@nhost/nhost-js 1.0.10 → 1.0.11
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 +8 -8
- package/dist/index.es.js.map +2 -2
- package/package.json +3 -3
package/dist/index.es.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
var $u=Object.create;var Rr=Object.defineProperty;var Wu=Object.getOwnPropertyDescriptor;var Ku=Object.getOwnPropertyNames;var Xu=Object.getPrototypeOf,Yu=Object.prototype.hasOwnProperty;var Qu=t=>Rr(t,"__esModule",{value:!0});var m=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var Zu=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Ku(e))!Yu.call(t,i)&&(r||i!=="default")&&Rr(t,i,{get:()=>e[i],enumerable:!(n=Wu(e,i))||n.enumerable});return t},Nt=(t,e)=>Zu(Qu(Rr(t!=null?$u(Xu(t)):{},"default",!e&&t&&t.__esModule?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var Vr=m((im,us)=>{"use strict";us.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 $=m((sm,ds)=>{"use strict";var uf=Vr(),Ee=Object.prototype.toString;function Jr(t){return Array.isArray(t)}function Hr(t){return typeof t=="undefined"}function cf(t){return t!==null&&!Hr(t)&&t.constructor!==null&&!Hr(t.constructor)&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function cs(t){return Ee.call(t)==="[object ArrayBuffer]"}function ff(t){return Ee.call(t)==="[object FormData]"}function lf(t){var e;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&cs(t.buffer),e}function df(t){return typeof t=="string"}function hf(t){return typeof t=="number"}function fs(t){return t!==null&&typeof t=="object"}function Yt(t){if(Ee.call(t)!=="[object Object]")return!1;var e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}function pf(t){return Ee.call(t)==="[object Date]"}function mf(t){return Ee.call(t)==="[object File]"}function vf(t){return Ee.call(t)==="[object Blob]"}function ls(t){return Ee.call(t)==="[object Function]"}function yf(t){return fs(t)&&ls(t.pipe)}function gf(t){return Ee.call(t)==="[object URLSearchParams]"}function Ef(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function Sf(){return typeof navigator!="undefined"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window!="undefined"&&typeof document!="undefined"}function zr(t,e){if(!(t===null||typeof t=="undefined"))if(typeof t!="object"&&(t=[t]),Jr(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 Gr(){var t={};function e(i,s){Yt(t[s])&&Yt(i)?t[s]=Gr(t[s],i):Yt(i)?t[s]=Gr({},i):Jr(i)?t[s]=i.slice():t[s]=i}for(var r=0,n=arguments.length;r<n;r++)zr(arguments[r],e);return t}function wf(t,e,r){return zr(e,function(i,s){r&&typeof i=="function"?t[s]=uf(i,r):t[s]=i}),t}function xf(t){return t.charCodeAt(0)===65279&&(t=t.slice(1)),t}ds.exports={isArray:Jr,isArrayBuffer:cs,isBuffer:cf,isFormData:ff,isArrayBufferView:lf,isString:df,isNumber:hf,isObject:fs,isPlainObject:Yt,isUndefined:Hr,isDate:pf,isFile:mf,isBlob:vf,isFunction:ls,isStream:yf,isURLSearchParams:gf,isStandardBrowserEnv:Sf,forEach:zr,merge:Gr,extend:wf,trim:Ef,stripBOM:xf}});var $r=m((om,ps)=>{"use strict";var ze=$();function hs(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}ps.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,f){c===null||typeof c=="undefined"||(ze.isArray(c)?f=f+"[]":c=[c],ze.forEach(c,function(l){ze.isDate(l)?l=l.toISOString():ze.isObject(l)&&(l=JSON.stringify(l)),s.push(hs(f)+"="+hs(l))}))}),i=s.join("&")}if(i){var o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}});var vs=m((am,ms)=>{"use strict";var
|
|
2
|
-
`),function(a){if(s=a.indexOf(":"),n=Xr.trim(a.substr(0,s)).toLowerCase(),i=Xr.trim(a.substr(s+1)),n){if(r[n]&&Pf.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 Ds=m((ym,qs)=>{"use strict";var ks=$();qs.exports=ks.isStandardBrowserEnv()?function(){var e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a"),n;function i(s){var o=s;return e&&(r.setAttribute("href",o),o=r.href),r.setAttribute("href",o),{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(o){var a=ks.isString(o)?i(o):o;return a.protocol===n.protocol&&a.host===n.host}}():function(){return function(){return!0}}()});var xt=m((gm,Us)=>{"use strict";function Yr(t){this.message=t}Yr.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")};Yr.prototype.__CANCEL__=!0;Us.exports=Yr});var Zr=m((Em,Ms)=>{"use strict";var er=$(),_f=xs(),Nf=bs(),If=$r(),kf=_s(),qf=Is(),Df=Ds(),Qr=Kr(),Uf=Tt(),Mf=xt();Ms.exports=function(e){return new Promise(function(n,i){var s=e.data,o=e.headers,a=e.responseType,c;function f(){e.cancelToken&&e.cancelToken.unsubscribe(c),e.signal&&e.signal.removeEventListener("abort",c)}er.isFormData(s)&&delete o["Content-Type"];var u=new XMLHttpRequest;if(e.auth){var l=e.auth.username||"",d=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";o.Authorization="Basic "+btoa(l+":"+d)}var h=kf(e.baseURL,e.url);u.open(e.method.toUpperCase(),If(h,e.params,e.paramsSerializer),!0),u.timeout=e.timeout;function g(){if(!!u){var p="getAllResponseHeaders"in u?qf(u.getAllResponseHeaders()):null,w=!a||a==="text"||a==="json"?u.responseText:u.response,y={data:w,status:u.status,statusText:u.statusText,headers:p,config:e,request:u};_f(function(C){n(C),f()},function(C){i(C),f()},y),u=null}}if("onloadend"in u?u.onloadend=g:u.onreadystatechange=function(){!u||u.readyState!==4||u.status===0&&!(u.responseURL&&u.responseURL.indexOf("file:")===0)||setTimeout(g)},u.onabort=function(){!u||(i(Qr("Request aborted",e,"ECONNABORTED",u)),u=null)},u.onerror=function(){i(Qr("Network Error",e,null,u)),u=null},u.ontimeout=function(){var w=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",y=e.transitional||Uf.transitional;e.timeoutErrorMessage&&(w=e.timeoutErrorMessage),i(Qr(w,e,y.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",u)),u=null},er.isStandardBrowserEnv()){var E=(e.withCredentials||Df(h))&&e.xsrfCookieName?Nf.read(e.xsrfCookieName):void 0;E&&(o[e.xsrfHeaderName]=E)}"setRequestHeader"in u&&er.forEach(o,function(w,y){typeof s=="undefined"&&y.toLowerCase()==="content-type"?delete o[y]:u.setRequestHeader(y,w)}),er.isUndefined(e.withCredentials)||(u.withCredentials=!!e.withCredentials),a&&a!=="json"&&(u.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&u.addEventListener("progress",e.onDownloadProgress),typeof e.onUploadProgress=="function"&&u.upload&&u.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(c=function(p){!u||(i(!p||p&&p.type?new Mf("canceled"):p),u.abort(),u=null)},e.cancelToken&&e.cancelToken.subscribe(c),e.signal&&(e.signal.aborted?c():e.signal.addEventListener("abort",c))),s||(s=null),u.send(s)})}});var Tt=m((Sm,Bs)=>{"use strict";var F=$(),Ls=gs(),Lf=Wr(),jf={"Content-Type":"application/x-www-form-urlencoded"};function js(t,e){!F.isUndefined(t)&&F.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}function Bf(){var t;return typeof XMLHttpRequest!="undefined"?t=Zr():typeof process!="undefined"&&Object.prototype.toString.call(process)==="[object process]"&&(t=Zr()),t}function Ff(t,e,r){if(F.isString(t))try{return(e||JSON.parse)(t),F.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:Bf(),transformRequest:[function(e,r){return Ls(r,"Accept"),Ls(r,"Content-Type"),F.isFormData(e)||F.isArrayBuffer(e)||F.isBuffer(e)||F.isStream(e)||F.isFile(e)||F.isBlob(e)?e:F.isArrayBufferView(e)?e.buffer:F.isURLSearchParams(e)?(js(r,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):F.isObject(e)||r&&r["Content-Type"]==="application/json"?(js(r,"application/json"),Ff(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&&F.isString(e)&&e.length)try{return JSON.parse(e)}catch(o){if(s)throw o.name==="SyntaxError"?Lf(o,this,"E_JSON_PARSE"):o}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, */*"}}};F.forEach(["delete","get","head"],function(e){tr.headers[e]={}});F.forEach(["post","put","patch"],function(e){tr.headers[e]=F.merge(jf)});Bs.exports=tr});var Vs=m((wm,Fs)=>{"use strict";var Vf=$(),Hf=Tt();Fs.exports=function(e,r,n){var i=this||Hf;return Vf.forEach(n,function(o){e=o.call(i,e,r)}),e}});var en=m((xm,Hs)=>{"use strict";Hs.exports=function(e){return!!(e&&e.__CANCEL__)}});var zs=m((Tm,Js)=>{"use strict";var Gs=$(),tn=Vs(),Gf=en(),Jf=Tt(),zf=xt();function rn(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new zf("canceled")}Js.exports=function(e){rn(e),e.headers=e.headers||{},e.data=tn.call(e,e.data,e.headers,e.transformRequest),e.headers=Gs.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),Gs.forEach(["delete","get","head","post","put","patch","common"],function(i){delete e.headers[i]});var r=e.adapter||Jf.adapter;return r(e).then(function(i){return rn(e),i.data=tn.call(e,i.data,i.headers,e.transformResponse),i},function(i){return Gf(i)||(rn(e),i&&i.response&&(i.response.data=tn.call(e,i.response.data,i.response.headers,e.transformResponse))),Promise.reject(i)})}});var nn=m((bm,$s)=>{"use strict";var ee=$();$s.exports=function(e,r){r=r||{};var n={};function i(u,l){return ee.isPlainObject(u)&&ee.isPlainObject(l)?ee.merge(u,l):ee.isPlainObject(l)?ee.merge({},l):ee.isArray(l)?l.slice():l}function s(u){if(ee.isUndefined(r[u])){if(!ee.isUndefined(e[u]))return i(void 0,e[u])}else return i(e[u],r[u])}function o(u){if(!ee.isUndefined(r[u]))return i(void 0,r[u])}function a(u){if(ee.isUndefined(r[u])){if(!ee.isUndefined(e[u]))return i(void 0,e[u])}else return i(void 0,r[u])}function c(u){if(u in r)return i(e[u],r[u]);if(u in e)return i(void 0,e[u])}var f={url:o,method:o,data:o,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:c};return ee.forEach(Object.keys(e).concat(Object.keys(r)),function(l){var d=f[l]||s,h=d(l);ee.isUndefined(h)&&d!==c||(n[l]=h)}),n}});var sn=m((Rm,Ws)=>{Ws.exports={version:"0.25.0"}});var Ys=m((Am,Xs)=>{"use strict";var $f=sn().version,on={};["object","boolean","number","function","string","symbol"].forEach(function(t,e){on[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});var Ks={};on.transitional=function(e,r,n){function i(s,o){return"[Axios v"+$f+"] Transitional option '"+s+"'"+o+(n?". "+n:"")}return function(s,o,a){if(e===!1)throw new Error(i(o," has been removed"+(r?" in "+r:"")));return r&&!Ks[o]&&(Ks[o]=!0,console.warn(i(o," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(s,o,a):!0}};function Wf(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],o=e[s];if(o){var a=t[s],c=a===void 0||o(a,s,t);if(c!==!0)throw new TypeError("option "+s+" must be "+c);continue}if(r!==!0)throw Error("Unknown option "+s)}}Xs.exports={assertOptions:Wf,validators:on}});var no=m((Om,ro)=>{"use strict";var eo=$(),Kf=$r(),Qs=vs(),Zs=zs(),rr=nn(),to=Ys(),$e=to.validators;function bt(t){this.defaults=t,this.interceptors={request:new Qs,response:new Qs}}bt.prototype.request=function(e,r){if(typeof e=="string"?(r=r||{},r.url=e):r=e||{},!r.url)throw new Error("Provided config url is not valid");r=rr(this.defaults,r),r.method?r.method=r.method.toLowerCase():this.defaults.method?r.method=this.defaults.method.toLowerCase():r.method="get";var n=r.transitional;n!==void 0&&to.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 o=[];this.interceptors.response.forEach(function(h){o.push(h.fulfilled,h.rejected)});var a;if(!s){var c=[Zs,void 0];for(Array.prototype.unshift.apply(c,i),c=c.concat(o),a=Promise.resolve(r);c.length;)a=a.then(c.shift(),c.shift());return a}for(var f=r;i.length;){var u=i.shift(),l=i.shift();try{f=u(f)}catch(d){l(d);break}}try{a=Zs(f)}catch(d){return Promise.reject(d)}for(;o.length;)a=a.then(o.shift(),o.shift());return a};bt.prototype.getUri=function(e){if(!e.url)throw new Error("Provided config url is not valid");return e=rr(this.defaults,e),Kf(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")};eo.forEach(["delete","get","head","options"],function(e){bt.prototype[e]=function(r,n){return this.request(rr(n||{},{method:e,url:r,data:(n||{}).data}))}});eo.forEach(["post","put","patch"],function(e){bt.prototype[e]=function(r,n,i){return this.request(rr(i||{},{method:e,url:r,data:n}))}});ro.exports=bt});var so=m((Cm,io)=>{"use strict";var Xf=xt();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(o){r.subscribe(o),i=o}).then(n);return s.cancel=function(){r.unsubscribe(i)},s},t(function(i){r.reason||(r.reason=new Xf(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}};io.exports=We});var ao=m((Pm,oo)=>{"use strict";oo.exports=function(e){return function(n){return e.apply(null,n)}}});var co=m((_m,uo)=>{"use strict";var Yf=$();uo.exports=function(e){return Yf.isObject(e)&&e.isAxiosError===!0}});var ho=m((Nm,an)=>{"use strict";var fo=$(),Qf=Vr(),nr=no(),Zf=nn(),el=Tt();function lo(t){var e=new nr(t),r=Qf(nr.prototype.request,e);return fo.extend(r,nr.prototype,e),fo.extend(r,e),r.create=function(i){return lo(Zf(t,i))},r}var fe=lo(el);fe.Axios=nr;fe.Cancel=xt();fe.CancelToken=so();fe.isCancel=en();fe.VERSION=sn().version;fe.all=function(e){return Promise.all(e)};fe.spread=ao();fe.isAxiosError=co();an.exports=fe;an.exports.default=fe});var mo=m((Im,po)=>{po.exports=ho()});var ln=m((gy,Po)=>{"use strict";Po.exports=function(e,r){return function(){for(var i=new Array(arguments.length),s=0;s<i.length;s++)i[s]=arguments[s];return e.apply(r,i)}}});var W=m((Ey,Io)=>{"use strict";var cl=ln(),ke=Object.prototype.toString;function pn(t){return ke.call(t)==="[object Array]"}function dn(t){return typeof t=="undefined"}function fl(t){return t!==null&&!dn(t)&&t.constructor!==null&&!dn(t.constructor)&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function ll(t){return ke.call(t)==="[object ArrayBuffer]"}function dl(t){return typeof FormData!="undefined"&&t instanceof FormData}function hl(t){var e;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&t.buffer instanceof ArrayBuffer,e}function pl(t){return typeof t=="string"}function ml(t){return typeof t=="number"}function _o(t){return t!==null&&typeof t=="object"}function cr(t){if(ke.call(t)!=="[object Object]")return!1;var e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}function vl(t){return ke.call(t)==="[object Date]"}function yl(t){return ke.call(t)==="[object File]"}function gl(t){return ke.call(t)==="[object Blob]"}function No(t){return ke.call(t)==="[object Function]"}function El(t){return _o(t)&&No(t.pipe)}function Sl(t){return typeof URLSearchParams!="undefined"&&t instanceof URLSearchParams}function wl(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function xl(){return typeof navigator!="undefined"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window!="undefined"&&typeof document!="undefined"}function mn(t,e){if(!(t===null||typeof t=="undefined"))if(typeof t!="object"&&(t=[t]),pn(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 hn(){var t={};function e(i,s){cr(t[s])&&cr(i)?t[s]=hn(t[s],i):cr(i)?t[s]=hn({},i):pn(i)?t[s]=i.slice():t[s]=i}for(var r=0,n=arguments.length;r<n;r++)mn(arguments[r],e);return t}function Tl(t,e,r){return mn(e,function(i,s){r&&typeof i=="function"?t[s]=cl(i,r):t[s]=i}),t}function bl(t){return t.charCodeAt(0)===65279&&(t=t.slice(1)),t}Io.exports={isArray:pn,isArrayBuffer:ll,isBuffer:fl,isFormData:dl,isArrayBufferView:hl,isString:pl,isNumber:ml,isObject:_o,isPlainObject:cr,isUndefined:dn,isDate:vl,isFile:yl,isBlob:gl,isFunction:No,isStream:El,isURLSearchParams:Sl,isStandardBrowserEnv:xl,forEach:mn,merge:hn,extend:Tl,trim:wl,stripBOM:bl}});var vn=m((Sy,qo)=>{"use strict";var Ye=W();function ko(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}qo.exports=function(e,r,n){if(!r)return e;var i;if(n)i=n(r);else if(Ye.isURLSearchParams(r))i=r.toString();else{var s=[];Ye.forEach(r,function(c,f){c===null||typeof c=="undefined"||(Ye.isArray(c)?f=f+"[]":c=[c],Ye.forEach(c,function(l){Ye.isDate(l)?l=l.toISOString():Ye.isObject(l)&&(l=JSON.stringify(l)),s.push(ko(f)+"="+ko(l))}))}),i=s.join("&")}if(i){var o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}});var Uo=m((wy,Do)=>{"use strict";var Rl=W();function fr(){this.handlers=[]}fr.prototype.use=function(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1};fr.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)};fr.prototype.forEach=function(e){Rl.forEach(this.handlers,function(n){n!==null&&e(n)})};Do.exports=fr});var Lo=m((xy,Mo)=>{"use strict";var Al=W();Mo.exports=function(e,r){Al.forEach(e,function(i,s){s!==r&&s.toUpperCase()===r.toUpperCase()&&(e[r]=i,delete e[s])})}});var yn=m((Ty,jo)=>{"use strict";jo.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 gn=m((by,Bo)=>{"use strict";var Ol=yn();Bo.exports=function(e,r,n,i,s){var o=new Error(e);return Ol(o,r,n,i,s)}});var Vo=m((Ry,Fo)=>{"use strict";var Cl=gn();Fo.exports=function(e,r,n){var i=n.config.validateStatus;!n.status||!i||i(n.status)?e(n):r(Cl("Request failed with status code "+n.status,n.config,null,n.request,n))}});var Go=m((Ay,Ho)=>{"use strict";var lr=W();Ho.exports=lr.isStandardBrowserEnv()?function(){return{write:function(r,n,i,s,o,a){var c=[];c.push(r+"="+encodeURIComponent(n)),lr.isNumber(i)&&c.push("expires="+new Date(i).toGMTString()),lr.isString(s)&&c.push("path="+s),lr.isString(o)&&c.push("domain="+o),a===!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 zo=m((Oy,Jo)=>{"use strict";Jo.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}});var Wo=m((Cy,$o)=>{"use strict";$o.exports=function(e,r){return r?e.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):e}});var Xo=m((Py,Ko)=>{"use strict";var Pl=zo(),_l=Wo();Ko.exports=function(e,r){return e&&!Pl(r)?_l(e,r):r}});var Qo=m((_y,Yo)=>{"use strict";var En=W(),Nl=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];Yo.exports=function(e){var r={},n,i,s;return e&&En.forEach(e.split(`
|
|
3
|
-
`),function(a){if(s=a.indexOf(":"),n=En.trim(a.substr(0,s)).toLowerCase(),i=En.trim(a.substr(s+1)),n){if(r[n]&&Nl.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 ta=m((Ny,ea)=>{"use strict";var Zo=W();ea.exports=Zo.isStandardBrowserEnv()?function(){var e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a"),n;function i(s){var o=s;return e&&(r.setAttribute("href",o),o=r.href),r.setAttribute("href",o),{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(o){var a=Zo.isString(o)?i(o):o;return a.protocol===n.protocol&&a.host===n.host}}():function(){return function(){return!0}}()});var wn=m((Iy,ra)=>{"use strict";var dr=W(),Il=Vo(),kl=Go(),ql=vn(),Dl=Xo(),Ul=Qo(),Ml=ta(),Sn=gn();ra.exports=function(e){return new Promise(function(n,i){var s=e.data,o=e.headers,a=e.responseType;dr.isFormData(s)&&delete o["Content-Type"];var c=new XMLHttpRequest;if(e.auth){var f=e.auth.username||"",u=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";o.Authorization="Basic "+btoa(f+":"+u)}var l=Dl(e.baseURL,e.url);c.open(e.method.toUpperCase(),ql(l,e.params,e.paramsSerializer),!0),c.timeout=e.timeout;function d(){if(!!c){var g="getAllResponseHeaders"in c?Ul(c.getAllResponseHeaders()):null,E=!a||a==="text"||a==="json"?c.responseText:c.response,p={data:E,status:c.status,statusText:c.statusText,headers:g,config:e,request:c};Il(n,i,p),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(Sn("Request aborted",e,"ECONNABORTED",c)),c=null)},c.onerror=function(){i(Sn("Network Error",e,null,c)),c=null},c.ontimeout=function(){var E="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(E=e.timeoutErrorMessage),i(Sn(E,e,e.transitional&&e.transitional.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",c)),c=null},dr.isStandardBrowserEnv()){var h=(e.withCredentials||Ml(l))&&e.xsrfCookieName?kl.read(e.xsrfCookieName):void 0;h&&(o[e.xsrfHeaderName]=h)}"setRequestHeader"in c&&dr.forEach(o,function(E,p){typeof s=="undefined"&&p.toLowerCase()==="content-type"?delete o[p]:c.setRequestHeader(p,E)}),dr.isUndefined(e.withCredentials)||(c.withCredentials=!!e.withCredentials),a&&a!=="json"&&(c.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&c.addEventListener("progress",e.onDownloadProgress),typeof e.onUploadProgress=="function"&&c.upload&&c.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then(function(E){!c||(c.abort(),i(E),c=null)}),s||(s=null),c.send(s)})}});var pr=m((ky,sa)=>{"use strict";var V=W(),na=Lo(),Ll=yn(),jl={"Content-Type":"application/x-www-form-urlencoded"};function ia(t,e){!V.isUndefined(t)&&V.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}function Bl(){var t;return typeof XMLHttpRequest!="undefined"?t=wn():typeof process!="undefined"&&Object.prototype.toString.call(process)==="[object process]"&&(t=wn()),t}function Fl(t,e,r){if(V.isString(t))try{return(e||JSON.parse)(t),V.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}var hr={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:Bl(),transformRequest:[function(e,r){return na(r,"Accept"),na(r,"Content-Type"),V.isFormData(e)||V.isArrayBuffer(e)||V.isBuffer(e)||V.isStream(e)||V.isFile(e)||V.isBlob(e)?e:V.isArrayBufferView(e)?e.buffer:V.isURLSearchParams(e)?(ia(r,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):V.isObject(e)||r&&r["Content-Type"]==="application/json"?(ia(r,"application/json"),Fl(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&&V.isString(e)&&e.length)try{return JSON.parse(e)}catch(o){if(s)throw o.name==="SyntaxError"?Ll(o,this,"E_JSON_PARSE"):o}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300}};hr.headers={common:{Accept:"application/json, text/plain, */*"}};V.forEach(["delete","get","head"],function(e){hr.headers[e]={}});V.forEach(["post","put","patch"],function(e){hr.headers[e]=V.merge(jl)});sa.exports=hr});var aa=m((qy,oa)=>{"use strict";var Vl=W(),Hl=pr();oa.exports=function(e,r,n){var i=this||Hl;return Vl.forEach(n,function(o){e=o.call(i,e,r)}),e}});var xn=m((Dy,ua)=>{"use strict";ua.exports=function(e){return!!(e&&e.__CANCEL__)}});var la=m((Uy,fa)=>{"use strict";var ca=W(),Tn=aa(),Gl=xn(),Jl=pr();function bn(t){t.cancelToken&&t.cancelToken.throwIfRequested()}fa.exports=function(e){bn(e),e.headers=e.headers||{},e.data=Tn.call(e,e.data,e.headers,e.transformRequest),e.headers=ca.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),ca.forEach(["delete","get","head","post","put","patch","common"],function(i){delete e.headers[i]});var r=e.adapter||Jl.adapter;return r(e).then(function(i){return bn(e),i.data=Tn.call(e,i.data,i.headers,e.transformResponse),i},function(i){return Gl(i)||(bn(e),i&&i.response&&(i.response.data=Tn.call(e,i.response.data,i.response.headers,e.transformResponse))),Promise.reject(i)})}});var Rn=m((My,da)=>{"use strict";var z=W();da.exports=function(e,r){r=r||{};var n={},i=["url","method","data"],s=["headers","auth","proxy","params"],o=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],a=["validateStatus"];function c(d,h){return z.isPlainObject(d)&&z.isPlainObject(h)?z.merge(d,h):z.isPlainObject(h)?z.merge({},h):z.isArray(h)?h.slice():h}function f(d){z.isUndefined(r[d])?z.isUndefined(e[d])||(n[d]=c(void 0,e[d])):n[d]=c(e[d],r[d])}z.forEach(i,function(h){z.isUndefined(r[h])||(n[h]=c(void 0,r[h]))}),z.forEach(s,f),z.forEach(o,function(h){z.isUndefined(r[h])?z.isUndefined(e[h])||(n[h]=c(void 0,e[h])):n[h]=c(void 0,r[h])}),z.forEach(a,function(h){h in r?n[h]=c(e[h],r[h]):h in e&&(n[h]=c(void 0,e[h]))});var u=i.concat(s).concat(o).concat(a),l=Object.keys(e).concat(Object.keys(r)).filter(function(h){return u.indexOf(h)===-1});return z.forEach(l,f),n}});var ha=m((Ly,zl)=>{zl.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 ga=m((jy,ya)=>{"use strict";var ma=ha(),An={};["object","boolean","number","function","string","symbol"].forEach(function(t,e){An[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});var pa={},$l=ma.version.split(".");function va(t,e){for(var r=e?e.split("."):$l,n=t.split("."),i=0;i<3;i++){if(r[i]>n[i])return!0;if(r[i]<n[i])return!1}return!1}An.transitional=function(e,r,n){var i=r&&va(r);function s(o,a){return"[Axios v"+ma.version+"] Transitional option '"+o+"'"+a+(n?". "+n:"")}return function(o,a,c){if(e===!1)throw new Error(s(a," has been removed in "+r));return i&&!pa[a]&&(pa[a]=!0,console.warn(s(a," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(o,a,c):!0}};function Wl(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],o=e[s];if(o){var a=t[s],c=a===void 0||o(a,s,t);if(c!==!0)throw new TypeError("option "+s+" must be "+c);continue}if(r!==!0)throw Error("Unknown option "+s)}}ya.exports={isOlderVersion:va,assertOptions:Wl,validators:An}});var ba=m((By,Ta)=>{"use strict";var wa=W(),Kl=vn(),Ea=Uo(),Sa=la(),mr=Rn(),xa=ga(),Qe=xa.validators;function At(t){this.defaults=t,this.interceptors={request:new Ea,response:new Ea}}At.prototype.request=function(e){typeof e=="string"?(e=arguments[1]||{},e.url=arguments[0]):e=e||{},e=mr(this.defaults,e),e.method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var r=e.transitional;r!==void 0&&xa.assertOptions(r,{silentJSONParsing:Qe.transitional(Qe.boolean,"1.0.0"),forcedJSONParsing:Qe.transitional(Qe.boolean,"1.0.0"),clarifyTimeoutError:Qe.transitional(Qe.boolean,"1.0.0")},!1);var n=[],i=!0;this.interceptors.request.forEach(function(d){typeof d.runWhen=="function"&&d.runWhen(e)===!1||(i=i&&d.synchronous,n.unshift(d.fulfilled,d.rejected))});var s=[];this.interceptors.response.forEach(function(d){s.push(d.fulfilled,d.rejected)});var o;if(!i){var a=[Sa,void 0];for(Array.prototype.unshift.apply(a,n),a=a.concat(s),o=Promise.resolve(e);a.length;)o=o.then(a.shift(),a.shift());return o}for(var c=e;n.length;){var f=n.shift(),u=n.shift();try{c=f(c)}catch(l){u(l);break}}try{o=Sa(c)}catch(l){return Promise.reject(l)}for(;s.length;)o=o.then(s.shift(),s.shift());return o};At.prototype.getUri=function(e){return e=mr(this.defaults,e),Kl(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")};wa.forEach(["delete","get","head","options"],function(e){At.prototype[e]=function(r,n){return this.request(mr(n||{},{method:e,url:r,data:(n||{}).data}))}});wa.forEach(["post","put","patch"],function(e){At.prototype[e]=function(r,n,i){return this.request(mr(i||{},{method:e,url:r,data:n}))}});Ta.exports=At});var Cn=m((Fy,Ra)=>{"use strict";function On(t){this.message=t}On.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")};On.prototype.__CANCEL__=!0;Ra.exports=On});var Oa=m((Vy,Aa)=>{"use strict";var Xl=Cn();function vr(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 Xl(i),e(r.reason))})}vr.prototype.throwIfRequested=function(){if(this.reason)throw this.reason};vr.source=function(){var e,r=new vr(function(i){e=i});return{token:r,cancel:e}};Aa.exports=vr});var Pa=m((Hy,Ca)=>{"use strict";Ca.exports=function(e){return function(n){return e.apply(null,n)}}});var Na=m((Gy,_a)=>{"use strict";_a.exports=function(e){return typeof e=="object"&&e.isAxiosError===!0}});var qa=m((Jy,Pn)=>{"use strict";var Ia=W(),Yl=ln(),yr=ba(),Ql=Rn(),Zl=pr();function ka(t){var e=new yr(t),r=Yl(yr.prototype.request,e);return Ia.extend(r,yr.prototype,e),Ia.extend(r,e),r}var oe=ka(Zl);oe.Axios=yr;oe.create=function(e){return ka(Ql(oe.defaults,e))};oe.Cancel=Cn();oe.CancelToken=Oa();oe.isCancel=xn();oe.all=function(e){return Promise.all(e)};oe.spread=Pa();oe.isAxiosError=Na();Pn.exports=oe;Pn.exports.default=oe});var Ua=m((zy,Da)=>{Da.exports=qa()});var In=m((tg,La)=>{"use strict";La.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=m((rg,Fa)=>{"use strict";var ed=In(),qe=Object.prototype.toString;function Dn(t){return qe.call(t)==="[object Array]"}function kn(t){return typeof t=="undefined"}function td(t){return t!==null&&!kn(t)&&t.constructor!==null&&!kn(t.constructor)&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function rd(t){return qe.call(t)==="[object ArrayBuffer]"}function nd(t){return typeof FormData!="undefined"&&t instanceof FormData}function id(t){var e;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&t.buffer instanceof ArrayBuffer,e}function sd(t){return typeof t=="string"}function od(t){return typeof t=="number"}function ja(t){return t!==null&&typeof t=="object"}function gr(t){if(qe.call(t)!=="[object Object]")return!1;var e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}function ad(t){return qe.call(t)==="[object Date]"}function ud(t){return qe.call(t)==="[object File]"}function cd(t){return qe.call(t)==="[object Blob]"}function Ba(t){return qe.call(t)==="[object Function]"}function fd(t){return ja(t)&&Ba(t.pipe)}function ld(t){return typeof URLSearchParams!="undefined"&&t instanceof URLSearchParams}function dd(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function hd(){return typeof navigator!="undefined"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window!="undefined"&&typeof document!="undefined"}function Un(t,e){if(!(t===null||typeof t=="undefined"))if(typeof t!="object"&&(t=[t]),Dn(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 qn(){var t={};function e(i,s){gr(t[s])&&gr(i)?t[s]=qn(t[s],i):gr(i)?t[s]=qn({},i):Dn(i)?t[s]=i.slice():t[s]=i}for(var r=0,n=arguments.length;r<n;r++)Un(arguments[r],e);return t}function pd(t,e,r){return Un(e,function(i,s){r&&typeof i=="function"?t[s]=ed(i,r):t[s]=i}),t}function md(t){return t.charCodeAt(0)===65279&&(t=t.slice(1)),t}Fa.exports={isArray:Dn,isArrayBuffer:rd,isBuffer:td,isFormData:nd,isArrayBufferView:id,isString:sd,isNumber:od,isObject:ja,isPlainObject:gr,isUndefined:kn,isDate:ad,isFile:ud,isBlob:cd,isFunction:Ba,isStream:fd,isURLSearchParams:ld,isStandardBrowserEnv:hd,forEach:Un,merge:qn,extend:pd,trim:dd,stripBOM:md}});var Mn=m((ng,Ha)=>{"use strict";var Ze=K();function Va(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}Ha.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,f){c===null||typeof c=="undefined"||(Ze.isArray(c)?f=f+"[]":c=[c],Ze.forEach(c,function(l){Ze.isDate(l)?l=l.toISOString():Ze.isObject(l)&&(l=JSON.stringify(l)),s.push(Va(f)+"="+Va(l))}))}),i=s.join("&")}if(i){var o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}});var Ja=m((ig,Ga)=>{"use strict";var vd=K();function Er(){this.handlers=[]}Er.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};Er.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)};Er.prototype.forEach=function(e){vd.forEach(this.handlers,function(n){n!==null&&e(n)})};Ga.exports=Er});var $a=m((sg,za)=>{"use strict";var yd=K();za.exports=function(e,r){yd.forEach(e,function(i,s){s!==r&&s.toUpperCase()===r.toUpperCase()&&(e[r]=i,delete e[s])})}});var Ln=m((og,Wa)=>{"use strict";Wa.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=m((ag,Ka)=>{"use strict";var gd=Ln();Ka.exports=function(e,r,n,i,s){var o=new Error(e);return gd(o,r,n,i,s)}});var Ya=m((ug,Xa)=>{"use strict";var Ed=jn();Xa.exports=function(e,r,n){var i=n.config.validateStatus;!n.status||!i||i(n.status)?e(n):r(Ed("Request failed with status code "+n.status,n.config,null,n.request,n))}});var Za=m((cg,Qa)=>{"use strict";var Sr=K();Qa.exports=Sr.isStandardBrowserEnv()?function(){return{write:function(r,n,i,s,o,a){var c=[];c.push(r+"="+encodeURIComponent(n)),Sr.isNumber(i)&&c.push("expires="+new Date(i).toGMTString()),Sr.isString(s)&&c.push("path="+s),Sr.isString(o)&&c.push("domain="+o),a===!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 tu=m((fg,eu)=>{"use strict";eu.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}});var nu=m((lg,ru)=>{"use strict";ru.exports=function(e,r){return r?e.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):e}});var su=m((dg,iu)=>{"use strict";var Sd=tu(),wd=nu();iu.exports=function(e,r){return e&&!Sd(r)?wd(e,r):r}});var au=m((hg,ou)=>{"use strict";var Bn=K(),xd=["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"];ou.exports=function(e){var r={},n,i,s;return e&&Bn.forEach(e.split(`
|
|
4
|
-
`),function(a){if(s=a.indexOf(":"),n=Bn.trim(a.substr(0,s)).toLowerCase(),i=Bn.trim(a.substr(s+1)),n){if(r[n]&&xd.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 fu=m((pg,cu)=>{"use strict";var uu=K();cu.exports=uu.isStandardBrowserEnv()?function(){var e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a"),n;function i(s){var o=s;return e&&(r.setAttribute("href",o),o=r.href),r.setAttribute("href",o),{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(o){var a=uu.isString(o)?i(o):o;return a.protocol===n.protocol&&a.host===n.host}}():function(){return function(){return!0}}()});var Ot=m((mg,lu)=>{"use strict";function Fn(t){this.message=t}Fn.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")};Fn.prototype.__CANCEL__=!0;lu.exports=Fn});var Hn=m((vg,du)=>{"use strict";var wr=K(),Td=Ya(),bd=Za(),Rd=Mn(),Ad=su(),Od=au(),Cd=fu(),Vn=jn(),Pd=Ct(),_d=Ot();du.exports=function(e){return new Promise(function(n,i){var s=e.data,o=e.headers,a=e.responseType,c;function f(){e.cancelToken&&e.cancelToken.unsubscribe(c),e.signal&&e.signal.removeEventListener("abort",c)}wr.isFormData(s)&&delete o["Content-Type"];var u=new XMLHttpRequest;if(e.auth){var l=e.auth.username||"",d=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";o.Authorization="Basic "+btoa(l+":"+d)}var h=Ad(e.baseURL,e.url);u.open(e.method.toUpperCase(),Rd(h,e.params,e.paramsSerializer),!0),u.timeout=e.timeout;function g(){if(!!u){var p="getAllResponseHeaders"in u?Od(u.getAllResponseHeaders()):null,w=!a||a==="text"||a==="json"?u.responseText:u.response,y={data:w,status:u.status,statusText:u.statusText,headers:p,config:e,request:u};Td(function(C){n(C),f()},function(C){i(C),f()},y),u=null}}if("onloadend"in u?u.onloadend=g:u.onreadystatechange=function(){!u||u.readyState!==4||u.status===0&&!(u.responseURL&&u.responseURL.indexOf("file:")===0)||setTimeout(g)},u.onabort=function(){!u||(i(Vn("Request aborted",e,"ECONNABORTED",u)),u=null)},u.onerror=function(){i(Vn("Network Error",e,null,u)),u=null},u.ontimeout=function(){var w=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",y=e.transitional||Pd.transitional;e.timeoutErrorMessage&&(w=e.timeoutErrorMessage),i(Vn(w,e,y.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",u)),u=null},wr.isStandardBrowserEnv()){var E=(e.withCredentials||Cd(h))&&e.xsrfCookieName?bd.read(e.xsrfCookieName):void 0;E&&(o[e.xsrfHeaderName]=E)}"setRequestHeader"in u&&wr.forEach(o,function(w,y){typeof s=="undefined"&&y.toLowerCase()==="content-type"?delete o[y]:u.setRequestHeader(y,w)}),wr.isUndefined(e.withCredentials)||(u.withCredentials=!!e.withCredentials),a&&a!=="json"&&(u.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&u.addEventListener("progress",e.onDownloadProgress),typeof e.onUploadProgress=="function"&&u.upload&&u.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(c=function(p){!u||(i(!p||p&&p.type?new _d("canceled"):p),u.abort(),u=null)},e.cancelToken&&e.cancelToken.subscribe(c),e.signal&&(e.signal.aborted?c():e.signal.addEventListener("abort",c))),s||(s=null),u.send(s)})}});var Ct=m((yg,mu)=>{"use strict";var H=K(),hu=$a(),Nd=Ln(),Id={"Content-Type":"application/x-www-form-urlencoded"};function pu(t,e){!H.isUndefined(t)&&H.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}function kd(){var t;return typeof XMLHttpRequest!="undefined"?t=Hn():typeof process!="undefined"&&Object.prototype.toString.call(process)==="[object process]"&&(t=Hn()),t}function qd(t,e,r){if(H.isString(t))try{return(e||JSON.parse)(t),H.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}var xr={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:kd(),transformRequest:[function(e,r){return hu(r,"Accept"),hu(r,"Content-Type"),H.isFormData(e)||H.isArrayBuffer(e)||H.isBuffer(e)||H.isStream(e)||H.isFile(e)||H.isBlob(e)?e:H.isArrayBufferView(e)?e.buffer:H.isURLSearchParams(e)?(pu(r,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):H.isObject(e)||r&&r["Content-Type"]==="application/json"?(pu(r,"application/json"),qd(e)):e}],transformResponse:[function(e){var r=this.transitional||xr.transitional,n=r&&r.silentJSONParsing,i=r&&r.forcedJSONParsing,s=!n&&this.responseType==="json";if(s||i&&H.isString(e)&&e.length)try{return JSON.parse(e)}catch(o){if(s)throw o.name==="SyntaxError"?Nd(o,this,"E_JSON_PARSE"):o}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, */*"}}};H.forEach(["delete","get","head"],function(e){xr.headers[e]={}});H.forEach(["post","put","patch"],function(e){xr.headers[e]=H.merge(Id)});mu.exports=xr});var yu=m((gg,vu)=>{"use strict";var Dd=K(),Ud=Ct();vu.exports=function(e,r,n){var i=this||Ud;return Dd.forEach(n,function(o){e=o.call(i,e,r)}),e}});var Gn=m((Eg,gu)=>{"use strict";gu.exports=function(e){return!!(e&&e.__CANCEL__)}});var wu=m((Sg,Su)=>{"use strict";var Eu=K(),Jn=yu(),Md=Gn(),Ld=Ct(),jd=Ot();function zn(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new jd("canceled")}Su.exports=function(e){zn(e),e.headers=e.headers||{},e.data=Jn.call(e,e.data,e.headers,e.transformRequest),e.headers=Eu.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),Eu.forEach(["delete","get","head","post","put","patch","common"],function(i){delete e.headers[i]});var r=e.adapter||Ld.adapter;return r(e).then(function(i){return zn(e),i.data=Jn.call(e,i.data,i.headers,e.transformResponse),i},function(i){return Md(i)||(zn(e),i&&i.response&&(i.response.data=Jn.call(e,i.response.data,i.response.headers,e.transformResponse))),Promise.reject(i)})}});var $n=m((wg,xu)=>{"use strict";var te=K();xu.exports=function(e,r){r=r||{};var n={};function i(u,l){return te.isPlainObject(u)&&te.isPlainObject(l)?te.merge(u,l):te.isPlainObject(l)?te.merge({},l):te.isArray(l)?l.slice():l}function s(u){if(te.isUndefined(r[u])){if(!te.isUndefined(e[u]))return i(void 0,e[u])}else return i(e[u],r[u])}function o(u){if(!te.isUndefined(r[u]))return i(void 0,r[u])}function a(u){if(te.isUndefined(r[u])){if(!te.isUndefined(e[u]))return i(void 0,e[u])}else return i(void 0,r[u])}function c(u){if(u in r)return i(e[u],r[u]);if(u in e)return i(void 0,e[u])}var f={url:o,method:o,data:o,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:c};return te.forEach(Object.keys(e).concat(Object.keys(r)),function(l){var d=f[l]||s,h=d(l);te.isUndefined(h)&&d!==c||(n[l]=h)}),n}});var Wn=m((xg,Tu)=>{Tu.exports={version:"0.23.0"}});var Au=m((Tg,Ru)=>{"use strict";var Bd=Wn().version,Kn={};["object","boolean","number","function","string","symbol"].forEach(function(t,e){Kn[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});var bu={};Kn.transitional=function(e,r,n){function i(s,o){return"[Axios v"+Bd+"] Transitional option '"+s+"'"+o+(n?". "+n:"")}return function(s,o,a){if(e===!1)throw new Error(i(o," has been removed"+(r?" in "+r:"")));return r&&!bu[o]&&(bu[o]=!0,console.warn(i(o," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(s,o,a):!0}};function Fd(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],o=e[s];if(o){var a=t[s],c=a===void 0||o(a,s,t);if(c!==!0)throw new TypeError("option "+s+" must be "+c);continue}if(r!==!0)throw Error("Unknown option "+s)}}Ru.exports={assertOptions:Fd,validators:Kn}});var Iu=m((bg,Nu)=>{"use strict";var Pu=K(),Vd=Mn(),Ou=Ja(),Cu=wu(),Tr=$n(),_u=Au(),et=_u.validators;function Pt(t){this.defaults=t,this.interceptors={request:new Ou,response:new Ou}}Pt.prototype.request=function(e){typeof e=="string"?(e=arguments[1]||{},e.url=arguments[0]):e=e||{},e=Tr(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&&_u.assertOptions(r,{silentJSONParsing:et.transitional(et.boolean),forcedJSONParsing:et.transitional(et.boolean),clarifyTimeoutError:et.transitional(et.boolean)},!1);var n=[],i=!0;this.interceptors.request.forEach(function(d){typeof d.runWhen=="function"&&d.runWhen(e)===!1||(i=i&&d.synchronous,n.unshift(d.fulfilled,d.rejected))});var s=[];this.interceptors.response.forEach(function(d){s.push(d.fulfilled,d.rejected)});var o;if(!i){var a=[Cu,void 0];for(Array.prototype.unshift.apply(a,n),a=a.concat(s),o=Promise.resolve(e);a.length;)o=o.then(a.shift(),a.shift());return o}for(var c=e;n.length;){var f=n.shift(),u=n.shift();try{c=f(c)}catch(l){u(l);break}}try{o=Cu(c)}catch(l){return Promise.reject(l)}for(;s.length;)o=o.then(s.shift(),s.shift());return o};Pt.prototype.getUri=function(e){return e=Tr(this.defaults,e),Vd(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")};Pu.forEach(["delete","get","head","options"],function(e){Pt.prototype[e]=function(r,n){return this.request(Tr(n||{},{method:e,url:r,data:(n||{}).data}))}});Pu.forEach(["post","put","patch"],function(e){Pt.prototype[e]=function(r,n,i){return this.request(Tr(i||{},{method:e,url:r,data:n}))}});Nu.exports=Pt});var qu=m((Rg,ku)=>{"use strict";var Hd=Ot();function tt(t){if(typeof t!="function")throw new TypeError("executor must be a function.");var e;this.promise=new Promise(function(i){e=i});var r=this;this.promise.then(function(n){if(!!r._listeners){var i,s=r._listeners.length;for(i=0;i<s;i++)r._listeners[i](n);r._listeners=null}}),this.promise.then=function(n){var i,s=new Promise(function(o){r.subscribe(o),i=o}).then(n);return s.cancel=function(){r.unsubscribe(i)},s},t(function(i){r.reason||(r.reason=new Hd(i),e(r.reason))})}tt.prototype.throwIfRequested=function(){if(this.reason)throw this.reason};tt.prototype.subscribe=function(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]};tt.prototype.unsubscribe=function(e){if(!!this._listeners){var r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}};tt.source=function(){var e,r=new tt(function(i){e=i});return{token:r,cancel:e}};ku.exports=tt});var Uu=m((Ag,Du)=>{"use strict";Du.exports=function(e){return function(n){return e.apply(null,n)}}});var Lu=m((Og,Mu)=>{"use strict";Mu.exports=function(e){return typeof e=="object"&&e.isAxiosError===!0}});var Fu=m((Cg,Xn)=>{"use strict";var ju=K(),Gd=In(),br=Iu(),Jd=$n(),zd=Ct();function Bu(t){var e=new br(t),r=Gd(br.prototype.request,e);return ju.extend(r,br.prototype,e),ju.extend(r,e),r.create=function(i){return Bu(Jd(t,i))},r}var le=Bu(zd);le.Axios=br;le.Cancel=Ot();le.CancelToken=qu();le.isCancel=Gn();le.VERSION=Wn().version;le.all=function(e){return Promise.all(e)};le.spread=Uu();le.isAxiosError=Lu();Xn.exports=le;Xn.exports.default=le});var Yn=m((Pg,Vu)=>{Vu.exports=Fu()});var v=function(){return v=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},v.apply(this,arguments)};function Ue(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 b(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 R(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}function I(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 P;(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"})(P||(P={}));var ve;(function(t){t.Parent="#_parent",t.Internal="#_internal"})(ve||(ve={}));var rt=P.Start,Me=P.Stop,Le=P.Raise,we=P.Send,It=P.Cancel,ti=P.NullEvent,kt=P.Assign,Yd=P.After,Qd=P.DoneState,qt=P.Log,ri=P.Init,nt=P.Invoke,Zd=P.ErrorExecution,Ar=P.ErrorPlatform,Or=P.ErrorCustom,it=P.Update,ni=P.Choose,ii=P.Pure;var Dt=".",Cr={},Ut="xstate.guard",si="";var D=!0;var Mt;function ot(t,e,r){r===void 0&&(r=Dt);var n=je(t,r),i=je(e,r);return A(i)?A(n)?i===n:!1:A(n)?n in i:Object.keys(n).every(function(s){return s in i?ot(n[s],i[s]):!1})}function Lt(t){try{return A(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 jt(t,e){try{return de(t)?t:t.toString().split(e)}catch{throw new Error("'".concat(t,"' is not a valid state path."))}}function ec(t){return typeof t=="object"&&"value"in t&&"context"in t&&"event"in t&&"_event"in t}function je(t,e){if(ec(t))return t.value;if(de(t))return st(t);if(typeof t!="string")return t;var r=jt(t,e);return st(r)}function st(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 Be(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 Pr(t,e,r){var n,i,s={};try{for(var o=b(Object.keys(t)),a=o.next();!a.done;a=o.next()){var c=a.value,f=t[c];!r(f)||(s[c]=e(f,c,t))}}catch(u){n={error:u}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}return s}var oi=function(t){return function(e){var r,n,i=e;try{for(var s=b(t),o=s.next();!o.done;o=s.next()){var a=o.value;i=i[a]}}catch(c){r={error:c}}finally{try{o&&!o.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return i}};function ai(t,e){return function(r){var n,i,s=r;try{for(var o=b(t),a=o.next();!a.done;a=o.next()){var c=a.value;s=s[e][c]}}catch(f){n={error:f}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}return s}}function at(t){if(!t)return[[]];if(A(t))return[[t]];var e=q(Object.keys(t).map(function(r){var n=t[r];return typeof n!="string"&&(!n||!Object.keys(n).length)?[[r]]:at(t[r]).map(function(i){return[r].concat(i)})}));return e}function q(t){var e;return(e=[]).concat.apply(e,I([],R(t),!1))}function ui(t){return de(t)?t:[t]}function Z(t){return t===void 0?[]:ui(t)}function xe(t,e,r){var n,i;if(_(t))return t(e,r.data);var s={};try{for(var o=b(Object.keys(t)),a=o.next();!a.done;a=o.next()){var c=a.value,f=t[c];_(f)?s[c]=f(e,r.data):s[c]=f}}catch(u){n={error:u}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}return s}function ci(t){return/^(done|error)\./.test(t)}function _r(t){return!!(t instanceof Promise||t!==null&&(_(t)||typeof t=="object")&&_(t.then))}function fi(t){return t!==null&&typeof t=="object"&&"transition"in t&&typeof t.transition=="function"}function Bt(t,e){var r,n,i=R([[],[]],2),s=i[0],o=i[1];try{for(var a=b(t),c=a.next();!c.done;c=a.next()){var f=c.value;e(f)?s.push(f):o.push(f)}}catch(u){r={error:u}}finally{try{c&&!c.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return[s,o]}function li(t,e){return Be(t.states,function(r,n){if(!!r){var i=(A(e)?void 0:e[n])||(r?r.current:void 0);if(!!i)return{current:i,states:li(r,i)}}})}function di(t,e){return{current:e,states:li(t,e)}}function Nr(t,e,r,n){D||M(!!t,"Attempting to update undefined context");var i=t&&r.reduce(function(s,o){var a,c,f=o.assignment,u={state:n,action:o,_event:e},l={};if(_(f))l=f(s,e.data,u);else try{for(var d=b(Object.keys(f)),h=d.next();!h.done;h=d.next()){var g=h.value,E=f[g];l[g]=_(E)?E(s,e.data,u):E}}catch(p){a={error:p}}finally{try{h&&!h.done&&(c=d.return)&&c.call(d)}finally{if(a)throw a.error}}return Object.assign({},s,l)},t);return i}var M=function(){};D||(M=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 de(t){return Array.isArray(t)}function _(t){return typeof t=="function"}function A(t){return typeof t=="string"}function Ft(t,e){if(!!t)return A(t)?{type:Ut,name:t,predicate:e?e[t]:void 0}:_(t)?{type:Ut,name:t.name,predicate:t}:t}function hi(t){try{return"subscribe"in t&&_(t.subscribe)}catch{return!1}}var ae=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}(),oh=(Mt={},Mt[ae]=function(){return this},Mt[Symbol.observable]=function(){return this},Mt);function ue(t){return!!t&&"__xstatenode"in t}function pi(t){return!!t&&typeof t.send=="function"}function ut(t,e){return A(t)||typeof t=="number"?v({type:t},e):t}function j(t,e){if(!A(t)&&"$$type"in t&&t.$$type==="scxml")return t;var r=ut(t);return v({name:r.type,data:r,$$type:"scxml",type:"external"},e)}function Te(t,e){var r=ui(e).map(function(n){return typeof n=="undefined"||typeof n=="string"||ue(n)?{target:n,event:t}:v(v({},n),{event:t})});return r}function mi(t){if(!(t===void 0||t===si))return Z(t)}function vi(t,e,r){if(!D){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 Vt(t,e,r,n,i){var s=t.options.guards,o={state:i,cond:e,_event:n};if(e.type===Ut)return((s==null?void 0:s[e.name])||e.predicate)(r,n.data,o);var a=s==null?void 0:s[e.type];if(!a)throw new Error("Guard '".concat(e.type,"' is not implemented on machine '").concat(t.id,"'."));return a(r,n.data,o)}function Ht(t){return typeof t=="string"?{type:t}:t}function ct(t,e,r){if(typeof t=="object")return t;var n=function(){};return{next:t,error:e||n,complete:r||n}}function ft(t,e){return"".concat(t,":invocation[").concat(e,"]")}var be=j({type:ri});function Gt(t,e){return e&&e[t]||void 0}function Fe(t,e){var r;if(A(t)||typeof t=="number"){var n=Gt(t,e);_(n)?r={type:t,exec:n}:n?r=n:r={type:t,exec:void 0}}else if(_(t))r={type:t.name||t.toString(),exec:t};else{var n=Gt(t.type,e);if(_(n))r=v(v({},t),{exec:n});else if(n){var i=n.type||t.type;r=v(v(v({},n),t),{type:i})}else r=t}return r}var lt=function(t,e){if(!t)return[];var r=de(t)?t:[t];return r.map(function(n){return Fe(n,e)})};function zt(t){var e=Fe(t);return v(v({id:A(t)?t:e.id},e),{type:e.type})}function yi(t){return A(t)?{type:Le,event:t}:dt(t,{to:ve.Internal})}function tc(t){return{type:Le,_event:j(t.event)}}function dt(t,e){return{to:e?e.to:void 0,type:we,event:_(t)?t:ut(t),delay:e?e.delay:void 0,id:e&&e.id!==void 0?e.id:_(t)?t.name:Lt(t)}}function rc(t,e,r,n){var i={_event:r},s=j(_(t.event)?t.event(e,r.data,i):t.event),o;if(A(t.delay)){var a=n&&n[t.delay];o=_(a)?a(e,r.data,i):a}else o=_(t.delay)?t.delay(e,r.data,i):t.delay;var c=_(t.to)?t.to(e,r.data,i):t.to;return v(v({},t),{to:c,_event:s,event:s.data,delay:o})}var nc=function(t,e,r){return v(v({},t),{value:A(t.expr)?t.expr:t.expr(e,r.data,{_event:r})})},gi=function(t){return{type:It,sendId:t}};function Ei(t){var e=zt(t);return{type:P.Start,activity:e,exec:void 0}}function Si(t){var e=_(t)?t:zt(t);return{type:P.Stop,activity:e,exec:void 0}}function ic(t,e,r){var n=_(t.activity)?t.activity(e,r.data):t.activity,i=typeof n=="string"?{id:n}:n,s={type:P.Stop,activity:i};return s}var wi=function(t){return{type:kt,assignment:t}};function xi(t,e){var r=e?"#".concat(e):"";return"".concat(P.After,"(").concat(t,")").concat(r)}function ht(t,e){var r="".concat(P.DoneState,".").concat(t),n={type:r,data:e};return n.toString=function(){return r},n}function Re(t,e){var r="".concat(P.DoneInvoke,".").concat(t),n={type:r,data:e};return n.toString=function(){return r},n}function Ae(t,e){var r="".concat(P.ErrorPlatform,".").concat(t),n={type:r,data:e};return n.toString=function(){return r},n}function Jt(t,e,r,n,i,s){s===void 0&&(s=!1);var o=R(s?[[],i]:Bt(i,function(d){return d.type===kt}),2),a=o[0],c=o[1],f=a.length?Nr(r,n,a,e):r,u=s?[r]:void 0,l=q(c.map(function(d){var h;switch(d.type){case Le:return tc(d);case we:var g=rc(d,f,n,t.options.delays);return D||M(!A(d.delay)||typeof g.delay=="number","No delay reference for delay expression '".concat(d.delay,"' was found on machine '").concat(t.id,"'")),g;case qt:return nc(d,f,n);case ni:{var E=d,p=(h=E.conds.find(function(U){var B=Ft(U.cond,t.options.guards);return!B||Vt(t,B,f,n,e)}))===null||h===void 0?void 0:h.actions;if(!p)return[];var w=R(Jt(t,e,f,n,lt(Z(p),t.options.actions),s),2),y=w[0],x=w[1];return f=x,u==null||u.push(f),y}case ii:{var p=d.get(f,n.data);if(!p)return[];var C=R(Jt(t,e,f,n,lt(Z(p),t.options.actions),s),2),N=C[0],L=C[1];return f=L,u==null||u.push(f),N}case Me:return ic(d,f,n);case kt:{f=Nr(f,n,[d],e),u==null||u.push(f);break}default:var T=Fe(d,t.options.actions),S=T.exec;if(S&&u){var O=u.length-1;T=v(v({},T),{exec:function(U){for(var B=[],X=1;X<arguments.length;X++)B[X-1]=arguments[X];S.apply(void 0,I([u[O]],R(B),!1))}})}return T}}).filter(function(d){return!!d}));return[l,f]}var Ti=[],Oe=function(t,e){Ti.push(t);var r=e(t);return Ti.pop(),r};function bi(t){var e;return e={id:t,send:function(){},subscribe:function(){return{unsubscribe:function(){}}},getSnapshot:function(){},toJSON:function(){return{id:t}}},e[ae]=function(){return this},e}function Ri(t,e,r,n){var i,s=Ht(t.src),o=(i=e==null?void 0:e.options.services)===null||i===void 0?void 0:i[s.type],a=t.data?xe(t.data,r,n):void 0,c=o?Ai(o,t.id,a):bi(t.id);return c.meta=t,c}function Ai(t,e,r){var n=bi(e);if(n.deferred=!0,ue(t)){var i=n.state=Oe(void 0,function(){return(r?t.withContext(r):t).initialState});n.getSnapshot=function(){return i}}return n}function sc(t){try{return typeof t.send=="function"}catch{return!1}}function Oi(t){return sc(t)&&"id"in t}function Ci(t){var e;return v((e={subscribe:function(){return{unsubscribe:function(){}}},id:"anonymous",getSnapshot:function(){}},e[ae]=function(){return this},e),t)}var pt=function(t){return t.type==="atomic"||t.type==="final"};function Ce(t){return Object.keys(t.states).map(function(e){return t.states[e]})}function kr(t){var e=[t];return pt(t)?e:e.concat(q(Ce(t).map(kr)))}function Pe(t,e){var r,n,i,s,o,a,c,f,u=new Set(t),l=Ir(u),d=new Set(e);try{for(var h=b(d),g=h.next();!g.done;g=h.next())for(var E=g.value,p=E.parent;p&&!d.has(p);)d.add(p),p=p.parent}catch(O){r={error:O}}finally{try{g&&!g.done&&(n=h.return)&&n.call(h)}finally{if(r)throw r.error}}var w=Ir(d);try{for(var y=b(d),x=y.next();!x.done;x=y.next()){var E=x.value;if(E.type==="compound"&&(!w.get(E)||!w.get(E).length))l.get(E)?l.get(E).forEach(function(U){return d.add(U)}):E.initialStateNodes.forEach(function(U){return d.add(U)});else if(E.type==="parallel")try{for(var C=(o=void 0,b(Ce(E))),N=C.next();!N.done;N=C.next()){var L=N.value;L.type!=="history"&&(d.has(L)||(d.add(L),l.get(L)?l.get(L).forEach(function(U){return d.add(U)}):L.initialStateNodes.forEach(function(U){return d.add(U)})))}}catch(U){o={error:U}}finally{try{N&&!N.done&&(a=C.return)&&a.call(C)}finally{if(o)throw o.error}}}}catch(O){i={error:O}}finally{try{x&&!x.done&&(s=y.return)&&s.call(y)}finally{if(i)throw i.error}}try{for(var T=b(d),S=T.next();!S.done;S=T.next())for(var E=S.value,p=E.parent;p&&!d.has(p);)d.add(p),p=p.parent}catch(O){c={error:O}}finally{try{S&&!S.done&&(f=T.return)&&f.call(T)}finally{if(c)throw c.error}}return d}function Pi(t,e){var r=e.get(t);if(!r)return{};if(t.type==="compound"){var n=r[0];if(n){if(pt(n))return n.key}else return{}}var i={};return r.forEach(function(s){i[s.key]=Pi(s,e)}),i}function Ir(t){var e,r,n=new Map;try{for(var i=b(t),s=i.next();!s.done;s=i.next()){var o=s.value;n.has(o)||n.set(o,[]),o.parent&&(n.has(o.parent)||n.set(o.parent,[]),n.get(o.parent).push(o))}}catch(a){e={error:a}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}return n}function _i(t,e){var r=Pe([t],e);return Pi(t,Ir(r))}function mt(t,e){return Array.isArray(t)?t.some(function(r){return r===e}):t instanceof Set?t.has(e):!1}function Ni(t){return I([],R(new Set(q(I([],R(t.map(function(e){return e.ownEvents})),!1)))),!1)}function _e(t,e){return e.type==="compound"?Ce(e).some(function(r){return r.type==="final"&&mt(t,r)}):e.type==="parallel"?Ce(e).every(function(r){return _e(t,r)}):!1}function Ii(t){return t===void 0&&(t=[]),t.reduce(function(e,r){return r.meta!==void 0&&(e[r.id]=r.meta),e},{})}function qr(t){return new Set(q(t.map(function(e){return e.tags})))}function Dr(t,e){if(t===e)return!0;if(t===void 0||e===void 0)return!1;if(A(t)||A(e))return t===e;var r=Object.keys(t),n=Object.keys(e);return r.length===n.length&&r.every(function(i){return Dr(t[i],e[i])})}function ki(t){return typeof t!="object"||t===null?!1:"value"in t&&"_event"in t}function qi(t,e){var r=t.exec,n=v(v({},t),{exec:r!==void 0?function(){return r(e.context,e.event,{action:t,state:e,_event:e._event})}:void 0});return n}var ne=function(){function t(e){var r=this,n;this.actions=[],this.activities=Cr,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||Cr,this.meta=Ii(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 Ni(r.configuration)}})}return t.from=function(e,r){if(e instanceof t)return e.context!==r?new t({value:e.value,context:r,_event:e._event,_sessionid:null,historyValue:e.historyValue,history:e.history,actions:[],activities:e.activities,meta:{},events:[],configuration:[],transitions:[],children:{}}):e;var n=be;return new t({value:e,context:r,_event:n,_sessionid:null,historyValue:void 0,history:void 0,actions:[],activities:void 0,meta:void 0,events:[],configuration:[],transitions:[],children:{}})},t.create=function(e){return new t(e)},t.inert=function(e,r){if(e instanceof t){if(!e.actions.length)return e;var n=be;return new t({value:e.value,context:r,_event:n,_sessionid:null,historyValue:e.historyValue,history:e.history,activities:e.activities,configuration:e.configuration,transitions:[],children:{}})}return t.from(e,r)},t.prototype.toStrings=function(e,r){var n=this;if(e===void 0&&(e=this.value),r===void 0&&(r="."),A(e))return[e];var i=Object.keys(e);return i.concat.apply(i,I([],R(i.map(function(s){return n.toStrings(e[s],r).map(function(o){return s+r+o})})),!1))},t.prototype.toJSON=function(){var e=this;e.configuration,e.transitions;var r=e.tags;e.machine;var n=Ue(e,["configuration","transitions","tags","machine"]);return v(v({},n),{tags:Array.from(r)})},t.prototype.matches=function(e){return ot(e,this.value)},t.prototype.hasTag=function(e){return this.tags.has(e)},t.prototype.can=function(e){var r;D&&M(!!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 oc={deferEvents:!1},Ur=function(){function t(e){this.processingEvent=!1,this.queue=[],this.initialized=!1,this.options=v(v({},oc),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 Mr=new Map,ac=0,vt={bookId:function(){return"x:".concat(ac++)},register:function(t,e){return Mr.set(t,e),t},get:function(t){return Mr.get(t)},free:function(t){Mr.delete(t)}};function $t(){if(typeof globalThis!="undefined")return globalThis;if(typeof self!="undefined")return self;if(typeof window!="undefined")return window;if(typeof global!="undefined")return global;D||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 uc(){var t=$t();if(t&&"__xstate__"in t)return t.__xstate__}function Di(t){if(!!$t()){var e=uc();e&&e.register(t)}}function Ui(t,e){e===void 0&&(e={});var r=t.initialState,n=new Set,i=[],s=!1,o=function(){if(!s){for(s=!0;i.length>0;){var f=i.shift();r=t.transition(r,f,c),n.forEach(function(u){return u.next(r)})}s=!1}},a=Ci({id:e.id,send:function(f){i.push(f),o()},getSnapshot:function(){return r},subscribe:function(f,u,l){var d=ct(f,u,l);return n.add(d),d.next(r),{unsubscribe:function(){n.delete(d)}}}}),c={parent:e.parent,self:a,id:e.id||"anonymous",observers:n};return r=t.start?t.start(c):r,a}var cc={sync:!1,autoForward:!1},G;(function(t){t[t.NotStarted=0]="NotStarted",t[t.Running=1]="Running",t[t.Stopped=2]="Stopped"})(G||(G={}));var Mi=function(){function t(e,r){var n=this;r===void 0&&(r=t.defaultOptions),this.machine=e,this.scheduler=new Ur,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=G.NotStarted,this.children=new Map,this.forwardTo=new Set,this.init=this.start,this.send=function(u,l){if(de(u))return n.batch(u),n.state;var d=j(ut(u,l));if(n.status===G.Stopped)return D||M(!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.
|
|
1
|
+
var $u=Object.create;var Rr=Object.defineProperty;var Wu=Object.getOwnPropertyDescriptor;var Ku=Object.getOwnPropertyNames;var Xu=Object.getPrototypeOf,Yu=Object.prototype.hasOwnProperty;var Qu=t=>Rr(t,"__esModule",{value:!0});var m=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var Zu=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Ku(e))!Yu.call(t,i)&&(r||i!=="default")&&Rr(t,i,{get:()=>e[i],enumerable:!(n=Wu(e,i))||n.enumerable});return t},Nt=(t,e)=>Zu(Qu(Rr(t!=null?$u(Xu(t)):{},"default",!e&&t&&t.__esModule?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var Vr=m((im,us)=>{"use strict";us.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 $=m((sm,ds)=>{"use strict";var uf=Vr(),Ee=Object.prototype.toString;function Jr(t){return Array.isArray(t)}function Hr(t){return typeof t=="undefined"}function cf(t){return t!==null&&!Hr(t)&&t.constructor!==null&&!Hr(t.constructor)&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function cs(t){return Ee.call(t)==="[object ArrayBuffer]"}function ff(t){return Ee.call(t)==="[object FormData]"}function lf(t){var e;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&cs(t.buffer),e}function df(t){return typeof t=="string"}function hf(t){return typeof t=="number"}function fs(t){return t!==null&&typeof t=="object"}function Yt(t){if(Ee.call(t)!=="[object Object]")return!1;var e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}function pf(t){return Ee.call(t)==="[object Date]"}function mf(t){return Ee.call(t)==="[object File]"}function vf(t){return Ee.call(t)==="[object Blob]"}function ls(t){return Ee.call(t)==="[object Function]"}function yf(t){return fs(t)&&ls(t.pipe)}function gf(t){return Ee.call(t)==="[object URLSearchParams]"}function Ef(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function Sf(){return typeof navigator!="undefined"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window!="undefined"&&typeof document!="undefined"}function zr(t,e){if(!(t===null||typeof t=="undefined"))if(typeof t!="object"&&(t=[t]),Jr(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 Gr(){var t={};function e(i,s){Yt(t[s])&&Yt(i)?t[s]=Gr(t[s],i):Yt(i)?t[s]=Gr({},i):Jr(i)?t[s]=i.slice():t[s]=i}for(var r=0,n=arguments.length;r<n;r++)zr(arguments[r],e);return t}function wf(t,e,r){return zr(e,function(i,s){r&&typeof i=="function"?t[s]=uf(i,r):t[s]=i}),t}function xf(t){return t.charCodeAt(0)===65279&&(t=t.slice(1)),t}ds.exports={isArray:Jr,isArrayBuffer:cs,isBuffer:cf,isFormData:ff,isArrayBufferView:lf,isString:df,isNumber:hf,isObject:fs,isPlainObject:Yt,isUndefined:Hr,isDate:pf,isFile:mf,isBlob:vf,isFunction:ls,isStream:yf,isURLSearchParams:gf,isStandardBrowserEnv:Sf,forEach:zr,merge:Gr,extend:wf,trim:Ef,stripBOM:xf}});var $r=m((om,ps)=>{"use strict";var ze=$();function hs(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}ps.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,f){c===null||typeof c=="undefined"||(ze.isArray(c)?f=f+"[]":c=[c],ze.forEach(c,function(l){ze.isDate(l)?l=l.toISOString():ze.isObject(l)&&(l=JSON.stringify(l)),s.push(hs(f)+"="+hs(l))}))}),i=s.join("&")}if(i){var o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}});var vs=m((am,ms)=>{"use strict";var bf=$();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){bf.forEach(this.handlers,function(n){n!==null&&e(n)})};ms.exports=Qt});var gs=m((um,ys)=>{"use strict";var Tf=$();ys.exports=function(e,r){Tf.forEach(e,function(i,s){s!==r&&s.toUpperCase()===r.toUpperCase()&&(e[r]=i,delete e[s])})}});var Wr=m((cm,Es)=>{"use strict";Es.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 Kr=m((fm,Ss)=>{"use strict";var Rf=Wr();Ss.exports=function(e,r,n,i,s){var o=new Error(e);return Rf(o,r,n,i,s)}});var xs=m((lm,ws)=>{"use strict";var Af=Kr();ws.exports=function(e,r,n){var i=n.config.validateStatus;!n.status||!i||i(n.status)?e(n):r(Af("Request failed with status code "+n.status,n.config,null,n.request,n))}});var Ts=m((dm,bs)=>{"use strict";var Zt=$();bs.exports=Zt.isStandardBrowserEnv()?function(){return{write:function(r,n,i,s,o,a){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(o)&&c.push("domain="+o),a===!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 As=m((hm,Rs)=>{"use strict";Rs.exports=function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}});var Cs=m((pm,Os)=>{"use strict";Os.exports=function(e,r){return r?e.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):e}});var _s=m((mm,Ps)=>{"use strict";var Of=As(),Cf=Cs();Ps.exports=function(e,r){return e&&!Of(r)?Cf(e,r):r}});var Is=m((vm,Ns)=>{"use strict";var Xr=$(),Pf=["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"];Ns.exports=function(e){var r={},n,i,s;return e&&Xr.forEach(e.split(`
|
|
2
|
+
`),function(a){if(s=a.indexOf(":"),n=Xr.trim(a.substr(0,s)).toLowerCase(),i=Xr.trim(a.substr(s+1)),n){if(r[n]&&Pf.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 Ds=m((ym,qs)=>{"use strict";var ks=$();qs.exports=ks.isStandardBrowserEnv()?function(){var e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a"),n;function i(s){var o=s;return e&&(r.setAttribute("href",o),o=r.href),r.setAttribute("href",o),{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(o){var a=ks.isString(o)?i(o):o;return a.protocol===n.protocol&&a.host===n.host}}():function(){return function(){return!0}}()});var xt=m((gm,Us)=>{"use strict";function Yr(t){this.message=t}Yr.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")};Yr.prototype.__CANCEL__=!0;Us.exports=Yr});var Zr=m((Em,Ms)=>{"use strict";var er=$(),_f=xs(),Nf=Ts(),If=$r(),kf=_s(),qf=Is(),Df=Ds(),Qr=Kr(),Uf=bt(),Mf=xt();Ms.exports=function(e){return new Promise(function(n,i){var s=e.data,o=e.headers,a=e.responseType,c;function f(){e.cancelToken&&e.cancelToken.unsubscribe(c),e.signal&&e.signal.removeEventListener("abort",c)}er.isFormData(s)&&delete o["Content-Type"];var u=new XMLHttpRequest;if(e.auth){var l=e.auth.username||"",d=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";o.Authorization="Basic "+btoa(l+":"+d)}var h=kf(e.baseURL,e.url);u.open(e.method.toUpperCase(),If(h,e.params,e.paramsSerializer),!0),u.timeout=e.timeout;function g(){if(!!u){var p="getAllResponseHeaders"in u?qf(u.getAllResponseHeaders()):null,w=!a||a==="text"||a==="json"?u.responseText:u.response,y={data:w,status:u.status,statusText:u.statusText,headers:p,config:e,request:u};_f(function(C){n(C),f()},function(C){i(C),f()},y),u=null}}if("onloadend"in u?u.onloadend=g:u.onreadystatechange=function(){!u||u.readyState!==4||u.status===0&&!(u.responseURL&&u.responseURL.indexOf("file:")===0)||setTimeout(g)},u.onabort=function(){!u||(i(Qr("Request aborted",e,"ECONNABORTED",u)),u=null)},u.onerror=function(){i(Qr("Network Error",e,null,u)),u=null},u.ontimeout=function(){var w=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",y=e.transitional||Uf.transitional;e.timeoutErrorMessage&&(w=e.timeoutErrorMessage),i(Qr(w,e,y.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",u)),u=null},er.isStandardBrowserEnv()){var E=(e.withCredentials||Df(h))&&e.xsrfCookieName?Nf.read(e.xsrfCookieName):void 0;E&&(o[e.xsrfHeaderName]=E)}"setRequestHeader"in u&&er.forEach(o,function(w,y){typeof s=="undefined"&&y.toLowerCase()==="content-type"?delete o[y]:u.setRequestHeader(y,w)}),er.isUndefined(e.withCredentials)||(u.withCredentials=!!e.withCredentials),a&&a!=="json"&&(u.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&u.addEventListener("progress",e.onDownloadProgress),typeof e.onUploadProgress=="function"&&u.upload&&u.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(c=function(p){!u||(i(!p||p&&p.type?new Mf("canceled"):p),u.abort(),u=null)},e.cancelToken&&e.cancelToken.subscribe(c),e.signal&&(e.signal.aborted?c():e.signal.addEventListener("abort",c))),s||(s=null),u.send(s)})}});var bt=m((Sm,Bs)=>{"use strict";var F=$(),Ls=gs(),Lf=Wr(),jf={"Content-Type":"application/x-www-form-urlencoded"};function js(t,e){!F.isUndefined(t)&&F.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}function Bf(){var t;return typeof XMLHttpRequest!="undefined"?t=Zr():typeof process!="undefined"&&Object.prototype.toString.call(process)==="[object process]"&&(t=Zr()),t}function Ff(t,e,r){if(F.isString(t))try{return(e||JSON.parse)(t),F.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:Bf(),transformRequest:[function(e,r){return Ls(r,"Accept"),Ls(r,"Content-Type"),F.isFormData(e)||F.isArrayBuffer(e)||F.isBuffer(e)||F.isStream(e)||F.isFile(e)||F.isBlob(e)?e:F.isArrayBufferView(e)?e.buffer:F.isURLSearchParams(e)?(js(r,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):F.isObject(e)||r&&r["Content-Type"]==="application/json"?(js(r,"application/json"),Ff(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&&F.isString(e)&&e.length)try{return JSON.parse(e)}catch(o){if(s)throw o.name==="SyntaxError"?Lf(o,this,"E_JSON_PARSE"):o}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, */*"}}};F.forEach(["delete","get","head"],function(e){tr.headers[e]={}});F.forEach(["post","put","patch"],function(e){tr.headers[e]=F.merge(jf)});Bs.exports=tr});var Vs=m((wm,Fs)=>{"use strict";var Vf=$(),Hf=bt();Fs.exports=function(e,r,n){var i=this||Hf;return Vf.forEach(n,function(o){e=o.call(i,e,r)}),e}});var en=m((xm,Hs)=>{"use strict";Hs.exports=function(e){return!!(e&&e.__CANCEL__)}});var zs=m((bm,Js)=>{"use strict";var Gs=$(),tn=Vs(),Gf=en(),Jf=bt(),zf=xt();function rn(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new zf("canceled")}Js.exports=function(e){rn(e),e.headers=e.headers||{},e.data=tn.call(e,e.data,e.headers,e.transformRequest),e.headers=Gs.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),Gs.forEach(["delete","get","head","post","put","patch","common"],function(i){delete e.headers[i]});var r=e.adapter||Jf.adapter;return r(e).then(function(i){return rn(e),i.data=tn.call(e,i.data,i.headers,e.transformResponse),i},function(i){return Gf(i)||(rn(e),i&&i.response&&(i.response.data=tn.call(e,i.response.data,i.response.headers,e.transformResponse))),Promise.reject(i)})}});var nn=m((Tm,$s)=>{"use strict";var ee=$();$s.exports=function(e,r){r=r||{};var n={};function i(u,l){return ee.isPlainObject(u)&&ee.isPlainObject(l)?ee.merge(u,l):ee.isPlainObject(l)?ee.merge({},l):ee.isArray(l)?l.slice():l}function s(u){if(ee.isUndefined(r[u])){if(!ee.isUndefined(e[u]))return i(void 0,e[u])}else return i(e[u],r[u])}function o(u){if(!ee.isUndefined(r[u]))return i(void 0,r[u])}function a(u){if(ee.isUndefined(r[u])){if(!ee.isUndefined(e[u]))return i(void 0,e[u])}else return i(void 0,r[u])}function c(u){if(u in r)return i(e[u],r[u]);if(u in e)return i(void 0,e[u])}var f={url:o,method:o,data:o,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:c};return ee.forEach(Object.keys(e).concat(Object.keys(r)),function(l){var d=f[l]||s,h=d(l);ee.isUndefined(h)&&d!==c||(n[l]=h)}),n}});var sn=m((Rm,Ws)=>{Ws.exports={version:"0.25.0"}});var Ys=m((Am,Xs)=>{"use strict";var $f=sn().version,on={};["object","boolean","number","function","string","symbol"].forEach(function(t,e){on[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});var Ks={};on.transitional=function(e,r,n){function i(s,o){return"[Axios v"+$f+"] Transitional option '"+s+"'"+o+(n?". "+n:"")}return function(s,o,a){if(e===!1)throw new Error(i(o," has been removed"+(r?" in "+r:"")));return r&&!Ks[o]&&(Ks[o]=!0,console.warn(i(o," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(s,o,a):!0}};function Wf(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],o=e[s];if(o){var a=t[s],c=a===void 0||o(a,s,t);if(c!==!0)throw new TypeError("option "+s+" must be "+c);continue}if(r!==!0)throw Error("Unknown option "+s)}}Xs.exports={assertOptions:Wf,validators:on}});var no=m((Om,ro)=>{"use strict";var eo=$(),Kf=$r(),Qs=vs(),Zs=zs(),rr=nn(),to=Ys(),$e=to.validators;function Tt(t){this.defaults=t,this.interceptors={request:new Qs,response:new Qs}}Tt.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&&to.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 o=[];this.interceptors.response.forEach(function(h){o.push(h.fulfilled,h.rejected)});var a;if(!s){var c=[Zs,void 0];for(Array.prototype.unshift.apply(c,i),c=c.concat(o),a=Promise.resolve(r);c.length;)a=a.then(c.shift(),c.shift());return a}for(var f=r;i.length;){var u=i.shift(),l=i.shift();try{f=u(f)}catch(d){l(d);break}}try{a=Zs(f)}catch(d){return Promise.reject(d)}for(;o.length;)a=a.then(o.shift(),o.shift());return a};Tt.prototype.getUri=function(e){if(!e.url)throw new Error("Provided config url is not valid");return e=rr(this.defaults,e),Kf(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")};eo.forEach(["delete","get","head","options"],function(e){Tt.prototype[e]=function(r,n){return this.request(rr(n||{},{method:e,url:r,data:(n||{}).data}))}});eo.forEach(["post","put","patch"],function(e){Tt.prototype[e]=function(r,n,i){return this.request(rr(i||{},{method:e,url:r,data:n}))}});ro.exports=Tt});var so=m((Cm,io)=>{"use strict";var Xf=xt();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(o){r.subscribe(o),i=o}).then(n);return s.cancel=function(){r.unsubscribe(i)},s},t(function(i){r.reason||(r.reason=new Xf(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}};io.exports=We});var ao=m((Pm,oo)=>{"use strict";oo.exports=function(e){return function(n){return e.apply(null,n)}}});var co=m((_m,uo)=>{"use strict";var Yf=$();uo.exports=function(e){return Yf.isObject(e)&&e.isAxiosError===!0}});var ho=m((Nm,an)=>{"use strict";var fo=$(),Qf=Vr(),nr=no(),Zf=nn(),el=bt();function lo(t){var e=new nr(t),r=Qf(nr.prototype.request,e);return fo.extend(r,nr.prototype,e),fo.extend(r,e),r.create=function(i){return lo(Zf(t,i))},r}var fe=lo(el);fe.Axios=nr;fe.Cancel=xt();fe.CancelToken=so();fe.isCancel=en();fe.VERSION=sn().version;fe.all=function(e){return Promise.all(e)};fe.spread=ao();fe.isAxiosError=co();an.exports=fe;an.exports.default=fe});var mo=m((Im,po)=>{po.exports=ho()});var ln=m((gy,Po)=>{"use strict";Po.exports=function(e,r){return function(){for(var i=new Array(arguments.length),s=0;s<i.length;s++)i[s]=arguments[s];return e.apply(r,i)}}});var W=m((Ey,Io)=>{"use strict";var cl=ln(),ke=Object.prototype.toString;function pn(t){return ke.call(t)==="[object Array]"}function dn(t){return typeof t=="undefined"}function fl(t){return t!==null&&!dn(t)&&t.constructor!==null&&!dn(t.constructor)&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function ll(t){return ke.call(t)==="[object ArrayBuffer]"}function dl(t){return typeof FormData!="undefined"&&t instanceof FormData}function hl(t){var e;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&t.buffer instanceof ArrayBuffer,e}function pl(t){return typeof t=="string"}function ml(t){return typeof t=="number"}function _o(t){return t!==null&&typeof t=="object"}function cr(t){if(ke.call(t)!=="[object Object]")return!1;var e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}function vl(t){return ke.call(t)==="[object Date]"}function yl(t){return ke.call(t)==="[object File]"}function gl(t){return ke.call(t)==="[object Blob]"}function No(t){return ke.call(t)==="[object Function]"}function El(t){return _o(t)&&No(t.pipe)}function Sl(t){return typeof URLSearchParams!="undefined"&&t instanceof URLSearchParams}function wl(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function xl(){return typeof navigator!="undefined"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window!="undefined"&&typeof document!="undefined"}function mn(t,e){if(!(t===null||typeof t=="undefined"))if(typeof t!="object"&&(t=[t]),pn(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 hn(){var t={};function e(i,s){cr(t[s])&&cr(i)?t[s]=hn(t[s],i):cr(i)?t[s]=hn({},i):pn(i)?t[s]=i.slice():t[s]=i}for(var r=0,n=arguments.length;r<n;r++)mn(arguments[r],e);return t}function bl(t,e,r){return mn(e,function(i,s){r&&typeof i=="function"?t[s]=cl(i,r):t[s]=i}),t}function Tl(t){return t.charCodeAt(0)===65279&&(t=t.slice(1)),t}Io.exports={isArray:pn,isArrayBuffer:ll,isBuffer:fl,isFormData:dl,isArrayBufferView:hl,isString:pl,isNumber:ml,isObject:_o,isPlainObject:cr,isUndefined:dn,isDate:vl,isFile:yl,isBlob:gl,isFunction:No,isStream:El,isURLSearchParams:Sl,isStandardBrowserEnv:xl,forEach:mn,merge:hn,extend:bl,trim:wl,stripBOM:Tl}});var vn=m((Sy,qo)=>{"use strict";var Ye=W();function ko(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}qo.exports=function(e,r,n){if(!r)return e;var i;if(n)i=n(r);else if(Ye.isURLSearchParams(r))i=r.toString();else{var s=[];Ye.forEach(r,function(c,f){c===null||typeof c=="undefined"||(Ye.isArray(c)?f=f+"[]":c=[c],Ye.forEach(c,function(l){Ye.isDate(l)?l=l.toISOString():Ye.isObject(l)&&(l=JSON.stringify(l)),s.push(ko(f)+"="+ko(l))}))}),i=s.join("&")}if(i){var o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}});var Uo=m((wy,Do)=>{"use strict";var Rl=W();function fr(){this.handlers=[]}fr.prototype.use=function(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1};fr.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)};fr.prototype.forEach=function(e){Rl.forEach(this.handlers,function(n){n!==null&&e(n)})};Do.exports=fr});var Lo=m((xy,Mo)=>{"use strict";var Al=W();Mo.exports=function(e,r){Al.forEach(e,function(i,s){s!==r&&s.toUpperCase()===r.toUpperCase()&&(e[r]=i,delete e[s])})}});var yn=m((by,jo)=>{"use strict";jo.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 gn=m((Ty,Bo)=>{"use strict";var Ol=yn();Bo.exports=function(e,r,n,i,s){var o=new Error(e);return Ol(o,r,n,i,s)}});var Vo=m((Ry,Fo)=>{"use strict";var Cl=gn();Fo.exports=function(e,r,n){var i=n.config.validateStatus;!n.status||!i||i(n.status)?e(n):r(Cl("Request failed with status code "+n.status,n.config,null,n.request,n))}});var Go=m((Ay,Ho)=>{"use strict";var lr=W();Ho.exports=lr.isStandardBrowserEnv()?function(){return{write:function(r,n,i,s,o,a){var c=[];c.push(r+"="+encodeURIComponent(n)),lr.isNumber(i)&&c.push("expires="+new Date(i).toGMTString()),lr.isString(s)&&c.push("path="+s),lr.isString(o)&&c.push("domain="+o),a===!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 zo=m((Oy,Jo)=>{"use strict";Jo.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}});var Wo=m((Cy,$o)=>{"use strict";$o.exports=function(e,r){return r?e.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):e}});var Xo=m((Py,Ko)=>{"use strict";var Pl=zo(),_l=Wo();Ko.exports=function(e,r){return e&&!Pl(r)?_l(e,r):r}});var Qo=m((_y,Yo)=>{"use strict";var En=W(),Nl=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];Yo.exports=function(e){var r={},n,i,s;return e&&En.forEach(e.split(`
|
|
3
|
+
`),function(a){if(s=a.indexOf(":"),n=En.trim(a.substr(0,s)).toLowerCase(),i=En.trim(a.substr(s+1)),n){if(r[n]&&Nl.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 ta=m((Ny,ea)=>{"use strict";var Zo=W();ea.exports=Zo.isStandardBrowserEnv()?function(){var e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a"),n;function i(s){var o=s;return e&&(r.setAttribute("href",o),o=r.href),r.setAttribute("href",o),{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(o){var a=Zo.isString(o)?i(o):o;return a.protocol===n.protocol&&a.host===n.host}}():function(){return function(){return!0}}()});var wn=m((Iy,ra)=>{"use strict";var dr=W(),Il=Vo(),kl=Go(),ql=vn(),Dl=Xo(),Ul=Qo(),Ml=ta(),Sn=gn();ra.exports=function(e){return new Promise(function(n,i){var s=e.data,o=e.headers,a=e.responseType;dr.isFormData(s)&&delete o["Content-Type"];var c=new XMLHttpRequest;if(e.auth){var f=e.auth.username||"",u=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";o.Authorization="Basic "+btoa(f+":"+u)}var l=Dl(e.baseURL,e.url);c.open(e.method.toUpperCase(),ql(l,e.params,e.paramsSerializer),!0),c.timeout=e.timeout;function d(){if(!!c){var g="getAllResponseHeaders"in c?Ul(c.getAllResponseHeaders()):null,E=!a||a==="text"||a==="json"?c.responseText:c.response,p={data:E,status:c.status,statusText:c.statusText,headers:g,config:e,request:c};Il(n,i,p),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(Sn("Request aborted",e,"ECONNABORTED",c)),c=null)},c.onerror=function(){i(Sn("Network Error",e,null,c)),c=null},c.ontimeout=function(){var E="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(E=e.timeoutErrorMessage),i(Sn(E,e,e.transitional&&e.transitional.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",c)),c=null},dr.isStandardBrowserEnv()){var h=(e.withCredentials||Ml(l))&&e.xsrfCookieName?kl.read(e.xsrfCookieName):void 0;h&&(o[e.xsrfHeaderName]=h)}"setRequestHeader"in c&&dr.forEach(o,function(E,p){typeof s=="undefined"&&p.toLowerCase()==="content-type"?delete o[p]:c.setRequestHeader(p,E)}),dr.isUndefined(e.withCredentials)||(c.withCredentials=!!e.withCredentials),a&&a!=="json"&&(c.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&c.addEventListener("progress",e.onDownloadProgress),typeof e.onUploadProgress=="function"&&c.upload&&c.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then(function(E){!c||(c.abort(),i(E),c=null)}),s||(s=null),c.send(s)})}});var pr=m((ky,sa)=>{"use strict";var V=W(),na=Lo(),Ll=yn(),jl={"Content-Type":"application/x-www-form-urlencoded"};function ia(t,e){!V.isUndefined(t)&&V.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}function Bl(){var t;return typeof XMLHttpRequest!="undefined"?t=wn():typeof process!="undefined"&&Object.prototype.toString.call(process)==="[object process]"&&(t=wn()),t}function Fl(t,e,r){if(V.isString(t))try{return(e||JSON.parse)(t),V.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}var hr={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:Bl(),transformRequest:[function(e,r){return na(r,"Accept"),na(r,"Content-Type"),V.isFormData(e)||V.isArrayBuffer(e)||V.isBuffer(e)||V.isStream(e)||V.isFile(e)||V.isBlob(e)?e:V.isArrayBufferView(e)?e.buffer:V.isURLSearchParams(e)?(ia(r,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):V.isObject(e)||r&&r["Content-Type"]==="application/json"?(ia(r,"application/json"),Fl(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&&V.isString(e)&&e.length)try{return JSON.parse(e)}catch(o){if(s)throw o.name==="SyntaxError"?Ll(o,this,"E_JSON_PARSE"):o}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300}};hr.headers={common:{Accept:"application/json, text/plain, */*"}};V.forEach(["delete","get","head"],function(e){hr.headers[e]={}});V.forEach(["post","put","patch"],function(e){hr.headers[e]=V.merge(jl)});sa.exports=hr});var aa=m((qy,oa)=>{"use strict";var Vl=W(),Hl=pr();oa.exports=function(e,r,n){var i=this||Hl;return Vl.forEach(n,function(o){e=o.call(i,e,r)}),e}});var xn=m((Dy,ua)=>{"use strict";ua.exports=function(e){return!!(e&&e.__CANCEL__)}});var la=m((Uy,fa)=>{"use strict";var ca=W(),bn=aa(),Gl=xn(),Jl=pr();function Tn(t){t.cancelToken&&t.cancelToken.throwIfRequested()}fa.exports=function(e){Tn(e),e.headers=e.headers||{},e.data=bn.call(e,e.data,e.headers,e.transformRequest),e.headers=ca.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),ca.forEach(["delete","get","head","post","put","patch","common"],function(i){delete e.headers[i]});var r=e.adapter||Jl.adapter;return r(e).then(function(i){return Tn(e),i.data=bn.call(e,i.data,i.headers,e.transformResponse),i},function(i){return Gl(i)||(Tn(e),i&&i.response&&(i.response.data=bn.call(e,i.response.data,i.response.headers,e.transformResponse))),Promise.reject(i)})}});var Rn=m((My,da)=>{"use strict";var z=W();da.exports=function(e,r){r=r||{};var n={},i=["url","method","data"],s=["headers","auth","proxy","params"],o=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],a=["validateStatus"];function c(d,h){return z.isPlainObject(d)&&z.isPlainObject(h)?z.merge(d,h):z.isPlainObject(h)?z.merge({},h):z.isArray(h)?h.slice():h}function f(d){z.isUndefined(r[d])?z.isUndefined(e[d])||(n[d]=c(void 0,e[d])):n[d]=c(e[d],r[d])}z.forEach(i,function(h){z.isUndefined(r[h])||(n[h]=c(void 0,r[h]))}),z.forEach(s,f),z.forEach(o,function(h){z.isUndefined(r[h])?z.isUndefined(e[h])||(n[h]=c(void 0,e[h])):n[h]=c(void 0,r[h])}),z.forEach(a,function(h){h in r?n[h]=c(e[h],r[h]):h in e&&(n[h]=c(void 0,e[h]))});var u=i.concat(s).concat(o).concat(a),l=Object.keys(e).concat(Object.keys(r)).filter(function(h){return u.indexOf(h)===-1});return z.forEach(l,f),n}});var ha=m((Ly,zl)=>{zl.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 ga=m((jy,ya)=>{"use strict";var ma=ha(),An={};["object","boolean","number","function","string","symbol"].forEach(function(t,e){An[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});var pa={},$l=ma.version.split(".");function va(t,e){for(var r=e?e.split("."):$l,n=t.split("."),i=0;i<3;i++){if(r[i]>n[i])return!0;if(r[i]<n[i])return!1}return!1}An.transitional=function(e,r,n){var i=r&&va(r);function s(o,a){return"[Axios v"+ma.version+"] Transitional option '"+o+"'"+a+(n?". "+n:"")}return function(o,a,c){if(e===!1)throw new Error(s(a," has been removed in "+r));return i&&!pa[a]&&(pa[a]=!0,console.warn(s(a," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(o,a,c):!0}};function Wl(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],o=e[s];if(o){var a=t[s],c=a===void 0||o(a,s,t);if(c!==!0)throw new TypeError("option "+s+" must be "+c);continue}if(r!==!0)throw Error("Unknown option "+s)}}ya.exports={isOlderVersion:va,assertOptions:Wl,validators:An}});var Ta=m((By,ba)=>{"use strict";var wa=W(),Kl=vn(),Ea=Uo(),Sa=la(),mr=Rn(),xa=ga(),Qe=xa.validators;function At(t){this.defaults=t,this.interceptors={request:new Ea,response:new Ea}}At.prototype.request=function(e){typeof e=="string"?(e=arguments[1]||{},e.url=arguments[0]):e=e||{},e=mr(this.defaults,e),e.method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var r=e.transitional;r!==void 0&&xa.assertOptions(r,{silentJSONParsing:Qe.transitional(Qe.boolean,"1.0.0"),forcedJSONParsing:Qe.transitional(Qe.boolean,"1.0.0"),clarifyTimeoutError:Qe.transitional(Qe.boolean,"1.0.0")},!1);var n=[],i=!0;this.interceptors.request.forEach(function(d){typeof d.runWhen=="function"&&d.runWhen(e)===!1||(i=i&&d.synchronous,n.unshift(d.fulfilled,d.rejected))});var s=[];this.interceptors.response.forEach(function(d){s.push(d.fulfilled,d.rejected)});var o;if(!i){var a=[Sa,void 0];for(Array.prototype.unshift.apply(a,n),a=a.concat(s),o=Promise.resolve(e);a.length;)o=o.then(a.shift(),a.shift());return o}for(var c=e;n.length;){var f=n.shift(),u=n.shift();try{c=f(c)}catch(l){u(l);break}}try{o=Sa(c)}catch(l){return Promise.reject(l)}for(;s.length;)o=o.then(s.shift(),s.shift());return o};At.prototype.getUri=function(e){return e=mr(this.defaults,e),Kl(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")};wa.forEach(["delete","get","head","options"],function(e){At.prototype[e]=function(r,n){return this.request(mr(n||{},{method:e,url:r,data:(n||{}).data}))}});wa.forEach(["post","put","patch"],function(e){At.prototype[e]=function(r,n,i){return this.request(mr(i||{},{method:e,url:r,data:n}))}});ba.exports=At});var Cn=m((Fy,Ra)=>{"use strict";function On(t){this.message=t}On.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")};On.prototype.__CANCEL__=!0;Ra.exports=On});var Oa=m((Vy,Aa)=>{"use strict";var Xl=Cn();function vr(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 Xl(i),e(r.reason))})}vr.prototype.throwIfRequested=function(){if(this.reason)throw this.reason};vr.source=function(){var e,r=new vr(function(i){e=i});return{token:r,cancel:e}};Aa.exports=vr});var Pa=m((Hy,Ca)=>{"use strict";Ca.exports=function(e){return function(n){return e.apply(null,n)}}});var Na=m((Gy,_a)=>{"use strict";_a.exports=function(e){return typeof e=="object"&&e.isAxiosError===!0}});var qa=m((Jy,Pn)=>{"use strict";var Ia=W(),Yl=ln(),yr=Ta(),Ql=Rn(),Zl=pr();function ka(t){var e=new yr(t),r=Yl(yr.prototype.request,e);return Ia.extend(r,yr.prototype,e),Ia.extend(r,e),r}var oe=ka(Zl);oe.Axios=yr;oe.create=function(e){return ka(Ql(oe.defaults,e))};oe.Cancel=Cn();oe.CancelToken=Oa();oe.isCancel=xn();oe.all=function(e){return Promise.all(e)};oe.spread=Pa();oe.isAxiosError=Na();Pn.exports=oe;Pn.exports.default=oe});var Ua=m((zy,Da)=>{Da.exports=qa()});var In=m((tg,La)=>{"use strict";La.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=m((rg,Fa)=>{"use strict";var ed=In(),qe=Object.prototype.toString;function Dn(t){return qe.call(t)==="[object Array]"}function kn(t){return typeof t=="undefined"}function td(t){return t!==null&&!kn(t)&&t.constructor!==null&&!kn(t.constructor)&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function rd(t){return qe.call(t)==="[object ArrayBuffer]"}function nd(t){return typeof FormData!="undefined"&&t instanceof FormData}function id(t){var e;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&t.buffer instanceof ArrayBuffer,e}function sd(t){return typeof t=="string"}function od(t){return typeof t=="number"}function ja(t){return t!==null&&typeof t=="object"}function gr(t){if(qe.call(t)!=="[object Object]")return!1;var e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}function ad(t){return qe.call(t)==="[object Date]"}function ud(t){return qe.call(t)==="[object File]"}function cd(t){return qe.call(t)==="[object Blob]"}function Ba(t){return qe.call(t)==="[object Function]"}function fd(t){return ja(t)&&Ba(t.pipe)}function ld(t){return typeof URLSearchParams!="undefined"&&t instanceof URLSearchParams}function dd(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function hd(){return typeof navigator!="undefined"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window!="undefined"&&typeof document!="undefined"}function Un(t,e){if(!(t===null||typeof t=="undefined"))if(typeof t!="object"&&(t=[t]),Dn(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 qn(){var t={};function e(i,s){gr(t[s])&&gr(i)?t[s]=qn(t[s],i):gr(i)?t[s]=qn({},i):Dn(i)?t[s]=i.slice():t[s]=i}for(var r=0,n=arguments.length;r<n;r++)Un(arguments[r],e);return t}function pd(t,e,r){return Un(e,function(i,s){r&&typeof i=="function"?t[s]=ed(i,r):t[s]=i}),t}function md(t){return t.charCodeAt(0)===65279&&(t=t.slice(1)),t}Fa.exports={isArray:Dn,isArrayBuffer:rd,isBuffer:td,isFormData:nd,isArrayBufferView:id,isString:sd,isNumber:od,isObject:ja,isPlainObject:gr,isUndefined:kn,isDate:ad,isFile:ud,isBlob:cd,isFunction:Ba,isStream:fd,isURLSearchParams:ld,isStandardBrowserEnv:hd,forEach:Un,merge:qn,extend:pd,trim:dd,stripBOM:md}});var Mn=m((ng,Ha)=>{"use strict";var Ze=K();function Va(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}Ha.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,f){c===null||typeof c=="undefined"||(Ze.isArray(c)?f=f+"[]":c=[c],Ze.forEach(c,function(l){Ze.isDate(l)?l=l.toISOString():Ze.isObject(l)&&(l=JSON.stringify(l)),s.push(Va(f)+"="+Va(l))}))}),i=s.join("&")}if(i){var o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}});var Ja=m((ig,Ga)=>{"use strict";var vd=K();function Er(){this.handlers=[]}Er.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};Er.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)};Er.prototype.forEach=function(e){vd.forEach(this.handlers,function(n){n!==null&&e(n)})};Ga.exports=Er});var $a=m((sg,za)=>{"use strict";var yd=K();za.exports=function(e,r){yd.forEach(e,function(i,s){s!==r&&s.toUpperCase()===r.toUpperCase()&&(e[r]=i,delete e[s])})}});var Ln=m((og,Wa)=>{"use strict";Wa.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=m((ag,Ka)=>{"use strict";var gd=Ln();Ka.exports=function(e,r,n,i,s){var o=new Error(e);return gd(o,r,n,i,s)}});var Ya=m((ug,Xa)=>{"use strict";var Ed=jn();Xa.exports=function(e,r,n){var i=n.config.validateStatus;!n.status||!i||i(n.status)?e(n):r(Ed("Request failed with status code "+n.status,n.config,null,n.request,n))}});var Za=m((cg,Qa)=>{"use strict";var Sr=K();Qa.exports=Sr.isStandardBrowserEnv()?function(){return{write:function(r,n,i,s,o,a){var c=[];c.push(r+"="+encodeURIComponent(n)),Sr.isNumber(i)&&c.push("expires="+new Date(i).toGMTString()),Sr.isString(s)&&c.push("path="+s),Sr.isString(o)&&c.push("domain="+o),a===!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 tu=m((fg,eu)=>{"use strict";eu.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}});var nu=m((lg,ru)=>{"use strict";ru.exports=function(e,r){return r?e.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):e}});var su=m((dg,iu)=>{"use strict";var Sd=tu(),wd=nu();iu.exports=function(e,r){return e&&!Sd(r)?wd(e,r):r}});var au=m((hg,ou)=>{"use strict";var Bn=K(),xd=["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"];ou.exports=function(e){var r={},n,i,s;return e&&Bn.forEach(e.split(`
|
|
4
|
+
`),function(a){if(s=a.indexOf(":"),n=Bn.trim(a.substr(0,s)).toLowerCase(),i=Bn.trim(a.substr(s+1)),n){if(r[n]&&xd.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 fu=m((pg,cu)=>{"use strict";var uu=K();cu.exports=uu.isStandardBrowserEnv()?function(){var e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a"),n;function i(s){var o=s;return e&&(r.setAttribute("href",o),o=r.href),r.setAttribute("href",o),{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(o){var a=uu.isString(o)?i(o):o;return a.protocol===n.protocol&&a.host===n.host}}():function(){return function(){return!0}}()});var Ot=m((mg,lu)=>{"use strict";function Fn(t){this.message=t}Fn.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")};Fn.prototype.__CANCEL__=!0;lu.exports=Fn});var Hn=m((vg,du)=>{"use strict";var wr=K(),bd=Ya(),Td=Za(),Rd=Mn(),Ad=su(),Od=au(),Cd=fu(),Vn=jn(),Pd=Ct(),_d=Ot();du.exports=function(e){return new Promise(function(n,i){var s=e.data,o=e.headers,a=e.responseType,c;function f(){e.cancelToken&&e.cancelToken.unsubscribe(c),e.signal&&e.signal.removeEventListener("abort",c)}wr.isFormData(s)&&delete o["Content-Type"];var u=new XMLHttpRequest;if(e.auth){var l=e.auth.username||"",d=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";o.Authorization="Basic "+btoa(l+":"+d)}var h=Ad(e.baseURL,e.url);u.open(e.method.toUpperCase(),Rd(h,e.params,e.paramsSerializer),!0),u.timeout=e.timeout;function g(){if(!!u){var p="getAllResponseHeaders"in u?Od(u.getAllResponseHeaders()):null,w=!a||a==="text"||a==="json"?u.responseText:u.response,y={data:w,status:u.status,statusText:u.statusText,headers:p,config:e,request:u};bd(function(C){n(C),f()},function(C){i(C),f()},y),u=null}}if("onloadend"in u?u.onloadend=g:u.onreadystatechange=function(){!u||u.readyState!==4||u.status===0&&!(u.responseURL&&u.responseURL.indexOf("file:")===0)||setTimeout(g)},u.onabort=function(){!u||(i(Vn("Request aborted",e,"ECONNABORTED",u)),u=null)},u.onerror=function(){i(Vn("Network Error",e,null,u)),u=null},u.ontimeout=function(){var w=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",y=e.transitional||Pd.transitional;e.timeoutErrorMessage&&(w=e.timeoutErrorMessage),i(Vn(w,e,y.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",u)),u=null},wr.isStandardBrowserEnv()){var E=(e.withCredentials||Cd(h))&&e.xsrfCookieName?Td.read(e.xsrfCookieName):void 0;E&&(o[e.xsrfHeaderName]=E)}"setRequestHeader"in u&&wr.forEach(o,function(w,y){typeof s=="undefined"&&y.toLowerCase()==="content-type"?delete o[y]:u.setRequestHeader(y,w)}),wr.isUndefined(e.withCredentials)||(u.withCredentials=!!e.withCredentials),a&&a!=="json"&&(u.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&u.addEventListener("progress",e.onDownloadProgress),typeof e.onUploadProgress=="function"&&u.upload&&u.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(c=function(p){!u||(i(!p||p&&p.type?new _d("canceled"):p),u.abort(),u=null)},e.cancelToken&&e.cancelToken.subscribe(c),e.signal&&(e.signal.aborted?c():e.signal.addEventListener("abort",c))),s||(s=null),u.send(s)})}});var Ct=m((yg,mu)=>{"use strict";var H=K(),hu=$a(),Nd=Ln(),Id={"Content-Type":"application/x-www-form-urlencoded"};function pu(t,e){!H.isUndefined(t)&&H.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}function kd(){var t;return typeof XMLHttpRequest!="undefined"?t=Hn():typeof process!="undefined"&&Object.prototype.toString.call(process)==="[object process]"&&(t=Hn()),t}function qd(t,e,r){if(H.isString(t))try{return(e||JSON.parse)(t),H.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}var xr={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:kd(),transformRequest:[function(e,r){return hu(r,"Accept"),hu(r,"Content-Type"),H.isFormData(e)||H.isArrayBuffer(e)||H.isBuffer(e)||H.isStream(e)||H.isFile(e)||H.isBlob(e)?e:H.isArrayBufferView(e)?e.buffer:H.isURLSearchParams(e)?(pu(r,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):H.isObject(e)||r&&r["Content-Type"]==="application/json"?(pu(r,"application/json"),qd(e)):e}],transformResponse:[function(e){var r=this.transitional||xr.transitional,n=r&&r.silentJSONParsing,i=r&&r.forcedJSONParsing,s=!n&&this.responseType==="json";if(s||i&&H.isString(e)&&e.length)try{return JSON.parse(e)}catch(o){if(s)throw o.name==="SyntaxError"?Nd(o,this,"E_JSON_PARSE"):o}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, */*"}}};H.forEach(["delete","get","head"],function(e){xr.headers[e]={}});H.forEach(["post","put","patch"],function(e){xr.headers[e]=H.merge(Id)});mu.exports=xr});var yu=m((gg,vu)=>{"use strict";var Dd=K(),Ud=Ct();vu.exports=function(e,r,n){var i=this||Ud;return Dd.forEach(n,function(o){e=o.call(i,e,r)}),e}});var Gn=m((Eg,gu)=>{"use strict";gu.exports=function(e){return!!(e&&e.__CANCEL__)}});var wu=m((Sg,Su)=>{"use strict";var Eu=K(),Jn=yu(),Md=Gn(),Ld=Ct(),jd=Ot();function zn(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new jd("canceled")}Su.exports=function(e){zn(e),e.headers=e.headers||{},e.data=Jn.call(e,e.data,e.headers,e.transformRequest),e.headers=Eu.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),Eu.forEach(["delete","get","head","post","put","patch","common"],function(i){delete e.headers[i]});var r=e.adapter||Ld.adapter;return r(e).then(function(i){return zn(e),i.data=Jn.call(e,i.data,i.headers,e.transformResponse),i},function(i){return Md(i)||(zn(e),i&&i.response&&(i.response.data=Jn.call(e,i.response.data,i.response.headers,e.transformResponse))),Promise.reject(i)})}});var $n=m((wg,xu)=>{"use strict";var te=K();xu.exports=function(e,r){r=r||{};var n={};function i(u,l){return te.isPlainObject(u)&&te.isPlainObject(l)?te.merge(u,l):te.isPlainObject(l)?te.merge({},l):te.isArray(l)?l.slice():l}function s(u){if(te.isUndefined(r[u])){if(!te.isUndefined(e[u]))return i(void 0,e[u])}else return i(e[u],r[u])}function o(u){if(!te.isUndefined(r[u]))return i(void 0,r[u])}function a(u){if(te.isUndefined(r[u])){if(!te.isUndefined(e[u]))return i(void 0,e[u])}else return i(void 0,r[u])}function c(u){if(u in r)return i(e[u],r[u]);if(u in e)return i(void 0,e[u])}var f={url:o,method:o,data:o,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:c};return te.forEach(Object.keys(e).concat(Object.keys(r)),function(l){var d=f[l]||s,h=d(l);te.isUndefined(h)&&d!==c||(n[l]=h)}),n}});var Wn=m((xg,bu)=>{bu.exports={version:"0.23.0"}});var Au=m((bg,Ru)=>{"use strict";var Bd=Wn().version,Kn={};["object","boolean","number","function","string","symbol"].forEach(function(t,e){Kn[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});var Tu={};Kn.transitional=function(e,r,n){function i(s,o){return"[Axios v"+Bd+"] Transitional option '"+s+"'"+o+(n?". "+n:"")}return function(s,o,a){if(e===!1)throw new Error(i(o," has been removed"+(r?" in "+r:"")));return r&&!Tu[o]&&(Tu[o]=!0,console.warn(i(o," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(s,o,a):!0}};function Fd(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],o=e[s];if(o){var a=t[s],c=a===void 0||o(a,s,t);if(c!==!0)throw new TypeError("option "+s+" must be "+c);continue}if(r!==!0)throw Error("Unknown option "+s)}}Ru.exports={assertOptions:Fd,validators:Kn}});var Iu=m((Tg,Nu)=>{"use strict";var Pu=K(),Vd=Mn(),Ou=Ja(),Cu=wu(),br=$n(),_u=Au(),et=_u.validators;function Pt(t){this.defaults=t,this.interceptors={request:new Ou,response:new Ou}}Pt.prototype.request=function(e){typeof e=="string"?(e=arguments[1]||{},e.url=arguments[0]):e=e||{},e=br(this.defaults,e),e.method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var r=e.transitional;r!==void 0&&_u.assertOptions(r,{silentJSONParsing:et.transitional(et.boolean),forcedJSONParsing:et.transitional(et.boolean),clarifyTimeoutError:et.transitional(et.boolean)},!1);var n=[],i=!0;this.interceptors.request.forEach(function(d){typeof d.runWhen=="function"&&d.runWhen(e)===!1||(i=i&&d.synchronous,n.unshift(d.fulfilled,d.rejected))});var s=[];this.interceptors.response.forEach(function(d){s.push(d.fulfilled,d.rejected)});var o;if(!i){var a=[Cu,void 0];for(Array.prototype.unshift.apply(a,n),a=a.concat(s),o=Promise.resolve(e);a.length;)o=o.then(a.shift(),a.shift());return o}for(var c=e;n.length;){var f=n.shift(),u=n.shift();try{c=f(c)}catch(l){u(l);break}}try{o=Cu(c)}catch(l){return Promise.reject(l)}for(;s.length;)o=o.then(s.shift(),s.shift());return o};Pt.prototype.getUri=function(e){return e=br(this.defaults,e),Vd(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")};Pu.forEach(["delete","get","head","options"],function(e){Pt.prototype[e]=function(r,n){return this.request(br(n||{},{method:e,url:r,data:(n||{}).data}))}});Pu.forEach(["post","put","patch"],function(e){Pt.prototype[e]=function(r,n,i){return this.request(br(i||{},{method:e,url:r,data:n}))}});Nu.exports=Pt});var qu=m((Rg,ku)=>{"use strict";var Hd=Ot();function tt(t){if(typeof t!="function")throw new TypeError("executor must be a function.");var e;this.promise=new Promise(function(i){e=i});var r=this;this.promise.then(function(n){if(!!r._listeners){var i,s=r._listeners.length;for(i=0;i<s;i++)r._listeners[i](n);r._listeners=null}}),this.promise.then=function(n){var i,s=new Promise(function(o){r.subscribe(o),i=o}).then(n);return s.cancel=function(){r.unsubscribe(i)},s},t(function(i){r.reason||(r.reason=new Hd(i),e(r.reason))})}tt.prototype.throwIfRequested=function(){if(this.reason)throw this.reason};tt.prototype.subscribe=function(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]};tt.prototype.unsubscribe=function(e){if(!!this._listeners){var r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}};tt.source=function(){var e,r=new tt(function(i){e=i});return{token:r,cancel:e}};ku.exports=tt});var Uu=m((Ag,Du)=>{"use strict";Du.exports=function(e){return function(n){return e.apply(null,n)}}});var Lu=m((Og,Mu)=>{"use strict";Mu.exports=function(e){return typeof e=="object"&&e.isAxiosError===!0}});var Fu=m((Cg,Xn)=>{"use strict";var ju=K(),Gd=In(),Tr=Iu(),Jd=$n(),zd=Ct();function Bu(t){var e=new Tr(t),r=Gd(Tr.prototype.request,e);return ju.extend(r,Tr.prototype,e),ju.extend(r,e),r.create=function(i){return Bu(Jd(t,i))},r}var le=Bu(zd);le.Axios=Tr;le.Cancel=Ot();le.CancelToken=qu();le.isCancel=Gn();le.VERSION=Wn().version;le.all=function(e){return Promise.all(e)};le.spread=Uu();le.isAxiosError=Lu();Xn.exports=le;Xn.exports.default=le});var Yn=m((Pg,Vu)=>{Vu.exports=Fu()});var v=function(){return v=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},v.apply(this,arguments)};function Ue(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 T(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 R(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}function I(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 P;(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"})(P||(P={}));var ve;(function(t){t.Parent="#_parent",t.Internal="#_internal"})(ve||(ve={}));var rt=P.Start,Me=P.Stop,Le=P.Raise,Se=P.Send,It=P.Cancel,ti=P.NullEvent,kt=P.Assign,Yd=P.After,Qd=P.DoneState,qt=P.Log,ri=P.Init,nt=P.Invoke,Zd=P.ErrorExecution,Ar=P.ErrorPlatform,Or=P.ErrorCustom,it=P.Update,ni=P.Choose,ii=P.Pure;var Dt=".",Cr={},Ut="xstate.guard",si="";var D=!0;var Mt;function ot(t,e,r){r===void 0&&(r=Dt);var n=je(t,r),i=je(e,r);return A(i)?A(n)?i===n:!1:A(n)?n in i:Object.keys(n).every(function(s){return s in i?ot(n[s],i[s]):!1})}function Lt(t){try{return A(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 jt(t,e){try{return de(t)?t:t.toString().split(e)}catch{throw new Error("'".concat(t,"' is not a valid state path."))}}function ec(t){return typeof t=="object"&&"value"in t&&"context"in t&&"event"in t&&"_event"in t}function je(t,e){if(ec(t))return t.value;if(de(t))return st(t);if(typeof t!="string")return t;var r=jt(t,e);return st(r)}function st(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 Be(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 Pr(t,e,r){var n,i,s={};try{for(var o=T(Object.keys(t)),a=o.next();!a.done;a=o.next()){var c=a.value,f=t[c];!r(f)||(s[c]=e(f,c,t))}}catch(u){n={error:u}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}return s}var oi=function(t){return function(e){var r,n,i=e;try{for(var s=T(t),o=s.next();!o.done;o=s.next()){var a=o.value;i=i[a]}}catch(c){r={error:c}}finally{try{o&&!o.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return i}};function ai(t,e){return function(r){var n,i,s=r;try{for(var o=T(t),a=o.next();!a.done;a=o.next()){var c=a.value;s=s[e][c]}}catch(f){n={error:f}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}return s}}function at(t){if(!t)return[[]];if(A(t))return[[t]];var e=q(Object.keys(t).map(function(r){var n=t[r];return typeof n!="string"&&(!n||!Object.keys(n).length)?[[r]]:at(t[r]).map(function(i){return[r].concat(i)})}));return e}function q(t){var e;return(e=[]).concat.apply(e,I([],R(t),!1))}function ui(t){return de(t)?t:[t]}function Z(t){return t===void 0?[]:ui(t)}function we(t,e,r){var n,i;if(_(t))return t(e,r.data);var s={};try{for(var o=T(Object.keys(t)),a=o.next();!a.done;a=o.next()){var c=a.value,f=t[c];_(f)?s[c]=f(e,r.data):s[c]=f}}catch(u){n={error:u}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}return s}function ci(t){return/^(done|error)\./.test(t)}function _r(t){return!!(t instanceof Promise||t!==null&&(_(t)||typeof t=="object")&&_(t.then))}function fi(t){return t!==null&&typeof t=="object"&&"transition"in t&&typeof t.transition=="function"}function Bt(t,e){var r,n,i=R([[],[]],2),s=i[0],o=i[1];try{for(var a=T(t),c=a.next();!c.done;c=a.next()){var f=c.value;e(f)?s.push(f):o.push(f)}}catch(u){r={error:u}}finally{try{c&&!c.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return[s,o]}function li(t,e){return Be(t.states,function(r,n){if(!!r){var i=(A(e)?void 0:e[n])||(r?r.current:void 0);if(!!i)return{current:i,states:li(r,i)}}})}function di(t,e){return{current:e,states:li(t,e)}}function Nr(t,e,r,n){D||M(!!t,"Attempting to update undefined context");var i=t&&r.reduce(function(s,o){var a,c,f=o.assignment,u={state:n,action:o,_event:e},l={};if(_(f))l=f(s,e.data,u);else try{for(var d=T(Object.keys(f)),h=d.next();!h.done;h=d.next()){var g=h.value,E=f[g];l[g]=_(E)?E(s,e.data,u):E}}catch(p){a={error:p}}finally{try{h&&!h.done&&(c=d.return)&&c.call(d)}finally{if(a)throw a.error}}return Object.assign({},s,l)},t);return i}var M=function(){};D||(M=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 de(t){return Array.isArray(t)}function _(t){return typeof t=="function"}function A(t){return typeof t=="string"}function Ft(t,e){if(!!t)return A(t)?{type:Ut,name:t,predicate:e?e[t]:void 0}:_(t)?{type:Ut,name:t.name,predicate:t}:t}function hi(t){try{return"subscribe"in t&&_(t.subscribe)}catch{return!1}}var ae=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}(),oh=(Mt={},Mt[ae]=function(){return this},Mt[Symbol.observable]=function(){return this},Mt);function ue(t){return!!t&&"__xstatenode"in t}function pi(t){return!!t&&typeof t.send=="function"}function ut(t,e){return A(t)||typeof t=="number"?v({type:t},e):t}function j(t,e){if(!A(t)&&"$$type"in t&&t.$$type==="scxml")return t;var r=ut(t);return v({name:r.type,data:r,$$type:"scxml",type:"external"},e)}function xe(t,e){var r=ui(e).map(function(n){return typeof n=="undefined"||typeof n=="string"||ue(n)?{target:n,event:t}:v(v({},n),{event:t})});return r}function mi(t){if(!(t===void 0||t===si))return Z(t)}function vi(t,e,r){if(!D){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 Vt(t,e,r,n,i){var s=t.options.guards,o={state:i,cond:e,_event:n};if(e.type===Ut)return((s==null?void 0:s[e.name])||e.predicate)(r,n.data,o);var a=s==null?void 0:s[e.type];if(!a)throw new Error("Guard '".concat(e.type,"' is not implemented on machine '").concat(t.id,"'."));return a(r,n.data,o)}function Ht(t){return typeof t=="string"?{type:t}:t}function ct(t,e,r){if(typeof t=="object")return t;var n=function(){};return{next:t,error:e||n,complete:r||n}}function ft(t,e){return"".concat(t,":invocation[").concat(e,"]")}var be=j({type:ri});function Gt(t,e){return e&&e[t]||void 0}function Fe(t,e){var r;if(A(t)||typeof t=="number"){var n=Gt(t,e);_(n)?r={type:t,exec:n}:n?r=n:r={type:t,exec:void 0}}else if(_(t))r={type:t.name||t.toString(),exec:t};else{var n=Gt(t.type,e);if(_(n))r=v(v({},t),{exec:n});else if(n){var i=n.type||t.type;r=v(v(v({},n),t),{type:i})}else r=t}return r}var lt=function(t,e){if(!t)return[];var r=de(t)?t:[t];return r.map(function(n){return Fe(n,e)})};function zt(t){var e=Fe(t);return v(v({id:A(t)?t:e.id},e),{type:e.type})}function yi(t){return A(t)?{type:Le,event:t}:dt(t,{to:ve.Internal})}function tc(t){return{type:Le,_event:j(t.event)}}function dt(t,e){return{to:e?e.to:void 0,type:Se,event:_(t)?t:ut(t),delay:e?e.delay:void 0,id:e&&e.id!==void 0?e.id:_(t)?t.name:Lt(t)}}function rc(t,e,r,n){var i={_event:r},s=j(_(t.event)?t.event(e,r.data,i):t.event),o;if(A(t.delay)){var a=n&&n[t.delay];o=_(a)?a(e,r.data,i):a}else o=_(t.delay)?t.delay(e,r.data,i):t.delay;var c=_(t.to)?t.to(e,r.data,i):t.to;return v(v({},t),{to:c,_event:s,event:s.data,delay:o})}var nc=function(t,e,r){return v(v({},t),{value:A(t.expr)?t.expr:t.expr(e,r.data,{_event:r})})},gi=function(t){return{type:It,sendId:t}};function Ei(t){var e=zt(t);return{type:P.Start,activity:e,exec:void 0}}function Si(t){var e=_(t)?t:zt(t);return{type:P.Stop,activity:e,exec:void 0}}function ic(t,e,r){var n=_(t.activity)?t.activity(e,r.data):t.activity,i=typeof n=="string"?{id:n}:n,s={type:P.Stop,activity:i};return s}var wi=function(t){return{type:kt,assignment:t}};function xi(t,e){var r=e?"#".concat(e):"";return"".concat(P.After,"(").concat(t,")").concat(r)}function ht(t,e){var r="".concat(P.DoneState,".").concat(t),n={type:r,data:e};return n.toString=function(){return r},n}function Te(t,e){var r="".concat(P.DoneInvoke,".").concat(t),n={type:r,data:e};return n.toString=function(){return r},n}function Re(t,e){var r="".concat(P.ErrorPlatform,".").concat(t),n={type:r,data:e};return n.toString=function(){return r},n}function Jt(t,e,r,n,i,s){s===void 0&&(s=!1);var o=R(s?[[],i]:Bt(i,function(d){return d.type===kt}),2),a=o[0],c=o[1],f=a.length?Nr(r,n,a,e):r,u=s?[r]:void 0,l=q(c.map(function(d){var h;switch(d.type){case Le:return tc(d);case Se:var g=rc(d,f,n,t.options.delays);return D||M(!A(d.delay)||typeof g.delay=="number","No delay reference for delay expression '".concat(d.delay,"' was found on machine '").concat(t.id,"'")),g;case qt:return nc(d,f,n);case ni:{var E=d,p=(h=E.conds.find(function(U){var B=Ft(U.cond,t.options.guards);return!B||Vt(t,B,f,n,e)}))===null||h===void 0?void 0:h.actions;if(!p)return[];var w=R(Jt(t,e,f,n,lt(Z(p),t.options.actions),s),2),y=w[0],x=w[1];return f=x,u==null||u.push(f),y}case ii:{var p=d.get(f,n.data);if(!p)return[];var C=R(Jt(t,e,f,n,lt(Z(p),t.options.actions),s),2),N=C[0],L=C[1];return f=L,u==null||u.push(f),N}case Me:return ic(d,f,n);case kt:{f=Nr(f,n,[d],e),u==null||u.push(f);break}default:var b=Fe(d,t.options.actions),S=b.exec;if(S&&u){var O=u.length-1;b=v(v({},b),{exec:function(U){for(var B=[],X=1;X<arguments.length;X++)B[X-1]=arguments[X];S.apply(void 0,I([u[O]],R(B),!1))}})}return b}}).filter(function(d){return!!d}));return[l,f]}var bi=[],Ae=function(t,e){bi.push(t);var r=e(t);return bi.pop(),r};function Ti(t){var e;return e={id:t,send:function(){},subscribe:function(){return{unsubscribe:function(){}}},getSnapshot:function(){},toJSON:function(){return{id:t}}},e[ae]=function(){return this},e}function Ri(t,e,r,n){var i,s=Ht(t.src),o=(i=e==null?void 0:e.options.services)===null||i===void 0?void 0:i[s.type],a=t.data?we(t.data,r,n):void 0,c=o?Ai(o,t.id,a):Ti(t.id);return c.meta=t,c}function Ai(t,e,r){var n=Ti(e);if(n.deferred=!0,ue(t)){var i=n.state=Ae(void 0,function(){return(r?t.withContext(r):t).initialState});n.getSnapshot=function(){return i}}return n}function sc(t){try{return typeof t.send=="function"}catch{return!1}}function Oi(t){return sc(t)&&"id"in t}function Ci(t){var e;return v((e={subscribe:function(){return{unsubscribe:function(){}}},id:"anonymous",getSnapshot:function(){}},e[ae]=function(){return this},e),t)}var pt=function(t){return t.type==="atomic"||t.type==="final"};function Oe(t){return Object.keys(t.states).map(function(e){return t.states[e]})}function kr(t){var e=[t];return pt(t)?e:e.concat(q(Oe(t).map(kr)))}function Ce(t,e){var r,n,i,s,o,a,c,f,u=new Set(t),l=Ir(u),d=new Set(e);try{for(var h=T(d),g=h.next();!g.done;g=h.next())for(var E=g.value,p=E.parent;p&&!d.has(p);)d.add(p),p=p.parent}catch(O){r={error:O}}finally{try{g&&!g.done&&(n=h.return)&&n.call(h)}finally{if(r)throw r.error}}var w=Ir(d);try{for(var y=T(d),x=y.next();!x.done;x=y.next()){var E=x.value;if(E.type==="compound"&&(!w.get(E)||!w.get(E).length))l.get(E)?l.get(E).forEach(function(U){return d.add(U)}):E.initialStateNodes.forEach(function(U){return d.add(U)});else if(E.type==="parallel")try{for(var C=(o=void 0,T(Oe(E))),N=C.next();!N.done;N=C.next()){var L=N.value;L.type!=="history"&&(d.has(L)||(d.add(L),l.get(L)?l.get(L).forEach(function(U){return d.add(U)}):L.initialStateNodes.forEach(function(U){return d.add(U)})))}}catch(U){o={error:U}}finally{try{N&&!N.done&&(a=C.return)&&a.call(C)}finally{if(o)throw o.error}}}}catch(O){i={error:O}}finally{try{x&&!x.done&&(s=y.return)&&s.call(y)}finally{if(i)throw i.error}}try{for(var b=T(d),S=b.next();!S.done;S=b.next())for(var E=S.value,p=E.parent;p&&!d.has(p);)d.add(p),p=p.parent}catch(O){c={error:O}}finally{try{S&&!S.done&&(f=b.return)&&f.call(b)}finally{if(c)throw c.error}}return d}function Pi(t,e){var r=e.get(t);if(!r)return{};if(t.type==="compound"){var n=r[0];if(n){if(pt(n))return n.key}else return{}}var i={};return r.forEach(function(s){i[s.key]=Pi(s,e)}),i}function Ir(t){var e,r,n=new Map;try{for(var i=T(t),s=i.next();!s.done;s=i.next()){var o=s.value;n.has(o)||n.set(o,[]),o.parent&&(n.has(o.parent)||n.set(o.parent,[]),n.get(o.parent).push(o))}}catch(a){e={error:a}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}return n}function _i(t,e){var r=Ce([t],e);return Pi(t,Ir(r))}function mt(t,e){return Array.isArray(t)?t.some(function(r){return r===e}):t instanceof Set?t.has(e):!1}function Ni(t){return I([],R(new Set(q(I([],R(t.map(function(e){return e.ownEvents})),!1)))),!1)}function Pe(t,e){return e.type==="compound"?Oe(e).some(function(r){return r.type==="final"&&mt(t,r)}):e.type==="parallel"?Oe(e).every(function(r){return Pe(t,r)}):!1}function Ii(t){return t===void 0&&(t=[]),t.reduce(function(e,r){return r.meta!==void 0&&(e[r.id]=r.meta),e},{})}function qr(t){return new Set(q(t.map(function(e){return e.tags})))}function Dr(t,e){if(t===e)return!0;if(t===void 0||e===void 0)return!1;if(A(t)||A(e))return t===e;var r=Object.keys(t),n=Object.keys(e);return r.length===n.length&&r.every(function(i){return Dr(t[i],e[i])})}function ki(t){return typeof t!="object"||t===null?!1:"value"in t&&"_event"in t}function qi(t,e){var r=t.exec,n=v(v({},t),{exec:r!==void 0?function(){return r(e.context,e.event,{action:t,state:e,_event:e._event})}:void 0});return n}var ne=function(){function t(e){var r=this,n;this.actions=[],this.activities=Cr,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||Cr,this.meta=Ii(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 Ni(r.configuration)}})}return t.from=function(e,r){if(e instanceof t)return e.context!==r?new t({value:e.value,context:r,_event:e._event,_sessionid:null,historyValue:e.historyValue,history:e.history,actions:[],activities:e.activities,meta:{},events:[],configuration:[],transitions:[],children:{}}):e;var n=be;return new t({value:e,context:r,_event:n,_sessionid:null,historyValue:void 0,history:void 0,actions:[],activities:void 0,meta:void 0,events:[],configuration:[],transitions:[],children:{}})},t.create=function(e){return new t(e)},t.inert=function(e,r){if(e instanceof t){if(!e.actions.length)return e;var n=be;return new t({value:e.value,context:r,_event:n,_sessionid:null,historyValue:e.historyValue,history:e.history,activities:e.activities,configuration:e.configuration,transitions:[],children:{}})}return t.from(e,r)},t.prototype.toStrings=function(e,r){var n=this;if(e===void 0&&(e=this.value),r===void 0&&(r="."),A(e))return[e];var i=Object.keys(e);return i.concat.apply(i,I([],R(i.map(function(s){return n.toStrings(e[s],r).map(function(o){return s+r+o})})),!1))},t.prototype.toJSON=function(){var e=this;e.configuration,e.transitions;var r=e.tags;e.machine;var n=Ue(e,["configuration","transitions","tags","machine"]);return v(v({},n),{tags:Array.from(r)})},t.prototype.matches=function(e){return ot(e,this.value)},t.prototype.hasTag=function(e){return this.tags.has(e)},t.prototype.can=function(e){var r;D&&M(!!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 oc={deferEvents:!1},Ur=function(){function t(e){this.processingEvent=!1,this.queue=[],this.initialized=!1,this.options=v(v({},oc),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 Mr=new Map,ac=0,vt={bookId:function(){return"x:".concat(ac++)},register:function(t,e){return Mr.set(t,e),t},get:function(t){return Mr.get(t)},free:function(t){Mr.delete(t)}};function $t(){if(typeof globalThis!="undefined")return globalThis;if(typeof self!="undefined")return self;if(typeof window!="undefined")return window;if(typeof global!="undefined")return global;D||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 uc(){var t=$t();if(t&&"__xstate__"in t)return t.__xstate__}function Di(t){if(!!$t()){var e=uc();e&&e.register(t)}}function Ui(t,e){e===void 0&&(e={});var r=t.initialState,n=new Set,i=[],s=!1,o=function(){if(!s){for(s=!0;i.length>0;){var f=i.shift();r=t.transition(r,f,c),n.forEach(function(u){return u.next(r)})}s=!1}},a=Ci({id:e.id,send:function(f){i.push(f),o()},getSnapshot:function(){return r},subscribe:function(f,u,l){var d=ct(f,u,l);return n.add(d),d.next(r),{unsubscribe:function(){n.delete(d)}}}}),c={parent:e.parent,self:a,id:e.id||"anonymous",observers:n};return r=t.start?t.start(c):r,a}var cc={sync:!1,autoForward:!1},G;(function(t){t[t.NotStarted=0]="NotStarted",t[t.Running=1]="Running",t[t.Stopped=2]="Stopped"})(G||(G={}));var Mi=function(){function t(e,r){var n=this;r===void 0&&(r=t.defaultOptions),this.machine=e,this.scheduler=new Ur,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=G.NotStarted,this.children=new Map,this.forwardTo=new Set,this.init=this.start,this.send=function(u,l){if(de(u))return n.batch(u),n.state;var d=j(ut(u,l));if(n.status===G.Stopped)return D||M(!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.
|
|
5
5
|
Event: `).concat(JSON.stringify(d.data))),n.state;if(n.status!==G.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.
|
|
6
|
-
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(u,l){var d=n.parent&&(l===ve.Parent||n.parent.id===l),h=d?n.parent:A(l)?n.children.get(l)||vt.get(l):pi(l)?l:void 0;if(!h){if(!d)throw new Error("Unable to send event to child '".concat(l,"' from service '").concat(n.id,"'."));D||M(!1,"Service '".concat(n.id,"' has no parent: unable to send event ").concat(u.type));return}"machine"in h?h.send(v(v({},u),{name:u.name===Or?"".concat(
|
|
7
|
-
Event: `).concat(JSON.stringify(event)));else if(this.status!==G.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,o=!1,a=[],c=function(d){var h=j(d);r.forward(h),s=Oe(r,function(){return r.machine.transition(s,h)}),a.push.apply(a,I([],R(s.actions.map(function(g){return qi(g,s)})),!1)),o=o||!!s.changed};try{for(var f=b(e),u=f.next();!u.done;u=f.next()){var l=u.value;c(l)}}catch(d){n={error:d}}finally{try{u&&!u.done&&(i=f.return)&&i.call(f)}finally{if(n)throw n.error}}s.changed=o,s.actions=a,r.update(s,j(e[e.length-1]))})},t.prototype.sender=function(e){return this.send.bind(this,e)},t.prototype.nextState=function(e){var r=this,n=j(e);if(n.name.indexOf(Ar)===0&&!this.state.nextEvents.some(function(s){return s.indexOf(Ar)===0}))throw n.data.data;var i=Oe(this,function(){return r.machine.transition(r.state,n)});return i},t.prototype.forward=function(e){var r,n;try{for(var i=b(this.forwardTo),s=i.next();!s.done;s=i.next()){var o=s.value,a=this.children.get(o);if(!a)throw new Error("Unable to forward event '".concat(e,"' from interpreter '").concat(this.id,"' to nonexistant child '").concat(o,"'."));a.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,o=e.exec||Gt(e.type,n),a=_(o)?o:o?o.exec:e.exec;if(a)try{return a(i,s.data,{action:e,state:this.state,_event:s})}catch(C){throw this.parent&&this.parent.send({type:"xstate.error",data:C}),C}switch(e.type){case we: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 It:this.cancel(e.sendId);break;case rt:{if(this.status!==G.Running)return;var f=e.activity;if(!this.state.activities[f.id||f.type])break;if(f.type===P.Invoke){var u=Ht(f.src),l=this.machine.options.services?this.machine.options.services[u.type]:void 0,d=f.id,h=f.data;D||M(!("forward"in f),"`forward` property is deprecated (found in invocation of '".concat(f.src,"' in in machine '").concat(this.machine.id,"'). ")+"Please use `autoForward` instead.");var g="autoForward"in f?f.autoForward:!!f.forward;if(!l){D||M(!1,"No service found for invocation '".concat(f.src,"' in machine '").concat(this.machine.id,"'."));return}var E=h?xe(h,i,s):void 0;if(typeof l=="string")return;var p=_(l)?l(i,s.data,{data:E,src:u,meta:f.meta}):l;if(!p)return;var w=void 0;ue(p)&&(p=E?p.withContext(E):p,w={autoForward:g}),this.spawn(p,d,w)}else this.spawnActivity(f);break}case Me:{this.stopChild(e.activity.id);break}case qt:var y=e.label,x=e.value;y?this.logger(y,x):this.logger(x);break;default:D||M(!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),_(r.stop)&&r.stop())},t.prototype.spawn=function(e,r,n){if(_r(e))return this.spawnPromise(Promise.resolve(e),r);if(_(e))return this.spawnCallback(e,r);if(Oi(e))return this.spawnActor(e,r);if(hi(e))return this.spawnObservable(e,r);if(ue(e))return this.spawnMachine(e,v(v({},n),{id:r}));if(fi(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,v(v({},this.options),{parent:this,id:r.id||e.id})),s=v(v({},cc),r);s.sync&&i.onTransition(function(a){n.send(it,{state:a,id:i.id})});var o=i;return this.children.set(i.id,o),s.autoForward&&this.forwardTo.add(i.id),i.onDone(function(a){n.removeChild(i.id),n.send(j(a,{origin:i.id}))}).start(),o},t.prototype.spawnBehavior=function(e,r){var n=Ui(e,{id:r,parent:this});return this.children.set(r,n),n},t.prototype.spawnPromise=function(e,r){var n,i=this,s=!1,o;e.then(function(c){s||(o=c,i.removeChild(r),i.send(j(Re(r,c),{origin:r})))},function(c){if(!s){i.removeChild(r);var f=Ae(r,c);try{i.send(j(f,{origin:r}))}catch(u){vi(c,u,r),i.devTools&&i.devTools.send(f,i.state),i.machine.strict&&i.stop()}}});var a=(n={id:r,send:function(){},subscribe:function(c,f,u){var l=ct(c,f,u),d=!1;return e.then(function(h){d||(l.next(h),!d&&l.complete())},function(h){d||l.error(h)}),{unsubscribe:function(){return d=!0}}},stop:function(){s=!0},toJSON:function(){return{id:r}},getSnapshot:function(){return o}},n[ae]=function(){return this},n);return this.children.set(r,a),a},t.prototype.spawnCallback=function(e,r){var n,i=this,s=!1,o=new Set,a=new Set,c,f=function(d){c=d,a.forEach(function(h){return h(d)}),!s&&i.send(j(d,{origin:r}))},u;try{u=e(f,function(d){o.add(d)})}catch(d){this.send(Ae(r,d))}if(_r(u))return this.spawnPromise(u,r);var l=(n={id:r,send:function(d){return o.forEach(function(h){return h(d)})},subscribe:function(d){var h=ct(d);return a.add(h.next),{unsubscribe:function(){a.delete(h.next)}}},stop:function(){s=!0,_(u)&&u()},toJSON:function(){return{id:r}},getSnapshot:function(){return c}},n[ae]=function(){return this},n);return this.children.set(r,l),l},t.prototype.spawnObservable=function(e,r){var n,i=this,s,o=e.subscribe(function(c){s=c,i.send(j(c,{origin:r}))},function(c){i.removeChild(r),i.send(j(Ae(r,c),{origin:r}))},function(){i.removeChild(r),i.send(j(Re(r),{origin:r}))}),a=(n={id:r,send:function(){},subscribe:function(c,f,u){return e.subscribe(c,f,u)},stop:function(){return o.unsubscribe()},getSnapshot:function(){return s},toJSON:function(){return{id:r}}},n[ae]=function(){return this},n);return this.children.set(r,a),a},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){D||M(!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[ae]=function(){return this},n))},t.prototype.attachDev=function(){var e=$t();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(v(v({name:this.id,autoPause:!0,stateSanitizer:function(n){return{value:n.value,context:n.context,actions:n.actions}}},r),{features:v({jump:!1,skip:!1},r?r.features:void 0)}),this.machine),this.devTools.init(this.state)}Di(this)}},t.prototype.toJSON=function(){return{id:this.id}},t.prototype[ae]=function(){return this},t.prototype.getSnapshot=function(){return this.status===G.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=he,t}();function he(t,e){var r=new Mi(t,e);return r}function fc(t){if(typeof t=="string"){var e={type:t};return e.toString=function(){return t},e}return t}function yt(t){return v(v({type:nt},t),{toJSON:function(){t.onDone,t.onError;var e=Ue(t,["onDone","onError"]);return v(v({},e),{type:nt,src:fc(t.src)})}})}var Ge="",Lr="#",gt="*",Ve={},He=function(t){return t[0]===Lr},lc=function(){return{actions:{},guards:{},services:{},activities:{},delays:{}}},dc=function(t,e,r){var n=r.slice(0,-1).some(function(s){return!("cond"in s)&&!("in"in s)&&(A(s.target)||ue(s.target))}),i=e===Ge?"the transient event":"event '".concat(e,"'");M(!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.")},Li=function(){function t(e,r,n,i){var s=this;n===void 0&&(n="context"in e?e.context:void 0);var o;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(lc(),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:Dt),this.id=this.config.id||I([this.machine.key],R(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:(o=this.config.schema)!==null&&o!==void 0?o:{},this.description=this.config.description,D||M(!("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?Be(this.config.states,function(f,u){var l,d=new t(f,{},void 0,{parent:s,key:u});return Object.assign(s.idMap,v((l={},l[d.id]=d,l),d.idMap)),d}):Ve;var a=0;function c(f){var u,l;f.order=a++;try{for(var d=b(Ce(f)),h=d.next();!h.done;h=d.next()){var g=h.value;c(g)}}catch(E){u={error:E}}finally{try{h&&!h.done&&(l=d.return)&&l.call(d)}finally{if(u)throw u.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(f){var u=f.event;return u===Ge}):Ge in this.config.on:!1),this.strict=!!this.config.strict,this.onEntry=Z(this.config.entry||this.config.onEntry).map(function(f){return Fe(f)}),this.onExit=Z(this.config.exit||this.config.onExit).map(function(f){return Fe(f)}),this.meta=this.config.meta,this.doneData=this.type==="final"?this.config.data:void 0,this.invoke=Z(this.config.invoke).map(function(f,u){var l,d;if(ue(f)){var h=ft(s.id,u);return s.machine.options.services=v((l={},l[h]=f,l),s.machine.options.services),yt({src:h,id:h})}else if(A(f.src)){var h=f.id||ft(s.id,u);return yt(v(v({},f),{id:h,src:f.src}))}else if(ue(f.src)||_(f.src)){var h=f.id||ft(s.id,u);return s.machine.options.services=v((d={},d[h]=f.src,d),s.machine.options.services),yt(v(v({id:h},f),{src:h}))}else{var g=f.src;return yt(v(v({id:ft(s.id,u)},f),{src:g}))}}),this.activities=Z(this.config.activities).concat(this.invoke).map(function(f){return zt(f)}),this.transition=this.transition.bind(this),this.tags=Z(this.config.tags)}return t.prototype._init=function(){this.__cache.transitions||kr(this).forEach(function(e){return e.on})},t.prototype.withConfig=function(e,r){var n=this.options,i=n.actions,s=n.activities,o=n.guards,a=n.services,c=n.delays;return new t(this.config,{actions:v(v({},i),e.actions),activities:v(v({},s),e.activities),guards:v(v({},o),e.guards),services:v(v({},a),e.services),delays:v(v({},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 _(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:Be(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===Ge,n=this.transitions.filter(function(i){var s=i.eventType===e;return r?s:s||i.eventType===gt});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,o){var a=_(s)?"".concat(e.id,":delay[").concat(o,"]"):s,c=xi(a,e.id);return e.onEntry.push(dt(c,{delay:s})),e.onExit.push(gi(c)),c},i=de(r)?r.map(function(s,o){var a=n(s.delay,o);return v(v({},s),{event:a})}):q(Object.keys(r).map(function(s,o){var a=r[s],c=A(a)?{target:a}:a,f=isNaN(+s)?s:+s,u=n(f,o);return Z(c).map(function(l){return v(v({},l),{event:u,delay:f})})}));return i.map(function(s){var o=s.delay;return v(v({},e.formatTransition(s)),{delay:o})})},t.prototype.getStateNodes=function(e){var r,n=this;if(!e)return[];var i=e instanceof ne?e.value:je(e,this.delimiter);if(A(i)){var s=this.getStateNode(i).initial;return s!==void 0?this.getStateNodes((r={},r[i]=s,r)):[this,this.states[i]]}var o=Object.keys(i),a=[this];return a.push.apply(a,I([],R(q(o.map(function(c){return n.getStateNode(c).getStateNodes(i[c])}))),!1)),a},t.prototype.handles=function(e){var r=Lt(e);return this.events.includes(r)},t.prototype.resolveState=function(e){var r=e instanceof ne?e:ne.create(e),n=Array.from(Pe([],this.getStateNodes(r.value)));return new ne(v(v({},r),{value:this.resolve(r.value),configuration:n,done:_e(n,this),tags:qr(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]),o=s._transition(e[i[0]],r,n);return!o||!o.transitions.length?this.next(r,n):o},t.prototype.transitionParallelNode=function(e,r,n){var i,s,o={};try{for(var a=b(Object.keys(e)),c=a.next();!c.done;c=a.next()){var f=c.value,u=e[f];if(!!u){var l=this.getStateNode(f),d=l._transition(u,r,n);d&&(o[f]=d)}}}catch(y){i={error:y}}finally{try{c&&!c.done&&(s=a.return)&&s.call(a)}finally{if(i)throw i.error}}var h=Object.keys(o).map(function(y){return o[y]}),g=q(h.map(function(y){return y.transitions})),E=h.some(function(y){return y.transitions.length>0});if(!E)return this.next(r,n);var p=q(h.map(function(y){return y.entrySet})),w=q(Object.keys(o).map(function(y){return o[y].configuration}));return{transitions:g,entrySet:p,exitSet:q(h.map(function(y){return y.exitSet})),configuration:w,source:r,actions:q(Object.keys(o).map(function(y){return o[y].actions}))}},t.prototype._transition=function(e,r,n){return A(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,j(r))},t.prototype.next=function(e,r){var n,i,s=this,o=r.name,a=[],c=[],f;try{for(var u=b(this.getCandidates(o)),l=u.next();!l.done;l=u.next()){var d=l.value,h=d.cond,g=d.in,E=e.context,p=g?A(g)&&He(g)?e.matches(je(this.getStateNodeById(g).path,this.delimiter)):ot(je(g,this.delimiter),oi(this.path.slice(0,-2))(e.value)):!0,w=!1;try{w=!h||Vt(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(o,"' in state node '").concat(this.id,`':
|
|
8
|
-
`).concat(N.message))}if(w&&p){d.target!==void 0&&(c=d.target),a.push.apply(a,I([],R(d.actions),!1)),f=d;break}}}catch(N){n={error:N}}finally{try{l&&!l.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}if(!!f){if(!c.length)return{transitions:[f],entrySet:[],exitSet:[],configuration:e.value?[this]:[],source:e,actions:a};var y=q(c.map(function(N){return s.getRelativeStateNodes(N,e.historyValue)})),x=!!f.internal,C=x?[]:q(y.map(function(N){return s.nodesFromChild(N)}));return{transitions:[f],entrySet:C,exitSet:x?[]:[this],configuration:y,source:e,actions:a}}},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,o,a,c,f=Pe([],i?this.getStateNodes(i.value):[this]),u=e.configuration.length?Pe(f,e.configuration):f;try{for(var l=b(u),d=l.next();!d.done;d=l.next()){var h=d.value;mt(f,h)||e.entrySet.push(h)}}catch(T){s={error:T}}finally{try{d&&!d.done&&(o=l.return)&&o.call(l)}finally{if(s)throw s.error}}try{for(var g=b(f),E=g.next();!E.done;E=g.next()){var h=E.value;(!mt(u,h)||mt(e.exitSet,h.parent))&&e.exitSet.push(h)}}catch(T){a={error:T}}finally{try{E&&!E.done&&(c=g.return)&&c.call(g)}finally{if(a)throw a.error}}var p=q(e.entrySet.map(function(T){var S=[];if(T.type!=="final")return S;var O=T.parent;if(!O.parent)return S;S.push(ht(T.id,T.doneData),ht(O.id,T.doneData?xe(T.doneData,r,n):void 0));var U=O.parent;return U.type==="parallel"&&Ce(U).every(function(B){return _e(e.configuration,B)})&&S.push(ht(U.id)),S}));e.exitSet.sort(function(T,S){return S.order-T.order}),e.entrySet.sort(function(T,S){return T.order-S.order});var w=new Set(e.entrySet),y=new Set(e.exitSet),x=R([q(Array.from(w).map(function(T){return I(I([],R(T.activities.map(function(S){return Ei(S)})),!1),R(T.onEntry),!1)})).concat(p.map(yi)),q(Array.from(y).map(function(T){return I(I([],R(T.onExit),!1),R(T.activities.map(function(S){return Si(S)})),!1)}))],2),C=x[0],N=x[1],L=lt(N.concat(e.actions).concat(C),this.machine.options.actions);return L},t.prototype.transition=function(e,r,n){e===void 0&&(e=this.initialState);var i=j(r),s;if(e instanceof ne)s=n===void 0?e:this.resolveState(ne.from(e,n));else{var o=A(e)?this.resolve(st(this.getResolvedPath(e))):this.resolve(e),a=n!=null?n:this.machine.context;s=this.resolveState(ne.from(o,a))}if(!D&&i.name===gt)throw new Error("An event cannot have the wildcard type ('".concat(gt,"')"));if(this.strict&&!this.events.includes(i.name)&&!ci(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:[]},f=Pe([],this.getStateNodes(s.value)),u=c.configuration.length?Pe(f,c.configuration):f;return c.configuration=I([],R(u),!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,I([],R(s),!1)),e},t.prototype.resolveTransition=function(e,r,n,i){var s,o,a=this;i===void 0&&(i=be);var c=e.configuration,f=!r||e.transitions.length>0,u=f?_i(this.machine,c):void 0,l=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?v({},r.activities):{};try{for(var g=b(d),E=g.next();!E.done;E=g.next()){var p=E.value;p.type===rt?h[p.activity.id||p.activity.type]=p:p.type===Me&&(h[p.activity.id||p.activity.type]=!1)}}catch(Q){s={error:Q}}finally{try{E&&!E.done&&(o=g.return)&&o.call(g)}finally{if(s)throw s.error}}var w=R(Jt(this,r,n,i,d,this.machine.config.preserveActionOrder),2),y=w[0],x=w[1],C=R(Bt(y,function(Q){return Q.type===Le||Q.type===we&&Q.to===ve.Internal}),2),N=C[0],L=C[1],T=y.filter(function(Q){var De;return Q.type===rt&&((De=Q.activity)===null||De===void 0?void 0:De.type)===nt}),S=T.reduce(function(Q,De){return Q[De.activity.id]=Ri(De.activity,a.machine,x,i),Q},r?v({},r.children):{}),O=f?e.configuration:r?r.configuration:[],U=_e(O,this),B=new ne({value:u||r.value,context:x,_event:i,_sessionid:r?r._sessionid:null,historyValue:u?l?di(l,u):void 0:r?r.historyValue:void 0,history:!u||e.source?r:void 0,actions:u?L:[],activities:u?h:r?r.activities:{},events:[],configuration:O,transitions:e.transitions,children:S,done:U,tags:r==null?void 0:r.tags,machine:this}),X=n!==x;B.changed=i.name===it||X;var me=B.history;me&&delete me.history;var _t=!U&&(this._transient||c.some(function(Q){return Q._transient}));if(!f&&(!_t||i.name===Ge))return B;var Y=B;if(!U)for(_t&&(Y=this.resolveRaisedTransition(Y,{type:ti},i));N.length;){var Ju=N.shift();Y=this.resolveRaisedTransition(Y,Ju._event,i)}var zu=Y.changed||(me?!!Y.actions.length||X||typeof me.value!=typeof Y.value||!Dr(Y.value,me.value):void 0);return Y.changed=zu,Y.history=me,Y.tags=qr(Y.configuration),Y},t.prototype.getStateNode=function(e){if(He(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=He(e)?e.slice(Lr.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"&&He(e))try{return this.getStateNodeById(e.slice(1))}catch{}for(var r=jt(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||Ve;switch(this.type){case"parallel":return Be(this.initialStateValue,function(s,o){return s?n.getStateNode(o).resolve(e[o]||s):Ve});case"compound":if(A(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?Be(e,function(s,o){return s?n.getStateNode(o).resolve(s):Ve}):this.initialStateValue||{};default:return e||Ve}},t.prototype.getResolvedPath=function(e){if(He(e)){var r=this.machine.idMap[e.slice(Lr.length)];if(!r)throw new Error("Unable to find state node '".concat(e,"'"));return r.path}return jt(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=Pr(this.states,function(n){return n.initialStateValue||Ve},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=pt(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;A(r.target)?e=He(r.target)?st(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(pt(this))return[this];if(this.type==="compound"&&!this.initial)return D||M(!1,"Compound state node '".concat(this.id,"' has no initial state.")),[this];var r=at(this.initialStateValue);return q(r.map(function(n){return e.getFromRelativePath(n)}))},enumerable:!1,configurable:!0}),t.prototype.getFromRelativePath=function(e){if(!e.length)return[this];var r=R(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:Pr(this.states,function(r,n){if(!e)return r.historyValue();var i=A(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?q(at(i).map(function(o){return n.getFromRelativePath(o)})):n.initialStateNodes}var s=ai(n.path,"states")(e).current;return A(s)?[n.getStateNode(s)]:q(at(s).map(function(o){return r.history==="deep"?n.getFromRelativePath(o):[n.states[o[0]]]}))},Object.defineProperty(t.prototype,"stateIds",{get:function(){var e=this,r=q(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,o=new Set(this.ownEvents);if(s)try{for(var a=b(Object.keys(s)),c=a.next();!c.done;c=a.next()){var f=c.value,u=s[f];if(u.states)try{for(var l=(n=void 0,b(u.events)),d=l.next();!d.done;d=l.next()){var h=d.value;o.add("".concat(h))}}catch(g){n={error:g}}finally{try{d&&!d.done&&(i=l.return)&&i.call(l)}finally{if(n)throw n.error}}}}catch(g){e={error:g}}finally{try{c&&!c.done&&(r=a.return)&&r.call(a)}finally{if(e)throw e.error}}return this.__cache.events=Array.from(o)},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(!A(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 o=r.parent.getStateNodeByPath(s);return o}catch(a){throw new Error("Invalid transition definition for state node '".concat(r.id,`':
|
|
9
|
-
`).concat(a.message))}else return r.getStateNodeByPath(s)})},t.prototype.formatTransition=function(e){var r=this,n=mi(e.target),i="internal"in e?e.internal:n?n.some(function(c){return A(c)&&c[0]===r.delimiter}):!0,s=this.machine.options.guards,o=this.resolveTarget(n),a=v(v({},e),{actions:lt(Z(e.actions)),cond:Ft(e.cond,s),target:o,source:this,internal:i,eventType:e.event,toJSON:function(){return v(v({},a),{target:a.target?a.target.map(function(c){return"#".concat(c.id)}):void 0,source:"#".concat(r.id)})}});return a},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,o=gt,a=s[o],c=a===void 0?[]:a,f=Ue(s,[typeof o=="symbol"?o:o+""]);i=q(Object.keys(f).map(function(y){!D&&y===Ge&&M(!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 x=Te(y,f[y]);return D||dc(n,y,x),x}).concat(Te(gt,c)))}var u=this.config.always?Te("",this.config.always):[],l=this.config.onDone?Te(String(ht(this.id)),this.config.onDone):[];D||M(!(this.config.onDone&&!this.parent),'Root nodes cannot have an ".onDone" transition. Please check the config of "'.concat(this.id,'".'));var d=q(this.invoke.map(function(y){var x=[];return y.onDone&&x.push.apply(x,I([],R(Te(String(Re(y.id)),y.onDone)),!1)),y.onError&&x.push.apply(x,I([],R(Te(String(Ae(y.id)),y.onError)),!1)),x})),h=this.after,g=q(I(I(I(I([],R(l),!1),R(d),!1),R(i),!1),R(u),!1).map(function(y){return Z(y).map(function(x){return n.formatTransition(x)})}));try{for(var E=b(h),p=E.next();!p.done;p=E.next()){var w=p.value;g.push(w)}}catch(y){e={error:y}}finally{try{p&&!p.done&&(r=E.return)&&r.call(E)}finally{if(e)throw e.error}}return g},t}();function ie(t,e){return new Li(t,e)}var k=wi,J=dt;function Bi(t){return!!(t&&typeof t.then=="function")}var hc=Promise.resolve(!1),Ap=Promise.resolve(!0),ce=Promise.resolve();function Wt(t,e){return t||(t=0),new Promise(function(r){return setTimeout(function(){return r(e)},t)})}function Fi(t,e){return Math.floor(Math.random()*(e-t+1)+t)}function Et(){return Math.random().toString(36).substring(2)}var ji=0,jr=0;function ye(){var t=new Date().getTime();return t===ji?(jr++,t*1e3+jr):(ji=t,jr=0,t*1e3)}var ge=Object.prototype.toString.call(typeof process!="undefined"?process:0)==="[object process]";var pc=ye,mc="native";function vc(t){var e={messagesCallback:null,bc:new BroadcastChannel(t),subFns:[]};return e.bc.onmessage=function(r){e.messagesCallback&&e.messagesCallback(r.data)},e}function yc(t){t.bc.close(),t.subFns=[]}function gc(t,e){try{return t.bc.postMessage(e,!1),ce}catch(r){return Promise.reject(r)}}function Ec(t,e){t.messagesCallback=e}function Sc(){if(ge&&typeof window=="undefined")return!1;if(typeof BroadcastChannel=="function"){if(BroadcastChannel._pubkey)throw new Error("BroadcastChannel: Do not overwrite window.BroadcastChannel with this module, this is not a polyfill");return!0}else return!1}function wc(){return 150}var Vi={create:vc,close:yc,onMessage:Ec,postMessage:gc,canBeUsed:Sc,type:mc,averageResponseTime:wc,microSeconds:pc};var Kt=function(){function t(e){this.ttl=e,this.set=new Set,this.timeMap=new Map}return t.prototype.has=function(e){return this.set.has(e)},t.prototype.add=function(e){var r=this;this.timeMap.set(e,Hi()),this.set.add(e),setTimeout(function(){xc(r)},0)},t.prototype.clear=function(){this.set.clear(),this.timeMap.clear()},t}();function xc(t){for(var e=Hi()-t.ttl,r=t.set[Symbol.iterator]();;){var n=r.next().value;if(!n)return;var i=t.timeMap.get(n);if(i<e)t.timeMap.delete(n),t.set.delete(n);else return}}function Hi(){return new Date().getTime()}function Je(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=JSON.parse(JSON.stringify(t));return typeof e.webWorkerSupport=="undefined"&&(e.webWorkerSupport=!0),e.idb||(e.idb={}),e.idb.ttl||(e.idb.ttl=1e3*45),e.idb.fallbackInterval||(e.idb.fallbackInterval=150),t.idb&&typeof t.idb.onclose=="function"&&(e.idb.onclose=t.idb.onclose),e.localstorage||(e.localstorage={}),e.localstorage.removeTimeout||(e.localstorage.removeTimeout=1e3*60),t.methods&&(e.methods=t.methods),e.node||(e.node={}),e.node.ttl||(e.node.ttl=1e3*60*2),e.node.maxParallelWrites||(e.node.maxParallelWrites=2048),typeof e.node.useFastPath=="undefined"&&(e.node.useFastPath=!0),e}var Tc=ye,bc="pubkey.broadcast-channel-0-",pe="messages",Rc="idb";function Gi(){if(typeof indexedDB!="undefined")return indexedDB;if(typeof window!="undefined"){if(typeof window.mozIndexedDB!="undefined")return window.mozIndexedDB;if(typeof window.webkitIndexedDB!="undefined")return window.webkitIndexedDB;if(typeof window.msIndexedDB!="undefined")return window.msIndexedDB}return!1}function Ac(t){var e=Gi(),r=bc+t,n=e.open(r,1);n.onupgradeneeded=function(s){var o=s.target.result;o.createObjectStore(pe,{keyPath:"id",autoIncrement:!0})};var i=new Promise(function(s,o){n.onerror=function(a){return o(a)},n.onsuccess=function(){s(n.result)}});return i}function Oc(t,e,r){var n=new Date().getTime(),i={uuid:e,time:n,data:r},s=t.transaction([pe],"readwrite");return new Promise(function(o,a){s.oncomplete=function(){return o()},s.onerror=function(f){return a(f)};var c=s.objectStore(pe);c.add(i)})}function Cc(t,e){var r=t.transaction(pe).objectStore(pe),n=[];function i(){try{var s=IDBKeyRange.bound(e+1,1/0);return r.openCursor(s)}catch{return r.openCursor()}}return new Promise(function(s){i().onsuccess=function(o){var a=o.target.result;a?a.value.id<e+1?a.continue(e+1):(n.push(a.value),a.continue()):s(n)}})}function Pc(t,e){var r=t.transaction([pe],"readwrite").objectStore(pe).delete(e);return new Promise(function(n){r.onsuccess=function(){return n()}})}function _c(t,e){var r=new Date().getTime()-e,n=t.transaction(pe).objectStore(pe),i=[];return new Promise(function(s){n.openCursor().onsuccess=function(o){var a=o.target.result;if(a){var c=a.value;if(c.time<r)i.push(c),a.continue();else{s(i);return}}else s(i)}})}function Nc(t,e){return _c(t,e).then(function(r){return Promise.all(r.map(function(n){return Pc(t,n.id)}))})}function Ic(t,e){return e=Je(e),Ac(t).then(function(r){var n={closed:!1,lastCursorId:0,channelName:t,options:e,uuid:Et(),eMIs:new Kt(e.idb.ttl*2),writeBlockPromise:ce,messagesCallback:null,readQueuePromises:[],db:r};return r.onclose=function(){n.closed=!0,e.idb.onclose&&e.idb.onclose()},Ji(n),n})}function Ji(t){t.closed||zi(t).then(function(){return Wt(t.options.idb.fallbackInterval)}).then(function(){return Ji(t)})}function kc(t,e){return!(t.uuid===e.uuid||e.eMIs.has(t.id)||t.data.time<e.messagesCallbackTime)}function zi(t){return t.closed?ce:t.messagesCallback?Cc(t.db,t.lastCursorId).then(function(e){var r=e.filter(function(n){return!!n}).map(function(n){return n.id>t.lastCursorId&&(t.lastCursorId=n.id),n}).filter(function(n){return kc(n,t)}).sort(function(n,i){return n.time-i.time});return r.forEach(function(n){t.messagesCallback&&(t.eMIs.add(n.id),t.messagesCallback(n.data))}),ce}):ce}function qc(t){t.closed=!0,t.db.close()}function Dc(t,e){return t.writeBlockPromise=t.writeBlockPromise.then(function(){return Oc(t.db,t.uuid,e)}).then(function(){Fi(0,10)===0&&Nc(t.db,t.options.idb.ttl)}),t.writeBlockPromise}function Uc(t,e,r){t.messagesCallbackTime=r,t.messagesCallback=e,zi(t)}function Mc(){if(ge)return!1;var t=Gi();return!!t}function Lc(t){return t.idb.fallbackInterval*2}var $i={create:Ic,close:qc,onMessage:Uc,postMessage:Dc,canBeUsed:Mc,type:Rc,averageResponseTime:Lc,microSeconds:Tc};var jc=ye,Bc="pubkey.broadcastChannel-",Fc="localstorage";function Wi(){var t;if(typeof window=="undefined")return null;try{t=window.localStorage,t=window["ie8-eventlistener/storage"]||window.localStorage}catch{}return t}function Ki(t){return Bc+t}function Vc(t,e){return new Promise(function(r){Wt().then(function(){var n=Ki(t.channelName),i={token:Et(),time:new Date().getTime(),data:e,uuid:t.uuid},s=JSON.stringify(i);Wi().setItem(n,s);var o=document.createEvent("Event");o.initEvent("storage",!0,!0),o.key=n,o.newValue=s,window.dispatchEvent(o),r()})})}function Hc(t,e){var r=Ki(t),n=function(s){s.key===r&&e(JSON.parse(s.newValue))};return window.addEventListener("storage",n),n}function Gc(t){window.removeEventListener("storage",t)}function Jc(t,e){if(e=Je(e),!Xi())throw new Error("BroadcastChannel: localstorage cannot be used");var r=Et(),n=new Kt(e.localstorage.removeTimeout),i={channelName:t,uuid:r,eMIs:n};return i.listener=Hc(t,function(s){!i.messagesCallback||s.uuid!==r&&(!s.token||n.has(s.token)||s.data.time&&s.data.time<i.messagesCallbackTime||(n.add(s.token),i.messagesCallback(s.data)))}),i}function zc(t){Gc(t.listener)}function $c(t,e,r){t.messagesCallbackTime=r,t.messagesCallback=e}function Xi(){if(ge)return!1;var t=Wi();if(!t)return!1;try{var e="__broadcastchannel_check";t.setItem(e,"works"),t.removeItem(e)}catch{return!1}return!0}function Wc(){var t=120,e=navigator.userAgent.toLowerCase();return e.includes("safari")&&!e.includes("chrome")?t*2:t}var Yi={create:Jc,close:zc,onMessage:$c,postMessage:Vc,canBeUsed:Xi,type:Fc,averageResponseTime:Wc,microSeconds:jc};var Kc=ye,Xc="simulate",Br=new Set;function Yc(t){var e={name:t,messagesCallback:null};return Br.add(e),e}function Qc(t){Br.delete(t)}function Zc(t,e){return new Promise(function(r){return setTimeout(function(){var n=Array.from(Br);n.filter(function(i){return i.name===t.name}).filter(function(i){return i!==t}).filter(function(i){return!!i.messagesCallback}).forEach(function(i){return i.messagesCallback(e)}),r()},5)})}function ef(t,e){t.messagesCallback=e}function tf(){return!0}function rf(){return 5}var Qi={create:Yc,close:Qc,onMessage:ef,postMessage:Zc,canBeUsed:tf,type:Xc,averageResponseTime:rf,microSeconds:Kc};var Zi=[Vi,$i,Yi];function es(t){var e=[].concat(t.methods,Zi).filter(Boolean);if(t.type){if(t.type==="simulate")return Qi;var r=e.find(function(i){return i.type===t.type});if(r)return r;throw new Error("method-type "+t.type+" not found")}!t.webWorkerSupport&&!ge&&(e=e.filter(function(i){return i.type!=="idb"}));var n=e.find(function(i){return i.canBeUsed()});if(n)return n;throw new Error("No useable method found in "+JSON.stringify(Zi.map(function(i){return i.type})))}var Fr=new Set,nf=0,Ne=function(e,r){this.id=nf++,Fr.add(this),this.name=e,ts&&(r=ts),this.options=Je(r),this.method=es(this.options),this._iL=!1,this._onML=null,this._addEL={message:[],internal:[]},this._uMP=new Set,this._befC=[],this._prepP=null,sf(this)};Ne._pubkey=!0;var ts;Ne.prototype={postMessage:function(e){if(this.closed)throw new Error("BroadcastChannel.postMessage(): Cannot post message after channel has closed "+JSON.stringify(e));return rs(this,"message",e)},postInternal:function(e){return rs(this,"internal",e)},set onmessage(t){var e=this.method.microSeconds(),r={time:e,fn:t};is(this,"message",this._onML),t&&typeof t=="function"?(this._onML=r,ns(this,"message",r)):this._onML=null},addEventListener:function(e,r){var n=this.method.microSeconds(),i={time:n,fn:r};ns(this,e,i)},removeEventListener:function(e,r){var n=this._addEL[e].find(function(i){return i.fn===r});is(this,e,n)},close:function(){var e=this;if(!this.closed){Fr.delete(this),this.closed=!0;var r=this._prepP?this._prepP:ce;return this._onML=null,this._addEL.message=[],r.then(function(){return Promise.all(Array.from(e._uMP))}).then(function(){return Promise.all(e._befC.map(function(n){return n()}))}).then(function(){return e.method.close(e._state)})}},get type(){return this.method.type},get isClosed(){return this.closed}};function rs(t,e,r){var n=t.method.microSeconds(),i={time:n,type:e,data:r},s=t._prepP?t._prepP:ce;return s.then(function(){var o=t.method.postMessage(t._state,i);return t._uMP.add(o),o.catch().then(function(){return t._uMP.delete(o)}),o})}function sf(t){var e=t.method.create(t.name,t.options);Bi(e)?(t._prepP=e,e.then(function(r){t._state=r})):t._state=e}function ss(t){return t._addEL.message.length>0||t._addEL.internal.length>0}function ns(t,e,r){t._addEL[e].push(r),of(t)}function is(t,e,r){t._addEL[e]=t._addEL[e].filter(function(n){return n!==r}),af(t)}function of(t){if(!t._iL&&ss(t)){var e=function(i){t._addEL[i.type].forEach(function(s){var o=1e5,a=s.time-o;i.time>=a&&s.fn(i.data)})},r=t.method.microSeconds();t._prepP?t._prepP.then(function(){t._iL=!0,t.method.onMessage(t._state,e,r)}):(t._iL=!0,t.method.onMessage(t._state,e,r))}}function af(t){if(t._iL&&!ss(t)){t._iL=!1;var e=t.method.microSeconds();t.method.onMessage(t._state,null,e)}}var Xt="nhostRefreshToken",St="nhostRefreshTokenExpiresAt";var Ie={status:10,error:"invalid-email",message:"Email is incorrectly formatted"};var wt={status:10,error:"invalid-password",message:"Password is incorrectly formatted"},os={status:10,error:"invalid-phone-number",message:"Phone number is incorrectly formatted"},as={status:10,error:"no-mfa-ticket",message:"No MFA ticket has been provided"};var vo=Nt(mo());var se=t=>{let e=vo.default.create({baseURL:t});return e.interceptors.response.use(r=>r,r=>{var n,i,s,o,a,c,f,u,l,d;return Promise.reject({error:{message:(a=(o=(s=(i=(n=r.response)==null?void 0:n.data)==null?void 0:i.message)!=null?s:r.message)!=null?o:r.request.responseText)!=null?a:JSON.stringify(r),status:(l=(u=(c=r.response)==null?void 0:c.status)!=null?u:(f=r.response)==null?void 0:f.data.statusCode)!=null?l:0,error:((d=r.response)==null?void 0:d.data.error)||r.request.statusText||"network"}})}),e};var yo=(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},re=(t,e)=>{var r;return e!=null&&e.redirectTo?{...e,redirectTo:(r=e==null?void 0:e.redirectTo)!=null&&r.startsWith("/")?t+e.redirectTo:e==null?void 0:e.redirectTo}:e};var Ke=t=>!!t&&typeof t=="string"&&!!String(t).toLowerCase().match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/),ir=t=>!!t&&typeof t=="string"&&t.length>=3,go=t=>!!t&&typeof t=="string";var un={user:null,mfa:null,accessToken:{value:null,expiresAt:new Date},refreshTimer:{elapsed:0,attempts:0},refreshToken:{value:null},errors:{}};var Eo=({backendUrl:t,clientUrl:e,interpreter:r})=>{let n=se(t);return ie({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:k({error:i=>Ie}),saveRequestError:k({error:(i,{data:{error:s}})=>s}),reportError:J(i=>({type:"ERROR",error:i.error})),reportSuccess:J("SUCCESS")},guards:{invalidEmail:(i,{email:s})=>!Ke(s)},services:{requestChange:async(i,{email:s,options:o})=>(await n.post("/user/email/change",{newEmail:s,options:re(e,o)},{headers:{authorization:`Bearer ${r==null?void 0:r.state.context.accessToken.value}`}})).data}})};var So=({backendUrl:t,interpreter:e})=>{let r=se(t);return ie({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:k({error:n=>wt}),saveRequestError:k({error:(n,{data:{error:i}})=>(console.log(i),i)}),reportError:J(n=>({type:"ERROR",error:n.error})),reportSuccess:J("SUCCESS")},guards:{invalidPassword:(n,{password:i})=>!ir(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 wo=({backendUrl:t,clientUrl:e})=>{let r=se(t);return ie({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:k({error:(n,{data:{error:i}})=>(console.log(i),i)}),reportError:J(n=>({type:"ERROR",error:n.error})),reportSuccess:J("SUCCESS")},services:{requestChange:(n,{email:i,options:s})=>r.post("/user/password/reset",{email:i,options:re(e,s)})}})};var xo=({backendUrl:t,clientUrl:e,interpreter:r})=>{let n=se(t);return ie({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:k({error:i=>Ie}),saveRequestError:k({error:(i,{data:{error:s}})=>s}),reportError:J(i=>({type:"ERROR",error:i.error})),reportSuccess:J("SUCCESS")},guards:{invalidEmail:(i,{email:s})=>!Ke(s)},services:{request:async(i,{email:s,options:o})=>(await n.post("/user/email/send-verification-email",{email:s,options:re(e,o)})).data}})};var To=({backendUrl:t,clientUrl:e,clientStorageGetter:r,clientStorageSetter:n,refreshIntervalTime:i,autoRefreshToken:s=!0,autoSignIn:o=!0})=>{let a=se(t),c=async(f,u,l)=>(await a.post(f,u,l)).data;return ie({schema:{context:{},events:{}},tsTypes:{},context:un,preserveActionOrder:!0,id:"nhost",type:"parallel",states:{authentication:{initial:"checkAutoSignIn",on:{SESSION_UPDATE:[{cond:"hasSession",actions:["saveSession","persist","resetTimer","reportTokenChanged"],target:".signedIn"}]},states:{checkAutoSignIn:{always:[{cond:"isAutoSignInDisabled",target:"importingRefreshToken"}],invoke:{id:"autoSignIn",src:"autoSignIn",onDone:{target:"signedIn",actions:["saveSession","persist","reportTokenChanged"]},onError:"importingRefreshToken"}},importingRefreshToken:{invoke:{id:"importRefreshToken",src:"importRefreshToken",onDone:{actions:"saveRefreshToken",target:"starting"}}},starting:{always:[{cond:"isSignedIn",target:"signedIn"},{cond:"hasRefreshTokenWithoutSession",target:["authenticating.token","#nhost.token.running"]},"signedOut"]},signedOut:{tags:["ready"],initial:"noErrors",entry:"reportSignedOut",states:{noErrors:{},success:{},needsEmailVerification:{},needsSmsOtp:{},needsMfa:{},failed:{exit:"resetAuthenticationError",initial:"server",states:{server:{},validation:{states:{password:{},email:{},phoneNumber:{}}}}},signingOut:{entry:"destroyToken",exit:"clearContext",invoke:{src:"signout",id:"signingOut",onDone:{target:"success"},onError:{target:"failed.server"}}}},on:{SIGNIN_PASSWORD:[{cond:"invalidEmail",actions:["saveInvalidEmail"],target:".failed.validation.email"},{cond:"invalidPassword",actions:["saveInvalidPassword"],target:".failed.validation.password"},"#nhost.authentication.authenticating.password"],SIGNIN_PASSWORDLESS_EMAIL:[{cond:"invalidEmail",actions:"saveInvalidEmail",target:".failed.validation.email"},"#nhost.authentication.authenticating.passwordlessEmail"],SIGNIN_PASSWORDLESS_SMS:[{cond:"invalidPhoneNumber",actions:"saveInvalidPhoneNumber",target:".failed.validation.phoneNumber"},"#nhost.authentication.authenticating.passwordlessSms"],SIGNIN_PASSWORDLESS_SMS_OTP:[{cond:"invalidPhoneNumber",actions:"saveInvalidPhoneNumber",target:".failed.validation.phoneNumber"},"#nhost.authentication.authenticating.passwordlessSmsOtp"],SIGNUP_EMAIL_PASSWORD:[{cond:"invalidEmail",actions:"saveInvalidSignUpEmail",target:".failed.validation.email"},{cond:"invalidPassword",actions:"saveInvalidSignUpPassword",target:".failed.validation.password"},"#nhost.authentication.registering"],SIGNIN_ANONYMOUS:"#nhost.authentication.authenticating.anonymous",SIGNIN_MFA_TOTP:[{cond:"noMfaTicket",actions:["saveNoMfaTicketError"],target:".failed"},"#nhost.authentication.authenticating.mfa.totp"]}},authenticating:{states:{passwordlessEmail:{invoke:{src:"signInPasswordlessEmail",id:"authenticatePasswordlessEmail",onDone:"#nhost.authentication.signedOut.needsEmailVerification",onError:{actions:"saveAuthenticationError",target:"#nhost.authentication.signedOut.failed.server"}}},passwordlessSms:{invoke:{src:"signInPasswordlessSms",id:"authenticatePasswordlessSms",onDone:"#nhost.authentication.signedOut.needsSmsOtp",onError:{actions:"saveAuthenticationError",target:"#nhost.authentication.signedOut.failed.server"}}},passwordlessSmsOtp:{invoke:{src:"signInPasswordlessSmsOtp",id:"authenticatePasswordlessSmsOtp",onDone:{actions:["saveSession","persist","reportTokenChanged"],target:"#nhost.authentication.signedIn"},onError:{actions:"saveAuthenticationError",target:"#nhost.authentication.signedOut.failed.server"}}},password:{invoke:{src:"signInPassword",id:"authenticateUserWithPassword",onDone:[{cond:"hasMfaTicket",actions:["saveMfaTicket"],target:"#nhost.authentication.signedOut.needsMfa"},{actions:["saveSession","persist","reportTokenChanged"],target:"#nhost.authentication.signedIn"}],onError:[{cond:"unverified",target:"#nhost.authentication.signedOut.needsEmailVerification"},{actions:"saveAuthenticationError",target:"#nhost.authentication.signedOut.failed.server"}]}},token:{},anonymous:{invoke:{src:"signInAnonymous",id:"authenticateAnonymously",onDone:{actions:["saveSession","persist","reportTokenChanged"],target:"#nhost.authentication.signedIn"},onError:{actions:"saveAuthenticationError",target:"#nhost.authentication.signedOut.failed.server"}}},mfa:{states:{totp:{invoke:{src:"signInMfaTotp",id:"signInMfaTotp",onDone:{actions:["saveSession","persist","reportTokenChanged"],target:"#nhost.authentication.signedIn"},onError:{actions:["saveAuthenticationError"],target:"#nhost.authentication.signedOut.failed.server"}}}}}}},registering:{entry:"resetSignUpError",invoke:{src:"registerUser",id:"registerUser",onDone:[{cond:"hasSession",target:"#nhost.authentication.signedIn",actions:["saveSession","persist","reportTokenChanged"]},{target:"#nhost.authentication.signedOut.needsEmailVerification"}],onError:[{cond:"unverified",target:"#nhost.authentication.signedOut.needsEmailVerification"},{actions:"saveRegisrationError",target:"#nhost.authentication.signedOut.failed.server"}]}},signedIn:{tags:["ready"],type:"parallel",entry:"reportSignedIn",on:{SIGNOUT:"#nhost.authentication.signedOut.signingOut",DEANONYMIZE:{target:".deanonymizing"}},states:{refreshTimer:{id:"timer",initial:"idle",states:{disabled:{type:"final"},stopped:{always:{cond:"noToken",target:"idle"}},idle:{always:[{cond:"isAutoRefreshDisabled",target:"disabled"},{cond:"hasRefreshToken",target:"running"}]},running:{initial:"pending",entry:"resetTimer",states:{pending:{after:{"1000":{actions:"tickRefreshTimer",internal:!1,target:"pending"}},always:{cond:"refreshTimerShouldRefresh",target:"refreshing"}},refreshing:{invoke:{src:"refreshToken",id:"refreshToken",onDone:{actions:["saveSession","persist","resetTimer"],target:"pending"},onError:[]}}}}}},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:J("SIGNED_IN"),reportSignedOut:J("SIGNED_OUT"),reportTokenChanged:J("TOKEN_CHANGED"),clearContext:k(()=>un),saveSession:k({user:(f,u)=>{var l,d;return(d=(l=u.data)==null?void 0:l.session)==null?void 0:d.user},accessToken:(f,u)=>{var l,d,h,g;return{value:(d=(l=u.data)==null?void 0:l.session)==null?void 0:d.accessToken,expiresAt:new Date(Date.now()+((g=(h=u.data)==null?void 0:h.session)==null?void 0:g.accessTokenExpiresIn)*1e3)}},refreshToken:(f,u)=>{var l,d;return{value:(d=(l=u.data)==null?void 0:l.session)==null?void 0:d.refreshToken}}}),saveMfaTicket:k({mfa:(f,u)=>{var l,d;return(d=(l=u.data)==null?void 0:l.mfa)!=null?d:null}}),resetTimer:k({refreshTimer:(f,u)=>({elapsed:0,attempts:0})}),tickRefreshTimer:k({refreshTimer:(f,u)=>({elapsed:f.refreshTimer.elapsed+1,attempts:f.refreshTimer.attempts})}),saveAuthenticationError:k({errors:({errors:f},{data:{error:u}})=>({...f,authentication:u})}),resetAuthenticationError:k({errors:({errors:{authentication:f,...u}})=>u}),saveInvalidEmail:k({errors:({errors:f})=>({...f,authentication:Ie})}),saveInvalidPassword:k({errors:({errors:f})=>({...f,authentication:wt})}),saveInvalidPhoneNumber:k({errors:({errors:f})=>({...f,authentication:os})}),saveRegisrationError:k({errors:({errors:f},{data:{error:u}})=>({...f,registration:u})}),resetSignUpError:k({errors:({errors:{registration:f,...u}})=>u}),saveInvalidSignUpPassword:k({errors:({errors:f})=>({...f,registration:Ie})}),saveInvalidSignUpEmail:k({errors:({errors:f})=>({...f,registration:wt})}),saveNoMfaTicketError:k({errors:({errors:f})=>({...f,registration:as})}),saveRefreshToken:k({accessToken:(f,u)=>({...f.accessToken,expiresAt:u.data.expiresAt}),refreshToken:(f,u)=>({...f.refreshToken,value:u.data.refreshToken})}),persist:(f,{data:u})=>{if(n(Xt,u.session.refreshToken),u.session.accessTokenExpiresIn){let l=new Date(Date.now()+u.session.accessTokenExpiresIn*1e3).toISOString();n(St,l)}else n(St,null)},destroyToken:()=>{n(Xt,null),n(St,null)}},guards:{isSignedIn:f=>!!f.user&&!!f.refreshToken.value&&!!f.accessToken.value,hasRefreshTokenWithoutSession:f=>!!f.refreshToken.value&&!f.user&&!f.accessToken.value,noToken:f=>!f.refreshToken.value,noMfaTicket:(f,{ticket:u})=>{var l;return!u&&!((l=f.mfa)!=null&&l.ticket)},hasRefreshToken:f=>!!f.refreshToken.value,isAutoRefreshDisabled:()=>!s,isAutoSignInDisabled:()=>!o,refreshTimerShouldRefresh:f=>f.refreshTimer.elapsed>Math.max((Date.now()-f.accessToken.expiresAt.getTime())/1e3-900,i),unverified:(f,{data:{error:u}})=>u.status===401&&u.message==="Email is not verified",hasSession:(f,u)=>{var l;return!!((l=u.data)!=null&&l.session)},hasMfaTicket:(f,u)=>{var l;return!!((l=u.data)!=null&&l.mfa)},invalidEmail:(f,{email:u})=>!Ke(u),invalidPassword:(f,{password:u})=>!ir(u),invalidPhoneNumber:(f,{phoneNumber:u})=>!go(u)},services:{signInPassword:(f,{email:u,password:l})=>c("/signin/email-password",{email:u,password:l}),signInPasswordlessSms:(f,{phoneNumber:u,options:l})=>c("/signin/passwordless/sms",{phoneNumber:u,options:re(e,l)}),signInPasswordlessSmsOtp:(f,{phoneNumber:u,otp:l})=>c("/signin/passwordless/sms/otp",{phoneNumber:u,otp:l}),signInPasswordlessEmail:(f,{email:u,options:l})=>c("/signin/passwordless/email",{email:u,options:re(e,l)}),signInAnonymous:f=>c("/signin/anonymous"),signInMfaTotp:(f,{ticket:u,otp:l})=>{var d;return c("/signin/mfa/totp",{ticket:u||((d=f.mfa)==null?void 0:d.ticket),otp:l})},refreshToken:async(f,u)=>{let l=u.type==="TRY_TOKEN"?u.token:f.refreshToken.value;return{session:await c("/token",{refreshToken:l})}},signout:(f,u)=>c("/signout",{refreshToken:f.refreshToken.value,all:!!u.all}),registerUser:(f,{email:u,password:l,options:d})=>c("/signup/email-password",{email:u,password:l,options:re(e,d)}),autoSignIn:async()=>{if(typeof window=="undefined"||!window.location)throw Error("window is undefined or location does not exist");let{hash:f}=window.location;if(!f)throw Error("No hash in window.location");let l=new URLSearchParams(f.slice(1)).get("refreshToken");if(!l)throw Error("No refresh token in the location hash");let d=await c("/token",{refreshToken:l});return new Ne("nhost").postMessage(l),{session:d}},importRefreshToken:async()=>{let f=await r(St),u=f?new Date(f):null;return{refreshToken:await r(Xt),expiresAt:u}}}})};function sr(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 il={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 cn(t,e){function r(i,s,o){if(typeof document!="undefined"){o=sr({},e,o),typeof o.expires=="number"&&(o.expires=new Date(Date.now()+o.expires*864e5)),o.expires&&(o.expires=o.expires.toUTCString()),i=encodeURIComponent(i).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var a="";for(var c in o)!o[c]||(a+="; "+c,o[c]!==!0&&(a+="="+o[c].split(";")[0]));return document.cookie=i+"="+t.write(s,i)+a}}function n(i){if(!(typeof document=="undefined"||arguments.length&&!i)){for(var s=document.cookie?document.cookie.split("; "):[],o={},a=0;a<s.length;a++){var c=s[a].split("="),f=c.slice(1).join("=");try{var u=decodeURIComponent(c[0]);if(o[u]=t.read(f,u),i===u)break}catch{}}return i?o[i]:o}}return Object.create({set:r,get:n,remove:function(i,s){r(i,"",sr({},s,{expires:-1}))},withAttributes:function(i){return cn(this.converter,sr({},this.attributes,i))},withConverter:function(i){return cn(sr({},this.converter,i),this.attributes)}},{attributes:{value:Object.freeze(e)},converter:{value:Object.freeze(t)}})}var _v=cn(il,{path:"/"});var bo=typeof window!="undefined",or=new Map,ar=t=>{var e;return bo&&localStorage?localStorage.getItem(t):(e=or.get(t))!=null?e:null},ur=(t,e)=>{bo&&localStorage?e?localStorage.setItem(t,e):localStorage.removeItem(t):e?or.set(t,e):or.has(t)&&or.delete(t)};var Rt=class{constructor({backendUrl:e,clientUrl:r=typeof window!="undefined"&&(f=>(f=window.location)==null?void 0:f.origin)()||"",clientStorageGetter:n=ar,clientStorageSetter:i=ur,refreshIntervalTime:s=60,autoSignIn:o=!0,autoRefreshToken:a=!0,start:c=!0}){this._subscriptions=new Set;this.backendUrl=e,this.clientUrl=r,this.machine=To({backendUrl:e,clientUrl:r,refreshIntervalTime:s,clientStorageGetter:n,clientStorageSetter:i,autoSignIn:o,autoRefreshToken:a}),c&&(this.interpreter=he(this.machine),this.interpreter.start()),typeof window!="undefined"&&o&&(this._channel=new Ne("nhost"),this._channel.addEventListener("message",u=>{var d;let l=(d=this.interpreter)==null?void 0:d.state.context.refreshToken;this.interpreter&&u!==l&&this.interpreter.send({type:"TRY_TOKEN",token:u})}))}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 Ro=()=>typeof window!="undefined",Se=t=>!t||!t.accessToken.value||!t.refreshToken.value?null:{accessToken:t.accessToken.value,accessTokenExpiresIn:(t.accessToken.expiresAt.getTime()-Date.now())/1e3,refreshToken:t.refreshToken.value,user:t.user},Xe=(t,e)=>{e.forEach(r=>{typeof t[r]!="function"&&console.error(`clientStorage.${r} is not a function`)})},Ao=(t,e)=>{if(e){if(t==="react-native"||t==="custom")return Xe(e,["getItem"]),r=>{var n;return(n=e.getItem)==null?void 0:n.call(e,r)};if(t==="capacitor")return Xe(e,["get"]),r=>{var n;return(n=e.get)==null?void 0:n.call(e,{key:r})};if(t==="expo-secure-storage")return Xe(e,["getItemAsync"]),r=>{var n;return(n=e.getItemAsync)==null?void 0:n.call(e,r)}}return ar},Oo=(t,e)=>{if(e){if(t==="react-native"||t==="custom")return Xe(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 Xe(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 Xe(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 ur};var Co={message:"User is already signed in",status:100},ol={message:"User is not authenticated",status:101},al={message:"User is not anonymous",status:101},ul={message:"Email needs verification",status:102},fn=class{constructor({url:e,autoRefreshToken:r=!0,autoLogin:n=!0,clientStorage:i,clientStorageType:s="web",clientStorageGetter:o,clientStorageSetter:a,refreshIntervalTime:c,start:f=!0,Client:u=Rt}){this.onTokenChangedSubscriptions=new Set;this.onAuthStateChangedSubscriptions=new Set;this._client=new u({backendUrl:e,autoRefreshToken:r,autoSignIn:n,start:f,clientStorageGetter:o||Ao(s,i),clientStorageSetter:a||Oo(s,i),refreshIntervalTime:c})}async signUp(e){let r=await this.waitUntilReady(),{email:n,password:i,options:s}=e;return this.isAuthenticated()?{session:null,error:Co}:new Promise(o=>{r.send({type:"SIGNUP_EMAIL_PASSWORD",email:n,password:i,options:s}),r.onTransition(a=>{if(a.matches({authentication:{signedOut:"needsEmailVerification"}}))return o({session:null,error:null});if(a.matches({authentication:{signedOut:"failed"}}))return o({session:null,error:a.context.errors.registration||null});if(a.matches({authentication:"signedIn"}))return o({session:Se(a.context),error:null})})})}async signIn(e){let r=await this.waitUntilReady();if(this.isAuthenticated())return{session:null,mfa:null,error:Co};if("provider"in e){let{provider:n,options:i}=e,s=yo(`${this._client.backendUrl}/signin/provider/${n}`,re(this._client.clientUrl,i));return Ro()&&(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:Se(i.context),mfa:null,error:null}):i.matches({authentication:{signedOut:"needsEmailVerification"}})?n({session:null,mfa:null,error:ul}):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:Se(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"}})&&n({error:i.context.errors.signout||null})})}):{error:ol}}async resetPassword({email:e,options:r}){return new Promise(n=>{let i=he(wo(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=he(So(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=he(xo(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=he(Eo(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 a;if(!this.isAuthenticated()||!((a=r.state.context.user)!=null&&a.isAnonymous))return{error:al};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,...o}=e;r.send({type:"DEANONYMIZE",signInMethod:i,connection:s,options:o})})}onTokenChanged(e){var r;return this._client.interpreter?this.onTokenChangedSubscriptions.add((r=this._client.interpreter)==null?void 0:r.onTransition(({event:n,context:i})=>{n.type==="TOKEN_CHANGED"&&e(Se(i))})):console.log("onTokenChanged: no interpreter is set yet",e),()=>{this.onTokenChangedSubscriptions.forEach(n=>n.stop())}}onAuthStateChanged(e){var r;return this._client.interpreter?this.onAuthStateChangedSubscriptions.add((r=this._client.interpreter)==null?void 0:r.onTransition(({event:n,context:i})=>{n.type==="SIGNED_IN"?e("SIGNED_IN",Se(i)):n.type==="SIGNED_OUT"&&e("SIGNED_OUT",Se(i))})):console.log("onAuthStateChanged: no interpreter is set yet",e),()=>{this.onAuthStateChangedSubscriptions.forEach(n=>n.stop())}}isAuthenticated(){var e;return!!((e=this._client.interpreter)!=null&&e.state.matches({authentication:"signedIn"}))}async isAuthenticatedAsync(){return(await this.waitUntilReady()).state.matches({authentication:"signedIn"})}getAuthenticationStatus(){return this.isReady()?{isAuthenticated:this.isAuthenticated(),isLoading:!1}:{isAuthenticated:!1,isLoading:!0}}getJWTToken(){return this.getAccessToken()}getAccessToken(){var e,r;return(r=(e=this._client.interpreter)==null?void 0:e.state.context.accessToken.value)!=null?r:void 0}async refreshSession(e){try{let r=await this.waitUntilReady();return r.state.matches({token:"idle"})?void 0:new Promise(n=>{let i=e||r.state.context.refreshToken.value;if(!i)return n();r==null||r.onTransition(s=>{(s.matches({token:{idle:"error"}})||s.event.type==="TOKEN_CHANGED")&&n()}),r.send({type:"TRY_TOKEN",token:i})})}catch{return}}getSession(){var e,r;return Se((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(o=>{if(o.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 Ma=Nt(Ua()),_n=class{constructor({url:e}){this.url=e,this.httpClient=Ma.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 Nn=class{constructor({url:e}){this.url=e,this.api=new _n({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 Hu=Nt(Yn()),Qn=class{constructor(e){let{url:r}=e;this.accessToken=null,this.instance=Hu.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(o){if(o instanceof Error)return{res:null,error:o}}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 Gu=Nt(Yn()),Zn=class{constructor(e){let{url:r}=e;this.url=r,this.accessToken=null,this.instance=Gu.default.create({baseURL:r})}async request(e,r,n){let i={...n==null?void 0:n.headers,...this.generateAccessTokenHeaders()},s="",o;try{o=(await this.instance.post("",{operationName:s||void 0,query:e,variables:r},{...n,headers:i})).data}catch(a){return a instanceof Error?{data:null,error:a}:(console.error(a),{data:null,error:new Error("Unable to get do GraphQL request")})}return typeof o!="object"||Array.isArray(o)||o===null?{data:null,error:new Error("incorrect response data from GraphQL server")}:(o=o,o.errors?{data:null,error:o.errors}:{data:o.data,error:null})}getUrl(){return this.url}setAccessToken(e){if(!e){this.accessToken=null;return}this.accessToken=e}generateAccessTokenHeaders(){if(!!this.accessToken)return{Authorization:`Bearer ${this.accessToken}`}}};var ei=class{constructor({backendUrl:e,refreshIntervalTime:r,clientStorageGetter:n,clientStorageSetter:i,clientStorage:s,clientStorageType:o,autoRefreshToken:a,autoLogin:c,start:f=!0,Client:u}){if(!e)throw new Error("Please specify a `backendUrl`. Docs: [todo]!");this.auth=new fn({url:`${e}/v1/auth`,refreshIntervalTime:r,clientStorageGetter:n,clientStorageSetter:i,clientStorage:s,clientStorageType:o,autoRefreshToken:a,autoLogin:c,start:f,Client:u}),this.storage=new Nn({url:`${e}/v1/storage`}),this.functions=new Qn({url:`${e}/v1/functions`}),this.graphql=new Zn({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((l,d)=>{l==="SIGNED_OUT"&&(this.storage.setAccessToken(void 0),this.functions.setAccessToken(void 0),this.graphql.setAccessToken(void 0))}),this.auth.onTokenChanged(l=>{this.storage.setAccessToken(l==null?void 0:l.accessToken),this.functions.setAccessToken(l==null?void 0:l.accessToken),this.graphql.setAccessToken(l==null?void 0:l.accessToken)})})}};var zg=t=>new ei(t);export{ei as NhostClient,zg as createClient};
|
|
6
|
+
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(u,l){var d=n.parent&&(l===ve.Parent||n.parent.id===l),h=d?n.parent:A(l)?n.children.get(l)||vt.get(l):pi(l)?l:void 0;if(!h){if(!d)throw new Error("Unable to send event to child '".concat(l,"' from service '").concat(n.id,"'."));D||M(!1,"Service '".concat(n.id,"' has no parent: unable to send event ").concat(u.type));return}"machine"in h?h.send(v(v({},u),{name:u.name===Or?"".concat(Re(n.id)):u.name,origin:n.sessionId})):h.send(u.data)};var i=v(v({},t.defaultOptions),r),s=i.clock,o=i.logger,a=i.parent,c=i.id,f=c!==void 0?c:e.id;this.id=f,this.logger=o,this.clock=s,this.parent=a,this.options=i,this.scheduler=new Ur({deferEvents:this.options.deferEvents}),this.sessionId=vt.bookId()}return Object.defineProperty(t.prototype,"initialState",{get:function(){var e=this;return this._initialState?this._initialState:Ae(this,function(){return e._initialState=e.machine.initialState,e._initialState})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"state",{get:function(){return D||M(this.status!==G.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=T(e.actions),o=s.next();!o.done;o=s.next()){var a=o.value;this.exec(a,e,r)}}catch(c){n={error:c}}finally{try{o&&!o.done&&(i=s.return)&&i.call(s)}finally{if(n)throw n.error}}},t.prototype.update=function(e,r){var n,i,s,o,a,c,f,u,l=this;if(e._sessionid=this.sessionId,this._state=e,this.options.execute&&this.execute(this.state),this.children.forEach(function(O){l.state.children[O.id]=O}),this.devTools&&this.devTools.send(r.data,e),e.event)try{for(var d=T(this.eventListeners),h=d.next();!h.done;h=d.next()){var g=h.value;g(e.event)}}catch(O){n={error:O}}finally{try{h&&!h.done&&(i=d.return)&&i.call(d)}finally{if(n)throw n.error}}try{for(var E=T(this.listeners),p=E.next();!p.done;p=E.next()){var g=p.value;g(e,e.event)}}catch(O){s={error:O}}finally{try{p&&!p.done&&(o=E.return)&&o.call(E)}finally{if(s)throw s.error}}try{for(var w=T(this.contextListeners),y=w.next();!y.done;y=w.next()){var x=y.value;x(this.state.context,this.state.history?this.state.history.context:void 0)}}catch(O){a={error:O}}finally{try{y&&!y.done&&(c=w.return)&&c.call(w)}finally{if(a)throw a.error}}var C=Pe(e.configuration||[],this.machine);if(this.state.configuration&&C){var N=e.configuration.find(function(O){return O.type==="final"&&O.parent===l.machine}),L=N&&N.doneData?we(N.doneData,e.context,r):void 0;try{for(var b=T(this.doneListeners),S=b.next();!S.done;S=b.next()){var g=S.value;g(Te(this.id,L))}}catch(O){f={error:O}}finally{try{S&&!S.done&&(u=b.return)&&u.call(b)}finally{if(f)throw f.error}}this.stop()}},t.prototype.onTransition=function(e){return this.listeners.add(e),this.status===G.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,o=n;return typeof e=="function"?s=e:(s=e.next.bind(e),o=e.complete.bind(e)),this.listeners.add(s),this.status===G.Running&&s(this.state),o&&this.onDone(o),{unsubscribe:function(){s&&i.listeners.delete(s),o&&i.doneListeners.delete(o)}}},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===G.Running)return this;this.machine._init(),vt.register(this.sessionId,this),this.initialized=!0,this.status=G.Running;var n=e===void 0?this.initialState:Ae(this,function(){return ki(e)?r.machine.resolveState(e):r.machine.resolveState(ne.from(e,r.machine.context))});return this.options.devTools&&this.attachDev(),this.scheduler.initialize(function(){r.update(n,be)}),this},t.prototype.stop=function(){var e,r,n,i,s,o,a,c,f,u,l=this;try{for(var d=T(this.listeners),h=d.next();!h.done;h=d.next()){var g=h.value;this.listeners.delete(g)}}catch(S){e={error:S}}finally{try{h&&!h.done&&(r=d.return)&&r.call(d)}finally{if(e)throw e.error}}try{for(var E=T(this.stopListeners),p=E.next();!p.done;p=E.next()){var g=p.value;g(),this.stopListeners.delete(g)}}catch(S){n={error:S}}finally{try{p&&!p.done&&(i=E.return)&&i.call(E)}finally{if(n)throw n.error}}try{for(var w=T(this.contextListeners),y=w.next();!y.done;y=w.next()){var g=y.value;this.contextListeners.delete(g)}}catch(S){s={error:S}}finally{try{y&&!y.done&&(o=w.return)&&o.call(w)}finally{if(s)throw s.error}}try{for(var x=T(this.doneListeners),C=x.next();!C.done;C=x.next()){var g=C.value;this.doneListeners.delete(g)}}catch(S){a={error:S}}finally{try{C&&!C.done&&(c=x.return)&&c.call(x)}finally{if(a)throw a.error}}if(!this.initialized)return this;I([],R(this.state.configuration),!1).sort(function(S,O){return O.order-S.order}).forEach(function(S){var O,U;try{for(var B=T(S.definition.exit),X=B.next();!X.done;X=B.next()){var me=X.value;l.exec(me,l.state)}}catch(_t){O={error:_t}}finally{try{X&&!X.done&&(U=B.return)&&U.call(B)}finally{if(O)throw O.error}}}),this.children.forEach(function(S){_(S.stop)&&S.stop()});try{for(var N=T(Object.keys(this.delayedEventsMap)),L=N.next();!L.done;L=N.next()){var b=L.value;this.clock.clearTimeout(this.delayedEventsMap[b])}}catch(S){f={error:S}}finally{try{L&&!L.done&&(u=N.return)&&u.call(N)}finally{if(f)throw f.error}}return this.scheduler.clear(),this.initialized=!1,this.status=G.Stopped,vt.free(this.sessionId),this},t.prototype.batch=function(e){var r=this;if(this.status===G.NotStarted&&this.options.deferEvents)D||M(!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.
|
|
7
|
+
Event: `).concat(JSON.stringify(event)));else if(this.status!==G.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,o=!1,a=[],c=function(d){var h=j(d);r.forward(h),s=Ae(r,function(){return r.machine.transition(s,h)}),a.push.apply(a,I([],R(s.actions.map(function(g){return qi(g,s)})),!1)),o=o||!!s.changed};try{for(var f=T(e),u=f.next();!u.done;u=f.next()){var l=u.value;c(l)}}catch(d){n={error:d}}finally{try{u&&!u.done&&(i=f.return)&&i.call(f)}finally{if(n)throw n.error}}s.changed=o,s.actions=a,r.update(s,j(e[e.length-1]))})},t.prototype.sender=function(e){return this.send.bind(this,e)},t.prototype.nextState=function(e){var r=this,n=j(e);if(n.name.indexOf(Ar)===0&&!this.state.nextEvents.some(function(s){return s.indexOf(Ar)===0}))throw n.data.data;var i=Ae(this,function(){return r.machine.transition(r.state,n)});return i},t.prototype.forward=function(e){var r,n;try{for(var i=T(this.forwardTo),s=i.next();!s.done;s=i.next()){var o=s.value,a=this.children.get(o);if(!a)throw new Error("Unable to forward event '".concat(e,"' from interpreter '").concat(this.id,"' to nonexistant child '").concat(o,"'."));a.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,o=e.exec||Gt(e.type,n),a=_(o)?o:o?o.exec:e.exec;if(a)try{return a(i,s.data,{action:e,state:this.state,_event:s})}catch(C){throw this.parent&&this.parent.send({type:"xstate.error",data:C}),C}switch(e.type){case Se: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 It:this.cancel(e.sendId);break;case rt:{if(this.status!==G.Running)return;var f=e.activity;if(!this.state.activities[f.id||f.type])break;if(f.type===P.Invoke){var u=Ht(f.src),l=this.machine.options.services?this.machine.options.services[u.type]:void 0,d=f.id,h=f.data;D||M(!("forward"in f),"`forward` property is deprecated (found in invocation of '".concat(f.src,"' in in machine '").concat(this.machine.id,"'). ")+"Please use `autoForward` instead.");var g="autoForward"in f?f.autoForward:!!f.forward;if(!l){D||M(!1,"No service found for invocation '".concat(f.src,"' in machine '").concat(this.machine.id,"'."));return}var E=h?we(h,i,s):void 0;if(typeof l=="string")return;var p=_(l)?l(i,s.data,{data:E,src:u,meta:f.meta}):l;if(!p)return;var w=void 0;ue(p)&&(p=E?p.withContext(E):p,w={autoForward:g}),this.spawn(p,d,w)}else this.spawnActivity(f);break}case Me:{this.stopChild(e.activity.id);break}case qt:var y=e.label,x=e.value;y?this.logger(y,x):this.logger(x);break;default:D||M(!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),_(r.stop)&&r.stop())},t.prototype.spawn=function(e,r,n){if(_r(e))return this.spawnPromise(Promise.resolve(e),r);if(_(e))return this.spawnCallback(e,r);if(Oi(e))return this.spawnActor(e,r);if(hi(e))return this.spawnObservable(e,r);if(ue(e))return this.spawnMachine(e,v(v({},n),{id:r}));if(fi(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,v(v({},this.options),{parent:this,id:r.id||e.id})),s=v(v({},cc),r);s.sync&&i.onTransition(function(a){n.send(it,{state:a,id:i.id})});var o=i;return this.children.set(i.id,o),s.autoForward&&this.forwardTo.add(i.id),i.onDone(function(a){n.removeChild(i.id),n.send(j(a,{origin:i.id}))}).start(),o},t.prototype.spawnBehavior=function(e,r){var n=Ui(e,{id:r,parent:this});return this.children.set(r,n),n},t.prototype.spawnPromise=function(e,r){var n,i=this,s=!1,o;e.then(function(c){s||(o=c,i.removeChild(r),i.send(j(Te(r,c),{origin:r})))},function(c){if(!s){i.removeChild(r);var f=Re(r,c);try{i.send(j(f,{origin:r}))}catch(u){vi(c,u,r),i.devTools&&i.devTools.send(f,i.state),i.machine.strict&&i.stop()}}});var a=(n={id:r,send:function(){},subscribe:function(c,f,u){var l=ct(c,f,u),d=!1;return e.then(function(h){d||(l.next(h),!d&&l.complete())},function(h){d||l.error(h)}),{unsubscribe:function(){return d=!0}}},stop:function(){s=!0},toJSON:function(){return{id:r}},getSnapshot:function(){return o}},n[ae]=function(){return this},n);return this.children.set(r,a),a},t.prototype.spawnCallback=function(e,r){var n,i=this,s=!1,o=new Set,a=new Set,c,f=function(d){c=d,a.forEach(function(h){return h(d)}),!s&&i.send(j(d,{origin:r}))},u;try{u=e(f,function(d){o.add(d)})}catch(d){this.send(Re(r,d))}if(_r(u))return this.spawnPromise(u,r);var l=(n={id:r,send:function(d){return o.forEach(function(h){return h(d)})},subscribe:function(d){var h=ct(d);return a.add(h.next),{unsubscribe:function(){a.delete(h.next)}}},stop:function(){s=!0,_(u)&&u()},toJSON:function(){return{id:r}},getSnapshot:function(){return c}},n[ae]=function(){return this},n);return this.children.set(r,l),l},t.prototype.spawnObservable=function(e,r){var n,i=this,s,o=e.subscribe(function(c){s=c,i.send(j(c,{origin:r}))},function(c){i.removeChild(r),i.send(j(Re(r,c),{origin:r}))},function(){i.removeChild(r),i.send(j(Te(r),{origin:r}))}),a=(n={id:r,send:function(){},subscribe:function(c,f,u){return e.subscribe(c,f,u)},stop:function(){return o.unsubscribe()},getSnapshot:function(){return s},toJSON:function(){return{id:r}}},n[ae]=function(){return this},n);return this.children.set(r,a),a},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){D||M(!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[ae]=function(){return this},n))},t.prototype.attachDev=function(){var e=$t();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(v(v({name:this.id,autoPause:!0,stateSanitizer:function(n){return{value:n.value,context:n.context,actions:n.actions}}},r),{features:v({jump:!1,skip:!1},r?r.features:void 0)}),this.machine),this.devTools.init(this.state)}Di(this)}},t.prototype.toJSON=function(){return{id:this.id}},t.prototype[ae]=function(){return this},t.prototype.getSnapshot=function(){return this.status===G.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=he,t}();function he(t,e){var r=new Mi(t,e);return r}function fc(t){if(typeof t=="string"){var e={type:t};return e.toString=function(){return t},e}return t}function yt(t){return v(v({type:nt},t),{toJSON:function(){t.onDone,t.onError;var e=Ue(t,["onDone","onError"]);return v(v({},e),{type:nt,src:fc(t.src)})}})}var Ge="",Lr="#",gt="*",Ve={},He=function(t){return t[0]===Lr},lc=function(){return{actions:{},guards:{},services:{},activities:{},delays:{}}},dc=function(t,e,r){var n=r.slice(0,-1).some(function(s){return!("cond"in s)&&!("in"in s)&&(A(s.target)||ue(s.target))}),i=e===Ge?"the transient event":"event '".concat(e,"'");M(!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.")},Li=function(){function t(e,r,n,i){var s=this;n===void 0&&(n="context"in e?e.context:void 0);var o;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(lc(),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:Dt),this.id=this.config.id||I([this.machine.key],R(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:(o=this.config.schema)!==null&&o!==void 0?o:{},this.description=this.config.description,D||M(!("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?Be(this.config.states,function(f,u){var l,d=new t(f,{},void 0,{parent:s,key:u});return Object.assign(s.idMap,v((l={},l[d.id]=d,l),d.idMap)),d}):Ve;var a=0;function c(f){var u,l;f.order=a++;try{for(var d=T(Oe(f)),h=d.next();!h.done;h=d.next()){var g=h.value;c(g)}}catch(E){u={error:E}}finally{try{h&&!h.done&&(l=d.return)&&l.call(d)}finally{if(u)throw u.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(f){var u=f.event;return u===Ge}):Ge in this.config.on:!1),this.strict=!!this.config.strict,this.onEntry=Z(this.config.entry||this.config.onEntry).map(function(f){return Fe(f)}),this.onExit=Z(this.config.exit||this.config.onExit).map(function(f){return Fe(f)}),this.meta=this.config.meta,this.doneData=this.type==="final"?this.config.data:void 0,this.invoke=Z(this.config.invoke).map(function(f,u){var l,d;if(ue(f)){var h=ft(s.id,u);return s.machine.options.services=v((l={},l[h]=f,l),s.machine.options.services),yt({src:h,id:h})}else if(A(f.src)){var h=f.id||ft(s.id,u);return yt(v(v({},f),{id:h,src:f.src}))}else if(ue(f.src)||_(f.src)){var h=f.id||ft(s.id,u);return s.machine.options.services=v((d={},d[h]=f.src,d),s.machine.options.services),yt(v(v({id:h},f),{src:h}))}else{var g=f.src;return yt(v(v({id:ft(s.id,u)},f),{src:g}))}}),this.activities=Z(this.config.activities).concat(this.invoke).map(function(f){return zt(f)}),this.transition=this.transition.bind(this),this.tags=Z(this.config.tags)}return t.prototype._init=function(){this.__cache.transitions||kr(this).forEach(function(e){return e.on})},t.prototype.withConfig=function(e,r){var n=this.options,i=n.actions,s=n.activities,o=n.guards,a=n.services,c=n.delays;return new t(this.config,{actions:v(v({},i),e.actions),activities:v(v({},s),e.activities),guards:v(v({},o),e.guards),services:v(v({},a),e.services),delays:v(v({},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 _(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:Be(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===Ge,n=this.transitions.filter(function(i){var s=i.eventType===e;return r?s:s||i.eventType===gt});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,o){var a=_(s)?"".concat(e.id,":delay[").concat(o,"]"):s,c=xi(a,e.id);return e.onEntry.push(dt(c,{delay:s})),e.onExit.push(gi(c)),c},i=de(r)?r.map(function(s,o){var a=n(s.delay,o);return v(v({},s),{event:a})}):q(Object.keys(r).map(function(s,o){var a=r[s],c=A(a)?{target:a}:a,f=isNaN(+s)?s:+s,u=n(f,o);return Z(c).map(function(l){return v(v({},l),{event:u,delay:f})})}));return i.map(function(s){var o=s.delay;return v(v({},e.formatTransition(s)),{delay:o})})},t.prototype.getStateNodes=function(e){var r,n=this;if(!e)return[];var i=e instanceof ne?e.value:je(e,this.delimiter);if(A(i)){var s=this.getStateNode(i).initial;return s!==void 0?this.getStateNodes((r={},r[i]=s,r)):[this,this.states[i]]}var o=Object.keys(i),a=[this];return a.push.apply(a,I([],R(q(o.map(function(c){return n.getStateNode(c).getStateNodes(i[c])}))),!1)),a},t.prototype.handles=function(e){var r=Lt(e);return this.events.includes(r)},t.prototype.resolveState=function(e){var r=e instanceof ne?e:ne.create(e),n=Array.from(Ce([],this.getStateNodes(r.value)));return new ne(v(v({},r),{value:this.resolve(r.value),configuration:n,done:Pe(n,this),tags:qr(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]),o=s._transition(e[i[0]],r,n);return!o||!o.transitions.length?this.next(r,n):o},t.prototype.transitionParallelNode=function(e,r,n){var i,s,o={};try{for(var a=T(Object.keys(e)),c=a.next();!c.done;c=a.next()){var f=c.value,u=e[f];if(!!u){var l=this.getStateNode(f),d=l._transition(u,r,n);d&&(o[f]=d)}}}catch(y){i={error:y}}finally{try{c&&!c.done&&(s=a.return)&&s.call(a)}finally{if(i)throw i.error}}var h=Object.keys(o).map(function(y){return o[y]}),g=q(h.map(function(y){return y.transitions})),E=h.some(function(y){return y.transitions.length>0});if(!E)return this.next(r,n);var p=q(h.map(function(y){return y.entrySet})),w=q(Object.keys(o).map(function(y){return o[y].configuration}));return{transitions:g,entrySet:p,exitSet:q(h.map(function(y){return y.exitSet})),configuration:w,source:r,actions:q(Object.keys(o).map(function(y){return o[y].actions}))}},t.prototype._transition=function(e,r,n){return A(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,j(r))},t.prototype.next=function(e,r){var n,i,s=this,o=r.name,a=[],c=[],f;try{for(var u=T(this.getCandidates(o)),l=u.next();!l.done;l=u.next()){var d=l.value,h=d.cond,g=d.in,E=e.context,p=g?A(g)&&He(g)?e.matches(je(this.getStateNodeById(g).path,this.delimiter)):ot(je(g,this.delimiter),oi(this.path.slice(0,-2))(e.value)):!0,w=!1;try{w=!h||Vt(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(o,"' in state node '").concat(this.id,`':
|
|
8
|
+
`).concat(N.message))}if(w&&p){d.target!==void 0&&(c=d.target),a.push.apply(a,I([],R(d.actions),!1)),f=d;break}}}catch(N){n={error:N}}finally{try{l&&!l.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}if(!!f){if(!c.length)return{transitions:[f],entrySet:[],exitSet:[],configuration:e.value?[this]:[],source:e,actions:a};var y=q(c.map(function(N){return s.getRelativeStateNodes(N,e.historyValue)})),x=!!f.internal,C=x?[]:q(y.map(function(N){return s.nodesFromChild(N)}));return{transitions:[f],entrySet:C,exitSet:x?[]:[this],configuration:y,source:e,actions:a}}},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,o,a,c,f=Ce([],i?this.getStateNodes(i.value):[this]),u=e.configuration.length?Ce(f,e.configuration):f;try{for(var l=T(u),d=l.next();!d.done;d=l.next()){var h=d.value;mt(f,h)||e.entrySet.push(h)}}catch(b){s={error:b}}finally{try{d&&!d.done&&(o=l.return)&&o.call(l)}finally{if(s)throw s.error}}try{for(var g=T(f),E=g.next();!E.done;E=g.next()){var h=E.value;(!mt(u,h)||mt(e.exitSet,h.parent))&&e.exitSet.push(h)}}catch(b){a={error:b}}finally{try{E&&!E.done&&(c=g.return)&&c.call(g)}finally{if(a)throw a.error}}var p=q(e.entrySet.map(function(b){var S=[];if(b.type!=="final")return S;var O=b.parent;if(!O.parent)return S;S.push(ht(b.id,b.doneData),ht(O.id,b.doneData?we(b.doneData,r,n):void 0));var U=O.parent;return U.type==="parallel"&&Oe(U).every(function(B){return Pe(e.configuration,B)})&&S.push(ht(U.id)),S}));e.exitSet.sort(function(b,S){return S.order-b.order}),e.entrySet.sort(function(b,S){return b.order-S.order});var w=new Set(e.entrySet),y=new Set(e.exitSet),x=R([q(Array.from(w).map(function(b){return I(I([],R(b.activities.map(function(S){return Ei(S)})),!1),R(b.onEntry),!1)})).concat(p.map(yi)),q(Array.from(y).map(function(b){return I(I([],R(b.onExit),!1),R(b.activities.map(function(S){return Si(S)})),!1)}))],2),C=x[0],N=x[1],L=lt(N.concat(e.actions).concat(C),this.machine.options.actions);return L},t.prototype.transition=function(e,r,n){e===void 0&&(e=this.initialState);var i=j(r),s;if(e instanceof ne)s=n===void 0?e:this.resolveState(ne.from(e,n));else{var o=A(e)?this.resolve(st(this.getResolvedPath(e))):this.resolve(e),a=n!=null?n:this.machine.context;s=this.resolveState(ne.from(o,a))}if(!D&&i.name===gt)throw new Error("An event cannot have the wildcard type ('".concat(gt,"')"));if(this.strict&&!this.events.includes(i.name)&&!ci(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:[]},f=Ce([],this.getStateNodes(s.value)),u=c.configuration.length?Ce(f,c.configuration):f;return c.configuration=I([],R(u),!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,I([],R(s),!1)),e},t.prototype.resolveTransition=function(e,r,n,i){var s,o,a=this;i===void 0&&(i=be);var c=e.configuration,f=!r||e.transitions.length>0,u=f?_i(this.machine,c):void 0,l=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?v({},r.activities):{};try{for(var g=T(d),E=g.next();!E.done;E=g.next()){var p=E.value;p.type===rt?h[p.activity.id||p.activity.type]=p:p.type===Me&&(h[p.activity.id||p.activity.type]=!1)}}catch(Q){s={error:Q}}finally{try{E&&!E.done&&(o=g.return)&&o.call(g)}finally{if(s)throw s.error}}var w=R(Jt(this,r,n,i,d,this.machine.config.preserveActionOrder),2),y=w[0],x=w[1],C=R(Bt(y,function(Q){return Q.type===Le||Q.type===Se&&Q.to===ve.Internal}),2),N=C[0],L=C[1],b=y.filter(function(Q){var De;return Q.type===rt&&((De=Q.activity)===null||De===void 0?void 0:De.type)===nt}),S=b.reduce(function(Q,De){return Q[De.activity.id]=Ri(De.activity,a.machine,x,i),Q},r?v({},r.children):{}),O=f?e.configuration:r?r.configuration:[],U=Pe(O,this),B=new ne({value:u||r.value,context:x,_event:i,_sessionid:r?r._sessionid:null,historyValue:u?l?di(l,u):void 0:r?r.historyValue:void 0,history:!u||e.source?r:void 0,actions:u?L:[],activities:u?h:r?r.activities:{},events:[],configuration:O,transitions:e.transitions,children:S,done:U,tags:r==null?void 0:r.tags,machine:this}),X=n!==x;B.changed=i.name===it||X;var me=B.history;me&&delete me.history;var _t=!U&&(this._transient||c.some(function(Q){return Q._transient}));if(!f&&(!_t||i.name===Ge))return B;var Y=B;if(!U)for(_t&&(Y=this.resolveRaisedTransition(Y,{type:ti},i));N.length;){var Ju=N.shift();Y=this.resolveRaisedTransition(Y,Ju._event,i)}var zu=Y.changed||(me?!!Y.actions.length||X||typeof me.value!=typeof Y.value||!Dr(Y.value,me.value):void 0);return Y.changed=zu,Y.history=me,Y.tags=qr(Y.configuration),Y},t.prototype.getStateNode=function(e){if(He(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=He(e)?e.slice(Lr.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"&&He(e))try{return this.getStateNodeById(e.slice(1))}catch{}for(var r=jt(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||Ve;switch(this.type){case"parallel":return Be(this.initialStateValue,function(s,o){return s?n.getStateNode(o).resolve(e[o]||s):Ve});case"compound":if(A(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?Be(e,function(s,o){return s?n.getStateNode(o).resolve(s):Ve}):this.initialStateValue||{};default:return e||Ve}},t.prototype.getResolvedPath=function(e){if(He(e)){var r=this.machine.idMap[e.slice(Lr.length)];if(!r)throw new Error("Unable to find state node '".concat(e,"'"));return r.path}return jt(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=Pr(this.states,function(n){return n.initialStateValue||Ve},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=pt(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;A(r.target)?e=He(r.target)?st(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(pt(this))return[this];if(this.type==="compound"&&!this.initial)return D||M(!1,"Compound state node '".concat(this.id,"' has no initial state.")),[this];var r=at(this.initialStateValue);return q(r.map(function(n){return e.getFromRelativePath(n)}))},enumerable:!1,configurable:!0}),t.prototype.getFromRelativePath=function(e){if(!e.length)return[this];var r=R(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:Pr(this.states,function(r,n){if(!e)return r.historyValue();var i=A(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?q(at(i).map(function(o){return n.getFromRelativePath(o)})):n.initialStateNodes}var s=ai(n.path,"states")(e).current;return A(s)?[n.getStateNode(s)]:q(at(s).map(function(o){return r.history==="deep"?n.getFromRelativePath(o):[n.states[o[0]]]}))},Object.defineProperty(t.prototype,"stateIds",{get:function(){var e=this,r=q(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,o=new Set(this.ownEvents);if(s)try{for(var a=T(Object.keys(s)),c=a.next();!c.done;c=a.next()){var f=c.value,u=s[f];if(u.states)try{for(var l=(n=void 0,T(u.events)),d=l.next();!d.done;d=l.next()){var h=d.value;o.add("".concat(h))}}catch(g){n={error:g}}finally{try{d&&!d.done&&(i=l.return)&&i.call(l)}finally{if(n)throw n.error}}}}catch(g){e={error:g}}finally{try{c&&!c.done&&(r=a.return)&&r.call(a)}finally{if(e)throw e.error}}return this.__cache.events=Array.from(o)},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(!A(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 o=r.parent.getStateNodeByPath(s);return o}catch(a){throw new Error("Invalid transition definition for state node '".concat(r.id,`':
|
|
9
|
+
`).concat(a.message))}else return r.getStateNodeByPath(s)})},t.prototype.formatTransition=function(e){var r=this,n=mi(e.target),i="internal"in e?e.internal:n?n.some(function(c){return A(c)&&c[0]===r.delimiter}):!0,s=this.machine.options.guards,o=this.resolveTarget(n),a=v(v({},e),{actions:lt(Z(e.actions)),cond:Ft(e.cond,s),target:o,source:this,internal:i,eventType:e.event,toJSON:function(){return v(v({},a),{target:a.target?a.target.map(function(c){return"#".concat(c.id)}):void 0,source:"#".concat(r.id)})}});return a},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,o=gt,a=s[o],c=a===void 0?[]:a,f=Ue(s,[typeof o=="symbol"?o:o+""]);i=q(Object.keys(f).map(function(y){!D&&y===Ge&&M(!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 x=xe(y,f[y]);return D||dc(n,y,x),x}).concat(xe(gt,c)))}var u=this.config.always?xe("",this.config.always):[],l=this.config.onDone?xe(String(ht(this.id)),this.config.onDone):[];D||M(!(this.config.onDone&&!this.parent),'Root nodes cannot have an ".onDone" transition. Please check the config of "'.concat(this.id,'".'));var d=q(this.invoke.map(function(y){var x=[];return y.onDone&&x.push.apply(x,I([],R(xe(String(Te(y.id)),y.onDone)),!1)),y.onError&&x.push.apply(x,I([],R(xe(String(Re(y.id)),y.onError)),!1)),x})),h=this.after,g=q(I(I(I(I([],R(l),!1),R(d),!1),R(i),!1),R(u),!1).map(function(y){return Z(y).map(function(x){return n.formatTransition(x)})}));try{for(var E=T(h),p=E.next();!p.done;p=E.next()){var w=p.value;g.push(w)}}catch(y){e={error:y}}finally{try{p&&!p.done&&(r=E.return)&&r.call(E)}finally{if(e)throw e.error}}return g},t}();function ie(t,e){return new Li(t,e)}var k=wi,J=dt;function Bi(t){return!!(t&&typeof t.then=="function")}var hc=Promise.resolve(!1),Ap=Promise.resolve(!0),ce=Promise.resolve();function Wt(t,e){return t||(t=0),new Promise(function(r){return setTimeout(function(){return r(e)},t)})}function Fi(t,e){return Math.floor(Math.random()*(e-t+1)+t)}function Et(){return Math.random().toString(36).substring(2)}var ji=0,jr=0;function ye(){var t=new Date().getTime();return t===ji?(jr++,t*1e3+jr):(ji=t,jr=0,t*1e3)}var ge=Object.prototype.toString.call(typeof process!="undefined"?process:0)==="[object process]";var pc=ye,mc="native";function vc(t){var e={messagesCallback:null,bc:new BroadcastChannel(t),subFns:[]};return e.bc.onmessage=function(r){e.messagesCallback&&e.messagesCallback(r.data)},e}function yc(t){t.bc.close(),t.subFns=[]}function gc(t,e){try{return t.bc.postMessage(e,!1),ce}catch(r){return Promise.reject(r)}}function Ec(t,e){t.messagesCallback=e}function Sc(){if(ge&&typeof window=="undefined")return!1;if(typeof BroadcastChannel=="function"){if(BroadcastChannel._pubkey)throw new Error("BroadcastChannel: Do not overwrite window.BroadcastChannel with this module, this is not a polyfill");return!0}else return!1}function wc(){return 150}var Vi={create:vc,close:yc,onMessage:Ec,postMessage:gc,canBeUsed:Sc,type:mc,averageResponseTime:wc,microSeconds:pc};var Kt=function(){function t(e){this.ttl=e,this.set=new Set,this.timeMap=new Map}return t.prototype.has=function(e){return this.set.has(e)},t.prototype.add=function(e){var r=this;this.timeMap.set(e,Hi()),this.set.add(e),setTimeout(function(){xc(r)},0)},t.prototype.clear=function(){this.set.clear(),this.timeMap.clear()},t}();function xc(t){for(var e=Hi()-t.ttl,r=t.set[Symbol.iterator]();;){var n=r.next().value;if(!n)return;var i=t.timeMap.get(n);if(i<e)t.timeMap.delete(n),t.set.delete(n);else return}}function Hi(){return new Date().getTime()}function Je(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=JSON.parse(JSON.stringify(t));return typeof e.webWorkerSupport=="undefined"&&(e.webWorkerSupport=!0),e.idb||(e.idb={}),e.idb.ttl||(e.idb.ttl=1e3*45),e.idb.fallbackInterval||(e.idb.fallbackInterval=150),t.idb&&typeof t.idb.onclose=="function"&&(e.idb.onclose=t.idb.onclose),e.localstorage||(e.localstorage={}),e.localstorage.removeTimeout||(e.localstorage.removeTimeout=1e3*60),t.methods&&(e.methods=t.methods),e.node||(e.node={}),e.node.ttl||(e.node.ttl=1e3*60*2),e.node.maxParallelWrites||(e.node.maxParallelWrites=2048),typeof e.node.useFastPath=="undefined"&&(e.node.useFastPath=!0),e}var bc=ye,Tc="pubkey.broadcast-channel-0-",pe="messages",Rc="idb";function Gi(){if(typeof indexedDB!="undefined")return indexedDB;if(typeof window!="undefined"){if(typeof window.mozIndexedDB!="undefined")return window.mozIndexedDB;if(typeof window.webkitIndexedDB!="undefined")return window.webkitIndexedDB;if(typeof window.msIndexedDB!="undefined")return window.msIndexedDB}return!1}function Ac(t){var e=Gi(),r=Tc+t,n=e.open(r,1);n.onupgradeneeded=function(s){var o=s.target.result;o.createObjectStore(pe,{keyPath:"id",autoIncrement:!0})};var i=new Promise(function(s,o){n.onerror=function(a){return o(a)},n.onsuccess=function(){s(n.result)}});return i}function Oc(t,e,r){var n=new Date().getTime(),i={uuid:e,time:n,data:r},s=t.transaction([pe],"readwrite");return new Promise(function(o,a){s.oncomplete=function(){return o()},s.onerror=function(f){return a(f)};var c=s.objectStore(pe);c.add(i)})}function Cc(t,e){var r=t.transaction(pe).objectStore(pe),n=[];function i(){try{var s=IDBKeyRange.bound(e+1,1/0);return r.openCursor(s)}catch{return r.openCursor()}}return new Promise(function(s){i().onsuccess=function(o){var a=o.target.result;a?a.value.id<e+1?a.continue(e+1):(n.push(a.value),a.continue()):s(n)}})}function Pc(t,e){var r=t.transaction([pe],"readwrite").objectStore(pe).delete(e);return new Promise(function(n){r.onsuccess=function(){return n()}})}function _c(t,e){var r=new Date().getTime()-e,n=t.transaction(pe).objectStore(pe),i=[];return new Promise(function(s){n.openCursor().onsuccess=function(o){var a=o.target.result;if(a){var c=a.value;if(c.time<r)i.push(c),a.continue();else{s(i);return}}else s(i)}})}function Nc(t,e){return _c(t,e).then(function(r){return Promise.all(r.map(function(n){return Pc(t,n.id)}))})}function Ic(t,e){return e=Je(e),Ac(t).then(function(r){var n={closed:!1,lastCursorId:0,channelName:t,options:e,uuid:Et(),eMIs:new Kt(e.idb.ttl*2),writeBlockPromise:ce,messagesCallback:null,readQueuePromises:[],db:r};return r.onclose=function(){n.closed=!0,e.idb.onclose&&e.idb.onclose()},Ji(n),n})}function Ji(t){t.closed||zi(t).then(function(){return Wt(t.options.idb.fallbackInterval)}).then(function(){return Ji(t)})}function kc(t,e){return!(t.uuid===e.uuid||e.eMIs.has(t.id)||t.data.time<e.messagesCallbackTime)}function zi(t){return t.closed?ce:t.messagesCallback?Cc(t.db,t.lastCursorId).then(function(e){var r=e.filter(function(n){return!!n}).map(function(n){return n.id>t.lastCursorId&&(t.lastCursorId=n.id),n}).filter(function(n){return kc(n,t)}).sort(function(n,i){return n.time-i.time});return r.forEach(function(n){t.messagesCallback&&(t.eMIs.add(n.id),t.messagesCallback(n.data))}),ce}):ce}function qc(t){t.closed=!0,t.db.close()}function Dc(t,e){return t.writeBlockPromise=t.writeBlockPromise.then(function(){return Oc(t.db,t.uuid,e)}).then(function(){Fi(0,10)===0&&Nc(t.db,t.options.idb.ttl)}),t.writeBlockPromise}function Uc(t,e,r){t.messagesCallbackTime=r,t.messagesCallback=e,zi(t)}function Mc(){if(ge)return!1;var t=Gi();return!!t}function Lc(t){return t.idb.fallbackInterval*2}var $i={create:Ic,close:qc,onMessage:Uc,postMessage:Dc,canBeUsed:Mc,type:Rc,averageResponseTime:Lc,microSeconds:bc};var jc=ye,Bc="pubkey.broadcastChannel-",Fc="localstorage";function Wi(){var t;if(typeof window=="undefined")return null;try{t=window.localStorage,t=window["ie8-eventlistener/storage"]||window.localStorage}catch{}return t}function Ki(t){return Bc+t}function Vc(t,e){return new Promise(function(r){Wt().then(function(){var n=Ki(t.channelName),i={token:Et(),time:new Date().getTime(),data:e,uuid:t.uuid},s=JSON.stringify(i);Wi().setItem(n,s);var o=document.createEvent("Event");o.initEvent("storage",!0,!0),o.key=n,o.newValue=s,window.dispatchEvent(o),r()})})}function Hc(t,e){var r=Ki(t),n=function(s){s.key===r&&e(JSON.parse(s.newValue))};return window.addEventListener("storage",n),n}function Gc(t){window.removeEventListener("storage",t)}function Jc(t,e){if(e=Je(e),!Xi())throw new Error("BroadcastChannel: localstorage cannot be used");var r=Et(),n=new Kt(e.localstorage.removeTimeout),i={channelName:t,uuid:r,eMIs:n};return i.listener=Hc(t,function(s){!i.messagesCallback||s.uuid!==r&&(!s.token||n.has(s.token)||s.data.time&&s.data.time<i.messagesCallbackTime||(n.add(s.token),i.messagesCallback(s.data)))}),i}function zc(t){Gc(t.listener)}function $c(t,e,r){t.messagesCallbackTime=r,t.messagesCallback=e}function Xi(){if(ge)return!1;var t=Wi();if(!t)return!1;try{var e="__broadcastchannel_check";t.setItem(e,"works"),t.removeItem(e)}catch{return!1}return!0}function Wc(){var t=120,e=navigator.userAgent.toLowerCase();return e.includes("safari")&&!e.includes("chrome")?t*2:t}var Yi={create:Jc,close:zc,onMessage:$c,postMessage:Vc,canBeUsed:Xi,type:Fc,averageResponseTime:Wc,microSeconds:jc};var Kc=ye,Xc="simulate",Br=new Set;function Yc(t){var e={name:t,messagesCallback:null};return Br.add(e),e}function Qc(t){Br.delete(t)}function Zc(t,e){return new Promise(function(r){return setTimeout(function(){var n=Array.from(Br);n.filter(function(i){return i.name===t.name}).filter(function(i){return i!==t}).filter(function(i){return!!i.messagesCallback}).forEach(function(i){return i.messagesCallback(e)}),r()},5)})}function ef(t,e){t.messagesCallback=e}function tf(){return!0}function rf(){return 5}var Qi={create:Yc,close:Qc,onMessage:ef,postMessage:Zc,canBeUsed:tf,type:Xc,averageResponseTime:rf,microSeconds:Kc};var Zi=[Vi,$i,Yi];function es(t){var e=[].concat(t.methods,Zi).filter(Boolean);if(t.type){if(t.type==="simulate")return Qi;var r=e.find(function(i){return i.type===t.type});if(r)return r;throw new Error("method-type "+t.type+" not found")}!t.webWorkerSupport&&!ge&&(e=e.filter(function(i){return i.type!=="idb"}));var n=e.find(function(i){return i.canBeUsed()});if(n)return n;throw new Error("No useable method found in "+JSON.stringify(Zi.map(function(i){return i.type})))}var Fr=new Set,nf=0,_e=function(e,r){this.id=nf++,Fr.add(this),this.name=e,ts&&(r=ts),this.options=Je(r),this.method=es(this.options),this._iL=!1,this._onML=null,this._addEL={message:[],internal:[]},this._uMP=new Set,this._befC=[],this._prepP=null,sf(this)};_e._pubkey=!0;var ts;_e.prototype={postMessage:function(e){if(this.closed)throw new Error("BroadcastChannel.postMessage(): Cannot post message after channel has closed "+JSON.stringify(e));return rs(this,"message",e)},postInternal:function(e){return rs(this,"internal",e)},set onmessage(t){var e=this.method.microSeconds(),r={time:e,fn:t};is(this,"message",this._onML),t&&typeof t=="function"?(this._onML=r,ns(this,"message",r)):this._onML=null},addEventListener:function(e,r){var n=this.method.microSeconds(),i={time:n,fn:r};ns(this,e,i)},removeEventListener:function(e,r){var n=this._addEL[e].find(function(i){return i.fn===r});is(this,e,n)},close:function(){var e=this;if(!this.closed){Fr.delete(this),this.closed=!0;var r=this._prepP?this._prepP:ce;return this._onML=null,this._addEL.message=[],r.then(function(){return Promise.all(Array.from(e._uMP))}).then(function(){return Promise.all(e._befC.map(function(n){return n()}))}).then(function(){return e.method.close(e._state)})}},get type(){return this.method.type},get isClosed(){return this.closed}};function rs(t,e,r){var n=t.method.microSeconds(),i={time:n,type:e,data:r},s=t._prepP?t._prepP:ce;return s.then(function(){var o=t.method.postMessage(t._state,i);return t._uMP.add(o),o.catch().then(function(){return t._uMP.delete(o)}),o})}function sf(t){var e=t.method.create(t.name,t.options);Bi(e)?(t._prepP=e,e.then(function(r){t._state=r})):t._state=e}function ss(t){return t._addEL.message.length>0||t._addEL.internal.length>0}function ns(t,e,r){t._addEL[e].push(r),of(t)}function is(t,e,r){t._addEL[e]=t._addEL[e].filter(function(n){return n!==r}),af(t)}function of(t){if(!t._iL&&ss(t)){var e=function(i){t._addEL[i.type].forEach(function(s){var o=1e5,a=s.time-o;i.time>=a&&s.fn(i.data)})},r=t.method.microSeconds();t._prepP?t._prepP.then(function(){t._iL=!0,t.method.onMessage(t._state,e,r)}):(t._iL=!0,t.method.onMessage(t._state,e,r))}}function af(t){if(t._iL&&!ss(t)){t._iL=!1;var e=t.method.microSeconds();t.method.onMessage(t._state,null,e)}}var Xt="nhostRefreshToken",St="nhostRefreshTokenExpiresAt";var Ne={status:10,error:"invalid-email",message:"Email is incorrectly formatted"};var wt={status:10,error:"invalid-password",message:"Password is incorrectly formatted"},os={status:10,error:"invalid-phone-number",message:"Phone number is incorrectly formatted"},as={status:10,error:"no-mfa-ticket",message:"No MFA ticket has been provided"};var vo=Nt(mo());var se=t=>{let e=vo.default.create({baseURL:t});return e.interceptors.response.use(r=>r,r=>{var n,i,s,o,a,c,f,u,l,d;return Promise.reject({error:{message:(a=(o=(s=(i=(n=r.response)==null?void 0:n.data)==null?void 0:i.message)!=null?s:r.message)!=null?o:r.request.responseText)!=null?a:JSON.stringify(r),status:(l=(u=(c=r.response)==null?void 0:c.status)!=null?u:(f=r.response)==null?void 0:f.data.statusCode)!=null?l:0,error:((d=r.response)==null?void 0:d.data.error)||r.request.statusText||"network"}})}),e};var yo=(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},re=(t,e)=>{var r;return e!=null&&e.redirectTo?{...e,redirectTo:(r=e==null?void 0:e.redirectTo)!=null&&r.startsWith("/")?t+e.redirectTo:e==null?void 0:e.redirectTo}:e};var Ke=t=>!!t&&typeof t=="string"&&!!String(t).toLowerCase().match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/),ir=t=>!!t&&typeof t=="string"&&t.length>=3,go=t=>!!t&&typeof t=="string";var un={user:null,mfa:null,accessToken:{value:null,expiresAt:new Date},refreshTimer:{elapsed:0,attempts:0},refreshToken:{value:null},errors:{}};var Eo=({backendUrl:t,clientUrl:e,interpreter:r})=>{let n=se(t);return ie({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:k({error:i=>Ne}),saveRequestError:k({error:(i,{data:{error:s}})=>s}),reportError:J(i=>({type:"ERROR",error:i.error})),reportSuccess:J("SUCCESS")},guards:{invalidEmail:(i,{email:s})=>!Ke(s)},services:{requestChange:async(i,{email:s,options:o})=>(await n.post("/user/email/change",{newEmail:s,options:re(e,o)},{headers:{authorization:`Bearer ${r==null?void 0:r.state.context.accessToken.value}`}})).data}})};var So=({backendUrl:t,interpreter:e})=>{let r=se(t);return ie({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:k({error:n=>wt}),saveRequestError:k({error:(n,{data:{error:i}})=>(console.log(i),i)}),reportError:J(n=>({type:"ERROR",error:n.error})),reportSuccess:J("SUCCESS")},guards:{invalidPassword:(n,{password:i})=>!ir(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 wo=({backendUrl:t,clientUrl:e})=>{let r=se(t);return ie({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:k({error:(n,{data:{error:i}})=>(console.log(i),i)}),reportError:J(n=>({type:"ERROR",error:n.error})),reportSuccess:J("SUCCESS")},services:{requestChange:(n,{email:i,options:s})=>r.post("/user/password/reset",{email:i,options:re(e,s)})}})};var xo=({backendUrl:t,clientUrl:e,interpreter:r})=>{let n=se(t);return ie({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:k({error:i=>Ne}),saveRequestError:k({error:(i,{data:{error:s}})=>s}),reportError:J(i=>({type:"ERROR",error:i.error})),reportSuccess:J("SUCCESS")},guards:{invalidEmail:(i,{email:s})=>!Ke(s)},services:{request:async(i,{email:s,options:o})=>(await n.post("/user/email/send-verification-email",{email:s,options:re(e,o)})).data}})};var bo=({backendUrl:t,clientUrl:e,clientStorageGetter:r,clientStorageSetter:n,refreshIntervalTime:i,autoRefreshToken:s=!0,autoSignIn:o=!0})=>{let a=se(t),c=async(f,u,l)=>(await a.post(f,u,l)).data;return ie({schema:{context:{},events:{}},tsTypes:{},context:un,preserveActionOrder:!0,id:"nhost",type:"parallel",states:{authentication:{initial:"checkAutoSignIn",on:{SESSION_UPDATE:[{cond:"hasSession",actions:["saveSession","persist","resetTimer","reportTokenChanged"],target:".signedIn"}]},states:{checkAutoSignIn:{always:[{cond:"isAutoSignInDisabled",target:"importingRefreshToken"}],invoke:{id:"autoSignIn",src:"autoSignIn",onDone:{target:"signedIn",actions:["saveSession","persist","reportTokenChanged"]},onError:"importingRefreshToken"}},importingRefreshToken:{invoke:{id:"importRefreshToken",src:"importRefreshToken",onDone:{actions:"saveRefreshToken",target:"starting"}}},starting:{always:[{cond:"isSignedIn",target:"signedIn"},{cond:"hasRefreshTokenWithoutSession",target:["authenticating.token","#nhost.token.running"]},"signedOut"]},signedOut:{tags:["ready"],initial:"noErrors",entry:"reportSignedOut",states:{noErrors:{},success:{},needsEmailVerification:{},needsSmsOtp:{},needsMfa:{},failed:{exit:"resetAuthenticationError",initial:"server",states:{server:{},validation:{states:{password:{},email:{},phoneNumber:{}}}}},signingOut:{entry:"destroyToken",exit:"clearContext",invoke:{src:"signout",id:"signingOut",onDone:{target:"success"},onError:{target:"failed.server"}}}},on:{SIGNIN_PASSWORD:[{cond:"invalidEmail",actions:["saveInvalidEmail"],target:".failed.validation.email"},{cond:"invalidPassword",actions:["saveInvalidPassword"],target:".failed.validation.password"},"#nhost.authentication.authenticating.password"],SIGNIN_PASSWORDLESS_EMAIL:[{cond:"invalidEmail",actions:"saveInvalidEmail",target:".failed.validation.email"},"#nhost.authentication.authenticating.passwordlessEmail"],SIGNIN_PASSWORDLESS_SMS:[{cond:"invalidPhoneNumber",actions:"saveInvalidPhoneNumber",target:".failed.validation.phoneNumber"},"#nhost.authentication.authenticating.passwordlessSms"],SIGNIN_PASSWORDLESS_SMS_OTP:[{cond:"invalidPhoneNumber",actions:"saveInvalidPhoneNumber",target:".failed.validation.phoneNumber"},"#nhost.authentication.authenticating.passwordlessSmsOtp"],SIGNUP_EMAIL_PASSWORD:[{cond:"invalidEmail",actions:"saveInvalidSignUpEmail",target:".failed.validation.email"},{cond:"invalidPassword",actions:"saveInvalidSignUpPassword",target:".failed.validation.password"},"#nhost.authentication.registering"],SIGNIN_ANONYMOUS:"#nhost.authentication.authenticating.anonymous",SIGNIN_MFA_TOTP:[{cond:"noMfaTicket",actions:["saveNoMfaTicketError"],target:".failed"},"#nhost.authentication.authenticating.mfa.totp"]}},authenticating:{states:{passwordlessEmail:{invoke:{src:"signInPasswordlessEmail",id:"authenticatePasswordlessEmail",onDone:"#nhost.authentication.signedOut.needsEmailVerification",onError:{actions:"saveAuthenticationError",target:"#nhost.authentication.signedOut.failed.server"}}},passwordlessSms:{invoke:{src:"signInPasswordlessSms",id:"authenticatePasswordlessSms",onDone:"#nhost.authentication.signedOut.needsSmsOtp",onError:{actions:"saveAuthenticationError",target:"#nhost.authentication.signedOut.failed.server"}}},passwordlessSmsOtp:{invoke:{src:"signInPasswordlessSmsOtp",id:"authenticatePasswordlessSmsOtp",onDone:{actions:["saveSession","persist","reportTokenChanged"],target:"#nhost.authentication.signedIn"},onError:{actions:"saveAuthenticationError",target:"#nhost.authentication.signedOut.failed.server"}}},password:{invoke:{src:"signInPassword",id:"authenticateUserWithPassword",onDone:[{cond:"hasMfaTicket",actions:["saveMfaTicket"],target:"#nhost.authentication.signedOut.needsMfa"},{actions:["saveSession","persist","reportTokenChanged"],target:"#nhost.authentication.signedIn"}],onError:[{cond:"unverified",target:"#nhost.authentication.signedOut.needsEmailVerification"},{actions:"saveAuthenticationError",target:"#nhost.authentication.signedOut.failed.server"}]}},token:{},anonymous:{invoke:{src:"signInAnonymous",id:"authenticateAnonymously",onDone:{actions:["saveSession","persist","reportTokenChanged"],target:"#nhost.authentication.signedIn"},onError:{actions:"saveAuthenticationError",target:"#nhost.authentication.signedOut.failed.server"}}},mfa:{states:{totp:{invoke:{src:"signInMfaTotp",id:"signInMfaTotp",onDone:{actions:["saveSession","persist","reportTokenChanged"],target:"#nhost.authentication.signedIn"},onError:{actions:["saveAuthenticationError"],target:"#nhost.authentication.signedOut.failed.server"}}}}}}},registering:{entry:"resetSignUpError",invoke:{src:"registerUser",id:"registerUser",onDone:[{cond:"hasSession",target:"#nhost.authentication.signedIn",actions:["saveSession","persist","reportTokenChanged"]},{target:"#nhost.authentication.signedOut.needsEmailVerification"}],onError:[{cond:"unverified",target:"#nhost.authentication.signedOut.needsEmailVerification"},{actions:"saveRegisrationError",target:"#nhost.authentication.signedOut.failed.server"}]}},signedIn:{tags:["ready"],type:"parallel",entry:"reportSignedIn",on:{SIGNOUT:"#nhost.authentication.signedOut.signingOut",DEANONYMIZE:{target:".deanonymizing"}},states:{refreshTimer:{id:"timer",initial:"idle",states:{disabled:{type:"final"},stopped:{always:{cond:"noToken",target:"idle"}},idle:{always:[{cond:"isAutoRefreshDisabled",target:"disabled"},{cond:"hasRefreshToken",target:"running"}]},running:{initial:"pending",entry:"resetTimer",states:{pending:{after:{"1000":{actions:"tickRefreshTimer",internal:!1,target:"pending"}},always:{cond:"refreshTimerShouldRefresh",target:"refreshing"}},refreshing:{invoke:{src:"refreshToken",id:"refreshToken",onDone:{actions:["saveSession","persist","resetTimer","reportTokenChanged"],target:"pending"},onError:[]}}}}}},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:J("SIGNED_IN"),reportSignedOut:J("SIGNED_OUT"),reportTokenChanged:J("TOKEN_CHANGED"),clearContext:k(()=>un),saveSession:k({user:(f,u)=>{var l,d;return(d=(l=u.data)==null?void 0:l.session)==null?void 0:d.user},accessToken:(f,u)=>{var l,d,h,g;return{value:(d=(l=u.data)==null?void 0:l.session)==null?void 0:d.accessToken,expiresAt:new Date(Date.now()+((g=(h=u.data)==null?void 0:h.session)==null?void 0:g.accessTokenExpiresIn)*1e3)}},refreshToken:(f,u)=>{var l,d;return{value:(d=(l=u.data)==null?void 0:l.session)==null?void 0:d.refreshToken}}}),saveMfaTicket:k({mfa:(f,u)=>{var l,d;return(d=(l=u.data)==null?void 0:l.mfa)!=null?d:null}}),resetTimer:k({refreshTimer:(f,u)=>({elapsed:0,attempts:0})}),tickRefreshTimer:k({refreshTimer:(f,u)=>({elapsed:f.refreshTimer.elapsed+1,attempts:f.refreshTimer.attempts})}),saveAuthenticationError:k({errors:({errors:f},{data:{error:u}})=>({...f,authentication:u})}),resetAuthenticationError:k({errors:({errors:{authentication:f,...u}})=>u}),saveInvalidEmail:k({errors:({errors:f})=>({...f,authentication:Ne})}),saveInvalidPassword:k({errors:({errors:f})=>({...f,authentication:wt})}),saveInvalidPhoneNumber:k({errors:({errors:f})=>({...f,authentication:os})}),saveRegisrationError:k({errors:({errors:f},{data:{error:u}})=>({...f,registration:u})}),resetSignUpError:k({errors:({errors:{registration:f,...u}})=>u}),saveInvalidSignUpPassword:k({errors:({errors:f})=>({...f,registration:Ne})}),saveInvalidSignUpEmail:k({errors:({errors:f})=>({...f,registration:wt})}),saveNoMfaTicketError:k({errors:({errors:f})=>({...f,registration:as})}),saveRefreshToken:k({accessToken:(f,u)=>({...f.accessToken,expiresAt:u.data.expiresAt}),refreshToken:(f,u)=>({...f.refreshToken,value:u.data.refreshToken})}),persist:(f,{data:u})=>{if(n(Xt,u.session.refreshToken),u.session.accessTokenExpiresIn){let l=new Date(Date.now()+u.session.accessTokenExpiresIn*1e3).toISOString();n(St,l)}else n(St,null)},destroyToken:()=>{n(Xt,null),n(St,null)}},guards:{isSignedIn:f=>!!f.user&&!!f.refreshToken.value&&!!f.accessToken.value,hasRefreshTokenWithoutSession:f=>!!f.refreshToken.value&&!f.user&&!f.accessToken.value,noToken:f=>!f.refreshToken.value,noMfaTicket:(f,{ticket:u})=>{var l;return!u&&!((l=f.mfa)!=null&&l.ticket)},hasRefreshToken:f=>!!f.refreshToken.value,isAutoRefreshDisabled:()=>!s,isAutoSignInDisabled:()=>!o,refreshTimerShouldRefresh:f=>f.refreshTimer.elapsed>Math.max((Date.now()-f.accessToken.expiresAt.getTime())/1e3-900,i),unverified:(f,{data:{error:u}})=>u.status===401&&u.message==="Email is not verified",hasSession:(f,u)=>{var l;return!!((l=u.data)!=null&&l.session)},hasMfaTicket:(f,u)=>{var l;return!!((l=u.data)!=null&&l.mfa)},invalidEmail:(f,{email:u})=>!Ke(u),invalidPassword:(f,{password:u})=>!ir(u),invalidPhoneNumber:(f,{phoneNumber:u})=>!go(u)},services:{signInPassword:(f,{email:u,password:l})=>c("/signin/email-password",{email:u,password:l}),signInPasswordlessSms:(f,{phoneNumber:u,options:l})=>c("/signin/passwordless/sms",{phoneNumber:u,options:re(e,l)}),signInPasswordlessSmsOtp:(f,{phoneNumber:u,otp:l})=>c("/signin/passwordless/sms/otp",{phoneNumber:u,otp:l}),signInPasswordlessEmail:(f,{email:u,options:l})=>c("/signin/passwordless/email",{email:u,options:re(e,l)}),signInAnonymous:f=>c("/signin/anonymous"),signInMfaTotp:(f,{ticket:u,otp:l})=>{var d;return c("/signin/mfa/totp",{ticket:u||((d=f.mfa)==null?void 0:d.ticket),otp:l})},refreshToken:async(f,u)=>{let l=u.type==="TRY_TOKEN"?u.token:f.refreshToken.value;return{session:await c("/token",{refreshToken:l})}},signout:(f,u)=>c("/signout",{refreshToken:f.refreshToken.value,all:!!u.all}),registerUser:(f,{email:u,password:l,options:d})=>c("/signup/email-password",{email:u,password:l,options:re(e,d)}),autoSignIn:async()=>{if(typeof window=="undefined"||!window.location)throw Error("window is undefined or location does not exist");let{hash:f}=window.location;if(!f)throw Error("No hash in window.location");let l=new URLSearchParams(f.slice(1)).get("refreshToken");if(!l)throw Error("No refresh token in the location hash");let d=await c("/token",{refreshToken:l});return new _e("nhost").postMessage(l),{session:d}},importRefreshToken:async()=>{let f=await r(St),u=f?new Date(f):null;return{refreshToken:await r(Xt),expiresAt:u}}}})};function sr(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 il={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 cn(t,e){function r(i,s,o){if(typeof document!="undefined"){o=sr({},e,o),typeof o.expires=="number"&&(o.expires=new Date(Date.now()+o.expires*864e5)),o.expires&&(o.expires=o.expires.toUTCString()),i=encodeURIComponent(i).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var a="";for(var c in o)!o[c]||(a+="; "+c,o[c]!==!0&&(a+="="+o[c].split(";")[0]));return document.cookie=i+"="+t.write(s,i)+a}}function n(i){if(!(typeof document=="undefined"||arguments.length&&!i)){for(var s=document.cookie?document.cookie.split("; "):[],o={},a=0;a<s.length;a++){var c=s[a].split("="),f=c.slice(1).join("=");try{var u=decodeURIComponent(c[0]);if(o[u]=t.read(f,u),i===u)break}catch{}}return i?o[i]:o}}return Object.create({set:r,get:n,remove:function(i,s){r(i,"",sr({},s,{expires:-1}))},withAttributes:function(i){return cn(this.converter,sr({},this.attributes,i))},withConverter:function(i){return cn(sr({},this.converter,i),this.attributes)}},{attributes:{value:Object.freeze(e)},converter:{value:Object.freeze(t)}})}var _v=cn(il,{path:"/"});var To=typeof window!="undefined",or=new Map,ar=t=>{var e;return To&&localStorage?localStorage.getItem(t):(e=or.get(t))!=null?e:null},ur=(t,e)=>{To&&localStorage?e?localStorage.setItem(t,e):localStorage.removeItem(t):e?or.set(t,e):or.has(t)&&or.delete(t)};var Rt=class{constructor({backendUrl:e,clientUrl:r=typeof window!="undefined"&&(f=>(f=window.location)==null?void 0:f.origin)()||"",clientStorageGetter:n=ar,clientStorageSetter:i=ur,refreshIntervalTime:s=60,autoSignIn:o=!0,autoRefreshToken:a=!0,start:c=!0}){this._subscriptions=new Set;this.backendUrl=e,this.clientUrl=r,this.machine=bo({backendUrl:e,clientUrl:r,refreshIntervalTime:s,clientStorageGetter:n,clientStorageSetter:i,autoSignIn:o,autoRefreshToken:a}),c&&(this.interpreter=he(this.machine),this.interpreter.start()),typeof window!="undefined"&&o&&(this._channel=new _e("nhost"),this._channel.addEventListener("message",u=>{var d;let l=(d=this.interpreter)==null?void 0:d.state.context.refreshToken;this.interpreter&&u!==l&&this.interpreter.send({type:"TRY_TOKEN",token:u})}))}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 Ro=()=>typeof window!="undefined",Ie=t=>!t||!t.accessToken.value||!t.refreshToken.value?null:{accessToken:t.accessToken.value,accessTokenExpiresIn:(t.accessToken.expiresAt.getTime()-Date.now())/1e3,refreshToken:t.refreshToken.value,user:t.user},Xe=(t,e)=>{e.forEach(r=>{typeof t[r]!="function"&&console.error(`clientStorage.${r} is not a function`)})},Ao=(t,e)=>{if(e){if(t==="react-native"||t==="custom")return Xe(e,["getItem"]),r=>{var n;return(n=e.getItem)==null?void 0:n.call(e,r)};if(t==="capacitor")return Xe(e,["get"]),r=>{var n;return(n=e.get)==null?void 0:n.call(e,{key:r})};if(t==="expo-secure-storage")return Xe(e,["getItemAsync"]),r=>{var n;return(n=e.getItemAsync)==null?void 0:n.call(e,r)}}return ar},Oo=(t,e)=>{if(e){if(t==="react-native"||t==="custom")return Xe(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 Xe(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 Xe(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 ur};var Co={message:"User is already signed in",status:100},ol={message:"User is not authenticated",status:101},al={message:"User is not anonymous",status:101},ul={message:"Email needs verification",status:102},fn=class{constructor({url:e,autoRefreshToken:r=!0,autoLogin:n=!0,clientStorage:i,clientStorageType:s="web",clientStorageGetter:o,clientStorageSetter:a,refreshIntervalTime:c,start:f=!0,Client:u=Rt}){this._client=new u({backendUrl:e,autoRefreshToken:r,autoSignIn:n,start:f,clientStorageGetter:o||Ao(s,i),clientStorageSetter:a||Oo(s,i),refreshIntervalTime:c})}async signUp(e){let r=await this.waitUntilReady(),{email:n,password:i,options:s}=e;return this.isAuthenticated()?{session:null,error:Co}:new Promise(o=>{r.send({type:"SIGNUP_EMAIL_PASSWORD",email:n,password:i,options:s}),r.onTransition(a=>{if(a.matches({authentication:{signedOut:"needsEmailVerification"}}))return o({session:null,error:null});if(a.matches({authentication:{signedOut:"failed"}}))return o({session:null,error:a.context.errors.registration||null});if(a.matches({authentication:"signedIn"}))return o({session:Ie(a.context),error:null})})})}async signIn(e){let r=await this.waitUntilReady();if(this.isAuthenticated())return{session:null,mfa:null,error:Co};if("provider"in e){let{provider:n,options:i}=e,s=yo(`${this._client.backendUrl}/signin/provider/${n}`,re(this._client.clientUrl,i));return Ro()&&(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:Ie(i.context),mfa:null,error:null}):i.matches({authentication:{signedOut:"needsEmailVerification"}})?n({session:null,mfa:null,error:ul}):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:Ie(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"}})&&n({error:i.context.errors.signout||null})})}):{error:ol}}async resetPassword({email:e,options:r}){return new Promise(n=>{let i=he(wo(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=he(So(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=he(xo(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=he(Eo(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 a;if(!this.isAuthenticated()||!((a=r.state.context.user)!=null&&a.isAnonymous))return{error:al};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,...o}=e;r.send({type:"DEANONYMIZE",signInMethod:i,connection:s,options:o})})}onTokenChanged(e){let r=n=>n.onTransition(({event:i,context:s})=>{i.type==="TOKEN_CHANGED"&&e(Ie(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,Ie(s))});if(this._client.interpreter){let n=r(this._client.interpreter);return()=>n.stop()}else return this._client.onStart(n=>{r(n.interpreter)}),()=>{console.log("onAuthStateChanged was added before the interpreter started. Cannot unsubscribe listener.")}}isAuthenticated(){var e;return!!((e=this._client.interpreter)!=null&&e.state.matches({authentication:"signedIn"}))}async isAuthenticatedAsync(){return(await this.waitUntilReady()).state.matches({authentication:"signedIn"})}getAuthenticationStatus(){return this.isReady()?{isAuthenticated:this.isAuthenticated(),isLoading:!1}:{isAuthenticated:!1,isLoading:!0}}getJWTToken(){return this.getAccessToken()}getAccessToken(){var e,r;return(r=(e=this._client.interpreter)==null?void 0:e.state.context.accessToken.value)!=null?r:void 0}async refreshSession(e){try{let r=await this.waitUntilReady();return r.state.matches({token:"idle"})?void 0:new Promise(n=>{let i=e||r.state.context.refreshToken.value;if(!i)return n();r==null||r.onTransition(s=>{(s.matches({token:{idle:"error"}})||s.event.type==="TOKEN_CHANGED")&&n()}),r.send({type:"TRY_TOKEN",token:i})})}catch{return}}getSession(){var e,r;return Ie((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(o=>{if(o.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 Ma=Nt(Ua()),_n=class{constructor({url:e}){this.url=e,this.httpClient=Ma.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 Nn=class{constructor({url:e}){this.url=e,this.api=new _n({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 Hu=Nt(Yn()),Qn=class{constructor(e){let{url:r}=e;this.accessToken=null,this.instance=Hu.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(o){if(o instanceof Error)return{res:null,error:o}}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 Gu=Nt(Yn()),Zn=class{constructor(e){let{url:r}=e;this.url=r,this.accessToken=null,this.instance=Gu.default.create({baseURL:r})}async request(e,r,n){let i={...n==null?void 0:n.headers,...this.generateAccessTokenHeaders()},s="",o;try{o=(await this.instance.post("",{operationName:s||void 0,query:e,variables:r},{...n,headers:i})).data}catch(a){return a instanceof Error?{data:null,error:a}:(console.error(a),{data:null,error:new Error("Unable to get do GraphQL request")})}return typeof o!="object"||Array.isArray(o)||o===null?{data:null,error:new Error("incorrect response data from GraphQL server")}:(o=o,o.errors?{data:null,error:o.errors}:{data:o.data,error:null})}getUrl(){return this.url}setAccessToken(e){if(!e){this.accessToken=null;return}this.accessToken=e}generateAccessTokenHeaders(){if(!!this.accessToken)return{Authorization:`Bearer ${this.accessToken}`}}};var ei=class{constructor({backendUrl:e,refreshIntervalTime:r,clientStorageGetter:n,clientStorageSetter:i,clientStorage:s,clientStorageType:o,autoRefreshToken:a,autoLogin:c,start:f=!0,Client:u}){if(!e)throw new Error("Please specify a `backendUrl`. Docs: [todo]!");this.auth=new fn({url:`${e}/v1/auth`,refreshIntervalTime:r,clientStorageGetter:n,clientStorageSetter:i,clientStorage:s,clientStorageType:o,autoRefreshToken:a,autoLogin:c,start:f,Client:u}),this.storage=new Nn({url:`${e}/v1/storage`}),this.functions=new Qn({url:`${e}/v1/functions`}),this.graphql=new Zn({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((l,d)=>{l==="SIGNED_OUT"&&(this.storage.setAccessToken(void 0),this.functions.setAccessToken(void 0),this.graphql.setAccessToken(void 0))}),this.auth.onTokenChanged(l=>{this.storage.setAccessToken(l==null?void 0:l.accessToken),this.functions.setAccessToken(l==null?void 0:l.accessToken),this.graphql.setAccessToken(l==null?void 0:l.accessToken)})})}};var zg=t=>new ei(t);export{ei as NhostClient,zg as createClient};
|
|
10
10
|
/*! *****************************************************************************
|
|
11
11
|
Copyright (c) Microsoft Corporation.
|
|
12
12
|
|