"use strict";(self.webpackChunk_anaconda_assistant=self.webpackChunk_anaconda_assistant||[]).push([[589],{6589:(t,e,n)=>{n.r(e),n.d(e,{Environment:()=>l,backend:()=>a,tokens:()=>w});var a={};n.r(a),n.d(a,{BackendError:()=>i,InvalidJSONError:()=>d,backendFetch:()=>o,handleProxyResponse:()=>c});var r=n(2818),s=n(8671);async function o(t,e={},n={},a=!0){try{const o=await async function(t,e,n){const a=r.ServerConnection.makeSettings();let o=s.URLExt.join(a.baseUrl,t);const c=s.URLExt.objectToQueryString(e);return c&&(o+=c),await r.ServerConnection.makeRequest(o,n,a)}(t,e,n);return async function(t,e){if(!t.ok)return async function(t){const e=await t.text();let n;if(e.length>0)try{n=JSON.parse(e)}catch(t){console.warn("Received an error message that isn't JSON",e)}throw new i(`Network request returned a ${t.status} status`,{code:t.status,data:n})}(t);const n=await t.text();if(!e)return n;let a;if(n.length>0)try{a=JSON.parse(n)}catch(t){throw new d("Received a response that isn't JSON",{data:{rawText:n},underlying:t})}return a}(o,a)}catch(t){throw new i("Network request failed",{underlying:t})}}function c(t){let{remote_status_code:e,remote_data:n}=t;if(e<200||e>=300)throw new i(`Proxied network request returned a ${e} status`,{code:e,data:t});return n}class i extends Error{statusCode;data;constructor(t,{code:e,data:n,underlying:a}){super(t,{cause:a}),this.statusCode=e,this.data=n}}class d extends i{}const u=new(n(7930).Token)("@anaconda/core");var l;!function(t){t.development="development",t.staging="staging",t.production="production",t.local="local"}(l||(l={}));const w={CoreToken:u}}}]);