Mini Kabibi Habibi
/*! For license information please see 3348.js.LICENSE.txt */
"use strict";(self.webpackChunkCCD=self.webpackChunkCCD||[]).push([[3348],{123348:(t,e,n)=>{n.r(e),n.d(e,{DotLottieStateMachineManager:()=>oe});var i=n(674559);function r(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,i)}return n}function o(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?r(Object(n),!0).forEach((function(e){var i,r,o;i=t,r=e,o=n[e],(r=h(r))in i?Object.defineProperty(i,r,{value:o,enumerable:!0,configurable:!0,writable:!0}):i[r]=o})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function a(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var i,r,o,a,s=[],c=!0,u=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;c=!1}else for(;!(c=(i=o.call(n)).done)&&(s.push(i.value),s.length!==e);c=!0);}catch(t){u=!0,r=t}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw r}}return s}}(t,e)||c(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=c(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0,r=function(){};return{s:r,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function c(t,e){if(t){if("string"==typeof t)return u(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(t,e):void 0}}function u(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n<e;n++)i[n]=t[n];return i}function l(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,h(i.key),i)}}function h(t){var e=function(t,e){if("object"!==d(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,"string");if("object"!==d(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===d(e)?e:String(e)}function f(){return f=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},f.apply(this,arguments)}function d(t){return d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},d(t)}n(804980);var v,p,y,g=function(){return g=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},g.apply(this,arguments)};function m(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(n[i[r]]=t[i[r]])}return n}function b(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],i=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function S(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var i,r,o=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(i=o.next()).done;)a.push(i.value)}catch(t){r={error:t}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return a}function w(t,e,n){if(n||2===arguments.length)for(var i,r=0,o=e.length;r<o;r++)(i||!(r in e))&&(i||(i=Array.prototype.slice.call(e,0,r)),i[r]=e[r]);return t.concat(i||Array.prototype.slice.call(e))}(p=v||(v={})).Start="xstate.start",p.Stop="xstate.stop",p.Raise="xstate.raise",p.Send="xstate.send",p.Cancel="xstate.cancel",p.NullEvent="",p.Assign="xstate.assign",p.After="xstate.after",p.DoneState="done.state",p.DoneInvoke="done.invoke",p.Log="xstate.log",p.Init="xstate.init",p.Invoke="xstate.invoke",p.ErrorExecution="error.execution",p.ErrorCommunication="error.communication",p.ErrorPlatform="error.platform",p.ErrorCustom="xstate.error",p.Update="xstate.update",p.Pure="xstate.pure",p.Choose="xstate.choose",function(t){t.Parent="#_parent",t.Internal="#_internal"}(y||(y={}));var x=v.Start,_=v.Stop,E=v.Raise,O=v.Send,k=v.Cancel,j=v.NullEvent,P=v.Assign;v.After,v.DoneState;var T=v.Log,A=v.Init,N=v.Invoke;v.ErrorExecution;var L,I=v.ErrorPlatform,C=v.ErrorCustom,D=v.Update,V=v.Choose,M=v.Pure,R={},z="xstate.guard";function U(t,e,n){void 0===n&&(n=".");var i=J(t,n),r=J(e,n);return ot(r)?!!ot(i)&&r===i:ot(i)?i in r:Object.keys(i).every((function(t){return t in r&&U(i[t],r[t])}))}function q(t){try{return ot(t)||"number"==typeof t?"".concat(t):t.type}catch(t){throw new Error("Events must be strings or objects with a string event.type property.")}}function B(t,e){try{return it(t)?t:t.toString().split(e)}catch(e){throw new Error("'".concat(t,"' is not a valid state path."))}}function J(t,e){return function(t){return"object"==d(t)&&"value"in t&&"context"in t&&"event"in t&&"_event"in t}(t)?t.value:it(t)?F(t):"string"!=typeof t?t:F(B(t,e))}function F(t){if(1===t.length)return t[0];for(var e={},n=e,i=0;i<t.length-1;i++)i===t.length-2?n[t[i]]=t[i+1]:(n[t[i]]={},n=n[t[i]]);return e}function $(t,e){for(var n={},i=Object.keys(t),r=0;r<i.length;r++){var o=i[r];n[o]=e(t[o],o,t,r)}return n}function X(t,e,n){var i,r,o={};try{for(var a=b(Object.keys(t)),s=a.next();!s.done;s=a.next()){var c=s.value,u=t[c];n(u)&&(o[c]=e(u,c,t))}}catch(t){i={error:t}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}var Q=function(t){return function(e){var n,i,r=e;try{for(var o=b(t),a=o.next();!a.done;a=o.next())r=r[a.value]}catch(t){n={error:t}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}return r}};function H(t){return t?ot(t)?[[t]]:G(Object.keys(t).map((function(e){var n=t[e];return"string"==typeof n||n&&Object.keys(n).length?H(t[e]).map((function(t){return[e].concat(t)})):[[e]]}))):[[]]}function G(t){var e;return(e=[]).concat.apply(e,w([],S(t),!1))}function W(t){return it(t)?t:[t]}function K(t){return void 0===t?[]:W(t)}function Y(t,e,n){var i,r;if(rt(t))return t(e,n.data);var o={};try{for(var a=b(Object.keys(t)),s=a.next();!s.done;s=a.next()){var c=s.value,u=t[c];rt(u)?o[c]=u(e,n.data):o[c]=u}}catch(t){i={error:t}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function Z(t){return!!(t instanceof Promise||null!==t&&(rt(t)||"object"==d(t))&&rt(t.then))}function tt(t,e){return $(t.states,(function(t,n){if(t){var i=(ot(e)?void 0:e[n])||(t?t.current:void 0);if(i)return{current:i,states:tt(t,i)}}}))}function et(t,e){return{current:e,states:tt(t,e)}}function nt(t,e,n,i){return t&&n.reduce((function(t,n){var r,o,a=n.assignment,s={state:i,action:n,_event:e},c={};if(rt(a))c=a(t,e.data,s);else try{for(var u=b(Object.keys(a)),l=u.next();!l.done;l=u.next()){var h=l.value,d=a[h];c[h]=rt(d)?d(t,e.data,s):d}}catch(t){r={error:t}}finally{try{l&&!l.done&&(o=u.return)&&o.call(u)}finally{if(r)throw r.error}}return f({},t,c)}),t)}function it(t){return Array.isArray(t)}function rt(t){return"function"==typeof t}function ot(t){return"string"==typeof t}function at(t,e){if(t)return ot(t)?{type:z,name:t,predicate:e?e[t]:void 0}:rt(t)?{type:z,name:t.name,predicate:t}:t}var st="function"==typeof Symbol&&Symbol.observable||"@@observable";function ct(t){return!!t&&"__xstatenode"in t}function ut(t,e){return ot(t)||"number"==typeof t?g({type:t},e):t}function lt(t,e){if(!ot(t)&&"$$type"in t&&"scxml"===t.$$type)return t;var n=ut(t);return g({name:n.type,data:n,$$type:"scxml",type:"external"},e)}function ht(t,e){return W(e).map((function(e){return d(e)>"u"||"string"==typeof e||ct(e)?{target:e,event:t}:g(g({},e),{event:t})}))}function ft(t,e,n,i,r){var o=t.options.guards,a={state:r,cond:e,_event:i};if(e.type===z)return((null==o?void 0:o[e.name])||e.predicate)(n,i.data,a);var s=null==o?void 0:o[e.type];if(!s)throw new Error("Guard '".concat(e.type,"' is not implemented on machine '").concat(t.id,"'."));return s(n,i.data,a)}function dt(t){return"string"==typeof t?{type:t}:t}function vt(t,e,n){var i=function(){},r="object"==d(t),o=r?t:null;return{next:((r?t.next:t)||i).bind(o),error:((r?t.error:e)||i).bind(o),complete:((r?t.complete:n)||i).bind(o)}}function pt(t,e){return"".concat(t,":invocation[").concat(e,"]")}function yt(t){return(t.type===E||t.type===O&&t.to===y.Internal)&&"number"!=typeof t.delay}(L={})[st]=function(){return this},L[Symbol.observable]=function(){return this};var gt=lt({type:A});function mt(t,e){return e&&e[t]||void 0}function bt(t,e){var n;if(ot(t)||"number"==typeof t)n=rt(i=mt(t,e))?{type:t,exec:i}:i||{type:t,exec:void 0};else if(rt(t))n={type:t.name||t.toString(),exec:t};else{var i;if(rt(i=mt(t.type,e)))n=g(g({},t),{exec:i});else if(i){var r=i.type||t.type;n=g(g(g({},i),t),{type:r})}else n=t}return n}var St=function(t,e){return t?(it(t)?t:[t]).map((function(t){return bt(t,e)})):[]};function wt(t){var e=bt(t);return g(g({id:ot(t)?t:e.id},e),{type:e.type})}function xt(t,e){var n="".concat(v.DoneState,".").concat(t);return{type:n,data:e,toString:function(){return n}}}function _t(t,e){var n="".concat(v.DoneInvoke,".").concat(t);return{type:n,data:e,toString:function(){return n}}}function Et(t,e){var n="".concat(v.ErrorPlatform,".").concat(t);return{type:n,data:e,toString:function(){return n}}}function Ot(t,e,n,i,r,o,a){void 0===a&&(a=!1);var s=a?[]:function(t){var e,n,i=[];try{for(var r=b(t),o=r.next();!o.done;o=r.next())for(var a=o.value,s=0;s<a.actions.length;)a.actions[s].type!==P?s++:(i.push(a.actions[s]),a.actions.splice(s,1))}catch(t){e={error:t}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(e)throw e.error}}return i}(r),c=s.length?nt(n,i,s,e):n,u=a?[n]:void 0,l=[];function h(r,s){var h;switch(s.type){case E:var f=function(t,e,n,i){var r,o={_event:n},a=lt(rt(t.event)?t.event(e,n.data,o):t.event);if(ot(t.delay)){var s=i&&i[t.delay];r=rt(s)?s(e,n.data,o):s}else r=rt(t.delay)?t.delay(e,n.data,o):t.delay;return g(g({},t),{type:E,_event:a,delay:r})}(s,c,i,t.options.delays);return o&&"number"==typeof f.delay&&o(f,c,i),f;case O:var d=function(t,e,n,i){var r,o={_event:n},a=lt(rt(t.event)?t.event(e,n.data,o):t.event);if(ot(t.delay)){var s=i&&i[t.delay];r=rt(s)?s(e,n.data,o):s}else r=rt(t.delay)?t.delay(e,n.data,o):t.delay;var c=rt(t.to)?t.to(e,n.data,o):t.to;return g(g({},t),{to:c,_event:a,event:a.data,delay:r})}(s,c,i,t.options.delays);return o&&d.to!==y.Internal&&("entry"===r?l.push(d):o(d,c,i)),d;case T:var p=function(t,e,n){return g(g({},t),{value:ot(t.expr)?t.expr:t.expr(e,n.data,{_event:n})})}(s,c,i);return null!=o&&o(p,c,i),p;case V:if(!(k=null===(h=s.conds.find((function(n){var r=at(n.cond,t.options.guards);return!r||ft(t,r,c,i,o?void 0:e)})))||void 0===h?void 0:h.actions))return[];var m=S(Ot(t,e,c,i,[{type:r,actions:St(K(k),t.options.actions)}],o,a),2),b=m[0],x=m[1];return c=x,null!=u&&u.push(c),b;case M:var k;if(!(k=s.get(c,i.data)))return[];var j=S(Ot(t,e,c,i,[{type:r,actions:St(K(k),t.options.actions)}],o,a),2),A=j[0],N=j[1];return c=N,null!=u&&u.push(c),A;case _:return p=function(t,e,n){var i=rt(t.activity)?t.activity(e,n.data):t.activity,r="string"==typeof i?{id:i}:i;return{type:v.Stop,activity:r}}(s,c,i),null!=o&&o(p,n,i),p;case P:c=nt(c,i,[s],o?void 0:e),null==u||u.push(c);break;default:var L=bt(s,t.options.actions),I=L.exec;if(o)o(L,c,i);else if(I&&u){var C=u.length-1,D=g(g({},L),{exec:function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];I.apply(void 0,w([u[C]],S(e),!1))}});L=D}return L}}return[G(r.map((function(t){var e,n,r=[];try{for(var a=b(t.actions),s=a.next();!s.done;s=a.next()){var u=s.value,f=h(t.type,u);f&&(r=r.concat(f))}}catch(t){e={error:t}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(e)throw e.error}}return l.forEach((function(t){o(t,c,i)})),l.length=0,r}))),c]}var kt=function(t,e){return e(t)};function jt(t){var e;return(e={id:t,send:function(){},subscribe:function(){return{unsubscribe:function(){}}},getSnapshot:function(){},toJSON:function(){return{id:t}}})[st]=function(){return this},e}function Pt(t,e,n){var i=jt(e);if(i.deferred=!0,ct(t)){var r=i.state=kt(void 0,(function(){return(n?t.withContext(n):t).initialState}));i.getSnapshot=function(){return r}}return i}var Tt=function(t){return"atomic"===t.type||"final"===t.type};function At(t){return Object.keys(t.states).map((function(e){return t.states[e]}))}function Nt(t){return At(t).filter((function(t){return"history"!==t.type}))}function Lt(t){var e=[t];return Tt(t)?e:e.concat(G(Nt(t).map(Lt)))}function It(t,e){var n,i,r,o,a,s,c,u,l=Dt(new Set(t)),h=new Set(e);try{for(var f=b(h),d=f.next();!d.done;d=f.next())for(var v=(E=d.value).parent;v&&!h.has(v);)h.add(v),v=v.parent}catch(t){n={error:t}}finally{try{d&&!d.done&&(i=f.return)&&i.call(f)}finally{if(n)throw n.error}}var p=Dt(h);try{for(var y=b(h),g=y.next();!g.done;g=y.next())if("compound"!==(E=g.value).type||p.get(E)&&p.get(E).length){if("parallel"===E.type)try{for(var m=(a=void 0,b(Nt(E))),S=m.next();!S.done;S=m.next()){var w=S.value;h.has(w)||(h.add(w),l.get(w)?l.get(w).forEach((function(t){return h.add(t)})):w.initialStateNodes.forEach((function(t){return h.add(t)})))}}catch(t){a={error:t}}finally{try{S&&!S.done&&(s=m.return)&&s.call(m)}finally{if(a)throw a.error}}}else l.get(E)?l.get(E).forEach((function(t){return h.add(t)})):E.initialStateNodes.forEach((function(t){return h.add(t)}))}catch(t){r={error:t}}finally{try{g&&!g.done&&(o=y.return)&&o.call(y)}finally{if(r)throw r.error}}try{for(var x=b(h),_=x.next();!_.done;_=x.next()){var E;for(v=(E=_.value).parent;v&&!h.has(v);)h.add(v),v=v.parent}}catch(t){c={error:t}}finally{try{_&&!_.done&&(u=x.return)&&u.call(x)}finally{if(c)throw c.error}}return h}function Ct(t,e){var n=e.get(t);if(!n)return{};if("compound"===t.type){var i=n[0];if(!i)return{};if(Tt(i))return i.key}var r={};return n.forEach((function(t){r[t.key]=Ct(t,e)})),r}function Dt(t){var e,n,i=new Map;try{for(var r=b(t),o=r.next();!o.done;o=r.next()){var a=o.value;i.has(a)||i.set(a,[]),a.parent&&(i.has(a.parent)||i.set(a.parent,[]),i.get(a.parent).push(a))}}catch(t){e={error:t}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(e)throw e.error}}return i}function Vt(t,e){return Ct(t,Dt(It([t],e)))}function Mt(t,e){return Array.isArray(t)?t.some((function(t){return t===e})):t instanceof Set&&t.has(e)}function Rt(t,e){return"compound"===e.type?Nt(e).some((function(e){return"final"===e.type&&Mt(t,e)})):"parallel"===e.type&&Nt(e).every((function(e){return Rt(t,e)}))}function zt(t){return new Set(G(t.map((function(t){return t.tags}))))}function Ut(t,e){if(t===e)return!0;if(void 0===t||void 0===e)return!1;if(ot(t)||ot(e))return t===e;var n=Object.keys(t),i=Object.keys(e);return n.length===i.length&&n.every((function(n){return Ut(t[n],e[n])}))}var qt=function(){function t(t){var e,n=this;this.actions=[],this.activities=R,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||R,this.meta=function(t){return void 0===t&&(t=[]),t.reduce((function(t,e){return void 0!==e.meta&&(t[e.id]=e.meta),t}),{})}(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=null!==(e=Array.isArray(t.tags)?new Set(t.tags):t.tags)&&void 0!==e?e:new Set,this.machine=t.machine,Object.defineProperty(this,"nextEvents",{get:function(){return function(t){return w([],S(new Set(G(w([],S(t.map((function(t){return t.ownEvents}))),!1)))),!1)}(n.configuration)}})}return t.from=function(e,n){return e instanceof t?e.context!==n?new t({value:e.value,context:n,_event:e._event,_sessionid:null,historyValue:e.historyValue,history:e.history,actions:[],activities:e.activities,meta:{},events:[],configuration:[],transitions:[],children:{}}):e:new t({value:e,context:n,_event:gt,_sessionid:null,historyValue:void 0,history:void 0,actions:[],activities:void 0,meta:void 0,events:[],configuration:[],transitions:[],children:{}})},t.create=function(e){return new t(e)},t.inert=function(e,n){if(e instanceof t){if(!e.actions.length)return e;var i=gt;return new t({value:e.value,context:n,_event:i,_sessionid:null,historyValue:e.historyValue,history:e.history,activities:e.activities,configuration:e.configuration,transitions:[],children:{}})}return t.from(e,n)},t.prototype.toStrings=function(t,e){var n=this;if(void 0===t&&(t=this.value),void 0===e&&(e="."),ot(t))return[t];var i=Object.keys(t);return i.concat.apply(i,w([],S(i.map((function(i){return n.toStrings(t[i],e).map((function(t){return i+e+t}))}))),!1))},t.prototype.toJSON=function(){var t=this;t.configuration,t.transitions;var e=t.tags;t.machine;var n=m(t,["configuration","transitions","tags","machine"]);return g(g({},n),{tags:Array.from(e)})},t.prototype.matches=function(t){return U(t,this.value)},t.prototype.hasTag=function(t){return this.tags.has(t)},t.prototype.can=function(t){var e;this.machine;var n=null===(e=this.machine)||void 0===e?void 0:e.getTransitionData(this,t);return!(null==n||!n.transitions.length)&&n.transitions.some((function(t){return void 0!==t.target||t.actions.length}))},t}(),Bt={deferEvents:!1},Jt=function(){function t(t){this.processingEvent=!1,this.queue=[],this.initialized=!1,this.options=g(g({},Bt),t)}return t.prototype.initialize=function(t){if(this.initialized=!0,t){if(!this.options.deferEvents)return void this.schedule(t);this.process(t)}this.flushEvents()},t.prototype.schedule=function(t){if(this.initialized&&!this.processingEvent){if(0!==this.queue.length)throw new Error("Event queue should be empty when it is not processing events");this.process(t),this.flushEvents()}else this.queue.push(t)},t.prototype.clear=function(){this.queue=[]},t.prototype.flushEvents=function(){for(var t=this.queue.shift();t;)this.process(t),t=this.queue.shift()},t.prototype.process=function(t){this.processingEvent=!0;try{t()}catch(t){throw this.clear(),t}finally{this.processingEvent=!1}},t}(),Ft=new Map,$t=0,Xt=function(t){Ft.delete(t)};function Qt(){return("undefined"==typeof globalThis?"undefined":d(globalThis))<"u"?globalThis:("undefined"==typeof self?"undefined":d(self))<"u"?self:("undefined"==typeof window?"undefined":d(window))<"u"?window:("undefined"==typeof global?"undefined":d(global))<"u"?global:void 0}var Ht,Gt={sync:!1,autoForward:!1};!function(t){t[t.NotStarted=0]="NotStarted",t[t.Running=1]="Running",t[t.Stopped=2]="Stopped"}(Ht||(Ht={}));var Wt=function(){function t(e,n){void 0===n&&(n=t.defaultOptions);var i=this;this.machine=e,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=Ht.NotStarted,this.children=new Map,this.forwardTo=new Set,this._outgoingQueue=[],this.init=this.start,this.send=function(t,e){if(it(t))return i.batch(t),i.state;var n=lt(ut(t,e));if(i.status===Ht.Stopped)return i.state;if(i.status!==Ht.Running&&!i.options.deferEvents)throw new Error('Event "'.concat(n.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.\nEvent: ').concat(JSON.stringify(n.data)));return i.scheduler.schedule((function(){i.forward(n);var t=i._nextState(n);i.update(t,n)})),i._state},this.sendTo=function(t,e,n){var r=i.parent&&(e===y.Parent||i.parent.id===e),o=r?i.parent:ot(e)?e===y.Internal?i:i.children.get(e)||function(t){return Ft.get(t)}(e):function(t){return!!t&&"function"==typeof t.send}(e)?e:void 0;if(o)if("machine"in o){if(i.status!==Ht.Stopped||i.parent!==o||i.state.done){var a=g(g({},t),{name:t.name===C?"".concat(Et(i.id)):t.name,origin:i.sessionId});!n&&i.machine.config.predictableActionArguments?i._outgoingQueue.push([o,a]):o.send(a)}}else!n&&i.machine.config.predictableActionArguments?i._outgoingQueue.push([o,t.data]):o.send(t.data);else if(!r)throw new Error("Unable to send event to child '".concat(e,"' from service '").concat(i.id,"'."))},this._exec=function(t,e,n,r){void 0===r&&(r=i.machine.options.actions);var o=t.exec||mt(t.type,r),a=rt(o)?o:o?o.exec:t.exec;if(a)try{return a(e,n.data,i.machine.config.predictableActionArguments?{action:t,_event:n}:{action:t,state:i.state,_event:n})}catch(t){throw i.parent&&i.parent.send({type:"xstate.error",data:t}),t}switch(t.type){case E:var s=t;i.defer(s);break;case O:var c=t;if("number"==typeof c.delay)return void i.defer(c);c.to?i.sendTo(c._event,c.to,n===gt):i.send(c._event);break;case k:i.cancel(t.sendId);break;case x:if(i.status!==Ht.Running)return;var u=t.activity;if(!i.machine.config.predictableActionArguments&&!i.state.activities[u.id||u.type])break;if(u.type===v.Invoke){var l=dt(u.src),h=i.machine.options.services?i.machine.options.services[l.type]:void 0,f=u.id,d=u.data,p="autoForward"in u?u.autoForward:!!u.forward;if(!h)return;var y=d?Y(d,e,n):void 0;if("string"==typeof h)return;var g=rt(h)?h(e,n.data,{data:y,src:l,meta:u.meta}):h;if(!g)return;var m=void 0;ct(g)&&(g=y?g.withContext(y):g,m={autoForward:p}),i.spawn(g,f,m)}else i.spawnActivity(u);break;case _:i.stopChild(t.activity.id);break;case T:var b=t,S=b.label,w=b.value;S?i.logger(S,w):i.logger(w)}};var r=g(g({},t.defaultOptions),n),o=r.clock,a=r.logger,s=r.parent,c=r.id,u=void 0!==c?c:e.id;this.id=u,this.logger=a,this.clock=o,this.parent=s,this.options=r,this.scheduler=new Jt({deferEvents:this.options.deferEvents}),this.sessionId="x:".concat($t++)}return Object.defineProperty(t.prototype,"initialState",{get:function(){var t=this;return this._initialState?this._initialState:kt(this,(function(){return t._initialState=t.machine.initialState,t._initialState}))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),t.prototype.execute=function(t,e){var n,i;try{for(var r=b(t.actions),o=r.next();!o.done;o=r.next()){var a=o.value;this.exec(a,t,e)}}catch(t){n={error:t}}finally{try{o&&!o.done&&(i=r.return)&&i.call(r)}finally{if(n)throw n.error}}},t.prototype.update=function(t,e){var n,i,r,o,a,s,c,u,l=this;if(t._sessionid=this.sessionId,this._state=t,this.machine.config.predictableActionArguments&&e!==gt||!this.options.execute)for(var h=void 0;h=this._outgoingQueue.shift();)h[0].send(h[1]);else this.execute(this.state);if(this.children.forEach((function(t){l.state.children[t.id]=t})),this.devTools&&this.devTools.send(e.data,t),t.event)try{for(var f=b(this.eventListeners),d=f.next();!d.done;d=f.next())(0,d.value)(t.event)}catch(t){n={error:t}}finally{try{d&&!d.done&&(i=f.return)&&i.call(f)}finally{if(n)throw n.error}}try{for(var v=b(this.listeners),p=v.next();!p.done;p=v.next())(0,p.value)(t,t.event)}catch(t){r={error:t}}finally{try{p&&!p.done&&(o=v.return)&&o.call(v)}finally{if(r)throw r.error}}try{for(var y=b(this.contextListeners),g=y.next();!g.done;g=y.next())(0,g.value)(this.state.context,this.state.history?this.state.history.context:void 0)}catch(t){a={error:t}}finally{try{g&&!g.done&&(s=y.return)&&s.call(y)}finally{if(a)throw a.error}}if(this.state.done){var m=t.configuration.find((function(t){return"final"===t.type&&t.parent===l.machine})),S=m&&m.doneData?Y(m.doneData,t.context,e):void 0;this._doneEvent=_t(this.id,S);try{for(var w=b(this.doneListeners),x=w.next();!x.done;x=w.next())(0,x.value)(this._doneEvent)}catch(t){c={error:t}}finally{try{x&&!x.done&&(u=w.return)&&u.call(w)}finally{if(c)throw c.error}}this._stop(),this._stopChildren(),Xt(this.sessionId)}},t.prototype.onTransition=function(t){return this.listeners.add(t),this.status===Ht.Running&&t(this.state,this.state.event),this},t.prototype.subscribe=function(t,e,n){var i=this,r=vt(t,e,n);this.listeners.add(r.next),this.status!==Ht.NotStarted&&r.next(this.state);var o=function t(){i.doneListeners.delete(t),i.stopListeners.delete(t),r.complete()};return this.status===Ht.Stopped?r.complete():(this.onDone(o),this.onStop(o)),{unsubscribe:function(){i.listeners.delete(r.next),i.doneListeners.delete(o),i.stopListeners.delete(o)}}},t.prototype.onEvent=function(t){return this.eventListeners.add(t),this},t.prototype.onSend=function(t){return this.sendListeners.add(t),this},t.prototype.onChange=function(t){return this.contextListeners.add(t),this},t.prototype.onStop=function(t){return this.stopListeners.add(t),this},t.prototype.onDone=function(t){return this.status===Ht.Stopped&&this._doneEvent?t(this._doneEvent):this.doneListeners.add(t),this},t.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},t.prototype.start=function(t){var e=this;if(this.status===Ht.Running)return this;this.machine._init(),function(t,e){Ft.set(t,e)}(this.sessionId,this),this.initialized=!0,this.status=Ht.Running;var n=void 0===t?this.initialState:kt(this,(function(){return function(t){return"object"==d(t)&&null!==t&&"value"in t&&"_event"in t}(t)?e.machine.resolveState(t):e.machine.resolveState(qt.from(t,e.machine.context))}));return this.options.devTools&&this.attachDev(),this.scheduler.initialize((function(){e.update(n,gt)})),this},t.prototype._stopChildren=function(){this.children.forEach((function(t){rt(t.stop)&&t.stop()})),this.children.clear()},t.prototype._stop=function(){var t,e,n,i,r,o,a,s,c,u;try{for(var l=b(this.listeners),h=l.next();!h.done;h=l.next()){var f=h.value;this.listeners.delete(f)}}catch(e){t={error:e}}finally{try{h&&!h.done&&(e=l.return)&&e.call(l)}finally{if(t)throw t.error}}try{for(var d=b(this.stopListeners),v=d.next();!v.done;v=d.next())(f=v.value)(),this.stopListeners.delete(f)}catch(t){n={error:t}}finally{try{v&&!v.done&&(i=d.return)&&i.call(d)}finally{if(n)throw n.error}}try{for(var p=b(this.contextListeners),y=p.next();!y.done;y=p.next())f=y.value,this.contextListeners.delete(f)}catch(t){r={error:t}}finally{try{y&&!y.done&&(o=p.return)&&o.call(p)}finally{if(r)throw r.error}}try{for(var g=b(this.doneListeners),m=g.next();!m.done;m=g.next())f=m.value,this.doneListeners.delete(f)}catch(t){a={error:t}}finally{try{m&&!m.done&&(s=g.return)&&s.call(g)}finally{if(a)throw a.error}}if(!this.initialized)return this;this.initialized=!1,this.status=Ht.Stopped,this._initialState=void 0;try{for(var S=b(Object.keys(this.delayedEventsMap)),w=S.next();!w.done;w=S.next()){var x=w.value;this.clock.clearTimeout(this.delayedEventsMap[x])}}catch(t){c={error:t}}finally{try{w&&!w.done&&(u=S.return)&&u.call(S)}finally{if(c)throw c.error}}this.scheduler.clear(),this.scheduler=new Jt({deferEvents:this.options.deferEvents})},t.prototype.stop=function(){var t=this,e=this.scheduler;return this._stop(),e.schedule((function(){var e=lt({type:"xstate.stop"}),n=kt(t,(function(){var n=G(w([],S(t.state.configuration),!1).sort((function(t,e){return e.order-t.order})).map((function(e){return St(e.onExit,t.machine.options.actions)}))),i=S(Ot(t.machine,t.state,t.state.context,e,[{type:"exit",actions:n}],t.machine.config.predictableActionArguments?t._exec:void 0,t.machine.config.predictableActionArguments||t.machine.config.preserveActionOrder),2),r=i[0],o=i[1],a=new qt({value:t.state.value,context:o,_event:e,_sessionid:t.sessionId,historyValue:void 0,history:t.state,actions:r.filter((function(t){return!yt(t)})),activities:{},events:[],configuration:[],transitions:[],children:{},done:t.state.done,tags:t.state.tags,machine:t.machine});return a.changed=!0,a}));t.update(n,e),t._stopChildren(),Xt(t.sessionId)})),this},t.prototype.batch=function(t){var e=this;if((this.status!==Ht.NotStarted||!this.options.deferEvents)&&this.status!==Ht.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 n=!!this.machine.config.predictableActionArguments&&this._exec;this.scheduler.schedule((function(){var i,r,o=e.state,a=!1,s=[],c=function(t){var i=lt(t);e.forward(i),o=kt(e,(function(){return e.machine.transition(o,i,void 0,n||void 0)})),s.push.apply(s,w([],S(e.machine.config.predictableActionArguments?o.actions:o.actions.map((function(t){return function(t,e){var n=t.exec;return g(g({},t),{exec:void 0!==n?function(){return n(e.context,e.event,{action:t,state:e,_event:e._event})}:void 0})}(t,o)}))),!1)),a=a||!!o.changed};try{for(var u=b(t),l=u.next();!l.done;l=u.next())c(l.value)}catch(t){i={error:t}}finally{try{l&&!l.done&&(r=u.return)&&r.call(u)}finally{if(i)throw i.error}}o.changed=a,o.actions=s,e.update(o,lt(t[t.length-1]))}))}},t.prototype.sender=function(t){return this.send.bind(this,t)},t.prototype._nextState=function(t,e){var n=this;void 0===e&&(e=!!this.machine.config.predictableActionArguments&&this._exec);var i=lt(t);if(0===i.name.indexOf(I)&&!this.state.nextEvents.some((function(t){return 0===t.indexOf(I)})))throw i.data.data;return kt(this,(function(){return n.machine.transition(n.state,i,void 0,e||void 0)}))},t.prototype.nextState=function(t){return this._nextState(t,!1)},t.prototype.forward=function(t){var e,n;try{for(var i=b(this.forwardTo),r=i.next();!r.done;r=i.next()){var o=r.value,a=this.children.get(o);if(!a)throw new Error("Unable to forward event '".concat(t,"' from interpreter '").concat(this.id,"' to nonexistant child '").concat(o,"'."));a.send(t)}}catch(t){e={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}},t.prototype.defer=function(t){var e=this,n=this.clock.setTimeout((function(){"to"in t&&t.to?e.sendTo(t._event,t.to,!0):e.send(t._event)}),t.delay);t.id&&(this.delayedEventsMap[t.id]=n)},t.prototype.cancel=function(t){this.clock.clearTimeout(this.delayedEventsMap[t]),delete this.delayedEventsMap[t]},t.prototype.exec=function(t,e,n){void 0===n&&(n=this.machine.options.actions),this._exec(t,e.context,e._event,n)},t.prototype.removeChild=function(t){var e;this.children.delete(t),this.forwardTo.delete(t),null===(e=this.state)||void 0===e||delete e.children[t]},t.prototype.stopChild=function(t){var e=this.children.get(t);e&&(this.removeChild(t),rt(e.stop)&&e.stop())},t.prototype.spawn=function(t,e,n){if(this.status!==Ht.Running)return Pt(t,e);if(Z(t))return this.spawnPromise(Promise.resolve(t),e);if(rt(t))return this.spawnCallback(t,e);if(function(t){return function(t){try{return"function"==typeof t.send}catch(t){return!1}}(t)&&"id"in t}(t))return this.spawnActor(t,e);if(function(t){try{return"subscribe"in t&&rt(t.subscribe)}catch(t){return!1}}(t))return this.spawnObservable(t,e);if(ct(t))return this.spawnMachine(t,g(g({},n),{id:e}));if(function(t){return null!==t&&"object"==d(t)&&"transition"in t&&"function"==typeof t.transition}(t))return this.spawnBehavior(t,e);throw new Error('Unable to spawn entity "'.concat(e,'" of type "').concat(d(t),'".'))},t.prototype.spawnMachine=function(e,n){var i=this;void 0===n&&(n={});var r=new t(e,g(g({},this.options),{parent:this,id:n.id||e.id})),o=g(g({},Gt),n);o.sync&&r.onTransition((function(t){i.send(D,{state:t,id:r.id})}));var a=r;return this.children.set(r.id,a),o.autoForward&&this.forwardTo.add(r.id),r.onDone((function(t){i.removeChild(r.id),i.send(lt(t,{origin:r.id}))})).start(),a},t.prototype.spawnBehavior=function(t,e){var n=function(t,e){void 0===e&&(e={});var n=t.initialState,i=new Set,r=[],o=!1,a=function(t){var e;return g(((e={subscribe:function(){return{unsubscribe:function(){}}},id:"anonymous",getSnapshot:function(){}})[st]=function(){return this},e),t)}({id:e.id,send:function(e){r.push(e),function(){if(!o){for(o=!0;r.length>0;){var e=r.shift();n=t.transition(n,e,s),i.forEach((function(t){return t.next(n)}))}o=!1}}()},getSnapshot:function(){return n},subscribe:function(t,e,r){var o=vt(t,e,r);return i.add(o),o.next(n),{unsubscribe:function(){i.delete(o)}}}}),s={parent:e.parent,self:a,id:e.id||"anonymous",observers:i};return n=t.start?t.start(s):n,a}(t,{id:e,parent:this});return this.children.set(e,n),n},t.prototype.spawnPromise=function(t,e){var n,i,r=this,o=!1;t.then((function(t){o||(i=t,r.removeChild(e),r.send(lt(_t(e,t),{origin:e})))}),(function(t){if(!o){r.removeChild(e);var n=Et(e,t);try{r.send(lt(n,{origin:e}))}catch(t){r.devTools&&r.devTools.send(n,r.state),r.machine.strict&&r.stop()}}}));var a=((n={id:e,send:function(){},subscribe:function(e,n,i){var r=vt(e,n,i),o=!1;return t.then((function(t){o||(r.next(t),!o&&r.complete())}),(function(t){o||r.error(t)})),{unsubscribe:function(){return o=!0}}},stop:function(){o=!0},toJSON:function(){return{id:e}},getSnapshot:function(){return i}})[st]=function(){return this},n);return this.children.set(e,a),a},t.prototype.spawnCallback=function(t,e){var n,i,r,o=this,a=!1,s=new Set,c=new Set;try{r=t((function(t){i=t,c.forEach((function(e){return e(t)})),!a&&o.send(lt(t,{origin:e}))}),(function(t){s.add(t)}))}catch(t){this.send(Et(e,t))}if(Z(r))return this.spawnPromise(r,e);var u=((n={id:e,send:function(t){return s.forEach((function(e){return e(t)}))},subscribe:function(t){var e=vt(t);return c.add(e.next),{unsubscribe:function(){c.delete(e.next)}}},stop:function(){a=!0,rt(r)&&r()},toJSON:function(){return{id:e}},getSnapshot:function(){return i}})[st]=function(){return this},n);return this.children.set(e,u),u},t.prototype.spawnObservable=function(t,e){var n,i,r=this,o=t.subscribe((function(t){i=t,r.send(lt(t,{origin:e}))}),(function(t){r.removeChild(e),r.send(lt(Et(e,t),{origin:e}))}),(function(){r.removeChild(e),r.send(lt(_t(e),{origin:e}))})),a=((n={id:e,send:function(){},subscribe:function(e,n,i){return t.subscribe(e,n,i)},stop:function(){return o.unsubscribe()},getSnapshot:function(){return i},toJSON:function(){return{id:e}}})[st]=function(){return this},n);return this.children.set(e,a),a},t.prototype.spawnActor=function(t,e){return this.children.set(e,t),t},t.prototype.spawnActivity=function(t){var e=this.machine.options&&this.machine.options.activities?this.machine.options.activities[t.type]:void 0;if(e){var n=e(this.state.context,t);this.spawnEffect(t.id,n)}},t.prototype.spawnEffect=function(t,e){var n;this.children.set(t,((n={id:t,send:function(){},subscribe:function(){return{unsubscribe:function(){}}},stop:e||void 0,getSnapshot:function(){},toJSON:function(){return{id:t}}})[st]=function(){return this},n))},t.prototype.attachDev=function(){var t=Qt();if(this.options.devTools&&t){if(t.__REDUX_DEVTOOLS_EXTENSION__){var e="object"==d(this.options.devTools)?this.options.devTools:void 0;this.devTools=t.__REDUX_DEVTOOLS_EXTENSION__.connect(g(g({name:this.id,autoPause:!0,stateSanitizer:function(t){return{value:t.value,context:t.context,actions:t.actions}}},e),{features:g({jump:!1,skip:!1},e?e.features:void 0)}),this.machine),this.devTools.init(this.state)}!function(t){if(Qt()){var e=function(){var t=Qt();if(t&&"__xstate__"in t)return t.__xstate__}();e&&e.register(t)}}(this)}},t.prototype.toJSON=function(){return{id:this.id}},t.prototype[st]=function(){return this},t.prototype.getSnapshot=function(){return this.status===Ht.NotStarted?this.initialState:this._state},t.defaultOptions={execute:!0,deferEvents:!0,clock:{setTimeout:function(t){function e(e,n){return t.apply(this,arguments)}return e.toString=function(){return t.toString()},e}((function(t,e){return setTimeout(t,e)})),clearTimeout:function(t){function e(e){return t.apply(this,arguments)}return e.toString=function(){return t.toString()},e}((function(t){return clearTimeout(t)}))},logger:console.log.bind(console),devTools:!1},t.interpret=Kt,t}();function Kt(t,e){return new Wt(t,e)}function Yt(t){return"string"==typeof t?{type:t,toString:function(){return t}}:t}function Zt(t){return g(g({type:N},t),{toJSON:function(){t.onDone,t.onError;var e=m(t,["onDone","onError"]);return g(g({},e),{type:N,src:Yt(t.src)})}})}var te={},ee=function(t){return"#"===t[0]},ne=function(){function t(e,n,i,r){void 0===i&&(i="context"in e?e.context:void 0);var o,a=this;this.config=e,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=f({actions:{},guards:{},services:{},activities:{},delays:{}},n),this.parent=null==r?void 0:r.parent,this.key=this.config.key||(null==r?void 0: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:"."),this.id=this.config.id||w([this.machine.key],S(this.path),!1).join(this.delimiter),this.version=this.parent?this.parent.version:this.config.version,this.type=this.config.type||(this.config.parallel?"parallel":this.config.states&&Object.keys(this.config.states).length?"compound":this.config.history?"history":"atomic"),this.schema=this.parent?this.machine.schema:null!==(o=this.config.schema)&&void 0!==o?o:{},this.description=this.config.description,this.initial=this.config.initial,this.states=this.config.states?$(this.config.states,(function(e,n){var i,r=new t(e,{},void 0,{parent:a,key:n});return f(a.idMap,g(((i={})[r.id]=r,i),r.idMap)),r})):te;var s=0;(function t(e){var n,i;e.order=s++;try{for(var r=b(At(e)),o=r.next();!o.done;o=r.next())t(o.value)}catch(t){n={error:t}}finally{try{o&&!o.done&&(i=r.return)&&i.call(r)}finally{if(n)throw n.error}}})(this),this.history=!0===this.config.history?"shallow":this.config.history||!1,this._transient=!!this.config.always||!!this.config.on&&(Array.isArray(this.config.on)?this.config.on.some((function(t){return""===t.event})):""in this.config.on),this.strict=!!this.config.strict,this.onEntry=K(this.config.entry||this.config.onEntry).map((function(t){return bt(t)})),this.onExit=K(this.config.exit||this.config.onExit).map((function(t){return bt(t)})),this.meta=this.config.meta,this.doneData="final"===this.type?this.config.data:void 0,this.invoke=K(this.config.invoke).map((function(t,e){var n,i;if(ct(t)){var r=pt(a.id,e);return a.machine.options.services=g(((n={})[r]=t,n),a.machine.options.services),Zt({src:r,id:r})}if(ot(t.src))return r=t.id||pt(a.id,e),Zt(g(g({},t),{id:r,src:t.src}));if(ct(t.src)||rt(t.src))return r=t.id||pt(a.id,e),a.machine.options.services=g(((i={})[r]=t.src,i),a.machine.options.services),Zt(g(g({id:r},t),{src:r}));var o=t.src;return Zt(g(g({id:pt(a.id,e)},t),{src:o}))})),this.activities=K(this.config.activities).concat(this.invoke).map((function(t){return wt(t)})),this.transition=this.transition.bind(this),this.tags=K(this.config.tags)}return t.prototype._init=function(){this.__cache.transitions||Lt(this).forEach((function(t){return t.on}))},t.prototype.withConfig=function(e,n){var i=this.options,r=i.actions,o=i.activities,a=i.guards,s=i.services,c=i.delays;return new t(this.config,{actions:g(g({},r),e.actions),activities:g(g({},o),e.activities),guards:g(g({},a),e.guards),services:g(g({},s),e.services),delays:g(g({},c),e.delays)},null!=n?n:this.context)},t.prototype.withContext=function(e){return new t(this.config,this.options,e)},Object.defineProperty(t.prototype,"context",{get:function(){return rt(this._context)?this._context():this._context},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"definition",{get:function(){return{id:this.id,key:this.key,version:this.version,context:this.context,type:this.type,initial:this.initial,history:this.history,states:$(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}),t.prototype.toJSON=function(){return this.definition},Object.defineProperty(t.prototype,"on",{get:function(){if(this.__cache.on)return this.__cache.on;var t=this.transitions;return this.__cache.on=t.reduce((function(t,e){return t[e.eventType]=t[e.eventType]||[],t[e.eventType].push(e),t}),{})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"after",{get:function(){return this.__cache.delayedTransitions||(this.__cache.delayedTransitions=this.getDelayedTransitions(),this.__cache.delayedTransitions)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"transitions",{get:function(){return this.__cache.transitions||(this.__cache.transitions=this.formatTransitions(),this.__cache.transitions)},enumerable:!1,configurable:!0}),t.prototype.getCandidates=function(t){if(this.__cache.candidates[t])return this.__cache.candidates[t];var e=""===t,n=this.transitions.filter((function(n){var i=n.eventType===t;return e?i:i||"*"===n.eventType}));return this.__cache.candidates[t]=n,n},t.prototype.getDelayedTransitions=function(){var t=this,e=this.config.after;if(!e)return[];var n=function(e,n){var i=function(t,e){var n=e?"#".concat(e):"";return"".concat(v.After,"(").concat(t,")").concat(n)}(rt(e)?"".concat(t.id,":delay[").concat(n,"]"):e,t.id);return t.onEntry.push(function(t,e){return{to:e?e.to:void 0,type:O,event:rt(t)?t:ut(t),delay:e?e.delay:void 0,id:e&&void 0!==e.id?e.id:rt(t)?t.name:q(t)}}(i,{delay:e})),t.onExit.push(function(t){return{type:k,sendId:t}}(i)),i};return(it(e)?e.map((function(t,e){var i=n(t.delay,e);return g(g({},t),{event:i})})):G(Object.keys(e).map((function(t,i){var r=e[t],o=ot(r)?{target:r}:r,a=isNaN(+t)?t:+t,s=n(a,i);return K(o).map((function(t){return g(g({},t),{event:s,delay:a})}))})))).map((function(e){var n=e.delay;return g(g({},t.formatTransition(e)),{delay:n})}))},t.prototype.getStateNodes=function(t){var e,n=this;if(!t)return[];var i=t instanceof qt?t.value:J(t,this.delimiter);if(ot(i)){var r=this.getStateNode(i).initial;return void 0!==r?this.getStateNodes(((e={})[i]=r,e)):[this,this.states[i]]}var o=Object.keys(i),a=[this];return a.push.apply(a,w([],S(G(o.map((function(t){return n.getStateNode(t).getStateNodes(i[t])})))),!1)),a},t.prototype.handles=function(t){var e=q(t);return this.events.includes(e)},t.prototype.resolveState=function(t){var e=t instanceof qt?t:qt.create(t),n=Array.from(It([],this.getStateNodes(e.value)));return new qt(g(g({},e),{value:this.resolve(e.value),configuration:n,done:Rt(n,this),tags:zt(n),machine:this.machine}))},t.prototype.transitionLeafNode=function(t,e,n){var i=this.getStateNode(t).next(e,n);return i&&i.transitions.length?i:this.next(e,n)},t.prototype.transitionCompoundNode=function(t,e,n){var i=Object.keys(t),r=this.getStateNode(i[0])._transition(t[i[0]],e,n);return r&&r.transitions.length?r:this.next(e,n)},t.prototype.transitionParallelNode=function(t,e,n){var i,r,o={};try{for(var a=b(Object.keys(t)),s=a.next();!s.done;s=a.next()){var c=s.value,u=t[c];if(u){var l=this.getStateNode(c)._transition(u,e,n);l&&(o[c]=l)}}}catch(t){i={error:t}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}var h=Object.keys(o).map((function(t){return o[t]})),f=G(h.map((function(t){return t.transitions})));if(!h.some((function(t){return t.transitions.length>0})))return this.next(e,n);var d=G(Object.keys(o).map((function(t){return o[t].configuration})));return{transitions:f,exitSet:G(h.map((function(t){return t.exitSet}))),configuration:d,source:e,actions:G(Object.keys(o).map((function(t){return o[t].actions})))}},t.prototype._transition=function(t,e,n){return ot(t)?this.transitionLeafNode(t,e,n):1===Object.keys(t).length?this.transitionCompoundNode(t,e,n):this.transitionParallelNode(t,e,n)},t.prototype.getTransitionData=function(t,e){return this._transition(t.value,t,lt(e))},t.prototype.next=function(t,e){var n,i,r,o=this,a=e.name,s=[],c=[];try{for(var u=b(this.getCandidates(a)),l=u.next();!l.done;l=u.next()){var h=l.value,f=h.cond,d=h.in,v=t.context,p=!d||(ot(d)&&ee(d)?t.matches(J(this.getStateNodeById(d).path,this.delimiter)):U(J(d,this.delimiter),Q(this.path.slice(0,-2))(t.value))),y=!1;try{y=!f||ft(this.machine,f,v,e,t)}catch(t){throw new Error("Unable to evaluate guard '".concat(f.name||f.type,"' in transition for event '").concat(a,"' in state node '").concat(this.id,"':\n").concat(t.message))}if(y&&p){void 0!==h.target&&(c=h.target),s.push.apply(s,w([],S(h.actions),!1)),r=h;break}}}catch(t){n={error:t}}finally{try{l&&!l.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}if(r){if(!c.length)return{transitions:[r],exitSet:[],configuration:t.value?[this]:[],source:t,actions:s};var g=G(c.map((function(e){return o.getRelativeStateNodes(e,t.historyValue)})));return{transitions:[r],exitSet:r.internal?[]:G(c.map((function(t){return o.getPotentiallyReenteringNodes(t)}))),configuration:g,source:t,actions:s}}},t.prototype.getPotentiallyReenteringNodes=function(t){if(this.order<t.order)return[this];for(var e=[],n=this,i=t;n&&n!==i;)e.push(n),n=n.parent;return n!==i?[]:(e.push(i),e)},t.prototype.getActions=function(t,e,n,i,r,o,a){var s,c,u,l,h=this,f=o?It([],this.getStateNodes(o.value)):[],d=new Set;try{for(var p=b(Array.from(t).sort((function(t,e){return t.order-e.order}))),y=p.next();!y.done;y=p.next())(!Mt(f,x=y.value)||Mt(n.exitSet,x)||x.parent&&d.has(x.parent))&&d.add(x)}catch(t){s={error:t}}finally{try{y&&!y.done&&(c=p.return)&&c.call(p)}finally{if(s)throw s.error}}try{for(var g=b(f),m=g.next();!m.done;m=g.next()){var x;(!Mt(t,x=m.value)||Mt(n.exitSet,x.parent))&&n.exitSet.push(x)}}catch(t){u={error:t}}finally{try{m&&!m.done&&(l=g.return)&&l.call(g)}finally{if(u)throw u.error}}n.exitSet.sort((function(t,e){return e.order-t.order}));var _=Array.from(d).sort((function(t,e){return t.order-e.order})),O=new Set(n.exitSet),k=G(_.map((function(t){var e=[];if("final"!==t.type)return e;var o=t.parent;if(!o.parent)return e;e.push(xt(t.id,t.doneData),xt(o.id,t.doneData?Y(t.doneData,i,r):void 0));var a=o.parent;return"parallel"===a.type&&Nt(a).every((function(t){return Rt(n.configuration,t)}))&&e.push(xt(a.id)),e}))),j=_.map((function(t){var e=t.onEntry,n=t.activities.map((function(t){return function(t){var e=wt(t);return{type:v.Start,activity:e,exec:void 0}}(t)}));return{type:"entry",actions:St(a?w(w([],S(e),!1),S(n),!1):w(w([],S(n),!1),S(e),!1),h.machine.options.actions)}})).concat({type:"state_done",actions:k.map((function(t){return function(t,e){return{type:E,event:"function"==typeof t?t:ut(t),delay:void 0,id:void 0}}(t)}))}),P=Array.from(O).map((function(t){return{type:"exit",actions:St(w(w([],S(t.onExit),!1),S(t.activities.map((function(t){return function(t){var e=rt(t)?t:wt(t);return{type:v.Stop,activity:e,exec:void 0}}(t)}))),!1),h.machine.options.actions)}})),T=P.concat({type:"transition",actions:St(n.actions,this.machine.options.actions)}).concat(j);if(e){var A=St(G(w([],S(t),!1).sort((function(t,e){return e.order-t.order})).map((function(t){return t.onExit}))),this.machine.options.actions).filter((function(t){return!yt(t)}));return T.concat({type:"stop",actions:A})}return T},t.prototype.transition=function(t,e,n,i){void 0===t&&(t=this.initialState);var r,o=lt(e);if(t instanceof qt)r=void 0===n?t:this.resolveState(qt.from(t,n));else{var a=ot(t)?this.resolve(F(this.getResolvedPath(t))):this.resolve(t),s=null!=n?n:this.machine.context;r=this.resolveState(qt.from(a,s))}if(this.strict&&!this.events.includes(o.name)&&!function(t){return/^(done|error)\./.test(t)}(o.name))throw new Error("Machine '".concat(this.id,"' does not accept event '").concat(o.name,"'"));var c=this._transition(r.value,r,o)||{transitions:[],configuration:[],exitSet:[],source:r,actions:[]},u=It([],this.getStateNodes(r.value)),l=c.configuration.length?It(u,c.configuration):u;return c.configuration=w([],S(l),!1),this.resolveTransition(c,r,r.context,i,o)},t.prototype.resolveRaisedTransition=function(t,e,n,i){var r,o=t.actions;return(t=this.transition(t,e,void 0,i))._event=n,t.event=n.data,(r=t.actions).unshift.apply(r,w([],S(o),!1)),t},t.prototype.resolveTransition=function(t,e,n,i,r){var o,a,s,c,u=this;void 0===r&&(r=gt);var l=t.configuration,h=!e||t.transitions.length>0,f=h?t.configuration:e?e.configuration:[],v=Rt(f,this),p=h?Vt(this.machine,l):void 0,y=e?e.historyValue?e.historyValue:t.source?this.machine.historyValue(e.value):void 0:void 0,m=this.getActions(new Set(f),v,t,n,r,e,i),w=e?g({},e.activities):{};try{for(var E=b(m),O=E.next();!O.done;O=E.next()){var k=O.value;try{for(var P=(s=void 0,b(k.actions)),T=P.next();!T.done;T=P.next()){var A=T.value;A.type===x?w[A.activity.id||A.activity.type]=A:A.type===_&&(w[A.activity.id||A.activity.type]=!1)}}catch(t){s={error:t}}finally{try{T&&!T.done&&(c=P.return)&&c.call(P)}finally{if(s)throw s.error}}}}catch(t){o={error:t}}finally{try{O&&!O.done&&(a=E.return)&&a.call(E)}finally{if(o)throw o.error}}var L=S(Ot(this,e,n,r,m,i,this.machine.config.predictableActionArguments||this.machine.config.preserveActionOrder),2),I=L[0],C=L[1],V=S(function(t,e){var n,i,r=S([[],[]],2),o=r[0],a=r[1];try{for(var s=b(t),c=s.next();!c.done;c=s.next()){var u=c.value;e(u)?o.push(u):a.push(u)}}catch(t){n={error:t}}finally{try{c&&!c.done&&(i=s.return)&&i.call(s)}finally{if(n)throw n.error}}return[o,a]}(I,yt),2),M=V[0],R=V[1],z=I.filter((function(t){var e;return t.type===x&&(null===(e=t.activity)||void 0===e?void 0:e.type)===N})).reduce((function(t,e){return t[e.activity.id]=function(t,e,n,i){var r,o=dt(t.src),a=null===(r=null==e?void 0:e.options.services)||void 0===r?void 0:r[o.type],s=t.data?Y(t.data,n,i):void 0,c=a?Pt(a,t.id,s):jt(t.id);return c.meta=t,c}(e.activity,u.machine,C,r),t}),e?g({},e.children):{}),U=new qt({value:p||e.value,context:C,_event:r,_sessionid:e?e._sessionid:null,historyValue:p?y?et(y,p):void 0:e?e.historyValue:void 0,history:!p||t.source?e:void 0,actions:p?R:[],activities:p?w:e?e.activities:{},events:[],configuration:f,transitions:t.transitions,children:z,done:v,tags:zt(f),machine:this}),q=n!==C;U.changed=r.name===D||q;var B=U.history;B&&delete B.history;var J=!v&&(this._transient||l.some((function(t){return t._transient})));if(!(h||J&&""!==r.name))return U;var F=U;if(!v)for(J&&(F=this.resolveRaisedTransition(F,{type:j},r,i));M.length;){var $=M.shift();F=this.resolveRaisedTransition(F,$._event,r,i)}var X=F.changed||(B?!!F.actions.length||q||d(B.value)!=d(F.value)||!Ut(F.value,B.value):void 0);return F.changed=X,F.history=B,F},t.prototype.getStateNode=function(t){if(ee(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 e=this.states[t];if(!e)throw new Error("Child state '".concat(t,"' does not exist on '").concat(this.id,"'"));return e},t.prototype.getStateNodeById=function(t){var e=ee(t)?t.slice(1):t;if(e===this.id)return this;var n=this.machine.idMap[e];if(!n)throw new Error("Child state node '#".concat(e,"' does not exist on machine '").concat(this.id,"'"));return n},t.prototype.getStateNodeByPath=function(t){if("string"==typeof t&&ee(t))try{return this.getStateNodeById(t.slice(1))}catch(t){}for(var e=B(t,this.delimiter).slice(),n=this;e.length;){var i=e.shift();if(!i.length)break;n=n.getStateNode(i)}return n},t.prototype.resolve=function(t){var e,n=this;if(!t)return this.initialStateValue||te;switch(this.type){case"parallel":return $(this.initialStateValue,(function(e,i){return e?n.getStateNode(i).resolve(t[i]||e):te}));case"compound":if(ot(t)){var i=this.getStateNode(t);return"parallel"===i.type||"compound"===i.type?((e={})[t]=i.initialStateValue,e):t}return Object.keys(t).length?$(t,(function(t,e){return t?n.getStateNode(e).resolve(t):te})):this.initialStateValue||{};default:return t||te}},t.prototype.getResolvedPath=function(t){if(ee(t)){var e=this.machine.idMap[t.slice(1)];if(!e)throw new Error("Unable to find state node '".concat(t,"'"));return e.path}return B(t,this.delimiter)},Object.defineProperty(t.prototype,"initialStateValue",{get:function(){var t,e;if(this.__cache.initialStateValue)return this.__cache.initialStateValue;if("parallel"===this.type)e=X(this.states,(function(t){return t.initialStateValue||te}),(function(t){return"history"!==t.type}));else if(void 0!==this.initial){if(!this.states[this.initial])throw new Error("Initial state '".concat(this.initial,"' not found on '").concat(this.key,"'"));e=Tt(this.states[this.initial])?this.initial:((t={})[this.initial]=this.states[this.initial].initialStateValue,t)}else e={};return this.__cache.initialStateValue=e,this.__cache.initialStateValue},enumerable:!1,configurable:!0}),t.prototype.getInitialState=function(t,e){this._init();var n=this.getStateNodes(t);return this.resolveTransition({configuration:n,exitSet:[],transitions:[],source:void 0,actions:[]},void 0,null!=e?e:this.machine.context,void 0)},Object.defineProperty(t.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(t.prototype,"target",{get:function(){var t;if("history"===this.type){var e=this.config;t=ot(e.target)&&ee(e.target)?F(this.machine.getStateNodeById(e.target).path.slice(this.path.length-1)):e.target}return t},enumerable:!1,configurable:!0}),t.prototype.getRelativeStateNodes=function(t,e,n){return void 0===n&&(n=!0),n?"history"===t.type?t.resolveHistory(e):t.initialStateNodes:[t]},Object.defineProperty(t.prototype,"initialStateNodes",{get:function(){var t=this;return Tt(this)?[this]:"compound"!==this.type||this.initial?G(H(this.initialStateValue).map((function(e){return t.getFromRelativePath(e)}))):[this]},enumerable:!1,configurable:!0}),t.prototype.getFromRelativePath=function(t){if(!t.length)return[this];var e=S(t),n=e[0],i=e.slice(1);if(!this.states)throw new Error("Cannot retrieve subPath '".concat(n,"' from node with no states"));var r=this.getStateNode(n);if("history"===r.type)return r.resolveHistory();if(!this.states[n])throw new Error("Child state '".concat(n,"' does not exist on '").concat(this.id,"'"));return this.states[n].getFromRelativePath(i)},t.prototype.historyValue=function(t){if(Object.keys(this.states).length)return{current:t||this.initialStateValue,states:X(this.states,(function(e,n){if(!t)return e.historyValue();var i=ot(t)?void 0:t[n];return e.historyValue(i||e.initialStateValue)}),(function(t){return!t.history}))}},t.prototype.resolveHistory=function(t){var e=this;if("history"!==this.type)return[this];var n=this.parent;if(!t){var i=this.target;return i?G(H(i).map((function(t){return n.getFromRelativePath(t)}))):n.initialStateNodes}var r=function(t,e){return function(e){var n,i,r=e;try{for(var o=b(t),a=o.next();!a.done;a=o.next()){var s=a.value;r=r.states[s]}}catch(t){n={error:t}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}return r}}(n.path)(t).current;return ot(r)?[n.getStateNode(r)]:G(H(r).map((function(t){return"deep"===e.history?n.getFromRelativePath(t):[n.states[t[0]]]})))},Object.defineProperty(t.prototype,"stateIds",{get:function(){var t=this,e=G(Object.keys(this.states).map((function(e){return t.states[e].stateIds})));return[this.id].concat(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"events",{get:function(){var t,e,n,i;if(this.__cache.events)return this.__cache.events;var r=this.states,o=new Set(this.ownEvents);if(r)try{for(var a=b(Object.keys(r)),s=a.next();!s.done;s=a.next()){var c=r[s.value];if(c.states)try{for(var u=(n=void 0,b(c.events)),l=u.next();!l.done;l=u.next()){var h=l.value;o.add("".concat(h))}}catch(t){n={error:t}}finally{try{l&&!l.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}}}catch(e){t={error:e}}finally{try{s&&!s.done&&(e=a.return)&&e.call(a)}finally{if(t)throw t.error}}return this.__cache.events=Array.from(o)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ownEvents",{get:function(){var t=new Set(this.transitions.filter((function(t){return!(!t.target&&!t.actions.length&&t.internal)})).map((function(t){return t.eventType})));return Array.from(t)},enumerable:!1,configurable:!0}),t.prototype.resolveTarget=function(t){var e=this;if(void 0!==t)return t.map((function(t){if(!ot(t))return t;var n=t[0]===e.delimiter;if(n&&!e.parent)return e.getStateNodeByPath(t.slice(1));var i=n?e.key+t:t;if(!e.parent)return e.getStateNodeByPath(i);try{return e.parent.getStateNodeByPath(i)}catch(t){throw new Error("Invalid transition definition for state node '".concat(e.id,"':\n").concat(t.message))}}))},t.prototype.formatTransition=function(t){var e=this,n=function(t){if(void 0!==t&&""!==t)return K(t)}(t.target),i="internal"in t?t.internal:!n||n.some((function(t){return ot(t)&&t[0]===e.delimiter})),r=this.machine.options.guards,o=this.resolveTarget(n),a=g(g({},t),{actions:St(K(t.actions)),cond:at(t.cond,r),target:o,source:this,internal:i,eventType:t.event,toJSON:function(){return g(g({},a),{target:a.target?a.target.map((function(t){return"#".concat(t.id)})):void 0,source:"#".concat(e.id)})}});return a},t.prototype.formatTransitions=function(){var t,e,n,i=this;if(this.config.on)if(Array.isArray(this.config.on))n=this.config.on;else{var r=this.config.on,o=r["*"],a=void 0===o?[]:o,s=m(r,[(d("*"),"*")]);n=G(Object.keys(s).map((function(t){return ht(t,s[t])})).concat(ht("*",a)))}else n=[];var c=this.config.always?ht("",this.config.always):[],u=this.config.onDone?ht(String(xt(this.id)),this.config.onDone):[],l=G(this.invoke.map((function(t){var e=[];return t.onDone&&e.push.apply(e,w([],S(ht(String(_t(t.id)),t.onDone)),!1)),t.onError&&e.push.apply(e,w([],S(ht(String(Et(t.id)),t.onError)),!1)),e}))),h=this.after,f=G(w(w(w(w([],S(u),!1),S(l),!1),S(n),!1),S(c),!1).map((function(t){return K(t).map((function(t){return i.formatTransition(t)}))})));try{for(var v=b(h),p=v.next();!p.done;p=v.next()){var y=p.value;f.push(y)}}catch(e){t={error:e}}finally{try{p&&!p.done&&(e=v.return)&&e.call(v)}finally{if(t)throw t.error}}return f},t}(),ie={click:"onClick",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",complete:"onComplete",after:"onAfter",enter:"onEnter",show:"onShow"};Object.values(ie);var re=Object.keys(ie),oe=function(){function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.activeStateId="",this._service=void 0,this._domListeners=new Map,this._domElement=void 0,this._playerListeners=new Map,this._player=void 0,this._machineSchemas=new Map,this._onShowPrevValue=0,this._player=n,this._machineSchemas=this._transformToXStateSchema(e),this._domElement=n.container}var e,n;return e=t,n=[{key:"start",value:function(t){this.stop();var e=this._machineSchemas.get(t);if(d(e)>"u")throw(0,i.a)("invalid state machine id ".concat(t));this._service=Kt(function(t,e){return new ne(t,void 0)}(e)),this._addEventListeners(),this._service.start()}},{key:"stop",value:function(){var t;this._removeEventListeners(),null!==(t=this._service)&&void 0!==t&&t.stop(),this._player.stop()}},{key:"_removeEventListeners",value:function(){this._requiresDomElement();var t,e=s(this._domListeners);try{for(e.s();!(t=e.n()).done;){var n,i=a(t.value,2),r=i[0],o=i[1];"visibilityChange"===r&&this._player.stopPlayOnShow(),null!==(n=this._domElement)&&void 0!==n&&n.removeEventListener(r,o),this._domListeners.delete(r)}}catch(t){e.e(t)}finally{e.f()}var c,u=s(this._playerListeners);try{for(u.s();!(c=u.n()).done;){var l=a(c.value,2),h=l[0],f=l[1];this._player.removeEventListener(h,f),this._playerListeners.delete(h)}}catch(t){u.e(t)}finally{u.f()}}},{key:"_addEventListeners",value:function(){var t=this;this._requiresDomElement();var e=function(e){return function(){!function(e){t._service.send({type:e})}(e)}};this._service.subscribe((function(n){if(d(n.changed)>"u"||n.changed){t._removeEventListeners();var i,r=s(n.nextEvents);try{var o=function(){var n=i.value;if(re.filter((function(t){return"complete"!==t&&"show"!==t})).includes(n)){var r,o=e(n);t._domListeners.set(n,o),null===(r=t._domElement)||void 0===r||r.addEventListener(n,o,{once:!0})}else if("complete"===n){var a=e(n);t._player.addEventListener(n,a),t._playerListeners.set(n,a)}else if("show"===n){var s=e(n);t._player.addIntersectionObserver({callbackOnIntersect:function(e){e>0&&(100!==e&&t._onShowPrevValue!==e&&s(),t._onShowPrevValue=e)},threshold:[]}),t._domListeners.set("visibilityChange",s)}};for(r.s();!(i=r.n()).done;)o()}catch(t){r.e(t)}finally{r.f()}}}))}},{key:"subscribe",value:function(t){throw(0,i.a)(t.toString())}},{key:"_transformToXStateSchema",value:function(t){var e,n=this,r=new Map,a=s(t);try{for(a.s();!(e=a.n()).done;){var c=e.value,u={},l={};if(l.id=c.descriptor.id,d(c.descriptor.initial)<"u"&&(l.initial=c.descriptor.initial),d(c)<"u"){var h=c.states;for(var f in h)if(d(h[f])<"u"&&h[f]){var v,p=h[f],y=p.playbackSettings,g=Object.keys(p).filter((function(t){return t.startsWith("on")})),m={},b={},S=s(g);try{for(S.s();!(v=S.n()).done;){var w=v.value;if(d(p[w])<"u"){var x,_,E,O=p[w];w===ie.after?b[O.ms]={target:null!==(E=null==O?void 0:O.state)&&void 0!==E?E:""}:m[(0,i.h)(ie,w)]=w===ie.enter?{target:null!==(x=null==O?void 0:O.state)&&void 0!==x?x:""}:{target:null!==(_=null==O?void 0:O.state)&&void 0!==_?_:""}}}}catch(t){S.e(t)}finally{S.f()}u[f]={entry:function(){!n._player.getAnimationInstance()||p.animationId&&p.animationId!==n._player.currentAnimationId?n._player.play(p.animationId,(function(){return o(o({},i.l),y)})).then((function(){n._updatePlaybackSettings(y)})).catch((function(t){(0,i.b)("State machine error: ".concat(t.message))})):n._updatePlaybackSettings(y)},exit:function(){d(y.segments)<"u"&&n._player.resetSegments(!1),d(y.playOnScroll)<"u"&&n._player.stopPlayOnScroll()},on:m,after:b,meta:y}}}l.states=u,r.set(l.id,l)}}catch(t){a.e(t)}finally{a.f()}return r}},{key:"_handlePlaySegments",value:function(t){if("string"==typeof t.segments)this._player.goToAndPlay(t.segments,!0);else{var e=a(t.segments,2),n=e[0],i=e[1],r=n;0!==n&&n===i&&(r=n-1),0===n&&n===i?this._player.goToAndPlay(n,!0):this._player.playSegments([r,i],!0)}}},{key:"_handlePlayOnScroll",value:function(t){var e=t.playOnScroll;if(t.segments&&"string"!=typeof t.segments){var n=t.segments;this._player.playOnScroll({threshold:e,segments:n})}else this._player.playOnScroll({threshold:e})}},{key:"_updatePlaybackSettings",value:function(t){if(!this._player.getAnimationInstance())throw new Error("Unable to update playbackSettings. Animations is not rendered yet.");d(t.autoplay)<"u"&&(this._player.setAutoplay(t.autoplay),t.autoplay?this._player.play():this._player.pause()),d(t.direction)<"u"&&this._player.setDirection(t.direction),d(t.intermission)<"u"&&this._player.setIntermission(t.intermission),d(t.loop)<"u"&&this._player.setLoop(t.loop),d(t.playMode)<"u"&&this._player.setMode(t.playMode),d(t.speed)<"u"&&this._player.setSpeed(t.speed),d(t.defaultTheme)<"u"&&this._player.setDefaultTheme(t.defaultTheme),d(t.playOnScroll)<"u"&&this._handlePlayOnScroll(t),t.segments&&this._handlePlaySegments(t),t.autoplay||this._player.pause()}},{key:"_requiresDomElement",value:function(){if(!this._domElement)throw(0,i.a)("Requires a DOM element to attach events.")}}],n&&l(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),t}()}}]);