@nhost/nhost-js 1.1.5 → 1.1.6

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/dist/index.es.js CHANGED
@@ -1,12 +1,12 @@
1
- var sc=Object.create;var ci=Object.defineProperty;var ac=Object.getOwnPropertyDescriptor;var oc=Object.getOwnPropertyNames;var uc=Object.getPrototypeOf,cc=Object.prototype.hasOwnProperty;var p=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var lc=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of oc(e))!cc.call(t,i)&&i!==r&&ci(t,i,{get:()=>e[i],enumerable:!(n=ac(e,i))||n.enumerable});return t};var it=(t,e,r)=>(r=t!=null?sc(uc(t)):{},lc(e||!t||!t.__esModule?ci(r,"default",{value:t,enumerable:!0}):r,t));var Yr=p((Tp,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=p((bp,is)=>{"use strict";var Rc=Yr(),Se=Object.prototype.toString;function en(t){return Array.isArray(t)}function Qr(t){return typeof t=="undefined"}function Oc(t){return t!==null&&!Qr(t)&&t.constructor!==null&&!Qr(t.constructor)&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function ts(t){return Se.call(t)==="[object ArrayBuffer]"}function Cc(t){return Se.call(t)==="[object FormData]"}function Pc(t){var e;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&ts(t.buffer),e}function Nc(t){return typeof t=="string"}function Ic(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 kc(t){return Se.call(t)==="[object Date]"}function _c(t){return Se.call(t)==="[object File]"}function Dc(t){return Se.call(t)==="[object Blob]"}function ns(t){return Se.call(t)==="[object Function]"}function qc(t){return rs(t)&&ns(t.pipe)}function Uc(t){return Se.call(t)==="[object URLSearchParams]"}function jc(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function Mc(){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]),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 Zr(){var t={};function e(i,s){Yt(t[s])&&Yt(i)?t[s]=Zr(t[s],i):Yt(i)?t[s]=Zr({},i):en(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 Lc(t,e,r){return tn(e,function(i,s){r&&typeof i=="function"?t[s]=Rc(i,r):t[s]=i}),t}function Bc(t){return t.charCodeAt(0)===65279&&(t=t.slice(1)),t}is.exports={isArray:en,isArrayBuffer:ts,isBuffer:Oc,isFormData:Cc,isArrayBufferView:Pc,isString:Nc,isNumber:Ic,isObject:rs,isPlainObject:Yt,isUndefined:Qr,isDate:kc,isFile:_c,isBlob:Dc,isFunction:ns,isStream:qc,isURLSearchParams:Uc,isStandardBrowserEnv:Mc,forEach:tn,merge:Zr,extend:Lc,trim:jc,stripBOM:Bc}});var rn=p((Ap,as)=>{"use strict";var ze=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(ze.isURLSearchParams(r))i=r.toString();else{var s=[];ze.forEach(r,function(c,l){c===null||typeof c=="undefined"||(ze.isArray(c)?l=l+"[]":c=[c],ze.forEach(c,function(f){ze.isDate(f)?f=f.toISOString():ze.isObject(f)&&(f=JSON.stringify(f)),s.push(ss(l)+"="+ss(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 us=p((Rp,os)=>{"use strict";var Fc=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){Fc.forEach(this.handlers,function(n){n!==null&&e(n)})};os.exports=Qt});var ls=p((Op,cs)=>{"use strict";var Vc=K();cs.exports=function(e,r){Vc.forEach(e,function(i,s){s!==r&&s.toUpperCase()===r.toUpperCase()&&(e[r]=i,delete e[s])})}});var nn=p((Cp,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 sn=p((Pp,ds)=>{"use strict";var Hc=nn();ds.exports=function(e,r,n,i,s){var a=new Error(e);return Hc(a,r,n,i,s)}});var ps=p((Np,hs)=>{"use strict";var Gc=sn();hs.exports=function(e,r,n){var i=n.config.validateStatus;!n.status||!i||i(n.status)?e(n):r(Gc("Request failed with status code "+n.status,n.config,null,n.request,n))}});var ms=p((Ip,vs)=>{"use strict";var Zt=K();vs.exports=Zt.isStandardBrowserEnv()?function(){return{write:function(r,n,i,s,a,u){var c=[];c.push(r+"="+encodeURIComponent(n)),Zt.isNumber(i)&&c.push("expires="+new Date(i).toGMTString()),Zt.isString(s)&&c.push("path="+s),Zt.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 gs=p((kp,ys)=>{"use strict";ys.exports=function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}});var Ss=p((_p,Es)=>{"use strict";Es.exports=function(e,r){return r?e.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):e}});var xs=p((Dp,ws)=>{"use strict";var Jc=gs(),zc=Ss();ws.exports=function(e,r){return e&&!Jc(r)?zc(e,r):r}});var bs=p((qp,Ts)=>{"use strict";var an=K(),$c=["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&&an.forEach(e.split(`
2
- `),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]&&$c.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=p((Up,Rs)=>{"use strict";var As=K();Rs.exports=As.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=As.isString(a)?i(a):a;return u.protocol===n.protocol&&u.host===n.host}}():function(){return function(){return!0}}()});var bt=p((jp,Cs)=>{"use strict";function on(t){this.message=t}on.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")};on.prototype.__CANCEL__=!0;Cs.exports=on});var cn=p((Mp,Ps)=>{"use strict";var er=K(),Wc=ps(),Kc=ms(),Xc=rn(),Yc=xs(),Qc=bs(),Zc=Os(),un=sn(),el=At(),tl=bt();Ps.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)}er.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=Yc(e.baseURL,e.url);o.open(e.method.toUpperCase(),Xc(h,e.params,e.paramsSerializer),!0),o.timeout=e.timeout;function m(){if(!!o){var v="getAllResponseHeaders"in o?Qc(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};Wc(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(un("Request aborted",e,"ECONNABORTED",o)),o=null)},o.onerror=function(){i(un("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||el.transitional;e.timeoutErrorMessage&&(x=e.timeoutErrorMessage),i(un(x,e,g.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",o)),o=null},er.isStandardBrowserEnv()){var E=(e.withCredentials||Zc(h))&&e.xsrfCookieName?Kc.read(e.xsrfCookieName):void 0;E&&(a[e.xsrfHeaderName]=E)}"setRequestHeader"in o&&er.forEach(a,function(x,g){typeof s=="undefined"&&g.toLowerCase()==="content-type"?delete a[g]:o.setRequestHeader(g,x)}),er.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 tl("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 At=p((Lp,ks)=>{"use strict";var G=K(),Ns=ls(),rl=nn(),nl={"Content-Type":"application/x-www-form-urlencoded"};function Is(t,e){!G.isUndefined(t)&&G.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}function il(){var t;return typeof XMLHttpRequest!="undefined"?t=cn():typeof process!="undefined"&&Object.prototype.toString.call(process)==="[object process]"&&(t=cn()),t}function sl(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:il(),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"),sl(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"?rl(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(nl)});ks.exports=tr});var Ds=p((Bp,_s)=>{"use strict";var al=K(),ol=At();_s.exports=function(e,r,n){var i=this||ol;return al.forEach(n,function(a){e=a.call(i,e,r)}),e}});var ln=p((Fp,qs)=>{"use strict";qs.exports=function(e){return!!(e&&e.__CANCEL__)}});var Ms=p((Vp,js)=>{"use strict";var Us=K(),fn=Ds(),ul=ln(),cl=At(),ll=bt();function dn(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new ll("canceled")}js.exports=function(e){dn(e),e.headers=e.headers||{},e.data=fn.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||cl.adapter;return r(e).then(function(i){return dn(e),i.data=fn.call(e,i.data,i.headers,e.transformResponse),i},function(i){return ul(i)||(dn(e),i&&i.response&&(i.response.data=fn.call(e,i.response.data,i.response.headers,e.transformResponse))),Promise.reject(i)})}});var hn=p((Hp,Ls)=>{"use strict";var te=K();Ls.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 pn=p((Gp,Bs)=>{Bs.exports={version:"0.25.0"}});var Hs=p((Jp,Vs)=>{"use strict";var fl=pn().version,vn={};["object","boolean","number","function","string","symbol"].forEach(function(t,e){vn[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});var Fs={};vn.transitional=function(e,r,n){function i(s,a){return"[Axios v"+fl+"] 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&&!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,u):!0}};function dl(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)}}Vs.exports={assertOptions:dl,validators:vn}});var Ks=p((zp,Ws)=>{"use strict";var zs=K(),hl=rn(),Gs=us(),Js=Ms(),rr=hn(),$s=Hs(),$e=$s.validators;function Rt(t){this.defaults=t,this.interceptors={request:new Gs,response:new Gs}}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=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&&$s.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=[Js,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=Js(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=rr(this.defaults,e),hl(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")};zs.forEach(["delete","get","head","options"],function(e){Rt.prototype[e]=function(r,n){return this.request(rr(n||{},{method:e,url:r,data:(n||{}).data}))}});zs.forEach(["post","put","patch"],function(e){Rt.prototype[e]=function(r,n,i){return this.request(rr(i||{},{method:e,url:r,data:n}))}});Ws.exports=Rt});var Ys=p(($p,Xs)=>{"use strict";var pl=bt();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 pl(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=p((Wp,Qs)=>{"use strict";Qs.exports=function(e){return function(n){return e.apply(null,n)}}});var ta=p((Kp,ea)=>{"use strict";var vl=K();ea.exports=function(e){return vl.isObject(e)&&e.isAxiosError===!0}});var ia=p((Xp,mn)=>{"use strict";var ra=K(),ml=Yr(),nr=Ks(),yl=hn(),gl=At();function na(t){var e=new nr(t),r=ml(nr.prototype.request,e);return ra.extend(r,nr.prototype,e),ra.extend(r,e),r.create=function(i){return na(yl(t,i))},r}var he=na(gl);he.Axios=nr;he.Cancel=bt();he.CancelToken=Ys();he.isCancel=ln();he.VERSION=pn().version;he.all=function(e){return Promise.all(e)};he.spread=Zs();he.isAxiosError=ta();mn.exports=he;mn.exports.default=he});var aa=p((Yp,sa)=>{sa.exports=ia()});var En=p((Lm,wa)=>{"use strict";wa.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,ba)=>{"use strict";var Cl=En(),_e=Object.prototype.toString;function xn(t){return _e.call(t)==="[object Array]"}function Sn(t){return typeof t=="undefined"}function Pl(t){return t!==null&&!Sn(t)&&t.constructor!==null&&!Sn(t.constructor)&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function Nl(t){return _e.call(t)==="[object ArrayBuffer]"}function Il(t){return typeof FormData!="undefined"&&t instanceof FormData}function kl(t){var e;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&t.buffer instanceof ArrayBuffer,e}function _l(t){return typeof t=="string"}function Dl(t){return typeof t=="number"}function xa(t){return t!==null&&typeof t=="object"}function fr(t){if(_e.call(t)!=="[object Object]")return!1;var e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}function ql(t){return _e.call(t)==="[object Date]"}function Ul(t){return _e.call(t)==="[object File]"}function jl(t){return _e.call(t)==="[object Blob]"}function Ta(t){return _e.call(t)==="[object Function]"}function Ml(t){return xa(t)&&Ta(t.pipe)}function Ll(t){return typeof URLSearchParams!="undefined"&&t instanceof URLSearchParams}function Bl(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function Fl(){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){fr(t[s])&&fr(i)?t[s]=wn(t[s],i):fr(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 Vl(t,e,r){return Tn(e,function(i,s){r&&typeof i=="function"?t[s]=Cl(i,r):t[s]=i}),t}function Hl(t){return t.charCodeAt(0)===65279&&(t=t.slice(1)),t}ba.exports={isArray:xn,isArrayBuffer:Nl,isBuffer:Pl,isFormData:Il,isArrayBufferView:kl,isString:_l,isNumber:Dl,isObject:xa,isPlainObject:fr,isUndefined:Sn,isDate:ql,isFile:Ul,isBlob:jl,isFunction:Ta,isStream:Ml,isURLSearchParams:Ll,isStandardBrowserEnv:Fl,forEach:Tn,merge:wn,extend:Vl,trim:Bl,stripBOM:Hl}});var bn=p((Fm,Ra)=>{"use strict";var Qe=X();function Aa(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}Ra.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(Aa(l)+"="+Aa(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 Ca=p((Vm,Oa)=>{"use strict";var Gl=X();function dr(){this.handlers=[]}dr.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};dr.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)};dr.prototype.forEach=function(e){Gl.forEach(this.handlers,function(n){n!==null&&e(n)})};Oa.exports=dr});var Na=p((Hm,Pa)=>{"use strict";var Jl=X();Pa.exports=function(e,r){Jl.forEach(e,function(i,s){s!==r&&s.toUpperCase()===r.toUpperCase()&&(e[r]=i,delete e[s])})}});var An=p((Gm,Ia)=>{"use strict";Ia.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=p((Jm,ka)=>{"use strict";var zl=An();ka.exports=function(e,r,n,i,s){var a=new Error(e);return zl(a,r,n,i,s)}});var Da=p((zm,_a)=>{"use strict";var $l=Rn();_a.exports=function(e,r,n){var i=n.config.validateStatus;!n.status||!i||i(n.status)?e(n):r($l("Request failed with status code "+n.status,n.config,null,n.request,n))}});var Ua=p(($m,qa)=>{"use strict";var hr=X();qa.exports=hr.isStandardBrowserEnv()?function(){return{write:function(r,n,i,s,a,u){var c=[];c.push(r+"="+encodeURIComponent(n)),hr.isNumber(i)&&c.push("expires="+new Date(i).toGMTString()),hr.isString(s)&&c.push("path="+s),hr.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 Ma=p((Wm,ja)=>{"use strict";ja.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}});var Ba=p((Km,La)=>{"use strict";La.exports=function(e,r){return r?e.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):e}});var Va=p((Xm,Fa)=>{"use strict";var Wl=Ma(),Kl=Ba();Fa.exports=function(e,r){return e&&!Wl(r)?Kl(e,r):r}});var Ga=p((Ym,Ha)=>{"use strict";var On=X(),Xl=["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"];Ha.exports=function(e){var r={},n,i,s;return e&&On.forEach(e.split(`
3
- `),function(u){if(s=u.indexOf(":"),n=On.trim(u.substr(0,s)).toLowerCase(),i=On.trim(u.substr(s+1)),n){if(r[n]&&Xl.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 $a=p((Qm,za)=>{"use strict";var Ja=X();za.exports=Ja.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=Ja.isString(a)?i(a):a;return u.protocol===n.protocol&&u.host===n.host}}():function(){return function(){return!0}}()});var Pn=p((Zm,Wa)=>{"use strict";var pr=X(),Yl=Da(),Ql=Ua(),Zl=bn(),ef=Va(),tf=Ga(),rf=$a(),Cn=Rn();Wa.exports=function(e){return new Promise(function(n,i){var s=e.data,a=e.headers,u=e.responseType;pr.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=ef(e.baseURL,e.url);c.open(e.method.toUpperCase(),Zl(f,e.params,e.paramsSerializer),!0),c.timeout=e.timeout;function d(){if(!!c){var m="getAllResponseHeaders"in c?tf(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};Yl(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(Cn("Request aborted",e,"ECONNABORTED",c)),c=null)},c.onerror=function(){i(Cn("Network Error",e,null,c)),c=null},c.ontimeout=function(){var E="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(E=e.timeoutErrorMessage),i(Cn(E,e,e.transitional&&e.transitional.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",c)),c=null},pr.isStandardBrowserEnv()){var h=(e.withCredentials||rf(f))&&e.xsrfCookieName?Ql.read(e.xsrfCookieName):void 0;h&&(a[e.xsrfHeaderName]=h)}"setRequestHeader"in c&&pr.forEach(a,function(E,v){typeof s=="undefined"&&v.toLowerCase()==="content-type"?delete a[v]:c.setRequestHeader(v,E)}),pr.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 mr=p((ey,Ya)=>{"use strict";var J=X(),Ka=Na(),nf=An(),sf={"Content-Type":"application/x-www-form-urlencoded"};function Xa(t,e){!J.isUndefined(t)&&J.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}function af(){var t;return typeof XMLHttpRequest!="undefined"?t=Pn():typeof process!="undefined"&&Object.prototype.toString.call(process)==="[object process]"&&(t=Pn()),t}function of(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 vr={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:af(),transformRequest:[function(e,r){return Ka(r,"Accept"),Ka(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)?(Xa(r,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):J.isObject(e)||r&&r["Content-Type"]==="application/json"?(Xa(r,"application/json"),of(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"?nf(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}};vr.headers={common:{Accept:"application/json, text/plain, */*"}};J.forEach(["delete","get","head"],function(e){vr.headers[e]={}});J.forEach(["post","put","patch"],function(e){vr.headers[e]=J.merge(sf)});Ya.exports=vr});var Za=p((ty,Qa)=>{"use strict";var uf=X(),cf=mr();Qa.exports=function(e,r,n){var i=this||cf;return uf.forEach(n,function(a){e=a.call(i,e,r)}),e}});var Nn=p((ry,eo)=>{"use strict";eo.exports=function(e){return!!(e&&e.__CANCEL__)}});var no=p((ny,ro)=>{"use strict";var to=X(),In=Za(),lf=Nn(),ff=mr();function kn(t){t.cancelToken&&t.cancelToken.throwIfRequested()}ro.exports=function(e){kn(e),e.headers=e.headers||{},e.data=In.call(e,e.data,e.headers,e.transformRequest),e.headers=to.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),to.forEach(["delete","get","head","post","put","patch","common"],function(i){delete e.headers[i]});var r=e.adapter||ff.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 lf(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=p((iy,io)=>{"use strict";var W=X();io.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 so=p((sy,df)=>{df.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 lo=p((ay,co)=>{"use strict";var oo=so(),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 ao={},hf=oo.version.split(".");function uo(t,e){for(var r=e?e.split("."):hf,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&&uo(r);function s(a,u){return"[Axios v"+oo.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&&!ao[u]&&(ao[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 pf(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)}}co.exports={isOlderVersion:uo,assertOptions:pf,validators:Dn}});var yo=p((oy,mo)=>{"use strict";var po=X(),vf=bn(),fo=Ca(),ho=no(),yr=_n(),vo=lo(),Ze=vo.validators;function Ot(t){this.defaults=t,this.interceptors={request:new fo,response:new fo}}Ot.prototype.request=function(e){typeof e=="string"?(e=arguments[1]||{},e.url=arguments[0]):e=e||{},e=yr(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&&vo.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=[ho,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=ho(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=yr(this.defaults,e),vf(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")};po.forEach(["delete","get","head","options"],function(e){Ot.prototype[e]=function(r,n){return this.request(yr(n||{},{method:e,url:r,data:(n||{}).data}))}});po.forEach(["post","put","patch"],function(e){Ot.prototype[e]=function(r,n,i){return this.request(yr(i||{},{method:e,url:r,data:n}))}});mo.exports=Ot});var Un=p((uy,go)=>{"use strict";function qn(t){this.message=t}qn.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")};qn.prototype.__CANCEL__=!0;go.exports=qn});var So=p((cy,Eo)=>{"use strict";var mf=Un();function gr(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 mf(i),e(r.reason))})}gr.prototype.throwIfRequested=function(){if(this.reason)throw this.reason};gr.source=function(){var e,r=new gr(function(i){e=i});return{token:r,cancel:e}};Eo.exports=gr});var xo=p((ly,wo)=>{"use strict";wo.exports=function(e){return function(n){return e.apply(null,n)}}});var bo=p((fy,To)=>{"use strict";To.exports=function(e){return typeof e=="object"&&e.isAxiosError===!0}});var Oo=p((dy,jn)=>{"use strict";var Ao=X(),yf=En(),Er=yo(),gf=_n(),Ef=mr();function Ro(t){var e=new Er(t),r=yf(Er.prototype.request,e);return Ao.extend(r,Er.prototype,e),Ao.extend(r,e),r}var ue=Ro(Ef);ue.Axios=Er;ue.create=function(e){return Ro(gf(ue.defaults,e))};ue.Cancel=Un();ue.CancelToken=So();ue.isCancel=Nn();ue.all=function(e){return Promise.all(e)};ue.spread=xo();ue.isAxiosError=bo();jn.exports=ue;jn.exports.default=ue});var Po=p((hy,Co)=>{Co.exports=Oo()});var Mn=p((xy,Io)=>{"use strict";Io.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((Ty,Do)=>{"use strict";var Sf=Mn(),De=Object.prototype.toString;function Fn(t){return De.call(t)==="[object Array]"}function Ln(t){return typeof t=="undefined"}function wf(t){return t!==null&&!Ln(t)&&t.constructor!==null&&!Ln(t.constructor)&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function xf(t){return De.call(t)==="[object ArrayBuffer]"}function Tf(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 Af(t){return typeof t=="string"}function Rf(t){return typeof t=="number"}function ko(t){return t!==null&&typeof t=="object"}function xr(t){if(De.call(t)!=="[object Object]")return!1;var e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}function Of(t){return De.call(t)==="[object Date]"}function Cf(t){return De.call(t)==="[object File]"}function Pf(t){return De.call(t)==="[object Blob]"}function _o(t){return De.call(t)==="[object Function]"}function Nf(t){return ko(t)&&_o(t.pipe)}function If(t){return typeof URLSearchParams!="undefined"&&t instanceof URLSearchParams}function kf(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function _f(){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){xr(t[s])&&xr(i)?t[s]=Bn(t[s],i):xr(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 Df(t,e,r){return Vn(e,function(i,s){r&&typeof i=="function"?t[s]=Sf(i,r):t[s]=i}),t}function qf(t){return t.charCodeAt(0)===65279&&(t=t.slice(1)),t}Do.exports={isArray:Fn,isArrayBuffer:xf,isBuffer:wf,isFormData:Tf,isArrayBufferView:bf,isString:Af,isNumber:Rf,isObject:ko,isPlainObject:xr,isUndefined:Ln,isDate:Of,isFile:Cf,isBlob:Pf,isFunction:_o,isStream:Nf,isURLSearchParams:If,isStandardBrowserEnv:_f,forEach:Vn,merge:Bn,extend:Df,trim:kf,stripBOM:qf}});var Hn=p((by,Uo)=>{"use strict";var et=Y();function qo(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}Uo.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(qo(l)+"="+qo(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 Mo=p((Ay,jo)=>{"use strict";var Uf=Y();function Tr(){this.handlers=[]}Tr.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};Tr.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)};Tr.prototype.forEach=function(e){Uf.forEach(this.handlers,function(n){n!==null&&e(n)})};jo.exports=Tr});var Bo=p((Ry,Lo)=>{"use strict";var jf=Y();Lo.exports=function(e,r){jf.forEach(e,function(i,s){s!==r&&s.toUpperCase()===r.toUpperCase()&&(e[r]=i,delete e[s])})}});var Gn=p((Oy,Fo)=>{"use strict";Fo.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=p((Cy,Vo)=>{"use strict";var Mf=Gn();Vo.exports=function(e,r,n,i,s){var a=new Error(e);return Mf(a,r,n,i,s)}});var Go=p((Py,Ho)=>{"use strict";var Lf=Jn();Ho.exports=function(e,r,n){var i=n.config.validateStatus;!n.status||!i||i(n.status)?e(n):r(Lf("Request failed with status code "+n.status,n.config,null,n.request,n))}});var zo=p((Ny,Jo)=>{"use strict";var br=Y();Jo.exports=br.isStandardBrowserEnv()?function(){return{write:function(r,n,i,s,a,u){var c=[];c.push(r+"="+encodeURIComponent(n)),br.isNumber(i)&&c.push("expires="+new Date(i).toGMTString()),br.isString(s)&&c.push("path="+s),br.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 Wo=p((Iy,$o)=>{"use strict";$o.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}});var Xo=p((ky,Ko)=>{"use strict";Ko.exports=function(e,r){return r?e.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):e}});var Qo=p((_y,Yo)=>{"use strict";var Bf=Wo(),Ff=Xo();Yo.exports=function(e,r){return e&&!Bf(r)?Ff(e,r):r}});var eu=p((Dy,Zo)=>{"use strict";var zn=Y(),Vf=["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"];Zo.exports=function(e){var r={},n,i,s;return e&&zn.forEach(e.split(`
4
- `),function(u){if(s=u.indexOf(":"),n=zn.trim(u.substr(0,s)).toLowerCase(),i=zn.trim(u.substr(s+1)),n){if(r[n]&&Vf.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 nu=p((qy,ru)=>{"use strict";var tu=Y();ru.exports=tu.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=tu.isString(a)?i(a):a;return u.protocol===n.protocol&&u.host===n.host}}():function(){return function(){return!0}}()});var Ct=p((Uy,iu)=>{"use strict";function $n(t){this.message=t}$n.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")};$n.prototype.__CANCEL__=!0;iu.exports=$n});var Kn=p((jy,su)=>{"use strict";var Ar=Y(),Hf=Go(),Gf=zo(),Jf=Hn(),zf=Qo(),$f=eu(),Wf=nu(),Wn=Jn(),Kf=Pt(),Xf=Ct();su.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)}Ar.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=zf(e.baseURL,e.url);o.open(e.method.toUpperCase(),Jf(h,e.params,e.paramsSerializer),!0),o.timeout=e.timeout;function m(){if(!!o){var v="getAllResponseHeaders"in o?$f(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};Hf(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(Wn("Request aborted",e,"ECONNABORTED",o)),o=null)},o.onerror=function(){i(Wn("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||Kf.transitional;e.timeoutErrorMessage&&(x=e.timeoutErrorMessage),i(Wn(x,e,g.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",o)),o=null},Ar.isStandardBrowserEnv()){var E=(e.withCredentials||Wf(h))&&e.xsrfCookieName?Gf.read(e.xsrfCookieName):void 0;E&&(a[e.xsrfHeaderName]=E)}"setRequestHeader"in o&&Ar.forEach(a,function(x,g){typeof s=="undefined"&&g.toLowerCase()==="content-type"?delete a[g]:o.setRequestHeader(g,x)}),Ar.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 Xf("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 Pt=p((My,uu)=>{"use strict";var z=Y(),au=Bo(),Yf=Gn(),Qf={"Content-Type":"application/x-www-form-urlencoded"};function ou(t,e){!z.isUndefined(t)&&z.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}function Zf(){var t;return typeof XMLHttpRequest!="undefined"?t=Kn():typeof process!="undefined"&&Object.prototype.toString.call(process)==="[object process]"&&(t=Kn()),t}function ed(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 Rr={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:Zf(),transformRequest:[function(e,r){return au(r,"Accept"),au(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)?(ou(r,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):z.isObject(e)||r&&r["Content-Type"]==="application/json"?(ou(r,"application/json"),ed(e)):e}],transformResponse:[function(e){var r=this.transitional||Rr.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"?Yf(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){Rr.headers[e]={}});z.forEach(["post","put","patch"],function(e){Rr.headers[e]=z.merge(Qf)});uu.exports=Rr});var lu=p((Ly,cu)=>{"use strict";var td=Y(),rd=Pt();cu.exports=function(e,r,n){var i=this||rd;return td.forEach(n,function(a){e=a.call(i,e,r)}),e}});var Xn=p((By,fu)=>{"use strict";fu.exports=function(e){return!!(e&&e.__CANCEL__)}});var pu=p((Fy,hu)=>{"use strict";var du=Y(),Yn=lu(),nd=Xn(),id=Pt(),sd=Ct();function Qn(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new sd("canceled")}hu.exports=function(e){Qn(e),e.headers=e.headers||{},e.data=Yn.call(e,e.data,e.headers,e.transformRequest),e.headers=du.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),du.forEach(["delete","get","head","post","put","patch","common"],function(i){delete e.headers[i]});var r=e.adapter||id.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 nd(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=p((Vy,vu)=>{"use strict";var re=Y();vu.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 ei=p((Hy,mu)=>{mu.exports={version:"0.23.0"}});var Eu=p((Gy,gu)=>{"use strict";var ad=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 yu={};ti.transitional=function(e,r,n){function i(s,a){return"[Axios v"+ad+"] 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&&!yu[a]&&(yu[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 od(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)}}gu.exports={assertOptions:od,validators:ti}});var Au=p((Jy,bu)=>{"use strict";var xu=Y(),ud=Hn(),Su=Mo(),wu=pu(),Or=Zn(),Tu=Eu(),tt=Tu.validators;function Nt(t){this.defaults=t,this.interceptors={request:new Su,response:new Su}}Nt.prototype.request=function(e){typeof e=="string"?(e=arguments[1]||{},e.url=arguments[0]):e=e||{},e=Or(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&&Tu.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=[wu,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=wu(c)}catch(f){return Promise.reject(f)}for(;s.length;)a=a.then(s.shift(),s.shift());return a};Nt.prototype.getUri=function(e){return e=Or(this.defaults,e),ud(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")};xu.forEach(["delete","get","head","options"],function(e){Nt.prototype[e]=function(r,n){return this.request(Or(n||{},{method:e,url:r,data:(n||{}).data}))}});xu.forEach(["post","put","patch"],function(e){Nt.prototype[e]=function(r,n,i){return this.request(Or(i||{},{method:e,url:r,data:n}))}});bu.exports=Nt});var Ou=p((zy,Ru)=>{"use strict";var cd=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 cd(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}};Ru.exports=rt});var Pu=p(($y,Cu)=>{"use strict";Cu.exports=function(e){return function(n){return e.apply(null,n)}}});var Iu=p((Wy,Nu)=>{"use strict";Nu.exports=function(e){return typeof e=="object"&&e.isAxiosError===!0}});var Du=p((Ky,ri)=>{"use strict";var ku=Y(),ld=Mn(),Cr=Au(),fd=Zn(),dd=Pt();function _u(t){var e=new Cr(t),r=ld(Cr.prototype.request,e);return ku.extend(r,Cr.prototype,e),ku.extend(r,e),r.create=function(i){return _u(fd(t,i))},r}var pe=_u(dd);pe.Axios=Cr;pe.Cancel=Ct();pe.CancelToken=Ou();pe.isCancel=Xn();pe.VERSION=ei().version;pe.all=function(e){return Promise.all(e)};pe.spread=Pu();pe.isAxiosError=Iu();ri.exports=pe;ri.exports.default=pe});var ni=p((Xy,qu)=>{qu.exports=Du()});var ii=p(Nr=>{"use strict";Object.defineProperty(Nr,"__esModule",{value:!0});Nr.default=void 0;var hd=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):void 0,pd=hd;Nr.default=pd});var Mu=p(si=>{"use strict";Object.defineProperty(si,"__esModule",{value:!0});si.default=gd;var vd=md(ii());function md(t){return t&&t.__esModule?t:{default:t}}function Ir(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Ir=function(r){return typeof r}:Ir=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Ir(t)}var yd=10,ju=2;function gd(t){return kr(t,[])}function kr(t,e){switch(Ir(t)){case"string":return JSON.stringify(t);case"function":return t.name?"[function ".concat(t.name,"]"):"[function]";case"object":return t===null?"null":Ed(t,e);default:return String(t)}}function Ed(t,e){if(e.indexOf(t)!==-1)return"[Circular]";var r=[].concat(e,[t]),n=xd(t);if(n!==void 0){var i=n.call(t);if(i!==t)return typeof i=="string"?i:kr(i,r)}else if(Array.isArray(t))return wd(t,r);return Sd(t,r)}function Sd(t,e){var r=Object.keys(t);if(r.length===0)return"{}";if(e.length>ju)return"["+Td(t)+"]";var n=r.map(function(i){var s=kr(t[i],e);return i+": "+s});return"{ "+n.join(", ")+" }"}function wd(t,e){if(t.length===0)return"[]";if(e.length>ju)return"[Array]";for(var r=Math.min(yd,t.length),n=t.length-r,i=[],s=0;s<r;++s)i.push(kr(t[s],e));return n===1?i.push("... 1 more item"):n>1&&i.push("... ".concat(n," more items")),"["+i.join(", ")+"]"}function xd(t){var e=t[String(vd.default)];if(typeof e=="function")return e;if(typeof t.inspect=="function")return t.inspect}function Td(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 Lu=p(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 Vu=p(oi=>{"use strict";Object.defineProperty(oi,"__esModule",{value:!0});oi.default=Rd;var Ad=Fu(Lu()),Bu=Fu(ii());function Fu(t){return t&&t.__esModule?t:{default:t}}function Rd(t){var e=t.prototype.toJSON;typeof e=="function"||(0,Ad.default)(0),t.prototype.inspect=e,Bu.default&&(t.prototype[Bu.default]=e)}});var zu=p(qe=>{"use strict";Object.defineProperty(qe,"__esModule",{value:!0});qe.isNode=Cd;qe.Token=qe.Location=void 0;var Hu=Od(Vu());function Od(t){return t&&t.__esModule?t:{default:t}}var Gu=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=Gu;(0,Hu.default)(Gu);var Ju=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=Ju;(0,Hu.default)(Ju);function Cd(t){return t!=null&&typeof t.kind=="string"}});var Ku=p(ye=>{"use strict";Object.defineProperty(ye,"__esModule",{value:!0});ye.visit=Id;ye.visitInParallel=kd;ye.getVisitFn=_r;ye.BREAK=ye.QueryDocumentKeys=void 0;var Pd=Nd(Mu()),$u=zu();function Nd(t){return t&&t.__esModule?t:{default:t}}var Wu={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=Wu;var nt=Object.freeze({});ye.BREAK=nt;function Id(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Wu,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,N=0;N<u.length;N++){var M=u[N][0],b=u[N][1];i&&(M-=O),i&&b===null?(c.splice(M,1),O++):c[M]=b}}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,$u.isNode)(c))throw new Error("Invalid AST Node: ".concat((0,Pd.default)(c),"."));var A=_r(e,c.kind,m);if(A){if(w=A.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,$u.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 kd(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=_r(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=_r(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 _r(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 Qu=p(It=>{"use strict";Object.defineProperty(It,"__esModule",{value:!0});It.dedentBlockStringValue=_d;It.getBlockStringIndentation=Yu;It.printBlockString=Dd;function _d(t){var e=t.split(/\r\n|[\n\r]/g),r=Yu(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&&Xu(e[i]);)++i;for(var s=e.length;s>i&&Xu(e[s-1]);)--s;return e.slice(i,s).join(`
1
+ var sc=Object.create;var li=Object.defineProperty;var ac=Object.getOwnPropertyDescriptor;var oc=Object.getOwnPropertyNames;var uc=Object.getPrototypeOf,cc=Object.prototype.hasOwnProperty;var p=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var lc=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of oc(e))!cc.call(t,i)&&i!==r&&li(t,i,{get:()=>e[i],enumerable:!(n=ac(e,i))||n.enumerable});return t};var it=(t,e,r)=>(r=t!=null?sc(uc(t)):{},lc(e||!t||!t.__esModule?li(r,"default",{value:t,enumerable:!0}):r,t));var Yr=p((Tp,ts)=>{"use strict";ts.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=p((bp,ss)=>{"use strict";var Rc=Yr(),Se=Object.prototype.toString;function en(t){return Array.isArray(t)}function Qr(t){return typeof t=="undefined"}function Oc(t){return t!==null&&!Qr(t)&&t.constructor!==null&&!Qr(t.constructor)&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function rs(t){return Se.call(t)==="[object ArrayBuffer]"}function Cc(t){return Se.call(t)==="[object FormData]"}function Pc(t){var e;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&rs(t.buffer),e}function Nc(t){return typeof t=="string"}function Ic(t){return typeof t=="number"}function ns(t){return t!==null&&typeof t=="object"}function Qt(t){if(Se.call(t)!=="[object Object]")return!1;var e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}function kc(t){return Se.call(t)==="[object Date]"}function _c(t){return Se.call(t)==="[object File]"}function Dc(t){return Se.call(t)==="[object Blob]"}function is(t){return Se.call(t)==="[object Function]"}function qc(t){return ns(t)&&is(t.pipe)}function Uc(t){return Se.call(t)==="[object URLSearchParams]"}function jc(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function Mc(){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]),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 Zr(){var t={};function e(i,s){Qt(t[s])&&Qt(i)?t[s]=Zr(t[s],i):Qt(i)?t[s]=Zr({},i):en(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 Lc(t,e,r){return tn(e,function(i,s){r&&typeof i=="function"?t[s]=Rc(i,r):t[s]=i}),t}function Bc(t){return t.charCodeAt(0)===65279&&(t=t.slice(1)),t}ss.exports={isArray:en,isArrayBuffer:rs,isBuffer:Oc,isFormData:Cc,isArrayBufferView:Pc,isString:Nc,isNumber:Ic,isObject:ns,isPlainObject:Qt,isUndefined:Qr,isDate:kc,isFile:_c,isBlob:Dc,isFunction:is,isStream:qc,isURLSearchParams:Uc,isStandardBrowserEnv:Mc,forEach:tn,merge:Zr,extend:Lc,trim:jc,stripBOM:Bc}});var rn=p((Ap,os)=>{"use strict";var ze=K();function as(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}os.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(c,l){c===null||typeof c=="undefined"||(ze.isArray(c)?l=l+"[]":c=[c],ze.forEach(c,function(f){ze.isDate(f)?f=f.toISOString():ze.isObject(f)&&(f=JSON.stringify(f)),s.push(as(l)+"="+as(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 cs=p((Rp,us)=>{"use strict";var Fc=K();function Zt(){this.handlers=[]}Zt.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};Zt.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)};Zt.prototype.forEach=function(e){Fc.forEach(this.handlers,function(n){n!==null&&e(n)})};us.exports=Zt});var fs=p((Op,ls)=>{"use strict";var Vc=K();ls.exports=function(e,r){Vc.forEach(e,function(i,s){s!==r&&s.toUpperCase()===r.toUpperCase()&&(e[r]=i,delete e[s])})}});var nn=p((Cp,ds)=>{"use strict";ds.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 sn=p((Pp,hs)=>{"use strict";var Hc=nn();hs.exports=function(e,r,n,i,s){var a=new Error(e);return Hc(a,r,n,i,s)}});var vs=p((Np,ps)=>{"use strict";var Gc=sn();ps.exports=function(e,r,n){var i=n.config.validateStatus;!n.status||!i||i(n.status)?e(n):r(Gc("Request failed with status code "+n.status,n.config,null,n.request,n))}});var ys=p((Ip,ms)=>{"use strict";var er=K();ms.exports=er.isStandardBrowserEnv()?function(){return{write:function(r,n,i,s,a,u){var c=[];c.push(r+"="+encodeURIComponent(n)),er.isNumber(i)&&c.push("expires="+new Date(i).toGMTString()),er.isString(s)&&c.push("path="+s),er.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 Es=p((kp,gs)=>{"use strict";gs.exports=function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}});var ws=p((_p,Ss)=>{"use strict";Ss.exports=function(e,r){return r?e.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):e}});var Ts=p((Dp,xs)=>{"use strict";var Jc=Es(),zc=ws();xs.exports=function(e,r){return e&&!Jc(r)?zc(e,r):r}});var As=p((qp,bs)=>{"use strict";var an=K(),$c=["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"];bs.exports=function(e){var r={},n,i,s;return e&&an.forEach(e.split(`
2
+ `),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]&&$c.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 Cs=p((Up,Os)=>{"use strict";var Rs=K();Os.exports=Rs.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=Rs.isString(a)?i(a):a;return u.protocol===n.protocol&&u.host===n.host}}():function(){return function(){return!0}}()});var bt=p((jp,Ps)=>{"use strict";function on(t){this.message=t}on.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")};on.prototype.__CANCEL__=!0;Ps.exports=on});var cn=p((Mp,Ns)=>{"use strict";var tr=K(),Wc=vs(),Kc=ys(),Xc=rn(),Yc=Ts(),Qc=As(),Zc=Cs(),un=sn(),el=At(),tl=bt();Ns.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=Yc(e.baseURL,e.url);o.open(e.method.toUpperCase(),Xc(h,e.params,e.paramsSerializer),!0),o.timeout=e.timeout;function m(){if(!!o){var v="getAllResponseHeaders"in o?Qc(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};Wc(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(un("Request aborted",e,"ECONNABORTED",o)),o=null)},o.onerror=function(){i(un("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||el.transitional;e.timeoutErrorMessage&&(x=e.timeoutErrorMessage),i(un(x,e,g.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",o)),o=null},tr.isStandardBrowserEnv()){var E=(e.withCredentials||Zc(h))&&e.xsrfCookieName?Kc.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 tl("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 At=p((Lp,_s)=>{"use strict";var G=K(),Is=fs(),rl=nn(),nl={"Content-Type":"application/x-www-form-urlencoded"};function ks(t,e){!G.isUndefined(t)&&G.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}function il(){var t;return typeof XMLHttpRequest!="undefined"?t=cn():typeof process!="undefined"&&Object.prototype.toString.call(process)==="[object process]"&&(t=cn()),t}function sl(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 rr={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:il(),transformRequest:[function(e,r){return Is(r,"Accept"),Is(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)?(ks(r,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):G.isObject(e)||r&&r["Content-Type"]==="application/json"?(ks(r,"application/json"),sl(e)):e}],transformResponse:[function(e){var r=this.transitional||rr.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"?rl(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){rr.headers[e]={}});G.forEach(["post","put","patch"],function(e){rr.headers[e]=G.merge(nl)});_s.exports=rr});var qs=p((Bp,Ds)=>{"use strict";var al=K(),ol=At();Ds.exports=function(e,r,n){var i=this||ol;return al.forEach(n,function(a){e=a.call(i,e,r)}),e}});var ln=p((Fp,Us)=>{"use strict";Us.exports=function(e){return!!(e&&e.__CANCEL__)}});var Ls=p((Vp,Ms)=>{"use strict";var js=K(),fn=qs(),ul=ln(),cl=At(),ll=bt();function dn(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new ll("canceled")}Ms.exports=function(e){dn(e),e.headers=e.headers||{},e.data=fn.call(e,e.data,e.headers,e.transformRequest),e.headers=js.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),js.forEach(["delete","get","head","post","put","patch","common"],function(i){delete e.headers[i]});var r=e.adapter||cl.adapter;return r(e).then(function(i){return dn(e),i.data=fn.call(e,i.data,i.headers,e.transformResponse),i},function(i){return ul(i)||(dn(e),i&&i.response&&(i.response.data=fn.call(e,i.response.data,i.response.headers,e.transformResponse))),Promise.reject(i)})}});var hn=p((Hp,Bs)=>{"use strict";var te=K();Bs.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 pn=p((Gp,Fs)=>{Fs.exports={version:"0.25.0"}});var Gs=p((Jp,Hs)=>{"use strict";var fl=pn().version,vn={};["object","boolean","number","function","string","symbol"].forEach(function(t,e){vn[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});var Vs={};vn.transitional=function(e,r,n){function i(s,a){return"[Axios v"+fl+"] 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&&!Vs[a]&&(Vs[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 dl(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)}}Hs.exports={assertOptions:dl,validators:vn}});var Xs=p((zp,Ks)=>{"use strict";var $s=K(),hl=rn(),Js=cs(),zs=Ls(),nr=hn(),Ws=Gs(),$e=Ws.validators;function Rt(t){this.defaults=t,this.interceptors={request:new Js,response:new Js}}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=nr(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&&Ws.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=[zs,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=zs(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=nr(this.defaults,e),hl(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")};$s.forEach(["delete","get","head","options"],function(e){Rt.prototype[e]=function(r,n){return this.request(nr(n||{},{method:e,url:r,data:(n||{}).data}))}});$s.forEach(["post","put","patch"],function(e){Rt.prototype[e]=function(r,n,i){return this.request(nr(i||{},{method:e,url:r,data:n}))}});Ks.exports=Rt});var Qs=p(($p,Ys)=>{"use strict";var pl=bt();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 pl(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}};Ys.exports=We});var ea=p((Wp,Zs)=>{"use strict";Zs.exports=function(e){return function(n){return e.apply(null,n)}}});var ra=p((Kp,ta)=>{"use strict";var vl=K();ta.exports=function(e){return vl.isObject(e)&&e.isAxiosError===!0}});var sa=p((Xp,mn)=>{"use strict";var na=K(),ml=Yr(),ir=Xs(),yl=hn(),gl=At();function ia(t){var e=new ir(t),r=ml(ir.prototype.request,e);return na.extend(r,ir.prototype,e),na.extend(r,e),r.create=function(i){return ia(yl(t,i))},r}var he=ia(gl);he.Axios=ir;he.Cancel=bt();he.CancelToken=Qs();he.isCancel=ln();he.VERSION=pn().version;he.all=function(e){return Promise.all(e)};he.spread=ea();he.isAxiosError=ra();mn.exports=he;mn.exports.default=he});var oa=p((Yp,aa)=>{aa.exports=sa()});var Sn=p((Lm,wa)=>{"use strict";wa.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,ba)=>{"use strict";var Cl=Sn(),_e=Object.prototype.toString;function Tn(t){return _e.call(t)==="[object Array]"}function wn(t){return typeof t=="undefined"}function Pl(t){return t!==null&&!wn(t)&&t.constructor!==null&&!wn(t.constructor)&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function Nl(t){return _e.call(t)==="[object ArrayBuffer]"}function Il(t){return typeof FormData!="undefined"&&t instanceof FormData}function kl(t){var e;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&t.buffer instanceof ArrayBuffer,e}function _l(t){return typeof t=="string"}function Dl(t){return typeof t=="number"}function xa(t){return t!==null&&typeof t=="object"}function fr(t){if(_e.call(t)!=="[object Object]")return!1;var e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}function ql(t){return _e.call(t)==="[object Date]"}function Ul(t){return _e.call(t)==="[object File]"}function jl(t){return _e.call(t)==="[object Blob]"}function Ta(t){return _e.call(t)==="[object Function]"}function Ml(t){return xa(t)&&Ta(t.pipe)}function Ll(t){return typeof URLSearchParams!="undefined"&&t instanceof URLSearchParams}function Bl(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function Fl(){return typeof navigator!="undefined"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window!="undefined"&&typeof document!="undefined"}function bn(t,e){if(!(t===null||typeof t=="undefined"))if(typeof t!="object"&&(t=[t]),Tn(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 xn(){var t={};function e(i,s){fr(t[s])&&fr(i)?t[s]=xn(t[s],i):fr(i)?t[s]=xn({},i):Tn(i)?t[s]=i.slice():t[s]=i}for(var r=0,n=arguments.length;r<n;r++)bn(arguments[r],e);return t}function Vl(t,e,r){return bn(e,function(i,s){r&&typeof i=="function"?t[s]=Cl(i,r):t[s]=i}),t}function Hl(t){return t.charCodeAt(0)===65279&&(t=t.slice(1)),t}ba.exports={isArray:Tn,isArrayBuffer:Nl,isBuffer:Pl,isFormData:Il,isArrayBufferView:kl,isString:_l,isNumber:Dl,isObject:xa,isPlainObject:fr,isUndefined:wn,isDate:ql,isFile:Ul,isBlob:jl,isFunction:Ta,isStream:Ml,isURLSearchParams:Ll,isStandardBrowserEnv:Fl,forEach:bn,merge:xn,extend:Vl,trim:Bl,stripBOM:Hl}});var An=p((Fm,Ra)=>{"use strict";var Qe=X();function Aa(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}Ra.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(Aa(l)+"="+Aa(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 Ca=p((Vm,Oa)=>{"use strict";var Gl=X();function dr(){this.handlers=[]}dr.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};dr.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)};dr.prototype.forEach=function(e){Gl.forEach(this.handlers,function(n){n!==null&&e(n)})};Oa.exports=dr});var Na=p((Hm,Pa)=>{"use strict";var Jl=X();Pa.exports=function(e,r){Jl.forEach(e,function(i,s){s!==r&&s.toUpperCase()===r.toUpperCase()&&(e[r]=i,delete e[s])})}});var Rn=p((Gm,Ia)=>{"use strict";Ia.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 On=p((Jm,ka)=>{"use strict";var zl=Rn();ka.exports=function(e,r,n,i,s){var a=new Error(e);return zl(a,r,n,i,s)}});var Da=p((zm,_a)=>{"use strict";var $l=On();_a.exports=function(e,r,n){var i=n.config.validateStatus;!n.status||!i||i(n.status)?e(n):r($l("Request failed with status code "+n.status,n.config,null,n.request,n))}});var Ua=p(($m,qa)=>{"use strict";var hr=X();qa.exports=hr.isStandardBrowserEnv()?function(){return{write:function(r,n,i,s,a,u){var c=[];c.push(r+"="+encodeURIComponent(n)),hr.isNumber(i)&&c.push("expires="+new Date(i).toGMTString()),hr.isString(s)&&c.push("path="+s),hr.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 Ma=p((Wm,ja)=>{"use strict";ja.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}});var Ba=p((Km,La)=>{"use strict";La.exports=function(e,r){return r?e.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):e}});var Va=p((Xm,Fa)=>{"use strict";var Wl=Ma(),Kl=Ba();Fa.exports=function(e,r){return e&&!Wl(r)?Kl(e,r):r}});var Ga=p((Ym,Ha)=>{"use strict";var Cn=X(),Xl=["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"];Ha.exports=function(e){var r={},n,i,s;return e&&Cn.forEach(e.split(`
3
+ `),function(u){if(s=u.indexOf(":"),n=Cn.trim(u.substr(0,s)).toLowerCase(),i=Cn.trim(u.substr(s+1)),n){if(r[n]&&Xl.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 $a=p((Qm,za)=>{"use strict";var Ja=X();za.exports=Ja.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=Ja.isString(a)?i(a):a;return u.protocol===n.protocol&&u.host===n.host}}():function(){return function(){return!0}}()});var Nn=p((Zm,Wa)=>{"use strict";var pr=X(),Yl=Da(),Ql=Ua(),Zl=An(),ef=Va(),tf=Ga(),rf=$a(),Pn=On();Wa.exports=function(e){return new Promise(function(n,i){var s=e.data,a=e.headers,u=e.responseType;pr.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=ef(e.baseURL,e.url);c.open(e.method.toUpperCase(),Zl(f,e.params,e.paramsSerializer),!0),c.timeout=e.timeout;function d(){if(!!c){var m="getAllResponseHeaders"in c?tf(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};Yl(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(Pn("Request aborted",e,"ECONNABORTED",c)),c=null)},c.onerror=function(){i(Pn("Network Error",e,null,c)),c=null},c.ontimeout=function(){var E="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(E=e.timeoutErrorMessage),i(Pn(E,e,e.transitional&&e.transitional.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",c)),c=null},pr.isStandardBrowserEnv()){var h=(e.withCredentials||rf(f))&&e.xsrfCookieName?Ql.read(e.xsrfCookieName):void 0;h&&(a[e.xsrfHeaderName]=h)}"setRequestHeader"in c&&pr.forEach(a,function(E,v){typeof s=="undefined"&&v.toLowerCase()==="content-type"?delete a[v]:c.setRequestHeader(v,E)}),pr.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 mr=p((ey,Ya)=>{"use strict";var J=X(),Ka=Na(),nf=Rn(),sf={"Content-Type":"application/x-www-form-urlencoded"};function Xa(t,e){!J.isUndefined(t)&&J.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}function af(){var t;return typeof XMLHttpRequest!="undefined"?t=Nn():typeof process!="undefined"&&Object.prototype.toString.call(process)==="[object process]"&&(t=Nn()),t}function of(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 vr={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:af(),transformRequest:[function(e,r){return Ka(r,"Accept"),Ka(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)?(Xa(r,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):J.isObject(e)||r&&r["Content-Type"]==="application/json"?(Xa(r,"application/json"),of(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"?nf(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}};vr.headers={common:{Accept:"application/json, text/plain, */*"}};J.forEach(["delete","get","head"],function(e){vr.headers[e]={}});J.forEach(["post","put","patch"],function(e){vr.headers[e]=J.merge(sf)});Ya.exports=vr});var Za=p((ty,Qa)=>{"use strict";var uf=X(),cf=mr();Qa.exports=function(e,r,n){var i=this||cf;return uf.forEach(n,function(a){e=a.call(i,e,r)}),e}});var In=p((ry,eo)=>{"use strict";eo.exports=function(e){return!!(e&&e.__CANCEL__)}});var no=p((ny,ro)=>{"use strict";var to=X(),kn=Za(),lf=In(),ff=mr();function _n(t){t.cancelToken&&t.cancelToken.throwIfRequested()}ro.exports=function(e){_n(e),e.headers=e.headers||{},e.data=kn.call(e,e.data,e.headers,e.transformRequest),e.headers=to.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),to.forEach(["delete","get","head","post","put","patch","common"],function(i){delete e.headers[i]});var r=e.adapter||ff.adapter;return r(e).then(function(i){return _n(e),i.data=kn.call(e,i.data,i.headers,e.transformResponse),i},function(i){return lf(i)||(_n(e),i&&i.response&&(i.response.data=kn.call(e,i.response.data,i.response.headers,e.transformResponse))),Promise.reject(i)})}});var Dn=p((iy,io)=>{"use strict";var W=X();io.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 so=p((sy,df)=>{df.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 lo=p((ay,co)=>{"use strict";var oo=so(),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 ao={},hf=oo.version.split(".");function uo(t,e){for(var r=e?e.split("."):hf,n=t.split("."),i=0;i<3;i++){if(r[i]>n[i])return!0;if(r[i]<n[i])return!1}return!1}qn.transitional=function(e,r,n){var i=r&&uo(r);function s(a,u){return"[Axios v"+oo.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&&!ao[u]&&(ao[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 pf(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)}}co.exports={isOlderVersion:uo,assertOptions:pf,validators:qn}});var yo=p((oy,mo)=>{"use strict";var po=X(),vf=An(),fo=Ca(),ho=no(),yr=Dn(),vo=lo(),Ze=vo.validators;function Ct(t){this.defaults=t,this.interceptors={request:new fo,response:new fo}}Ct.prototype.request=function(e){typeof e=="string"?(e=arguments[1]||{},e.url=arguments[0]):e=e||{},e=yr(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&&vo.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=[ho,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=ho(c)}catch(f){return Promise.reject(f)}for(;s.length;)a=a.then(s.shift(),s.shift());return a};Ct.prototype.getUri=function(e){return e=yr(this.defaults,e),vf(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")};po.forEach(["delete","get","head","options"],function(e){Ct.prototype[e]=function(r,n){return this.request(yr(n||{},{method:e,url:r,data:(n||{}).data}))}});po.forEach(["post","put","patch"],function(e){Ct.prototype[e]=function(r,n,i){return this.request(yr(i||{},{method:e,url:r,data:n}))}});mo.exports=Ct});var jn=p((uy,go)=>{"use strict";function Un(t){this.message=t}Un.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")};Un.prototype.__CANCEL__=!0;go.exports=Un});var So=p((cy,Eo)=>{"use strict";var mf=jn();function gr(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 mf(i),e(r.reason))})}gr.prototype.throwIfRequested=function(){if(this.reason)throw this.reason};gr.source=function(){var e,r=new gr(function(i){e=i});return{token:r,cancel:e}};Eo.exports=gr});var xo=p((ly,wo)=>{"use strict";wo.exports=function(e){return function(n){return e.apply(null,n)}}});var bo=p((fy,To)=>{"use strict";To.exports=function(e){return typeof e=="object"&&e.isAxiosError===!0}});var Oo=p((dy,Mn)=>{"use strict";var Ao=X(),yf=Sn(),Er=yo(),gf=Dn(),Ef=mr();function Ro(t){var e=new Er(t),r=yf(Er.prototype.request,e);return Ao.extend(r,Er.prototype,e),Ao.extend(r,e),r}var ue=Ro(Ef);ue.Axios=Er;ue.create=function(e){return Ro(gf(ue.defaults,e))};ue.Cancel=jn();ue.CancelToken=So();ue.isCancel=In();ue.all=function(e){return Promise.all(e)};ue.spread=xo();ue.isAxiosError=bo();Mn.exports=ue;Mn.exports.default=ue});var Po=p((hy,Co)=>{Co.exports=Oo()});var Ln=p((xy,Io)=>{"use strict";Io.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((Ty,Do)=>{"use strict";var Sf=Ln(),De=Object.prototype.toString;function Vn(t){return De.call(t)==="[object Array]"}function Bn(t){return typeof t=="undefined"}function wf(t){return t!==null&&!Bn(t)&&t.constructor!==null&&!Bn(t.constructor)&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function xf(t){return De.call(t)==="[object ArrayBuffer]"}function Tf(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 Af(t){return typeof t=="string"}function Rf(t){return typeof t=="number"}function ko(t){return t!==null&&typeof t=="object"}function xr(t){if(De.call(t)!=="[object Object]")return!1;var e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}function Of(t){return De.call(t)==="[object Date]"}function Cf(t){return De.call(t)==="[object File]"}function Pf(t){return De.call(t)==="[object Blob]"}function _o(t){return De.call(t)==="[object Function]"}function Nf(t){return ko(t)&&_o(t.pipe)}function If(t){return typeof URLSearchParams!="undefined"&&t instanceof URLSearchParams}function kf(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function _f(){return typeof navigator!="undefined"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window!="undefined"&&typeof document!="undefined"}function Hn(t,e){if(!(t===null||typeof t=="undefined"))if(typeof t!="object"&&(t=[t]),Vn(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 Fn(){var t={};function e(i,s){xr(t[s])&&xr(i)?t[s]=Fn(t[s],i):xr(i)?t[s]=Fn({},i):Vn(i)?t[s]=i.slice():t[s]=i}for(var r=0,n=arguments.length;r<n;r++)Hn(arguments[r],e);return t}function Df(t,e,r){return Hn(e,function(i,s){r&&typeof i=="function"?t[s]=Sf(i,r):t[s]=i}),t}function qf(t){return t.charCodeAt(0)===65279&&(t=t.slice(1)),t}Do.exports={isArray:Vn,isArrayBuffer:xf,isBuffer:wf,isFormData:Tf,isArrayBufferView:bf,isString:Af,isNumber:Rf,isObject:ko,isPlainObject:xr,isUndefined:Bn,isDate:Of,isFile:Cf,isBlob:Pf,isFunction:_o,isStream:Nf,isURLSearchParams:If,isStandardBrowserEnv:_f,forEach:Hn,merge:Fn,extend:Df,trim:kf,stripBOM:qf}});var Gn=p((by,Uo)=>{"use strict";var et=Y();function qo(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}Uo.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(qo(l)+"="+qo(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 Mo=p((Ay,jo)=>{"use strict";var Uf=Y();function Tr(){this.handlers=[]}Tr.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};Tr.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)};Tr.prototype.forEach=function(e){Uf.forEach(this.handlers,function(n){n!==null&&e(n)})};jo.exports=Tr});var Bo=p((Ry,Lo)=>{"use strict";var jf=Y();Lo.exports=function(e,r){jf.forEach(e,function(i,s){s!==r&&s.toUpperCase()===r.toUpperCase()&&(e[r]=i,delete e[s])})}});var Jn=p((Oy,Fo)=>{"use strict";Fo.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 zn=p((Cy,Vo)=>{"use strict";var Mf=Jn();Vo.exports=function(e,r,n,i,s){var a=new Error(e);return Mf(a,r,n,i,s)}});var Go=p((Py,Ho)=>{"use strict";var Lf=zn();Ho.exports=function(e,r,n){var i=n.config.validateStatus;!n.status||!i||i(n.status)?e(n):r(Lf("Request failed with status code "+n.status,n.config,null,n.request,n))}});var zo=p((Ny,Jo)=>{"use strict";var br=Y();Jo.exports=br.isStandardBrowserEnv()?function(){return{write:function(r,n,i,s,a,u){var c=[];c.push(r+"="+encodeURIComponent(n)),br.isNumber(i)&&c.push("expires="+new Date(i).toGMTString()),br.isString(s)&&c.push("path="+s),br.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 Wo=p((Iy,$o)=>{"use strict";$o.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}});var Xo=p((ky,Ko)=>{"use strict";Ko.exports=function(e,r){return r?e.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):e}});var Qo=p((_y,Yo)=>{"use strict";var Bf=Wo(),Ff=Xo();Yo.exports=function(e,r){return e&&!Bf(r)?Ff(e,r):r}});var eu=p((Dy,Zo)=>{"use strict";var $n=Y(),Vf=["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"];Zo.exports=function(e){var r={},n,i,s;return e&&$n.forEach(e.split(`
4
+ `),function(u){if(s=u.indexOf(":"),n=$n.trim(u.substr(0,s)).toLowerCase(),i=$n.trim(u.substr(s+1)),n){if(r[n]&&Vf.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 nu=p((qy,ru)=>{"use strict";var tu=Y();ru.exports=tu.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=tu.isString(a)?i(a):a;return u.protocol===n.protocol&&u.host===n.host}}():function(){return function(){return!0}}()});var Pt=p((Uy,iu)=>{"use strict";function Wn(t){this.message=t}Wn.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")};Wn.prototype.__CANCEL__=!0;iu.exports=Wn});var Xn=p((jy,su)=>{"use strict";var Ar=Y(),Hf=Go(),Gf=zo(),Jf=Gn(),zf=Qo(),$f=eu(),Wf=nu(),Kn=zn(),Kf=Nt(),Xf=Pt();su.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)}Ar.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=zf(e.baseURL,e.url);o.open(e.method.toUpperCase(),Jf(h,e.params,e.paramsSerializer),!0),o.timeout=e.timeout;function m(){if(!!o){var v="getAllResponseHeaders"in o?$f(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};Hf(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(Kn("Request aborted",e,"ECONNABORTED",o)),o=null)},o.onerror=function(){i(Kn("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||Kf.transitional;e.timeoutErrorMessage&&(x=e.timeoutErrorMessage),i(Kn(x,e,g.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",o)),o=null},Ar.isStandardBrowserEnv()){var E=(e.withCredentials||Wf(h))&&e.xsrfCookieName?Gf.read(e.xsrfCookieName):void 0;E&&(a[e.xsrfHeaderName]=E)}"setRequestHeader"in o&&Ar.forEach(a,function(x,g){typeof s=="undefined"&&g.toLowerCase()==="content-type"?delete a[g]:o.setRequestHeader(g,x)}),Ar.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 Xf("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((My,uu)=>{"use strict";var z=Y(),au=Bo(),Yf=Jn(),Qf={"Content-Type":"application/x-www-form-urlencoded"};function ou(t,e){!z.isUndefined(t)&&z.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}function Zf(){var t;return typeof XMLHttpRequest!="undefined"?t=Xn():typeof process!="undefined"&&Object.prototype.toString.call(process)==="[object process]"&&(t=Xn()),t}function ed(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 Rr={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:Zf(),transformRequest:[function(e,r){return au(r,"Accept"),au(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)?(ou(r,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):z.isObject(e)||r&&r["Content-Type"]==="application/json"?(ou(r,"application/json"),ed(e)):e}],transformResponse:[function(e){var r=this.transitional||Rr.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"?Yf(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){Rr.headers[e]={}});z.forEach(["post","put","patch"],function(e){Rr.headers[e]=z.merge(Qf)});uu.exports=Rr});var lu=p((Ly,cu)=>{"use strict";var td=Y(),rd=Nt();cu.exports=function(e,r,n){var i=this||rd;return td.forEach(n,function(a){e=a.call(i,e,r)}),e}});var Yn=p((By,fu)=>{"use strict";fu.exports=function(e){return!!(e&&e.__CANCEL__)}});var pu=p((Fy,hu)=>{"use strict";var du=Y(),Qn=lu(),nd=Yn(),id=Nt(),sd=Pt();function Zn(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new sd("canceled")}hu.exports=function(e){Zn(e),e.headers=e.headers||{},e.data=Qn.call(e,e.data,e.headers,e.transformRequest),e.headers=du.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),du.forEach(["delete","get","head","post","put","patch","common"],function(i){delete e.headers[i]});var r=e.adapter||id.adapter;return r(e).then(function(i){return Zn(e),i.data=Qn.call(e,i.data,i.headers,e.transformResponse),i},function(i){return nd(i)||(Zn(e),i&&i.response&&(i.response.data=Qn.call(e,i.response.data,i.response.headers,e.transformResponse))),Promise.reject(i)})}});var ei=p((Vy,vu)=>{"use strict";var re=Y();vu.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 ti=p((Hy,mu)=>{mu.exports={version:"0.23.0"}});var Eu=p((Gy,gu)=>{"use strict";var ad=ti().version,ri={};["object","boolean","number","function","string","symbol"].forEach(function(t,e){ri[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});var yu={};ri.transitional=function(e,r,n){function i(s,a){return"[Axios v"+ad+"] 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&&!yu[a]&&(yu[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 od(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)}}gu.exports={assertOptions:od,validators:ri}});var Au=p((Jy,bu)=>{"use strict";var xu=Y(),ud=Gn(),Su=Mo(),wu=pu(),Or=ei(),Tu=Eu(),tt=Tu.validators;function It(t){this.defaults=t,this.interceptors={request:new Su,response:new Su}}It.prototype.request=function(e){typeof e=="string"?(e=arguments[1]||{},e.url=arguments[0]):e=e||{},e=Or(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&&Tu.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=[wu,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=wu(c)}catch(f){return Promise.reject(f)}for(;s.length;)a=a.then(s.shift(),s.shift());return a};It.prototype.getUri=function(e){return e=Or(this.defaults,e),ud(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")};xu.forEach(["delete","get","head","options"],function(e){It.prototype[e]=function(r,n){return this.request(Or(n||{},{method:e,url:r,data:(n||{}).data}))}});xu.forEach(["post","put","patch"],function(e){It.prototype[e]=function(r,n,i){return this.request(Or(i||{},{method:e,url:r,data:n}))}});bu.exports=It});var Ou=p((zy,Ru)=>{"use strict";var cd=Pt();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 cd(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}};Ru.exports=rt});var Pu=p(($y,Cu)=>{"use strict";Cu.exports=function(e){return function(n){return e.apply(null,n)}}});var Iu=p((Wy,Nu)=>{"use strict";Nu.exports=function(e){return typeof e=="object"&&e.isAxiosError===!0}});var Du=p((Ky,ni)=>{"use strict";var ku=Y(),ld=Ln(),Cr=Au(),fd=ei(),dd=Nt();function _u(t){var e=new Cr(t),r=ld(Cr.prototype.request,e);return ku.extend(r,Cr.prototype,e),ku.extend(r,e),r.create=function(i){return _u(fd(t,i))},r}var pe=_u(dd);pe.Axios=Cr;pe.Cancel=Pt();pe.CancelToken=Ou();pe.isCancel=Yn();pe.VERSION=ti().version;pe.all=function(e){return Promise.all(e)};pe.spread=Pu();pe.isAxiosError=Iu();ni.exports=pe;ni.exports.default=pe});var ii=p((Xy,qu)=>{qu.exports=Du()});var si=p(Nr=>{"use strict";Object.defineProperty(Nr,"__esModule",{value:!0});Nr.default=void 0;var hd=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):void 0,pd=hd;Nr.default=pd});var Mu=p(ai=>{"use strict";Object.defineProperty(ai,"__esModule",{value:!0});ai.default=gd;var vd=md(si());function md(t){return t&&t.__esModule?t:{default:t}}function Ir(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Ir=function(r){return typeof r}:Ir=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Ir(t)}var yd=10,ju=2;function gd(t){return kr(t,[])}function kr(t,e){switch(Ir(t)){case"string":return JSON.stringify(t);case"function":return t.name?"[function ".concat(t.name,"]"):"[function]";case"object":return t===null?"null":Ed(t,e);default:return String(t)}}function Ed(t,e){if(e.indexOf(t)!==-1)return"[Circular]";var r=[].concat(e,[t]),n=xd(t);if(n!==void 0){var i=n.call(t);if(i!==t)return typeof i=="string"?i:kr(i,r)}else if(Array.isArray(t))return wd(t,r);return Sd(t,r)}function Sd(t,e){var r=Object.keys(t);if(r.length===0)return"{}";if(e.length>ju)return"["+Td(t)+"]";var n=r.map(function(i){var s=kr(t[i],e);return i+": "+s});return"{ "+n.join(", ")+" }"}function wd(t,e){if(t.length===0)return"[]";if(e.length>ju)return"[Array]";for(var r=Math.min(yd,t.length),n=t.length-r,i=[],s=0;s<r;++s)i.push(kr(t[s],e));return n===1?i.push("... 1 more item"):n>1&&i.push("... ".concat(n," more items")),"["+i.join(", ")+"]"}function xd(t){var e=t[String(vd.default)];if(typeof e=="function")return e;if(typeof t.inspect=="function")return t.inspect}function Td(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 Lu=p(oi=>{"use strict";Object.defineProperty(oi,"__esModule",{value:!0});oi.default=bd;function bd(t,e){var r=Boolean(t);if(!r)throw new Error(e!=null?e:"Unexpected invariant triggered.")}});var Vu=p(ui=>{"use strict";Object.defineProperty(ui,"__esModule",{value:!0});ui.default=Rd;var Ad=Fu(Lu()),Bu=Fu(si());function Fu(t){return t&&t.__esModule?t:{default:t}}function Rd(t){var e=t.prototype.toJSON;typeof e=="function"||(0,Ad.default)(0),t.prototype.inspect=e,Bu.default&&(t.prototype[Bu.default]=e)}});var zu=p(qe=>{"use strict";Object.defineProperty(qe,"__esModule",{value:!0});qe.isNode=Cd;qe.Token=qe.Location=void 0;var Hu=Od(Vu());function Od(t){return t&&t.__esModule?t:{default:t}}var Gu=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=Gu;(0,Hu.default)(Gu);var Ju=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=Ju;(0,Hu.default)(Ju);function Cd(t){return t!=null&&typeof t.kind=="string"}});var Ku=p(ye=>{"use strict";Object.defineProperty(ye,"__esModule",{value:!0});ye.visit=Id;ye.visitInParallel=kd;ye.getVisitFn=_r;ye.BREAK=ye.QueryDocumentKeys=void 0;var Pd=Nd(Mu()),$u=zu();function Nd(t){return t&&t.__esModule?t:{default:t}}var Wu={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=Wu;var nt=Object.freeze({});ye.BREAK=nt;function Id(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Wu,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,N=0;N<u.length;N++){var M=u[N][0],b=u[N][1];i&&(M-=O),i&&b===null?(c.splice(M,1),O++):c[M]=b}}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,$u.isNode)(c))throw new Error("Invalid AST Node: ".concat((0,Pd.default)(c),"."));var A=_r(e,c.kind,m);if(A){if(w=A.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,$u.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 kd(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=_r(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=_r(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 _r(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 Qu=p(kt=>{"use strict";Object.defineProperty(kt,"__esModule",{value:!0});kt.dedentBlockStringValue=_d;kt.getBlockStringIndentation=Yu;kt.printBlockString=Dd;function _d(t){var e=t.split(/\r\n|[\n\r]/g),r=Yu(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&&Xu(e[i]);)++i;for(var s=e.length;s>i&&Xu(e[s-1]);)--s;return e.slice(i,s).join(`
5
5
  `)}function Xu(t){for(var e=0;e<t.length;++e)if(t[e]!==" "&&t[e]!==" ")return!1;return!0}function Yu(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 Dd(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
6
  `)===-1,i=t[0]===" "||t[0]===" ",s=t[t.length-1]==='"',a=t[t.length-1]==="\\",u=!n||s||a||r,c="";return u&&!(n&&i)&&(c+=`
7
7
  `+e),c+=e?t.replace(/\n/g,`
8
8
  `+e):t,u&&(c+=`
9
- `),'"""'+c.replace(/"""/g,'\\"""')+'"""'}});var ec=p(ui=>{"use strict";Object.defineProperty(ui,"__esModule",{value:!0});ui.print=jd;var qd=Ku(),Ud=Qu();function jd(t){return(0,qd.visit)(t,{leave:Ld})}var Md=80,Ld={Name:function(e){return e.value},Variable:function(e){return"$"+e.name},Document:function(e){return S(e.definitions,`
9
+ `),'"""'+c.replace(/"""/g,'\\"""')+'"""'}});var ec=p(ci=>{"use strict";Object.defineProperty(ci,"__esModule",{value:!0});ci.print=jd;var qd=Ku(),Ud=Qu();function jd(t){return(0,qd.visit)(t,{leave:Ld})}var Md=80,Ld={Name:function(e){return e.value},Variable:function(e){return"$"+e.name},Document:function(e){return S(e.definitions,`
10
10
 
11
11
  `)+`
12
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,u=L("",r,": ")+n,c=u+L("(",S(i,", "),")");return c.length>Md&&(c=u+L(`(
@@ -24,12 +24,12 @@ var sc=Object.create;var ci=Object.defineProperty;var ac=Object.getOwnPropertyDe
24
24
  `)),`
25
25
  }`)}function L(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"";return e!=null&&e!==""?t+e+r:""}function Dr(t){return L(" ",t.replace(/\n/g,`
26
26
  `))}function Bd(t){return t.indexOf(`
27
- `)!==-1}function Zu(t){return t!=null&&t.some(Bd)}});function jr(t){this.message=t}jr.prototype=new Error,jr.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 jr("'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 fc(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 dc(t,e){if(typeof t!="string")throw new _t("Invalid token specified");var r=(e=e||{}).header===!0?0:1;try{return JSON.parse(fc(t.split(".")[r]))}catch(n){throw new _t("Invalid token specified: "+n.message)}}_t.prototype=new Error,_t.prototype.name="InvalidTokenError";var fi=dc;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,Dt=I.Cancel,di=I.NullEvent,qt=I.Assign,zd=I.After,$d=I.DoneState,Ut=I.Log,hi=I.Init,at=I.Invoke,Wd=I.ErrorExecution,Mr=I.ErrorPlatform,Lr=I.ErrorCustom,ot=I.Update,pi=I.Choose,vi=I.Pure;var jt=".",Br={},Mt="xstate.guard",mi="";var j=!0;var Lt;function ct(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?ct(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 hc(t){return typeof t=="object"&&"value"in t&&"context"in t&&"event"in t&&"_event"in t}function Be(t,e){if(hc(t))return t.value;if(ve(t))return ut(t);if(typeof t!="string")return t;var r=Ft(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 Fr(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 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 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 gi(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(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]]: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 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)),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 Si(t){return/^(done|error)\./.test(t)}function Vr(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 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 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 Hr(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 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 bi(t){try{return"subscribe"in t&&k(t.subscribe)}catch{return!1}}var fe=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}(),th=(Lt={},Lt[fe]=function(){return this},Lt[Symbol.observable]=function(){return this},Lt);function de(t){return!!t&&"__xstatenode"in t}function Ai(t){return!!t&&typeof t.send=="function"}function ft(t,e){return P(t)||typeof t=="number"?y({type:t},e):t}function F(t,e){if(!P(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 be(t,e){var r=Ei(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 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 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 Jt(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 Ae=F({type:hi});function zt(t,e){return e&&e[t]||void 0}function Ve(t,e){var r;if(P(t)||typeof t=="number"){var n=zt(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=zt(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 Wt(t){var e=Ve(t);return y(y({id:P(t)?t:e.id},e),{type:e.type})}function Ci(t){return P(t)?{type:Le,event:t}:vt(t,{to:Ee.Internal})}function pc(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:Bt(t)}}function vc(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 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 mc=function(t,e,r){return y(y({},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 yc(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 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 $t(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),u=a[0],c=a[1],l=u.length?Hr(r,n,u,e):r,o=s?[r]:void 0,f=U(c.map(function(d){var h;switch(d.type){case Le:return pc(d);case xe:var m=vc(d,l,n,t.options.delays);return j||B(!P(d.delay)||typeof m.delay=="number","No delay reference for delay expression '".concat(d.delay,"' was found on machine '").concat(t.id,"'")),m;case Ut:return mc(d,l,n);case pi:{var E=d,v=(h=E.conds.find(function(q){var V=Ht(q.cond,t.options.guards);return!V||Gt(t,V,l,n,e)}))===null||h===void 0?void 0:h.actions;if(!v)return[];var x=C($t(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 vi:{var v=d.get(l,n.data);if(!v)return[];var O=C($t(t,e,l,n,pt(ee(v),t.options.actions),s),2),N=O[0],M=O[1];return l=M,o==null||o.push(l),N}case Me:return yc(d,l,n);case qt:{l=Hr(l,n,[d],e),o==null||o.push(l);break}default:var b=Ve(d,t.options.actions),w=b.exec;if(w&&o){var A=o.length-1;b=y(y({},b),{exec:function(q){for(var V=[],Q=1;Q<arguments.length;Q++)V[Q-1]=arguments[Q];w.apply(void 0,D([o[A]],C(V),!1))}})}return b}}).filter(function(d){return!!d}));return[f,l]}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],u=t.data?Te(t.data,r,n):void 0,c=a?ji(a,t.id,u):qi(t.id);return c.meta=t,c}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 gc(t){try{return typeof t.send=="function"}catch{return!1}}function Mi(t){return gc(t)&&"id"in t}function Li(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 Pe(t){return Object.keys(t.states).map(function(e){return t.states[e]}).filter(function(e){return e.type!=="history"})}function Jr(t){var e=[t];return yt(t)?e:e.concat(U(Pe(t).map(Jr)))}function Ne(t,e){var r,n,i,s,a,u,c,l,o=new Set(t),f=Gr(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(A){r={error:A}}finally{try{m&&!m.done&&(n=h.return)&&n.call(h)}finally{if(r)throw r.error}}var x=Gr(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(Pe(E))),N=O.next();!N.done;N=O.next()){var M=N.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{N&&!N.done&&(u=O.return)&&u.call(O)}finally{if(a)throw a.error}}}}catch(A){i={error:A}}finally{try{T&&!T.done&&(s=g.return)&&s.call(g)}finally{if(i)throw i.error}}try{for(var b=R(d),w=b.next();!w.done;w=b.next())for(var E=w.value,v=E.parent;v&&!d.has(v);)d.add(v),v=v.parent}catch(A){c={error:A}}finally{try{w&&!w.done&&(l=b.return)&&l.call(b)}finally{if(c)throw c.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(yt(n))return n.key}else return{}}var i={};return r.forEach(function(s){i[s.key]=Bi(s,e)}),i}function Gr(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 Fi(t,e){var r=Ne([t],e);return Bi(t,Gr(r))}function gt(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"&&gt(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 zr(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=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=Br,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||Br,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=Ae;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=Ae;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 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 Ec={deferEvents:!1},Wr=function(){function t(e){this.processingEvent=!1,this.queue=[],this.initialized=!1,this.options=y(y({},Ec),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 Kr=new Map,Sc=0,Et={bookId:function(){return"x:".concat(Sc++)},register:function(t,e){return Kr.set(t,e),t},get:function(t){return Kr.get(t)},free:function(t){Kr.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 wc(){var t=Kt();if(t&&"__xstate__"in t)return t.__xstate__}function zi(t){if(!!Kt()){var e=wc();e&&e.register(t)}}function $i(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=Li({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 xc={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(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.
27
+ `)!==-1}function Zu(t){return t!=null&&t.some(Bd)}});function jr(t){this.message=t}jr.prototype=new Error,jr.prototype.name="InvalidCharacterError";var fi=typeof window!="undefined"&&window.atob&&window.atob.bind(window)||function(t){var e=String(t).replace(/=+$/,"");if(e.length%4==1)throw new jr("'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 fc(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(fi(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 fi(e)}}function Dt(t){this.message=t}function dc(t,e){if(typeof t!="string")throw new Dt("Invalid token specified");var r=(e=e||{}).header===!0?0:1;try{return JSON.parse(fc(t.split(".")[r]))}catch(n){throw new Dt("Invalid token specified: "+n.message)}}Dt.prototype=new Error,Dt.prototype.name="InvalidTokenError";var di=dc;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,qt=I.Cancel,hi=I.NullEvent,Ut=I.Assign,zd=I.After,$d=I.DoneState,jt=I.Log,pi=I.Init,at=I.Invoke,Wd=I.ErrorExecution,Mr=I.ErrorPlatform,Lr=I.ErrorCustom,ot=I.Update,vi=I.Choose,mi=I.Pure;var Mt=".",Br={},Lt="xstate.guard",yi="";var j=!0;var Bt;function ct(t,e,r){r===void 0&&(r=Mt);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?ct(n[s],i[s]):!1})}function Ft(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 Vt(t,e){try{return ve(t)?t:t.toString().split(e)}catch{throw new Error("'".concat(t,"' is not a valid state path."))}}function hc(t){return typeof t=="object"&&"value"in t&&"context"in t&&"event"in t&&"_event"in t}function Be(t,e){if(hc(t))return t.value;if(ve(t))return ut(t);if(typeof t!="string")return t;var r=Vt(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 Fr(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 gi=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 Ei(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(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]]: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 Si(t){return ve(t)?t:[t]}function ee(t){return t===void 0?[]:Si(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 wi(t){return/^(done|error)\./.test(t)}function Vr(t){return!!(t instanceof Promise||t!==null&&(k(t)||typeof t=="object")&&k(t.then))}function xi(t){return t!==null&&typeof t=="object"&&"transition"in t&&typeof t.transition=="function"}function Ht(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 Ti(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:Ti(r,i)}}})}function bi(t,e){return{current:e,states:Ti(t,e)}}function Hr(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 P(t){return typeof t=="string"}function Gt(t,e){if(!!t)return P(t)?{type:Lt,name:t,predicate:e?e[t]:void 0}:k(t)?{type:Lt,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"}(),th=(Bt={},Bt[fe]=function(){return this},Bt[Symbol.observable]=function(){return this},Bt);function de(t){return!!t&&"__xstatenode"in t}function Ri(t){return!!t&&typeof t.send=="function"}function ft(t,e){return P(t)||typeof t=="number"?y({type:t},e):t}function F(t,e){if(!P(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 be(t,e){var r=Si(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 Oi(t){if(!(t===void 0||t===yi))return ee(t)}function Ci(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 Jt(t,e,r,n,i){var s=t.options.guards,a={state:i,cond:e,_event:n};if(e.type===Lt)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 zt(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 Ae=F({type:pi});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=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 Kt(t){var e=Ve(t);return y(y({id:P(t)?t:e.id},e),{type:e.type})}function Pi(t){return P(t)?{type:Le,event:t}:vt(t,{to:Ee.Internal})}function pc(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:Ft(t)}}function vc(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 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 mc=function(t,e,r){return y(y({},t),{value:P(t.expr)?t.expr:t.expr(e,r.data,{_event:r})})},Ni=function(t){return{type:qt,sendId:t}};function Ii(t){var e=Kt(t);return{type:I.Start,activity:e,exec:void 0}}function ki(t){var e=k(t)?t:Kt(t);return{type:I.Stop,activity:e,exec:void 0}}function yc(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 _i=function(t){return{type:Ut,assignment:t}};function Di(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 Wt(t,e,r,n,i,s){s===void 0&&(s=!1);var a=C(s?[[],i]:Ht(i,function(d){return d.type===Ut}),2),u=a[0],c=a[1],l=u.length?Hr(r,n,u,e):r,o=s?[r]:void 0,f=U(c.map(function(d){var h;switch(d.type){case Le:return pc(d);case xe:var m=vc(d,l,n,t.options.delays);return j||B(!P(d.delay)||typeof m.delay=="number","No delay reference for delay expression '".concat(d.delay,"' was found on machine '").concat(t.id,"'")),m;case jt:return mc(d,l,n);case vi:{var E=d,v=(h=E.conds.find(function(q){var V=Gt(q.cond,t.options.guards);return!V||Jt(t,V,l,n,e)}))===null||h===void 0?void 0:h.actions;if(!v)return[];var x=C(Wt(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 mi:{var v=d.get(l,n.data);if(!v)return[];var O=C(Wt(t,e,l,n,pt(ee(v),t.options.actions),s),2),N=O[0],M=O[1];return l=M,o==null||o.push(l),N}case Me:return yc(d,l,n);case Ut:{l=Hr(l,n,[d],e),o==null||o.push(l);break}default:var b=Ve(d,t.options.actions),w=b.exec;if(w&&o){var A=o.length-1;b=y(y({},b),{exec:function(q){for(var V=[],Q=1;Q<arguments.length;Q++)V[Q-1]=arguments[Q];w.apply(void 0,D([o[A]],C(V),!1))}})}return b}}).filter(function(d){return!!d}));return[f,l]}var qi=[],Ce=function(t,e){qi.push(t);var r=e(t);return qi.pop(),r};function Ui(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 ji(t,e,r,n){var i,s=zt(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?Mi(a,t.id,u):Ui(t.id);return c.meta=t,c}function Mi(t,e,r){var n=Ui(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 gc(t){try{return typeof t.send=="function"}catch{return!1}}function Li(t){return gc(t)&&"id"in t}function Bi(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 Pe(t){return Object.keys(t.states).map(function(e){return t.states[e]}).filter(function(e){return e.type!=="history"})}function Jr(t){var e=[t];return yt(t)?e:e.concat(U(Pe(t).map(Jr)))}function Ne(t,e){var r,n,i,s,a,u,c,l,o=new Set(t),f=Gr(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(A){r={error:A}}finally{try{m&&!m.done&&(n=h.return)&&n.call(h)}finally{if(r)throw r.error}}var x=Gr(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(Pe(E))),N=O.next();!N.done;N=O.next()){var M=N.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{N&&!N.done&&(u=O.return)&&u.call(O)}finally{if(a)throw a.error}}}}catch(A){i={error:A}}finally{try{T&&!T.done&&(s=g.return)&&s.call(g)}finally{if(i)throw i.error}}try{for(var b=R(d),w=b.next();!w.done;w=b.next())for(var E=w.value,v=E.parent;v&&!d.has(v);)d.add(v),v=v.parent}catch(A){c={error:A}}finally{try{w&&!w.done&&(l=b.return)&&l.call(b)}finally{if(c)throw c.error}}return d}function Fi(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]=Fi(s,e)}),i}function Gr(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 Vi(t,e){var r=Ne([t],e);return Fi(t,Gr(r))}function gt(t,e){return Array.isArray(t)?t.some(function(r){return r===e}):t instanceof Set?t.has(e):!1}function Hi(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"&&gt(t,r)}):e.type==="parallel"?Pe(e).every(function(r){return Ie(t,r)}):!1}function Gi(t){return t===void 0&&(t=[]),t.reduce(function(e,r){return r.meta!==void 0&&(e[r.id]=r.meta),e},{})}function zr(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 Ji(t){return typeof t!="object"||t===null?!1:"value"in t&&"_event"in t}function zi(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=Br,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||Br,this.meta=Gi(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 Hi(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=Ae;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=Ae;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 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 Ec={deferEvents:!1},Wr=function(){function t(e){this.processingEvent=!1,this.queue=[],this.initialized=!1,this.options=y(y({},Ec),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 Kr=new Map,Sc=0,Et={bookId:function(){return"x:".concat(Sc++)},register:function(t,e){return Kr.set(t,e),t},get:function(t){return Kr.get(t)},free:function(t){Kr.delete(t)}};function Xt(){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 wc(){var t=Xt();if(t&&"__xstate__"in t)return t.__xstate__}function $i(t){if(!!Xt()){var e=wc();e&&e.register(t)}}function Wi(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=Bi({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 xc={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 Ki=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.
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 h=n.nextState(d);n.update(h,d)}),n._state},this.sendTo=function(o,f){var d=n.parent&&(f===Ee.Parent||n.parent.id===f),h=d?n.parent:P(f)?n.children.get(f)||Et.get(f):Ai(f)?f:void 0;if(!h){if(!d)throw new Error("Unable to send event to child '".concat(f,"' from service '").concat(n.id,"'."));j||B(!1,"Service '".concat(n.id,"' has no parent: unable to send event ").concat(o.type));return}"machine"in h?h.send(y(y({},o),{name:o.name===Lr?"".concat(Oe(n.id)):o.name,origin:n.sessionId})):h.send(o.data)};var i=y(y({},t.defaultOptions),r),s=i.clock,a=i.logger,u=i.parent,c=i.id,l=c!==void 0?c:e.id;this.id=l,this.logger=a,this.clock=s,this.parent=u,this.options=i,this.scheduler=new Wr({deferEvents:this.options.deferEvents}),this.sessionId=Et.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 u=a.value;this.exec(u,e,r)}}catch(c){n={error:c}}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,u,c,l,o,f=this;if(e._sessionid=this.sessionId,this._state=e,this.options.execute&&this.execute(this.state),this.children.forEach(function(A){f.state.children[A.id]=A}),this.devTools&&this.devTools.send(r.data,e),e.event)try{for(var d=R(this.eventListeners),h=d.next();!h.done;h=d.next()){var m=h.value;m(e.event)}}catch(A){n={error:A}}finally{try{h&&!h.done&&(i=d.return)&&i.call(d)}finally{if(n)throw n.error}}try{for(var E=R(this.listeners),v=E.next();!v.done;v=E.next()){var m=v.value;m(e,e.event)}}catch(A){s={error:A}}finally{try{v&&!v.done&&(a=E.return)&&a.call(E)}finally{if(s)throw s.error}}try{for(var x=R(this.contextListeners),g=x.next();!g.done;g=x.next()){var T=g.value;T(this.state.context,this.state.history?this.state.history.context:void 0)}}catch(A){u={error:A}}finally{try{g&&!g.done&&(c=x.return)&&c.call(x)}finally{if(u)throw u.error}}var O=Ie(e.configuration||[],this.machine);if(this.state.configuration&&O){var N=e.configuration.find(function(A){return A.type==="final"&&A.parent===f.machine}),M=N&&N.doneData?Te(N.doneData,e.context,r):void 0;try{for(var b=R(this.doneListeners),w=b.next();!w.done;w=b.next()){var m=w.value;m(Re(this.id,M))}}catch(A){l={error:A}}finally{try{w&&!w.done&&(o=b.return)&&o.call(b)}finally{if(l)throw l.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(),Et.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,Ae)}),this},t.prototype.stop=function(){var e,r,n,i,s,a,u,c,l,o,f=this;try{for(var d=R(this.listeners),h=d.next();!h.done;h=d.next()){var m=h.value;this.listeners.delete(m)}}catch(w){e={error:w}}finally{try{h&&!h.done&&(r=d.return)&&r.call(d)}finally{if(e)throw e.error}}try{for(var E=R(this.stopListeners),v=E.next();!v.done;v=E.next()){var m=v.value;m(),this.stopListeners.delete(m)}}catch(w){n={error:w}}finally{try{v&&!v.done&&(i=E.return)&&i.call(E)}finally{if(n)throw n.error}}try{for(var x=R(this.contextListeners),g=x.next();!g.done;g=x.next()){var m=g.value;this.contextListeners.delete(m)}}catch(w){s={error:w}}finally{try{g&&!g.done&&(a=x.return)&&a.call(x)}finally{if(s)throw s.error}}try{for(var T=R(this.doneListeners),O=T.next();!O.done;O=T.next()){var m=O.value;this.doneListeners.delete(m)}}catch(w){u={error:w}}finally{try{O&&!O.done&&(c=T.return)&&c.call(T)}finally{if(u)throw u.error}}if(!this.initialized)return this;D([],C(this.state.configuration),!1).sort(function(w,A){return A.order-w.order}).forEach(function(w){var A,q;try{for(var V=R(w.definition.exit),Q=V.next();!Q.done;Q=V.next()){var ge=Q.value;f.exec(ge,f.state)}}catch(kt){A={error:kt}}finally{try{Q&&!Q.done&&(q=V.return)&&q.call(V)}finally{if(A)throw A.error}}}),this.children.forEach(function(w){k(w.stop)&&w.stop()}),this.children.clear();try{for(var N=R(Object.keys(this.delayedEventsMap)),M=N.next();!M.done;M=N.next()){var b=M.value;this.clock.clearTimeout(this.delayedEventsMap[b])}}catch(w){l={error:w}}finally{try{M&&!M.done&&(o=N.return)&&o.call(N)}finally{if(l)throw l.error}}return this.scheduler.clear(),this.scheduler=new Wr({deferEvents:this.options.deferEvents}),this.initialized=!1,this.status=H.Stopped,this._initialState=void 0,Et.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,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 Ji(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(Mr)===0&&!this.state.nextEvents.some(function(s){return s.indexOf(Mr)===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||zt(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 Dt: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=Jt(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 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(Vr(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(bi(e))return this.spawnObservable(e,r);if(de(e))return this.spawnMachine(e,y(y({},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,y(y({},this.options),{parent:this,id:r.id||e.id})),s=y(y({},xc),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=$i(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){Oi(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(Vr(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=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(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)}zi(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 Tc(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:Tc(t.src)})}})}var Je="",Xr="#",wt="*",He={},Ge=function(t){return t[0]===Xr},bc=function(){return{actions:{},guards:{},services:{},activities:{},delays:{}}},Ac=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(bc(),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(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(Pe(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(P(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 Wt(l)}),this.transition=this.transition.bind(this),this.tags=ee(this.config.tags)}return t.prototype._init=function(){this.__cache.transitions||Jr(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=_i(u,e.id);return e.onEntry.push(vt(c,{delay:s})),e.onExit.push(Pi(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=P(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(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),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=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(y(y({},r),{value:this.resolve(r.value),configuration:n,done:Ie(n,this),tags:zr(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 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,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?P(m)&&Ge(m)?e.matches(Be(this.getStateNodeById(m).path,this.delimiter)):ct(Be(m,this.delimiter),yi(this.path.slice(0,-2))(e.value)):!0,x=!1;try{x=!h||Gt(this.machine,h,E,r,e)}catch(N){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(N.message))}if(x&&v){d.target!==void 0&&(c=d.target),u.push.apply(u,D([],C(d.actions),!1)),l=d;break}}}catch(N){n={error:N}}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(N){return s.getRelativeStateNodes(N,e.historyValue)})),T=!!l.internal,O=T?[]:U(g.map(function(N){return s.nodesFromChild(N)}));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=Ne([],i?this.getStateNodes(i.value):[this]),o=e.configuration.length?Ne(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(b){s={error:b}}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(b){u={error:b}}finally{try{E&&!E.done&&(c=m.return)&&c.call(m)}finally{if(u)throw u.error}}var v=U(e.entrySet.map(function(b){var w=[];if(b.type!=="final")return w;var A=b.parent;if(!A.parent)return w;w.push(mt(b.id,b.doneData),mt(A.id,b.doneData?Te(b.doneData,r,n):void 0));var q=A.parent;return q.type==="parallel"&&Pe(q).every(function(V){return Ie(e.configuration,V)})&&w.push(mt(q.id)),w}));e.exitSet.sort(function(b,w){return w.order-b.order}),e.entrySet.sort(function(b,w){return b.order-w.order});var x=new Set(e.entrySet),g=new Set(e.exitSet),T=C([U(Array.from(x).map(function(b){return D(D([],C(b.activities.map(function(w){return Ni(w)})),!1),C(b.onEntry),!1)})).concat(v.map(Ci)),U(Array.from(g).map(function(b){return D(D([],C(b.onExit),!1),C(b.activities.map(function(w){return Ii(w)})),!1)}))],2),O=T[0],N=T[1],M=pt(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(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)&&!Si(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=Ne([],this.getStateNodes(s.value)),o=c.configuration.length?Ne(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=Ae);var c=e.configuration,l=!r||e.transitions.length>0,o=l?Fi(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($t(this,r,n,i,d,this.machine.config.preserveActionOrder),2),g=x[0],T=x[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],b=g.filter(function(Z){var Ue;return Z.type===st&&((Ue=Z.activity)===null||Ue===void 0?void 0:Ue.type)===at}),w=b.reduce(function(Z,Ue){return Z[Ue.activity.id]=Ui(Ue.activity,u.machine,T,i),Z},r?y({},r.children):{}),A=l?e.configuration:r?r.configuration:[],q=Ie(A,this),V=new se({value:o||r.value,context:T,_event:i,_sessionid:r?r._sessionid:null,historyValue:o?f?Ti(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:A,transitions:e.transitions,children:w,done:q,tags:zr(A),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:di},i));N.length;){var nc=N.shift();ie=this.resolveRaisedTransition(ie,nc._event,i)}var ic=ie.changed||(ge?!!ie.actions.length||Q||typeof ge.value!=typeof ie.value||!$r(ie.value,ge.value):void 0);return ie.changed=ic,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(Xr.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(Xr.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=Fr(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;P(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:Fr(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(lt(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(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(!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(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=Ri(e.target),i="internal"in e?e.internal:n?n.some(function(c){return P(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:Ht(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=be(g,l[g]);return j||Ac(n,g,T),T}).concat(be(wt,c)))}var o=this.config.always?be("",this.config.always):[],f=this.config.onDone?be(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(be(String(Re(g.id)),g.onDone)),!1)),g.onError&&T.push.apply(T,D([],C(be(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 Ki(t,e)}var _=ki,$=vt;var Xt="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"},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=it(aa());var oe=t=>{let e=oa.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 ua=(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 ir(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 ca(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,}))$/),sr=t=>!!t&&typeof t=="string"&&t.length>=3,la=t=>!!t&&typeof t=="string";var yn={user:null,mfa:null,accessToken:{value:null,expiresAt:null},refreshTimer:{startedAt:null,attempts:0,lastAttempt:null},refreshToken:{value:null},errors:{}};var fa=({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 da=({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})=>!sr(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 ha=({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 pa=({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 va=({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:yn,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",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),{...yn,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:Xi})}),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:Yi})}),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(Xt,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(Xt,null),{value:null})}),broadcastToken:l=>{if(a)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:o})=>{var f;return!o&&!((f=l.mfa)!=null&&f.ticket)},hasRefreshToken:l=>!!l.refreshToken.value,hasAuthenticationError:l=>!!l.errors.authentication,isAutoRefreshDisabled:()=>!s,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})=>!sr(o),invalidPhoneNumber:(l,{phoneNumber:o})=>!la(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)}),importRefreshToken:async()=>{let l=await r(xt),o=l?new Date(l):null,f=await r(Xt);if(a){let d=ir("refreshToken")||null;if(d)f||(f=d),ca("refreshToken");else{let h=ir("error");if(h)return Promise.reject({error:{status:10,error:h,message:ir("errorDescription")||h}})}}return f?{refreshToken:f,expiresAt:o}:Promise.reject({error:null})}}})};function ar(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 bl={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 gn(t,e){function r(i,s,a){if(typeof document!="undefined"){a=ar({},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,"",ar({},s,{expires:-1}))},withAttributes:function(i){return gn(this.converter,ar({},this.attributes,i))},withConverter:function(i){return gn(ar({},this.converter,i),this.attributes)}},{attributes:{value:Object.freeze(e)},converter:{value:Object.freeze(t)}})}var Kv=gn(bl,{path:"/"});var ma=typeof window!="undefined",or=new Map,ur=t=>{var e;return ma&&localStorage?localStorage.getItem(t):(e=or.get(t))!=null?e:null},cr=(t,e)=>{ma&&localStorage?e?localStorage.setItem(t,e):localStorage.removeItem(t):e?or.set(t,e):or.has(t)&&or.delete(t)};var Xe=class{constructor({backendUrl:e,clientUrl:r=typeof window!="undefined"&&(l=>(l=window.location)==null?void 0:l.origin)()||"",clientStorageGetter:n=ur,clientStorageSetter:i=cr,refreshIntervalTime:s,autoSignIn:a=!0,autoRefreshToken:u=!0,start:c=!0}){this._subscriptions=new Set;if(this.backendUrl=e,this.clientUrl=r,this.machine=va({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.value;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 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},Ye=(t,e)=>{e.forEach(r=>{typeof t[r]!="function"&&console.error(`clientStorage.${r} is not a function`)})},ga=(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 ur},Ea=(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 cr};var Sa={message:"User is already signed in",status:100},Al={message:"User is not authenticated",status:101},Rl={message:"User is not anonymous",status:101},Ol={message:"Email needs verification",status:102},lr=class{constructor({url:e,autoRefreshToken:r=!0,autoSignIn:n=!0,autoLogin:i,clientStorage:s,clientStorageType:a="web",clientStorageGetter:u,clientStorageSetter:c,refreshIntervalTime:l,start:o=!0,Client:f=Xe}){this._client=new f({backendUrl:e,autoRefreshToken:r,autoSignIn:typeof i=="boolean"?i:n,start:o,clientStorageGetter:u||ga(a,s),clientStorageSetter:c||Ea(a,s),refreshIntervalTime:l})}async signUp(e){let r=await this.waitUntilReady(),{email:n,password:i,options:s}=e;return this.isAuthenticated()?{session:null,error:Sa}: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:Sa};if("provider"in e){let{provider:n,options:i}=e,s=ua(`${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({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:Ol}):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:Al}}async resetPassword({email:e,options:r}){return new Promise(n=>{let i=me(ha(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(da(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(pa(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(fa(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:Rl};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}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==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: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 No=it(Po()),Sr=class{constructor({url:e}){this.url=e,this.httpClient=No.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 wr=class{constructor({url:e}){this.url=e,this.api=new Sr({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 Uu=it(ni()),Pr=class{constructor(e){let{url:r}=e;this.accessToken=null,this.instance=Uu.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 tc=it(ni()),rc=it(ec()),qr=class{constructor(e){let{url:r}=e;this.url=r,this.accessToken=null,this.instance=tc.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,rc.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 Ur=class{constructor({backendUrl:e,refreshIntervalTime:r,clientStorageGetter:n,clientStorageSetter:i,clientStorage:s,clientStorageType:a,autoRefreshToken:u,autoSignIn:c,start:l=!0,Client:o}){if(!e)throw new Error("Please specify a `backendUrl`. Docs: [todo]!");this.auth=new lr({url:`${e}/v1/auth`,refreshIntervalTime:r,clientStorageGetter:n,clientStorageSetter:i,clientStorage:s,clientStorageType:a,autoRefreshToken:u,autoSignIn:c,start:l,Client:o}),this.storage=new wr({url:`${e}/v1/storage`}),this.functions=new Pr({url:`${e}/v1/functions`}),this.graphql=new qr({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 Ag=t=>new Ur(t);export{Ur as NhostClient,Pr as NhostFunctionsClient,qr as NhostGraphqlClient,Ag as createClient};
29
+ Event: `).concat(JSON.stringify(d.data)));return n.scheduler.schedule(function(){n.forward(d);var h=n.nextState(d);n.update(h,d)}),n._state},this.sendTo=function(o,f){var d=n.parent&&(f===Ee.Parent||n.parent.id===f),h=d?n.parent:P(f)?n.children.get(f)||Et.get(f):Ri(f)?f:void 0;if(!h){if(!d)throw new Error("Unable to send event to child '".concat(f,"' from service '").concat(n.id,"'."));j||B(!1,"Service '".concat(n.id,"' has no parent: unable to send event ").concat(o.type));return}"machine"in h?h.send(y(y({},o),{name:o.name===Lr?"".concat(Oe(n.id)):o.name,origin:n.sessionId})):h.send(o.data)};var i=y(y({},t.defaultOptions),r),s=i.clock,a=i.logger,u=i.parent,c=i.id,l=c!==void 0?c:e.id;this.id=l,this.logger=a,this.clock=s,this.parent=u,this.options=i,this.scheduler=new Wr({deferEvents:this.options.deferEvents}),this.sessionId=Et.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 u=a.value;this.exec(u,e,r)}}catch(c){n={error:c}}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,u,c,l,o,f=this;if(e._sessionid=this.sessionId,this._state=e,this.options.execute&&this.execute(this.state),this.children.forEach(function(A){f.state.children[A.id]=A}),this.devTools&&this.devTools.send(r.data,e),e.event)try{for(var d=R(this.eventListeners),h=d.next();!h.done;h=d.next()){var m=h.value;m(e.event)}}catch(A){n={error:A}}finally{try{h&&!h.done&&(i=d.return)&&i.call(d)}finally{if(n)throw n.error}}try{for(var E=R(this.listeners),v=E.next();!v.done;v=E.next()){var m=v.value;m(e,e.event)}}catch(A){s={error:A}}finally{try{v&&!v.done&&(a=E.return)&&a.call(E)}finally{if(s)throw s.error}}try{for(var x=R(this.contextListeners),g=x.next();!g.done;g=x.next()){var T=g.value;T(this.state.context,this.state.history?this.state.history.context:void 0)}}catch(A){u={error:A}}finally{try{g&&!g.done&&(c=x.return)&&c.call(x)}finally{if(u)throw u.error}}var O=Ie(e.configuration||[],this.machine);if(this.state.configuration&&O){var N=e.configuration.find(function(A){return A.type==="final"&&A.parent===f.machine}),M=N&&N.doneData?Te(N.doneData,e.context,r):void 0;try{for(var b=R(this.doneListeners),w=b.next();!w.done;w=b.next()){var m=w.value;m(Re(this.id,M))}}catch(A){l={error:A}}finally{try{w&&!w.done&&(o=b.return)&&o.call(b)}finally{if(l)throw l.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(),Et.register(this.sessionId,this),this.initialized=!0,this.status=H.Running;var n=e===void 0?this.initialState:Ce(this,function(){return Ji(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,Ae)}),this},t.prototype.stop=function(){var e,r,n,i,s,a,u,c,l,o,f=this;try{for(var d=R(this.listeners),h=d.next();!h.done;h=d.next()){var m=h.value;this.listeners.delete(m)}}catch(w){e={error:w}}finally{try{h&&!h.done&&(r=d.return)&&r.call(d)}finally{if(e)throw e.error}}try{for(var E=R(this.stopListeners),v=E.next();!v.done;v=E.next()){var m=v.value;m(),this.stopListeners.delete(m)}}catch(w){n={error:w}}finally{try{v&&!v.done&&(i=E.return)&&i.call(E)}finally{if(n)throw n.error}}try{for(var x=R(this.contextListeners),g=x.next();!g.done;g=x.next()){var m=g.value;this.contextListeners.delete(m)}}catch(w){s={error:w}}finally{try{g&&!g.done&&(a=x.return)&&a.call(x)}finally{if(s)throw s.error}}try{for(var T=R(this.doneListeners),O=T.next();!O.done;O=T.next()){var m=O.value;this.doneListeners.delete(m)}}catch(w){u={error:w}}finally{try{O&&!O.done&&(c=T.return)&&c.call(T)}finally{if(u)throw u.error}}if(!this.initialized)return this;D([],C(this.state.configuration),!1).sort(function(w,A){return A.order-w.order}).forEach(function(w){var A,q;try{for(var V=R(w.definition.exit),Q=V.next();!Q.done;Q=V.next()){var ge=Q.value;f.exec(ge,f.state)}}catch(_t){A={error:_t}}finally{try{Q&&!Q.done&&(q=V.return)&&q.call(V)}finally{if(A)throw A.error}}}),this.children.forEach(function(w){k(w.stop)&&w.stop()}),this.children.clear();try{for(var N=R(Object.keys(this.delayedEventsMap)),M=N.next();!M.done;M=N.next()){var b=M.value;this.clock.clearTimeout(this.delayedEventsMap[b])}}catch(w){l={error:w}}finally{try{M&&!M.done&&(o=N.return)&&o.call(N)}finally{if(l)throw l.error}}return this.scheduler.clear(),this.scheduler=new Wr({deferEvents:this.options.deferEvents}),this.initialized=!1,this.status=H.Stopped,this._initialState=void 0,Et.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,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 zi(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(Mr)===0&&!this.state.nextEvents.some(function(s){return s.indexOf(Mr)===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||$t(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 qt: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=zt(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 jt: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(Vr(e))return this.spawnPromise(Promise.resolve(e),r);if(k(e))return this.spawnCallback(e,r);if(Li(e))return this.spawnActor(e,r);if(Ai(e))return this.spawnObservable(e,r);if(de(e))return this.spawnMachine(e,y(y({},n),{id:r}));if(xi(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({},xc),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=Wi(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){Ci(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(Vr(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=Xt();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)}$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 Ki(t,e);return r}function Tc(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:Tc(t.src)})}})}var Je="",Xr="#",wt="*",He={},Ge=function(t){return t[0]===Xr},bc=function(){return{actions:{},guards:{},services:{},activities:{},delays:{}}},Ac=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.")},Xi=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(bc(),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:Mt),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(Pe(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(P(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 Kt(l)}),this.transition=this.transition.bind(this),this.tags=ee(this.config.tags)}return t.prototype._init=function(){this.__cache.transitions||Jr(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=Di(u,e.id);return e.onEntry.push(vt(c,{delay:s})),e.onExit.push(Ni(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=P(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(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),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=Ft(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(y(y({},r),{value:this.resolve(r.value),configuration:n,done:Ie(n,this),tags:zr(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 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,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?P(m)&&Ge(m)?e.matches(Be(this.getStateNodeById(m).path,this.delimiter)):ct(Be(m,this.delimiter),gi(this.path.slice(0,-2))(e.value)):!0,x=!1;try{x=!h||Jt(this.machine,h,E,r,e)}catch(N){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(N.message))}if(x&&v){d.target!==void 0&&(c=d.target),u.push.apply(u,D([],C(d.actions),!1)),l=d;break}}}catch(N){n={error:N}}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(N){return s.getRelativeStateNodes(N,e.historyValue)})),T=!!l.internal,O=T?[]:U(g.map(function(N){return s.nodesFromChild(N)}));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=Ne([],i?this.getStateNodes(i.value):[this]),o=e.configuration.length?Ne(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(b){s={error:b}}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(b){u={error:b}}finally{try{E&&!E.done&&(c=m.return)&&c.call(m)}finally{if(u)throw u.error}}var v=U(e.entrySet.map(function(b){var w=[];if(b.type!=="final")return w;var A=b.parent;if(!A.parent)return w;w.push(mt(b.id,b.doneData),mt(A.id,b.doneData?Te(b.doneData,r,n):void 0));var q=A.parent;return q.type==="parallel"&&Pe(q).every(function(V){return Ie(e.configuration,V)})&&w.push(mt(q.id)),w}));e.exitSet.sort(function(b,w){return w.order-b.order}),e.entrySet.sort(function(b,w){return b.order-w.order});var x=new Set(e.entrySet),g=new Set(e.exitSet),T=C([U(Array.from(x).map(function(b){return D(D([],C(b.activities.map(function(w){return Ii(w)})),!1),C(b.onEntry),!1)})).concat(v.map(Pi)),U(Array.from(g).map(function(b){return D(D([],C(b.onExit),!1),C(b.activities.map(function(w){return ki(w)})),!1)}))],2),O=T[0],N=T[1],M=pt(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(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)&&!wi(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=Ne([],this.getStateNodes(s.value)),o=c.configuration.length?Ne(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=Ae);var c=e.configuration,l=!r||e.transitions.length>0,o=l?Vi(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(Wt(this,r,n,i,d,this.machine.config.preserveActionOrder),2),g=x[0],T=x[1],O=C(Ht(g,function(Z){return Z.type===Le||Z.type===xe&&Z.to===Ee.Internal}),2),N=O[0],M=O[1],b=g.filter(function(Z){var Ue;return Z.type===st&&((Ue=Z.activity)===null||Ue===void 0?void 0:Ue.type)===at}),w=b.reduce(function(Z,Ue){return Z[Ue.activity.id]=ji(Ue.activity,u.machine,T,i),Z},r?y({},r.children):{}),A=l?e.configuration:r?r.configuration:[],q=Ie(A,this),V=new se({value:o||r.value,context:T,_event:i,_sessionid:r?r._sessionid:null,historyValue:o?f?bi(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:A,transitions:e.transitions,children:w,done:q,tags:zr(A),machine:this}),Q=n!==T;V.changed=i.name===ot||Q;var ge=V.history;ge&&delete ge.history;var _t=!q&&(this._transient||c.some(function(Z){return Z._transient}));if(!l&&(!_t||i.name===Je))return V;var ie=V;if(!q)for(_t&&(ie=this.resolveRaisedTransition(ie,{type:hi},i));N.length;){var nc=N.shift();ie=this.resolveRaisedTransition(ie,nc._event,i)}var ic=ie.changed||(ge?!!ie.actions.length||Q||typeof ge.value!=typeof ie.value||!$r(ie.value,ge.value):void 0);return ie.changed=ic,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(Xr.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=Vt(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(Xr.length)];if(!r)throw new Error("Unable to find state node '".concat(e,"'"));return r.path}return Vt(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=Fr(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;P(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:Fr(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(lt(i).map(function(a){return n.getFromRelativePath(a)})):n.initialStateNodes}var s=Ei(n.path,"states")(e).current;return P(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(!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(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=Oi(e.target),i="internal"in e?e.internal:n?n.some(function(c){return P(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:Gt(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=be(g,l[g]);return j||Ac(n,g,T),T}).concat(be(wt,c)))}var o=this.config.always?be("",this.config.always):[],f=this.config.onDone?be(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(be(String(Re(g.id)),g.onDone)),!1)),g.onError&&T.push.apply(T,D([],C(be(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 Xi(t,e)}var _=_i,$=vt;var Yt="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"},Yi={status:10,error:"invalid-phone-number",message:"Phone number is incorrectly formatted"},Qi={status:10,error:"no-mfa-ticket",message:"No MFA ticket has been provided"},Zi={status:10,error:"no-refresh-token",message:"No refresh token has been provided"},es={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 ua=it(oa());var oe=t=>{let e=ua.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 ca=(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 Ot(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,}))$/),sr=t=>!!t&&typeof t=="string"&&t.length>=3,la=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 fa=({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 da=({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})=>!sr(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 ha=({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 pa=({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 va=({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: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:$("SIGNED_IN"),reportSignedOut:$("SIGNED_OUT"),reportTokenChanged:$("TOKEN_CHANGED"),clearContextExceptRefreshToken:_(({refreshToken:{value:l}})=>(n(xt,null),{...gn,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:Yi})}),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:Qi})}),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(Yt,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(Yt,null),{value:null})}),cleanUrl:()=>{a&&Ot("refreshToken")&&(yn("refreshToken"),yn("type"))},broadcastToken:l=>{if(a)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:o})=>{var f;return!o&&!((f=l.mfa)!=null&&f.ticket)},hasRefreshToken:l=>!!l.refreshToken.value,hasAuthenticationError:l=>!!l.errors.authentication,isAutoRefreshDisabled:()=>!s,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})=>!sr(o),invalidPhoneNumber:(l,{phoneNumber:o})=>!la(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)}),importRefreshToken:async()=>{let l=await r(xt),o=l?new Date(l):null,f=await r(Yt);if(a){let d=Ot("refreshToken")||null;if(d)f||(f=d);else{let h=Ot("error");if(h)return Promise.reject({error:{status:10,error:h,message:Ot("errorDescription")||h}})}}return f?{refreshToken:f,expiresAt:o}:Promise.reject({error:null})}}})};function ar(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 bl={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 En(t,e){function r(i,s,a){if(typeof document!="undefined"){a=ar({},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,"",ar({},s,{expires:-1}))},withAttributes:function(i){return En(this.converter,ar({},this.attributes,i))},withConverter:function(i){return En(ar({},this.converter,i),this.attributes)}},{attributes:{value:Object.freeze(e)},converter:{value:Object.freeze(t)}})}var Kv=En(bl,{path:"/"});var ma=typeof window!="undefined",or=new Map,ur=t=>{var e;return ma&&localStorage?localStorage.getItem(t):(e=or.get(t))!=null?e:null},cr=(t,e)=>{ma&&localStorage?e?localStorage.setItem(t,e):localStorage.removeItem(t):e?or.set(t,e):or.has(t)&&or.delete(t)};var Xe=class{constructor({backendUrl:e,clientUrl:r=typeof window!="undefined"&&(l=>(l=window.location)==null?void 0:l.origin)()||"",clientStorageGetter:n=ur,clientStorageSetter:i=cr,refreshIntervalTime:s,autoSignIn:a=!0,autoRefreshToken:u=!0,start:c=!0}){this._subscriptions=new Set;if(this.backendUrl=e,this.clientUrl=r,this.machine=va({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.value;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 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},Ye=(t,e)=>{e.forEach(r=>{typeof t[r]!="function"&&console.error(`clientStorage.${r} is not a function`)})},ga=(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 ur},Ea=(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 cr};var Sa={message:"User is already signed in",status:100},Al={message:"User is not authenticated",status:101},Rl={message:"User is not anonymous",status:101},Ol={message:"Email needs verification",status:102},lr=class{constructor({url:e,autoRefreshToken:r=!0,autoSignIn:n=!0,autoLogin:i,clientStorage:s,clientStorageType:a="web",clientStorageGetter:u,clientStorageSetter:c,refreshIntervalTime:l,start:o=!0,Client:f=Xe}){this._client=new f({backendUrl:e,autoRefreshToken:r,autoSignIn:typeof i=="boolean"?i:n,start:o,clientStorageGetter:u||ga(a,s),clientStorageSetter:c||Ea(a,s),refreshIntervalTime:l})}async signUp(e){let r=await this.waitUntilReady(),{email:n,password:i,options:s}=e;return this.isAuthenticated()?{session:null,error:Sa}: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:Sa};if("provider"in e){let{provider:n,options:i}=e,s=ca(`${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({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:Ol}):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:Al}}async resetPassword({email:e,options:r}){return new Promise(n=>{let i=me(ha(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(da(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(pa(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(fa(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:Rl};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}getDecodedAccessToken(){let e=this.getAccessToken();return e?di(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:Zi});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:es}}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 No=it(Po()),Sr=class{constructor({url:e}){this.url=e,this.httpClient=No.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 wr=class{constructor({url:e}){this.url=e,this.api=new Sr({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 Uu=it(ii()),Pr=class{constructor(e){let{url:r}=e;this.accessToken=null,this.instance=Uu.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 tc=it(ii()),rc=it(ec()),qr=class{constructor(e){let{url:r}=e;this.url=r,this.accessToken=null,this.instance=tc.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,rc.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 Ur=class{constructor({backendUrl:e,refreshIntervalTime:r,clientStorageGetter:n,clientStorageSetter:i,clientStorage:s,clientStorageType:a,autoRefreshToken:u,autoSignIn:c,start:l=!0,Client:o}){if(!e)throw new Error("Please specify a `backendUrl`. Docs: [todo]!");this.auth=new lr({url:`${e}/v1/auth`,refreshIntervalTime:r,clientStorageGetter:n,clientStorageSetter:i,clientStorage:s,clientStorageType:a,autoRefreshToken:u,autoSignIn:c,start:l,Client:o}),this.storage=new wr({url:`${e}/v1/storage`}),this.functions=new Pr({url:`${e}/v1/functions`}),this.graphql=new qr({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 Ag=t=>new Ur(t);export{Ur as NhostClient,Pr as NhostFunctionsClient,qr as NhostGraphqlClient,Ag as createClient};
33
33
  /*! *****************************************************************************
34
34
  Copyright (c) Microsoft Corporation.
35
35