/*! For license information please see 5242.js.LICENSE.txt */ (globalThis.webpackChunk_wcAdmin_webpackJsonp=globalThis.webpackChunk_wcAdmin_webpackJsonp||[]).push([[5242],{94859:(t,e,s)=>{"use strict";s.d(e,{d4:()=>h,zl:()=>f});var n=s(51609),o=s(29820),i=s(95747),r=s(93754),c=s(89104);const a=(t,e)=>{e(t);const s=t.getSnapshot().children;s&&Object.values(s).forEach(t=>{a(t,e)})};function u(t,e){return t===e}function h(t,e,s=u){const o=(0,n.useCallback)(e=>{if(!t)return()=>{};const{unsubscribe:s}=t.subscribe(e);return s},[t]),i=(0,n.useCallback)(()=>t?.getSnapshot(),[t]);return(0,r.useSyncExternalStoreWithSelector)(o,i,i,e,s)}function f(t,...[e]){return function(t,...[e]){const s=function(t,...[e]){let[[s,r],c]=(0,n.useState)(()=>{const s=(0,i.c)(t,e);return[t.config,s]});if(t.config!==s){const s=(0,i.c)(t,{...e,snapshot:r.getPersistedSnapshot({__unsafeAllowInlineActors:!0})});c([t.config,s]),r=s}return(0,o.A)(()=>{r.logic.implementations=t.implementations}),r}(t,e),r=(0,n.useCallback)(()=>s.getSnapshot(),[s]),u=(0,n.useCallback)(t=>{const{unsubscribe:e}=s.subscribe(t);return e},[s]),h=(0,c.useSyncExternalStore)(u,r,r);return(0,n.useEffect)(()=>(s.start(),()=>{!function(t){const e=[];a(t,t=>{e.push([t,t.getSnapshot()]),t.observers=new Set});const s=t.system.getSnapshot?.();t.stop(),t.system._snapshot=s,e.forEach(([t,e])=>{t._processingStatus=0,t._snapshot=e})}(s)}),[s]),[h,s.send,s]}(t,e)}},94736:(t,e,s)=>{"use strict";e.A=function(t){var e=t.size,s=void 0===e?24:e,n=t.onClick,c=(t.icon,t.className),a=function(t,e){if(null==t)return{};var s,n,o=function(t,e){if(null==t)return{};var s,n,o={},i=Object.keys(t);for(n=0;n{function e(t,e){if((t=t.replace(/\s+/g,""))===(e=e.replace(/\s+/g,"")))return 1;if(t.length<2||e.length<2)return 0;let s=new Map;for(let e=0;e0&&(s.set(o,i-1),n++)}return 2*n/(t.length+e.length-2)}t.exports={compareTwoStrings:e,findBestMatch:function(t,s){if(!function(t,e){return"string"==typeof t&&!!Array.isArray(e)&&!!e.length&&!e.find(function(t){return"string"!=typeof t})}(t,s))throw new Error("Bad arguments: First argument should be a string, second should be an array of strings");const n=[];let o=0;for(let i=0;in[o].rating&&(o=i)}return{ratings:n,bestMatch:n[o],bestMatchIndex:o}}}},29820:(t,e,s)=>{"use strict";s.d(e,{A:()=>n});var n=s(51609).useLayoutEffect},63133:(t,e,s)=>{"use strict";var n=s(51609),o="function"==typeof Object.is?Object.is:function(t,e){return t===e&&(0!==t||1/t==1/e)||t!=t&&e!=e},i=n.useState,r=n.useEffect,c=n.useLayoutEffect,a=n.useDebugValue;function u(t){var e=t.getSnapshot;t=t.value;try{var s=e();return!o(t,s)}catch(t){return!0}}var h="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(t,e){return e()}:function(t,e){var s=e(),n=i({inst:{value:s,getSnapshot:e}}),o=n[0].inst,h=n[1];return c(function(){o.value=s,o.getSnapshot=e,u(o)&&h({inst:o})},[t,s,e]),r(function(){return u(o)&&h({inst:o}),t(function(){u(o)&&h({inst:o})})},[t]),a(s),s};e.useSyncExternalStore=void 0!==n.useSyncExternalStore?n.useSyncExternalStore:h},23378:(t,e,s)=>{"use strict";var n=s(51609),o=s(89104),i="function"==typeof Object.is?Object.is:function(t,e){return t===e&&(0!==t||1/t==1/e)||t!=t&&e!=e},r=o.useSyncExternalStore,c=n.useRef,a=n.useEffect,u=n.useMemo,h=n.useDebugValue;e.useSyncExternalStoreWithSelector=function(t,e,s,n,o){var f=c(null);if(null===f.current){var d={hasValue:!1,value:null};f.current=d}else d=f.current;f=u(function(){function t(t){if(!a){if(a=!0,r=t,t=n(t),void 0!==o&&d.hasValue){var e=d.value;if(o(e,t))return c=e}return c=t}if(e=c,i(r,t))return e;var s=n(t);return void 0!==o&&o(e,s)?(r=t,e):(r=t,c=s)}var r,c,a=!1,u=void 0===s?null:s;return[function(){return t(e())},null===u?void 0:function(){return t(u())}]},[e,s,n,o]);var p=r(t,f[0],f[1]);return a(function(){d.hasValue=!0,d.value=p},[p]),h(p),p}},89104:(t,e,s)=>{"use strict";t.exports=s(63133)},93754:(t,e,s)=>{"use strict";t.exports=s(23378)},7:(t,e,s)=>{"use strict";s.d(e,{SP:()=>i,Sx:()=>u});var n=s(95747);const o=new WeakMap;function i(t){return{config:t,start:(e,s)=>{const{self:n,system:i,emit:r}=s,c={receivers:void 0,dispose:void 0};o.set(n,c),c.dispose=t({input:e.input,system:i,self:n,sendBack:t=>{"stopped"!==n.getSnapshot().status&&n._parent&&i._relay(n,n._parent,t)},receive:t=>{c.receivers??=new Set,c.receivers.add(t)},emit:r})},transition:(t,e,s)=>{const i=o.get(s.self);return e.type===n.X?(t={...t,status:"stopped",error:void 0},o.delete(s.self),i.receivers?.clear(),i.dispose?.(),t):(i.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}}const r="xstate.promise.resolve",c="xstate.promise.reject",a=new WeakMap;function u(t){return{config:t,transition:(t,e,s)=>{if("active"!==t.status)return t;switch(e.type){case r:{const s=e.data;return{...t,status:"done",output:s,input:void 0}}case c:return{...t,status:"error",error:e.data,input:void 0};case n.X:return a.get(s.self)?.abort(),a.delete(s.self),{...t,status:"stopped",input:void 0};default:return t}},start:(e,{self:s,system:n,emit:o})=>{if("active"!==e.status)return;const i=new AbortController;a.set(s,i),Promise.resolve(t({input:e.input,system:n,self:s,signal:i.signal,emit:o})).then(t=>{"active"===s.getSnapshot().status&&(a.delete(s),n._relay(s,s,{type:r,data:t}))},t=>{"active"===s.getSnapshot().status&&(a.delete(s),n._relay(s,s,{type:c,data:t}))})},getInitialSnapshot:(t,e)=>({status:"active",output:void 0,error:void 0,input:e}),getPersistedSnapshot:t=>t,restoreSnapshot:t=>t}}},48395:(t,e,s)=>{"use strict";s.d(e,{s:()=>n});const n=t=>{if("undefined"==typeof window)return;const e=function(){const t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==s.g?s.g:void 0;if(t.__xstate__)return t.__xstate__}();e&&e.register(t)}},23614:(t,e,s)=>{"use strict";s.d(e,{S:()=>h});var n=s(95747),o=s(98752);const i=new WeakMap;function r(t,e,s){let n=i.get(t);return n?e in n||(n[e]=s()):(n={[e]:s()},i.set(t,n)),n[e]}const c={},a=t=>"string"==typeof t?{type:t}:"function"==typeof t?"resolve"in t?{type:t.type}:{type:t.name}:t;class u{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(n.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,n.y)(this.config.states,(t,e)=>new u(t,{_parent:this,_key:e,_machine:this.machine})):c,"compound"===this.type&&!this.config.initial)throw new 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,n.t)(this.config.entry).slice(),this.exit=(0,n.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,n.t)(t.tags).slice()}_initialize(){this.transitions=(0,n.z)(this),this.config.always&&(this.always=(0,n.B)(this.config.always).map(t=>(0,n.C)(this,n.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.type,initial:this.initial?{target:this.initial.target,source:this,actions:this.initial.actions.map(a),eventType:null,reenter:!1,toJSON:()=>({target:this.initial.target.map(t=>`#${t.id}`),source:`#${this.id}`,actions:this.initial.actions.map(a),eventType:null})}:void 0,history:this.history,states:(0,n.y)(this.states,t=>t.definition),on:this.on,transitions:[...this.transitions.values()].flat().map(t=>({...t,actions:t.actions.map(a)})),entry:this.entry.map(a),exit:this.exit.map(a),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 r(this,"invoke",()=>(0,n.t)(this.config.invoke).map((t,e)=>{const{src:s,systemId:o}=t,i=t.id??(0,n.E)(this.id,e),r="string"==typeof s?s:`xstate.invoke.${(0,n.E)(this.id,e)}`;return{...t,src:r,id:i,systemId:o,toJSON(){const{onDone:e,onError:s,...n}=t;return{...n,type:"xstate.invoke",src:r,id:i}}}}))}get on(){return r(this,"on",()=>[...this.transitions].flatMap(([t,e])=>e.map(e=>[t,e])).reduce((t,[e,s])=>(t[e]=t[e]||[],t[e].push(s),t),{}))}get after(){return r(this,"delayedTransitions",()=>(0,n.F)(this))}get initial(){return r(this,"initial",()=>(0,n.G)(this,this.config.initial))}next(t,e){const s=e.type,o=[];let i;const c=r(this,`candidates-${s}`,()=>(0,n.H)(this,s));for(const r of c){const{guard:c}=r,a=t.context;let u=!1;try{u=!c||(0,n.D)(c,a,e,t)}catch(t){const e="string"==typeof c?c:"object"==typeof c?c.type:void 0;throw new Error(`Unable to evaluate guard ${e?`'${e}' `:""}in transition for event '${s}' in state node '${this.id}':\n${t.message}`)}if(u){o.push(...r.actions),i=r;break}}return i?[i]:void 0}get events(){return r(this,"events",()=>{const{states:t}=this,e=new Set(this.ownEvents);if(t)for(const s of Object.keys(t)){const n=t[s];if(n.states)for(const t of n.events)e.add(`${t}`)}return Array.from(e)})}get ownEvents(){const t=Object.keys(Object.fromEntries(this.transitions)),e=new Set(t.filter(t=>this.transitions.get(t).some(t=>!(!t.target&&!t.actions.length&&!t.reenter))));return Array.from(e)}}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 u(t,{_key:this.id,_machine:this}),this.root._initialize(),(0,n.I)(this.root),this.states=this.root.states,this.events=this.root.events}provide(t){const{actions:e,guards:s,actors:n,delays:o}=this.implementations;return new h(this.config,{actions:{...e,...t.actions},guards:{...s,...t.guards},actors:{...n,...t.actors},delays:{...o,...t.delays}})}resolveState(t){const e=(0,n.J)(this.root,t.value),s=(0,n.K)((0,n.p)(this.root,e));return(0,n.L)({_nodes:[...s],context:t.context||{},children:{},status:(0,n.M)(s,this.root)?"done":t.status||"active",output:t.output,error:t.error,historyValue:t.historyValue},this)}transition(t,e,s){return(0,n.d)(t,e,s,[]).snapshot}microstep(t,e,s){return(0,n.d)(t,e,s,[]).microsteps.map(([t])=>t)}getTransitionData(t,e){return(0,n.O)(this.root,t.value,t,e)||[]}_getPreInitialState(t,e,s){const{context:i}=this.config,r=(0,n.L)({context:"function"!=typeof i&&i?i:{},_nodes:[this.root],children:{},status:"active"},this);if("function"==typeof i){const c=({spawn:t,event:e,self:s})=>i({spawn:t,input:e.input,self:s});return(0,n.P)(r,e,t,[(0,o.a)(c)],s,void 0)}return r}getInitialSnapshot(t,e){const s=(0,n.e)(e),o=[],i=this._getPreInitialState(t,s,o),[r]=(0,n.i)(this.root,i,t,s,o),{snapshot:c}=(0,n.d)(r,s,t,o);return c}start(t){Object.values(t.children).forEach(t=>{"active"===t.getSnapshot().status&&t.start()})}getStateNodeById(t){const e=(0,n.Q)(t),s=e.slice(1),o=(0,n.R)(e[0])?e[0].slice(1):e[0],i=this.idMap.get(o);if(!i)throw new Error(`Child state node '#${o}' does not exist on machine '${this.id}'`);return(0,n.T)(i,s)}get definition(){return this.root.definition}toJSON(){return this.definition}getPersistedSnapshot(t,e){return(0,n.U)(t,e)}restoreSnapshot(t,e){const s={},o=t.children;function i(t,e){if(e instanceof u)return e;try{return t.machine.getStateNodeById(e.id)}catch{}}Object.keys(o).forEach(t=>{const i=o[t],r=i.snapshot,c=i.src,a="string"==typeof c?(0,n.V)(this,c):c;if(!a)return;const u=(0,n.c)(a,{id:t,parent:e.self,syncSnapshot:i.syncSnapshot,snapshot:r,src:c,systemId:i.systemId});s[t]=u});const r=function(t,e){if(!e||"object"!=typeof e)return{};const s={};for(const n in e){const o=e[n];for(const e of o){const o=i(t,e);o&&(s[n]??=[],s[n].push(o))}}return s}(this.root,t.historyValue),c=(0,n.L)({...t,children:s,_nodes:Array.from((0,n.K)((0,n.p)(this.root,t.value))),historyValue:r},this),a=new Set;return function t(e,s){if(!a.has(e)){a.add(e);for(const o in e){const i=e[o];if(i&&"object"==typeof i){if("xstate$$type"in i&&i.xstate$$type===n.$){e[o]=s[i.id];continue}t(i,s)}}}}(c.context,s),c}}},98752:(t,e,s)=>{"use strict";s.d(e,{a:()=>r});var n=s(95747);function o(t,{machine:e,context:s},o,i){return(r,c)=>{const a=((r,c)=>{if("string"==typeof r){const a=(0,n.V)(e,r);if(!a)throw new Error(`Actor logic '${r}' not implemented in machine '${e.id}'`);const u=(0,n.c)(a,{id:c?.id,parent:t.self,syncSnapshot:c?.syncSnapshot,input:"function"==typeof c?.input?c.input({context:s,event:o,self:t.self}):c?.input,src:r,systemId:c?.systemId});return i[u.id]=u,u}return(0,n.c)(r,{id:c?.id,parent:t.self,syncSnapshot:c?.syncSnapshot,input:c?.input,src:r,systemId:c?.systemId})})(r,c);return i[a.id]=a,t.defer(()=>{a._processingStatus!==n.Z.Stopped&&a.start()}),a}}function i(t,e,s,i,{assignment:r}){if(!e.context)throw new Error("Cannot assign to undefined `context`. Ensure that `context` is defined in the machine config.");const c={},a={context:e.context,event:s.event,spawn:o(t,e,s.event,c),self:t.self,system:t.system};let u={};if("function"==typeof r)u=r(a,i);else for(const t of Object.keys(r)){const e=r[t];u[t]="function"==typeof e?e(a,i):e}const h=Object.assign({},e.context,u);return[(0,n._)(e,{context:h,children:Object.keys(c).length?{...e.children,...c}: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}},93009:(t,e,s)=>{"use strict";s.d(e,{a:()=>c,b:()=>p,e:()=>y,l:()=>m,s:()=>d});var n=s(95747),o=s(98752);function i(t,e,s,n,{event:o}){return[e,{event:"function"==typeof o?o(s,n):o},void 0]}function r(t,{event:e}){t.defer(()=>t.emit(e))}function c(t){function e(t,e){}return e.type="xstate.emit",e.event=t,e.resolve=i,e.execute=r,e}let a=function(t){return t.Parent="#_parent",t.Internal="#_internal",t}({});function u(t,e,s,n,{to:o,event:i,id:r,delay:c},u){const h=e.machine.implementations.delays;if("string"==typeof i)throw new Error(`Only event objects may be used with sendTo; use sendTo({ type: "${i}" }) instead`);const f="function"==typeof i?i(s,n):i;let d;if("string"==typeof c){const t=h&&h[c];d="function"==typeof t?t(s,n):t}else d="function"==typeof c?c(s,n):c;const p="function"==typeof o?o(s,n):o;let l;if("string"==typeof p){if(l=p===a.Parent?t.self._parent:p===a.Internal?t.self:p.startsWith("#_")?e.children[p.slice(2)]:u.deferredActorIds?.includes(p)?p:e.children[p],!l)throw new 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:f,id:r,delay:d},void 0]}function h(t,e,s){"string"==typeof s.to&&(s.to=e.children[s.to])}function f(t,e){t.defer(()=>{const{to:s,event:o,delay:i,id:r}=e;"number"!=typeof i?t.system._relay(t.self,s,o.type===n.W?(0,n.Y)(t.self.id,o.data):o):t.system.scheduler.schedule(t.self,s,o,i,r)})}function d(t,e,s){function n(t,e){}return n.type="xstate.sendTo",n.to=t,n.event=e,n.id=s?.id,n.delay=s?.delay,n.resolve=u,n.retryResolve=h,n.execute=f,n}function p(t,e){return d(a.Parent,t,e)}function l(t,e,s,i,{collect:r}){const a=[],u=function(t){a.push(t)};return u.assign=(...t)=>{a.push((0,o.a)(...t))},u.cancel=(...t)=>{a.push((0,n.a)(...t))},u.raise=(...t)=>{a.push((0,n.r)(...t))},u.sendTo=(...t)=>{a.push(d(...t))},u.sendParent=(...t)=>{a.push(p(...t))},u.spawnChild=(...t)=>{a.push((0,n.b)(...t))},u.stopChild=(...t)=>{a.push((0,n.s)(...t))},u.emit=(...t)=>{a.push(c(...t))},r({context:s.context,event:s.event,enqueue:u,check:t=>(0,n.D)(t,e.context,s.event,e),self:t.self,system:t.system},i),[e,void 0,a]}function y(t){function e(t,e){}return e.type="xstate.enqueueActions",e.collect=t,e.resolve=l,e}function g(t,e,s,n,{value:o,label:i}){return[e,{value:"function"==typeof o?o(s,n):o,label:i},void 0]}function v({logger:t},{value:e,label:s}){s?t(s,e):t(e)}function m(t=({context:t,event:e})=>({context:t,event:e}),e){function s(t,e){}return s.type="xstate.log",s.value=t,s.label=e,s.resolve=g,s.execute=v,s}},95747:(t,e,s)=>{"use strict";s.d(e,{$:()=>C,B:()=>k,C:()=>ut,D:()=>H,E:()=>O,F:()=>at,G:()=>dt,H:()=>ct,I:()=>ft,J:()=>Bt,K:()=>et,L:()=>Ft,M:()=>it,N:()=>c,O:()=>St,P:()=>Rt,Q:()=>m,R:()=>rt,S:()=>i,T:()=>mt,U:()=>Xt,V:()=>j,W:()=>h,X:()=>f,Y:()=>p,Z:()=>P,_:()=>Gt,a:()=>B,b:()=>q,c:()=>D,d:()=>Vt,e:()=>l,i:()=>Ot,m:()=>A,o:()=>X,p:()=>_t,r:()=>te,s:()=>G,t:()=>x,y:()=>S,z:()=>ht});var n=s(48395);class o{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){const e={value:t,next:null};if(this._current)return this._last.next=e,void(this._last=e);this._current=e,this._last=e,this._active&&this.flush()}flush(){for(;this._current;){const t=this._current;this._process(t.value),this._current=t.next}this._last=null}}const i=".",r="",c="",a="*",u="xstate.init",h="xstate.error",f="xstate.stop";function d(t,e){return{type:`xstate.done.state.${t}`,output:e}}function p(t,e){return{type:`xstate.error.actor.${t}`,error:e,actorId:t}}function l(t){return{type:u,input:t}}function y(t){setTimeout(()=>{throw t})}const g="function"==typeof Symbol&&Symbol.observable||"@@observable";function v(t,e){const s=_(t),n=_(e);return"string"==typeof n?"string"==typeof s&&n===s:"string"==typeof s?s in n:Object.keys(s).every(t=>t in n&&v(s[t],n[t]))}function m(t){if(E(t))return t;const e=[];let s="";for(let n=0;nvoid 0===t||"string"==typeof t?{target:t}:t)}function I(t){if(void 0!==t&&t!==r)return x(t)}function $(t,e,s){const n="object"==typeof t,o=n?t:void 0;return{next:(n?t.next:t)?.bind(o),error:(n?t.error:e)?.bind(o),complete:(n?t.complete:s)?.bind(o)}}function O(t,e){return`${e}.${t}`}function j(t,e){const s=e.match(/^xstate\.invoke\.(\d+)\.(.*)/);if(!s)return t.implementations.actors[e];const[,n,o]=s,i=t.getStateNodeById(o).config.invoke;return(Array.isArray(i)?i[n]:i).src}function A(t,e){if(e===t)return!0;if(e===a)return!0;if(!e.endsWith(".*"))return!1;const s=e.split("."),n=t.split(".");for(let t=0;tsetTimeout(t,e),clearTimeout:t=>clearTimeout(t)},logger:console.log.bind(console),devTools:!1};class V{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 o(this._process.bind(this)),this.observers=new Set,this.eventListeners=new Map,this.logger=void 0,this._processingStatus=P.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=[];const s={...R,...e},{clock:n,logger:i,parent:r,syncSnapshot:c,id:a,systemId:u,inspect:h}=s;this.system=r?r.system:function(t,e){const s=new Map,n=new Map,o=new WeakMap,i=new Set,r={},{clock:c,logger:a}=e,u={schedule:(t,e,s,n,o=Math.random().toString(36).slice(2))=>{const i={source:t,target:e,event:s,delay:n,id:o,startedAt:Date.now()},a=T(t,o);h._snapshot._scheduledEvents[a]=i;const u=c.setTimeout(()=>{delete r[a],delete h._snapshot._scheduledEvents[a],h._relay(t,e,s)},n);r[a]=u},cancel:(t,e)=>{const s=T(t,e),n=r[s];delete r[s],delete h._snapshot._scheduledEvents[s],void 0!==n&&c.clearTimeout(n)},cancelAll:t=>{for(const e in h._snapshot._scheduledEvents){const s=h._snapshot._scheduledEvents[e];s.source===t&&u.cancel(t,s.id)}}},h={_snapshot:{_scheduledEvents:(e?.snapshot&&e.snapshot.scheduler)??{}},_bookId:()=>"x:"+M++,_register:(t,e)=>(s.set(t,e),t),_unregister:t=>{s.delete(t.sessionId);const e=o.get(t);void 0!==e&&(n.delete(e),o.delete(t))},get:t=>n.get(t),getAll:()=>Object.fromEntries(n.entries()),_set:(t,e)=>{const s=n.get(t);if(s&&s!==e)throw new Error(`Actor with system ID '${t}' already exists.`);n.set(t,e),o.set(e,t)},inspect:t=>{const e=$(t);return i.add(e),{unsubscribe(){i.delete(e)}}},_sendInspectionEvent:e=>{if(!i.size)return;const s={...e,rootId:t.sessionId};i.forEach(t=>t.next?.(s))},_relay:(t,e,s)=>{h._sendInspectionEvent({type:"@xstate.event",sourceRef:t,actorRef:e,event:s}),e._send(s)},scheduler:u,getSnapshot:()=>({_scheduledEvents:{...h._snapshot._scheduledEvents}}),start:()=>{const t=h._snapshot._scheduledEvents;h._snapshot._scheduledEvents={};for(const e in t){const{source:s,target:n,event:o,delay:i,id:r}=t[e];u.schedule(s,n,o,i,r)}},_clock:c,_logger:a};return h}(this,{clock:n,logger:i}),h&&!r&&this.system.inspect($(h)),this.sessionId=this.system._bookId(),this.id=a??this.sessionId,this.logger=e?.logger??this.system._logger,this.clock=e?.clock??this.system._clock,this._parent=r,this._syncSnapshot=c,this.options=s,this.src=s.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 new Error(`Cannot stop child actor ${t.id} of ${this.id} because it is not a child`);t._stop()},emit:t=>{const e=this.eventListeners.get(t.type),s=this.eventListeners.get("*");if(!e&&!s)return;const n=[...e?e.values():[],...s?s.values():[]];for(const e of n)try{e(t)}catch(t){y(t)}},actionExecutor:t=>{const e=()=>{if(this._actorScope.system._sendInspectionEvent({type:"@xstate.action",actorRef:this,action:{type:t.type,params:t.params}}),!t.exec)return;const e=N;try{N=!0,t.exec(t.info,t.params)}finally{N=e}};this._processingStatus===P.Running?e():this._deferred.push(e)}},this.send=this.send.bind(this),this.system._sendInspectionEvent({type:"@xstate.actor",actorRef:this}),u&&(this.systemId=u,this.system._set(u,this)),this._initState(e?.snapshot??e?.state),u&&"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 s;for(this._snapshot=t;s=this._deferred.shift();)try{s()}catch(e){this._deferred.length=0,this._snapshot={...t,status:"error",error:e}}switch(this._snapshot.status){case"active":for(const e of this.observers)try{e.next?.(t)}catch(t){y(t)}break;case"done":for(const e of this.observers)try{e.next?.(t)}catch(t){y(t)}this._stopProcedure(),this._complete(),this._doneEvent={type:`xstate.done.actor.${n=this.id}`,output:this._snapshot.output,actorId:n},this._parent&&this.system._relay(this,this._parent,this._doneEvent);break;case"error":this._error(this._snapshot.error)}var n;this.system._sendInspectionEvent({type:"@xstate.snapshot",actorRef:this,event:e,snapshot:t})}subscribe(t,e,s){const n=$(t,e,s);if(this._processingStatus!==P.Stopped)this.observers.add(n);else switch(this._snapshot.status){case"done":try{n.complete?.()}catch(t){y(t)}break;case"error":{const t=this._snapshot.error;if(n.error)try{n.error(t)}catch(t){y(t)}else y(t);break}}return{unsubscribe:()=>{this.observers.delete(n)}}}on(t,e){let s=this.eventListeners.get(t);s||(s=new Set,this.eventListeners.set(t,s));const n=e.bind(void 0);return s.add(n),{unsubscribe:()=>{s.delete(n)}}}select(t,e=Object.is){return{subscribe:s=>{const n=$(s),o=this.getSnapshot();let i=t(o);return this.subscribe(s=>{const o=t(s);e(i,o)||(i=o,n.next?.(o))})},get:()=>t(this.getSnapshot())}}start(){if(this._processingStatus===P.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=P.Running;const t=l(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,s;try{e=this.logic.transition(this._snapshot,t,this._actorScope)}catch(t){s={err:t}}if(s){const{err:t}=s;return this._snapshot={...this._snapshot,status:"error",error:t},void this._error(t)}this.update(e,t),t.type===f&&(this._stopProcedure(),this._complete())}_stop(){return this._processingStatus===P.Stopped?this:(this.mailbox.clear(),this._processingStatus===P.NotStarted?(this._processingStatus=P.Stopped,this):(this.mailbox.enqueue({type:f}),this))}stop(){if(this._parent)throw new Error("A non-root actor cannot be stopped directly.");return this._stop()}_complete(){for(const t of this.observers)try{t.complete?.()}catch(t){y(t)}this.observers.clear(),this.eventListeners.clear()}_reportError(t){if(!this.observers.size)return this._parent||y(t),void this.eventListeners.clear();let e=!1;for(const s of this.observers){const n=s.error;e||=!n;try{n?.(t)}catch(t){y(t)}}this.observers.clear(),this.eventListeners.clear(),e&&y(t)}_error(t){this._stopProcedure(),this._reportError(t),this._parent&&this.system._relay(this,this._parent,p(this.id,t))}_stopProcedure(){return this._processingStatus!==P.Running||(this.system.scheduler.cancelAll(this),this.mailbox.clear(),this.mailbox=new o(this._process.bind(this)),this._processingStatus=P.Stopped,this.system._unregister(this)),this}_send(t){this._processingStatus!==P.Stopped&&this.mailbox.enqueue(t)}send(t){this.system._relay(void 0,this,t)}attachDevTools(){const{devTools:t}=this.options;t&&("function"==typeof t?t:n.s)(this)}toJSON(){return{xstate$$type:C,id:this.id}}getPersistedSnapshot(t){return this.logic.getPersistedSnapshot(this._snapshot,t)}[g](){return this}getSnapshot(){return this._snapshot}}function D(t,...[e]){return new V(t,e)}function J(t,e,s,n,{sendId:o}){return[e,{sendId:"function"==typeof o?o(s,n):o},void 0]}function z(t,e){t.defer(()=>{t.system.scheduler.cancel(t.self,e.sendId)})}function B(t){function e(t,e){}return e.type="xstate.cancel",e.sendId=t,e.resolve=J,e.execute=z,e}function L(t,e,s,n,{id:o,systemId:i,src:r,input:c,syncSnapshot:a}){const u="string"==typeof r?j(e.machine,r):r,h="function"==typeof o?o(s):o;let f,d;return u&&(d="function"==typeof c?c({context:e.context,event:s.event,self:t.self}):c,f=D(u,{id:h,src:r,parent:t.self,syncSnapshot:a,systemId:i,input:d})),[Gt(e,{children:{...e.children,[h]:f}}),{id:o,systemId:i,actorRef:f,src:r,input:d},void 0]}function W(t,{actorRef:e}){e&&t.defer(()=>{e._processingStatus!==P.Stopped&&e.start()})}function q(...[t,{id:e,systemId:s,input:n,syncSnapshot:o=!1}={}]){function i(t,e){}return i.type="xstate.spawnChild",i.id=e,i.systemId=s,i.src=t,i.input=n,i.syncSnapshot=o,i.resolve=L,i.execute=W,i}function U(t,e,s,n,{actorRef:o}){const i="function"==typeof o?o(s,n):o,r="string"==typeof i?e.children[i]:i;let c=e.children;return r&&(c={...c},delete c[r.id]),[Gt(e,{children:c}),r,void 0]}function Q(t,e){const s=e.getSnapshot();if(s&&"children"in s)for(const e of Object.values(s.children))Q(t,e);t.system._unregister(e)}function F(t,e){e&&(Q(t,e),e._processingStatus===P.Running?t.defer(()=>{t.stopChild(e)}):t.stopChild(e))}function G(t){function e(t,e){}return e.type="xstate.stopChild",e.actorRef=t,e.resolve=U,e.execute=F,e}function K(t,{context:e,event:s},{guards:n}){return n.some(n=>H(n,e,s,t))}function X(t){function e(t,e){return!1}return e.check=K,e.guards=t,e}function H(t,e,s,n){const{machine:o}=n,i="function"==typeof t,r=i?t:o.implementations.guards["string"==typeof t?t:t.type];if(!i&&!r)throw new Error(`Guard '${"string"==typeof t?t:t.type}' is not implemented.'.`);if("function"!=typeof r)return H(r,e,s,n);const c={context:e,event:s},a=i||"string"==typeof t?void 0:"params"in t?"function"==typeof t.params?t.params({context:e,event:s}):t.params:void 0;return"check"in r?r.check(n,c,r):r(c,a)}function Y(t){return"atomic"===t.type||"final"===t.type}function Z(t){return Object.values(t.states).filter(t=>"history"!==t.type)}function tt(t,e){const s=[];if(e===t)return s;let n=t.parent;for(;n&&n!==e;)s.push(n),n=n.parent;return s}function et(t){const e=new Set(t),s=nt(e);for(const t of e)if("compound"!==t.type||s.get(t)&&s.get(t).length){if("parallel"===t.type)for(const s of Z(t))if("history"!==s.type&&!e.has(s)){const t=yt(s);for(const s of t)e.add(s)}}else yt(t).forEach(t=>e.add(t));for(const t of e){let s=t.parent;for(;s;)e.add(s),s=s.parent}return e}function st(t,e){const s=e.get(t);if(!s)return{};if("compound"===t.type){const t=s[0];if(!t)return{};if(Y(t))return t.key}const n={};for(const t of s)n[t.key]=st(t,e);return n}function nt(t){const e=new Map;for(const s of t)e.has(s)||e.set(s,[]),s.parent&&(e.has(s.parent)||e.set(s.parent,[]),e.get(s.parent).push(s));return e}function ot(t,e){return st(t,nt(et(e)))}function it(t,e){return"compound"===e.type?Z(e).some(e=>"final"===e.type&&t.has(e)):"parallel"===e.type?Z(e).every(e=>it(t,e)):"final"===e.type}const rt=t=>"#"===t[0];function ct(t,e){return t.transitions.get(e)||[...t.transitions.keys()].filter(t=>A(e,t)).sort((t,e)=>e.length-t.length).flatMap(e=>t.transitions.get(e))}function at(t){const e=t.config.after;return e?Object.keys(e).flatMap(s=>{const n=e[s],o="string"==typeof n?{target:n}:n,i=Number.isNaN(+s)?s:+s,r=(e=>{const s={type:`xstate.after.${e}.${t.id}`};const n=s.type;return t.entry.push(te(s,{id:n,delay:e})),t.exit.push(B(n)),n})(i);return x(o).map(t=>({...t,event:r,delay:i}))}).map(e=>{const{delay:s}=e;return{...ut(t,e.event,e),delay:s}}):[]}function ut(t,e,s){const n=I(s.target),o=s.reenter??!1,r=function(t,e){if(void 0!==e)return e.map(e=>{if("string"!=typeof e)return e;if(rt(e))return t.machine.getStateNodeById(e);const s=e[0]===i;if(s&&!t.parent)return mt(t,e.slice(1));const n=s?t.key+e:e;if(!t.parent)throw new Error(`Invalid target: "${e}" is not a valid target from the root node. Did you mean ".${e}"?`);try{return mt(t.parent,n)}catch(e){throw new Error(`Invalid transition definition for state node '${t.id}':\n${e.message}`)}})}(t,n),c={...s,actions:x(s.actions),guard:s.guard,target:r,source:t,reenter:o,eventType:e,toJSON:()=>({...c,source:`#${t.id}`,target:r?r.map(t=>`#${t.id}`):void 0})};return c}function ht(t){const e=new Map;if(t.config.on)for(const s of Object.keys(t.config.on)){if(s===c)throw new Error('Null events ("") cannot be specified as a transition key. Use `always: { ... }` instead.');const n=t.config.on[s];e.set(s,k(n).map(e=>ut(t,s,e)))}if(t.config.onDone){const s=`xstate.done.state.${t.id}`;e.set(s,k(t.config.onDone).map(e=>ut(t,s,e)))}for(const s of t.invoke){if(s.onDone){const n=`xstate.done.actor.${s.id}`;e.set(n,k(s.onDone).map(e=>ut(t,n,e)))}if(s.onError){const n=`xstate.error.actor.${s.id}`;e.set(n,k(s.onError).map(e=>ut(t,n,e)))}if(s.onSnapshot){const n=`xstate.snapshot.${s.id}`;e.set(n,k(s.onSnapshot).map(e=>ut(t,n,e)))}}for(const s of t.after){let t=e.get(s.eventType);t||(t=[],e.set(s.eventType,t)),t.push(s)}return e}function ft(t){const e=[],s=n=>{Object.values(n).forEach(n=>{if(n.config.route&&n.config.id){const s=n.config.id,o=n.config.route.guard,i=(t,e)=>t.event.to===`#${s}`&&(!o||"function"!=typeof o||o(t,e)),r={...n.config.route,guard:i,target:`#${s}`};e.push(ut(t,"xstate.route",r))}n.states&&s(n.states)})};s(t.states),e.length>0&&t.transitions.set("xstate.route",e)}function dt(t,e){const s="string"==typeof e?t.states[e]:e?t.states[e.target]:void 0;if(!s&&e)throw new Error(`Initial state node "${e}" not found on parent state node #${t.id}`);const n={source:t,actions:e&&"string"!=typeof e?x(e.actions):[],eventType:null,reenter:!1,target:s?[s]:[],toJSON:()=>({...n,source:`#${t.id}`,target:s?[`#${s.id}`]:[]})};return n}function pt(t){const e=I(t.config.target);return e?{target:e.map(e=>"string"==typeof e?mt(t.parent,e):e)}:t.parent.initial}function lt(t){return"history"===t.type}function yt(t){const e=gt(t);for(const s of e)for(const n of tt(s,t))e.add(n);return e}function gt(t){const e=new Set;return function t(s){if(!e.has(s))if(e.add(s),"compound"===s.type)t(s.initial.target[0]);else if("parallel"===s.type)for(const e of Z(s))t(e)}(t),e}function vt(t,e){if(rt(e))return t.machine.getStateNodeById(e);if(!t.states)throw new Error(`Unable to retrieve child state '${e}' from '${t.id}'; no child states exist.`);const s=t.states[e];if(!s)throw new Error(`Child state '${e}' does not exist on '${t.id}'`);return s}function mt(t,e){if("string"==typeof e&&rt(e))try{return t.machine.getStateNodeById(e)}catch{}const s=m(e).slice();let n=t;for(;s.length;){const t=s.shift();if(!t.length)break;n=vt(n,t)}return n}function _t(t,e){if("string"==typeof e){const s=t.states[e];if(!s)throw new Error(`State '${e}' does not exist on '${t.id}'`);return[t,s]}const s=Object.keys(e),n=s.map(e=>vt(t,e)).filter(Boolean);return[t.machine.root,t].concat(n,s.reduce((s,n)=>{const o=vt(t,n);if(!o)return s;const i=_t(o,e[n]);return s.concat(i)},[]))}function St(t,e,s,n){return"string"==typeof e?function(t,e,s,n){const o=vt(t,e).next(s,n);return o&&o.length?o:t.next(s,n)}(t,e,s,n):1===Object.keys(e).length?function(t,e,s,n){const o=Object.keys(e),i=St(vt(t,o[0]),e[o[0]],s,n);return i&&i.length?i:t.next(s,n)}(t,e,s,n):function(t,e,s,n){const o=[];for(const i of Object.keys(e)){const r=e[i];if(!r)continue;const c=St(vt(t,i),r,s,n);c&&o.push(...c)}return o.length?o:t.next(s,n)}(t,e,s,n)}function bt(t){return Object.keys(t.states).map(e=>t.states[e]).filter(t=>"history"===t.type)}function xt(t,e){let s=t;for(;s.parent&&s.parent!==e;)s=s.parent;return s.parent===e}function wt(t,e){const s=new Set(t),n=new Set(e);for(const t of s)if(n.has(t))return!0;for(const t of n)if(s.has(t))return!0;return!1}function Et(t,e,s){const n=new Set;for(const o of t){let t=!1;const i=new Set;for(const r of n)if(wt($t([o],e,s),$t([r],e,s))){if(!xt(o.source,r.source)){t=!0;break}i.add(r)}if(!t){for(const t of i)n.delete(t);n.add(o)}}return Array.from(n)}function kt(t,e){if(!t.target)return[];const s=new Set;for(const n of t.target)if(lt(n))if(e[n.id])for(const t of e[n.id])s.add(t);else for(const t of kt(pt(n),e))s.add(t);else s.add(n);return[...s]}function It(t,e){const s=kt(t,e);if(!s)return;if(!t.reenter&&s.every(e=>e===t.source||xt(e,t.source)))return t.source;return function(t){const[e,...s]=t;for(const t of tt(e,void 0))if(s.every(e=>xt(e,t)))return t}(s.concat(t.source))||(t.reenter?void 0:t.source.machine.root)}function $t(t,e,s){const n=new Set;for(const o of t)if(o.target?.length){const t=It(o,s);o.reenter&&o.source===t&&n.add(t);for(const s of e)xt(s,t)&&n.add(s)}return[...n]}function Ot(t,e,s,n,o){return jt([{target:[...gt(t)],source:t,reenter:!0,actions:[],eventType:null,toJSON:null}],e,s,n,!0,o)}function jt(t,e,s,n,o,i){const r=[];if(!t.length)return[e,r];const c=s.actionExecutor;s.actionExecutor=t=>{r.push(t),c(t)};try{const c=new Set(e._nodes);let a=e.historyValue;const u=Et(t,c,a);let h=e;o||([h,a]=function(t,e,s,n,o,i,r){let c=t;const a=$t(n,o,i);let u;a.sort((t,e)=>e.order-t.order);for(const t of a)for(const e of bt(t)){let s;s="deep"===e.history?e=>Y(e)&&xt(e,t):e=>e.parent===t,u??={...i},u[e.id]=Array.from(o).filter(s)}for(const t of a)c=Rt(c,e,s,[...t.exit,...t.invoke.map(t=>G(t.id))],r,void 0),o.delete(t);return[c,u||i]}(h,n,s,u,c,a,i,s.actionExecutor)),h=Rt(h,n,s,u.flatMap(t=>t.actions),i,void 0),h=function(t,e,s,n,o,i,r,c){let a=t;const u=new Set,h=new Set;(function(t,e,s,n){for(const o of t){const t=It(o,e);for(const i of o.target||[])lt(i)||o.source===i&&o.source===t&&!o.reenter||(n.add(i),s.add(i)),Tt(i,e,s,n);const i=kt(o,e);for(const r of i){const i=tt(r,t);"parallel"===t?.type&&i.push(t),Mt(n,e,s,i,!o.source.parent&&o.reenter?void 0:t)}}})(n,r,h,u),c&&h.add(t.machine.root);const f=new Set;for(const t of[...u].sort((t,e)=>t.order-e.order)){o.add(t);const n=[];n.push(...t.entry);for(const e of t.invoke)n.push(q(e.src,{...e,syncSnapshot:!!e.onSnapshot}));if(h.has(t)){const e=t.initial.actions;n.push(...e)}if(a=Rt(a,e,s,n,i,t.invoke.map(t=>t.id)),"final"===t.type){const n=t.parent;let r="parallel"===n?.type?n:n?.parent,c=r||t;for("compound"===n?.type&&i.push(d(n.id,void 0!==t.output?w(t.output,a.context,e,s.self):void 0));"parallel"===r?.type&&!f.has(r)&&it(o,r);)f.add(r),i.push(d(r.id)),c=r,r=r.parent;if(r)continue;a=Gt(a,{status:"done",output:At(a,e,s,a.machine.root,c)})}}return a}(h,n,s,u,c,i,a,o);const f=[...c];"done"===h.status&&(h=Rt(h,n,s,f.sort((t,e)=>e.order-t.order).flatMap(t=>t.exit),i,void 0));try{return a===e.historyValue&&function(t,e){if(t.length!==e.size)return!1;for(const s of t)if(!e.has(s))return!1;return!0}(e._nodes,c)?[h,r]:[Gt(h,{_nodes:f,historyValue:a}),r]}catch(t){throw t}}finally{s.actionExecutor=c}}function At(t,e,s,n,o){if(void 0===n.output)return;const i=d(o.id,void 0!==o.output&&o.parent?w(o.output,t.context,e,s.self):void 0);return w(n.output,t.context,i,s.self)}function Tt(t,e,s,n){if(lt(t))if(e[t.id]){const o=e[t.id];for(const t of o)n.add(t),Tt(t,e,s,n);for(const i of o)Nt(i,t.parent,n,e,s)}else{const o=pt(t);for(const i of o.target)n.add(i),o===t.parent?.initial&&s.add(t.parent),Tt(i,e,s,n);for(const i of o.target)Nt(i,t.parent,n,e,s)}else if("compound"===t.type){const[o]=t.initial.target;lt(o)||(n.add(o),s.add(o)),Tt(o,e,s,n),Nt(o,t,n,e,s)}else if("parallel"===t.type)for(const o of Z(t).filter(t=>!lt(t)))[...n].some(t=>xt(t,o))||(lt(o)||(n.add(o),s.add(o)),Tt(o,e,s,n))}function Mt(t,e,s,n,o){for(const i of n)if(o&&!xt(i,o)||t.add(i),"parallel"===i.type)for(const n of Z(i).filter(t=>!lt(t)))[...t].some(t=>xt(t,n))||(t.add(n),Tt(n,e,s,t))}function Nt(t,e,s,n,o){Mt(s,n,o,tt(t,e))}function Ct(t,e){return t.implementations.actions[e]}function Pt(t,e,s,n,o,i){const{machine:r}=t;let c=t;for(const t of n){const n="function"==typeof t,a=n?t:Ct(r,"string"==typeof t?t:t.type),u={context:c.context,event:e,self:s.self,system:s.system},h=n||"string"==typeof t?void 0:"params"in t?"function"==typeof t.params?t.params({context:c.context,event:e}):t.params:void 0;if(!a||!("resolve"in a)){s.actionExecutor({type:"string"==typeof t?t:"object"==typeof t?t.type:t.name||"(anonymous)",info:u,params:h,exec:a});continue}const f=a,[d,p,l]=f.resolve(s,c,u,h,a,o);c=d,"retryResolve"in f&&i?.push([f,p]),"execute"in f&&s.actionExecutor({type:f.type,info:u,params:p,exec:f.execute.bind(null,s,p)}),l&&(c=Pt(c,e,s,l,o,i))}return c}function Rt(t,e,s,n,o,i){const r=i?[]:void 0,c=Pt(t,e,s,n,{internalQueue:o,deferredActorIds:i},r);return r?.forEach(([t,e])=>{t.retryResolve(s,c,e)}),c}function Vt(t,e,s,n){let o=t;const i=[];function r(t,e,n){s.system._sendInspectionEvent({type:"@xstate.microstep",actorRef:s.self,event:e,snapshot:t[0],_transitions:n}),i.push(t)}if(e.type===f)return o=Gt(Dt(o,e,s),{status:"stopped"}),r([o,[]],e,[]),{snapshot:o,microsteps:i};let c=e;if(c.type!==u){const e=c,a=function(t){return t.type.startsWith("xstate.error.actor")}(e),u=Jt(e,o);if(a&&!u.length)return o=Gt(t,{status:"error",error:e.error}),r([o,[]],e,[]),{snapshot:o,microsteps:i};const h=jt(u,t,s,c,!1,n);o=h[0],r(h,e,u)}let a=!0;for(;"active"===o.status;){let t=a?zt(o,c):[];const e=t.length?o:void 0;if(!t.length){if(!n.length)break;c=n.shift(),t=Jt(c,o)}const i=jt(t,o,s,c,!1,n);o=i[0],a=o!==e,r(i,c,t)}return"active"!==o.status&&Dt(o,c,s),{snapshot:o,microsteps:i}}function Dt(t,e,s){return Rt(t,e,s,Object.values(t.children).map(t=>G(t)),[],void 0)}function Jt(t,e){return e.machine.getTransitionData(e,t)}function zt(t,e){const s=new Set,n=t._nodes.filter(Y);for(const o of n)t:for(const n of[o].concat(tt(o,void 0)))if(n.always)for(const o of n.always)if(void 0===o.guard||H(o.guard,t.context,e,t)){s.add(o);break t}return Et(Array.from(s),new Set(t._nodes),t.historyValue)}function Bt(t,e){return ot(t,[...et(_t(t,e))])}const Lt=function(t){return v(t,this.value)},Wt=function(t){return this.tags.has(t)},qt=function(t){const e=this.machine.getTransitionData(this,t);return!!e?.length&&e.some(t=>void 0!==t.target||t.actions.length)},Ut=function(){const{_nodes:t,tags:e,machine:s,getMeta:n,toJSON:o,can:i,hasTag:r,matches:c,...a}=this;return{...a,tags:Array.from(e)}},Qt=function(){return this._nodes.reduce((t,e)=>(void 0!==e.meta&&(t[e.id]=e.meta),t),{})};function Ft(t,e){return{status:t.status,output:t.output,error:t.error,machine:e,context:t.context,_nodes:t._nodes,value:ot(e.root,t._nodes),tags:new Set(t._nodes.flatMap(t=>t.tags)),children:t.children,historyValue:t.historyValue||{},matches:Lt,hasTag:Wt,can:qt,getMeta:Qt,toJSON:Ut}}function Gt(t,e={}){return Ft({...t,...e},t.machine)}function Kt(t){if("object"!=typeof t||null===t)return{};const e={};for(const s in t){const n=t[s];Array.isArray(n)&&(e[s]=n.map(t=>({id:t.id})))}return e}function Xt(t,e){const{_nodes:s,tags:n,machine:o,children:i,context:r,can:c,hasTag:a,matches:u,getMeta:h,toJSON:f,...d}=t,p={};for(const t in i){const s=i[t];p[t]={snapshot:s.getPersistedSnapshot(e),src:s.src,systemId:s.systemId,syncSnapshot:s._syncSnapshot}}return{...d,context:Ht(r),children:p,historyValue:Kt(d.historyValue)}}function Ht(t){let e;for(const s in t){const n=t[s];if(n&&"object"==typeof n)if("sessionId"in n&&"send"in n&&"ref"in n)e??=Array.isArray(t)?t.slice():{...t},e[s]={xstate$$type:C,id:n.id};else{const o=Ht(n);o!==n&&(e??=Array.isArray(t)?t.slice():{...t},e[s]=o)}}return e??t}function Yt(t,e,s,n,{event:o,id:i,delay:r},{internalQueue:c}){const a=e.machine.implementations.delays;if("string"==typeof o)throw new Error(`Only event objects may be used with raise; use raise({ type: "${o}" }) instead`);const u="function"==typeof o?o(s,n):o;let h;if("string"==typeof r){const t=a&&a[r];h="function"==typeof t?t(s,n):t}else h="function"==typeof r?r(s,n):r;return"number"!=typeof h&&c.push(u),[e,{event:u,id:i,delay:h},void 0]}function Zt(t,e){const{event:s,delay:n,id:o}=e;"number"!=typeof n||t.defer(()=>{const e=t.self;t.system.scheduler.schedule(e,e,s,n,o)})}function te(t,e){function s(t,e){}return s.type="xstate.raise",s.event=t,s.id=e?.id,s.delay=e?.delay,s.resolve=Yt,s.execute=Zt,s}},19669:(t,e,s)=>{"use strict";s.d(e,{DT:()=>c,Op:()=>a,mj:()=>u}),s(7);var n=s(95747),o=s(23614),i=s(98752),r=s(93009);function c(t,e){const s=(0,n.t)(e);if(!s.some(e=>(0,n.m)(t.type,e))){const e=1===s.length?`type matching "${s[0]}"`:`one of types matching "${s.join('", "')}"`;throw new Error(`Expected event ${JSON.stringify(t)} to have ${e}`)}}function a(t,e){return new o.S(t,e)}function u({schemas:t,actors:e,actions:s,guards:o,delays:c}){return{assign:i.a,sendTo:r.s,raise:n.r,log:r.l,cancel:n.a,stopChild:n.s,enqueueActions:r.e,emit:r.a,spawnChild:n.b,createStateConfig:t=>t,createAction:t=>t,createMachine:n=>a({...n,schemas:t},{actors:e,actions:s,guards:o,delays:c}),extend:n=>u({schemas:t,actors:e,actions:{...s,...n.actions},guards:{...o,...n.guards},delays:{...c,...n.delays}})}}}}]);