@nhost/nhost-js 0.3.10 → 0.3.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -36,7 +36,7 @@ const nhost = new NhostClient({
36
36
 
37
37
  ### GraphQL
38
38
 
39
- Access Nhost Auth methods using `nhost.graphql`.
39
+ Access Nhost GraphQL methods using `nhost.graphql`.
40
40
 
41
41
  ### Authentication
42
42
 
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts", "../src/core/nhost-client.ts", "../src/clients/functions.ts", "../src/clients/graphql.ts"],
4
4
  "sourcesContent": ["import { NhostClient, NhostClientConstructorParams } from './core'\n\nconst createClient = (config: NhostClientConstructorParams) => new NhostClient(config)\n\nexport * from './core'\nexport { createClient }\n", "import { ClientStorage, ClientStorageType, HasuraAuthClient } from '@nhost/hasura-auth-js'\nimport { HasuraStorageClient } from '@nhost/hasura-storage-js'\n\nimport { NhostFunctionsClient } from '../clients/functions'\nimport { NhostGraphqlClient } from '../clients/graphql'\n\nexport interface NhostClientConstructorParams {\n backendUrl: string\n refreshIntervalTime?: number\n clientStorage?: ClientStorage\n clientStorageType?: ClientStorageType\n autoRefreshToken?: boolean\n autoLogin?: boolean\n}\n\nexport class NhostClient {\n auth: HasuraAuthClient\n storage: HasuraStorageClient\n functions: NhostFunctionsClient\n graphql: NhostGraphqlClient\n\n /**\n * Nhost Client\n *\n * @example\n * const nhost = new NhostClient({ url });\n *\n * @docs https://docs.nhost.io/TODO\n */\n constructor(params: NhostClientConstructorParams) {\n if (!params.backendUrl) throw new Error('Please specify a `backendUrl`. Docs: [todo]!')\n\n const {\n backendUrl,\n refreshIntervalTime,\n clientStorage,\n clientStorageType,\n autoRefreshToken,\n autoLogin\n } = params\n\n this.auth = new HasuraAuthClient({\n url: `${backendUrl}/v1/auth`,\n refreshIntervalTime,\n clientStorage,\n clientStorageType,\n autoRefreshToken,\n autoLogin\n })\n\n this.storage = new HasuraStorageClient({\n url: `${backendUrl}/v1/storage`\n })\n\n this.functions = new NhostFunctionsClient({\n url: `${backendUrl}/v1/functions`\n })\n\n this.graphql = new NhostGraphqlClient({\n url: `${backendUrl}/v1/graphql`\n })\n\n // set current token if token is already accessable\n this.storage.setAccessToken(this.auth.getAccessToken())\n this.functions.setAccessToken(this.auth.getAccessToken())\n this.graphql.setAccessToken(this.auth.getAccessToken())\n\n // update access token for clients\n this.auth.onAuthStateChanged((_event, session) => {\n this.storage.setAccessToken(session?.accessToken)\n this.functions.setAccessToken(session?.accessToken)\n this.graphql.setAccessToken(session?.accessToken)\n })\n\n // update access token for clients\n this.auth.onTokenChanged((session) => {\n this.storage.setAccessToken(session?.accessToken)\n this.functions.setAccessToken(session?.accessToken)\n this.graphql.setAccessToken(session?.accessToken)\n })\n }\n}\n", "import axios, { AxiosInstance, AxiosRequestConfig } from 'axios'\n\nimport { FunctionCallResponse } from '../types'\nexport interface NhostFunctionsConstructorParams {\n url: string\n}\n\nexport class NhostFunctionsClient {\n private instance: AxiosInstance\n private accessToken: string | null\n\n constructor(params: NhostFunctionsConstructorParams) {\n const { url } = params\n\n this.accessToken = null\n this.instance = axios.create({\n baseURL: url\n })\n }\n\n async call(url: string, data: any, config?: AxiosRequestConfig): Promise<FunctionCallResponse> {\n const headers = {\n ...this.generateAccessTokenHeaders(),\n ...config?.headers\n }\n\n let res\n try {\n res = await this.instance.post(url, data, { ...config, headers })\n } catch (error) {\n if (error instanceof Error) {\n return { res: null, error }\n }\n }\n\n if (!res) {\n return {\n res: null,\n error: new Error('Unable to make post request to funtion')\n }\n }\n\n return { res, error: null }\n }\n\n setAccessToken(accessToken: string | undefined) {\n if (!accessToken) {\n this.accessToken = null\n return\n }\n\n this.accessToken = accessToken\n }\n\n private generateAccessTokenHeaders(): { Authorization: string } | undefined {\n if (!this.accessToken) {\n return\n }\n\n // eslint-disable-next-line consistent-return\n return {\n Authorization: `Bearer ${this.accessToken}`\n }\n }\n}\n", "import axios, { AxiosInstance, AxiosRequestConfig } from 'axios'\n\nimport { GraphqlRequestResponse, GraphqlResponse } from '../types'\n\nexport interface NhostGraphqlConstructorParams {\n url: string\n}\n\nexport class NhostGraphqlClient {\n private url: string\n private instance: AxiosInstance\n private accessToken: string | null\n\n constructor(params: NhostGraphqlConstructorParams) {\n const { url } = params\n\n this.url = url\n this.accessToken = null\n this.instance = axios.create({\n baseURL: url\n })\n }\n\n async request(\n document: string,\n variables?: any,\n config?: AxiosRequestConfig\n ): Promise<GraphqlRequestResponse> {\n // add auth headers if any\n const headers = {\n ...config?.headers,\n ...this.generateAccessTokenHeaders()\n }\n\n const operationName = ''\n\n let responseData\n try {\n const res = await this.instance.post(\n '',\n {\n operationName: operationName || undefined,\n query: document,\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n variables\n },\n { ...config, headers }\n )\n\n responseData = res.data\n } catch (error) {\n if (error instanceof Error) {\n return { data: null, error }\n }\n console.error(error)\n return {\n data: null,\n error: new Error('Unable to get do GraphQL request')\n }\n }\n\n if (typeof responseData !== 'object' || Array.isArray(responseData) || responseData === null) {\n return {\n data: null,\n error: new Error('incorrect response data from GraphQL server')\n }\n }\n\n responseData = responseData as GraphqlResponse\n\n if (responseData.errors) {\n return {\n data: null,\n error: responseData.errors\n }\n }\n\n return { data: responseData.data, error: null }\n }\n\n getUrl(): string {\n return this.url\n }\n\n setAccessToken(accessToken: string | undefined) {\n if (!accessToken) {\n this.accessToken = null\n return\n }\n\n this.accessToken = accessToken\n }\n\n private generateAccessTokenHeaders() {\n if (!this.accessToken) {\n return\n }\n\n // eslint-disable-next-line consistent-return\n return {\n Authorization: `Bearer ${this.accessToken}`\n }\n }\n}\n"],
5
- "mappings": "wgCAAA,qDCAA,MAAmE,iCACnE,EAAoC,oCCDpC,MAAyD,oBAOlD,OAA2B,CAIhC,YAAY,EAAyC,CACnD,GAAM,CAAE,OAAQ,EAEhB,KAAK,YAAc,KACnB,KAAK,SAAW,UAAM,OAAO,CAC3B,QAAS,SAIP,MAAK,EAAa,EAAW,EAA4D,CAC7F,GAAM,GAAU,OACX,KAAK,8BACL,iBAAQ,SAGT,EACJ,GAAI,CACF,EAAM,KAAM,MAAK,SAAS,KAAK,EAAK,EAAM,OAAK,GAAL,CAAa,mBAChD,EAAP,CACA,GAAI,YAAiB,OACnB,MAAO,CAAE,IAAK,KAAM,SAIxB,MAAK,GAOE,CAAE,MAAK,MAAO,MANZ,CACL,IAAK,KACL,MAAO,GAAI,OAAM,2CAOvB,eAAe,EAAiC,CAC9C,GAAI,CAAC,EAAa,CAChB,KAAK,YAAc,KACnB,OAGF,KAAK,YAAc,EAGb,4BAAoE,CAC1E,GAAI,EAAC,KAAK,YAKV,MAAO,CACL,cAAe,UAAU,KAAK,iBC7DpC,MAAyD,oBAQlD,OAAyB,CAK9B,YAAY,EAAuC,CACjD,GAAM,CAAE,OAAQ,EAEhB,KAAK,IAAM,EACX,KAAK,YAAc,KACnB,KAAK,SAAW,UAAM,OAAO,CAC3B,QAAS,SAIP,SACJ,EACA,EACA,EACiC,CAEjC,GAAM,GAAU,OACX,iBAAQ,SACR,KAAK,8BAGJ,EAAgB,GAElB,EACJ,GAAI,CAYF,EAAe,AAXH,MAAM,MAAK,SAAS,KAC9B,GACA,CACE,cAAe,GAAiB,OAChC,MAAO,EAEP,aAEF,OAAK,GAAL,CAAa,cAGI,WACZ,EAAP,CACA,MAAI,aAAiB,OACZ,CAAE,KAAM,KAAM,SAEvB,SAAQ,MAAM,GACP,CACL,KAAM,KACN,MAAO,GAAI,OAAM,sCAIrB,MAAI,OAAO,IAAiB,UAAY,MAAM,QAAQ,IAAiB,IAAiB,KAC/E,CACL,KAAM,KACN,MAAO,GAAI,OAAM,gDAIrB,GAAe,EAEX,EAAa,OACR,CACL,KAAM,KACN,MAAO,EAAa,QAIjB,CAAE,KAAM,EAAa,KAAM,MAAO,OAG3C,QAAiB,CACf,MAAO,MAAK,IAGd,eAAe,EAAiC,CAC9C,GAAI,CAAC,EAAa,CAChB,KAAK,YAAc,KACnB,OAGF,KAAK,YAAc,EAGb,4BAA6B,CACnC,GAAI,EAAC,KAAK,YAKV,MAAO,CACL,cAAe,UAAU,KAAK,iBFrF7B,WAAkB,CAcvB,YAAY,EAAsC,CAChD,GAAI,CAAC,EAAO,WAAY,KAAM,IAAI,OAAM,gDAExC,GAAM,CACJ,aACA,sBACA,gBACA,oBACA,mBACA,aACE,EAEJ,KAAK,KAAO,GAAI,oBAAiB,CAC/B,IAAK,GAAG,YACR,sBACA,gBACA,oBACA,mBACA,cAGF,KAAK,QAAU,GAAI,uBAAoB,CACrC,IAAK,GAAG,iBAGV,KAAK,UAAY,GAAI,GAAqB,CACxC,IAAK,GAAG,mBAGV,KAAK,QAAU,GAAI,GAAmB,CACpC,IAAK,GAAG,iBAIV,KAAK,QAAQ,eAAe,KAAK,KAAK,kBACtC,KAAK,UAAU,eAAe,KAAK,KAAK,kBACxC,KAAK,QAAQ,eAAe,KAAK,KAAK,kBAGtC,KAAK,KAAK,mBAAmB,CAAC,EAAQ,IAAY,CAChD,KAAK,QAAQ,eAAe,iBAAS,aACrC,KAAK,UAAU,eAAe,iBAAS,aACvC,KAAK,QAAQ,eAAe,iBAAS,eAIvC,KAAK,KAAK,eAAe,AAAC,GAAY,CACpC,KAAK,QAAQ,eAAe,iBAAS,aACrC,KAAK,UAAU,eAAe,iBAAS,aACvC,KAAK,QAAQ,eAAe,iBAAS,iBD5E3C,GAAM,GAAe,AAAC,GAAyC,GAAI,GAAY",
5
+ "mappings": "wgCAAA,qDCAA,MAAmE,iCACnE,EAAoC,oCCDpC,MAAyD,oBAOlD,OAA2B,CAIhC,YAAY,EAAyC,CACnD,GAAM,CAAE,OAAQ,EAEhB,KAAK,YAAc,KACnB,KAAK,SAAW,UAAM,OAAO,CAC3B,QAAS,CACX,CAAC,CACH,MAEM,MAAK,EAAa,EAAW,EAA4D,CAC7F,GAAM,GAAU,OACX,KAAK,2BAA2B,GAChC,iBAAQ,SAGT,EACJ,GAAI,CACF,EAAM,KAAM,MAAK,SAAS,KAAK,EAAK,EAAM,OAAK,GAAL,CAAa,SAAQ,EAAC,CAClE,OAAS,EAAP,CACA,GAAI,YAAiB,OACnB,MAAO,CAAE,IAAK,KAAM,OAAM,CAE9B,CAEA,MAAK,GAOE,CAAE,MAAK,MAAO,IAAK,EANjB,CACL,IAAK,KACL,MAAO,GAAI,OAAM,wCAAwC,CAC3D,CAIJ,CAEA,eAAe,EAAiC,CAC9C,GAAI,CAAC,EAAa,CAChB,KAAK,YAAc,KACnB,MACF,CAEA,KAAK,YAAc,CACrB,CAEQ,4BAAoE,CAC1E,GAAI,EAAC,KAAK,YAKV,MAAO,CACL,cAAe,UAAU,KAAK,aAChC,CACF,CACF,EChEA,MAAyD,oBAQlD,OAAyB,CAK9B,YAAY,EAAuC,CACjD,GAAM,CAAE,OAAQ,EAEhB,KAAK,IAAM,EACX,KAAK,YAAc,KACnB,KAAK,SAAW,UAAM,OAAO,CAC3B,QAAS,CACX,CAAC,CACH,MAEM,SACJ,EACA,EACA,EACiC,CAEjC,GAAM,GAAU,OACX,iBAAQ,SACR,KAAK,2BAA2B,GAG/B,EAAgB,GAElB,EACJ,GAAI,CAYF,EAAe,AAXH,MAAM,MAAK,SAAS,KAC9B,GACA,CACE,cAAe,GAAiB,OAChC,MAAO,EAEP,WACF,EACA,OAAK,GAAL,CAAa,SAAQ,EACvB,GAEmB,IACrB,OAAS,EAAP,CACA,MAAI,aAAiB,OACZ,CAAE,KAAM,KAAM,OAAM,EAE7B,SAAQ,MAAM,CAAK,EACZ,CACL,KAAM,KACN,MAAO,GAAI,OAAM,kCAAkC,CACrD,EACF,CAEA,MAAI,OAAO,IAAiB,UAAY,MAAM,QAAQ,CAAY,GAAK,IAAiB,KAC/E,CACL,KAAM,KACN,MAAO,GAAI,OAAM,6CAA6C,CAChE,EAGF,GAAe,EAEX,EAAa,OACR,CACL,KAAM,KACN,MAAO,EAAa,MACtB,EAGK,CAAE,KAAM,EAAa,KAAM,MAAO,IAAK,EAChD,CAEA,QAAiB,CACf,MAAO,MAAK,GACd,CAEA,eAAe,EAAiC,CAC9C,GAAI,CAAC,EAAa,CAChB,KAAK,YAAc,KACnB,MACF,CAEA,KAAK,YAAc,CACrB,CAEQ,4BAA6B,CACnC,GAAI,EAAC,KAAK,YAKV,MAAO,CACL,cAAe,UAAU,KAAK,aAChC,CACF,CACF,EFxFO,WAAkB,CAcvB,YAAY,EAAsC,CAChD,GAAI,CAAC,EAAO,WAAY,KAAM,IAAI,OAAM,8CAA8C,EAEtF,GAAM,CACJ,aACA,sBACA,gBACA,oBACA,mBACA,aACE,EAEJ,KAAK,KAAO,GAAI,oBAAiB,CAC/B,IAAK,GAAG,YACR,sBACA,gBACA,oBACA,mBACA,WACF,CAAC,EAED,KAAK,QAAU,GAAI,uBAAoB,CACrC,IAAK,GAAG,cACV,CAAC,EAED,KAAK,UAAY,GAAI,GAAqB,CACxC,IAAK,GAAG,gBACV,CAAC,EAED,KAAK,QAAU,GAAI,GAAmB,CACpC,IAAK,GAAG,cACV,CAAC,EAGD,KAAK,QAAQ,eAAe,KAAK,KAAK,eAAe,CAAC,EACtD,KAAK,UAAU,eAAe,KAAK,KAAK,eAAe,CAAC,EACxD,KAAK,QAAQ,eAAe,KAAK,KAAK,eAAe,CAAC,EAGtD,KAAK,KAAK,mBAAmB,CAAC,EAAQ,IAAY,CAChD,KAAK,QAAQ,eAAe,iBAAS,WAAW,EAChD,KAAK,UAAU,eAAe,iBAAS,WAAW,EAClD,KAAK,QAAQ,eAAe,iBAAS,WAAW,CAClD,CAAC,EAGD,KAAK,KAAK,eAAe,AAAC,GAAY,CACpC,KAAK,QAAQ,eAAe,iBAAS,WAAW,EAChD,KAAK,UAAU,eAAe,iBAAS,WAAW,EAClD,KAAK,QAAQ,eAAe,iBAAS,WAAW,CAClD,CAAC,CACH,CACF,ED/EA,GAAM,GAAe,AAAC,GAAyC,GAAI,GAAY,CAAM",
6
6
  "names": []
7
7
  }
package/dist/index.es.js CHANGED
@@ -1,5 +1,5 @@
1
- var or=Object.create;var oe=Object.defineProperty;var ir=Object.getOwnPropertyDescriptor;var ar=Object.getOwnPropertyNames;var ur=Object.getPrototypeOf,cr=Object.prototype.hasOwnProperty;var lr=r=>oe(r,"__esModule",{value:!0});var j=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var fr=(r,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of ar(e))!cr.call(r,n)&&(t||n!=="default")&&oe(r,n,{get:()=>e[n],enumerable:!(o=ir(e,n))||o.enumerable});return r},Pe=(r,e)=>fr(lr(oe(r!=null?or(ur(r)):{},"default",!e&&r&&r.__esModule?{get:()=>r.default,enumerable:!0}:{value:r,enumerable:!0})),r);var ce=j((bs,Ye)=>{"use strict";Ye.exports=function(e,t){return function(){for(var n=new Array(arguments.length),i=0;i<n.length;i++)n[i]=arguments[i];return e.apply(t,n)}}});var L=j((ws,tt)=>{"use strict";var En=ce(),M=Object.prototype.toString;function he(r){return M.call(r)==="[object Array]"}function le(r){return typeof r>"u"}function kn(r){return r!==null&&!le(r)&&r.constructor!==null&&!le(r.constructor)&&typeof r.constructor.isBuffer=="function"&&r.constructor.isBuffer(r)}function Cn(r){return M.call(r)==="[object ArrayBuffer]"}function Tn(r){return typeof FormData<"u"&&r instanceof FormData}function An(r){var e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(r):e=r&&r.buffer&&r.buffer instanceof ArrayBuffer,e}function On(r){return typeof r=="string"}function jn(r){return typeof r=="number"}function Ze(r){return r!==null&&typeof r=="object"}function Y(r){if(M.call(r)!=="[object Object]")return!1;var e=Object.getPrototypeOf(r);return e===null||e===Object.prototype}function Nn(r){return M.call(r)==="[object Date]"}function Rn(r){return M.call(r)==="[object File]"}function Pn(r){return M.call(r)==="[object Blob]"}function et(r){return M.call(r)==="[object Function]"}function In(r){return Ze(r)&&et(r.pipe)}function qn(r){return typeof URLSearchParams<"u"&&r instanceof URLSearchParams}function Un(r){return r.trim?r.trim():r.replace(/^\s+|\s+$/g,"")}function Ln(){return typeof navigator<"u"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window<"u"&&typeof document<"u"}function pe(r,e){if(!(r===null||typeof r>"u"))if(typeof r!="object"&&(r=[r]),he(r))for(var t=0,o=r.length;t<o;t++)e.call(null,r[t],t,r);else for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.call(null,r[n],n,r)}function fe(){var r={};function e(n,i){Y(r[i])&&Y(n)?r[i]=fe(r[i],n):Y(n)?r[i]=fe({},n):he(n)?r[i]=n.slice():r[i]=n}for(var t=0,o=arguments.length;t<o;t++)pe(arguments[t],e);return r}function Fn(r,e,t){return pe(e,function(n,i){t&&typeof n=="function"?r[i]=En(n,t):r[i]=n}),r}function Bn(r){return r.charCodeAt(0)===65279&&(r=r.slice(1)),r}tt.exports={isArray:he,isArrayBuffer:Cn,isBuffer:kn,isFormData:Tn,isArrayBufferView:An,isString:On,isNumber:jn,isObject:Ze,isPlainObject:Y,isUndefined:le,isDate:Nn,isFile:Rn,isBlob:Pn,isFunction:et,isStream:In,isURLSearchParams:qn,isStandardBrowserEnv:Ln,forEach:pe,merge:fe,extend:Fn,trim:Un,stripBOM:Bn}});var de=j((xs,nt)=>{"use strict";var J=L();function rt(r){return encodeURIComponent(r).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}nt.exports=function(e,t,o){if(!t)return e;var n;if(o)n=o(t);else if(J.isURLSearchParams(t))n=t.toString();else{var i=[];J.forEach(t,function(u,l){u===null||typeof u>"u"||(J.isArray(u)?l=l+"[]":u=[u],J.forEach(u,function(p){J.isDate(p)?p=p.toISOString():J.isObject(p)&&(p=JSON.stringify(p)),i.push(rt(l)+"="+rt(p))}))}),n=i.join("&")}if(n){var a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+n}return e}});var ot=j((Ss,st)=>{"use strict";var _n=L();function Z(){this.handlers=[]}Z.prototype.use=function(e,t,o){return this.handlers.push({fulfilled:e,rejected:t,synchronous:o?o.synchronous:!1,runWhen:o?o.runWhen:null}),this.handlers.length-1};Z.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)};Z.prototype.forEach=function(e){_n.forEach(this.handlers,function(o){o!==null&&e(o)})};st.exports=Z});var at=j((Es,it)=>{"use strict";var Dn=L();it.exports=function(e,t){Dn.forEach(e,function(n,i){i!==t&&i.toUpperCase()===t.toUpperCase()&&(e[t]=n,delete e[i])})}});var me=j((ks,ut)=>{"use strict";ut.exports=function(e,t,o,n,i){return e.config=t,o&&(e.code=o),e.request=n,e.response=i,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}},e}});var ge=j((Cs,ct)=>{"use strict";var Hn=me();ct.exports=function(e,t,o,n,i){var a=new Error(e);return Hn(a,t,o,n,i)}});var ft=j((Ts,lt)=>{"use strict";var Mn=ge();lt.exports=function(e,t,o){var n=o.config.validateStatus;!o.status||!n||n(o.status)?e(o):t(Mn("Request failed with status code "+o.status,o.config,null,o.request,o))}});var pt=j((As,ht)=>{"use strict";var ee=L();ht.exports=ee.isStandardBrowserEnv()?function(){return{write:function(t,o,n,i,a,c){var u=[];u.push(t+"="+encodeURIComponent(o)),ee.isNumber(n)&&u.push("expires="+new Date(n).toGMTString()),ee.isString(i)&&u.push("path="+i),ee.isString(a)&&u.push("domain="+a),c===!0&&u.push("secure"),document.cookie=u.join("; ")},read:function(t){var o=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return o?decodeURIComponent(o[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()});var mt=j((Os,dt)=>{"use strict";dt.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}});var vt=j((js,gt)=>{"use strict";gt.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}});var bt=j((Ns,yt)=>{"use strict";var Jn=mt(),$n=vt();yt.exports=function(e,t){return e&&!Jn(t)?$n(e,t):t}});var xt=j((Rs,wt)=>{"use strict";var ve=L(),zn=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];wt.exports=function(e){var t={},o,n,i;return e&&ve.forEach(e.split(`
2
- `),function(c){if(i=c.indexOf(":"),o=ve.trim(c.substr(0,i)).toLowerCase(),n=ve.trim(c.substr(i+1)),o){if(t[o]&&zn.indexOf(o)>=0)return;o==="set-cookie"?t[o]=(t[o]?t[o]:[]).concat([n]):t[o]=t[o]?t[o]+", "+n:n}}),t}});var kt=j((Ps,Et)=>{"use strict";var St=L();Et.exports=St.isStandardBrowserEnv()?function(){var e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a"),o;function n(i){var a=i;return e&&(t.setAttribute("href",a),a=t.href),t.setAttribute("href",a),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:t.pathname.charAt(0)==="/"?t.pathname:"/"+t.pathname}}return o=n(window.location.href),function(a){var c=St.isString(a)?n(a):a;return c.protocol===o.protocol&&c.host===o.host}}():function(){return function(){return!0}}()});var V=j((Is,Ct)=>{"use strict";function ye(r){this.message=r}ye.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")};ye.prototype.__CANCEL__=!0;Ct.exports=ye});var we=j((qs,Tt)=>{"use strict";var te=L(),Vn=ft(),Gn=pt(),Wn=de(),Xn=bt(),Kn=xt(),Qn=kt(),be=ge(),Yn=G(),Zn=V();Tt.exports=function(e){return new Promise(function(o,n){var i=e.data,a=e.headers,c=e.responseType,u;function l(){e.cancelToken&&e.cancelToken.unsubscribe(u),e.signal&&e.signal.removeEventListener("abort",u)}te.isFormData(i)&&delete a["Content-Type"];var s=new XMLHttpRequest;if(e.auth){var p=e.auth.username||"",h=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";a.Authorization="Basic "+btoa(p+":"+h)}var x=Xn(e.baseURL,e.url);s.open(e.method.toUpperCase(),Wn(x,e.params,e.paramsSerializer),!0),s.timeout=e.timeout;function y(){if(!!s){var b="getAllResponseHeaders"in s?Kn(s.getAllResponseHeaders()):null,T=!c||c==="text"||c==="json"?s.responseText:s.response,m={data:T,status:s.status,statusText:s.statusText,headers:b,config:e,request:s};Vn(function(d){o(d),l()},function(d){n(d),l()},m),s=null}}if("onloadend"in s?s.onloadend=y:s.onreadystatechange=function(){!s||s.readyState!==4||s.status===0&&!(s.responseURL&&s.responseURL.indexOf("file:")===0)||setTimeout(y)},s.onabort=function(){!s||(n(be("Request aborted",e,"ECONNABORTED",s)),s=null)},s.onerror=function(){n(be("Network Error",e,null,s)),s=null},s.ontimeout=function(){var T=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",m=e.transitional||Yn.transitional;e.timeoutErrorMessage&&(T=e.timeoutErrorMessage),n(be(T,e,m.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",s)),s=null},te.isStandardBrowserEnv()){var S=(e.withCredentials||Qn(x))&&e.xsrfCookieName?Gn.read(e.xsrfCookieName):void 0;S&&(a[e.xsrfHeaderName]=S)}"setRequestHeader"in s&&te.forEach(a,function(T,m){typeof i>"u"&&m.toLowerCase()==="content-type"?delete a[m]:s.setRequestHeader(m,T)}),te.isUndefined(e.withCredentials)||(s.withCredentials=!!e.withCredentials),c&&c!=="json"&&(s.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&s.addEventListener("progress",e.onDownloadProgress),typeof e.onUploadProgress=="function"&&s.upload&&s.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(u=function(b){!s||(n(!b||b&&b.type?new Zn("canceled"):b),s.abort(),s=null)},e.cancelToken&&e.cancelToken.subscribe(u),e.signal&&(e.signal.aborted?u():e.signal.addEventListener("abort",u))),i||(i=null),s.send(i)})}});var G=j((Us,jt)=>{"use strict";var q=L(),At=at(),es=me(),ts={"Content-Type":"application/x-www-form-urlencoded"};function Ot(r,e){!q.isUndefined(r)&&q.isUndefined(r["Content-Type"])&&(r["Content-Type"]=e)}function rs(){var r;return typeof XMLHttpRequest<"u"?r=we():typeof process<"u"&&Object.prototype.toString.call(process)==="[object process]"&&(r=we()),r}function ns(r,e,t){if(q.isString(r))try{return(e||JSON.parse)(r),q.trim(r)}catch(o){if(o.name!=="SyntaxError")throw o}return(t||JSON.stringify)(r)}var re={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:rs(),transformRequest:[function(e,t){return At(t,"Accept"),At(t,"Content-Type"),q.isFormData(e)||q.isArrayBuffer(e)||q.isBuffer(e)||q.isStream(e)||q.isFile(e)||q.isBlob(e)?e:q.isArrayBufferView(e)?e.buffer:q.isURLSearchParams(e)?(Ot(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):q.isObject(e)||t&&t["Content-Type"]==="application/json"?(Ot(t,"application/json"),ns(e)):e}],transformResponse:[function(e){var t=this.transitional||re.transitional,o=t&&t.silentJSONParsing,n=t&&t.forcedJSONParsing,i=!o&&this.responseType==="json";if(i||n&&q.isString(e)&&e.length)try{return JSON.parse(e)}catch(a){if(i)throw a.name==="SyntaxError"?es(a,this,"E_JSON_PARSE"):a}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};q.forEach(["delete","get","head"],function(e){re.headers[e]={}});q.forEach(["post","put","patch"],function(e){re.headers[e]=q.merge(ts)});jt.exports=re});var Rt=j((Ls,Nt)=>{"use strict";var ss=L(),os=G();Nt.exports=function(e,t,o){var n=this||os;return ss.forEach(o,function(a){e=a.call(n,e,t)}),e}});var xe=j((Fs,Pt)=>{"use strict";Pt.exports=function(e){return!!(e&&e.__CANCEL__)}});var Ut=j((Bs,qt)=>{"use strict";var It=L(),Se=Rt(),is=xe(),as=G(),us=V();function Ee(r){if(r.cancelToken&&r.cancelToken.throwIfRequested(),r.signal&&r.signal.aborted)throw new us("canceled")}qt.exports=function(e){Ee(e),e.headers=e.headers||{},e.data=Se.call(e,e.data,e.headers,e.transformRequest),e.headers=It.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),It.forEach(["delete","get","head","post","put","patch","common"],function(n){delete e.headers[n]});var t=e.adapter||as.adapter;return t(e).then(function(n){return Ee(e),n.data=Se.call(e,n.data,n.headers,e.transformResponse),n},function(n){return is(n)||(Ee(e),n&&n.response&&(n.response.data=Se.call(e,n.response.data,n.response.headers,e.transformResponse))),Promise.reject(n)})}});var ke=j((_s,Lt)=>{"use strict";var _=L();Lt.exports=function(e,t){t=t||{};var o={};function n(s,p){return _.isPlainObject(s)&&_.isPlainObject(p)?_.merge(s,p):_.isPlainObject(p)?_.merge({},p):_.isArray(p)?p.slice():p}function i(s){if(_.isUndefined(t[s])){if(!_.isUndefined(e[s]))return n(void 0,e[s])}else return n(e[s],t[s])}function a(s){if(!_.isUndefined(t[s]))return n(void 0,t[s])}function c(s){if(_.isUndefined(t[s])){if(!_.isUndefined(e[s]))return n(void 0,e[s])}else return n(void 0,t[s])}function u(s){if(s in t)return n(e[s],t[s]);if(s in e)return n(void 0,e[s])}var l={url:a,method:a,data:a,baseURL:c,transformRequest:c,transformResponse:c,paramsSerializer:c,timeout:c,timeoutMessage:c,withCredentials:c,adapter:c,responseType:c,xsrfCookieName:c,xsrfHeaderName:c,onUploadProgress:c,onDownloadProgress:c,decompress:c,maxContentLength:c,maxBodyLength:c,transport:c,httpAgent:c,httpsAgent:c,cancelToken:c,socketPath:c,responseEncoding:c,validateStatus:u};return _.forEach(Object.keys(e).concat(Object.keys(t)),function(p){var h=l[p]||i,x=h(p);_.isUndefined(x)&&h!==u||(o[p]=x)}),o}});var Ce=j((Ds,Ft)=>{Ft.exports={version:"0.23.0"}});var Dt=j((Hs,_t)=>{"use strict";var cs=Ce().version,Te={};["object","boolean","number","function","string","symbol"].forEach(function(r,e){Te[r]=function(o){return typeof o===r||"a"+(e<1?"n ":" ")+r}});var Bt={};Te.transitional=function(e,t,o){function n(i,a){return"[Axios v"+cs+"] Transitional option '"+i+"'"+a+(o?". "+o:"")}return function(i,a,c){if(e===!1)throw new Error(n(a," has been removed"+(t?" in "+t:"")));return t&&!Bt[a]&&(Bt[a]=!0,console.warn(n(a," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(i,a,c):!0}};function ls(r,e,t){if(typeof r!="object")throw new TypeError("options must be an object");for(var o=Object.keys(r),n=o.length;n-- >0;){var i=o[n],a=e[i];if(a){var c=r[i],u=c===void 0||a(c,i,r);if(u!==!0)throw new TypeError("option "+i+" must be "+u);continue}if(t!==!0)throw Error("Unknown option "+i)}}_t.exports={assertOptions:ls,validators:Te}});var Vt=j((Ms,zt)=>{"use strict";var Jt=L(),fs=de(),Ht=ot(),Mt=Ut(),ne=ke(),$t=Dt(),$=$t.validators;function W(r){this.defaults=r,this.interceptors={request:new Ht,response:new Ht}}W.prototype.request=function(e){typeof e=="string"?(e=arguments[1]||{},e.url=arguments[0]):e=e||{},e=ne(this.defaults,e),e.method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=e.transitional;t!==void 0&&$t.assertOptions(t,{silentJSONParsing:$.transitional($.boolean),forcedJSONParsing:$.transitional($.boolean),clarifyTimeoutError:$.transitional($.boolean)},!1);var o=[],n=!0;this.interceptors.request.forEach(function(h){typeof h.runWhen=="function"&&h.runWhen(e)===!1||(n=n&&h.synchronous,o.unshift(h.fulfilled,h.rejected))});var i=[];this.interceptors.response.forEach(function(h){i.push(h.fulfilled,h.rejected)});var a;if(!n){var c=[Mt,void 0];for(Array.prototype.unshift.apply(c,o),c=c.concat(i),a=Promise.resolve(e);c.length;)a=a.then(c.shift(),c.shift());return a}for(var u=e;o.length;){var l=o.shift(),s=o.shift();try{u=l(u)}catch(p){s(p);break}}try{a=Mt(u)}catch(p){return Promise.reject(p)}for(;i.length;)a=a.then(i.shift(),i.shift());return a};W.prototype.getUri=function(e){return e=ne(this.defaults,e),fs(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")};Jt.forEach(["delete","get","head","options"],function(e){W.prototype[e]=function(t,o){return this.request(ne(o||{},{method:e,url:t,data:(o||{}).data}))}});Jt.forEach(["post","put","patch"],function(e){W.prototype[e]=function(t,o,n){return this.request(ne(n||{},{method:e,url:t,data:o}))}});zt.exports=W});var Wt=j((Js,Gt)=>{"use strict";var hs=V();function z(r){if(typeof r!="function")throw new TypeError("executor must be a function.");var e;this.promise=new Promise(function(n){e=n});var t=this;this.promise.then(function(o){if(!!t._listeners){var n,i=t._listeners.length;for(n=0;n<i;n++)t._listeners[n](o);t._listeners=null}}),this.promise.then=function(o){var n,i=new Promise(function(a){t.subscribe(a),n=a}).then(o);return i.cancel=function(){t.unsubscribe(n)},i},r(function(n){t.reason||(t.reason=new hs(n),e(t.reason))})}z.prototype.throwIfRequested=function(){if(this.reason)throw this.reason};z.prototype.subscribe=function(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]};z.prototype.unsubscribe=function(e){if(!!this._listeners){var t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}};z.source=function(){var e,t=new z(function(n){e=n});return{token:t,cancel:e}};Gt.exports=z});var Kt=j(($s,Xt)=>{"use strict";Xt.exports=function(e){return function(o){return e.apply(null,o)}}});var Yt=j((zs,Qt)=>{"use strict";Qt.exports=function(e){return typeof e=="object"&&e.isAxiosError===!0}});var tr=j((Vs,Ae)=>{"use strict";var Zt=L(),ps=ce(),se=Vt(),ds=ke(),ms=G();function er(r){var e=new se(r),t=ps(se.prototype.request,e);return Zt.extend(t,se.prototype,e),Zt.extend(t,e),t.create=function(n){return er(ds(r,n))},t}var D=er(ms);D.Axios=se;D.Cancel=V();D.CancelToken=Wt();D.isCancel=xe();D.VERSION=Ce().version;D.all=function(e){return Promise.all(e)};D.spread=Kt();D.isAxiosError=Yt();Ae.exports=D;Ae.exports.default=D});var Oe=j((Gs,rr)=>{rr.exports=tr()});var hr=Object.create,ie=Object.defineProperty,pr=Object.getOwnPropertyDescriptor,dr=Object.getOwnPropertyNames,mr=Object.getPrototypeOf,gr=Object.prototype.hasOwnProperty,vr=r=>ie(r,"__esModule",{value:!0}),A=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),yr=(r,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of dr(e))!gr.call(r,n)&&(t||n!=="default")&&ie(r,n,{get:()=>e[n],enumerable:!(o=pr(e,n))||o.enumerable});return r},qe=(r,e)=>yr(vr(ie(r!=null?hr(mr(r)):{},"default",!e&&r&&r.__esModule?{get:()=>r.default,enumerable:!0}:{value:r,enumerable:!0})),r),Ue=A((r,e)=>{"use strict";e.exports=function(t,o){return function(){for(var n=new Array(arguments.length),i=0;i<n.length;i++)n[i]=arguments[i];return t.apply(o,n)}}}),U=A((r,e)=>{"use strict";var t=Ue(),o=Object.prototype.toString;function n(f){return Array.isArray(f)}function i(f){return typeof f>"u"}function a(f){return f!==null&&!i(f)&&f.constructor!==null&&!i(f.constructor)&&typeof f.constructor.isBuffer=="function"&&f.constructor.isBuffer(f)}function c(f){return o.call(f)==="[object ArrayBuffer]"}function u(f){return o.call(f)==="[object FormData]"}function l(f){var C;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?C=ArrayBuffer.isView(f):C=f&&f.buffer&&c(f.buffer),C}function s(f){return typeof f=="string"}function p(f){return typeof f=="number"}function h(f){return f!==null&&typeof f=="object"}function x(f){if(o.call(f)!=="[object Object]")return!1;var C=Object.getPrototypeOf(f);return C===null||C===Object.prototype}function y(f){return o.call(f)==="[object Date]"}function S(f){return o.call(f)==="[object File]"}function b(f){return o.call(f)==="[object Blob]"}function T(f){return o.call(f)==="[object Function]"}function m(f){return h(f)&&T(f.pipe)}function g(f){return o.call(f)==="[object URLSearchParams]"}function d(f){return f.trim?f.trim():f.replace(/^\s+|\s+$/g,"")}function v(){return typeof navigator<"u"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window<"u"&&typeof document<"u"}function w(f,C){if(!(f===null||typeof f>"u"))if(typeof f!="object"&&(f=[f]),n(f))for(var R=0,I=f.length;R<I;R++)C.call(null,f[R],R,f);else for(var O in f)Object.prototype.hasOwnProperty.call(f,O)&&C.call(null,f[O],O,f)}function k(){var f={};function C(O,F){x(f[F])&&x(O)?f[F]=k(f[F],O):x(O)?f[F]=k({},O):n(O)?f[F]=O.slice():f[F]=O}for(var R=0,I=arguments.length;R<I;R++)w(arguments[R],C);return f}function E(f,C,R){return w(C,function(I,O){R&&typeof I=="function"?f[O]=t(I,R):f[O]=I}),f}function P(f){return f.charCodeAt(0)===65279&&(f=f.slice(1)),f}e.exports={isArray:n,isArrayBuffer:c,isBuffer:a,isFormData:u,isArrayBufferView:l,isString:s,isNumber:p,isObject:h,isPlainObject:x,isUndefined:i,isDate:y,isFile:S,isBlob:b,isFunction:T,isStream:m,isURLSearchParams:g,isStandardBrowserEnv:v,forEach:w,merge:k,extend:E,trim:d,stripBOM:P}}),Le=A((r,e)=>{"use strict";var t=U();function o(n){return encodeURIComponent(n).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}e.exports=function(n,i,a){if(!i)return n;var c;if(a)c=a(i);else if(t.isURLSearchParams(i))c=i.toString();else{var u=[];t.forEach(i,function(s,p){s===null||typeof s>"u"||(t.isArray(s)?p=p+"[]":s=[s],t.forEach(s,function(h){t.isDate(h)?h=h.toISOString():t.isObject(h)&&(h=JSON.stringify(h)),u.push(o(p)+"="+o(h))}))}),c=u.join("&")}if(c){var l=n.indexOf("#");l!==-1&&(n=n.slice(0,l)),n+=(n.indexOf("?")===-1?"?":"&")+c}return n}}),br=A((r,e)=>{"use strict";var t=U();function o(){this.handlers=[]}o.prototype.use=function(n,i,a){return this.handlers.push({fulfilled:n,rejected:i,synchronous:a?a.synchronous:!1,runWhen:a?a.runWhen:null}),this.handlers.length-1},o.prototype.eject=function(n){this.handlers[n]&&(this.handlers[n]=null)},o.prototype.forEach=function(n){t.forEach(this.handlers,function(i){i!==null&&n(i)})},e.exports=o}),wr=A((r,e)=>{"use strict";var t=U();e.exports=function(o,n){t.forEach(o,function(i,a){a!==n&&a.toUpperCase()===n.toUpperCase()&&(o[n]=i,delete o[a])})}}),Fe=A((r,e)=>{"use strict";e.exports=function(t,o,n,i,a){return t.config=o,n&&(t.code=n),t.request=i,t.response=a,t.isAxiosError=!0,t.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}},t}}),Be=A((r,e)=>{"use strict";var t=Fe();e.exports=function(o,n,i,a,c){var u=new Error(o);return t(u,n,i,a,c)}}),xr=A((r,e)=>{"use strict";var t=Be();e.exports=function(o,n,i){var a=i.config.validateStatus;!i.status||!a||a(i.status)?o(i):n(t("Request failed with status code "+i.status,i.config,null,i.request,i))}}),Sr=A((r,e)=>{"use strict";var t=U();e.exports=t.isStandardBrowserEnv()?function(){return{write:function(o,n,i,a,c,u){var l=[];l.push(o+"="+encodeURIComponent(n)),t.isNumber(i)&&l.push("expires="+new Date(i).toGMTString()),t.isString(a)&&l.push("path="+a),t.isString(c)&&l.push("domain="+c),u===!0&&l.push("secure"),document.cookie=l.join("; ")},read:function(o){var n=document.cookie.match(new RegExp("(^|;\\s*)("+o+")=([^;]*)"));return n?decodeURIComponent(n[3]):null},remove:function(o){this.write(o,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()}),Er=A((r,e)=>{"use strict";e.exports=function(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}}),kr=A((r,e)=>{"use strict";e.exports=function(t,o){return o?t.replace(/\/+$/,"")+"/"+o.replace(/^\/+/,""):t}}),Cr=A((r,e)=>{"use strict";var t=Er(),o=kr();e.exports=function(n,i){return n&&!t(i)?o(n,i):i}}),Tr=A((r,e)=>{"use strict";var t=U(),o=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];e.exports=function(n){var i={},a,c,u;return n&&t.forEach(n.split(`
3
- `),function(l){if(u=l.indexOf(":"),a=t.trim(l.substr(0,u)).toLowerCase(),c=t.trim(l.substr(u+1)),a){if(i[a]&&o.indexOf(a)>=0)return;a==="set-cookie"?i[a]=(i[a]?i[a]:[]).concat([c]):i[a]=i[a]?i[a]+", "+c:c}}),i}}),Ar=A((r,e)=>{"use strict";var t=U();e.exports=t.isStandardBrowserEnv()?function(){var o=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a"),i;function a(c){var u=c;return o&&(n.setAttribute("href",u),u=n.href),n.setAttribute("href",u),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:n.pathname.charAt(0)==="/"?n.pathname:"/"+n.pathname}}return i=a(window.location.href),function(c){var u=t.isString(c)?a(c):c;return u.protocol===i.protocol&&u.host===i.host}}():function(){return function(){return!0}}()}),K=A((r,e)=>{"use strict";function t(o){this.message=o}t.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},t.prototype.__CANCEL__=!0,e.exports=t}),Ie=A((r,e)=>{"use strict";var t=U(),o=xr(),n=Sr(),i=Le(),a=Cr(),c=Tr(),u=Ar(),l=Be(),s=Q(),p=K();e.exports=function(h){return new Promise(function(x,y){var S=h.data,b=h.headers,T=h.responseType,m;function g(){h.cancelToken&&h.cancelToken.unsubscribe(m),h.signal&&h.signal.removeEventListener("abort",m)}t.isFormData(S)&&delete b["Content-Type"];var d=new XMLHttpRequest;if(h.auth){var v=h.auth.username||"",w=h.auth.password?unescape(encodeURIComponent(h.auth.password)):"";b.Authorization="Basic "+btoa(v+":"+w)}var k=a(h.baseURL,h.url);d.open(h.method.toUpperCase(),i(k,h.params,h.paramsSerializer),!0),d.timeout=h.timeout;function E(){if(d){var f="getAllResponseHeaders"in d?c(d.getAllResponseHeaders()):null,C=!T||T==="text"||T==="json"?d.responseText:d.response,R={data:C,status:d.status,statusText:d.statusText,headers:f,config:h,request:d};o(function(I){x(I),g()},function(I){y(I),g()},R),d=null}}if("onloadend"in d?d.onloadend=E:d.onreadystatechange=function(){!d||d.readyState!==4||d.status===0&&!(d.responseURL&&d.responseURL.indexOf("file:")===0)||setTimeout(E)},d.onabort=function(){!d||(y(l("Request aborted",h,"ECONNABORTED",d)),d=null)},d.onerror=function(){y(l("Network Error",h,null,d)),d=null},d.ontimeout=function(){var f=h.timeout?"timeout of "+h.timeout+"ms exceeded":"timeout exceeded",C=h.transitional||s.transitional;h.timeoutErrorMessage&&(f=h.timeoutErrorMessage),y(l(f,h,C.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",d)),d=null},t.isStandardBrowserEnv()){var P=(h.withCredentials||u(k))&&h.xsrfCookieName?n.read(h.xsrfCookieName):void 0;P&&(b[h.xsrfHeaderName]=P)}"setRequestHeader"in d&&t.forEach(b,function(f,C){typeof S>"u"&&C.toLowerCase()==="content-type"?delete b[C]:d.setRequestHeader(C,f)}),t.isUndefined(h.withCredentials)||(d.withCredentials=!!h.withCredentials),T&&T!=="json"&&(d.responseType=h.responseType),typeof h.onDownloadProgress=="function"&&d.addEventListener("progress",h.onDownloadProgress),typeof h.onUploadProgress=="function"&&d.upload&&d.upload.addEventListener("progress",h.onUploadProgress),(h.cancelToken||h.signal)&&(m=function(f){!d||(y(!f||f&&f.type?new p("canceled"):f),d.abort(),d=null)},h.cancelToken&&h.cancelToken.subscribe(m),h.signal&&(h.signal.aborted?m():h.signal.addEventListener("abort",m))),S||(S=null),d.send(S)})}}),Q=A((r,e)=>{"use strict";var t=U(),o=wr(),n=Fe(),i={"Content-Type":"application/x-www-form-urlencoded"};function a(s,p){!t.isUndefined(s)&&t.isUndefined(s["Content-Type"])&&(s["Content-Type"]=p)}function c(){var s;return(typeof XMLHttpRequest<"u"||typeof process<"u"&&Object.prototype.toString.call(process)==="[object process]")&&(s=Ie()),s}function u(s,p,h){if(t.isString(s))try{return(p||JSON.parse)(s),t.trim(s)}catch(x){if(x.name!=="SyntaxError")throw x}return(h||JSON.stringify)(s)}var l={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:c(),transformRequest:[function(s,p){return o(p,"Accept"),o(p,"Content-Type"),t.isFormData(s)||t.isArrayBuffer(s)||t.isBuffer(s)||t.isStream(s)||t.isFile(s)||t.isBlob(s)?s:t.isArrayBufferView(s)?s.buffer:t.isURLSearchParams(s)?(a(p,"application/x-www-form-urlencoded;charset=utf-8"),s.toString()):t.isObject(s)||p&&p["Content-Type"]==="application/json"?(a(p,"application/json"),u(s)):s}],transformResponse:[function(s){var p=this.transitional||l.transitional,h=p&&p.silentJSONParsing,x=p&&p.forcedJSONParsing,y=!h&&this.responseType==="json";if(y||x&&t.isString(s)&&s.length)try{return JSON.parse(s)}catch(S){if(y)throw S.name==="SyntaxError"?n(S,this,"E_JSON_PARSE"):S}return s}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(s){return s>=200&&s<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};t.forEach(["delete","get","head"],function(s){l.headers[s]={}}),t.forEach(["post","put","patch"],function(s){l.headers[s]=t.merge(i)}),e.exports=l}),Or=A((r,e)=>{"use strict";var t=U(),o=Q();e.exports=function(n,i,a){var c=this||o;return t.forEach(a,function(u){n=u.call(c,n,i)}),n}}),_e=A((r,e)=>{"use strict";e.exports=function(t){return!!(t&&t.__CANCEL__)}}),jr=A((r,e)=>{"use strict";var t=U(),o=Or(),n=_e(),i=Q(),a=K();function c(u){if(u.cancelToken&&u.cancelToken.throwIfRequested(),u.signal&&u.signal.aborted)throw new a("canceled")}e.exports=function(u){c(u),u.headers=u.headers||{},u.data=o.call(u,u.data,u.headers,u.transformRequest),u.headers=t.merge(u.headers.common||{},u.headers[u.method]||{},u.headers),t.forEach(["delete","get","head","post","put","patch","common"],function(s){delete u.headers[s]});var l=u.adapter||i.adapter;return l(u).then(function(s){return c(u),s.data=o.call(u,s.data,s.headers,u.transformResponse),s},function(s){return n(s)||(c(u),s&&s.response&&(s.response.data=o.call(u,s.response.data,s.response.headers,u.transformResponse))),Promise.reject(s)})}}),De=A((r,e)=>{"use strict";var t=U();e.exports=function(o,n){n=n||{};var i={};function a(h,x){return t.isPlainObject(h)&&t.isPlainObject(x)?t.merge(h,x):t.isPlainObject(x)?t.merge({},x):t.isArray(x)?x.slice():x}function c(h){if(t.isUndefined(n[h])){if(!t.isUndefined(o[h]))return a(void 0,o[h])}else return a(o[h],n[h])}function u(h){if(!t.isUndefined(n[h]))return a(void 0,n[h])}function l(h){if(t.isUndefined(n[h])){if(!t.isUndefined(o[h]))return a(void 0,o[h])}else return a(void 0,n[h])}function s(h){if(h in n)return a(o[h],n[h]);if(h in o)return a(void 0,o[h])}var p={url:u,method:u,data:u,baseURL:l,transformRequest:l,transformResponse:l,paramsSerializer:l,timeout:l,timeoutMessage:l,withCredentials:l,adapter:l,responseType:l,xsrfCookieName:l,xsrfHeaderName:l,onUploadProgress:l,onDownloadProgress:l,decompress:l,maxContentLength:l,maxBodyLength:l,transport:l,httpAgent:l,httpsAgent:l,cancelToken:l,socketPath:l,responseEncoding:l,validateStatus:s};return t.forEach(Object.keys(o).concat(Object.keys(n)),function(h){var x=p[h]||c,y=x(h);t.isUndefined(y)&&x!==s||(i[h]=y)}),i}}),He=A((r,e)=>{e.exports={version:"0.25.0"}}),Nr=A((r,e)=>{"use strict";var t=He().version,o={};["object","boolean","number","function","string","symbol"].forEach(function(a,c){o[a]=function(u){return typeof u===a||"a"+(c<1?"n ":" ")+a}});var n={};o.transitional=function(a,c,u){function l(s,p){return"[Axios v"+t+"] Transitional option '"+s+"'"+p+(u?". "+u:"")}return function(s,p,h){if(a===!1)throw new Error(l(p," has been removed"+(c?" in "+c:"")));return c&&!n[p]&&(n[p]=!0,console.warn(l(p," has been deprecated since v"+c+" and will be removed in the near future"))),a?a(s,p,h):!0}};function i(a,c,u){if(typeof a!="object")throw new TypeError("options must be an object");for(var l=Object.keys(a),s=l.length;s-- >0;){var p=l[s],h=c[p];if(h){var x=a[p],y=x===void 0||h(x,p,a);if(y!==!0)throw new TypeError("option "+p+" must be "+y);continue}if(u!==!0)throw Error("Unknown option "+p)}}e.exports={assertOptions:i,validators:o}}),Rr=A((r,e)=>{"use strict";var t=U(),o=Le(),n=br(),i=jr(),a=De(),c=Nr(),u=c.validators;function l(s){this.defaults=s,this.interceptors={request:new n,response:new n}}l.prototype.request=function(s,p){if(typeof s=="string"?(p=p||{},p.url=s):p=s||{},!p.url)throw new Error("Provided config url is not valid");p=a(this.defaults,p),p.method?p.method=p.method.toLowerCase():this.defaults.method?p.method=this.defaults.method.toLowerCase():p.method="get";var h=p.transitional;h!==void 0&&c.assertOptions(h,{silentJSONParsing:u.transitional(u.boolean),forcedJSONParsing:u.transitional(u.boolean),clarifyTimeoutError:u.transitional(u.boolean)},!1);var x=[],y=!0;this.interceptors.request.forEach(function(v){typeof v.runWhen=="function"&&v.runWhen(p)===!1||(y=y&&v.synchronous,x.unshift(v.fulfilled,v.rejected))});var S=[];this.interceptors.response.forEach(function(v){S.push(v.fulfilled,v.rejected)});var b;if(!y){var T=[i,void 0];for(Array.prototype.unshift.apply(T,x),T=T.concat(S),b=Promise.resolve(p);T.length;)b=b.then(T.shift(),T.shift());return b}for(var m=p;x.length;){var g=x.shift(),d=x.shift();try{m=g(m)}catch(v){d(v);break}}try{b=i(m)}catch(v){return Promise.reject(v)}for(;S.length;)b=b.then(S.shift(),S.shift());return b},l.prototype.getUri=function(s){if(!s.url)throw new Error("Provided config url is not valid");return s=a(this.defaults,s),o(s.url,s.params,s.paramsSerializer).replace(/^\?/,"")},t.forEach(["delete","get","head","options"],function(s){l.prototype[s]=function(p,h){return this.request(a(h||{},{method:s,url:p,data:(h||{}).data}))}}),t.forEach(["post","put","patch"],function(s){l.prototype[s]=function(p,h,x){return this.request(a(x||{},{method:s,url:p,data:h}))}}),e.exports=l}),Pr=A((r,e)=>{"use strict";var t=K();function o(n){if(typeof n!="function")throw new TypeError("executor must be a function.");var i;this.promise=new Promise(function(c){i=c});var a=this;this.promise.then(function(c){if(a._listeners){var u,l=a._listeners.length;for(u=0;u<l;u++)a._listeners[u](c);a._listeners=null}}),this.promise.then=function(c){var u,l=new Promise(function(s){a.subscribe(s),u=s}).then(c);return l.cancel=function(){a.unsubscribe(u)},l},n(function(c){a.reason||(a.reason=new t(c),i(a.reason))})}o.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},o.prototype.subscribe=function(n){if(this.reason){n(this.reason);return}this._listeners?this._listeners.push(n):this._listeners=[n]},o.prototype.unsubscribe=function(n){if(this._listeners){var i=this._listeners.indexOf(n);i!==-1&&this._listeners.splice(i,1)}},o.source=function(){var n,i=new o(function(a){n=a});return{token:i,cancel:n}},e.exports=o}),Ir=A((r,e)=>{"use strict";e.exports=function(t){return function(o){return t.apply(null,o)}}}),qr=A((r,e)=>{"use strict";var t=U();e.exports=function(o){return t.isObject(o)&&o.isAxiosError===!0}}),Ur=A((r,e)=>{"use strict";var t=U(),o=Ue(),n=Rr(),i=De(),a=Q();function c(l){var s=new n(l),p=o(n.prototype.request,s);return t.extend(p,n.prototype,s),t.extend(p,s),p.create=function(h){return c(i(l,h))},p}var u=c(a);u.Axios=n,u.Cancel=K(),u.CancelToken=Pr(),u.isCancel=_e(),u.VERSION=He().version,u.all=function(l){return Promise.all(l)},u.spread=Ir(),u.isAxiosError=qr(),e.exports=u,e.exports.default=u}),Lr=A((r,e)=>{e.exports=Ur()}),Fr=A((r,e)=>{"use strict";e.exports=t=>encodeURIComponent(t).replace(/[!'()*]/g,o=>`%${o.charCodeAt(0).toString(16).toUpperCase()}`)}),Br=A((r,e)=>{"use strict";var t="%[a-f0-9]{2}",o=new RegExp(t,"gi"),n=new RegExp("("+t+")+","gi");function i(u,l){try{return decodeURIComponent(u.join(""))}catch{}if(u.length===1)return u;l=l||1;var s=u.slice(0,l),p=u.slice(l);return Array.prototype.concat.call([],i(s),i(p))}function a(u){try{return decodeURIComponent(u)}catch{for(var l=u.match(o),s=1;s<l.length;s++)u=i(l,s).join(""),l=u.match(o);return u}}function c(u){for(var l={"%FE%FF":"\uFFFD\uFFFD","%FF%FE":"\uFFFD\uFFFD"},s=n.exec(u);s;){try{l[s[0]]=decodeURIComponent(s[0])}catch{var p=a(s[0]);p!==s[0]&&(l[s[0]]=p)}s=n.exec(u)}l["%C2"]="\uFFFD";for(var h=Object.keys(l),x=0;x<h.length;x++){var y=h[x];u=u.replace(new RegExp(y,"g"),l[y])}return u}e.exports=function(u){if(typeof u!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof u+"`");try{return u=u.replace(/\+/g," "),decodeURIComponent(u)}catch{return c(u)}}}),_r=A((r,e)=>{"use strict";e.exports=(t,o)=>{if(!(typeof t=="string"&&typeof o=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(o==="")return[t];let n=t.indexOf(o);return n===-1?[t]:[t.slice(0,n),t.slice(n+o.length)]}}),Dr=A((r,e)=>{"use strict";e.exports=function(t,o){for(var n={},i=Object.keys(t),a=Array.isArray(o),c=0;c<i.length;c++){var u=i[c],l=t[u];(a?o.indexOf(u)!==-1:o(u,l,t))&&(n[u]=l)}return n}}),Hr=A(r=>{"use strict";var e=Fr(),t=Br(),o=_r(),n=Dr(),i=m=>m==null,a=Symbol("encodeFragmentIdentifier");function c(m){switch(m.arrayFormat){case"index":return g=>(d,v)=>{let w=d.length;return v===void 0||m.skipNull&&v===null||m.skipEmptyString&&v===""?d:v===null?[...d,[s(g,m),"[",w,"]"].join("")]:[...d,[s(g,m),"[",s(w,m),"]=",s(v,m)].join("")]};case"bracket":return g=>(d,v)=>v===void 0||m.skipNull&&v===null||m.skipEmptyString&&v===""?d:v===null?[...d,[s(g,m),"[]"].join("")]:[...d,[s(g,m),"[]=",s(v,m)].join("")];case"colon-list-separator":return g=>(d,v)=>v===void 0||m.skipNull&&v===null||m.skipEmptyString&&v===""?d:v===null?[...d,[s(g,m),":list="].join("")]:[...d,[s(g,m),":list=",s(v,m)].join("")];case"comma":case"separator":case"bracket-separator":{let g=m.arrayFormat==="bracket-separator"?"[]=":"=";return d=>(v,w)=>w===void 0||m.skipNull&&w===null||m.skipEmptyString&&w===""?v:(w=w===null?"":w,v.length===0?[[s(d,m),g,s(w,m)].join("")]:[[v,s(w,m)].join(m.arrayFormatSeparator)])}default:return g=>(d,v)=>v===void 0||m.skipNull&&v===null||m.skipEmptyString&&v===""?d:v===null?[...d,s(g,m)]:[...d,[s(g,m),"=",s(v,m)].join("")]}}function u(m){let g;switch(m.arrayFormat){case"index":return(d,v,w)=>{if(g=/\[(\d*)\]$/.exec(d),d=d.replace(/\[\d*\]$/,""),!g){w[d]=v;return}w[d]===void 0&&(w[d]={}),w[d][g[1]]=v};case"bracket":return(d,v,w)=>{if(g=/(\[\])$/.exec(d),d=d.replace(/\[\]$/,""),!g){w[d]=v;return}if(w[d]===void 0){w[d]=[v];return}w[d]=[].concat(w[d],v)};case"colon-list-separator":return(d,v,w)=>{if(g=/(:list)$/.exec(d),d=d.replace(/:list$/,""),!g){w[d]=v;return}if(w[d]===void 0){w[d]=[v];return}w[d]=[].concat(w[d],v)};case"comma":case"separator":return(d,v,w)=>{let k=typeof v=="string"&&v.includes(m.arrayFormatSeparator),E=typeof v=="string"&&!k&&p(v,m).includes(m.arrayFormatSeparator);v=E?p(v,m):v;let P=k||E?v.split(m.arrayFormatSeparator).map(f=>p(f,m)):v===null?v:p(v,m);w[d]=P};case"bracket-separator":return(d,v,w)=>{let k=/(\[\])$/.test(d);if(d=d.replace(/\[\]$/,""),!k){w[d]=v&&p(v,m);return}let E=v===null?[]:v.split(m.arrayFormatSeparator).map(P=>p(P,m));if(w[d]===void 0){w[d]=E;return}w[d]=[].concat(w[d],E)};default:return(d,v,w)=>{if(w[d]===void 0){w[d]=v;return}w[d]=[].concat(w[d],v)}}}function l(m){if(typeof m!="string"||m.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function s(m,g){return g.encode?g.strict?e(m):encodeURIComponent(m):m}function p(m,g){return g.decode?t(m):m}function h(m){return Array.isArray(m)?m.sort():typeof m=="object"?h(Object.keys(m)).sort((g,d)=>Number(g)-Number(d)).map(g=>m[g]):m}function x(m){let g=m.indexOf("#");return g!==-1&&(m=m.slice(0,g)),m}function y(m){let g="",d=m.indexOf("#");return d!==-1&&(g=m.slice(d)),g}function S(m){m=x(m);let g=m.indexOf("?");return g===-1?"":m.slice(g+1)}function b(m,g){return g.parseNumbers&&!Number.isNaN(Number(m))&&typeof m=="string"&&m.trim()!==""?m=Number(m):g.parseBooleans&&m!==null&&(m.toLowerCase()==="true"||m.toLowerCase()==="false")&&(m=m.toLowerCase()==="true"),m}function T(m,g){g=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},g),l(g.arrayFormatSeparator);let d=u(g),v=Object.create(null);if(typeof m!="string"||(m=m.trim().replace(/^[?#&]/,""),!m))return v;for(let w of m.split("&")){if(w==="")continue;let[k,E]=o(g.decode?w.replace(/\+/g," "):w,"=");E=E===void 0?null:["comma","separator","bracket-separator"].includes(g.arrayFormat)?E:p(E,g),d(p(k,g),E,v)}for(let w of Object.keys(v)){let k=v[w];if(typeof k=="object"&&k!==null)for(let E of Object.keys(k))k[E]=b(k[E],g);else v[w]=b(k,g)}return g.sort===!1?v:(g.sort===!0?Object.keys(v).sort():Object.keys(v).sort(g.sort)).reduce((w,k)=>{let E=v[k];return Boolean(E)&&typeof E=="object"&&!Array.isArray(E)?w[k]=h(E):w[k]=E,w},Object.create(null))}r.extract=S,r.parse=T,r.stringify=(m,g)=>{if(!m)return"";g=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},g),l(g.arrayFormatSeparator);let d=E=>g.skipNull&&i(m[E])||g.skipEmptyString&&m[E]==="",v=c(g),w={};for(let E of Object.keys(m))d(E)||(w[E]=m[E]);let k=Object.keys(w);return g.sort!==!1&&k.sort(g.sort),k.map(E=>{let P=m[E];return P===void 0?"":P===null?s(E,g):Array.isArray(P)?P.length===0&&g.arrayFormat==="bracket-separator"?s(E,g)+"[]":P.reduce(v(E),[]).join("&"):s(E,g)+"="+s(P,g)}).filter(E=>E.length>0).join("&")},r.parseUrl=(m,g)=>{g=Object.assign({decode:!0},g);let[d,v]=o(m,"#");return Object.assign({url:d.split("?")[0]||"",query:T(S(m),g)},g&&g.parseFragmentIdentifier&&v?{fragmentIdentifier:p(v,g)}:{})},r.stringifyUrl=(m,g)=>{g=Object.assign({encode:!0,strict:!0,[a]:!0},g);let d=x(m.url).split("?")[0]||"",v=r.extract(m.url),w=r.parse(v,{sort:!1}),k=Object.assign(w,m.query),E=r.stringify(k,g);E&&(E=`?${E}`);let P=y(m.url);return m.fragmentIdentifier&&(P=`#${g[a]?s(m.fragmentIdentifier,g):m.fragmentIdentifier}`),`${d}${E}${P}`},r.pick=(m,g,d)=>{d=Object.assign({parseFragmentIdentifier:!0,[a]:!1},d);let{url:v,query:w,fragmentIdentifier:k}=r.parseUrl(m,d);return r.stringifyUrl({url:v,query:n(w,g),fragmentIdentifier:k},d)},r.exclude=(m,g,d)=>{let v=Array.isArray(g)?w=>!g.includes(w):(w,k)=>!g(w,k);return r.pick(m,v,d)}}),Mr=qe(Lr()),Jr=500,$r=class{url;httpClient;accessToken;constructor({url:r=""}){this.url=r,this.httpClient=Mr.default.create({baseURL:this.url}),this.httpClient.interceptors.response.use(e=>e,e=>Promise.reject({message:e.response?.data?.message??e.message??JSON.stringify(e),status:e.response?.status??Jr}))}async signUpEmailPassword(r){try{return{data:(await this.httpClient.post("/signup/email-password",r)).data,error:null}}catch(e){return{data:null,error:e}}}async signInEmailPassword(r){try{return{data:(await this.httpClient.post("/signin/email-password",r)).data,error:null}}catch(e){return{data:null,error:e}}}async signInPasswordlessEmail(r){try{return{data:(await this.httpClient.post("/signin/passwordless/email",r)).data,error:null}}catch(e){return{data:null,error:e}}}async signInPasswordlessSms(r){try{return{data:(await this.httpClient.post("/signin/passwordless/sms",r)).data,error:null}}catch(e){return{data:null,error:e}}}async signInPasswordlessSmsOtp(r){try{return{data:(await this.httpClient.post("/signin/passwordless/sms/otp",r)).data,error:null}}catch(e){return{data:null,error:e}}}async signOut(r){try{return await this.httpClient.post("/signout",r),{error:null}}catch(e){return{error:e}}}async refreshToken(r){try{let e=await this.httpClient.post("/token",r);return{error:null,session:e.data}}catch(e){return{error:e,session:null}}}async resetPassword(r){try{return await this.httpClient.post("/user/password/reset",r),{error:null}}catch(e){return{error:e}}}async changePassword(r){try{return await this.httpClient.post("/user/password",r,{headers:{...this.generateAuthHeaders()}}),{error:null}}catch(e){return{error:e}}}async sendVerificationEmail(r){try{return await this.httpClient.post("/user/email/send-verification-email",r),{error:null}}catch(e){return{error:e}}}async changeEmail(r){try{return await this.httpClient.post("/user/email/change",r,{headers:{...this.generateAuthHeaders()}}),{error:null}}catch(e){return{error:e}}}async deanonymize(r){try{return await this.httpClient.post("/user/deanonymize",r),{error:null}}catch(e){return{error:e}}}async verifyEmail(r){try{return{data:(await this.httpClient.post("/user/email/verify",r)).data,error:null}}catch(e){return{data:null,error:e}}}setAccessToken(r){this.accessToken=r}generateAuthHeaders(){return this.accessToken?{Authorization:`Bearer ${this.accessToken}`}:null}},zr=qe(Hr()),H="nhostRefreshToken",X=()=>typeof window<"u",Vr=class{memory;constructor(){this.memory={}}setItem(r,e){this.memory[r]=e}getItem(r){return this.memory[r]}removeItem(r){delete this.memory[r]}},Me=class{api;onTokenChangedFunctions;onAuthChangedFunctions;refreshInterval;refreshIntervalTime;clientStorage;clientStorageType;url;autoRefreshToken;session;initAuthLoading;refreshSleepCheckInterval;refreshIntervalSleepCheckLastSample;sampleRate;constructor({url:r,autoRefreshToken:e=!0,autoLogin:t=!0,refreshIntervalTime:o,clientStorage:n,clientStorageType:i="web"}){this.refreshIntervalTime=o,n?this.clientStorage=n:this.clientStorage=X()?localStorage:new Vr,this.clientStorageType=i,this.onTokenChangedFunctions=[],this.onAuthChangedFunctions=[],this.refreshInterval,this.refreshSleepCheckInterval=0,this.refreshIntervalSleepCheckLastSample=Date.now(),this.sampleRate=2e3,this.url=r,this.autoRefreshToken=e,this.initAuthLoading=!0,this.session=null,this.api=new $r({url:this.url});let a=null,c=!1;if(t&&X()&&window.location){let u=zr.default.parse(window.location.toString().split("#")[1]);if("refreshToken"in u&&(a=u.refreshToken),"otp"in u&&"email"in u){let{otp:l,email:s}=u;this.signIn({otp:l,email:s}),c=!0}}!c&&t?this._autoLogin(a):a&&this._setItem(H,a)}async signUp(r){let{email:e,password:t}=r;if(e&&t){let{data:o,error:n}=await this.api.signUpEmailPassword(r);if(n)return{session:null,error:n};if(!o)return{session:null,error:{message:"An error occurred on sign up.",status:500}};let{session:i}=o;return i&&await this._setSession(i),{session:i,error:null}}return{session:null,error:{message:"Incorrect parameters",status:500}}}async signIn(r){if("provider"in r){let{provider:e}=r,t=`${this.url}/signin/provider/${e}`;return X()&&(window.location.href=t),{providerUrl:t,provider:e,session:null,mfa:null,error:null}}if("email"in r&&"password"in r){let{data:e,error:t}=await this.api.signInEmailPassword(r);if(t)return{session:null,mfa:null,error:t};if(!e)return{session:null,mfa:null,error:{message:"Incorrect Data",status:500}};let{session:o,mfa:n}=e;return o&&await this._setSession(o),{session:o,mfa:n,error:null}}if("email"in r&&!("otp"in r)){let{error:e}=await this.api.signInPasswordlessEmail(r);return e?{session:null,mfa:null,error:e}:{session:null,mfa:null,error:null}}if("phoneNumber"in r&&!("otp"in r)){let{error:e}=await this.api.signInPasswordlessSms(r);return e?{session:null,mfa:null,error:e}:{session:null,mfa:null,error:null}}if("otp"in r){let{data:e,error:t}=await this.api.signInPasswordlessSmsOtp(r);if(t)return{session:null,mfa:null,error:t};if(!e)return{session:null,mfa:null,error:{message:"Incorrect data",status:500}};let{session:o,mfa:n}=e;return o&&await this._setSession(o),{session:o,mfa:n,error:null}}return{session:null,mfa:null,error:{message:"Incorrect parameters",status:500}}}async signOut(r){let e=await this._getItem(H);this._clearSession();let{error:t}=await this.api.signOut({refreshToken:e,all:r?.all});return{error:t}}async verifyEmail(r){return await this.api.verifyEmail(r)}async resetPassword(r){let{error:e}=await this.api.resetPassword(r);return{error:e}}async changePassword(r){let{error:e}=await this.api.changePassword(r);return{error:e}}async sendVerificationEmail(r){let{error:e}=await this.api.sendVerificationEmail(r);return{error:e}}async changeEmail(r){let{error:e}=await this.api.changeEmail(r);return{error:e}}async deanonymize(r){let{error:e}=await this.api.deanonymize(r);return{error:e}}onTokenChanged(r){this.onTokenChangedFunctions.push(r);let e=this.onTokenChangedFunctions.length-1;return()=>{try{this.onTokenChangedFunctions[e]=()=>{}}catch{console.warn("Unable to unsubscribe onTokenChanged function. Maybe the functions is already unsubscribed?")}}}onAuthStateChanged(r){this.onAuthChangedFunctions.push(r);let e=this.onAuthChangedFunctions.length-1;return()=>{try{this.onAuthChangedFunctions[e]=()=>{}}catch{console.warn("Unable to unsubscribe onAuthStateChanged function. Maybe you already did?")}}}isAuthenticated(){return this.session!==null}async isAuthenticatedAsync(){return new Promise(r=>{if(!this.initAuthLoading)r(this.isAuthenticated());else{let e=this.onAuthStateChanged((t,o)=>{r(t==="SIGNED_IN"),e()})}})}getAuthenticationStatus(){return this.initAuthLoading?{isAuthenticated:!1,isLoading:!0}:{isAuthenticated:this.session!==null,isLoading:!1}}getJWTToken(){return this.getAccessToken()}getAccessToken(){if(this.session)return this.session.accessToken}async refreshSession(r){let e=r||await this._getItem(H);return e||console.warn("no refresh token found. No way of refreshing session"),this._refreshTokens(e)}getSession(){return this.session}getUser(){return this.session?this.session.user:null}async _setItem(r,e){if(typeof e!="string"){console.error('value is not of type "string"');return}switch(this.clientStorageType){case"web":if(typeof this.clientStorage.setItem!="function"){console.error("this.clientStorage.setItem is not a function");break}this.clientStorage.setItem(r,e);break;case"custom":case"react-native":if(typeof this.clientStorage.setItem!="function"){console.error("this.clientStorage.setItem is not a function");break}await this.clientStorage.setItem(r,e);break;case"capacitor":if(typeof this.clientStorage.set!="function"){console.error("this.clientStorage.set is not a function");break}await this.clientStorage.set({key:r,value:e});break;case"expo-secure-storage":if(typeof this.clientStorage.setItemAsync!="function"){console.error("this.clientStorage.setItemAsync is not a function");break}this.clientStorage.setItemAsync(r,e);break;default:break}}async _getItem(r){switch(this.clientStorageType){case"web":if(typeof this.clientStorage.getItem!="function"){console.error("this.clientStorage.getItem is not a function");break}return this.clientStorage.getItem(r);case"custom":case"react-native":if(typeof this.clientStorage.getItem!="function"){console.error("this.clientStorage.getItem is not a function");break}return await this.clientStorage.getItem(r);case"capacitor":if(typeof this.clientStorage.get!="function"){console.error("this.clientStorage.get is not a function");break}return(await this.clientStorage.get({key:r})).value;case"expo-secure-storage":if(typeof this.clientStorage.getItemAsync!="function"){console.error("this.clientStorage.getItemAsync is not a function");break}return this.clientStorage.getItemAsync(r);default:return""}return""}async _removeItem(r){switch(this.clientStorageType){case"web":if(typeof this.clientStorage.removeItem!="function"){console.error("this.clientStorage.removeItem is not a function");break}return void this.clientStorage.removeItem(r);case"custom":case"react-native":if(typeof this.clientStorage.removeItem!="function"){console.error("this.clientStorage.removeItem is not a function");break}return void this.clientStorage.removeItem(r);case"capacitor":if(typeof this.clientStorage.remove!="function"){console.error("this.clientStorage.remove is not a function");break}await this.clientStorage.remove({key:r});break;case"expo-secure-storage":if(typeof this.clientStorage.deleteItemAsync!="function"){console.error("this.clientStorage.deleteItemAsync is not a function");break}this.clientStorage.deleteItemAsync(r);break;default:break}}_autoLogin(r){!X()||this._refreshTokens(r)}async _refreshTokens(r){let e=r||await this._getItem(H);if(!e){setTimeout(async()=>{await this._clearSession()},0);return}try{let{session:t,error:o}=await this.api.refreshToken({refreshToken:e});if(o&&o.status===401){await this._clearSession();return}if(!t)throw new Error("Invalid session data");await this._setSession(t),this.tokenChanged()}catch{}}tokenChanged(){for(let r of this.onTokenChangedFunctions)r(this.session)}authStateChanged({event:r,session:e}){r==="SIGNED_IN"&&e?this.api.setAccessToken(e.accessToken):this.api.setAccessToken(void 0);for(let t of this.onAuthChangedFunctions)t(r,e)}async _clearSession(){let{isLoading:r,isAuthenticated:e}=this.getAuthenticationStatus();this.session=null,this.initAuthLoading=!1,await this._removeItem(H),(r||e)&&(clearInterval(this.refreshInterval),clearInterval(this.refreshSleepCheckInterval),this.authStateChanged({event:"SIGNED_OUT",session:null}))}async _setSession(r){let{isAuthenticated:e}=this.getAuthenticationStatus();if(this.session=r,await this._setItem(H,r.refreshToken),this.autoRefreshToken&&!e){let t=r.accessTokenExpiresIn,o=this.refreshIntervalTime?this.refreshIntervalTime:Math.max(1,t-1);this.refreshInterval=setInterval(async()=>{let n=await this._getItem(H);await this._refreshTokens(n)},o*1e3),this.refreshIntervalSleepCheckLastSample=Date.now(),this.refreshSleepCheckInterval=setInterval(async()=>{if(Date.now()-this.refreshIntervalSleepCheckLastSample>=this.sampleRate*2){let n=await this._getItem(H);await this._refreshTokens(n)}this.refreshIntervalSleepCheckLastSample=Date.now()},this.sampleRate),this.authStateChanged({event:"SIGNED_IN",session:this.session})}this.initAuthLoading=!1}};var Gr=Object.create,ae=Object.defineProperty,Wr=Object.getOwnPropertyDescriptor,Xr=Object.getOwnPropertyNames,Kr=Object.getPrototypeOf,Qr=Object.prototype.hasOwnProperty,Yr=r=>ae(r,"__esModule",{value:!0}),N=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),Zr=(r,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Xr(e))!Qr.call(r,n)&&(t||n!=="default")&&ae(r,n,{get:()=>e[n],enumerable:!(o=Wr(e,n))||o.enumerable});return r},en=(r,e)=>Zr(Yr(ae(r!=null?Gr(Kr(r)):{},"default",!e&&r&&r.__esModule?{get:()=>r.default,enumerable:!0}:{value:r,enumerable:!0})),r),$e=N((r,e)=>{"use strict";e.exports=function(t,o){return function(){for(var n=new Array(arguments.length),i=0;i<n.length;i++)n[i]=arguments[i];return t.apply(o,n)}}}),B=N((r,e)=>{"use strict";var t=$e(),o=Object.prototype.toString;function n(f){return o.call(f)==="[object Array]"}function i(f){return typeof f>"u"}function a(f){return f!==null&&!i(f)&&f.constructor!==null&&!i(f.constructor)&&typeof f.constructor.isBuffer=="function"&&f.constructor.isBuffer(f)}function c(f){return o.call(f)==="[object ArrayBuffer]"}function u(f){return typeof FormData<"u"&&f instanceof FormData}function l(f){var C;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?C=ArrayBuffer.isView(f):C=f&&f.buffer&&f.buffer instanceof ArrayBuffer,C}function s(f){return typeof f=="string"}function p(f){return typeof f=="number"}function h(f){return f!==null&&typeof f=="object"}function x(f){if(o.call(f)!=="[object Object]")return!1;var C=Object.getPrototypeOf(f);return C===null||C===Object.prototype}function y(f){return o.call(f)==="[object Date]"}function S(f){return o.call(f)==="[object File]"}function b(f){return o.call(f)==="[object Blob]"}function T(f){return o.call(f)==="[object Function]"}function m(f){return h(f)&&T(f.pipe)}function g(f){return typeof URLSearchParams<"u"&&f instanceof URLSearchParams}function d(f){return f.trim?f.trim():f.replace(/^\s+|\s+$/g,"")}function v(){return typeof navigator<"u"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window<"u"&&typeof document<"u"}function w(f,C){if(!(f===null||typeof f>"u"))if(typeof f!="object"&&(f=[f]),n(f))for(var R=0,I=f.length;R<I;R++)C.call(null,f[R],R,f);else for(var O in f)Object.prototype.hasOwnProperty.call(f,O)&&C.call(null,f[O],O,f)}function k(){var f={};function C(O,F){x(f[F])&&x(O)?f[F]=k(f[F],O):x(O)?f[F]=k({},O):n(O)?f[F]=O.slice():f[F]=O}for(var R=0,I=arguments.length;R<I;R++)w(arguments[R],C);return f}function E(f,C,R){return w(C,function(I,O){R&&typeof I=="function"?f[O]=t(I,R):f[O]=I}),f}function P(f){return f.charCodeAt(0)===65279&&(f=f.slice(1)),f}e.exports={isArray:n,isArrayBuffer:c,isBuffer:a,isFormData:u,isArrayBufferView:l,isString:s,isNumber:p,isObject:h,isPlainObject:x,isUndefined:i,isDate:y,isFile:S,isBlob:b,isFunction:T,isStream:m,isURLSearchParams:g,isStandardBrowserEnv:v,forEach:w,merge:k,extend:E,trim:d,stripBOM:P}}),ze=N((r,e)=>{"use strict";var t=B();function o(n){return encodeURIComponent(n).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}e.exports=function(n,i,a){if(!i)return n;var c;if(a)c=a(i);else if(t.isURLSearchParams(i))c=i.toString();else{var u=[];t.forEach(i,function(s,p){s===null||typeof s>"u"||(t.isArray(s)?p=p+"[]":s=[s],t.forEach(s,function(h){t.isDate(h)?h=h.toISOString():t.isObject(h)&&(h=JSON.stringify(h)),u.push(o(p)+"="+o(h))}))}),c=u.join("&")}if(c){var l=n.indexOf("#");l!==-1&&(n=n.slice(0,l)),n+=(n.indexOf("?")===-1?"?":"&")+c}return n}}),tn=N((r,e)=>{"use strict";var t=B();function o(){this.handlers=[]}o.prototype.use=function(n,i,a){return this.handlers.push({fulfilled:n,rejected:i,synchronous:a?a.synchronous:!1,runWhen:a?a.runWhen:null}),this.handlers.length-1},o.prototype.eject=function(n){this.handlers[n]&&(this.handlers[n]=null)},o.prototype.forEach=function(n){t.forEach(this.handlers,function(i){i!==null&&n(i)})},e.exports=o}),rn=N((r,e)=>{"use strict";var t=B();e.exports=function(o,n){t.forEach(o,function(i,a){a!==n&&a.toUpperCase()===n.toUpperCase()&&(o[n]=i,delete o[a])})}}),Ve=N((r,e)=>{"use strict";e.exports=function(t,o,n,i,a){return t.config=o,n&&(t.code=n),t.request=i,t.response=a,t.isAxiosError=!0,t.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},t}}),Ge=N((r,e)=>{"use strict";var t=Ve();e.exports=function(o,n,i,a,c){var u=new Error(o);return t(u,n,i,a,c)}}),nn=N((r,e)=>{"use strict";var t=Ge();e.exports=function(o,n,i){var a=i.config.validateStatus;!i.status||!a||a(i.status)?o(i):n(t("Request failed with status code "+i.status,i.config,null,i.request,i))}}),sn=N((r,e)=>{"use strict";var t=B();e.exports=t.isStandardBrowserEnv()?function(){return{write:function(o,n,i,a,c,u){var l=[];l.push(o+"="+encodeURIComponent(n)),t.isNumber(i)&&l.push("expires="+new Date(i).toGMTString()),t.isString(a)&&l.push("path="+a),t.isString(c)&&l.push("domain="+c),u===!0&&l.push("secure"),document.cookie=l.join("; ")},read:function(o){var n=document.cookie.match(new RegExp("(^|;\\s*)("+o+")=([^;]*)"));return n?decodeURIComponent(n[3]):null},remove:function(o){this.write(o,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()}),on=N((r,e)=>{"use strict";e.exports=function(t){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(t)}}),an=N((r,e)=>{"use strict";e.exports=function(t,o){return o?t.replace(/\/+$/,"")+"/"+o.replace(/^\/+/,""):t}}),un=N((r,e)=>{"use strict";var t=on(),o=an();e.exports=function(n,i){return n&&!t(i)?o(n,i):i}}),cn=N((r,e)=>{"use strict";var t=B(),o=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];e.exports=function(n){var i={},a,c,u;return n&&t.forEach(n.split(`
4
- `),function(l){if(u=l.indexOf(":"),a=t.trim(l.substr(0,u)).toLowerCase(),c=t.trim(l.substr(u+1)),a){if(i[a]&&o.indexOf(a)>=0)return;a==="set-cookie"?i[a]=(i[a]?i[a]:[]).concat([c]):i[a]=i[a]?i[a]+", "+c:c}}),i}}),ln=N((r,e)=>{"use strict";var t=B();e.exports=t.isStandardBrowserEnv()?function(){var o=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a"),i;function a(c){var u=c;return o&&(n.setAttribute("href",u),u=n.href),n.setAttribute("href",u),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:n.pathname.charAt(0)==="/"?n.pathname:"/"+n.pathname}}return i=a(window.location.href),function(c){var u=t.isString(c)?a(c):c;return u.protocol===i.protocol&&u.host===i.host}}():function(){return function(){return!0}}()}),Je=N((r,e)=>{"use strict";var t=B(),o=nn(),n=sn(),i=ze(),a=un(),c=cn(),u=ln(),l=Ge();e.exports=function(s){return new Promise(function(p,h){var x=s.data,y=s.headers,S=s.responseType;t.isFormData(x)&&delete y["Content-Type"];var b=new XMLHttpRequest;if(s.auth){var T=s.auth.username||"",m=s.auth.password?unescape(encodeURIComponent(s.auth.password)):"";y.Authorization="Basic "+btoa(T+":"+m)}var g=a(s.baseURL,s.url);b.open(s.method.toUpperCase(),i(g,s.params,s.paramsSerializer),!0),b.timeout=s.timeout;function d(){if(b){var w="getAllResponseHeaders"in b?c(b.getAllResponseHeaders()):null,k=!S||S==="text"||S==="json"?b.responseText:b.response,E={data:k,status:b.status,statusText:b.statusText,headers:w,config:s,request:b};o(p,h,E),b=null}}if("onloadend"in b?b.onloadend=d:b.onreadystatechange=function(){!b||b.readyState!==4||b.status===0&&!(b.responseURL&&b.responseURL.indexOf("file:")===0)||setTimeout(d)},b.onabort=function(){!b||(h(l("Request aborted",s,"ECONNABORTED",b)),b=null)},b.onerror=function(){h(l("Network Error",s,null,b)),b=null},b.ontimeout=function(){var w="timeout of "+s.timeout+"ms exceeded";s.timeoutErrorMessage&&(w=s.timeoutErrorMessage),h(l(w,s,s.transitional&&s.transitional.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",b)),b=null},t.isStandardBrowserEnv()){var v=(s.withCredentials||u(g))&&s.xsrfCookieName?n.read(s.xsrfCookieName):void 0;v&&(y[s.xsrfHeaderName]=v)}"setRequestHeader"in b&&t.forEach(y,function(w,k){typeof x>"u"&&k.toLowerCase()==="content-type"?delete y[k]:b.setRequestHeader(k,w)}),t.isUndefined(s.withCredentials)||(b.withCredentials=!!s.withCredentials),S&&S!=="json"&&(b.responseType=s.responseType),typeof s.onDownloadProgress=="function"&&b.addEventListener("progress",s.onDownloadProgress),typeof s.onUploadProgress=="function"&&b.upload&&b.upload.addEventListener("progress",s.onUploadProgress),s.cancelToken&&s.cancelToken.promise.then(function(w){!b||(b.abort(),h(w),b=null)}),x||(x=null),b.send(x)})}}),ue=N((r,e)=>{"use strict";var t=B(),o=rn(),n=Ve(),i={"Content-Type":"application/x-www-form-urlencoded"};function a(s,p){!t.isUndefined(s)&&t.isUndefined(s["Content-Type"])&&(s["Content-Type"]=p)}function c(){var s;return(typeof XMLHttpRequest<"u"||typeof process<"u"&&Object.prototype.toString.call(process)==="[object process]")&&(s=Je()),s}function u(s,p,h){if(t.isString(s))try{return(p||JSON.parse)(s),t.trim(s)}catch(x){if(x.name!=="SyntaxError")throw x}return(h||JSON.stringify)(s)}var l={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:c(),transformRequest:[function(s,p){return o(p,"Accept"),o(p,"Content-Type"),t.isFormData(s)||t.isArrayBuffer(s)||t.isBuffer(s)||t.isStream(s)||t.isFile(s)||t.isBlob(s)?s:t.isArrayBufferView(s)?s.buffer:t.isURLSearchParams(s)?(a(p,"application/x-www-form-urlencoded;charset=utf-8"),s.toString()):t.isObject(s)||p&&p["Content-Type"]==="application/json"?(a(p,"application/json"),u(s)):s}],transformResponse:[function(s){var p=this.transitional,h=p&&p.silentJSONParsing,x=p&&p.forcedJSONParsing,y=!h&&this.responseType==="json";if(y||x&&t.isString(s)&&s.length)try{return JSON.parse(s)}catch(S){if(y)throw S.name==="SyntaxError"?n(S,this,"E_JSON_PARSE"):S}return s}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(s){return s>=200&&s<300}};l.headers={common:{Accept:"application/json, text/plain, */*"}},t.forEach(["delete","get","head"],function(s){l.headers[s]={}}),t.forEach(["post","put","patch"],function(s){l.headers[s]=t.merge(i)}),e.exports=l}),fn=N((r,e)=>{"use strict";var t=B(),o=ue();e.exports=function(n,i,a){var c=this||o;return t.forEach(a,function(u){n=u.call(c,n,i)}),n}}),We=N((r,e)=>{"use strict";e.exports=function(t){return!!(t&&t.__CANCEL__)}}),hn=N((r,e)=>{"use strict";var t=B(),o=fn(),n=We(),i=ue();function a(c){c.cancelToken&&c.cancelToken.throwIfRequested()}e.exports=function(c){a(c),c.headers=c.headers||{},c.data=o.call(c,c.data,c.headers,c.transformRequest),c.headers=t.merge(c.headers.common||{},c.headers[c.method]||{},c.headers),t.forEach(["delete","get","head","post","put","patch","common"],function(l){delete c.headers[l]});var u=c.adapter||i.adapter;return u(c).then(function(l){return a(c),l.data=o.call(c,l.data,l.headers,c.transformResponse),l},function(l){return n(l)||(a(c),l&&l.response&&(l.response.data=o.call(c,l.response.data,l.response.headers,c.transformResponse))),Promise.reject(l)})}}),Xe=N((r,e)=>{"use strict";var t=B();e.exports=function(o,n){n=n||{};var i={},a=["url","method","data"],c=["headers","auth","proxy","params"],u=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],l=["validateStatus"];function s(y,S){return t.isPlainObject(y)&&t.isPlainObject(S)?t.merge(y,S):t.isPlainObject(S)?t.merge({},S):t.isArray(S)?S.slice():S}function p(y){t.isUndefined(n[y])?t.isUndefined(o[y])||(i[y]=s(void 0,o[y])):i[y]=s(o[y],n[y])}t.forEach(a,function(y){t.isUndefined(n[y])||(i[y]=s(void 0,n[y]))}),t.forEach(c,p),t.forEach(u,function(y){t.isUndefined(n[y])?t.isUndefined(o[y])||(i[y]=s(void 0,o[y])):i[y]=s(void 0,n[y])}),t.forEach(l,function(y){y in n?i[y]=s(o[y],n[y]):y in o&&(i[y]=s(void 0,o[y]))});var h=a.concat(c).concat(u).concat(l),x=Object.keys(o).concat(Object.keys(n)).filter(function(y){return h.indexOf(y)===-1});return t.forEach(x,p),i}}),pn=N((r,e)=>{e.exports={name:"axios",version:"0.21.4",description:"Promise based HTTP client for the browser and node.js",main:"index.js",scripts:{test:"grunt test",start:"node ./sandbox/server.js",build:"NODE_ENV=production grunt build",preversion:"npm test",version:"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json",postversion:"git push && git push --tags",examples:"node ./examples/server.js",coveralls:"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",fix:"eslint --fix lib/**/*.js"},repository:{type:"git",url:"https://github.com/axios/axios.git"},keywords:["xhr","http","ajax","promise","node"],author:"Matt Zabriskie",license:"MIT",bugs:{url:"https://github.com/axios/axios/issues"},homepage:"https://axios-http.com",devDependencies:{coveralls:"^3.0.0","es6-promise":"^4.2.4",grunt:"^1.3.0","grunt-banner":"^0.6.0","grunt-cli":"^1.2.0","grunt-contrib-clean":"^1.1.0","grunt-contrib-watch":"^1.0.0","grunt-eslint":"^23.0.0","grunt-karma":"^4.0.0","grunt-mocha-test":"^0.13.3","grunt-ts":"^6.0.0-beta.19","grunt-webpack":"^4.0.2","istanbul-instrumenter-loader":"^1.0.0","jasmine-core":"^2.4.1",karma:"^6.3.2","karma-chrome-launcher":"^3.1.0","karma-firefox-launcher":"^2.1.0","karma-jasmine":"^1.1.1","karma-jasmine-ajax":"^0.1.13","karma-safari-launcher":"^1.0.0","karma-sauce-launcher":"^4.3.6","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.8","karma-webpack":"^4.0.2","load-grunt-tasks":"^3.5.2",minimist:"^1.2.0",mocha:"^8.2.1",sinon:"^4.5.0","terser-webpack-plugin":"^4.2.3",typescript:"^4.0.5","url-search-params":"^0.10.0",webpack:"^4.44.2","webpack-dev-server":"^3.11.0"},browser:{"./lib/adapters/http.js":"./lib/adapters/xhr.js"},jsdelivr:"dist/axios.min.js",unpkg:"dist/axios.min.js",typings:"./index.d.ts",dependencies:{"follow-redirects":"^1.14.0"},bundlesize:[{path:"./dist/axios.min.js",threshold:"5kB"}]}}),dn=N((r,e)=>{"use strict";var t=pn(),o={};["object","boolean","number","function","string","symbol"].forEach(function(u,l){o[u]=function(s){return typeof s===u||"a"+(l<1?"n ":" ")+u}});var n={},i=t.version.split(".");function a(u,l){for(var s=l?l.split("."):i,p=u.split("."),h=0;h<3;h++){if(s[h]>p[h])return!0;if(s[h]<p[h])return!1}return!1}o.transitional=function(u,l,s){var p=l&&a(l);function h(x,y){return"[Axios v"+t.version+"] Transitional option '"+x+"'"+y+(s?". "+s:"")}return function(x,y,S){if(u===!1)throw new Error(h(y," has been removed in "+l));return p&&!n[y]&&(n[y]=!0,console.warn(h(y," has been deprecated since v"+l+" and will be removed in the near future"))),u?u(x,y,S):!0}};function c(u,l,s){if(typeof u!="object")throw new TypeError("options must be an object");for(var p=Object.keys(u),h=p.length;h-- >0;){var x=p[h],y=l[x];if(y){var S=u[x],b=S===void 0||y(S,x,u);if(b!==!0)throw new TypeError("option "+x+" must be "+b);continue}if(s!==!0)throw Error("Unknown option "+x)}}e.exports={isOlderVersion:a,assertOptions:c,validators:o}}),mn=N((r,e)=>{"use strict";var t=B(),o=ze(),n=tn(),i=hn(),a=Xe(),c=dn(),u=c.validators;function l(s){this.defaults=s,this.interceptors={request:new n,response:new n}}l.prototype.request=function(s){typeof s=="string"?(s=arguments[1]||{},s.url=arguments[0]):s=s||{},s=a(this.defaults,s),s.method?s.method=s.method.toLowerCase():this.defaults.method?s.method=this.defaults.method.toLowerCase():s.method="get";var p=s.transitional;p!==void 0&&c.assertOptions(p,{silentJSONParsing:u.transitional(u.boolean,"1.0.0"),forcedJSONParsing:u.transitional(u.boolean,"1.0.0"),clarifyTimeoutError:u.transitional(u.boolean,"1.0.0")},!1);var h=[],x=!0;this.interceptors.request.forEach(function(d){typeof d.runWhen=="function"&&d.runWhen(s)===!1||(x=x&&d.synchronous,h.unshift(d.fulfilled,d.rejected))});var y=[];this.interceptors.response.forEach(function(d){y.push(d.fulfilled,d.rejected)});var S;if(!x){var b=[i,void 0];for(Array.prototype.unshift.apply(b,h),b=b.concat(y),S=Promise.resolve(s);b.length;)S=S.then(b.shift(),b.shift());return S}for(var T=s;h.length;){var m=h.shift(),g=h.shift();try{T=m(T)}catch(d){g(d);break}}try{S=i(T)}catch(d){return Promise.reject(d)}for(;y.length;)S=S.then(y.shift(),y.shift());return S},l.prototype.getUri=function(s){return s=a(this.defaults,s),o(s.url,s.params,s.paramsSerializer).replace(/^\?/,"")},t.forEach(["delete","get","head","options"],function(s){l.prototype[s]=function(p,h){return this.request(a(h||{},{method:s,url:p,data:(h||{}).data}))}}),t.forEach(["post","put","patch"],function(s){l.prototype[s]=function(p,h,x){return this.request(a(x||{},{method:s,url:p,data:h}))}}),e.exports=l}),Ke=N((r,e)=>{"use strict";function t(o){this.message=o}t.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},t.prototype.__CANCEL__=!0,e.exports=t}),gn=N((r,e)=>{"use strict";var t=Ke();function o(n){if(typeof n!="function")throw new TypeError("executor must be a function.");var i;this.promise=new Promise(function(c){i=c});var a=this;n(function(c){a.reason||(a.reason=new t(c),i(a.reason))})}o.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},o.source=function(){var n,i=new o(function(a){n=a});return{token:i,cancel:n}},e.exports=o}),vn=N((r,e)=>{"use strict";e.exports=function(t){return function(o){return t.apply(null,o)}}}),yn=N((r,e)=>{"use strict";e.exports=function(t){return typeof t=="object"&&t.isAxiosError===!0}}),bn=N((r,e)=>{"use strict";var t=B(),o=$e(),n=mn(),i=Xe(),a=ue();function c(l){var s=new n(l),p=o(n.prototype.request,s);return t.extend(p,n.prototype,s),t.extend(p,s),p}var u=c(a);u.Axios=n,u.create=function(l){return c(i(u.defaults,l))},u.Cancel=Ke(),u.CancelToken=gn(),u.isCancel=We(),u.all=function(l){return Promise.all(l)},u.spread=vn(),u.isAxiosError=yn(),e.exports=u,e.exports.default=u}),wn=N((r,e)=>{e.exports=bn()}),xn=en(wn()),Sn=class{url;httpClient;accessToken;constructor({url:r}){this.url=r,this.httpClient=xn.default.create({baseURL:this.url})}async upload(r){try{return{fileMetadata:(await this.httpClient.post("/files",r.file,{headers:{...this.generateUploadHeaders(r),...this.generateAuthHeaders()}})).data,error:null}}catch(e){return{fileMetadata:null,error:e}}}async getPresignedUrl(r){try{let{fileId:e}=r;return{presignedUrl:(await this.httpClient.get(`/files/${e}/presignedurl`,{headers:{...this.generateAuthHeaders()}})).data,error:null}}catch(e){return{presignedUrl:null,error:e}}}async delete(r){try{let{fileId:e}=r;return await this.httpClient.delete(`/files/${e}`,{headers:{...this.generateAuthHeaders()}}),{error:null}}catch(e){return{error:e}}}setAccessToken(r){this.accessToken=r}generateUploadHeaders(r){let{bucketId:e,name:t,id:o}=r,n={};return e&&(n["x-nhost-bucket-id"]=e),o&&(n["x-nhost-file-id"]=o),t&&(n["x-nhost-file-name"]=t),n}generateAuthHeaders(){return this.accessToken?{Authorization:`Bearer ${this.accessToken}`}:null}},Qe=class{url;api;constructor({url:r}){this.url=r,this.api=new Sn({url:r})}async upload(r){let e=new FormData;e.append("file",r.file);let{fileMetadata:t,error:o}=await this.api.upload({...r,file:e});return o?{fileMetadata:null,error:o}:t?{fileMetadata:t,error:null}:{fileMetadata:null,error:new Error("Invalid file returned")}}getUrl(r){let{fileId:e}=r;return`${this.url}/files/${e}`}async getPresignedUrl(r){let{presignedUrl:e,error:t}=await this.api.getPresignedUrl(r);return t?{presignedUrl:null,error:t}:e?{presignedUrl:e,error:null}:{presignedUrl:null,error:new Error("Invalid file id")}}async delete(r){let{error:e}=await this.api.delete(r);return e?{error:e}:{error:null}}setAccessToken(r){this.api.setAccessToken(r)}};var nr=Pe(Oe()),je=class{instance;accessToken;constructor(e){let{url:t}=e;this.accessToken=null,this.instance=nr.default.create({baseURL:t})}async call(e,t,o){let n={...this.generateAccessTokenHeaders(),...o?.headers},i;try{i=await this.instance.post(e,t,{...o,headers:n})}catch(a){if(a instanceof Error)return{res:null,error:a}}return i?{res:i,error:null}:{res:null,error:new Error("Unable to make post request to funtion")}}setAccessToken(e){if(!e){this.accessToken=null;return}this.accessToken=e}generateAccessTokenHeaders(){if(!!this.accessToken)return{Authorization:`Bearer ${this.accessToken}`}}};var sr=Pe(Oe()),Ne=class{url;instance;accessToken;constructor(e){let{url:t}=e;this.url=t,this.accessToken=null,this.instance=sr.default.create({baseURL:t})}async request(e,t,o){let n={...o?.headers,...this.generateAccessTokenHeaders()},i="",a;try{a=(await this.instance.post("",{operationName:i||void 0,query:e,variables:t},{...o,headers:n})).data}catch(c){return c instanceof Error?{data:null,error:c}:(console.error(c),{data:null,error:new Error("Unable to get do GraphQL request")})}return typeof a!="object"||Array.isArray(a)||a===null?{data:null,error:new Error("incorrect response data from GraphQL server")}:(a=a,a.errors?{data:null,error:a.errors}:{data:a.data,error:null})}getUrl(){return this.url}setAccessToken(e){if(!e){this.accessToken=null;return}this.accessToken=e}generateAccessTokenHeaders(){if(!!this.accessToken)return{Authorization:`Bearer ${this.accessToken}`}}};var Re=class{auth;storage;functions;graphql;constructor(e){if(!e.backendUrl)throw new Error("Please specify a `backendUrl`. Docs: [todo]!");let{backendUrl:t,refreshIntervalTime:o,clientStorage:n,clientStorageType:i,autoRefreshToken:a,autoLogin:c}=e;this.auth=new Me({url:`${t}/v1/auth`,refreshIntervalTime:o,clientStorage:n,clientStorageType:i,autoRefreshToken:a,autoLogin:c}),this.storage=new Qe({url:`${t}/v1/storage`}),this.functions=new je({url:`${t}/v1/functions`}),this.graphql=new Ne({url:`${t}/v1/graphql`}),this.storage.setAccessToken(this.auth.getAccessToken()),this.functions.setAccessToken(this.auth.getAccessToken()),this.graphql.setAccessToken(this.auth.getAccessToken()),this.auth.onAuthStateChanged((u,l)=>{this.storage.setAccessToken(l?.accessToken),this.functions.setAccessToken(l?.accessToken),this.graphql.setAccessToken(l?.accessToken)}),this.auth.onTokenChanged(u=>{this.storage.setAccessToken(u?.accessToken),this.functions.setAccessToken(u?.accessToken),this.graphql.setAccessToken(u?.accessToken)})}};var fo=r=>new Re(r);export{Re as NhostClient,fo as createClient};
1
+ var Ui=Object.create;var Re=Object.defineProperty;var ki=Object.getOwnPropertyDescriptor;var Fi=Object.getOwnPropertyNames;var ji=Object.getPrototypeOf,Di=Object.prototype.hasOwnProperty;var Li=t=>Re(t,"__esModule",{value:!0});var l=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var Bi=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Fi(e))!Di.call(t,s)&&(r||s!=="default")&&Re(t,s,{get:()=>e[s],enumerable:!(n=ki(e,s))||n.enumerable});return t},W=(t,e)=>Bi(Li(Re(t!=null?Ui(ji(t)):{},"default",!e&&t&&t.__esModule?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var qe=l((Tu,Mr)=>{"use strict";Mr.exports=function(e,r){return function(){for(var s=new Array(arguments.length),i=0;i<s.length;i++)s[i]=arguments[i];return e.apply(r,s)}}});var E=l((Ou,Vr)=>{"use strict";var _i=qe(),j=Object.prototype.toString;function Ie(t){return Array.isArray(t)}function Te(t){return typeof t=="undefined"}function Hi(t){return t!==null&&!Te(t)&&t.constructor!==null&&!Te(t.constructor)&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function Jr(t){return j.call(t)==="[object ArrayBuffer]"}function Mi(t){return j.call(t)==="[object FormData]"}function Ji(t){var e;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&Jr(t.buffer),e}function $i(t){return typeof t=="string"}function zi(t){return typeof t=="number"}function $r(t){return t!==null&&typeof t=="object"}function ne(t){if(j.call(t)!=="[object Object]")return!1;var e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}function Vi(t){return j.call(t)==="[object Date]"}function Gi(t){return j.call(t)==="[object File]"}function Wi(t){return j.call(t)==="[object Blob]"}function zr(t){return j.call(t)==="[object Function]"}function Xi(t){return $r(t)&&zr(t.pipe)}function Ki(t){return j.call(t)==="[object URLSearchParams]"}function Qi(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function Yi(){return typeof navigator!="undefined"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window!="undefined"&&typeof document!="undefined"}function Ne(t,e){if(!(t===null||typeof t=="undefined"))if(typeof t!="object"&&(t=[t]),Ie(t))for(var r=0,n=t.length;r<n;r++)e.call(null,t[r],r,t);else for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.call(null,t[s],s,t)}function Oe(){var t={};function e(s,i){ne(t[i])&&ne(s)?t[i]=Oe(t[i],s):ne(s)?t[i]=Oe({},s):Ie(s)?t[i]=s.slice():t[i]=s}for(var r=0,n=arguments.length;r<n;r++)Ne(arguments[r],e);return t}function Zi(t,e,r){return Ne(e,function(s,i){r&&typeof s=="function"?t[i]=_i(s,r):t[i]=s}),t}function ea(t){return t.charCodeAt(0)===65279&&(t=t.slice(1)),t}Vr.exports={isArray:Ie,isArrayBuffer:Jr,isBuffer:Hi,isFormData:Mi,isArrayBufferView:Ji,isString:$i,isNumber:zi,isObject:$r,isPlainObject:ne,isUndefined:Te,isDate:Vi,isFile:Gi,isBlob:Wi,isFunction:zr,isStream:Xi,isURLSearchParams:Ki,isStandardBrowserEnv:Yi,forEach:Ne,merge:Oe,extend:Zi,trim:Qi,stripBOM:ea}});var Ue=l((Iu,Wr)=>{"use strict";var _=E();function Gr(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}Wr.exports=function(e,r,n){if(!r)return e;var s;if(n)s=n(r);else if(_.isURLSearchParams(r))s=r.toString();else{var i=[];_.forEach(r,function(u,p){u===null||typeof u=="undefined"||(_.isArray(u)?p=p+"[]":u=[u],_.forEach(u,function(f){_.isDate(f)?f=f.toISOString():_.isObject(f)&&(f=JSON.stringify(f)),i.push(Gr(p)+"="+Gr(f))}))}),s=i.join("&")}if(s){var a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+s}return e}});var Kr=l((Nu,Xr)=>{"use strict";var ra=E();function se(){this.handlers=[]}se.prototype.use=function(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1};se.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)};se.prototype.forEach=function(e){ra.forEach(this.handlers,function(n){n!==null&&e(n)})};Xr.exports=se});var Yr=l((Uu,Qr)=>{"use strict";var ta=E();Qr.exports=function(e,r){ta.forEach(e,function(s,i){i!==r&&i.toUpperCase()===r.toUpperCase()&&(e[r]=s,delete e[i])})}});var ke=l((ku,Zr)=>{"use strict";Zr.exports=function(e,r,n,s,i){return e.config=r,n&&(e.code=n),e.request=s,e.response=i,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}},e}});var Fe=l((Fu,et)=>{"use strict";var na=ke();et.exports=function(e,r,n,s,i){var a=new Error(e);return na(a,r,n,s,i)}});var tt=l((ju,rt)=>{"use strict";var sa=Fe();rt.exports=function(e,r,n){var s=n.config.validateStatus;!n.status||!s||s(n.status)?e(n):r(sa("Request failed with status code "+n.status,n.config,null,n.request,n))}});var st=l((Du,nt)=>{"use strict";var ie=E();nt.exports=ie.isStandardBrowserEnv()?function(){return{write:function(r,n,s,i,a,o){var u=[];u.push(r+"="+encodeURIComponent(n)),ie.isNumber(s)&&u.push("expires="+new Date(s).toGMTString()),ie.isString(i)&&u.push("path="+i),ie.isString(a)&&u.push("domain="+a),o===!0&&u.push("secure"),document.cookie=u.join("; ")},read:function(r){var n=document.cookie.match(new RegExp("(^|;\\s*)("+r+")=([^;]*)"));return n?decodeURIComponent(n[3]):null},remove:function(r){this.write(r,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()});var at=l((Lu,it)=>{"use strict";it.exports=function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}});var ut=l((Bu,ot)=>{"use strict";ot.exports=function(e,r){return r?e.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):e}});var lt=l((_u,ct)=>{"use strict";var ia=at(),aa=ut();ct.exports=function(e,r){return e&&!ia(r)?aa(e,r):r}});var dt=l((Hu,ft)=>{"use strict";var je=E(),oa=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];ft.exports=function(e){var r={},n,s,i;return e&&je.forEach(e.split(`
2
+ `),function(o){if(i=o.indexOf(":"),n=je.trim(o.substr(0,i)).toLowerCase(),s=je.trim(o.substr(i+1)),n){if(r[n]&&oa.indexOf(n)>=0)return;n==="set-cookie"?r[n]=(r[n]?r[n]:[]).concat([s]):r[n]=r[n]?r[n]+", "+s:s}}),r}});var mt=l((Mu,pt)=>{"use strict";var ht=E();pt.exports=ht.isStandardBrowserEnv()?function(){var e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a"),n;function s(i){var a=i;return e&&(r.setAttribute("href",a),a=r.href),r.setAttribute("href",a),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}return n=s(window.location.href),function(a){var o=ht.isString(a)?s(a):a;return o.protocol===n.protocol&&o.host===n.host}}():function(){return function(){return!0}}()});var X=l((Ju,gt)=>{"use strict";function De(t){this.message=t}De.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")};De.prototype.__CANCEL__=!0;gt.exports=De});var Be=l(($u,vt)=>{"use strict";var ae=E(),ua=tt(),ca=st(),la=Ue(),fa=lt(),da=dt(),ha=mt(),Le=Fe(),pa=K(),ma=X();vt.exports=function(e){return new Promise(function(n,s){var i=e.data,a=e.headers,o=e.responseType,u;function p(){e.cancelToken&&e.cancelToken.unsubscribe(u),e.signal&&e.signal.removeEventListener("abort",u)}ae.isFormData(i)&&delete a["Content-Type"];var c=new XMLHttpRequest;if(e.auth){var f=e.auth.username||"",h=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";a.Authorization="Basic "+btoa(f+":"+h)}var d=fa(e.baseURL,e.url);c.open(e.method.toUpperCase(),la(d,e.params,e.paramsSerializer),!0),c.timeout=e.timeout;function R(){if(!!c){var m="getAllResponseHeaders"in c?da(c.getAllResponseHeaders()):null,q=!o||o==="text"||o==="json"?c.responseText:c.response,b={data:q,status:c.status,statusText:c.statusText,headers:m,config:e,request:c};ua(function(D){n(D),p()},function(D){s(D),p()},b),c=null}}if("onloadend"in c?c.onloadend=R:c.onreadystatechange=function(){!c||c.readyState!==4||c.status===0&&!(c.responseURL&&c.responseURL.indexOf("file:")===0)||setTimeout(R)},c.onabort=function(){!c||(s(Le("Request aborted",e,"ECONNABORTED",c)),c=null)},c.onerror=function(){s(Le("Network Error",e,null,c)),c=null},c.ontimeout=function(){var q=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",b=e.transitional||pa.transitional;e.timeoutErrorMessage&&(q=e.timeoutErrorMessage),s(Le(q,e,b.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",c)),c=null},ae.isStandardBrowserEnv()){var A=(e.withCredentials||ha(d))&&e.xsrfCookieName?ca.read(e.xsrfCookieName):void 0;A&&(a[e.xsrfHeaderName]=A)}"setRequestHeader"in c&&ae.forEach(a,function(q,b){typeof i=="undefined"&&b.toLowerCase()==="content-type"?delete a[b]:c.setRequestHeader(b,q)}),ae.isUndefined(e.withCredentials)||(c.withCredentials=!!e.withCredentials),o&&o!=="json"&&(c.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&c.addEventListener("progress",e.onDownloadProgress),typeof e.onUploadProgress=="function"&&c.upload&&c.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(u=function(m){!c||(s(!m||m&&m.type?new ma("canceled"):m),c.abort(),c=null)},e.cancelToken&&e.cancelToken.subscribe(u),e.signal&&(e.signal.aborted?u():e.signal.addEventListener("abort",u))),i||(i=null),c.send(i)})}});var K=l((zu,St)=>{"use strict";var v=E(),yt=Yr(),ga=ke(),va={"Content-Type":"application/x-www-form-urlencoded"};function wt(t,e){!v.isUndefined(t)&&v.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}function ya(){var t;return typeof XMLHttpRequest!="undefined"?t=Be():typeof process!="undefined"&&Object.prototype.toString.call(process)==="[object process]"&&(t=Be()),t}function wa(t,e,r){if(v.isString(t))try{return(e||JSON.parse)(t),v.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}var oe={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:ya(),transformRequest:[function(e,r){return yt(r,"Accept"),yt(r,"Content-Type"),v.isFormData(e)||v.isArrayBuffer(e)||v.isBuffer(e)||v.isStream(e)||v.isFile(e)||v.isBlob(e)?e:v.isArrayBufferView(e)?e.buffer:v.isURLSearchParams(e)?(wt(r,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):v.isObject(e)||r&&r["Content-Type"]==="application/json"?(wt(r,"application/json"),wa(e)):e}],transformResponse:[function(e){var r=this.transitional||oe.transitional,n=r&&r.silentJSONParsing,s=r&&r.forcedJSONParsing,i=!n&&this.responseType==="json";if(i||s&&v.isString(e)&&e.length)try{return JSON.parse(e)}catch(a){if(i)throw a.name==="SyntaxError"?ga(a,this,"E_JSON_PARSE"):a}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};v.forEach(["delete","get","head"],function(e){oe.headers[e]={}});v.forEach(["post","put","patch"],function(e){oe.headers[e]=v.merge(va)});St.exports=oe});var Et=l((Vu,bt)=>{"use strict";var Sa=E(),ba=K();bt.exports=function(e,r,n){var s=this||ba;return Sa.forEach(n,function(a){e=a.call(s,e,r)}),e}});var _e=l((Gu,At)=>{"use strict";At.exports=function(e){return!!(e&&e.__CANCEL__)}});var Pt=l((Wu,Ct)=>{"use strict";var xt=E(),He=Et(),Ea=_e(),Aa=K(),xa=X();function Me(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new xa("canceled")}Ct.exports=function(e){Me(e),e.headers=e.headers||{},e.data=He.call(e,e.data,e.headers,e.transformRequest),e.headers=xt.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),xt.forEach(["delete","get","head","post","put","patch","common"],function(s){delete e.headers[s]});var r=e.adapter||Aa.adapter;return r(e).then(function(s){return Me(e),s.data=He.call(e,s.data,s.headers,e.transformResponse),s},function(s){return Ea(s)||(Me(e),s&&s.response&&(s.response.data=He.call(e,s.response.data,s.response.headers,e.transformResponse))),Promise.reject(s)})}});var Je=l((Xu,Rt)=>{"use strict";var T=E();Rt.exports=function(e,r){r=r||{};var n={};function s(c,f){return T.isPlainObject(c)&&T.isPlainObject(f)?T.merge(c,f):T.isPlainObject(f)?T.merge({},f):T.isArray(f)?f.slice():f}function i(c){if(T.isUndefined(r[c])){if(!T.isUndefined(e[c]))return s(void 0,e[c])}else return s(e[c],r[c])}function a(c){if(!T.isUndefined(r[c]))return s(void 0,r[c])}function o(c){if(T.isUndefined(r[c])){if(!T.isUndefined(e[c]))return s(void 0,e[c])}else return s(void 0,r[c])}function u(c){if(c in r)return s(e[c],r[c]);if(c in e)return s(void 0,e[c])}var p={url:a,method:a,data:a,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:u};return T.forEach(Object.keys(e).concat(Object.keys(r)),function(f){var h=p[f]||i,d=h(f);T.isUndefined(d)&&h!==u||(n[f]=d)}),n}});var $e=l((Ku,qt)=>{qt.exports={version:"0.25.0"}});var It=l((Qu,Ot)=>{"use strict";var Ca=$e().version,ze={};["object","boolean","number","function","string","symbol"].forEach(function(t,e){ze[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});var Tt={};ze.transitional=function(e,r,n){function s(i,a){return"[Axios v"+Ca+"] Transitional option '"+i+"'"+a+(n?". "+n:"")}return function(i,a,o){if(e===!1)throw new Error(s(a," has been removed"+(r?" in "+r:"")));return r&&!Tt[a]&&(Tt[a]=!0,console.warn(s(a," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(i,a,o):!0}};function Pa(t,e,r){if(typeof t!="object")throw new TypeError("options must be an object");for(var n=Object.keys(t),s=n.length;s-- >0;){var i=n[s],a=e[i];if(a){var o=t[i],u=o===void 0||a(o,i,t);if(u!==!0)throw new TypeError("option "+i+" must be "+u);continue}if(r!==!0)throw Error("Unknown option "+i)}}Ot.exports={assertOptions:Pa,validators:ze}});var Dt=l((Yu,jt)=>{"use strict";var kt=E(),Ra=Ue(),Nt=Kr(),Ut=Pt(),ue=Je(),Ft=It(),H=Ft.validators;function Q(t){this.defaults=t,this.interceptors={request:new Nt,response:new Nt}}Q.prototype.request=function(e,r){if(typeof e=="string"?(r=r||{},r.url=e):r=e||{},!r.url)throw new Error("Provided config url is not valid");r=ue(this.defaults,r),r.method?r.method=r.method.toLowerCase():this.defaults.method?r.method=this.defaults.method.toLowerCase():r.method="get";var n=r.transitional;n!==void 0&&Ft.assertOptions(n,{silentJSONParsing:H.transitional(H.boolean),forcedJSONParsing:H.transitional(H.boolean),clarifyTimeoutError:H.transitional(H.boolean)},!1);var s=[],i=!0;this.interceptors.request.forEach(function(d){typeof d.runWhen=="function"&&d.runWhen(r)===!1||(i=i&&d.synchronous,s.unshift(d.fulfilled,d.rejected))});var a=[];this.interceptors.response.forEach(function(d){a.push(d.fulfilled,d.rejected)});var o;if(!i){var u=[Ut,void 0];for(Array.prototype.unshift.apply(u,s),u=u.concat(a),o=Promise.resolve(r);u.length;)o=o.then(u.shift(),u.shift());return o}for(var p=r;s.length;){var c=s.shift(),f=s.shift();try{p=c(p)}catch(h){f(h);break}}try{o=Ut(p)}catch(h){return Promise.reject(h)}for(;a.length;)o=o.then(a.shift(),a.shift());return o};Q.prototype.getUri=function(e){if(!e.url)throw new Error("Provided config url is not valid");return e=ue(this.defaults,e),Ra(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")};kt.forEach(["delete","get","head","options"],function(e){Q.prototype[e]=function(r,n){return this.request(ue(n||{},{method:e,url:r,data:(n||{}).data}))}});kt.forEach(["post","put","patch"],function(e){Q.prototype[e]=function(r,n,s){return this.request(ue(s||{},{method:e,url:r,data:n}))}});jt.exports=Q});var Bt=l((Zu,Lt)=>{"use strict";var qa=X();function M(t){if(typeof t!="function")throw new TypeError("executor must be a function.");var e;this.promise=new Promise(function(s){e=s});var r=this;this.promise.then(function(n){if(!!r._listeners){var s,i=r._listeners.length;for(s=0;s<i;s++)r._listeners[s](n);r._listeners=null}}),this.promise.then=function(n){var s,i=new Promise(function(a){r.subscribe(a),s=a}).then(n);return i.cancel=function(){r.unsubscribe(s)},i},t(function(s){r.reason||(r.reason=new qa(s),e(r.reason))})}M.prototype.throwIfRequested=function(){if(this.reason)throw this.reason};M.prototype.subscribe=function(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]};M.prototype.unsubscribe=function(e){if(!!this._listeners){var r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}};M.source=function(){var e,r=new M(function(s){e=s});return{token:r,cancel:e}};Lt.exports=M});var Ht=l((ec,_t)=>{"use strict";_t.exports=function(e){return function(n){return e.apply(null,n)}}});var Jt=l((rc,Mt)=>{"use strict";var Ta=E();Mt.exports=function(e){return Ta.isObject(e)&&e.isAxiosError===!0}});var Vt=l((tc,Ve)=>{"use strict";var $t=E(),Oa=qe(),ce=Dt(),Ia=Je(),Na=K();function zt(t){var e=new ce(t),r=Oa(ce.prototype.request,e);return $t.extend(r,ce.prototype,e),$t.extend(r,e),r.create=function(s){return zt(Ia(t,s))},r}var N=zt(Na);N.Axios=ce;N.Cancel=X();N.CancelToken=Bt();N.isCancel=_e();N.VERSION=$e().version;N.all=function(e){return Promise.all(e)};N.spread=Ht();N.isAxiosError=Jt();Ve.exports=N;Ve.exports.default=N});var Wt=l((nc,Gt)=>{Gt.exports=Vt()});var Qt=l((oc,Kt)=>{"use strict";Kt.exports=t=>encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)});var tn=l((uc,rn)=>{"use strict";var en="%[a-f0-9]{2}",Yt=new RegExp(en,"gi"),Zt=new RegExp("("+en+")+","gi");function We(t,e){try{return decodeURIComponent(t.join(""))}catch{}if(t.length===1)return t;e=e||1;var r=t.slice(0,e),n=t.slice(e);return Array.prototype.concat.call([],We(r),We(n))}function ka(t){try{return decodeURIComponent(t)}catch{for(var e=t.match(Yt),r=1;r<e.length;r++)t=We(e,r).join(""),e=t.match(Yt);return t}}function Fa(t){for(var e={"%FE%FF":"\uFFFD\uFFFD","%FF%FE":"\uFFFD\uFFFD"},r=Zt.exec(t);r;){try{e[r[0]]=decodeURIComponent(r[0])}catch{var n=ka(r[0]);n!==r[0]&&(e[r[0]]=n)}r=Zt.exec(t)}e["%C2"]="\uFFFD";for(var s=Object.keys(e),i=0;i<s.length;i++){var a=s[i];t=t.replace(new RegExp(a,"g"),e[a])}return t}rn.exports=function(t){if(typeof t!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof t+"`");try{return t=t.replace(/\+/g," "),decodeURIComponent(t)}catch{return Fa(t)}}});var sn=l((cc,nn)=>{"use strict";nn.exports=(t,e)=>{if(!(typeof t=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e==="")return[t];let r=t.indexOf(e);return r===-1?[t]:[t.slice(0,r),t.slice(r+e.length)]}});var on=l((lc,an)=>{"use strict";an.exports=function(t,e){for(var r={},n=Object.keys(t),s=Array.isArray(e),i=0;i<n.length;i++){var a=n[i],o=t[a];(s?e.indexOf(a)!==-1:e(a,o,t))&&(r[a]=o)}return r}});var mn=l(x=>{"use strict";var ja=Qt(),Da=tn(),cn=sn(),La=on(),Ba=t=>t==null,Xe=Symbol("encodeFragmentIdentifier");function _a(t){switch(t.arrayFormat){case"index":return e=>(r,n)=>{let s=r.length;return n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,[g(e,t),"[",s,"]"].join("")]:[...r,[g(e,t),"[",g(s,t),"]=",g(n,t)].join("")]};case"bracket":return e=>(r,n)=>n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,[g(e,t),"[]"].join("")]:[...r,[g(e,t),"[]=",g(n,t)].join("")];case"colon-list-separator":return e=>(r,n)=>n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,[g(e,t),":list="].join("")]:[...r,[g(e,t),":list=",g(n,t)].join("")];case"comma":case"separator":case"bracket-separator":{let e=t.arrayFormat==="bracket-separator"?"[]=":"=";return r=>(n,s)=>s===void 0||t.skipNull&&s===null||t.skipEmptyString&&s===""?n:(s=s===null?"":s,n.length===0?[[g(r,t),e,g(s,t)].join("")]:[[n,g(s,t)].join(t.arrayFormatSeparator)])}default:return e=>(r,n)=>n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,g(e,t)]:[...r,[g(e,t),"=",g(n,t)].join("")]}}function Ha(t){let e;switch(t.arrayFormat){case"index":return(r,n,s)=>{if(e=/\[(\d*)\]$/.exec(r),r=r.replace(/\[\d*\]$/,""),!e){s[r]=n;return}s[r]===void 0&&(s[r]={}),s[r][e[1]]=n};case"bracket":return(r,n,s)=>{if(e=/(\[\])$/.exec(r),r=r.replace(/\[\]$/,""),!e){s[r]=n;return}if(s[r]===void 0){s[r]=[n];return}s[r]=[].concat(s[r],n)};case"colon-list-separator":return(r,n,s)=>{if(e=/(:list)$/.exec(r),r=r.replace(/:list$/,""),!e){s[r]=n;return}if(s[r]===void 0){s[r]=[n];return}s[r]=[].concat(s[r],n)};case"comma":case"separator":return(r,n,s)=>{let i=typeof n=="string"&&n.includes(t.arrayFormatSeparator),a=typeof n=="string"&&!i&&k(n,t).includes(t.arrayFormatSeparator);n=a?k(n,t):n;let o=i||a?n.split(t.arrayFormatSeparator).map(u=>k(u,t)):n===null?n:k(n,t);s[r]=o};case"bracket-separator":return(r,n,s)=>{let i=/(\[\])$/.test(r);if(r=r.replace(/\[\]$/,""),!i){s[r]=n&&k(n,t);return}let a=n===null?[]:n.split(t.arrayFormatSeparator).map(o=>k(o,t));if(s[r]===void 0){s[r]=a;return}s[r]=[].concat(s[r],a)};default:return(r,n,s)=>{if(s[r]===void 0){s[r]=n;return}s[r]=[].concat(s[r],n)}}}function ln(t){if(typeof t!="string"||t.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function g(t,e){return e.encode?e.strict?ja(t):encodeURIComponent(t):t}function k(t,e){return e.decode?Da(t):t}function fn(t){return Array.isArray(t)?t.sort():typeof t=="object"?fn(Object.keys(t)).sort((e,r)=>Number(e)-Number(r)).map(e=>t[e]):t}function dn(t){let e=t.indexOf("#");return e!==-1&&(t=t.slice(0,e)),t}function Ma(t){let e="",r=t.indexOf("#");return r!==-1&&(e=t.slice(r)),e}function hn(t){t=dn(t);let e=t.indexOf("?");return e===-1?"":t.slice(e+1)}function un(t,e){return e.parseNumbers&&!Number.isNaN(Number(t))&&typeof t=="string"&&t.trim()!==""?t=Number(t):e.parseBooleans&&t!==null&&(t.toLowerCase()==="true"||t.toLowerCase()==="false")&&(t=t.toLowerCase()==="true"),t}function pn(t,e){e=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},e),ln(e.arrayFormatSeparator);let r=Ha(e),n=Object.create(null);if(typeof t!="string"||(t=t.trim().replace(/^[?#&]/,""),!t))return n;for(let s of t.split("&")){if(s==="")continue;let[i,a]=cn(e.decode?s.replace(/\+/g," "):s,"=");a=a===void 0?null:["comma","separator","bracket-separator"].includes(e.arrayFormat)?a:k(a,e),r(k(i,e),a,n)}for(let s of Object.keys(n)){let i=n[s];if(typeof i=="object"&&i!==null)for(let a of Object.keys(i))i[a]=un(i[a],e);else n[s]=un(i,e)}return e.sort===!1?n:(e.sort===!0?Object.keys(n).sort():Object.keys(n).sort(e.sort)).reduce((s,i)=>{let a=n[i];return Boolean(a)&&typeof a=="object"&&!Array.isArray(a)?s[i]=fn(a):s[i]=a,s},Object.create(null))}x.extract=hn;x.parse=pn;x.stringify=(t,e)=>{if(!t)return"";e=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},e),ln(e.arrayFormatSeparator);let r=a=>e.skipNull&&Ba(t[a])||e.skipEmptyString&&t[a]==="",n=_a(e),s={};for(let a of Object.keys(t))r(a)||(s[a]=t[a]);let i=Object.keys(s);return e.sort!==!1&&i.sort(e.sort),i.map(a=>{let o=t[a];return o===void 0?"":o===null?g(a,e):Array.isArray(o)?o.length===0&&e.arrayFormat==="bracket-separator"?g(a,e)+"[]":o.reduce(n(a),[]).join("&"):g(a,e)+"="+g(o,e)}).filter(a=>a.length>0).join("&")};x.parseUrl=(t,e)=>{e=Object.assign({decode:!0},e);let[r,n]=cn(t,"#");return Object.assign({url:r.split("?")[0]||"",query:pn(hn(t),e)},e&&e.parseFragmentIdentifier&&n?{fragmentIdentifier:k(n,e)}:{})};x.stringifyUrl=(t,e)=>{e=Object.assign({encode:!0,strict:!0,[Xe]:!0},e);let r=dn(t.url).split("?")[0]||"",n=x.extract(t.url),s=x.parse(n,{sort:!1}),i=Object.assign(s,t.query),a=x.stringify(i,e);a&&(a=`?${a}`);let o=Ma(t.url);return t.fragmentIdentifier&&(o=`#${e[Xe]?g(t.fragmentIdentifier,e):t.fragmentIdentifier}`),`${r}${a}${o}`};x.pick=(t,e,r)=>{r=Object.assign({parseFragmentIdentifier:!0,[Xe]:!1},r);let{url:n,query:s,fragmentIdentifier:i}=x.parseUrl(t,r);return x.stringifyUrl({url:n,query:La(s,e),fragmentIdentifier:i},r)};x.exclude=(t,e,r)=>{let n=Array.isArray(e)?s=>!e.includes(s):(s,i)=>!e(s,i);return x.pick(t,n,r)}});var Ye=l((Ec,vn)=>{"use strict";vn.exports=function(e,r){return function(){for(var s=new Array(arguments.length),i=0;i<s.length;i++)s[i]=arguments[i];return e.apply(r,s)}}});var C=l((Ac,Sn)=>{"use strict";var Ja=Ye(),L=Object.prototype.toString;function rr(t){return L.call(t)==="[object Array]"}function Ze(t){return typeof t=="undefined"}function $a(t){return t!==null&&!Ze(t)&&t.constructor!==null&&!Ze(t.constructor)&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function za(t){return L.call(t)==="[object ArrayBuffer]"}function Va(t){return typeof FormData!="undefined"&&t instanceof FormData}function Ga(t){var e;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&t.buffer instanceof ArrayBuffer,e}function Wa(t){return typeof t=="string"}function Xa(t){return typeof t=="number"}function yn(t){return t!==null&&typeof t=="object"}function le(t){if(L.call(t)!=="[object Object]")return!1;var e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}function Ka(t){return L.call(t)==="[object Date]"}function Qa(t){return L.call(t)==="[object File]"}function Ya(t){return L.call(t)==="[object Blob]"}function wn(t){return L.call(t)==="[object Function]"}function Za(t){return yn(t)&&wn(t.pipe)}function eo(t){return typeof URLSearchParams!="undefined"&&t instanceof URLSearchParams}function ro(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function to(){return typeof navigator!="undefined"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window!="undefined"&&typeof document!="undefined"}function tr(t,e){if(!(t===null||typeof t=="undefined"))if(typeof t!="object"&&(t=[t]),rr(t))for(var r=0,n=t.length;r<n;r++)e.call(null,t[r],r,t);else for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.call(null,t[s],s,t)}function er(){var t={};function e(s,i){le(t[i])&&le(s)?t[i]=er(t[i],s):le(s)?t[i]=er({},s):rr(s)?t[i]=s.slice():t[i]=s}for(var r=0,n=arguments.length;r<n;r++)tr(arguments[r],e);return t}function no(t,e,r){return tr(e,function(s,i){r&&typeof s=="function"?t[i]=Ja(s,r):t[i]=s}),t}function so(t){return t.charCodeAt(0)===65279&&(t=t.slice(1)),t}Sn.exports={isArray:rr,isArrayBuffer:za,isBuffer:$a,isFormData:Va,isArrayBufferView:Ga,isString:Wa,isNumber:Xa,isObject:yn,isPlainObject:le,isUndefined:Ze,isDate:Ka,isFile:Qa,isBlob:Ya,isFunction:wn,isStream:Za,isURLSearchParams:eo,isStandardBrowserEnv:to,forEach:tr,merge:er,extend:no,trim:ro,stripBOM:so}});var nr=l((xc,En)=>{"use strict";var J=C();function bn(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}En.exports=function(e,r,n){if(!r)return e;var s;if(n)s=n(r);else if(J.isURLSearchParams(r))s=r.toString();else{var i=[];J.forEach(r,function(u,p){u===null||typeof u=="undefined"||(J.isArray(u)?p=p+"[]":u=[u],J.forEach(u,function(f){J.isDate(f)?f=f.toISOString():J.isObject(f)&&(f=JSON.stringify(f)),i.push(bn(p)+"="+bn(f))}))}),s=i.join("&")}if(s){var a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+s}return e}});var xn=l((Cc,An)=>{"use strict";var io=C();function fe(){this.handlers=[]}fe.prototype.use=function(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1};fe.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)};fe.prototype.forEach=function(e){io.forEach(this.handlers,function(n){n!==null&&e(n)})};An.exports=fe});var Pn=l((Pc,Cn)=>{"use strict";var ao=C();Cn.exports=function(e,r){ao.forEach(e,function(s,i){i!==r&&i.toUpperCase()===r.toUpperCase()&&(e[r]=s,delete e[i])})}});var sr=l((Rc,Rn)=>{"use strict";Rn.exports=function(e,r,n,s,i){return e.config=r,n&&(e.code=n),e.request=s,e.response=i,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e}});var ir=l((qc,qn)=>{"use strict";var oo=sr();qn.exports=function(e,r,n,s,i){var a=new Error(e);return oo(a,r,n,s,i)}});var On=l((Tc,Tn)=>{"use strict";var uo=ir();Tn.exports=function(e,r,n){var s=n.config.validateStatus;!n.status||!s||s(n.status)?e(n):r(uo("Request failed with status code "+n.status,n.config,null,n.request,n))}});var Nn=l((Oc,In)=>{"use strict";var de=C();In.exports=de.isStandardBrowserEnv()?function(){return{write:function(r,n,s,i,a,o){var u=[];u.push(r+"="+encodeURIComponent(n)),de.isNumber(s)&&u.push("expires="+new Date(s).toGMTString()),de.isString(i)&&u.push("path="+i),de.isString(a)&&u.push("domain="+a),o===!0&&u.push("secure"),document.cookie=u.join("; ")},read:function(r){var n=document.cookie.match(new RegExp("(^|;\\s*)("+r+")=([^;]*)"));return n?decodeURIComponent(n[3]):null},remove:function(r){this.write(r,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()});var kn=l((Ic,Un)=>{"use strict";Un.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}});var jn=l((Nc,Fn)=>{"use strict";Fn.exports=function(e,r){return r?e.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):e}});var Ln=l((Uc,Dn)=>{"use strict";var co=kn(),lo=jn();Dn.exports=function(e,r){return e&&!co(r)?lo(e,r):r}});var _n=l((kc,Bn)=>{"use strict";var ar=C(),fo=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];Bn.exports=function(e){var r={},n,s,i;return e&&ar.forEach(e.split(`
3
+ `),function(o){if(i=o.indexOf(":"),n=ar.trim(o.substr(0,i)).toLowerCase(),s=ar.trim(o.substr(i+1)),n){if(r[n]&&fo.indexOf(n)>=0)return;n==="set-cookie"?r[n]=(r[n]?r[n]:[]).concat([s]):r[n]=r[n]?r[n]+", "+s:s}}),r}});var Jn=l((Fc,Mn)=>{"use strict";var Hn=C();Mn.exports=Hn.isStandardBrowserEnv()?function(){var e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a"),n;function s(i){var a=i;return e&&(r.setAttribute("href",a),a=r.href),r.setAttribute("href",a),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}return n=s(window.location.href),function(a){var o=Hn.isString(a)?s(a):a;return o.protocol===n.protocol&&o.host===n.host}}():function(){return function(){return!0}}()});var ur=l((jc,$n)=>{"use strict";var he=C(),ho=On(),po=Nn(),mo=nr(),go=Ln(),vo=_n(),yo=Jn(),or=ir();$n.exports=function(e){return new Promise(function(n,s){var i=e.data,a=e.headers,o=e.responseType;he.isFormData(i)&&delete a["Content-Type"];var u=new XMLHttpRequest;if(e.auth){var p=e.auth.username||"",c=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";a.Authorization="Basic "+btoa(p+":"+c)}var f=go(e.baseURL,e.url);u.open(e.method.toUpperCase(),mo(f,e.params,e.paramsSerializer),!0),u.timeout=e.timeout;function h(){if(!!u){var R="getAllResponseHeaders"in u?vo(u.getAllResponseHeaders()):null,A=!o||o==="text"||o==="json"?u.responseText:u.response,m={data:A,status:u.status,statusText:u.statusText,headers:R,config:e,request:u};ho(n,s,m),u=null}}if("onloadend"in u?u.onloadend=h:u.onreadystatechange=function(){!u||u.readyState!==4||u.status===0&&!(u.responseURL&&u.responseURL.indexOf("file:")===0)||setTimeout(h)},u.onabort=function(){!u||(s(or("Request aborted",e,"ECONNABORTED",u)),u=null)},u.onerror=function(){s(or("Network Error",e,null,u)),u=null},u.ontimeout=function(){var A="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(A=e.timeoutErrorMessage),s(or(A,e,e.transitional&&e.transitional.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",u)),u=null},he.isStandardBrowserEnv()){var d=(e.withCredentials||yo(f))&&e.xsrfCookieName?po.read(e.xsrfCookieName):void 0;d&&(a[e.xsrfHeaderName]=d)}"setRequestHeader"in u&&he.forEach(a,function(A,m){typeof i=="undefined"&&m.toLowerCase()==="content-type"?delete a[m]:u.setRequestHeader(m,A)}),he.isUndefined(e.withCredentials)||(u.withCredentials=!!e.withCredentials),o&&o!=="json"&&(u.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&u.addEventListener("progress",e.onDownloadProgress),typeof e.onUploadProgress=="function"&&u.upload&&u.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then(function(A){!u||(u.abort(),s(A),u=null)}),i||(i=null),u.send(i)})}});var me=l((Dc,Gn)=>{"use strict";var y=C(),zn=Pn(),wo=sr(),So={"Content-Type":"application/x-www-form-urlencoded"};function Vn(t,e){!y.isUndefined(t)&&y.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}function bo(){var t;return typeof XMLHttpRequest!="undefined"?t=ur():typeof process!="undefined"&&Object.prototype.toString.call(process)==="[object process]"&&(t=ur()),t}function Eo(t,e,r){if(y.isString(t))try{return(e||JSON.parse)(t),y.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}var pe={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:bo(),transformRequest:[function(e,r){return zn(r,"Accept"),zn(r,"Content-Type"),y.isFormData(e)||y.isArrayBuffer(e)||y.isBuffer(e)||y.isStream(e)||y.isFile(e)||y.isBlob(e)?e:y.isArrayBufferView(e)?e.buffer:y.isURLSearchParams(e)?(Vn(r,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):y.isObject(e)||r&&r["Content-Type"]==="application/json"?(Vn(r,"application/json"),Eo(e)):e}],transformResponse:[function(e){var r=this.transitional,n=r&&r.silentJSONParsing,s=r&&r.forcedJSONParsing,i=!n&&this.responseType==="json";if(i||s&&y.isString(e)&&e.length)try{return JSON.parse(e)}catch(a){if(i)throw a.name==="SyntaxError"?wo(a,this,"E_JSON_PARSE"):a}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300}};pe.headers={common:{Accept:"application/json, text/plain, */*"}};y.forEach(["delete","get","head"],function(e){pe.headers[e]={}});y.forEach(["post","put","patch"],function(e){pe.headers[e]=y.merge(So)});Gn.exports=pe});var Xn=l((Lc,Wn)=>{"use strict";var Ao=C(),xo=me();Wn.exports=function(e,r,n){var s=this||xo;return Ao.forEach(n,function(a){e=a.call(s,e,r)}),e}});var cr=l((Bc,Kn)=>{"use strict";Kn.exports=function(e){return!!(e&&e.__CANCEL__)}});var Zn=l((_c,Yn)=>{"use strict";var Qn=C(),lr=Xn(),Co=cr(),Po=me();function fr(t){t.cancelToken&&t.cancelToken.throwIfRequested()}Yn.exports=function(e){fr(e),e.headers=e.headers||{},e.data=lr.call(e,e.data,e.headers,e.transformRequest),e.headers=Qn.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),Qn.forEach(["delete","get","head","post","put","patch","common"],function(s){delete e.headers[s]});var r=e.adapter||Po.adapter;return r(e).then(function(s){return fr(e),s.data=lr.call(e,s.data,s.headers,e.transformResponse),s},function(s){return Co(s)||(fr(e),s&&s.response&&(s.response.data=lr.call(e,s.response.data,s.response.headers,e.transformResponse))),Promise.reject(s)})}});var dr=l((Hc,es)=>{"use strict";var S=C();es.exports=function(e,r){r=r||{};var n={},s=["url","method","data"],i=["headers","auth","proxy","params"],a=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],o=["validateStatus"];function u(h,d){return S.isPlainObject(h)&&S.isPlainObject(d)?S.merge(h,d):S.isPlainObject(d)?S.merge({},d):S.isArray(d)?d.slice():d}function p(h){S.isUndefined(r[h])?S.isUndefined(e[h])||(n[h]=u(void 0,e[h])):n[h]=u(e[h],r[h])}S.forEach(s,function(d){S.isUndefined(r[d])||(n[d]=u(void 0,r[d]))}),S.forEach(i,p),S.forEach(a,function(d){S.isUndefined(r[d])?S.isUndefined(e[d])||(n[d]=u(void 0,e[d])):n[d]=u(void 0,r[d])}),S.forEach(o,function(d){d in r?n[d]=u(e[d],r[d]):d in e&&(n[d]=u(void 0,e[d]))});var c=s.concat(i).concat(a).concat(o),f=Object.keys(e).concat(Object.keys(r)).filter(function(d){return c.indexOf(d)===-1});return S.forEach(f,p),n}});var rs=l((Mc,Ro)=>{Ro.exports={name:"axios",version:"0.21.4",description:"Promise based HTTP client for the browser and node.js",main:"index.js",scripts:{test:"grunt test",start:"node ./sandbox/server.js",build:"NODE_ENV=production grunt build",preversion:"npm test",version:"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json",postversion:"git push && git push --tags",examples:"node ./examples/server.js",coveralls:"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",fix:"eslint --fix lib/**/*.js"},repository:{type:"git",url:"https://github.com/axios/axios.git"},keywords:["xhr","http","ajax","promise","node"],author:"Matt Zabriskie",license:"MIT",bugs:{url:"https://github.com/axios/axios/issues"},homepage:"https://axios-http.com",devDependencies:{coveralls:"^3.0.0","es6-promise":"^4.2.4",grunt:"^1.3.0","grunt-banner":"^0.6.0","grunt-cli":"^1.2.0","grunt-contrib-clean":"^1.1.0","grunt-contrib-watch":"^1.0.0","grunt-eslint":"^23.0.0","grunt-karma":"^4.0.0","grunt-mocha-test":"^0.13.3","grunt-ts":"^6.0.0-beta.19","grunt-webpack":"^4.0.2","istanbul-instrumenter-loader":"^1.0.0","jasmine-core":"^2.4.1",karma:"^6.3.2","karma-chrome-launcher":"^3.1.0","karma-firefox-launcher":"^2.1.0","karma-jasmine":"^1.1.1","karma-jasmine-ajax":"^0.1.13","karma-safari-launcher":"^1.0.0","karma-sauce-launcher":"^4.3.6","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.8","karma-webpack":"^4.0.2","load-grunt-tasks":"^3.5.2",minimist:"^1.2.0",mocha:"^8.2.1",sinon:"^4.5.0","terser-webpack-plugin":"^4.2.3",typescript:"^4.0.5","url-search-params":"^0.10.0",webpack:"^4.44.2","webpack-dev-server":"^3.11.0"},browser:{"./lib/adapters/http.js":"./lib/adapters/xhr.js"},jsdelivr:"dist/axios.min.js",unpkg:"dist/axios.min.js",typings:"./index.d.ts",dependencies:{"follow-redirects":"^1.14.0"},bundlesize:[{path:"./dist/axios.min.js",threshold:"5kB"}]}});var as=l((Jc,is)=>{"use strict";var ns=rs(),hr={};["object","boolean","number","function","string","symbol"].forEach(function(t,e){hr[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});var ts={},qo=ns.version.split(".");function ss(t,e){for(var r=e?e.split("."):qo,n=t.split("."),s=0;s<3;s++){if(r[s]>n[s])return!0;if(r[s]<n[s])return!1}return!1}hr.transitional=function(e,r,n){var s=r&&ss(r);function i(a,o){return"[Axios v"+ns.version+"] Transitional option '"+a+"'"+o+(n?". "+n:"")}return function(a,o,u){if(e===!1)throw new Error(i(o," has been removed in "+r));return s&&!ts[o]&&(ts[o]=!0,console.warn(i(o," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(a,o,u):!0}};function To(t,e,r){if(typeof t!="object")throw new TypeError("options must be an object");for(var n=Object.keys(t),s=n.length;s-- >0;){var i=n[s],a=e[i];if(a){var o=t[i],u=o===void 0||a(o,i,t);if(u!==!0)throw new TypeError("option "+i+" must be "+u);continue}if(r!==!0)throw Error("Unknown option "+i)}}is.exports={isOlderVersion:ss,assertOptions:To,validators:hr}});var ds=l(($c,fs)=>{"use strict";var cs=C(),Oo=nr(),os=xn(),us=Zn(),ge=dr(),ls=as(),$=ls.validators;function Z(t){this.defaults=t,this.interceptors={request:new os,response:new os}}Z.prototype.request=function(e){typeof e=="string"?(e=arguments[1]||{},e.url=arguments[0]):e=e||{},e=ge(this.defaults,e),e.method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var r=e.transitional;r!==void 0&&ls.assertOptions(r,{silentJSONParsing:$.transitional($.boolean,"1.0.0"),forcedJSONParsing:$.transitional($.boolean,"1.0.0"),clarifyTimeoutError:$.transitional($.boolean,"1.0.0")},!1);var n=[],s=!0;this.interceptors.request.forEach(function(h){typeof h.runWhen=="function"&&h.runWhen(e)===!1||(s=s&&h.synchronous,n.unshift(h.fulfilled,h.rejected))});var i=[];this.interceptors.response.forEach(function(h){i.push(h.fulfilled,h.rejected)});var a;if(!s){var o=[us,void 0];for(Array.prototype.unshift.apply(o,n),o=o.concat(i),a=Promise.resolve(e);o.length;)a=a.then(o.shift(),o.shift());return a}for(var u=e;n.length;){var p=n.shift(),c=n.shift();try{u=p(u)}catch(f){c(f);break}}try{a=us(u)}catch(f){return Promise.reject(f)}for(;i.length;)a=a.then(i.shift(),i.shift());return a};Z.prototype.getUri=function(e){return e=ge(this.defaults,e),Oo(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")};cs.forEach(["delete","get","head","options"],function(e){Z.prototype[e]=function(r,n){return this.request(ge(n||{},{method:e,url:r,data:(n||{}).data}))}});cs.forEach(["post","put","patch"],function(e){Z.prototype[e]=function(r,n,s){return this.request(ge(s||{},{method:e,url:r,data:n}))}});fs.exports=Z});var mr=l((zc,hs)=>{"use strict";function pr(t){this.message=t}pr.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")};pr.prototype.__CANCEL__=!0;hs.exports=pr});var ms=l((Vc,ps)=>{"use strict";var Io=mr();function ve(t){if(typeof t!="function")throw new TypeError("executor must be a function.");var e;this.promise=new Promise(function(s){e=s});var r=this;t(function(s){r.reason||(r.reason=new Io(s),e(r.reason))})}ve.prototype.throwIfRequested=function(){if(this.reason)throw this.reason};ve.source=function(){var e,r=new ve(function(s){e=s});return{token:r,cancel:e}};ps.exports=ve});var vs=l((Gc,gs)=>{"use strict";gs.exports=function(e){return function(n){return e.apply(null,n)}}});var ws=l((Wc,ys)=>{"use strict";ys.exports=function(e){return typeof e=="object"&&e.isAxiosError===!0}});var Es=l((Xc,gr)=>{"use strict";var Ss=C(),No=Ye(),ye=ds(),Uo=dr(),ko=me();function bs(t){var e=new ye(t),r=No(ye.prototype.request,e);return Ss.extend(r,ye.prototype,e),Ss.extend(r,e),r}var I=bs(ko);I.Axios=ye;I.create=function(e){return bs(Uo(I.defaults,e))};I.Cancel=mr();I.CancelToken=ms();I.isCancel=cr();I.all=function(e){return Promise.all(e)};I.spread=vs();I.isAxiosError=ws();gr.exports=I;gr.exports.default=I});var xs=l((Kc,As)=>{As.exports=Es()});var wr=l((il,Ps)=>{"use strict";Ps.exports=function(e,r){return function(){for(var s=new Array(arguments.length),i=0;i<s.length;i++)s[i]=arguments[i];return e.apply(r,s)}}});var P=l((al,Ts)=>{"use strict";var Fo=wr(),B=Object.prototype.toString;function Er(t){return B.call(t)==="[object Array]"}function Sr(t){return typeof t=="undefined"}function jo(t){return t!==null&&!Sr(t)&&t.constructor!==null&&!Sr(t.constructor)&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function Do(t){return B.call(t)==="[object ArrayBuffer]"}function Lo(t){return typeof FormData!="undefined"&&t instanceof FormData}function Bo(t){var e;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&t.buffer instanceof ArrayBuffer,e}function _o(t){return typeof t=="string"}function Ho(t){return typeof t=="number"}function Rs(t){return t!==null&&typeof t=="object"}function we(t){if(B.call(t)!=="[object Object]")return!1;var e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}function Mo(t){return B.call(t)==="[object Date]"}function Jo(t){return B.call(t)==="[object File]"}function $o(t){return B.call(t)==="[object Blob]"}function qs(t){return B.call(t)==="[object Function]"}function zo(t){return Rs(t)&&qs(t.pipe)}function Vo(t){return typeof URLSearchParams!="undefined"&&t instanceof URLSearchParams}function Go(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function Wo(){return typeof navigator!="undefined"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window!="undefined"&&typeof document!="undefined"}function Ar(t,e){if(!(t===null||typeof t=="undefined"))if(typeof t!="object"&&(t=[t]),Er(t))for(var r=0,n=t.length;r<n;r++)e.call(null,t[r],r,t);else for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.call(null,t[s],s,t)}function br(){var t={};function e(s,i){we(t[i])&&we(s)?t[i]=br(t[i],s):we(s)?t[i]=br({},s):Er(s)?t[i]=s.slice():t[i]=s}for(var r=0,n=arguments.length;r<n;r++)Ar(arguments[r],e);return t}function Xo(t,e,r){return Ar(e,function(s,i){r&&typeof s=="function"?t[i]=Fo(s,r):t[i]=s}),t}function Ko(t){return t.charCodeAt(0)===65279&&(t=t.slice(1)),t}Ts.exports={isArray:Er,isArrayBuffer:Do,isBuffer:jo,isFormData:Lo,isArrayBufferView:Bo,isString:_o,isNumber:Ho,isObject:Rs,isPlainObject:we,isUndefined:Sr,isDate:Mo,isFile:Jo,isBlob:$o,isFunction:qs,isStream:zo,isURLSearchParams:Vo,isStandardBrowserEnv:Wo,forEach:Ar,merge:br,extend:Xo,trim:Go,stripBOM:Ko}});var xr=l((ol,Is)=>{"use strict";var z=P();function Os(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}Is.exports=function(e,r,n){if(!r)return e;var s;if(n)s=n(r);else if(z.isURLSearchParams(r))s=r.toString();else{var i=[];z.forEach(r,function(u,p){u===null||typeof u=="undefined"||(z.isArray(u)?p=p+"[]":u=[u],z.forEach(u,function(f){z.isDate(f)?f=f.toISOString():z.isObject(f)&&(f=JSON.stringify(f)),i.push(Os(p)+"="+Os(f))}))}),s=i.join("&")}if(s){var a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+s}return e}});var Us=l((ul,Ns)=>{"use strict";var Qo=P();function Se(){this.handlers=[]}Se.prototype.use=function(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1};Se.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)};Se.prototype.forEach=function(e){Qo.forEach(this.handlers,function(n){n!==null&&e(n)})};Ns.exports=Se});var Fs=l((cl,ks)=>{"use strict";var Yo=P();ks.exports=function(e,r){Yo.forEach(e,function(s,i){i!==r&&i.toUpperCase()===r.toUpperCase()&&(e[r]=s,delete e[i])})}});var Cr=l((ll,js)=>{"use strict";js.exports=function(e,r,n,s,i){return e.config=r,n&&(e.code=n),e.request=s,e.response=i,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}},e}});var Pr=l((fl,Ds)=>{"use strict";var Zo=Cr();Ds.exports=function(e,r,n,s,i){var a=new Error(e);return Zo(a,r,n,s,i)}});var Bs=l((dl,Ls)=>{"use strict";var eu=Pr();Ls.exports=function(e,r,n){var s=n.config.validateStatus;!n.status||!s||s(n.status)?e(n):r(eu("Request failed with status code "+n.status,n.config,null,n.request,n))}});var Hs=l((hl,_s)=>{"use strict";var be=P();_s.exports=be.isStandardBrowserEnv()?function(){return{write:function(r,n,s,i,a,o){var u=[];u.push(r+"="+encodeURIComponent(n)),be.isNumber(s)&&u.push("expires="+new Date(s).toGMTString()),be.isString(i)&&u.push("path="+i),be.isString(a)&&u.push("domain="+a),o===!0&&u.push("secure"),document.cookie=u.join("; ")},read:function(r){var n=document.cookie.match(new RegExp("(^|;\\s*)("+r+")=([^;]*)"));return n?decodeURIComponent(n[3]):null},remove:function(r){this.write(r,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()});var Js=l((pl,Ms)=>{"use strict";Ms.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}});var zs=l((ml,$s)=>{"use strict";$s.exports=function(e,r){return r?e.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):e}});var Gs=l((gl,Vs)=>{"use strict";var ru=Js(),tu=zs();Vs.exports=function(e,r){return e&&!ru(r)?tu(e,r):r}});var Xs=l((vl,Ws)=>{"use strict";var Rr=P(),nu=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];Ws.exports=function(e){var r={},n,s,i;return e&&Rr.forEach(e.split(`
4
+ `),function(o){if(i=o.indexOf(":"),n=Rr.trim(o.substr(0,i)).toLowerCase(),s=Rr.trim(o.substr(i+1)),n){if(r[n]&&nu.indexOf(n)>=0)return;n==="set-cookie"?r[n]=(r[n]?r[n]:[]).concat([s]):r[n]=r[n]?r[n]+", "+s:s}}),r}});var Ys=l((yl,Qs)=>{"use strict";var Ks=P();Qs.exports=Ks.isStandardBrowserEnv()?function(){var e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a"),n;function s(i){var a=i;return e&&(r.setAttribute("href",a),a=r.href),r.setAttribute("href",a),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}return n=s(window.location.href),function(a){var o=Ks.isString(a)?s(a):a;return o.protocol===n.protocol&&o.host===n.host}}():function(){return function(){return!0}}()});var ee=l((wl,Zs)=>{"use strict";function qr(t){this.message=t}qr.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")};qr.prototype.__CANCEL__=!0;Zs.exports=qr});var Or=l((Sl,ei)=>{"use strict";var Ee=P(),su=Bs(),iu=Hs(),au=xr(),ou=Gs(),uu=Xs(),cu=Ys(),Tr=Pr(),lu=re(),fu=ee();ei.exports=function(e){return new Promise(function(n,s){var i=e.data,a=e.headers,o=e.responseType,u;function p(){e.cancelToken&&e.cancelToken.unsubscribe(u),e.signal&&e.signal.removeEventListener("abort",u)}Ee.isFormData(i)&&delete a["Content-Type"];var c=new XMLHttpRequest;if(e.auth){var f=e.auth.username||"",h=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";a.Authorization="Basic "+btoa(f+":"+h)}var d=ou(e.baseURL,e.url);c.open(e.method.toUpperCase(),au(d,e.params,e.paramsSerializer),!0),c.timeout=e.timeout;function R(){if(!!c){var m="getAllResponseHeaders"in c?uu(c.getAllResponseHeaders()):null,q=!o||o==="text"||o==="json"?c.responseText:c.response,b={data:q,status:c.status,statusText:c.statusText,headers:m,config:e,request:c};su(function(D){n(D),p()},function(D){s(D),p()},b),c=null}}if("onloadend"in c?c.onloadend=R:c.onreadystatechange=function(){!c||c.readyState!==4||c.status===0&&!(c.responseURL&&c.responseURL.indexOf("file:")===0)||setTimeout(R)},c.onabort=function(){!c||(s(Tr("Request aborted",e,"ECONNABORTED",c)),c=null)},c.onerror=function(){s(Tr("Network Error",e,null,c)),c=null},c.ontimeout=function(){var q=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",b=e.transitional||lu.transitional;e.timeoutErrorMessage&&(q=e.timeoutErrorMessage),s(Tr(q,e,b.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",c)),c=null},Ee.isStandardBrowserEnv()){var A=(e.withCredentials||cu(d))&&e.xsrfCookieName?iu.read(e.xsrfCookieName):void 0;A&&(a[e.xsrfHeaderName]=A)}"setRequestHeader"in c&&Ee.forEach(a,function(q,b){typeof i=="undefined"&&b.toLowerCase()==="content-type"?delete a[b]:c.setRequestHeader(b,q)}),Ee.isUndefined(e.withCredentials)||(c.withCredentials=!!e.withCredentials),o&&o!=="json"&&(c.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&c.addEventListener("progress",e.onDownloadProgress),typeof e.onUploadProgress=="function"&&c.upload&&c.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(u=function(m){!c||(s(!m||m&&m.type?new fu("canceled"):m),c.abort(),c=null)},e.cancelToken&&e.cancelToken.subscribe(u),e.signal&&(e.signal.aborted?u():e.signal.addEventListener("abort",u))),i||(i=null),c.send(i)})}});var re=l((bl,ni)=>{"use strict";var w=P(),ri=Fs(),du=Cr(),hu={"Content-Type":"application/x-www-form-urlencoded"};function ti(t,e){!w.isUndefined(t)&&w.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}function pu(){var t;return typeof XMLHttpRequest!="undefined"?t=Or():typeof process!="undefined"&&Object.prototype.toString.call(process)==="[object process]"&&(t=Or()),t}function mu(t,e,r){if(w.isString(t))try{return(e||JSON.parse)(t),w.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}var Ae={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:pu(),transformRequest:[function(e,r){return ri(r,"Accept"),ri(r,"Content-Type"),w.isFormData(e)||w.isArrayBuffer(e)||w.isBuffer(e)||w.isStream(e)||w.isFile(e)||w.isBlob(e)?e:w.isArrayBufferView(e)?e.buffer:w.isURLSearchParams(e)?(ti(r,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):w.isObject(e)||r&&r["Content-Type"]==="application/json"?(ti(r,"application/json"),mu(e)):e}],transformResponse:[function(e){var r=this.transitional||Ae.transitional,n=r&&r.silentJSONParsing,s=r&&r.forcedJSONParsing,i=!n&&this.responseType==="json";if(i||s&&w.isString(e)&&e.length)try{return JSON.parse(e)}catch(a){if(i)throw a.name==="SyntaxError"?du(a,this,"E_JSON_PARSE"):a}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};w.forEach(["delete","get","head"],function(e){Ae.headers[e]={}});w.forEach(["post","put","patch"],function(e){Ae.headers[e]=w.merge(hu)});ni.exports=Ae});var ii=l((El,si)=>{"use strict";var gu=P(),vu=re();si.exports=function(e,r,n){var s=this||vu;return gu.forEach(n,function(a){e=a.call(s,e,r)}),e}});var Ir=l((Al,ai)=>{"use strict";ai.exports=function(e){return!!(e&&e.__CANCEL__)}});var ci=l((xl,ui)=>{"use strict";var oi=P(),Nr=ii(),yu=Ir(),wu=re(),Su=ee();function Ur(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Su("canceled")}ui.exports=function(e){Ur(e),e.headers=e.headers||{},e.data=Nr.call(e,e.data,e.headers,e.transformRequest),e.headers=oi.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),oi.forEach(["delete","get","head","post","put","patch","common"],function(s){delete e.headers[s]});var r=e.adapter||wu.adapter;return r(e).then(function(s){return Ur(e),s.data=Nr.call(e,s.data,s.headers,e.transformResponse),s},function(s){return yu(s)||(Ur(e),s&&s.response&&(s.response.data=Nr.call(e,s.response.data,s.response.headers,e.transformResponse))),Promise.reject(s)})}});var kr=l((Cl,li)=>{"use strict";var O=P();li.exports=function(e,r){r=r||{};var n={};function s(c,f){return O.isPlainObject(c)&&O.isPlainObject(f)?O.merge(c,f):O.isPlainObject(f)?O.merge({},f):O.isArray(f)?f.slice():f}function i(c){if(O.isUndefined(r[c])){if(!O.isUndefined(e[c]))return s(void 0,e[c])}else return s(e[c],r[c])}function a(c){if(!O.isUndefined(r[c]))return s(void 0,r[c])}function o(c){if(O.isUndefined(r[c])){if(!O.isUndefined(e[c]))return s(void 0,e[c])}else return s(void 0,r[c])}function u(c){if(c in r)return s(e[c],r[c]);if(c in e)return s(void 0,e[c])}var p={url:a,method:a,data:a,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:u};return O.forEach(Object.keys(e).concat(Object.keys(r)),function(f){var h=p[f]||i,d=h(f);O.isUndefined(d)&&h!==u||(n[f]=d)}),n}});var Fr=l((Pl,fi)=>{fi.exports={version:"0.23.0"}});var pi=l((Rl,hi)=>{"use strict";var bu=Fr().version,jr={};["object","boolean","number","function","string","symbol"].forEach(function(t,e){jr[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});var di={};jr.transitional=function(e,r,n){function s(i,a){return"[Axios v"+bu+"] Transitional option '"+i+"'"+a+(n?". "+n:"")}return function(i,a,o){if(e===!1)throw new Error(s(a," has been removed"+(r?" in "+r:"")));return r&&!di[a]&&(di[a]=!0,console.warn(s(a," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(i,a,o):!0}};function Eu(t,e,r){if(typeof t!="object")throw new TypeError("options must be an object");for(var n=Object.keys(t),s=n.length;s-- >0;){var i=n[s],a=e[i];if(a){var o=t[i],u=o===void 0||a(o,i,t);if(u!==!0)throw new TypeError("option "+i+" must be "+u);continue}if(r!==!0)throw Error("Unknown option "+i)}}hi.exports={assertOptions:Eu,validators:jr}});var Si=l((ql,wi)=>{"use strict";var vi=P(),Au=xr(),mi=Us(),gi=ci(),xe=kr(),yi=pi(),V=yi.validators;function te(t){this.defaults=t,this.interceptors={request:new mi,response:new mi}}te.prototype.request=function(e){typeof e=="string"?(e=arguments[1]||{},e.url=arguments[0]):e=e||{},e=xe(this.defaults,e),e.method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var r=e.transitional;r!==void 0&&yi.assertOptions(r,{silentJSONParsing:V.transitional(V.boolean),forcedJSONParsing:V.transitional(V.boolean),clarifyTimeoutError:V.transitional(V.boolean)},!1);var n=[],s=!0;this.interceptors.request.forEach(function(h){typeof h.runWhen=="function"&&h.runWhen(e)===!1||(s=s&&h.synchronous,n.unshift(h.fulfilled,h.rejected))});var i=[];this.interceptors.response.forEach(function(h){i.push(h.fulfilled,h.rejected)});var a;if(!s){var o=[gi,void 0];for(Array.prototype.unshift.apply(o,n),o=o.concat(i),a=Promise.resolve(e);o.length;)a=a.then(o.shift(),o.shift());return a}for(var u=e;n.length;){var p=n.shift(),c=n.shift();try{u=p(u)}catch(f){c(f);break}}try{a=gi(u)}catch(f){return Promise.reject(f)}for(;i.length;)a=a.then(i.shift(),i.shift());return a};te.prototype.getUri=function(e){return e=xe(this.defaults,e),Au(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")};vi.forEach(["delete","get","head","options"],function(e){te.prototype[e]=function(r,n){return this.request(xe(n||{},{method:e,url:r,data:(n||{}).data}))}});vi.forEach(["post","put","patch"],function(e){te.prototype[e]=function(r,n,s){return this.request(xe(s||{},{method:e,url:r,data:n}))}});wi.exports=te});var Ei=l((Tl,bi)=>{"use strict";var xu=ee();function G(t){if(typeof t!="function")throw new TypeError("executor must be a function.");var e;this.promise=new Promise(function(s){e=s});var r=this;this.promise.then(function(n){if(!!r._listeners){var s,i=r._listeners.length;for(s=0;s<i;s++)r._listeners[s](n);r._listeners=null}}),this.promise.then=function(n){var s,i=new Promise(function(a){r.subscribe(a),s=a}).then(n);return i.cancel=function(){r.unsubscribe(s)},i},t(function(s){r.reason||(r.reason=new xu(s),e(r.reason))})}G.prototype.throwIfRequested=function(){if(this.reason)throw this.reason};G.prototype.subscribe=function(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]};G.prototype.unsubscribe=function(e){if(!!this._listeners){var r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}};G.source=function(){var e,r=new G(function(s){e=s});return{token:r,cancel:e}};bi.exports=G});var xi=l((Ol,Ai)=>{"use strict";Ai.exports=function(e){return function(n){return e.apply(null,n)}}});var Pi=l((Il,Ci)=>{"use strict";Ci.exports=function(e){return typeof e=="object"&&e.isAxiosError===!0}});var Ti=l((Nl,Dr)=>{"use strict";var Ri=P(),Cu=wr(),Ce=Si(),Pu=kr(),Ru=re();function qi(t){var e=new Ce(t),r=Cu(Ce.prototype.request,e);return Ri.extend(r,Ce.prototype,e),Ri.extend(r,e),r.create=function(s){return qi(Pu(t,s))},r}var U=qi(Ru);U.Axios=Ce;U.Cancel=ee();U.CancelToken=Ei();U.isCancel=Ir();U.VERSION=Fr().version;U.all=function(e){return Promise.all(e)};U.spread=xi();U.isAxiosError=Pi();Dr.exports=U;Dr.exports.default=U});var Lr=l((Ul,Oi)=>{Oi.exports=Ti()});var Xt=W(Wt()),Ua=500,Ge=class{constructor({url:e=""}){this.url=e,this.httpClient=Xt.default.create({baseURL:this.url}),this.httpClient.interceptors.response.use(r=>r,r=>{var n,s,i,a,o,u;return Promise.reject({message:(a=(i=(s=(n=r.response)==null?void 0:n.data)==null?void 0:s.message)!=null?i:r.message)!=null?a:JSON.stringify(r),status:(u=(o=r.response)==null?void 0:o.status)!=null?u:Ua})})}async signUpEmailPassword(e){try{return{data:(await this.httpClient.post("/signup/email-password",e)).data,error:null}}catch(r){return{data:null,error:r}}}async signInEmailPassword(e){try{return{data:(await this.httpClient.post("/signin/email-password",e)).data,error:null}}catch(r){return{data:null,error:r}}}async signInPasswordlessEmail(e){try{return{data:(await this.httpClient.post("/signin/passwordless/email",e)).data,error:null}}catch(r){return{data:null,error:r}}}async signInPasswordlessSms(e){try{return{data:(await this.httpClient.post("/signin/passwordless/sms",e)).data,error:null}}catch(r){return{data:null,error:r}}}async signInPasswordlessSmsOtp(e){try{return{data:(await this.httpClient.post("/signin/passwordless/sms/otp",e)).data,error:null}}catch(r){return{data:null,error:r}}}async signOut(e){try{return await this.httpClient.post("/signout",e),{error:null}}catch(r){return{error:r}}}async refreshToken(e){try{let r=await this.httpClient.post("/token",e);return{error:null,session:r.data}}catch(r){return{error:r,session:null}}}async resetPassword(e){try{return await this.httpClient.post("/user/password/reset",e),{error:null}}catch(r){return{error:r}}}async changePassword(e){try{return await this.httpClient.post("/user/password",e,{headers:{...this.generateAuthHeaders()}}),{error:null}}catch(r){return{error:r}}}async sendVerificationEmail(e){try{return await this.httpClient.post("/user/email/send-verification-email",e),{error:null}}catch(r){return{error:r}}}async changeEmail(e){try{return await this.httpClient.post("/user/email/change",e,{headers:{...this.generateAuthHeaders()}}),{error:null}}catch(r){return{error:r}}}async deanonymize(e){try{return await this.httpClient.post("/user/deanonymize",e),{error:null}}catch(r){return{error:r}}}async verifyEmail(e){try{return{data:(await this.httpClient.post("/user/email/verify",e)).data,error:null}}catch(r){return{data:null,error:r}}}setAccessToken(e){this.accessToken=e}generateAuthHeaders(){return this.accessToken?{Authorization:`Bearer ${this.accessToken}`}:null}};var gn=W(mn());var F="nhostRefreshToken";var Y=()=>typeof window!="undefined",Ke=class{constructor(){this.memory={}}setItem(e,r){this.memory[e]=r}getItem(e){return this.memory[e]}removeItem(e){delete this.memory[e]}};var Qe=class{constructor({url:e,autoRefreshToken:r=!0,autoLogin:n=!0,refreshIntervalTime:s,clientStorage:i,clientStorageType:a="web"}){this.refreshIntervalTime=s,i?this.clientStorage=i:this.clientStorage=Y()?localStorage:new Ke,this.clientStorageType=a,this.onTokenChangedFunctions=[],this.onAuthChangedFunctions=[],this.refreshInterval,this.refreshSleepCheckInterval=0,this.refreshIntervalSleepCheckLastSample=Date.now(),this.sampleRate=2e3,this.url=e,this.autoRefreshToken=r,this.initAuthLoading=!0,this.session=null,this.api=new Ge({url:this.url});let o=null,u=!1;if(n&&Y()&&window.location){let p=gn.default.parse(window.location.toString().split("#")[1]);if("refreshToken"in p&&(o=p.refreshToken),"otp"in p&&"email"in p){let{otp:c,email:f}=p;this.signIn({otp:c,email:f}),u=!0}}!u&&n?this._autoLogin(o):o&&this._setItem(F,o)}async signUp(e){let{email:r,password:n}=e;if(r&&n){let{data:s,error:i}=await this.api.signUpEmailPassword(e);if(i)return{session:null,error:i};if(!s)return{session:null,error:{message:"An error occurred on sign up.",status:500}};let{session:a}=s;return a&&await this._setSession(a),{session:a,error:null}}return{session:null,error:{message:"Incorrect parameters",status:500}}}async signIn(e){if("provider"in e){let{provider:r,options:n}=e,s=`${this.url}/signin/provider/${r}`;return n&&(s+="?",n.locale&&(s+=`locale=${encodeURIComponent(n.locale)}&`),n.allowedRoles&&(s+=`allowedRoles=${encodeURIComponent(n.allowedRoles.join(","))}&`),n.defaultRole&&(s+=`defaultRole=${encodeURIComponent(n.defaultRole)}&`),n.displayName&&(s+=`displayName=${encodeURIComponent(n.displayName)}&`),n.redirectTo&&(s+=`redirectTo=${encodeURIComponent(n.redirectTo)}&`),n.metadata&&(s+=`metadata=${encodeURIComponent(JSON.stringify(n.metadata))}&`),s=s.slice(0,-1)),Y()&&(window.location.href=s),{providerUrl:s,provider:r,session:null,mfa:null,error:null}}if("email"in e&&"password"in e){let{data:r,error:n}=await this.api.signInEmailPassword(e);if(n)return{session:null,mfa:null,error:n};if(!r)return{session:null,mfa:null,error:{message:"Incorrect Data",status:500}};let{session:s,mfa:i}=r;return s&&await this._setSession(s),{session:s,mfa:i,error:null}}if("email"in e&&!("otp"in e)){let{error:r}=await this.api.signInPasswordlessEmail(e);return r?{session:null,mfa:null,error:r}:{session:null,mfa:null,error:null}}if("phoneNumber"in e&&!("otp"in e)){let{error:r}=await this.api.signInPasswordlessSms(e);return r?{session:null,mfa:null,error:r}:{session:null,mfa:null,error:null}}if("otp"in e){let{data:r,error:n}=await this.api.signInPasswordlessSmsOtp(e);if(n)return{session:null,mfa:null,error:n};if(!r)return{session:null,mfa:null,error:{message:"Incorrect data",status:500}};let{session:s,mfa:i}=r;return s&&await this._setSession(s),{session:s,mfa:i,error:null}}return{session:null,mfa:null,error:{message:"Incorrect parameters",status:500}}}async signOut(e){let r=await this._getItem(F);this._clearSession();let{error:n}=await this.api.signOut({refreshToken:r,all:e==null?void 0:e.all});return{error:n}}async verifyEmail(e){return await this.api.verifyEmail(e)}async resetPassword(e){let{error:r}=await this.api.resetPassword(e);return{error:r}}async changePassword(e){let{error:r}=await this.api.changePassword(e);return{error:r}}async sendVerificationEmail(e){let{error:r}=await this.api.sendVerificationEmail(e);return{error:r}}async changeEmail(e){let{error:r}=await this.api.changeEmail(e);return{error:r}}async deanonymize(e){let{error:r}=await this.api.deanonymize(e);return{error:r}}onTokenChanged(e){this.onTokenChangedFunctions.push(e);let r=this.onTokenChangedFunctions.length-1;return()=>{try{this.onTokenChangedFunctions[r]=()=>{}}catch{console.warn("Unable to unsubscribe onTokenChanged function. Maybe the functions is already unsubscribed?")}}}onAuthStateChanged(e){this.onAuthChangedFunctions.push(e);let r=this.onAuthChangedFunctions.length-1;return()=>{try{this.onAuthChangedFunctions[r]=()=>{}}catch{console.warn("Unable to unsubscribe onAuthStateChanged function. Maybe you already did?")}}}isAuthenticated(){return this.session!==null}async isAuthenticatedAsync(){return new Promise(e=>{if(!this.initAuthLoading)e(this.isAuthenticated());else{let r=this.onAuthStateChanged((n,s)=>{e(n==="SIGNED_IN"),r()})}})}getAuthenticationStatus(){return this.initAuthLoading?{isAuthenticated:!1,isLoading:!0}:{isAuthenticated:this.session!==null,isLoading:!1}}getJWTToken(){return this.getAccessToken()}getAccessToken(){if(!!this.session)return this.session.accessToken}async refreshSession(e){let r=e||await this._getItem(F);return r||console.warn("no refresh token found. No way of refreshing session"),this._refreshTokens(r)}getSession(){return this.session}getUser(){return this.session?this.session.user:null}async _setItem(e,r){if(typeof r!="string"){console.error('value is not of type "string"');return}switch(this.clientStorageType){case"web":if(typeof this.clientStorage.setItem!="function"){console.error("this.clientStorage.setItem is not a function");break}this.clientStorage.setItem(e,r);break;case"custom":case"react-native":if(typeof this.clientStorage.setItem!="function"){console.error("this.clientStorage.setItem is not a function");break}await this.clientStorage.setItem(e,r);break;case"capacitor":if(typeof this.clientStorage.set!="function"){console.error("this.clientStorage.set is not a function");break}await this.clientStorage.set({key:e,value:r});break;case"expo-secure-storage":if(typeof this.clientStorage.setItemAsync!="function"){console.error("this.clientStorage.setItemAsync is not a function");break}this.clientStorage.setItemAsync(e,r);break;default:break}}async _getItem(e){switch(this.clientStorageType){case"web":if(typeof this.clientStorage.getItem!="function"){console.error("this.clientStorage.getItem is not a function");break}return this.clientStorage.getItem(e);case"custom":case"react-native":if(typeof this.clientStorage.getItem!="function"){console.error("this.clientStorage.getItem is not a function");break}return await this.clientStorage.getItem(e);case"capacitor":if(typeof this.clientStorage.get!="function"){console.error("this.clientStorage.get is not a function");break}return(await this.clientStorage.get({key:e})).value;case"expo-secure-storage":if(typeof this.clientStorage.getItemAsync!="function"){console.error("this.clientStorage.getItemAsync is not a function");break}return this.clientStorage.getItemAsync(e);default:return""}return""}async _removeItem(e){switch(this.clientStorageType){case"web":if(typeof this.clientStorage.removeItem!="function"){console.error("this.clientStorage.removeItem is not a function");break}return void this.clientStorage.removeItem(e);case"custom":case"react-native":if(typeof this.clientStorage.removeItem!="function"){console.error("this.clientStorage.removeItem is not a function");break}return void this.clientStorage.removeItem(e);case"capacitor":if(typeof this.clientStorage.remove!="function"){console.error("this.clientStorage.remove is not a function");break}await this.clientStorage.remove({key:e});break;case"expo-secure-storage":if(typeof this.clientStorage.deleteItemAsync!="function"){console.error("this.clientStorage.deleteItemAsync is not a function");break}this.clientStorage.deleteItemAsync(e);break;default:break}}_autoLogin(e){!Y()||this._refreshTokens(e)}async _refreshTokens(e){let r=e||await this._getItem(F);if(!r){setTimeout(async()=>{await this._clearSession()},0);return}try{let{session:n,error:s}=await this.api.refreshToken({refreshToken:r});if(s&&s.status===401){await this._clearSession();return}if(!n)throw new Error("Invalid session data");await this._setSession(n),this.tokenChanged()}catch{}}tokenChanged(){for(let e of this.onTokenChangedFunctions)e(this.session)}authStateChanged({event:e,session:r}){e==="SIGNED_IN"&&r?this.api.setAccessToken(r.accessToken):this.api.setAccessToken(void 0);for(let n of this.onAuthChangedFunctions)n(e,r)}async _clearSession(){let{isLoading:e,isAuthenticated:r}=this.getAuthenticationStatus();this.session=null,this.initAuthLoading=!1,await this._removeItem(F),(e||r)&&(clearInterval(this.refreshInterval),clearInterval(this.refreshSleepCheckInterval),this.authStateChanged({event:"SIGNED_OUT",session:null}))}async _setSession(e){let{isAuthenticated:r}=this.getAuthenticationStatus();if(this.session=e,await this._setItem(F,e.refreshToken),this.autoRefreshToken&&!r){let n=e.accessTokenExpiresIn,s=this.refreshIntervalTime?this.refreshIntervalTime:Math.max(1,n-1);this.refreshInterval=setInterval(async()=>{let i=await this._getItem(F);await this._refreshTokens(i)},s*1e3),this.refreshIntervalSleepCheckLastSample=Date.now(),this.refreshSleepCheckInterval=setInterval(async()=>{if(Date.now()-this.refreshIntervalSleepCheckLastSample>=this.sampleRate*2){let i=await this._getItem(F);await this._refreshTokens(i)}this.refreshIntervalSleepCheckLastSample=Date.now()},this.sampleRate),this.authStateChanged({event:"SIGNED_IN",session:this.session})}this.initAuthLoading=!1}};var Cs=W(xs()),vr=class{constructor({url:e}){this.url=e,this.httpClient=Cs.default.create({baseURL:this.url})}async upload(e){try{return{fileMetadata:(await this.httpClient.post("/files",e.file,{headers:{...this.generateUploadHeaders(e),...this.generateAuthHeaders()}})).data,error:null}}catch(r){return{fileMetadata:null,error:r}}}async getPresignedUrl(e){try{let{fileId:r}=e;return{presignedUrl:(await this.httpClient.get(`/files/${r}/presignedurl`,{headers:{...this.generateAuthHeaders()}})).data,error:null}}catch(r){return{presignedUrl:null,error:r}}}async delete(e){try{let{fileId:r}=e;return await this.httpClient.delete(`/files/${r}`,{headers:{...this.generateAuthHeaders()}}),{error:null}}catch(r){return{error:r}}}setAccessToken(e){return this.accessToken=e,this}setAdminSecret(e){return this.adminSecret=e,this}generateUploadHeaders(e){let{bucketId:r,name:n,id:s}=e,i={};return r&&(i["x-nhost-bucket-id"]=r),s&&(i["x-nhost-file-id"]=s),n&&(i["x-nhost-file-name"]=n),i}generateAuthHeaders(){return!this.adminSecret&&!this.accessToken?null:this.adminSecret?{"x-hasura-admin-secret":this.adminSecret}:{Authorization:`Bearer ${this.accessToken}`}}};var yr=class{constructor({url:e}){this.url=e,this.api=new vr({url:e})}async upload(e){let r=new FormData;r.append("file",e.file);let{fileMetadata:n,error:s}=await this.api.upload({...e,file:r});return s?{fileMetadata:null,error:s}:n?{fileMetadata:n,error:null}:{fileMetadata:null,error:new Error("Invalid file returned")}}getUrl(e){return this.getPublicUrl(e)}getPublicUrl(e){let{fileId:r}=e;return`${this.url}/files/${r}`}async getPresignedUrl(e){let{presignedUrl:r,error:n}=await this.api.getPresignedUrl(e);return n?{presignedUrl:null,error:n}:r?{presignedUrl:r,error:null}:{presignedUrl:null,error:new Error("Invalid file id")}}async delete(e){let{error:r}=await this.api.delete(e);return r?{error:r}:{error:null}}setAccessToken(e){return this.api.setAccessToken(e),this}setAdminSecret(e){return this.api.setAdminSecret(e),this}};var Ii=W(Lr()),Br=class{constructor(e){let{url:r}=e;this.accessToken=null,this.instance=Ii.default.create({baseURL:r})}async call(e,r,n){let s={...this.generateAccessTokenHeaders(),...n==null?void 0:n.headers},i;try{i=await this.instance.post(e,r,{...n,headers:s})}catch(a){if(a instanceof Error)return{res:null,error:a}}return i?{res:i,error:null}:{res:null,error:new Error("Unable to make post request to funtion")}}setAccessToken(e){if(!e){this.accessToken=null;return}this.accessToken=e}generateAccessTokenHeaders(){if(!!this.accessToken)return{Authorization:`Bearer ${this.accessToken}`}}};var Ni=W(Lr()),_r=class{constructor(e){let{url:r}=e;this.url=r,this.accessToken=null,this.instance=Ni.default.create({baseURL:r})}async request(e,r,n){let s={...n==null?void 0:n.headers,...this.generateAccessTokenHeaders()},i="",a;try{a=(await this.instance.post("",{operationName:i||void 0,query:e,variables:r},{...n,headers:s})).data}catch(o){return o instanceof Error?{data:null,error:o}:(console.error(o),{data:null,error:new Error("Unable to get do GraphQL request")})}return typeof a!="object"||Array.isArray(a)||a===null?{data:null,error:new Error("incorrect response data from GraphQL server")}:(a=a,a.errors?{data:null,error:a.errors}:{data:a.data,error:null})}getUrl(){return this.url}setAccessToken(e){if(!e){this.accessToken=null;return}this.accessToken=e}generateAccessTokenHeaders(){if(!!this.accessToken)return{Authorization:`Bearer ${this.accessToken}`}}};var Hr=class{constructor(e){if(!e.backendUrl)throw new Error("Please specify a `backendUrl`. Docs: [todo]!");let{backendUrl:r,refreshIntervalTime:n,clientStorage:s,clientStorageType:i,autoRefreshToken:a,autoLogin:o}=e;this.auth=new Qe({url:`${r}/v1/auth`,refreshIntervalTime:n,clientStorage:s,clientStorageType:i,autoRefreshToken:a,autoLogin:o}),this.storage=new yr({url:`${r}/v1/storage`}),this.functions=new Br({url:`${r}/v1/functions`}),this.graphql=new _r({url:`${r}/v1/graphql`}),this.storage.setAccessToken(this.auth.getAccessToken()),this.functions.setAccessToken(this.auth.getAccessToken()),this.graphql.setAccessToken(this.auth.getAccessToken()),this.auth.onAuthStateChanged((u,p)=>{this.storage.setAccessToken(p==null?void 0:p.accessToken),this.functions.setAccessToken(p==null?void 0:p.accessToken),this.graphql.setAccessToken(p==null?void 0:p.accessToken)}),this.auth.onTokenChanged(u=>{this.storage.setAccessToken(u==null?void 0:u.accessToken),this.functions.setAccessToken(u==null?void 0:u.accessToken),this.graphql.setAccessToken(u==null?void 0:u.accessToken)})}};var Ql=t=>new Hr(t);export{Hr as NhostClient,Ql as createClient};
5
5
  //# sourceMappingURL=index.es.js.map