@nhost/nhost-js 1.1.4 → 1.1.7
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 +1 -1
- package/dist/clients/functions.d.ts +3 -0
- package/dist/clients/graphql.d.ts +3 -0
- package/dist/clients/index.d.ts +2 -0
- package/dist/core/nhost-client.d.ts +7 -4
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +23 -23
- package/dist/index.es.js.map +3 -3
- package/package.json +8 -5
- package/src/index.ts +1 -0
package/dist/index.es.js
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
var
|
|
2
|
-
`),function(u){if(s=u.indexOf(":"),n=rn.trim(u.substr(0,s)).toLowerCase(),i=rn.trim(u.substr(s+1)),n){if(r[n]&&Lc.indexOf(n)>=0)return;n==="set-cookie"?r[n]=(r[n]?r[n]:[]).concat([i]):r[n]=r[n]?r[n]+", "+i:i}}),r}});var xs=p((Rp,ws)=>{"use strict";var Ss=K();ws.exports=Ss.isStandardBrowserEnv()?function(){var e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a"),n;function i(s){var a=s;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=i(window.location.href),function(a){var u=Ss.isString(a)?i(a):a;return u.protocol===n.protocol&&u.host===n.host}}():function(){return function(){return!0}}()});var At=p((Op,Ts)=>{"use strict";function nn(t){this.message=t}nn.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")};nn.prototype.__CANCEL__=!0;Ts.exports=nn});var an=p((Cp,As)=>{"use strict";var Zt=K(),Bc=cs(),Fc=fs(),Vc=Zr(),Hc=ys(),Gc=Es(),Jc=xs(),sn=tn(),zc=bt(),$c=At();As.exports=function(e){return new Promise(function(n,i){var s=e.data,a=e.headers,u=e.responseType,c;function l(){e.cancelToken&&e.cancelToken.unsubscribe(c),e.signal&&e.signal.removeEventListener("abort",c)}Zt.isFormData(s)&&delete a["Content-Type"];var o=new XMLHttpRequest;if(e.auth){var f=e.auth.username||"",d=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";a.Authorization="Basic "+btoa(f+":"+d)}var h=Hc(e.baseURL,e.url);o.open(e.method.toUpperCase(),Vc(h,e.params,e.paramsSerializer),!0),o.timeout=e.timeout;function m(){if(!!o){var v="getAllResponseHeaders"in o?Gc(o.getAllResponseHeaders()):null,x=!u||u==="text"||u==="json"?o.responseText:o.response,g={data:x,status:o.status,statusText:o.statusText,headers:v,config:e,request:o};Bc(function(O){n(O),l()},function(O){i(O),l()},g),o=null}}if("onloadend"in o?o.onloadend=m:o.onreadystatechange=function(){!o||o.readyState!==4||o.status===0&&!(o.responseURL&&o.responseURL.indexOf("file:")===0)||setTimeout(m)},o.onabort=function(){!o||(i(sn("Request aborted",e,"ECONNABORTED",o)),o=null)},o.onerror=function(){i(sn("Network Error",e,null,o)),o=null},o.ontimeout=function(){var x=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",g=e.transitional||zc.transitional;e.timeoutErrorMessage&&(x=e.timeoutErrorMessage),i(sn(x,e,g.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",o)),o=null},Zt.isStandardBrowserEnv()){var E=(e.withCredentials||Jc(h))&&e.xsrfCookieName?Fc.read(e.xsrfCookieName):void 0;E&&(a[e.xsrfHeaderName]=E)}"setRequestHeader"in o&&Zt.forEach(a,function(x,g){typeof s=="undefined"&&g.toLowerCase()==="content-type"?delete a[g]:o.setRequestHeader(g,x)}),Zt.isUndefined(e.withCredentials)||(o.withCredentials=!!e.withCredentials),u&&u!=="json"&&(o.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&o.addEventListener("progress",e.onDownloadProgress),typeof e.onUploadProgress=="function"&&o.upload&&o.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(c=function(v){!o||(i(!v||v&&v.type?new $c("canceled"):v),o.abort(),o=null)},e.cancelToken&&e.cancelToken.subscribe(c),e.signal&&(e.signal.aborted?c():e.signal.addEventListener("abort",c))),s||(s=null),o.send(s)})}});var bt=p((Np,Os)=>{"use strict";var G=K(),bs=ss(),Wc=en(),Kc={"Content-Type":"application/x-www-form-urlencoded"};function Rs(t,e){!G.isUndefined(t)&&G.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}function Xc(){var t;return typeof XMLHttpRequest!="undefined"?t=an():typeof process!="undefined"&&Object.prototype.toString.call(process)==="[object process]"&&(t=an()),t}function Yc(t,e,r){if(G.isString(t))try{return(e||JSON.parse)(t),G.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}var er={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:Xc(),transformRequest:[function(e,r){return bs(r,"Accept"),bs(r,"Content-Type"),G.isFormData(e)||G.isArrayBuffer(e)||G.isBuffer(e)||G.isStream(e)||G.isFile(e)||G.isBlob(e)?e:G.isArrayBufferView(e)?e.buffer:G.isURLSearchParams(e)?(Rs(r,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):G.isObject(e)||r&&r["Content-Type"]==="application/json"?(Rs(r,"application/json"),Yc(e)):e}],transformResponse:[function(e){var r=this.transitional||er.transitional,n=r&&r.silentJSONParsing,i=r&&r.forcedJSONParsing,s=!n&&this.responseType==="json";if(s||i&&G.isString(e)&&e.length)try{return JSON.parse(e)}catch(a){if(s)throw a.name==="SyntaxError"?Wc(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, */*"}}};G.forEach(["delete","get","head"],function(e){er.headers[e]={}});G.forEach(["post","put","patch"],function(e){er.headers[e]=G.merge(Kc)});Os.exports=er});var Ns=p((Pp,Cs)=>{"use strict";var Qc=K(),Zc=bt();Cs.exports=function(e,r,n){var i=this||Zc;return Qc.forEach(n,function(a){e=a.call(i,e,r)}),e}});var on=p((Ip,Ps)=>{"use strict";Ps.exports=function(e){return!!(e&&e.__CANCEL__)}});var _s=p((kp,ks)=>{"use strict";var Is=K(),un=Ns(),el=on(),tl=bt(),rl=At();function cn(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new rl("canceled")}ks.exports=function(e){cn(e),e.headers=e.headers||{},e.data=un.call(e,e.data,e.headers,e.transformRequest),e.headers=Is.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),Is.forEach(["delete","get","head","post","put","patch","common"],function(i){delete e.headers[i]});var r=e.adapter||tl.adapter;return r(e).then(function(i){return cn(e),i.data=un.call(e,i.data,i.headers,e.transformResponse),i},function(i){return el(i)||(cn(e),i&&i.response&&(i.response.data=un.call(e,i.response.data,i.response.headers,e.transformResponse))),Promise.reject(i)})}});var ln=p((_p,Ds)=>{"use strict";var te=K();Ds.exports=function(e,r){r=r||{};var n={};function i(o,f){return te.isPlainObject(o)&&te.isPlainObject(f)?te.merge(o,f):te.isPlainObject(f)?te.merge({},f):te.isArray(f)?f.slice():f}function s(o){if(te.isUndefined(r[o])){if(!te.isUndefined(e[o]))return i(void 0,e[o])}else return i(e[o],r[o])}function a(o){if(!te.isUndefined(r[o]))return i(void 0,r[o])}function u(o){if(te.isUndefined(r[o])){if(!te.isUndefined(e[o]))return i(void 0,e[o])}else return i(void 0,r[o])}function c(o){if(o in r)return i(e[o],r[o]);if(o in e)return i(void 0,e[o])}var l={url:a,method:a,data:a,baseURL:u,transformRequest:u,transformResponse:u,paramsSerializer:u,timeout:u,timeoutMessage:u,withCredentials:u,adapter:u,responseType:u,xsrfCookieName:u,xsrfHeaderName:u,onUploadProgress:u,onDownloadProgress:u,decompress:u,maxContentLength:u,maxBodyLength:u,transport:u,httpAgent:u,httpsAgent:u,cancelToken:u,socketPath:u,responseEncoding:u,validateStatus:c};return te.forEach(Object.keys(e).concat(Object.keys(r)),function(f){var d=l[f]||s,h=d(f);te.isUndefined(h)&&d!==c||(n[f]=h)}),n}});var fn=p((Dp,qs)=>{qs.exports={version:"0.25.0"}});var Ms=p((qp,js)=>{"use strict";var nl=fn().version,dn={};["object","boolean","number","function","string","symbol"].forEach(function(t,e){dn[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});var Us={};dn.transitional=function(e,r,n){function i(s,a){return"[Axios v"+nl+"] Transitional option '"+s+"'"+a+(n?". "+n:"")}return function(s,a,u){if(e===!1)throw new Error(i(a," has been removed"+(r?" in "+r:"")));return r&&!Us[a]&&(Us[a]=!0,console.warn(i(a," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(s,a,u):!0}};function il(t,e,r){if(typeof t!="object")throw new TypeError("options must be an object");for(var n=Object.keys(t),i=n.length;i-- >0;){var s=n[i],a=e[s];if(a){var u=t[s],c=u===void 0||a(u,s,t);if(c!==!0)throw new TypeError("option "+s+" must be "+c);continue}if(r!==!0)throw Error("Unknown option "+s)}}js.exports={assertOptions:il,validators:dn}});var Gs=p((Up,Hs)=>{"use strict";var Fs=K(),sl=Zr(),Ls=ns(),Bs=_s(),tr=ln(),Vs=Ms(),$e=Vs.validators;function Rt(t){this.defaults=t,this.interceptors={request:new Ls,response:new Ls}}Rt.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=tr(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&&Vs.assertOptions(n,{silentJSONParsing:$e.transitional($e.boolean),forcedJSONParsing:$e.transitional($e.boolean),clarifyTimeoutError:$e.transitional($e.boolean)},!1);var i=[],s=!0;this.interceptors.request.forEach(function(h){typeof h.runWhen=="function"&&h.runWhen(r)===!1||(s=s&&h.synchronous,i.unshift(h.fulfilled,h.rejected))});var a=[];this.interceptors.response.forEach(function(h){a.push(h.fulfilled,h.rejected)});var u;if(!s){var c=[Bs,void 0];for(Array.prototype.unshift.apply(c,i),c=c.concat(a),u=Promise.resolve(r);c.length;)u=u.then(c.shift(),c.shift());return u}for(var l=r;i.length;){var o=i.shift(),f=i.shift();try{l=o(l)}catch(d){f(d);break}}try{u=Bs(l)}catch(d){return Promise.reject(d)}for(;a.length;)u=u.then(a.shift(),a.shift());return u};Rt.prototype.getUri=function(e){if(!e.url)throw new Error("Provided config url is not valid");return e=tr(this.defaults,e),sl(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")};Fs.forEach(["delete","get","head","options"],function(e){Rt.prototype[e]=function(r,n){return this.request(tr(n||{},{method:e,url:r,data:(n||{}).data}))}});Fs.forEach(["post","put","patch"],function(e){Rt.prototype[e]=function(r,n,i){return this.request(tr(i||{},{method:e,url:r,data:n}))}});Hs.exports=Rt});var zs=p((jp,Js)=>{"use strict";var al=At();function We(t){if(typeof t!="function")throw new TypeError("executor must be a function.");var e;this.promise=new Promise(function(i){e=i});var r=this;this.promise.then(function(n){if(!!r._listeners){var i,s=r._listeners.length;for(i=0;i<s;i++)r._listeners[i](n);r._listeners=null}}),this.promise.then=function(n){var i,s=new Promise(function(a){r.subscribe(a),i=a}).then(n);return s.cancel=function(){r.unsubscribe(i)},s},t(function(i){r.reason||(r.reason=new al(i),e(r.reason))})}We.prototype.throwIfRequested=function(){if(this.reason)throw this.reason};We.prototype.subscribe=function(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]};We.prototype.unsubscribe=function(e){if(!!this._listeners){var r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}};We.source=function(){var e,r=new We(function(i){e=i});return{token:r,cancel:e}};Js.exports=We});var Ws=p((Mp,$s)=>{"use strict";$s.exports=function(e){return function(n){return e.apply(null,n)}}});var Xs=p((Lp,Ks)=>{"use strict";var ol=K();Ks.exports=function(e){return ol.isObject(e)&&e.isAxiosError===!0}});var Zs=p((Bp,hn)=>{"use strict";var Ys=K(),ul=Wr(),rr=Gs(),cl=ln(),ll=bt();function Qs(t){var e=new rr(t),r=ul(rr.prototype.request,e);return Ys.extend(r,rr.prototype,e),Ys.extend(r,e),r.create=function(i){return Qs(cl(t,i))},r}var he=Qs(ll);he.Axios=rr;he.Cancel=At();he.CancelToken=zs();he.isCancel=on();he.VERSION=fn().version;he.all=function(e){return Promise.all(e)};he.spread=Ws();he.isAxiosError=Xs();hn.exports=he;hn.exports.default=he});var ta=p((Fp,ea)=>{ea.exports=Zs()});var mn=p((Am,va)=>{"use strict";va.exports=function(e,r){return function(){for(var i=new Array(arguments.length),s=0;s<i.length;s++)i[s]=arguments[s];return e.apply(r,i)}}});var X=p((bm,ga)=>{"use strict";var El=mn(),_e=Object.prototype.toString;function En(t){return _e.call(t)==="[object Array]"}function yn(t){return typeof t=="undefined"}function Sl(t){return t!==null&&!yn(t)&&t.constructor!==null&&!yn(t.constructor)&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function wl(t){return _e.call(t)==="[object ArrayBuffer]"}function xl(t){return typeof FormData!="undefined"&&t instanceof FormData}function Tl(t){var e;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&t.buffer instanceof ArrayBuffer,e}function Al(t){return typeof t=="string"}function bl(t){return typeof t=="number"}function ma(t){return t!==null&&typeof t=="object"}function cr(t){if(_e.call(t)!=="[object Object]")return!1;var e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}function Rl(t){return _e.call(t)==="[object Date]"}function Ol(t){return _e.call(t)==="[object File]"}function Cl(t){return _e.call(t)==="[object Blob]"}function ya(t){return _e.call(t)==="[object Function]"}function Nl(t){return ma(t)&&ya(t.pipe)}function Pl(t){return typeof URLSearchParams!="undefined"&&t instanceof URLSearchParams}function Il(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function kl(){return typeof navigator!="undefined"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window!="undefined"&&typeof document!="undefined"}function Sn(t,e){if(!(t===null||typeof t=="undefined"))if(typeof t!="object"&&(t=[t]),En(t))for(var r=0,n=t.length;r<n;r++)e.call(null,t[r],r,t);else for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.call(null,t[i],i,t)}function gn(){var t={};function e(i,s){cr(t[s])&&cr(i)?t[s]=gn(t[s],i):cr(i)?t[s]=gn({},i):En(i)?t[s]=i.slice():t[s]=i}for(var r=0,n=arguments.length;r<n;r++)Sn(arguments[r],e);return t}function _l(t,e,r){return Sn(e,function(i,s){r&&typeof i=="function"?t[s]=El(i,r):t[s]=i}),t}function Dl(t){return t.charCodeAt(0)===65279&&(t=t.slice(1)),t}ga.exports={isArray:En,isArrayBuffer:wl,isBuffer:Sl,isFormData:xl,isArrayBufferView:Tl,isString:Al,isNumber:bl,isObject:ma,isPlainObject:cr,isUndefined:yn,isDate:Rl,isFile:Ol,isBlob:Cl,isFunction:ya,isStream:Nl,isURLSearchParams:Pl,isStandardBrowserEnv:kl,forEach:Sn,merge:gn,extend:_l,trim:Il,stripBOM:Dl}});var wn=p((Rm,Sa)=>{"use strict";var Qe=X();function Ea(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}Sa.exports=function(e,r,n){if(!r)return e;var i;if(n)i=n(r);else if(Qe.isURLSearchParams(r))i=r.toString();else{var s=[];Qe.forEach(r,function(c,l){c===null||typeof c=="undefined"||(Qe.isArray(c)?l=l+"[]":c=[c],Qe.forEach(c,function(f){Qe.isDate(f)?f=f.toISOString():Qe.isObject(f)&&(f=JSON.stringify(f)),s.push(Ea(l)+"="+Ea(f))}))}),i=s.join("&")}if(i){var a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}});var xa=p((Om,wa)=>{"use strict";var ql=X();function lr(){this.handlers=[]}lr.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};lr.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)};lr.prototype.forEach=function(e){ql.forEach(this.handlers,function(n){n!==null&&e(n)})};wa.exports=lr});var Aa=p((Cm,Ta)=>{"use strict";var Ul=X();Ta.exports=function(e,r){Ul.forEach(e,function(i,s){s!==r&&s.toUpperCase()===r.toUpperCase()&&(e[r]=i,delete e[s])})}});var xn=p((Nm,ba)=>{"use strict";ba.exports=function(e,r,n,i,s){return e.config=r,n&&(e.code=n),e.request=i,e.response=s,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 Tn=p((Pm,Ra)=>{"use strict";var jl=xn();Ra.exports=function(e,r,n,i,s){var a=new Error(e);return jl(a,r,n,i,s)}});var Ca=p((Im,Oa)=>{"use strict";var Ml=Tn();Oa.exports=function(e,r,n){var i=n.config.validateStatus;!n.status||!i||i(n.status)?e(n):r(Ml("Request failed with status code "+n.status,n.config,null,n.request,n))}});var Pa=p((km,Na)=>{"use strict";var fr=X();Na.exports=fr.isStandardBrowserEnv()?function(){return{write:function(r,n,i,s,a,u){var c=[];c.push(r+"="+encodeURIComponent(n)),fr.isNumber(i)&&c.push("expires="+new Date(i).toGMTString()),fr.isString(s)&&c.push("path="+s),fr.isString(a)&&c.push("domain="+a),u===!0&&c.push("secure"),document.cookie=c.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 ka=p((_m,Ia)=>{"use strict";Ia.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}});var Da=p((Dm,_a)=>{"use strict";_a.exports=function(e,r){return r?e.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):e}});var Ua=p((qm,qa)=>{"use strict";var Ll=ka(),Bl=Da();qa.exports=function(e,r){return e&&!Ll(r)?Bl(e,r):r}});var Ma=p((Um,ja)=>{"use strict";var An=X(),Fl=["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"];ja.exports=function(e){var r={},n,i,s;return e&&An.forEach(e.split(`
|
|
3
|
-
`),function(u){if(s=u.indexOf(":"),n=An.trim(u.substr(0,s)).toLowerCase(),i=An.trim(u.substr(s+1)),n){if(r[n]&&Fl.indexOf(n)>=0)return;n==="set-cookie"?r[n]=(r[n]?r[n]:[]).concat([i]):r[n]=r[n]?r[n]+", "+i:i}}),r}});var Fa=p((jm,Ba)=>{"use strict";var La=X();Ba.exports=La.isStandardBrowserEnv()?function(){var e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a"),n;function i(s){var a=s;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=i(window.location.href),function(a){var u=La.isString(a)?i(a):a;return u.protocol===n.protocol&&u.host===n.host}}():function(){return function(){return!0}}()});var Rn=p((Mm,Va)=>{"use strict";var dr=X(),Vl=Ca(),Hl=Pa(),Gl=wn(),Jl=Ua(),zl=Ma(),$l=Fa(),bn=Tn();Va.exports=function(e){return new Promise(function(n,i){var s=e.data,a=e.headers,u=e.responseType;dr.isFormData(s)&&delete a["Content-Type"];var c=new XMLHttpRequest;if(e.auth){var l=e.auth.username||"",o=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";a.Authorization="Basic "+btoa(l+":"+o)}var f=Jl(e.baseURL,e.url);c.open(e.method.toUpperCase(),Gl(f,e.params,e.paramsSerializer),!0),c.timeout=e.timeout;function d(){if(!!c){var m="getAllResponseHeaders"in c?zl(c.getAllResponseHeaders()):null,E=!u||u==="text"||u==="json"?c.responseText:c.response,v={data:E,status:c.status,statusText:c.statusText,headers:m,config:e,request:c};Vl(n,i,v),c=null}}if("onloadend"in c?c.onloadend=d:c.onreadystatechange=function(){!c||c.readyState!==4||c.status===0&&!(c.responseURL&&c.responseURL.indexOf("file:")===0)||setTimeout(d)},c.onabort=function(){!c||(i(bn("Request aborted",e,"ECONNABORTED",c)),c=null)},c.onerror=function(){i(bn("Network Error",e,null,c)),c=null},c.ontimeout=function(){var E="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(E=e.timeoutErrorMessage),i(bn(E,e,e.transitional&&e.transitional.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",c)),c=null},dr.isStandardBrowserEnv()){var h=(e.withCredentials||$l(f))&&e.xsrfCookieName?Hl.read(e.xsrfCookieName):void 0;h&&(a[e.xsrfHeaderName]=h)}"setRequestHeader"in c&&dr.forEach(a,function(E,v){typeof s=="undefined"&&v.toLowerCase()==="content-type"?delete a[v]:c.setRequestHeader(v,E)}),dr.isUndefined(e.withCredentials)||(c.withCredentials=!!e.withCredentials),u&&u!=="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.cancelToken.promise.then(function(E){!c||(c.abort(),i(E),c=null)}),s||(s=null),c.send(s)})}});var pr=p((Lm,Ja)=>{"use strict";var J=X(),Ha=Aa(),Wl=xn(),Kl={"Content-Type":"application/x-www-form-urlencoded"};function Ga(t,e){!J.isUndefined(t)&&J.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}function Xl(){var t;return typeof XMLHttpRequest!="undefined"?t=Rn():typeof process!="undefined"&&Object.prototype.toString.call(process)==="[object process]"&&(t=Rn()),t}function Yl(t,e,r){if(J.isString(t))try{return(e||JSON.parse)(t),J.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}var hr={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:Xl(),transformRequest:[function(e,r){return Ha(r,"Accept"),Ha(r,"Content-Type"),J.isFormData(e)||J.isArrayBuffer(e)||J.isBuffer(e)||J.isStream(e)||J.isFile(e)||J.isBlob(e)?e:J.isArrayBufferView(e)?e.buffer:J.isURLSearchParams(e)?(Ga(r,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):J.isObject(e)||r&&r["Content-Type"]==="application/json"?(Ga(r,"application/json"),Yl(e)):e}],transformResponse:[function(e){var r=this.transitional,n=r&&r.silentJSONParsing,i=r&&r.forcedJSONParsing,s=!n&&this.responseType==="json";if(s||i&&J.isString(e)&&e.length)try{return JSON.parse(e)}catch(a){if(s)throw a.name==="SyntaxError"?Wl(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}};hr.headers={common:{Accept:"application/json, text/plain, */*"}};J.forEach(["delete","get","head"],function(e){hr.headers[e]={}});J.forEach(["post","put","patch"],function(e){hr.headers[e]=J.merge(Kl)});Ja.exports=hr});var $a=p((Bm,za)=>{"use strict";var Ql=X(),Zl=pr();za.exports=function(e,r,n){var i=this||Zl;return Ql.forEach(n,function(a){e=a.call(i,e,r)}),e}});var On=p((Fm,Wa)=>{"use strict";Wa.exports=function(e){return!!(e&&e.__CANCEL__)}});var Ya=p((Vm,Xa)=>{"use strict";var Ka=X(),Cn=$a(),ef=On(),tf=pr();function Nn(t){t.cancelToken&&t.cancelToken.throwIfRequested()}Xa.exports=function(e){Nn(e),e.headers=e.headers||{},e.data=Cn.call(e,e.data,e.headers,e.transformRequest),e.headers=Ka.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),Ka.forEach(["delete","get","head","post","put","patch","common"],function(i){delete e.headers[i]});var r=e.adapter||tf.adapter;return r(e).then(function(i){return Nn(e),i.data=Cn.call(e,i.data,i.headers,e.transformResponse),i},function(i){return ef(i)||(Nn(e),i&&i.response&&(i.response.data=Cn.call(e,i.response.data,i.response.headers,e.transformResponse))),Promise.reject(i)})}});var Pn=p((Hm,Qa)=>{"use strict";var W=X();Qa.exports=function(e,r){r=r||{};var n={},i=["url","method","data"],s=["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"],u=["validateStatus"];function c(d,h){return W.isPlainObject(d)&&W.isPlainObject(h)?W.merge(d,h):W.isPlainObject(h)?W.merge({},h):W.isArray(h)?h.slice():h}function l(d){W.isUndefined(r[d])?W.isUndefined(e[d])||(n[d]=c(void 0,e[d])):n[d]=c(e[d],r[d])}W.forEach(i,function(h){W.isUndefined(r[h])||(n[h]=c(void 0,r[h]))}),W.forEach(s,l),W.forEach(a,function(h){W.isUndefined(r[h])?W.isUndefined(e[h])||(n[h]=c(void 0,e[h])):n[h]=c(void 0,r[h])}),W.forEach(u,function(h){h in r?n[h]=c(e[h],r[h]):h in e&&(n[h]=c(void 0,e[h]))});var o=i.concat(s).concat(a).concat(u),f=Object.keys(e).concat(Object.keys(r)).filter(function(h){return o.indexOf(h)===-1});return W.forEach(f,l),n}});var Za=p((Gm,rf)=>{rf.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 io=p((Jm,no)=>{"use strict";var to=Za(),In={};["object","boolean","number","function","string","symbol"].forEach(function(t,e){In[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});var eo={},nf=to.version.split(".");function ro(t,e){for(var r=e?e.split("."):nf,n=t.split("."),i=0;i<3;i++){if(r[i]>n[i])return!0;if(r[i]<n[i])return!1}return!1}In.transitional=function(e,r,n){var i=r&&ro(r);function s(a,u){return"[Axios v"+to.version+"] Transitional option '"+a+"'"+u+(n?". "+n:"")}return function(a,u,c){if(e===!1)throw new Error(s(u," has been removed in "+r));return i&&!eo[u]&&(eo[u]=!0,console.warn(s(u," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(a,u,c):!0}};function sf(t,e,r){if(typeof t!="object")throw new TypeError("options must be an object");for(var n=Object.keys(t),i=n.length;i-- >0;){var s=n[i],a=e[s];if(a){var u=t[s],c=u===void 0||a(u,s,t);if(c!==!0)throw new TypeError("option "+s+" must be "+c);continue}if(r!==!0)throw Error("Unknown option "+s)}}no.exports={isOlderVersion:ro,assertOptions:sf,validators:In}});var lo=p((zm,co)=>{"use strict";var oo=X(),af=wn(),so=xa(),ao=Ya(),vr=Pn(),uo=io(),Ze=uo.validators;function Ot(t){this.defaults=t,this.interceptors={request:new so,response:new so}}Ot.prototype.request=function(e){typeof e=="string"?(e=arguments[1]||{},e.url=arguments[0]):e=e||{},e=vr(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&&uo.assertOptions(r,{silentJSONParsing:Ze.transitional(Ze.boolean,"1.0.0"),forcedJSONParsing:Ze.transitional(Ze.boolean,"1.0.0"),clarifyTimeoutError:Ze.transitional(Ze.boolean,"1.0.0")},!1);var n=[],i=!0;this.interceptors.request.forEach(function(d){typeof d.runWhen=="function"&&d.runWhen(e)===!1||(i=i&&d.synchronous,n.unshift(d.fulfilled,d.rejected))});var s=[];this.interceptors.response.forEach(function(d){s.push(d.fulfilled,d.rejected)});var a;if(!i){var u=[ao,void 0];for(Array.prototype.unshift.apply(u,n),u=u.concat(s),a=Promise.resolve(e);u.length;)a=a.then(u.shift(),u.shift());return a}for(var c=e;n.length;){var l=n.shift(),o=n.shift();try{c=l(c)}catch(f){o(f);break}}try{a=ao(c)}catch(f){return Promise.reject(f)}for(;s.length;)a=a.then(s.shift(),s.shift());return a};Ot.prototype.getUri=function(e){return e=vr(this.defaults,e),af(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")};oo.forEach(["delete","get","head","options"],function(e){Ot.prototype[e]=function(r,n){return this.request(vr(n||{},{method:e,url:r,data:(n||{}).data}))}});oo.forEach(["post","put","patch"],function(e){Ot.prototype[e]=function(r,n,i){return this.request(vr(i||{},{method:e,url:r,data:n}))}});co.exports=Ot});var _n=p(($m,fo)=>{"use strict";function kn(t){this.message=t}kn.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")};kn.prototype.__CANCEL__=!0;fo.exports=kn});var po=p((Wm,ho)=>{"use strict";var of=_n();function mr(t){if(typeof t!="function")throw new TypeError("executor must be a function.");var e;this.promise=new Promise(function(i){e=i});var r=this;t(function(i){r.reason||(r.reason=new of(i),e(r.reason))})}mr.prototype.throwIfRequested=function(){if(this.reason)throw this.reason};mr.source=function(){var e,r=new mr(function(i){e=i});return{token:r,cancel:e}};ho.exports=mr});var mo=p((Km,vo)=>{"use strict";vo.exports=function(e){return function(n){return e.apply(null,n)}}});var go=p((Xm,yo)=>{"use strict";yo.exports=function(e){return typeof e=="object"&&e.isAxiosError===!0}});var wo=p((Ym,Dn)=>{"use strict";var Eo=X(),uf=mn(),yr=lo(),cf=Pn(),lf=pr();function So(t){var e=new yr(t),r=uf(yr.prototype.request,e);return Eo.extend(r,yr.prototype,e),Eo.extend(r,e),r}var ue=So(lf);ue.Axios=yr;ue.create=function(e){return So(cf(ue.defaults,e))};ue.Cancel=_n();ue.CancelToken=po();ue.isCancel=On();ue.all=function(e){return Promise.all(e)};ue.spread=mo();ue.isAxiosError=go();Dn.exports=ue;Dn.exports.default=ue});var To=p((Qm,xo)=>{xo.exports=wo()});var qn=p((oy,bo)=>{"use strict";bo.exports=function(e,r){return function(){for(var i=new Array(arguments.length),s=0;s<i.length;s++)i[s]=arguments[s];return e.apply(r,i)}}});var Y=p((uy,Co)=>{"use strict";var ff=qn(),De=Object.prototype.toString;function Mn(t){return De.call(t)==="[object Array]"}function Un(t){return typeof t=="undefined"}function df(t){return t!==null&&!Un(t)&&t.constructor!==null&&!Un(t.constructor)&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function hf(t){return De.call(t)==="[object ArrayBuffer]"}function pf(t){return typeof FormData!="undefined"&&t instanceof FormData}function vf(t){var e;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&t.buffer instanceof ArrayBuffer,e}function mf(t){return typeof t=="string"}function yf(t){return typeof t=="number"}function Ro(t){return t!==null&&typeof t=="object"}function Sr(t){if(De.call(t)!=="[object Object]")return!1;var e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}function gf(t){return De.call(t)==="[object Date]"}function Ef(t){return De.call(t)==="[object File]"}function Sf(t){return De.call(t)==="[object Blob]"}function Oo(t){return De.call(t)==="[object Function]"}function wf(t){return Ro(t)&&Oo(t.pipe)}function xf(t){return typeof URLSearchParams!="undefined"&&t instanceof URLSearchParams}function Tf(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function Af(){return typeof navigator!="undefined"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window!="undefined"&&typeof document!="undefined"}function Ln(t,e){if(!(t===null||typeof t=="undefined"))if(typeof t!="object"&&(t=[t]),Mn(t))for(var r=0,n=t.length;r<n;r++)e.call(null,t[r],r,t);else for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.call(null,t[i],i,t)}function jn(){var t={};function e(i,s){Sr(t[s])&&Sr(i)?t[s]=jn(t[s],i):Sr(i)?t[s]=jn({},i):Mn(i)?t[s]=i.slice():t[s]=i}for(var r=0,n=arguments.length;r<n;r++)Ln(arguments[r],e);return t}function bf(t,e,r){return Ln(e,function(i,s){r&&typeof i=="function"?t[s]=ff(i,r):t[s]=i}),t}function Rf(t){return t.charCodeAt(0)===65279&&(t=t.slice(1)),t}Co.exports={isArray:Mn,isArrayBuffer:hf,isBuffer:df,isFormData:pf,isArrayBufferView:vf,isString:mf,isNumber:yf,isObject:Ro,isPlainObject:Sr,isUndefined:Un,isDate:gf,isFile:Ef,isBlob:Sf,isFunction:Oo,isStream:wf,isURLSearchParams:xf,isStandardBrowserEnv:Af,forEach:Ln,merge:jn,extend:bf,trim:Tf,stripBOM:Rf}});var Bn=p((cy,Po)=>{"use strict";var et=Y();function No(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}Po.exports=function(e,r,n){if(!r)return e;var i;if(n)i=n(r);else if(et.isURLSearchParams(r))i=r.toString();else{var s=[];et.forEach(r,function(c,l){c===null||typeof c=="undefined"||(et.isArray(c)?l=l+"[]":c=[c],et.forEach(c,function(f){et.isDate(f)?f=f.toISOString():et.isObject(f)&&(f=JSON.stringify(f)),s.push(No(l)+"="+No(f))}))}),i=s.join("&")}if(i){var a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}});var ko=p((ly,Io)=>{"use strict";var Of=Y();function wr(){this.handlers=[]}wr.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};wr.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)};wr.prototype.forEach=function(e){Of.forEach(this.handlers,function(n){n!==null&&e(n)})};Io.exports=wr});var Do=p((fy,_o)=>{"use strict";var Cf=Y();_o.exports=function(e,r){Cf.forEach(e,function(i,s){s!==r&&s.toUpperCase()===r.toUpperCase()&&(e[r]=i,delete e[s])})}});var Fn=p((dy,qo)=>{"use strict";qo.exports=function(e,r,n,i,s){return e.config=r,n&&(e.code=n),e.request=i,e.response=s,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 Vn=p((hy,Uo)=>{"use strict";var Nf=Fn();Uo.exports=function(e,r,n,i,s){var a=new Error(e);return Nf(a,r,n,i,s)}});var Mo=p((py,jo)=>{"use strict";var Pf=Vn();jo.exports=function(e,r,n){var i=n.config.validateStatus;!n.status||!i||i(n.status)?e(n):r(Pf("Request failed with status code "+n.status,n.config,null,n.request,n))}});var Bo=p((vy,Lo)=>{"use strict";var xr=Y();Lo.exports=xr.isStandardBrowserEnv()?function(){return{write:function(r,n,i,s,a,u){var c=[];c.push(r+"="+encodeURIComponent(n)),xr.isNumber(i)&&c.push("expires="+new Date(i).toGMTString()),xr.isString(s)&&c.push("path="+s),xr.isString(a)&&c.push("domain="+a),u===!0&&c.push("secure"),document.cookie=c.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 Vo=p((my,Fo)=>{"use strict";Fo.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}});var Go=p((yy,Ho)=>{"use strict";Ho.exports=function(e,r){return r?e.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):e}});var zo=p((gy,Jo)=>{"use strict";var If=Vo(),kf=Go();Jo.exports=function(e,r){return e&&!If(r)?kf(e,r):r}});var Wo=p((Ey,$o)=>{"use strict";var Hn=Y(),_f=["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"];$o.exports=function(e){var r={},n,i,s;return e&&Hn.forEach(e.split(`
|
|
4
|
-
`),function(u){if(s=u.indexOf(":"),n=Hn.trim(u.substr(0,s)).toLowerCase(),i=Hn.trim(u.substr(s+1)),n){if(r[n]&&_f.indexOf(n)>=0)return;n==="set-cookie"?r[n]=(r[n]?r[n]:[]).concat([i]):r[n]=r[n]?r[n]+", "+i:i}}),r}});var Yo=p((Sy,Xo)=>{"use strict";var Ko=Y();Xo.exports=Ko.isStandardBrowserEnv()?function(){var e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a"),n;function i(s){var a=s;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=i(window.location.href),function(a){var u=Ko.isString(a)?i(a):a;return u.protocol===n.protocol&&u.host===n.host}}():function(){return function(){return!0}}()});var Ct=p((wy,Qo)=>{"use strict";function Gn(t){this.message=t}Gn.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")};Gn.prototype.__CANCEL__=!0;Qo.exports=Gn});var zn=p((xy,Zo)=>{"use strict";var Tr=Y(),Df=Mo(),qf=Bo(),Uf=Bn(),jf=zo(),Mf=Wo(),Lf=Yo(),Jn=Vn(),Bf=Nt(),Ff=Ct();Zo.exports=function(e){return new Promise(function(n,i){var s=e.data,a=e.headers,u=e.responseType,c;function l(){e.cancelToken&&e.cancelToken.unsubscribe(c),e.signal&&e.signal.removeEventListener("abort",c)}Tr.isFormData(s)&&delete a["Content-Type"];var o=new XMLHttpRequest;if(e.auth){var f=e.auth.username||"",d=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";a.Authorization="Basic "+btoa(f+":"+d)}var h=jf(e.baseURL,e.url);o.open(e.method.toUpperCase(),Uf(h,e.params,e.paramsSerializer),!0),o.timeout=e.timeout;function m(){if(!!o){var v="getAllResponseHeaders"in o?Mf(o.getAllResponseHeaders()):null,x=!u||u==="text"||u==="json"?o.responseText:o.response,g={data:x,status:o.status,statusText:o.statusText,headers:v,config:e,request:o};Df(function(O){n(O),l()},function(O){i(O),l()},g),o=null}}if("onloadend"in o?o.onloadend=m:o.onreadystatechange=function(){!o||o.readyState!==4||o.status===0&&!(o.responseURL&&o.responseURL.indexOf("file:")===0)||setTimeout(m)},o.onabort=function(){!o||(i(Jn("Request aborted",e,"ECONNABORTED",o)),o=null)},o.onerror=function(){i(Jn("Network Error",e,null,o)),o=null},o.ontimeout=function(){var x=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",g=e.transitional||Bf.transitional;e.timeoutErrorMessage&&(x=e.timeoutErrorMessage),i(Jn(x,e,g.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",o)),o=null},Tr.isStandardBrowserEnv()){var E=(e.withCredentials||Lf(h))&&e.xsrfCookieName?qf.read(e.xsrfCookieName):void 0;E&&(a[e.xsrfHeaderName]=E)}"setRequestHeader"in o&&Tr.forEach(a,function(x,g){typeof s=="undefined"&&g.toLowerCase()==="content-type"?delete a[g]:o.setRequestHeader(g,x)}),Tr.isUndefined(e.withCredentials)||(o.withCredentials=!!e.withCredentials),u&&u!=="json"&&(o.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&o.addEventListener("progress",e.onDownloadProgress),typeof e.onUploadProgress=="function"&&o.upload&&o.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(c=function(v){!o||(i(!v||v&&v.type?new Ff("canceled"):v),o.abort(),o=null)},e.cancelToken&&e.cancelToken.subscribe(c),e.signal&&(e.signal.aborted?c():e.signal.addEventListener("abort",c))),s||(s=null),o.send(s)})}});var Nt=p((Ty,ru)=>{"use strict";var z=Y(),eu=Do(),Vf=Fn(),Hf={"Content-Type":"application/x-www-form-urlencoded"};function tu(t,e){!z.isUndefined(t)&&z.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}function Gf(){var t;return typeof XMLHttpRequest!="undefined"?t=zn():typeof process!="undefined"&&Object.prototype.toString.call(process)==="[object process]"&&(t=zn()),t}function Jf(t,e,r){if(z.isString(t))try{return(e||JSON.parse)(t),z.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}var Ar={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:Gf(),transformRequest:[function(e,r){return eu(r,"Accept"),eu(r,"Content-Type"),z.isFormData(e)||z.isArrayBuffer(e)||z.isBuffer(e)||z.isStream(e)||z.isFile(e)||z.isBlob(e)?e:z.isArrayBufferView(e)?e.buffer:z.isURLSearchParams(e)?(tu(r,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):z.isObject(e)||r&&r["Content-Type"]==="application/json"?(tu(r,"application/json"),Jf(e)):e}],transformResponse:[function(e){var r=this.transitional||Ar.transitional,n=r&&r.silentJSONParsing,i=r&&r.forcedJSONParsing,s=!n&&this.responseType==="json";if(s||i&&z.isString(e)&&e.length)try{return JSON.parse(e)}catch(a){if(s)throw a.name==="SyntaxError"?Vf(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, */*"}}};z.forEach(["delete","get","head"],function(e){Ar.headers[e]={}});z.forEach(["post","put","patch"],function(e){Ar.headers[e]=z.merge(Hf)});ru.exports=Ar});var iu=p((Ay,nu)=>{"use strict";var zf=Y(),$f=Nt();nu.exports=function(e,r,n){var i=this||$f;return zf.forEach(n,function(a){e=a.call(i,e,r)}),e}});var $n=p((by,su)=>{"use strict";su.exports=function(e){return!!(e&&e.__CANCEL__)}});var uu=p((Ry,ou)=>{"use strict";var au=Y(),Wn=iu(),Wf=$n(),Kf=Nt(),Xf=Ct();function Kn(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Xf("canceled")}ou.exports=function(e){Kn(e),e.headers=e.headers||{},e.data=Wn.call(e,e.data,e.headers,e.transformRequest),e.headers=au.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),au.forEach(["delete","get","head","post","put","patch","common"],function(i){delete e.headers[i]});var r=e.adapter||Kf.adapter;return r(e).then(function(i){return Kn(e),i.data=Wn.call(e,i.data,i.headers,e.transformResponse),i},function(i){return Wf(i)||(Kn(e),i&&i.response&&(i.response.data=Wn.call(e,i.response.data,i.response.headers,e.transformResponse))),Promise.reject(i)})}});var Xn=p((Oy,cu)=>{"use strict";var re=Y();cu.exports=function(e,r){r=r||{};var n={};function i(o,f){return re.isPlainObject(o)&&re.isPlainObject(f)?re.merge(o,f):re.isPlainObject(f)?re.merge({},f):re.isArray(f)?f.slice():f}function s(o){if(re.isUndefined(r[o])){if(!re.isUndefined(e[o]))return i(void 0,e[o])}else return i(e[o],r[o])}function a(o){if(!re.isUndefined(r[o]))return i(void 0,r[o])}function u(o){if(re.isUndefined(r[o])){if(!re.isUndefined(e[o]))return i(void 0,e[o])}else return i(void 0,r[o])}function c(o){if(o in r)return i(e[o],r[o]);if(o in e)return i(void 0,e[o])}var l={url:a,method:a,data:a,baseURL:u,transformRequest:u,transformResponse:u,paramsSerializer:u,timeout:u,timeoutMessage:u,withCredentials:u,adapter:u,responseType:u,xsrfCookieName:u,xsrfHeaderName:u,onUploadProgress:u,onDownloadProgress:u,decompress:u,maxContentLength:u,maxBodyLength:u,transport:u,httpAgent:u,httpsAgent:u,cancelToken:u,socketPath:u,responseEncoding:u,validateStatus:c};return re.forEach(Object.keys(e).concat(Object.keys(r)),function(f){var d=l[f]||s,h=d(f);re.isUndefined(h)&&d!==c||(n[f]=h)}),n}});var Yn=p((Cy,lu)=>{lu.exports={version:"0.23.0"}});var hu=p((Ny,du)=>{"use strict";var Yf=Yn().version,Qn={};["object","boolean","number","function","string","symbol"].forEach(function(t,e){Qn[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});var fu={};Qn.transitional=function(e,r,n){function i(s,a){return"[Axios v"+Yf+"] Transitional option '"+s+"'"+a+(n?". "+n:"")}return function(s,a,u){if(e===!1)throw new Error(i(a," has been removed"+(r?" in "+r:"")));return r&&!fu[a]&&(fu[a]=!0,console.warn(i(a," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(s,a,u):!0}};function Qf(t,e,r){if(typeof t!="object")throw new TypeError("options must be an object");for(var n=Object.keys(t),i=n.length;i-- >0;){var s=n[i],a=e[s];if(a){var u=t[s],c=u===void 0||a(u,s,t);if(c!==!0)throw new TypeError("option "+s+" must be "+c);continue}if(r!==!0)throw Error("Unknown option "+s)}}du.exports={assertOptions:Qf,validators:Qn}});var Eu=p((Py,gu)=>{"use strict";var mu=Y(),Zf=Bn(),pu=ko(),vu=uu(),br=Xn(),yu=hu(),tt=yu.validators;function Pt(t){this.defaults=t,this.interceptors={request:new pu,response:new pu}}Pt.prototype.request=function(e){typeof e=="string"?(e=arguments[1]||{},e.url=arguments[0]):e=e||{},e=br(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&&yu.assertOptions(r,{silentJSONParsing:tt.transitional(tt.boolean),forcedJSONParsing:tt.transitional(tt.boolean),clarifyTimeoutError:tt.transitional(tt.boolean)},!1);var n=[],i=!0;this.interceptors.request.forEach(function(d){typeof d.runWhen=="function"&&d.runWhen(e)===!1||(i=i&&d.synchronous,n.unshift(d.fulfilled,d.rejected))});var s=[];this.interceptors.response.forEach(function(d){s.push(d.fulfilled,d.rejected)});var a;if(!i){var u=[vu,void 0];for(Array.prototype.unshift.apply(u,n),u=u.concat(s),a=Promise.resolve(e);u.length;)a=a.then(u.shift(),u.shift());return a}for(var c=e;n.length;){var l=n.shift(),o=n.shift();try{c=l(c)}catch(f){o(f);break}}try{a=vu(c)}catch(f){return Promise.reject(f)}for(;s.length;)a=a.then(s.shift(),s.shift());return a};Pt.prototype.getUri=function(e){return e=br(this.defaults,e),Zf(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")};mu.forEach(["delete","get","head","options"],function(e){Pt.prototype[e]=function(r,n){return this.request(br(n||{},{method:e,url:r,data:(n||{}).data}))}});mu.forEach(["post","put","patch"],function(e){Pt.prototype[e]=function(r,n,i){return this.request(br(i||{},{method:e,url:r,data:n}))}});gu.exports=Pt});var wu=p((Iy,Su)=>{"use strict";var ed=Ct();function rt(t){if(typeof t!="function")throw new TypeError("executor must be a function.");var e;this.promise=new Promise(function(i){e=i});var r=this;this.promise.then(function(n){if(!!r._listeners){var i,s=r._listeners.length;for(i=0;i<s;i++)r._listeners[i](n);r._listeners=null}}),this.promise.then=function(n){var i,s=new Promise(function(a){r.subscribe(a),i=a}).then(n);return s.cancel=function(){r.unsubscribe(i)},s},t(function(i){r.reason||(r.reason=new ed(i),e(r.reason))})}rt.prototype.throwIfRequested=function(){if(this.reason)throw this.reason};rt.prototype.subscribe=function(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]};rt.prototype.unsubscribe=function(e){if(!!this._listeners){var r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}};rt.source=function(){var e,r=new rt(function(i){e=i});return{token:r,cancel:e}};Su.exports=rt});var Tu=p((ky,xu)=>{"use strict";xu.exports=function(e){return function(n){return e.apply(null,n)}}});var bu=p((_y,Au)=>{"use strict";Au.exports=function(e){return typeof e=="object"&&e.isAxiosError===!0}});var Cu=p((Dy,Zn)=>{"use strict";var Ru=Y(),td=qn(),Rr=Eu(),rd=Xn(),nd=Nt();function Ou(t){var e=new Rr(t),r=td(Rr.prototype.request,e);return Ru.extend(r,Rr.prototype,e),Ru.extend(r,e),r.create=function(i){return Ou(rd(t,i))},r}var pe=Ou(nd);pe.Axios=Rr;pe.Cancel=Ct();pe.CancelToken=wu();pe.isCancel=$n();pe.VERSION=Yn().version;pe.all=function(e){return Promise.all(e)};pe.spread=Tu();pe.isAxiosError=bu();Zn.exports=pe;Zn.exports.default=pe});var ei=p((qy,Nu)=>{Nu.exports=Cu()});var ti=p(Cr=>{"use strict";Object.defineProperty(Cr,"__esModule",{value:!0});Cr.default=void 0;var id=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):void 0,sd=id;Cr.default=sd});var ku=p(ri=>{"use strict";Object.defineProperty(ri,"__esModule",{value:!0});ri.default=cd;var ad=od(ti());function od(t){return t&&t.__esModule?t:{default:t}}function Nr(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Nr=function(r){return typeof r}:Nr=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Nr(t)}var ud=10,Iu=2;function cd(t){return Pr(t,[])}function Pr(t,e){switch(Nr(t)){case"string":return JSON.stringify(t);case"function":return t.name?"[function ".concat(t.name,"]"):"[function]";case"object":return t===null?"null":ld(t,e);default:return String(t)}}function ld(t,e){if(e.indexOf(t)!==-1)return"[Circular]";var r=[].concat(e,[t]),n=hd(t);if(n!==void 0){var i=n.call(t);if(i!==t)return typeof i=="string"?i:Pr(i,r)}else if(Array.isArray(t))return dd(t,r);return fd(t,r)}function fd(t,e){var r=Object.keys(t);if(r.length===0)return"{}";if(e.length>Iu)return"["+pd(t)+"]";var n=r.map(function(i){var s=Pr(t[i],e);return i+": "+s});return"{ "+n.join(", ")+" }"}function dd(t,e){if(t.length===0)return"[]";if(e.length>Iu)return"[Array]";for(var r=Math.min(ud,t.length),n=t.length-r,i=[],s=0;s<r;++s)i.push(Pr(t[s],e));return n===1?i.push("... 1 more item"):n>1&&i.push("... ".concat(n," more items")),"["+i.join(", ")+"]"}function hd(t){var e=t[String(ad.default)];if(typeof e=="function")return e;if(typeof t.inspect=="function")return t.inspect}function pd(t){var e=Object.prototype.toString.call(t).replace(/^\[object /,"").replace(/]$/,"");if(e==="Object"&&typeof t.constructor=="function"){var r=t.constructor.name;if(typeof r=="string"&&r!=="")return r}return e}});var _u=p(ni=>{"use strict";Object.defineProperty(ni,"__esModule",{value:!0});ni.default=vd;function vd(t,e){var r=Boolean(t);if(!r)throw new Error(e!=null?e:"Unexpected invariant triggered.")}});var Uu=p(ii=>{"use strict";Object.defineProperty(ii,"__esModule",{value:!0});ii.default=yd;var md=qu(_u()),Du=qu(ti());function qu(t){return t&&t.__esModule?t:{default:t}}function yd(t){var e=t.prototype.toJSON;typeof e=="function"||(0,md.default)(0),t.prototype.inspect=e,Du.default&&(t.prototype[Du.default]=e)}});var Bu=p(qe=>{"use strict";Object.defineProperty(qe,"__esModule",{value:!0});qe.isNode=Ed;qe.Token=qe.Location=void 0;var ju=gd(Uu());function gd(t){return t&&t.__esModule?t:{default:t}}var Mu=function(){function t(r,n,i){this.start=r.start,this.end=n.end,this.startToken=r,this.endToken=n,this.source=i}var e=t.prototype;return e.toJSON=function(){return{start:this.start,end:this.end}},t}();qe.Location=Mu;(0,ju.default)(Mu);var Lu=function(){function t(r,n,i,s,a,u,c){this.kind=r,this.start=n,this.end=i,this.line=s,this.column=a,this.value=c,this.prev=u,this.next=null}var e=t.prototype;return e.toJSON=function(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}},t}();qe.Token=Lu;(0,ju.default)(Lu);function Ed(t){return t!=null&&typeof t.kind=="string"}});var Hu=p(ye=>{"use strict";Object.defineProperty(ye,"__esModule",{value:!0});ye.visit=xd;ye.visitInParallel=Td;ye.getVisitFn=Ir;ye.BREAK=ye.QueryDocumentKeys=void 0;var Sd=wd(ku()),Fu=Bu();function wd(t){return t&&t.__esModule?t:{default:t}}var Vu={Name:[],Document:["definitions"],OperationDefinition:["name","variableDefinitions","directives","selectionSet"],VariableDefinition:["variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["description","directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","interfaces","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","locations"],SchemaExtension:["directives","operationTypes"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","interfaces","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"]};ye.QueryDocumentKeys=Vu;var nt=Object.freeze({});ye.BREAK=nt;function xd(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Vu,n=void 0,i=Array.isArray(t),s=[t],a=-1,u=[],c=void 0,l=void 0,o=void 0,f=[],d=[],h=t;do{a++;var m=a===s.length,E=m&&u.length!==0;if(m){if(l=d.length===0?void 0:f[f.length-1],c=o,o=d.pop(),E){if(i)c=c.slice();else{for(var v={},x=0,g=Object.keys(c);x<g.length;x++){var T=g[x];v[T]=c[T]}c=v}for(var O=0,P=0;P<u.length;P++){var M=u[P][0],A=u[P][1];i&&(M-=O),i&&A===null?(c.splice(M,1),O++):c[M]=A}}a=n.index,s=n.keys,u=n.edits,i=n.inArray,n=n.prev}else{if(l=o?i?a:s[a]:void 0,c=o?o[l]:h,c==null)continue;o&&f.push(l)}var w=void 0;if(!Array.isArray(c)){if(!(0,Fu.isNode)(c))throw new Error("Invalid AST Node: ".concat((0,Sd.default)(c),"."));var b=Ir(e,c.kind,m);if(b){if(w=b.call(e,c,l,o,f,d),w===nt)break;if(w===!1){if(!m){f.pop();continue}}else if(w!==void 0&&(u.push([l,w]),!m))if((0,Fu.isNode)(w))c=w;else{f.pop();continue}}}if(w===void 0&&E&&u.push([l,c]),m)f.pop();else{var q;n={inArray:i,index:a,keys:s,edits:u,prev:n},i=Array.isArray(c),s=i?c:(q=r[c.kind])!==null&&q!==void 0?q:[],a=-1,u=[],o&&d.push(o),o=c}}while(n!==void 0);return u.length!==0&&(h=u[u.length-1][1]),h}function Td(t){var e=new Array(t.length);return{enter:function(n){for(var i=0;i<t.length;i++)if(e[i]==null){var s=Ir(t[i],n.kind,!1);if(s){var a=s.apply(t[i],arguments);if(a===!1)e[i]=n;else if(a===nt)e[i]=nt;else if(a!==void 0)return a}}},leave:function(n){for(var i=0;i<t.length;i++)if(e[i]==null){var s=Ir(t[i],n.kind,!0);if(s){var a=s.apply(t[i],arguments);if(a===nt)e[i]=nt;else if(a!==void 0&&a!==!1)return a}}else e[i]===n&&(e[i]=null)}}}function Ir(t,e,r){var n=t[e];if(n){if(!r&&typeof n=="function")return n;var i=r?n.leave:n.enter;if(typeof i=="function")return i}else{var s=r?t.leave:t.enter;if(s){if(typeof s=="function")return s;var a=s[e];if(typeof a=="function")return a}}}});var zu=p(It=>{"use strict";Object.defineProperty(It,"__esModule",{value:!0});It.dedentBlockStringValue=Ad;It.getBlockStringIndentation=Ju;It.printBlockString=bd;function Ad(t){var e=t.split(/\r\n|[\n\r]/g),r=Ju(t);if(r!==0)for(var n=1;n<e.length;n++)e[n]=e[n].slice(r);for(var i=0;i<e.length&&Gu(e[i]);)++i;for(var s=e.length;s>i&&Gu(e[s-1]);)--s;return e.slice(i,s).join(`
|
|
5
|
-
`)}function
|
|
6
|
-
`)===-1,i=t[0]===" "||t[0]===" ",s=t[t.length-1]==='"',a=t[t.length-1]==="\\",
|
|
7
|
-
`+e),
|
|
8
|
-
`+e):t,
|
|
9
|
-
`),'"""'+
|
|
1
|
+
var nc=Object.create;var ci=Object.defineProperty;var ic=Object.getOwnPropertyDescriptor;var sc=Object.getOwnPropertyNames;var ac=Object.getPrototypeOf,oc=Object.prototype.hasOwnProperty;var y=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var uc=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of sc(e))!oc.call(t,i)&&i!==r&&ci(t,i,{get:()=>e[i],enumerable:!(n=ic(e,i))||n.enumerable});return t};var nt=(t,e,r)=>(r=t!=null?nc(ac(t)):{},uc(e||!t||!t.__esModule?ci(r,"default",{value:t,enumerable:!0}):r,t));var Xr=y((Ap,es)=>{"use strict";es.exports=function(e,r){return function(){for(var i=new Array(arguments.length),s=0;s<i.length;s++)i[s]=arguments[s];return e.apply(r,i)}}});var K=y((bp,is)=>{"use strict";var Ac=Xr(),Se=Object.prototype.toString;function Zr(t){return Array.isArray(t)}function Yr(t){return typeof t=="undefined"}function bc(t){return t!==null&&!Yr(t)&&t.constructor!==null&&!Yr(t.constructor)&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function ts(t){return Se.call(t)==="[object ArrayBuffer]"}function Rc(t){return Se.call(t)==="[object FormData]"}function Oc(t){var e;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&ts(t.buffer),e}function Cc(t){return typeof t=="string"}function Pc(t){return typeof t=="number"}function rs(t){return t!==null&&typeof t=="object"}function Yt(t){if(Se.call(t)!=="[object Object]")return!1;var e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}function Nc(t){return Se.call(t)==="[object Date]"}function Ic(t){return Se.call(t)==="[object File]"}function kc(t){return Se.call(t)==="[object Blob]"}function ns(t){return Se.call(t)==="[object Function]"}function _c(t){return rs(t)&&ns(t.pipe)}function Dc(t){return Se.call(t)==="[object URLSearchParams]"}function qc(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function Uc(){return typeof navigator!="undefined"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window!="undefined"&&typeof document!="undefined"}function en(t,e){if(!(t===null||typeof t=="undefined"))if(typeof t!="object"&&(t=[t]),Zr(t))for(var r=0,n=t.length;r<n;r++)e.call(null,t[r],r,t);else for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.call(null,t[i],i,t)}function Qr(){var t={};function e(i,s){Yt(t[s])&&Yt(i)?t[s]=Qr(t[s],i):Yt(i)?t[s]=Qr({},i):Zr(i)?t[s]=i.slice():t[s]=i}for(var r=0,n=arguments.length;r<n;r++)en(arguments[r],e);return t}function jc(t,e,r){return en(e,function(i,s){r&&typeof i=="function"?t[s]=Ac(i,r):t[s]=i}),t}function Mc(t){return t.charCodeAt(0)===65279&&(t=t.slice(1)),t}is.exports={isArray:Zr,isArrayBuffer:ts,isBuffer:bc,isFormData:Rc,isArrayBufferView:Oc,isString:Cc,isNumber:Pc,isObject:rs,isPlainObject:Yt,isUndefined:Yr,isDate:Nc,isFile:Ic,isBlob:kc,isFunction:ns,isStream:_c,isURLSearchParams:Dc,isStandardBrowserEnv:Uc,forEach:en,merge:Qr,extend:jc,trim:qc,stripBOM:Mc}});var tn=y((Rp,as)=>{"use strict";var $e=K();function ss(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}as.exports=function(e,r,n){if(!r)return e;var i;if(n)i=n(r);else if($e.isURLSearchParams(r))i=r.toString();else{var s=[];$e.forEach(r,function(u,f){u===null||typeof u=="undefined"||($e.isArray(u)?f=f+"[]":u=[u],$e.forEach(u,function(h){$e.isDate(h)?h=h.toISOString():$e.isObject(h)&&(h=JSON.stringify(h)),s.push(ss(f)+"="+ss(h))}))}),i=s.join("&")}if(i){var a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}});var us=y((Op,os)=>{"use strict";var Lc=K();function Qt(){this.handlers=[]}Qt.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};Qt.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)};Qt.prototype.forEach=function(e){Lc.forEach(this.handlers,function(n){n!==null&&e(n)})};os.exports=Qt});var ls=y((Cp,cs)=>{"use strict";var Bc=K();cs.exports=function(e,r){Bc.forEach(e,function(i,s){s!==r&&s.toUpperCase()===r.toUpperCase()&&(e[r]=i,delete e[s])})}});var rn=y((Pp,fs)=>{"use strict";fs.exports=function(e,r,n,i,s){return e.config=r,n&&(e.code=n),e.request=i,e.response=s,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 nn=y((Np,ds)=>{"use strict";var Fc=rn();ds.exports=function(e,r,n,i,s){var a=new Error(e);return Fc(a,r,n,i,s)}});var ps=y((Ip,hs)=>{"use strict";var Vc=nn();hs.exports=function(e,r,n){var i=n.config.validateStatus;!n.status||!i||i(n.status)?e(n):r(Vc("Request failed with status code "+n.status,n.config,null,n.request,n))}});var ms=y((kp,vs)=>{"use strict";var Zt=K();vs.exports=Zt.isStandardBrowserEnv()?function(){return{write:function(r,n,i,s,a,o){var u=[];u.push(r+"="+encodeURIComponent(n)),Zt.isNumber(i)&&u.push("expires="+new Date(i).toGMTString()),Zt.isString(s)&&u.push("path="+s),Zt.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 gs=y((_p,ys)=>{"use strict";ys.exports=function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}});var Ss=y((Dp,Es)=>{"use strict";Es.exports=function(e,r){return r?e.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):e}});var xs=y((qp,ws)=>{"use strict";var Hc=gs(),Gc=Ss();ws.exports=function(e,r){return e&&!Hc(r)?Gc(e,r):r}});var As=y((Up,Ts)=>{"use strict";var sn=K(),Jc=["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"];Ts.exports=function(e){var r={},n,i,s;return e&&sn.forEach(e.split(`
|
|
2
|
+
`),function(o){if(s=o.indexOf(":"),n=sn.trim(o.substr(0,s)).toLowerCase(),i=sn.trim(o.substr(s+1)),n){if(r[n]&&Jc.indexOf(n)>=0)return;n==="set-cookie"?r[n]=(r[n]?r[n]:[]).concat([i]):r[n]=r[n]?r[n]+", "+i:i}}),r}});var Os=y((jp,Rs)=>{"use strict";var bs=K();Rs.exports=bs.isStandardBrowserEnv()?function(){var e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a"),n;function i(s){var a=s;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=i(window.location.href),function(a){var o=bs.isString(a)?i(a):a;return o.protocol===n.protocol&&o.host===n.host}}():function(){return function(){return!0}}()});var Tt=y((Mp,Cs)=>{"use strict";function an(t){this.message=t}an.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")};an.prototype.__CANCEL__=!0;Cs.exports=an});var un=y((Lp,Ps)=>{"use strict";var er=K(),$c=ps(),zc=ms(),Wc=tn(),Kc=xs(),Xc=As(),Yc=Os(),on=nn(),Qc=At(),Zc=Tt();Ps.exports=function(e){return new Promise(function(n,i){var s=e.data,a=e.headers,o=e.responseType,u;function f(){e.cancelToken&&e.cancelToken.unsubscribe(u),e.signal&&e.signal.removeEventListener("abort",u)}er.isFormData(s)&&delete a["Content-Type"];var c=new XMLHttpRequest;if(e.auth){var h=e.auth.username||"",d=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";a.Authorization="Basic "+btoa(h+":"+d)}var l=Kc(e.baseURL,e.url);c.open(e.method.toUpperCase(),Wc(l,e.params,e.paramsSerializer),!0),c.timeout=e.timeout;function p(){if(!!c){var m="getAllResponseHeaders"in c?Xc(c.getAllResponseHeaders()):null,w=!o||o==="text"||o==="json"?c.responseText:c.response,g={data:w,status:c.status,statusText:c.statusText,headers:m,config:e,request:c};$c(function(O){n(O),f()},function(O){i(O),f()},g),c=null}}if("onloadend"in c?c.onloadend=p:c.onreadystatechange=function(){!c||c.readyState!==4||c.status===0&&!(c.responseURL&&c.responseURL.indexOf("file:")===0)||setTimeout(p)},c.onabort=function(){!c||(i(on("Request aborted",e,"ECONNABORTED",c)),c=null)},c.onerror=function(){i(on("Network Error",e,null,c)),c=null},c.ontimeout=function(){var w=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",g=e.transitional||Qc.transitional;e.timeoutErrorMessage&&(w=e.timeoutErrorMessage),i(on(w,e,g.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",c)),c=null},er.isStandardBrowserEnv()){var v=(e.withCredentials||Yc(l))&&e.xsrfCookieName?zc.read(e.xsrfCookieName):void 0;v&&(a[e.xsrfHeaderName]=v)}"setRequestHeader"in c&&er.forEach(a,function(w,g){typeof s=="undefined"&&g.toLowerCase()==="content-type"?delete a[g]:c.setRequestHeader(g,w)}),er.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||(i(!m||m&&m.type?new Zc("canceled"):m),c.abort(),c=null)},e.cancelToken&&e.cancelToken.subscribe(u),e.signal&&(e.signal.aborted?u():e.signal.addEventListener("abort",u))),s||(s=null),c.send(s)})}});var At=y((Bp,ks)=>{"use strict";var G=K(),Ns=ls(),el=rn(),tl={"Content-Type":"application/x-www-form-urlencoded"};function Is(t,e){!G.isUndefined(t)&&G.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}function rl(){var t;return typeof XMLHttpRequest!="undefined"?t=un():typeof process!="undefined"&&Object.prototype.toString.call(process)==="[object process]"&&(t=un()),t}function nl(t,e,r){if(G.isString(t))try{return(e||JSON.parse)(t),G.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}var tr={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:rl(),transformRequest:[function(e,r){return Ns(r,"Accept"),Ns(r,"Content-Type"),G.isFormData(e)||G.isArrayBuffer(e)||G.isBuffer(e)||G.isStream(e)||G.isFile(e)||G.isBlob(e)?e:G.isArrayBufferView(e)?e.buffer:G.isURLSearchParams(e)?(Is(r,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):G.isObject(e)||r&&r["Content-Type"]==="application/json"?(Is(r,"application/json"),nl(e)):e}],transformResponse:[function(e){var r=this.transitional||tr.transitional,n=r&&r.silentJSONParsing,i=r&&r.forcedJSONParsing,s=!n&&this.responseType==="json";if(s||i&&G.isString(e)&&e.length)try{return JSON.parse(e)}catch(a){if(s)throw a.name==="SyntaxError"?el(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, */*"}}};G.forEach(["delete","get","head"],function(e){tr.headers[e]={}});G.forEach(["post","put","patch"],function(e){tr.headers[e]=G.merge(tl)});ks.exports=tr});var Ds=y((Fp,_s)=>{"use strict";var il=K(),sl=At();_s.exports=function(e,r,n){var i=this||sl;return il.forEach(n,function(a){e=a.call(i,e,r)}),e}});var cn=y((Vp,qs)=>{"use strict";qs.exports=function(e){return!!(e&&e.__CANCEL__)}});var Ms=y((Hp,js)=>{"use strict";var Us=K(),ln=Ds(),al=cn(),ol=At(),ul=Tt();function fn(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new ul("canceled")}js.exports=function(e){fn(e),e.headers=e.headers||{},e.data=ln.call(e,e.data,e.headers,e.transformRequest),e.headers=Us.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),Us.forEach(["delete","get","head","post","put","patch","common"],function(i){delete e.headers[i]});var r=e.adapter||ol.adapter;return r(e).then(function(i){return fn(e),i.data=ln.call(e,i.data,i.headers,e.transformResponse),i},function(i){return al(i)||(fn(e),i&&i.response&&(i.response.data=ln.call(e,i.response.data,i.response.headers,e.transformResponse))),Promise.reject(i)})}});var dn=y((Gp,Ls)=>{"use strict";var te=K();Ls.exports=function(e,r){r=r||{};var n={};function i(c,h){return te.isPlainObject(c)&&te.isPlainObject(h)?te.merge(c,h):te.isPlainObject(h)?te.merge({},h):te.isArray(h)?h.slice():h}function s(c){if(te.isUndefined(r[c])){if(!te.isUndefined(e[c]))return i(void 0,e[c])}else return i(e[c],r[c])}function a(c){if(!te.isUndefined(r[c]))return i(void 0,r[c])}function o(c){if(te.isUndefined(r[c])){if(!te.isUndefined(e[c]))return i(void 0,e[c])}else return i(void 0,r[c])}function u(c){if(c in r)return i(e[c],r[c]);if(c in e)return i(void 0,e[c])}var f={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 te.forEach(Object.keys(e).concat(Object.keys(r)),function(h){var d=f[h]||s,l=d(h);te.isUndefined(l)&&d!==u||(n[h]=l)}),n}});var hn=y((Jp,Bs)=>{Bs.exports={version:"0.25.0"}});var Hs=y(($p,Vs)=>{"use strict";var cl=hn().version,pn={};["object","boolean","number","function","string","symbol"].forEach(function(t,e){pn[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});var Fs={};pn.transitional=function(e,r,n){function i(s,a){return"[Axios v"+cl+"] Transitional option '"+s+"'"+a+(n?". "+n:"")}return function(s,a,o){if(e===!1)throw new Error(i(a," has been removed"+(r?" in "+r:"")));return r&&!Fs[a]&&(Fs[a]=!0,console.warn(i(a," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(s,a,o):!0}};function ll(t,e,r){if(typeof t!="object")throw new TypeError("options must be an object");for(var n=Object.keys(t),i=n.length;i-- >0;){var s=n[i],a=e[s];if(a){var o=t[s],u=o===void 0||a(o,s,t);if(u!==!0)throw new TypeError("option "+s+" must be "+u);continue}if(r!==!0)throw Error("Unknown option "+s)}}Vs.exports={assertOptions:ll,validators:pn}});var Ks=y((zp,Ws)=>{"use strict";var $s=K(),fl=tn(),Gs=us(),Js=Ms(),rr=dn(),zs=Hs(),ze=zs.validators;function bt(t){this.defaults=t,this.interceptors={request:new Gs,response:new Gs}}bt.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=rr(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&&zs.assertOptions(n,{silentJSONParsing:ze.transitional(ze.boolean),forcedJSONParsing:ze.transitional(ze.boolean),clarifyTimeoutError:ze.transitional(ze.boolean)},!1);var i=[],s=!0;this.interceptors.request.forEach(function(l){typeof l.runWhen=="function"&&l.runWhen(r)===!1||(s=s&&l.synchronous,i.unshift(l.fulfilled,l.rejected))});var a=[];this.interceptors.response.forEach(function(l){a.push(l.fulfilled,l.rejected)});var o;if(!s){var u=[Js,void 0];for(Array.prototype.unshift.apply(u,i),u=u.concat(a),o=Promise.resolve(r);u.length;)o=o.then(u.shift(),u.shift());return o}for(var f=r;i.length;){var c=i.shift(),h=i.shift();try{f=c(f)}catch(d){h(d);break}}try{o=Js(f)}catch(d){return Promise.reject(d)}for(;a.length;)o=o.then(a.shift(),a.shift());return o};bt.prototype.getUri=function(e){if(!e.url)throw new Error("Provided config url is not valid");return e=rr(this.defaults,e),fl(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")};$s.forEach(["delete","get","head","options"],function(e){bt.prototype[e]=function(r,n){return this.request(rr(n||{},{method:e,url:r,data:(n||{}).data}))}});$s.forEach(["post","put","patch"],function(e){bt.prototype[e]=function(r,n,i){return this.request(rr(i||{},{method:e,url:r,data:n}))}});Ws.exports=bt});var Ys=y((Wp,Xs)=>{"use strict";var dl=Tt();function We(t){if(typeof t!="function")throw new TypeError("executor must be a function.");var e;this.promise=new Promise(function(i){e=i});var r=this;this.promise.then(function(n){if(!!r._listeners){var i,s=r._listeners.length;for(i=0;i<s;i++)r._listeners[i](n);r._listeners=null}}),this.promise.then=function(n){var i,s=new Promise(function(a){r.subscribe(a),i=a}).then(n);return s.cancel=function(){r.unsubscribe(i)},s},t(function(i){r.reason||(r.reason=new dl(i),e(r.reason))})}We.prototype.throwIfRequested=function(){if(this.reason)throw this.reason};We.prototype.subscribe=function(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]};We.prototype.unsubscribe=function(e){if(!!this._listeners){var r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}};We.source=function(){var e,r=new We(function(i){e=i});return{token:r,cancel:e}};Xs.exports=We});var Zs=y((Kp,Qs)=>{"use strict";Qs.exports=function(e){return function(n){return e.apply(null,n)}}});var ta=y((Xp,ea)=>{"use strict";var hl=K();ea.exports=function(e){return hl.isObject(e)&&e.isAxiosError===!0}});var ia=y((Yp,vn)=>{"use strict";var ra=K(),pl=Xr(),nr=Ks(),vl=dn(),ml=At();function na(t){var e=new nr(t),r=pl(nr.prototype.request,e);return ra.extend(r,nr.prototype,e),ra.extend(r,e),r.create=function(i){return na(vl(t,i))},r}var he=na(ml);he.Axios=nr;he.Cancel=Tt();he.CancelToken=Ys();he.isCancel=cn();he.VERSION=hn().version;he.all=function(e){return Promise.all(e)};he.spread=Zs();he.isAxiosError=ta();vn.exports=he;vn.exports.default=he});var aa=y((Qp,sa)=>{sa.exports=ia()});var En=y((Im,Ea)=>{"use strict";Ea.exports=function(e,r){return function(){for(var i=new Array(arguments.length),s=0;s<i.length;s++)i[s]=arguments[s];return e.apply(r,i)}}});var X=y((km,xa)=>{"use strict";var Pl=En(),_e=Object.prototype.toString;function xn(t){return _e.call(t)==="[object Array]"}function Sn(t){return typeof t=="undefined"}function Nl(t){return t!==null&&!Sn(t)&&t.constructor!==null&&!Sn(t.constructor)&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function Il(t){return _e.call(t)==="[object ArrayBuffer]"}function kl(t){return typeof FormData!="undefined"&&t instanceof FormData}function _l(t){var e;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&t.buffer instanceof ArrayBuffer,e}function Dl(t){return typeof t=="string"}function ql(t){return typeof t=="number"}function Sa(t){return t!==null&&typeof t=="object"}function lr(t){if(_e.call(t)!=="[object Object]")return!1;var e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}function Ul(t){return _e.call(t)==="[object Date]"}function jl(t){return _e.call(t)==="[object File]"}function Ml(t){return _e.call(t)==="[object Blob]"}function wa(t){return _e.call(t)==="[object Function]"}function Ll(t){return Sa(t)&&wa(t.pipe)}function Bl(t){return typeof URLSearchParams!="undefined"&&t instanceof URLSearchParams}function Fl(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function Vl(){return typeof navigator!="undefined"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window!="undefined"&&typeof document!="undefined"}function Tn(t,e){if(!(t===null||typeof t=="undefined"))if(typeof t!="object"&&(t=[t]),xn(t))for(var r=0,n=t.length;r<n;r++)e.call(null,t[r],r,t);else for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.call(null,t[i],i,t)}function wn(){var t={};function e(i,s){lr(t[s])&&lr(i)?t[s]=wn(t[s],i):lr(i)?t[s]=wn({},i):xn(i)?t[s]=i.slice():t[s]=i}for(var r=0,n=arguments.length;r<n;r++)Tn(arguments[r],e);return t}function Hl(t,e,r){return Tn(e,function(i,s){r&&typeof i=="function"?t[s]=Pl(i,r):t[s]=i}),t}function Gl(t){return t.charCodeAt(0)===65279&&(t=t.slice(1)),t}xa.exports={isArray:xn,isArrayBuffer:Il,isBuffer:Nl,isFormData:kl,isArrayBufferView:_l,isString:Dl,isNumber:ql,isObject:Sa,isPlainObject:lr,isUndefined:Sn,isDate:Ul,isFile:jl,isBlob:Ml,isFunction:wa,isStream:Ll,isURLSearchParams:Bl,isStandardBrowserEnv:Vl,forEach:Tn,merge:wn,extend:Hl,trim:Fl,stripBOM:Gl}});var An=y((_m,Aa)=>{"use strict";var Ye=X();function Ta(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}Aa.exports=function(e,r,n){if(!r)return e;var i;if(n)i=n(r);else if(Ye.isURLSearchParams(r))i=r.toString();else{var s=[];Ye.forEach(r,function(u,f){u===null||typeof u=="undefined"||(Ye.isArray(u)?f=f+"[]":u=[u],Ye.forEach(u,function(h){Ye.isDate(h)?h=h.toISOString():Ye.isObject(h)&&(h=JSON.stringify(h)),s.push(Ta(f)+"="+Ta(h))}))}),i=s.join("&")}if(i){var a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}});var Ra=y((Dm,ba)=>{"use strict";var Jl=X();function fr(){this.handlers=[]}fr.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};fr.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)};fr.prototype.forEach=function(e){Jl.forEach(this.handlers,function(n){n!==null&&e(n)})};ba.exports=fr});var Ca=y((qm,Oa)=>{"use strict";var $l=X();Oa.exports=function(e,r){$l.forEach(e,function(i,s){s!==r&&s.toUpperCase()===r.toUpperCase()&&(e[r]=i,delete e[s])})}});var bn=y((Um,Pa)=>{"use strict";Pa.exports=function(e,r,n,i,s){return e.config=r,n&&(e.code=n),e.request=i,e.response=s,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 Rn=y((jm,Na)=>{"use strict";var zl=bn();Na.exports=function(e,r,n,i,s){var a=new Error(e);return zl(a,r,n,i,s)}});var ka=y((Mm,Ia)=>{"use strict";var Wl=Rn();Ia.exports=function(e,r,n){var i=n.config.validateStatus;!n.status||!i||i(n.status)?e(n):r(Wl("Request failed with status code "+n.status,n.config,null,n.request,n))}});var Da=y((Lm,_a)=>{"use strict";var dr=X();_a.exports=dr.isStandardBrowserEnv()?function(){return{write:function(r,n,i,s,a,o){var u=[];u.push(r+"="+encodeURIComponent(n)),dr.isNumber(i)&&u.push("expires="+new Date(i).toGMTString()),dr.isString(s)&&u.push("path="+s),dr.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 Ua=y((Bm,qa)=>{"use strict";qa.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}});var Ma=y((Fm,ja)=>{"use strict";ja.exports=function(e,r){return r?e.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):e}});var Ba=y((Vm,La)=>{"use strict";var Kl=Ua(),Xl=Ma();La.exports=function(e,r){return e&&!Kl(r)?Xl(e,r):r}});var Va=y((Hm,Fa)=>{"use strict";var On=X(),Yl=["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"];Fa.exports=function(e){var r={},n,i,s;return e&&On.forEach(e.split(`
|
|
3
|
+
`),function(o){if(s=o.indexOf(":"),n=On.trim(o.substr(0,s)).toLowerCase(),i=On.trim(o.substr(s+1)),n){if(r[n]&&Yl.indexOf(n)>=0)return;n==="set-cookie"?r[n]=(r[n]?r[n]:[]).concat([i]):r[n]=r[n]?r[n]+", "+i:i}}),r}});var Ja=y((Gm,Ga)=>{"use strict";var Ha=X();Ga.exports=Ha.isStandardBrowserEnv()?function(){var e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a"),n;function i(s){var a=s;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=i(window.location.href),function(a){var o=Ha.isString(a)?i(a):a;return o.protocol===n.protocol&&o.host===n.host}}():function(){return function(){return!0}}()});var Pn=y((Jm,$a)=>{"use strict";var hr=X(),Ql=ka(),Zl=Da(),ef=An(),tf=Ba(),rf=Va(),nf=Ja(),Cn=Rn();$a.exports=function(e){return new Promise(function(n,i){var s=e.data,a=e.headers,o=e.responseType;hr.isFormData(s)&&delete a["Content-Type"];var u=new XMLHttpRequest;if(e.auth){var f=e.auth.username||"",c=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";a.Authorization="Basic "+btoa(f+":"+c)}var h=tf(e.baseURL,e.url);u.open(e.method.toUpperCase(),ef(h,e.params,e.paramsSerializer),!0),u.timeout=e.timeout;function d(){if(!!u){var p="getAllResponseHeaders"in u?rf(u.getAllResponseHeaders()):null,v=!o||o==="text"||o==="json"?u.responseText:u.response,m={data:v,status:u.status,statusText:u.statusText,headers:p,config:e,request:u};Ql(n,i,m),u=null}}if("onloadend"in u?u.onloadend=d:u.onreadystatechange=function(){!u||u.readyState!==4||u.status===0&&!(u.responseURL&&u.responseURL.indexOf("file:")===0)||setTimeout(d)},u.onabort=function(){!u||(i(Cn("Request aborted",e,"ECONNABORTED",u)),u=null)},u.onerror=function(){i(Cn("Network Error",e,null,u)),u=null},u.ontimeout=function(){var v="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(v=e.timeoutErrorMessage),i(Cn(v,e,e.transitional&&e.transitional.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",u)),u=null},hr.isStandardBrowserEnv()){var l=(e.withCredentials||nf(h))&&e.xsrfCookieName?Zl.read(e.xsrfCookieName):void 0;l&&(a[e.xsrfHeaderName]=l)}"setRequestHeader"in u&&hr.forEach(a,function(v,m){typeof s=="undefined"&&m.toLowerCase()==="content-type"?delete a[m]:u.setRequestHeader(m,v)}),hr.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(v){!u||(u.abort(),i(v),u=null)}),s||(s=null),u.send(s)})}});var vr=y(($m,Ka)=>{"use strict";var J=X(),za=Ca(),sf=bn(),af={"Content-Type":"application/x-www-form-urlencoded"};function Wa(t,e){!J.isUndefined(t)&&J.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}function of(){var t;return typeof XMLHttpRequest!="undefined"?t=Pn():typeof process!="undefined"&&Object.prototype.toString.call(process)==="[object process]"&&(t=Pn()),t}function uf(t,e,r){if(J.isString(t))try{return(e||JSON.parse)(t),J.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}var pr={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:of(),transformRequest:[function(e,r){return za(r,"Accept"),za(r,"Content-Type"),J.isFormData(e)||J.isArrayBuffer(e)||J.isBuffer(e)||J.isStream(e)||J.isFile(e)||J.isBlob(e)?e:J.isArrayBufferView(e)?e.buffer:J.isURLSearchParams(e)?(Wa(r,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):J.isObject(e)||r&&r["Content-Type"]==="application/json"?(Wa(r,"application/json"),uf(e)):e}],transformResponse:[function(e){var r=this.transitional,n=r&&r.silentJSONParsing,i=r&&r.forcedJSONParsing,s=!n&&this.responseType==="json";if(s||i&&J.isString(e)&&e.length)try{return JSON.parse(e)}catch(a){if(s)throw a.name==="SyntaxError"?sf(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}};pr.headers={common:{Accept:"application/json, text/plain, */*"}};J.forEach(["delete","get","head"],function(e){pr.headers[e]={}});J.forEach(["post","put","patch"],function(e){pr.headers[e]=J.merge(af)});Ka.exports=pr});var Ya=y((zm,Xa)=>{"use strict";var cf=X(),lf=vr();Xa.exports=function(e,r,n){var i=this||lf;return cf.forEach(n,function(a){e=a.call(i,e,r)}),e}});var Nn=y((Wm,Qa)=>{"use strict";Qa.exports=function(e){return!!(e&&e.__CANCEL__)}});var to=y((Km,eo)=>{"use strict";var Za=X(),In=Ya(),ff=Nn(),df=vr();function kn(t){t.cancelToken&&t.cancelToken.throwIfRequested()}eo.exports=function(e){kn(e),e.headers=e.headers||{},e.data=In.call(e,e.data,e.headers,e.transformRequest),e.headers=Za.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),Za.forEach(["delete","get","head","post","put","patch","common"],function(i){delete e.headers[i]});var r=e.adapter||df.adapter;return r(e).then(function(i){return kn(e),i.data=In.call(e,i.data,i.headers,e.transformResponse),i},function(i){return ff(i)||(kn(e),i&&i.response&&(i.response.data=In.call(e,i.response.data,i.response.headers,e.transformResponse))),Promise.reject(i)})}});var _n=y((Xm,ro)=>{"use strict";var W=X();ro.exports=function(e,r){r=r||{};var n={},i=["url","method","data"],s=["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(d,l){return W.isPlainObject(d)&&W.isPlainObject(l)?W.merge(d,l):W.isPlainObject(l)?W.merge({},l):W.isArray(l)?l.slice():l}function f(d){W.isUndefined(r[d])?W.isUndefined(e[d])||(n[d]=u(void 0,e[d])):n[d]=u(e[d],r[d])}W.forEach(i,function(l){W.isUndefined(r[l])||(n[l]=u(void 0,r[l]))}),W.forEach(s,f),W.forEach(a,function(l){W.isUndefined(r[l])?W.isUndefined(e[l])||(n[l]=u(void 0,e[l])):n[l]=u(void 0,r[l])}),W.forEach(o,function(l){l in r?n[l]=u(e[l],r[l]):l in e&&(n[l]=u(void 0,e[l]))});var c=i.concat(s).concat(a).concat(o),h=Object.keys(e).concat(Object.keys(r)).filter(function(l){return c.indexOf(l)===-1});return W.forEach(h,f),n}});var no=y((Ym,hf)=>{hf.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 uo=y((Qm,oo)=>{"use strict";var so=no(),Dn={};["object","boolean","number","function","string","symbol"].forEach(function(t,e){Dn[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});var io={},pf=so.version.split(".");function ao(t,e){for(var r=e?e.split("."):pf,n=t.split("."),i=0;i<3;i++){if(r[i]>n[i])return!0;if(r[i]<n[i])return!1}return!1}Dn.transitional=function(e,r,n){var i=r&&ao(r);function s(a,o){return"[Axios v"+so.version+"] Transitional option '"+a+"'"+o+(n?". "+n:"")}return function(a,o,u){if(e===!1)throw new Error(s(o," has been removed in "+r));return i&&!io[o]&&(io[o]=!0,console.warn(s(o," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(a,o,u):!0}};function vf(t,e,r){if(typeof t!="object")throw new TypeError("options must be an object");for(var n=Object.keys(t),i=n.length;i-- >0;){var s=n[i],a=e[s];if(a){var o=t[s],u=o===void 0||a(o,s,t);if(u!==!0)throw new TypeError("option "+s+" must be "+u);continue}if(r!==!0)throw Error("Unknown option "+s)}}oo.exports={isOlderVersion:ao,assertOptions:vf,validators:Dn}});var vo=y((Zm,po)=>{"use strict";var fo=X(),mf=An(),co=Ra(),lo=to(),mr=_n(),ho=uo(),Qe=ho.validators;function Ot(t){this.defaults=t,this.interceptors={request:new co,response:new co}}Ot.prototype.request=function(e){typeof e=="string"?(e=arguments[1]||{},e.url=arguments[0]):e=e||{},e=mr(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&&ho.assertOptions(r,{silentJSONParsing:Qe.transitional(Qe.boolean,"1.0.0"),forcedJSONParsing:Qe.transitional(Qe.boolean,"1.0.0"),clarifyTimeoutError:Qe.transitional(Qe.boolean,"1.0.0")},!1);var n=[],i=!0;this.interceptors.request.forEach(function(d){typeof d.runWhen=="function"&&d.runWhen(e)===!1||(i=i&&d.synchronous,n.unshift(d.fulfilled,d.rejected))});var s=[];this.interceptors.response.forEach(function(d){s.push(d.fulfilled,d.rejected)});var a;if(!i){var o=[lo,void 0];for(Array.prototype.unshift.apply(o,n),o=o.concat(s),a=Promise.resolve(e);o.length;)a=a.then(o.shift(),o.shift());return a}for(var u=e;n.length;){var f=n.shift(),c=n.shift();try{u=f(u)}catch(h){c(h);break}}try{a=lo(u)}catch(h){return Promise.reject(h)}for(;s.length;)a=a.then(s.shift(),s.shift());return a};Ot.prototype.getUri=function(e){return e=mr(this.defaults,e),mf(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")};fo.forEach(["delete","get","head","options"],function(e){Ot.prototype[e]=function(r,n){return this.request(mr(n||{},{method:e,url:r,data:(n||{}).data}))}});fo.forEach(["post","put","patch"],function(e){Ot.prototype[e]=function(r,n,i){return this.request(mr(i||{},{method:e,url:r,data:n}))}});po.exports=Ot});var Un=y((ey,mo)=>{"use strict";function qn(t){this.message=t}qn.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")};qn.prototype.__CANCEL__=!0;mo.exports=qn});var go=y((ty,yo)=>{"use strict";var yf=Un();function yr(t){if(typeof t!="function")throw new TypeError("executor must be a function.");var e;this.promise=new Promise(function(i){e=i});var r=this;t(function(i){r.reason||(r.reason=new yf(i),e(r.reason))})}yr.prototype.throwIfRequested=function(){if(this.reason)throw this.reason};yr.source=function(){var e,r=new yr(function(i){e=i});return{token:r,cancel:e}};yo.exports=yr});var So=y((ry,Eo)=>{"use strict";Eo.exports=function(e){return function(n){return e.apply(null,n)}}});var xo=y((ny,wo)=>{"use strict";wo.exports=function(e){return typeof e=="object"&&e.isAxiosError===!0}});var bo=y((iy,jn)=>{"use strict";var To=X(),gf=En(),gr=vo(),Ef=_n(),Sf=vr();function Ao(t){var e=new gr(t),r=gf(gr.prototype.request,e);return To.extend(r,gr.prototype,e),To.extend(r,e),r}var ue=Ao(Sf);ue.Axios=gr;ue.create=function(e){return Ao(Ef(ue.defaults,e))};ue.Cancel=Un();ue.CancelToken=go();ue.isCancel=Nn();ue.all=function(e){return Promise.all(e)};ue.spread=So();ue.isAxiosError=xo();jn.exports=ue;jn.exports.default=ue});var Oo=y((sy,Ro)=>{Ro.exports=bo()});var Mn=y((py,Po)=>{"use strict";Po.exports=function(e,r){return function(){for(var i=new Array(arguments.length),s=0;s<i.length;s++)i[s]=arguments[s];return e.apply(r,i)}}});var Y=y((vy,ko)=>{"use strict";var wf=Mn(),De=Object.prototype.toString;function Fn(t){return De.call(t)==="[object Array]"}function Ln(t){return typeof t=="undefined"}function xf(t){return t!==null&&!Ln(t)&&t.constructor!==null&&!Ln(t.constructor)&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function Tf(t){return De.call(t)==="[object ArrayBuffer]"}function Af(t){return typeof FormData!="undefined"&&t instanceof FormData}function bf(t){var e;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&t.buffer instanceof ArrayBuffer,e}function Rf(t){return typeof t=="string"}function Of(t){return typeof t=="number"}function No(t){return t!==null&&typeof t=="object"}function wr(t){if(De.call(t)!=="[object Object]")return!1;var e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}function Cf(t){return De.call(t)==="[object Date]"}function Pf(t){return De.call(t)==="[object File]"}function Nf(t){return De.call(t)==="[object Blob]"}function Io(t){return De.call(t)==="[object Function]"}function If(t){return No(t)&&Io(t.pipe)}function kf(t){return typeof URLSearchParams!="undefined"&&t instanceof URLSearchParams}function _f(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function Df(){return typeof navigator!="undefined"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window!="undefined"&&typeof document!="undefined"}function Vn(t,e){if(!(t===null||typeof t=="undefined"))if(typeof t!="object"&&(t=[t]),Fn(t))for(var r=0,n=t.length;r<n;r++)e.call(null,t[r],r,t);else for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.call(null,t[i],i,t)}function Bn(){var t={};function e(i,s){wr(t[s])&&wr(i)?t[s]=Bn(t[s],i):wr(i)?t[s]=Bn({},i):Fn(i)?t[s]=i.slice():t[s]=i}for(var r=0,n=arguments.length;r<n;r++)Vn(arguments[r],e);return t}function qf(t,e,r){return Vn(e,function(i,s){r&&typeof i=="function"?t[s]=wf(i,r):t[s]=i}),t}function Uf(t){return t.charCodeAt(0)===65279&&(t=t.slice(1)),t}ko.exports={isArray:Fn,isArrayBuffer:Tf,isBuffer:xf,isFormData:Af,isArrayBufferView:bf,isString:Rf,isNumber:Of,isObject:No,isPlainObject:wr,isUndefined:Ln,isDate:Cf,isFile:Pf,isBlob:Nf,isFunction:Io,isStream:If,isURLSearchParams:kf,isStandardBrowserEnv:Df,forEach:Vn,merge:Bn,extend:qf,trim:_f,stripBOM:Uf}});var Hn=y((my,Do)=>{"use strict";var Ze=Y();function _o(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}Do.exports=function(e,r,n){if(!r)return e;var i;if(n)i=n(r);else if(Ze.isURLSearchParams(r))i=r.toString();else{var s=[];Ze.forEach(r,function(u,f){u===null||typeof u=="undefined"||(Ze.isArray(u)?f=f+"[]":u=[u],Ze.forEach(u,function(h){Ze.isDate(h)?h=h.toISOString():Ze.isObject(h)&&(h=JSON.stringify(h)),s.push(_o(f)+"="+_o(h))}))}),i=s.join("&")}if(i){var a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}});var Uo=y((yy,qo)=>{"use strict";var jf=Y();function xr(){this.handlers=[]}xr.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};xr.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)};xr.prototype.forEach=function(e){jf.forEach(this.handlers,function(n){n!==null&&e(n)})};qo.exports=xr});var Mo=y((gy,jo)=>{"use strict";var Mf=Y();jo.exports=function(e,r){Mf.forEach(e,function(i,s){s!==r&&s.toUpperCase()===r.toUpperCase()&&(e[r]=i,delete e[s])})}});var Gn=y((Ey,Lo)=>{"use strict";Lo.exports=function(e,r,n,i,s){return e.config=r,n&&(e.code=n),e.request=i,e.response=s,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 Jn=y((Sy,Bo)=>{"use strict";var Lf=Gn();Bo.exports=function(e,r,n,i,s){var a=new Error(e);return Lf(a,r,n,i,s)}});var Vo=y((wy,Fo)=>{"use strict";var Bf=Jn();Fo.exports=function(e,r,n){var i=n.config.validateStatus;!n.status||!i||i(n.status)?e(n):r(Bf("Request failed with status code "+n.status,n.config,null,n.request,n))}});var Go=y((xy,Ho)=>{"use strict";var Tr=Y();Ho.exports=Tr.isStandardBrowserEnv()?function(){return{write:function(r,n,i,s,a,o){var u=[];u.push(r+"="+encodeURIComponent(n)),Tr.isNumber(i)&&u.push("expires="+new Date(i).toGMTString()),Tr.isString(s)&&u.push("path="+s),Tr.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 $o=y((Ty,Jo)=>{"use strict";Jo.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}});var Wo=y((Ay,zo)=>{"use strict";zo.exports=function(e,r){return r?e.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):e}});var Xo=y((by,Ko)=>{"use strict";var Ff=$o(),Vf=Wo();Ko.exports=function(e,r){return e&&!Ff(r)?Vf(e,r):r}});var Qo=y((Ry,Yo)=>{"use strict";var $n=Y(),Hf=["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"];Yo.exports=function(e){var r={},n,i,s;return e&&$n.forEach(e.split(`
|
|
4
|
+
`),function(o){if(s=o.indexOf(":"),n=$n.trim(o.substr(0,s)).toLowerCase(),i=$n.trim(o.substr(s+1)),n){if(r[n]&&Hf.indexOf(n)>=0)return;n==="set-cookie"?r[n]=(r[n]?r[n]:[]).concat([i]):r[n]=r[n]?r[n]+", "+i:i}}),r}});var tu=y((Oy,eu)=>{"use strict";var Zo=Y();eu.exports=Zo.isStandardBrowserEnv()?function(){var e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a"),n;function i(s){var a=s;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=i(window.location.href),function(a){var o=Zo.isString(a)?i(a):a;return o.protocol===n.protocol&&o.host===n.host}}():function(){return function(){return!0}}()});var Ct=y((Cy,ru)=>{"use strict";function zn(t){this.message=t}zn.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")};zn.prototype.__CANCEL__=!0;ru.exports=zn});var Kn=y((Py,nu)=>{"use strict";var Ar=Y(),Gf=Vo(),Jf=Go(),$f=Hn(),zf=Xo(),Wf=Qo(),Kf=tu(),Wn=Jn(),Xf=Pt(),Yf=Ct();nu.exports=function(e){return new Promise(function(n,i){var s=e.data,a=e.headers,o=e.responseType,u;function f(){e.cancelToken&&e.cancelToken.unsubscribe(u),e.signal&&e.signal.removeEventListener("abort",u)}Ar.isFormData(s)&&delete a["Content-Type"];var c=new XMLHttpRequest;if(e.auth){var h=e.auth.username||"",d=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";a.Authorization="Basic "+btoa(h+":"+d)}var l=zf(e.baseURL,e.url);c.open(e.method.toUpperCase(),$f(l,e.params,e.paramsSerializer),!0),c.timeout=e.timeout;function p(){if(!!c){var m="getAllResponseHeaders"in c?Wf(c.getAllResponseHeaders()):null,w=!o||o==="text"||o==="json"?c.responseText:c.response,g={data:w,status:c.status,statusText:c.statusText,headers:m,config:e,request:c};Gf(function(O){n(O),f()},function(O){i(O),f()},g),c=null}}if("onloadend"in c?c.onloadend=p:c.onreadystatechange=function(){!c||c.readyState!==4||c.status===0&&!(c.responseURL&&c.responseURL.indexOf("file:")===0)||setTimeout(p)},c.onabort=function(){!c||(i(Wn("Request aborted",e,"ECONNABORTED",c)),c=null)},c.onerror=function(){i(Wn("Network Error",e,null,c)),c=null},c.ontimeout=function(){var w=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",g=e.transitional||Xf.transitional;e.timeoutErrorMessage&&(w=e.timeoutErrorMessage),i(Wn(w,e,g.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",c)),c=null},Ar.isStandardBrowserEnv()){var v=(e.withCredentials||Kf(l))&&e.xsrfCookieName?Jf.read(e.xsrfCookieName):void 0;v&&(a[e.xsrfHeaderName]=v)}"setRequestHeader"in c&&Ar.forEach(a,function(w,g){typeof s=="undefined"&&g.toLowerCase()==="content-type"?delete a[g]:c.setRequestHeader(g,w)}),Ar.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||(i(!m||m&&m.type?new Yf("canceled"):m),c.abort(),c=null)},e.cancelToken&&e.cancelToken.subscribe(u),e.signal&&(e.signal.aborted?u():e.signal.addEventListener("abort",u))),s||(s=null),c.send(s)})}});var Pt=y((Ny,au)=>{"use strict";var $=Y(),iu=Mo(),Qf=Gn(),Zf={"Content-Type":"application/x-www-form-urlencoded"};function su(t,e){!$.isUndefined(t)&&$.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}function ed(){var t;return typeof XMLHttpRequest!="undefined"?t=Kn():typeof process!="undefined"&&Object.prototype.toString.call(process)==="[object process]"&&(t=Kn()),t}function td(t,e,r){if($.isString(t))try{return(e||JSON.parse)(t),$.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}var br={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:ed(),transformRequest:[function(e,r){return iu(r,"Accept"),iu(r,"Content-Type"),$.isFormData(e)||$.isArrayBuffer(e)||$.isBuffer(e)||$.isStream(e)||$.isFile(e)||$.isBlob(e)?e:$.isArrayBufferView(e)?e.buffer:$.isURLSearchParams(e)?(su(r,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):$.isObject(e)||r&&r["Content-Type"]==="application/json"?(su(r,"application/json"),td(e)):e}],transformResponse:[function(e){var r=this.transitional||br.transitional,n=r&&r.silentJSONParsing,i=r&&r.forcedJSONParsing,s=!n&&this.responseType==="json";if(s||i&&$.isString(e)&&e.length)try{return JSON.parse(e)}catch(a){if(s)throw a.name==="SyntaxError"?Qf(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, */*"}}};$.forEach(["delete","get","head"],function(e){br.headers[e]={}});$.forEach(["post","put","patch"],function(e){br.headers[e]=$.merge(Zf)});au.exports=br});var uu=y((Iy,ou)=>{"use strict";var rd=Y(),nd=Pt();ou.exports=function(e,r,n){var i=this||nd;return rd.forEach(n,function(a){e=a.call(i,e,r)}),e}});var Xn=y((ky,cu)=>{"use strict";cu.exports=function(e){return!!(e&&e.__CANCEL__)}});var du=y((_y,fu)=>{"use strict";var lu=Y(),Yn=uu(),id=Xn(),sd=Pt(),ad=Ct();function Qn(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new ad("canceled")}fu.exports=function(e){Qn(e),e.headers=e.headers||{},e.data=Yn.call(e,e.data,e.headers,e.transformRequest),e.headers=lu.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),lu.forEach(["delete","get","head","post","put","patch","common"],function(i){delete e.headers[i]});var r=e.adapter||sd.adapter;return r(e).then(function(i){return Qn(e),i.data=Yn.call(e,i.data,i.headers,e.transformResponse),i},function(i){return id(i)||(Qn(e),i&&i.response&&(i.response.data=Yn.call(e,i.response.data,i.response.headers,e.transformResponse))),Promise.reject(i)})}});var Zn=y((Dy,hu)=>{"use strict";var re=Y();hu.exports=function(e,r){r=r||{};var n={};function i(c,h){return re.isPlainObject(c)&&re.isPlainObject(h)?re.merge(c,h):re.isPlainObject(h)?re.merge({},h):re.isArray(h)?h.slice():h}function s(c){if(re.isUndefined(r[c])){if(!re.isUndefined(e[c]))return i(void 0,e[c])}else return i(e[c],r[c])}function a(c){if(!re.isUndefined(r[c]))return i(void 0,r[c])}function o(c){if(re.isUndefined(r[c])){if(!re.isUndefined(e[c]))return i(void 0,e[c])}else return i(void 0,r[c])}function u(c){if(c in r)return i(e[c],r[c]);if(c in e)return i(void 0,e[c])}var f={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 re.forEach(Object.keys(e).concat(Object.keys(r)),function(h){var d=f[h]||s,l=d(h);re.isUndefined(l)&&d!==u||(n[h]=l)}),n}});var ei=y((qy,pu)=>{pu.exports={version:"0.23.0"}});var yu=y((Uy,mu)=>{"use strict";var od=ei().version,ti={};["object","boolean","number","function","string","symbol"].forEach(function(t,e){ti[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});var vu={};ti.transitional=function(e,r,n){function i(s,a){return"[Axios v"+od+"] Transitional option '"+s+"'"+a+(n?". "+n:"")}return function(s,a,o){if(e===!1)throw new Error(i(a," has been removed"+(r?" in "+r:"")));return r&&!vu[a]&&(vu[a]=!0,console.warn(i(a," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(s,a,o):!0}};function ud(t,e,r){if(typeof t!="object")throw new TypeError("options must be an object");for(var n=Object.keys(t),i=n.length;i-- >0;){var s=n[i],a=e[s];if(a){var o=t[s],u=o===void 0||a(o,s,t);if(u!==!0)throw new TypeError("option "+s+" must be "+u);continue}if(r!==!0)throw Error("Unknown option "+s)}}mu.exports={assertOptions:ud,validators:ti}});var Tu=y((jy,xu)=>{"use strict";var Su=Y(),cd=Hn(),gu=Uo(),Eu=du(),Rr=Zn(),wu=yu(),et=wu.validators;function Nt(t){this.defaults=t,this.interceptors={request:new gu,response:new gu}}Nt.prototype.request=function(e){typeof e=="string"?(e=arguments[1]||{},e.url=arguments[0]):e=e||{},e=Rr(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&&wu.assertOptions(r,{silentJSONParsing:et.transitional(et.boolean),forcedJSONParsing:et.transitional(et.boolean),clarifyTimeoutError:et.transitional(et.boolean)},!1);var n=[],i=!0;this.interceptors.request.forEach(function(d){typeof d.runWhen=="function"&&d.runWhen(e)===!1||(i=i&&d.synchronous,n.unshift(d.fulfilled,d.rejected))});var s=[];this.interceptors.response.forEach(function(d){s.push(d.fulfilled,d.rejected)});var a;if(!i){var o=[Eu,void 0];for(Array.prototype.unshift.apply(o,n),o=o.concat(s),a=Promise.resolve(e);o.length;)a=a.then(o.shift(),o.shift());return a}for(var u=e;n.length;){var f=n.shift(),c=n.shift();try{u=f(u)}catch(h){c(h);break}}try{a=Eu(u)}catch(h){return Promise.reject(h)}for(;s.length;)a=a.then(s.shift(),s.shift());return a};Nt.prototype.getUri=function(e){return e=Rr(this.defaults,e),cd(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")};Su.forEach(["delete","get","head","options"],function(e){Nt.prototype[e]=function(r,n){return this.request(Rr(n||{},{method:e,url:r,data:(n||{}).data}))}});Su.forEach(["post","put","patch"],function(e){Nt.prototype[e]=function(r,n,i){return this.request(Rr(i||{},{method:e,url:r,data:n}))}});xu.exports=Nt});var bu=y((My,Au)=>{"use strict";var ld=Ct();function tt(t){if(typeof t!="function")throw new TypeError("executor must be a function.");var e;this.promise=new Promise(function(i){e=i});var r=this;this.promise.then(function(n){if(!!r._listeners){var i,s=r._listeners.length;for(i=0;i<s;i++)r._listeners[i](n);r._listeners=null}}),this.promise.then=function(n){var i,s=new Promise(function(a){r.subscribe(a),i=a}).then(n);return s.cancel=function(){r.unsubscribe(i)},s},t(function(i){r.reason||(r.reason=new ld(i),e(r.reason))})}tt.prototype.throwIfRequested=function(){if(this.reason)throw this.reason};tt.prototype.subscribe=function(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]};tt.prototype.unsubscribe=function(e){if(!!this._listeners){var r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}};tt.source=function(){var e,r=new tt(function(i){e=i});return{token:r,cancel:e}};Au.exports=tt});var Ou=y((Ly,Ru)=>{"use strict";Ru.exports=function(e){return function(n){return e.apply(null,n)}}});var Pu=y((By,Cu)=>{"use strict";Cu.exports=function(e){return typeof e=="object"&&e.isAxiosError===!0}});var ku=y((Fy,ri)=>{"use strict";var Nu=Y(),fd=Mn(),Or=Tu(),dd=Zn(),hd=Pt();function Iu(t){var e=new Or(t),r=fd(Or.prototype.request,e);return Nu.extend(r,Or.prototype,e),Nu.extend(r,e),r.create=function(i){return Iu(dd(t,i))},r}var pe=Iu(hd);pe.Axios=Or;pe.Cancel=Ct();pe.CancelToken=bu();pe.isCancel=Xn();pe.VERSION=ei().version;pe.all=function(e){return Promise.all(e)};pe.spread=Ou();pe.isAxiosError=Pu();ri.exports=pe;ri.exports.default=pe});var ni=y((Vy,_u)=>{_u.exports=ku()});var ii=y(Pr=>{"use strict";Object.defineProperty(Pr,"__esModule",{value:!0});Pr.default=void 0;var pd=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):void 0,vd=pd;Pr.default=vd});var Uu=y(si=>{"use strict";Object.defineProperty(si,"__esModule",{value:!0});si.default=Ed;var md=yd(ii());function yd(t){return t&&t.__esModule?t:{default:t}}function Nr(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Nr=function(r){return typeof r}:Nr=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Nr(t)}var gd=10,qu=2;function Ed(t){return Ir(t,[])}function Ir(t,e){switch(Nr(t)){case"string":return JSON.stringify(t);case"function":return t.name?"[function ".concat(t.name,"]"):"[function]";case"object":return t===null?"null":Sd(t,e);default:return String(t)}}function Sd(t,e){if(e.indexOf(t)!==-1)return"[Circular]";var r=[].concat(e,[t]),n=Td(t);if(n!==void 0){var i=n.call(t);if(i!==t)return typeof i=="string"?i:Ir(i,r)}else if(Array.isArray(t))return xd(t,r);return wd(t,r)}function wd(t,e){var r=Object.keys(t);if(r.length===0)return"{}";if(e.length>qu)return"["+Ad(t)+"]";var n=r.map(function(i){var s=Ir(t[i],e);return i+": "+s});return"{ "+n.join(", ")+" }"}function xd(t,e){if(t.length===0)return"[]";if(e.length>qu)return"[Array]";for(var r=Math.min(gd,t.length),n=t.length-r,i=[],s=0;s<r;++s)i.push(Ir(t[s],e));return n===1?i.push("... 1 more item"):n>1&&i.push("... ".concat(n," more items")),"["+i.join(", ")+"]"}function Td(t){var e=t[String(md.default)];if(typeof e=="function")return e;if(typeof t.inspect=="function")return t.inspect}function Ad(t){var e=Object.prototype.toString.call(t).replace(/^\[object /,"").replace(/]$/,"");if(e==="Object"&&typeof t.constructor=="function"){var r=t.constructor.name;if(typeof r=="string"&&r!=="")return r}return e}});var ju=y(ai=>{"use strict";Object.defineProperty(ai,"__esModule",{value:!0});ai.default=bd;function bd(t,e){var r=Boolean(t);if(!r)throw new Error(e!=null?e:"Unexpected invariant triggered.")}});var Bu=y(oi=>{"use strict";Object.defineProperty(oi,"__esModule",{value:!0});oi.default=Od;var Rd=Lu(ju()),Mu=Lu(ii());function Lu(t){return t&&t.__esModule?t:{default:t}}function Od(t){var e=t.prototype.toJSON;typeof e=="function"||(0,Rd.default)(0),t.prototype.inspect=e,Mu.default&&(t.prototype[Mu.default]=e)}});var Gu=y(qe=>{"use strict";Object.defineProperty(qe,"__esModule",{value:!0});qe.isNode=Pd;qe.Token=qe.Location=void 0;var Fu=Cd(Bu());function Cd(t){return t&&t.__esModule?t:{default:t}}var Vu=function(){function t(r,n,i){this.start=r.start,this.end=n.end,this.startToken=r,this.endToken=n,this.source=i}var e=t.prototype;return e.toJSON=function(){return{start:this.start,end:this.end}},t}();qe.Location=Vu;(0,Fu.default)(Vu);var Hu=function(){function t(r,n,i,s,a,o,u){this.kind=r,this.start=n,this.end=i,this.line=s,this.column=a,this.value=u,this.prev=o,this.next=null}var e=t.prototype;return e.toJSON=function(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}},t}();qe.Token=Hu;(0,Fu.default)(Hu);function Pd(t){return t!=null&&typeof t.kind=="string"}});var zu=y(ye=>{"use strict";Object.defineProperty(ye,"__esModule",{value:!0});ye.visit=kd;ye.visitInParallel=_d;ye.getVisitFn=kr;ye.BREAK=ye.QueryDocumentKeys=void 0;var Nd=Id(Uu()),Ju=Gu();function Id(t){return t&&t.__esModule?t:{default:t}}var $u={Name:[],Document:["definitions"],OperationDefinition:["name","variableDefinitions","directives","selectionSet"],VariableDefinition:["variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["description","directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","interfaces","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","locations"],SchemaExtension:["directives","operationTypes"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","interfaces","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"]};ye.QueryDocumentKeys=$u;var rt=Object.freeze({});ye.BREAK=rt;function kd(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:$u,n=void 0,i=Array.isArray(t),s=[t],a=-1,o=[],u=void 0,f=void 0,c=void 0,h=[],d=[],l=t;do{a++;var p=a===s.length,v=p&&o.length!==0;if(p){if(f=d.length===0?void 0:h[h.length-1],u=c,c=d.pop(),v){if(i)u=u.slice();else{for(var m={},w=0,g=Object.keys(u);w<g.length;w++){var T=g[w];m[T]=u[T]}u=m}for(var O=0,N=0;N<o.length;N++){var M=o[N][0],A=o[N][1];i&&(M-=O),i&&A===null?(u.splice(M,1),O++):u[M]=A}}a=n.index,s=n.keys,o=n.edits,i=n.inArray,n=n.prev}else{if(f=c?i?a:s[a]:void 0,u=c?c[f]:l,u==null)continue;c&&h.push(f)}var x=void 0;if(!Array.isArray(u)){if(!(0,Ju.isNode)(u))throw new Error("Invalid AST Node: ".concat((0,Nd.default)(u),"."));var b=kr(e,u.kind,p);if(b){if(x=b.call(e,u,f,c,h,d),x===rt)break;if(x===!1){if(!p){h.pop();continue}}else if(x!==void 0&&(o.push([f,x]),!p))if((0,Ju.isNode)(x))u=x;else{h.pop();continue}}}if(x===void 0&&v&&o.push([f,u]),p)h.pop();else{var q;n={inArray:i,index:a,keys:s,edits:o,prev:n},i=Array.isArray(u),s=i?u:(q=r[u.kind])!==null&&q!==void 0?q:[],a=-1,o=[],c&&d.push(c),c=u}}while(n!==void 0);return o.length!==0&&(l=o[o.length-1][1]),l}function _d(t){var e=new Array(t.length);return{enter:function(n){for(var i=0;i<t.length;i++)if(e[i]==null){var s=kr(t[i],n.kind,!1);if(s){var a=s.apply(t[i],arguments);if(a===!1)e[i]=n;else if(a===rt)e[i]=rt;else if(a!==void 0)return a}}},leave:function(n){for(var i=0;i<t.length;i++)if(e[i]==null){var s=kr(t[i],n.kind,!0);if(s){var a=s.apply(t[i],arguments);if(a===rt)e[i]=rt;else if(a!==void 0&&a!==!1)return a}}else e[i]===n&&(e[i]=null)}}}function kr(t,e,r){var n=t[e];if(n){if(!r&&typeof n=="function")return n;var i=r?n.leave:n.enter;if(typeof i=="function")return i}else{var s=r?t.leave:t.enter;if(s){if(typeof s=="function")return s;var a=s[e];if(typeof a=="function")return a}}}});var Xu=y(It=>{"use strict";Object.defineProperty(It,"__esModule",{value:!0});It.dedentBlockStringValue=Dd;It.getBlockStringIndentation=Ku;It.printBlockString=qd;function Dd(t){var e=t.split(/\r\n|[\n\r]/g),r=Ku(t);if(r!==0)for(var n=1;n<e.length;n++)e[n]=e[n].slice(r);for(var i=0;i<e.length&&Wu(e[i]);)++i;for(var s=e.length;s>i&&Wu(e[s-1]);)--s;return e.slice(i,s).join(`
|
|
5
|
+
`)}function Wu(t){for(var e=0;e<t.length;++e)if(t[e]!==" "&&t[e]!==" ")return!1;return!0}function Ku(t){for(var e,r=!0,n=!0,i=0,s=null,a=0;a<t.length;++a)switch(t.charCodeAt(a)){case 13:t.charCodeAt(a+1)===10&&++a;case 10:r=!1,n=!0,i=0;break;case 9:case 32:++i;break;default:n&&!r&&(s===null||i<s)&&(s=i),n=!1}return(e=s)!==null&&e!==void 0?e:0}function qd(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,n=t.indexOf(`
|
|
6
|
+
`)===-1,i=t[0]===" "||t[0]===" ",s=t[t.length-1]==='"',a=t[t.length-1]==="\\",o=!n||s||a||r,u="";return o&&!(n&&i)&&(u+=`
|
|
7
|
+
`+e),u+=e?t.replace(/\n/g,`
|
|
8
|
+
`+e):t,o&&(u+=`
|
|
9
|
+
`),'"""'+u.replace(/"""/g,'\\"""')+'"""'}});var Qu=y(ui=>{"use strict";Object.defineProperty(ui,"__esModule",{value:!0});ui.print=Md;var Ud=zu(),jd=Xu();function Md(t){return(0,Ud.visit)(t,{leave:Bd})}var Ld=80,Bd={Name:function(e){return e.value},Variable:function(e){return"$"+e.name},Document:function(e){return S(e.definitions,`
|
|
10
10
|
|
|
11
11
|
`)+`
|
|
12
|
-
`},OperationDefinition:function(e){var r=e.operation,n=e.name,i=L("(",S(e.variableDefinitions,", "),")"),s=S(e.directives," "),a=e.selectionSet;return!n&&!s&&!i&&r==="query"?a:S([r,S([n,i]),s,a]," ")},VariableDefinition:function(e){var r=e.variable,n=e.type,i=e.defaultValue,s=e.directives;return r+": "+n+L(" = ",i)+L(" ",S(s," "))},SelectionSet:function(e){var r=e.selections;return le(r)},Field:function(e){var r=e.alias,n=e.name,i=e.arguments,s=e.directives,a=e.selectionSet,
|
|
13
|
-
`,
|
|
12
|
+
`},OperationDefinition:function(e){var r=e.operation,n=e.name,i=L("(",S(e.variableDefinitions,", "),")"),s=S(e.directives," "),a=e.selectionSet;return!n&&!s&&!i&&r==="query"?a:S([r,S([n,i]),s,a]," ")},VariableDefinition:function(e){var r=e.variable,n=e.type,i=e.defaultValue,s=e.directives;return r+": "+n+L(" = ",i)+L(" ",S(s," "))},SelectionSet:function(e){var r=e.selections;return le(r)},Field:function(e){var r=e.alias,n=e.name,i=e.arguments,s=e.directives,a=e.selectionSet,o=L("",r,": ")+n,u=o+L("(",S(i,", "),")");return u.length>Ld&&(u=o+L(`(
|
|
13
|
+
`,_r(S(i,`
|
|
14
14
|
`)),`
|
|
15
|
-
)`)),S([
|
|
16
|
-
`,
|
|
15
|
+
)`)),S([u,S(s," "),a]," ")},Argument:function(e){var r=e.name,n=e.value;return r+": "+n},FragmentSpread:function(e){var r=e.name,n=e.directives;return"..."+r+L(" ",S(n," "))},InlineFragment:function(e){var r=e.typeCondition,n=e.directives,i=e.selectionSet;return S(["...",L("on ",r),S(n," "),i]," ")},FragmentDefinition:function(e){var r=e.name,n=e.typeCondition,i=e.variableDefinitions,s=e.directives,a=e.selectionSet;return"fragment ".concat(r).concat(L("(",S(i,", "),")")," ")+"on ".concat(n," ").concat(L("",S(s," ")," "))+a},IntValue:function(e){var r=e.value;return r},FloatValue:function(e){var r=e.value;return r},StringValue:function(e,r){var n=e.value,i=e.block;return i?(0,jd.printBlockString)(n,r==="description"?"":" "):JSON.stringify(n)},BooleanValue:function(e){var r=e.value;return r?"true":"false"},NullValue:function(){return"null"},EnumValue:function(e){var r=e.value;return r},ListValue:function(e){var r=e.values;return"["+S(r,", ")+"]"},ObjectValue:function(e){var r=e.fields;return"{"+S(r,", ")+"}"},ObjectField:function(e){var r=e.name,n=e.value;return r+": "+n},Directive:function(e){var r=e.name,n=e.arguments;return"@"+r+L("(",S(n,", "),")")},NamedType:function(e){var r=e.name;return r},ListType:function(e){var r=e.type;return"["+r+"]"},NonNullType:function(e){var r=e.type;return r+"!"},SchemaDefinition:ce(function(t){var e=t.directives,r=t.operationTypes;return S(["schema",S(e," "),le(r)]," ")}),OperationTypeDefinition:function(e){var r=e.operation,n=e.type;return r+": "+n},ScalarTypeDefinition:ce(function(t){var e=t.name,r=t.directives;return S(["scalar",e,S(r," ")]," ")}),ObjectTypeDefinition:ce(function(t){var e=t.name,r=t.interfaces,n=t.directives,i=t.fields;return S(["type",e,L("implements ",S(r," & ")),S(n," "),le(i)]," ")}),FieldDefinition:ce(function(t){var e=t.name,r=t.arguments,n=t.type,i=t.directives;return e+(Yu(r)?L(`(
|
|
16
|
+
`,_r(S(r,`
|
|
17
17
|
`)),`
|
|
18
|
-
)`):L("(",S(r,", "),")"))+": "+n+L(" ",S(i," "))}),InputValueDefinition:ce(function(t){var e=t.name,r=t.type,n=t.defaultValue,i=t.directives;return S([e+": "+r,L("= ",n),S(i," ")]," ")}),InterfaceTypeDefinition:ce(function(t){var e=t.name,r=t.interfaces,n=t.directives,i=t.fields;return S(["interface",e,L("implements ",S(r," & ")),S(n," "),le(i)]," ")}),UnionTypeDefinition:ce(function(t){var e=t.name,r=t.directives,n=t.types;return S(["union",e,S(r," "),n&&n.length!==0?"= "+S(n," | "):""]," ")}),EnumTypeDefinition:ce(function(t){var e=t.name,r=t.directives,n=t.values;return S(["enum",e,S(r," "),le(n)]," ")}),EnumValueDefinition:ce(function(t){var e=t.name,r=t.directives;return S([e,S(r," ")]," ")}),InputObjectTypeDefinition:ce(function(t){var e=t.name,r=t.directives,n=t.fields;return S(["input",e,S(r," "),le(n)]," ")}),DirectiveDefinition:ce(function(t){var e=t.name,r=t.arguments,n=t.repeatable,i=t.locations;return"directive @"+e+(
|
|
19
|
-
`,
|
|
18
|
+
)`):L("(",S(r,", "),")"))+": "+n+L(" ",S(i," "))}),InputValueDefinition:ce(function(t){var e=t.name,r=t.type,n=t.defaultValue,i=t.directives;return S([e+": "+r,L("= ",n),S(i," ")]," ")}),InterfaceTypeDefinition:ce(function(t){var e=t.name,r=t.interfaces,n=t.directives,i=t.fields;return S(["interface",e,L("implements ",S(r," & ")),S(n," "),le(i)]," ")}),UnionTypeDefinition:ce(function(t){var e=t.name,r=t.directives,n=t.types;return S(["union",e,S(r," "),n&&n.length!==0?"= "+S(n," | "):""]," ")}),EnumTypeDefinition:ce(function(t){var e=t.name,r=t.directives,n=t.values;return S(["enum",e,S(r," "),le(n)]," ")}),EnumValueDefinition:ce(function(t){var e=t.name,r=t.directives;return S([e,S(r," ")]," ")}),InputObjectTypeDefinition:ce(function(t){var e=t.name,r=t.directives,n=t.fields;return S(["input",e,S(r," "),le(n)]," ")}),DirectiveDefinition:ce(function(t){var e=t.name,r=t.arguments,n=t.repeatable,i=t.locations;return"directive @"+e+(Yu(r)?L(`(
|
|
19
|
+
`,_r(S(r,`
|
|
20
20
|
`)),`
|
|
21
21
|
)`):L("(",S(r,", "),")"))+(n?" repeatable":"")+" on "+S(i," | ")}),SchemaExtension:function(e){var r=e.directives,n=e.operationTypes;return S(["extend schema",S(r," "),le(n)]," ")},ScalarTypeExtension:function(e){var r=e.name,n=e.directives;return S(["extend scalar",r,S(n," ")]," ")},ObjectTypeExtension:function(e){var r=e.name,n=e.interfaces,i=e.directives,s=e.fields;return S(["extend type",r,L("implements ",S(n," & ")),S(i," "),le(s)]," ")},InterfaceTypeExtension:function(e){var r=e.name,n=e.interfaces,i=e.directives,s=e.fields;return S(["extend interface",r,L("implements ",S(n," & ")),S(i," "),le(s)]," ")},UnionTypeExtension:function(e){var r=e.name,n=e.directives,i=e.types;return S(["extend union",r,S(n," "),i&&i.length!==0?"= "+S(i," | "):""]," ")},EnumTypeExtension:function(e){var r=e.name,n=e.directives,i=e.values;return S(["extend enum",r,S(n," "),le(i)]," ")},InputObjectTypeExtension:function(e){var r=e.name,n=e.directives,i=e.fields;return S(["extend input",r,S(n," "),le(i)]," ")}};function ce(t){return function(e){return S([e.description,t(e)],`
|
|
22
22
|
`)}}function S(t){var e,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return(e=t==null?void 0:t.filter(function(n){return n}).join(r))!==null&&e!==void 0?e:""}function le(t){return L(`{
|
|
23
|
-
`,
|
|
23
|
+
`,_r(S(t,`
|
|
24
24
|
`)),`
|
|
25
|
-
}`)}function L(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"";return e!=null&&e!==""?t+e+r:""}function
|
|
26
|
-
`))}function
|
|
27
|
-
`)!==-1}function $u(t){return t!=null&&t.some(Id)}});var y=function(){return y=Object.assign||function(e){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},y.apply(this,arguments)};function je(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]]);return r}function R(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function C(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],a;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(u){a={error:u}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return s}function D(t,e,r){if(r||arguments.length===2)for(var n=0,i=e.length,s;n<i;n++)(s||!(n in e))&&(s||(s=Array.prototype.slice.call(e,0,n)),s[n]=e[n]);return t.concat(s||Array.prototype.slice.call(e))}var I;(function(t){t.Start="xstate.start",t.Stop="xstate.stop",t.Raise="xstate.raise",t.Send="xstate.send",t.Cancel="xstate.cancel",t.NullEvent="",t.Assign="xstate.assign",t.After="xstate.after",t.DoneState="done.state",t.DoneInvoke="done.invoke",t.Log="xstate.log",t.Init="xstate.init",t.Invoke="xstate.invoke",t.ErrorExecution="error.execution",t.ErrorCommunication="error.communication",t.ErrorPlatform="error.platform",t.ErrorCustom="xstate.error",t.Update="xstate.update",t.Pure="xstate.pure",t.Choose="xstate.choose"})(I||(I={}));var Ee;(function(t){t.Parent="#_parent",t.Internal="#_internal"})(Ee||(Ee={}));var st=I.Start,Me=I.Stop,Le=I.Raise,xe=I.Send,_t=I.Cancel,oi=I.NullEvent,Dt=I.Assign,Ud=I.After,jd=I.DoneState,qt=I.Log,ui=I.Init,at=I.Invoke,Md=I.ErrorExecution,qr=I.ErrorPlatform,Ur=I.ErrorCustom,ot=I.Update,ci=I.Choose,li=I.Pure;var Ut=".",jr={},jt="xstate.guard",fi="";var j=!0;var Mt;function ct(t,e,r){r===void 0&&(r=Ut);var n=Be(t,r),i=Be(e,r);return N(i)?N(n)?i===n:!1:N(n)?n in i:Object.keys(n).every(function(s){return s in i?ct(n[s],i[s]):!1})}function Lt(t){try{return N(t)||typeof t=="number"?"".concat(t):t.type}catch{throw new Error("Events must be strings or objects with a string event.type property.")}}function Bt(t,e){try{return ve(t)?t:t.toString().split(e)}catch{throw new Error("'".concat(t,"' is not a valid state path."))}}function sc(t){return typeof t=="object"&&"value"in t&&"context"in t&&"event"in t&&"_event"in t}function Be(t,e){if(sc(t))return t.value;if(ve(t))return ut(t);if(typeof t!="string")return t;var r=Bt(t,e);return ut(r)}function ut(t){if(t.length===1)return t[0];for(var e={},r=e,n=0;n<t.length-1;n++)n===t.length-2?r[t[n]]=t[n+1]:(r[t[n]]={},r=r[t[n]]);return e}function Fe(t,e){for(var r={},n=Object.keys(t),i=0;i<n.length;i++){var s=n[i];r[s]=e(t[s],s,t,i)}return r}function Mr(t,e,r){var n,i,s={};try{for(var a=R(Object.keys(t)),u=a.next();!u.done;u=a.next()){var c=u.value,l=t[c];!r(l)||(s[c]=e(l,c,t))}}catch(o){n={error:o}}finally{try{u&&!u.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}return s}var di=function(t){return function(e){var r,n,i=e;try{for(var s=R(t),a=s.next();!a.done;a=s.next()){var u=a.value;i=i[u]}}catch(c){r={error:c}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return i}};function hi(t,e){return function(r){var n,i,s=r;try{for(var a=R(t),u=a.next();!u.done;u=a.next()){var c=u.value;s=s[e][c]}}catch(l){n={error:l}}finally{try{u&&!u.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}return s}}function lt(t){if(!t)return[[]];if(N(t))return[[t]];var e=U(Object.keys(t).map(function(r){var n=t[r];return typeof n!="string"&&(!n||!Object.keys(n).length)?[[r]]:lt(t[r]).map(function(i){return[r].concat(i)})}));return e}function U(t){var e;return(e=[]).concat.apply(e,D([],C(t),!1))}function pi(t){return ve(t)?t:[t]}function ee(t){return t===void 0?[]:pi(t)}function Te(t,e,r){var n,i;if(k(t))return t(e,r.data);var s={};try{for(var a=R(Object.keys(t)),u=a.next();!u.done;u=a.next()){var c=u.value,l=t[c];k(l)?s[c]=l(e,r.data):s[c]=l}}catch(o){n={error:o}}finally{try{u&&!u.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}return s}function vi(t){return/^(done|error)\./.test(t)}function Lr(t){return!!(t instanceof Promise||t!==null&&(k(t)||typeof t=="object")&&k(t.then))}function mi(t){return t!==null&&typeof t=="object"&&"transition"in t&&typeof t.transition=="function"}function Ft(t,e){var r,n,i=C([[],[]],2),s=i[0],a=i[1];try{for(var u=R(t),c=u.next();!c.done;c=u.next()){var l=c.value;e(l)?s.push(l):a.push(l)}}catch(o){r={error:o}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(r)throw r.error}}return[s,a]}function yi(t,e){return Fe(t.states,function(r,n){if(!!r){var i=(N(e)?void 0:e[n])||(r?r.current:void 0);if(!!i)return{current:i,states:yi(r,i)}}})}function gi(t,e){return{current:e,states:yi(t,e)}}function Br(t,e,r,n){j||B(!!t,"Attempting to update undefined context");var i=t&&r.reduce(function(s,a){var u,c,l=a.assignment,o={state:n,action:a,_event:e},f={};if(k(l))f=l(s,e.data,o);else try{for(var d=R(Object.keys(l)),h=d.next();!h.done;h=d.next()){var m=h.value,E=l[m];f[m]=k(E)?E(s,e.data,o):E}}catch(v){u={error:v}}finally{try{h&&!h.done&&(c=d.return)&&c.call(d)}finally{if(u)throw u.error}}return Object.assign({},s,f)},t);return i}var B=function(){};j||(B=function(t,e){var r=t instanceof Error?t:void 0;if(!(!r&&t)&&console!==void 0){var n=["Warning: ".concat(e)];r&&n.push(r),console.warn.apply(console,n)}});function ve(t){return Array.isArray(t)}function k(t){return typeof t=="function"}function N(t){return typeof t=="string"}function Vt(t,e){if(!!t)return N(t)?{type:jt,name:t,predicate:e?e[t]:void 0}:k(t)?{type:jt,name:t.name,predicate:t}:t}function Ei(t){try{return"subscribe"in t&&k(t.subscribe)}catch{return!1}}var fe=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}(),Jd=(Mt={},Mt[fe]=function(){return this},Mt[Symbol.observable]=function(){return this},Mt);function de(t){return!!t&&"__xstatenode"in t}function Si(t){return!!t&&typeof t.send=="function"}function ft(t,e){return N(t)||typeof t=="number"?y({type:t},e):t}function F(t,e){if(!N(t)&&"$$type"in t&&t.$$type==="scxml")return t;var r=ft(t);return y({name:r.type,data:r,$$type:"scxml",type:"external"},e)}function Ae(t,e){var r=pi(e).map(function(n){return typeof n=="undefined"||typeof n=="string"||de(n)?{target:n,event:t}:y(y({},n),{event:t})});return r}function wi(t){if(!(t===void 0||t===fi))return ee(t)}function xi(t,e,r){if(!j){var n=t.stack?" Stacktrace was '".concat(t.stack,"'"):"";if(t===e)console.error("Missing onError handler for invocation '".concat(r,"', error was '").concat(t,"'.").concat(n));else{var i=e.stack?" Stacktrace was '".concat(e.stack,"'"):"";console.error("Missing onError handler and/or unhandled exception/promise rejection for invocation '".concat(r,"'. ")+"Original error: '".concat(t,"'. ").concat(n," Current error is '").concat(e,"'.").concat(i))}}}function Ht(t,e,r,n,i){var s=t.options.guards,a={state:i,cond:e,_event:n};if(e.type===jt)return((s==null?void 0:s[e.name])||e.predicate)(r,n.data,a);var u=s==null?void 0:s[e.type];if(!u)throw new Error("Guard '".concat(e.type,"' is not implemented on machine '").concat(t.id,"'."));return u(r,n.data,a)}function Gt(t){return typeof t=="string"?{type:t}:t}function dt(t,e,r){if(typeof t=="object")return t;var n=function(){};return{next:t,error:e||n,complete:r||n}}function ht(t,e){return"".concat(t,":invocation[").concat(e,"]")}var be=F({type:ui});function Jt(t,e){return e&&e[t]||void 0}function Ve(t,e){var r;if(N(t)||typeof t=="number"){var n=Jt(t,e);k(n)?r={type:t,exec:n}:n?r=n:r={type:t,exec:void 0}}else if(k(t))r={type:t.name||t.toString(),exec:t};else{var n=Jt(t.type,e);if(k(n))r=y(y({},t),{exec:n});else if(n){var i=n.type||t.type;r=y(y(y({},n),t),{type:i})}else r=t}return r}var pt=function(t,e){if(!t)return[];var r=ve(t)?t:[t];return r.map(function(n){return Ve(n,e)})};function $t(t){var e=Ve(t);return y(y({id:N(t)?t:e.id},e),{type:e.type})}function Ti(t){return N(t)?{type:Le,event:t}:vt(t,{to:Ee.Internal})}function ac(t){return{type:Le,_event:F(t.event)}}function vt(t,e){return{to:e?e.to:void 0,type:xe,event:k(t)?t:ft(t),delay:e?e.delay:void 0,id:e&&e.id!==void 0?e.id:k(t)?t.name:Lt(t)}}function oc(t,e,r,n){var i={_event:r},s=F(k(t.event)?t.event(e,r.data,i):t.event),a;if(N(t.delay)){var u=n&&n[t.delay];a=k(u)?u(e,r.data,i):u}else a=k(t.delay)?t.delay(e,r.data,i):t.delay;var c=k(t.to)?t.to(e,r.data,i):t.to;return y(y({},t),{to:c,_event:s,event:s.data,delay:a})}var uc=function(t,e,r){return y(y({},t),{value:N(t.expr)?t.expr:t.expr(e,r.data,{_event:r})})},Ai=function(t){return{type:_t,sendId:t}};function bi(t){var e=$t(t);return{type:I.Start,activity:e,exec:void 0}}function Ri(t){var e=k(t)?t:$t(t);return{type:I.Stop,activity:e,exec:void 0}}function cc(t,e,r){var n=k(t.activity)?t.activity(e,r.data):t.activity,i=typeof n=="string"?{id:n}:n,s={type:I.Stop,activity:i};return s}var Oi=function(t){return{type:Dt,assignment:t}};function Ci(t,e){var r=e?"#".concat(e):"";return"".concat(I.After,"(").concat(t,")").concat(r)}function mt(t,e){var r="".concat(I.DoneState,".").concat(t),n={type:r,data:e};return n.toString=function(){return r},n}function Re(t,e){var r="".concat(I.DoneInvoke,".").concat(t),n={type:r,data:e};return n.toString=function(){return r},n}function Oe(t,e){var r="".concat(I.ErrorPlatform,".").concat(t),n={type:r,data:e};return n.toString=function(){return r},n}function zt(t,e,r,n,i,s){s===void 0&&(s=!1);var a=C(s?[[],i]:Ft(i,function(d){return d.type===Dt}),2),u=a[0],c=a[1],l=u.length?Br(r,n,u,e):r,o=s?[r]:void 0,f=U(c.map(function(d){var h;switch(d.type){case Le:return ac(d);case xe:var m=oc(d,l,n,t.options.delays);return j||B(!N(d.delay)||typeof m.delay=="number","No delay reference for delay expression '".concat(d.delay,"' was found on machine '").concat(t.id,"'")),m;case qt:return uc(d,l,n);case ci:{var E=d,v=(h=E.conds.find(function(q){var V=Vt(q.cond,t.options.guards);return!V||Ht(t,V,l,n,e)}))===null||h===void 0?void 0:h.actions;if(!v)return[];var x=C(zt(t,e,l,n,pt(ee(v),t.options.actions),s),2),g=x[0],T=x[1];return l=T,o==null||o.push(l),g}case li:{var v=d.get(l,n.data);if(!v)return[];var O=C(zt(t,e,l,n,pt(ee(v),t.options.actions),s),2),P=O[0],M=O[1];return l=M,o==null||o.push(l),P}case Me:return cc(d,l,n);case Dt:{l=Br(l,n,[d],e),o==null||o.push(l);break}default:var A=Ve(d,t.options.actions),w=A.exec;if(w&&o){var b=o.length-1;A=y(y({},A),{exec:function(q){for(var V=[],Q=1;Q<arguments.length;Q++)V[Q-1]=arguments[Q];w.apply(void 0,D([o[b]],C(V),!1))}})}return A}}).filter(function(d){return!!d}));return[f,l]}var Ni=[],Ce=function(t,e){Ni.push(t);var r=e(t);return Ni.pop(),r};function Pi(t){var e;return e={id:t,send:function(){},subscribe:function(){return{unsubscribe:function(){}}},getSnapshot:function(){},toJSON:function(){return{id:t}}},e[fe]=function(){return this},e}function Ii(t,e,r,n){var i,s=Gt(t.src),a=(i=e==null?void 0:e.options.services)===null||i===void 0?void 0:i[s.type],u=t.data?Te(t.data,r,n):void 0,c=a?ki(a,t.id,u):Pi(t.id);return c.meta=t,c}function ki(t,e,r){var n=Pi(e);if(n.deferred=!0,de(t)){var i=n.state=Ce(void 0,function(){return(r?t.withContext(r):t).initialState});n.getSnapshot=function(){return i}}return n}function lc(t){try{return typeof t.send=="function"}catch{return!1}}function _i(t){return lc(t)&&"id"in t}function Di(t){var e;return y((e={subscribe:function(){return{unsubscribe:function(){}}},id:"anonymous",getSnapshot:function(){}},e[fe]=function(){return this},e),t)}var yt=function(t){return t.type==="atomic"||t.type==="final"};function Ne(t){return Object.keys(t.states).map(function(e){return t.states[e]}).filter(function(e){return e.type!=="history"})}function Vr(t){var e=[t];return yt(t)?e:e.concat(U(Ne(t).map(Vr)))}function Pe(t,e){var r,n,i,s,a,u,c,l,o=new Set(t),f=Fr(o),d=new Set(e);try{for(var h=R(d),m=h.next();!m.done;m=h.next())for(var E=m.value,v=E.parent;v&&!d.has(v);)d.add(v),v=v.parent}catch(b){r={error:b}}finally{try{m&&!m.done&&(n=h.return)&&n.call(h)}finally{if(r)throw r.error}}var x=Fr(d);try{for(var g=R(d),T=g.next();!T.done;T=g.next()){var E=T.value;if(E.type==="compound"&&(!x.get(E)||!x.get(E).length))f.get(E)?f.get(E).forEach(function(q){return d.add(q)}):E.initialStateNodes.forEach(function(q){return d.add(q)});else if(E.type==="parallel")try{for(var O=(a=void 0,R(Ne(E))),P=O.next();!P.done;P=O.next()){var M=P.value;d.has(M)||(d.add(M),f.get(M)?f.get(M).forEach(function(q){return d.add(q)}):M.initialStateNodes.forEach(function(q){return d.add(q)}))}}catch(q){a={error:q}}finally{try{P&&!P.done&&(u=O.return)&&u.call(O)}finally{if(a)throw a.error}}}}catch(b){i={error:b}}finally{try{T&&!T.done&&(s=g.return)&&s.call(g)}finally{if(i)throw i.error}}try{for(var A=R(d),w=A.next();!w.done;w=A.next())for(var E=w.value,v=E.parent;v&&!d.has(v);)d.add(v),v=v.parent}catch(b){c={error:b}}finally{try{w&&!w.done&&(l=A.return)&&l.call(A)}finally{if(c)throw c.error}}return d}function qi(t,e){var r=e.get(t);if(!r)return{};if(t.type==="compound"){var n=r[0];if(n){if(yt(n))return n.key}else return{}}var i={};return r.forEach(function(s){i[s.key]=qi(s,e)}),i}function Fr(t){var e,r,n=new Map;try{for(var i=R(t),s=i.next();!s.done;s=i.next()){var a=s.value;n.has(a)||n.set(a,[]),a.parent&&(n.has(a.parent)||n.set(a.parent,[]),n.get(a.parent).push(a))}}catch(u){e={error:u}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}return n}function Ui(t,e){var r=Pe([t],e);return qi(t,Fr(r))}function gt(t,e){return Array.isArray(t)?t.some(function(r){return r===e}):t instanceof Set?t.has(e):!1}function ji(t){return D([],C(new Set(U(D([],C(t.map(function(e){return e.ownEvents})),!1)))),!1)}function Ie(t,e){return e.type==="compound"?Ne(e).some(function(r){return r.type==="final"&>(t,r)}):e.type==="parallel"?Ne(e).every(function(r){return Ie(t,r)}):!1}function Mi(t){return t===void 0&&(t=[]),t.reduce(function(e,r){return r.meta!==void 0&&(e[r.id]=r.meta),e},{})}function Hr(t){return new Set(U(t.map(function(e){return e.tags})))}function Gr(t,e){if(t===e)return!0;if(t===void 0||e===void 0)return!1;if(N(t)||N(e))return t===e;var r=Object.keys(t),n=Object.keys(e);return r.length===n.length&&r.every(function(i){return Gr(t[i],e[i])})}function Li(t){return typeof t!="object"||t===null?!1:"value"in t&&"_event"in t}function Bi(t,e){var r=t.exec,n=y(y({},t),{exec:r!==void 0?function(){return r(e.context,e.event,{action:t,state:e,_event:e._event})}:void 0});return n}var se=function(){function t(e){var r=this,n;this.actions=[],this.activities=jr,this.meta={},this.events=[],this.value=e.value,this.context=e.context,this._event=e._event,this._sessionid=e._sessionid,this.event=this._event.data,this.historyValue=e.historyValue,this.history=e.history,this.actions=e.actions||[],this.activities=e.activities||jr,this.meta=Mi(e.configuration),this.events=e.events||[],this.matches=this.matches.bind(this),this.toStrings=this.toStrings.bind(this),this.configuration=e.configuration,this.transitions=e.transitions,this.children=e.children,this.done=!!e.done,this.tags=(n=Array.isArray(e.tags)?new Set(e.tags):e.tags)!==null&&n!==void 0?n:new Set,this.machine=e.machine,Object.defineProperty(this,"nextEvents",{get:function(){return ji(r.configuration)}})}return t.from=function(e,r){if(e instanceof t)return e.context!==r?new t({value:e.value,context:r,_event:e._event,_sessionid:null,historyValue:e.historyValue,history:e.history,actions:[],activities:e.activities,meta:{},events:[],configuration:[],transitions:[],children:{}}):e;var n=be;return new t({value:e,context:r,_event:n,_sessionid:null,historyValue:void 0,history:void 0,actions:[],activities:void 0,meta:void 0,events:[],configuration:[],transitions:[],children:{}})},t.create=function(e){return new t(e)},t.inert=function(e,r){if(e instanceof t){if(!e.actions.length)return e;var n=be;return new t({value:e.value,context:r,_event:n,_sessionid:null,historyValue:e.historyValue,history:e.history,activities:e.activities,configuration:e.configuration,transitions:[],children:{}})}return t.from(e,r)},t.prototype.toStrings=function(e,r){var n=this;if(e===void 0&&(e=this.value),r===void 0&&(r="."),N(e))return[e];var i=Object.keys(e);return i.concat.apply(i,D([],C(i.map(function(s){return n.toStrings(e[s],r).map(function(a){return s+r+a})})),!1))},t.prototype.toJSON=function(){var e=this;e.configuration,e.transitions;var r=e.tags;e.machine;var n=je(e,["configuration","transitions","tags","machine"]);return y(y({},n),{tags:Array.from(r)})},t.prototype.matches=function(e){return ct(e,this.value)},t.prototype.hasTag=function(e){return this.tags.has(e)},t.prototype.can=function(e){var r;j&&B(!!this.machine,"state.can(...) used outside of a machine-created State object; this will always return false.");var n=(r=this.machine)===null||r===void 0?void 0:r.getTransitionData(this,e);return!!(n!=null&&n.transitions.length)&&n.transitions.some(function(i){return i.target!==void 0||i.actions.length})},t}();var fc={deferEvents:!1},Jr=function(){function t(e){this.processingEvent=!1,this.queue=[],this.initialized=!1,this.options=y(y({},fc),e)}return t.prototype.initialize=function(e){if(this.initialized=!0,e){if(!this.options.deferEvents){this.schedule(e);return}this.process(e)}this.flushEvents()},t.prototype.schedule=function(e){if(!this.initialized||this.processingEvent){this.queue.push(e);return}if(this.queue.length!==0)throw new Error("Event queue should be empty when it is not processing events");this.process(e),this.flushEvents()},t.prototype.clear=function(){this.queue=[]},t.prototype.flushEvents=function(){for(var e=this.queue.shift();e;)this.process(e),e=this.queue.shift()},t.prototype.process=function(e){this.processingEvent=!0;try{e()}catch(r){throw this.clear(),r}finally{this.processingEvent=!1}},t}();var zr=new Map,dc=0,Et={bookId:function(){return"x:".concat(dc++)},register:function(t,e){return zr.set(t,e),t},get:function(t){return zr.get(t)},free:function(t){zr.delete(t)}};function Wt(){if(typeof globalThis!="undefined")return globalThis;if(typeof self!="undefined")return self;if(typeof window!="undefined")return window;if(typeof global!="undefined")return global;j||console.warn("XState could not find a global object in this environment. Please let the maintainers know and raise an issue here: https://github.com/statelyai/xstate/issues")}function hc(){var t=Wt();if(t&&"__xstate__"in t)return t.__xstate__}function Fi(t){if(!!Wt()){var e=hc();e&&e.register(t)}}function Vi(t,e){e===void 0&&(e={});var r=t.initialState,n=new Set,i=[],s=!1,a=function(){if(!s){for(s=!0;i.length>0;){var l=i.shift();r=t.transition(r,l,c),n.forEach(function(o){return o.next(r)})}s=!1}},u=Di({id:e.id,send:function(l){i.push(l),a()},getSnapshot:function(){return r},subscribe:function(l,o,f){var d=dt(l,o,f);return n.add(d),d.next(r),{unsubscribe:function(){n.delete(d)}}}}),c={parent:e.parent,self:u,id:e.id||"anonymous",observers:n};return r=t.start?t.start(c):r,u}var pc={sync:!1,autoForward:!1},H;(function(t){t[t.NotStarted=0]="NotStarted",t[t.Running=1]="Running",t[t.Stopped=2]="Stopped"})(H||(H={}));var Hi=function(){function t(e,r){var n=this;r===void 0&&(r=t.defaultOptions),this.machine=e,this.delayedEventsMap={},this.listeners=new Set,this.contextListeners=new Set,this.stopListeners=new Set,this.doneListeners=new Set,this.eventListeners=new Set,this.sendListeners=new Set,this.initialized=!1,this.status=H.NotStarted,this.children=new Map,this.forwardTo=new Set,this.init=this.start,this.send=function(o,f){if(ve(o))return n.batch(o),n.state;var d=F(ft(o,f));if(n.status===H.Stopped)return j||B(!1,'Event "'.concat(d.name,'" was sent to stopped service "').concat(n.machine.id,`". This service has already reached its final state, and will not transition.
|
|
25
|
+
}`)}function L(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"";return e!=null&&e!==""?t+e+r:""}function _r(t){return L(" ",t.replace(/\n/g,`
|
|
26
|
+
`))}function Fd(t){return t.indexOf(`
|
|
27
|
+
`)!==-1}function Yu(t){return t!=null&&t.some(Fd)}});function Ur(t){this.message=t}Ur.prototype=new Error,Ur.prototype.name="InvalidCharacterError";var li=typeof window!="undefined"&&window.atob&&window.atob.bind(window)||function(t){var e=String(t).replace(/=+$/,"");if(e.length%4==1)throw new Ur("'atob' failed: The string to be decoded is not correctly encoded.");for(var r,n,i=0,s=0,a="";n=e.charAt(s++);~n&&(r=i%4?64*r+n:n,i++%4)?a+=String.fromCharCode(255&r>>(-2*i&6)):0)n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(n);return a};function cc(t){var e=t.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw"Illegal base64url string!"}try{return function(r){return decodeURIComponent(li(r).replace(/(.)/g,function(n,i){var s=i.charCodeAt(0).toString(16).toUpperCase();return s.length<2&&(s="0"+s),"%"+s}))}(e)}catch{return li(e)}}function _t(t){this.message=t}function lc(t,e){if(typeof t!="string")throw new _t("Invalid token specified");var r=(e=e||{}).header===!0?0:1;try{return JSON.parse(cc(t.split(".")[r]))}catch(n){throw new _t("Invalid token specified: "+n.message)}}_t.prototype=new Error,_t.prototype.name="InvalidTokenError";var fi=lc;var E=function(){return E=Object.assign||function(e){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},E.apply(this,arguments)};function je(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]]);return r}function R(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function C(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],a;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(o){a={error:o}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return s}function D(t,e,r){if(r||arguments.length===2)for(var n=0,i=e.length,s;n<i;n++)(s||!(n in e))&&(s||(s=Array.prototype.slice.call(e,0,n)),s[n]=e[n]);return t.concat(s||Array.prototype.slice.call(e))}var I;(function(t){t.Start="xstate.start",t.Stop="xstate.stop",t.Raise="xstate.raise",t.Send="xstate.send",t.Cancel="xstate.cancel",t.NullEvent="",t.Assign="xstate.assign",t.After="xstate.after",t.DoneState="done.state",t.DoneInvoke="done.invoke",t.Log="xstate.log",t.Init="xstate.init",t.Invoke="xstate.invoke",t.ErrorExecution="error.execution",t.ErrorCommunication="error.communication",t.ErrorPlatform="error.platform",t.ErrorCustom="xstate.error",t.Update="xstate.update",t.Pure="xstate.pure",t.Choose="xstate.choose"})(I||(I={}));var Ee;(function(t){t.Parent="#_parent",t.Internal="#_internal"})(Ee||(Ee={}));var it=I.Start,Me=I.Stop,Le=I.Raise,xe=I.Send,Dt=I.Cancel,di=I.NullEvent,qt=I.Assign,zd=I.After,Wd=I.DoneState,Ut=I.Log,hi=I.Init,st=I.Invoke,Kd=I.ErrorExecution,jr=I.ErrorPlatform,Mr=I.ErrorCustom,at=I.Update,pi=I.Choose,vi=I.Pure;var jt=".",Lr={},Mt="xstate.guard",mi="";var j=!0;var Lt;function ut(t,e,r){r===void 0&&(r=jt);var n=Be(t,r),i=Be(e,r);return P(i)?P(n)?i===n:!1:P(n)?n in i:Object.keys(n).every(function(s){return s in i?ut(n[s],i[s]):!1})}function Bt(t){try{return P(t)||typeof t=="number"?"".concat(t):t.type}catch{throw new Error("Events must be strings or objects with a string event.type property.")}}function Ft(t,e){try{return ve(t)?t:t.toString().split(e)}catch{throw new Error("'".concat(t,"' is not a valid state path."))}}function fc(t){return typeof t=="object"&&"value"in t&&"context"in t&&"event"in t&&"_event"in t}function Be(t,e){if(fc(t))return t.value;if(ve(t))return ot(t);if(typeof t!="string")return t;var r=Ft(t,e);return ot(r)}function ot(t){if(t.length===1)return t[0];for(var e={},r=e,n=0;n<t.length-1;n++)n===t.length-2?r[t[n]]=t[n+1]:(r[t[n]]={},r=r[t[n]]);return e}function Fe(t,e){for(var r={},n=Object.keys(t),i=0;i<n.length;i++){var s=n[i];r[s]=e(t[s],s,t,i)}return r}function Br(t,e,r){var n,i,s={};try{for(var a=R(Object.keys(t)),o=a.next();!o.done;o=a.next()){var u=o.value,f=t[u];!r(f)||(s[u]=e(f,u,t))}}catch(c){n={error:c}}finally{try{o&&!o.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}return s}var yi=function(t){return function(e){var r,n,i=e;try{for(var s=R(t),a=s.next();!a.done;a=s.next()){var o=a.value;i=i[o]}}catch(u){r={error:u}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return i}};function gi(t,e){return function(r){var n,i,s=r;try{for(var a=R(t),o=a.next();!o.done;o=a.next()){var u=o.value;s=s[e][u]}}catch(f){n={error:f}}finally{try{o&&!o.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}return s}}function ct(t){if(!t)return[[]];if(P(t))return[[t]];var e=U(Object.keys(t).map(function(r){var n=t[r];return typeof n!="string"&&(!n||!Object.keys(n).length)?[[r]]:ct(t[r]).map(function(i){return[r].concat(i)})}));return e}function U(t){var e;return(e=[]).concat.apply(e,D([],C(t),!1))}function Ei(t){return ve(t)?t:[t]}function ee(t){return t===void 0?[]:Ei(t)}function Te(t,e,r){var n,i;if(k(t))return t(e,r.data);var s={};try{for(var a=R(Object.keys(t)),o=a.next();!o.done;o=a.next()){var u=o.value,f=t[u];k(f)?s[u]=f(e,r.data):s[u]=f}}catch(c){n={error:c}}finally{try{o&&!o.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}return s}function Si(t){return/^(done|error)\./.test(t)}function Fr(t){return!!(t instanceof Promise||t!==null&&(k(t)||typeof t=="object")&&k(t.then))}function wi(t){return t!==null&&typeof t=="object"&&"transition"in t&&typeof t.transition=="function"}function Vt(t,e){var r,n,i=C([[],[]],2),s=i[0],a=i[1];try{for(var o=R(t),u=o.next();!u.done;u=o.next()){var f=u.value;e(f)?s.push(f):a.push(f)}}catch(c){r={error:c}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return[s,a]}function xi(t,e){return Fe(t.states,function(r,n){if(!!r){var i=(P(e)?void 0:e[n])||(r?r.current:void 0);if(!!i)return{current:i,states:xi(r,i)}}})}function Ti(t,e){return{current:e,states:xi(t,e)}}function Vr(t,e,r,n){j||B(!!t,"Attempting to update undefined context");var i=t&&r.reduce(function(s,a){var o,u,f=a.assignment,c={state:n,action:a,_event:e},h={};if(k(f))h=f(s,e.data,c);else try{for(var d=R(Object.keys(f)),l=d.next();!l.done;l=d.next()){var p=l.value,v=f[p];h[p]=k(v)?v(s,e.data,c):v}}catch(m){o={error:m}}finally{try{l&&!l.done&&(u=d.return)&&u.call(d)}finally{if(o)throw o.error}}return Object.assign({},s,h)},t);return i}var B=function(){};j||(B=function(t,e){var r=t instanceof Error?t:void 0;if(!(!r&&t)&&console!==void 0){var n=["Warning: ".concat(e)];r&&n.push(r),console.warn.apply(console,n)}});function ve(t){return Array.isArray(t)}function k(t){return typeof t=="function"}function P(t){return typeof t=="string"}function Ht(t,e){if(!!t)return P(t)?{type:Mt,name:t,predicate:e?e[t]:void 0}:k(t)?{type:Mt,name:t.name,predicate:t}:t}function Ai(t){try{return"subscribe"in t&&k(t.subscribe)}catch{return!1}}var fe=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}(),rh=(Lt={},Lt[fe]=function(){return this},Lt[Symbol.observable]=function(){return this},Lt);function de(t){return!!t&&"__xstatenode"in t}function bi(t){return!!t&&typeof t.send=="function"}function lt(t,e){return P(t)||typeof t=="number"?E({type:t},e):t}function F(t,e){if(!P(t)&&"$$type"in t&&t.$$type==="scxml")return t;var r=lt(t);return E({name:r.type,data:r,$$type:"scxml",type:"external"},e)}function Ae(t,e){var r=Ei(e).map(function(n){return typeof n=="undefined"||typeof n=="string"||de(n)?{target:n,event:t}:E(E({},n),{event:t})});return r}function Ri(t){if(!(t===void 0||t===mi))return ee(t)}function Oi(t,e,r){if(!j){var n=t.stack?" Stacktrace was '".concat(t.stack,"'"):"";if(t===e)console.error("Missing onError handler for invocation '".concat(r,"', error was '").concat(t,"'.").concat(n));else{var i=e.stack?" Stacktrace was '".concat(e.stack,"'"):"";console.error("Missing onError handler and/or unhandled exception/promise rejection for invocation '".concat(r,"'. ")+"Original error: '".concat(t,"'. ").concat(n," Current error is '").concat(e,"'.").concat(i))}}}function Gt(t,e,r,n,i){var s=t.options.guards,a={state:i,cond:e,_event:n};if(e.type===Mt)return((s==null?void 0:s[e.name])||e.predicate)(r,n.data,a);var o=s==null?void 0:s[e.type];if(!o)throw new Error("Guard '".concat(e.type,"' is not implemented on machine '").concat(t.id,"'."));return o(r,n.data,a)}function Jt(t){return typeof t=="string"?{type:t}:t}function ft(t,e,r){if(typeof t=="object")return t;var n=function(){};return{next:t,error:e||n,complete:r||n}}function dt(t,e){return"".concat(t,":invocation[").concat(e,"]")}var be=F({type:hi});function $t(t,e){return e&&e[t]||void 0}function Ve(t,e){var r;if(P(t)||typeof t=="number"){var n=$t(t,e);k(n)?r={type:t,exec:n}:n?r=n:r={type:t,exec:void 0}}else if(k(t))r={type:t.name||t.toString(),exec:t};else{var n=$t(t.type,e);if(k(n))r=E(E({},t),{exec:n});else if(n){var i=n.type||t.type;r=E(E(E({},n),t),{type:i})}else r=t}return r}var ht=function(t,e){if(!t)return[];var r=ve(t)?t:[t];return r.map(function(n){return Ve(n,e)})};function Wt(t){var e=Ve(t);return E(E({id:P(t)?t:e.id},e),{type:e.type})}function Ci(t){return P(t)?{type:Le,event:t}:pt(t,{to:Ee.Internal})}function dc(t){return{type:Le,_event:F(t.event)}}function pt(t,e){return{to:e?e.to:void 0,type:xe,event:k(t)?t:lt(t),delay:e?e.delay:void 0,id:e&&e.id!==void 0?e.id:k(t)?t.name:Bt(t)}}function hc(t,e,r,n){var i={_event:r},s=F(k(t.event)?t.event(e,r.data,i):t.event),a;if(P(t.delay)){var o=n&&n[t.delay];a=k(o)?o(e,r.data,i):o}else a=k(t.delay)?t.delay(e,r.data,i):t.delay;var u=k(t.to)?t.to(e,r.data,i):t.to;return E(E({},t),{to:u,_event:s,event:s.data,delay:a})}var pc=function(t,e,r){return E(E({},t),{value:P(t.expr)?t.expr:t.expr(e,r.data,{_event:r})})},Pi=function(t){return{type:Dt,sendId:t}};function Ni(t){var e=Wt(t);return{type:I.Start,activity:e,exec:void 0}}function Ii(t){var e=k(t)?t:Wt(t);return{type:I.Stop,activity:e,exec:void 0}}function vc(t,e,r){var n=k(t.activity)?t.activity(e,r.data):t.activity,i=typeof n=="string"?{id:n}:n,s={type:I.Stop,activity:i};return s}var ki=function(t){return{type:qt,assignment:t}};function _i(t,e){var r=e?"#".concat(e):"";return"".concat(I.After,"(").concat(t,")").concat(r)}function vt(t,e){var r="".concat(I.DoneState,".").concat(t),n={type:r,data:e};return n.toString=function(){return r},n}function Re(t,e){var r="".concat(I.DoneInvoke,".").concat(t),n={type:r,data:e};return n.toString=function(){return r},n}function Oe(t,e){var r="".concat(I.ErrorPlatform,".").concat(t),n={type:r,data:e};return n.toString=function(){return r},n}function zt(t,e,r,n,i,s){s===void 0&&(s=!1);var a=C(s?[[],i]:Vt(i,function(d){return d.type===qt}),2),o=a[0],u=a[1],f=o.length?Vr(r,n,o,e):r,c=s?[r]:void 0,h=U(u.map(function(d){var l;switch(d.type){case Le:return dc(d);case xe:var p=hc(d,f,n,t.options.delays);return j||B(!P(d.delay)||typeof p.delay=="number","No delay reference for delay expression '".concat(d.delay,"' was found on machine '").concat(t.id,"'")),p;case Ut:return pc(d,f,n);case pi:{var v=d,m=(l=v.conds.find(function(q){var V=Ht(q.cond,t.options.guards);return!V||Gt(t,V,f,n,e)}))===null||l===void 0?void 0:l.actions;if(!m)return[];var w=C(zt(t,e,f,n,ht(ee(m),t.options.actions),s),2),g=w[0],T=w[1];return f=T,c==null||c.push(f),g}case vi:{var m=d.get(f,n.data);if(!m)return[];var O=C(zt(t,e,f,n,ht(ee(m),t.options.actions),s),2),N=O[0],M=O[1];return f=M,c==null||c.push(f),N}case Me:return vc(d,f,n);case qt:{f=Vr(f,n,[d],e),c==null||c.push(f);break}default:var A=Ve(d,t.options.actions),x=A.exec;if(x&&c){var b=c.length-1;A=E(E({},A),{exec:function(q){for(var V=[],Q=1;Q<arguments.length;Q++)V[Q-1]=arguments[Q];x.apply(void 0,D([c[b]],C(V),!1))}})}return A}}).filter(function(d){return!!d}));return[h,f]}var Di=[],Ce=function(t,e){Di.push(t);var r=e(t);return Di.pop(),r};function qi(t){var e;return e={id:t,send:function(){},subscribe:function(){return{unsubscribe:function(){}}},getSnapshot:function(){},toJSON:function(){return{id:t}}},e[fe]=function(){return this},e}function Ui(t,e,r,n){var i,s=Jt(t.src),a=(i=e==null?void 0:e.options.services)===null||i===void 0?void 0:i[s.type],o=t.data?Te(t.data,r,n):void 0,u=a?ji(a,t.id,o):qi(t.id);return u.meta=t,u}function ji(t,e,r){var n=qi(e);if(n.deferred=!0,de(t)){var i=n.state=Ce(void 0,function(){return(r?t.withContext(r):t).initialState});n.getSnapshot=function(){return i}}return n}function mc(t){try{return typeof t.send=="function"}catch{return!1}}function Mi(t){return mc(t)&&"id"in t}function Li(t){var e;return E((e={subscribe:function(){return{unsubscribe:function(){}}},id:"anonymous",getSnapshot:function(){}},e[fe]=function(){return this},e),t)}var mt=function(t){return t.type==="atomic"||t.type==="final"};function Pe(t){return Object.keys(t.states).map(function(e){return t.states[e]}).filter(function(e){return e.type!=="history"})}function Gr(t){var e=[t];return mt(t)?e:e.concat(U(Pe(t).map(Gr)))}function Ne(t,e){var r,n,i,s,a,o,u,f,c=new Set(t),h=Hr(c),d=new Set(e);try{for(var l=R(d),p=l.next();!p.done;p=l.next())for(var v=p.value,m=v.parent;m&&!d.has(m);)d.add(m),m=m.parent}catch(b){r={error:b}}finally{try{p&&!p.done&&(n=l.return)&&n.call(l)}finally{if(r)throw r.error}}var w=Hr(d);try{for(var g=R(d),T=g.next();!T.done;T=g.next()){var v=T.value;if(v.type==="compound"&&(!w.get(v)||!w.get(v).length))h.get(v)?h.get(v).forEach(function(q){return d.add(q)}):v.initialStateNodes.forEach(function(q){return d.add(q)});else if(v.type==="parallel")try{for(var O=(a=void 0,R(Pe(v))),N=O.next();!N.done;N=O.next()){var M=N.value;d.has(M)||(d.add(M),h.get(M)?h.get(M).forEach(function(q){return d.add(q)}):M.initialStateNodes.forEach(function(q){return d.add(q)}))}}catch(q){a={error:q}}finally{try{N&&!N.done&&(o=O.return)&&o.call(O)}finally{if(a)throw a.error}}}}catch(b){i={error:b}}finally{try{T&&!T.done&&(s=g.return)&&s.call(g)}finally{if(i)throw i.error}}try{for(var A=R(d),x=A.next();!x.done;x=A.next())for(var v=x.value,m=v.parent;m&&!d.has(m);)d.add(m),m=m.parent}catch(b){u={error:b}}finally{try{x&&!x.done&&(f=A.return)&&f.call(A)}finally{if(u)throw u.error}}return d}function Bi(t,e){var r=e.get(t);if(!r)return{};if(t.type==="compound"){var n=r[0];if(n){if(mt(n))return n.key}else return{}}var i={};return r.forEach(function(s){i[s.key]=Bi(s,e)}),i}function Hr(t){var e,r,n=new Map;try{for(var i=R(t),s=i.next();!s.done;s=i.next()){var a=s.value;n.has(a)||n.set(a,[]),a.parent&&(n.has(a.parent)||n.set(a.parent,[]),n.get(a.parent).push(a))}}catch(o){e={error:o}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}return n}function Fi(t,e){var r=Ne([t],e);return Bi(t,Hr(r))}function yt(t,e){return Array.isArray(t)?t.some(function(r){return r===e}):t instanceof Set?t.has(e):!1}function Vi(t){return D([],C(new Set(U(D([],C(t.map(function(e){return e.ownEvents})),!1)))),!1)}function Ie(t,e){return e.type==="compound"?Pe(e).some(function(r){return r.type==="final"&&yt(t,r)}):e.type==="parallel"?Pe(e).every(function(r){return Ie(t,r)}):!1}function Hi(t){return t===void 0&&(t=[]),t.reduce(function(e,r){return r.meta!==void 0&&(e[r.id]=r.meta),e},{})}function Jr(t){return new Set(U(t.map(function(e){return e.tags})))}function $r(t,e){if(t===e)return!0;if(t===void 0||e===void 0)return!1;if(P(t)||P(e))return t===e;var r=Object.keys(t),n=Object.keys(e);return r.length===n.length&&r.every(function(i){return $r(t[i],e[i])})}function Gi(t){return typeof t!="object"||t===null?!1:"value"in t&&"_event"in t}function Ji(t,e){var r=t.exec,n=E(E({},t),{exec:r!==void 0?function(){return r(e.context,e.event,{action:t,state:e,_event:e._event})}:void 0});return n}var se=function(){function t(e){var r=this,n;this.actions=[],this.activities=Lr,this.meta={},this.events=[],this.value=e.value,this.context=e.context,this._event=e._event,this._sessionid=e._sessionid,this.event=this._event.data,this.historyValue=e.historyValue,this.history=e.history,this.actions=e.actions||[],this.activities=e.activities||Lr,this.meta=Hi(e.configuration),this.events=e.events||[],this.matches=this.matches.bind(this),this.toStrings=this.toStrings.bind(this),this.configuration=e.configuration,this.transitions=e.transitions,this.children=e.children,this.done=!!e.done,this.tags=(n=Array.isArray(e.tags)?new Set(e.tags):e.tags)!==null&&n!==void 0?n:new Set,this.machine=e.machine,Object.defineProperty(this,"nextEvents",{get:function(){return Vi(r.configuration)}})}return t.from=function(e,r){if(e instanceof t)return e.context!==r?new t({value:e.value,context:r,_event:e._event,_sessionid:null,historyValue:e.historyValue,history:e.history,actions:[],activities:e.activities,meta:{},events:[],configuration:[],transitions:[],children:{}}):e;var n=be;return new t({value:e,context:r,_event:n,_sessionid:null,historyValue:void 0,history:void 0,actions:[],activities:void 0,meta:void 0,events:[],configuration:[],transitions:[],children:{}})},t.create=function(e){return new t(e)},t.inert=function(e,r){if(e instanceof t){if(!e.actions.length)return e;var n=be;return new t({value:e.value,context:r,_event:n,_sessionid:null,historyValue:e.historyValue,history:e.history,activities:e.activities,configuration:e.configuration,transitions:[],children:{}})}return t.from(e,r)},t.prototype.toStrings=function(e,r){var n=this;if(e===void 0&&(e=this.value),r===void 0&&(r="."),P(e))return[e];var i=Object.keys(e);return i.concat.apply(i,D([],C(i.map(function(s){return n.toStrings(e[s],r).map(function(a){return s+r+a})})),!1))},t.prototype.toJSON=function(){var e=this;e.configuration,e.transitions;var r=e.tags;e.machine;var n=je(e,["configuration","transitions","tags","machine"]);return E(E({},n),{tags:Array.from(r)})},t.prototype.matches=function(e){return ut(e,this.value)},t.prototype.hasTag=function(e){return this.tags.has(e)},t.prototype.can=function(e){var r;j&&B(!!this.machine,"state.can(...) used outside of a machine-created State object; this will always return false.");var n=(r=this.machine)===null||r===void 0?void 0:r.getTransitionData(this,e);return!!(n!=null&&n.transitions.length)&&n.transitions.some(function(i){return i.target!==void 0||i.actions.length})},t}();var yc={deferEvents:!1},zr=function(){function t(e){this.processingEvent=!1,this.queue=[],this.initialized=!1,this.options=E(E({},yc),e)}return t.prototype.initialize=function(e){if(this.initialized=!0,e){if(!this.options.deferEvents){this.schedule(e);return}this.process(e)}this.flushEvents()},t.prototype.schedule=function(e){if(!this.initialized||this.processingEvent){this.queue.push(e);return}if(this.queue.length!==0)throw new Error("Event queue should be empty when it is not processing events");this.process(e),this.flushEvents()},t.prototype.clear=function(){this.queue=[]},t.prototype.flushEvents=function(){for(var e=this.queue.shift();e;)this.process(e),e=this.queue.shift()},t.prototype.process=function(e){this.processingEvent=!0;try{e()}catch(r){throw this.clear(),r}finally{this.processingEvent=!1}},t}();var Wr=new Map,gc=0,gt={bookId:function(){return"x:".concat(gc++)},register:function(t,e){return Wr.set(t,e),t},get:function(t){return Wr.get(t)},free:function(t){Wr.delete(t)}};function Kt(){if(typeof globalThis!="undefined")return globalThis;if(typeof self!="undefined")return self;if(typeof window!="undefined")return window;if(typeof global!="undefined")return global;j||console.warn("XState could not find a global object in this environment. Please let the maintainers know and raise an issue here: https://github.com/statelyai/xstate/issues")}function Ec(){var t=Kt();if(t&&"__xstate__"in t)return t.__xstate__}function $i(t){if(!!Kt()){var e=Ec();e&&e.register(t)}}function zi(t,e){e===void 0&&(e={});var r=t.initialState,n=new Set,i=[],s=!1,a=function(){if(!s){for(s=!0;i.length>0;){var f=i.shift();r=t.transition(r,f,u),n.forEach(function(c){return c.next(r)})}s=!1}},o=Li({id:e.id,send:function(f){i.push(f),a()},getSnapshot:function(){return r},subscribe:function(f,c,h){var d=ft(f,c,h);return n.add(d),d.next(r),{unsubscribe:function(){n.delete(d)}}}}),u={parent:e.parent,self:o,id:e.id||"anonymous",observers:n};return r=t.start?t.start(u):r,o}var Sc={sync:!1,autoForward:!1},H;(function(t){t[t.NotStarted=0]="NotStarted",t[t.Running=1]="Running",t[t.Stopped=2]="Stopped"})(H||(H={}));var Wi=function(){function t(e,r){var n=this;r===void 0&&(r=t.defaultOptions),this.machine=e,this.delayedEventsMap={},this.listeners=new Set,this.contextListeners=new Set,this.stopListeners=new Set,this.doneListeners=new Set,this.eventListeners=new Set,this.sendListeners=new Set,this.initialized=!1,this.status=H.NotStarted,this.children=new Map,this.forwardTo=new Set,this.init=this.start,this.send=function(c,h){if(ve(c))return n.batch(c),n.state;var d=F(lt(c,h));if(n.status===H.Stopped)return j||B(!1,'Event "'.concat(d.name,'" was sent to stopped service "').concat(n.machine.id,`". This service has already reached its final state, and will not transition.
|
|
28
28
|
Event: `).concat(JSON.stringify(d.data))),n.state;if(n.status!==H.Running&&!n.options.deferEvents)throw new Error('Event "'.concat(d.name,'" was sent to uninitialized service "').concat(n.machine.id,`". Make sure .start() is called for this service, or set { deferEvents: true } in the service options.
|
|
29
|
-
Event: `).concat(JSON.stringify(d.data)));return n.scheduler.schedule(function(){n.forward(d);var
|
|
30
|
-
Event: `).concat(JSON.stringify(event)));else if(this.status!==H.Running)throw new Error("".concat(e.length,' event(s) were sent to uninitialized service "').concat(this.machine.id,'". Make sure .start() is called for this service, or set { deferEvents: true } in the service options.'));this.scheduler.schedule(function(){var n,i,s=r.state,a=!1,u=[],c=function(d){var h=F(d);r.forward(h),s=Ce(r,function(){return r.machine.transition(s,h)}),u.push.apply(u,D([],C(s.actions.map(function(m){return Bi(m,s)})),!1)),a=a||!!s.changed};try{for(var l=R(e),o=l.next();!o.done;o=l.next()){var f=o.value;c(f)}}catch(d){n={error:d}}finally{try{o&&!o.done&&(i=l.return)&&i.call(l)}finally{if(n)throw n.error}}s.changed=a,s.actions=u,r.update(s,F(e[e.length-1]))})},t.prototype.sender=function(e){return this.send.bind(this,e)},t.prototype.nextState=function(e){var r=this,n=F(e);if(n.name.indexOf(qr)===0&&!this.state.nextEvents.some(function(s){return s.indexOf(qr)===0}))throw n.data.data;var i=Ce(this,function(){return r.machine.transition(r.state,n)});return i},t.prototype.forward=function(e){var r,n;try{for(var i=R(this.forwardTo),s=i.next();!s.done;s=i.next()){var a=s.value,u=this.children.get(a);if(!u)throw new Error("Unable to forward event '".concat(e,"' from interpreter '").concat(this.id,"' to nonexistant child '").concat(a,"'."));u.send(e)}}catch(c){r={error:c}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}},t.prototype.defer=function(e){var r=this;this.delayedEventsMap[e.id]=this.clock.setTimeout(function(){e.to?r.sendTo(e._event,e.to):r.send(e._event)},e.delay)},t.prototype.cancel=function(e){this.clock.clearTimeout(this.delayedEventsMap[e]),delete this.delayedEventsMap[e]},t.prototype.exec=function(e,r,n){n===void 0&&(n=this.machine.options.actions);var i=r.context,s=r._event,a=e.exec||Jt(e.type,n),u=k(a)?a:a?a.exec:e.exec;if(u)try{return u(i,s.data,{action:e,state:this.state,_event:s})}catch(O){throw this.parent&&this.parent.send({type:"xstate.error",data:O}),O}switch(e.type){case xe:var c=e;if(typeof c.delay=="number"){this.defer(c);return}else c.to?this.sendTo(c._event,c.to):this.send(c._event);break;case _t:this.cancel(e.sendId);break;case st:{if(this.status!==H.Running)return;var l=e.activity;if(!this.state.activities[l.id||l.type])break;if(l.type===I.Invoke){var o=Gt(l.src),f=this.machine.options.services?this.machine.options.services[o.type]:void 0,d=l.id,h=l.data;j||B(!("forward"in l),"`forward` property is deprecated (found in invocation of '".concat(l.src,"' in in machine '").concat(this.machine.id,"'). ")+"Please use `autoForward` instead.");var m="autoForward"in l?l.autoForward:!!l.forward;if(!f){j||B(!1,"No service found for invocation '".concat(l.src,"' in machine '").concat(this.machine.id,"'."));return}var E=h?Te(h,i,s):void 0;if(typeof f=="string")return;var v=k(f)?f(i,s.data,{data:E,src:o,meta:l.meta}):f;if(!v)return;var x=void 0;de(v)&&(v=E?v.withContext(E):v,x={autoForward:m}),this.spawn(v,d,x)}else this.spawnActivity(l);break}case Me:{this.stopChild(e.activity.id);break}case qt:var g=e.label,T=e.value;g?this.logger(g,T):this.logger(T);break;default:j||B(!1,"No implementation found for action type '".concat(e.type,"'"));break}},t.prototype.removeChild=function(e){var r;this.children.delete(e),this.forwardTo.delete(e),(r=this.state)===null||r===void 0||delete r.children[e]},t.prototype.stopChild=function(e){var r=this.children.get(e);!r||(this.removeChild(e),k(r.stop)&&r.stop())},t.prototype.spawn=function(e,r,n){if(Lr(e))return this.spawnPromise(Promise.resolve(e),r);if(k(e))return this.spawnCallback(e,r);if(_i(e))return this.spawnActor(e,r);if(Ei(e))return this.spawnObservable(e,r);if(de(e))return this.spawnMachine(e,y(y({},n),{id:r}));if(mi(e))return this.spawnBehavior(e,r);throw new Error('Unable to spawn entity "'.concat(r,'" of type "').concat(typeof e,'".'))},t.prototype.spawnMachine=function(e,r){var n=this;r===void 0&&(r={});var i=new t(e,y(y({},this.options),{parent:this,id:r.id||e.id})),s=y(y({},pc),r);s.sync&&i.onTransition(function(u){n.send(ot,{state:u,id:i.id})});var a=i;return this.children.set(i.id,a),s.autoForward&&this.forwardTo.add(i.id),i.onDone(function(u){n.removeChild(i.id),n.send(F(u,{origin:i.id}))}).start(),a},t.prototype.spawnBehavior=function(e,r){var n=Vi(e,{id:r,parent:this});return this.children.set(r,n),n},t.prototype.spawnPromise=function(e,r){var n,i=this,s=!1,a;e.then(function(c){s||(a=c,i.removeChild(r),i.send(F(Re(r,c),{origin:r})))},function(c){if(!s){i.removeChild(r);var l=Oe(r,c);try{i.send(F(l,{origin:r}))}catch(o){xi(c,o,r),i.devTools&&i.devTools.send(l,i.state),i.machine.strict&&i.stop()}}});var u=(n={id:r,send:function(){},subscribe:function(c,l,o){var f=dt(c,l,o),d=!1;return e.then(function(h){d||(f.next(h),!d&&f.complete())},function(h){d||f.error(h)}),{unsubscribe:function(){return d=!0}}},stop:function(){s=!0},toJSON:function(){return{id:r}},getSnapshot:function(){return a}},n[fe]=function(){return this},n);return this.children.set(r,u),u},t.prototype.spawnCallback=function(e,r){var n,i=this,s=!1,a=new Set,u=new Set,c,l=function(d){c=d,u.forEach(function(h){return h(d)}),!s&&i.send(F(d,{origin:r}))},o;try{o=e(l,function(d){a.add(d)})}catch(d){this.send(Oe(r,d))}if(Lr(o))return this.spawnPromise(o,r);var f=(n={id:r,send:function(d){return a.forEach(function(h){return h(d)})},subscribe:function(d){var h=dt(d);return u.add(h.next),{unsubscribe:function(){u.delete(h.next)}}},stop:function(){s=!0,k(o)&&o()},toJSON:function(){return{id:r}},getSnapshot:function(){return c}},n[fe]=function(){return this},n);return this.children.set(r,f),f},t.prototype.spawnObservable=function(e,r){var n,i=this,s,a=e.subscribe(function(c){s=c,i.send(F(c,{origin:r}))},function(c){i.removeChild(r),i.send(F(Oe(r,c),{origin:r}))},function(){i.removeChild(r),i.send(F(Re(r),{origin:r}))}),u=(n={id:r,send:function(){},subscribe:function(c,l,o){return e.subscribe(c,l,o)},stop:function(){return a.unsubscribe()},getSnapshot:function(){return s},toJSON:function(){return{id:r}}},n[fe]=function(){return this},n);return this.children.set(r,u),u},t.prototype.spawnActor=function(e,r){return this.children.set(r,e),e},t.prototype.spawnActivity=function(e){var r=this.machine.options&&this.machine.options.activities?this.machine.options.activities[e.type]:void 0;if(!r){j||B(!1,"No implementation found for activity '".concat(e.type,"'"));return}var n=r(this.state.context,e);this.spawnEffect(e.id,n)},t.prototype.spawnEffect=function(e,r){var n;this.children.set(e,(n={id:e,send:function(){},subscribe:function(){return{unsubscribe:function(){}}},stop:r||void 0,getSnapshot:function(){},toJSON:function(){return{id:e}}},n[fe]=function(){return this},n))},t.prototype.attachDev=function(){var e=Wt();if(this.options.devTools&&e){if(e.__REDUX_DEVTOOLS_EXTENSION__){var r=typeof this.options.devTools=="object"?this.options.devTools:void 0;this.devTools=e.__REDUX_DEVTOOLS_EXTENSION__.connect(y(y({name:this.id,autoPause:!0,stateSanitizer:function(n){return{value:n.value,context:n.context,actions:n.actions}}},r),{features:y({jump:!1,skip:!1},r?r.features:void 0)}),this.machine),this.devTools.init(this.state)}Fi(this)}},t.prototype.toJSON=function(){return{id:this.id}},t.prototype[fe]=function(){return this},t.prototype.getSnapshot=function(){return this.status===H.NotStarted?this.initialState:this._state},t.defaultOptions={execute:!0,deferEvents:!0,clock:{setTimeout:function(e,r){return setTimeout(e,r)},clearTimeout:function(e){return clearTimeout(e)}},logger:console.log.bind(console),devTools:!1},t.interpret=me,t}();function me(t,e){var r=new Hi(t,e);return r}function vc(t){if(typeof t=="string"){var e={type:t};return e.toString=function(){return t},e}return t}function St(t){return y(y({type:at},t),{toJSON:function(){t.onDone,t.onError;var e=je(t,["onDone","onError"]);return y(y({},e),{type:at,src:vc(t.src)})}})}var Je="",$r="#",wt="*",He={},Ge=function(t){return t[0]===$r},mc=function(){return{actions:{},guards:{},services:{},activities:{},delays:{}}},yc=function(t,e,r){var n=r.slice(0,-1).some(function(s){return!("cond"in s)&&!("in"in s)&&(N(s.target)||de(s.target))}),i=e===Je?"the transient event":"event '".concat(e,"'");B(!n,"One or more transitions for ".concat(i," on state '").concat(t.id,"' are unreachable. ")+"Make sure that the default transition is the last one defined.")},Gi=function(){function t(e,r,n,i){var s=this;n===void 0&&(n="context"in e?e.context:void 0);var a;this.config=e,this._context=n,this.order=-1,this.__xstatenode=!0,this.__cache={events:void 0,relativeValue:new Map,initialStateValue:void 0,initialState:void 0,on:void 0,transitions:void 0,candidates:{},delayedTransitions:void 0},this.idMap={},this.tags=[],this.options=Object.assign(mc(),r),this.parent=i==null?void 0:i.parent,this.key=this.config.key||(i==null?void 0:i.key)||this.config.id||"(machine)",this.machine=this.parent?this.parent.machine:this,this.path=this.parent?this.parent.path.concat(this.key):[],this.delimiter=this.config.delimiter||(this.parent?this.parent.delimiter:Ut),this.id=this.config.id||D([this.machine.key],C(this.path),!1).join(this.delimiter),this.version=this.parent?this.parent.version:this.config.version,this.type=this.config.type||(this.config.parallel?"parallel":this.config.states&&Object.keys(this.config.states).length?"compound":this.config.history?"history":"atomic"),this.schema=this.parent?this.machine.schema:(a=this.config.schema)!==null&&a!==void 0?a:{},this.description=this.config.description,j||B(!("parallel"in this.config),'The "parallel" property is deprecated and will be removed in version 4.1. '.concat(this.config.parallel?"Replace with `type: 'parallel'`":"Use `type: '".concat(this.type,"'`")," in the config for state node '").concat(this.id,"' instead.")),this.initial=this.config.initial,this.states=this.config.states?Fe(this.config.states,function(l,o){var f,d=new t(l,{},void 0,{parent:s,key:o});return Object.assign(s.idMap,y((f={},f[d.id]=d,f),d.idMap)),d}):He;var u=0;function c(l){var o,f;l.order=u++;try{for(var d=R(Ne(l)),h=d.next();!h.done;h=d.next()){var m=h.value;c(m)}}catch(E){o={error:E}}finally{try{h&&!h.done&&(f=d.return)&&f.call(d)}finally{if(o)throw o.error}}}c(this),this.history=this.config.history===!0?"shallow":this.config.history||!1,this._transient=!!this.config.always||(this.config.on?Array.isArray(this.config.on)?this.config.on.some(function(l){var o=l.event;return o===Je}):Je in this.config.on:!1),this.strict=!!this.config.strict,this.onEntry=ee(this.config.entry||this.config.onEntry).map(function(l){return Ve(l)}),this.onExit=ee(this.config.exit||this.config.onExit).map(function(l){return Ve(l)}),this.meta=this.config.meta,this.doneData=this.type==="final"?this.config.data:void 0,this.invoke=ee(this.config.invoke).map(function(l,o){var f,d;if(de(l)){var h=ht(s.id,o);return s.machine.options.services=y((f={},f[h]=l,f),s.machine.options.services),St({src:h,id:h})}else if(N(l.src)){var h=l.id||ht(s.id,o);return St(y(y({},l),{id:h,src:l.src}))}else if(de(l.src)||k(l.src)){var h=l.id||ht(s.id,o);return s.machine.options.services=y((d={},d[h]=l.src,d),s.machine.options.services),St(y(y({id:h},l),{src:h}))}else{var m=l.src;return St(y(y({id:ht(s.id,o)},l),{src:m}))}}),this.activities=ee(this.config.activities).concat(this.invoke).map(function(l){return $t(l)}),this.transition=this.transition.bind(this),this.tags=ee(this.config.tags)}return t.prototype._init=function(){this.__cache.transitions||Vr(this).forEach(function(e){return e.on})},t.prototype.withConfig=function(e,r){var n=this.options,i=n.actions,s=n.activities,a=n.guards,u=n.services,c=n.delays;return new t(this.config,{actions:y(y({},i),e.actions),activities:y(y({},s),e.activities),guards:y(y({},a),e.guards),services:y(y({},u),e.services),delays:y(y({},c),e.delays)},r!=null?r:this.context)},t.prototype.withContext=function(e){return new t(this.config,this.options,e)},Object.defineProperty(t.prototype,"context",{get:function(){return k(this._context)?this._context():this._context},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"definition",{get:function(){return{id:this.id,key:this.key,version:this.version,context:this.context,type:this.type,initial:this.initial,history:this.history,states:Fe(this.states,function(e){return e.definition}),on:this.on,transitions:this.transitions,entry:this.onEntry,exit:this.onExit,activities:this.activities||[],meta:this.meta,order:this.order||-1,data:this.doneData,invoke:this.invoke,description:this.description,tags:this.tags}},enumerable:!1,configurable:!0}),t.prototype.toJSON=function(){return this.definition},Object.defineProperty(t.prototype,"on",{get:function(){if(this.__cache.on)return this.__cache.on;var e=this.transitions;return this.__cache.on=e.reduce(function(r,n){return r[n.eventType]=r[n.eventType]||[],r[n.eventType].push(n),r},{})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"after",{get:function(){return this.__cache.delayedTransitions||(this.__cache.delayedTransitions=this.getDelayedTransitions(),this.__cache.delayedTransitions)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"transitions",{get:function(){return this.__cache.transitions||(this.__cache.transitions=this.formatTransitions(),this.__cache.transitions)},enumerable:!1,configurable:!0}),t.prototype.getCandidates=function(e){if(this.__cache.candidates[e])return this.__cache.candidates[e];var r=e===Je,n=this.transitions.filter(function(i){var s=i.eventType===e;return r?s:s||i.eventType===wt});return this.__cache.candidates[e]=n,n},t.prototype.getDelayedTransitions=function(){var e=this,r=this.config.after;if(!r)return[];var n=function(s,a){var u=k(s)?"".concat(e.id,":delay[").concat(a,"]"):s,c=Ci(u,e.id);return e.onEntry.push(vt(c,{delay:s})),e.onExit.push(Ai(c)),c},i=ve(r)?r.map(function(s,a){var u=n(s.delay,a);return y(y({},s),{event:u})}):U(Object.keys(r).map(function(s,a){var u=r[s],c=N(u)?{target:u}:u,l=isNaN(+s)?s:+s,o=n(l,a);return ee(c).map(function(f){return y(y({},f),{event:o,delay:l})})}));return i.map(function(s){var a=s.delay;return y(y({},e.formatTransition(s)),{delay:a})})},t.prototype.getStateNodes=function(e){var r,n=this;if(!e)return[];var i=e instanceof se?e.value:Be(e,this.delimiter);if(N(i)){var s=this.getStateNode(i).initial;return s!==void 0?this.getStateNodes((r={},r[i]=s,r)):[this,this.states[i]]}var a=Object.keys(i),u=[this];return u.push.apply(u,D([],C(U(a.map(function(c){return n.getStateNode(c).getStateNodes(i[c])}))),!1)),u},t.prototype.handles=function(e){var r=Lt(e);return this.events.includes(r)},t.prototype.resolveState=function(e){var r=e instanceof se?e:se.create(e),n=Array.from(Pe([],this.getStateNodes(r.value)));return new se(y(y({},r),{value:this.resolve(r.value),configuration:n,done:Ie(n,this),tags:Hr(n),machine:this.machine}))},t.prototype.transitionLeafNode=function(e,r,n){var i=this.getStateNode(e),s=i.next(r,n);return!s||!s.transitions.length?this.next(r,n):s},t.prototype.transitionCompoundNode=function(e,r,n){var i=Object.keys(e),s=this.getStateNode(i[0]),a=s._transition(e[i[0]],r,n);return!a||!a.transitions.length?this.next(r,n):a},t.prototype.transitionParallelNode=function(e,r,n){var i,s,a={};try{for(var u=R(Object.keys(e)),c=u.next();!c.done;c=u.next()){var l=c.value,o=e[l];if(!!o){var f=this.getStateNode(l),d=f._transition(o,r,n);d&&(a[l]=d)}}}catch(g){i={error:g}}finally{try{c&&!c.done&&(s=u.return)&&s.call(u)}finally{if(i)throw i.error}}var h=Object.keys(a).map(function(g){return a[g]}),m=U(h.map(function(g){return g.transitions})),E=h.some(function(g){return g.transitions.length>0});if(!E)return this.next(r,n);var v=U(h.map(function(g){return g.entrySet})),x=U(Object.keys(a).map(function(g){return a[g].configuration}));return{transitions:m,entrySet:v,exitSet:U(h.map(function(g){return g.exitSet})),configuration:x,source:r,actions:U(Object.keys(a).map(function(g){return a[g].actions}))}},t.prototype._transition=function(e,r,n){return N(e)?this.transitionLeafNode(e,r,n):Object.keys(e).length===1?this.transitionCompoundNode(e,r,n):this.transitionParallelNode(e,r,n)},t.prototype.getTransitionData=function(e,r){return this._transition(e.value,e,F(r))},t.prototype.next=function(e,r){var n,i,s=this,a=r.name,u=[],c=[],l;try{for(var o=R(this.getCandidates(a)),f=o.next();!f.done;f=o.next()){var d=f.value,h=d.cond,m=d.in,E=e.context,v=m?N(m)&&Ge(m)?e.matches(Be(this.getStateNodeById(m).path,this.delimiter)):ct(Be(m,this.delimiter),di(this.path.slice(0,-2))(e.value)):!0,x=!1;try{x=!h||Ht(this.machine,h,E,r,e)}catch(P){throw new Error("Unable to evaluate guard '".concat(h.name||h.type,"' in transition for event '").concat(a,"' in state node '").concat(this.id,`':
|
|
31
|
-
`).concat(P.message))}if(x&&v){d.target!==void 0&&(c=d.target),u.push.apply(u,D([],C(d.actions),!1)),l=d;break}}}catch(P){n={error:P}}finally{try{f&&!f.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}if(!!l){if(!c.length)return{transitions:[l],entrySet:[],exitSet:[],configuration:e.value?[this]:[],source:e,actions:u};var g=U(c.map(function(P){return s.getRelativeStateNodes(P,e.historyValue)})),T=!!l.internal,O=T?[]:U(g.map(function(P){return s.nodesFromChild(P)}));return{transitions:[l],entrySet:O,exitSet:T?[]:[this],configuration:g,source:e,actions:u}}},t.prototype.nodesFromChild=function(e){if(e.escapes(this))return[];for(var r=[],n=e;n&&n!==this;)r.push(n),n=n.parent;return r.push(this),r},t.prototype.escapes=function(e){if(this===e)return!1;for(var r=this.parent;r;){if(r===e)return!1;r=r.parent}return!0},t.prototype.getActions=function(e,r,n,i){var s,a,u,c,l=Pe([],i?this.getStateNodes(i.value):[this]),o=e.configuration.length?Pe(l,e.configuration):l;try{for(var f=R(o),d=f.next();!d.done;d=f.next()){var h=d.value;gt(l,h)||e.entrySet.push(h)}}catch(A){s={error:A}}finally{try{d&&!d.done&&(a=f.return)&&a.call(f)}finally{if(s)throw s.error}}try{for(var m=R(l),E=m.next();!E.done;E=m.next()){var h=E.value;(!gt(o,h)||gt(e.exitSet,h.parent))&&e.exitSet.push(h)}}catch(A){u={error:A}}finally{try{E&&!E.done&&(c=m.return)&&c.call(m)}finally{if(u)throw u.error}}var v=U(e.entrySet.map(function(A){var w=[];if(A.type!=="final")return w;var b=A.parent;if(!b.parent)return w;w.push(mt(A.id,A.doneData),mt(b.id,A.doneData?Te(A.doneData,r,n):void 0));var q=b.parent;return q.type==="parallel"&&Ne(q).every(function(V){return Ie(e.configuration,V)})&&w.push(mt(q.id)),w}));e.exitSet.sort(function(A,w){return w.order-A.order}),e.entrySet.sort(function(A,w){return A.order-w.order});var x=new Set(e.entrySet),g=new Set(e.exitSet),T=C([U(Array.from(x).map(function(A){return D(D([],C(A.activities.map(function(w){return bi(w)})),!1),C(A.onEntry),!1)})).concat(v.map(Ti)),U(Array.from(g).map(function(A){return D(D([],C(A.onExit),!1),C(A.activities.map(function(w){return Ri(w)})),!1)}))],2),O=T[0],P=T[1],M=pt(P.concat(e.actions).concat(O),this.machine.options.actions);return M},t.prototype.transition=function(e,r,n){e===void 0&&(e=this.initialState);var i=F(r),s;if(e instanceof se)s=n===void 0?e:this.resolveState(se.from(e,n));else{var a=N(e)?this.resolve(ut(this.getResolvedPath(e))):this.resolve(e),u=n!=null?n:this.machine.context;s=this.resolveState(se.from(a,u))}if(!j&&i.name===wt)throw new Error("An event cannot have the wildcard type ('".concat(wt,"')"));if(this.strict&&!this.events.includes(i.name)&&!vi(i.name))throw new Error("Machine '".concat(this.id,"' does not accept event '").concat(i.name,"'"));var c=this._transition(s.value,s,i)||{transitions:[],configuration:[],entrySet:[],exitSet:[],source:s,actions:[]},l=Pe([],this.getStateNodes(s.value)),o=c.configuration.length?Pe(l,c.configuration):l;return c.configuration=D([],C(o),!1),this.resolveTransition(c,s,s.context,i)},t.prototype.resolveRaisedTransition=function(e,r,n){var i,s=e.actions;return e=this.transition(e,r),e._event=n,e.event=n.data,(i=e.actions).unshift.apply(i,D([],C(s),!1)),e},t.prototype.resolveTransition=function(e,r,n,i){var s,a,u=this;i===void 0&&(i=be);var c=e.configuration,l=!r||e.transitions.length>0,o=l?Ui(this.machine,c):void 0,f=r?r.historyValue?r.historyValue:e.source?this.machine.historyValue(r.value):void 0:void 0,d=this.getActions(e,n,i,r),h=r?y({},r.activities):{};try{for(var m=R(d),E=m.next();!E.done;E=m.next()){var v=E.value;v.type===st?h[v.activity.id||v.activity.type]=v:v.type===Me&&(h[v.activity.id||v.activity.type]=!1)}}catch(Z){s={error:Z}}finally{try{E&&!E.done&&(a=m.return)&&a.call(m)}finally{if(s)throw s.error}}var x=C(zt(this,r,n,i,d,this.machine.config.preserveActionOrder),2),g=x[0],T=x[1],O=C(Ft(g,function(Z){return Z.type===Le||Z.type===xe&&Z.to===Ee.Internal}),2),P=O[0],M=O[1],A=g.filter(function(Z){var Ue;return Z.type===st&&((Ue=Z.activity)===null||Ue===void 0?void 0:Ue.type)===at}),w=A.reduce(function(Z,Ue){return Z[Ue.activity.id]=Ii(Ue.activity,u.machine,T,i),Z},r?y({},r.children):{}),b=l?e.configuration:r?r.configuration:[],q=Ie(b,this),V=new se({value:o||r.value,context:T,_event:i,_sessionid:r?r._sessionid:null,historyValue:o?f?gi(f,o):void 0:r?r.historyValue:void 0,history:!o||e.source?r:void 0,actions:o?M:[],activities:o?h:r?r.activities:{},events:[],configuration:b,transitions:e.transitions,children:w,done:q,tags:Hr(b),machine:this}),Q=n!==T;V.changed=i.name===ot||Q;var ge=V.history;ge&&delete ge.history;var kt=!q&&(this._transient||c.some(function(Z){return Z._transient}));if(!l&&(!kt||i.name===Je))return V;var ie=V;if(!q)for(kt&&(ie=this.resolveRaisedTransition(ie,{type:oi},i));P.length;){var Yu=P.shift();ie=this.resolveRaisedTransition(ie,Yu._event,i)}var Qu=ie.changed||(ge?!!ie.actions.length||Q||typeof ge.value!=typeof ie.value||!Gr(ie.value,ge.value):void 0);return ie.changed=Qu,ie.history=ge,ie},t.prototype.getStateNode=function(e){if(Ge(e))return this.machine.getStateNodeById(e);if(!this.states)throw new Error("Unable to retrieve child state '".concat(e,"' from '").concat(this.id,"'; no child states exist."));var r=this.states[e];if(!r)throw new Error("Child state '".concat(e,"' does not exist on '").concat(this.id,"'"));return r},t.prototype.getStateNodeById=function(e){var r=Ge(e)?e.slice($r.length):e;if(r===this.id)return this;var n=this.machine.idMap[r];if(!n)throw new Error("Child state node '#".concat(r,"' does not exist on machine '").concat(this.id,"'"));return n},t.prototype.getStateNodeByPath=function(e){if(typeof e=="string"&&Ge(e))try{return this.getStateNodeById(e.slice(1))}catch{}for(var r=Bt(e,this.delimiter).slice(),n=this;r.length;){var i=r.shift();if(!i.length)break;n=n.getStateNode(i)}return n},t.prototype.resolve=function(e){var r,n=this;if(!e)return this.initialStateValue||He;switch(this.type){case"parallel":return Fe(this.initialStateValue,function(s,a){return s?n.getStateNode(a).resolve(e[a]||s):He});case"compound":if(N(e)){var i=this.getStateNode(e);return i.type==="parallel"||i.type==="compound"?(r={},r[e]=i.initialStateValue,r):e}return Object.keys(e).length?Fe(e,function(s,a){return s?n.getStateNode(a).resolve(s):He}):this.initialStateValue||{};default:return e||He}},t.prototype.getResolvedPath=function(e){if(Ge(e)){var r=this.machine.idMap[e.slice($r.length)];if(!r)throw new Error("Unable to find state node '".concat(e,"'"));return r.path}return Bt(e,this.delimiter)},Object.defineProperty(t.prototype,"initialStateValue",{get:function(){var e;if(this.__cache.initialStateValue)return this.__cache.initialStateValue;var r;if(this.type==="parallel")r=Mr(this.states,function(n){return n.initialStateValue||He},function(n){return n.type!=="history"});else if(this.initial!==void 0){if(!this.states[this.initial])throw new Error("Initial state '".concat(this.initial,"' not found on '").concat(this.key,"'"));r=yt(this.states[this.initial])?this.initial:(e={},e[this.initial]=this.states[this.initial].initialStateValue,e)}else r={};return this.__cache.initialStateValue=r,this.__cache.initialStateValue},enumerable:!1,configurable:!0}),t.prototype.getInitialState=function(e,r){this._init();var n=this.getStateNodes(e);return this.resolveTransition({configuration:n,entrySet:n,exitSet:[],transitions:[],source:void 0,actions:[]},void 0,r!=null?r:this.machine.context,void 0)},Object.defineProperty(t.prototype,"initialState",{get:function(){var e=this.initialStateValue;if(!e)throw new Error("Cannot retrieve initial state from simple state '".concat(this.id,"'."));return this.getInitialState(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"target",{get:function(){var e;if(this.type==="history"){var r=this.config;N(r.target)?e=Ge(r.target)?ut(this.machine.getStateNodeById(r.target).path.slice(this.path.length-1)):r.target:e=r.target}return e},enumerable:!1,configurable:!0}),t.prototype.getRelativeStateNodes=function(e,r,n){return n===void 0&&(n=!0),n?e.type==="history"?e.resolveHistory(r):e.initialStateNodes:[e]},Object.defineProperty(t.prototype,"initialStateNodes",{get:function(){var e=this;if(yt(this))return[this];if(this.type==="compound"&&!this.initial)return j||B(!1,"Compound state node '".concat(this.id,"' has no initial state.")),[this];var r=lt(this.initialStateValue);return U(r.map(function(n){return e.getFromRelativePath(n)}))},enumerable:!1,configurable:!0}),t.prototype.getFromRelativePath=function(e){if(!e.length)return[this];var r=C(e),n=r[0],i=r.slice(1);if(!this.states)throw new Error("Cannot retrieve subPath '".concat(n,"' from node with no states"));var s=this.getStateNode(n);if(s.type==="history")return s.resolveHistory();if(!this.states[n])throw new Error("Child state '".concat(n,"' does not exist on '").concat(this.id,"'"));return this.states[n].getFromRelativePath(i)},t.prototype.historyValue=function(e){if(!!Object.keys(this.states).length)return{current:e||this.initialStateValue,states:Mr(this.states,function(r,n){if(!e)return r.historyValue();var i=N(e)?void 0:e[n];return r.historyValue(i||r.initialStateValue)},function(r){return!r.history})}},t.prototype.resolveHistory=function(e){var r=this;if(this.type!=="history")return[this];var n=this.parent;if(!e){var i=this.target;return i?U(lt(i).map(function(a){return n.getFromRelativePath(a)})):n.initialStateNodes}var s=hi(n.path,"states")(e).current;return N(s)?[n.getStateNode(s)]:U(lt(s).map(function(a){return r.history==="deep"?n.getFromRelativePath(a):[n.states[a[0]]]}))},Object.defineProperty(t.prototype,"stateIds",{get:function(){var e=this,r=U(Object.keys(this.states).map(function(n){return e.states[n].stateIds}));return[this.id].concat(r)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"events",{get:function(){var e,r,n,i;if(this.__cache.events)return this.__cache.events;var s=this.states,a=new Set(this.ownEvents);if(s)try{for(var u=R(Object.keys(s)),c=u.next();!c.done;c=u.next()){var l=c.value,o=s[l];if(o.states)try{for(var f=(n=void 0,R(o.events)),d=f.next();!d.done;d=f.next()){var h=d.value;a.add("".concat(h))}}catch(m){n={error:m}}finally{try{d&&!d.done&&(i=f.return)&&i.call(f)}finally{if(n)throw n.error}}}}catch(m){e={error:m}}finally{try{c&&!c.done&&(r=u.return)&&r.call(u)}finally{if(e)throw e.error}}return this.__cache.events=Array.from(a)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ownEvents",{get:function(){var e=new Set(this.transitions.filter(function(r){return!(!r.target&&!r.actions.length&&r.internal)}).map(function(r){return r.eventType}));return Array.from(e)},enumerable:!1,configurable:!0}),t.prototype.resolveTarget=function(e){var r=this;if(e!==void 0)return e.map(function(n){if(!N(n))return n;var i=n[0]===r.delimiter;if(i&&!r.parent)return r.getStateNodeByPath(n.slice(1));var s=i?r.key+n:n;if(r.parent)try{var a=r.parent.getStateNodeByPath(s);return a}catch(u){throw new Error("Invalid transition definition for state node '".concat(r.id,`':
|
|
32
|
-
`).concat(u.message))}else return r.getStateNodeByPath(s)})},t.prototype.formatTransition=function(e){var r=this,n=wi(e.target),i="internal"in e?e.internal:n?n.some(function(c){return N(c)&&c[0]===r.delimiter}):!0,s=this.machine.options.guards,a=this.resolveTarget(n),u=y(y({},e),{actions:pt(ee(e.actions)),cond:Vt(e.cond,s),target:a,source:this,internal:i,eventType:e.event,toJSON:function(){return y(y({},u),{target:u.target?u.target.map(function(c){return"#".concat(c.id)}):void 0,source:"#".concat(r.id)})}});return u},t.prototype.formatTransitions=function(){var e,r,n=this,i;if(!this.config.on)i=[];else if(Array.isArray(this.config.on))i=this.config.on;else{var s=this.config.on,a=wt,u=s[a],c=u===void 0?[]:u,l=je(s,[typeof a=="symbol"?a:a+""]);i=U(Object.keys(l).map(function(g){!j&&g===Je&&B(!1,"Empty string transition configs (e.g., `{ on: { '': ... }}`) for transient transitions are deprecated. Specify the transition in the `{ always: ... }` property instead. "+'Please check the `on` configuration for "#'.concat(n.id,'".'));var T=Ae(g,l[g]);return j||yc(n,g,T),T}).concat(Ae(wt,c)))}var o=this.config.always?Ae("",this.config.always):[],f=this.config.onDone?Ae(String(mt(this.id)),this.config.onDone):[];j||B(!(this.config.onDone&&!this.parent),'Root nodes cannot have an ".onDone" transition. Please check the config of "'.concat(this.id,'".'));var d=U(this.invoke.map(function(g){var T=[];return g.onDone&&T.push.apply(T,D([],C(Ae(String(Re(g.id)),g.onDone)),!1)),g.onError&&T.push.apply(T,D([],C(Ae(String(Oe(g.id)),g.onError)),!1)),T})),h=this.after,m=U(D(D(D(D([],C(f),!1),C(d),!1),C(i),!1),C(o),!1).map(function(g){return ee(g).map(function(T){return n.formatTransition(T)})}));try{for(var E=R(h),v=E.next();!v.done;v=E.next()){var x=v.value;m.push(x)}}catch(g){e={error:g}}finally{try{v&&!v.done&&(r=E.return)&&r.call(E)}finally{if(e)throw e.error}}return m},t}();function ae(t,e){return new Gi(t,e)}var _=Oi,$=vt;var Kt="nhostRefreshToken",xt="nhostRefreshTokenExpiresAt";var ke={status:10,error:"invalid-email",message:"Email is incorrectly formatted"};var Tt={status:10,error:"invalid-password",message:"Password is incorrectly formatted"},Ji={status:10,error:"invalid-phone-number",message:"Phone number is incorrectly formatted"},zi={status:10,error:"no-mfa-ticket",message:"No MFA ticket has been provided"},$i={status:10,error:"no-refresh-token",message:"No refresh token has been provided"},Wi={status:20,error:"refresher-already-running",message:"The token refresher is already running. You must wait until is has finished before submitting a new token."};var ra=it(ta());var oe=t=>{let e=ra.default.create({baseURL:t});return e.interceptors.response.use(r=>r,r=>{var n,i,s,a,u,c,l,o,f,d;return Promise.reject({error:{message:(u=(a=(s=(i=(n=r.response)==null?void 0:n.data)==null?void 0:i.message)!=null?s:r.message)!=null?a:r.request.responseText)!=null?u:JSON.stringify(r),status:(f=(o=(c=r.response)==null?void 0:c.status)!=null?o:(l=r.response)==null?void 0:l.data.statusCode)!=null?f:0,error:((d=r.response)==null?void 0:d.data.error)||r.request.statusText||"network"}})}),e};var na=(t,e)=>{let r=e&&Object.entries(e).map(([n,i])=>{let s=Array.isArray(i)?i.join(","):typeof i=="object"?JSON.stringify(i):i;return`${n}=${encodeURIComponent(s)}`}).join("&");return r?`${t}?${r}`:t},ne=(t,e)=>{var r;return e!=null&&e.redirectTo?{...e,redirectTo:(r=e==null?void 0:e.redirectTo)!=null&&r.startsWith("/")?t+e.redirectTo:e==null?void 0:e.redirectTo}:e};var Ke=t=>!!t&&typeof t=="string"&&!!String(t).toLowerCase().match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/),nr=t=>!!t&&typeof t=="string"&&t.length>=3,ia=t=>!!t&&typeof t=="string";var pn={user:null,mfa:null,accessToken:{value:null,expiresAt:null},refreshTimer:{startedAt:null,attempts:0,lastAttempt:null},refreshToken:{value:null},errors:{}};var sa=({backendUrl:t,clientUrl:e,interpreter:r})=>{let n=oe(t);return ae({schema:{context:{},events:{}},tsTypes:{},preserveActionOrder:!0,id:"changeEmail",initial:"idle",context:{error:null},states:{idle:{on:{REQUEST:[{cond:"invalidEmail",actions:"saveInvalidEmailError",target:".error"},{target:"requesting"}]},initial:"initial",states:{initial:{},success:{},error:{}}},requesting:{invoke:{src:"requestChange",id:"requestChange",onDone:{target:"idle.success",actions:"reportSuccess"},onError:{actions:["saveRequestError","reportError"],target:"idle.error"}}}}},{actions:{saveInvalidEmailError:_({error:i=>ke}),saveRequestError:_({error:(i,{data:{error:s}})=>s}),reportError:$(i=>({type:"ERROR",error:i.error})),reportSuccess:$("SUCCESS")},guards:{invalidEmail:(i,{email:s})=>!Ke(s)},services:{requestChange:async(i,{email:s,options:a})=>(await n.post("/user/email/change",{newEmail:s,options:ne(e,a)},{headers:{authorization:`Bearer ${r==null?void 0:r.state.context.accessToken.value}`}})).data}})};var aa=({backendUrl:t,interpreter:e})=>{let r=oe(t);return ae({schema:{context:{},events:{}},tsTypes:{},preserveActionOrder:!0,id:"changePassword",initial:"idle",context:{error:null},states:{idle:{on:{REQUEST:[{cond:"invalidPassword",actions:"saveInvalidPasswordError",target:".error"},{target:"requesting"}]},initial:"initial",states:{initial:{},success:{},error:{}}},requesting:{invoke:{src:"requestChange",id:"requestChange",onDone:{target:"idle.success",actions:"reportSuccess"},onError:{actions:["saveRequestError","reportError"],target:"idle.error"}}}}},{actions:{saveInvalidPasswordError:_({error:n=>Tt}),saveRequestError:_({error:(n,{data:{error:i}})=>(console.log(i),i)}),reportError:$(n=>({type:"ERROR",error:n.error})),reportSuccess:$("SUCCESS")},guards:{invalidPassword:(n,{password:i})=>!nr(i)},services:{requestChange:(n,{password:i})=>r.post("/user/password",{newPassword:i},{headers:{authorization:`Bearer ${e==null?void 0:e.state.context.accessToken.value}`}})}})};var oa=({backendUrl:t,clientUrl:e})=>{let r=oe(t);return ae({schema:{context:{},events:{}},tsTypes:{},preserveActionOrder:!0,id:"changePassword",initial:"idle",context:{error:null},states:{idle:{on:{REQUEST:"requesting"},initial:"initial",states:{initial:{},success:{},error:{}}},requesting:{invoke:{src:"requestChange",id:"requestChange",onDone:{target:"idle.success",actions:"reportSuccess"},onError:{actions:["saveRequestError","reportError"],target:"idle.error"}}}}},{actions:{saveRequestError:_({error:(n,{data:{error:i}})=>(console.log(i),i)}),reportError:$(n=>({type:"ERROR",error:n.error})),reportSuccess:$("SUCCESS")},services:{requestChange:(n,{email:i,options:s})=>r.post("/user/password/reset",{email:i,options:ne(e,s)})}})};var ua=({backendUrl:t,clientUrl:e,interpreter:r})=>{let n=oe(t);return ae({schema:{context:{},events:{}},tsTypes:{},preserveActionOrder:!0,id:"sendVerificationEmail",initial:"idle",context:{error:null},states:{idle:{on:{REQUEST:[{cond:"invalidEmail",actions:"saveInvalidEmailError",target:".error"},{target:"requesting"}]},initial:"initial",states:{initial:{},success:{},error:{}}},requesting:{invoke:{src:"request",id:"request",onDone:{target:"idle.success",actions:"reportSuccess"},onError:{actions:["saveRequestError","reportError"],target:"idle.error"}}}}},{actions:{saveInvalidEmailError:_({error:i=>ke}),saveRequestError:_({error:(i,{data:{error:s}})=>s}),reportError:$(i=>({type:"ERROR",error:i.error})),reportSuccess:$("SUCCESS")},guards:{invalidEmail:(i,{email:s})=>!Ke(s)},services:{request:async(i,{email:s,options:a})=>(await n.post("/user/email/send-verification-email",{email:s,options:ne(e,a)})).data}})};var ca=({backendUrl:t,clientUrl:e,clientStorageGetter:r,clientStorageSetter:n,refreshIntervalTime:i,autoRefreshToken:s=!0,autoSignIn:a=!0})=>{let u=oe(t),c=async(l,o,f)=>(await u.post(l,o,f)).data;return ae({schema:{context:{},events:{}},tsTypes:{},context:pn,preserveActionOrder:!0,id:"nhost",type:"parallel",states:{authentication:{initial:"checkAutoSignIn",on:{SESSION_UPDATE:[{cond:"hasSession",actions:["saveSession","persist","resetTimer","reportTokenChanged"],target:".signedIn"}]},states:{checkAutoSignIn:{always:[{cond:"isAutoSignInDisabled",target:"importingRefreshToken"}],invoke:{id:"autoSignIn",src:"autoSignIn",onDone:{target:"signedIn",actions:["saveSession","persist","reportTokenChanged"]},onError:"importingRefreshToken"}},importingRefreshToken:{invoke:{id:"importRefreshToken",src:"importRefreshToken",onDone:{actions:"saveRefreshToken",target:"starting"}}},starting:{always:[{cond:"isSignedIn",target:"signedIn"},{cond:"hasRefreshTokenWithoutSession",target:["authenticating.token","#nhost.token.running"]},"signedOut"]},signedOut:{tags:["ready"],initial:"noErrors",entry:"reportSignedOut",states:{noErrors:{},success:{},needsEmailVerification:{},needsSmsOtp:{},needsMfa:{},failed:{exit:"resetAuthenticationError",initial:"server",states:{server:{},validation:{states:{password:{},email:{},phoneNumber:{}}}}},signingOut:{entry:["clearContextExceptRefreshToken"],exit:["destroyRefreshToken","reportTokenChanged"],invoke:{src:"signout",id:"signingOut",onDone:{target:"success"},onError:{target:"failed.server"}}}},on:{SIGNIN_PASSWORD:[{cond:"invalidEmail",actions:["saveInvalidEmail"],target:".failed.validation.email"},{cond:"invalidPassword",actions:["saveInvalidPassword"],target:".failed.validation.password"},"#nhost.authentication.authenticating.password"],SIGNIN_PASSWORDLESS_EMAIL:[{cond:"invalidEmail",actions:"saveInvalidEmail",target:".failed.validation.email"},"#nhost.authentication.authenticating.passwordlessEmail"],SIGNIN_PASSWORDLESS_SMS:[{cond:"invalidPhoneNumber",actions:"saveInvalidPhoneNumber",target:".failed.validation.phoneNumber"},"#nhost.authentication.authenticating.passwordlessSms"],SIGNIN_PASSWORDLESS_SMS_OTP:[{cond:"invalidPhoneNumber",actions:"saveInvalidPhoneNumber",target:".failed.validation.phoneNumber"},"#nhost.authentication.authenticating.passwordlessSmsOtp"],SIGNUP_EMAIL_PASSWORD:[{cond:"invalidEmail",actions:"saveInvalidSignUpEmail",target:".failed.validation.email"},{cond:"invalidPassword",actions:"saveInvalidSignUpPassword",target:".failed.validation.password"},"#nhost.authentication.registering"],SIGNIN_ANONYMOUS:"#nhost.authentication.authenticating.anonymous",SIGNIN_MFA_TOTP:[{cond:"noMfaTicket",actions:["saveNoMfaTicketError"],target:".failed"},"#nhost.authentication.authenticating.mfa.totp"]}},authenticating:{states:{passwordlessEmail:{invoke:{src:"signInPasswordlessEmail",id:"authenticatePasswordlessEmail",onDone:"#nhost.authentication.signedOut.needsEmailVerification",onError:{actions:"saveAuthenticationError",target:"#nhost.authentication.signedOut.failed.server"}}},passwordlessSms:{invoke:{src:"signInPasswordlessSms",id:"authenticatePasswordlessSms",onDone:"#nhost.authentication.signedOut.needsSmsOtp",onError:{actions:"saveAuthenticationError",target:"#nhost.authentication.signedOut.failed.server"}}},passwordlessSmsOtp:{invoke:{src:"signInPasswordlessSmsOtp",id:"authenticatePasswordlessSmsOtp",onDone:{actions:["saveSession","persist","reportTokenChanged"],target:"#nhost.authentication.signedIn"},onError:{actions:"saveAuthenticationError",target:"#nhost.authentication.signedOut.failed.server"}}},password:{invoke:{src:"signInPassword",id:"authenticateUserWithPassword",onDone:[{cond:"hasMfaTicket",actions:["saveMfaTicket"],target:"#nhost.authentication.signedOut.needsMfa"},{actions:["saveSession","persist","reportTokenChanged"],target:"#nhost.authentication.signedIn"}],onError:[{cond:"unverified",target:"#nhost.authentication.signedOut.needsEmailVerification"},{actions:"saveAuthenticationError",target:"#nhost.authentication.signedOut.failed.server"}]}},token:{},anonymous:{invoke:{src:"signInAnonymous",id:"authenticateAnonymously",onDone:{actions:["saveSession","persist","reportTokenChanged"],target:"#nhost.authentication.signedIn"},onError:{actions:"saveAuthenticationError",target:"#nhost.authentication.signedOut.failed.server"}}},mfa:{states:{totp:{invoke:{src:"signInMfaTotp",id:"signInMfaTotp",onDone:{actions:["saveSession","persist","reportTokenChanged"],target:"#nhost.authentication.signedIn"},onError:{actions:["saveAuthenticationError"],target:"#nhost.authentication.signedOut.failed.server"}}}}}}},registering:{entry:"resetSignUpError",invoke:{src:"registerUser",id:"registerUser",onDone:[{cond:"hasSession",target:"#nhost.authentication.signedIn",actions:["saveSession","persist","reportTokenChanged"]},{target:"#nhost.authentication.signedOut.needsEmailVerification"}],onError:[{cond:"unverified",target:"#nhost.authentication.signedOut.needsEmailVerification"},{actions:"saveRegisrationError",target:"#nhost.authentication.signedOut.failed.server"}]}},signedIn:{tags:["ready"],type:"parallel",entry:"reportSignedIn",on:{SIGNOUT:"#nhost.authentication.signedOut.signingOut",DEANONYMIZE:{target:".deanonymizing"}},states:{refreshTimer:{id:"timer",initial:"idle",states:{disabled:{type:"final"},stopped:{always:{cond:"noToken",target:"idle"}},idle:{always:[{cond:"isAutoRefreshDisabled",target:"disabled"},{cond:"hasRefreshToken",target:"running"}]},running:{initial:"pending",entry:"resetTimer",states:{pending:{after:{"1000":{internal:!1,target:"pending"}},always:{cond:"refreshTimerShouldRefresh",target:"refreshing"}},refreshing:{invoke:{src:"refreshToken",id:"refreshToken",onDone:{actions:["saveSession","persist","resetTimer","reportTokenChanged"],target:"pending"},onError:[{actions:"saveRefreshAttempt",target:"pending"}]}}}}}},deanonymizing:{initial:"error",states:{error:{},success:{}}}}}}},token:{initial:"idle",states:{idle:{on:{TRY_TOKEN:"running"},initial:"noErrors",states:{noErrors:{},error:{}}},running:{invoke:{src:"refreshToken",id:"authenticateWithToken",onDone:{actions:["saveSession","persist","reportTokenChanged"],target:["#nhost.authentication.signedIn","idle.noErrors"]},onError:[{cond:"isSignedIn",target:"idle.error"},{target:["#nhost.authentication.signedOut","idle.error"]}]}}}}}},{actions:{reportSignedIn:$("SIGNED_IN"),reportSignedOut:$("SIGNED_OUT"),reportTokenChanged:$("TOKEN_CHANGED"),clearContextExceptRefreshToken:_(({refreshToken:{value:l}})=>(n(xt,null),{...pn,refreshToken:{value:l}})),saveSession:_({user:(l,o)=>{var f,d;return(d=(f=o.data)==null?void 0:f.session)==null?void 0:d.user},accessToken:(l,o)=>{var f,d,h,m;return{value:(d=(f=o.data)==null?void 0:f.session)==null?void 0:d.accessToken,expiresAt:new Date(Date.now()+((m=(h=o.data)==null?void 0:h.session)==null?void 0:m.accessTokenExpiresIn)*1e3)}},refreshToken:(l,o)=>{var f,d;return{value:(d=(f=o.data)==null?void 0:f.session)==null?void 0:d.refreshToken}}}),saveMfaTicket:_({mfa:(l,o)=>{var f,d;return(d=(f=o.data)==null?void 0:f.mfa)!=null?d:null}}),resetTimer:_({refreshTimer:(l,o)=>({startedAt:new Date,attempts:0,lastAttempt:null})}),saveRefreshAttempt:_({refreshTimer:(l,o)=>({startedAt:l.refreshTimer.startedAt,attempts:l.refreshTimer.attempts+1,lastAttempt:new Date})}),saveAuthenticationError:_({errors:({errors:l},{data:{error:o}})=>({...l,authentication:o})}),resetAuthenticationError:_({errors:({errors:{authentication:l,...o}})=>o}),saveInvalidEmail:_({errors:({errors:l})=>({...l,authentication:ke})}),saveInvalidPassword:_({errors:({errors:l})=>({...l,authentication:Tt})}),saveInvalidPhoneNumber:_({errors:({errors:l})=>({...l,authentication:Ji})}),saveRegisrationError:_({errors:({errors:l},{data:{error:o}})=>({...l,registration:o})}),resetSignUpError:_({errors:({errors:{registration:l,...o}})=>o}),saveInvalidSignUpPassword:_({errors:({errors:l})=>({...l,registration:Tt})}),saveInvalidSignUpEmail:_({errors:({errors:l})=>({...l,registration:ke})}),saveNoMfaTicketError:_({errors:({errors:l})=>({...l,registration:zi})}),saveRefreshToken:_({accessToken:(l,o)=>({...l.accessToken,expiresAt:o.data.expiresAt}),refreshToken:(l,o)=>({...l.refreshToken,value:o.data.refreshToken})}),persist:(l,{data:o})=>{if(n(Kt,o.session.refreshToken),o.session.accessTokenExpiresIn){let f=new Date(Date.now()+o.session.accessTokenExpiresIn*1e3).toISOString();n(xt,f)}else n(xt,null)},destroyRefreshToken:_({refreshToken:l=>(n(Kt,null),{value:null})})},guards:{isSignedIn:l=>!!l.user&&!!l.refreshToken.value&&!!l.accessToken.value,hasRefreshTokenWithoutSession:l=>!!l.refreshToken.value&&!l.user&&!l.accessToken.value,noToken:l=>!l.refreshToken.value,noMfaTicket:(l,{ticket:o})=>{var f;return!o&&!((f=l.mfa)!=null&&f.ticket)},hasRefreshToken:l=>!!l.refreshToken.value,isAutoRefreshDisabled:()=>!s,isAutoSignInDisabled:()=>!a,refreshTimerShouldRefresh:l=>{var h;let{expiresAt:o}=l.accessToken;return o?l.refreshTimer.lastAttempt?Date.now()-l.refreshTimer.lastAttempt.getTime()>5*1e3:i&&Date.now()-(((h=l.refreshTimer.startedAt)==null?void 0:h.getTime())||0)>i*1e3?!0:o.getTime()-Date.now()-1e3*300<=0:!1},unverified:(l,{data:{error:o}})=>o.status===401&&o.message==="Email is not verified",hasSession:(l,o)=>{var f;return!!((f=o.data)!=null&&f.session)},hasMfaTicket:(l,o)=>{var f;return!!((f=o.data)!=null&&f.mfa)},invalidEmail:(l,{email:o})=>!Ke(o),invalidPassword:(l,{password:o})=>!nr(o),invalidPhoneNumber:(l,{phoneNumber:o})=>!ia(o)},services:{signInPassword:(l,{email:o,password:f})=>c("/signin/email-password",{email:o,password:f}),signInPasswordlessSms:(l,{phoneNumber:o,options:f})=>c("/signin/passwordless/sms",{phoneNumber:o,options:ne(e,f)}),signInPasswordlessSmsOtp:(l,{phoneNumber:o,otp:f})=>c("/signin/passwordless/sms/otp",{phoneNumber:o,otp:f}),signInPasswordlessEmail:(l,{email:o,options:f})=>c("/signin/passwordless/email",{email:o,options:ne(e,f)}),signInAnonymous:l=>c("/signin/anonymous"),signInMfaTotp:(l,{ticket:o,otp:f})=>{var d;return c("/signin/mfa/totp",{ticket:o||((d=l.mfa)==null?void 0:d.ticket),otp:f})},refreshToken:async(l,o)=>{let f=o.type==="TRY_TOKEN"?o.token:l.refreshToken.value;return{session:await c("/token",{refreshToken:f})}},signout:(l,o)=>c("/signout",{refreshToken:l.refreshToken.value,all:!!o.all}),registerUser:(l,{email:o,password:f,options:d})=>c("/signup/email-password",{email:o,password:f,options:ne(e,d)}),autoSignIn:async()=>{if(typeof window=="undefined"||!window.location)throw Error("window is undefined or location does not exist");let{hash:l}=window.location;if(!l)throw Error("No hash in window.location");let f=new URLSearchParams(l.slice(1)).get("refreshToken");if(!f)throw Error("No refresh token in the location hash");let d=await c("/token",{refreshToken:f});try{new BroadcastChannel("nhost").postMessage(f)}catch{}return{session:d}},importRefreshToken:async()=>{let l=await r(xt),o=l?new Date(l):null;return{refreshToken:await r(Kt),expiresAt:o}}}})};function ir(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)t[n]=r[n]}return t}var vl={read:function(t){return t[0]==='"'&&(t=t.slice(1,-1)),t.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(t){return encodeURIComponent(t).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function vn(t,e){function r(i,s,a){if(typeof document!="undefined"){a=ir({},e,a),typeof a.expires=="number"&&(a.expires=new Date(Date.now()+a.expires*864e5)),a.expires&&(a.expires=a.expires.toUTCString()),i=encodeURIComponent(i).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var u="";for(var c in a)!a[c]||(u+="; "+c,a[c]!==!0&&(u+="="+a[c].split(";")[0]));return document.cookie=i+"="+t.write(s,i)+u}}function n(i){if(!(typeof document=="undefined"||arguments.length&&!i)){for(var s=document.cookie?document.cookie.split("; "):[],a={},u=0;u<s.length;u++){var c=s[u].split("="),l=c.slice(1).join("=");try{var o=decodeURIComponent(c[0]);if(a[o]=t.read(l,o),i===o)break}catch{}}return i?a[i]:a}}return Object.create({set:r,get:n,remove:function(i,s){r(i,"",ir({},s,{expires:-1}))},withAttributes:function(i){return vn(this.converter,ir({},this.attributes,i))},withConverter:function(i){return vn(ir({},this.converter,i),this.attributes)}},{attributes:{value:Object.freeze(e)},converter:{value:Object.freeze(t)}})}var Mv=vn(vl,{path:"/"});var la=typeof window!="undefined",sr=new Map,ar=t=>{var e;return la&&localStorage?localStorage.getItem(t):(e=sr.get(t))!=null?e:null},or=(t,e)=>{la&&localStorage?e?localStorage.setItem(t,e):localStorage.removeItem(t):e?sr.set(t,e):sr.has(t)&&sr.delete(t)};var Xe=class{constructor({backendUrl:e,clientUrl:r=typeof window!="undefined"&&(l=>(l=window.location)==null?void 0:l.origin)()||"",clientStorageGetter:n=ar,clientStorageSetter:i=or,refreshIntervalTime:s,autoSignIn:a=!0,autoRefreshToken:u=!0,start:c=!0}){this._subscriptions=new Set;if(this.backendUrl=e,this.clientUrl=r,this.machine=ca({backendUrl:e,clientUrl:r,refreshIntervalTime:s,clientStorageGetter:n,clientStorageSetter:i,autoSignIn:a,autoRefreshToken:u}),c&&(this.interpreter=me(this.machine),this.interpreter.start()),typeof window!="undefined"&&a)try{this._channel=new BroadcastChannel("nhost"),this._channel.addEventListener("message",o=>{var d;let f=(d=this.interpreter)==null?void 0:d.state.context.refreshToken;this.interpreter&&o.data!==f&&this.interpreter.send({type:"TRY_TOKEN",token:o.data})})}catch{}}get interpreter(){return this._interpreter}set interpreter(e){this._interpreter=e,e&&this._subscriptions.forEach(r=>r(this))}onStart(e){this.interpreter?e(this):this._subscriptions.add(e)}};var fa=()=>typeof window!="undefined",we=t=>!t||!t.accessToken.value||!t.refreshToken.value||!t.accessToken.expiresAt?null:{accessToken:t.accessToken.value,accessTokenExpiresIn:(t.accessToken.expiresAt.getTime()-Date.now())/1e3,refreshToken:t.refreshToken.value,user:t.user},Ye=(t,e)=>{e.forEach(r=>{typeof t[r]!="function"&&console.error(`clientStorage.${r} is not a function`)})},da=(t,e)=>{if(e){if(t==="react-native"||t==="custom")return Ye(e,["getItem"]),r=>{var n;return(n=e.getItem)==null?void 0:n.call(e,r)};if(t==="capacitor")return Ye(e,["get"]),r=>{var n;return(n=e.get)==null?void 0:n.call(e,{key:r})};if(t==="expo-secure-storage")return Ye(e,["getItemAsync"]),r=>{var n;return(n=e.getItemAsync)==null?void 0:n.call(e,r)}}return ar},ha=(t,e)=>{if(e){if(t==="react-native"||t==="custom")return Ye(e,["setItem","removeItem"]),(r,n)=>{var i,s;n?(i=e.setItem)==null||i.call(e,r,n):(s=e.removeItem)==null||s.call(e,r)};if(t==="capacitor")return Ye(e,["set","remove"]),(r,n)=>{var i,s;n?(i=e.set)==null||i.call(e,{key:r,value:n}):(s=e.remove)==null||s.call(e,{key:r})};if(t==="expo-secure-storage")return Ye(e,["setItemAsync","deleteItemAsync"]),async(r,n)=>{var i,s;n?await((i=e.setItemAsync)==null?void 0:i.call(e,r,n)):(s=e.deleteItemAsync)==null||s.call(e,r)}}return or};var pa={message:"User is already signed in",status:100},ml={message:"User is not authenticated",status:101},yl={message:"User is not anonymous",status:101},gl={message:"Email needs verification",status:102},ur=class{constructor({url:e,autoRefreshToken:r=!0,autoLogin:n=!0,clientStorage:i,clientStorageType:s="web",clientStorageGetter:a,clientStorageSetter:u,refreshIntervalTime:c,start:l=!0,Client:o=Xe}){this._client=new o({backendUrl:e,autoRefreshToken:r,autoSignIn:n,start:l,clientStorageGetter:a||da(s,i),clientStorageSetter:u||ha(s,i),refreshIntervalTime:c})}async signUp(e){let r=await this.waitUntilReady(),{email:n,password:i,options:s}=e;return this.isAuthenticated()?{session:null,error:pa}:new Promise(a=>{r.send({type:"SIGNUP_EMAIL_PASSWORD",email:n,password:i,options:s}),r.onTransition(u=>{if(u.matches({authentication:{signedOut:"needsEmailVerification"}}))return a({session:null,error:null});if(u.matches({authentication:{signedOut:"failed"}}))return a({session:null,error:u.context.errors.registration||null});if(u.matches({authentication:"signedIn"}))return a({session:we(u.context),error:null})})})}async signIn(e){let r=await this.waitUntilReady();if(this.isAuthenticated())return{session:null,mfa:null,error:pa};if("provider"in e){let{provider:n,options:i}=e,s=na(`${this._client.backendUrl}/signin/provider/${n}`,ne(this._client.clientUrl,i));return fa()&&(window.location.href=s),{providerUrl:s,provider:n,session:null,mfa:null,error:null}}return"email"in e&&"password"in e?new Promise(n=>{r.send({type:"SIGNIN_PASSWORD",...e}),r.onTransition(i=>{i.matches({authentication:"signedIn"})?n({session:we(i.context),mfa:null,error:null}):i.matches({authentication:{signedOut:"needsEmailVerification"}})?n({session:null,mfa:null,error:gl}):i.matches({authentication:{signedOut:"needsMfa"}})?n({session:null,mfa:i.context.mfa,error:null}):i.matches({authentication:{signedOut:"failed"}})&&n({session:null,mfa:null,error:i.context.errors.authentication||null})})}):"email"in e&&!("otp"in e)?new Promise(n=>{r.onTransition(i=>{i.matches({authentication:{signedOut:"needsEmailVerification"}})?n({session:null,mfa:null,error:null}):i.matches({authentication:{signedOut:"failed"}})&&n({session:null,mfa:null,error:i.context.errors.authentication||null})}),r.send({type:"SIGNIN_PASSWORDLESS_EMAIL",...e})}):"phoneNumber"in e&&!("otp"in e)?new Promise(n=>{r.onTransition(i=>{i.matches({authentication:{signedOut:"needsSmsOtp"}})?n({session:null,mfa:null,error:null}):i.matches({authentication:{signedOut:"failed"}})&&n({session:null,mfa:null,error:i.context.errors.authentication||null})}),r.send({type:"SIGNIN_PASSWORDLESS_SMS",...e})}):"otp"in e?new Promise(n=>{r.onTransition(i=>{i.matches({authentication:"signedIn"})?n({session:we(i.context),mfa:null,error:null}):i.matches({authentication:{signedOut:"failed"}})&&n({session:null,mfa:null,error:i.context.errors.authentication||null})}),r.send({type:"SIGNIN_PASSWORDLESS_SMS_OTP",...e})}):{session:null,mfa:null,error:{message:"Incorrect parameters",status:500}}}async signOut(e){let r=await this.waitUntilReady();return this.isAuthenticated()?new Promise(n=>{r.send({type:"SIGNOUT",all:e==null?void 0:e.all}),r.onTransition(i=>{i.matches({authentication:{signedOut:"success"}})?n({error:null}):i.matches({authentication:{signedOut:{failed:"server"}}})&&n({error:i.context.errors.signout||null})})}):{error:ml}}async resetPassword({email:e,options:r}){return new Promise(n=>{let i=me(oa(this._client));i.onTransition(({event:s})=>{if(s.type==="ERROR")return n({error:s.error});if(s.type==="SUCCESS")return n({error:null})}),i.start(),i.send({type:"REQUEST",email:e,options:r})})}async changePassword(e){return new Promise(r=>{let n=me(aa(this._client));n.onTransition(({event:i})=>{if(i.type==="ERROR")return r({error:i.error});if(i.type==="SUCCESS")return r({error:null})}),n.start(),n.send({type:"REQUEST",password:e.newPassword})})}async sendVerificationEmail(e){return new Promise(r=>{let n=me(ua(this._client));n.onTransition(({event:i})=>{if(i.type==="ERROR")return r({error:i.error});if(i.type==="SUCCESS")return r({error:null})}),n.start(),n.send({type:"REQUEST",email:e.email,options:e.options})})}async changeEmail({newEmail:e,options:r}){return new Promise(n=>{let i=me(sa(this._client));i.onTransition(({event:s})=>{if(s.type==="ERROR")return n({error:s.error});if(s.type==="SUCCESS")return n({error:null})}),i.start(),i.send({type:"REQUEST",email:e,options:r})})}async deanonymize(e){let r=await this.waitUntilReady();return new Promise(n=>{var u;if(!this.isAuthenticated()||!((u=r.state.context.user)!=null&&u.isAnonymous))return{error:yl};r.onTransition(c=>{c.matches({authentication:{signedIn:{deanonymizing:"success"}}})?n({error:null}):c.matches({authentication:{signedIn:{deanonymizing:"error"}}})&&n({error:c.context.errors.authentication||null})}),r.start();let{signInMethod:i,connection:s,...a}=e;r.send({type:"DEANONYMIZE",signInMethod:i,connection:s,options:a})})}onTokenChanged(e){let r=n=>n.onTransition(({event:i,context:s})=>{i.type==="TOKEN_CHANGED"&&e(we(s))});if(this._client.interpreter){let n=r(this._client.interpreter);return()=>n.stop()}else return this._client.onStart(n=>{r(n.interpreter)}),()=>{console.log("onTokenChanged was added before the interpreter started. Cannot unsubscribe listener.")}}onAuthStateChanged(e){let r=n=>n.onTransition(({event:i,context:s})=>{(i.type==="SIGNED_IN"||i.type==="SIGNED_OUT")&&e(i.type,we(s))});if(this._client.interpreter){let n=r(this._client.interpreter);return()=>n.stop()}else return this._client.onStart(n=>{r(n.interpreter)}),()=>{console.log("onAuthStateChanged was added before the interpreter started. Cannot unsubscribe listener.")}}isAuthenticated(){var e;return!!((e=this._client.interpreter)!=null&&e.state.matches({authentication:"signedIn"}))}async isAuthenticatedAsync(){return(await this.waitUntilReady()).state.matches({authentication:"signedIn"})}getAuthenticationStatus(){return this.isReady()?{isAuthenticated:this.isAuthenticated(),isLoading:!1}:{isAuthenticated:!1,isLoading:!0}}getJWTToken(){return this.getAccessToken()}getAccessToken(){var e,r;return(r=(e=this._client.interpreter)==null?void 0:e.state.context.accessToken.value)!=null?r:void 0}async refreshSession(e){try{let r=await this.waitUntilReady();return r.state.matches({token:"idle"})?new Promise(n=>{let i=e||r.state.context.refreshToken.value;if(!i)return n({session:null,error:$i});r==null||r.onTransition(s=>{s.matches({token:{idle:"error"}})?n({session:null,error:{status:400,message:"Invalid refresh token"}}):s.event.type==="TOKEN_CHANGED"&&n({session:we(s.context),error:null})}),r.send({type:"TRY_TOKEN",token:i})}):{session:null,error:Wi}}catch(r){return{session:null,error:r.message}}}getSession(){var e,r;return we((r=(e=this._client.interpreter)==null?void 0:e.state)==null?void 0:r.context)}getUser(){var e,r,n;return((n=(r=(e=this._client.interpreter)==null?void 0:e.state)==null?void 0:r.context)==null?void 0:n.user)||null}waitUntilReady(){let r=this._client.interpreter;if(!r)throw Error("Auth interpreter not set");return r.state.hasTag("ready")?Promise.resolve(r):new Promise((n,i)=>{let s=setTimeout(()=>i(`The state machine is not yet ready after ${15} seconds.`),15e3);r.onTransition(a=>{if(a.hasTag("ready"))return clearTimeout(s),n(r)})})}isReady(){var e,r;return!!((r=(e=this._client.interpreter)==null?void 0:e.state)!=null&&r.hasTag("ready"))}get client(){return this._client}};var Ao=it(To()),gr=class{constructor({url:e}){this.url=e,this.httpClient=Ao.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:i}=e,s={};return r&&(s["x-nhost-bucket-id"]=r),i&&(s["x-nhost-file-id"]=i),n&&(s["x-nhost-file-name"]=n),s}generateAuthHeaders(){return!this.adminSecret&&!this.accessToken?null:this.adminSecret?{"x-hasura-admin-secret":this.adminSecret}:{Authorization:`Bearer ${this.accessToken}`}}};var Er=class{constructor({url:e}){this.url=e,this.api=new gr({url:e})}async upload(e){let r=new FormData;r.append("file",e.file);let{fileMetadata:n,error:i}=await this.api.upload({...e,file:r});return i?{fileMetadata:null,error:i}: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 Pu=it(ei()),Or=class{constructor(e){let{url:r}=e;this.accessToken=null,this.instance=Pu.default.create({baseURL:r})}async call(e,r,n){let i={...this.generateAccessTokenHeaders(),...n==null?void 0:n.headers},s;try{s=await this.instance.post(e,r,{...n,headers:i})}catch(a){if(a instanceof Error)return{res:null,error:a}}return s?{res:s,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 Ku=it(ei()),Xu=it(Wu()),_r=class{constructor(e){let{url:r}=e;this.url=r,this.accessToken=null,this.instance=Ku.default.create({baseURL:r})}async request(e,r,n){let i={...n==null?void 0:n.headers,...this.generateAccessTokenHeaders()};try{let s="",u=(await this.instance.post("",{operationName:s||void 0,query:typeof e=="string"?e:(0,Xu.print)(e),variables:r},{...n,headers:i})).data,{data:c}=u;return u.errors?{data:null,error:u.errors}:typeof c!="object"||Array.isArray(c)||c===null?{data:null,error:new Error("incorrect response data from GraphQL server")}:{data:c,error:null}}catch(s){return s instanceof Error?{data:null,error:s}:(console.error(s),{data:null,error:new Error("Unable to get do GraphQL request")})}}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 Dr=class{constructor({backendUrl:e,refreshIntervalTime:r,clientStorageGetter:n,clientStorageSetter:i,clientStorage:s,clientStorageType:a,autoRefreshToken:u,autoLogin:c,start:l=!0,Client:o}){if(!e)throw new Error("Please specify a `backendUrl`. Docs: [todo]!");this.auth=new ur({url:`${e}/v1/auth`,refreshIntervalTime:r,clientStorageGetter:n,clientStorageSetter:i,clientStorage:s,clientStorageType:a,autoRefreshToken:u,autoLogin:c,start:l,Client:o}),this.storage=new Er({url:`${e}/v1/storage`}),this.functions=new Or({url:`${e}/v1/functions`}),this.graphql=new _r({url:`${e}/v1/graphql`}),this.storage.setAccessToken(this.auth.getAccessToken()),this.functions.setAccessToken(this.auth.getAccessToken()),this.graphql.setAccessToken(this.auth.getAccessToken()),this.auth.client.onStart(()=>{this.auth.onAuthStateChanged((f,d)=>{f==="SIGNED_OUT"&&(this.storage.setAccessToken(void 0),this.functions.setAccessToken(void 0),this.graphql.setAccessToken(void 0))}),this.auth.onTokenChanged(f=>{this.storage.setAccessToken(f==null?void 0:f.accessToken),this.functions.setAccessToken(f==null?void 0:f.accessToken),this.graphql.setAccessToken(f==null?void 0:f.accessToken)})})}};var og=t=>new Dr(t);export{Dr as NhostClient,og as createClient};
|
|
29
|
+
Event: `).concat(JSON.stringify(d.data)));return n.scheduler.schedule(function(){n.forward(d);var l=n.nextState(d);n.update(l,d)}),n._state},this.sendTo=function(c,h){var d=n.parent&&(h===Ee.Parent||n.parent.id===h),l=d?n.parent:P(h)?n.children.get(h)||gt.get(h):bi(h)?h:void 0;if(!l){if(!d)throw new Error("Unable to send event to child '".concat(h,"' from service '").concat(n.id,"'."));j||B(!1,"Service '".concat(n.id,"' has no parent: unable to send event ").concat(c.type));return}"machine"in l?l.send(E(E({},c),{name:c.name===Mr?"".concat(Oe(n.id)):c.name,origin:n.sessionId})):l.send(c.data)};var i=E(E({},t.defaultOptions),r),s=i.clock,a=i.logger,o=i.parent,u=i.id,f=u!==void 0?u:e.id;this.id=f,this.logger=a,this.clock=s,this.parent=o,this.options=i,this.scheduler=new zr({deferEvents:this.options.deferEvents}),this.sessionId=gt.bookId()}return Object.defineProperty(t.prototype,"initialState",{get:function(){var e=this;return this._initialState?this._initialState:Ce(this,function(){return e._initialState=e.machine.initialState,e._initialState})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"state",{get:function(){return j||B(this.status!==H.NotStarted,"Attempted to read state from uninitialized service '".concat(this.id,"'. Make sure the service is started first.")),this._state},enumerable:!1,configurable:!0}),t.prototype.execute=function(e,r){var n,i;try{for(var s=R(e.actions),a=s.next();!a.done;a=s.next()){var o=a.value;this.exec(o,e,r)}}catch(u){n={error:u}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(n)throw n.error}}},t.prototype.update=function(e,r){var n,i,s,a,o,u,f,c,h=this;if(e._sessionid=this.sessionId,this._state=e,this.options.execute&&this.execute(this.state),this.children.forEach(function(b){h.state.children[b.id]=b}),this.devTools&&this.devTools.send(r.data,e),e.event)try{for(var d=R(this.eventListeners),l=d.next();!l.done;l=d.next()){var p=l.value;p(e.event)}}catch(b){n={error:b}}finally{try{l&&!l.done&&(i=d.return)&&i.call(d)}finally{if(n)throw n.error}}try{for(var v=R(this.listeners),m=v.next();!m.done;m=v.next()){var p=m.value;p(e,e.event)}}catch(b){s={error:b}}finally{try{m&&!m.done&&(a=v.return)&&a.call(v)}finally{if(s)throw s.error}}try{for(var w=R(this.contextListeners),g=w.next();!g.done;g=w.next()){var T=g.value;T(this.state.context,this.state.history?this.state.history.context:void 0)}}catch(b){o={error:b}}finally{try{g&&!g.done&&(u=w.return)&&u.call(w)}finally{if(o)throw o.error}}var O=Ie(e.configuration||[],this.machine);if(this.state.configuration&&O){var N=e.configuration.find(function(b){return b.type==="final"&&b.parent===h.machine}),M=N&&N.doneData?Te(N.doneData,e.context,r):void 0;try{for(var A=R(this.doneListeners),x=A.next();!x.done;x=A.next()){var p=x.value;p(Re(this.id,M))}}catch(b){f={error:b}}finally{try{x&&!x.done&&(c=A.return)&&c.call(A)}finally{if(f)throw f.error}}this.stop()}},t.prototype.onTransition=function(e){return this.listeners.add(e),this.status===H.Running&&e(this.state,this.state.event),this},t.prototype.subscribe=function(e,r,n){var i=this;if(!e)return{unsubscribe:function(){}};var s,a=n;return typeof e=="function"?s=e:(s=e.next.bind(e),a=e.complete.bind(e)),this.listeners.add(s),this.status!==H.NotStarted&&s(this.state),a&&(this.status===H.Stopped?a():this.onDone(a)),{unsubscribe:function(){s&&i.listeners.delete(s),a&&i.doneListeners.delete(a)}}},t.prototype.onEvent=function(e){return this.eventListeners.add(e),this},t.prototype.onSend=function(e){return this.sendListeners.add(e),this},t.prototype.onChange=function(e){return this.contextListeners.add(e),this},t.prototype.onStop=function(e){return this.stopListeners.add(e),this},t.prototype.onDone=function(e){return this.doneListeners.add(e),this},t.prototype.off=function(e){return this.listeners.delete(e),this.eventListeners.delete(e),this.sendListeners.delete(e),this.stopListeners.delete(e),this.doneListeners.delete(e),this.contextListeners.delete(e),this},t.prototype.start=function(e){var r=this;if(this.status===H.Running)return this;this.machine._init(),gt.register(this.sessionId,this),this.initialized=!0,this.status=H.Running;var n=e===void 0?this.initialState:Ce(this,function(){return Gi(e)?r.machine.resolveState(e):r.machine.resolveState(se.from(e,r.machine.context))});return this.options.devTools&&this.attachDev(),this.scheduler.initialize(function(){r.update(n,be)}),this},t.prototype.stop=function(){var e,r,n,i,s,a,o,u,f,c,h=this;try{for(var d=R(this.listeners),l=d.next();!l.done;l=d.next()){var p=l.value;this.listeners.delete(p)}}catch(x){e={error:x}}finally{try{l&&!l.done&&(r=d.return)&&r.call(d)}finally{if(e)throw e.error}}try{for(var v=R(this.stopListeners),m=v.next();!m.done;m=v.next()){var p=m.value;p(),this.stopListeners.delete(p)}}catch(x){n={error:x}}finally{try{m&&!m.done&&(i=v.return)&&i.call(v)}finally{if(n)throw n.error}}try{for(var w=R(this.contextListeners),g=w.next();!g.done;g=w.next()){var p=g.value;this.contextListeners.delete(p)}}catch(x){s={error:x}}finally{try{g&&!g.done&&(a=w.return)&&a.call(w)}finally{if(s)throw s.error}}try{for(var T=R(this.doneListeners),O=T.next();!O.done;O=T.next()){var p=O.value;this.doneListeners.delete(p)}}catch(x){o={error:x}}finally{try{O&&!O.done&&(u=T.return)&&u.call(T)}finally{if(o)throw o.error}}if(!this.initialized)return this;D([],C(this.state.configuration),!1).sort(function(x,b){return b.order-x.order}).forEach(function(x){var b,q;try{for(var V=R(x.definition.exit),Q=V.next();!Q.done;Q=V.next()){var ge=Q.value;h.exec(ge,h.state)}}catch(kt){b={error:kt}}finally{try{Q&&!Q.done&&(q=V.return)&&q.call(V)}finally{if(b)throw b.error}}}),this.children.forEach(function(x){k(x.stop)&&x.stop()}),this.children.clear();try{for(var N=R(Object.keys(this.delayedEventsMap)),M=N.next();!M.done;M=N.next()){var A=M.value;this.clock.clearTimeout(this.delayedEventsMap[A])}}catch(x){f={error:x}}finally{try{M&&!M.done&&(c=N.return)&&c.call(N)}finally{if(f)throw f.error}}return this.scheduler.clear(),this.scheduler=new zr({deferEvents:this.options.deferEvents}),this.initialized=!1,this.status=H.Stopped,this._initialState=void 0,gt.free(this.sessionId),this},t.prototype.batch=function(e){var r=this;if(this.status===H.NotStarted&&this.options.deferEvents)j||B(!1,"".concat(e.length,' event(s) were sent to uninitialized service "').concat(this.machine.id,`" and are deferred. Make sure .start() is called for this service.
|
|
30
|
+
Event: `).concat(JSON.stringify(event)));else if(this.status!==H.Running)throw new Error("".concat(e.length,' event(s) were sent to uninitialized service "').concat(this.machine.id,'". Make sure .start() is called for this service, or set { deferEvents: true } in the service options.'));this.scheduler.schedule(function(){var n,i,s=r.state,a=!1,o=[],u=function(d){var l=F(d);r.forward(l),s=Ce(r,function(){return r.machine.transition(s,l)}),o.push.apply(o,D([],C(s.actions.map(function(p){return Ji(p,s)})),!1)),a=a||!!s.changed};try{for(var f=R(e),c=f.next();!c.done;c=f.next()){var h=c.value;u(h)}}catch(d){n={error:d}}finally{try{c&&!c.done&&(i=f.return)&&i.call(f)}finally{if(n)throw n.error}}s.changed=a,s.actions=o,r.update(s,F(e[e.length-1]))})},t.prototype.sender=function(e){return this.send.bind(this,e)},t.prototype.nextState=function(e){var r=this,n=F(e);if(n.name.indexOf(jr)===0&&!this.state.nextEvents.some(function(s){return s.indexOf(jr)===0}))throw n.data.data;var i=Ce(this,function(){return r.machine.transition(r.state,n)});return i},t.prototype.forward=function(e){var r,n;try{for(var i=R(this.forwardTo),s=i.next();!s.done;s=i.next()){var a=s.value,o=this.children.get(a);if(!o)throw new Error("Unable to forward event '".concat(e,"' from interpreter '").concat(this.id,"' to nonexistant child '").concat(a,"'."));o.send(e)}}catch(u){r={error:u}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}},t.prototype.defer=function(e){var r=this;this.delayedEventsMap[e.id]=this.clock.setTimeout(function(){e.to?r.sendTo(e._event,e.to):r.send(e._event)},e.delay)},t.prototype.cancel=function(e){this.clock.clearTimeout(this.delayedEventsMap[e]),delete this.delayedEventsMap[e]},t.prototype.exec=function(e,r,n){n===void 0&&(n=this.machine.options.actions);var i=r.context,s=r._event,a=e.exec||$t(e.type,n),o=k(a)?a:a?a.exec:e.exec;if(o)try{return o(i,s.data,{action:e,state:this.state,_event:s})}catch(O){throw this.parent&&this.parent.send({type:"xstate.error",data:O}),O}switch(e.type){case xe:var u=e;if(typeof u.delay=="number"){this.defer(u);return}else u.to?this.sendTo(u._event,u.to):this.send(u._event);break;case Dt:this.cancel(e.sendId);break;case it:{if(this.status!==H.Running)return;var f=e.activity;if(!this.state.activities[f.id||f.type])break;if(f.type===I.Invoke){var c=Jt(f.src),h=this.machine.options.services?this.machine.options.services[c.type]:void 0,d=f.id,l=f.data;j||B(!("forward"in f),"`forward` property is deprecated (found in invocation of '".concat(f.src,"' in in machine '").concat(this.machine.id,"'). ")+"Please use `autoForward` instead.");var p="autoForward"in f?f.autoForward:!!f.forward;if(!h){j||B(!1,"No service found for invocation '".concat(f.src,"' in machine '").concat(this.machine.id,"'."));return}var v=l?Te(l,i,s):void 0;if(typeof h=="string")return;var m=k(h)?h(i,s.data,{data:v,src:c,meta:f.meta}):h;if(!m)return;var w=void 0;de(m)&&(m=v?m.withContext(v):m,w={autoForward:p}),this.spawn(m,d,w)}else this.spawnActivity(f);break}case Me:{this.stopChild(e.activity.id);break}case Ut:var g=e.label,T=e.value;g?this.logger(g,T):this.logger(T);break;default:j||B(!1,"No implementation found for action type '".concat(e.type,"'"));break}},t.prototype.removeChild=function(e){var r;this.children.delete(e),this.forwardTo.delete(e),(r=this.state)===null||r===void 0||delete r.children[e]},t.prototype.stopChild=function(e){var r=this.children.get(e);!r||(this.removeChild(e),k(r.stop)&&r.stop())},t.prototype.spawn=function(e,r,n){if(Fr(e))return this.spawnPromise(Promise.resolve(e),r);if(k(e))return this.spawnCallback(e,r);if(Mi(e))return this.spawnActor(e,r);if(Ai(e))return this.spawnObservable(e,r);if(de(e))return this.spawnMachine(e,E(E({},n),{id:r}));if(wi(e))return this.spawnBehavior(e,r);throw new Error('Unable to spawn entity "'.concat(r,'" of type "').concat(typeof e,'".'))},t.prototype.spawnMachine=function(e,r){var n=this;r===void 0&&(r={});var i=new t(e,E(E({},this.options),{parent:this,id:r.id||e.id})),s=E(E({},Sc),r);s.sync&&i.onTransition(function(o){n.send(at,{state:o,id:i.id})});var a=i;return this.children.set(i.id,a),s.autoForward&&this.forwardTo.add(i.id),i.onDone(function(o){n.removeChild(i.id),n.send(F(o,{origin:i.id}))}).start(),a},t.prototype.spawnBehavior=function(e,r){var n=zi(e,{id:r,parent:this});return this.children.set(r,n),n},t.prototype.spawnPromise=function(e,r){var n,i=this,s=!1,a;e.then(function(u){s||(a=u,i.removeChild(r),i.send(F(Re(r,u),{origin:r})))},function(u){if(!s){i.removeChild(r);var f=Oe(r,u);try{i.send(F(f,{origin:r}))}catch(c){Oi(u,c,r),i.devTools&&i.devTools.send(f,i.state),i.machine.strict&&i.stop()}}});var o=(n={id:r,send:function(){},subscribe:function(u,f,c){var h=ft(u,f,c),d=!1;return e.then(function(l){d||(h.next(l),!d&&h.complete())},function(l){d||h.error(l)}),{unsubscribe:function(){return d=!0}}},stop:function(){s=!0},toJSON:function(){return{id:r}},getSnapshot:function(){return a}},n[fe]=function(){return this},n);return this.children.set(r,o),o},t.prototype.spawnCallback=function(e,r){var n,i=this,s=!1,a=new Set,o=new Set,u,f=function(d){u=d,o.forEach(function(l){return l(d)}),!s&&i.send(F(d,{origin:r}))},c;try{c=e(f,function(d){a.add(d)})}catch(d){this.send(Oe(r,d))}if(Fr(c))return this.spawnPromise(c,r);var h=(n={id:r,send:function(d){return a.forEach(function(l){return l(d)})},subscribe:function(d){var l=ft(d);return o.add(l.next),{unsubscribe:function(){o.delete(l.next)}}},stop:function(){s=!0,k(c)&&c()},toJSON:function(){return{id:r}},getSnapshot:function(){return u}},n[fe]=function(){return this},n);return this.children.set(r,h),h},t.prototype.spawnObservable=function(e,r){var n,i=this,s,a=e.subscribe(function(u){s=u,i.send(F(u,{origin:r}))},function(u){i.removeChild(r),i.send(F(Oe(r,u),{origin:r}))},function(){i.removeChild(r),i.send(F(Re(r),{origin:r}))}),o=(n={id:r,send:function(){},subscribe:function(u,f,c){return e.subscribe(u,f,c)},stop:function(){return a.unsubscribe()},getSnapshot:function(){return s},toJSON:function(){return{id:r}}},n[fe]=function(){return this},n);return this.children.set(r,o),o},t.prototype.spawnActor=function(e,r){return this.children.set(r,e),e},t.prototype.spawnActivity=function(e){var r=this.machine.options&&this.machine.options.activities?this.machine.options.activities[e.type]:void 0;if(!r){j||B(!1,"No implementation found for activity '".concat(e.type,"'"));return}var n=r(this.state.context,e);this.spawnEffect(e.id,n)},t.prototype.spawnEffect=function(e,r){var n;this.children.set(e,(n={id:e,send:function(){},subscribe:function(){return{unsubscribe:function(){}}},stop:r||void 0,getSnapshot:function(){},toJSON:function(){return{id:e}}},n[fe]=function(){return this},n))},t.prototype.attachDev=function(){var e=Kt();if(this.options.devTools&&e){if(e.__REDUX_DEVTOOLS_EXTENSION__){var r=typeof this.options.devTools=="object"?this.options.devTools:void 0;this.devTools=e.__REDUX_DEVTOOLS_EXTENSION__.connect(E(E({name:this.id,autoPause:!0,stateSanitizer:function(n){return{value:n.value,context:n.context,actions:n.actions}}},r),{features:E({jump:!1,skip:!1},r?r.features:void 0)}),this.machine),this.devTools.init(this.state)}$i(this)}},t.prototype.toJSON=function(){return{id:this.id}},t.prototype[fe]=function(){return this},t.prototype.getSnapshot=function(){return this.status===H.NotStarted?this.initialState:this._state},t.defaultOptions={execute:!0,deferEvents:!0,clock:{setTimeout:function(e,r){return setTimeout(e,r)},clearTimeout:function(e){return clearTimeout(e)}},logger:console.log.bind(console),devTools:!1},t.interpret=me,t}();function me(t,e){var r=new Wi(t,e);return r}function wc(t){if(typeof t=="string"){var e={type:t};return e.toString=function(){return t},e}return t}function Et(t){return E(E({type:st},t),{toJSON:function(){t.onDone,t.onError;var e=je(t,["onDone","onError"]);return E(E({},e),{type:st,src:wc(t.src)})}})}var Je="",Kr="#",St="*",He={},Ge=function(t){return t[0]===Kr},xc=function(){return{actions:{},guards:{},services:{},activities:{},delays:{}}},Tc=function(t,e,r){var n=r.slice(0,-1).some(function(s){return!("cond"in s)&&!("in"in s)&&(P(s.target)||de(s.target))}),i=e===Je?"the transient event":"event '".concat(e,"'");B(!n,"One or more transitions for ".concat(i," on state '").concat(t.id,"' are unreachable. ")+"Make sure that the default transition is the last one defined.")},Ki=function(){function t(e,r,n,i){var s=this;n===void 0&&(n="context"in e?e.context:void 0);var a;this.config=e,this._context=n,this.order=-1,this.__xstatenode=!0,this.__cache={events:void 0,relativeValue:new Map,initialStateValue:void 0,initialState:void 0,on:void 0,transitions:void 0,candidates:{},delayedTransitions:void 0},this.idMap={},this.tags=[],this.options=Object.assign(xc(),r),this.parent=i==null?void 0:i.parent,this.key=this.config.key||(i==null?void 0:i.key)||this.config.id||"(machine)",this.machine=this.parent?this.parent.machine:this,this.path=this.parent?this.parent.path.concat(this.key):[],this.delimiter=this.config.delimiter||(this.parent?this.parent.delimiter:jt),this.id=this.config.id||D([this.machine.key],C(this.path),!1).join(this.delimiter),this.version=this.parent?this.parent.version:this.config.version,this.type=this.config.type||(this.config.parallel?"parallel":this.config.states&&Object.keys(this.config.states).length?"compound":this.config.history?"history":"atomic"),this.schema=this.parent?this.machine.schema:(a=this.config.schema)!==null&&a!==void 0?a:{},this.description=this.config.description,j||B(!("parallel"in this.config),'The "parallel" property is deprecated and will be removed in version 4.1. '.concat(this.config.parallel?"Replace with `type: 'parallel'`":"Use `type: '".concat(this.type,"'`")," in the config for state node '").concat(this.id,"' instead.")),this.initial=this.config.initial,this.states=this.config.states?Fe(this.config.states,function(f,c){var h,d=new t(f,{},void 0,{parent:s,key:c});return Object.assign(s.idMap,E((h={},h[d.id]=d,h),d.idMap)),d}):He;var o=0;function u(f){var c,h;f.order=o++;try{for(var d=R(Pe(f)),l=d.next();!l.done;l=d.next()){var p=l.value;u(p)}}catch(v){c={error:v}}finally{try{l&&!l.done&&(h=d.return)&&h.call(d)}finally{if(c)throw c.error}}}u(this),this.history=this.config.history===!0?"shallow":this.config.history||!1,this._transient=!!this.config.always||(this.config.on?Array.isArray(this.config.on)?this.config.on.some(function(f){var c=f.event;return c===Je}):Je in this.config.on:!1),this.strict=!!this.config.strict,this.onEntry=ee(this.config.entry||this.config.onEntry).map(function(f){return Ve(f)}),this.onExit=ee(this.config.exit||this.config.onExit).map(function(f){return Ve(f)}),this.meta=this.config.meta,this.doneData=this.type==="final"?this.config.data:void 0,this.invoke=ee(this.config.invoke).map(function(f,c){var h,d;if(de(f)){var l=dt(s.id,c);return s.machine.options.services=E((h={},h[l]=f,h),s.machine.options.services),Et({src:l,id:l})}else if(P(f.src)){var l=f.id||dt(s.id,c);return Et(E(E({},f),{id:l,src:f.src}))}else if(de(f.src)||k(f.src)){var l=f.id||dt(s.id,c);return s.machine.options.services=E((d={},d[l]=f.src,d),s.machine.options.services),Et(E(E({id:l},f),{src:l}))}else{var p=f.src;return Et(E(E({id:dt(s.id,c)},f),{src:p}))}}),this.activities=ee(this.config.activities).concat(this.invoke).map(function(f){return Wt(f)}),this.transition=this.transition.bind(this),this.tags=ee(this.config.tags)}return t.prototype._init=function(){this.__cache.transitions||Gr(this).forEach(function(e){return e.on})},t.prototype.withConfig=function(e,r){var n=this.options,i=n.actions,s=n.activities,a=n.guards,o=n.services,u=n.delays;return new t(this.config,{actions:E(E({},i),e.actions),activities:E(E({},s),e.activities),guards:E(E({},a),e.guards),services:E(E({},o),e.services),delays:E(E({},u),e.delays)},r!=null?r:this.context)},t.prototype.withContext=function(e){return new t(this.config,this.options,e)},Object.defineProperty(t.prototype,"context",{get:function(){return k(this._context)?this._context():this._context},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"definition",{get:function(){return{id:this.id,key:this.key,version:this.version,context:this.context,type:this.type,initial:this.initial,history:this.history,states:Fe(this.states,function(e){return e.definition}),on:this.on,transitions:this.transitions,entry:this.onEntry,exit:this.onExit,activities:this.activities||[],meta:this.meta,order:this.order||-1,data:this.doneData,invoke:this.invoke,description:this.description,tags:this.tags}},enumerable:!1,configurable:!0}),t.prototype.toJSON=function(){return this.definition},Object.defineProperty(t.prototype,"on",{get:function(){if(this.__cache.on)return this.__cache.on;var e=this.transitions;return this.__cache.on=e.reduce(function(r,n){return r[n.eventType]=r[n.eventType]||[],r[n.eventType].push(n),r},{})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"after",{get:function(){return this.__cache.delayedTransitions||(this.__cache.delayedTransitions=this.getDelayedTransitions(),this.__cache.delayedTransitions)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"transitions",{get:function(){return this.__cache.transitions||(this.__cache.transitions=this.formatTransitions(),this.__cache.transitions)},enumerable:!1,configurable:!0}),t.prototype.getCandidates=function(e){if(this.__cache.candidates[e])return this.__cache.candidates[e];var r=e===Je,n=this.transitions.filter(function(i){var s=i.eventType===e;return r?s:s||i.eventType===St});return this.__cache.candidates[e]=n,n},t.prototype.getDelayedTransitions=function(){var e=this,r=this.config.after;if(!r)return[];var n=function(s,a){var o=k(s)?"".concat(e.id,":delay[").concat(a,"]"):s,u=_i(o,e.id);return e.onEntry.push(pt(u,{delay:s})),e.onExit.push(Pi(u)),u},i=ve(r)?r.map(function(s,a){var o=n(s.delay,a);return E(E({},s),{event:o})}):U(Object.keys(r).map(function(s,a){var o=r[s],u=P(o)?{target:o}:o,f=isNaN(+s)?s:+s,c=n(f,a);return ee(u).map(function(h){return E(E({},h),{event:c,delay:f})})}));return i.map(function(s){var a=s.delay;return E(E({},e.formatTransition(s)),{delay:a})})},t.prototype.getStateNodes=function(e){var r,n=this;if(!e)return[];var i=e instanceof se?e.value:Be(e,this.delimiter);if(P(i)){var s=this.getStateNode(i).initial;return s!==void 0?this.getStateNodes((r={},r[i]=s,r)):[this,this.states[i]]}var a=Object.keys(i),o=[this];return o.push.apply(o,D([],C(U(a.map(function(u){return n.getStateNode(u).getStateNodes(i[u])}))),!1)),o},t.prototype.handles=function(e){var r=Bt(e);return this.events.includes(r)},t.prototype.resolveState=function(e){var r=e instanceof se?e:se.create(e),n=Array.from(Ne([],this.getStateNodes(r.value)));return new se(E(E({},r),{value:this.resolve(r.value),configuration:n,done:Ie(n,this),tags:Jr(n),machine:this.machine}))},t.prototype.transitionLeafNode=function(e,r,n){var i=this.getStateNode(e),s=i.next(r,n);return!s||!s.transitions.length?this.next(r,n):s},t.prototype.transitionCompoundNode=function(e,r,n){var i=Object.keys(e),s=this.getStateNode(i[0]),a=s._transition(e[i[0]],r,n);return!a||!a.transitions.length?this.next(r,n):a},t.prototype.transitionParallelNode=function(e,r,n){var i,s,a={};try{for(var o=R(Object.keys(e)),u=o.next();!u.done;u=o.next()){var f=u.value,c=e[f];if(!!c){var h=this.getStateNode(f),d=h._transition(c,r,n);d&&(a[f]=d)}}}catch(g){i={error:g}}finally{try{u&&!u.done&&(s=o.return)&&s.call(o)}finally{if(i)throw i.error}}var l=Object.keys(a).map(function(g){return a[g]}),p=U(l.map(function(g){return g.transitions})),v=l.some(function(g){return g.transitions.length>0});if(!v)return this.next(r,n);var m=U(l.map(function(g){return g.entrySet})),w=U(Object.keys(a).map(function(g){return a[g].configuration}));return{transitions:p,entrySet:m,exitSet:U(l.map(function(g){return g.exitSet})),configuration:w,source:r,actions:U(Object.keys(a).map(function(g){return a[g].actions}))}},t.prototype._transition=function(e,r,n){return P(e)?this.transitionLeafNode(e,r,n):Object.keys(e).length===1?this.transitionCompoundNode(e,r,n):this.transitionParallelNode(e,r,n)},t.prototype.getTransitionData=function(e,r){return this._transition(e.value,e,F(r))},t.prototype.next=function(e,r){var n,i,s=this,a=r.name,o=[],u=[],f;try{for(var c=R(this.getCandidates(a)),h=c.next();!h.done;h=c.next()){var d=h.value,l=d.cond,p=d.in,v=e.context,m=p?P(p)&&Ge(p)?e.matches(Be(this.getStateNodeById(p).path,this.delimiter)):ut(Be(p,this.delimiter),yi(this.path.slice(0,-2))(e.value)):!0,w=!1;try{w=!l||Gt(this.machine,l,v,r,e)}catch(N){throw new Error("Unable to evaluate guard '".concat(l.name||l.type,"' in transition for event '").concat(a,"' in state node '").concat(this.id,`':
|
|
31
|
+
`).concat(N.message))}if(w&&m){d.target!==void 0&&(u=d.target),o.push.apply(o,D([],C(d.actions),!1)),f=d;break}}}catch(N){n={error:N}}finally{try{h&&!h.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}if(!!f){if(!u.length)return{transitions:[f],entrySet:[],exitSet:[],configuration:e.value?[this]:[],source:e,actions:o};var g=U(u.map(function(N){return s.getRelativeStateNodes(N,e.historyValue)})),T=!!f.internal,O=T?[]:U(g.map(function(N){return s.nodesFromChild(N)}));return{transitions:[f],entrySet:O,exitSet:T?[]:[this],configuration:g,source:e,actions:o}}},t.prototype.nodesFromChild=function(e){if(e.escapes(this))return[];for(var r=[],n=e;n&&n!==this;)r.push(n),n=n.parent;return r.push(this),r},t.prototype.escapes=function(e){if(this===e)return!1;for(var r=this.parent;r;){if(r===e)return!1;r=r.parent}return!0},t.prototype.getActions=function(e,r,n,i){var s,a,o,u,f=Ne([],i?this.getStateNodes(i.value):[this]),c=e.configuration.length?Ne(f,e.configuration):f;try{for(var h=R(c),d=h.next();!d.done;d=h.next()){var l=d.value;yt(f,l)||e.entrySet.push(l)}}catch(A){s={error:A}}finally{try{d&&!d.done&&(a=h.return)&&a.call(h)}finally{if(s)throw s.error}}try{for(var p=R(f),v=p.next();!v.done;v=p.next()){var l=v.value;(!yt(c,l)||yt(e.exitSet,l.parent))&&e.exitSet.push(l)}}catch(A){o={error:A}}finally{try{v&&!v.done&&(u=p.return)&&u.call(p)}finally{if(o)throw o.error}}var m=U(e.entrySet.map(function(A){var x=[];if(A.type!=="final")return x;var b=A.parent;if(!b.parent)return x;x.push(vt(A.id,A.doneData),vt(b.id,A.doneData?Te(A.doneData,r,n):void 0));var q=b.parent;return q.type==="parallel"&&Pe(q).every(function(V){return Ie(e.configuration,V)})&&x.push(vt(q.id)),x}));e.exitSet.sort(function(A,x){return x.order-A.order}),e.entrySet.sort(function(A,x){return A.order-x.order});var w=new Set(e.entrySet),g=new Set(e.exitSet),T=C([U(Array.from(w).map(function(A){return D(D([],C(A.activities.map(function(x){return Ni(x)})),!1),C(A.onEntry),!1)})).concat(m.map(Ci)),U(Array.from(g).map(function(A){return D(D([],C(A.onExit),!1),C(A.activities.map(function(x){return Ii(x)})),!1)}))],2),O=T[0],N=T[1],M=ht(N.concat(e.actions).concat(O),this.machine.options.actions);return M},t.prototype.transition=function(e,r,n){e===void 0&&(e=this.initialState);var i=F(r),s;if(e instanceof se)s=n===void 0?e:this.resolveState(se.from(e,n));else{var a=P(e)?this.resolve(ot(this.getResolvedPath(e))):this.resolve(e),o=n!=null?n:this.machine.context;s=this.resolveState(se.from(a,o))}if(!j&&i.name===St)throw new Error("An event cannot have the wildcard type ('".concat(St,"')"));if(this.strict&&!this.events.includes(i.name)&&!Si(i.name))throw new Error("Machine '".concat(this.id,"' does not accept event '").concat(i.name,"'"));var u=this._transition(s.value,s,i)||{transitions:[],configuration:[],entrySet:[],exitSet:[],source:s,actions:[]},f=Ne([],this.getStateNodes(s.value)),c=u.configuration.length?Ne(f,u.configuration):f;return u.configuration=D([],C(c),!1),this.resolveTransition(u,s,s.context,i)},t.prototype.resolveRaisedTransition=function(e,r,n){var i,s=e.actions;return e=this.transition(e,r),e._event=n,e.event=n.data,(i=e.actions).unshift.apply(i,D([],C(s),!1)),e},t.prototype.resolveTransition=function(e,r,n,i){var s,a,o=this;i===void 0&&(i=be);var u=e.configuration,f=!r||e.transitions.length>0,c=f?Fi(this.machine,u):void 0,h=r?r.historyValue?r.historyValue:e.source?this.machine.historyValue(r.value):void 0:void 0,d=this.getActions(e,n,i,r),l=r?E({},r.activities):{};try{for(var p=R(d),v=p.next();!v.done;v=p.next()){var m=v.value;m.type===it?l[m.activity.id||m.activity.type]=m:m.type===Me&&(l[m.activity.id||m.activity.type]=!1)}}catch(Z){s={error:Z}}finally{try{v&&!v.done&&(a=p.return)&&a.call(p)}finally{if(s)throw s.error}}var w=C(zt(this,r,n,i,d,this.machine.config.preserveActionOrder),2),g=w[0],T=w[1],O=C(Vt(g,function(Z){return Z.type===Le||Z.type===xe&&Z.to===Ee.Internal}),2),N=O[0],M=O[1],A=g.filter(function(Z){var Ue;return Z.type===it&&((Ue=Z.activity)===null||Ue===void 0?void 0:Ue.type)===st}),x=A.reduce(function(Z,Ue){return Z[Ue.activity.id]=Ui(Ue.activity,o.machine,T,i),Z},r?E({},r.children):{}),b=f?e.configuration:r?r.configuration:[],q=Ie(b,this),V=new se({value:c||r.value,context:T,_event:i,_sessionid:r?r._sessionid:null,historyValue:c?h?Ti(h,c):void 0:r?r.historyValue:void 0,history:!c||e.source?r:void 0,actions:c?M:[],activities:c?l:r?r.activities:{},events:[],configuration:b,transitions:e.transitions,children:x,done:q,tags:Jr(b),machine:this}),Q=n!==T;V.changed=i.name===at||Q;var ge=V.history;ge&&delete ge.history;var kt=!q&&(this._transient||u.some(function(Z){return Z._transient}));if(!f&&(!kt||i.name===Je))return V;var ie=V;if(!q)for(kt&&(ie=this.resolveRaisedTransition(ie,{type:di},i));N.length;){var tc=N.shift();ie=this.resolveRaisedTransition(ie,tc._event,i)}var rc=ie.changed||(ge?!!ie.actions.length||Q||typeof ge.value!=typeof ie.value||!$r(ie.value,ge.value):void 0);return ie.changed=rc,ie.history=ge,ie},t.prototype.getStateNode=function(e){if(Ge(e))return this.machine.getStateNodeById(e);if(!this.states)throw new Error("Unable to retrieve child state '".concat(e,"' from '").concat(this.id,"'; no child states exist."));var r=this.states[e];if(!r)throw new Error("Child state '".concat(e,"' does not exist on '").concat(this.id,"'"));return r},t.prototype.getStateNodeById=function(e){var r=Ge(e)?e.slice(Kr.length):e;if(r===this.id)return this;var n=this.machine.idMap[r];if(!n)throw new Error("Child state node '#".concat(r,"' does not exist on machine '").concat(this.id,"'"));return n},t.prototype.getStateNodeByPath=function(e){if(typeof e=="string"&&Ge(e))try{return this.getStateNodeById(e.slice(1))}catch{}for(var r=Ft(e,this.delimiter).slice(),n=this;r.length;){var i=r.shift();if(!i.length)break;n=n.getStateNode(i)}return n},t.prototype.resolve=function(e){var r,n=this;if(!e)return this.initialStateValue||He;switch(this.type){case"parallel":return Fe(this.initialStateValue,function(s,a){return s?n.getStateNode(a).resolve(e[a]||s):He});case"compound":if(P(e)){var i=this.getStateNode(e);return i.type==="parallel"||i.type==="compound"?(r={},r[e]=i.initialStateValue,r):e}return Object.keys(e).length?Fe(e,function(s,a){return s?n.getStateNode(a).resolve(s):He}):this.initialStateValue||{};default:return e||He}},t.prototype.getResolvedPath=function(e){if(Ge(e)){var r=this.machine.idMap[e.slice(Kr.length)];if(!r)throw new Error("Unable to find state node '".concat(e,"'"));return r.path}return Ft(e,this.delimiter)},Object.defineProperty(t.prototype,"initialStateValue",{get:function(){var e;if(this.__cache.initialStateValue)return this.__cache.initialStateValue;var r;if(this.type==="parallel")r=Br(this.states,function(n){return n.initialStateValue||He},function(n){return n.type!=="history"});else if(this.initial!==void 0){if(!this.states[this.initial])throw new Error("Initial state '".concat(this.initial,"' not found on '").concat(this.key,"'"));r=mt(this.states[this.initial])?this.initial:(e={},e[this.initial]=this.states[this.initial].initialStateValue,e)}else r={};return this.__cache.initialStateValue=r,this.__cache.initialStateValue},enumerable:!1,configurable:!0}),t.prototype.getInitialState=function(e,r){this._init();var n=this.getStateNodes(e);return this.resolveTransition({configuration:n,entrySet:n,exitSet:[],transitions:[],source:void 0,actions:[]},void 0,r!=null?r:this.machine.context,void 0)},Object.defineProperty(t.prototype,"initialState",{get:function(){var e=this.initialStateValue;if(!e)throw new Error("Cannot retrieve initial state from simple state '".concat(this.id,"'."));return this.getInitialState(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"target",{get:function(){var e;if(this.type==="history"){var r=this.config;P(r.target)?e=Ge(r.target)?ot(this.machine.getStateNodeById(r.target).path.slice(this.path.length-1)):r.target:e=r.target}return e},enumerable:!1,configurable:!0}),t.prototype.getRelativeStateNodes=function(e,r,n){return n===void 0&&(n=!0),n?e.type==="history"?e.resolveHistory(r):e.initialStateNodes:[e]},Object.defineProperty(t.prototype,"initialStateNodes",{get:function(){var e=this;if(mt(this))return[this];if(this.type==="compound"&&!this.initial)return j||B(!1,"Compound state node '".concat(this.id,"' has no initial state.")),[this];var r=ct(this.initialStateValue);return U(r.map(function(n){return e.getFromRelativePath(n)}))},enumerable:!1,configurable:!0}),t.prototype.getFromRelativePath=function(e){if(!e.length)return[this];var r=C(e),n=r[0],i=r.slice(1);if(!this.states)throw new Error("Cannot retrieve subPath '".concat(n,"' from node with no states"));var s=this.getStateNode(n);if(s.type==="history")return s.resolveHistory();if(!this.states[n])throw new Error("Child state '".concat(n,"' does not exist on '").concat(this.id,"'"));return this.states[n].getFromRelativePath(i)},t.prototype.historyValue=function(e){if(!!Object.keys(this.states).length)return{current:e||this.initialStateValue,states:Br(this.states,function(r,n){if(!e)return r.historyValue();var i=P(e)?void 0:e[n];return r.historyValue(i||r.initialStateValue)},function(r){return!r.history})}},t.prototype.resolveHistory=function(e){var r=this;if(this.type!=="history")return[this];var n=this.parent;if(!e){var i=this.target;return i?U(ct(i).map(function(a){return n.getFromRelativePath(a)})):n.initialStateNodes}var s=gi(n.path,"states")(e).current;return P(s)?[n.getStateNode(s)]:U(ct(s).map(function(a){return r.history==="deep"?n.getFromRelativePath(a):[n.states[a[0]]]}))},Object.defineProperty(t.prototype,"stateIds",{get:function(){var e=this,r=U(Object.keys(this.states).map(function(n){return e.states[n].stateIds}));return[this.id].concat(r)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"events",{get:function(){var e,r,n,i;if(this.__cache.events)return this.__cache.events;var s=this.states,a=new Set(this.ownEvents);if(s)try{for(var o=R(Object.keys(s)),u=o.next();!u.done;u=o.next()){var f=u.value,c=s[f];if(c.states)try{for(var h=(n=void 0,R(c.events)),d=h.next();!d.done;d=h.next()){var l=d.value;a.add("".concat(l))}}catch(p){n={error:p}}finally{try{d&&!d.done&&(i=h.return)&&i.call(h)}finally{if(n)throw n.error}}}}catch(p){e={error:p}}finally{try{u&&!u.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}return this.__cache.events=Array.from(a)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ownEvents",{get:function(){var e=new Set(this.transitions.filter(function(r){return!(!r.target&&!r.actions.length&&r.internal)}).map(function(r){return r.eventType}));return Array.from(e)},enumerable:!1,configurable:!0}),t.prototype.resolveTarget=function(e){var r=this;if(e!==void 0)return e.map(function(n){if(!P(n))return n;var i=n[0]===r.delimiter;if(i&&!r.parent)return r.getStateNodeByPath(n.slice(1));var s=i?r.key+n:n;if(r.parent)try{var a=r.parent.getStateNodeByPath(s);return a}catch(o){throw new Error("Invalid transition definition for state node '".concat(r.id,`':
|
|
32
|
+
`).concat(o.message))}else return r.getStateNodeByPath(s)})},t.prototype.formatTransition=function(e){var r=this,n=Ri(e.target),i="internal"in e?e.internal:n?n.some(function(u){return P(u)&&u[0]===r.delimiter}):!0,s=this.machine.options.guards,a=this.resolveTarget(n),o=E(E({},e),{actions:ht(ee(e.actions)),cond:Ht(e.cond,s),target:a,source:this,internal:i,eventType:e.event,toJSON:function(){return E(E({},o),{target:o.target?o.target.map(function(u){return"#".concat(u.id)}):void 0,source:"#".concat(r.id)})}});return o},t.prototype.formatTransitions=function(){var e,r,n=this,i;if(!this.config.on)i=[];else if(Array.isArray(this.config.on))i=this.config.on;else{var s=this.config.on,a=St,o=s[a],u=o===void 0?[]:o,f=je(s,[typeof a=="symbol"?a:a+""]);i=U(Object.keys(f).map(function(g){!j&&g===Je&&B(!1,"Empty string transition configs (e.g., `{ on: { '': ... }}`) for transient transitions are deprecated. Specify the transition in the `{ always: ... }` property instead. "+'Please check the `on` configuration for "#'.concat(n.id,'".'));var T=Ae(g,f[g]);return j||Tc(n,g,T),T}).concat(Ae(St,u)))}var c=this.config.always?Ae("",this.config.always):[],h=this.config.onDone?Ae(String(vt(this.id)),this.config.onDone):[];j||B(!(this.config.onDone&&!this.parent),'Root nodes cannot have an ".onDone" transition. Please check the config of "'.concat(this.id,'".'));var d=U(this.invoke.map(function(g){var T=[];return g.onDone&&T.push.apply(T,D([],C(Ae(String(Re(g.id)),g.onDone)),!1)),g.onError&&T.push.apply(T,D([],C(Ae(String(Oe(g.id)),g.onError)),!1)),T})),l=this.after,p=U(D(D(D(D([],C(h),!1),C(d),!1),C(i),!1),C(c),!1).map(function(g){return ee(g).map(function(T){return n.formatTransition(T)})}));try{for(var v=R(l),m=v.next();!m.done;m=v.next()){var w=m.value;p.push(w)}}catch(g){e={error:g}}finally{try{m&&!m.done&&(r=v.return)&&r.call(v)}finally{if(e)throw e.error}}return p},t}();function ae(t,e){return new Ki(t,e)}var _=ki,z=pt;var Xt="nhostRefreshToken",wt="nhostRefreshTokenExpiresAt";var ke={status:10,error:"invalid-email",message:"Email is incorrectly formatted"};var xt={status:10,error:"invalid-password",message:"Password is incorrectly formatted"},Xi={status:10,error:"invalid-phone-number",message:"Phone number is incorrectly formatted"},Yi={status:10,error:"no-mfa-ticket",message:"No MFA ticket has been provided"},Qi={status:10,error:"no-refresh-token",message:"No refresh token has been provided"},Zi={status:20,error:"refresher-already-running",message:"The token refresher is already running. You must wait until is has finished before submitting a new token."};var oa=nt(aa());var oe=t=>{let e=oa.default.create({baseURL:t});return e.interceptors.response.use(r=>r,r=>{var n,i,s,a,o,u,f,c,h,d;return Promise.reject({error:{message:(o=(a=(s=(i=(n=r.response)==null?void 0:n.data)==null?void 0:i.message)!=null?s:r.message)!=null?a:r.request.responseText)!=null?o:JSON.stringify(r),status:(h=(c=(u=r.response)==null?void 0:u.status)!=null?c:(f=r.response)==null?void 0:f.data.statusCode)!=null?h:0,error:((d=r.response)==null?void 0:d.data.error)||r.request.statusText||"network"}})}),e};function ir(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)t[n]=r[n]}return t}var gl={read:function(t){return t[0]==='"'&&(t=t.slice(1,-1)),t.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(t){return encodeURIComponent(t).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function mn(t,e){function r(i,s,a){if(typeof document!="undefined"){a=ir({},e,a),typeof a.expires=="number"&&(a.expires=new Date(Date.now()+a.expires*864e5)),a.expires&&(a.expires=a.expires.toUTCString()),i=encodeURIComponent(i).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var o="";for(var u in a)!a[u]||(o+="; "+u,a[u]!==!0&&(o+="="+a[u].split(";")[0]));return document.cookie=i+"="+t.write(s,i)+o}}function n(i){if(!(typeof document=="undefined"||arguments.length&&!i)){for(var s=document.cookie?document.cookie.split("; "):[],a={},o=0;o<s.length;o++){var u=s[o].split("="),f=u.slice(1).join("=");try{var c=decodeURIComponent(u[0]);if(a[c]=t.read(f,c),i===c)break}catch{}}return i?a[i]:a}}return Object.create({set:r,get:n,remove:function(i,s){r(i,"",ir({},s,{expires:-1}))},withAttributes:function(i){return mn(this.converter,ir({},this.attributes,i))},withConverter:function(i){return mn(ir({},this.converter,i),this.attributes)}},{attributes:{value:Object.freeze(e)},converter:{value:Object.freeze(t)}})}var El=mn(gl,{path:"/"}),sr=El;var or=typeof window!="undefined",ar=new Map,Sl=t=>{var e;return or&&typeof localStorage!="undefined"?localStorage.getItem(t):(e=ar.get(t))!=null?e:null},wl=(t,e)=>{or&&typeof localStorage!="undefined"?e?localStorage.setItem(t,e):localStorage.removeItem(t):e?ar.set(t,e):ar.has(t)&&ar.delete(t)};var ua=(t,e)=>{if(!e||t==="localStorage"||t==="web")return Sl;if(t==="react-native")return r=>{var n;return(n=e.getItem)==null?void 0:n.call(e,r)};if(t==="capacitor")return r=>{var n;return(n=e.get)==null?void 0:n.call(e,{key:r})};if(t==="expo-secure-storage")return r=>{var n;return(n=e.getItemAsync)==null?void 0:n.call(e,r)};if(t==="cookie")return r=>{var n;return or&&(n=sr.get(r))!=null?n:null};if(t==="custom"){if(e.getItem&&e.removeItem)return e.getItem;if(e.getItemAsync)return e.getItemAsync;throw Error("clientStorageType is set to 'custom' but clientStorage is missing getItem or getItemAsync property")}throw Error(`Unknown storage type: ${t}`)},ca=(t,e)=>{if(!e||t==="localStorage"||t==="web")return wl;if(t==="react-native")return(r,n)=>{var i,s;return n?(i=e.setItem)==null?void 0:i.call(e,r,n):(s=e.removeItem)==null?void 0:s.call(e,r)};if(t==="capacitor")return(r,n)=>{var i,s;return n?(i=e.set)==null?void 0:i.call(e,{key:r,value:n}):(s=e.remove)==null?void 0:s.call(e,{key:r})};if(t==="expo-secure-storage")return async(r,n)=>{var i,s;return n?(i=e.setItemAsync)==null?void 0:i.call(e,r,n):(s=e.deleteItemAsync)==null?void 0:s.call(e,r)};if(t==="cookie")return(r,n)=>{or&&(n?sr.set(r,n):sr.remove(r))};if(t==="custom"){if(!e.removeItem)throw Error("clientStorageType is set to 'custom' but clientStorage is missing a removeItem property");if(e.setItem)return(r,n)=>{var i,s;return n?(i=e.setItem)==null?void 0:i.call(e,r,n):(s=e.removeItem)==null?void 0:s.call(e,r)};if(e.setItemAsync)return async(r,n)=>{var i,s;return n?(i=e.setItemAsync)==null?void 0:i.call(e,r,n):(s=e.removeItem)==null?void 0:s.call(e,r)};throw Error("clientStorageType is set to 'custom' but clientStorage is missing setItem or setItemAsync property")}throw Error(`Unknown storage type: ${t}`)};var la=(t,e)=>{let r=e&&Object.entries(e).map(([n,i])=>{let s=Array.isArray(i)?i.join(","):typeof i=="object"?JSON.stringify(i):i;return`${n}=${encodeURIComponent(s)}`}).join("&");return r?`${t}?${r}`:t},ne=(t,e)=>{var r;return e!=null&&e.redirectTo?{...e,redirectTo:(r=e==null?void 0:e.redirectTo)!=null&&r.startsWith("/")?t+e.redirectTo:e==null?void 0:e.redirectTo}:e};function Rt(t,e){var i;if(!e){if(typeof window=="undefined")return;e=((i=window.location)==null?void 0:i.href)||""}t=t.replace(/[\[\]]/g,"\\$&");let r=new RegExp("[?&#]"+t+"(=([^&#]*)|&|#|$)"),n=r.exec(e);return n?n[2]?decodeURIComponent(n[2].replace(/\+/g," ")):"":null}function yn(t){var r;if(typeof window=="undefined")return;let e=window==null?void 0:window.location;if(!!e&&e){let n=new URLSearchParams(e.search),i=new URLSearchParams((r=e.hash)==null?void 0:r.slice(1));n.delete(t),i.delete(t);let s=window.location.pathname;Array.from(n).length&&(s+=`?${n.toString()}`),Array.from(i).length&&(s+=`#${i.toString()}`),window.history.pushState({},"",s)}}var Ke=t=>!!t&&typeof t=="string"&&!!String(t).toLowerCase().match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/),ur=t=>!!t&&typeof t=="string"&&t.length>=3,fa=t=>!!t&&typeof t=="string";var gn={user:null,mfa:null,accessToken:{value:null,expiresAt:null},refreshTimer:{startedAt:null,attempts:0,lastAttempt:null},refreshToken:{value:null},errors:{}};var da=({backendUrl:t,clientUrl:e,interpreter:r})=>{let n=oe(t);return ae({schema:{context:{},events:{}},tsTypes:{},preserveActionOrder:!0,id:"changeEmail",initial:"idle",context:{error:null},states:{idle:{on:{REQUEST:[{cond:"invalidEmail",actions:"saveInvalidEmailError",target:".error"},{target:"requesting"}]},initial:"initial",states:{initial:{},success:{},error:{}}},requesting:{invoke:{src:"requestChange",id:"requestChange",onDone:{target:"idle.success",actions:"reportSuccess"},onError:{actions:["saveRequestError","reportError"],target:"idle.error"}}}}},{actions:{saveInvalidEmailError:_({error:i=>ke}),saveRequestError:_({error:(i,{data:{error:s}})=>s}),reportError:z(i=>({type:"ERROR",error:i.error})),reportSuccess:z("SUCCESS")},guards:{invalidEmail:(i,{email:s})=>!Ke(s)},services:{requestChange:async(i,{email:s,options:a})=>(await n.post("/user/email/change",{newEmail:s,options:ne(e,a)},{headers:{authorization:`Bearer ${r==null?void 0:r.state.context.accessToken.value}`}})).data}})};var ha=({backendUrl:t,interpreter:e})=>{let r=oe(t);return ae({schema:{context:{},events:{}},tsTypes:{},preserveActionOrder:!0,id:"changePassword",initial:"idle",context:{error:null},states:{idle:{on:{REQUEST:[{cond:"invalidPassword",actions:"saveInvalidPasswordError",target:".error"},{target:"requesting"}]},initial:"initial",states:{initial:{},success:{},error:{}}},requesting:{invoke:{src:"requestChange",id:"requestChange",onDone:{target:"idle.success",actions:"reportSuccess"},onError:{actions:["saveRequestError","reportError"],target:"idle.error"}}}}},{actions:{saveInvalidPasswordError:_({error:n=>xt}),saveRequestError:_({error:(n,{data:{error:i}})=>(console.log(i),i)}),reportError:z(n=>({type:"ERROR",error:n.error})),reportSuccess:z("SUCCESS")},guards:{invalidPassword:(n,{password:i})=>!ur(i)},services:{requestChange:(n,{password:i})=>r.post("/user/password",{newPassword:i},{headers:{authorization:`Bearer ${e==null?void 0:e.state.context.accessToken.value}`}})}})};var pa=({backendUrl:t,clientUrl:e})=>{let r=oe(t);return ae({schema:{context:{},events:{}},tsTypes:{},preserveActionOrder:!0,id:"changePassword",initial:"idle",context:{error:null},states:{idle:{on:{REQUEST:"requesting"},initial:"initial",states:{initial:{},success:{},error:{}}},requesting:{invoke:{src:"requestChange",id:"requestChange",onDone:{target:"idle.success",actions:"reportSuccess"},onError:{actions:["saveRequestError","reportError"],target:"idle.error"}}}}},{actions:{saveRequestError:_({error:(n,{data:{error:i}})=>(console.log(i),i)}),reportError:z(n=>({type:"ERROR",error:n.error})),reportSuccess:z("SUCCESS")},services:{requestChange:(n,{email:i,options:s})=>r.post("/user/password/reset",{email:i,options:ne(e,s)})}})};var va=({backendUrl:t,clientUrl:e,interpreter:r})=>{let n=oe(t);return ae({schema:{context:{},events:{}},tsTypes:{},preserveActionOrder:!0,id:"sendVerificationEmail",initial:"idle",context:{error:null},states:{idle:{on:{REQUEST:[{cond:"invalidEmail",actions:"saveInvalidEmailError",target:".error"},{target:"requesting"}]},initial:"initial",states:{initial:{},success:{},error:{}}},requesting:{invoke:{src:"request",id:"request",onDone:{target:"idle.success",actions:"reportSuccess"},onError:{actions:["saveRequestError","reportError"],target:"idle.error"}}}}},{actions:{saveInvalidEmailError:_({error:i=>ke}),saveRequestError:_({error:(i,{data:{error:s}})=>s}),reportError:z(i=>({type:"ERROR",error:i.error})),reportSuccess:z("SUCCESS")},guards:{invalidEmail:(i,{email:s})=>!Ke(s)},services:{request:async(i,{email:s,options:a})=>(await n.post("/user/email/send-verification-email",{email:s,options:ne(e,a)})).data}})};var ma=({backendUrl:t,clientUrl:e,clientStorageGetter:r,clientStorageSetter:n,clientStorageType:i="web",clientStorage:s,refreshIntervalTime:a,autoRefreshToken:o=!0,autoSignIn:u=!0})=>{let f=r||ua(i,s),c=n||ca(i,s),h=oe(t),d=async(l,p,v)=>(await h.post(l,p,v)).data;return ae({schema:{context:{},events:{}},tsTypes:{},context:gn,preserveActionOrder:!0,id:"nhost",type:"parallel",states:{authentication:{initial:"importingRefreshToken",on:{SESSION_UPDATE:[{cond:"hasSession",actions:["saveSession","persist","resetTimer","reportTokenChanged"],target:".signedIn"}]},states:{importingRefreshToken:{always:{cond:"isSignedIn",target:"signedIn"},invoke:{id:"importRefreshToken",src:"importRefreshToken",onDone:{actions:"saveRefreshToken",target:"starting"},onError:{actions:["saveAuthenticationError"],target:"signedOut"}}},starting:{always:[{cond:"hasRefreshTokenWithoutSession",target:"authenticating.token"},{cond:"hasAuthenticationError",target:"signedOut.failed"},"signedOut"]},signedOut:{tags:["ready"],initial:"noErrors",entry:"reportSignedOut",states:{noErrors:{},success:{},needsEmailVerification:{},needsSmsOtp:{},needsMfa:{},failed:{exit:"resetAuthenticationError",initial:"server",states:{server:{},validation:{states:{password:{},email:{},phoneNumber:{}}}}},signingOut:{entry:["clearContextExceptRefreshToken"],exit:["destroyRefreshToken","reportTokenChanged"],invoke:{src:"signout",id:"signingOut",onDone:{target:"success"},onError:{target:"failed.server"}}}},on:{SIGNIN_PASSWORD:[{cond:"invalidEmail",actions:["saveInvalidEmail"],target:".failed.validation.email"},{cond:"invalidPassword",actions:["saveInvalidPassword"],target:".failed.validation.password"},"#nhost.authentication.authenticating.password"],SIGNIN_PASSWORDLESS_EMAIL:[{cond:"invalidEmail",actions:"saveInvalidEmail",target:".failed.validation.email"},"#nhost.authentication.authenticating.passwordlessEmail"],SIGNIN_PASSWORDLESS_SMS:[{cond:"invalidPhoneNumber",actions:"saveInvalidPhoneNumber",target:".failed.validation.phoneNumber"},"#nhost.authentication.authenticating.passwordlessSms"],SIGNIN_PASSWORDLESS_SMS_OTP:[{cond:"invalidPhoneNumber",actions:"saveInvalidPhoneNumber",target:".failed.validation.phoneNumber"},"#nhost.authentication.authenticating.passwordlessSmsOtp"],SIGNUP_EMAIL_PASSWORD:[{cond:"invalidEmail",actions:"saveInvalidSignUpEmail",target:".failed.validation.email"},{cond:"invalidPassword",actions:"saveInvalidSignUpPassword",target:".failed.validation.password"},"#nhost.authentication.registering"],SIGNIN_ANONYMOUS:"#nhost.authentication.authenticating.anonymous",SIGNIN_MFA_TOTP:[{cond:"noMfaTicket",actions:["saveNoMfaTicketError"],target:".failed"},"#nhost.authentication.authenticating.mfa.totp"]}},authenticating:{states:{passwordlessEmail:{invoke:{src:"signInPasswordlessEmail",id:"authenticatePasswordlessEmail",onDone:"#nhost.authentication.signedOut.needsEmailVerification",onError:{actions:"saveAuthenticationError",target:"#nhost.authentication.signedOut.failed.server"}}},passwordlessSms:{invoke:{src:"signInPasswordlessSms",id:"authenticatePasswordlessSms",onDone:"#nhost.authentication.signedOut.needsSmsOtp",onError:{actions:"saveAuthenticationError",target:"#nhost.authentication.signedOut.failed.server"}}},passwordlessSmsOtp:{invoke:{src:"signInPasswordlessSmsOtp",id:"authenticatePasswordlessSmsOtp",onDone:{actions:["saveSession","persist","reportTokenChanged"],target:"#nhost.authentication.signedIn"},onError:{actions:"saveAuthenticationError",target:"#nhost.authentication.signedOut.failed.server"}}},password:{invoke:{src:"signInPassword",id:"authenticateUserWithPassword",onDone:[{cond:"hasMfaTicket",actions:["saveMfaTicket"],target:"#nhost.authentication.signedOut.needsMfa"},{actions:["saveSession","persist","reportTokenChanged"],target:"#nhost.authentication.signedIn"}],onError:[{cond:"unverified",target:"#nhost.authentication.signedOut.needsEmailVerification"},{actions:"saveAuthenticationError",target:"#nhost.authentication.signedOut.failed.server"}]}},token:{invoke:{src:"refreshToken",id:"signInToken",onDone:{actions:["saveSession","persist","reportTokenChanged","broadcastToken"],target:"#nhost.authentication.signedIn"},onError:{actions:"saveAuthenticationError",target:"#nhost.authentication.signedOut.failed.server"}}},anonymous:{invoke:{src:"signInAnonymous",id:"authenticateAnonymously",onDone:{actions:["saveSession","persist","reportTokenChanged"],target:"#nhost.authentication.signedIn"},onError:{actions:"saveAuthenticationError",target:"#nhost.authentication.signedOut.failed.server"}}},mfa:{states:{totp:{invoke:{src:"signInMfaTotp",id:"signInMfaTotp",onDone:{actions:["saveSession","persist","reportTokenChanged"],target:"#nhost.authentication.signedIn"},onError:{actions:["saveAuthenticationError"],target:"#nhost.authentication.signedOut.failed.server"}}}}}}},registering:{entry:"resetSignUpError",invoke:{src:"registerUser",id:"registerUser",onDone:[{cond:"hasSession",target:"#nhost.authentication.signedIn",actions:["saveSession","persist","reportTokenChanged"]},{target:"#nhost.authentication.signedOut.needsEmailVerification"}],onError:[{cond:"unverified",target:"#nhost.authentication.signedOut.needsEmailVerification"},{actions:"saveRegisrationError",target:"#nhost.authentication.signedOut.failed.server"}]}},signedIn:{tags:["ready"],type:"parallel",entry:["reportSignedIn","cleanUrl"],on:{SIGNOUT:"#nhost.authentication.signedOut.signingOut",DEANONYMIZE:{target:".deanonymizing"}},states:{refreshTimer:{id:"timer",initial:"idle",states:{disabled:{type:"final"},stopped:{always:{cond:"noToken",target:"idle"}},idle:{always:[{cond:"isAutoRefreshDisabled",target:"disabled"},{cond:"hasRefreshToken",target:"running"}]},running:{initial:"pending",entry:"resetTimer",states:{pending:{after:{"1000":{internal:!1,target:"pending"}},always:{cond:"refreshTimerShouldRefresh",target:"refreshing"}},refreshing:{invoke:{src:"refreshToken",id:"refreshToken",onDone:{actions:["saveSession","persist","resetTimer","reportTokenChanged"],target:"pending"},onError:[{actions:"saveRefreshAttempt",target:"pending"}]}}}}}},deanonymizing:{initial:"error",states:{error:{},success:{}}}}}}},token:{initial:"idle",states:{idle:{on:{TRY_TOKEN:"running"},initial:"noErrors",states:{noErrors:{},error:{}}},running:{invoke:{src:"refreshToken",id:"authenticateWithToken",onDone:{actions:["saveSession","persist","reportTokenChanged"],target:["#nhost.authentication.signedIn","idle.noErrors"]},onError:[{cond:"isSignedIn",target:"idle.error"},{target:["#nhost.authentication.signedOut","idle.error"]}]}}}}}},{actions:{reportSignedIn:z("SIGNED_IN"),reportSignedOut:z("SIGNED_OUT"),reportTokenChanged:z("TOKEN_CHANGED"),clearContextExceptRefreshToken:_(({refreshToken:{value:l}})=>(c(wt,null),{...gn,refreshToken:{value:l}})),saveSession:_({user:(l,p)=>{var v,m;return(m=(v=p.data)==null?void 0:v.session)==null?void 0:m.user},accessToken:(l,p)=>{var v,m,w,g;return{value:(m=(v=p.data)==null?void 0:v.session)==null?void 0:m.accessToken,expiresAt:new Date(Date.now()+((g=(w=p.data)==null?void 0:w.session)==null?void 0:g.accessTokenExpiresIn)*1e3)}},refreshToken:(l,p)=>{var v,m;return{value:(m=(v=p.data)==null?void 0:v.session)==null?void 0:m.refreshToken}}}),saveMfaTicket:_({mfa:(l,p)=>{var v,m;return(m=(v=p.data)==null?void 0:v.mfa)!=null?m:null}}),resetTimer:_({refreshTimer:(l,p)=>({startedAt:new Date,attempts:0,lastAttempt:null})}),saveRefreshAttempt:_({refreshTimer:(l,p)=>({startedAt:l.refreshTimer.startedAt,attempts:l.refreshTimer.attempts+1,lastAttempt:new Date})}),saveAuthenticationError:_({errors:({errors:l},{data:{error:p}})=>({...l,authentication:p})}),resetAuthenticationError:_({errors:({errors:{authentication:l,...p}})=>p}),saveInvalidEmail:_({errors:({errors:l})=>({...l,authentication:ke})}),saveInvalidPassword:_({errors:({errors:l})=>({...l,authentication:xt})}),saveInvalidPhoneNumber:_({errors:({errors:l})=>({...l,authentication:Xi})}),saveRegisrationError:_({errors:({errors:l},{data:{error:p}})=>({...l,registration:p})}),resetSignUpError:_({errors:({errors:{registration:l,...p}})=>p}),saveInvalidSignUpPassword:_({errors:({errors:l})=>({...l,registration:xt})}),saveInvalidSignUpEmail:_({errors:({errors:l})=>({...l,registration:ke})}),saveNoMfaTicketError:_({errors:({errors:l})=>({...l,registration:Yi})}),saveRefreshToken:_({accessToken:(l,p)=>({...l.accessToken,expiresAt:p.data.expiresAt}),refreshToken:(l,p)=>({...l.refreshToken,value:p.data.refreshToken})}),persist:(l,{data:p})=>{if(c(Xt,p.session.refreshToken),p.session.accessTokenExpiresIn){let v=new Date(Date.now()+p.session.accessTokenExpiresIn*1e3).toISOString();c(wt,v)}else c(wt,null)},destroyRefreshToken:_({refreshToken:l=>(c(Xt,null),{value:null})}),cleanUrl:()=>{u&&Rt("refreshToken")&&(yn("refreshToken"),yn("type"))},broadcastToken:l=>{if(u)try{new BroadcastChannel("nhost").postMessage(l.refreshToken.value)}catch{}}},guards:{isSignedIn:l=>!!l.user&&!!l.refreshToken.value&&!!l.accessToken.value,hasRefreshTokenWithoutSession:l=>!!l.refreshToken.value&&!l.user&&!l.accessToken.value,noToken:l=>!l.refreshToken.value,noMfaTicket:(l,{ticket:p})=>{var v;return!p&&!((v=l.mfa)!=null&&v.ticket)},hasRefreshToken:l=>!!l.refreshToken.value,hasAuthenticationError:l=>!!l.errors.authentication,isAutoRefreshDisabled:()=>!o,refreshTimerShouldRefresh:l=>{var w;let{expiresAt:p}=l.accessToken;return p?l.refreshTimer.lastAttempt?Date.now()-l.refreshTimer.lastAttempt.getTime()>5*1e3:a&&Date.now()-(((w=l.refreshTimer.startedAt)==null?void 0:w.getTime())||0)>a*1e3?!0:p.getTime()-Date.now()-1e3*300<=0:!1},unverified:(l,{data:{error:p}})=>p.status===401&&p.message==="Email is not verified",hasSession:(l,p)=>{var v;return!!((v=p.data)!=null&&v.session)},hasMfaTicket:(l,p)=>{var v;return!!((v=p.data)!=null&&v.mfa)},invalidEmail:(l,{email:p})=>!Ke(p),invalidPassword:(l,{password:p})=>!ur(p),invalidPhoneNumber:(l,{phoneNumber:p})=>!fa(p)},services:{signInPassword:(l,{email:p,password:v})=>d("/signin/email-password",{email:p,password:v}),signInPasswordlessSms:(l,{phoneNumber:p,options:v})=>d("/signin/passwordless/sms",{phoneNumber:p,options:ne(e,v)}),signInPasswordlessSmsOtp:(l,{phoneNumber:p,otp:v})=>d("/signin/passwordless/sms/otp",{phoneNumber:p,otp:v}),signInPasswordlessEmail:(l,{email:p,options:v})=>d("/signin/passwordless/email",{email:p,options:ne(e,v)}),signInAnonymous:l=>d("/signin/anonymous"),signInMfaTotp:(l,{ticket:p,otp:v})=>{var m;return d("/signin/mfa/totp",{ticket:p||((m=l.mfa)==null?void 0:m.ticket),otp:v})},refreshToken:async(l,p)=>{let v=p.type==="TRY_TOKEN"?p.token:l.refreshToken.value;return{session:await d("/token",{refreshToken:v})}},signout:(l,p)=>d("/signout",{refreshToken:l.refreshToken.value,all:!!p.all}),registerUser:(l,{email:p,password:v,options:m})=>d("/signup/email-password",{email:p,password:v,options:ne(e,m)}),importRefreshToken:async()=>{let l=await f(wt),p=l?new Date(l):null,v=await f(Xt);if(u){let m=Rt("refreshToken")||null;if(m)v||(v=m);else{let w=Rt("error");if(w)return Promise.reject({error:{status:10,error:w,message:Rt("errorDescription")||w}})}}return v?{refreshToken:v,expiresAt:p}:Promise.reject({error:null})}}})};var Xe=class{constructor({clientStorageType:e="web",autoSignIn:r=!0,autoRefreshToken:n=!0,start:i=!0,backendUrl:s,clientUrl:a,...o}){this._subscriptions=new Set;if(this.backendUrl=s,this.clientUrl=a,this.machine=ma({...o,backendUrl:s,clientUrl:a,clientStorageType:e,autoSignIn:r,autoRefreshToken:n}),i&&(this.interpreter=me(this.machine),this.interpreter.start()),typeof window!="undefined"&&r)try{this._channel=new BroadcastChannel("nhost"),this._channel.addEventListener("message",u=>{var c;let f=(c=this.interpreter)==null?void 0:c.state.context.refreshToken.value;this.interpreter&&u.data!==f&&this.interpreter.send({type:"TRY_TOKEN",token:u.data})})}catch{}}get interpreter(){return this._interpreter}set interpreter(e){this._interpreter=e,e&&this._subscriptions.forEach(r=>r(this))}onStart(e){this.interpreter?e(this):this._subscriptions.add(e)}};var ya=()=>typeof window!="undefined",we=t=>!t||!t.accessToken.value||!t.refreshToken.value||!t.accessToken.expiresAt?null:{accessToken:t.accessToken.value,accessTokenExpiresIn:(t.accessToken.expiresAt.getTime()-Date.now())/1e3,refreshToken:t.refreshToken.value,user:t.user};var ga={message:"User is already signed in",status:100},Rl={message:"User is not authenticated",status:101},Ol={message:"User is not anonymous",status:101},Cl={message:"Email needs verification",status:102},cr=class{constructor({url:e,autoRefreshToken:r=!0,autoSignIn:n=!0,autoLogin:i,clientStorage:s,clientStorageType:a,clientStorageGetter:o,clientStorageSetter:u,refreshIntervalTime:f,start:c=!0}){var h;this._client=new Xe({backendUrl:e,clientUrl:typeof window!="undefined"&&((h=window.location)==null?void 0:h.origin)||"",autoRefreshToken:r,autoSignIn:typeof i=="boolean"?i:n,start:c,clientStorage:s,clientStorageType:a,clientStorageGetter:o,clientStorageSetter:u,refreshIntervalTime:f})}async signUp(e){let r=await this.waitUntilReady(),{email:n,password:i,options:s}=e;return this.isAuthenticated()?{session:null,error:ga}:new Promise(a=>{r.send("SIGNUP_EMAIL_PASSWORD",{email:n,password:i,options:s}),r.onTransition(o=>{if(o.matches({authentication:{signedOut:"needsEmailVerification"}}))return a({session:null,error:null});if(o.matches({authentication:{signedOut:"failed"}}))return a({session:null,error:o.context.errors.registration||null});if(o.matches({authentication:"signedIn"}))return a({session:we(o.context),error:null})})})}async signIn(e){let r=await this.waitUntilReady();if(this.isAuthenticated())return{session:null,mfa:null,error:ga};if("provider"in e){let{provider:n,options:i}=e,s=la(`${this._client.backendUrl}/signin/provider/${n}`,ne(this._client.clientUrl,i));return ya()&&(window.location.href=s),{providerUrl:s,provider:n,session:null,mfa:null,error:null}}return"email"in e&&"password"in e?new Promise(n=>{r.send("SIGNIN_PASSWORD",e),r.onTransition(i=>{i.matches({authentication:"signedIn"})?n({session:we(i.context),mfa:null,error:null}):i.matches({authentication:{signedOut:"needsEmailVerification"}})?n({session:null,mfa:null,error:Cl}):i.matches({authentication:{signedOut:"needsMfa"}})?n({session:null,mfa:i.context.mfa,error:null}):i.matches({authentication:{signedOut:"failed"}})&&n({session:null,mfa:null,error:i.context.errors.authentication||null})})}):"email"in e&&!("otp"in e)?new Promise(n=>{r.send("SIGNIN_PASSWORDLESS_EMAIL",e),r.onTransition(i=>{i.matches({authentication:{signedOut:"needsEmailVerification"}})?n({session:null,mfa:null,error:null}):i.matches({authentication:{signedOut:"failed"}})&&n({session:null,mfa:null,error:i.context.errors.authentication||null})})}):"phoneNumber"in e&&!("otp"in e)?new Promise(n=>{r.send("SIGNIN_PASSWORDLESS_SMS",e),r.onTransition(i=>{i.matches({authentication:{signedOut:"needsSmsOtp"}})?n({session:null,mfa:null,error:null}):i.matches({authentication:{signedOut:"failed"}})&&n({session:null,mfa:null,error:i.context.errors.authentication||null})})}):"otp"in e?new Promise(n=>{r.send("SIGNIN_PASSWORDLESS_SMS_OTP",e),r.onTransition(i=>{i.matches({authentication:"signedIn"})?n({session:we(i.context),mfa:null,error:null}):i.matches({authentication:{signedOut:"failed"}})&&n({session:null,mfa:null,error:i.context.errors.authentication||null})})}):{session:null,mfa:null,error:{message:"Incorrect parameters",status:500}}}async signOut(e){let r=await this.waitUntilReady();return this.isAuthenticated()?new Promise(n=>{r.send("SIGNOUT",{all:e==null?void 0:e.all}),r.onTransition(i=>{i.matches({authentication:{signedOut:"success"}})?n({error:null}):i.matches({authentication:{signedOut:{failed:"server"}}})&&n({error:i.context.errors.signout||null})})}):{error:Rl}}async resetPassword({email:e,options:r}){return new Promise(n=>{let i=me(pa(this._client));i.onTransition(({event:s})=>{if(s.type==="ERROR")return n({error:s.error});if(s.type==="SUCCESS")return n({error:null})}),i.start(),i.send("REQUEST",{email:e,options:r})})}async changePassword(e){return new Promise(r=>{let n=me(ha(this._client));n.onTransition(({event:i})=>{if(i.type==="ERROR")return r({error:i.error});if(i.type==="SUCCESS")return r({error:null})}),n.start(),n.send("REQUEST",{password:e.newPassword})})}async sendVerificationEmail(e){return new Promise(r=>{let n=me(va(this._client));n.onTransition(({event:i})=>{if(i.type==="ERROR")return r({error:i.error});if(i.type==="SUCCESS")return r({error:null})}),n.start(),n.send("REQUEST",{email:e.email,options:e.options})})}async changeEmail({newEmail:e,options:r}){return new Promise(n=>{let i=me(da(this._client));i.onTransition(({event:s})=>{if(s.type==="ERROR")return n({error:s.error});if(s.type==="SUCCESS")return n({error:null})}),i.start(),i.send("REQUEST",{email:e,options:r})})}async deanonymize(e){let r=await this.waitUntilReady();return new Promise(n=>{var o;if(!this.isAuthenticated()||!((o=r.state.context.user)!=null&&o.isAnonymous))return{error:Ol};let{signInMethod:i,connection:s,...a}=e;r.send("DEANONYMIZE",{signInMethod:i,connection:s,options:a}),r.onTransition(u=>{u.matches({authentication:{signedIn:{deanonymizing:"success"}}})?n({error:null}):u.matches({authentication:{signedIn:{deanonymizing:"error"}}})&&n({error:u.context.errors.authentication||null})}),r.start()})}onTokenChanged(e){let r=n=>n.onTransition(({event:i,context:s})=>{i.type==="TOKEN_CHANGED"&&e(we(s))});if(this._client.interpreter){let n=r(this._client.interpreter);return()=>n.stop()}else return this._client.onStart(n=>{r(n.interpreter)}),()=>{console.log("onTokenChanged was added before the interpreter started. Cannot unsubscribe listener.")}}onAuthStateChanged(e){let r=n=>n.onTransition(({event:i,context:s})=>{(i.type==="SIGNED_IN"||i.type==="SIGNED_OUT")&&e(i.type,we(s))});if(this._client.interpreter){let n=r(this._client.interpreter);return()=>n.stop()}else return this._client.onStart(n=>{r(n.interpreter)}),()=>{console.log("onAuthStateChanged was added before the interpreter started. Cannot unsubscribe listener.")}}isAuthenticated(){var e;return!!((e=this._client.interpreter)!=null&&e.state.matches({authentication:"signedIn"}))}async isAuthenticatedAsync(){return(await this.waitUntilReady()).state.matches({authentication:"signedIn"})}getAuthenticationStatus(){return this.isReady()?{isAuthenticated:this.isAuthenticated(),isLoading:!1}:{isAuthenticated:!1,isLoading:!0}}getJWTToken(){return this.getAccessToken()}getAccessToken(){var e,r;return(r=(e=this._client.interpreter)==null?void 0:e.state.context.accessToken.value)!=null?r:void 0}getDecodedAccessToken(){let e=this.getAccessToken();return e?fi(e):null}getHasuraClaims(){var e;return((e=this.getDecodedAccessToken())==null?void 0:e["https://hasura.io/jwt/claims"])||null}getHasuraClaim(e){var r;return((r=this.getHasuraClaims())==null?void 0:r[e.startsWith("x-hasura-")?e:`x-hasura-${e}`])||null}async refreshSession(e){try{let r=await this.waitUntilReady();return r.state.matches({token:"idle"})?new Promise(n=>{let i=e||r.state.context.refreshToken.value;if(!i)return n({session:null,error:Qi});r.send("TRY_TOKEN",{token:i}),r==null||r.onTransition(s=>{s.matches({token:{idle:"error"}})?n({session:null,error:{status:400,message:"Invalid refresh token"}}):s.event.type==="TOKEN_CHANGED"&&n({session:we(s.context),error:null})})}):{session:null,error:Zi}}catch(r){return{session:null,error:r.message}}}getSession(){var e,r;return we((r=(e=this._client.interpreter)==null?void 0:e.state)==null?void 0:r.context)}getUser(){var e,r,n;return((n=(r=(e=this._client.interpreter)==null?void 0:e.state)==null?void 0:r.context)==null?void 0:n.user)||null}waitUntilReady(){let r=this._client.interpreter;if(!r)throw Error("Auth interpreter not set");return r.state.hasTag("ready")?Promise.resolve(r):new Promise((n,i)=>{let s=setTimeout(()=>i(`The state machine is not yet ready after ${15} seconds.`),15e3);r.onTransition(a=>{if(a.hasTag("ready"))return clearTimeout(s),n(r)})})}isReady(){var e,r;return!!((r=(e=this._client.interpreter)==null?void 0:e.state)!=null&&r.hasTag("ready"))}get client(){return this._client}};var Co=nt(Oo()),Er=class{constructor({url:e}){this.url=e,this.httpClient=Co.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:i}=e,s={};return r&&(s["x-nhost-bucket-id"]=r),i&&(s["x-nhost-file-id"]=i),n&&(s["x-nhost-file-name"]=n),s}generateAuthHeaders(){return!this.adminSecret&&!this.accessToken?null:this.adminSecret?{"x-hasura-admin-secret":this.adminSecret}:{Authorization:`Bearer ${this.accessToken}`}}};var Sr=class{constructor({url:e}){this.url=e,this.api=new Er({url:e})}async upload(e){let r=new FormData;r.append("file",e.file);let{fileMetadata:n,error:i}=await this.api.upload({...e,file:r});return i?{fileMetadata:null,error:i}: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 Du=nt(ni()),Cr=class{constructor(e){let{url:r}=e;this.accessToken=null,this.instance=Du.default.create({baseURL:r})}async call(e,r,n){let i={...this.generateAccessTokenHeaders(),...n==null?void 0:n.headers},s;try{s=await this.instance.post(e,r,{...n,headers:i})}catch(a){if(a instanceof Error)return{res:null,error:a}}return s?{res:s,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 Zu=nt(ni()),ec=nt(Qu()),Dr=class{constructor(e){let{url:r}=e;this.url=r,this.accessToken=null,this.instance=Zu.default.create({baseURL:r})}async request(e,r,n){let i={...n==null?void 0:n.headers,...this.generateAccessTokenHeaders()};try{let s="",o=(await this.instance.post("",{operationName:s||void 0,query:typeof e=="string"?e:(0,ec.print)(e),variables:r},{...n,headers:i})).data,{data:u}=o;return o.errors?{data:null,error:o.errors}:typeof u!="object"||Array.isArray(u)||u===null?{data:null,error:new Error("incorrect response data from GraphQL server")}:{data:u,error:null}}catch(s){return s instanceof Error?{data:null,error:s}:(console.error(s),{data:null,error:new Error("Unable to get do GraphQL request")})}}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 qr=class{constructor({backendUrl:e,refreshIntervalTime:r,clientStorageGetter:n,clientStorageSetter:i,clientStorage:s,clientStorageType:a,autoRefreshToken:o,autoSignIn:u,start:f=!0}){if(!e)throw new Error("Please specify a `backendUrl`. Docs: [todo]!");this.auth=new cr({url:`${e}/v1/auth`,refreshIntervalTime:r,clientStorageGetter:n,clientStorageSetter:i,clientStorage:s,clientStorageType:a,autoRefreshToken:o,autoSignIn:u,start:f}),this.storage=new Sr({url:`${e}/v1/storage`}),this.functions=new Cr({url:`${e}/v1/functions`}),this.graphql=new Dr({url:`${e}/v1/graphql`}),this.storage.setAccessToken(this.auth.getAccessToken()),this.functions.setAccessToken(this.auth.getAccessToken()),this.graphql.setAccessToken(this.auth.getAccessToken()),this.auth.client.onStart(()=>{this.auth.onAuthStateChanged((c,h)=>{c==="SIGNED_OUT"&&(this.storage.setAccessToken(void 0),this.functions.setAccessToken(void 0),this.graphql.setAccessToken(void 0))}),this.auth.onTokenChanged(c=>{this.storage.setAccessToken(c==null?void 0:c.accessToken),this.functions.setAccessToken(c==null?void 0:c.accessToken),this.graphql.setAccessToken(c==null?void 0:c.accessToken)})})}};var yg=t=>new qr(t);export{qr as NhostClient,Cr as NhostFunctionsClient,Dr as NhostGraphqlClient,yg as createClient};
|
|
33
33
|
/*! *****************************************************************************
|
|
34
34
|
Copyright (c) Microsoft Corporation.
|
|
35
35
|
|