<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">import{a as mt,b as Zt,c as Vt,d as Te,e as Ne,f as je,g as Pe,k as Yt,n as Le}from"https://st-p.rmcdn1.net/25c090b1/dist/c/c-GMOCWGZ2.js";import{c as Ae}from"https://st-p.rmcdn1.net/25c090b1/dist/c/c-4YQWBH3P.js";import{a as ke,f as X}from"https://st-p.rmcdn1.net/25c090b1/dist/c/c-A35UTUZP.js";function Ft(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&amp;&amp;t.indexOf(i)&lt;0&amp;&amp;(n[i]=e[i]);if(e!=null&amp;&amp;typeof Object.getOwnPropertySymbols=="function")for(var r=0,i=Object.getOwnPropertySymbols(e);r&lt;i.length;r++)t.indexOf(i[r])&lt;0&amp;&amp;Object.prototype.propertyIsEnumerable.call(e,i[r])&amp;&amp;(n[i[r]]=e[i[r]]);return n}function E(e){var t=typeof Symbol=="function"&amp;&amp;Symbol.iterator,n=t&amp;&amp;e[t],i=0;if(n)return n.call(e);if(e&amp;&amp;typeof e.length=="number")return{next:function(){return e&amp;&amp;i&gt;=e.length&amp;&amp;(e=void 0),{value:e&amp;&amp;e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function O(e,t){var n=typeof Symbol=="function"&amp;&amp;e[Symbol.iterator];if(!n)return e;var i=n.call(e),r,o=[],a;try{for(;(t===void 0||t-- &gt;0)&amp;&amp;!(r=i.next()).done;)o.push(r.value)}catch(s){a={error:s}}finally{try{r&amp;&amp;!r.done&amp;&amp;(n=i.return)&amp;&amp;n.call(i)}finally{if(a)throw a.error}}return o}function V(e,t,n){if(n||arguments.length===2)for(var i=0,r=t.length,o;i&lt;r;i++)(o||!(i in t))&amp;&amp;(o||(o=Array.prototype.slice.call(t,0,i)),o[i]=t[i]);return e.concat(o||Array.prototype.slice.call(t))}function Qt(e,t,n){n===void 0&amp;&amp;(n=he);var i=dt(e,n),r=dt(t,n);return A(r)?A(i)?r===i:!1:A(i)?i in r:Object.keys(i).every(function(o){return o in r?Qt(i[o],r[o]):!1})}function le(e){try{return A(e)||typeof e=="number"?"".concat(e):e.type}catch{throw new Error("Events must be strings or objects with a string event.type property.")}}function Bt(e,t){try{return at(e)?e:e.toString().split(t)}catch{throw new Error("'".concat(e,"' is not a valid state path."))}}function ze(e){return typeof e=="object"&amp;&amp;"value"in e&amp;&amp;"context"in e&amp;&amp;"event"in e&amp;&amp;"_event"in e}function dt(e,t){if(ze(e))return e.value;if(at(e))return Nt(e);if(typeof e!="string")return e;var n=Bt(e,t);return Nt(n)}function Nt(e){if(e.length===1)return e[0];for(var t={},n=t,i=0;i&lt;e.length-1;i++)i===e.length-2?n[e[i]]=e[i+1]:(n[e[i]]={},n=n[e[i]]);return t}function ut(e,t){for(var n={},i=Object.keys(e),r=0;r&lt;i.length;r++){var o=i[r];n[o]=t(e[o],o,e,r)}return n}function ee(e,t,n){var i,r,o={};try{for(var a=E(Object.keys(e)),s=a.next();!s.done;s=a.next()){var c=s.value,u=e[c];n(u)&amp;&amp;(o[c]=t(u,c,e))}}catch(h){i={error:h}}finally{try{s&amp;&amp;!s.done&amp;&amp;(r=a.return)&amp;&amp;r.call(a)}finally{if(i)throw i.error}}return o}function Je(e,t){return function(n){var i,r,o=n;try{for(var a=E(e),s=a.next();!s.done;s=a.next()){var c=s.value;o=o[t][c]}}catch(u){i={error:u}}finally{try{s&amp;&amp;!s.done&amp;&amp;(r=a.return)&amp;&amp;r.call(a)}finally{if(i)throw i.error}}return o}}function Et(e){if(!e)return[[]];if(A(e))return[[e]];var t=I(Object.keys(e).map(function(n){var i=e[n];return typeof i!="string"&amp;&amp;(!i||!Object.keys(i).length)?[[n]]:Et(e[n]).map(function(r){return[n].concat(r)})}));return t}function I(e){var t;return(t=[]).concat.apply(t,V([],O(e),!1))}function fe(e){return at(e)?e:[e]}function U(e){return e===void 0?[]:fe(e)}function jt(e,t,n){var i,r;if(T(e))return e(t,n.data);var o={};try{for(var a=E(Object.keys(e)),s=a.next();!s.done;s=a.next()){var c=s.value,u=e[c];T(u)?o[c]=u(t,n.data):o[c]=u}}catch(h){i={error:h}}finally{try{s&amp;&amp;!s.done&amp;&amp;(r=a.return)&amp;&amp;r.call(a)}finally{if(i)throw i.error}}return o}function qe(e){return/^(done|error)\./.test(e)}function ne(e){return!!(e instanceof Promise||e!==null&amp;&amp;(T(e)||typeof e=="object")&amp;&amp;T(e.then))}function Ue(e){return e!==null&amp;&amp;typeof e=="object"&amp;&amp;"transition"in e&amp;&amp;typeof e.transition=="function"}function $e(e,t){var n,i,r=O([[],[]],2),o=r[0],a=r[1];try{for(var s=E(e),c=s.next();!c.done;c=s.next()){var u=c.value;t(u)?o.push(u):a.push(u)}}catch(h){n={error:h}}finally{try{c&amp;&amp;!c.done&amp;&amp;(i=s.return)&amp;&amp;i.call(s)}finally{if(n)throw n.error}}return[o,a]}function de(e,t){return ut(e.states,function(n,i){if(n){var r=(A(t)?void 0:t[i])||(n?n.current:void 0);if(r)return{current:r,states:de(n,r)}}})}function Fe(e,t){return{current:t,states:de(e,t)}}function ie(e,t,n,i){var r=e&amp;&amp;n.reduce(function(o,a){var s,c,u=a.assignment,h={state:i,action:a,_event:t},f={};if(T(u))f=u(o,t.data,h);else try{for(var l=E(Object.keys(u)),d=l.next();!d.done;d=l.next()){var y=d.value,v=u[y];f[y]=T(v)?v(o,t.data,h):v}}catch(_){s={error:_}}finally{try{d&amp;&amp;!d.done&amp;&amp;(c=l.return)&amp;&amp;c.call(l)}finally{if(s)throw s.error}}return Object.assign({},o,f)},e);return r}function at(e){return Array.isArray(e)}function T(e){return typeof e=="function"}function A(e){return typeof e=="string"}function ve(e,t){if(e)return A(e)?{type:zt,name:e,predicate:t?t[e]:void 0}:T(e)?{type:zt,name:e.name,predicate:e}:e}function Qe(e){try{return"subscribe"in e&amp;&amp;T(e.subscribe)}catch{return!1}}function ot(e){return!!e&amp;&amp;"__xstatenode"in e}function He(e){return!!e&amp;&amp;typeof e.send=="function"}function Ct(e,t){return A(e)||typeof e=="number"?p({type:e},t):e}function R(e,t){if(!A(e)&amp;&amp;"$$type"in e&amp;&amp;e.$$type==="scxml")return e;var n=Ct(e);return p({name:n.type,data:n,$$type:"scxml",type:"external"},t)}function Y(e,t){var n=fe(t).map(function(i){return typeof i&gt;"u"||typeof i=="string"||ot(i)?{target:i,event:e}:p(p({},i),{event:e})});return n}function We(e){if(!(e===void 0||e===Re))return U(e)}function pe(e,t,n,i,r){var o=e.options.guards,a={state:r,cond:t,_event:i};if(t.type===zt)return(o?.[t.name]||t.predicate)(n,i.data,a);var s=o?.[t.type];if(!s)throw new Error("Guard '".concat(t.type,"' is not implemented on machine '").concat(e.id,"'."));return s(n,i.data,a)}function ye(e){return typeof e=="string"?{type:e}:e}function Ot(e,t,n){var i=function(){},r=typeof e=="object",o=r?e:null;return{next:((r?e.next:e)||i).bind(o),error:((r?e.error:t)||i).bind(o),complete:((r?e.complete:n)||i).bind(o)}}function bt(e,t){return"".concat(e,":invocation[").concat(t,"]")}function Jt(e){return(e.type===yt||e.type===Lt&amp;&amp;e.to===rt.Internal)&amp;&amp;typeof e.delay!="number"}function qt(e,t){return t&amp;&amp;t[e]||void 0}function vt(e,t){var n;if(A(e)||typeof e=="number"){var i=qt(e,t);T(i)?n={type:e,exec:i}:i?n=i:n={type:e,exec:void 0}}else if(T(e))n={type:e.name||e.toString(),exec:e};else{var i=qt(e.type,t);if(T(i))n=p(p({},e),{exec:i});else if(i){var r=i.type||e.type;n=p(p(p({},i),e),{type:r})}else n=e}return n}function Ht(e){var t=vt(e);return p(p({id:A(e)?e:t.id},t),{type:t.type})}function Ke(e,t){return{type:yt,event:typeof e=="function"?e:Ct(e),delay:t?t.delay:void 0,id:t?.id}}function Ze(e,t,n,i){var r={_event:n},o=R(T(e.event)?e.event(t,n.data,r):e.event),a;if(A(e.delay)){var s=i&amp;&amp;i[e.delay];a=T(s)?s(t,n.data,r):s}else a=T(e.delay)?e.delay(t,n.data,r):e.delay;return p(p({},e),{type:yt,_event:o,delay:a})}function Ye(e,t){return{to:t?t.to:void 0,type:Lt,event:T(e)?e:Ct(e),delay:t?t.delay:void 0,id:t&amp;&amp;t.id!==void 0?t.id:T(e)?e.name:le(e)}}function Ge(e,t,n,i){var r={_event:n},o=R(T(e.event)?e.event(t,n.data,r):e.event),a;if(A(e.delay)){var s=i&amp;&amp;i[e.delay];a=T(s)?s(t,n.data,r):s}else a=T(e.delay)?e.delay(t,n.data,r):e.delay;var c=T(e.to)?e.to(t,n.data,r):e.to;return p(p({},e),{to:c,_event:o,event:o.data,delay:a})}function nn(e){var t=Ht(e);return{type:P.Start,activity:t,exec:void 0}}function rn(e){var t=T(e)?e:Ht(e);return{type:P.Stop,activity:t,exec:void 0}}function on(e,t,n){var i=T(e.activity)?e.activity(t,n.data):e.activity,r=typeof i=="string"?{id:i}:i,o={type:P.Stop,activity:r};return o}function an(e,t){var n=t?"#".concat(t):"";return"".concat(P.After,"(").concat(e,")").concat(n)}function xt(e,t){var n="".concat(P.DoneState,".").concat(e),i={type:n,data:t};return i.toString=function(){return n},i}function kt(e,t){var n="".concat(P.DoneInvoke,".").concat(e),i={type:n,data:t};return i.toString=function(){return n},i}function ht(e,t){var n="".concat(P.ErrorPlatform,".").concat(e),i={type:n,data:t};return i.toString=function(){return n},i}function At(e,t,n,i,r,o,a){a===void 0&amp;&amp;(a=!1);var s=a?[]:sn(r),c=s.length?ie(n,i,s,t):n,u=a?[n]:void 0,h=[];function f(y,v){var _;switch(v.type){case yt:{var g=Ze(v,c,i,e.options.delays);return o&amp;&amp;typeof g.delay=="number"&amp;&amp;o(g,c,i),g}case Lt:var m=Ge(v,c,i,e.options.delays);return o&amp;&amp;m.to!==rt.Internal&amp;&amp;(y==="entry"?h.push(m):o(m,c,i)),m;case ce:{var b=tn(v,c,i);return o?.(b,c,i),b}case Me:{var S=v,N=(_=S.conds.find(function(gt){var $=ve(gt.cond,e.options.guards);return!$||pe(e,$,c,i,o?void 0:t)}))===null||_===void 0?void 0:_.actions;if(!N)return[];var C=O(At(e,t,c,i,[{type:y,actions:H(U(N),e.options.actions)}],o,a),2),k=C[0],L=C[1];return c=L,u?.push(c),k}case De:{var N=v.get(c,i.data);if(!N)return[];var w=O(At(e,t,c,i,[{type:y,actions:H(U(N),e.options.actions)}],o,a),2),M=w[0],x=w[1];return c=x,u?.push(c),M}case Xt:{var b=on(v,c,i);return o?.(b,n,i),b}case se:{c=ie(c,i,[v],o?void 0:t),u?.push(c);break}default:var j=vt(v,e.options.actions),z=j.exec;if(o)o(j,c,i);else if(z&amp;&amp;u){var B=u.length-1,st=p(p({},j),{exec:function(gt){for(var $=[],W=1;W&lt;arguments.length;W++)$[W-1]=arguments[W];z.apply(void 0,V([u[B]],O($),!1))}});j=st}return j}}function l(y){var v,_,g=[];try{for(var m=E(y.actions),b=m.next();!b.done;b=m.next()){var S=b.value,N=f(y.type,S);N&amp;&amp;(g=g.concat(N))}}catch(C){v={error:C}}finally{try{b&amp;&amp;!b.done&amp;&amp;(_=m.return)&amp;&amp;_.call(m)}finally{if(v)throw v.error}}return h.forEach(function(C){o(C,c,i)}),h.length=0,g}var d=I(r.map(l));return[d,c]}function ge(e){var t;return t={id:e,send:function(){},subscribe:function(){return{unsubscribe:function(){}}},getSnapshot:function(){},toJSON:function(){return{id:e}}},t[Q]=function(){return this},t}function cn(e,t,n,i){var r,o=ye(e.src),a=(r=t?.options.services)===null||r===void 0?void 0:r[o.type],s=e.data?jt(e.data,n,i):void 0,c=a?me(a,e.id,s):ge(e.id);return c.meta=e,c}function me(e,t,n){var i=ge(t);if(i.deferred=!0,ot(e)){var r=i.state=et(void 0,function(){return(n?e.withContext(n):e).initialState});i.getSnapshot=function(){return r}}return i}function un(e){try{return typeof e.send=="function"}catch{return!1}}function hn(e){return un(e)&amp;&amp;"id"in e}function ln(e){var t;return p((t={subscribe:function(){return{unsubscribe:function(){}}},id:"anonymous",getSnapshot:function(){}},t[Q]=function(){return this},t),e)}function _e(e){return Object.keys(e.states).map(function(t){return e.states[t]})}function pt(e){return _e(e).filter(function(t){return t.type!=="history"})}function be(e){var t=[e];return Pt(e)?t:t.concat(I(pt(e).map(be)))}function lt(e,t){var n,i,r,o,a,s,c,u,h=new Set(e),f=Ut(h),l=new Set(t);try{for(var d=E(l),y=d.next();!y.done;y=d.next())for(var v=y.value,_=v.parent;_&amp;&amp;!l.has(_);)l.add(_),_=_.parent}catch(w){n={error:w}}finally{try{y&amp;&amp;!y.done&amp;&amp;(i=d.return)&amp;&amp;i.call(d)}finally{if(n)throw n.error}}var g=Ut(l);try{for(var m=E(l),b=m.next();!b.done;b=m.next()){var v=b.value;if(v.type==="compound"&amp;&amp;(!g.get(v)||!g.get(v).length))f.get(v)?f.get(v).forEach(function(M){return l.add(M)}):v.initialStateNodes.forEach(function(M){return l.add(M)});else if(v.type==="parallel")try{for(var S=(a=void 0,E(pt(v))),N=S.next();!N.done;N=S.next()){var C=N.value;l.has(C)||(l.add(C),f.get(C)?f.get(C).forEach(function(M){return l.add(M)}):C.initialStateNodes.forEach(function(M){return l.add(M)}))}}catch(M){a={error:M}}finally{try{N&amp;&amp;!N.done&amp;&amp;(s=S.return)&amp;&amp;s.call(S)}finally{if(a)throw a.error}}}}catch(w){r={error:w}}finally{try{b&amp;&amp;!b.done&amp;&amp;(o=m.return)&amp;&amp;o.call(m)}finally{if(r)throw r.error}}try{for(var k=E(l),L=k.next();!L.done;L=k.next())for(var v=L.value,_=v.parent;_&amp;&amp;!l.has(_);)l.add(_),_=_.parent}catch(w){c={error:w}}finally{try{L&amp;&amp;!L.done&amp;&amp;(u=k.return)&amp;&amp;u.call(k)}finally{if(c)throw c.error}}return l}function xe(e,t){var n=t.get(e);if(!n)return{};if(e.type==="compound"){var i=n[0];if(i){if(Pt(i))return i.key}else return{}}var r={};return n.forEach(function(o){r[o.key]=xe(o,t)}),r}function Ut(e){var t,n,i=new Map;try{for(var r=E(e),o=r.next();!o.done;o=r.next()){var a=o.value;i.has(a)||i.set(a,[]),a.parent&amp;&amp;(i.has(a.parent)||i.set(a.parent,[]),i.get(a.parent).push(a))}}catch(s){t={error:s}}finally{try{o&amp;&amp;!o.done&amp;&amp;(n=r.return)&amp;&amp;n.call(r)}finally{if(t)throw t.error}}return i}function fn(e,t){var n=lt([e],t);return xe(e,Ut(n))}function ft(e,t){return Array.isArray(e)?e.some(function(n){return n===t}):e instanceof Set?e.has(t):!1}function dn(e){return V([],O(new Set(I(V([],O(e.map(function(t){return t.ownEvents})),!1)))),!1)}function Tt(e,t){return t.type==="compound"?pt(t).some(function(n){return n.type==="final"&amp;&amp;ft(e,n)}):t.type==="parallel"?pt(t).every(function(n){return Tt(e,n)}):!1}function vn(e){return e===void 0&amp;&amp;(e=[]),e.reduce(function(t,n){return n.meta!==void 0&amp;&amp;(t[n.id]=n.meta),t},{})}function re(e){return new Set(I(e.map(function(t){return t.tags})))}function Se(e,t){if(e===t)return!0;if(e===void 0||t===void 0)return!1;if(A(e)||A(t))return e===t;var n=Object.keys(e),i=Object.keys(t);return n.length===i.length&amp;&amp;n.every(function(r){return Se(e[r],t[r])})}function pn(e){return typeof e!="object"||e===null?!1:"value"in e&amp;&amp;"_event"in e}function yn(e,t){var n=e.exec,i=p(p({},e),{exec:n!==void 0?function(){return n(t.context,t.event,{action:e,state:t,_event:t._event})}:void 0});return i}function Wt(){if(typeof globalThis&lt;"u")return globalThis;if(typeof self&lt;"u")return self;if(typeof window&lt;"u"||typeof window&lt;"u")return window}function _n(){var e=Wt();if(e&amp;&amp;"__xstate__"in e)return e.__xstate__}function bn(e){if(Wt()){var t=_n();t&amp;&amp;t.register(e)}}function xn(e,t){t===void 0&amp;&amp;(t={});var n=e.initialState,i=new Set,r=[],o=!1,a=function(){if(!o){for(o=!0;r.length&gt;0;){var u=r.shift();n=e.transition(n,u,c),i.forEach(function(h){return h.next(n)})}o=!1}},s=ln({id:t.id,send:function(u){r.push(u),a()},getSnapshot:function(){return n},subscribe:function(u,h,f){var l=Ot(u,h,f);return i.add(l),l.next(n),{unsubscribe:function(){i.delete(l)}}}}),c={parent:t.parent,self:s,id:t.id||"anonymous",observers:i};return n=e.start?e.start(c):n,s}function we(e,t){var n=new wn(e,t);return n}function En(e){if(typeof e=="string"){var t={type:e};return t.toString=function(){return e},t}return e}function St(e){return p(p({type:Rt},e),{toJSON:function(){e.onDone,e.onError;var t=Ft(e,["onDone","onError"]);return p(p({},t),{type:Rt,src:En(e.src)})}})}function Tn(e,t){return new kn(e,t)}var p,P,rt,Dt,Xt,yt,Lt,ae,Ce,se,ce,Ve,Rt,Gt,Ie,ue,Me,De,he,te,zt,Re,_t,Be,Xe,Q,it,H,tn,en,sn,et,Pt,F,gn,oe,It,mn,ct,Sn,D,wn,wt,$t,Mt,G,tt,On,kn,nt,Nn,Mn,jn=ke(()=&gt;{Le();Ne();Pe();je();Te();Ae();p=function(){return p=Object.assign||function(e){for(var t,n=1,i=arguments.length;n&lt;i;n++){t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&amp;&amp;(e[r]=t[r])}return e},p.apply(this,arguments)};(function(e){e.Start="xstate.start",e.Stop="xstate.stop",e.Raise="xstate.raise",e.Send="xstate.send",e.Cancel="xstate.cancel",e.NullEvent="",e.Assign="xstate.assign",e.After="xstate.after",e.DoneState="done.state",e.DoneInvoke="done.invoke",e.Log="xstate.log",e.Init="xstate.init",e.Invoke="xstate.invoke",e.ErrorExecution="error.execution",e.ErrorCommunication="error.communication",e.ErrorPlatform="error.platform",e.ErrorCustom="xstate.error",e.Update="xstate.update",e.Pure="xstate.pure",e.Choose="xstate.choose"})(P||(P={}));(function(e){e.Parent="#_parent",e.Internal="#_internal"})(rt||(rt={}));Dt=P.Start,Xt=P.Stop,yt=P.Raise,Lt=P.Send,ae=P.Cancel,Ce=P.NullEvent,se=P.Assign;P.After;P.DoneState;ce=P.Log,Ve=P.Init,Rt=P.Invoke;P.ErrorExecution;Gt=P.ErrorPlatform,Ie=P.ErrorCustom,ue=P.Update,Me=P.Choose,De=P.Pure,he=".",te={},zt="xstate.guard",Re="";Be=function(e){return function(t){var n,i,r=t;try{for(var o=E(e),a=o.next();!a.done;a=o.next()){var s=a.value;r=r[s]}}catch(c){n={error:c}}finally{try{a&amp;&amp;!a.done&amp;&amp;(i=o.return)&amp;&amp;i.call(o)}finally{if(n)throw n.error}}return r}};Xe=function(){};Q=function(){return typeof Symbol=="function"&amp;&amp;Symbol.observable||"@@observable"}();_t={},_t[Q]=function(){return this},_t[Symbol.observable]=function(){return this};it=R({type:Ve});H=function(e,t){if(!e)return[];var n=at(e)?e:[e];return n.map(function(i){return vt(i,t)})};tn=function(e,t,n){return p(p({},e),{value:A(e.expr)?e.expr:e.expr(t,n.data,{_event:n})})},en=function(e){return{type:ae,sendId:e}};sn=function(e){var t,n,i=[];try{for(var r=E(e),o=r.next();!o.done;o=r.next())for(var a=o.value,s=0;s&lt;a.actions.length;){if(a.actions[s].type===se){i.push(a.actions[s]),a.actions.splice(s,1);continue}s++}}catch(c){t={error:c}}finally{try{o&amp;&amp;!o.done&amp;&amp;(n=r.return)&amp;&amp;n.call(r)}finally{if(t)throw t.error}}return i};et=function(e,t){var n=t(e);return n};Pt=function(e){return e.type==="atomic"||e.type==="final"};F=function(){function e(t){var n=this,i;this.actions=[],this.activities=te,this.meta={},this.events=[],this.value=t.value,this.context=t.context,this._event=t._event,this._sessionid=t._sessionid,this.event=this._event.data,this.historyValue=t.historyValue,this.history=t.history,this.actions=t.actions||[],this.activities=t.activities||te,this.meta=vn(t.configuration),this.events=t.events||[],this.matches=this.matches.bind(this),this.toStrings=this.toStrings.bind(this),this.configuration=t.configuration,this.transitions=t.transitions,this.children=t.children,this.done=!!t.done,this.tags=(i=Array.isArray(t.tags)?new Set(t.tags):t.tags)!==null&amp;&amp;i!==void 0?i:new Set,this.machine=t.machine,Object.defineProperty(this,"nextEvents",{get:function(){return dn(n.configuration)}})}return e.from=function(t,n){if(t instanceof e)return t.context!==n?new e({value:t.value,context:n,_event:t._event,_sessionid:null,historyValue:t.historyValue,history:t.history,actions:[],activities:t.activities,meta:{},events:[],configuration:[],transitions:[],children:{}}):t;var i=it;return new e({value:t,context:n,_event:i,_sessionid:null,historyValue:void 0,history:void 0,actions:[],activities:void 0,meta:void 0,events:[],configuration:[],transitions:[],children:{}})},e.create=function(t){return new e(t)},e.inert=function(t,n){if(t instanceof e){if(!t.actions.length)return t;var i=it;return new e({value:t.value,context:n,_event:i,_sessionid:null,historyValue:t.historyValue,history:t.history,activities:t.activities,configuration:t.configuration,transitions:[],children:{}})}return e.from(t,n)},e.prototype.toStrings=function(t,n){var i=this;if(t===void 0&amp;&amp;(t=this.value),n===void 0&amp;&amp;(n="."),A(t))return[t];var r=Object.keys(t);return r.concat.apply(r,V([],O(r.map(function(o){return i.toStrings(t[o],n).map(function(a){return o+n+a})})),!1))},e.prototype.toJSON=function(){var t=this;t.configuration,t.transitions;var n=t.tags;t.machine;var i=Ft(t,["configuration","transitions","tags","machine"]);return p(p({},i),{tags:Array.from(n)})},e.prototype.matches=function(t){return Qt(t,this.value)},e.prototype.hasTag=function(t){return this.tags.has(t)},e.prototype.can=function(t){var n;Xe(!!this.machine);var i=(n=this.machine)===null||n===void 0?void 0:n.getTransitionData(this,t);return!!(i!=null&amp;&amp;i.transitions.length)&amp;&amp;i.transitions.some(function(r){return r.target!==void 0||r.actions.length})},e}(),gn={deferEvents:!1},oe=function(){function e(t){this.processingEvent=!1,this.queue=[],this.initialized=!1,this.options=p(p({},gn),t)}return e.prototype.initialize=function(t){if(this.initialized=!0,t){if(!this.options.deferEvents){this.schedule(t);return}this.process(t)}this.flushEvents()},e.prototype.schedule=function(t){if(!this.initialized||this.processingEvent){this.queue.push(t);return}if(this.queue.length!==0)throw new Error("Event queue should be empty when it is not processing events");this.process(t),this.flushEvents()},e.prototype.clear=function(){this.queue=[]},e.prototype.flushEvents=function(){for(var t=this.queue.shift();t;)this.process(t),t=this.queue.shift()},e.prototype.process=function(t){this.processingEvent=!0;try{t()}catch(n){throw this.clear(),n}finally{this.processingEvent=!1}},e}(),It=new Map,mn=0,ct={bookId:function(){return"x:".concat(mn++)},register:function(e,t){return It.set(e,t),e},get:function(e){return It.get(e)},free:function(e){It.delete(e)}};Sn={sync:!1,autoForward:!1};(function(e){e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped"})(D||(D={}));wn=function(){function e(t,n){n===void 0&amp;&amp;(n=e.defaultOptions);var i=this;this.machine=t,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=D.NotStarted,this.children=new Map,this.forwardTo=new Set,this._outgoingQueue=[],this.init=this.start,this.send=function(h,f){if(at(h))return i.batch(h),i.state;var l=R(Ct(h,f));if(i.status===D.Stopped)return i.state;if(i.status!==D.Running&amp;&amp;!i.options.deferEvents)throw new Error('Event "'.concat(l.name,'" was sent to uninitialized service "').concat(i.machine.id,`". Make sure .start() is called for this service, or set { deferEvents: true } in the service options.
Event: `).concat(JSON.stringify(l.data)));return i.scheduler.schedule(function(){i.forward(l);var d=i._nextState(l);i.update(d,l)}),i._state},this.sendTo=function(h,f,l){var d=i.parent&amp;&amp;(f===rt.Parent||i.parent.id===f),y=d?i.parent:A(f)?f===rt.Internal?i:i.children.get(f)||ct.get(f):He(f)?f:void 0;if(!y){if(!d)throw new Error("Unable to send event to child '".concat(f,"' from service '").concat(i.id,"'."));return}if("machine"in y){if(i.status!==D.Stopped||i.parent!==y||i.state.done){var v=p(p({},h),{name:h.name===Ie?"".concat(ht(i.id)):h.name,origin:i.sessionId});!l&amp;&amp;i.machine.config.predictableActionArguments?i._outgoingQueue.push([y,v]):y.send(v)}}else!l&amp;&amp;i.machine.config.predictableActionArguments?i._outgoingQueue.push([y,h.data]):y.send(h.data)},this._exec=function(h,f,l,d){d===void 0&amp;&amp;(d=i.machine.options.actions);var y=h.exec||qt(h.type,d),v=T(y)?y:y?y.exec:h.exec;if(v)try{return v(f,l.data,i.machine.config.predictableActionArguments?{action:h,_event:l}:{action:h,state:i.state,_event:l})}catch(B){throw i.parent&amp;&amp;i.parent.send({type:"xstate.error",data:B}),B}switch(h.type){case yt:{var _=h;i.defer(_);break}case Lt:var g=h;if(typeof g.delay=="number"){i.defer(g);return}else g.to?i.sendTo(g._event,g.to,l===it):i.send(g._event);break;case ae:i.cancel(h.sendId);break;case Dt:{if(i.status!==D.Running)return;var m=h.activity;if(!i.machine.config.predictableActionArguments&amp;&amp;!i.state.activities[m.id||m.type])break;if(m.type===P.Invoke){var b=ye(m.src),S=i.machine.options.services?i.machine.options.services[b.type]:void 0,N=m.id,C=m.data,k="autoForward"in m?m.autoForward:!!m.forward;if(!S)return;var L=C?jt(C,f,l):void 0;if(typeof S=="string")return;var w=T(S)?S(f,l.data,{data:L,src:b,meta:m.meta}):S;if(!w)return;var M=void 0;ot(w)&amp;&amp;(w=L?w.withContext(L):w,M={autoForward:k}),i.spawn(w,N,M)}else i.spawnActivity(m);break}case Xt:{i.stopChild(h.activity.id);break}case ce:var x=h,j=x.label,z=x.value;j?i.logger(j,z):i.logger(z);break}};var r=p(p({},e.defaultOptions),n),o=r.clock,a=r.logger,s=r.parent,c=r.id,u=c!==void 0?c:t.id;this.id=u,this.logger=a,this.clock=o,this.parent=s,this.options=r,this.scheduler=new oe({deferEvents:this.options.deferEvents}),this.sessionId=ct.bookId()}return Object.defineProperty(e.prototype,"initialState",{get:function(){var t=this;return this._initialState?this._initialState:et(this,function(){return t._initialState=t.machine.initialState,t._initialState})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),e.prototype.execute=function(t,n){var i,r;try{for(var o=E(t.actions),a=o.next();!a.done;a=o.next()){var s=a.value;this.exec(s,t,n)}}catch(c){i={error:c}}finally{try{a&amp;&amp;!a.done&amp;&amp;(r=o.return)&amp;&amp;r.call(o)}finally{if(i)throw i.error}}},e.prototype.update=function(t,n){var i,r,o,a,s,c,u,h,f=this;if(t._sessionid=this.sessionId,this._state=t,(!this.machine.config.predictableActionArguments||n===it)&amp;&amp;this.options.execute)this.execute(this.state);else for(var l=void 0;l=this._outgoingQueue.shift();)l[0].send(l[1]);if(this.children.forEach(function(w){f.state.children[w.id]=w}),this.devTools&amp;&amp;this.devTools.send(n.data,t),t.event)try{for(var d=E(this.eventListeners),y=d.next();!y.done;y=d.next()){var v=y.value;v(t.event)}}catch(w){i={error:w}}finally{try{y&amp;&amp;!y.done&amp;&amp;(r=d.return)&amp;&amp;r.call(d)}finally{if(i)throw i.error}}try{for(var _=E(this.listeners),g=_.next();!g.done;g=_.next()){var v=g.value;v(t,t.event)}}catch(w){o={error:w}}finally{try{g&amp;&amp;!g.done&amp;&amp;(a=_.return)&amp;&amp;a.call(_)}finally{if(o)throw o.error}}try{for(var m=E(this.contextListeners),b=m.next();!b.done;b=m.next()){var S=b.value;S(this.state.context,this.state.history?this.state.history.context:void 0)}}catch(w){s={error:w}}finally{try{b&amp;&amp;!b.done&amp;&amp;(c=m.return)&amp;&amp;c.call(m)}finally{if(s)throw s.error}}if(this.state.done){var N=t.configuration.find(function(w){return w.type==="final"&amp;&amp;w.parent===f.machine}),C=N&amp;&amp;N.doneData?jt(N.doneData,t.context,n):void 0;this._doneEvent=kt(this.id,C);try{for(var k=E(this.doneListeners),L=k.next();!L.done;L=k.next()){var v=L.value;v(this._doneEvent)}}catch(w){u={error:w}}finally{try{L&amp;&amp;!L.done&amp;&amp;(h=k.return)&amp;&amp;h.call(k)}finally{if(u)throw u.error}}this._stop(),this._stopChildren(),ct.free(this.sessionId)}},e.prototype.onTransition=function(t){return this.listeners.add(t),this.status===D.Running&amp;&amp;t(this.state,this.state.event),this},e.prototype.subscribe=function(t,n,i){var r=this,o=Ot(t,n,i);this.listeners.add(o.next),this.status!==D.NotStarted&amp;&amp;o.next(this.state);var a=function(){r.doneListeners.delete(a),r.stopListeners.delete(a),o.complete()};return this.status===D.Stopped?o.complete():(this.onDone(a),this.onStop(a)),{unsubscribe:function(){r.listeners.delete(o.next),r.doneListeners.delete(a),r.stopListeners.delete(a)}}},e.prototype.onEvent=function(t){return this.eventListeners.add(t),this},e.prototype.onSend=function(t){return this.sendListeners.add(t),this},e.prototype.onChange=function(t){return this.contextListeners.add(t),this},e.prototype.onStop=function(t){return this.stopListeners.add(t),this},e.prototype.onDone=function(t){return this.status===D.Stopped&amp;&amp;this._doneEvent?t(this._doneEvent):this.doneListeners.add(t),this},e.prototype.off=function(t){return this.listeners.delete(t),this.eventListeners.delete(t),this.sendListeners.delete(t),this.stopListeners.delete(t),this.doneListeners.delete(t),this.contextListeners.delete(t),this},e.prototype.start=function(t){var n=this;if(this.status===D.Running)return this;this.machine._init(),ct.register(this.sessionId,this),this.initialized=!0,this.status=D.Running;var i=t===void 0?this.initialState:et(this,function(){return pn(t)?n.machine.resolveState(t):n.machine.resolveState(F.from(t,n.machine.context))});return this.options.devTools&amp;&amp;this.attachDev(),this.scheduler.initialize(function(){n.update(i,it)}),this},e.prototype._stopChildren=function(){this.children.forEach(function(t){T(t.stop)&amp;&amp;t.stop()}),this.children.clear()},e.prototype._stop=function(){var t,n,i,r,o,a,s,c,u,h;try{for(var f=E(this.listeners),l=f.next();!l.done;l=f.next()){var d=l.value;this.listeners.delete(d)}}catch(k){t={error:k}}finally{try{l&amp;&amp;!l.done&amp;&amp;(n=f.return)&amp;&amp;n.call(f)}finally{if(t)throw t.error}}try{for(var y=E(this.stopListeners),v=y.next();!v.done;v=y.next()){var d=v.value;d(),this.stopListeners.delete(d)}}catch(k){i={error:k}}finally{try{v&amp;&amp;!v.done&amp;&amp;(r=y.return)&amp;&amp;r.call(y)}finally{if(i)throw i.error}}try{for(var _=E(this.contextListeners),g=_.next();!g.done;g=_.next()){var d=g.value;this.contextListeners.delete(d)}}catch(k){o={error:k}}finally{try{g&amp;&amp;!g.done&amp;&amp;(a=_.return)&amp;&amp;a.call(_)}finally{if(o)throw o.error}}try{for(var m=E(this.doneListeners),b=m.next();!b.done;b=m.next()){var d=b.value;this.doneListeners.delete(d)}}catch(k){s={error:k}}finally{try{b&amp;&amp;!b.done&amp;&amp;(c=m.return)&amp;&amp;c.call(m)}finally{if(s)throw s.error}}if(!this.initialized)return this;this.initialized=!1,this.status=D.Stopped,this._initialState=void 0;try{for(var S=E(Object.keys(this.delayedEventsMap)),N=S.next();!N.done;N=S.next()){var C=N.value;this.clock.clearTimeout(this.delayedEventsMap[C])}}catch(k){u={error:k}}finally{try{N&amp;&amp;!N.done&amp;&amp;(h=S.return)&amp;&amp;h.call(S)}finally{if(u)throw u.error}}this.scheduler.clear(),this.scheduler=new oe({deferEvents:this.options.deferEvents})},e.prototype.stop=function(){var t=this,n=this.scheduler;return this._stop(),n.schedule(function(){var i=R({type:"xstate.stop"}),r=et(t,function(){var o=I(V([],O(t.state.configuration),!1).sort(function(h,f){return f.order-h.order}).map(function(h){return H(h.onExit,t.machine.options.actions)})),a=O(At(t.machine,t.state,t.state.context,i,[{type:"exit",actions:o}],t.machine.config.predictableActionArguments?t._exec:void 0,t.machine.config.predictableActionArguments||t.machine.config.preserveActionOrder),2),s=a[0],c=a[1],u=new F({value:t.state.value,context:c,_event:i,_sessionid:t.sessionId,historyValue:void 0,history:t.state,actions:s.filter(function(h){return!Jt(h)}),activities:{},events:[],configuration:[],transitions:[],children:{},done:t.state.done,tags:t.state.tags,machine:t.machine});return u.changed=!0,u});t.update(r,i),t._stopChildren(),ct.free(t.sessionId)}),this},e.prototype.batch=function(t){var n=this;if(!(this.status===D.NotStarted&amp;&amp;this.options.deferEvents)){if(this.status!==D.Running)throw new Error("".concat(t.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.'))}if(t.length){var i=!!this.machine.config.predictableActionArguments&amp;&amp;this._exec;this.scheduler.schedule(function(){var r,o,a=n.state,s=!1,c=[],u=function(d){var y=R(d);n.forward(y),a=et(n,function(){return n.machine.transition(a,y,void 0,i||void 0)}),c.push.apply(c,V([],O(n.machine.config.predictableActionArguments?a.actions:a.actions.map(function(v){return yn(v,a)})),!1)),s=s||!!a.changed};try{for(var h=E(t),f=h.next();!f.done;f=h.next()){var l=f.value;u(l)}}catch(d){r={error:d}}finally{try{f&amp;&amp;!f.done&amp;&amp;(o=h.return)&amp;&amp;o.call(h)}finally{if(r)throw r.error}}a.changed=s,a.actions=c,n.update(a,R(t[t.length-1]))})}},e.prototype.sender=function(t){return this.send.bind(this,t)},e.prototype._nextState=function(t,n){var i=this;n===void 0&amp;&amp;(n=!!this.machine.config.predictableActionArguments&amp;&amp;this._exec);var r=R(t);if(r.name.indexOf(Gt)===0&amp;&amp;!this.state.nextEvents.some(function(a){return a.indexOf(Gt)===0}))throw r.data.data;var o=et(this,function(){return i.machine.transition(i.state,r,void 0,n||void 0)});return o},e.prototype.nextState=function(t){return this._nextState(t,!1)},e.prototype.forward=function(t){var n,i;try{for(var r=E(this.forwardTo),o=r.next();!o.done;o=r.next()){var a=o.value,s=this.children.get(a);if(!s)throw new Error("Unable to forward event '".concat(t,"' from interpreter '").concat(this.id,"' to nonexistant child '").concat(a,"'."));s.send(t)}}catch(c){n={error:c}}finally{try{o&amp;&amp;!o.done&amp;&amp;(i=r.return)&amp;&amp;i.call(r)}finally{if(n)throw n.error}}},e.prototype.defer=function(t){var n=this,i=this.clock.setTimeout(function(){"to"in t&amp;&amp;t.to?n.sendTo(t._event,t.to,!0):n.send(t._event)},t.delay);t.id&amp;&amp;(this.delayedEventsMap[t.id]=i)},e.prototype.cancel=function(t){this.clock.clearTimeout(this.delayedEventsMap[t]),delete this.delayedEventsMap[t]},e.prototype.exec=function(t,n,i){i===void 0&amp;&amp;(i=this.machine.options.actions),this._exec(t,n.context,n._event,i)},e.prototype.removeChild=function(t){var n;this.children.delete(t),this.forwardTo.delete(t),(n=this.state)===null||n===void 0||delete n.children[t]},e.prototype.stopChild=function(t){var n=this.children.get(t);n&amp;&amp;(this.removeChild(t),T(n.stop)&amp;&amp;n.stop())},e.prototype.spawn=function(t,n,i){if(this.status!==D.Running)return me(t,n);if(ne(t))return this.spawnPromise(Promise.resolve(t),n);if(T(t))return this.spawnCallback(t,n);if(hn(t))return this.spawnActor(t,n);if(Qe(t))return this.spawnObservable(t,n);if(ot(t))return this.spawnMachine(t,p(p({},i),{id:n}));if(Ue(t))return this.spawnBehavior(t,n);throw new Error('Unable to spawn entity "'.concat(n,'" of type "').concat(typeof t,'".'))},e.prototype.spawnMachine=function(t,n){var i=this;n===void 0&amp;&amp;(n={});var r=new e(t,p(p({},this.options),{parent:this,id:n.id||t.id})),o=p(p({},Sn),n);o.sync&amp;&amp;r.onTransition(function(s){i.send(ue,{state:s,id:r.id})});var a=r;return this.children.set(r.id,a),o.autoForward&amp;&amp;this.forwardTo.add(r.id),r.onDone(function(s){i.removeChild(r.id),i.send(R(s,{origin:r.id}))}).start(),a},e.prototype.spawnBehavior=function(t,n){var i=xn(t,{id:n,parent:this});return this.children.set(n,i),i},e.prototype.spawnPromise=function(t,n){var i,r=this,o=!1,a;t.then(function(c){o||(a=c,r.removeChild(n),r.send(R(kt(n,c),{origin:n})))},function(c){if(!o){r.removeChild(n);var u=ht(n,c);try{r.send(R(u,{origin:n}))}catch{r.devTools&amp;&amp;r.devTools.send(u,r.state),r.machine.strict&amp;&amp;r.stop()}}});var s=(i={id:n,send:function(){},subscribe:function(c,u,h){var f=Ot(c,u,h),l=!1;return t.then(function(d){l||(f.next(d),!l&amp;&amp;f.complete())},function(d){l||f.error(d)}),{unsubscribe:function(){return l=!0}}},stop:function(){o=!0},toJSON:function(){return{id:n}},getSnapshot:function(){return a}},i[Q]=function(){return this},i);return this.children.set(n,s),s},e.prototype.spawnCallback=function(t,n){var i,r=this,o=!1,a=new Set,s=new Set,c,u=function(l){c=l,s.forEach(function(d){return d(l)}),!o&amp;&amp;r.send(R(l,{origin:n}))},h;try{h=t(u,function(l){a.add(l)})}catch(l){this.send(ht(n,l))}if(ne(h))return this.spawnPromise(h,n);var f=(i={id:n,send:function(l){return a.forEach(function(d){return d(l)})},subscribe:function(l){var d=Ot(l);return s.add(d.next),{unsubscribe:function(){s.delete(d.next)}}},stop:function(){o=!0,T(h)&amp;&amp;h()},toJSON:function(){return{id:n}},getSnapshot:function(){return c}},i[Q]=function(){return this},i);return this.children.set(n,f),f},e.prototype.spawnObservable=function(t,n){var i,r=this,o,a=t.subscribe(function(c){o=c,r.send(R(c,{origin:n}))},function(c){r.removeChild(n),r.send(R(ht(n,c),{origin:n}))},function(){r.removeChild(n),r.send(R(kt(n),{origin:n}))}),s=(i={id:n,send:function(){},subscribe:function(c,u,h){return t.subscribe(c,u,h)},stop:function(){return a.unsubscribe()},getSnapshot:function(){return o},toJSON:function(){return{id:n}}},i[Q]=function(){return this},i);return this.children.set(n,s),s},e.prototype.spawnActor=function(t,n){return this.children.set(n,t),t},e.prototype.spawnActivity=function(t){var n=this.machine.options&amp;&amp;this.machine.options.activities?this.machine.options.activities[t.type]:void 0;if(n){var i=n(this.state.context,t);this.spawnEffect(t.id,i)}},e.prototype.spawnEffect=function(t,n){var i;this.children.set(t,(i={id:t,send:function(){},subscribe:function(){return{unsubscribe:function(){}}},stop:n||void 0,getSnapshot:function(){},toJSON:function(){return{id:t}}},i[Q]=function(){return this},i))},e.prototype.attachDev=function(){var t=Wt();if(this.options.devTools&amp;&amp;t){if(t.__REDUX_DEVTOOLS_EXTENSION__){var n=typeof this.options.devTools=="object"?this.options.devTools:void 0;this.devTools=t.__REDUX_DEVTOOLS_EXTENSION__.connect(p(p({name:this.id,autoPause:!0,stateSanitizer:function(i){return{value:i.value,context:i.context,actions:i.actions}}},n),{features:p({jump:!1,skip:!1},n?n.features:void 0)}),this.machine),this.devTools.init(this.state)}bn(this)}},e.prototype.toJSON=function(){return{id:this.id}},e.prototype[Q]=function(){return this},e.prototype.getSnapshot=function(){return this.status===D.NotStarted?this.initialState:this._state},e.defaultOptions={execute:!0,deferEvents:!0,clock:{setTimeout:function(t,n){return setTimeout(t,n)},clearTimeout:function(t){return clearTimeout(t)}},logger:console.log.bind(console),devTools:!1},e.interpret=we,e}();wt="",$t="#",Mt="*",G={},tt=function(e){return e[0]===$t},On=function(){return{actions:{},guards:{},services:{},activities:{},delays:{}}},kn=function(){function e(t,n,i,r){i===void 0&amp;&amp;(i="context"in t?t.context:void 0);var o=this,a;this.config=t,this._context=i,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(On(),n),this.parent=r?.parent,this.key=this.config.key||r?.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:he),this.id=this.config.id||V([this.machine.key],O(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&amp;&amp;Object.keys(this.config.states).length?"compound":this.config.history?"history":"atomic"),this.schema=this.parent?this.machine.schema:(a=this.config.schema)!==null&amp;&amp;a!==void 0?a:{},this.description=this.config.description,this.initial=this.config.initial,this.states=this.config.states?ut(this.config.states,function(u,h){var f,l=new e(u,{},void 0,{parent:o,key:h});return Object.assign(o.idMap,p((f={},f[l.id]=l,f),l.idMap)),l}):G;var s=0;function c(u){var h,f;u.order=s++;try{for(var l=E(_e(u)),d=l.next();!d.done;d=l.next()){var y=d.value;c(y)}}catch(v){h={error:v}}finally{try{d&amp;&amp;!d.done&amp;&amp;(f=l.return)&amp;&amp;f.call(l)}finally{if(h)throw h.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(u){var h=u.event;return h===wt}):wt in this.config.on:!1),this.strict=!!this.config.strict,this.onEntry=U(this.config.entry||this.config.onEntry).map(function(u){return vt(u)}),this.onExit=U(this.config.exit||this.config.onExit).map(function(u){return vt(u)}),this.meta=this.config.meta,this.doneData=this.type==="final"?this.config.data:void 0,this.invoke=U(this.config.invoke).map(function(u,h){var f,l;if(ot(u)){var d=bt(o.id,h);return o.machine.options.services=p((f={},f[d]=u,f),o.machine.options.services),St({src:d,id:d})}else if(A(u.src)){var d=u.id||bt(o.id,h);return St(p(p({},u),{id:d,src:u.src}))}else if(ot(u.src)||T(u.src)){var d=u.id||bt(o.id,h);return o.machine.options.services=p((l={},l[d]=u.src,l),o.machine.options.services),St(p(p({id:d},u),{src:d}))}else{var y=u.src;return St(p(p({id:bt(o.id,h)},u),{src:y}))}}),this.activities=U(this.config.activities).concat(this.invoke).map(function(u){return Ht(u)}),this.transition=this.transition.bind(this),this.tags=U(this.config.tags)}return e.prototype._init=function(){this.__cache.transitions||be(this).forEach(function(t){return t.on})},e.prototype.withConfig=function(t,n){var i=this.options,r=i.actions,o=i.activities,a=i.guards,s=i.services,c=i.delays;return new e(this.config,{actions:p(p({},r),t.actions),activities:p(p({},o),t.activities),guards:p(p({},a),t.guards),services:p(p({},s),t.services),delays:p(p({},c),t.delays)},n??this.context)},e.prototype.withContext=function(t){return new e(this.config,this.options,t)},Object.defineProperty(e.prototype,"context",{get:function(){return T(this._context)?this._context():this._context},enumerable:!1,configurable:!0}),Object.defineProperty(e.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:ut(this.states,function(t){return t.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}),e.prototype.toJSON=function(){return this.definition},Object.defineProperty(e.prototype,"on",{get:function(){if(this.__cache.on)return this.__cache.on;var t=this.transitions;return this.__cache.on=t.reduce(function(n,i){return n[i.eventType]=n[i.eventType]||[],n[i.eventType].push(i),n},{})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"after",{get:function(){return this.__cache.delayedTransitions||(this.__cache.delayedTransitions=this.getDelayedTransitions(),this.__cache.delayedTransitions)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transitions",{get:function(){return this.__cache.transitions||(this.__cache.transitions=this.formatTransitions(),this.__cache.transitions)},enumerable:!1,configurable:!0}),e.prototype.getCandidates=function(t){if(this.__cache.candidates[t])return this.__cache.candidates[t];var n=t===wt,i=this.transitions.filter(function(r){var o=r.eventType===t;return n?o:o||r.eventType===Mt});return this.__cache.candidates[t]=i,i},e.prototype.getDelayedTransitions=function(){var t=this,n=this.config.after;if(!n)return[];var i=function(o,a){var s=T(o)?"".concat(t.id,":delay[").concat(a,"]"):o,c=an(s,t.id);return t.onEntry.push(Ye(c,{delay:o})),t.onExit.push(en(c)),c},r=at(n)?n.map(function(o,a){var s=i(o.delay,a);return p(p({},o),{event:s})}):I(Object.keys(n).map(function(o,a){var s=n[o],c=A(s)?{target:s}:s,u=isNaN(+o)?o:+o,h=i(u,a);return U(c).map(function(f){return p(p({},f),{event:h,delay:u})})}));return r.map(function(o){var a=o.delay;return p(p({},t.formatTransition(o)),{delay:a})})},e.prototype.getStateNodes=function(t){var n,i=this;if(!t)return[];var r=t instanceof F?t.value:dt(t,this.delimiter);if(A(r)){var o=this.getStateNode(r).initial;return o!==void 0?this.getStateNodes((n={},n[r]=o,n)):[this,this.states[r]]}var a=Object.keys(r),s=[this];return s.push.apply(s,V([],O(I(a.map(function(c){return i.getStateNode(c).getStateNodes(r[c])}))),!1)),s},e.prototype.handles=function(t){var n=le(t);return this.events.includes(n)},e.prototype.resolveState=function(t){var n=t instanceof F?t:F.create(t),i=Array.from(lt([],this.getStateNodes(n.value)));return new F(p(p({},n),{value:this.resolve(n.value),configuration:i,done:Tt(i,this),tags:re(i),machine:this.machine}))},e.prototype.transitionLeafNode=function(t,n,i){var r=this.getStateNode(t),o=r.next(n,i);return!o||!o.transitions.length?this.next(n,i):o},e.prototype.transitionCompoundNode=function(t,n,i){var r=Object.keys(t),o=this.getStateNode(r[0]),a=o._transition(t[r[0]],n,i);return!a||!a.transitions.length?this.next(n,i):a},e.prototype.transitionParallelNode=function(t,n,i){var r,o,a={};try{for(var s=E(Object.keys(t)),c=s.next();!c.done;c=s.next()){var u=c.value,h=t[u];if(h){var f=this.getStateNode(u),l=f._transition(h,n,i);l&amp;&amp;(a[u]=l)}}}catch(g){r={error:g}}finally{try{c&amp;&amp;!c.done&amp;&amp;(o=s.return)&amp;&amp;o.call(s)}finally{if(r)throw r.error}}var d=Object.keys(a).map(function(g){return a[g]}),y=I(d.map(function(g){return g.transitions})),v=d.some(function(g){return g.transitions.length&gt;0});if(!v)return this.next(n,i);var _=I(Object.keys(a).map(function(g){return a[g].configuration}));return{transitions:y,exitSet:I(d.map(function(g){return g.exitSet})),configuration:_,source:n,actions:I(Object.keys(a).map(function(g){return a[g].actions}))}},e.prototype._transition=function(t,n,i){return A(t)?this.transitionLeafNode(t,n,i):Object.keys(t).length===1?this.transitionCompoundNode(t,n,i):this.transitionParallelNode(t,n,i)},e.prototype.getTransitionData=function(t,n){return this._transition(t.value,t,R(n))},e.prototype.next=function(t,n){var i,r,o=this,a=n.name,s=[],c=[],u;try{for(var h=E(this.getCandidates(a)),f=h.next();!f.done;f=h.next()){var l=f.value,d=l.cond,y=l.in,v=t.context,_=y?A(y)&amp;&amp;tt(y)?t.matches(dt(this.getStateNodeById(y).path,this.delimiter)):Qt(dt(y,this.delimiter),Be(this.path.slice(0,-2))(t.value)):!0,g=!1;try{g=!d||pe(this.machine,d,v,n,t)}catch(S){throw new Error("Unable to evaluate guard '".concat(d.name||d.type,"' in transition for event '").concat(a,"' in state node '").concat(this.id,`':
`).concat(S.message))}if(g&amp;&amp;_){l.target!==void 0&amp;&amp;(c=l.target),s.push.apply(s,V([],O(l.actions),!1)),u=l;break}}}catch(S){i={error:S}}finally{try{f&amp;&amp;!f.done&amp;&amp;(r=h.return)&amp;&amp;r.call(h)}finally{if(i)throw i.error}}if(u){if(!c.length)return{transitions:[u],exitSet:[],configuration:t.value?[this]:[],source:t,actions:s};var m=I(c.map(function(S){return o.getRelativeStateNodes(S,t.historyValue)})),b=!!u.internal;return{transitions:[u],exitSet:b?[]:I(c.map(function(S){return o.getPotentiallyReenteringNodes(S)})),configuration:m,source:t,actions:s}}},e.prototype.getPotentiallyReenteringNodes=function(t){if(this.order&lt;t.order)return[this];for(var n=[],i=this,r=t;i&amp;&amp;i!==r;)n.push(i),i=i.parent;return i!==r?[]:(n.push(r),n)},e.prototype.getActions=function(t,n,i,r,o,a,s){var c,u,h,f,l=this,d=a?lt([],this.getStateNodes(a.value)):[],y=new Set;try{for(var v=E(Array.from(t).sort(function(x,j){return x.order-j.order})),_=v.next();!_.done;_=v.next()){var g=_.value;(!ft(d,g)||ft(i.exitSet,g)||g.parent&amp;&amp;y.has(g.parent))&amp;&amp;y.add(g)}}catch(x){c={error:x}}finally{try{_&amp;&amp;!_.done&amp;&amp;(u=v.return)&amp;&amp;u.call(v)}finally{if(c)throw c.error}}try{for(var m=E(d),b=m.next();!b.done;b=m.next()){var g=b.value;(!ft(t,g)||ft(i.exitSet,g.parent))&amp;&amp;i.exitSet.push(g)}}catch(x){h={error:x}}finally{try{b&amp;&amp;!b.done&amp;&amp;(f=m.return)&amp;&amp;f.call(m)}finally{if(h)throw h.error}}i.exitSet.sort(function(x,j){return j.order-x.order});var S=Array.from(y).sort(function(x,j){return x.order-j.order}),N=new Set(i.exitSet),C=I(S.map(function(x){var j=[];if(x.type!=="final")return j;var z=x.parent;if(!z.parent)return j;j.push(xt(x.id,x.doneData),xt(z.id,x.doneData?jt(x.doneData,r,o):void 0));var B=z.parent;return B.type==="parallel"&amp;&amp;pt(B).every(function(st){return Tt(i.configuration,st)})&amp;&amp;j.push(xt(B.id)),j})),k=S.map(function(x){var j=x.onEntry,z=x.activities.map(function(B){return nn(B)});return{type:"entry",actions:H(s?V(V([],O(j),!1),O(z),!1):V(V([],O(z),!1),O(j),!1),l.machine.options.actions)}}).concat({type:"state_done",actions:C.map(function(x){return Ke(x)})}),L=Array.from(N).map(function(x){return{type:"exit",actions:H(V(V([],O(x.onExit),!1),O(x.activities.map(function(j){return rn(j)})),!1),l.machine.options.actions)}}),w=L.concat({type:"transition",actions:H(i.actions,this.machine.options.actions)}).concat(k);if(n){var M=H(I(V([],O(t),!1).sort(function(x,j){return j.order-x.order}).map(function(x){return x.onExit})),this.machine.options.actions).filter(function(x){return!Jt(x)});return w.concat({type:"stop",actions:M})}return w},e.prototype.transition=function(t,n,i,r){t===void 0&amp;&amp;(t=this.initialState);var o=R(n),a;if(t instanceof F)a=i===void 0?t:this.resolveState(F.from(t,i));else{var s=A(t)?this.resolve(Nt(this.getResolvedPath(t))):this.resolve(t),c=i??this.machine.context;a=this.resolveState(F.from(s,c))}if(this.strict&amp;&amp;!this.events.includes(o.name)&amp;&amp;!qe(o.name))throw new Error("Machine '".concat(this.id,"' does not accept event '").concat(o.name,"'"));var u=this._transition(a.value,a,o)||{transitions:[],configuration:[],exitSet:[],source:a,actions:[]},h=lt([],this.getStateNodes(a.value)),f=u.configuration.length?lt(h,u.configuration):h;return u.configuration=V([],O(f),!1),this.resolveTransition(u,a,a.context,r,o)},e.prototype.resolveRaisedTransition=function(t,n,i,r){var o,a=t.actions;return t=this.transition(t,n,void 0,r),t._event=i,t.event=i.data,(o=t.actions).unshift.apply(o,V([],O(a),!1)),t},e.prototype.resolveTransition=function(t,n,i,r,o){var a,s,c,u,h=this;o===void 0&amp;&amp;(o=it);var f=t.configuration,l=!n||t.transitions.length&gt;0,d=l?t.configuration:n?n.configuration:[],y=Tt(d,this),v=l?fn(this.machine,f):void 0,_=n?n.historyValue?n.historyValue:t.source?this.machine.historyValue(n.value):void 0:void 0,g=this.getActions(new Set(d),y,t,i,o,n,r),m=n?p({},n.activities):{};try{for(var b=E(g),S=b.next();!S.done;S=b.next()){var N=S.value;try{for(var C=(c=void 0,E(N.actions)),k=C.next();!k.done;k=C.next()){var L=k.value;L.type===Dt?m[L.activity.id||L.activity.type]=L:L.type===Xt&amp;&amp;(m[L.activity.id||L.activity.type]=!1)}}catch(q){c={error:q}}finally{try{k&amp;&amp;!k.done&amp;&amp;(u=C.return)&amp;&amp;u.call(C)}finally{if(c)throw c.error}}}}catch(q){a={error:q}}finally{try{S&amp;&amp;!S.done&amp;&amp;(s=b.return)&amp;&amp;s.call(b)}finally{if(a)throw a.error}}var w=O(At(this,n,i,o,g,r,this.machine.config.predictableActionArguments||this.machine.config.preserveActionOrder),2),M=w[0],x=w[1],j=O($e(M,Jt),2),z=j[0],B=j[1],st=M.filter(function(q){var Z;return q.type===Dt&amp;&amp;((Z=q.activity)===null||Z===void 0?void 0:Z.type)===Rt}),gt=st.reduce(function(q,Z){return q[Z.activity.id]=cn(Z.activity,h.machine,x,o),q},n?p({},n.children):{}),$=new F({value:v||n.value,context:x,_event:o,_sessionid:n?n._sessionid:null,historyValue:v?_?Fe(_,v):void 0:n?n.historyValue:void 0,history:!v||t.source?n:void 0,actions:v?B:[],activities:v?m:n?n.activities:{},events:[],configuration:d,transitions:t.transitions,children:gt,done:y,tags:re(d),machine:this}),W=i!==x;$.changed=o.name===ue||W;var K=$.history;K&amp;&amp;delete K.history;var Kt=!y&amp;&amp;(this._transient||f.some(function(q){return q._transient}));if(!l&amp;&amp;(!Kt||o.name===wt))return $;var J=$;if(!y)for(Kt&amp;&amp;(J=this.resolveRaisedTransition(J,{type:Ce},o,r));z.length;){var Ee=z.shift();J=this.resolveRaisedTransition(J,Ee._event,o,r)}var Oe=J.changed||(K?!!J.actions.length||W||typeof K.value!=typeof J.value||!Se(J.value,K.value):void 0);return J.changed=Oe,J.history=K,J},e.prototype.getStateNode=function(t){if(tt(t))return this.machine.getStateNodeById(t);if(!this.states)throw new Error("Unable to retrieve child state '".concat(t,"' from '").concat(this.id,"'; no child states exist."));var n=this.states[t];if(!n)throw new Error("Child state '".concat(t,"' does not exist on '").concat(this.id,"'"));return n},e.prototype.getStateNodeById=function(t){var n=tt(t)?t.slice($t.length):t;if(n===this.id)return this;var i=this.machine.idMap[n];if(!i)throw new Error("Child state node '#".concat(n,"' does not exist on machine '").concat(this.id,"'"));return i},e.prototype.getStateNodeByPath=function(t){if(typeof t=="string"&amp;&amp;tt(t))try{return this.getStateNodeById(t.slice(1))}catch{}for(var n=Bt(t,this.delimiter).slice(),i=this;n.length;){var r=n.shift();if(!r.length)break;i=i.getStateNode(r)}return i},e.prototype.resolve=function(t){var n,i=this;if(!t)return this.initialStateValue||G;switch(this.type){case"parallel":return ut(this.initialStateValue,function(o,a){return o?i.getStateNode(a).resolve(t[a]||o):G});case"compound":if(A(t)){var r=this.getStateNode(t);return r.type==="parallel"||r.type==="compound"?(n={},n[t]=r.initialStateValue,n):t}return Object.keys(t).length?ut(t,function(o,a){return o?i.getStateNode(a).resolve(o):G}):this.initialStateValue||{};default:return t||G}},e.prototype.getResolvedPath=function(t){if(tt(t)){var n=this.machine.idMap[t.slice($t.length)];if(!n)throw new Error("Unable to find state node '".concat(t,"'"));return n.path}return Bt(t,this.delimiter)},Object.defineProperty(e.prototype,"initialStateValue",{get:function(){var t;if(this.__cache.initialStateValue)return this.__cache.initialStateValue;var n;if(this.type==="parallel")n=ee(this.states,function(i){return i.initialStateValue||G},function(i){return i.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,"'"));n=Pt(this.states[this.initial])?this.initial:(t={},t[this.initial]=this.states[this.initial].initialStateValue,t)}else n={};return this.__cache.initialStateValue=n,this.__cache.initialStateValue},enumerable:!1,configurable:!0}),e.prototype.getInitialState=function(t,n){this._init();var i=this.getStateNodes(t);return this.resolveTransition({configuration:i,exitSet:[],transitions:[],source:void 0,actions:[]},void 0,n??this.machine.context,void 0)},Object.defineProperty(e.prototype,"initialState",{get:function(){var t=this.initialStateValue;if(!t)throw new Error("Cannot retrieve initial state from simple state '".concat(this.id,"'."));return this.getInitialState(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"target",{get:function(){var t;if(this.type==="history"){var n=this.config;A(n.target)?t=tt(n.target)?Nt(this.machine.getStateNodeById(n.target).path.slice(this.path.length-1)):n.target:t=n.target}return t},enumerable:!1,configurable:!0}),e.prototype.getRelativeStateNodes=function(t,n,i){return i===void 0&amp;&amp;(i=!0),i?t.type==="history"?t.resolveHistory(n):t.initialStateNodes:[t]},Object.defineProperty(e.prototype,"initialStateNodes",{get:function(){var t=this;if(Pt(this))return[this];if(this.type==="compound"&amp;&amp;!this.initial)return[this];var n=Et(this.initialStateValue);return I(n.map(function(i){return t.getFromRelativePath(i)}))},enumerable:!1,configurable:!0}),e.prototype.getFromRelativePath=function(t){if(!t.length)return[this];var n=O(t),i=n[0],r=n.slice(1);if(!this.states)throw new Error("Cannot retrieve subPath '".concat(i,"' from node with no states"));var o=this.getStateNode(i);if(o.type==="history")return o.resolveHistory();if(!this.states[i])throw new Error("Child state '".concat(i,"' does not exist on '").concat(this.id,"'"));return this.states[i].getFromRelativePath(r)},e.prototype.historyValue=function(t){if(Object.keys(this.states).length)return{current:t||this.initialStateValue,states:ee(this.states,function(n,i){if(!t)return n.historyValue();var r=A(t)?void 0:t[i];return n.historyValue(r||n.initialStateValue)},function(n){return!n.history})}},e.prototype.resolveHistory=function(t){var n=this;if(this.type!=="history")return[this];var i=this.parent;if(!t){var r=this.target;return r?I(Et(r).map(function(a){return i.getFromRelativePath(a)})):i.initialStateNodes}var o=Je(i.path,"states")(t).current;return A(o)?[i.getStateNode(o)]:I(Et(o).map(function(a){return n.history==="deep"?i.getFromRelativePath(a):[i.states[a[0]]]}))},Object.defineProperty(e.prototype,"stateIds",{get:function(){var t=this,n=I(Object.keys(this.states).map(function(i){return t.states[i].stateIds}));return[this.id].concat(n)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"events",{get:function(){var t,n,i,r;if(this.__cache.events)return this.__cache.events;var o=this.states,a=new Set(this.ownEvents);if(o)try{for(var s=E(Object.keys(o)),c=s.next();!c.done;c=s.next()){var u=c.value,h=o[u];if(h.states)try{for(var f=(i=void 0,E(h.events)),l=f.next();!l.done;l=f.next()){var d=l.value;a.add("".concat(d))}}catch(y){i={error:y}}finally{try{l&amp;&amp;!l.done&amp;&amp;(r=f.return)&amp;&amp;r.call(f)}finally{if(i)throw i.error}}}}catch(y){t={error:y}}finally{try{c&amp;&amp;!c.done&amp;&amp;(n=s.return)&amp;&amp;n.call(s)}finally{if(t)throw t.error}}return this.__cache.events=Array.from(a)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"ownEvents",{get:function(){var t=new Set(this.transitions.filter(function(n){return!(!n.target&amp;&amp;!n.actions.length&amp;&amp;n.internal)}).map(function(n){return n.eventType}));return Array.from(t)},enumerable:!1,configurable:!0}),e.prototype.resolveTarget=function(t){var n=this;if(t!==void 0)return t.map(function(i){if(!A(i))return i;var r=i[0]===n.delimiter;if(r&amp;&amp;!n.parent)return n.getStateNodeByPath(i.slice(1));var o=r?n.key+i:i;if(n.parent)try{var a=n.parent.getStateNodeByPath(o);return a}catch(s){throw new Error("Invalid transition definition for state node '".concat(n.id,`':
`).concat(s.message))}else return n.getStateNodeByPath(o)})},e.prototype.formatTransition=function(t){var n=this,i=We(t.target),r="internal"in t?t.internal:i?i.some(function(c){return A(c)&amp;&amp;c[0]===n.delimiter}):!0,o=this.machine.options.guards,a=this.resolveTarget(i),s=p(p({},t),{actions:H(U(t.actions)),cond:ve(t.cond,o),target:a,source:this,internal:r,eventType:t.event,toJSON:function(){return p(p({},s),{target:s.target?s.target.map(function(c){return"#".concat(c.id)}):void 0,source:"#".concat(n.id)})}});return s},e.prototype.formatTransitions=function(){var t,n,i=this,r;if(!this.config.on)r=[];else if(Array.isArray(this.config.on))r=this.config.on;else{var o=this.config.on,a=Mt,s=o[a],c=s===void 0?[]:s,u=Ft(o,[typeof a=="symbol"?a:a+""]);r=I(Object.keys(u).map(function(m){var b=Y(m,u[m]);return b}).concat(Y(Mt,c)))}var h=this.config.always?Y("",this.config.always):[],f=this.config.onDone?Y(String(xt(this.id)),this.config.onDone):[],l=I(this.invoke.map(function(m){var b=[];return m.onDone&amp;&amp;b.push.apply(b,V([],O(Y(String(kt(m.id)),m.onDone)),!1)),m.onError&amp;&amp;b.push.apply(b,V([],O(Y(String(ht(m.id)),m.onError)),!1)),b})),d=this.after,y=I(V(V(V(V([],O(f),!1),O(l),!1),O(r),!1),O(h),!1).map(function(m){return U(m).map(function(b){return i.formatTransition(b)})}));try{for(var v=E(d),_=v.next();!_.done;_=v.next()){var g=_.value;y.push(g)}}catch(m){t={error:m}}finally{try{_&amp;&amp;!_.done&amp;&amp;(n=v.return)&amp;&amp;n.call(v)}finally{if(t)throw t.error}}return y},e}();nt={click:"onClick",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",complete:"onComplete",after:"onAfter",enter:"onEnter",show:"onShow"};Object.values(nt);Nn=Object.keys(nt),Mn=class{constructor(e,t){X(this,"activeStateId","");X(this,"_service");X(this,"_domListeners",new Map);X(this,"_domElement");X(this,"_playerListeners",new Map);X(this,"_player");X(this,"_machineSchemas",new Map);X(this,"_onShowPrevValue",0);this._player=t,this._machineSchemas=this._transformToXStateSchema(e),this._domElement=t.container}start(e){this.stop();let t=this._machineSchemas.get(e);if(typeof t&gt;"u")throw mt(`invalid state machine id ${e}`);this._service=we(Tn(t)),this._addEventListeners(),this._service.start()}stop(){var e;this._removeEventListeners(),(e=this._service)==null||e.stop(),this._player.stop()}_removeEventListeners(){var e;this._requiresDomElement();for(let[t,n]of this._domListeners)t==="visibilityChange"&amp;&amp;this._player.stopPlayOnShow(),(e=this._domElement)==null||e.removeEventListener(t,n),this._domListeners.delete(t);for(let[t,n]of this._playerListeners)this._player.removeEventListener(t,n),this._playerListeners.delete(t)}_addEventListeners(){this._requiresDomElement();let e=n=&gt;{this._service.send({type:n})},t=n=&gt;{function i(){e(n)}return i};this._service.subscribe(n=&gt;{var i;if(typeof n.changed&gt;"u"||n.changed){this._removeEventListeners();for(let r of n.nextEvents)if(Nn.filter(o=&gt;o!=="complete"&amp;&amp;o!=="show").includes(r)){let o=t(r);this._domListeners.set(r,o),(i=this._domElement)==null||i.addEventListener(r,o,{once:!0})}else if(r==="complete"){let o=t(r);this._player.addEventListener(r,o),this._playerListeners.set(r,o)}else if(r==="show"){let o=t(r);this._player.addIntersectionObserver({callbackOnIntersect:a=&gt;{a&gt;0&amp;&amp;(a!==100&amp;&amp;this._onShowPrevValue!==a&amp;&amp;o(),this._onShowPrevValue=a)},threshold:[]}),this._domListeners.set("visibilityChange",o)}}})}subscribe(e){throw mt(e.toString())}_transformToXStateSchema(e){var t,n,i;let r=new Map;for(let o of e){let a={},s={};if(s.id=o.descriptor.id,typeof o.descriptor.initial&lt;"u"&amp;&amp;(s.initial=o.descriptor.initial),typeof o&lt;"u"){let c=o.states;for(let u in c)if(typeof c[u]&lt;"u"&amp;&amp;c[u]){let h=c[u],f=h.playbackSettings,l=Object.keys(h).filter(v=&gt;v.startsWith("on")),d={},y={};for(let v of l)if(typeof h[v]&lt;"u"){let _=h[v];if(v===nt.after){let g=_;y[g.ms]={target:(t=_?.state)!=null?t:""}}else v===nt.enter?d[Vt(nt,v)]={target:(n=_?.state)!=null?n:""}:d[Vt(nt,v)]={target:(i=_?.state)!=null?i:""}}a[u]={entry:()=&gt;{!this._player.getAnimationInstance()||h.animationId&amp;&amp;h.animationId!==this._player.currentAnimationId?this._player.play(h.animationId,()=&gt;({...Yt,...f})).then(()=&gt;{this._updatePlaybackSettings(f)}).catch(v=&gt;{Zt(`State machine error: ${v.message}`)}):this._updatePlaybackSettings(f)},exit:()=&gt;{typeof f.segments&lt;"u"&amp;&amp;this._player.resetSegments(!1),typeof f.playOnScroll&lt;"u"&amp;&amp;this._player.stopPlayOnScroll()},on:d,after:y,meta:f}}}s.states=a,r.set(s.id,s)}return r}_handlePlaySegments(e){if(typeof e.segments=="string")this._player.goToAndPlay(e.segments,!0);else{let[t,n]=e.segments,i=t;t!==0&amp;&amp;t===n&amp;&amp;(i=t-1),t===0&amp;&amp;t===n?this._player.goToAndPlay(t,!0):this._player.playSegments([i,n],!0)}}_handlePlayOnScroll(e){let t=e.playOnScroll;if(e.segments&amp;&amp;typeof e.segments!="string"){let n=e.segments;this._player.playOnScroll({threshold:t,segments:n})}else this._player.playOnScroll({threshold:t})}_updatePlaybackSettings(e){if(!this._player.getAnimationInstance())throw new Error("Unable to update playbackSettings. Animations is not rendered yet.");typeof e.autoplay&lt;"u"&amp;&amp;(this._player.setAutoplay(e.autoplay),e.autoplay?this._player.play():this._player.pause()),typeof e.direction&lt;"u"&amp;&amp;this._player.setDirection(e.direction),typeof e.intermission&lt;"u"&amp;&amp;this._player.setIntermission(e.intermission),typeof e.loop&lt;"u"&amp;&amp;this._player.setLoop(e.loop),typeof e.playMode&lt;"u"&amp;&amp;this._player.setMode(e.playMode),typeof e.speed&lt;"u"&amp;&amp;this._player.setSpeed(e.speed),typeof e.defaultTheme&lt;"u"&amp;&amp;this._player.setDefaultTheme(e.defaultTheme),typeof e.playOnScroll&lt;"u"&amp;&amp;this._handlePlayOnScroll(e),e.segments&amp;&amp;this._handlePlaySegments(e),e.autoplay||this._player.pause()}_requiresDomElement(){if(!this._domElement)throw mt("Requires a DOM element to attach events.")}};});jn();export{Mn as DotLottieStateMachineManager};
</pre></body></html>