1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8759],{59176:(t,e,n)=>{n.d(e,{v:()=>r});var s=n(47279),i=n(51924);function r(t){return new s.c(function(e){(0,i.Tg)(t()).subscribe(e)})}},40065:(t,e,n)=>{n.d(e,{I:()=>r,w:()=>i});var s=n(47279),i=new s.c(function(t){return t.complete()});function r(t){return t?new s.c(function(e){return t.schedule(function(){return e.complete()})}):i}},68072:(t,e,n)=>{n.d(e,{R:()=>function t(e,n,p,y){if((0,u.T)(p)&&(y=p,p=void 0),y)return t(e,n,p).pipe((0,c.I)(y));var v=(0,s.zs)((0,u.T)(e.addEventListener)&&(0,u.T)(e.removeEventListener)?l.map(function(t){return function(s){return e[t](n,s,p)}}):(0,u.T)(e.addListener)&&(0,u.T)(e.removeListener)?h.map(d(e,n)):(0,u.T)(e.on)&&(0,u.T)(e.off)?f.map(d(e,n)):[],2),g=v[0],m=v[1];if(!g&&(0,a.X)(e))return(0,o.Z)(function(e){return t(e,n,p)})((0,i.Tg)(e));if(!g)throw TypeError("Invalid event target");return new r.c(function(t){var e=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return t.next(1<e.length?e:e[0])};return g(e),function(){return m(e)}})}});var s=n(6476),i=n(51924),r=n(47279),o=n(36806),a=n(34255),u=n(80195),c=n(7690),h=["addListener","removeListener"],l=["addEventListener","removeEventListener"],f=["on","off"];function d(t,e){return function(n){return function(s){return t[n](e,s)}}}},81237:(t,e,n)=>{n.d(e,{S:()=>a});var s=n(6476),i=n(64482),r=n(42894),o=n(62238);function a(t,e){return void 0===e&&(e=null),e=null!=e?e:t,(0,i.N)(function(n,i){var a=[],u=0;n.subscribe((0,r._)(i,function(n){var r,c,h,l,f=null;u++%e==0&&a.push([]);try{for(var d=(0,s.Ju)(a),p=d.next();!p.done;p=d.next()){var y=p.value;y.push(n),t<=y.length&&(f=null!=f?f:[]).push(y)}}catch(t){r={error:t}}finally{try{p&&!p.done&&(c=d.return)&&c.call(d)}finally{if(r)throw r.error}}if(f)try{for(var v=(0,s.Ju)(f),g=v.next();!g.done;g=v.next()){var y=g.value;(0,o.o)(a,y),i.next(y)}}catch(t){h={error:t}}finally{try{g&&!g.done&&(l=v.return)&&l.call(v)}finally{if(h)throw h.error}}},function(){var t,e;try{for(var n=(0,s.Ju)(a),r=n.next();!r.done;r=n.next()){var o=r.value;i.next(o)}}catch(e){t={error:e}}finally{try{r&&!r.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}i.complete()},void 0,function(){a=null}))})}},16798:(t,e,n)=>{n.d(e,{H:()=>r});var s=n(36806),i=n(80195);function r(t,e){return(0,i.T)(e)?(0,s.Z)(t,e,1):(0,s.Z)(t,1)}},60142:(t,e,n)=>{n.d(e,{h:()=>o});var s=n(51924),i=n(65623),r=n(42894);function o(t,e,n,o,a,u,c,h){var l=[],f=0,d=0,p=!1,y=function(){!p||l.length||f||e.complete()},v=function(t){return f<o?g(t):l.push(t)},g=function(t){u&&e.next(t),f++;var h=!1;(0,s.Tg)(n(t,d++)).subscribe((0,r._)(e,function(t){null==a||a(t),u?v(t):e.next(t)},function(){h=!0},void 0,function(){if(h)try{for(f--;l.length&&f<o;)!function(){var t=l.shift();c?(0,i.N)(e,c,function(){return g(t)}):g(t)}();y()}catch(t){e.error(t)}}))};return t.subscribe((0,r._)(e,v,function(){p=!0,y()})),function(){null==h||h()}}},36806:(t,e,n)=>{n.d(e,{Z:()=>function t(e,n,u){return(void 0===u&&(u=1/0),(0,a.T)(n))?t(function(t,r){return(0,s.T)(function(e,s){return n(t,e,r,s)})((0,i.Tg)(e(t,r)))},u):("number"==typeof n&&(u=n),(0,r.N)(function(t,n){return(0,o.h)(t,n,e,u)}))}});var s=n(31190),i=n(51924),r=n(64482),o=n(60142),a=n(80195)},43591:(t,e,n)=>{n.d(e,{s:()=>o});var s=n(40065),i=n(64482),r=n(42894);function o(t){return t<=0?function(){return s.w}:(0,i.N)(function(e,n){var s=0;e.subscribe((0,r._)(n,function(e){++s<=t&&(n.next(e),t<=s&&n.complete())}))})}},75341:(t,e,n)=>{n.d(e,{Q:()=>a});var s=n(64482),i=n(42894),r=n(51924),o=n(86879);function a(t){return(0,s.N)(function(e,n){(0,r.Tg)(t).subscribe((0,i._)(n,function(){return n.complete()},o.l)),n.closed||e.subscribe(n)})}},8691:(t,e,n)=>{n.d(e,{H6:()=>v,K_:()=>c,OX:()=>h,SP:()=>r,Sx:()=>p});var s=n(65987);let i=new WeakMap;function r(t){return{config:t,start:(e,n)=>{let{self:s,system:r,emit:o}=n,a={receivers:void 0,dispose:void 0};i.set(s,a),a.dispose=t({input:e.input,system:r,self:s,sendBack:t=>{"stopped"!==s.getSnapshot().status&&s._parent&&r._relay(s,s._parent,t)},receive:t=>{a.receivers??=new Set,a.receivers.add(t)},emit:o})},transition:(t,e,n)=>{let r=i.get(n.self);return e.type===s.X?(t={...t,status:"stopped",error:void 0},r.dispose?.()):r.receivers?.forEach(t=>t(e)),t},getInitialSnapshot:(t,e)=>({status:"active",output:void 0,error:void 0,input:e}),getPersistedSnapshot:t=>t,restoreSnapshot:t=>t}}let o="xstate.observable.next",a="xstate.observable.error",u="xstate.observable.complete";function c(t){return{config:t,transition:(t,e)=>{if("active"!==t.status)return t;switch(e.type){case o:return{...t,context:e.data};case a:return{...t,status:"error",error:e.data,input:void 0,_subscription:void 0};case u:return{...t,status:"done",input:void 0,_subscription:void 0};case s.X:return t._subscription.unsubscribe(),{...t,status:"stopped",input:void 0,_subscription:void 0};default:return t}},getInitialSnapshot:(t,e)=>({status:"active",output:void 0,error:void 0,context:void 0,input:e,_subscription:void 0}),start:(e,{self:n,system:s,emit:i})=>{"done"!==e.status&&(e._subscription=t({input:e.input,system:s,self:n,emit:i}).subscribe({next:t=>{s._relay(n,n,{type:o,data:t})},error:t=>{s._relay(n,n,{type:a,data:t})},complete:()=>{s._relay(n,n,{type:u})}}))},getPersistedSnapshot:({_subscription:t,...e})=>e,restoreSnapshot:t=>({...t,_subscription:void 0})}}function h(t){return{config:t,transition:(t,e)=>{if("active"!==t.status)return t;switch(e.type){case a:return{...t,status:"error",error:e.data,input:void 0,_subscription:void 0};case u:return{...t,status:"done",input:void 0,_subscription:void 0};case s.X:return t._subscription.unsubscribe(),{...t,status:"stopped",input:void 0,_subscription:void 0};default:return t}},getInitialSnapshot:(t,e)=>({status:"active",output:void 0,error:void 0,context:void 0,input:e,_subscription:void 0}),start:(e,{self:n,system:s,emit:i})=>{"done"!==e.status&&(e._subscription=t({input:e.input,system:s,self:n,emit:i}).subscribe({next:t=>{n._parent&&s._relay(n,n._parent,t)},error:t=>{s._relay(n,n,{type:a,data:t})},complete:()=>{s._relay(n,n,{type:u})}}))},getPersistedSnapshot:({_subscription:t,...e})=>e,restoreSnapshot:t=>({...t,_subscription:void 0})}}let l="xstate.promise.resolve",f="xstate.promise.reject",d=new WeakMap;function p(t){return{config:t,transition:(t,e,n)=>{if("active"!==t.status)return t;switch(e.type){case l:{let n=e.data;return{...t,status:"done",output:n,input:void 0}}case f:return{...t,status:"error",error:e.data,input:void 0};case s.X:return d.get(n.self)?.abort(),{...t,status:"stopped",input:void 0};default:return t}},start:(e,{self:n,system:s,emit:i})=>{if("active"!==e.status)return;let r=new AbortController;d.set(n,r),Promise.resolve(t({input:e.input,system:s,self:n,signal:r.signal,emit:i})).then(t=>
1{"active"===n.getSnapshot().status&&(d.delete(n),s._relay(n,n,{type:l,data:t}))},t=>{"active"===n.getSnapshot().status&&(d.delete(n),s._relay(n,n,{type:f,data:t}))})},getInitialSnapshot:(t,e)=>({status:"active",output:void 0,error:void 0,input:e}),getPersistedSnapshot:t=>t,restoreSnapshot:t=>t}}let y=function(t,e){return{config:t,transition:(e,n,s)=>({...e,context:t(e.context,n,s)}),getInitialSnapshot:(t,n)=>({status:"active",output:void 0,error:void 0,context:"function"==typeof e?e({input:n}):e}),getPersistedSnapshot:t=>t,restoreSnapshot:t=>t}}(t=>void 0,void 0);function v(){return(0,s.c)(y)}},69324:(t,e,n)=>{n.d(e,{a:()=>r});var s=n(65987);function i(t,e,n,i,{assignment:r}){if(!e.context)throw Error("Cannot assign to undefined `context`. Ensure that `context` is defined in the machine config.");let o={},a={context:e.context,event:n.event,spawn:function(t,{machine:e,context:n},i,r){let o=(o,a)=>{if("string"!=typeof o)return(0,s.c)(o,{id:a?.id,parent:t.self,syncSnapshot:a?.syncSnapshot,input:a?.input,src:o,systemId:a?.systemId});{let u=(0,s.R)(e,o);if(!u)throw Error(`Actor logic '${o}' not implemented in machine '${e.id}'`);let c=(0,s.c)(u,{id:a?.id,parent:t.self,syncSnapshot:a?.syncSnapshot,input:"function"==typeof a?.input?a.input({context:n,event:i,self:t.self}):a?.input,src:o,systemId:a?.systemId});return r[c.id]=c,c}};return(e,n)=>{let i=o(e,n);return r[i.id]=i,t.defer(()=>{i._processingStatus!==s.V.Stopped&&i.start()}),i}}(t,e,n.event,o),self:t.self,system:t.system},u={};if("function"==typeof r)u=r(a,i);else for(let t of Object.keys(r)){let e=r[t];u[t]="function"==typeof e?e(a,i):e}let c=Object.assign({},e.context,u);return[(0,s.W)(e,{context:c,children:Object.keys(o).length?{...e.children,...o}:e.children}),void 0,void 0]}function r(t){function e(t,e){}return e.type="xstate.assign",e.assignment=t,e.resolve=i,e}},441:(t,e,n)=>{n.d(e,{a:()=>y,b:()=>f,e:()=>a,l:()=>m,s:()=>d});var s=n(65987),i=n(69324);function r(t,e,n,s,{event:i}){return[e,{event:"function"==typeof i?i(n,s):i},void 0]}function o(t,{event:e}){t.defer(()=>t.emit(e))}function a(t){function e(t,e){}return e.type="xstate.emit",e.event=t,e.resolve=r,e.execute=o,e}let u=function(t){return t.Parent="#_parent",t.Internal="#_internal",t}({});function c(t,e,n,s,{to:i,event:r,id:o,delay:a},c){let h,l;let f=e.machine.implementations.delays;if("string"==typeof r)throw Error(`Only event objects may be used with sendTo; use sendTo({ type: "${r}" }) instead`);let d="function"==typeof r?r(n,s):r;if("string"==typeof a){let t=f&&f[a];h="function"==typeof t?t(n,s):t}else h="function"==typeof a?a(n,s):a;let p="function"==typeof i?i(n,s):i;if("string"==typeof p){if(!(l=p===u.Parent?t.self._parent:p===u.Internal?t.self:p.startsWith("#_")?e.children[p.slice(2)]:c.deferredActorIds?.includes(p)?p:e.children[p]))throw Error(`Unable to send event to actor '${p}' from machine '${e.machine.id}'.`)}else l=p||t.self;return[e,{to:l,targetId:"string"==typeof p?p:void 0,event:d,id:o,delay:h},void 0]}function h(t,e,n){"string"==typeof n.to&&(n.to=e.children[n.to])}function l(t,e){t.defer(()=>{let{to:n,event:i,delay:r,id:o}=e;if("number"==typeof r){t.system.scheduler.schedule(t.self,n,i,r,o);return}t.system._relay(t.self,n,i.type===s.T?(0,s.U)(t.self.id,i.data):i)})}function f(t,e,n){function s(t,e){}return s.type="xstate.sendTo",s.to=t,s.event=e,s.id=n?.id,s.delay=n?.delay,s.resolve=c,s.retryResolve=h,s.execute=l,s}function d(t,e){return f(u.Parent,t,e)}function p(t,e,n,r,{collect:o}){let u=[],c=function(t){u.push(t)};return c.assign=(...t)=>{u.push((0,i.a)(...t))},c.cancel=(...t)=>{u.push((0,s.f)(...t))},c.raise=(...t)=>{u.push((0,s.r)(...t))},c.sendTo=(...t)=>{u.push(f(...t))},c.sendParent=(...t)=>{u.push(d(...t))},c.spawnChild=(...t)=>{u.push((0,s.h)(...t))},c.stopChild=(...t)=>{u.push((0,s.k)(...t))},c.emit=(...t)=>{u.push(a(...t))},o({context:n.context,event:n.event,enqueue:c,check:t=>(0,s.w)(t,e.context,n.event,e),self:t.self,system:t.system},r),[e,void 0,u]}function y(t){function e(t,e){}return e.type="xstate.enqueueActions",e.collect=t,e.resolve=p,e}function v(t,e,n,s,{value:i,label:r}){return[e,{value:"function"==typeof i?i(n,s):i,label:r},void 0]}function g({logger:t},{value:e,label:n}){n?t(n,e):t(e)}function m(t=({context:t,event:e})=>({context:t,event:e}),e){function n(t,e){}return n.type="xstate.log",n.value=t,n.label=e,n.resolve=v,n.execute=g,n}},65987:(t,e,n)=>{n.d(e,{$:()=>N,B:()=>ti,C:()=>tT,D:()=>Y,E:()=>tP,F:()=>tn,G:()=>tE,H:()=>function t(e,n,s,i){return"string"==typeof n?function(t,e,n,s){let i=td(t,e).next(n,s);return i&&i.length?i:t.next(n,s)}(e,n,s,i):1===Object.keys(n).length?function(e,n,s,i){let r=Object.keys(n),o=t(td(e,r[0]),n[r[0]],s,i);return o&&o.length?o:e.next(s,i)}(e,n,s,i):function(e,n,s,i){let r=[];for(let o of Object.keys(n)){let a=n[o];if(!a)continue;let u=t(td(e,o),a,s,i);u&&r.push(...u)}return r.length?r:e.next(s,i)}(e,n,s,i)},I:()=>tk,J:()=>f,K:()=>tx,L:()=>tf,M:()=>y,N:()=>o,O:()=>ts,P:()=>tp,Q:()=>tC,R:()=>E,S:()=>r,T:()=>u,U:()=>l,V:()=>O,W:()=>tR,X:()=>c,a:()=>H,c:()=>M,e:()=>w,f:()=>C,g:()=>ty,h:()=>L,k:()=>z,l:()=>g,n:()=>U,q:()=>ta,r:()=>tL,s:()=>X,t:()=>m,u:()=>x,v:()=>to,w:()=>Z,x:()=>k,y:()=>tr,z:()=>tu});let s=t=>{if("undefined"==typeof window)return;let e=function(){let t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==n.g?n.g:void 0;if(t.__xstate__)return t.__xstate__}();e&&e.register(t)};class i{constructor(t){this._process=t,this._active=!1,this._current=null,this._last=null}start(){this._active=!0,this.flush()}clear(){this._current&&(this._current.next=null,this._last=this._current)}enqueue(t){let e={value:t,next:null};if(this._current){this._last.next=e,this._last=e;return}this._current=e,this._last=e,this._active&&this.flush()}flush(){for(;this._current;){let t=this._current;this._process(t.value),this._current=t.next}this._last=null}}let r=".",o="",a="xstate.init",u="xstate.error",c="xstate.stop";function h(t,e){return{type:`xstate.done.state.${t}`,output:e}}function l(t,e){return{type:`xstate.error.actor.${t}`,error:e,actorId:t}}
1function f(t){return{type:a,input:t}}function d(t){setTimeout(()=>{throw t})}let p="function"==typeof Symbol&&Symbol.observable||"@@observable";function y(t){if(b(t))return t;let e=[],n="";for(let s=0;s<t.length;s++){switch(t.charCodeAt(s)){case 92:n+=t[s+1],s++;continue;case 46:e.push(n),n="";continue}n+=t[s]}return e.push(n),e}function v(t){return t&&"object"==typeof t&&"machine"in t&&"value"in t?t.value:"string"!=typeof t?t:function(t){if(1===t.length)return t[0];let e={},n=e;for(let e=0;e<t.length-1;e++)if(e===t.length-2)n[t[e]]=t[e+1];else{let s=n;n={},s[t[e]]=n}return e}(y(t))}function g(t,e){let n={},s=Object.keys(t);for(let i=0;i<s.length;i++){let r=s[i];n[r]=e(t[r],r,t,i)}return n}function m(t){return void 0===t?[]:b(t)?t:[t]}function _(t,e,n,s){return"function"==typeof t?t({context:e,event:n,self:s}):t}function b(t){return Array.isArray(t)}function x(t){return(b(t)?t:[t]).map(t=>void 0===t||"string"==typeof t?{target:t}:t)}function S(t){if(void 0!==t&&""!==t)return m(t)}function w(t,e,n){let s="object"==typeof t,i=s?t:void 0;return{next:(s?t.next:t)?.bind(i),error:(s?t.error:e)?.bind(i),complete:(s?t.complete:n)?.bind(i)}}function k(t,e){return`${e}.${t}`}function E(t,e){let n=e.match(/^xstate\.invoke\.(\d+)\.(.*)/);if(!n)return t.implementations.actors[e];let[,s,i]=n,r=t.getStateNodeById(i).config.invoke;return(Array.isArray(r)?r[s]:r).src}function I(t,e){return`${t.sessionId}.${e}`}let $=0,T=!1,N=1,O=function(t){return t[t.NotStarted=0]="NotStarted",t[t.Running=1]="Running",t[t.Stopped=2]="Stopped",t}({}),j={clock:{setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t)},logger:console.log.bind(console),devTools:!1};class A{constructor(t,e){this.logic=t,this._snapshot=void 0,this.clock=void 0,this.options=void 0,this.id=void 0,this.mailbox=new i(this._process.bind(this)),this.observers=new Set,this.eventListeners=new Map,this.logger=void 0,this._processingStatus=O.NotStarted,this._parent=void 0,this._syncSnapshot=void 0,this.ref=void 0,this._actorScope=void 0,this._systemId=void 0,this.sessionId=void 0,this.system=void 0,this._doneEvent=void 0,this.src=void 0,this._deferred=[];let n={...j,...e},{clock:s,logger:r,parent:o,syncSnapshot:a,id:u,systemId:c,inspect:h}=n;this.system=o?o.system:function(t,e){let n=new Map,s=new Map,i=new WeakMap,r=new Set,o={},{clock:a,logger:u}=e,c={schedule:(t,e,n,s,i=Math.random().toString(36).slice(2))=>{let r={source:t,target:e,event:n,delay:s,id:i,startedAt:Date.now()},u=I(t,i);h._snapshot._scheduledEvents[u]=r;let c=a.setTimeout(()=>{delete o[u],delete h._snapshot._scheduledEvents[u],h._relay(t,e,n)},s);o[u]=c},cancel:(t,e)=>{let n=I(t,e),s=o[n];delete o[n],delete h._snapshot._scheduledEvents[n],void 0!==s&&a.clearTimeout(s)},cancelAll:t=>{for(let e in h._snapshot._scheduledEvents){let n=h._snapshot._scheduledEvents[e];n.source===t&&c.cancel(t,n.id)}}},h={_snapshot:{_scheduledEvents:(e?.snapshot&&e.snapshot.scheduler)??{}},_bookId:()=>`x:${$++}`,_register:(t,e)=>(n.set(t,e),t),_unregister:t=>{n.delete(t.sessionId);let e=i.get(t);void 0!==e&&(s.delete(e),i.delete(t))},get:t=>s.get(t),_set:(t,e)=>{let n=s.get(t);if(n&&n!==e)throw Error(`Actor with system ID '${t}' already exists.`);s.set(t,e),i.set(e,t)},inspect:t=>{let e=w(t);return r.add(e),{unsubscribe(){r.delete(e)}}},_sendInspectionEvent:e=>{if(!r.size)return;let n={...e,rootId:t.sessionId};r.forEach(t=>t.next?.(n))},_relay:(t,e,n)=>{h._sendInspectionEvent({type:"@xstate.event",sourceRef:t,actorRef:e,event:n}),e._send(n)},scheduler:c,getSnapshot:()=>({_scheduledEvents:{...h._snapshot._scheduledEvents}}),start:()=>{let t=h._snapshot._scheduledEvents;for(let e in h._snapshot._scheduledEvents={},t){let{source:n,target:s,event:i,delay:r,id:o}=t[e];c.schedule(n,s,i,r,o)}},_clock:a,_logger:u};return h}(this,{clock:s,logger:r}),h&&!o&&this.system.inspect(w(h)),this.sessionId=this.system._bookId(),this.id=u??this.sessionId,this.logger=e?.logger??this.system._logger,this.clock=e?.clock??this.system._clock,this._parent=o,this._syncSnapshot=a,this.options=n,this.src=n.src??t,this.ref=this,this._actorScope={self:this,id:this.id,sessionId:this.sessionId,logger:this.logger,defer:t=>{this._deferred.push(t)},system:this.system,stopChild:t=>{if(t._parent!==this)throw Error(`Cannot stop child actor ${t.id} of ${this.id} because it is not a child`);t._stop()},emit:t=>{let e=this.eventListeners.get(t.type),n=this.eventListeners.get("*");if(e||n)for(let s of[...e?e.values():[],...n?n.values():[]])s(t)},actionExecutor:t=>{let e=()=>{if(this._actorScope.system._sendInspectionEvent({type:"@xstate.action",actorRef:this,action:{type:t.type,params:t.params}}),!t.exec)return;let e=T;try{T=!0,t.exec(t.info,t.params)}finally{T=e}};this._processingStatus===O.Running?e():this._deferred.push(e)}},this.send=this.send.bind(this),this.system._sendInspectionEvent({type:"@xstate.actor",actorRef:this}),c&&(this._systemId=c,this.system._set(c,this)),this._initState(e?.snapshot??e?.state),c&&"active"!==this._snapshot.status&&this.system._unregister(this)}_initState(t){try{this._snapshot=t?this.logic.restoreSnapshot?this.logic.restoreSnapshot(t,this._actorScope):t:this.logic.getInitialSnapshot(this._actorScope,this.options?.input)}catch(t){this._snapshot={status:"error",output:void 0,error:t}}}update(t,e){let n;for(this._snapshot=t;n=this._deferred.shift();)try{n()}catch(e){this._deferred.length=0,this._snapshot={...t,status:"error",error:e}}switch(this._snapshot.status){case"active":for(let e of this.observers)try{e.
1next?.(t)}catch(t){d(t)}break;case"done":var s;for(let e of this.observers)try{e.next?.(t)}catch(t){d(t)}this._stopProcedure(),this._complete(),this._doneEvent=(s=this.id,{type:`xstate.done.actor.${s}`,output:this._snapshot.output,actorId:s}),this._parent&&this.system._relay(this,this._parent,this._doneEvent);break;case"error":this._error(this._snapshot.error)}this.system._sendInspectionEvent({type:"@xstate.snapshot",actorRef:this,event:e,snapshot:t})}subscribe(t,e,n){let s=w(t,e,n);if(this._processingStatus!==O.Stopped)this.observers.add(s);else switch(this._snapshot.status){case"done":try{s.complete?.()}catch(t){d(t)}break;case"error":{let t=this._snapshot.error;if(s.error)try{s.error(t)}catch(t){d(t)}else d(t)}}return{unsubscribe:()=>{this.observers.delete(s)}}}on(t,e){let n=this.eventListeners.get(t);n||(n=new Set,this.eventListeners.set(t,n));let s=e.bind(void 0);return n.add(s),{unsubscribe:()=>{n.delete(s)}}}start(){if(this._processingStatus===O.Running)return this;this._syncSnapshot&&this.subscribe({next:t=>{"active"===t.status&&this.system._relay(this,this._parent,{type:`xstate.snapshot.${this.id}`,snapshot:t})},error:()=>{}}),this.system._register(this.sessionId,this),this._systemId&&this.system._set(this._systemId,this),this._processingStatus=O.Running;let t=f(this.options.input);switch(this.system._sendInspectionEvent({type:"@xstate.event",sourceRef:this._parent,actorRef:this,event:t}),this._snapshot.status){case"done":return this.update(this._snapshot,t),this;case"error":return this._error(this._snapshot.error),this}if(this._parent||this.system.start(),this.logic.start)try{this.logic.start(this._snapshot,this._actorScope)}catch(t){return this._snapshot={...this._snapshot,status:"error",error:t},this._error(t),this}return this.update(this._snapshot,t),this.options.devTools&&this.attachDevTools(),this.mailbox.start(),this}_process(t){let e,n;try{e=this.logic.transition(this._snapshot,t,this._actorScope)}catch(t){n={err:t}}if(n){let{err:t}=n;this._snapshot={...this._snapshot,status:"error",error:t},this._error(t);return}this.update(e,t),t.type===c&&(this._stopProcedure(),this._complete())}_stop(){return this._processingStatus===O.Stopped||((this.mailbox.clear(),this._processingStatus===O.NotStarted)?this._processingStatus=O.Stopped:this.mailbox.enqueue({type:c})),this}stop(){if(this._parent)throw Error("A non-root actor cannot be stopped directly.");return this._stop()}_complete(){for(let t of this.observers)try{t.complete?.()}catch(t){d(t)}this.observers.clear()}_reportError(t){if(!this.observers.size){this._parent||d(t);return}let e=!1;for(let n of this.observers){let s=n.error;e||=!s;try{s?.(t)}catch(t){d(t)}}this.observers.clear(),e&&d(t)}_error(t){this._stopProcedure(),this._reportError(t),this._parent&&this.system._relay(this,this._parent,l(this.id,t))}_stopProcedure(){return this._processingStatus!==O.Running||(this.system.scheduler.cancelAll(this),this.mailbox.clear(),this.mailbox=new i(this._process.bind(this)),this._processingStatus=O.Stopped,this.system._unregister(this)),this}_send(t){this._processingStatus!==O.Stopped&&this.mailbox.enqueue(t)}send(t){this.system._relay(void 0,this,t)}attachDevTools(){let{devTools:t}=this.options;t&&("function"==typeof t?t:s)(this)}toJSON(){return{xstate$$type:N,id:this.id}}getPersistedSnapshot(t){return this.logic.getPersistedSnapshot(this._snapshot,t)}[p](){return this}getSnapshot(){return this._snapshot}}function M(t,...[e]){return new A(t,e)}function P(t,e,n,s,{sendId:i}){return[e,{sendId:"function"==typeof i?i(n,s):i},void 0]}function R(t,e){t.defer(()=>{t.system.scheduler.cancel(t.self,e.sendId)})}function C(t){function e(t,e){}return e.type="xstate.cancel",e.sendId=t,e.resolve=P,e.execute=R,e}function D(t,e,n,s,{id:i,systemId:r,src:o,input:a,syncSnapshot:u}){let c,h;let l="string"==typeof o?E(e.machine,o):o,f="function"==typeof i?i(n):i;return l&&(h="function"==typeof a?a({context:e.context,event:n.event,self:t.self}):a,c=M(l,{id:f,src:o,parent:t.self,syncSnapshot:u,systemId:r,input:h})),[tR(e,{children:{...e.children,[f]:c}}),{id:i,systemId:r,actorRef:c,src:o,input:h},void 0]}function J(t,{actorRef:e}){e&&t.defer(()=>{e._processingStatus!==O.Stopped&&e.start()})}function L(...[t,{id:e,systemId:n,input:s,syncSnapshot:i=!1}={}]){function r(t,e){}return r.type="xstate.spawnChild",r.id=e,r.systemId=n,r.src=t,r.input=s,r.syncSnapshot=i,r.resolve=D,r.execute=J,r}function V(t,e,n,s,{actorRef:i}){let r="function"==typeof i?i(n,s):i,o="string"==typeof r?e.children[r]:r,a=e.children;return o&&(a={...a},delete a[o.id]),[tR(e,{children:a}),o,void 0]}function B(t,e){if(e){if(t.system._unregister(e),e._processingStatus!==O.Running){t.stopChild(e);return}t.defer(()=>{t.stopChild(e)})}}function z(t){function e(t,e){}return e.type="xstate.stopChild",e.actorRef=t,e.resolve=V,e.execute=B,e}function W(t,e,{stateValue:n}){if("string"==typeof n&&ts(n)){let e=t.machine.getStateNodeById(n);return t._nodes.some(t=>t===e)}return t.matches(n)}function X(t){function e(){return!1}return e.check=W,e.stateValue=t,e}function q(t,{context:e,event:n},{guards:s}){return!Z(s[0],e,n,t)}function U(t){function e(t,e){return!1}return e.check=q,e.guards=[t],e}function G(t,{context:e,event:n},{guards:s}){return s.every(s=>Z(s,e,n,t))}function H(t){function e(t,e){return!1}return e.check=G,e.guards=t,e}function Z(t,e,n,s){let{machine:i}=s,r="function"==typeof t,o=r?t:i.implementations.guards["string"==typeof t?t:t.type];if(!r&&!o)throw Error(`Guard '${"string"==typeof t?t:t.type}' is not implemented.'.`);if("function"!=typeof o)return Z(o,e,n,s);let a={context:e,event:n},u=r||"string"==typeof t?void 0:"params"in t?"function"==typeof t.params?t.params({context:e,event:n}):t.params:void 0;return"check"in o?o.check(s,a,o):o(a,u)}let K=t=>"atomic"===t.type||"final"===t.type;function Q(t){return Object.values(t.states).filter(t=>"history"!==t.type)}function F(t,e){let n=[];if(e===t)return n;let s=t.parent;for(;s&&s!==e;)n.push(s),s=s.parent;return n}function Y(t){let e=new Set(t),n=tt(e);for(let t of e)if("compound"!==t.type||n.get(t)&&n.get(t).length){if("parallel"===t.type){for(let n of Q(t))if("history"!==n.type&&!e.has(n))for(let t of tl(n))e.add(t)}}else tl(t).forEach(t=>e.add(t));for(let t of e){let n=t.parent;for(;n;)e.add(n),n=n.parent}return e}function tt(t){let e=new Map;for(let n of t)e.has(n)||e.set(n,[]),n.parent&&(e.has(n.parent)||e.set(n.parent,[]),e.get(n.parent).push(n));return e}function te(t,e){return function t(e,n){let s=n.get(e);if(!s)return{};if("compound"===e.type){let t=s[0];if(!t)return{};if(K(t))return t.key}let i={};for(let e of s)i[e.key]=t(e,n);return i}(t,tt(Y(e)))}function tn(t,e){return"compound"===e.type?Q(e).some(e=>"final"===e.type&&t.has(e)):"parallel"===e.type?Q(e).every(e=>tn(t,e)):"final"===e.type}let ts=t=>"#"===t[0];function ti(t,e){return t.transitions.get(e)||[...t.transitions.keys()].filter(t=>{if("*"===t)return!0;
1if(!t.endsWith(".*"))return!1;let n=t.split("."),s=e.split(".");for(let t=0;t<n.length;t++){let e=n[t],i=s[t];if("*"===e)return t===n.length-1;if(e!==i)return!1}return!0}).sort((t,e)=>e.length-t.length).flatMap(e=>t.transitions.get(e))}function tr(t){let e=t.config.after;if(!e)return[];let n=e=>{var n;let s=(n=t.id,{type:`xstate.after.${e}.${n}`}),i=s.type;return t.entry.push(tL(s,{id:i,delay:e})),t.exit.push(C(i)),i};return Object.keys(e).flatMap(t=>{let s=e[t],i=Number.isNaN(+t)?t:+t,r=n(i);return m("string"==typeof s?{target:s}:s).map(t=>({...t,event:r,delay:i}))}).map(e=>{let{delay:n}=e;return{...to(t,e.event,e),delay:n}})}function to(t,e,n){let s=S(n.target),i=n.reenter??!1,o=function(t,e){if(void 0!==e)return e.map(e=>{if("string"!=typeof e)return e;if(ts(e))return t.machine.getStateNodeById(e);let n=e[0]===r;if(n&&!t.parent)return tp(t,e.slice(1));let s=n?t.key+e:e;if(t.parent)try{return tp(t.parent,s)}catch(e){throw Error(`Invalid transition definition for state node '${t.id}': 2${e.message}`)}else throw Error(`Invalid target: "${e}" is not a valid target from the root node. Did you mean ".${e}"?`)})}(t,s),a={...n,actions:m(n.actions),guard:n.guard,target:o,source:t,reenter:i,eventType:e,toJSON:()=>({...a,source:`#${t.id}`,target:o?o.map(t=>`#${t.id}`):void 0})};return a}function ta(t){let e=new Map;if(t.config.on)for(let n of Object.keys(t.config.on)){if(n===o)throw Error('Null events ("") cannot be specified as a transition key. Use `always: { ... }` instead.');let s=t.config.on[n];e.set(n,x(s).map(e=>to(t,n,e)))}if(t.config.onDone){let n=`xstate.done.state.${t.id}`;e.set(n,x(t.config.onDone).map(e=>to(t,n,e)))}for(let n of t.invoke){if(n.onDone){let s=`xstate.done.actor.${n.id}`;e.set(s,x(n.onDone).map(e=>to(t,s,e)))}if(n.onError){let s=`xstate.error.actor.${n.id}`;e.set(s,x(n.onError).map(e=>to(t,s,e)))}if(n.onSnapshot){let s=`xstate.snapshot.${n.id}`;e.set(s,x(n.onSnapshot).map(e=>to(t,s,e)))}}for(let n of t.after){let t=e.get(n.eventType);t||(t=[],e.set(n.eventType,t)),t.push(n)}return e}function tu(t,e){let n="string"==typeof e?t.states[e]:e?t.states[e.target]:void 0;if(!n&&e)throw Error(`Initial state node "${e}" not found on parent state node #${t.id}`);let s={source:t,actions:e&&"string"!=typeof e?m(e.actions):[],eventType:null,reenter:!1,target:n?[n]:[],toJSON:()=>({...s,source:`#${t.id}`,target:n?[`#${n.id}`]:[]})};return s}function tc(t){let e=S(t.config.target);return e?{target:e.map(e=>"string"==typeof e?tp(t.parent,e):e)}:t.parent.initial}function th(t){return"history"===t.type}function tl(t){let e=tf(t);for(let n of e)for(let s of F(n,t))e.add(s);return e}function tf(t){let e=new Set;return!function t(n){if(!e.has(n)){if(e.add(n),"compound"===n.type)t(n.initial.target[0]);else if("parallel"===n.type)for(let e of Q(n))t(e)}}(t),e}function td(t,e){if(ts(e))return t.machine.getStateNodeById(e);if(!t.states)throw Error(`Unable to retrieve child state '${e}' from '${t.id}'; no child states exist.`);let n=t.states[e];if(!n)throw Error(`Child state '${e}' does not exist on '${t.id}'`);return n}function tp(t,e){if("string"==typeof e&&ts(e))try{return t.machine.getStateNodeById(e)}catch{}let n=y(e).slice(),s=t;for(;n.length;){let t=n.shift();if(!t.length)break;s=td(s,t)}return s}function ty(t,e){if("string"==typeof e){let n=t.states[e];if(!n)throw Error(`State '${e}' does not exist on '${t.id}'`);return[t,n]}let n=Object.keys(e),s=n.map(e=>td(t,e)).filter(Boolean);return[t.machine.root,t].concat(s,n.reduce((n,s)=>{let i=td(t,s);if(!i)return n;let r=ty(i,e[s]);return n.concat(r)},[]))}function tv(t,e){let n=t;for(;n.parent&&n.parent!==e;)n=n.parent;return n.parent===e}function tg(t,e,n){let s=new Set;for(let i of t){let t=!1,r=new Set;for(let o of s)if(function(t,e){let n=new Set(t),s=new Set(e);for(let t of n)if(s.has(t))return!0;for(let t of s)if(n.has(t))return!0;return!1}(tb([i],e,n),tb([o],e,n))){if(tv(i.source,o.source))r.add(o);else{t=!0;break}}if(!t){for(let t of r)s.delete(t);s.add(i)}}return Array.from(s)}function tm(t,e){if(!t.target)return[];let n=new Set;for(let s of t.target)if(th(s)){if(e[s.id])for(let t of e[s.id])n.add(t);else for(let t of tm(tc(s),e))n.add(t)}else n.add(s);return[...n]}function t_(t,e){let n=tm(t,e);if(!n)return;if(!t.reenter&&n.every(e=>
2e===t.source||tv(e,t.source)))return t.source;let s=function(t){let[e,...n]=t;for(let t of F(e,void 0))if(n.every(e=>tv(e,t)))return t}(n.concat(t.source));return s||(t.reenter?void 0:t.source.machine.root)}function tb(t,e,n){let s=new Set;for(let i of t)if(i.target?.length){let t=t_(i,n);for(let n of(i.reenter&&i.source===t&&s.add(t),e))tv(n,t)&&s.add(n)}return[...s]}function tx(t,e,n,s,i,r){if(!t.length)return e;let o=new Set(e._nodes),a=e.historyValue,u=tg(t,o,a),c=e;i||([c,a]=function(t,e,n,s,i,r,o,a){let u,c=t,h=tb(s,i,r);for(let t of(h.sort((t,e)=>e.order-t.order),h))for(let e of function(t){return Object.keys(t.states).map(e=>t.states[e]).filter(t=>"history"===t.type)}(t)){let n;n="deep"===e.history?e=>K(e)&&tv(e,t):e=>e.parent===t,(u??={...r})[e.id]=Array.from(i).filter(n)}for(let t of h)c=tk(c,e,n,[...t.exit,...t.invoke.map(t=>z(t.id))],o,void 0),i.delete(t);return[c,u||r]}(c,s,n,u,o,a,r,n.actionExecutor)),c=function(t,e,n,s,i,r,o,a){let u=t,c=new Set,l=new Set;(function(t,e,n,s){for(let i of t){let t=t_(i,e);for(let r of i.target||[])!th(r)&&(i.source!==r||i.source!==t||i.reenter)&&(s.add(r),n.add(r)),tS(r,e,n,s);for(let r of tm(i,e)){let o=F(r,t);t?.type==="parallel"&&o.push(t),tw(s,e,n,o,!i.source.parent&&i.reenter?void 0:t)}}})(s,o,l,c),a&&l.add(t.machine.root);let f=new Set;for(let t of[...c].sort((t,e)=>t.order-e.order)){i.add(t);let s=[];for(let e of(s.push(...t.entry),t.invoke))s.push(L(e.src,{...e,syncSnapshot:!!e.onSnapshot}));if(l.has(t)){let e=t.initial.actions;s.push(...e)}if(u=tk(u,e,n,s,r,t.invoke.map(t=>t.id)),"final"===t.type){let s=t.parent,o=s?.type==="parallel"?s:s?.parent,a=o||t;for(s?.type==="compound"&&r.push(h(s.id,void 0!==t.output?_(t.output,u.context,e,n.self):void 0));o?.type==="parallel"&&!f.has(o)&&tn(i,o);)f.add(o),r.push(h(o.id)),a=o,o=o.parent;if(o)continue;u=tR(u,{status:"done",output:function(t,e,n,s,i){if(void 0===s.output)return;let r=h(i.id,void 0!==i.output&&i.parent?_(i.output,t.context,e,n.self):void 0);return _(s.output,t.context,r,n.self)}(u,e,n,u.machine.root,a)})}}return u}(c=tk(c,s,n,u.flatMap(t=>t.actions),r,void 0),s,n,u,o,r,a,i);let l=[...o];"done"===c.status&&(c=tk(c,s,n,l.sort((t,e)=>e.order-t.order).flatMap(t=>t.exit),r,void 0));try{if(a===e.historyValue&&function(t,e){if(t.length!==e.size)return!1;for(let n of t)if(!e.has(n))return!1;return!0}(e._nodes,o))return c;return tR(c,{_nodes:l,historyValue:a})}catch(t){throw t}}function tS(t,e,n,s){if(th(t)){if(e[t.id]){let i=e[t.id];
2for(let t of i)s.add(t),tS(t,e,n,s);for(let r of i)tw(s,e,n,F(r,t.parent))}else{let i=tc(t);for(let r of i.target)s.add(r),i===t.parent?.initial&&n.add(t.parent),tS(r,e,n,s);for(let r of i.target)tw(s,e,n,F(r,t.parent))}}else if("compound"===t.type){let[i]=t.initial.target;th(i)||(s.add(i),n.add(i)),tS(i,e,n,s),tw(s,e,n,F(i,t))}else if("parallel"===t.type)for(let i of Q(t).filter(t=>!th(t)))[...s].some(t=>tv(t,i))||(th(i)||(s.add(i),n.add(i)),tS(i,e,n,s))}function tw(t,e,n,s,i){for(let r of s)if((!i||tv(r,i))&&t.add(r),"parallel"===r.type)for(let s of Q(r).filter(t=>!th(t)))[...t].some(t=>tv(t,s))||(t.add(s),tS(s,e,n,t))}function tk(t,e,n,s,i,r){let o=r?[]:void 0,a=function t(e,n,s,i,r,o){let{machine:a}=e,u=e;for(let e of i){var c;let i="function"==typeof e,h=i?e:(c="string"==typeof e?e:e.type,a.implementations.actions[c]),l={context:u.context,event:n,self:s.self,system:s.system},f=i||"string"==typeof e?void 0:"params"in e?"function"==typeof e.params?e.params({context:u.context,event:n}):e.params:void 0;if(!h||!("resolve"in h)){s.actionExecutor({type:"string"==typeof e?e:"object"==typeof e?e.type:e.name||"(anonymous)",info:l,params:f,exec:h});continue}let[d,p,y]=h.resolve(s,u,l,f,h,r);u=d,"retryResolve"in h&&o?.push([h,p]),"execute"in h&&s.actionExecutor({type:h.type,info:l,params:p,exec:h.execute.bind(null,s,p)}),y&&(u=t(u,n,s,y,r,o))}return u}(t,e,n,s,{internalQueue:i,deferredActorIds:r},o);return o?.forEach(([t,e])=>{t.retryResolve(n,a,e)}),a}function tE(t,e,n,s){let i=t,r=[];function o(t,e,s){n.system._sendInspectionEvent({type:"@xstate.microstep",actorRef:n.self,event:e,snapshot:t,_transitions:s}),r.push(t)}if(e.type===c)return o(i=tR(tI(i,e,n),{status:"stopped"}),e,[]),{snapshot:i,microstates:r};let u=e;if(u.type!==a){let e=u,a=e.type.startsWith("xstate.error.actor"),c=t$(e,i);if(a&&!c.length)return o(i=tR(t,{status:"error",error:e.error}),e,[]),{snapshot:i,microstates:r};o(i=tx(c,t,n,u,!1,s),e,c)}let h=!0;for(;"active"===i.status;){let t=h?function(t,e){let n=new Set;for(let s of t._nodes.filter(K))t:for(let i of[s].concat(F(s,void 0)))if(i.always){for(let s of i.always)if(void 0===s.guard||Z(s.guard,t.context,e,t)){n.add(s);break t}}return tg(Array.from(n),new Set(t._nodes),t.historyValue)}(i,u):[],e=t.length?i:void 0;if(!t.length){if(!s.length)break;t=t$(u=s.shift(),i)}h=(i=tx(t,i,n,u,!1,s))!==e,o(i,u,t)}return"active"!==i.status&&tI(i,u,n),{snapshot:i,microstates:r}}function tI(t,e,n){return tk(t,e,n,Object.values(t.children).map(t=>z(t)),[],void 0)}function t$(t,e){return e.machine.getTransitionData(e,t)}function tT(t,e){let n=Y(ty(t,e));return te(t,[...n])}let tN=function(t){return function t(e,n){let s=v(e),i=v(n);return"string"==typeof i?"string"==typeof s&&i===s:"string"==typeof s?s in i:Object.keys(s).every(e=>e in i&&t(s[e],i[e]))}(t,this.value)},tO=function(t){return this.tags.has(t)},tj=function(t){let e=this.machine.getTransitionData(this,t);return!!e?.length&&e.some(t=>void 0!==t.target||t.actions.length)},tA=function(){let{_nodes:t,tags:e,machine:n,getMeta:s,toJSON:i,can:r,hasTag:o,matches:a,...u}=this;return{...u,tags:Array.from(e)}},tM=function(){return this._nodes.reduce((t,e)=>(void 0!==e.meta&&(t[e.id]=e.meta),t),{})};function tP(t,e){return{status:t.status,output:t.output,error:t.error,machine:e,context:t.context,_nodes:t._nodes,value:te(e.root,t._nodes),tags:new Set(t._nodes.flatMap(t=>t.tags)),children:t.children,historyValue:t.historyValue||{},matches:tN,hasTag:tO,can:tj,getMeta:tM,toJSON:tA}}function tR(t,e={}){return tP({...t,...e},t.machine)}function tC(t,e){let{_nodes:n,tags:s,machine:i,children:r,context:o,can:a,hasTag:u,matches:c,getMeta:h,toJSON:l,...f}=t,d={};for(let t in r){let n=r[t];d[t]={snapshot:n.getPersistedSnapshot(e),src:n.src,systemId:n._systemId,syncSnapshot:n._syncSnapshot}}return{...f,context:function t(e){let n;for(let s in e){let i=e[s];if(i&&"object"==typeof i){if("sessionId"in i&&"send"in i&&"ref"in i)(n??=Array.isArray(e)?e.slice():{...e})[s]={xstate$$type:N,id:i.id};else{let r=t(i);r!==i&&((n??=Array.isArray(e)?e.slice():{...e})[s]=r)}}}return n??e}(o),children:d,historyValue:function(t){if("object"!=typeof t||null===t)return{};let e={};for(let n in t){let s=t[n];Array.isArray(s)&&(e[n]=s.map(t=>({id:t.id})))}return e}(f.historyValue)}}function tD(t,e,n,s,{event:i,id:r,delay:o},{internalQueue:a}){let u;let c=e.machine.implementations.delays;if("string"==typeof i)throw Error(`Only event objects may be used with raise; use raise({ type: "${i}" }) instead`);let h="function"==typeof i?i(n,s):i;
2if("string"==typeof o){let t=c&&c[o];u="function"==typeof t?t(n,s):t}else u="function"==typeof o?o(n,s):o;return"number"!=typeof u&&a.push(h),[e,{event:h,id:r,delay:u},void 0]}function tJ(t,e){let{event:n,delay:s,id:i}=e;if("number"==typeof s){t.defer(()=>{let e=t.self;t.system.scheduler.schedule(e,e,n,s,i)});return}}function tL(t,e){function n(t,e){}return n.type="xstate.raise",n.event=t,n.id=e?.id,n.delay=e?.delay,n.resolve=tD,n.execute=tJ,n}},97942:(t,e,n)=>{n.d(e,{DT:()=>l,mj:()=>f}),n(8691);var s=n(65987),i=n(69324);let r=new WeakMap;function o(t,e,n){let s=r.get(t);return s?e in s||(s[e]=n()):(s={[e]:n()},r.set(t,s)),s[e]}let a={},u=t=>"string"==typeof t?{type:t}:"function"==typeof t?"resolve"in t?{type:t.type}:{type:t.name}:t;class c{constructor(t,e){if(this.config=t,this.key=void 0,this.id=void 0,this.type=void 0,this.path=void 0,this.states=void 0,this.history=void 0,this.entry=void 0,this.exit=void 0,this.parent=void 0,this.machine=void 0,this.meta=void 0,this.output=void 0,this.order=-1,this.description=void 0,this.tags=[],this.transitions=void 0,this.always=void 0,this.parent=e._parent,this.key=e._key,this.machine=e._machine,this.path=this.parent?this.parent.path.concat(this.key):[],this.id=this.config.id||[this.machine.id,...this.path].join(s.S),this.type=this.config.type||(this.config.states&&Object.keys(this.config.states).length?"compound":this.config.history?"history":"atomic"),this.description=this.config.description,this.order=this.machine.idMap.size,this.machine.idMap.set(this.id,this),this.states=this.config.states?(0,s.l)(this.config.states,(t,e)=>new c(t,{_parent:this,_key:e,_machine:this.machine})):a,"compound"===this.type&&!this.config.initial)throw Error(`No initial state specified for compound state node "#${this.id}". Try adding { initial: "${Object.keys(this.states)[0]}" } to the state config.`);this.history=!0===this.config.history?"shallow":this.config.history||!1,this.entry=(0,s.t)(this.config.entry).slice(),this.exit=(0,s.t)(this.config.exit).slice(),this.meta=this.config.meta,this.output="final"!==this.type&&this.parent?void 0:this.config.output,this.tags=(0,s.t)(t.tags).slice()}_initialize(){this.transitions=(0,s.q)(this),this.config.always&&(this.always=(0,s.u)(this.config.always).map(t=>(0,s.v)(this,s.N,t))),Object.keys(this.states).forEach(t=>{this.states[t]._initialize()})}get definition(){return{id:this.id,key:this.key,version:this.machine.version,type:this.t
2ype,initial:this.initial?{target:this.initial.target,source:this,actions:this.initial.actions.map(u),eventType:null,reenter:!1,toJSON:()=>({target:this.initial.target.map(t=>`#${t.id}`),source:`#${this.id}`,actions:this.initial.actions.map(u),eventType:null})}:void 0,history:this.history,states:(0,s.l)(this.states,t=>t.definition),on:this.on,transitions:[...this.transitions.values()].flat().map(t=>({...t,actions:t.actions.map(u)})),entry:this.entry.map(u),exit:this.exit.map(u),meta:this.meta,order:this.order||-1,output:this.output,invoke:this.invoke,description:this.description,tags:this.tags}}toJSON(){return this.definition}get invoke(){return o(this,"invoke",()=>(0,s.t)(this.config.invoke).map((t,e)=>{let{src:n,systemId:i}=t,r=t.id??(0,s.x)(this.id,e),o="string"==typeof n?n:`xstate.invoke.${(0,s.x)(this.id,e)}`;return{...t,src:o,id:r,systemId:i,toJSON(){let{onDone:e,onError:n,...s}=t;return{...s,type:"xstate.invoke",src:o,id:r}}}}))}get on(){return o(this,"on",()=>[...this.transitions].flatMap(([t,e])=>e.map(e=>[t,e])).reduce((t,[e,n])=>(t[e]=t[e]||[],t[e].push(n),t),{}))}get after(){return o(this,"delayedTransitions",()=>(0,s.y)(this))}get initial(){return o(this,"initial",()=>(0,s.z)(this,this.config.initial))}next(t,e){let n;let i=e.type,r=[];for(let a of o(this,`candidates-${i}`,()=>(0,s.B)(this,i))){let{guard:o}=a,u=t.context,c=!1;try{c=!o||(0,s.w)(o,u,e,t)}catch(e){let t="string"==typeof o?o:"object"==typeof o?o.type:void 0;throw Error(`Unable to evaluate guard ${t?`'${t}' `:""}in transition for event '${i}' in state node '${this.id}': 3${e.message}`)}if(c){r.push(...a.actions),n=a;break}}return n?[n]:void 0}get events(){return o(this,"events",()=>{let{states:t}=this,e=new Set(this.ownEvents);if(t)for(let n of Object.keys(t)){let s=t[n];if(s.states)for(let t of s.events)e.add(`${t}`)}return Array.from(e)})}get ownEvents(){return Array.from(new Set([...this.transitions.keys()].filter(t=>this.transitions.get(t).some(t=>!(!t.target&&!t.actions.length&&!t.reenter)))))}}class h{constructor(t,e){this.config=t,this.version=void 0,this.schemas=void 0,this.implementations=void 0,this.__xstatenode=!0,this.idMap=new Map,this.root=void 0,this.id=void 0,this.states=void 0,this.events=void 0,this.id=t.id||"(machine)",this.implementations={actors:e?.actors??{},actions:e?.actions??{},delays:e?.delays??{},guards:e?.guards??{}},this.version=this.config.version,this.schemas=this.config.schemas,this.transition=this.transition.bind(this),this.getInitialSnapshot=this.getInitialSnapshot.bind(this),this.getPersistedSnapshot=this.getPersistedSnapshot.bind(this),this.restoreSnapshot=this.restoreSnapshot.bind(this),this.start=this.start.bind(this),this.root=new c(t,{_key:this.id,_machine:this}),this.root._initialize(),this.states=this.root.states,this.events=this.root.events}provide(t){let{actions:e,guards:n,actors:s,delays:i}=this.implementations;return new h(this.config,{actions:{...e,...t.actions},guards:{...n,...t.guards},actors:{...s,...t.actors},delays:{...i,...t.delays}})}resolveState(t){let e=(0,s.C)(this.root,t.value),n=(0,s.D)((0,s.g)(this.root,e));return(0,s.E)({_nodes:[...n],context:t.context||{},children:{},status:(0,s.F)(n,this.root)?"done":t.status||"active",output:t.output,error:t.error,historyValue:t.historyValue},this)}transition(t,e,n){return(0,s.G)(t,e,n,[]).snapshot}microstep(t,e,n){return(0,s.G)(t,e,n,[]).microstates}getTransitionData(t,e){return(0,s.H)(this.root,t.value,t,e)||[]}getPreInitialState(t,e,n){let{context:r}=this.config,o=(0,s.E)({context:"function"!=typeof r&&r?r:{},_nodes:[this.root],children:{},status:"active"},this);return"function"==typeof r?(0,s.I)(o,e,t,[(0,i.a)(({spawn:t,event:e,self:n})=>r({spawn:t,input:e.input,self:n}))],n,void 0):o}getInitialSnapshot(t,e){let n=(0,s.J)(e),i=[],r=this.getPreInitialState(t,n,i),o=(0,s.K)([{target:[...(0,s.L)(this.root)],source:this.root,reenter:!0,actions:[],eventType:null,toJSON:null}],r,t,n,!0,i),{snapshot:a}=(0,s.G)(o,n,t,i);return a}start(t){Object.values(t.children).forEach(t=>{"active"===t.getSnapshot().status&&t.start()})}getStateNodeById(t){let e=(0,s.M)(t),n=e.slice(1),i=(0,s.O)(e[0])?e[0].slice(1):e[0],r=this.idMap.get(i);if(!r)throw Error(`Child state node '#${i}' does not exist on machine '${this.id}'`);return(0,s.P)(r,n)}get definition(){return this.root.definition}toJSON(){return this.definition}getPersistedSnapshot(t,e){return(0,s.Q)(t,e)}restoreSnapshot(t,e){let n={},i=t.children;
3Object.keys(i).forEach(t=>{let r=i[t],o=r.snapshot,a=r.src,u="string"==typeof a?(0,s.R)(this,a):a;if(!u)return;let c=(0,s.c)(u,{id:t,parent:e.self,syncSnapshot:r.syncSnapshot,snapshot:o,src:a,systemId:r.systemId});n[t]=c});let r=function(t,e){if(!e||"object"!=typeof e)return{};let n={};for(let s in e)for(let i of e[s]){let e=function(t,e){if(e instanceof c)return e;try{return t.machine.getStateNodeById(e.id)}catch{}}(t,i);e&&(n[s]??=[],n[s].push(e))}return n}(this.root,t.historyValue),o=(0,s.E)({...t,children:n,_nodes:Array.from((0,s.D)((0,s.g)(this.root,t.value))),historyValue:r},this),a=new Set;return!function t(e,n){if(!a.has(e))for(let i in a.add(e),e){let r=e[i];if(r&&"object"==typeof r){if("xstate$$type"in r&&r.xstate$$type===s.$){e[i]=n[r.id];continue}t(r,n)}}}(o.context,n),o}}function l(t,e){let n=(0,s.t)(e);if(!n.includes(t.type)){let e=1===n.length?`type "${n[0]}"`:`one of types "${n.join('", "')}"`;throw Error(`Expected event ${JSON.stringify(t)} to have ${e}`)}}function f({schemas:t,actors:e,actions:n,guards:s,delays:i}){return{createMachine:r=>new h({...r,schemas:t},{actors:e,actions:n,guards:s,delays:i})}}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.