@nhost/nhost-js 1.1.0 → 1.1.1
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 +24 -24
- package/dist/index.es.js.map +3 -3
- package/package.json +3 -3
package/dist/index.es.js
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
var
|
|
2
|
-
`),function(a){if(s=a.indexOf(":"),n=ln.trim(a.substr(0,s)).toLowerCase(),i=ln.trim(a.substr(s+1)),n){if(r[n]&&df.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 Zs=h((Cm,Qs)=>{"use strict";var Ys=K();Qs.exports=Ys.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=Ys.isString(o)?i(o):o;return a.protocol===n.protocol&&a.host===n.host}}():function(){return function(){return!0}}()});var Nt=h((Pm,eo)=>{"use strict";function fn(t){this.message=t}fn.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")};fn.prototype.__CANCEL__=!0;eo.exports=fn});var pn=h((Nm,to)=>{"use strict";var ur=K(),pf=Bs(),hf=Vs(),vf=an(),mf=Ws(),yf=Xs(),gf=Zs(),dn=cn(),Ef=It(),Sf=Nt();to.exports=function(e){return new Promise(function(n,i){var s=e.data,o=e.headers,a=e.responseType,c;function l(){e.cancelToken&&e.cancelToken.unsubscribe(c),e.signal&&e.signal.removeEventListener("abort",c)}ur.isFormData(s)&&delete o["Content-Type"];var u=new XMLHttpRequest;if(e.auth){var f=e.auth.username||"",d=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";o.Authorization="Basic "+btoa(f+":"+d)}var p=mf(e.baseURL,e.url);u.open(e.method.toUpperCase(),vf(p,e.params,e.paramsSerializer),!0),u.timeout=e.timeout;function y(){if(!!u){var v="getAllResponseHeaders"in u?yf(u.getAllResponseHeaders()):null,x=!a||a==="text"||a==="json"?u.responseText:u.response,g={data:x,status:u.status,statusText:u.statusText,headers:v,config:e,request:u};pf(function(O){n(O),l()},function(O){i(O),l()},g),u=null}}if("onloadend"in u?u.onloadend=y:u.onreadystatechange=function(){!u||u.readyState!==4||u.status===0&&!(u.responseURL&&u.responseURL.indexOf("file:")===0)||setTimeout(y)},u.onabort=function(){!u||(i(dn("Request aborted",e,"ECONNABORTED",u)),u=null)},u.onerror=function(){i(dn("Network Error",e,null,u)),u=null},u.ontimeout=function(){var x=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",g=e.transitional||Ef.transitional;e.timeoutErrorMessage&&(x=e.timeoutErrorMessage),i(dn(x,e,g.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",u)),u=null},ur.isStandardBrowserEnv()){var E=(e.withCredentials||gf(p))&&e.xsrfCookieName?hf.read(e.xsrfCookieName):void 0;E&&(o[e.xsrfHeaderName]=E)}"setRequestHeader"in u&&ur.forEach(o,function(x,g){typeof s=="undefined"&&g.toLowerCase()==="content-type"?delete o[g]:u.setRequestHeader(g,x)}),ur.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(v){!u||(i(!v||v&&v.type?new Sf("canceled"):v),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 It=h((Im,io)=>{"use strict";var H=K(),ro=Us(),wf=un(),xf={"Content-Type":"application/x-www-form-urlencoded"};function no(t,e){!H.isUndefined(t)&&H.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}function Tf(){var t;return typeof XMLHttpRequest!="undefined"?t=pn():typeof process!="undefined"&&Object.prototype.toString.call(process)==="[object process]"&&(t=pn()),t}function bf(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 cr={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:Tf(),transformRequest:[function(e,r){return ro(r,"Accept"),ro(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)?(no(r,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):H.isObject(e)||r&&r["Content-Type"]==="application/json"?(no(r,"application/json"),bf(e)):e}],transformResponse:[function(e){var r=this.transitional||cr.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"?wf(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){cr.headers[e]={}});H.forEach(["post","put","patch"],function(e){cr.headers[e]=H.merge(xf)});io.exports=cr});var oo=h((_m,so)=>{"use strict";var Af=K(),Rf=It();so.exports=function(e,r,n){var i=this||Rf;return Af.forEach(n,function(o){e=o.call(i,e,r)}),e}});var hn=h((km,ao)=>{"use strict";ao.exports=function(e){return!!(e&&e.__CANCEL__)}});var lo=h((Dm,co)=>{"use strict";var uo=K(),vn=oo(),Of=hn(),Cf=It(),Pf=Nt();function mn(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Pf("canceled")}co.exports=function(e){mn(e),e.headers=e.headers||{},e.data=vn.call(e,e.data,e.headers,e.transformRequest),e.headers=uo.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),uo.forEach(["delete","get","head","post","put","patch","common"],function(i){delete e.headers[i]});var r=e.adapter||Cf.adapter;return r(e).then(function(i){return mn(e),i.data=vn.call(e,i.data,i.headers,e.transformResponse),i},function(i){return Of(i)||(mn(e),i&&i.response&&(i.response.data=vn.call(e,i.response.data,i.response.headers,e.transformResponse))),Promise.reject(i)})}});var yn=h((qm,fo)=>{"use strict";var re=K();fo.exports=function(e,r){r=r||{};var n={};function i(u,f){return re.isPlainObject(u)&&re.isPlainObject(f)?re.merge(u,f):re.isPlainObject(f)?re.merge({},f):re.isArray(f)?f.slice():f}function s(u){if(re.isUndefined(r[u])){if(!re.isUndefined(e[u]))return i(void 0,e[u])}else return i(e[u],r[u])}function o(u){if(!re.isUndefined(r[u]))return i(void 0,r[u])}function a(u){if(re.isUndefined(r[u])){if(!re.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 l={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 re.forEach(Object.keys(e).concat(Object.keys(r)),function(f){var d=l[f]||s,p=d(f);re.isUndefined(p)&&d!==c||(n[f]=p)}),n}});var gn=h((Um,po)=>{po.exports={version:"0.25.0"}});var mo=h((Mm,vo)=>{"use strict";var Nf=gn().version,En={};["object","boolean","number","function","string","symbol"].forEach(function(t,e){En[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});var ho={};En.transitional=function(e,r,n){function i(s,o){return"[Axios v"+Nf+"] 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&&!ho[o]&&(ho[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 If(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)}}vo.exports={assertOptions:If,validators:En}});var xo=h((Lm,wo)=>{"use strict";var Eo=K(),_f=an(),yo=Ds(),go=lo(),lr=yn(),So=mo(),Ze=So.validators;function _t(t){this.defaults=t,this.interceptors={request:new yo,response:new yo}}_t.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=lr(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&&So.assertOptions(n,{silentJSONParsing:Ze.transitional(Ze.boolean),forcedJSONParsing:Ze.transitional(Ze.boolean),clarifyTimeoutError:Ze.transitional(Ze.boolean)},!1);var i=[],s=!0;this.interceptors.request.forEach(function(p){typeof p.runWhen=="function"&&p.runWhen(r)===!1||(s=s&&p.synchronous,i.unshift(p.fulfilled,p.rejected))});var o=[];this.interceptors.response.forEach(function(p){o.push(p.fulfilled,p.rejected)});var a;if(!s){var c=[go,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 l=r;i.length;){var u=i.shift(),f=i.shift();try{l=u(l)}catch(d){f(d);break}}try{a=go(l)}catch(d){return Promise.reject(d)}for(;o.length;)a=a.then(o.shift(),o.shift());return a};_t.prototype.getUri=function(e){if(!e.url)throw new Error("Provided config url is not valid");return e=lr(this.defaults,e),_f(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")};Eo.forEach(["delete","get","head","options"],function(e){_t.prototype[e]=function(r,n){return this.request(lr(n||{},{method:e,url:r,data:(n||{}).data}))}});Eo.forEach(["post","put","patch"],function(e){_t.prototype[e]=function(r,n,i){return this.request(lr(i||{},{method:e,url:r,data:n}))}});wo.exports=_t});var bo=h((jm,To)=>{"use strict";var kf=Nt();function et(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 kf(i),e(r.reason))})}et.prototype.throwIfRequested=function(){if(this.reason)throw this.reason};et.prototype.subscribe=function(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]};et.prototype.unsubscribe=function(e){if(!!this._listeners){var r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}};et.source=function(){var e,r=new et(function(i){e=i});return{token:r,cancel:e}};To.exports=et});var Ro=h((Bm,Ao)=>{"use strict";Ao.exports=function(e){return function(n){return e.apply(null,n)}}});var Co=h((Fm,Oo)=>{"use strict";var Df=K();Oo.exports=function(e){return Df.isObject(e)&&e.isAxiosError===!0}});var Io=h((Vm,Sn)=>{"use strict";var Po=K(),qf=tn(),fr=xo(),Uf=yn(),Mf=It();function No(t){var e=new fr(t),r=qf(fr.prototype.request,e);return Po.extend(r,fr.prototype,e),Po.extend(r,e),r.create=function(i){return No(Uf(t,i))},r}var he=No(Mf);he.Axios=fr;he.Cancel=Nt();he.CancelToken=bo();he.isCancel=hn();he.VERSION=gn().version;he.all=function(e){return Promise.all(e)};he.spread=Ro();he.isAxiosError=Co();Sn.exports=he;Sn.exports.default=he});var ko=h((Hm,_o)=>{_o.exports=Io()});var bn=h((Pg,$o)=>{"use strict";$o.exports=function(e,r){return function(){for(var i=new Array(arguments.length),s=0;s<i.length;s++)i[s]=arguments[s];return e.apply(r,i)}}});var X=h((Ng,Xo)=>{"use strict";var zf=bn(),Le=Object.prototype.toString;function On(t){return Le.call(t)==="[object Array]"}function An(t){return typeof t=="undefined"}function $f(t){return t!==null&&!An(t)&&t.constructor!==null&&!An(t.constructor)&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function Wf(t){return Le.call(t)==="[object ArrayBuffer]"}function Kf(t){return typeof FormData!="undefined"&&t instanceof FormData}function Xf(t){var e;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&t.buffer instanceof ArrayBuffer,e}function Yf(t){return typeof t=="string"}function Qf(t){return typeof t=="number"}function Wo(t){return t!==null&&typeof t=="object"}function yr(t){if(Le.call(t)!=="[object Object]")return!1;var e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}function Zf(t){return Le.call(t)==="[object Date]"}function ed(t){return Le.call(t)==="[object File]"}function td(t){return Le.call(t)==="[object Blob]"}function Ko(t){return Le.call(t)==="[object Function]"}function rd(t){return Wo(t)&&Ko(t.pipe)}function nd(t){return typeof URLSearchParams!="undefined"&&t instanceof URLSearchParams}function id(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function sd(){return typeof navigator!="undefined"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window!="undefined"&&typeof document!="undefined"}function Cn(t,e){if(!(t===null||typeof t=="undefined"))if(typeof t!="object"&&(t=[t]),On(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 Rn(){var t={};function e(i,s){yr(t[s])&&yr(i)?t[s]=Rn(t[s],i):yr(i)?t[s]=Rn({},i):On(i)?t[s]=i.slice():t[s]=i}for(var r=0,n=arguments.length;r<n;r++)Cn(arguments[r],e);return t}function od(t,e,r){return Cn(e,function(i,s){r&&typeof i=="function"?t[s]=zf(i,r):t[s]=i}),t}function ad(t){return t.charCodeAt(0)===65279&&(t=t.slice(1)),t}Xo.exports={isArray:On,isArrayBuffer:Wf,isBuffer:$f,isFormData:Kf,isArrayBufferView:Xf,isString:Yf,isNumber:Qf,isObject:Wo,isPlainObject:yr,isUndefined:An,isDate:Zf,isFile:ed,isBlob:td,isFunction:Ko,isStream:rd,isURLSearchParams:nd,isStandardBrowserEnv:sd,forEach:Cn,merge:Rn,extend:od,trim:id,stripBOM:ad}});var Pn=h((Ig,Qo)=>{"use strict";var nt=X();function Yo(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(nt.isURLSearchParams(r))i=r.toString();else{var s=[];nt.forEach(r,function(c,l){c===null||typeof c=="undefined"||(nt.isArray(c)?l=l+"[]":c=[c],nt.forEach(c,function(f){nt.isDate(f)?f=f.toISOString():nt.isObject(f)&&(f=JSON.stringify(f)),s.push(Yo(l)+"="+Yo(f))}))}),i=s.join("&")}if(i){var o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}});var ea=h((_g,Zo)=>{"use strict";var ud=X();function gr(){this.handlers=[]}gr.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};gr.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)};gr.prototype.forEach=function(e){ud.forEach(this.handlers,function(n){n!==null&&e(n)})};Zo.exports=gr});var ra=h((kg,ta)=>{"use strict";var cd=X();ta.exports=function(e,r){cd.forEach(e,function(i,s){s!==r&&s.toUpperCase()===r.toUpperCase()&&(e[r]=i,delete e[s])})}});var Nn=h((Dg,na)=>{"use strict";na.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 In=h((qg,ia)=>{"use strict";var ld=Nn();ia.exports=function(e,r,n,i,s){var o=new Error(e);return ld(o,r,n,i,s)}});var oa=h((Ug,sa)=>{"use strict";var fd=In();sa.exports=function(e,r,n){var i=n.config.validateStatus;!n.status||!i||i(n.status)?e(n):r(fd("Request failed with status code "+n.status,n.config,null,n.request,n))}});var ua=h((Mg,aa)=>{"use strict";var Er=X();aa.exports=Er.isStandardBrowserEnv()?function(){return{write:function(r,n,i,s,o,a){var c=[];c.push(r+"="+encodeURIComponent(n)),Er.isNumber(i)&&c.push("expires="+new Date(i).toGMTString()),Er.isString(s)&&c.push("path="+s),Er.isString(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 la=h((Lg,ca)=>{"use strict";ca.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}});var da=h((jg,fa)=>{"use strict";fa.exports=function(e,r){return r?e.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):e}});var ha=h((Bg,pa)=>{"use strict";var dd=la(),pd=da();pa.exports=function(e,r){return e&&!dd(r)?pd(e,r):r}});var ma=h((Fg,va)=>{"use strict";var _n=X(),hd=["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"];va.exports=function(e){var r={},n,i,s;return e&&_n.forEach(e.split(`
|
|
3
|
-
`),function(a){if(s=a.indexOf(":"),n=_n.trim(a.substr(0,s)).toLowerCase(),i=_n.trim(a.substr(s+1)),n){if(r[n]&&hd.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 Ea=h((Vg,ga)=>{"use strict";var ya=X();ga.exports=ya.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=ya.isString(o)?i(o):o;return a.protocol===n.protocol&&a.host===n.host}}():function(){return function(){return!0}}()});var Dn=h((Hg,Sa)=>{"use strict";var Sr=X(),vd=oa(),md=ua(),yd=Pn(),gd=ha(),Ed=ma(),Sd=Ea(),kn=In();Sa.exports=function(e){return new Promise(function(n,i){var s=e.data,o=e.headers,a=e.responseType;Sr.isFormData(s)&&delete o["Content-Type"];var c=new XMLHttpRequest;if(e.auth){var l=e.auth.username||"",u=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";o.Authorization="Basic "+btoa(l+":"+u)}var f=gd(e.baseURL,e.url);c.open(e.method.toUpperCase(),yd(f,e.params,e.paramsSerializer),!0),c.timeout=e.timeout;function d(){if(!!c){var y="getAllResponseHeaders"in c?Ed(c.getAllResponseHeaders()):null,E=!a||a==="text"||a==="json"?c.responseText:c.response,v={data:E,status:c.status,statusText:c.statusText,headers:y,config:e,request:c};vd(n,i,v),c=null}}if("onloadend"in c?c.onloadend=d:c.onreadystatechange=function(){!c||c.readyState!==4||c.status===0&&!(c.responseURL&&c.responseURL.indexOf("file:")===0)||setTimeout(d)},c.onabort=function(){!c||(i(kn("Request aborted",e,"ECONNABORTED",c)),c=null)},c.onerror=function(){i(kn("Network Error",e,null,c)),c=null},c.ontimeout=function(){var E="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(E=e.timeoutErrorMessage),i(kn(E,e,e.transitional&&e.transitional.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",c)),c=null},Sr.isStandardBrowserEnv()){var p=(e.withCredentials||Sd(f))&&e.xsrfCookieName?md.read(e.xsrfCookieName):void 0;p&&(o[e.xsrfHeaderName]=p)}"setRequestHeader"in c&&Sr.forEach(o,function(E,v){typeof s=="undefined"&&v.toLowerCase()==="content-type"?delete o[v]:c.setRequestHeader(v,E)}),Sr.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 xr=h((Gg,Ta)=>{"use strict";var G=X(),wa=ra(),wd=Nn(),xd={"Content-Type":"application/x-www-form-urlencoded"};function xa(t,e){!G.isUndefined(t)&&G.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}function Td(){var t;return typeof XMLHttpRequest!="undefined"?t=Dn():typeof process!="undefined"&&Object.prototype.toString.call(process)==="[object process]"&&(t=Dn()),t}function bd(t,e,r){if(G.isString(t))try{return(e||JSON.parse)(t),G.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}var wr={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:Td(),transformRequest:[function(e,r){return wa(r,"Accept"),wa(r,"Content-Type"),G.isFormData(e)||G.isArrayBuffer(e)||G.isBuffer(e)||G.isStream(e)||G.isFile(e)||G.isBlob(e)?e:G.isArrayBufferView(e)?e.buffer:G.isURLSearchParams(e)?(xa(r,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):G.isObject(e)||r&&r["Content-Type"]==="application/json"?(xa(r,"application/json"),bd(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&&G.isString(e)&&e.length)try{return JSON.parse(e)}catch(o){if(s)throw o.name==="SyntaxError"?wd(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}};wr.headers={common:{Accept:"application/json, text/plain, */*"}};G.forEach(["delete","get","head"],function(e){wr.headers[e]={}});G.forEach(["post","put","patch"],function(e){wr.headers[e]=G.merge(xd)});Ta.exports=wr});var Aa=h((Jg,ba)=>{"use strict";var Ad=X(),Rd=xr();ba.exports=function(e,r,n){var i=this||Rd;return Ad.forEach(n,function(o){e=o.call(i,e,r)}),e}});var qn=h((zg,Ra)=>{"use strict";Ra.exports=function(e){return!!(e&&e.__CANCEL__)}});var Pa=h(($g,Ca)=>{"use strict";var Oa=X(),Un=Aa(),Od=qn(),Cd=xr();function Mn(t){t.cancelToken&&t.cancelToken.throwIfRequested()}Ca.exports=function(e){Mn(e),e.headers=e.headers||{},e.data=Un.call(e,e.data,e.headers,e.transformRequest),e.headers=Oa.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),Oa.forEach(["delete","get","head","post","put","patch","common"],function(i){delete e.headers[i]});var r=e.adapter||Cd.adapter;return r(e).then(function(i){return Mn(e),i.data=Un.call(e,i.data,i.headers,e.transformResponse),i},function(i){return Od(i)||(Mn(e),i&&i.response&&(i.response.data=Un.call(e,i.response.data,i.response.headers,e.transformResponse))),Promise.reject(i)})}});var Ln=h((Wg,Na)=>{"use strict";var W=X();Na.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,p){return W.isPlainObject(d)&&W.isPlainObject(p)?W.merge(d,p):W.isPlainObject(p)?W.merge({},p):W.isArray(p)?p.slice():p}function l(d){W.isUndefined(r[d])?W.isUndefined(e[d])||(n[d]=c(void 0,e[d])):n[d]=c(e[d],r[d])}W.forEach(i,function(p){W.isUndefined(r[p])||(n[p]=c(void 0,r[p]))}),W.forEach(s,l),W.forEach(o,function(p){W.isUndefined(r[p])?W.isUndefined(e[p])||(n[p]=c(void 0,e[p])):n[p]=c(void 0,r[p])}),W.forEach(a,function(p){p in r?n[p]=c(e[p],r[p]):p in e&&(n[p]=c(void 0,e[p]))});var u=i.concat(s).concat(o).concat(a),f=Object.keys(e).concat(Object.keys(r)).filter(function(p){return u.indexOf(p)===-1});return W.forEach(f,l),n}});var Ia=h((Kg,Pd)=>{Pd.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 Ua=h((Xg,qa)=>{"use strict";var ka=Ia(),jn={};["object","boolean","number","function","string","symbol"].forEach(function(t,e){jn[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});var _a={},Nd=ka.version.split(".");function Da(t,e){for(var r=e?e.split("."):Nd,n=t.split("."),i=0;i<3;i++){if(r[i]>n[i])return!0;if(r[i]<n[i])return!1}return!1}jn.transitional=function(e,r,n){var i=r&&Da(r);function s(o,a){return"[Axios v"+ka.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&&!_a[a]&&(_a[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 Id(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)}}qa.exports={isOlderVersion:Da,assertOptions:Id,validators:jn}});var Va=h((Yg,Fa)=>{"use strict";var ja=X(),_d=Pn(),Ma=ea(),La=Pa(),Tr=Ln(),Ba=Ua(),it=Ba.validators;function Dt(t){this.defaults=t,this.interceptors={request:new Ma,response:new Ma}}Dt.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&&Ba.assertOptions(r,{silentJSONParsing:it.transitional(it.boolean,"1.0.0"),forcedJSONParsing:it.transitional(it.boolean,"1.0.0"),clarifyTimeoutError:it.transitional(it.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=[La,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 l=n.shift(),u=n.shift();try{c=l(c)}catch(f){u(f);break}}try{o=La(c)}catch(f){return Promise.reject(f)}for(;s.length;)o=o.then(s.shift(),s.shift());return o};Dt.prototype.getUri=function(e){return e=Tr(this.defaults,e),_d(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")};ja.forEach(["delete","get","head","options"],function(e){Dt.prototype[e]=function(r,n){return this.request(Tr(n||{},{method:e,url:r,data:(n||{}).data}))}});ja.forEach(["post","put","patch"],function(e){Dt.prototype[e]=function(r,n,i){return this.request(Tr(i||{},{method:e,url:r,data:n}))}});Fa.exports=Dt});var Fn=h((Qg,Ha)=>{"use strict";function Bn(t){this.message=t}Bn.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")};Bn.prototype.__CANCEL__=!0;Ha.exports=Bn});var Ja=h((Zg,Ga)=>{"use strict";var kd=Fn();function br(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 kd(i),e(r.reason))})}br.prototype.throwIfRequested=function(){if(this.reason)throw this.reason};br.source=function(){var e,r=new br(function(i){e=i});return{token:r,cancel:e}};Ga.exports=br});var $a=h((eE,za)=>{"use strict";za.exports=function(e){return function(n){return e.apply(null,n)}}});var Ka=h((tE,Wa)=>{"use strict";Wa.exports=function(e){return typeof e=="object"&&e.isAxiosError===!0}});var Qa=h((rE,Vn)=>{"use strict";var Xa=X(),Dd=bn(),Ar=Va(),qd=Ln(),Ud=xr();function Ya(t){var e=new Ar(t),r=Dd(Ar.prototype.request,e);return Xa.extend(r,Ar.prototype,e),Xa.extend(r,e),r}var ue=Ya(Ud);ue.Axios=Ar;ue.create=function(e){return Ya(qd(ue.defaults,e))};ue.Cancel=Fn();ue.CancelToken=Ja();ue.isCancel=qn();ue.all=function(e){return Promise.all(e)};ue.spread=$a();ue.isAxiosError=Ka();Vn.exports=ue;Vn.exports.default=ue});var eu=h((nE,Za)=>{Za.exports=Qa()});var Jn=h((dE,ru)=>{"use strict";ru.exports=function(e,r){return function(){for(var i=new Array(arguments.length),s=0;s<i.length;s++)i[s]=arguments[s];return e.apply(r,i)}}});var Y=h((pE,su)=>{"use strict";var Md=Jn(),je=Object.prototype.toString;function Wn(t){return je.call(t)==="[object Array]"}function zn(t){return typeof t=="undefined"}function Ld(t){return t!==null&&!zn(t)&&t.constructor!==null&&!zn(t.constructor)&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function jd(t){return je.call(t)==="[object ArrayBuffer]"}function Bd(t){return typeof FormData!="undefined"&&t instanceof FormData}function Fd(t){var e;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&t.buffer instanceof ArrayBuffer,e}function Vd(t){return typeof t=="string"}function Hd(t){return typeof t=="number"}function nu(t){return t!==null&&typeof t=="object"}function Rr(t){if(je.call(t)!=="[object Object]")return!1;var e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}function Gd(t){return je.call(t)==="[object Date]"}function Jd(t){return je.call(t)==="[object File]"}function zd(t){return je.call(t)==="[object Blob]"}function iu(t){return je.call(t)==="[object Function]"}function $d(t){return nu(t)&&iu(t.pipe)}function Wd(t){return typeof URLSearchParams!="undefined"&&t instanceof URLSearchParams}function Kd(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function Xd(){return typeof navigator!="undefined"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window!="undefined"&&typeof document!="undefined"}function Kn(t,e){if(!(t===null||typeof t=="undefined"))if(typeof t!="object"&&(t=[t]),Wn(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 $n(){var t={};function e(i,s){Rr(t[s])&&Rr(i)?t[s]=$n(t[s],i):Rr(i)?t[s]=$n({},i):Wn(i)?t[s]=i.slice():t[s]=i}for(var r=0,n=arguments.length;r<n;r++)Kn(arguments[r],e);return t}function Yd(t,e,r){return Kn(e,function(i,s){r&&typeof i=="function"?t[s]=Md(i,r):t[s]=i}),t}function Qd(t){return t.charCodeAt(0)===65279&&(t=t.slice(1)),t}su.exports={isArray:Wn,isArrayBuffer:jd,isBuffer:Ld,isFormData:Bd,isArrayBufferView:Fd,isString:Vd,isNumber:Hd,isObject:nu,isPlainObject:Rr,isUndefined:zn,isDate:Gd,isFile:Jd,isBlob:zd,isFunction:iu,isStream:$d,isURLSearchParams:Wd,isStandardBrowserEnv:Xd,forEach:Kn,merge:$n,extend:Yd,trim:Kd,stripBOM:Qd}});var Xn=h((hE,au)=>{"use strict";var st=Y();function ou(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}au.exports=function(e,r,n){if(!r)return e;var i;if(n)i=n(r);else if(st.isURLSearchParams(r))i=r.toString();else{var s=[];st.forEach(r,function(c,l){c===null||typeof c=="undefined"||(st.isArray(c)?l=l+"[]":c=[c],st.forEach(c,function(f){st.isDate(f)?f=f.toISOString():st.isObject(f)&&(f=JSON.stringify(f)),s.push(ou(l)+"="+ou(f))}))}),i=s.join("&")}if(i){var o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}});var cu=h((vE,uu)=>{"use strict";var Zd=Y();function Or(){this.handlers=[]}Or.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};Or.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)};Or.prototype.forEach=function(e){Zd.forEach(this.handlers,function(n){n!==null&&e(n)})};uu.exports=Or});var fu=h((mE,lu)=>{"use strict";var ep=Y();lu.exports=function(e,r){ep.forEach(e,function(i,s){s!==r&&s.toUpperCase()===r.toUpperCase()&&(e[r]=i,delete e[s])})}});var Yn=h((yE,du)=>{"use strict";du.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 Qn=h((gE,pu)=>{"use strict";var tp=Yn();pu.exports=function(e,r,n,i,s){var o=new Error(e);return tp(o,r,n,i,s)}});var vu=h((EE,hu)=>{"use strict";var rp=Qn();hu.exports=function(e,r,n){var i=n.config.validateStatus;!n.status||!i||i(n.status)?e(n):r(rp("Request failed with status code "+n.status,n.config,null,n.request,n))}});var yu=h((SE,mu)=>{"use strict";var Cr=Y();mu.exports=Cr.isStandardBrowserEnv()?function(){return{write:function(r,n,i,s,o,a){var c=[];c.push(r+"="+encodeURIComponent(n)),Cr.isNumber(i)&&c.push("expires="+new Date(i).toGMTString()),Cr.isString(s)&&c.push("path="+s),Cr.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 Eu=h((wE,gu)=>{"use strict";gu.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}});var wu=h((xE,Su)=>{"use strict";Su.exports=function(e,r){return r?e.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):e}});var Tu=h((TE,xu)=>{"use strict";var np=Eu(),ip=wu();xu.exports=function(e,r){return e&&!np(r)?ip(e,r):r}});var Au=h((bE,bu)=>{"use strict";var Zn=Y(),sp=["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"];bu.exports=function(e){var r={},n,i,s;return e&&Zn.forEach(e.split(`
|
|
4
|
-
`),function(a){if(s=a.indexOf(":"),n=Zn.trim(a.substr(0,s)).toLowerCase(),i=Zn.trim(a.substr(s+1)),n){if(r[n]&&sp.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 Cu=h((AE,Ou)=>{"use strict";var Ru=Y();Ou.exports=Ru.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=Ru.isString(o)?i(o):o;return a.protocol===n.protocol&&a.host===n.host}}():function(){return function(){return!0}}()});var qt=h((RE,Pu)=>{"use strict";function ei(t){this.message=t}ei.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")};ei.prototype.__CANCEL__=!0;Pu.exports=ei});var ri=h((OE,Nu)=>{"use strict";var Pr=Y(),op=vu(),ap=yu(),up=Xn(),cp=Tu(),lp=Au(),fp=Cu(),ti=Qn(),dp=Ut(),pp=qt();Nu.exports=function(e){return new Promise(function(n,i){var s=e.data,o=e.headers,a=e.responseType,c;function l(){e.cancelToken&&e.cancelToken.unsubscribe(c),e.signal&&e.signal.removeEventListener("abort",c)}Pr.isFormData(s)&&delete o["Content-Type"];var u=new XMLHttpRequest;if(e.auth){var f=e.auth.username||"",d=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";o.Authorization="Basic "+btoa(f+":"+d)}var p=cp(e.baseURL,e.url);u.open(e.method.toUpperCase(),up(p,e.params,e.paramsSerializer),!0),u.timeout=e.timeout;function y(){if(!!u){var v="getAllResponseHeaders"in u?lp(u.getAllResponseHeaders()):null,x=!a||a==="text"||a==="json"?u.responseText:u.response,g={data:x,status:u.status,statusText:u.statusText,headers:v,config:e,request:u};op(function(O){n(O),l()},function(O){i(O),l()},g),u=null}}if("onloadend"in u?u.onloadend=y:u.onreadystatechange=function(){!u||u.readyState!==4||u.status===0&&!(u.responseURL&&u.responseURL.indexOf("file:")===0)||setTimeout(y)},u.onabort=function(){!u||(i(ti("Request aborted",e,"ECONNABORTED",u)),u=null)},u.onerror=function(){i(ti("Network Error",e,null,u)),u=null},u.ontimeout=function(){var x=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",g=e.transitional||dp.transitional;e.timeoutErrorMessage&&(x=e.timeoutErrorMessage),i(ti(x,e,g.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",u)),u=null},Pr.isStandardBrowserEnv()){var E=(e.withCredentials||fp(p))&&e.xsrfCookieName?ap.read(e.xsrfCookieName):void 0;E&&(o[e.xsrfHeaderName]=E)}"setRequestHeader"in u&&Pr.forEach(o,function(x,g){typeof s=="undefined"&&g.toLowerCase()==="content-type"?delete o[g]:u.setRequestHeader(g,x)}),Pr.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(v){!u||(i(!v||v&&v.type?new pp("canceled"):v),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 Ut=h((CE,ku)=>{"use strict";var J=Y(),Iu=fu(),hp=Yn(),vp={"Content-Type":"application/x-www-form-urlencoded"};function _u(t,e){!J.isUndefined(t)&&J.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}function mp(){var t;return typeof XMLHttpRequest!="undefined"?t=ri():typeof process!="undefined"&&Object.prototype.toString.call(process)==="[object process]"&&(t=ri()),t}function yp(t,e,r){if(J.isString(t))try{return(e||JSON.parse)(t),J.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}var Nr={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:mp(),transformRequest:[function(e,r){return Iu(r,"Accept"),Iu(r,"Content-Type"),J.isFormData(e)||J.isArrayBuffer(e)||J.isBuffer(e)||J.isStream(e)||J.isFile(e)||J.isBlob(e)?e:J.isArrayBufferView(e)?e.buffer:J.isURLSearchParams(e)?(_u(r,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):J.isObject(e)||r&&r["Content-Type"]==="application/json"?(_u(r,"application/json"),yp(e)):e}],transformResponse:[function(e){var r=this.transitional||Nr.transitional,n=r&&r.silentJSONParsing,i=r&&r.forcedJSONParsing,s=!n&&this.responseType==="json";if(s||i&&J.isString(e)&&e.length)try{return JSON.parse(e)}catch(o){if(s)throw o.name==="SyntaxError"?hp(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, */*"}}};J.forEach(["delete","get","head"],function(e){Nr.headers[e]={}});J.forEach(["post","put","patch"],function(e){Nr.headers[e]=J.merge(vp)});ku.exports=Nr});var qu=h((PE,Du)=>{"use strict";var gp=Y(),Ep=Ut();Du.exports=function(e,r,n){var i=this||Ep;return gp.forEach(n,function(o){e=o.call(i,e,r)}),e}});var ni=h((NE,Uu)=>{"use strict";Uu.exports=function(e){return!!(e&&e.__CANCEL__)}});var ju=h((IE,Lu)=>{"use strict";var Mu=Y(),ii=qu(),Sp=ni(),wp=Ut(),xp=qt();function si(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new xp("canceled")}Lu.exports=function(e){si(e),e.headers=e.headers||{},e.data=ii.call(e,e.data,e.headers,e.transformRequest),e.headers=Mu.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),Mu.forEach(["delete","get","head","post","put","patch","common"],function(i){delete e.headers[i]});var r=e.adapter||wp.adapter;return r(e).then(function(i){return si(e),i.data=ii.call(e,i.data,i.headers,e.transformResponse),i},function(i){return Sp(i)||(si(e),i&&i.response&&(i.response.data=ii.call(e,i.response.data,i.response.headers,e.transformResponse))),Promise.reject(i)})}});var oi=h((_E,Bu)=>{"use strict";var ne=Y();Bu.exports=function(e,r){r=r||{};var n={};function i(u,f){return ne.isPlainObject(u)&&ne.isPlainObject(f)?ne.merge(u,f):ne.isPlainObject(f)?ne.merge({},f):ne.isArray(f)?f.slice():f}function s(u){if(ne.isUndefined(r[u])){if(!ne.isUndefined(e[u]))return i(void 0,e[u])}else return i(e[u],r[u])}function o(u){if(!ne.isUndefined(r[u]))return i(void 0,r[u])}function a(u){if(ne.isUndefined(r[u])){if(!ne.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 l={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 ne.forEach(Object.keys(e).concat(Object.keys(r)),function(f){var d=l[f]||s,p=d(f);ne.isUndefined(p)&&d!==c||(n[f]=p)}),n}});var ai=h((kE,Fu)=>{Fu.exports={version:"0.23.0"}});var Gu=h((DE,Hu)=>{"use strict";var Tp=ai().version,ui={};["object","boolean","number","function","string","symbol"].forEach(function(t,e){ui[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});var Vu={};ui.transitional=function(e,r,n){function i(s,o){return"[Axios v"+Tp+"] 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&&!Vu[o]&&(Vu[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 bp(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)}}Hu.exports={assertOptions:bp,validators:ui}});var Xu=h((qE,Ku)=>{"use strict";var $u=Y(),Ap=Xn(),Ju=cu(),zu=ju(),Ir=oi(),Wu=Gu(),ot=Wu.validators;function Mt(t){this.defaults=t,this.interceptors={request:new Ju,response:new Ju}}Mt.prototype.request=function(e){typeof e=="string"?(e=arguments[1]||{},e.url=arguments[0]):e=e||{},e=Ir(this.defaults,e),e.method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var r=e.transitional;r!==void 0&&Wu.assertOptions(r,{silentJSONParsing:ot.transitional(ot.boolean),forcedJSONParsing:ot.transitional(ot.boolean),clarifyTimeoutError:ot.transitional(ot.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=[zu,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 l=n.shift(),u=n.shift();try{c=l(c)}catch(f){u(f);break}}try{o=zu(c)}catch(f){return Promise.reject(f)}for(;s.length;)o=o.then(s.shift(),s.shift());return o};Mt.prototype.getUri=function(e){return e=Ir(this.defaults,e),Ap(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")};$u.forEach(["delete","get","head","options"],function(e){Mt.prototype[e]=function(r,n){return this.request(Ir(n||{},{method:e,url:r,data:(n||{}).data}))}});$u.forEach(["post","put","patch"],function(e){Mt.prototype[e]=function(r,n,i){return this.request(Ir(i||{},{method:e,url:r,data:n}))}});Ku.exports=Mt});var Qu=h((UE,Yu)=>{"use strict";var Rp=qt();function at(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 Rp(i),e(r.reason))})}at.prototype.throwIfRequested=function(){if(this.reason)throw this.reason};at.prototype.subscribe=function(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]};at.prototype.unsubscribe=function(e){if(!!this._listeners){var r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}};at.source=function(){var e,r=new at(function(i){e=i});return{token:r,cancel:e}};Yu.exports=at});var ec=h((ME,Zu)=>{"use strict";Zu.exports=function(e){return function(n){return e.apply(null,n)}}});var rc=h((LE,tc)=>{"use strict";tc.exports=function(e){return typeof e=="object"&&e.isAxiosError===!0}});var sc=h((jE,ci)=>{"use strict";var nc=Y(),Op=Jn(),_r=Xu(),Cp=oi(),Pp=Ut();function ic(t){var e=new _r(t),r=Op(_r.prototype.request,e);return nc.extend(r,_r.prototype,e),nc.extend(r,e),r.create=function(i){return ic(Cp(t,i))},r}var ve=ic(Pp);ve.Axios=_r;ve.Cancel=qt();ve.CancelToken=Qu();ve.isCancel=ni();ve.VERSION=ai().version;ve.all=function(e){return Promise.all(e)};ve.spread=ec();ve.isAxiosError=rc();ci.exports=ve;ci.exports.default=ve});var li=h((BE,oc)=>{oc.exports=sc()});var di=h(kr=>{"use strict";Object.defineProperty(kr,"__esModule",{value:!0});kr.default=void 0;var Np=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):void 0,Ip=Np;kr.default=Ip});var cc=h(pi=>{"use strict";Object.defineProperty(pi,"__esModule",{value:!0});pi.default=qp;var _p=kp(di());function kp(t){return t&&t.__esModule?t:{default:t}}function Dr(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Dr=function(r){return typeof r}:Dr=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Dr(t)}var Dp=10,uc=2;function qp(t){return qr(t,[])}function qr(t,e){switch(Dr(t)){case"string":return JSON.stringify(t);case"function":return t.name?"[function ".concat(t.name,"]"):"[function]";case"object":return t===null?"null":Up(t,e);default:return String(t)}}function Up(t,e){if(e.indexOf(t)!==-1)return"[Circular]";var r=[].concat(e,[t]),n=jp(t);if(n!==void 0){var i=n.call(t);if(i!==t)return typeof i=="string"?i:qr(i,r)}else if(Array.isArray(t))return Lp(t,r);return Mp(t,r)}function Mp(t,e){var r=Object.keys(t);if(r.length===0)return"{}";if(e.length>uc)return"["+Bp(t)+"]";var n=r.map(function(i){var s=qr(t[i],e);return i+": "+s});return"{ "+n.join(", ")+" }"}function Lp(t,e){if(t.length===0)return"[]";if(e.length>uc)return"[Array]";for(var r=Math.min(Dp,t.length),n=t.length-r,i=[],s=0;s<r;++s)i.push(qr(t[s],e));return n===1?i.push("... 1 more item"):n>1&&i.push("... ".concat(n," more items")),"["+i.join(", ")+"]"}function jp(t){var e=t[String(_p.default)];if(typeof e=="function")return e;if(typeof t.inspect=="function")return t.inspect}function Bp(t){var e=Object.prototype.toString.call(t).replace(/^\[object /,"").replace(/]$/,"");if(e==="Object"&&typeof t.constructor=="function"){var r=t.constructor.name;if(typeof r=="string"&&r!=="")return r}return e}});var lc=h(hi=>{"use strict";Object.defineProperty(hi,"__esModule",{value:!0});hi.default=Fp;function Fp(t,e){var r=Boolean(t);if(!r)throw new Error(e!=null?e:"Unexpected invariant triggered.")}});var pc=h(vi=>{"use strict";Object.defineProperty(vi,"__esModule",{value:!0});vi.default=Hp;var Vp=dc(lc()),fc=dc(di());function dc(t){return t&&t.__esModule?t:{default:t}}function Hp(t){var e=t.prototype.toJSON;typeof e=="function"||(0,Vp.default)(0),t.prototype.inspect=e,fc.default&&(t.prototype[fc.default]=e)}});var yc=h(Be=>{"use strict";Object.defineProperty(Be,"__esModule",{value:!0});Be.isNode=Jp;Be.Token=Be.Location=void 0;var hc=Gp(pc());function Gp(t){return t&&t.__esModule?t:{default:t}}var vc=function(){function t(r,n,i){this.start=r.start,this.end=n.end,this.startToken=r,this.endToken=n,this.source=i}var e=t.prototype;return e.toJSON=function(){return{start:this.start,end:this.end}},t}();Be.Location=vc;(0,hc.default)(vc);var mc=function(){function t(r,n,i,s,o,a,c){this.kind=r,this.start=n,this.end=i,this.line=s,this.column=o,this.value=c,this.prev=a,this.next=null}var e=t.prototype;return e.toJSON=function(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}},t}();Be.Token=mc;(0,hc.default)(mc);function Jp(t){return t!=null&&typeof t.kind=="string"}});var Sc=h(Ee=>{"use strict";Object.defineProperty(Ee,"__esModule",{value:!0});Ee.visit=Wp;Ee.visitInParallel=Kp;Ee.getVisitFn=Ur;Ee.BREAK=Ee.QueryDocumentKeys=void 0;var zp=$p(cc()),gc=yc();function $p(t){return t&&t.__esModule?t:{default:t}}var Ec={Name:[],Document:["definitions"],OperationDefinition:["name","variableDefinitions","directives","selectionSet"],VariableDefinition:["variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["description","directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","interfaces","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","locations"],SchemaExtension:["directives","operationTypes"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","interfaces","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"]};Ee.QueryDocumentKeys=Ec;var ut=Object.freeze({});Ee.BREAK=ut;function Wp(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ec,n=void 0,i=Array.isArray(t),s=[t],o=-1,a=[],c=void 0,l=void 0,u=void 0,f=[],d=[],p=t;do{o++;var y=o===s.length,E=y&&a.length!==0;if(y){if(l=d.length===0?void 0:f[f.length-1],c=u,u=d.pop(),E){if(i)c=c.slice();else{for(var v={},x=0,g=Object.keys(c);x<g.length;x++){var T=g[x];v[T]=c[T]}c=v}for(var O=0,N=0;N<a.length;N++){var L=a[N][0],b=a[N][1];i&&(L-=O),i&&b===null?(c.splice(L,1),O++):c[L]=b}}o=n.index,s=n.keys,a=n.edits,i=n.inArray,n=n.prev}else{if(l=u?i?o:s[o]:void 0,c=u?u[l]:p,c==null)continue;u&&f.push(l)}var w=void 0;if(!Array.isArray(c)){if(!(0,gc.isNode)(c))throw new Error("Invalid AST Node: ".concat((0,zp.default)(c),"."));var A=Ur(e,c.kind,y);if(A){if(w=A.call(e,c,l,u,f,d),w===ut)break;if(w===!1){if(!y){f.pop();continue}}else if(w!==void 0&&(a.push([l,w]),!y))if((0,gc.isNode)(w))c=w;else{f.pop();continue}}}if(w===void 0&&E&&a.push([l,c]),y)f.pop();else{var q;n={inArray:i,index:o,keys:s,edits:a,prev:n},i=Array.isArray(c),s=i?c:(q=r[c.kind])!==null&&q!==void 0?q:[],o=-1,a=[],u&&d.push(u),u=c}}while(n!==void 0);return a.length!==0&&(p=a[a.length-1][1]),p}function Kp(t){var e=new Array(t.length);return{enter:function(n){for(var i=0;i<t.length;i++)if(e[i]==null){var s=Ur(t[i],n.kind,!1);if(s){var o=s.apply(t[i],arguments);if(o===!1)e[i]=n;else if(o===ut)e[i]=ut;else if(o!==void 0)return o}}},leave:function(n){for(var i=0;i<t.length;i++)if(e[i]==null){var s=Ur(t[i],n.kind,!0);if(s){var o=s.apply(t[i],arguments);if(o===ut)e[i]=ut;else if(o!==void 0&&o!==!1)return o}}else e[i]===n&&(e[i]=null)}}}function Ur(t,e,r){var n=t[e];if(n){if(!r&&typeof n=="function")return n;var i=r?n.leave:n.enter;if(typeof i=="function")return i}else{var s=r?t.leave:t.enter;if(s){if(typeof s=="function")return s;var o=s[e];if(typeof o=="function")return o}}}});var Tc=h(Lt=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:!0});Lt.dedentBlockStringValue=Xp;Lt.getBlockStringIndentation=xc;Lt.printBlockString=Yp;function Xp(t){var e=t.split(/\r\n|[\n\r]/g),r=xc(t);if(r!==0)for(var n=1;n<e.length;n++)e[n]=e[n].slice(r);for(var i=0;i<e.length&&wc(e[i]);)++i;for(var s=e.length;s>i&&wc(e[s-1]);)--s;return e.slice(i,s).join(`
|
|
5
|
-
`)}function
|
|
6
|
-
`)===-1,i=t[0]===" "||t[0]===" ",s=t[t.length-1]==='"',
|
|
1
|
+
var Yu=Object.create;var Pr=Object.defineProperty;var Qu=Object.getOwnPropertyDescriptor;var Zu=Object.getOwnPropertyNames;var ec=Object.getPrototypeOf,tc=Object.prototype.hasOwnProperty;var rc=t=>Pr(t,"__esModule",{value:!0});var p=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var nc=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Zu(e))!tc.call(t,i)&&(r||i!=="default")&&Pr(t,i,{get:()=>e[i],enumerable:!(n=Qu(e,i))||n.enumerable});return t},nt=(t,e)=>nc(rc(Pr(t!=null?Yu(ec(t)):{},"default",!e&&t&&t.__esModule?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var Hr=p((dp,$i)=>{"use strict";$i.exports=function(e,r){return function(){for(var i=new Array(arguments.length),s=0;s<i.length;s++)i[s]=arguments[s];return e.apply(r,i)}}});var K=p((hp,Yi)=>{"use strict";var yc=Hr(),Se=Object.prototype.toString;function zr(t){return Array.isArray(t)}function Gr(t){return typeof t=="undefined"}function gc(t){return t!==null&&!Gr(t)&&t.constructor!==null&&!Gr(t.constructor)&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function Wi(t){return Se.call(t)==="[object ArrayBuffer]"}function Ec(t){return Se.call(t)==="[object FormData]"}function Sc(t){var e;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&Wi(t.buffer),e}function wc(t){return typeof t=="string"}function xc(t){return typeof t=="number"}function Ki(t){return t!==null&&typeof t=="object"}function Xt(t){if(Se.call(t)!=="[object Object]")return!1;var e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}function Tc(t){return Se.call(t)==="[object Date]"}function bc(t){return Se.call(t)==="[object File]"}function Ac(t){return Se.call(t)==="[object Blob]"}function Xi(t){return Se.call(t)==="[object Function]"}function Rc(t){return Ki(t)&&Xi(t.pipe)}function Oc(t){return Se.call(t)==="[object URLSearchParams]"}function Cc(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function Pc(){return typeof navigator!="undefined"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window!="undefined"&&typeof document!="undefined"}function $r(t,e){if(!(t===null||typeof t=="undefined"))if(typeof t!="object"&&(t=[t]),zr(t))for(var r=0,n=t.length;r<n;r++)e.call(null,t[r],r,t);else for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.call(null,t[i],i,t)}function Jr(){var t={};function e(i,s){Xt(t[s])&&Xt(i)?t[s]=Jr(t[s],i):Xt(i)?t[s]=Jr({},i):zr(i)?t[s]=i.slice():t[s]=i}for(var r=0,n=arguments.length;r<n;r++)$r(arguments[r],e);return t}function Nc(t,e,r){return $r(e,function(i,s){r&&typeof i=="function"?t[s]=yc(i,r):t[s]=i}),t}function Ic(t){return t.charCodeAt(0)===65279&&(t=t.slice(1)),t}Yi.exports={isArray:zr,isArrayBuffer:Wi,isBuffer:gc,isFormData:Ec,isArrayBufferView:Sc,isString:wc,isNumber:xc,isObject:Ki,isPlainObject:Xt,isUndefined:Gr,isDate:Tc,isFile:bc,isBlob:Ac,isFunction:Xi,isStream:Rc,isURLSearchParams:Oc,isStandardBrowserEnv:Pc,forEach:$r,merge:Jr,extend:Nc,trim:Cc,stripBOM:Ic}});var Wr=p((pp,Zi)=>{"use strict";var ze=K();function Qi(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}Zi.exports=function(e,r,n){if(!r)return e;var i;if(n)i=n(r);else if(ze.isURLSearchParams(r))i=r.toString();else{var s=[];ze.forEach(r,function(c,l){c===null||typeof c=="undefined"||(ze.isArray(c)?l=l+"[]":c=[c],ze.forEach(c,function(f){ze.isDate(f)?f=f.toISOString():ze.isObject(f)&&(f=JSON.stringify(f)),s.push(Qi(l)+"="+Qi(f))}))}),i=s.join("&")}if(i){var a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}});var ts=p((vp,es)=>{"use strict";var kc=K();function Yt(){this.handlers=[]}Yt.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};Yt.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)};Yt.prototype.forEach=function(e){kc.forEach(this.handlers,function(n){n!==null&&e(n)})};es.exports=Yt});var ns=p((mp,rs)=>{"use strict";var _c=K();rs.exports=function(e,r){_c.forEach(e,function(i,s){s!==r&&s.toUpperCase()===r.toUpperCase()&&(e[r]=i,delete e[s])})}});var Kr=p((yp,is)=>{"use strict";is.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 Xr=p((gp,ss)=>{"use strict";var qc=Kr();ss.exports=function(e,r,n,i,s){var a=new Error(e);return qc(a,r,n,i,s)}});var os=p((Ep,as)=>{"use strict";var Dc=Xr();as.exports=function(e,r,n){var i=n.config.validateStatus;!n.status||!i||i(n.status)?e(n):r(Dc("Request failed with status code "+n.status,n.config,null,n.request,n))}});var cs=p((Sp,us)=>{"use strict";var Qt=K();us.exports=Qt.isStandardBrowserEnv()?function(){return{write:function(r,n,i,s,a,u){var c=[];c.push(r+"="+encodeURIComponent(n)),Qt.isNumber(i)&&c.push("expires="+new Date(i).toGMTString()),Qt.isString(s)&&c.push("path="+s),Qt.isString(a)&&c.push("domain="+a),u===!0&&c.push("secure"),document.cookie=c.join("; ")},read:function(r){var n=document.cookie.match(new RegExp("(^|;\\s*)("+r+")=([^;]*)"));return n?decodeURIComponent(n[3]):null},remove:function(r){this.write(r,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()});var fs=p((wp,ls)=>{"use strict";ls.exports=function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}});var hs=p((xp,ds)=>{"use strict";ds.exports=function(e,r){return r?e.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):e}});var vs=p((Tp,ps)=>{"use strict";var Uc=fs(),Mc=hs();ps.exports=function(e,r){return e&&!Uc(r)?Mc(e,r):r}});var ys=p((bp,ms)=>{"use strict";var Yr=K(),jc=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];ms.exports=function(e){var r={},n,i,s;return e&&Yr.forEach(e.split(`
|
|
2
|
+
`),function(u){if(s=u.indexOf(":"),n=Yr.trim(u.substr(0,s)).toLowerCase(),i=Yr.trim(u.substr(s+1)),n){if(r[n]&&jc.indexOf(n)>=0)return;n==="set-cookie"?r[n]=(r[n]?r[n]:[]).concat([i]):r[n]=r[n]?r[n]+", "+i:i}}),r}});var Ss=p((Ap,Es)=>{"use strict";var gs=K();Es.exports=gs.isStandardBrowserEnv()?function(){var e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a"),n;function i(s){var a=s;return e&&(r.setAttribute("href",a),a=r.href),r.setAttribute("href",a),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}return n=i(window.location.href),function(a){var u=gs.isString(a)?i(a):a;return u.protocol===n.protocol&&u.host===n.host}}():function(){return function(){return!0}}()});var Tt=p((Rp,ws)=>{"use strict";function Qr(t){this.message=t}Qr.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")};Qr.prototype.__CANCEL__=!0;ws.exports=Qr});var en=p((Op,xs)=>{"use strict";var Zt=K(),Lc=os(),Bc=cs(),Fc=Wr(),Vc=vs(),Hc=ys(),Gc=Ss(),Zr=Xr(),Jc=bt(),zc=Tt();xs.exports=function(e){return new Promise(function(n,i){var s=e.data,a=e.headers,u=e.responseType,c;function l(){e.cancelToken&&e.cancelToken.unsubscribe(c),e.signal&&e.signal.removeEventListener("abort",c)}Zt.isFormData(s)&&delete a["Content-Type"];var o=new XMLHttpRequest;if(e.auth){var f=e.auth.username||"",d=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";a.Authorization="Basic "+btoa(f+":"+d)}var h=Vc(e.baseURL,e.url);o.open(e.method.toUpperCase(),Fc(h,e.params,e.paramsSerializer),!0),o.timeout=e.timeout;function y(){if(!!o){var v="getAllResponseHeaders"in o?Hc(o.getAllResponseHeaders()):null,x=!u||u==="text"||u==="json"?o.responseText:o.response,g={data:x,status:o.status,statusText:o.statusText,headers:v,config:e,request:o};Lc(function(O){n(O),l()},function(O){i(O),l()},g),o=null}}if("onloadend"in o?o.onloadend=y:o.onreadystatechange=function(){!o||o.readyState!==4||o.status===0&&!(o.responseURL&&o.responseURL.indexOf("file:")===0)||setTimeout(y)},o.onabort=function(){!o||(i(Zr("Request aborted",e,"ECONNABORTED",o)),o=null)},o.onerror=function(){i(Zr("Network Error",e,null,o)),o=null},o.ontimeout=function(){var x=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",g=e.transitional||Jc.transitional;e.timeoutErrorMessage&&(x=e.timeoutErrorMessage),i(Zr(x,e,g.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",o)),o=null},Zt.isStandardBrowserEnv()){var E=(e.withCredentials||Gc(h))&&e.xsrfCookieName?Bc.read(e.xsrfCookieName):void 0;E&&(a[e.xsrfHeaderName]=E)}"setRequestHeader"in o&&Zt.forEach(a,function(x,g){typeof s=="undefined"&&g.toLowerCase()==="content-type"?delete a[g]:o.setRequestHeader(g,x)}),Zt.isUndefined(e.withCredentials)||(o.withCredentials=!!e.withCredentials),u&&u!=="json"&&(o.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&o.addEventListener("progress",e.onDownloadProgress),typeof e.onUploadProgress=="function"&&o.upload&&o.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(c=function(v){!o||(i(!v||v&&v.type?new zc("canceled"):v),o.abort(),o=null)},e.cancelToken&&e.cancelToken.subscribe(c),e.signal&&(e.signal.aborted?c():e.signal.addEventListener("abort",c))),s||(s=null),o.send(s)})}});var bt=p((Cp,As)=>{"use strict";var H=K(),Ts=ns(),$c=Kr(),Wc={"Content-Type":"application/x-www-form-urlencoded"};function bs(t,e){!H.isUndefined(t)&&H.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}function Kc(){var t;return typeof XMLHttpRequest!="undefined"?t=en():typeof process!="undefined"&&Object.prototype.toString.call(process)==="[object process]"&&(t=en()),t}function Xc(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 er={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:Kc(),transformRequest:[function(e,r){return Ts(r,"Accept"),Ts(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)?(bs(r,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):H.isObject(e)||r&&r["Content-Type"]==="application/json"?(bs(r,"application/json"),Xc(e)):e}],transformResponse:[function(e){var r=this.transitional||er.transitional,n=r&&r.silentJSONParsing,i=r&&r.forcedJSONParsing,s=!n&&this.responseType==="json";if(s||i&&H.isString(e)&&e.length)try{return JSON.parse(e)}catch(a){if(s)throw a.name==="SyntaxError"?$c(a,this,"E_JSON_PARSE"):a}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};H.forEach(["delete","get","head"],function(e){er.headers[e]={}});H.forEach(["post","put","patch"],function(e){er.headers[e]=H.merge(Wc)});As.exports=er});var Os=p((Pp,Rs)=>{"use strict";var Yc=K(),Qc=bt();Rs.exports=function(e,r,n){var i=this||Qc;return Yc.forEach(n,function(a){e=a.call(i,e,r)}),e}});var tn=p((Np,Cs)=>{"use strict";Cs.exports=function(e){return!!(e&&e.__CANCEL__)}});var Is=p((Ip,Ns)=>{"use strict";var Ps=K(),rn=Os(),Zc=tn(),el=bt(),tl=Tt();function nn(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new tl("canceled")}Ns.exports=function(e){nn(e),e.headers=e.headers||{},e.data=rn.call(e,e.data,e.headers,e.transformRequest),e.headers=Ps.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),Ps.forEach(["delete","get","head","post","put","patch","common"],function(i){delete e.headers[i]});var r=e.adapter||el.adapter;return r(e).then(function(i){return nn(e),i.data=rn.call(e,i.data,i.headers,e.transformResponse),i},function(i){return Zc(i)||(nn(e),i&&i.response&&(i.response.data=rn.call(e,i.response.data,i.response.headers,e.transformResponse))),Promise.reject(i)})}});var sn=p((kp,ks)=>{"use strict";var re=K();ks.exports=function(e,r){r=r||{};var n={};function i(o,f){return re.isPlainObject(o)&&re.isPlainObject(f)?re.merge(o,f):re.isPlainObject(f)?re.merge({},f):re.isArray(f)?f.slice():f}function s(o){if(re.isUndefined(r[o])){if(!re.isUndefined(e[o]))return i(void 0,e[o])}else return i(e[o],r[o])}function a(o){if(!re.isUndefined(r[o]))return i(void 0,r[o])}function u(o){if(re.isUndefined(r[o])){if(!re.isUndefined(e[o]))return i(void 0,e[o])}else return i(void 0,r[o])}function c(o){if(o in r)return i(e[o],r[o]);if(o in e)return i(void 0,e[o])}var l={url:a,method:a,data:a,baseURL:u,transformRequest:u,transformResponse:u,paramsSerializer:u,timeout:u,timeoutMessage:u,withCredentials:u,adapter:u,responseType:u,xsrfCookieName:u,xsrfHeaderName:u,onUploadProgress:u,onDownloadProgress:u,decompress:u,maxContentLength:u,maxBodyLength:u,transport:u,httpAgent:u,httpsAgent:u,cancelToken:u,socketPath:u,responseEncoding:u,validateStatus:c};return re.forEach(Object.keys(e).concat(Object.keys(r)),function(f){var d=l[f]||s,h=d(f);re.isUndefined(h)&&d!==c||(n[f]=h)}),n}});var an=p((_p,_s)=>{_s.exports={version:"0.25.0"}});var Us=p((qp,Ds)=>{"use strict";var rl=an().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 qs={};on.transitional=function(e,r,n){function i(s,a){return"[Axios v"+rl+"] Transitional option '"+s+"'"+a+(n?". "+n:"")}return function(s,a,u){if(e===!1)throw new Error(i(a," has been removed"+(r?" in "+r:"")));return r&&!qs[a]&&(qs[a]=!0,console.warn(i(a," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(s,a,u):!0}};function nl(t,e,r){if(typeof t!="object")throw new TypeError("options must be an object");for(var n=Object.keys(t),i=n.length;i-- >0;){var s=n[i],a=e[s];if(a){var u=t[s],c=u===void 0||a(u,s,t);if(c!==!0)throw new TypeError("option "+s+" must be "+c);continue}if(r!==!0)throw Error("Unknown option "+s)}}Ds.exports={assertOptions:nl,validators:on}});var Vs=p((Dp,Fs)=>{"use strict";var Ls=K(),il=Wr(),Ms=ts(),js=Is(),tr=sn(),Bs=Us(),$e=Bs.validators;function At(t){this.defaults=t,this.interceptors={request:new Ms,response:new Ms}}At.prototype.request=function(e,r){if(typeof e=="string"?(r=r||{},r.url=e):r=e||{},!r.url)throw new Error("Provided config url is not valid");r=tr(this.defaults,r),r.method?r.method=r.method.toLowerCase():this.defaults.method?r.method=this.defaults.method.toLowerCase():r.method="get";var n=r.transitional;n!==void 0&&Bs.assertOptions(n,{silentJSONParsing:$e.transitional($e.boolean),forcedJSONParsing:$e.transitional($e.boolean),clarifyTimeoutError:$e.transitional($e.boolean)},!1);var i=[],s=!0;this.interceptors.request.forEach(function(h){typeof h.runWhen=="function"&&h.runWhen(r)===!1||(s=s&&h.synchronous,i.unshift(h.fulfilled,h.rejected))});var a=[];this.interceptors.response.forEach(function(h){a.push(h.fulfilled,h.rejected)});var u;if(!s){var c=[js,void 0];for(Array.prototype.unshift.apply(c,i),c=c.concat(a),u=Promise.resolve(r);c.length;)u=u.then(c.shift(),c.shift());return u}for(var l=r;i.length;){var o=i.shift(),f=i.shift();try{l=o(l)}catch(d){f(d);break}}try{u=js(l)}catch(d){return Promise.reject(d)}for(;a.length;)u=u.then(a.shift(),a.shift());return u};At.prototype.getUri=function(e){if(!e.url)throw new Error("Provided config url is not valid");return e=tr(this.defaults,e),il(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")};Ls.forEach(["delete","get","head","options"],function(e){At.prototype[e]=function(r,n){return this.request(tr(n||{},{method:e,url:r,data:(n||{}).data}))}});Ls.forEach(["post","put","patch"],function(e){At.prototype[e]=function(r,n,i){return this.request(tr(i||{},{method:e,url:r,data:n}))}});Fs.exports=At});var Gs=p((Up,Hs)=>{"use strict";var sl=Tt();function We(t){if(typeof t!="function")throw new TypeError("executor must be a function.");var e;this.promise=new Promise(function(i){e=i});var r=this;this.promise.then(function(n){if(!!r._listeners){var i,s=r._listeners.length;for(i=0;i<s;i++)r._listeners[i](n);r._listeners=null}}),this.promise.then=function(n){var i,s=new Promise(function(a){r.subscribe(a),i=a}).then(n);return s.cancel=function(){r.unsubscribe(i)},s},t(function(i){r.reason||(r.reason=new sl(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}};Hs.exports=We});var zs=p((Mp,Js)=>{"use strict";Js.exports=function(e){return function(n){return e.apply(null,n)}}});var Ws=p((jp,$s)=>{"use strict";var al=K();$s.exports=function(e){return al.isObject(e)&&e.isAxiosError===!0}});var Ys=p((Lp,un)=>{"use strict";var Ks=K(),ol=Hr(),rr=Vs(),ul=sn(),cl=bt();function Xs(t){var e=new rr(t),r=ol(rr.prototype.request,e);return Ks.extend(r,rr.prototype,e),Ks.extend(r,e),r.create=function(i){return Xs(ul(t,i))},r}var he=Xs(cl);he.Axios=rr;he.Cancel=Tt();he.CancelToken=Gs();he.isCancel=tn();he.VERSION=an().version;he.all=function(e){return Promise.all(e)};he.spread=zs();he.isAxiosError=Ws();un.exports=he;un.exports.default=he});var Zs=p((Bp,Qs)=>{Qs.exports=Ys()});var dn=p((bm,ha)=>{"use strict";ha.exports=function(e,r){return function(){for(var i=new Array(arguments.length),s=0;s<i.length;s++)i[s]=arguments[s];return e.apply(r,i)}}});var X=p((Am,ma)=>{"use strict";var gl=dn(),_e=Object.prototype.toString;function vn(t){return _e.call(t)==="[object Array]"}function hn(t){return typeof t=="undefined"}function El(t){return t!==null&&!hn(t)&&t.constructor!==null&&!hn(t.constructor)&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function Sl(t){return _e.call(t)==="[object ArrayBuffer]"}function wl(t){return typeof FormData!="undefined"&&t instanceof FormData}function xl(t){var e;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&t.buffer instanceof ArrayBuffer,e}function Tl(t){return typeof t=="string"}function bl(t){return typeof t=="number"}function pa(t){return t!==null&&typeof t=="object"}function ur(t){if(_e.call(t)!=="[object Object]")return!1;var e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}function Al(t){return _e.call(t)==="[object Date]"}function Rl(t){return _e.call(t)==="[object File]"}function Ol(t){return _e.call(t)==="[object Blob]"}function va(t){return _e.call(t)==="[object Function]"}function Cl(t){return pa(t)&&va(t.pipe)}function Pl(t){return typeof URLSearchParams!="undefined"&&t instanceof URLSearchParams}function Nl(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function Il(){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]),vn(t))for(var r=0,n=t.length;r<n;r++)e.call(null,t[r],r,t);else for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.call(null,t[i],i,t)}function pn(){var t={};function e(i,s){ur(t[s])&&ur(i)?t[s]=pn(t[s],i):ur(i)?t[s]=pn({},i):vn(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 kl(t,e,r){return mn(e,function(i,s){r&&typeof i=="function"?t[s]=gl(i,r):t[s]=i}),t}function _l(t){return t.charCodeAt(0)===65279&&(t=t.slice(1)),t}ma.exports={isArray:vn,isArrayBuffer:Sl,isBuffer:El,isFormData:wl,isArrayBufferView:xl,isString:Tl,isNumber:bl,isObject:pa,isPlainObject:ur,isUndefined:hn,isDate:Al,isFile:Rl,isBlob:Ol,isFunction:va,isStream:Cl,isURLSearchParams:Pl,isStandardBrowserEnv:Il,forEach:mn,merge:pn,extend:kl,trim:Nl,stripBOM:_l}});var yn=p((Rm,ga)=>{"use strict";var Ye=X();function ya(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}ga.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,l){c===null||typeof c=="undefined"||(Ye.isArray(c)?l=l+"[]":c=[c],Ye.forEach(c,function(f){Ye.isDate(f)?f=f.toISOString():Ye.isObject(f)&&(f=JSON.stringify(f)),s.push(ya(l)+"="+ya(f))}))}),i=s.join("&")}if(i){var a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}});var Sa=p((Om,Ea)=>{"use strict";var ql=X();function cr(){this.handlers=[]}cr.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};cr.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)};cr.prototype.forEach=function(e){ql.forEach(this.handlers,function(n){n!==null&&e(n)})};Ea.exports=cr});var xa=p((Cm,wa)=>{"use strict";var Dl=X();wa.exports=function(e,r){Dl.forEach(e,function(i,s){s!==r&&s.toUpperCase()===r.toUpperCase()&&(e[r]=i,delete e[s])})}});var gn=p((Pm,Ta)=>{"use strict";Ta.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 En=p((Nm,ba)=>{"use strict";var Ul=gn();ba.exports=function(e,r,n,i,s){var a=new Error(e);return Ul(a,r,n,i,s)}});var Ra=p((Im,Aa)=>{"use strict";var Ml=En();Aa.exports=function(e,r,n){var i=n.config.validateStatus;!n.status||!i||i(n.status)?e(n):r(Ml("Request failed with status code "+n.status,n.config,null,n.request,n))}});var Ca=p((km,Oa)=>{"use strict";var lr=X();Oa.exports=lr.isStandardBrowserEnv()?function(){return{write:function(r,n,i,s,a,u){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(a)&&c.push("domain="+a),u===!0&&c.push("secure"),document.cookie=c.join("; ")},read:function(r){var n=document.cookie.match(new RegExp("(^|;\\s*)("+r+")=([^;]*)"));return n?decodeURIComponent(n[3]):null},remove:function(r){this.write(r,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()});var Na=p((_m,Pa)=>{"use strict";Pa.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}});var ka=p((qm,Ia)=>{"use strict";Ia.exports=function(e,r){return r?e.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):e}});var qa=p((Dm,_a)=>{"use strict";var jl=Na(),Ll=ka();_a.exports=function(e,r){return e&&!jl(r)?Ll(e,r):r}});var Ua=p((Um,Da)=>{"use strict";var Sn=X(),Bl=["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"];Da.exports=function(e){var r={},n,i,s;return e&&Sn.forEach(e.split(`
|
|
3
|
+
`),function(u){if(s=u.indexOf(":"),n=Sn.trim(u.substr(0,s)).toLowerCase(),i=Sn.trim(u.substr(s+1)),n){if(r[n]&&Bl.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 La=p((Mm,ja)=>{"use strict";var Ma=X();ja.exports=Ma.isStandardBrowserEnv()?function(){var e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a"),n;function i(s){var a=s;return e&&(r.setAttribute("href",a),a=r.href),r.setAttribute("href",a),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}return n=i(window.location.href),function(a){var u=Ma.isString(a)?i(a):a;return u.protocol===n.protocol&&u.host===n.host}}():function(){return function(){return!0}}()});var xn=p((jm,Ba)=>{"use strict";var fr=X(),Fl=Ra(),Vl=Ca(),Hl=yn(),Gl=qa(),Jl=Ua(),zl=La(),wn=En();Ba.exports=function(e){return new Promise(function(n,i){var s=e.data,a=e.headers,u=e.responseType;fr.isFormData(s)&&delete a["Content-Type"];var c=new XMLHttpRequest;if(e.auth){var l=e.auth.username||"",o=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";a.Authorization="Basic "+btoa(l+":"+o)}var f=Gl(e.baseURL,e.url);c.open(e.method.toUpperCase(),Hl(f,e.params,e.paramsSerializer),!0),c.timeout=e.timeout;function d(){if(!!c){var y="getAllResponseHeaders"in c?Jl(c.getAllResponseHeaders()):null,E=!u||u==="text"||u==="json"?c.responseText:c.response,v={data:E,status:c.status,statusText:c.statusText,headers:y,config:e,request:c};Fl(n,i,v),c=null}}if("onloadend"in c?c.onloadend=d:c.onreadystatechange=function(){!c||c.readyState!==4||c.status===0&&!(c.responseURL&&c.responseURL.indexOf("file:")===0)||setTimeout(d)},c.onabort=function(){!c||(i(wn("Request aborted",e,"ECONNABORTED",c)),c=null)},c.onerror=function(){i(wn("Network Error",e,null,c)),c=null},c.ontimeout=function(){var E="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(E=e.timeoutErrorMessage),i(wn(E,e,e.transitional&&e.transitional.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",c)),c=null},fr.isStandardBrowserEnv()){var h=(e.withCredentials||zl(f))&&e.xsrfCookieName?Vl.read(e.xsrfCookieName):void 0;h&&(a[e.xsrfHeaderName]=h)}"setRequestHeader"in c&&fr.forEach(a,function(E,v){typeof s=="undefined"&&v.toLowerCase()==="content-type"?delete a[v]:c.setRequestHeader(v,E)}),fr.isUndefined(e.withCredentials)||(c.withCredentials=!!e.withCredentials),u&&u!=="json"&&(c.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&c.addEventListener("progress",e.onDownloadProgress),typeof e.onUploadProgress=="function"&&c.upload&&c.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then(function(E){!c||(c.abort(),i(E),c=null)}),s||(s=null),c.send(s)})}});var hr=p((Lm,Ha)=>{"use strict";var G=X(),Fa=xa(),$l=gn(),Wl={"Content-Type":"application/x-www-form-urlencoded"};function Va(t,e){!G.isUndefined(t)&&G.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}function Kl(){var t;return typeof XMLHttpRequest!="undefined"?t=xn():typeof process!="undefined"&&Object.prototype.toString.call(process)==="[object process]"&&(t=xn()),t}function Xl(t,e,r){if(G.isString(t))try{return(e||JSON.parse)(t),G.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}var dr={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:Kl(),transformRequest:[function(e,r){return Fa(r,"Accept"),Fa(r,"Content-Type"),G.isFormData(e)||G.isArrayBuffer(e)||G.isBuffer(e)||G.isStream(e)||G.isFile(e)||G.isBlob(e)?e:G.isArrayBufferView(e)?e.buffer:G.isURLSearchParams(e)?(Va(r,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):G.isObject(e)||r&&r["Content-Type"]==="application/json"?(Va(r,"application/json"),Xl(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&&G.isString(e)&&e.length)try{return JSON.parse(e)}catch(a){if(s)throw a.name==="SyntaxError"?$l(a,this,"E_JSON_PARSE"):a}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300}};dr.headers={common:{Accept:"application/json, text/plain, */*"}};G.forEach(["delete","get","head"],function(e){dr.headers[e]={}});G.forEach(["post","put","patch"],function(e){dr.headers[e]=G.merge(Wl)});Ha.exports=dr});var Ja=p((Bm,Ga)=>{"use strict";var Yl=X(),Ql=hr();Ga.exports=function(e,r,n){var i=this||Ql;return Yl.forEach(n,function(a){e=a.call(i,e,r)}),e}});var Tn=p((Fm,za)=>{"use strict";za.exports=function(e){return!!(e&&e.__CANCEL__)}});var Ka=p((Vm,Wa)=>{"use strict";var $a=X(),bn=Ja(),Zl=Tn(),ef=hr();function An(t){t.cancelToken&&t.cancelToken.throwIfRequested()}Wa.exports=function(e){An(e),e.headers=e.headers||{},e.data=bn.call(e,e.data,e.headers,e.transformRequest),e.headers=$a.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),$a.forEach(["delete","get","head","post","put","patch","common"],function(i){delete e.headers[i]});var r=e.adapter||ef.adapter;return r(e).then(function(i){return An(e),i.data=bn.call(e,i.data,i.headers,e.transformResponse),i},function(i){return Zl(i)||(An(e),i&&i.response&&(i.response.data=bn.call(e,i.response.data,i.response.headers,e.transformResponse))),Promise.reject(i)})}});var Rn=p((Hm,Xa)=>{"use strict";var W=X();Xa.exports=function(e,r){r=r||{};var n={},i=["url","method","data"],s=["headers","auth","proxy","params"],a=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],u=["validateStatus"];function c(d,h){return W.isPlainObject(d)&&W.isPlainObject(h)?W.merge(d,h):W.isPlainObject(h)?W.merge({},h):W.isArray(h)?h.slice():h}function l(d){W.isUndefined(r[d])?W.isUndefined(e[d])||(n[d]=c(void 0,e[d])):n[d]=c(e[d],r[d])}W.forEach(i,function(h){W.isUndefined(r[h])||(n[h]=c(void 0,r[h]))}),W.forEach(s,l),W.forEach(a,function(h){W.isUndefined(r[h])?W.isUndefined(e[h])||(n[h]=c(void 0,e[h])):n[h]=c(void 0,r[h])}),W.forEach(u,function(h){h in r?n[h]=c(e[h],r[h]):h in e&&(n[h]=c(void 0,e[h]))});var o=i.concat(s).concat(a).concat(u),f=Object.keys(e).concat(Object.keys(r)).filter(function(h){return o.indexOf(h)===-1});return W.forEach(f,l),n}});var Ya=p((Gm,tf)=>{tf.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 ro=p((Jm,to)=>{"use strict";var Za=Ya(),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 Qa={},rf=Za.version.split(".");function eo(t,e){for(var r=e?e.split("."):rf,n=t.split("."),i=0;i<3;i++){if(r[i]>n[i])return!0;if(r[i]<n[i])return!1}return!1}On.transitional=function(e,r,n){var i=r&&eo(r);function s(a,u){return"[Axios v"+Za.version+"] Transitional option '"+a+"'"+u+(n?". "+n:"")}return function(a,u,c){if(e===!1)throw new Error(s(u," has been removed in "+r));return i&&!Qa[u]&&(Qa[u]=!0,console.warn(s(u," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(a,u,c):!0}};function nf(t,e,r){if(typeof t!="object")throw new TypeError("options must be an object");for(var n=Object.keys(t),i=n.length;i-- >0;){var s=n[i],a=e[s];if(a){var u=t[s],c=u===void 0||a(u,s,t);if(c!==!0)throw new TypeError("option "+s+" must be "+c);continue}if(r!==!0)throw Error("Unknown option "+s)}}to.exports={isOlderVersion:eo,assertOptions:nf,validators:On}});var uo=p((zm,oo)=>{"use strict";var so=X(),sf=yn(),no=Sa(),io=Ka(),pr=Rn(),ao=ro(),Qe=ao.validators;function Ot(t){this.defaults=t,this.interceptors={request:new no,response:new no}}Ot.prototype.request=function(e){typeof e=="string"?(e=arguments[1]||{},e.url=arguments[0]):e=e||{},e=pr(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&&ao.assertOptions(r,{silentJSONParsing:Qe.transitional(Qe.boolean,"1.0.0"),forcedJSONParsing:Qe.transitional(Qe.boolean,"1.0.0"),clarifyTimeoutError:Qe.transitional(Qe.boolean,"1.0.0")},!1);var n=[],i=!0;this.interceptors.request.forEach(function(d){typeof d.runWhen=="function"&&d.runWhen(e)===!1||(i=i&&d.synchronous,n.unshift(d.fulfilled,d.rejected))});var s=[];this.interceptors.response.forEach(function(d){s.push(d.fulfilled,d.rejected)});var a;if(!i){var u=[io,void 0];for(Array.prototype.unshift.apply(u,n),u=u.concat(s),a=Promise.resolve(e);u.length;)a=a.then(u.shift(),u.shift());return a}for(var c=e;n.length;){var l=n.shift(),o=n.shift();try{c=l(c)}catch(f){o(f);break}}try{a=io(c)}catch(f){return Promise.reject(f)}for(;s.length;)a=a.then(s.shift(),s.shift());return a};Ot.prototype.getUri=function(e){return e=pr(this.defaults,e),sf(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")};so.forEach(["delete","get","head","options"],function(e){Ot.prototype[e]=function(r,n){return this.request(pr(n||{},{method:e,url:r,data:(n||{}).data}))}});so.forEach(["post","put","patch"],function(e){Ot.prototype[e]=function(r,n,i){return this.request(pr(i||{},{method:e,url:r,data:n}))}});oo.exports=Ot});var Pn=p(($m,co)=>{"use strict";function Cn(t){this.message=t}Cn.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")};Cn.prototype.__CANCEL__=!0;co.exports=Cn});var fo=p((Wm,lo)=>{"use strict";var af=Pn();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 af(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}};lo.exports=vr});var po=p((Km,ho)=>{"use strict";ho.exports=function(e){return function(n){return e.apply(null,n)}}});var mo=p((Xm,vo)=>{"use strict";vo.exports=function(e){return typeof e=="object"&&e.isAxiosError===!0}});var Eo=p((Ym,Nn)=>{"use strict";var yo=X(),of=dn(),mr=uo(),uf=Rn(),cf=hr();function go(t){var e=new mr(t),r=of(mr.prototype.request,e);return yo.extend(r,mr.prototype,e),yo.extend(r,e),r}var ue=go(cf);ue.Axios=mr;ue.create=function(e){return go(uf(ue.defaults,e))};ue.Cancel=Pn();ue.CancelToken=fo();ue.isCancel=Tn();ue.all=function(e){return Promise.all(e)};ue.spread=po();ue.isAxiosError=mo();Nn.exports=ue;Nn.exports.default=ue});var wo=p((Qm,So)=>{So.exports=Eo()});var _n=p((oy,To)=>{"use strict";To.exports=function(e,r){return function(){for(var i=new Array(arguments.length),s=0;s<i.length;s++)i[s]=arguments[s];return e.apply(r,i)}}});var Y=p((uy,Ro)=>{"use strict";var lf=_n(),qe=Object.prototype.toString;function Un(t){return qe.call(t)==="[object Array]"}function qn(t){return typeof t=="undefined"}function ff(t){return t!==null&&!qn(t)&&t.constructor!==null&&!qn(t.constructor)&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function df(t){return qe.call(t)==="[object ArrayBuffer]"}function hf(t){return typeof FormData!="undefined"&&t instanceof FormData}function pf(t){var e;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&t.buffer instanceof ArrayBuffer,e}function vf(t){return typeof t=="string"}function mf(t){return typeof t=="number"}function bo(t){return t!==null&&typeof t=="object"}function yr(t){if(qe.call(t)!=="[object Object]")return!1;var e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}function yf(t){return qe.call(t)==="[object Date]"}function gf(t){return qe.call(t)==="[object File]"}function Ef(t){return qe.call(t)==="[object Blob]"}function Ao(t){return qe.call(t)==="[object Function]"}function Sf(t){return bo(t)&&Ao(t.pipe)}function wf(t){return typeof URLSearchParams!="undefined"&&t instanceof URLSearchParams}function xf(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function Tf(){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]),Un(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 Dn(){var t={};function e(i,s){yr(t[s])&&yr(i)?t[s]=Dn(t[s],i):yr(i)?t[s]=Dn({},i):Un(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 bf(t,e,r){return Mn(e,function(i,s){r&&typeof i=="function"?t[s]=lf(i,r):t[s]=i}),t}function Af(t){return t.charCodeAt(0)===65279&&(t=t.slice(1)),t}Ro.exports={isArray:Un,isArrayBuffer:df,isBuffer:ff,isFormData:hf,isArrayBufferView:pf,isString:vf,isNumber:mf,isObject:bo,isPlainObject:yr,isUndefined:qn,isDate:yf,isFile:gf,isBlob:Ef,isFunction:Ao,isStream:Sf,isURLSearchParams:wf,isStandardBrowserEnv:Tf,forEach:Mn,merge:Dn,extend:bf,trim:xf,stripBOM:Af}});var jn=p((cy,Co)=>{"use strict";var Ze=Y();function Oo(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}Co.exports=function(e,r,n){if(!r)return e;var i;if(n)i=n(r);else if(Ze.isURLSearchParams(r))i=r.toString();else{var s=[];Ze.forEach(r,function(c,l){c===null||typeof c=="undefined"||(Ze.isArray(c)?l=l+"[]":c=[c],Ze.forEach(c,function(f){Ze.isDate(f)?f=f.toISOString():Ze.isObject(f)&&(f=JSON.stringify(f)),s.push(Oo(l)+"="+Oo(f))}))}),i=s.join("&")}if(i){var a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}});var No=p((ly,Po)=>{"use strict";var Rf=Y();function gr(){this.handlers=[]}gr.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};gr.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)};gr.prototype.forEach=function(e){Rf.forEach(this.handlers,function(n){n!==null&&e(n)})};Po.exports=gr});var ko=p((fy,Io)=>{"use strict";var Of=Y();Io.exports=function(e,r){Of.forEach(e,function(i,s){s!==r&&s.toUpperCase()===r.toUpperCase()&&(e[r]=i,delete e[s])})}});var Ln=p((dy,_o)=>{"use strict";_o.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 Bn=p((hy,qo)=>{"use strict";var Cf=Ln();qo.exports=function(e,r,n,i,s){var a=new Error(e);return Cf(a,r,n,i,s)}});var Uo=p((py,Do)=>{"use strict";var Pf=Bn();Do.exports=function(e,r,n){var i=n.config.validateStatus;!n.status||!i||i(n.status)?e(n):r(Pf("Request failed with status code "+n.status,n.config,null,n.request,n))}});var jo=p((vy,Mo)=>{"use strict";var Er=Y();Mo.exports=Er.isStandardBrowserEnv()?function(){return{write:function(r,n,i,s,a,u){var c=[];c.push(r+"="+encodeURIComponent(n)),Er.isNumber(i)&&c.push("expires="+new Date(i).toGMTString()),Er.isString(s)&&c.push("path="+s),Er.isString(a)&&c.push("domain="+a),u===!0&&c.push("secure"),document.cookie=c.join("; ")},read:function(r){var n=document.cookie.match(new RegExp("(^|;\\s*)("+r+")=([^;]*)"));return n?decodeURIComponent(n[3]):null},remove:function(r){this.write(r,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()});var Bo=p((my,Lo)=>{"use strict";Lo.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}});var Vo=p((yy,Fo)=>{"use strict";Fo.exports=function(e,r){return r?e.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):e}});var Go=p((gy,Ho)=>{"use strict";var Nf=Bo(),If=Vo();Ho.exports=function(e,r){return e&&!Nf(r)?If(e,r):r}});var zo=p((Ey,Jo)=>{"use strict";var Fn=Y(),kf=["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"];Jo.exports=function(e){var r={},n,i,s;return e&&Fn.forEach(e.split(`
|
|
4
|
+
`),function(u){if(s=u.indexOf(":"),n=Fn.trim(u.substr(0,s)).toLowerCase(),i=Fn.trim(u.substr(s+1)),n){if(r[n]&&kf.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 Ko=p((Sy,Wo)=>{"use strict";var $o=Y();Wo.exports=$o.isStandardBrowserEnv()?function(){var e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a"),n;function i(s){var a=s;return e&&(r.setAttribute("href",a),a=r.href),r.setAttribute("href",a),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}return n=i(window.location.href),function(a){var u=$o.isString(a)?i(a):a;return u.protocol===n.protocol&&u.host===n.host}}():function(){return function(){return!0}}()});var Ct=p((wy,Xo)=>{"use strict";function Vn(t){this.message=t}Vn.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")};Vn.prototype.__CANCEL__=!0;Xo.exports=Vn});var Gn=p((xy,Yo)=>{"use strict";var Sr=Y(),_f=Uo(),qf=jo(),Df=jn(),Uf=Go(),Mf=zo(),jf=Ko(),Hn=Bn(),Lf=Pt(),Bf=Ct();Yo.exports=function(e){return new Promise(function(n,i){var s=e.data,a=e.headers,u=e.responseType,c;function l(){e.cancelToken&&e.cancelToken.unsubscribe(c),e.signal&&e.signal.removeEventListener("abort",c)}Sr.isFormData(s)&&delete a["Content-Type"];var o=new XMLHttpRequest;if(e.auth){var f=e.auth.username||"",d=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";a.Authorization="Basic "+btoa(f+":"+d)}var h=Uf(e.baseURL,e.url);o.open(e.method.toUpperCase(),Df(h,e.params,e.paramsSerializer),!0),o.timeout=e.timeout;function y(){if(!!o){var v="getAllResponseHeaders"in o?Mf(o.getAllResponseHeaders()):null,x=!u||u==="text"||u==="json"?o.responseText:o.response,g={data:x,status:o.status,statusText:o.statusText,headers:v,config:e,request:o};_f(function(O){n(O),l()},function(O){i(O),l()},g),o=null}}if("onloadend"in o?o.onloadend=y:o.onreadystatechange=function(){!o||o.readyState!==4||o.status===0&&!(o.responseURL&&o.responseURL.indexOf("file:")===0)||setTimeout(y)},o.onabort=function(){!o||(i(Hn("Request aborted",e,"ECONNABORTED",o)),o=null)},o.onerror=function(){i(Hn("Network Error",e,null,o)),o=null},o.ontimeout=function(){var x=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",g=e.transitional||Lf.transitional;e.timeoutErrorMessage&&(x=e.timeoutErrorMessage),i(Hn(x,e,g.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",o)),o=null},Sr.isStandardBrowserEnv()){var E=(e.withCredentials||jf(h))&&e.xsrfCookieName?qf.read(e.xsrfCookieName):void 0;E&&(a[e.xsrfHeaderName]=E)}"setRequestHeader"in o&&Sr.forEach(a,function(x,g){typeof s=="undefined"&&g.toLowerCase()==="content-type"?delete a[g]:o.setRequestHeader(g,x)}),Sr.isUndefined(e.withCredentials)||(o.withCredentials=!!e.withCredentials),u&&u!=="json"&&(o.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&o.addEventListener("progress",e.onDownloadProgress),typeof e.onUploadProgress=="function"&&o.upload&&o.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(c=function(v){!o||(i(!v||v&&v.type?new Bf("canceled"):v),o.abort(),o=null)},e.cancelToken&&e.cancelToken.subscribe(c),e.signal&&(e.signal.aborted?c():e.signal.addEventListener("abort",c))),s||(s=null),o.send(s)})}});var Pt=p((Ty,eu)=>{"use strict";var J=Y(),Qo=ko(),Ff=Ln(),Vf={"Content-Type":"application/x-www-form-urlencoded"};function Zo(t,e){!J.isUndefined(t)&&J.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}function Hf(){var t;return typeof XMLHttpRequest!="undefined"?t=Gn():typeof process!="undefined"&&Object.prototype.toString.call(process)==="[object process]"&&(t=Gn()),t}function Gf(t,e,r){if(J.isString(t))try{return(e||JSON.parse)(t),J.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}var wr={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:Hf(),transformRequest:[function(e,r){return Qo(r,"Accept"),Qo(r,"Content-Type"),J.isFormData(e)||J.isArrayBuffer(e)||J.isBuffer(e)||J.isStream(e)||J.isFile(e)||J.isBlob(e)?e:J.isArrayBufferView(e)?e.buffer:J.isURLSearchParams(e)?(Zo(r,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):J.isObject(e)||r&&r["Content-Type"]==="application/json"?(Zo(r,"application/json"),Gf(e)):e}],transformResponse:[function(e){var r=this.transitional||wr.transitional,n=r&&r.silentJSONParsing,i=r&&r.forcedJSONParsing,s=!n&&this.responseType==="json";if(s||i&&J.isString(e)&&e.length)try{return JSON.parse(e)}catch(a){if(s)throw a.name==="SyntaxError"?Ff(a,this,"E_JSON_PARSE"):a}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};J.forEach(["delete","get","head"],function(e){wr.headers[e]={}});J.forEach(["post","put","patch"],function(e){wr.headers[e]=J.merge(Vf)});eu.exports=wr});var ru=p((by,tu)=>{"use strict";var Jf=Y(),zf=Pt();tu.exports=function(e,r,n){var i=this||zf;return Jf.forEach(n,function(a){e=a.call(i,e,r)}),e}});var Jn=p((Ay,nu)=>{"use strict";nu.exports=function(e){return!!(e&&e.__CANCEL__)}});var au=p((Ry,su)=>{"use strict";var iu=Y(),zn=ru(),$f=Jn(),Wf=Pt(),Kf=Ct();function $n(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Kf("canceled")}su.exports=function(e){$n(e),e.headers=e.headers||{},e.data=zn.call(e,e.data,e.headers,e.transformRequest),e.headers=iu.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),iu.forEach(["delete","get","head","post","put","patch","common"],function(i){delete e.headers[i]});var r=e.adapter||Wf.adapter;return r(e).then(function(i){return $n(e),i.data=zn.call(e,i.data,i.headers,e.transformResponse),i},function(i){return $f(i)||($n(e),i&&i.response&&(i.response.data=zn.call(e,i.response.data,i.response.headers,e.transformResponse))),Promise.reject(i)})}});var Wn=p((Oy,ou)=>{"use strict";var ne=Y();ou.exports=function(e,r){r=r||{};var n={};function i(o,f){return ne.isPlainObject(o)&&ne.isPlainObject(f)?ne.merge(o,f):ne.isPlainObject(f)?ne.merge({},f):ne.isArray(f)?f.slice():f}function s(o){if(ne.isUndefined(r[o])){if(!ne.isUndefined(e[o]))return i(void 0,e[o])}else return i(e[o],r[o])}function a(o){if(!ne.isUndefined(r[o]))return i(void 0,r[o])}function u(o){if(ne.isUndefined(r[o])){if(!ne.isUndefined(e[o]))return i(void 0,e[o])}else return i(void 0,r[o])}function c(o){if(o in r)return i(e[o],r[o]);if(o in e)return i(void 0,e[o])}var l={url:a,method:a,data:a,baseURL:u,transformRequest:u,transformResponse:u,paramsSerializer:u,timeout:u,timeoutMessage:u,withCredentials:u,adapter:u,responseType:u,xsrfCookieName:u,xsrfHeaderName:u,onUploadProgress:u,onDownloadProgress:u,decompress:u,maxContentLength:u,maxBodyLength:u,transport:u,httpAgent:u,httpsAgent:u,cancelToken:u,socketPath:u,responseEncoding:u,validateStatus:c};return ne.forEach(Object.keys(e).concat(Object.keys(r)),function(f){var d=l[f]||s,h=d(f);ne.isUndefined(h)&&d!==c||(n[f]=h)}),n}});var Kn=p((Cy,uu)=>{uu.exports={version:"0.23.0"}});var fu=p((Py,lu)=>{"use strict";var Xf=Kn().version,Xn={};["object","boolean","number","function","string","symbol"].forEach(function(t,e){Xn[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});var cu={};Xn.transitional=function(e,r,n){function i(s,a){return"[Axios v"+Xf+"] Transitional option '"+s+"'"+a+(n?". "+n:"")}return function(s,a,u){if(e===!1)throw new Error(i(a," has been removed"+(r?" in "+r:"")));return r&&!cu[a]&&(cu[a]=!0,console.warn(i(a," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(s,a,u):!0}};function Yf(t,e,r){if(typeof t!="object")throw new TypeError("options must be an object");for(var n=Object.keys(t),i=n.length;i-- >0;){var s=n[i],a=e[s];if(a){var u=t[s],c=u===void 0||a(u,s,t);if(c!==!0)throw new TypeError("option "+s+" must be "+c);continue}if(r!==!0)throw Error("Unknown option "+s)}}lu.exports={assertOptions:Yf,validators:Xn}});var yu=p((Ny,mu)=>{"use strict";var pu=Y(),Qf=jn(),du=No(),hu=au(),xr=Wn(),vu=fu(),et=vu.validators;function Nt(t){this.defaults=t,this.interceptors={request:new du,response:new du}}Nt.prototype.request=function(e){typeof e=="string"?(e=arguments[1]||{},e.url=arguments[0]):e=e||{},e=xr(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&&vu.assertOptions(r,{silentJSONParsing:et.transitional(et.boolean),forcedJSONParsing:et.transitional(et.boolean),clarifyTimeoutError:et.transitional(et.boolean)},!1);var n=[],i=!0;this.interceptors.request.forEach(function(d){typeof d.runWhen=="function"&&d.runWhen(e)===!1||(i=i&&d.synchronous,n.unshift(d.fulfilled,d.rejected))});var s=[];this.interceptors.response.forEach(function(d){s.push(d.fulfilled,d.rejected)});var a;if(!i){var u=[hu,void 0];for(Array.prototype.unshift.apply(u,n),u=u.concat(s),a=Promise.resolve(e);u.length;)a=a.then(u.shift(),u.shift());return a}for(var c=e;n.length;){var l=n.shift(),o=n.shift();try{c=l(c)}catch(f){o(f);break}}try{a=hu(c)}catch(f){return Promise.reject(f)}for(;s.length;)a=a.then(s.shift(),s.shift());return a};Nt.prototype.getUri=function(e){return e=xr(this.defaults,e),Qf(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")};pu.forEach(["delete","get","head","options"],function(e){Nt.prototype[e]=function(r,n){return this.request(xr(n||{},{method:e,url:r,data:(n||{}).data}))}});pu.forEach(["post","put","patch"],function(e){Nt.prototype[e]=function(r,n,i){return this.request(xr(i||{},{method:e,url:r,data:n}))}});mu.exports=Nt});var Eu=p((Iy,gu)=>{"use strict";var Zf=Ct();function tt(t){if(typeof t!="function")throw new TypeError("executor must be a function.");var e;this.promise=new Promise(function(i){e=i});var r=this;this.promise.then(function(n){if(!!r._listeners){var i,s=r._listeners.length;for(i=0;i<s;i++)r._listeners[i](n);r._listeners=null}}),this.promise.then=function(n){var i,s=new Promise(function(a){r.subscribe(a),i=a}).then(n);return s.cancel=function(){r.unsubscribe(i)},s},t(function(i){r.reason||(r.reason=new Zf(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}};gu.exports=tt});var wu=p((ky,Su)=>{"use strict";Su.exports=function(e){return function(n){return e.apply(null,n)}}});var Tu=p((_y,xu)=>{"use strict";xu.exports=function(e){return typeof e=="object"&&e.isAxiosError===!0}});var Ru=p((qy,Yn)=>{"use strict";var bu=Y(),ed=_n(),Tr=yu(),td=Wn(),rd=Pt();function Au(t){var e=new Tr(t),r=ed(Tr.prototype.request,e);return bu.extend(r,Tr.prototype,e),bu.extend(r,e),r.create=function(i){return Au(td(t,i))},r}var pe=Au(rd);pe.Axios=Tr;pe.Cancel=Ct();pe.CancelToken=Eu();pe.isCancel=Jn();pe.VERSION=Kn().version;pe.all=function(e){return Promise.all(e)};pe.spread=wu();pe.isAxiosError=Tu();Yn.exports=pe;Yn.exports.default=pe});var Qn=p((Dy,Ou)=>{Ou.exports=Ru()});var ei=p(br=>{"use strict";Object.defineProperty(br,"__esModule",{value:!0});br.default=void 0;var nd=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):void 0,id=nd;br.default=id});var Nu=p(ti=>{"use strict";Object.defineProperty(ti,"__esModule",{value:!0});ti.default=ud;var sd=ad(ei());function ad(t){return t&&t.__esModule?t:{default:t}}function Ar(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Ar=function(r){return typeof r}:Ar=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Ar(t)}var od=10,Pu=2;function ud(t){return Rr(t,[])}function Rr(t,e){switch(Ar(t)){case"string":return JSON.stringify(t);case"function":return t.name?"[function ".concat(t.name,"]"):"[function]";case"object":return t===null?"null":cd(t,e);default:return String(t)}}function cd(t,e){if(e.indexOf(t)!==-1)return"[Circular]";var r=[].concat(e,[t]),n=dd(t);if(n!==void 0){var i=n.call(t);if(i!==t)return typeof i=="string"?i:Rr(i,r)}else if(Array.isArray(t))return fd(t,r);return ld(t,r)}function ld(t,e){var r=Object.keys(t);if(r.length===0)return"{}";if(e.length>Pu)return"["+hd(t)+"]";var n=r.map(function(i){var s=Rr(t[i],e);return i+": "+s});return"{ "+n.join(", ")+" }"}function fd(t,e){if(t.length===0)return"[]";if(e.length>Pu)return"[Array]";for(var r=Math.min(od,t.length),n=t.length-r,i=[],s=0;s<r;++s)i.push(Rr(t[s],e));return n===1?i.push("... 1 more item"):n>1&&i.push("... ".concat(n," more items")),"["+i.join(", ")+"]"}function dd(t){var e=t[String(sd.default)];if(typeof e=="function")return e;if(typeof t.inspect=="function")return t.inspect}function hd(t){var e=Object.prototype.toString.call(t).replace(/^\[object /,"").replace(/]$/,"");if(e==="Object"&&typeof t.constructor=="function"){var r=t.constructor.name;if(typeof r=="string"&&r!=="")return r}return e}});var Iu=p(ri=>{"use strict";Object.defineProperty(ri,"__esModule",{value:!0});ri.default=pd;function pd(t,e){var r=Boolean(t);if(!r)throw new Error(e!=null?e:"Unexpected invariant triggered.")}});var qu=p(ni=>{"use strict";Object.defineProperty(ni,"__esModule",{value:!0});ni.default=md;var vd=_u(Iu()),ku=_u(ei());function _u(t){return t&&t.__esModule?t:{default:t}}function md(t){var e=t.prototype.toJSON;typeof e=="function"||(0,vd.default)(0),t.prototype.inspect=e,ku.default&&(t.prototype[ku.default]=e)}});var ju=p(De=>{"use strict";Object.defineProperty(De,"__esModule",{value:!0});De.isNode=gd;De.Token=De.Location=void 0;var Du=yd(qu());function yd(t){return t&&t.__esModule?t:{default:t}}var Uu=function(){function t(r,n,i){this.start=r.start,this.end=n.end,this.startToken=r,this.endToken=n,this.source=i}var e=t.prototype;return e.toJSON=function(){return{start:this.start,end:this.end}},t}();De.Location=Uu;(0,Du.default)(Uu);var Mu=function(){function t(r,n,i,s,a,u,c){this.kind=r,this.start=n,this.end=i,this.line=s,this.column=a,this.value=c,this.prev=u,this.next=null}var e=t.prototype;return e.toJSON=function(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}},t}();De.Token=Mu;(0,Du.default)(Mu);function gd(t){return t!=null&&typeof t.kind=="string"}});var Fu=p(ye=>{"use strict";Object.defineProperty(ye,"__esModule",{value:!0});ye.visit=wd;ye.visitInParallel=xd;ye.getVisitFn=Or;ye.BREAK=ye.QueryDocumentKeys=void 0;var Ed=Sd(Nu()),Lu=ju();function Sd(t){return t&&t.__esModule?t:{default:t}}var Bu={Name:[],Document:["definitions"],OperationDefinition:["name","variableDefinitions","directives","selectionSet"],VariableDefinition:["variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["description","directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","interfaces","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","locations"],SchemaExtension:["directives","operationTypes"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","interfaces","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"]};ye.QueryDocumentKeys=Bu;var rt=Object.freeze({});ye.BREAK=rt;function wd(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Bu,n=void 0,i=Array.isArray(t),s=[t],a=-1,u=[],c=void 0,l=void 0,o=void 0,f=[],d=[],h=t;do{a++;var y=a===s.length,E=y&&u.length!==0;if(y){if(l=d.length===0?void 0:f[f.length-1],c=o,o=d.pop(),E){if(i)c=c.slice();else{for(var v={},x=0,g=Object.keys(c);x<g.length;x++){var T=g[x];v[T]=c[T]}c=v}for(var O=0,N=0;N<u.length;N++){var j=u[N][0],b=u[N][1];i&&(j-=O),i&&b===null?(c.splice(j,1),O++):c[j]=b}}a=n.index,s=n.keys,u=n.edits,i=n.inArray,n=n.prev}else{if(l=o?i?a:s[a]:void 0,c=o?o[l]:h,c==null)continue;o&&f.push(l)}var w=void 0;if(!Array.isArray(c)){if(!(0,Lu.isNode)(c))throw new Error("Invalid AST Node: ".concat((0,Ed.default)(c),"."));var A=Or(e,c.kind,y);if(A){if(w=A.call(e,c,l,o,f,d),w===rt)break;if(w===!1){if(!y){f.pop();continue}}else if(w!==void 0&&(u.push([l,w]),!y))if((0,Lu.isNode)(w))c=w;else{f.pop();continue}}}if(w===void 0&&E&&u.push([l,c]),y)f.pop();else{var D;n={inArray:i,index:a,keys:s,edits:u,prev:n},i=Array.isArray(c),s=i?c:(D=r[c.kind])!==null&&D!==void 0?D:[],a=-1,u=[],o&&d.push(o),o=c}}while(n!==void 0);return u.length!==0&&(h=u[u.length-1][1]),h}function xd(t){var e=new Array(t.length);return{enter:function(n){for(var i=0;i<t.length;i++)if(e[i]==null){var s=Or(t[i],n.kind,!1);if(s){var a=s.apply(t[i],arguments);if(a===!1)e[i]=n;else if(a===rt)e[i]=rt;else if(a!==void 0)return a}}},leave:function(n){for(var i=0;i<t.length;i++)if(e[i]==null){var s=Or(t[i],n.kind,!0);if(s){var a=s.apply(t[i],arguments);if(a===rt)e[i]=rt;else if(a!==void 0&&a!==!1)return a}}else e[i]===n&&(e[i]=null)}}}function Or(t,e,r){var n=t[e];if(n){if(!r&&typeof n=="function")return n;var i=r?n.leave:n.enter;if(typeof i=="function")return i}else{var s=r?t.leave:t.enter;if(s){if(typeof s=="function")return s;var a=s[e];if(typeof a=="function")return a}}}});var Gu=p(It=>{"use strict";Object.defineProperty(It,"__esModule",{value:!0});It.dedentBlockStringValue=Td;It.getBlockStringIndentation=Hu;It.printBlockString=bd;function Td(t){var e=t.split(/\r\n|[\n\r]/g),r=Hu(t);if(r!==0)for(var n=1;n<e.length;n++)e[n]=e[n].slice(r);for(var i=0;i<e.length&&Vu(e[i]);)++i;for(var s=e.length;s>i&&Vu(e[s-1]);)--s;return e.slice(i,s).join(`
|
|
5
|
+
`)}function Vu(t){for(var e=0;e<t.length;++e)if(t[e]!==" "&&t[e]!==" ")return!1;return!0}function Hu(t){for(var e,r=!0,n=!0,i=0,s=null,a=0;a<t.length;++a)switch(t.charCodeAt(a)){case 13:t.charCodeAt(a+1)===10&&++a;case 10:r=!1,n=!0,i=0;break;case 9:case 32:++i;break;default:n&&!r&&(s===null||i<s)&&(s=i),n=!1}return(e=s)!==null&&e!==void 0?e:0}function bd(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,n=t.indexOf(`
|
|
6
|
+
`)===-1,i=t[0]===" "||t[0]===" ",s=t[t.length-1]==='"',a=t[t.length-1]==="\\",u=!n||s||a||r,c="";return u&&!(n&&i)&&(c+=`
|
|
7
7
|
`+e),c+=e?t.replace(/\n/g,`
|
|
8
|
-
`+e):t,
|
|
9
|
-
`),'"""'+c.replace(/"""/g,'\\"""')+'"""'}});var
|
|
8
|
+
`+e):t,u&&(c+=`
|
|
9
|
+
`),'"""'+c.replace(/"""/g,'\\"""')+'"""'}});var zu=p(ii=>{"use strict";Object.defineProperty(ii,"__esModule",{value:!0});ii.print=Od;var Ad=Fu(),Rd=Gu();function Od(t){return(0,Ad.visit)(t,{leave:Pd})}var Cd=80,Pd={Name:function(e){return e.value},Variable:function(e){return"$"+e.name},Document:function(e){return S(e.definitions,`
|
|
10
10
|
|
|
11
11
|
`)+`
|
|
12
|
-
`},OperationDefinition:function(e){var r=e.operation,n=e.name,i=
|
|
13
|
-
`,
|
|
12
|
+
`},OperationDefinition:function(e){var r=e.operation,n=e.name,i=L("(",S(e.variableDefinitions,", "),")"),s=S(e.directives," "),a=e.selectionSet;return!n&&!s&&!i&&r==="query"?a:S([r,S([n,i]),s,a]," ")},VariableDefinition:function(e){var r=e.variable,n=e.type,i=e.defaultValue,s=e.directives;return r+": "+n+L(" = ",i)+L(" ",S(s," "))},SelectionSet:function(e){var r=e.selections;return le(r)},Field:function(e){var r=e.alias,n=e.name,i=e.arguments,s=e.directives,a=e.selectionSet,u=L("",r,": ")+n,c=u+L("(",S(i,", "),")");return c.length>Cd&&(c=u+L(`(
|
|
13
|
+
`,Cr(S(i,`
|
|
14
14
|
`)),`
|
|
15
|
-
)`)),S([c,S(s," "),
|
|
16
|
-
`,
|
|
15
|
+
)`)),S([c,S(s," "),a]," ")},Argument:function(e){var r=e.name,n=e.value;return r+": "+n},FragmentSpread:function(e){var r=e.name,n=e.directives;return"..."+r+L(" ",S(n," "))},InlineFragment:function(e){var r=e.typeCondition,n=e.directives,i=e.selectionSet;return S(["...",L("on ",r),S(n," "),i]," ")},FragmentDefinition:function(e){var r=e.name,n=e.typeCondition,i=e.variableDefinitions,s=e.directives,a=e.selectionSet;return"fragment ".concat(r).concat(L("(",S(i,", "),")")," ")+"on ".concat(n," ").concat(L("",S(s," ")," "))+a},IntValue:function(e){var r=e.value;return r},FloatValue:function(e){var r=e.value;return r},StringValue:function(e,r){var n=e.value,i=e.block;return i?(0,Rd.printBlockString)(n,r==="description"?"":" "):JSON.stringify(n)},BooleanValue:function(e){var r=e.value;return r?"true":"false"},NullValue:function(){return"null"},EnumValue:function(e){var r=e.value;return r},ListValue:function(e){var r=e.values;return"["+S(r,", ")+"]"},ObjectValue:function(e){var r=e.fields;return"{"+S(r,", ")+"}"},ObjectField:function(e){var r=e.name,n=e.value;return r+": "+n},Directive:function(e){var r=e.name,n=e.arguments;return"@"+r+L("(",S(n,", "),")")},NamedType:function(e){var r=e.name;return r},ListType:function(e){var r=e.type;return"["+r+"]"},NonNullType:function(e){var r=e.type;return r+"!"},SchemaDefinition:ce(function(t){var e=t.directives,r=t.operationTypes;return S(["schema",S(e," "),le(r)]," ")}),OperationTypeDefinition:function(e){var r=e.operation,n=e.type;return r+": "+n},ScalarTypeDefinition:ce(function(t){var e=t.name,r=t.directives;return S(["scalar",e,S(r," ")]," ")}),ObjectTypeDefinition:ce(function(t){var e=t.name,r=t.interfaces,n=t.directives,i=t.fields;return S(["type",e,L("implements ",S(r," & ")),S(n," "),le(i)]," ")}),FieldDefinition:ce(function(t){var e=t.name,r=t.arguments,n=t.type,i=t.directives;return e+(Ju(r)?L(`(
|
|
16
|
+
`,Cr(S(r,`
|
|
17
17
|
`)),`
|
|
18
|
-
)`):
|
|
19
|
-
`,
|
|
18
|
+
)`):L("(",S(r,", "),")"))+": "+n+L(" ",S(i," "))}),InputValueDefinition:ce(function(t){var e=t.name,r=t.type,n=t.defaultValue,i=t.directives;return S([e+": "+r,L("= ",n),S(i," ")]," ")}),InterfaceTypeDefinition:ce(function(t){var e=t.name,r=t.interfaces,n=t.directives,i=t.fields;return S(["interface",e,L("implements ",S(r," & ")),S(n," "),le(i)]," ")}),UnionTypeDefinition:ce(function(t){var e=t.name,r=t.directives,n=t.types;return S(["union",e,S(r," "),n&&n.length!==0?"= "+S(n," | "):""]," ")}),EnumTypeDefinition:ce(function(t){var e=t.name,r=t.directives,n=t.values;return S(["enum",e,S(r," "),le(n)]," ")}),EnumValueDefinition:ce(function(t){var e=t.name,r=t.directives;return S([e,S(r," ")]," ")}),InputObjectTypeDefinition:ce(function(t){var e=t.name,r=t.directives,n=t.fields;return S(["input",e,S(r," "),le(n)]," ")}),DirectiveDefinition:ce(function(t){var e=t.name,r=t.arguments,n=t.repeatable,i=t.locations;return"directive @"+e+(Ju(r)?L(`(
|
|
19
|
+
`,Cr(S(r,`
|
|
20
20
|
`)),`
|
|
21
|
-
)`):
|
|
22
|
-
`)}}function S(t){var e,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return(e=t==null?void 0:t.filter(function(n){return n}).join(r))!==null&&e!==void 0?e:""}function le(t){return
|
|
23
|
-
`,
|
|
21
|
+
)`):L("(",S(r,", "),")"))+(n?" repeatable":"")+" on "+S(i," | ")}),SchemaExtension:function(e){var r=e.directives,n=e.operationTypes;return S(["extend schema",S(r," "),le(n)]," ")},ScalarTypeExtension:function(e){var r=e.name,n=e.directives;return S(["extend scalar",r,S(n," ")]," ")},ObjectTypeExtension:function(e){var r=e.name,n=e.interfaces,i=e.directives,s=e.fields;return S(["extend type",r,L("implements ",S(n," & ")),S(i," "),le(s)]," ")},InterfaceTypeExtension:function(e){var r=e.name,n=e.interfaces,i=e.directives,s=e.fields;return S(["extend interface",r,L("implements ",S(n," & ")),S(i," "),le(s)]," ")},UnionTypeExtension:function(e){var r=e.name,n=e.directives,i=e.types;return S(["extend union",r,S(n," "),i&&i.length!==0?"= "+S(i," | "):""]," ")},EnumTypeExtension:function(e){var r=e.name,n=e.directives,i=e.values;return S(["extend enum",r,S(n," "),le(i)]," ")},InputObjectTypeExtension:function(e){var r=e.name,n=e.directives,i=e.fields;return S(["extend input",r,S(n," "),le(i)]," ")}};function ce(t){return function(e){return S([e.description,t(e)],`
|
|
22
|
+
`)}}function S(t){var e,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return(e=t==null?void 0:t.filter(function(n){return n}).join(r))!==null&&e!==void 0?e:""}function le(t){return L(`{
|
|
23
|
+
`,Cr(S(t,`
|
|
24
24
|
`)),`
|
|
25
|
-
}`)}function
|
|
26
|
-
`))}function
|
|
27
|
-
`)!==-1}function bc(t){return t!=null&&t.some(nh)}});var m=function(){return m=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},m.apply(this,arguments)};function Ve(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]]);return r}function R(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function C(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],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 k(t,e,r){if(r||arguments.length===2)for(var n=0,i=e.length,s;n<i;n++)(s||!(n in e))&&(s||(s=Array.prototype.slice.call(e,0,n)),s[n]=e[n]);return t.concat(s||Array.prototype.slice.call(e))}var I;(function(t){t.Start="xstate.start",t.Stop="xstate.stop",t.Raise="xstate.raise",t.Send="xstate.send",t.Cancel="xstate.cancel",t.NullEvent="",t.Assign="xstate.assign",t.After="xstate.after",t.DoneState="done.state",t.DoneInvoke="done.invoke",t.Log="xstate.log",t.Init="xstate.init",t.Invoke="xstate.invoke",t.ErrorExecution="error.execution",t.ErrorCommunication="error.communication",t.ErrorPlatform="error.platform",t.ErrorCustom="xstate.error",t.Update="xstate.update",t.Pure="xstate.pure",t.Choose="xstate.choose"})(I||(I={}));var we;(function(t){t.Parent="#_parent",t.Internal="#_internal"})(we||(we={}));var lt=I.Start,He=I.Stop,Ge=I.Raise,Ae=I.Send,Bt=I.Cancel,Ei=I.NullEvent,Ft=I.Assign,uh=I.After,ch=I.DoneState,Vt=I.Log,Si=I.Init,ft=I.Invoke,lh=I.ErrorExecution,jr=I.ErrorPlatform,Br=I.ErrorCustom,dt=I.Update,wi=I.Choose,xi=I.Pure;var Ht=".",Fr={},Gt="xstate.guard",Ti="";var M=!0;var Jt;function ht(t,e,r){r===void 0&&(r=Ht);var n=Je(t,r),i=Je(e,r);return P(i)?P(n)?i===n:!1:P(n)?n in i:Object.keys(n).every(function(s){return s in i?ht(n[s],i[s]):!1})}function zt(t){try{return P(t)||typeof t=="number"?"".concat(t):t.type}catch{throw new Error("Events must be strings or objects with a string event.type property.")}}function $t(t,e){try{return me(t)?t:t.toString().split(e)}catch{throw new Error("'".concat(t,"' is not a valid state path."))}}function Mc(t){return typeof t=="object"&&"value"in t&&"context"in t&&"event"in t&&"_event"in t}function Je(t,e){if(Mc(t))return t.value;if(me(t))return pt(t);if(typeof t!="string")return t;var r=$t(t,e);return pt(r)}function pt(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 ze(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 Vr(t,e,r){var n,i,s={};try{for(var o=R(Object.keys(t)),a=o.next();!a.done;a=o.next()){var c=a.value,l=t[c];!r(l)||(s[c]=e(l,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 bi=function(t){return function(e){var r,n,i=e;try{for(var s=R(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=R(t),a=o.next();!a.done;a=o.next()){var c=a.value;s=s[e][c]}}catch(l){n={error:l}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}return s}}function vt(t){if(!t)return[[]];if(P(t))return[[t]];var e=U(Object.keys(t).map(function(r){var n=t[r];return typeof n!="string"&&(!n||!Object.keys(n).length)?[[r]]:vt(t[r]).map(function(i){return[r].concat(i)})}));return e}function U(t){var e;return(e=[]).concat.apply(e,k([],C(t),!1))}function Ri(t){return me(t)?t:[t]}function te(t){return t===void 0?[]:Ri(t)}function Re(t,e,r){var n,i;if(_(t))return t(e,r.data);var s={};try{for(var o=R(Object.keys(t)),a=o.next();!a.done;a=o.next()){var c=a.value,l=t[c];_(l)?s[c]=l(e,r.data):s[c]=l}}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 Oi(t){return/^(done|error)\./.test(t)}function Hr(t){return!!(t instanceof Promise||t!==null&&(_(t)||typeof t=="object")&&_(t.then))}function Ci(t){return t!==null&&typeof t=="object"&&"transition"in t&&typeof t.transition=="function"}function Wt(t,e){var r,n,i=C([[],[]],2),s=i[0],o=i[1];try{for(var a=R(t),c=a.next();!c.done;c=a.next()){var l=c.value;e(l)?s.push(l):o.push(l)}}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 Pi(t,e){return ze(t.states,function(r,n){if(!!r){var i=(P(e)?void 0:e[n])||(r?r.current:void 0);if(!!i)return{current:i,states:Pi(r,i)}}})}function Ni(t,e){return{current:e,states:Pi(t,e)}}function Gr(t,e,r,n){M||B(!!t,"Attempting to update undefined context");var i=t&&r.reduce(function(s,o){var a,c,l=o.assignment,u={state:n,action:o,_event:e},f={};if(_(l))f=l(s,e.data,u);else try{for(var d=R(Object.keys(l)),p=d.next();!p.done;p=d.next()){var y=p.value,E=l[y];f[y]=_(E)?E(s,e.data,u):E}}catch(v){a={error:v}}finally{try{p&&!p.done&&(c=d.return)&&c.call(d)}finally{if(a)throw a.error}}return Object.assign({},s,f)},t);return i}var B=function(){};M||(B=function(t,e){var r=t instanceof Error?t:void 0;if(!(!r&&t)&&console!==void 0){var n=["Warning: ".concat(e)];r&&n.push(r),console.warn.apply(console,n)}});function me(t){return Array.isArray(t)}function _(t){return typeof t=="function"}function P(t){return typeof t=="string"}function Kt(t,e){if(!!t)return P(t)?{type:Gt,name:t,predicate:e?e[t]:void 0}:_(t)?{type:Gt,name:t.name,predicate:t}:t}function Ii(t){try{return"subscribe"in t&&_(t.subscribe)}catch{return!1}}var fe=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}(),yh=(Jt={},Jt[fe]=function(){return this},Jt[Symbol.observable]=function(){return this},Jt);function de(t){return!!t&&"__xstatenode"in t}function _i(t){return!!t&&typeof t.send=="function"}function mt(t,e){return P(t)||typeof t=="number"?m({type:t},e):t}function F(t,e){if(!P(t)&&"$$type"in t&&t.$$type==="scxml")return t;var r=mt(t);return m({name:r.type,data:r,$$type:"scxml",type:"external"},e)}function Oe(t,e){var r=Ri(e).map(function(n){return typeof n=="undefined"||typeof n=="string"||de(n)?{target:n,event:t}:m(m({},n),{event:t})});return r}function ki(t){if(!(t===void 0||t===Ti))return te(t)}function Di(t,e,r){if(!M){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 Xt(t,e,r,n,i){var s=t.options.guards,o={state:i,cond:e,_event:n};if(e.type===Gt)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 Yt(t){return typeof t=="string"?{type:t}:t}function yt(t,e,r){if(typeof t=="object")return t;var n=function(){};return{next:t,error:e||n,complete:r||n}}function gt(t,e){return"".concat(t,":invocation[").concat(e,"]")}var Ce=F({type:Si});function Qt(t,e){return e&&e[t]||void 0}function $e(t,e){var r;if(P(t)||typeof t=="number"){var n=Qt(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=Qt(t.type,e);if(_(n))r=m(m({},t),{exec:n});else if(n){var i=n.type||t.type;r=m(m(m({},n),t),{type:i})}else r=t}return r}var Et=function(t,e){if(!t)return[];var r=me(t)?t:[t];return r.map(function(n){return $e(n,e)})};function er(t){var e=$e(t);return m(m({id:P(t)?t:e.id},e),{type:e.type})}function qi(t){return P(t)?{type:Ge,event:t}:St(t,{to:we.Internal})}function Lc(t){return{type:Ge,_event:F(t.event)}}function St(t,e){return{to:e?e.to:void 0,type:Ae,event:_(t)?t:mt(t),delay:e?e.delay:void 0,id:e&&e.id!==void 0?e.id:_(t)?t.name:zt(t)}}function jc(t,e,r,n){var i={_event:r},s=F(_(t.event)?t.event(e,r.data,i):t.event),o;if(P(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 m(m({},t),{to:c,_event:s,event:s.data,delay:o})}var Bc=function(t,e,r){return m(m({},t),{value:P(t.expr)?t.expr:t.expr(e,r.data,{_event:r})})},Ui=function(t){return{type:Bt,sendId:t}};function Mi(t){var e=er(t);return{type:I.Start,activity:e,exec:void 0}}function Li(t){var e=_(t)?t:er(t);return{type:I.Stop,activity:e,exec:void 0}}function Fc(t,e,r){var n=_(t.activity)?t.activity(e,r.data):t.activity,i=typeof n=="string"?{id:n}:n,s={type:I.Stop,activity:i};return s}var ji=function(t){return{type:Ft,assignment:t}};function Bi(t,e){var r=e?"#".concat(e):"";return"".concat(I.After,"(").concat(t,")").concat(r)}function wt(t,e){var r="".concat(I.DoneState,".").concat(t),n={type:r,data:e};return n.toString=function(){return r},n}function Pe(t,e){var r="".concat(I.DoneInvoke,".").concat(t),n={type:r,data:e};return n.toString=function(){return r},n}function Ne(t,e){var r="".concat(I.ErrorPlatform,".").concat(t),n={type:r,data:e};return n.toString=function(){return r},n}function Zt(t,e,r,n,i,s){s===void 0&&(s=!1);var o=C(s?[[],i]:Wt(i,function(d){return d.type===Ft}),2),a=o[0],c=o[1],l=a.length?Gr(r,n,a,e):r,u=s?[r]:void 0,f=U(c.map(function(d){var p;switch(d.type){case Ge:return Lc(d);case Ae:var y=jc(d,l,n,t.options.delays);return M||B(!P(d.delay)||typeof y.delay=="number","No delay reference for delay expression '".concat(d.delay,"' was found on machine '").concat(t.id,"'")),y;case Vt:return Bc(d,l,n);case wi:{var E=d,v=(p=E.conds.find(function(q){var V=Kt(q.cond,t.options.guards);return!V||Xt(t,V,l,n,e)}))===null||p===void 0?void 0:p.actions;if(!v)return[];var x=C(Zt(t,e,l,n,Et(te(v),t.options.actions),s),2),g=x[0],T=x[1];return l=T,u==null||u.push(l),g}case xi:{var v=d.get(l,n.data);if(!v)return[];var O=C(Zt(t,e,l,n,Et(te(v),t.options.actions),s),2),N=O[0],L=O[1];return l=L,u==null||u.push(l),N}case He:return Fc(d,l,n);case Ft:{l=Gr(l,n,[d],e),u==null||u.push(l);break}default:var b=$e(d,t.options.actions),w=b.exec;if(w&&u){var A=u.length-1;b=m(m({},b),{exec:function(q){for(var V=[],Q=1;Q<arguments.length;Q++)V[Q-1]=arguments[Q];w.apply(void 0,k([u[A]],C(V),!1))}})}return b}}).filter(function(d){return!!d}));return[f,l]}var Fi=[],Ie=function(t,e){Fi.push(t);var r=e(t);return Fi.pop(),r};function Vi(t){var e;return e={id:t,send:function(){},subscribe:function(){return{unsubscribe:function(){}}},getSnapshot:function(){},toJSON:function(){return{id:t}}},e[fe]=function(){return this},e}function Hi(t,e,r,n){var i,s=Yt(t.src),o=(i=e==null?void 0:e.options.services)===null||i===void 0?void 0:i[s.type],a=t.data?Re(t.data,r,n):void 0,c=o?Gi(o,t.id,a):Vi(t.id);return c.meta=t,c}function Gi(t,e,r){var n=Vi(e);if(n.deferred=!0,de(t)){var i=n.state=Ie(void 0,function(){return(r?t.withContext(r):t).initialState});n.getSnapshot=function(){return i}}return n}function Vc(t){try{return typeof t.send=="function"}catch{return!1}}function Ji(t){return Vc(t)&&"id"in t}function zi(t){var e;return m((e={subscribe:function(){return{unsubscribe:function(){}}},id:"anonymous",getSnapshot:function(){}},e[fe]=function(){return this},e),t)}var xt=function(t){return t.type==="atomic"||t.type==="final"};function _e(t){return Object.keys(t.states).map(function(e){return t.states[e]})}function zr(t){var e=[t];return xt(t)?e:e.concat(U(_e(t).map(zr)))}function ke(t,e){var r,n,i,s,o,a,c,l,u=new Set(t),f=Jr(u),d=new Set(e);try{for(var p=R(d),y=p.next();!y.done;y=p.next())for(var E=y.value,v=E.parent;v&&!d.has(v);)d.add(v),v=v.parent}catch(A){r={error:A}}finally{try{y&&!y.done&&(n=p.return)&&n.call(p)}finally{if(r)throw r.error}}var x=Jr(d);try{for(var g=R(d),T=g.next();!T.done;T=g.next()){var E=T.value;if(E.type==="compound"&&(!x.get(E)||!x.get(E).length))f.get(E)?f.get(E).forEach(function(q){return d.add(q)}):E.initialStateNodes.forEach(function(q){return d.add(q)});else if(E.type==="parallel")try{for(var O=(o=void 0,R(_e(E))),N=O.next();!N.done;N=O.next()){var L=N.value;L.type!=="history"&&(d.has(L)||(d.add(L),f.get(L)?f.get(L).forEach(function(q){return d.add(q)}):L.initialStateNodes.forEach(function(q){return d.add(q)})))}}catch(q){o={error:q}}finally{try{N&&!N.done&&(a=O.return)&&a.call(O)}finally{if(o)throw o.error}}}}catch(A){i={error:A}}finally{try{T&&!T.done&&(s=g.return)&&s.call(g)}finally{if(i)throw i.error}}try{for(var b=R(d),w=b.next();!w.done;w=b.next())for(var E=w.value,v=E.parent;v&&!d.has(v);)d.add(v),v=v.parent}catch(A){c={error:A}}finally{try{w&&!w.done&&(l=b.return)&&l.call(b)}finally{if(c)throw c.error}}return d}function $i(t,e){var r=e.get(t);if(!r)return{};if(t.type==="compound"){var n=r[0];if(n){if(xt(n))return n.key}else return{}}var i={};return r.forEach(function(s){i[s.key]=$i(s,e)}),i}function Jr(t){var e,r,n=new Map;try{for(var i=R(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 Wi(t,e){var r=ke([t],e);return $i(t,Jr(r))}function Tt(t,e){return Array.isArray(t)?t.some(function(r){return r===e}):t instanceof Set?t.has(e):!1}function Ki(t){return k([],C(new Set(U(k([],C(t.map(function(e){return e.ownEvents})),!1)))),!1)}function De(t,e){return e.type==="compound"?_e(e).some(function(r){return r.type==="final"&&Tt(t,r)}):e.type==="parallel"?_e(e).every(function(r){return De(t,r)}):!1}function Xi(t){return t===void 0&&(t=[]),t.reduce(function(e,r){return r.meta!==void 0&&(e[r.id]=r.meta),e},{})}function $r(t){return new Set(U(t.map(function(e){return e.tags})))}function Wr(t,e){if(t===e)return!0;if(t===void 0||e===void 0)return!1;if(P(t)||P(e))return t===e;var r=Object.keys(t),n=Object.keys(e);return r.length===n.length&&r.every(function(i){return Wr(t[i],e[i])})}function Yi(t){return typeof t!="object"||t===null?!1:"value"in t&&"_event"in t}function Qi(t,e){var r=t.exec,n=m(m({},t),{exec:r!==void 0?function(){return r(e.context,e.event,{action:t,state:e,_event:e._event})}:void 0});return n}var se=function(){function t(e){var r=this,n;this.actions=[],this.activities=Fr,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||Fr,this.meta=Xi(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 Ki(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=Ce;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=Ce;return new t({value:e.value,context:r,_event:n,_sessionid:null,historyValue:e.historyValue,history:e.history,activities:e.activities,configuration:e.configuration,transitions:[],children:{}})}return t.from(e,r)},t.prototype.toStrings=function(e,r){var n=this;if(e===void 0&&(e=this.value),r===void 0&&(r="."),P(e))return[e];var i=Object.keys(e);return i.concat.apply(i,k([],C(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=Ve(e,["configuration","transitions","tags","machine"]);return m(m({},n),{tags:Array.from(r)})},t.prototype.matches=function(e){return ht(e,this.value)},t.prototype.hasTag=function(e){return this.tags.has(e)},t.prototype.can=function(e){var r;M&&B(!!this.machine,"state.can(...) used outside of a machine-created State object; this will always return false.");var n=(r=this.machine)===null||r===void 0?void 0:r.getTransitionData(this,e);return!!(n!=null&&n.transitions.length)&&n.transitions.some(function(i){return i.target!==void 0||i.actions.length})},t}();var Hc={deferEvents:!1},Kr=function(){function t(e){this.processingEvent=!1,this.queue=[],this.initialized=!1,this.options=m(m({},Hc),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 Xr=new Map,Gc=0,bt={bookId:function(){return"x:".concat(Gc++)},register:function(t,e){return Xr.set(t,e),t},get:function(t){return Xr.get(t)},free:function(t){Xr.delete(t)}};function tr(){if(typeof globalThis!="undefined")return globalThis;if(typeof self!="undefined")return self;if(typeof window!="undefined")return window;if(typeof global!="undefined")return global;M||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 Jc(){var t=tr();if(t&&"__xstate__"in t)return t.__xstate__}function Zi(t){if(!!tr()){var e=Jc();e&&e.register(t)}}function es(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 l=i.shift();r=t.transition(r,l,c),n.forEach(function(u){return u.next(r)})}s=!1}},a=zi({id:e.id,send:function(l){i.push(l),o()},getSnapshot:function(){return r},subscribe:function(l,u,f){var d=yt(l,u,f);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 zc={sync:!1,autoForward:!1},z;(function(t){t[t.NotStarted=0]="NotStarted",t[t.Running=1]="Running",t[t.Stopped=2]="Stopped"})(z||(z={}));var ts=function(){function t(e,r){var n=this;r===void 0&&(r=t.defaultOptions),this.machine=e,this.scheduler=new Kr,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=z.NotStarted,this.children=new Map,this.forwardTo=new Set,this.init=this.start,this.send=function(u,f){if(me(u))return n.batch(u),n.state;var d=F(mt(u,f));if(n.status===z.Stopped)return M||B(!1,'Event "'.concat(d.name,'" was sent to stopped service "').concat(n.machine.id,`". This service has already reached its final state, and will not transition.
|
|
25
|
+
}`)}function L(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"";return e!=null&&e!==""?t+e+r:""}function Cr(t){return L(" ",t.replace(/\n/g,`
|
|
26
|
+
`))}function Nd(t){return t.indexOf(`
|
|
27
|
+
`)!==-1}function Ju(t){return t!=null&&t.some(Nd)}});var m=function(){return m=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},m.apply(this,arguments)};function Me(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]]);return r}function R(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function C(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],a;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(u){a={error:u}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return s}function _(t,e,r){if(r||arguments.length===2)for(var n=0,i=e.length,s;n<i;n++)(s||!(n in e))&&(s||(s=Array.prototype.slice.call(e,0,n)),s[n]=e[n]);return t.concat(s||Array.prototype.slice.call(e))}var I;(function(t){t.Start="xstate.start",t.Stop="xstate.stop",t.Raise="xstate.raise",t.Send="xstate.send",t.Cancel="xstate.cancel",t.NullEvent="",t.Assign="xstate.assign",t.After="xstate.after",t.DoneState="done.state",t.DoneInvoke="done.invoke",t.Log="xstate.log",t.Init="xstate.init",t.Invoke="xstate.invoke",t.ErrorExecution="error.execution",t.ErrorCommunication="error.communication",t.ErrorPlatform="error.platform",t.ErrorCustom="xstate.error",t.Update="xstate.update",t.Pure="xstate.pure",t.Choose="xstate.choose"})(I||(I={}));var Ee;(function(t){t.Parent="#_parent",t.Internal="#_internal"})(Ee||(Ee={}));var it=I.Start,je=I.Stop,Le=I.Raise,we=I.Send,_t=I.Cancel,oi=I.NullEvent,qt=I.Assign,Dd=I.After,Ud=I.DoneState,Dt=I.Log,ui=I.Init,st=I.Invoke,Md=I.ErrorExecution,Nr=I.ErrorPlatform,Ir=I.ErrorCustom,at=I.Update,ci=I.Choose,li=I.Pure;var Ut=".",kr={},Mt="xstate.guard",fi="";var M=!0;var jt;function ut(t,e,r){r===void 0&&(r=Ut);var n=Be(t,r),i=Be(e,r);return P(i)?P(n)?i===n:!1:P(n)?n in i:Object.keys(n).every(function(s){return s in i?ut(n[s],i[s]):!1})}function Lt(t){try{return P(t)||typeof t=="number"?"".concat(t):t.type}catch{throw new Error("Events must be strings or objects with a string event.type property.")}}function Bt(t,e){try{return ve(t)?t:t.toString().split(e)}catch{throw new Error("'".concat(t,"' is not a valid state path."))}}function ic(t){return typeof t=="object"&&"value"in t&&"context"in t&&"event"in t&&"_event"in t}function Be(t,e){if(ic(t))return t.value;if(ve(t))return ot(t);if(typeof t!="string")return t;var r=Bt(t,e);return ot(r)}function ot(t){if(t.length===1)return t[0];for(var e={},r=e,n=0;n<t.length-1;n++)n===t.length-2?r[t[n]]=t[n+1]:(r[t[n]]={},r=r[t[n]]);return e}function Fe(t,e){for(var r={},n=Object.keys(t),i=0;i<n.length;i++){var s=n[i];r[s]=e(t[s],s,t,i)}return r}function _r(t,e,r){var n,i,s={};try{for(var a=R(Object.keys(t)),u=a.next();!u.done;u=a.next()){var c=u.value,l=t[c];!r(l)||(s[c]=e(l,c,t))}}catch(o){n={error:o}}finally{try{u&&!u.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}return s}var di=function(t){return function(e){var r,n,i=e;try{for(var s=R(t),a=s.next();!a.done;a=s.next()){var u=a.value;i=i[u]}}catch(c){r={error:c}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return i}};function hi(t,e){return function(r){var n,i,s=r;try{for(var a=R(t),u=a.next();!u.done;u=a.next()){var c=u.value;s=s[e][c]}}catch(l){n={error:l}}finally{try{u&&!u.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}return s}}function ct(t){if(!t)return[[]];if(P(t))return[[t]];var e=U(Object.keys(t).map(function(r){var n=t[r];return typeof n!="string"&&(!n||!Object.keys(n).length)?[[r]]:ct(t[r]).map(function(i){return[r].concat(i)})}));return e}function U(t){var e;return(e=[]).concat.apply(e,_([],C(t),!1))}function pi(t){return ve(t)?t:[t]}function te(t){return t===void 0?[]:pi(t)}function xe(t,e,r){var n,i;if(k(t))return t(e,r.data);var s={};try{for(var a=R(Object.keys(t)),u=a.next();!u.done;u=a.next()){var c=u.value,l=t[c];k(l)?s[c]=l(e,r.data):s[c]=l}}catch(o){n={error:o}}finally{try{u&&!u.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}return s}function vi(t){return/^(done|error)\./.test(t)}function qr(t){return!!(t instanceof Promise||t!==null&&(k(t)||typeof t=="object")&&k(t.then))}function mi(t){return t!==null&&typeof t=="object"&&"transition"in t&&typeof t.transition=="function"}function Ft(t,e){var r,n,i=C([[],[]],2),s=i[0],a=i[1];try{for(var u=R(t),c=u.next();!c.done;c=u.next()){var l=c.value;e(l)?s.push(l):a.push(l)}}catch(o){r={error:o}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(r)throw r.error}}return[s,a]}function yi(t,e){return Fe(t.states,function(r,n){if(!!r){var i=(P(e)?void 0:e[n])||(r?r.current:void 0);if(!!i)return{current:i,states:yi(r,i)}}})}function gi(t,e){return{current:e,states:yi(t,e)}}function Dr(t,e,r,n){M||B(!!t,"Attempting to update undefined context");var i=t&&r.reduce(function(s,a){var u,c,l=a.assignment,o={state:n,action:a,_event:e},f={};if(k(l))f=l(s,e.data,o);else try{for(var d=R(Object.keys(l)),h=d.next();!h.done;h=d.next()){var y=h.value,E=l[y];f[y]=k(E)?E(s,e.data,o):E}}catch(v){u={error:v}}finally{try{h&&!h.done&&(c=d.return)&&c.call(d)}finally{if(u)throw u.error}}return Object.assign({},s,f)},t);return i}var B=function(){};M||(B=function(t,e){var r=t instanceof Error?t:void 0;if(!(!r&&t)&&console!==void 0){var n=["Warning: ".concat(e)];r&&n.push(r),console.warn.apply(console,n)}});function ve(t){return Array.isArray(t)}function k(t){return typeof t=="function"}function P(t){return typeof t=="string"}function Vt(t,e){if(!!t)return P(t)?{type:Mt,name:t,predicate:e?e[t]:void 0}:k(t)?{type:Mt,name:t.name,predicate:t}:t}function Ei(t){try{return"subscribe"in t&&k(t.subscribe)}catch{return!1}}var fe=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}(),Gd=(jt={},jt[fe]=function(){return this},jt[Symbol.observable]=function(){return this},jt);function de(t){return!!t&&"__xstatenode"in t}function Si(t){return!!t&&typeof t.send=="function"}function lt(t,e){return P(t)||typeof t=="number"?m({type:t},e):t}function F(t,e){if(!P(t)&&"$$type"in t&&t.$$type==="scxml")return t;var r=lt(t);return m({name:r.type,data:r,$$type:"scxml",type:"external"},e)}function Te(t,e){var r=pi(e).map(function(n){return typeof n=="undefined"||typeof n=="string"||de(n)?{target:n,event:t}:m(m({},n),{event:t})});return r}function wi(t){if(!(t===void 0||t===fi))return te(t)}function xi(t,e,r){if(!M){var n=t.stack?" Stacktrace was '".concat(t.stack,"'"):"";if(t===e)console.error("Missing onError handler for invocation '".concat(r,"', error was '").concat(t,"'.").concat(n));else{var i=e.stack?" Stacktrace was '".concat(e.stack,"'"):"";console.error("Missing onError handler and/or unhandled exception/promise rejection for invocation '".concat(r,"'. ")+"Original error: '".concat(t,"'. ").concat(n," Current error is '").concat(e,"'.").concat(i))}}}function Ht(t,e,r,n,i){var s=t.options.guards,a={state:i,cond:e,_event:n};if(e.type===Mt)return((s==null?void 0:s[e.name])||e.predicate)(r,n.data,a);var u=s==null?void 0:s[e.type];if(!u)throw new Error("Guard '".concat(e.type,"' is not implemented on machine '").concat(t.id,"'."));return u(r,n.data,a)}function Gt(t){return typeof t=="string"?{type:t}:t}function ft(t,e,r){if(typeof t=="object")return t;var n=function(){};return{next:t,error:e||n,complete:r||n}}function dt(t,e){return"".concat(t,":invocation[").concat(e,"]")}var be=F({type:ui});function Jt(t,e){return e&&e[t]||void 0}function Ve(t,e){var r;if(P(t)||typeof t=="number"){var n=Jt(t,e);k(n)?r={type:t,exec:n}:n?r=n:r={type:t,exec:void 0}}else if(k(t))r={type:t.name||t.toString(),exec:t};else{var n=Jt(t.type,e);if(k(n))r=m(m({},t),{exec:n});else if(n){var i=n.type||t.type;r=m(m(m({},n),t),{type:i})}else r=t}return r}var ht=function(t,e){if(!t)return[];var r=ve(t)?t:[t];return r.map(function(n){return Ve(n,e)})};function $t(t){var e=Ve(t);return m(m({id:P(t)?t:e.id},e),{type:e.type})}function Ti(t){return P(t)?{type:Le,event:t}:pt(t,{to:Ee.Internal})}function sc(t){return{type:Le,_event:F(t.event)}}function pt(t,e){return{to:e?e.to:void 0,type:we,event:k(t)?t:lt(t),delay:e?e.delay:void 0,id:e&&e.id!==void 0?e.id:k(t)?t.name:Lt(t)}}function ac(t,e,r,n){var i={_event:r},s=F(k(t.event)?t.event(e,r.data,i):t.event),a;if(P(t.delay)){var u=n&&n[t.delay];a=k(u)?u(e,r.data,i):u}else a=k(t.delay)?t.delay(e,r.data,i):t.delay;var c=k(t.to)?t.to(e,r.data,i):t.to;return m(m({},t),{to:c,_event:s,event:s.data,delay:a})}var oc=function(t,e,r){return m(m({},t),{value:P(t.expr)?t.expr:t.expr(e,r.data,{_event:r})})},bi=function(t){return{type:_t,sendId:t}};function Ai(t){var e=$t(t);return{type:I.Start,activity:e,exec:void 0}}function Ri(t){var e=k(t)?t:$t(t);return{type:I.Stop,activity:e,exec:void 0}}function uc(t,e,r){var n=k(t.activity)?t.activity(e,r.data):t.activity,i=typeof n=="string"?{id:n}:n,s={type:I.Stop,activity:i};return s}var Oi=function(t){return{type:qt,assignment:t}};function Ci(t,e){var r=e?"#".concat(e):"";return"".concat(I.After,"(").concat(t,")").concat(r)}function vt(t,e){var r="".concat(I.DoneState,".").concat(t),n={type:r,data:e};return n.toString=function(){return r},n}function Ae(t,e){var r="".concat(I.DoneInvoke,".").concat(t),n={type:r,data:e};return n.toString=function(){return r},n}function Re(t,e){var r="".concat(I.ErrorPlatform,".").concat(t),n={type:r,data:e};return n.toString=function(){return r},n}function zt(t,e,r,n,i,s){s===void 0&&(s=!1);var a=C(s?[[],i]:Ft(i,function(d){return d.type===qt}),2),u=a[0],c=a[1],l=u.length?Dr(r,n,u,e):r,o=s?[r]:void 0,f=U(c.map(function(d){var h;switch(d.type){case Le:return sc(d);case we:var y=ac(d,l,n,t.options.delays);return M||B(!P(d.delay)||typeof y.delay=="number","No delay reference for delay expression '".concat(d.delay,"' was found on machine '").concat(t.id,"'")),y;case Dt:return oc(d,l,n);case ci:{var E=d,v=(h=E.conds.find(function(D){var V=Vt(D.cond,t.options.guards);return!V||Ht(t,V,l,n,e)}))===null||h===void 0?void 0:h.actions;if(!v)return[];var x=C(zt(t,e,l,n,ht(te(v),t.options.actions),s),2),g=x[0],T=x[1];return l=T,o==null||o.push(l),g}case li:{var v=d.get(l,n.data);if(!v)return[];var O=C(zt(t,e,l,n,ht(te(v),t.options.actions),s),2),N=O[0],j=O[1];return l=j,o==null||o.push(l),N}case je:return uc(d,l,n);case qt:{l=Dr(l,n,[d],e),o==null||o.push(l);break}default:var b=Ve(d,t.options.actions),w=b.exec;if(w&&o){var A=o.length-1;b=m(m({},b),{exec:function(D){for(var V=[],Q=1;Q<arguments.length;Q++)V[Q-1]=arguments[Q];w.apply(void 0,_([o[A]],C(V),!1))}})}return b}}).filter(function(d){return!!d}));return[f,l]}var Pi=[],Oe=function(t,e){Pi.push(t);var r=e(t);return Pi.pop(),r};function Ni(t){var e;return e={id:t,send:function(){},subscribe:function(){return{unsubscribe:function(){}}},getSnapshot:function(){},toJSON:function(){return{id:t}}},e[fe]=function(){return this},e}function Ii(t,e,r,n){var i,s=Gt(t.src),a=(i=e==null?void 0:e.options.services)===null||i===void 0?void 0:i[s.type],u=t.data?xe(t.data,r,n):void 0,c=a?ki(a,t.id,u):Ni(t.id);return c.meta=t,c}function ki(t,e,r){var n=Ni(e);if(n.deferred=!0,de(t)){var i=n.state=Oe(void 0,function(){return(r?t.withContext(r):t).initialState});n.getSnapshot=function(){return i}}return n}function cc(t){try{return typeof t.send=="function"}catch{return!1}}function _i(t){return cc(t)&&"id"in t}function qi(t){var e;return m((e={subscribe:function(){return{unsubscribe:function(){}}},id:"anonymous",getSnapshot:function(){}},e[fe]=function(){return this},e),t)}var mt=function(t){return t.type==="atomic"||t.type==="final"};function Ce(t){return Object.keys(t.states).map(function(e){return t.states[e]})}function Mr(t){var e=[t];return mt(t)?e:e.concat(U(Ce(t).map(Mr)))}function Pe(t,e){var r,n,i,s,a,u,c,l,o=new Set(t),f=Ur(o),d=new Set(e);try{for(var h=R(d),y=h.next();!y.done;y=h.next())for(var E=y.value,v=E.parent;v&&!d.has(v);)d.add(v),v=v.parent}catch(A){r={error:A}}finally{try{y&&!y.done&&(n=h.return)&&n.call(h)}finally{if(r)throw r.error}}var x=Ur(d);try{for(var g=R(d),T=g.next();!T.done;T=g.next()){var E=T.value;if(E.type==="compound"&&(!x.get(E)||!x.get(E).length))f.get(E)?f.get(E).forEach(function(D){return d.add(D)}):E.initialStateNodes.forEach(function(D){return d.add(D)});else if(E.type==="parallel")try{for(var O=(a=void 0,R(Ce(E))),N=O.next();!N.done;N=O.next()){var j=N.value;j.type!=="history"&&(d.has(j)||(d.add(j),f.get(j)?f.get(j).forEach(function(D){return d.add(D)}):j.initialStateNodes.forEach(function(D){return d.add(D)})))}}catch(D){a={error:D}}finally{try{N&&!N.done&&(u=O.return)&&u.call(O)}finally{if(a)throw a.error}}}}catch(A){i={error:A}}finally{try{T&&!T.done&&(s=g.return)&&s.call(g)}finally{if(i)throw i.error}}try{for(var b=R(d),w=b.next();!w.done;w=b.next())for(var E=w.value,v=E.parent;v&&!d.has(v);)d.add(v),v=v.parent}catch(A){c={error:A}}finally{try{w&&!w.done&&(l=b.return)&&l.call(b)}finally{if(c)throw c.error}}return d}function Di(t,e){var r=e.get(t);if(!r)return{};if(t.type==="compound"){var n=r[0];if(n){if(mt(n))return n.key}else return{}}var i={};return r.forEach(function(s){i[s.key]=Di(s,e)}),i}function Ur(t){var e,r,n=new Map;try{for(var i=R(t),s=i.next();!s.done;s=i.next()){var a=s.value;n.has(a)||n.set(a,[]),a.parent&&(n.has(a.parent)||n.set(a.parent,[]),n.get(a.parent).push(a))}}catch(u){e={error:u}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}return n}function Ui(t,e){var r=Pe([t],e);return Di(t,Ur(r))}function yt(t,e){return Array.isArray(t)?t.some(function(r){return r===e}):t instanceof Set?t.has(e):!1}function Mi(t){return _([],C(new Set(U(_([],C(t.map(function(e){return e.ownEvents})),!1)))),!1)}function Ne(t,e){return e.type==="compound"?Ce(e).some(function(r){return r.type==="final"&&yt(t,r)}):e.type==="parallel"?Ce(e).every(function(r){return Ne(t,r)}):!1}function ji(t){return t===void 0&&(t=[]),t.reduce(function(e,r){return r.meta!==void 0&&(e[r.id]=r.meta),e},{})}function jr(t){return new Set(U(t.map(function(e){return e.tags})))}function Lr(t,e){if(t===e)return!0;if(t===void 0||e===void 0)return!1;if(P(t)||P(e))return t===e;var r=Object.keys(t),n=Object.keys(e);return r.length===n.length&&r.every(function(i){return Lr(t[i],e[i])})}function Li(t){return typeof t!="object"||t===null?!1:"value"in t&&"_event"in t}function Bi(t,e){var r=t.exec,n=m(m({},t),{exec:r!==void 0?function(){return r(e.context,e.event,{action:t,state:e,_event:e._event})}:void 0});return n}var se=function(){function t(e){var r=this,n;this.actions=[],this.activities=kr,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||kr,this.meta=ji(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 Mi(r.configuration)}})}return t.from=function(e,r){if(e instanceof t)return e.context!==r?new t({value:e.value,context:r,_event:e._event,_sessionid:null,historyValue:e.historyValue,history:e.history,actions:[],activities:e.activities,meta:{},events:[],configuration:[],transitions:[],children:{}}):e;var n=be;return new t({value:e,context:r,_event:n,_sessionid:null,historyValue:void 0,history:void 0,actions:[],activities:void 0,meta:void 0,events:[],configuration:[],transitions:[],children:{}})},t.create=function(e){return new t(e)},t.inert=function(e,r){if(e instanceof t){if(!e.actions.length)return e;var n=be;return new t({value:e.value,context:r,_event:n,_sessionid:null,historyValue:e.historyValue,history:e.history,activities:e.activities,configuration:e.configuration,transitions:[],children:{}})}return t.from(e,r)},t.prototype.toStrings=function(e,r){var n=this;if(e===void 0&&(e=this.value),r===void 0&&(r="."),P(e))return[e];var i=Object.keys(e);return i.concat.apply(i,_([],C(i.map(function(s){return n.toStrings(e[s],r).map(function(a){return s+r+a})})),!1))},t.prototype.toJSON=function(){var e=this;e.configuration,e.transitions;var r=e.tags;e.machine;var n=Me(e,["configuration","transitions","tags","machine"]);return m(m({},n),{tags:Array.from(r)})},t.prototype.matches=function(e){return ut(e,this.value)},t.prototype.hasTag=function(e){return this.tags.has(e)},t.prototype.can=function(e){var r;M&&B(!!this.machine,"state.can(...) used outside of a machine-created State object; this will always return false.");var n=(r=this.machine)===null||r===void 0?void 0:r.getTransitionData(this,e);return!!(n!=null&&n.transitions.length)&&n.transitions.some(function(i){return i.target!==void 0||i.actions.length})},t}();var lc={deferEvents:!1},Br=function(){function t(e){this.processingEvent=!1,this.queue=[],this.initialized=!1,this.options=m(m({},lc),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 Fr=new Map,fc=0,gt={bookId:function(){return"x:".concat(fc++)},register:function(t,e){return Fr.set(t,e),t},get:function(t){return Fr.get(t)},free:function(t){Fr.delete(t)}};function Wt(){if(typeof globalThis!="undefined")return globalThis;if(typeof self!="undefined")return self;if(typeof window!="undefined")return window;if(typeof global!="undefined")return global;M||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 dc(){var t=Wt();if(t&&"__xstate__"in t)return t.__xstate__}function Fi(t){if(!!Wt()){var e=dc();e&&e.register(t)}}function Vi(t,e){e===void 0&&(e={});var r=t.initialState,n=new Set,i=[],s=!1,a=function(){if(!s){for(s=!0;i.length>0;){var l=i.shift();r=t.transition(r,l,c),n.forEach(function(o){return o.next(r)})}s=!1}},u=qi({id:e.id,send:function(l){i.push(l),a()},getSnapshot:function(){return r},subscribe:function(l,o,f){var d=ft(l,o,f);return n.add(d),d.next(r),{unsubscribe:function(){n.delete(d)}}}}),c={parent:e.parent,self:u,id:e.id||"anonymous",observers:n};return r=t.start?t.start(c):r,u}var hc={sync:!1,autoForward:!1},z;(function(t){t[t.NotStarted=0]="NotStarted",t[t.Running=1]="Running",t[t.Stopped=2]="Stopped"})(z||(z={}));var Hi=function(){function t(e,r){var n=this;r===void 0&&(r=t.defaultOptions),this.machine=e,this.scheduler=new Br,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=z.NotStarted,this.children=new Map,this.forwardTo=new Set,this.init=this.start,this.send=function(o,f){if(ve(o))return n.batch(o),n.state;var d=F(lt(o,f));if(n.status===z.Stopped)return M||B(!1,'Event "'.concat(d.name,'" was sent to stopped service "').concat(n.machine.id,`". This service has already reached its final state, and will not transition.
|
|
28
28
|
Event: `).concat(JSON.stringify(d.data))),n.state;if(n.status!==z.Running&&!n.options.deferEvents)throw new Error('Event "'.concat(d.name,'" was sent to uninitialized service "').concat(n.machine.id,`". Make sure .start() is called for this service, or set { deferEvents: true } in the service options.
|
|
29
|
-
Event: `).concat(JSON.stringify(d.data)));return n.scheduler.schedule(function(){n.forward(d);var
|
|
30
|
-
Event: `).concat(JSON.stringify(event)));else if(this.status!==z.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 p=F(d);r.forward(p),s=Ie(r,function(){return r.machine.transition(s,p)}),a.push.apply(a,k([],C(s.actions.map(function(y){return Qi(y,s)})),!1)),o=o||!!s.changed};try{for(var l=R(e),u=l.next();!u.done;u=l.next()){var f=u.value;c(f)}}catch(d){n={error:d}}finally{try{u&&!u.done&&(i=l.return)&&i.call(l)}finally{if(n)throw n.error}}s.changed=o,s.actions=a,r.update(s,F(e[e.length-1]))})},t.prototype.sender=function(e){return this.send.bind(this,e)},t.prototype.nextState=function(e){var r=this,n=F(e);if(n.name.indexOf(jr)===0&&!this.state.nextEvents.some(function(s){return s.indexOf(jr)===0}))throw n.data.data;var i=Ie(this,function(){return r.machine.transition(r.state,n)});return i},t.prototype.forward=function(e){var r,n;try{for(var i=R(this.forwardTo),s=i.next();!s.done;s=i.next()){var 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||Qt(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(O){throw this.parent&&this.parent.send({type:"xstate.error",data:O}),O}switch(e.type){case Ae: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 Bt:this.cancel(e.sendId);break;case lt:{if(this.status!==z.Running)return;var l=e.activity;if(!this.state.activities[l.id||l.type])break;if(l.type===I.Invoke){var u=Yt(l.src),f=this.machine.options.services?this.machine.options.services[u.type]:void 0,d=l.id,p=l.data;M||B(!("forward"in l),"`forward` property is deprecated (found in invocation of '".concat(l.src,"' in in machine '").concat(this.machine.id,"'). ")+"Please use `autoForward` instead.");var y="autoForward"in l?l.autoForward:!!l.forward;if(!f){M||B(!1,"No service found for invocation '".concat(l.src,"' in machine '").concat(this.machine.id,"'."));return}var E=p?Re(p,i,s):void 0;if(typeof f=="string")return;var v=_(f)?f(i,s.data,{data:E,src:u,meta:l.meta}):f;if(!v)return;var x=void 0;de(v)&&(v=E?v.withContext(E):v,x={autoForward:y}),this.spawn(v,d,x)}else this.spawnActivity(l);break}case He:{this.stopChild(e.activity.id);break}case Vt:var g=e.label,T=e.value;g?this.logger(g,T):this.logger(T);break;default:M||B(!1,"No implementation found for action type '".concat(e.type,"'"));break}},t.prototype.removeChild=function(e){var r;this.children.delete(e),this.forwardTo.delete(e),(r=this.state)===null||r===void 0||delete r.children[e]},t.prototype.stopChild=function(e){var r=this.children.get(e);!r||(this.removeChild(e),_(r.stop)&&r.stop())},t.prototype.spawn=function(e,r,n){if(Hr(e))return this.spawnPromise(Promise.resolve(e),r);if(_(e))return this.spawnCallback(e,r);if(Ji(e))return this.spawnActor(e,r);if(Ii(e))return this.spawnObservable(e,r);if(de(e))return this.spawnMachine(e,m(m({},n),{id:r}));if(Ci(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,m(m({},this.options),{parent:this,id:r.id||e.id})),s=m(m({},zc),r);s.sync&&i.onTransition(function(a){n.send(dt,{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(F(a,{origin:i.id}))}).start(),o},t.prototype.spawnBehavior=function(e,r){var n=es(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(F(Pe(r,c),{origin:r})))},function(c){if(!s){i.removeChild(r);var l=Ne(r,c);try{i.send(F(l,{origin:r}))}catch(u){Di(c,u,r),i.devTools&&i.devTools.send(l,i.state),i.machine.strict&&i.stop()}}});var a=(n={id:r,send:function(){},subscribe:function(c,l,u){var f=yt(c,l,u),d=!1;return e.then(function(p){d||(f.next(p),!d&&f.complete())},function(p){d||f.error(p)}),{unsubscribe:function(){return d=!0}}},stop:function(){s=!0},toJSON:function(){return{id:r}},getSnapshot:function(){return o}},n[fe]=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,l=function(d){c=d,a.forEach(function(p){return p(d)}),!s&&i.send(F(d,{origin:r}))},u;try{u=e(l,function(d){o.add(d)})}catch(d){this.send(Ne(r,d))}if(Hr(u))return this.spawnPromise(u,r);var f=(n={id:r,send:function(d){return o.forEach(function(p){return p(d)})},subscribe:function(d){var p=yt(d);return a.add(p.next),{unsubscribe:function(){a.delete(p.next)}}},stop:function(){s=!0,_(u)&&u()},toJSON:function(){return{id:r}},getSnapshot:function(){return c}},n[fe]=function(){return this},n);return this.children.set(r,f),f},t.prototype.spawnObservable=function(e,r){var n,i=this,s,o=e.subscribe(function(c){s=c,i.send(F(c,{origin:r}))},function(c){i.removeChild(r),i.send(F(Ne(r,c),{origin:r}))},function(){i.removeChild(r),i.send(F(Pe(r),{origin:r}))}),a=(n={id:r,send:function(){},subscribe:function(c,l,u){return e.subscribe(c,l,u)},stop:function(){return o.unsubscribe()},getSnapshot:function(){return s},toJSON:function(){return{id:r}}},n[fe]=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){M||B(!1,"No implementation found for activity '".concat(e.type,"'"));return}var n=r(this.state.context,e);this.spawnEffect(e.id,n)},t.prototype.spawnEffect=function(e,r){var n;this.children.set(e,(n={id:e,send:function(){},subscribe:function(){return{unsubscribe:function(){}}},stop:r||void 0,getSnapshot:function(){},toJSON:function(){return{id:e}}},n[fe]=function(){return this},n))},t.prototype.attachDev=function(){var e=tr();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(m(m({name:this.id,autoPause:!0,stateSanitizer:function(n){return{value:n.value,context:n.context,actions:n.actions}}},r),{features:m({jump:!1,skip:!1},r?r.features:void 0)}),this.machine),this.devTools.init(this.state)}Zi(this)}},t.prototype.toJSON=function(){return{id:this.id}},t.prototype[fe]=function(){return this},t.prototype.getSnapshot=function(){return this.status===z.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=ye,t}();function ye(t,e){var r=new ts(t,e);return r}function $c(t){if(typeof t=="string"){var e={type:t};return e.toString=function(){return t},e}return t}function At(t){return m(m({type:ft},t),{toJSON:function(){t.onDone,t.onError;var e=Ve(t,["onDone","onError"]);return m(m({},e),{type:ft,src:$c(t.src)})}})}var Xe="",Yr="#",Rt="*",We={},Ke=function(t){return t[0]===Yr},Wc=function(){return{actions:{},guards:{},services:{},activities:{},delays:{}}},Kc=function(t,e,r){var n=r.slice(0,-1).some(function(s){return!("cond"in s)&&!("in"in s)&&(P(s.target)||de(s.target))}),i=e===Xe?"the transient event":"event '".concat(e,"'");B(!n,"One or more transitions for ".concat(i," on state '").concat(t.id,"' are unreachable. ")+"Make sure that the default transition is the last one defined.")},rs=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(Wc(),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:Ht),this.id=this.config.id||k([this.machine.key],C(this.path),!1).join(this.delimiter),this.version=this.parent?this.parent.version:this.config.version,this.type=this.config.type||(this.config.parallel?"parallel":this.config.states&&Object.keys(this.config.states).length?"compound":this.config.history?"history":"atomic"),this.schema=this.parent?this.machine.schema:(o=this.config.schema)!==null&&o!==void 0?o:{},this.description=this.config.description,M||B(!("parallel"in this.config),'The "parallel" property is deprecated and will be removed in version 4.1. '.concat(this.config.parallel?"Replace with `type: 'parallel'`":"Use `type: '".concat(this.type,"'`")," in the config for state node '").concat(this.id,"' instead.")),this.initial=this.config.initial,this.states=this.config.states?ze(this.config.states,function(l,u){var f,d=new t(l,{},void 0,{parent:s,key:u});return Object.assign(s.idMap,m((f={},f[d.id]=d,f),d.idMap)),d}):We;var a=0;function c(l){var u,f;l.order=a++;try{for(var d=R(_e(l)),p=d.next();!p.done;p=d.next()){var y=p.value;c(y)}}catch(E){u={error:E}}finally{try{p&&!p.done&&(f=d.return)&&f.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(l){var u=l.event;return u===Xe}):Xe in this.config.on:!1),this.strict=!!this.config.strict,this.onEntry=te(this.config.entry||this.config.onEntry).map(function(l){return $e(l)}),this.onExit=te(this.config.exit||this.config.onExit).map(function(l){return $e(l)}),this.meta=this.config.meta,this.doneData=this.type==="final"?this.config.data:void 0,this.invoke=te(this.config.invoke).map(function(l,u){var f,d;if(de(l)){var p=gt(s.id,u);return s.machine.options.services=m((f={},f[p]=l,f),s.machine.options.services),At({src:p,id:p})}else if(P(l.src)){var p=l.id||gt(s.id,u);return At(m(m({},l),{id:p,src:l.src}))}else if(de(l.src)||_(l.src)){var p=l.id||gt(s.id,u);return s.machine.options.services=m((d={},d[p]=l.src,d),s.machine.options.services),At(m(m({id:p},l),{src:p}))}else{var y=l.src;return At(m(m({id:gt(s.id,u)},l),{src:y}))}}),this.activities=te(this.config.activities).concat(this.invoke).map(function(l){return er(l)}),this.transition=this.transition.bind(this),this.tags=te(this.config.tags)}return t.prototype._init=function(){this.__cache.transitions||zr(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:m(m({},i),e.actions),activities:m(m({},s),e.activities),guards:m(m({},o),e.guards),services:m(m({},a),e.services),delays:m(m({},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:ze(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===Xe,n=this.transitions.filter(function(i){var s=i.eventType===e;return r?s:s||i.eventType===Rt});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=Bi(a,e.id);return e.onEntry.push(St(c,{delay:s})),e.onExit.push(Ui(c)),c},i=me(r)?r.map(function(s,o){var a=n(s.delay,o);return m(m({},s),{event:a})}):U(Object.keys(r).map(function(s,o){var a=r[s],c=P(a)?{target:a}:a,l=isNaN(+s)?s:+s,u=n(l,o);return te(c).map(function(f){return m(m({},f),{event:u,delay:l})})}));return i.map(function(s){var o=s.delay;return m(m({},e.formatTransition(s)),{delay:o})})},t.prototype.getStateNodes=function(e){var r,n=this;if(!e)return[];var i=e instanceof se?e.value:Je(e,this.delimiter);if(P(i)){var s=this.getStateNode(i).initial;return s!==void 0?this.getStateNodes((r={},r[i]=s,r)):[this,this.states[i]]}var o=Object.keys(i),a=[this];return a.push.apply(a,k([],C(U(o.map(function(c){return n.getStateNode(c).getStateNodes(i[c])}))),!1)),a},t.prototype.handles=function(e){var r=zt(e);return this.events.includes(r)},t.prototype.resolveState=function(e){var r=e instanceof se?e:se.create(e),n=Array.from(ke([],this.getStateNodes(r.value)));return new se(m(m({},r),{value:this.resolve(r.value),configuration:n,done:De(n,this),tags:$r(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=R(Object.keys(e)),c=a.next();!c.done;c=a.next()){var l=c.value,u=e[l];if(!!u){var f=this.getStateNode(l),d=f._transition(u,r,n);d&&(o[l]=d)}}}catch(g){i={error:g}}finally{try{c&&!c.done&&(s=a.return)&&s.call(a)}finally{if(i)throw i.error}}var p=Object.keys(o).map(function(g){return o[g]}),y=U(p.map(function(g){return g.transitions})),E=p.some(function(g){return g.transitions.length>0});if(!E)return this.next(r,n);var v=U(p.map(function(g){return g.entrySet})),x=U(Object.keys(o).map(function(g){return o[g].configuration}));return{transitions:y,entrySet:v,exitSet:U(p.map(function(g){return g.exitSet})),configuration:x,source:r,actions:U(Object.keys(o).map(function(g){return o[g].actions}))}},t.prototype._transition=function(e,r,n){return P(e)?this.transitionLeafNode(e,r,n):Object.keys(e).length===1?this.transitionCompoundNode(e,r,n):this.transitionParallelNode(e,r,n)},t.prototype.getTransitionData=function(e,r){return this._transition(e.value,e,F(r))},t.prototype.next=function(e,r){var n,i,s=this,o=r.name,a=[],c=[],l;try{for(var u=R(this.getCandidates(o)),f=u.next();!f.done;f=u.next()){var d=f.value,p=d.cond,y=d.in,E=e.context,v=y?P(y)&&Ke(y)?e.matches(Je(this.getStateNodeById(y).path,this.delimiter)):ht(Je(y,this.delimiter),bi(this.path.slice(0,-2))(e.value)):!0,x=!1;try{x=!p||Xt(this.machine,p,E,r,e)}catch(N){throw new Error("Unable to evaluate guard '".concat(p.name||p.type,"' in transition for event '").concat(o,"' in state node '").concat(this.id,`':
|
|
31
|
-
`).concat(N.message))}if(x&&v){d.target!==void 0&&(c=d.target),a.push.apply(a,k([],C(d.actions),!1)),l=d;break}}}catch(N){n={error:N}}finally{try{f&&!f.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}if(!!l){if(!c.length)return{transitions:[l],entrySet:[],exitSet:[],configuration:e.value?[this]:[],source:e,actions:a};var g=U(c.map(function(N){return s.getRelativeStateNodes(N,e.historyValue)})),T=!!l.internal,O=T?[]:U(g.map(function(N){return s.nodesFromChild(N)}));return{transitions:[l],entrySet:O,exitSet:T?[]:[this],configuration:g,source:e,actions: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,l=ke([],i?this.getStateNodes(i.value):[this]),u=e.configuration.length?ke(l,e.configuration):l;try{for(var f=R(u),d=f.next();!d.done;d=f.next()){var p=d.value;Tt(l,p)||e.entrySet.push(p)}}catch(b){s={error:b}}finally{try{d&&!d.done&&(o=f.return)&&o.call(f)}finally{if(s)throw s.error}}try{for(var y=R(l),E=y.next();!E.done;E=y.next()){var p=E.value;(!Tt(u,p)||Tt(e.exitSet,p.parent))&&e.exitSet.push(p)}}catch(b){a={error:b}}finally{try{E&&!E.done&&(c=y.return)&&c.call(y)}finally{if(a)throw a.error}}var v=U(e.entrySet.map(function(b){var w=[];if(b.type!=="final")return w;var A=b.parent;if(!A.parent)return w;w.push(wt(b.id,b.doneData),wt(A.id,b.doneData?Re(b.doneData,r,n):void 0));var q=A.parent;return q.type==="parallel"&&_e(q).every(function(V){return De(e.configuration,V)})&&w.push(wt(q.id)),w}));e.exitSet.sort(function(b,w){return w.order-b.order}),e.entrySet.sort(function(b,w){return b.order-w.order});var x=new Set(e.entrySet),g=new Set(e.exitSet),T=C([U(Array.from(x).map(function(b){return k(k([],C(b.activities.map(function(w){return Mi(w)})),!1),C(b.onEntry),!1)})).concat(v.map(qi)),U(Array.from(g).map(function(b){return k(k([],C(b.onExit),!1),C(b.activities.map(function(w){return Li(w)})),!1)}))],2),O=T[0],N=T[1],L=Et(N.concat(e.actions).concat(O),this.machine.options.actions);return L},t.prototype.transition=function(e,r,n){e===void 0&&(e=this.initialState);var i=F(r),s;if(e instanceof se)s=n===void 0?e:this.resolveState(se.from(e,n));else{var o=P(e)?this.resolve(pt(this.getResolvedPath(e))):this.resolve(e),a=n!=null?n:this.machine.context;s=this.resolveState(se.from(o,a))}if(!M&&i.name===Rt)throw new Error("An event cannot have the wildcard type ('".concat(Rt,"')"));if(this.strict&&!this.events.includes(i.name)&&!Oi(i.name))throw new Error("Machine '".concat(this.id,"' does not accept event '").concat(i.name,"'"));var c=this._transition(s.value,s,i)||{transitions:[],configuration:[],entrySet:[],exitSet:[],source:s,actions:[]},l=ke([],this.getStateNodes(s.value)),u=c.configuration.length?ke(l,c.configuration):l;return c.configuration=k([],C(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,k([],C(s),!1)),e},t.prototype.resolveTransition=function(e,r,n,i){var s,o,a=this;i===void 0&&(i=Ce);var c=e.configuration,l=!r||e.transitions.length>0,u=l?Wi(this.machine,c):void 0,f=r?r.historyValue?r.historyValue:e.source?this.machine.historyValue(r.value):void 0:void 0,d=this.getActions(e,n,i,r),p=r?m({},r.activities):{};try{for(var y=R(d),E=y.next();!E.done;E=y.next()){var v=E.value;v.type===lt?p[v.activity.id||v.activity.type]=v:v.type===He&&(p[v.activity.id||v.activity.type]=!1)}}catch(ee){s={error:ee}}finally{try{E&&!E.done&&(o=y.return)&&o.call(y)}finally{if(s)throw s.error}}var x=C(Zt(this,r,n,i,d,this.machine.config.preserveActionOrder),2),g=x[0],T=x[1],O=C(Wt(g,function(ee){return ee.type===Ge||ee.type===Ae&&ee.to===we.Internal}),2),N=O[0],L=O[1],b=g.filter(function(ee){var Fe;return ee.type===lt&&((Fe=ee.activity)===null||Fe===void 0?void 0:Fe.type)===ft}),w=b.reduce(function(ee,Fe){return ee[Fe.activity.id]=Hi(Fe.activity,a.machine,T,i),ee},r?m({},r.children):{}),A=l?e.configuration:r?r.configuration:[],q=De(A,this),V=new se({value:u||r.value,context:T,_event:i,_sessionid:r?r._sessionid:null,historyValue:u?f?Ni(f,u):void 0:r?r.historyValue:void 0,history:!u||e.source?r:void 0,actions:u?L:[],activities:u?p:r?r.activities:{},events:[],configuration:A,transitions:e.transitions,children:w,done:q,tags:r==null?void 0:r.tags,machine:this}),Q=n!==T;V.changed=i.name===dt||Q;var Se=V.history;Se&&delete Se.history;var jt=!q&&(this._transient||c.some(function(ee){return ee._transient}));if(!l&&(!jt||i.name===Xe))return V;var Z=V;if(!q)for(jt&&(Z=this.resolveRaisedTransition(Z,{type:Ei},i));N.length;){var Cc=N.shift();Z=this.resolveRaisedTransition(Z,Cc._event,i)}var Pc=Z.changed||(Se?!!Z.actions.length||Q||typeof Se.value!=typeof Z.value||!Wr(Z.value,Se.value):void 0);return Z.changed=Pc,Z.history=Se,Z.tags=$r(Z.configuration),Z},t.prototype.getStateNode=function(e){if(Ke(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=Ke(e)?e.slice(Yr.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"&&Ke(e))try{return this.getStateNodeById(e.slice(1))}catch{}for(var r=$t(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||We;switch(this.type){case"parallel":return ze(this.initialStateValue,function(s,o){return s?n.getStateNode(o).resolve(e[o]||s):We});case"compound":if(P(e)){var i=this.getStateNode(e);return i.type==="parallel"||i.type==="compound"?(r={},r[e]=i.initialStateValue,r):e}return Object.keys(e).length?ze(e,function(s,o){return s?n.getStateNode(o).resolve(s):We}):this.initialStateValue||{};default:return e||We}},t.prototype.getResolvedPath=function(e){if(Ke(e)){var r=this.machine.idMap[e.slice(Yr.length)];if(!r)throw new Error("Unable to find state node '".concat(e,"'"));return r.path}return $t(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=Vr(this.states,function(n){return n.initialStateValue||We},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=xt(this.states[this.initial])?this.initial:(e={},e[this.initial]=this.states[this.initial].initialStateValue,e)}else r={};return this.__cache.initialStateValue=r,this.__cache.initialStateValue},enumerable:!1,configurable:!0}),t.prototype.getInitialState=function(e,r){this._init();var n=this.getStateNodes(e);return this.resolveTransition({configuration:n,entrySet:n,exitSet:[],transitions:[],source:void 0,actions:[]},void 0,r!=null?r:this.machine.context,void 0)},Object.defineProperty(t.prototype,"initialState",{get:function(){var e=this.initialStateValue;if(!e)throw new Error("Cannot retrieve initial state from simple state '".concat(this.id,"'."));return this.getInitialState(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"target",{get:function(){var e;if(this.type==="history"){var r=this.config;P(r.target)?e=Ke(r.target)?pt(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(xt(this))return[this];if(this.type==="compound"&&!this.initial)return M||B(!1,"Compound state node '".concat(this.id,"' has no initial state.")),[this];var r=vt(this.initialStateValue);return U(r.map(function(n){return e.getFromRelativePath(n)}))},enumerable:!1,configurable:!0}),t.prototype.getFromRelativePath=function(e){if(!e.length)return[this];var r=C(e),n=r[0],i=r.slice(1);if(!this.states)throw new Error("Cannot retrieve subPath '".concat(n,"' from node with no states"));var s=this.getStateNode(n);if(s.type==="history")return s.resolveHistory();if(!this.states[n])throw new Error("Child state '".concat(n,"' does not exist on '").concat(this.id,"'"));return this.states[n].getFromRelativePath(i)},t.prototype.historyValue=function(e){if(!!Object.keys(this.states).length)return{current:e||this.initialStateValue,states:Vr(this.states,function(r,n){if(!e)return r.historyValue();var i=P(e)?void 0:e[n];return r.historyValue(i||r.initialStateValue)},function(r){return!r.history})}},t.prototype.resolveHistory=function(e){var r=this;if(this.type!=="history")return[this];var n=this.parent;if(!e){var i=this.target;return i?U(vt(i).map(function(o){return n.getFromRelativePath(o)})):n.initialStateNodes}var s=Ai(n.path,"states")(e).current;return P(s)?[n.getStateNode(s)]:U(vt(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=U(Object.keys(this.states).map(function(n){return e.states[n].stateIds}));return[this.id].concat(r)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"events",{get:function(){var e,r,n,i;if(this.__cache.events)return this.__cache.events;var s=this.states,o=new Set(this.ownEvents);if(s)try{for(var a=R(Object.keys(s)),c=a.next();!c.done;c=a.next()){var l=c.value,u=s[l];if(u.states)try{for(var f=(n=void 0,R(u.events)),d=f.next();!d.done;d=f.next()){var p=d.value;o.add("".concat(p))}}catch(y){n={error:y}}finally{try{d&&!d.done&&(i=f.return)&&i.call(f)}finally{if(n)throw n.error}}}}catch(y){e={error:y}}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(!P(n))return n;var i=n[0]===r.delimiter;if(i&&!r.parent)return r.getStateNodeByPath(n.slice(1));var s=i?r.key+n:n;if(r.parent)try{var o=r.parent.getStateNodeByPath(s);return o}catch(a){throw new Error("Invalid transition definition for state node '".concat(r.id,`':
|
|
32
|
-
`).concat(a.message))}else return r.getStateNodeByPath(s)})},t.prototype.formatTransition=function(e){var r=this,n=ki(e.target),i="internal"in e?e.internal:n?n.some(function(c){return P(c)&&c[0]===r.delimiter}):!0,s=this.machine.options.guards,o=this.resolveTarget(n),a=m(m({},e),{actions:Et(te(e.actions)),cond:Kt(e.cond,s),target:o,source:this,internal:i,eventType:e.event,toJSON:function(){return m(m({},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=Rt,a=s[o],c=a===void 0?[]:a,l=Ve(s,[typeof o=="symbol"?o:o+""]);i=U(Object.keys(l).map(function(g){!M&&g===Xe&&B(!1,"Empty string transition configs (e.g., `{ on: { '': ... }}`) for transient transitions are deprecated. Specify the transition in the `{ always: ... }` property instead. "+'Please check the `on` configuration for "#'.concat(n.id,'".'));var T=Oe(g,l[g]);return M||Kc(n,g,T),T}).concat(Oe(Rt,c)))}var u=this.config.always?Oe("",this.config.always):[],f=this.config.onDone?Oe(String(wt(this.id)),this.config.onDone):[];M||B(!(this.config.onDone&&!this.parent),'Root nodes cannot have an ".onDone" transition. Please check the config of "'.concat(this.id,'".'));var d=U(this.invoke.map(function(g){var T=[];return g.onDone&&T.push.apply(T,k([],C(Oe(String(Pe(g.id)),g.onDone)),!1)),g.onError&&T.push.apply(T,k([],C(Oe(String(Ne(g.id)),g.onError)),!1)),T})),p=this.after,y=U(k(k(k(k([],C(f),!1),C(d),!1),C(i),!1),C(u),!1).map(function(g){return te(g).map(function(T){return n.formatTransition(T)})}));try{for(var E=R(p),v=E.next();!v.done;v=E.next()){var x=v.value;y.push(x)}}catch(g){e={error:g}}finally{try{v&&!v.done&&(r=E.return)&&r.call(E)}finally{if(e)throw e.error}}return y},t}();function oe(t,e){return new rs(t,e)}var D=ji,$=St;function is(t){return!!(t&&typeof t.then=="function")}var Xc=Promise.resolve(!1),Mv=Promise.resolve(!0),pe=Promise.resolve();function rr(t,e){return t||(t=0),new Promise(function(r){return setTimeout(function(){return r(e)},t)})}function ss(t,e){return Math.floor(Math.random()*(e-t+1)+t)}function Ot(){return Math.random().toString(36).substring(2)}var ns=0,Qr=0;function xe(){var t=new Date().getTime();return t===ns?(Qr++,t*1e3+Qr):(ns=t,Qr=0,t*1e3)}var Te=Object.prototype.toString.call(typeof process!="undefined"?process:0)==="[object process]";var Yc=xe,Qc="native";function Zc(t){var e={messagesCallback:null,bc:new BroadcastChannel(t),subFns:[]};return e.bc.onmessage=function(r){e.messagesCallback&&e.messagesCallback(r.data)},e}function el(t){t.bc.close(),t.subFns=[]}function tl(t,e){try{return t.bc.postMessage(e,!1),pe}catch(r){return Promise.reject(r)}}function rl(t,e){t.messagesCallback=e}function nl(){if(Te&&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 il(){return 150}var os={create:Zc,close:el,onMessage:rl,postMessage:tl,canBeUsed:nl,type:Qc,averageResponseTime:il,microSeconds:Yc};var nr=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,as()),this.set.add(e),setTimeout(function(){sl(r)},0)},t.prototype.clear=function(){this.set.clear(),this.timeMap.clear()},t}();function sl(t){for(var e=as()-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 as(){return new Date().getTime()}function Ye(){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 ol=xe,al="pubkey.broadcast-channel-0-",ge="messages",ul="idb";function us(){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 cl(t){var e=us(),r=al+t,n=e.open(r,1);n.onupgradeneeded=function(s){var o=s.target.result;o.createObjectStore(ge,{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 ll(t,e,r){var n=new Date().getTime(),i={uuid:e,time:n,data:r},s=t.transaction([ge],"readwrite");return new Promise(function(o,a){s.oncomplete=function(){return o()},s.onerror=function(l){return a(l)};var c=s.objectStore(ge);c.add(i)})}function fl(t,e){var r=t.transaction(ge).objectStore(ge),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 dl(t,e){var r=t.transaction([ge],"readwrite").objectStore(ge).delete(e);return new Promise(function(n){r.onsuccess=function(){return n()}})}function pl(t,e){var r=new Date().getTime()-e,n=t.transaction(ge).objectStore(ge),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 hl(t,e){return pl(t,e).then(function(r){return Promise.all(r.map(function(n){return dl(t,n.id)}))})}function vl(t,e){return e=Ye(e),cl(t).then(function(r){var n={closed:!1,lastCursorId:0,channelName:t,options:e,uuid:Ot(),eMIs:new nr(e.idb.ttl*2),writeBlockPromise:pe,messagesCallback:null,readQueuePromises:[],db:r};return r.onclose=function(){n.closed=!0,e.idb.onclose&&e.idb.onclose()},cs(n),n})}function cs(t){t.closed||ls(t).then(function(){return rr(t.options.idb.fallbackInterval)}).then(function(){return cs(t)})}function ml(t,e){return!(t.uuid===e.uuid||e.eMIs.has(t.id)||t.data.time<e.messagesCallbackTime)}function ls(t){return t.closed?pe:t.messagesCallback?fl(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 ml(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))}),pe}):pe}function yl(t){t.closed=!0,t.db.close()}function gl(t,e){return t.writeBlockPromise=t.writeBlockPromise.then(function(){return ll(t.db,t.uuid,e)}).then(function(){ss(0,10)===0&&hl(t.db,t.options.idb.ttl)}),t.writeBlockPromise}function El(t,e,r){t.messagesCallbackTime=r,t.messagesCallback=e,ls(t)}function Sl(){if(Te)return!1;var t=us();return!!t}function wl(t){return t.idb.fallbackInterval*2}var fs={create:vl,close:yl,onMessage:El,postMessage:gl,canBeUsed:Sl,type:ul,averageResponseTime:wl,microSeconds:ol};var xl=xe,Tl="pubkey.broadcastChannel-",bl="localstorage";function ds(){var t;if(typeof window=="undefined")return null;try{t=window.localStorage,t=window["ie8-eventlistener/storage"]||window.localStorage}catch{}return t}function ps(t){return Tl+t}function Al(t,e){return new Promise(function(r){rr().then(function(){var n=ps(t.channelName),i={token:Ot(),time:new Date().getTime(),data:e,uuid:t.uuid},s=JSON.stringify(i);ds().setItem(n,s);var o=document.createEvent("Event");o.initEvent("storage",!0,!0),o.key=n,o.newValue=s,window.dispatchEvent(o),r()})})}function Rl(t,e){var r=ps(t),n=function(s){s.key===r&&e(JSON.parse(s.newValue))};return window.addEventListener("storage",n),n}function Ol(t){window.removeEventListener("storage",t)}function Cl(t,e){if(e=Ye(e),!hs())throw new Error("BroadcastChannel: localstorage cannot be used");var r=Ot(),n=new nr(e.localstorage.removeTimeout),i={channelName:t,uuid:r,eMIs:n};return i.listener=Rl(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 Pl(t){Ol(t.listener)}function Nl(t,e,r){t.messagesCallbackTime=r,t.messagesCallback=e}function hs(){if(Te)return!1;var t=ds();if(!t)return!1;try{var e="__broadcastchannel_check";t.setItem(e,"works"),t.removeItem(e)}catch{return!1}return!0}function Il(){var t=120,e=navigator.userAgent.toLowerCase();return e.includes("safari")&&!e.includes("chrome")?t*2:t}var vs={create:Cl,close:Pl,onMessage:Nl,postMessage:Al,canBeUsed:hs,type:bl,averageResponseTime:Il,microSeconds:xl};var _l=xe,kl="simulate",Zr=new Set;function Dl(t){var e={name:t,messagesCallback:null};return Zr.add(e),e}function ql(t){Zr.delete(t)}function Ul(t,e){return new Promise(function(r){return setTimeout(function(){var n=Array.from(Zr);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 Ml(t,e){t.messagesCallback=e}function Ll(){return!0}function jl(){return 5}var ms={create:Dl,close:ql,onMessage:Ml,postMessage:Ul,canBeUsed:Ll,type:kl,averageResponseTime:jl,microSeconds:_l};var ys=[os,fs,vs];function gs(t){var e=[].concat(t.methods,ys).filter(Boolean);if(t.type){if(t.type==="simulate")return ms;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&&!Te&&(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(ys.map(function(i){return i.type})))}var en=new Set,Bl=0,qe=function(e,r){this.id=Bl++,en.add(this),this.name=e,Es&&(r=Es),this.options=Ye(r),this.method=gs(this.options),this._iL=!1,this._onML=null,this._addEL={message:[],internal:[]},this._uMP=new Set,this._befC=[],this._prepP=null,Fl(this)};qe._pubkey=!0;var Es;qe.prototype={postMessage:function(e){if(this.closed)throw new Error("BroadcastChannel.postMessage(): Cannot post message after channel has closed "+JSON.stringify(e));return Ss(this,"message",e)},postInternal:function(e){return Ss(this,"internal",e)},set onmessage(t){var e=this.method.microSeconds(),r={time:e,fn:t};xs(this,"message",this._onML),t&&typeof t=="function"?(this._onML=r,ws(this,"message",r)):this._onML=null},addEventListener:function(e,r){var n=this.method.microSeconds(),i={time:n,fn:r};ws(this,e,i)},removeEventListener:function(e,r){var n=this._addEL[e].find(function(i){return i.fn===r});xs(this,e,n)},close:function(){var e=this;if(!this.closed){en.delete(this),this.closed=!0;var r=this._prepP?this._prepP:pe;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 Ss(t,e,r){var n=t.method.microSeconds(),i={time:n,type:e,data:r},s=t._prepP?t._prepP:pe;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 Fl(t){var e=t.method.create(t.name,t.options);is(e)?(t._prepP=e,e.then(function(r){t._state=r})):t._state=e}function Ts(t){return t._addEL.message.length>0||t._addEL.internal.length>0}function ws(t,e,r){t._addEL[e].push(r),Vl(t)}function xs(t,e,r){t._addEL[e]=t._addEL[e].filter(function(n){return n!==r}),Hl(t)}function Vl(t){if(!t._iL&&Ts(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 Hl(t){if(t._iL&&!Ts(t)){t._iL=!1;var e=t.method.microSeconds();t.method.onMessage(t._state,null,e)}}var ir="nhostRefreshToken",Ct="nhostRefreshTokenExpiresAt";var Ue={status:10,error:"invalid-email",message:"Email is incorrectly formatted"};var Pt={status:10,error:"invalid-password",message:"Password is incorrectly formatted"},bs={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 Do=ct(ko());var ae=t=>{let e=Do.default.create({baseURL:t});return e.interceptors.response.use(r=>r,r=>{var n,i,s,o,a,c,l,u,f,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:(f=(u=(c=r.response)==null?void 0:c.status)!=null?u:(l=r.response)==null?void 0:l.data.statusCode)!=null?f:0,error:((d=r.response)==null?void 0:d.data.error)||r.request.statusText||"network"}})}),e};var qo=(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},ie=(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 tt=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,}))$/),dr=t=>!!t&&typeof t=="string"&&t.length>=3,Uo=t=>!!t&&typeof t=="string";var wn={user:null,mfa:null,accessToken:{value:null,expiresAt:new Date},refreshTimer:{elapsed:0,attempts:0},refreshToken:{value:null},errors:{}};var Mo=({backendUrl:t,clientUrl:e,interpreter:r})=>{let n=ae(t);return oe({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:D({error:i=>Ue}),saveRequestError:D({error:(i,{data:{error:s}})=>s}),reportError:$(i=>({type:"ERROR",error:i.error})),reportSuccess:$("SUCCESS")},guards:{invalidEmail:(i,{email:s})=>!tt(s)},services:{requestChange:async(i,{email:s,options:o})=>(await n.post("/user/email/change",{newEmail:s,options:ie(e,o)},{headers:{authorization:`Bearer ${r==null?void 0:r.state.context.accessToken.value}`}})).data}})};var Lo=({backendUrl:t,interpreter:e})=>{let r=ae(t);return oe({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:D({error:n=>Pt}),saveRequestError:D({error:(n,{data:{error:i}})=>(console.log(i),i)}),reportError:$(n=>({type:"ERROR",error:n.error})),reportSuccess:$("SUCCESS")},guards:{invalidPassword:(n,{password:i})=>!dr(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 jo=({backendUrl:t,clientUrl:e})=>{let r=ae(t);return oe({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:D({error:(n,{data:{error:i}})=>(console.log(i),i)}),reportError:$(n=>({type:"ERROR",error:n.error})),reportSuccess:$("SUCCESS")},services:{requestChange:(n,{email:i,options:s})=>r.post("/user/password/reset",{email:i,options:ie(e,s)})}})};var Bo=({backendUrl:t,clientUrl:e,interpreter:r})=>{let n=ae(t);return oe({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:D({error:i=>Ue}),saveRequestError:D({error:(i,{data:{error:s}})=>s}),reportError:$(i=>({type:"ERROR",error:i.error})),reportSuccess:$("SUCCESS")},guards:{invalidEmail:(i,{email:s})=>!tt(s)},services:{request:async(i,{email:s,options:o})=>(await n.post("/user/email/send-verification-email",{email:s,options:ie(e,o)})).data}})};var Fo=({backendUrl:t,clientUrl:e,clientStorageGetter:r,clientStorageSetter:n,refreshIntervalTime:i,autoRefreshToken:s=!0,autoSignIn:o=!0})=>{let a=ae(t),c=async(l,u,f)=>(await a.post(l,u,f)).data;return oe({schema:{context:{},events:{}},tsTypes:{},context:wn,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:$("SIGNED_IN"),reportSignedOut:$("SIGNED_OUT"),reportTokenChanged:$("TOKEN_CHANGED"),clearContext:D(()=>wn),saveSession:D({user:(l,u)=>{var f,d;return(d=(f=u.data)==null?void 0:f.session)==null?void 0:d.user},accessToken:(l,u)=>{var f,d,p,y;return{value:(d=(f=u.data)==null?void 0:f.session)==null?void 0:d.accessToken,expiresAt:new Date(Date.now()+((y=(p=u.data)==null?void 0:p.session)==null?void 0:y.accessTokenExpiresIn)*1e3)}},refreshToken:(l,u)=>{var f,d;return{value:(d=(f=u.data)==null?void 0:f.session)==null?void 0:d.refreshToken}}}),saveMfaTicket:D({mfa:(l,u)=>{var f,d;return(d=(f=u.data)==null?void 0:f.mfa)!=null?d:null}}),resetTimer:D({refreshTimer:(l,u)=>({elapsed:0,attempts:0})}),tickRefreshTimer:D({refreshTimer:(l,u)=>({elapsed:l.refreshTimer.elapsed+1,attempts:l.refreshTimer.attempts})}),saveAuthenticationError:D({errors:({errors:l},{data:{error:u}})=>({...l,authentication:u})}),resetAuthenticationError:D({errors:({errors:{authentication:l,...u}})=>u}),saveInvalidEmail:D({errors:({errors:l})=>({...l,authentication:Ue})}),saveInvalidPassword:D({errors:({errors:l})=>({...l,authentication:Pt})}),saveInvalidPhoneNumber:D({errors:({errors:l})=>({...l,authentication:bs})}),saveRegisrationError:D({errors:({errors:l},{data:{error:u}})=>({...l,registration:u})}),resetSignUpError:D({errors:({errors:{registration:l,...u}})=>u}),saveInvalidSignUpPassword:D({errors:({errors:l})=>({...l,registration:Ue})}),saveInvalidSignUpEmail:D({errors:({errors:l})=>({...l,registration:Pt})}),saveNoMfaTicketError:D({errors:({errors:l})=>({...l,registration:As})}),saveRefreshToken:D({accessToken:(l,u)=>({...l.accessToken,expiresAt:u.data.expiresAt}),refreshToken:(l,u)=>({...l.refreshToken,value:u.data.refreshToken})}),persist:(l,{data:u})=>{if(n(ir,u.session.refreshToken),u.session.accessTokenExpiresIn){let f=new Date(Date.now()+u.session.accessTokenExpiresIn*1e3).toISOString();n(Ct,f)}else n(Ct,null)},destroyToken:()=>{n(ir,null),n(Ct,null)}},guards:{isSignedIn:l=>!!l.user&&!!l.refreshToken.value&&!!l.accessToken.value,hasRefreshTokenWithoutSession:l=>!!l.refreshToken.value&&!l.user&&!l.accessToken.value,noToken:l=>!l.refreshToken.value,noMfaTicket:(l,{ticket:u})=>{var f;return!u&&!((f=l.mfa)!=null&&f.ticket)},hasRefreshToken:l=>!!l.refreshToken.value,isAutoRefreshDisabled:()=>!s,isAutoSignInDisabled:()=>!o,refreshTimerShouldRefresh:l=>l.refreshTimer.elapsed>Math.max((Date.now()-l.accessToken.expiresAt.getTime())/1e3-900,i),unverified:(l,{data:{error:u}})=>u.status===401&&u.message==="Email is not verified",hasSession:(l,u)=>{var f;return!!((f=u.data)!=null&&f.session)},hasMfaTicket:(l,u)=>{var f;return!!((f=u.data)!=null&&f.mfa)},invalidEmail:(l,{email:u})=>!tt(u),invalidPassword:(l,{password:u})=>!dr(u),invalidPhoneNumber:(l,{phoneNumber:u})=>!Uo(u)},services:{signInPassword:(l,{email:u,password:f})=>c("/signin/email-password",{email:u,password:f}),signInPasswordlessSms:(l,{phoneNumber:u,options:f})=>c("/signin/passwordless/sms",{phoneNumber:u,options:ie(e,f)}),signInPasswordlessSmsOtp:(l,{phoneNumber:u,otp:f})=>c("/signin/passwordless/sms/otp",{phoneNumber:u,otp:f}),signInPasswordlessEmail:(l,{email:u,options:f})=>c("/signin/passwordless/email",{email:u,options:ie(e,f)}),signInAnonymous:l=>c("/signin/anonymous"),signInMfaTotp:(l,{ticket:u,otp:f})=>{var d;return c("/signin/mfa/totp",{ticket:u||((d=l.mfa)==null?void 0:d.ticket),otp:f})},refreshToken:async(l,u)=>{let f=u.type==="TRY_TOKEN"?u.token:l.refreshToken.value;return{session:await c("/token",{refreshToken:f})}},signout:(l,u)=>c("/signout",{refreshToken:l.refreshToken.value,all:!!u.all}),registerUser:(l,{email:u,password:f,options:d})=>c("/signup/email-password",{email:u,password:f,options:ie(e,d)}),autoSignIn:async()=>{if(typeof window=="undefined"||!window.location)throw Error("window is undefined or location does not exist");let{hash:l}=window.location;if(!l)throw Error("No hash in window.location");let f=new URLSearchParams(l.slice(1)).get("refreshToken");if(!f)throw Error("No refresh token in the location hash");let d=await c("/token",{refreshToken:f});return new qe("nhost").postMessage(f),{session:d}},importRefreshToken:async()=>{let l=await r(Ct),u=l?new Date(l):null;return{refreshToken:await r(ir),expiresAt:u}}}})};function pr(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 Ff={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 xn(t,e){function r(i,s,o){if(typeof document!="undefined"){o=pr({},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("="),l=c.slice(1).join("=");try{var u=decodeURIComponent(c[0]);if(o[u]=t.read(l,u),i===u)break}catch{}}return i?o[i]:o}}return Object.create({set:r,get:n,remove:function(i,s){r(i,"",pr({},s,{expires:-1}))},withAttributes:function(i){return xn(this.converter,pr({},this.attributes,i))},withConverter:function(i){return xn(pr({},this.converter,i),this.attributes)}},{attributes:{value:Object.freeze(e)},converter:{value:Object.freeze(t)}})}var Fy=xn(Ff,{path:"/"});var Vo=typeof window!="undefined",hr=new Map,vr=t=>{var e;return Vo&&localStorage?localStorage.getItem(t):(e=hr.get(t))!=null?e:null},mr=(t,e)=>{Vo&&localStorage?e?localStorage.setItem(t,e):localStorage.removeItem(t):e?hr.set(t,e):hr.has(t)&&hr.delete(t)};var kt=class{constructor({backendUrl:e,clientUrl:r=typeof window!="undefined"&&(l=>(l=window.location)==null?void 0:l.origin)()||"",clientStorageGetter:n=vr,clientStorageSetter:i=mr,refreshIntervalTime:s=60,autoSignIn:o=!0,autoRefreshToken:a=!0,start:c=!0}){this._subscriptions=new Set;this.backendUrl=e,this.clientUrl=r,this.machine=Fo({backendUrl:e,clientUrl:r,refreshIntervalTime:s,clientStorageGetter:n,clientStorageSetter:i,autoSignIn:o,autoRefreshToken:a}),c&&(this.interpreter=ye(this.machine),this.interpreter.start()),typeof window!="undefined"&&o&&(this._channel=new qe("nhost"),this._channel.addEventListener("message",u=>{var d;let f=(d=this.interpreter)==null?void 0:d.state.context.refreshToken;this.interpreter&&u!==f&&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 Ho=()=>typeof window!="undefined",Me=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},rt=(t,e)=>{e.forEach(r=>{typeof t[r]!="function"&&console.error(`clientStorage.${r} is not a function`)})},Go=(t,e)=>{if(e){if(t==="react-native"||t==="custom")return rt(e,["getItem"]),r=>{var n;return(n=e.getItem)==null?void 0:n.call(e,r)};if(t==="capacitor")return rt(e,["get"]),r=>{var n;return(n=e.get)==null?void 0:n.call(e,{key:r})};if(t==="expo-secure-storage")return rt(e,["getItemAsync"]),r=>{var n;return(n=e.getItemAsync)==null?void 0:n.call(e,r)}}return vr},Jo=(t,e)=>{if(e){if(t==="react-native"||t==="custom")return rt(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 rt(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 rt(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 mr};var zo={message:"User is already signed in",status:100},Hf={message:"User is not authenticated",status:101},Gf={message:"User is not anonymous",status:101},Jf={message:"Email needs verification",status:102},Tn=class{constructor({url:e,autoRefreshToken:r=!0,autoLogin:n=!0,clientStorage:i,clientStorageType:s="web",clientStorageGetter:o,clientStorageSetter:a,refreshIntervalTime:c,start:l=!0,Client:u=kt}){this._client=new u({backendUrl:e,autoRefreshToken:r,autoSignIn:n,start:l,clientStorageGetter:o||Go(s,i),clientStorageSetter:a||Jo(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:zo}: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:Me(a.context),error:null})})})}async signIn(e){let r=await this.waitUntilReady();if(this.isAuthenticated())return{session:null,mfa:null,error:zo};if("provider"in e){let{provider:n,options:i}=e,s=qo(`${this._client.backendUrl}/signin/provider/${n}`,ie(this._client.clientUrl,i));return Ho()&&(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:Me(i.context),mfa:null,error:null}):i.matches({authentication:{signedOut:"needsEmailVerification"}})?n({session:null,mfa:null,error:Jf}):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:Me(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:Hf}}async resetPassword({email:e,options:r}){return new Promise(n=>{let i=ye(jo(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=ye(Lo(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=ye(Bo(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=ye(Mo(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:Gf};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(Me(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,Me(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 Me((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 tu=ct(eu()),Hn=class{constructor({url:e}){this.url=e,this.httpClient=tu.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 Gn=class{constructor({url:e}){this.url=e,this.api=new Hn({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 ac=ct(li()),fi=class{constructor(e){let{url:r}=e;this.accessToken=null,this.instance=ac.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 Rc=ct(li()),Oc=ct(Ac()),yi=class{constructor(e){let{url:r}=e;this.url=r,this.accessToken=null,this.instance=Rc.default.create({baseURL:r})}async request(e,r,n){let i={...n==null?void 0:n.headers,...this.generateAccessTokenHeaders()};try{let s="",a=(await this.instance.post("",{operationName:s||void 0,query:typeof e=="string"?e:(0,Oc.print)(e),variables:r},{...n,headers:i})).data,{data:c}=a;return a.errors?{data:null,error:a.errors}:typeof c!="object"||Array.isArray(c)||c===null?{data:null,error:new Error("incorrect response data from GraphQL server")}:{data:c,error:null}}catch(s){return s instanceof Error?{data:null,error:s}:(console.error(s),{data:null,error:new Error("Unable to get do GraphQL request")})}}getUrl(){return this.url}setAccessToken(e){if(!e){this.accessToken=null;return}this.accessToken=e}generateAccessTokenHeaders(){if(!!this.accessToken)return{Authorization:`Bearer ${this.accessToken}`}}};var gi=class{constructor({backendUrl:e,refreshIntervalTime:r,clientStorageGetter:n,clientStorageSetter:i,clientStorage:s,clientStorageType:o,autoRefreshToken:a,autoLogin:c,start:l=!0,Client:u}){if(!e)throw new Error("Please specify a `backendUrl`. Docs: [todo]!");this.auth=new Tn({url:`${e}/v1/auth`,refreshIntervalTime:r,clientStorageGetter:n,clientStorageSetter:i,clientStorage:s,clientStorageType:o,autoRefreshToken:a,autoLogin:c,start:l,Client:u}),this.storage=new Gn({url:`${e}/v1/storage`}),this.functions=new fi({url:`${e}/v1/functions`}),this.graphql=new yi({url:`${e}/v1/graphql`}),this.storage.setAccessToken(this.auth.getAccessToken()),this.functions.setAccessToken(this.auth.getAccessToken()),this.graphql.setAccessToken(this.auth.getAccessToken()),this.auth.client.onStart(()=>{this.auth.onAuthStateChanged((f,d)=>{f==="SIGNED_OUT"&&(this.storage.setAccessToken(void 0),this.functions.setAccessToken(void 0),this.graphql.setAccessToken(void 0))}),this.auth.onTokenChanged(f=>{this.storage.setAccessToken(f==null?void 0:f.accessToken),this.functions.setAccessToken(f==null?void 0:f.accessToken),this.graphql.setAccessToken(f==null?void 0:f.accessToken)})})}};var dS=t=>new gi(t);export{gi as NhostClient,dS as createClient};
|
|
29
|
+
Event: `).concat(JSON.stringify(d.data)));return n.scheduler.schedule(function(){n.forward(d);var h=n.nextState(d);n.update(h,d)}),n._state},this.sendTo=function(o,f){var d=n.parent&&(f===Ee.Parent||n.parent.id===f),h=d?n.parent:P(f)?n.children.get(f)||gt.get(f):Si(f)?f:void 0;if(!h){if(!d)throw new Error("Unable to send event to child '".concat(f,"' from service '").concat(n.id,"'."));M||B(!1,"Service '".concat(n.id,"' has no parent: unable to send event ").concat(o.type));return}"machine"in h?h.send(m(m({},o),{name:o.name===Ir?"".concat(Re(n.id)):o.name,origin:n.sessionId})):h.send(o.data)};var i=m(m({},t.defaultOptions),r),s=i.clock,a=i.logger,u=i.parent,c=i.id,l=c!==void 0?c:e.id;this.id=l,this.logger=a,this.clock=s,this.parent=u,this.options=i,this.scheduler=new Br({deferEvents:this.options.deferEvents}),this.sessionId=gt.bookId()}return Object.defineProperty(t.prototype,"initialState",{get:function(){var e=this;return this._initialState?this._initialState:Oe(this,function(){return e._initialState=e.machine.initialState,e._initialState})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"state",{get:function(){return M||B(this.status!==z.NotStarted,"Attempted to read state from uninitialized service '".concat(this.id,"'. Make sure the service is started first.")),this._state},enumerable:!1,configurable:!0}),t.prototype.execute=function(e,r){var n,i;try{for(var s=R(e.actions),a=s.next();!a.done;a=s.next()){var u=a.value;this.exec(u,e,r)}}catch(c){n={error:c}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(n)throw n.error}}},t.prototype.update=function(e,r){var n,i,s,a,u,c,l,o,f=this;if(e._sessionid=this.sessionId,this._state=e,this.options.execute&&this.execute(this.state),this.children.forEach(function(A){f.state.children[A.id]=A}),this.devTools&&this.devTools.send(r.data,e),e.event)try{for(var d=R(this.eventListeners),h=d.next();!h.done;h=d.next()){var y=h.value;y(e.event)}}catch(A){n={error:A}}finally{try{h&&!h.done&&(i=d.return)&&i.call(d)}finally{if(n)throw n.error}}try{for(var E=R(this.listeners),v=E.next();!v.done;v=E.next()){var y=v.value;y(e,e.event)}}catch(A){s={error:A}}finally{try{v&&!v.done&&(a=E.return)&&a.call(E)}finally{if(s)throw s.error}}try{for(var x=R(this.contextListeners),g=x.next();!g.done;g=x.next()){var T=g.value;T(this.state.context,this.state.history?this.state.history.context:void 0)}}catch(A){u={error:A}}finally{try{g&&!g.done&&(c=x.return)&&c.call(x)}finally{if(u)throw u.error}}var O=Ne(e.configuration||[],this.machine);if(this.state.configuration&&O){var N=e.configuration.find(function(A){return A.type==="final"&&A.parent===f.machine}),j=N&&N.doneData?xe(N.doneData,e.context,r):void 0;try{for(var b=R(this.doneListeners),w=b.next();!w.done;w=b.next()){var y=w.value;y(Ae(this.id,j))}}catch(A){l={error:A}}finally{try{w&&!w.done&&(o=b.return)&&o.call(b)}finally{if(l)throw l.error}}this.stop()}},t.prototype.onTransition=function(e){return this.listeners.add(e),this.status===z.Running&&e(this.state,this.state.event),this},t.prototype.subscribe=function(e,r,n){var i=this;if(!e)return{unsubscribe:function(){}};var s,a=n;return typeof e=="function"?s=e:(s=e.next.bind(e),a=e.complete.bind(e)),this.listeners.add(s),this.status===z.Running&&s(this.state),a&&this.onDone(a),{unsubscribe:function(){s&&i.listeners.delete(s),a&&i.doneListeners.delete(a)}}},t.prototype.onEvent=function(e){return this.eventListeners.add(e),this},t.prototype.onSend=function(e){return this.sendListeners.add(e),this},t.prototype.onChange=function(e){return this.contextListeners.add(e),this},t.prototype.onStop=function(e){return this.stopListeners.add(e),this},t.prototype.onDone=function(e){return this.doneListeners.add(e),this},t.prototype.off=function(e){return this.listeners.delete(e),this.eventListeners.delete(e),this.sendListeners.delete(e),this.stopListeners.delete(e),this.doneListeners.delete(e),this.contextListeners.delete(e),this},t.prototype.start=function(e){var r=this;if(this.status===z.Running)return this;this.machine._init(),gt.register(this.sessionId,this),this.initialized=!0,this.status=z.Running;var n=e===void 0?this.initialState:Oe(this,function(){return Li(e)?r.machine.resolveState(e):r.machine.resolveState(se.from(e,r.machine.context))});return this.options.devTools&&this.attachDev(),this.scheduler.initialize(function(){r.update(n,be)}),this},t.prototype.stop=function(){var e,r,n,i,s,a,u,c,l,o,f=this;try{for(var d=R(this.listeners),h=d.next();!h.done;h=d.next()){var y=h.value;this.listeners.delete(y)}}catch(w){e={error:w}}finally{try{h&&!h.done&&(r=d.return)&&r.call(d)}finally{if(e)throw e.error}}try{for(var E=R(this.stopListeners),v=E.next();!v.done;v=E.next()){var y=v.value;y(),this.stopListeners.delete(y)}}catch(w){n={error:w}}finally{try{v&&!v.done&&(i=E.return)&&i.call(E)}finally{if(n)throw n.error}}try{for(var x=R(this.contextListeners),g=x.next();!g.done;g=x.next()){var y=g.value;this.contextListeners.delete(y)}}catch(w){s={error:w}}finally{try{g&&!g.done&&(a=x.return)&&a.call(x)}finally{if(s)throw s.error}}try{for(var T=R(this.doneListeners),O=T.next();!O.done;O=T.next()){var y=O.value;this.doneListeners.delete(y)}}catch(w){u={error:w}}finally{try{O&&!O.done&&(c=T.return)&&c.call(T)}finally{if(u)throw u.error}}if(!this.initialized)return this;_([],C(this.state.configuration),!1).sort(function(w,A){return A.order-w.order}).forEach(function(w){var A,D;try{for(var V=R(w.definition.exit),Q=V.next();!Q.done;Q=V.next()){var ge=Q.value;f.exec(ge,f.state)}}catch(kt){A={error:kt}}finally{try{Q&&!Q.done&&(D=V.return)&&D.call(V)}finally{if(A)throw A.error}}}),this.children.forEach(function(w){k(w.stop)&&w.stop()});try{for(var N=R(Object.keys(this.delayedEventsMap)),j=N.next();!j.done;j=N.next()){var b=j.value;this.clock.clearTimeout(this.delayedEventsMap[b])}}catch(w){l={error:w}}finally{try{j&&!j.done&&(o=N.return)&&o.call(N)}finally{if(l)throw l.error}}return this.scheduler.clear(),this.initialized=!1,this.status=z.Stopped,gt.free(this.sessionId),this},t.prototype.batch=function(e){var r=this;if(this.status===z.NotStarted&&this.options.deferEvents)M||B(!1,"".concat(e.length,' event(s) were sent to uninitialized service "').concat(this.machine.id,`" and are deferred. Make sure .start() is called for this service.
|
|
30
|
+
Event: `).concat(JSON.stringify(event)));else if(this.status!==z.Running)throw new Error("".concat(e.length,' event(s) were sent to uninitialized service "').concat(this.machine.id,'". Make sure .start() is called for this service, or set { deferEvents: true } in the service options.'));this.scheduler.schedule(function(){var n,i,s=r.state,a=!1,u=[],c=function(d){var h=F(d);r.forward(h),s=Oe(r,function(){return r.machine.transition(s,h)}),u.push.apply(u,_([],C(s.actions.map(function(y){return Bi(y,s)})),!1)),a=a||!!s.changed};try{for(var l=R(e),o=l.next();!o.done;o=l.next()){var f=o.value;c(f)}}catch(d){n={error:d}}finally{try{o&&!o.done&&(i=l.return)&&i.call(l)}finally{if(n)throw n.error}}s.changed=a,s.actions=u,r.update(s,F(e[e.length-1]))})},t.prototype.sender=function(e){return this.send.bind(this,e)},t.prototype.nextState=function(e){var r=this,n=F(e);if(n.name.indexOf(Nr)===0&&!this.state.nextEvents.some(function(s){return s.indexOf(Nr)===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=R(this.forwardTo),s=i.next();!s.done;s=i.next()){var a=s.value,u=this.children.get(a);if(!u)throw new Error("Unable to forward event '".concat(e,"' from interpreter '").concat(this.id,"' to nonexistant child '").concat(a,"'."));u.send(e)}}catch(c){r={error:c}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}},t.prototype.defer=function(e){var r=this;this.delayedEventsMap[e.id]=this.clock.setTimeout(function(){e.to?r.sendTo(e._event,e.to):r.send(e._event)},e.delay)},t.prototype.cancel=function(e){this.clock.clearTimeout(this.delayedEventsMap[e]),delete this.delayedEventsMap[e]},t.prototype.exec=function(e,r,n){n===void 0&&(n=this.machine.options.actions);var i=r.context,s=r._event,a=e.exec||Jt(e.type,n),u=k(a)?a:a?a.exec:e.exec;if(u)try{return u(i,s.data,{action:e,state:this.state,_event:s})}catch(O){throw this.parent&&this.parent.send({type:"xstate.error",data:O}),O}switch(e.type){case 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 _t:this.cancel(e.sendId);break;case it:{if(this.status!==z.Running)return;var l=e.activity;if(!this.state.activities[l.id||l.type])break;if(l.type===I.Invoke){var o=Gt(l.src),f=this.machine.options.services?this.machine.options.services[o.type]:void 0,d=l.id,h=l.data;M||B(!("forward"in l),"`forward` property is deprecated (found in invocation of '".concat(l.src,"' in in machine '").concat(this.machine.id,"'). ")+"Please use `autoForward` instead.");var y="autoForward"in l?l.autoForward:!!l.forward;if(!f){M||B(!1,"No service found for invocation '".concat(l.src,"' in machine '").concat(this.machine.id,"'."));return}var E=h?xe(h,i,s):void 0;if(typeof f=="string")return;var v=k(f)?f(i,s.data,{data:E,src:o,meta:l.meta}):f;if(!v)return;var x=void 0;de(v)&&(v=E?v.withContext(E):v,x={autoForward:y}),this.spawn(v,d,x)}else this.spawnActivity(l);break}case je:{this.stopChild(e.activity.id);break}case Dt:var g=e.label,T=e.value;g?this.logger(g,T):this.logger(T);break;default:M||B(!1,"No implementation found for action type '".concat(e.type,"'"));break}},t.prototype.removeChild=function(e){var r;this.children.delete(e),this.forwardTo.delete(e),(r=this.state)===null||r===void 0||delete r.children[e]},t.prototype.stopChild=function(e){var r=this.children.get(e);!r||(this.removeChild(e),k(r.stop)&&r.stop())},t.prototype.spawn=function(e,r,n){if(qr(e))return this.spawnPromise(Promise.resolve(e),r);if(k(e))return this.spawnCallback(e,r);if(_i(e))return this.spawnActor(e,r);if(Ei(e))return this.spawnObservable(e,r);if(de(e))return this.spawnMachine(e,m(m({},n),{id:r}));if(mi(e))return this.spawnBehavior(e,r);throw new Error('Unable to spawn entity "'.concat(r,'" of type "').concat(typeof e,'".'))},t.prototype.spawnMachine=function(e,r){var n=this;r===void 0&&(r={});var i=new t(e,m(m({},this.options),{parent:this,id:r.id||e.id})),s=m(m({},hc),r);s.sync&&i.onTransition(function(u){n.send(at,{state:u,id:i.id})});var a=i;return this.children.set(i.id,a),s.autoForward&&this.forwardTo.add(i.id),i.onDone(function(u){n.removeChild(i.id),n.send(F(u,{origin:i.id}))}).start(),a},t.prototype.spawnBehavior=function(e,r){var n=Vi(e,{id:r,parent:this});return this.children.set(r,n),n},t.prototype.spawnPromise=function(e,r){var n,i=this,s=!1,a;e.then(function(c){s||(a=c,i.removeChild(r),i.send(F(Ae(r,c),{origin:r})))},function(c){if(!s){i.removeChild(r);var l=Re(r,c);try{i.send(F(l,{origin:r}))}catch(o){xi(c,o,r),i.devTools&&i.devTools.send(l,i.state),i.machine.strict&&i.stop()}}});var u=(n={id:r,send:function(){},subscribe:function(c,l,o){var f=ft(c,l,o),d=!1;return e.then(function(h){d||(f.next(h),!d&&f.complete())},function(h){d||f.error(h)}),{unsubscribe:function(){return d=!0}}},stop:function(){s=!0},toJSON:function(){return{id:r}},getSnapshot:function(){return a}},n[fe]=function(){return this},n);return this.children.set(r,u),u},t.prototype.spawnCallback=function(e,r){var n,i=this,s=!1,a=new Set,u=new Set,c,l=function(d){c=d,u.forEach(function(h){return h(d)}),!s&&i.send(F(d,{origin:r}))},o;try{o=e(l,function(d){a.add(d)})}catch(d){this.send(Re(r,d))}if(qr(o))return this.spawnPromise(o,r);var f=(n={id:r,send:function(d){return a.forEach(function(h){return h(d)})},subscribe:function(d){var h=ft(d);return u.add(h.next),{unsubscribe:function(){u.delete(h.next)}}},stop:function(){s=!0,k(o)&&o()},toJSON:function(){return{id:r}},getSnapshot:function(){return c}},n[fe]=function(){return this},n);return this.children.set(r,f),f},t.prototype.spawnObservable=function(e,r){var n,i=this,s,a=e.subscribe(function(c){s=c,i.send(F(c,{origin:r}))},function(c){i.removeChild(r),i.send(F(Re(r,c),{origin:r}))},function(){i.removeChild(r),i.send(F(Ae(r),{origin:r}))}),u=(n={id:r,send:function(){},subscribe:function(c,l,o){return e.subscribe(c,l,o)},stop:function(){return a.unsubscribe()},getSnapshot:function(){return s},toJSON:function(){return{id:r}}},n[fe]=function(){return this},n);return this.children.set(r,u),u},t.prototype.spawnActor=function(e,r){return this.children.set(r,e),e},t.prototype.spawnActivity=function(e){var r=this.machine.options&&this.machine.options.activities?this.machine.options.activities[e.type]:void 0;if(!r){M||B(!1,"No implementation found for activity '".concat(e.type,"'"));return}var n=r(this.state.context,e);this.spawnEffect(e.id,n)},t.prototype.spawnEffect=function(e,r){var n;this.children.set(e,(n={id:e,send:function(){},subscribe:function(){return{unsubscribe:function(){}}},stop:r||void 0,getSnapshot:function(){},toJSON:function(){return{id:e}}},n[fe]=function(){return this},n))},t.prototype.attachDev=function(){var e=Wt();if(this.options.devTools&&e){if(e.__REDUX_DEVTOOLS_EXTENSION__){var r=typeof this.options.devTools=="object"?this.options.devTools:void 0;this.devTools=e.__REDUX_DEVTOOLS_EXTENSION__.connect(m(m({name:this.id,autoPause:!0,stateSanitizer:function(n){return{value:n.value,context:n.context,actions:n.actions}}},r),{features:m({jump:!1,skip:!1},r?r.features:void 0)}),this.machine),this.devTools.init(this.state)}Fi(this)}},t.prototype.toJSON=function(){return{id:this.id}},t.prototype[fe]=function(){return this},t.prototype.getSnapshot=function(){return this.status===z.NotStarted?this.initialState:this._state},t.defaultOptions={execute:!0,deferEvents:!0,clock:{setTimeout:function(e,r){return setTimeout(e,r)},clearTimeout:function(e){return clearTimeout(e)}},logger:console.log.bind(console),devTools:!1},t.interpret=me,t}();function me(t,e){var r=new Hi(t,e);return r}function pc(t){if(typeof t=="string"){var e={type:t};return e.toString=function(){return t},e}return t}function Et(t){return m(m({type:st},t),{toJSON:function(){t.onDone,t.onError;var e=Me(t,["onDone","onError"]);return m(m({},e),{type:st,src:pc(t.src)})}})}var Je="",Vr="#",St="*",He={},Ge=function(t){return t[0]===Vr},vc=function(){return{actions:{},guards:{},services:{},activities:{},delays:{}}},mc=function(t,e,r){var n=r.slice(0,-1).some(function(s){return!("cond"in s)&&!("in"in s)&&(P(s.target)||de(s.target))}),i=e===Je?"the transient event":"event '".concat(e,"'");B(!n,"One or more transitions for ".concat(i," on state '").concat(t.id,"' are unreachable. ")+"Make sure that the default transition is the last one defined.")},Gi=function(){function t(e,r,n,i){var s=this;n===void 0&&(n="context"in e?e.context:void 0);var a;this.config=e,this._context=n,this.order=-1,this.__xstatenode=!0,this.__cache={events:void 0,relativeValue:new Map,initialStateValue:void 0,initialState:void 0,on:void 0,transitions:void 0,candidates:{},delayedTransitions:void 0},this.idMap={},this.tags=[],this.options=Object.assign(vc(),r),this.parent=i==null?void 0:i.parent,this.key=this.config.key||(i==null?void 0:i.key)||this.config.id||"(machine)",this.machine=this.parent?this.parent.machine:this,this.path=this.parent?this.parent.path.concat(this.key):[],this.delimiter=this.config.delimiter||(this.parent?this.parent.delimiter:Ut),this.id=this.config.id||_([this.machine.key],C(this.path),!1).join(this.delimiter),this.version=this.parent?this.parent.version:this.config.version,this.type=this.config.type||(this.config.parallel?"parallel":this.config.states&&Object.keys(this.config.states).length?"compound":this.config.history?"history":"atomic"),this.schema=this.parent?this.machine.schema:(a=this.config.schema)!==null&&a!==void 0?a:{},this.description=this.config.description,M||B(!("parallel"in this.config),'The "parallel" property is deprecated and will be removed in version 4.1. '.concat(this.config.parallel?"Replace with `type: 'parallel'`":"Use `type: '".concat(this.type,"'`")," in the config for state node '").concat(this.id,"' instead.")),this.initial=this.config.initial,this.states=this.config.states?Fe(this.config.states,function(l,o){var f,d=new t(l,{},void 0,{parent:s,key:o});return Object.assign(s.idMap,m((f={},f[d.id]=d,f),d.idMap)),d}):He;var u=0;function c(l){var o,f;l.order=u++;try{for(var d=R(Ce(l)),h=d.next();!h.done;h=d.next()){var y=h.value;c(y)}}catch(E){o={error:E}}finally{try{h&&!h.done&&(f=d.return)&&f.call(d)}finally{if(o)throw o.error}}}c(this),this.history=this.config.history===!0?"shallow":this.config.history||!1,this._transient=!!this.config.always||(this.config.on?Array.isArray(this.config.on)?this.config.on.some(function(l){var o=l.event;return o===Je}):Je in this.config.on:!1),this.strict=!!this.config.strict,this.onEntry=te(this.config.entry||this.config.onEntry).map(function(l){return Ve(l)}),this.onExit=te(this.config.exit||this.config.onExit).map(function(l){return Ve(l)}),this.meta=this.config.meta,this.doneData=this.type==="final"?this.config.data:void 0,this.invoke=te(this.config.invoke).map(function(l,o){var f,d;if(de(l)){var h=dt(s.id,o);return s.machine.options.services=m((f={},f[h]=l,f),s.machine.options.services),Et({src:h,id:h})}else if(P(l.src)){var h=l.id||dt(s.id,o);return Et(m(m({},l),{id:h,src:l.src}))}else if(de(l.src)||k(l.src)){var h=l.id||dt(s.id,o);return s.machine.options.services=m((d={},d[h]=l.src,d),s.machine.options.services),Et(m(m({id:h},l),{src:h}))}else{var y=l.src;return Et(m(m({id:dt(s.id,o)},l),{src:y}))}}),this.activities=te(this.config.activities).concat(this.invoke).map(function(l){return $t(l)}),this.transition=this.transition.bind(this),this.tags=te(this.config.tags)}return t.prototype._init=function(){this.__cache.transitions||Mr(this).forEach(function(e){return e.on})},t.prototype.withConfig=function(e,r){var n=this.options,i=n.actions,s=n.activities,a=n.guards,u=n.services,c=n.delays;return new t(this.config,{actions:m(m({},i),e.actions),activities:m(m({},s),e.activities),guards:m(m({},a),e.guards),services:m(m({},u),e.services),delays:m(m({},c),e.delays)},r!=null?r:this.context)},t.prototype.withContext=function(e){return new t(this.config,this.options,e)},Object.defineProperty(t.prototype,"context",{get:function(){return k(this._context)?this._context():this._context},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"definition",{get:function(){return{id:this.id,key:this.key,version:this.version,context:this.context,type:this.type,initial:this.initial,history:this.history,states:Fe(this.states,function(e){return e.definition}),on:this.on,transitions:this.transitions,entry:this.onEntry,exit:this.onExit,activities:this.activities||[],meta:this.meta,order:this.order||-1,data:this.doneData,invoke:this.invoke,description:this.description,tags:this.tags}},enumerable:!1,configurable:!0}),t.prototype.toJSON=function(){return this.definition},Object.defineProperty(t.prototype,"on",{get:function(){if(this.__cache.on)return this.__cache.on;var e=this.transitions;return this.__cache.on=e.reduce(function(r,n){return r[n.eventType]=r[n.eventType]||[],r[n.eventType].push(n),r},{})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"after",{get:function(){return this.__cache.delayedTransitions||(this.__cache.delayedTransitions=this.getDelayedTransitions(),this.__cache.delayedTransitions)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"transitions",{get:function(){return this.__cache.transitions||(this.__cache.transitions=this.formatTransitions(),this.__cache.transitions)},enumerable:!1,configurable:!0}),t.prototype.getCandidates=function(e){if(this.__cache.candidates[e])return this.__cache.candidates[e];var r=e===Je,n=this.transitions.filter(function(i){var s=i.eventType===e;return r?s:s||i.eventType===St});return this.__cache.candidates[e]=n,n},t.prototype.getDelayedTransitions=function(){var e=this,r=this.config.after;if(!r)return[];var n=function(s,a){var u=k(s)?"".concat(e.id,":delay[").concat(a,"]"):s,c=Ci(u,e.id);return e.onEntry.push(pt(c,{delay:s})),e.onExit.push(bi(c)),c},i=ve(r)?r.map(function(s,a){var u=n(s.delay,a);return m(m({},s),{event:u})}):U(Object.keys(r).map(function(s,a){var u=r[s],c=P(u)?{target:u}:u,l=isNaN(+s)?s:+s,o=n(l,a);return te(c).map(function(f){return m(m({},f),{event:o,delay:l})})}));return i.map(function(s){var a=s.delay;return m(m({},e.formatTransition(s)),{delay:a})})},t.prototype.getStateNodes=function(e){var r,n=this;if(!e)return[];var i=e instanceof se?e.value:Be(e,this.delimiter);if(P(i)){var s=this.getStateNode(i).initial;return s!==void 0?this.getStateNodes((r={},r[i]=s,r)):[this,this.states[i]]}var a=Object.keys(i),u=[this];return u.push.apply(u,_([],C(U(a.map(function(c){return n.getStateNode(c).getStateNodes(i[c])}))),!1)),u},t.prototype.handles=function(e){var r=Lt(e);return this.events.includes(r)},t.prototype.resolveState=function(e){var r=e instanceof se?e:se.create(e),n=Array.from(Pe([],this.getStateNodes(r.value)));return new se(m(m({},r),{value:this.resolve(r.value),configuration:n,done:Ne(n,this),tags:jr(n),machine:this.machine}))},t.prototype.transitionLeafNode=function(e,r,n){var i=this.getStateNode(e),s=i.next(r,n);return!s||!s.transitions.length?this.next(r,n):s},t.prototype.transitionCompoundNode=function(e,r,n){var i=Object.keys(e),s=this.getStateNode(i[0]),a=s._transition(e[i[0]],r,n);return!a||!a.transitions.length?this.next(r,n):a},t.prototype.transitionParallelNode=function(e,r,n){var i,s,a={};try{for(var u=R(Object.keys(e)),c=u.next();!c.done;c=u.next()){var l=c.value,o=e[l];if(!!o){var f=this.getStateNode(l),d=f._transition(o,r,n);d&&(a[l]=d)}}}catch(g){i={error:g}}finally{try{c&&!c.done&&(s=u.return)&&s.call(u)}finally{if(i)throw i.error}}var h=Object.keys(a).map(function(g){return a[g]}),y=U(h.map(function(g){return g.transitions})),E=h.some(function(g){return g.transitions.length>0});if(!E)return this.next(r,n);var v=U(h.map(function(g){return g.entrySet})),x=U(Object.keys(a).map(function(g){return a[g].configuration}));return{transitions:y,entrySet:v,exitSet:U(h.map(function(g){return g.exitSet})),configuration:x,source:r,actions:U(Object.keys(a).map(function(g){return a[g].actions}))}},t.prototype._transition=function(e,r,n){return P(e)?this.transitionLeafNode(e,r,n):Object.keys(e).length===1?this.transitionCompoundNode(e,r,n):this.transitionParallelNode(e,r,n)},t.prototype.getTransitionData=function(e,r){return this._transition(e.value,e,F(r))},t.prototype.next=function(e,r){var n,i,s=this,a=r.name,u=[],c=[],l;try{for(var o=R(this.getCandidates(a)),f=o.next();!f.done;f=o.next()){var d=f.value,h=d.cond,y=d.in,E=e.context,v=y?P(y)&&Ge(y)?e.matches(Be(this.getStateNodeById(y).path,this.delimiter)):ut(Be(y,this.delimiter),di(this.path.slice(0,-2))(e.value)):!0,x=!1;try{x=!h||Ht(this.machine,h,E,r,e)}catch(N){throw new Error("Unable to evaluate guard '".concat(h.name||h.type,"' in transition for event '").concat(a,"' in state node '").concat(this.id,`':
|
|
31
|
+
`).concat(N.message))}if(x&&v){d.target!==void 0&&(c=d.target),u.push.apply(u,_([],C(d.actions),!1)),l=d;break}}}catch(N){n={error:N}}finally{try{f&&!f.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}if(!!l){if(!c.length)return{transitions:[l],entrySet:[],exitSet:[],configuration:e.value?[this]:[],source:e,actions:u};var g=U(c.map(function(N){return s.getRelativeStateNodes(N,e.historyValue)})),T=!!l.internal,O=T?[]:U(g.map(function(N){return s.nodesFromChild(N)}));return{transitions:[l],entrySet:O,exitSet:T?[]:[this],configuration:g,source:e,actions:u}}},t.prototype.nodesFromChild=function(e){if(e.escapes(this))return[];for(var r=[],n=e;n&&n!==this;)r.push(n),n=n.parent;return r.push(this),r},t.prototype.escapes=function(e){if(this===e)return!1;for(var r=this.parent;r;){if(r===e)return!1;r=r.parent}return!0},t.prototype.getActions=function(e,r,n,i){var s,a,u,c,l=Pe([],i?this.getStateNodes(i.value):[this]),o=e.configuration.length?Pe(l,e.configuration):l;try{for(var f=R(o),d=f.next();!d.done;d=f.next()){var h=d.value;yt(l,h)||e.entrySet.push(h)}}catch(b){s={error:b}}finally{try{d&&!d.done&&(a=f.return)&&a.call(f)}finally{if(s)throw s.error}}try{for(var y=R(l),E=y.next();!E.done;E=y.next()){var h=E.value;(!yt(o,h)||yt(e.exitSet,h.parent))&&e.exitSet.push(h)}}catch(b){u={error:b}}finally{try{E&&!E.done&&(c=y.return)&&c.call(y)}finally{if(u)throw u.error}}var v=U(e.entrySet.map(function(b){var w=[];if(b.type!=="final")return w;var A=b.parent;if(!A.parent)return w;w.push(vt(b.id,b.doneData),vt(A.id,b.doneData?xe(b.doneData,r,n):void 0));var D=A.parent;return D.type==="parallel"&&Ce(D).every(function(V){return Ne(e.configuration,V)})&&w.push(vt(D.id)),w}));e.exitSet.sort(function(b,w){return w.order-b.order}),e.entrySet.sort(function(b,w){return b.order-w.order});var x=new Set(e.entrySet),g=new Set(e.exitSet),T=C([U(Array.from(x).map(function(b){return _(_([],C(b.activities.map(function(w){return Ai(w)})),!1),C(b.onEntry),!1)})).concat(v.map(Ti)),U(Array.from(g).map(function(b){return _(_([],C(b.onExit),!1),C(b.activities.map(function(w){return Ri(w)})),!1)}))],2),O=T[0],N=T[1],j=ht(N.concat(e.actions).concat(O),this.machine.options.actions);return j},t.prototype.transition=function(e,r,n){e===void 0&&(e=this.initialState);var i=F(r),s;if(e instanceof se)s=n===void 0?e:this.resolveState(se.from(e,n));else{var a=P(e)?this.resolve(ot(this.getResolvedPath(e))):this.resolve(e),u=n!=null?n:this.machine.context;s=this.resolveState(se.from(a,u))}if(!M&&i.name===St)throw new Error("An event cannot have the wildcard type ('".concat(St,"')"));if(this.strict&&!this.events.includes(i.name)&&!vi(i.name))throw new Error("Machine '".concat(this.id,"' does not accept event '").concat(i.name,"'"));var c=this._transition(s.value,s,i)||{transitions:[],configuration:[],entrySet:[],exitSet:[],source:s,actions:[]},l=Pe([],this.getStateNodes(s.value)),o=c.configuration.length?Pe(l,c.configuration):l;return c.configuration=_([],C(o),!1),this.resolveTransition(c,s,s.context,i)},t.prototype.resolveRaisedTransition=function(e,r,n){var i,s=e.actions;return e=this.transition(e,r),e._event=n,e.event=n.data,(i=e.actions).unshift.apply(i,_([],C(s),!1)),e},t.prototype.resolveTransition=function(e,r,n,i){var s,a,u=this;i===void 0&&(i=be);var c=e.configuration,l=!r||e.transitions.length>0,o=l?Ui(this.machine,c):void 0,f=r?r.historyValue?r.historyValue:e.source?this.machine.historyValue(r.value):void 0:void 0,d=this.getActions(e,n,i,r),h=r?m({},r.activities):{};try{for(var y=R(d),E=y.next();!E.done;E=y.next()){var v=E.value;v.type===it?h[v.activity.id||v.activity.type]=v:v.type===je&&(h[v.activity.id||v.activity.type]=!1)}}catch(ee){s={error:ee}}finally{try{E&&!E.done&&(a=y.return)&&a.call(y)}finally{if(s)throw s.error}}var x=C(zt(this,r,n,i,d,this.machine.config.preserveActionOrder),2),g=x[0],T=x[1],O=C(Ft(g,function(ee){return ee.type===Le||ee.type===we&&ee.to===Ee.Internal}),2),N=O[0],j=O[1],b=g.filter(function(ee){var Ue;return ee.type===it&&((Ue=ee.activity)===null||Ue===void 0?void 0:Ue.type)===st}),w=b.reduce(function(ee,Ue){return ee[Ue.activity.id]=Ii(Ue.activity,u.machine,T,i),ee},r?m({},r.children):{}),A=l?e.configuration:r?r.configuration:[],D=Ne(A,this),V=new se({value:o||r.value,context:T,_event:i,_sessionid:r?r._sessionid:null,historyValue:o?f?gi(f,o):void 0:r?r.historyValue:void 0,history:!o||e.source?r:void 0,actions:o?j:[],activities:o?h:r?r.activities:{},events:[],configuration:A,transitions:e.transitions,children:w,done:D,tags:r==null?void 0:r.tags,machine:this}),Q=n!==T;V.changed=i.name===at||Q;var ge=V.history;ge&&delete ge.history;var kt=!D&&(this._transient||c.some(function(ee){return ee._transient}));if(!l&&(!kt||i.name===Je))return V;var Z=V;if(!D)for(kt&&(Z=this.resolveRaisedTransition(Z,{type:oi},i));N.length;){var Ku=N.shift();Z=this.resolveRaisedTransition(Z,Ku._event,i)}var Xu=Z.changed||(ge?!!Z.actions.length||Q||typeof ge.value!=typeof Z.value||!Lr(Z.value,ge.value):void 0);return Z.changed=Xu,Z.history=ge,Z.tags=jr(Z.configuration),Z},t.prototype.getStateNode=function(e){if(Ge(e))return this.machine.getStateNodeById(e);if(!this.states)throw new Error("Unable to retrieve child state '".concat(e,"' from '").concat(this.id,"'; no child states exist."));var r=this.states[e];if(!r)throw new Error("Child state '".concat(e,"' does not exist on '").concat(this.id,"'"));return r},t.prototype.getStateNodeById=function(e){var r=Ge(e)?e.slice(Vr.length):e;if(r===this.id)return this;var n=this.machine.idMap[r];if(!n)throw new Error("Child state node '#".concat(r,"' does not exist on machine '").concat(this.id,"'"));return n},t.prototype.getStateNodeByPath=function(e){if(typeof e=="string"&&Ge(e))try{return this.getStateNodeById(e.slice(1))}catch{}for(var r=Bt(e,this.delimiter).slice(),n=this;r.length;){var i=r.shift();if(!i.length)break;n=n.getStateNode(i)}return n},t.prototype.resolve=function(e){var r,n=this;if(!e)return this.initialStateValue||He;switch(this.type){case"parallel":return Fe(this.initialStateValue,function(s,a){return s?n.getStateNode(a).resolve(e[a]||s):He});case"compound":if(P(e)){var i=this.getStateNode(e);return i.type==="parallel"||i.type==="compound"?(r={},r[e]=i.initialStateValue,r):e}return Object.keys(e).length?Fe(e,function(s,a){return s?n.getStateNode(a).resolve(s):He}):this.initialStateValue||{};default:return e||He}},t.prototype.getResolvedPath=function(e){if(Ge(e)){var r=this.machine.idMap[e.slice(Vr.length)];if(!r)throw new Error("Unable to find state node '".concat(e,"'"));return r.path}return Bt(e,this.delimiter)},Object.defineProperty(t.prototype,"initialStateValue",{get:function(){var e;if(this.__cache.initialStateValue)return this.__cache.initialStateValue;var r;if(this.type==="parallel")r=_r(this.states,function(n){return n.initialStateValue||He},function(n){return n.type!=="history"});else if(this.initial!==void 0){if(!this.states[this.initial])throw new Error("Initial state '".concat(this.initial,"' not found on '").concat(this.key,"'"));r=mt(this.states[this.initial])?this.initial:(e={},e[this.initial]=this.states[this.initial].initialStateValue,e)}else r={};return this.__cache.initialStateValue=r,this.__cache.initialStateValue},enumerable:!1,configurable:!0}),t.prototype.getInitialState=function(e,r){this._init();var n=this.getStateNodes(e);return this.resolveTransition({configuration:n,entrySet:n,exitSet:[],transitions:[],source:void 0,actions:[]},void 0,r!=null?r:this.machine.context,void 0)},Object.defineProperty(t.prototype,"initialState",{get:function(){var e=this.initialStateValue;if(!e)throw new Error("Cannot retrieve initial state from simple state '".concat(this.id,"'."));return this.getInitialState(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"target",{get:function(){var e;if(this.type==="history"){var r=this.config;P(r.target)?e=Ge(r.target)?ot(this.machine.getStateNodeById(r.target).path.slice(this.path.length-1)):r.target:e=r.target}return e},enumerable:!1,configurable:!0}),t.prototype.getRelativeStateNodes=function(e,r,n){return n===void 0&&(n=!0),n?e.type==="history"?e.resolveHistory(r):e.initialStateNodes:[e]},Object.defineProperty(t.prototype,"initialStateNodes",{get:function(){var e=this;if(mt(this))return[this];if(this.type==="compound"&&!this.initial)return M||B(!1,"Compound state node '".concat(this.id,"' has no initial state.")),[this];var r=ct(this.initialStateValue);return U(r.map(function(n){return e.getFromRelativePath(n)}))},enumerable:!1,configurable:!0}),t.prototype.getFromRelativePath=function(e){if(!e.length)return[this];var r=C(e),n=r[0],i=r.slice(1);if(!this.states)throw new Error("Cannot retrieve subPath '".concat(n,"' from node with no states"));var s=this.getStateNode(n);if(s.type==="history")return s.resolveHistory();if(!this.states[n])throw new Error("Child state '".concat(n,"' does not exist on '").concat(this.id,"'"));return this.states[n].getFromRelativePath(i)},t.prototype.historyValue=function(e){if(!!Object.keys(this.states).length)return{current:e||this.initialStateValue,states:_r(this.states,function(r,n){if(!e)return r.historyValue();var i=P(e)?void 0:e[n];return r.historyValue(i||r.initialStateValue)},function(r){return!r.history})}},t.prototype.resolveHistory=function(e){var r=this;if(this.type!=="history")return[this];var n=this.parent;if(!e){var i=this.target;return i?U(ct(i).map(function(a){return n.getFromRelativePath(a)})):n.initialStateNodes}var s=hi(n.path,"states")(e).current;return P(s)?[n.getStateNode(s)]:U(ct(s).map(function(a){return r.history==="deep"?n.getFromRelativePath(a):[n.states[a[0]]]}))},Object.defineProperty(t.prototype,"stateIds",{get:function(){var e=this,r=U(Object.keys(this.states).map(function(n){return e.states[n].stateIds}));return[this.id].concat(r)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"events",{get:function(){var e,r,n,i;if(this.__cache.events)return this.__cache.events;var s=this.states,a=new Set(this.ownEvents);if(s)try{for(var u=R(Object.keys(s)),c=u.next();!c.done;c=u.next()){var l=c.value,o=s[l];if(o.states)try{for(var f=(n=void 0,R(o.events)),d=f.next();!d.done;d=f.next()){var h=d.value;a.add("".concat(h))}}catch(y){n={error:y}}finally{try{d&&!d.done&&(i=f.return)&&i.call(f)}finally{if(n)throw n.error}}}}catch(y){e={error:y}}finally{try{c&&!c.done&&(r=u.return)&&r.call(u)}finally{if(e)throw e.error}}return this.__cache.events=Array.from(a)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ownEvents",{get:function(){var e=new Set(this.transitions.filter(function(r){return!(!r.target&&!r.actions.length&&r.internal)}).map(function(r){return r.eventType}));return Array.from(e)},enumerable:!1,configurable:!0}),t.prototype.resolveTarget=function(e){var r=this;if(e!==void 0)return e.map(function(n){if(!P(n))return n;var i=n[0]===r.delimiter;if(i&&!r.parent)return r.getStateNodeByPath(n.slice(1));var s=i?r.key+n:n;if(r.parent)try{var a=r.parent.getStateNodeByPath(s);return a}catch(u){throw new Error("Invalid transition definition for state node '".concat(r.id,`':
|
|
32
|
+
`).concat(u.message))}else return r.getStateNodeByPath(s)})},t.prototype.formatTransition=function(e){var r=this,n=wi(e.target),i="internal"in e?e.internal:n?n.some(function(c){return P(c)&&c[0]===r.delimiter}):!0,s=this.machine.options.guards,a=this.resolveTarget(n),u=m(m({},e),{actions:ht(te(e.actions)),cond:Vt(e.cond,s),target:a,source:this,internal:i,eventType:e.event,toJSON:function(){return m(m({},u),{target:u.target?u.target.map(function(c){return"#".concat(c.id)}):void 0,source:"#".concat(r.id)})}});return u},t.prototype.formatTransitions=function(){var e,r,n=this,i;if(!this.config.on)i=[];else if(Array.isArray(this.config.on))i=this.config.on;else{var s=this.config.on,a=St,u=s[a],c=u===void 0?[]:u,l=Me(s,[typeof a=="symbol"?a:a+""]);i=U(Object.keys(l).map(function(g){!M&&g===Je&&B(!1,"Empty string transition configs (e.g., `{ on: { '': ... }}`) for transient transitions are deprecated. Specify the transition in the `{ always: ... }` property instead. "+'Please check the `on` configuration for "#'.concat(n.id,'".'));var T=Te(g,l[g]);return M||mc(n,g,T),T}).concat(Te(St,c)))}var o=this.config.always?Te("",this.config.always):[],f=this.config.onDone?Te(String(vt(this.id)),this.config.onDone):[];M||B(!(this.config.onDone&&!this.parent),'Root nodes cannot have an ".onDone" transition. Please check the config of "'.concat(this.id,'".'));var d=U(this.invoke.map(function(g){var T=[];return g.onDone&&T.push.apply(T,_([],C(Te(String(Ae(g.id)),g.onDone)),!1)),g.onError&&T.push.apply(T,_([],C(Te(String(Re(g.id)),g.onError)),!1)),T})),h=this.after,y=U(_(_(_(_([],C(f),!1),C(d),!1),C(i),!1),C(o),!1).map(function(g){return te(g).map(function(T){return n.formatTransition(T)})}));try{for(var E=R(h),v=E.next();!v.done;v=E.next()){var x=v.value;y.push(x)}}catch(g){e={error:g}}finally{try{v&&!v.done&&(r=E.return)&&r.call(E)}finally{if(e)throw e.error}}return y},t}();function ae(t,e){return new Gi(t,e)}var q=Oi,$=pt;var Kt="nhostRefreshToken",wt="nhostRefreshTokenExpiresAt";var Ie={status:10,error:"invalid-email",message:"Email is incorrectly formatted"};var xt={status:10,error:"invalid-password",message:"Password is incorrectly formatted"},Ji={status:10,error:"invalid-phone-number",message:"Phone number is incorrectly formatted"},zi={status:10,error:"no-mfa-ticket",message:"No MFA ticket has been provided"};var ea=nt(Zs());var oe=t=>{let e=ea.default.create({baseURL:t});return e.interceptors.response.use(r=>r,r=>{var n,i,s,a,u,c,l,o,f,d;return Promise.reject({error:{message:(u=(a=(s=(i=(n=r.response)==null?void 0:n.data)==null?void 0:i.message)!=null?s:r.message)!=null?a:r.request.responseText)!=null?u:JSON.stringify(r),status:(f=(o=(c=r.response)==null?void 0:c.status)!=null?o:(l=r.response)==null?void 0:l.data.statusCode)!=null?f:0,error:((d=r.response)==null?void 0:d.data.error)||r.request.statusText||"network"}})}),e};var ta=(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},ie=(t,e)=>{var r;return e!=null&&e.redirectTo?{...e,redirectTo:(r=e==null?void 0:e.redirectTo)!=null&&r.startsWith("/")?t+e.redirectTo:e==null?void 0:e.redirectTo}:e};var Ke=t=>!!t&&typeof t=="string"&&!!String(t).toLowerCase().match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/),nr=t=>!!t&&typeof t=="string"&&t.length>=3,ra=t=>!!t&&typeof t=="string";var cn={user:null,mfa:null,accessToken:{value:null,expiresAt:new Date},refreshTimer:{elapsed:0,attempts:0},refreshToken:{value:null},errors:{}};var na=({backendUrl:t,clientUrl:e,interpreter:r})=>{let n=oe(t);return ae({schema:{context:{},events:{}},tsTypes:{},preserveActionOrder:!0,id:"changeEmail",initial:"idle",context:{error:null},states:{idle:{on:{REQUEST:[{cond:"invalidEmail",actions:"saveInvalidEmailError",target:".error"},{target:"requesting"}]},initial:"initial",states:{initial:{},success:{},error:{}}},requesting:{invoke:{src:"requestChange",id:"requestChange",onDone:{target:"idle.success",actions:"reportSuccess"},onError:{actions:["saveRequestError","reportError"],target:"idle.error"}}}}},{actions:{saveInvalidEmailError:q({error:i=>Ie}),saveRequestError:q({error:(i,{data:{error:s}})=>s}),reportError:$(i=>({type:"ERROR",error:i.error})),reportSuccess:$("SUCCESS")},guards:{invalidEmail:(i,{email:s})=>!Ke(s)},services:{requestChange:async(i,{email:s,options:a})=>(await n.post("/user/email/change",{newEmail:s,options:ie(e,a)},{headers:{authorization:`Bearer ${r==null?void 0:r.state.context.accessToken.value}`}})).data}})};var ia=({backendUrl:t,interpreter:e})=>{let r=oe(t);return ae({schema:{context:{},events:{}},tsTypes:{},preserveActionOrder:!0,id:"changePassword",initial:"idle",context:{error:null},states:{idle:{on:{REQUEST:[{cond:"invalidPassword",actions:"saveInvalidPasswordError",target:".error"},{target:"requesting"}]},initial:"initial",states:{initial:{},success:{},error:{}}},requesting:{invoke:{src:"requestChange",id:"requestChange",onDone:{target:"idle.success",actions:"reportSuccess"},onError:{actions:["saveRequestError","reportError"],target:"idle.error"}}}}},{actions:{saveInvalidPasswordError:q({error:n=>xt}),saveRequestError:q({error:(n,{data:{error:i}})=>(console.log(i),i)}),reportError:$(n=>({type:"ERROR",error:n.error})),reportSuccess:$("SUCCESS")},guards:{invalidPassword:(n,{password:i})=>!nr(i)},services:{requestChange:(n,{password:i})=>r.post("/user/password",{newPassword:i},{headers:{authorization:`Bearer ${e==null?void 0:e.state.context.accessToken.value}`}})}})};var sa=({backendUrl:t,clientUrl:e})=>{let r=oe(t);return ae({schema:{context:{},events:{}},tsTypes:{},preserveActionOrder:!0,id:"changePassword",initial:"idle",context:{error:null},states:{idle:{on:{REQUEST:"requesting"},initial:"initial",states:{initial:{},success:{},error:{}}},requesting:{invoke:{src:"requestChange",id:"requestChange",onDone:{target:"idle.success",actions:"reportSuccess"},onError:{actions:["saveRequestError","reportError"],target:"idle.error"}}}}},{actions:{saveRequestError:q({error:(n,{data:{error:i}})=>(console.log(i),i)}),reportError:$(n=>({type:"ERROR",error:n.error})),reportSuccess:$("SUCCESS")},services:{requestChange:(n,{email:i,options:s})=>r.post("/user/password/reset",{email:i,options:ie(e,s)})}})};var aa=({backendUrl:t,clientUrl:e,interpreter:r})=>{let n=oe(t);return ae({schema:{context:{},events:{}},tsTypes:{},preserveActionOrder:!0,id:"sendVerificationEmail",initial:"idle",context:{error:null},states:{idle:{on:{REQUEST:[{cond:"invalidEmail",actions:"saveInvalidEmailError",target:".error"},{target:"requesting"}]},initial:"initial",states:{initial:{},success:{},error:{}}},requesting:{invoke:{src:"request",id:"request",onDone:{target:"idle.success",actions:"reportSuccess"},onError:{actions:["saveRequestError","reportError"],target:"idle.error"}}}}},{actions:{saveInvalidEmailError:q({error:i=>Ie}),saveRequestError:q({error:(i,{data:{error:s}})=>s}),reportError:$(i=>({type:"ERROR",error:i.error})),reportSuccess:$("SUCCESS")},guards:{invalidEmail:(i,{email:s})=>!Ke(s)},services:{request:async(i,{email:s,options:a})=>(await n.post("/user/email/send-verification-email",{email:s,options:ie(e,a)})).data}})};var oa=({backendUrl:t,clientUrl:e,clientStorageGetter:r,clientStorageSetter:n,refreshIntervalTime:i,autoRefreshToken:s=!0,autoSignIn:a=!0})=>{let u=oe(t),c=async(l,o,f)=>(await u.post(l,o,f)).data;return ae({schema:{context:{},events:{}},tsTypes:{},context:cn,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:$("SIGNED_IN"),reportSignedOut:$("SIGNED_OUT"),reportTokenChanged:$("TOKEN_CHANGED"),clearContext:q(()=>cn),saveSession:q({user:(l,o)=>{var f,d;return(d=(f=o.data)==null?void 0:f.session)==null?void 0:d.user},accessToken:(l,o)=>{var f,d,h,y;return{value:(d=(f=o.data)==null?void 0:f.session)==null?void 0:d.accessToken,expiresAt:new Date(Date.now()+((y=(h=o.data)==null?void 0:h.session)==null?void 0:y.accessTokenExpiresIn)*1e3)}},refreshToken:(l,o)=>{var f,d;return{value:(d=(f=o.data)==null?void 0:f.session)==null?void 0:d.refreshToken}}}),saveMfaTicket:q({mfa:(l,o)=>{var f,d;return(d=(f=o.data)==null?void 0:f.mfa)!=null?d:null}}),resetTimer:q({refreshTimer:(l,o)=>({elapsed:0,attempts:0})}),tickRefreshTimer:q({refreshTimer:(l,o)=>({elapsed:l.refreshTimer.elapsed+1,attempts:l.refreshTimer.attempts})}),saveAuthenticationError:q({errors:({errors:l},{data:{error:o}})=>({...l,authentication:o})}),resetAuthenticationError:q({errors:({errors:{authentication:l,...o}})=>o}),saveInvalidEmail:q({errors:({errors:l})=>({...l,authentication:Ie})}),saveInvalidPassword:q({errors:({errors:l})=>({...l,authentication:xt})}),saveInvalidPhoneNumber:q({errors:({errors:l})=>({...l,authentication:Ji})}),saveRegisrationError:q({errors:({errors:l},{data:{error:o}})=>({...l,registration:o})}),resetSignUpError:q({errors:({errors:{registration:l,...o}})=>o}),saveInvalidSignUpPassword:q({errors:({errors:l})=>({...l,registration:Ie})}),saveInvalidSignUpEmail:q({errors:({errors:l})=>({...l,registration:xt})}),saveNoMfaTicketError:q({errors:({errors:l})=>({...l,registration:zi})}),saveRefreshToken:q({accessToken:(l,o)=>({...l.accessToken,expiresAt:o.data.expiresAt}),refreshToken:(l,o)=>({...l.refreshToken,value:o.data.refreshToken})}),persist:(l,{data:o})=>{if(n(Kt,o.session.refreshToken),o.session.accessTokenExpiresIn){let f=new Date(Date.now()+o.session.accessTokenExpiresIn*1e3).toISOString();n(wt,f)}else n(wt,null)},destroyToken:()=>{n(Kt,null),n(wt,null)}},guards:{isSignedIn:l=>!!l.user&&!!l.refreshToken.value&&!!l.accessToken.value,hasRefreshTokenWithoutSession:l=>!!l.refreshToken.value&&!l.user&&!l.accessToken.value,noToken:l=>!l.refreshToken.value,noMfaTicket:(l,{ticket:o})=>{var f;return!o&&!((f=l.mfa)!=null&&f.ticket)},hasRefreshToken:l=>!!l.refreshToken.value,isAutoRefreshDisabled:()=>!s,isAutoSignInDisabled:()=>!a,refreshTimerShouldRefresh:l=>l.refreshTimer.elapsed>Math.max((Date.now()-l.accessToken.expiresAt.getTime())/1e3-900,i),unverified:(l,{data:{error:o}})=>o.status===401&&o.message==="Email is not verified",hasSession:(l,o)=>{var f;return!!((f=o.data)!=null&&f.session)},hasMfaTicket:(l,o)=>{var f;return!!((f=o.data)!=null&&f.mfa)},invalidEmail:(l,{email:o})=>!Ke(o),invalidPassword:(l,{password:o})=>!nr(o),invalidPhoneNumber:(l,{phoneNumber:o})=>!ra(o)},services:{signInPassword:(l,{email:o,password:f})=>c("/signin/email-password",{email:o,password:f}),signInPasswordlessSms:(l,{phoneNumber:o,options:f})=>c("/signin/passwordless/sms",{phoneNumber:o,options:ie(e,f)}),signInPasswordlessSmsOtp:(l,{phoneNumber:o,otp:f})=>c("/signin/passwordless/sms/otp",{phoneNumber:o,otp:f}),signInPasswordlessEmail:(l,{email:o,options:f})=>c("/signin/passwordless/email",{email:o,options:ie(e,f)}),signInAnonymous:l=>c("/signin/anonymous"),signInMfaTotp:(l,{ticket:o,otp:f})=>{var d;return c("/signin/mfa/totp",{ticket:o||((d=l.mfa)==null?void 0:d.ticket),otp:f})},refreshToken:async(l,o)=>{let f=o.type==="TRY_TOKEN"?o.token:l.refreshToken.value;return{session:await c("/token",{refreshToken:f})}},signout:(l,o)=>c("/signout",{refreshToken:l.refreshToken.value,all:!!o.all}),registerUser:(l,{email:o,password:f,options:d})=>c("/signup/email-password",{email:o,password:f,options:ie(e,d)}),autoSignIn:async()=>{if(typeof window=="undefined"||!window.location)throw Error("window is undefined or location does not exist");let{hash:l}=window.location;if(!l)throw Error("No hash in window.location");let f=new URLSearchParams(l.slice(1)).get("refreshToken");if(!f)throw Error("No refresh token in the location hash");let d=await c("/token",{refreshToken:f});return new BroadcastChannel("nhost").postMessage(f),{session:d}},importRefreshToken:async()=>{let l=await r(wt),o=l?new Date(l):null;return{refreshToken:await r(Kt),expiresAt:o}}}})};function ir(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)t[n]=r[n]}return t}var hl={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 ln(t,e){function r(i,s,a){if(typeof document!="undefined"){a=ir({},e,a),typeof a.expires=="number"&&(a.expires=new Date(Date.now()+a.expires*864e5)),a.expires&&(a.expires=a.expires.toUTCString()),i=encodeURIComponent(i).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var u="";for(var c in a)!a[c]||(u+="; "+c,a[c]!==!0&&(u+="="+a[c].split(";")[0]));return document.cookie=i+"="+t.write(s,i)+u}}function n(i){if(!(typeof document=="undefined"||arguments.length&&!i)){for(var s=document.cookie?document.cookie.split("; "):[],a={},u=0;u<s.length;u++){var c=s[u].split("="),l=c.slice(1).join("=");try{var o=decodeURIComponent(c[0]);if(a[o]=t.read(l,o),i===o)break}catch{}}return i?a[i]:a}}return Object.create({set:r,get:n,remove:function(i,s){r(i,"",ir({},s,{expires:-1}))},withAttributes:function(i){return ln(this.converter,ir({},this.attributes,i))},withConverter:function(i){return ln(ir({},this.converter,i),this.attributes)}},{attributes:{value:Object.freeze(e)},converter:{value:Object.freeze(t)}})}var Mv=ln(hl,{path:"/"});var ua=typeof window!="undefined",sr=new Map,ar=t=>{var e;return ua&&localStorage?localStorage.getItem(t):(e=sr.get(t))!=null?e:null},or=(t,e)=>{ua&&localStorage?e?localStorage.setItem(t,e):localStorage.removeItem(t):e?sr.set(t,e):sr.has(t)&&sr.delete(t)};var Rt=class{constructor({backendUrl:e,clientUrl:r=typeof window!="undefined"&&(l=>(l=window.location)==null?void 0:l.origin)()||"",clientStorageGetter:n=ar,clientStorageSetter:i=or,refreshIntervalTime:s=60,autoSignIn:a=!0,autoRefreshToken:u=!0,start:c=!0}){this._subscriptions=new Set;this.backendUrl=e,this.clientUrl=r,this.machine=oa({backendUrl:e,clientUrl:r,refreshIntervalTime:s,clientStorageGetter:n,clientStorageSetter:i,autoSignIn:a,autoRefreshToken:u}),c&&(this.interpreter=me(this.machine),this.interpreter.start()),typeof window!="undefined"&&a&&(this._channel=new BroadcastChannel("nhost"),this._channel.addEventListener("message",o=>{var d;let f=(d=this.interpreter)==null?void 0:d.state.context.refreshToken;this.interpreter&&o.data!==f&&this.interpreter.send({type:"TRY_TOKEN",token:o.data})}))}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 ca=()=>typeof window!="undefined",ke=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`)})},la=(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},fa=(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 or};var da={message:"User is already signed in",status:100},vl={message:"User is not authenticated",status:101},ml={message:"User is not anonymous",status:101},yl={message:"Email needs verification",status:102},fn=class{constructor({url:e,autoRefreshToken:r=!0,autoLogin:n=!0,clientStorage:i,clientStorageType:s="web",clientStorageGetter:a,clientStorageSetter:u,refreshIntervalTime:c,start:l=!0,Client:o=Rt}){this._client=new o({backendUrl:e,autoRefreshToken:r,autoSignIn:n,start:l,clientStorageGetter:a||la(s,i),clientStorageSetter:u||fa(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:da}:new Promise(a=>{r.send({type:"SIGNUP_EMAIL_PASSWORD",email:n,password:i,options:s}),r.onTransition(u=>{if(u.matches({authentication:{signedOut:"needsEmailVerification"}}))return a({session:null,error:null});if(u.matches({authentication:{signedOut:"failed"}}))return a({session:null,error:u.context.errors.registration||null});if(u.matches({authentication:"signedIn"}))return a({session:ke(u.context),error:null})})})}async signIn(e){let r=await this.waitUntilReady();if(this.isAuthenticated())return{session:null,mfa:null,error:da};if("provider"in e){let{provider:n,options:i}=e,s=ta(`${this._client.backendUrl}/signin/provider/${n}`,ie(this._client.clientUrl,i));return ca()&&(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:ke(i.context),mfa:null,error:null}):i.matches({authentication:{signedOut:"needsEmailVerification"}})?n({session:null,mfa:null,error:yl}):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:ke(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:vl}}async resetPassword({email:e,options:r}){return new Promise(n=>{let i=me(sa(this._client));i.onTransition(({event:s})=>{if(s.type==="ERROR")return n({error:s.error});if(s.type==="SUCCESS")return n({error:null})}),i.start(),i.send({type:"REQUEST",email:e,options:r})})}async changePassword(e){return new Promise(r=>{let n=me(ia(this._client));n.onTransition(({event:i})=>{if(i.type==="ERROR")return r({error:i.error});if(i.type==="SUCCESS")return r({error:null})}),n.start(),n.send({type:"REQUEST",password:e.newPassword})})}async sendVerificationEmail(e){return new Promise(r=>{let n=me(aa(this._client));n.onTransition(({event:i})=>{if(i.type==="ERROR")return r({error:i.error});if(i.type==="SUCCESS")return r({error:null})}),n.start(),n.send({type:"REQUEST",email:e.email,options:e.options})})}async changeEmail({newEmail:e,options:r}){return new Promise(n=>{let i=me(na(this._client));i.onTransition(({event:s})=>{if(s.type==="ERROR")return n({error:s.error});if(s.type==="SUCCESS")return n({error:null})}),i.start(),i.send({type:"REQUEST",email:e,options:r})})}async deanonymize(e){let r=await this.waitUntilReady();return new Promise(n=>{var u;if(!this.isAuthenticated()||!((u=r.state.context.user)!=null&&u.isAnonymous))return{error:ml};r.onTransition(c=>{c.matches({authentication:{signedIn:{deanonymizing:"success"}}})?n({error:null}):c.matches({authentication:{signedIn:{deanonymizing:"error"}}})&&n({error:c.context.errors.authentication||null})}),r.start();let{signInMethod:i,connection:s,...a}=e;r.send({type:"DEANONYMIZE",signInMethod:i,connection:s,options:a})})}onTokenChanged(e){let r=n=>n.onTransition(({event:i,context:s})=>{i.type==="TOKEN_CHANGED"&&e(ke(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,ke(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 ke((r=(e=this._client.interpreter)==null?void 0:e.state)==null?void 0:r.context)}getUser(){var e,r,n;return((n=(r=(e=this._client.interpreter)==null?void 0:e.state)==null?void 0:r.context)==null?void 0:n.user)||null}waitUntilReady(){let r=this._client.interpreter;if(!r)throw Error("Auth interpreter not set");return r.state.hasTag("ready")?Promise.resolve(r):new Promise((n,i)=>{let s=setTimeout(()=>i(`The state machine is not yet ready after ${15} seconds.`),15e3);r.onTransition(a=>{if(a.hasTag("ready"))return clearTimeout(s),n(r)})})}isReady(){var e,r;return!!((r=(e=this._client.interpreter)==null?void 0:e.state)!=null&&r.hasTag("ready"))}get client(){return this._client}};var xo=nt(wo()),In=class{constructor({url:e}){this.url=e,this.httpClient=xo.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 kn=class{constructor({url:e}){this.url=e,this.api=new In({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 Cu=nt(Qn()),Zn=class{constructor(e){let{url:r}=e;this.accessToken=null,this.instance=Cu.default.create({baseURL:r})}async call(e,r,n){let i={...this.generateAccessTokenHeaders(),...n==null?void 0:n.headers},s;try{s=await this.instance.post(e,r,{...n,headers:i})}catch(a){if(a instanceof Error)return{res:null,error:a}}return s?{res:s,error:null}:{res:null,error:new Error("Unable to make post request to funtion")}}setAccessToken(e){if(!e){this.accessToken=null;return}this.accessToken=e}generateAccessTokenHeaders(){if(!!this.accessToken)return{Authorization:`Bearer ${this.accessToken}`}}};var $u=nt(Qn()),Wu=nt(zu()),si=class{constructor(e){let{url:r}=e;this.url=r,this.accessToken=null,this.instance=$u.default.create({baseURL:r})}async request(e,r,n){let i={...n==null?void 0:n.headers,...this.generateAccessTokenHeaders()};try{let s="",u=(await this.instance.post("",{operationName:s||void 0,query:typeof e=="string"?e:(0,Wu.print)(e),variables:r},{...n,headers:i})).data,{data:c}=u;return u.errors?{data:null,error:u.errors}:typeof c!="object"||Array.isArray(c)||c===null?{data:null,error:new Error("incorrect response data from GraphQL server")}:{data:c,error:null}}catch(s){return s instanceof Error?{data:null,error:s}:(console.error(s),{data:null,error:new Error("Unable to get do GraphQL request")})}}getUrl(){return this.url}setAccessToken(e){if(!e){this.accessToken=null;return}this.accessToken=e}generateAccessTokenHeaders(){if(!!this.accessToken)return{Authorization:`Bearer ${this.accessToken}`}}};var ai=class{constructor({backendUrl:e,refreshIntervalTime:r,clientStorageGetter:n,clientStorageSetter:i,clientStorage:s,clientStorageType:a,autoRefreshToken:u,autoLogin:c,start:l=!0,Client:o}){if(!e)throw new Error("Please specify a `backendUrl`. Docs: [todo]!");this.auth=new fn({url:`${e}/v1/auth`,refreshIntervalTime:r,clientStorageGetter:n,clientStorageSetter:i,clientStorage:s,clientStorageType:a,autoRefreshToken:u,autoLogin:c,start:l,Client:o}),this.storage=new kn({url:`${e}/v1/storage`}),this.functions=new Zn({url:`${e}/v1/functions`}),this.graphql=new si({url:`${e}/v1/graphql`}),this.storage.setAccessToken(this.auth.getAccessToken()),this.functions.setAccessToken(this.auth.getAccessToken()),this.graphql.setAccessToken(this.auth.getAccessToken()),this.auth.client.onStart(()=>{this.auth.onAuthStateChanged((f,d)=>{f==="SIGNED_OUT"&&(this.storage.setAccessToken(void 0),this.functions.setAccessToken(void 0),this.graphql.setAccessToken(void 0))}),this.auth.onTokenChanged(f=>{this.storage.setAccessToken(f==null?void 0:f.accessToken),this.functions.setAccessToken(f==null?void 0:f.accessToken),this.graphql.setAccessToken(f==null?void 0:f.accessToken)})})}};var og=t=>new ai(t);export{ai as NhostClient,og as createClient};
|
|
33
33
|
/*! *****************************************************************************
|
|
34
34
|
Copyright (c) Microsoft Corporation.
|
|
35
35
|
|