30 lines
70 KiB
JavaScript
Vendored
30 lines
70 KiB
JavaScript
Vendored
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8323],{99717:function(t,e,n){n.d(e,{e:function(){return N}});var r,i,o=n(67294),a=n(52798),s=n(63056),c=n(59043),u=n(54911),f=n(3884),h=n(30375),l=n(14066),d=n(89823),v={deferEvents:!1},p=function(){function t(t){this.processingEvent=!1,this.queue=[],this.initialized=!1,this.options=(0,s.pi)((0,s.pi)({},v),t)}return t.prototype.initialize=function(t){if(this.initialized=!0,t){if(!this.options.deferEvents){this.schedule(t);return}this.process(t)}this.flushEvents()},t.prototype.schedule=function(t){if(!this.initialized||this.processingEvent){this.queue.push(t);return}if(0!==this.queue.length)throw Error("Event queue should be empty when it is not processing events");this.process(t),this.flushEvents()},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}(),y=n(98933),g=new Map,m=0,x={bookId:function(){return"x:".concat(m++)},register:function(t,e){return g.set(t,e),t},get:function(t){return g.get(t)},free:function(t){g.delete(t)}};function b(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==n.g?n.g:void(l.M||console.warn("XState could not find a global object in this environment. Please let the maintainers know and raise an issue here: https://github.com/statelyai/xstate/issues"))}var S=n(10797),w={sync:!1,autoForward:!1};(r=i||(i={}))[r.NotStarted=0]="NotStarted",r[r.Running=1]="Running",r[r.Stopped=2]="Stopped";var _=function(){function t(e,n){void 0===n&&(n=t.defaultOptions);var r=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=i.NotStarted,this.children=new Map,this.forwardTo=new Set,this._outgoingQueue=[],this.init=this.start,this.send=function(t,e){if((0,d.kJ)(t))return r.batch(t),r.state;var n=(0,d.g5)((0,d._v)(t,e));if(r.status===i.Stopped)return l.M||(0,d.ZK)(!1,'Event "'.concat(n.name,'" was sent to stopped service "').concat(r.machine.id,'". This service has already reached its final state, and will not transition.\nEvent: ').concat(JSON.stringify(n.data))),r.state;if(r.status!==i.Running&&!r.options.deferEvents)throw Error('Event "'.concat(n.name,'" was sent to uninitialized service "').concat(r.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 r.scheduler.schedule(function(){r.forward(n);var t=r._nextState(n);r.update(t,n)}),r._state},this.sendTo=function(t,e,n){var o=r.parent&&(e===c.K.Parent||r.parent.id===e),a=o?r.parent:(0,d.HD)(e)?e===c.K.Internal?r:r.children.get(e)||x.get(e):(0,d.Bc)(e)?e:void 0;if(!a){if(!o)throw Error("Unable to send event to child '".concat(e,"' from service '").concat(r.id,"'."));l.M||(0,d.ZK)(!1,"Service '".concat(r.id,"' has no parent: unable to send event ").concat(t.type));return}if("machine"in a){if(r.status!==i.Stopped||r.parent!==a||r.state.done){var u=(0,s.pi)((0,s.pi)({},t),{name:t.name===f.vU?"".concat((0,h.vU)(r.id)):t.name,origin:r.sessionId});!n&&r.machine.config.predictableActionArguments?r._outgoingQueue.push([a,u]):a.send(u)}}else!n&&r.machine.config.predictableActionArguments?r._outgoingQueue.push([a,t.data]):a.send(t.data)},this._exec=function(t,e,n,o){void 0===o&&(o=r.machine.options.actions);var a=t.exec||(0,h.o$)(t.type,o),s=(0,d.mf)(a)?a:a?a.exec:t.exec;if(s)try{return s(e,n.data,r.machine.config.predictableActionArguments?{action:t,_event:n}:{action:t,state:r.state,_event:n})}catch(t){throw r.parent&&r.parent.send({type:"xstate.error",data:t}),t}switch(t.type){case f.OU:r.defer(t);break;case f.lW:if("number"==typeof t.delay){r.defer(t);return}t.to?r.sendTo(t._event,t.to,n===h.bf):r.send(t._event);break;case f.al:r.cancel(t.sendId);break;case f.BL:if(r.status!==i.Running)return;var u=t.activity;if(!r.machine.config.predictableActionArguments&&!r.state.activities[u.id||u.type])break;if(u.type===c.M.Invoke){var v=(0,d.j)(u.src),p=r.machine.options.services?r.machine.options.services[v.type]:void 0,y=u.id,g=u.data;l.M||(0,d.ZK)(!("forward"in u),"`forward` property is deprecated (found in invocation of '".concat(u.src,"' in in machine '").concat(r.machine.id,"'). ")+"Please use `autoForward` instead.");var m="autoForward"in u?u.autoForward:!!u.forward;if(!p){l.M||(0,d.ZK)(!1,"No service found for invocation '".concat(u.src,"' in machine '").concat(r.machine.id,"'."));return}var x=g?(0,d.QX)(g,e,n):void 0;if("string"==typeof p)return;var b=(0,d.mf)(p)?p(e,n.data,{data:x,src:v,meta:u.meta}):p;if(!b)return;var S=void 0;(0,d.O4)(b)&&(b=x?b.withContext(x):b,S={autoForward:m}),r.spawn(b,y,S)}else r.spawnActivity(u);break;case f.sT:r.stopChild(t.activity.id);break;case f.cM:var w=t.label,_=t.value;w?r.logger(w,_):r.logger(_);break;default:l.M||(0,d.ZK)(!1,"No implementation found for action type '".concat(t.type,"'"))}};var o=(0,s.pi)((0,s.pi)({},t.defaultOptions),n),a=o.clock,u=o.logger,v=o.parent,y=o.id,g=void 0!==y?y:e.id;this.id=g,this.logger=u,this.clock=a,this.parent=v,this.options=o,this.scheduler=new p({deferEvents:this.options.deferEvents}),this.sessionId=x.bookId()}return Object.defineProperty(t.prototype,"initialState",{get:function(){var t=this;return this._initialState?this._initialState:(0,S.J)(this,function(){return t._initialState=t.machine.initialState,t._initialState})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"state",{get:function(){return l.M||(0,d.ZK)(this.status!==i.NotStarted,"Attempted to read state from uninitialized service '".concat(this.id,"'. Make sure the service is started first.")),this._state},enumerable:!1,configurable:!0}),t.prototype.execute=function(t,e){var n,r;try{for(var i=(0,s.XA)(t.actions),o=i.next();!o.done;o=i.next()){var a=o.value;this.exec(a,t,e)}}catch(t){n={error:t}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}},t.prototype.update=function(t,e){var n,r,i,o,a,c,u,f,l=this;if(t._sessionid=this.sessionId,this._state=t,(!this.machine.config.predictableActionArguments||e===h.bf)&&this.options.execute)this.execute(this.state);else for(var v=void 0;v=this._outgoingQueue.shift();)v[0].send(v[1]);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 p=(0,s.XA)(this.eventListeners),y=p.next();!y.done;y=p.next()){var g=y.value;g(t.event)}}catch(t){n={error:t}}finally{try{y&&!y.done&&(r=p.return)&&r.call(p)}finally{if(n)throw n.error}}try{for(var m=(0,s.XA)(this.listeners),b=m.next();!b.done;b=m.next()){var g=b.value;g(t,t.event)}}catch(t){i={error:t}}finally{try{b&&!b.done&&(o=m.return)&&o.call(m)}finally{if(i)throw i.error}}try{for(var S=(0,s.XA)(this.contextListeners),w=S.next();!w.done;w=S.next())(0,w.value)(this.state.context,this.state.history?this.state.history.context:void 0)}catch(t){a={error:t}}finally{try{w&&!w.done&&(c=S.return)&&c.call(S)}finally{if(a)throw a.error}}if(this.state.done){var _=t.configuration.find(function(t){return"final"===t.type&&t.parent===l.machine}),E=_&&_.doneData?(0,d.QX)(_.doneData,t.context,e):void 0;this._doneEvent=(0,h.Sl)(this.id,E);try{for(var O=(0,s.XA)(this.doneListeners),A=O.next();!A.done;A=O.next()){var g=A.value;g(this._doneEvent)}}catch(t){u={error:t}}finally{try{A&&!A.done&&(f=O.return)&&f.call(O)}finally{if(u)throw u.error}}this._stop(),this._stopChildren(),x.free(this.sessionId)}},t.prototype.onTransition=function(t){return this.listeners.add(t),this.status===i.Running&&t(this.state,this.state.event),this},t.prototype.subscribe=function(t,e,n){var r=this,o=(0,d.zM)(t,e,n);this.listeners.add(o.next),this.status!==i.NotStarted&&o.next(this.state);var a=function(){r.doneListeners.delete(a),r.stopListeners.delete(a),o.complete()};return this.status===i.Stopped?o.complete():(this.onDone(a),this.onStop(a)),{unsubscribe:function(){r.listeners.delete(o.next),r.doneListeners.delete(a),r.stopListeners.delete(a)}}},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===i.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===i.Running)return this;this.machine._init(),x.register(this.sessionId,this),this.initialized=!0,this.status=i.Running;var n=void 0===t?this.initialState:(0,S.J)(this,function(){return(0,u.TL)(t)?e.machine.resolveState(t):e.machine.resolveState(u.ZM.from(t,e.machine.context))});return this.options.devTools&&this.attachDev(),this.scheduler.initialize(function(){e.update(n,h.bf)}),this},t.prototype._stopChildren=function(){this.children.forEach(function(t){(0,d.mf)(t.stop)&&t.stop()}),this.children.clear()},t.prototype._stop=function(){var t,e,n,r,o,a,c,u,f,h;try{for(var l=(0,s.XA)(this.listeners),d=l.next();!d.done;d=l.next()){var v=d.value;this.listeners.delete(v)}}catch(e){t={error:e}}finally{try{d&&!d.done&&(e=l.return)&&e.call(l)}finally{if(t)throw t.error}}try{for(var y=(0,s.XA)(this.stopListeners),g=y.next();!g.done;g=y.next()){var v=g.value;v(),this.stopListeners.delete(v)}}catch(t){n={error:t}}finally{try{g&&!g.done&&(r=y.return)&&r.call(y)}finally{if(n)throw n.error}}try{for(var m=(0,s.XA)(this.contextListeners),x=m.next();!x.done;x=m.next()){var v=x.value;this.contextListeners.delete(v)}}catch(t){o={error:t}}finally{try{x&&!x.done&&(a=m.return)&&a.call(m)}finally{if(o)throw o.error}}try{for(var b=(0,s.XA)(this.doneListeners),S=b.next();!S.done;S=b.next()){var v=S.value;this.doneListeners.delete(v)}}catch(t){c={error:t}}finally{try{S&&!S.done&&(u=b.return)&&u.call(b)}finally{if(c)throw c.error}}if(!this.initialized)return this;this.initialized=!1,this.status=i.Stopped,this._initialState=void 0;try{for(var w=(0,s.XA)(Object.keys(this.delayedEventsMap)),_=w.next();!_.done;_=w.next()){var E=_.value;this.clock.clearTimeout(this.delayedEventsMap[E])}}catch(t){f={error:t}}finally{try{_&&!_.done&&(h=w.return)&&h.call(w)}finally{if(f)throw f.error}}this.scheduler.clear(),this.scheduler=new p({deferEvents:this.options.deferEvents})},t.prototype.stop=function(){var t=this,e=this.scheduler;return this._stop(),e.schedule(function(){var e=(0,d.g5)({type:"xstate.stop"}),n=(0,S.J)(t,function(){var n=(0,d.xH)((0,s.ev)([],(0,s.CR)(t.state.configuration),!1).sort(function(t,e){return e.order-t.order}).map(function(e){return(0,h.AE)(e.onExit,t.machine.options.actions)})),r=(0,s.CR)((0,h.yC)(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),i=r[0],o=r[1],a=new u.ZM({value:t.state.value,context:o,_event:e,_sessionid:t.sessionId,historyValue:void 0,history:t.state,actions:i.filter(function(t){return!(0,d.vK)(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(),x.free(t.sessionId)}),this},t.prototype.batch=function(t){var e=this;if(this.status===i.NotStarted&&this.options.deferEvents)l.M||(0,d.ZK)(!1,"".concat(t.length,' event(s) were sent to uninitialized service "').concat(this.machine.id,'" and are deferred. Make sure .start() is called for this service.\nEvent: ').concat(JSON.stringify(event)));else if(this.status!==i.Running)throw 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 r,i,o=e.state,a=!1,c=[];try{for(var f=(0,s.XA)(t),h=f.next();!h.done;h=f.next()){var l=h.value;!function(t){var r=(0,d.g5)(t);e.forward(r),o=(0,S.J)(e,function(){return e.machine.transition(o,r,void 0,n||void 0)}),c.push.apply(c,(0,s.ev)([],(0,s.CR)(e.machine.config.predictableActionArguments?o.actions:o.actions.map(function(t){return(0,u.j1)(t,o)})),!1)),a=a||!!o.changed}(l)}}catch(t){r={error:t}}finally{try{h&&!h.done&&(i=f.return)&&i.call(f)}finally{if(r)throw r.error}}o.changed=a,o.actions=c,e.update(o,(0,d.g5)(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 r=(0,d.g5)(t);if(0===r.name.indexOf(f.Mg)&&!this.state.nextEvents.some(function(t){return 0===t.indexOf(f.Mg)}))throw r.data.data;return(0,S.J)(this,function(){return n.machine.transition(n.state,r,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 r=(0,s.XA)(this.forwardTo),i=r.next();!i.done;i=r.next()){var o=i.value,a=this.children.get(o);if(!a)throw 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{i&&!i.done&&(n=r.return)&&n.call(r)}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),(0,d.mf)(e.stop)&&e.stop())},t.prototype.spawn=function(t,e,n){if(this.status!==i.Running)return(0,y.Xg)(t,e);if((0,d.y8)(t))return this.spawnPromise(Promise.resolve(t),e);if((0,d.mf)(t))return this.spawnCallback(t,e);if((0,y.f3)(t))return this.spawnActor(t,e);if((0,d.bi)(t))return this.spawnObservable(t,e);if((0,d.O4)(t))return this.spawnMachine(t,(0,s.pi)((0,s.pi)({},n),{id:e}));if((0,d.HV)(t))return this.spawnBehavior(t,e);throw Error('Unable to spawn entity "'.concat(e,'" of type "').concat(typeof t,'".'))},t.prototype.spawnMachine=function(e,n){var r=this;void 0===n&&(n={});var i=new t(e,(0,s.pi)((0,s.pi)({},this.options),{parent:this,id:n.id||e.id})),o=(0,s.pi)((0,s.pi)({},w),n);return o.sync&&i.onTransition(function(t){r.send(f.Vx,{state:t,id:i.id})}),this.children.set(i.id,i),o.autoForward&&this.forwardTo.add(i.id),i.onDone(function(t){r.removeChild(i.id),r.send((0,d.g5)(t,{origin:i.id}))}).start(),i},t.prototype.spawnBehavior=function(t,e){var n,r,i,o,a,s,c,u,f=(n={id:e,parent:this},r=t.initialState,i=new Set,o=[],a=!1,s=function(){if(!a){for(a=!0;o.length>0;){var e=o.shift();r=t.transition(r,e,u),i.forEach(function(t){return t.next(r)})}a=!1}},c=(0,y.vk)({id:n.id,send:function(t){o.push(t),s()},getSnapshot:function(){return r},subscribe:function(t,e,n){var o=(0,d.zM)(t,e,n);return i.add(o),o.next(r),{unsubscribe:function(){i.delete(o)}}}}),u={parent:n.parent,self:c,id:n.id||"anonymous",observers:i},r=t.start?t.start(u):r,c);return this.children.set(e,f),f},t.prototype.spawnPromise=function(t,e){var n,r,i=this,o=!1;t.then(function(t){o||(r=t,i.removeChild(e),i.send((0,d.g5)((0,h.Sl)(e,t),{origin:e})))},function(t){if(!o){i.removeChild(e);var n=(0,h.vU)(e,t);try{i.send((0,d.g5)(n,{origin:e}))}catch(r){(0,d.v4)(t,r,e),i.devTools&&i.devTools.send(n,i.state),i.machine.strict&&i.stop()}}});var a=((n={id:e,send:function(){},subscribe:function(e,n,r){var i=(0,d.zM)(e,n,r),o=!1;return t.then(function(t){!o&&(i.next(t),o||i.complete())},function(t){o||i.error(t)}),{unsubscribe:function(){return o=!0}}},stop:function(){o=!0},toJSON:function(){return{id:e}},getSnapshot:function(){return r}})[d.L$]=function(){return this},n);return this.children.set(e,a),a},t.prototype.spawnCallback=function(t,e){var n,r,i,o=this,a=!1,s=new Set,c=new Set;try{i=t(function(t){r=t,c.forEach(function(e){return e(t)}),a||o.send((0,d.g5)(t,{origin:e}))},function(t){s.add(t)})}catch(t){this.send((0,h.vU)(e,t))}if((0,d.y8)(i))return this.spawnPromise(i,e);var u=((n={id:e,send:function(t){return s.forEach(function(e){return e(t)})},subscribe:function(t){var e=(0,d.zM)(t);return c.add(e.next),{unsubscribe:function(){c.delete(e.next)}}},stop:function(){a=!0,(0,d.mf)(i)&&i()},toJSON:function(){return{id:e}},getSnapshot:function(){return r}})[d.L$]=function(){return this},n);return this.children.set(e,u),u},t.prototype.spawnObservable=function(t,e){var n,r,i=this,o=t.subscribe(function(t){r=t,i.send((0,d.g5)(t,{origin:e}))},function(t){i.removeChild(e),i.send((0,d.g5)((0,h.vU)(e,t),{origin:e}))},function(){i.removeChild(e),i.send((0,d.g5)((0,h.Sl)(e),{origin:e}))}),a=((n={id:e,send:function(){},subscribe:function(e,n,r){return t.subscribe(e,n,r)},stop:function(){return o.unsubscribe()},getSnapshot:function(){return r},toJSON:function(){return{id:e}}})[d.L$]=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){l.M||(0,d.ZK)(!1,"No implementation found for activity '".concat(t.type,"'"));return}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}}})[d.L$]=function(){return this},n))},t.prototype.attachDev=function(){var t=b();if(this.options.devTools&&t){if(t.__REDUX_DEVTOOLS_EXTENSION__){var e="object"==typeof this.options.devTools?this.options.devTools:void 0;this.devTools=t.__REDUX_DEVTOOLS_EXTENSION__.connect((0,s.pi)((0,s.pi)({name:this.id,autoPause:!0,stateSanitizer:function(t){return{value:t.value,context:t.context,actions:t.actions}}},e),{features:(0,s.pi)({jump:!1,skip:!1},e?e.features:void 0)}),this.machine),this.devTools.init(this.state)}!function(t){if(b()){var e=function(){var t=b();if(t&&"__xstate__"in t)return t.__xstate__}();e&&e.register(t)}}(this)}},t.prototype.toJSON=function(){return{id:this.id}},t.prototype[d.L$]=function(){return this},t.prototype.getSnapshot=function(){return this.status===i.NotStarted?this.initialState:this._state},t.defaultOptions={execute:!0,deferEvents:!0,clock:{setTimeout:function(t,e){return setTimeout(t,e)},clearTimeout:function(t){return clearTimeout(t)}},logger:console.log.bind(console),devTools:!1},t.interpret=E,t}();function E(t,e){return new _(t,e)}var O=o.useLayoutEffect;function A(t){var e=o.useRef();return e.current||(e.current={v:t()}),e.current.v}var k=function(){return(k=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)},M=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&0>e.indexOf(r)&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)0>e.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n},j=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a};function T(t){return t}function N(t){for(var e,n,r,s,c,f,h,l,d,v=[],p=1;p<arguments.length;p++)v[p-1]=arguments[p];var y=j(v,1)[0],g=void 0===y?{}:y,m=(e=A(function(){return"function"==typeof t?t():t}),n=g.context,r=g.guards,s=g.actions,c=g.activities,f=g.services,h=g.delays,g.state,l=M(g,["context","guards","actions","activities","services","delays","state"]),d=A(function(){return E(e.withConfig({context:n,guards:r,actions:s,activities:c,services:f,delays:h},function(){return k(k({},e.context),n)}),l)}),O(function(){Object.assign(d.machine.options.actions,s),Object.assign(d.machine.options.guards,r),Object.assign(d.machine.options.activities,c),Object.assign(d.machine.options.services,f),Object.assign(d.machine.options.delays,h)},[s,r,c,f,h]),d),x=(0,o.useCallback)(function(){return m.status===i.NotStarted?g.state?u.ZM.create(g.state):m.machine.initialState:m.getSnapshot()},[m]),b=(0,o.useCallback)(function(t,e){return function(t,e,n){if(t.status===i.NotStarted)return!0;var r=void 0===n.changed&&(Object.keys(n.children).length>0||"boolean"==typeof e.changed);return!(n.changed||r)}(m,t,e)},[m]),S=(0,o.useCallback)(function(t){return m.subscribe(t).unsubscribe},[m]),w=(0,a.useSyncExternalStoreWithSelector)(S,x,x,T,b);return(0,o.useEffect)(function(){var t=g.state;return m.start(t?u.ZM.create(t):void 0),function(){m.stop(),m.status=i.NotStarted}},[]),[w,m.send,m]}},4511:function(t,e,n){n.d(e,{SV:function(){return a}});var r=n(67294);let i=(0,r.createContext)(null),o={didCatch:!1,error:null};class a extends r.Component{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=o}static getDerivedStateFromError(t){return{didCatch:!0,error:t}}resetErrorBoundary(){let{error:t}=this.state;if(null!==t){for(var e,n,r=arguments.length,i=Array(r),a=0;a<r;a++)i[a]=arguments[a];null===(e=(n=this.props).onReset)||void 0===e||e.call(n,{args:i,reason:"imperative-api"}),this.setState(o)}}componentDidCatch(t,e){var n,r;null===(n=(r=this.props).onError)||void 0===n||n.call(r,t,e)}componentDidUpdate(t,e){let{didCatch:n}=this.state,{resetKeys:r}=this.props;if(n&&null!==e.error&&function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return t.length!==e.length||t.some((t,n)=>!Object.is(t,e[n]))}(t.resetKeys,r)){var i,a;null===(i=(a=this.props).onReset)||void 0===i||i.call(a,{next:r,prev:t.resetKeys,reason:"keys"}),this.setState(o)}}render(){let{children:t,fallbackRender:e,FallbackComponent:n,fallback:o}=this.props,{didCatch:a,error:s}=this.state,c=t;if(a){let t={error:s,resetErrorBoundary:this.resetErrorBoundary};if((0,r.isValidElement)(o))c=o;else if("function"==typeof e)c=e(t);else if(n)c=(0,r.createElement)(n,t);else throw Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop")}return(0,r.createElement)(i.Provider,{value:{didCatch:a,error:s,resetErrorBoundary:this.resetErrorBoundary}},c)}}},53250:function(t,e,n){/**
|
|
* @license React
|
|
* use-sync-external-store-shim.production.min.js
|
|
*
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/var r=n(67294),i="function"==typeof Object.is?Object.is:function(t,e){return t===e&&(0!==t||1/t==1/e)||t!=t&&e!=e},o=r.useState,a=r.useEffect,s=r.useLayoutEffect,c=r.useDebugValue;function u(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!i(t,n)}catch(t){return!0}}var f="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(t,e){return e()}:function(t,e){var n=e(),r=o({inst:{value:n,getSnapshot:e}}),i=r[0].inst,f=r[1];return s(function(){i.value=n,i.getSnapshot=e,u(i)&&f({inst:i})},[t,n,e]),a(function(){return u(i)&&f({inst:i}),t(function(){u(i)&&f({inst:i})})},[t]),c(n),n};e.useSyncExternalStore=void 0!==r.useSyncExternalStore?r.useSyncExternalStore:f},50139:function(t,e,n){/**
|
|
* @license React
|
|
* use-sync-external-store-shim/with-selector.production.min.js
|
|
*
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/var r=n(67294),i=n(61688),o="function"==typeof Object.is?Object.is:function(t,e){return t===e&&(0!==t||1/t==1/e)||t!=t&&e!=e},a=i.useSyncExternalStore,s=r.useRef,c=r.useEffect,u=r.useMemo,f=r.useDebugValue;e.useSyncExternalStoreWithSelector=function(t,e,n,r,i){var h=s(null);if(null===h.current){var l={hasValue:!1,value:null};h.current=l}else l=h.current;h=u(function(){function t(t){if(!c){if(c=!0,a=t,t=r(t),void 0!==i&&l.hasValue){var e=l.value;if(i(e,t))return s=e}return s=t}if(e=s,o(a,t))return e;var n=r(t);return void 0!==i&&i(e,n)?e:(a=t,s=n)}var a,s,c=!1,u=void 0===n?null:n;return[function(){return t(e())},null===u?void 0:function(){return t(u())}]},[e,n,r,i]);var d=a(t,h[0],h[1]);return c(function(){l.hasValue=!0,l.value=d},[d]),f(d),d}},61688:function(t,e,n){t.exports=n(53250)},52798:function(t,e,n){t.exports=n(50139)},98933:function(t,e,n){n.d(e,{Xg:function(){return c},f3:function(){return u},mu:function(){return s},vk:function(){return f}});var r=n(63056),i=n(89823),o=n(10797);function a(t){var e;return(e={id:t,send:function(){},subscribe:function(){return{unsubscribe:function(){}}},getSnapshot:function(){},toJSON:function(){return{id:t}}})[i.L$]=function(){return this},e}function s(t,e,n,r){var o,s=(0,i.j)(t.src),u=null===(o=null==e?void 0:e.options.services)||void 0===o?void 0:o[s.type],f=t.data?(0,i.QX)(t.data,n,r):void 0,h=u?c(u,t.id,f):a(t.id);return h.meta=t,h}function c(t,e,n){var r=a(e);if(r.deferred=!0,(0,i.O4)(t)){var s=r.state=(0,o.J)(void 0,function(){return(n?t.withContext(n):t).initialState});r.getSnapshot=function(){return s}}return r}function u(t){return function(t){try{return"function"==typeof t.send}catch(t){return!1}}(t)&&"id"in t}function f(t){var e;return(0,r.pi)(((e={subscribe:function(){return{unsubscribe:function(){}}},id:"anonymous",getSnapshot:function(){}})[i.L$]=function(){return this},e),t)}},4723:function(t,e,n){n.d(e,{C:function(){return m}});var r=n(63056),i=n(89823),o=n(54911),a=n(3884),s=n(30375),c=n(14066),u=n(87353),f=n(56115),h=n(98933);function l(t){return(0,r.pi)((0,r.pi)({type:a.dw},t),{toJSON:function(){t.onDone,t.onError;var e=(0,r._T)(t,["onDone","onError"]);return(0,r.pi)((0,r.pi)({},e),{type:a.dw,src:function(t){if("string"==typeof t){var e={type:t};return e.toString=function(){return t},e}return t}(t.src)})}})}var d={},v=function(t){return"#"===t[0]},p=function(t,e,n){var r=n.slice(0,-1).some(function(t){return!("cond"in t)&&!("in"in t)&&((0,i.HD)(t.target)||(0,i.O4)(t.target))});(0,i.ZK)(!r,"One or more transitions for ".concat(""===e?"the transient event":"event '".concat(e,"'")," on state '").concat(t.id,"' are unreachable. ")+"Make sure that the default transition is the last one defined.")},y=function(){function t(e,n,o,a){void 0===o&&(o="context"in e?e.context:void 0);var h,v=this;this.config=e,this._context=o,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({actions:{},guards:{},services:{},activities:{},delays:{}},n),this.parent=null==a?void 0:a.parent,this.key=this.config.key||(null==a?void 0:a.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:u.iS),this.id=this.config.id||(0,r.ev)([this.machine.key],(0,r.CR)(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!==(h=this.config.schema)&&void 0!==h?h:{},this.description=this.config.description,c.M||(0,i.ZK)(!("parallel"in this.config),'The "parallel" property is deprecated and will be removed in version 4.1. '.concat(this.config.parallel?"Replace with `type: 'parallel'`":"Use `type: '".concat(this.type,"'`")," in the config for state node '").concat(this.id,"' instead.")),this.initial=this.config.initial,this.states=this.config.states?(0,i.Q8)(this.config.states,function(e,n){var i,o=new t(e,{},void 0,{parent:v,key:n});return Object.assign(v.idMap,(0,r.pi)(((i={})[o.id]=o,i),o.idMap)),o}):d;var p=0;!function t(e){var n,i;e.order=p++;try{for(var o=(0,r.XA)((0,f.nI)(e)),a=o.next();!a.done;a=o.next()){var s=a.value;t(s)}}catch(t){n={error:t}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}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=(0,i.qo)(this.config.entry||this.config.onEntry).map(function(t){return(0,s.Q8)(t)}),this.onExit=(0,i.qo)(this.config.exit||this.config.onExit).map(function(t){return(0,s.Q8)(t)}),this.meta=this.config.meta,this.doneData="final"===this.type?this.config.data:void 0,this.invoke=(0,i.qo)(this.config.invoke).map(function(t,e){if((0,i.O4)(t)){var n,o,a=(0,i.bx)(v.id,e);return v.machine.options.services=(0,r.pi)(((n={})[a]=t,n),v.machine.options.services),l({src:a,id:a})}if((0,i.HD)(t.src)){var a=t.id||(0,i.bx)(v.id,e);return l((0,r.pi)((0,r.pi)({},t),{id:a,src:t.src}))}if((0,i.O4)(t.src)||(0,i.mf)(t.src)){var a=t.id||(0,i.bx)(v.id,e);return v.machine.options.services=(0,r.pi)(((o={})[a]=t.src,o),v.machine.options.services),l((0,r.pi)((0,r.pi)({id:a},t),{src:a}))}var s=t.src;return l((0,r.pi)((0,r.pi)({id:(0,i.bx)(v.id,e)},t),{src:s}))}),this.activities=(0,i.qo)(this.config.activities).concat(this.invoke).map(function(t){return(0,s.XA)(t)}),this.transition=this.transition.bind(this),this.tags=(0,i.qo)(this.config.tags)}return t.prototype._init=function(){this.__cache.transitions||(0,f.ac)(this).forEach(function(t){return t.on})},t.prototype.withConfig=function(e,n){var i=this.options,o=i.actions,a=i.activities,s=i.guards,c=i.services,u=i.delays;return new t(this.config,{actions:(0,r.pi)((0,r.pi)({},o),e.actions),activities:(0,r.pi)((0,r.pi)({},a),e.activities),guards:(0,r.pi)((0,r.pi)({},s),e.guards),services:(0,r.pi)((0,r.pi)({},c),e.services),delays:(0,r.pi)((0,r.pi)({},u),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(0,i.mf)(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:(0,i.Q8)(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 r=n.eventType===t;return e?r:r||"*"===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 r=(0,i.mf)(e)?"".concat(t.id,":delay[").concat(n,"]"):e,o=(0,s.e4)(r,t.id);return t.onEntry.push((0,s.lW)(o,{delay:e})),t.onExit.push((0,s.al)(o)),o};return((0,i.kJ)(e)?e.map(function(t,e){var i=n(t.delay,e);return(0,r.pi)((0,r.pi)({},t),{event:i})}):(0,i.xH)(Object.keys(e).map(function(t,o){var a=e[t],s=(0,i.HD)(a)?{target:a}:a,c=isNaN(+t)?t:+t,u=n(c,o);return(0,i.qo)(s).map(function(t){return(0,r.pi)((0,r.pi)({},t),{event:u,delay:c})})}))).map(function(e){var n=e.delay;return(0,r.pi)((0,r.pi)({},t.formatTransition(e)),{delay:n})})},t.prototype.getStateNodes=function(t){var e,n=this;if(!t)return[];var a=t instanceof o.ZM?t.value:(0,i.WM)(t,this.delimiter);if((0,i.HD)(a)){var s=this.getStateNode(a).initial;return void 0!==s?this.getStateNodes(((e={})[a]=s,e)):[this,this.states[a]]}var c=Object.keys(a),u=[this];return u.push.apply(u,(0,r.ev)([],(0,r.CR)((0,i.xH)(c.map(function(t){return n.getStateNode(t).getStateNodes(a[t])}))),!1)),u},t.prototype.handles=function(t){var e=(0,i.x6)(t);return this.events.includes(e)},t.prototype.resolveState=function(t){var e=t instanceof o.ZM?t:o.ZM.create(t),n=Array.from((0,f.P_)([],this.getStateNodes(e.value)));return new o.ZM((0,r.pi)((0,r.pi)({},e),{value:this.resolve(e.value),configuration:n,done:(0,f.Ij)(n,this),tags:(0,f.Oe)(n),machine:this.machine}))},t.prototype.transitionLeafNode=function(t,e,n){var r=this.getStateNode(t).next(e,n);return r&&r.transitions.length?r:this.next(e,n)},t.prototype.transitionCompoundNode=function(t,e,n){var r=Object.keys(t),i=this.getStateNode(r[0])._transition(t[r[0]],e,n);return i&&i.transitions.length?i:this.next(e,n)},t.prototype.transitionParallelNode=function(t,e,n){var o,a,s={};try{for(var c=(0,r.XA)(Object.keys(t)),u=c.next();!u.done;u=c.next()){var f=u.value,h=t[f];if(h){var l=this.getStateNode(f)._transition(h,e,n);l&&(s[f]=l)}}}catch(t){o={error:t}}finally{try{u&&!u.done&&(a=c.return)&&a.call(c)}finally{if(o)throw o.error}}var d=Object.keys(s).map(function(t){return s[t]}),v=(0,i.xH)(d.map(function(t){return t.transitions}));if(!d.some(function(t){return t.transitions.length>0}))return this.next(e,n);var p=(0,i.xH)(Object.keys(s).map(function(t){return s[t].configuration}));return{transitions:v,exitSet:(0,i.xH)(d.map(function(t){return t.exitSet})),configuration:p,source:e,actions:(0,i.xH)(Object.keys(s).map(function(t){return s[t].actions}))}},t.prototype._transition=function(t,e,n){return(0,i.HD)(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,(0,i.g5)(e))},t.prototype.next=function(t,e){var n,o,a,s=this,c=e.name,u=[],f=[];try{for(var h=(0,r.XA)(this.getCandidates(c)),l=h.next();!l.done;l=h.next()){var d=l.value,p=d.cond,y=d.in,g=t.context,m=!y||((0,i.HD)(y)&&v(y)?t.matches((0,i.WM)(this.getStateNodeById(y).path,this.delimiter)):(0,i.W)((0,i.WM)(y,this.delimiter),(0,i.ET)(this.path.slice(0,-2))(t.value))),x=!1;try{x=!p||(0,i.vx)(this.machine,p,g,e,t)}catch(t){throw Error("Unable to evaluate guard '".concat(p.name||p.type,"' in transition for event '").concat(c,"' in state node '").concat(this.id,"':\n").concat(t.message))}if(x&&m){void 0!==d.target&&(f=d.target),u.push.apply(u,(0,r.ev)([],(0,r.CR)(d.actions),!1)),a=d;break}}}catch(t){n={error:t}}finally{try{l&&!l.done&&(o=h.return)&&o.call(h)}finally{if(n)throw n.error}}if(a){if(!f.length)return{transitions:[a],exitSet:[],configuration:t.value?[this]:[],source:t,actions:u};var b=(0,i.xH)(f.map(function(e){return s.getRelativeStateNodes(e,t.historyValue)})),S=!!a.internal;return{transitions:[a],exitSet:S?[]:(0,i.xH)(f.map(function(t){return s.getPotentiallyReenteringNodes(t)})),configuration:b,source:t,actions:u}}},t.prototype.getPotentiallyReenteringNodes=function(t){if(this.order<t.order)return[this];for(var e=[],n=this;n&&n!==t;)e.push(n),n=n.parent;return n!==t?[]:(e.push(t),e)},t.prototype.getActions=function(t,e,n,o,a,c,u){var h,l,d,v,p=this,y=c?(0,f.P_)([],this.getStateNodes(c.value)):[],g=new Set;try{for(var m=(0,r.XA)(Array.from(t).sort(function(t,e){return t.order-e.order})),x=m.next();!x.done;x=m.next()){var b=x.value;(!(0,f.e$)(y,b)||(0,f.e$)(n.exitSet,b)||b.parent&&g.has(b.parent))&&g.add(b)}}catch(t){h={error:t}}finally{try{x&&!x.done&&(l=m.return)&&l.call(m)}finally{if(h)throw h.error}}try{for(var S=(0,r.XA)(y),w=S.next();!w.done;w=S.next()){var b=w.value;(!(0,f.e$)(t,b)||(0,f.e$)(n.exitSet,b.parent))&&n.exitSet.push(b)}}catch(t){d={error:t}}finally{try{w&&!w.done&&(v=S.return)&&v.call(S)}finally{if(d)throw d.error}}n.exitSet.sort(function(t,e){return e.order-t.order});var _=Array.from(g).sort(function(t,e){return t.order-e.order}),E=new Set(n.exitSet),O=(0,i.xH)(_.map(function(t){var e=[];if("final"!==t.type)return e;var r=t.parent;if(!r.parent)return e;e.push((0,s.aT)(t.id,t.doneData),(0,s.aT)(r.id,t.doneData?(0,i.QX)(t.doneData,o,a):void 0));var c=r.parent;return"parallel"===c.type&&(0,f.G)(c).every(function(t){return(0,f.Ij)(n.configuration,t)})&&e.push((0,s.aT)(c.id)),e})),A=_.map(function(t){var e=t.onEntry,n=t.activities.map(function(t){return(0,s.BL)(t)});return{type:"entry",actions:(0,s.AE)(u?(0,r.ev)((0,r.ev)([],(0,r.CR)(e),!1),(0,r.CR)(n),!1):(0,r.ev)((0,r.ev)([],(0,r.CR)(n),!1),(0,r.CR)(e),!1),p.machine.options.actions)}}).concat({type:"state_done",actions:O.map(function(t){return(0,s.OU)(t)})}),k=Array.from(E).map(function(t){return{type:"exit",actions:(0,s.AE)((0,r.ev)((0,r.ev)([],(0,r.CR)(t.onExit),!1),(0,r.CR)(t.activities.map(function(t){return(0,s.sT)(t)})),!1),p.machine.options.actions)}}).concat({type:"transition",actions:(0,s.AE)(n.actions,this.machine.options.actions)}).concat(A);if(e){var M=(0,s.AE)((0,i.xH)((0,r.ev)([],(0,r.CR)(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!(0,i.vK)(t)});return k.concat({type:"stop",actions:M})}return k},t.prototype.transition=function(t,e,n,a){void 0===t&&(t=this.initialState);var s,u=(0,i.g5)(e);if(t instanceof o.ZM)s=void 0===n?t:this.resolveState(o.ZM.from(t,n));else{var h=(0,i.HD)(t)?this.resolve((0,i.on)(this.getResolvedPath(t))):this.resolve(t),l=null!=n?n:this.machine.context;s=this.resolveState(o.ZM.from(h,l))}if(!c.M&&"*"===u.name)throw Error("An event cannot have the wildcard type ('".concat("*","')"));if(this.strict&&!this.events.includes(u.name)&&!(0,i.JQ)(u.name))throw Error("Machine '".concat(this.id,"' does not accept event '").concat(u.name,"'"));var d=this._transition(s.value,s,u)||{transitions:[],configuration:[],exitSet:[],source:s,actions:[]},v=(0,f.P_)([],this.getStateNodes(s.value)),p=d.configuration.length?(0,f.P_)(v,d.configuration):v;return d.configuration=(0,r.ev)([],(0,r.CR)(p),!1),this.resolveTransition(d,s,s.context,a,u)},t.prototype.resolveRaisedTransition=function(t,e,n,i){var o,a=t.actions;return(t=this.transition(t,e,void 0,i))._event=n,t.event=n.data,(o=t.actions).unshift.apply(o,(0,r.ev)([],(0,r.CR)(a),!1)),t},t.prototype.resolveTransition=function(t,e,n,c,u){var l,d,v,p,y=this;void 0===u&&(u=s.bf);var g=t.configuration,m=!e||t.transitions.length>0,x=m?t.configuration:e?e.configuration:[],b=(0,f.Ij)(x,this),S=m?(0,f.NA)(this.machine,g):void 0,w=e?e.historyValue?e.historyValue:t.source?this.machine.historyValue(e.value):void 0:void 0,_=this.getActions(new Set(x),b,t,n,u,e,c),E=e?(0,r.pi)({},e.activities):{};try{for(var O=(0,r.XA)(_),A=O.next();!A.done;A=O.next()){var k=A.value;try{for(var M=(v=void 0,(0,r.XA)(k.actions)),j=M.next();!j.done;j=M.next()){var T=j.value;T.type===a.BL?E[T.activity.id||T.activity.type]=T:T.type===a.sT&&(E[T.activity.id||T.activity.type]=!1)}}catch(t){v={error:t}}finally{try{j&&!j.done&&(p=M.return)&&p.call(M)}finally{if(v)throw v.error}}}}catch(t){l={error:t}}finally{try{A&&!A.done&&(d=O.return)&&d.call(O)}finally{if(l)throw l.error}}var N=(0,r.CR)((0,s.yC)(this,e,n,u,_,c,this.machine.config.predictableActionArguments||this.machine.config.preserveActionOrder),2),C=N[0],R=N[1],P=(0,r.CR)((0,i.uK)(C,i.vK),2),D=P[0],L=P[1],H=C.filter(function(t){var e;return t.type===a.BL&&(null===(e=t.activity)||void 0===e?void 0:e.type)===a.dw}).reduce(function(t,e){return t[e.activity.id]=(0,h.mu)(e.activity,y.machine,R,u),t},e?(0,r.pi)({},e.children):{}),V=new o.ZM({value:S||e.value,context:R,_event:u,_sessionid:e?e._sessionid:null,historyValue:S?w?(0,i.yv)(w,S):void 0:e?e.historyValue:void 0,history:!S||t.source?e:void 0,actions:S?L:[],activities:S?E:e?e.activities:{},events:[],configuration:x,transitions:t.transitions,children:H,done:b,tags:(0,f.Oe)(x),machine:this}),X=n!==R;V.changed=u.name===a.Vx||X;var I=V.history;I&&delete I.history;var Z=!b&&(this._transient||g.some(function(t){return t._transient}));if(!m&&(!Z||""===u.name))return V;var K=V;if(!b)for(Z&&(K=this.resolveRaisedTransition(K,{type:a.IA},u,c));D.length;){var J=D.shift();K=this.resolveRaisedTransition(K,J._event,u,c)}var U=K.changed||(I?!!K.actions.length||X||typeof I.value!=typeof K.value||!(0,o.j_)(K.value,I.value):void 0);return K.changed=U,K.history=I,K},t.prototype.getStateNode=function(t){if(v(t))return this.machine.getStateNodeById(t);if(!this.states)throw Error("Unable to retrieve child state '".concat(t,"' from '").concat(this.id,"'; no child states exist."));var e=this.states[t];if(!e)throw Error("Child state '".concat(t,"' does not exist on '").concat(this.id,"'"));return e},t.prototype.getStateNodeById=function(t){var e=v(t)?t.slice(1):t;if(e===this.id)return this;var n=this.machine.idMap[e];if(!n)throw 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&&v(t))try{return this.getStateNodeById(t.slice(1))}catch(t){}for(var e=(0,i.Q9)(t,this.delimiter).slice(),n=this;e.length;){var r=e.shift();if(!r.length)break;n=n.getStateNode(r)}return n},t.prototype.resolve=function(t){var e,n=this;if(!t)return this.initialStateValue||d;switch(this.type){case"parallel":return(0,i.Q8)(this.initialStateValue,function(e,r){return e?n.getStateNode(r).resolve(t[r]||e):d});case"compound":if((0,i.HD)(t)){var r=this.getStateNode(t);if("parallel"===r.type||"compound"===r.type)return(e={})[t]=r.initialStateValue,e;return t}if(!Object.keys(t).length)return this.initialStateValue||{};return(0,i.Q8)(t,function(t,e){return t?n.getStateNode(e).resolve(t):d});default:return t||d}},t.prototype.getResolvedPath=function(t){if(v(t)){var e=this.machine.idMap[t.slice(1)];if(!e)throw Error("Unable to find state node '".concat(t,"'"));return e.path}return(0,i.Q9)(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=(0,i.ib)(this.states,function(t){return t.initialStateValue||d},function(t){return"history"!==t.type});else if(void 0!==this.initial){if(!this.states[this.initial])throw Error("Initial state '".concat(this.initial,"' not found on '").concat(this.key,"'"));e=(0,f.N9)(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 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=(0,i.HD)(e.target)&&v(e.target)?(0,i.on)(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;if((0,f.N9)(this))return[this];if("compound"===this.type&&!this.initial)return c.M||(0,i.ZK)(!1,"Compound state node '".concat(this.id,"' has no initial state.")),[this];var e=(0,i.SA)(this.initialStateValue);return(0,i.xH)(e.map(function(e){return t.getFromRelativePath(e)}))},enumerable:!1,configurable:!0}),t.prototype.getFromRelativePath=function(t){if(!t.length)return[this];var e=(0,r.CR)(t),n=e[0],i=e.slice(1);if(!this.states)throw Error("Cannot retrieve subPath '".concat(n,"' from node with no states"));var o=this.getStateNode(n);if("history"===o.type)return o.resolveHistory();if(!this.states[n])throw 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:(0,i.ib)(this.states,function(e,n){if(!t)return e.historyValue();var r=(0,i.HD)(t)?void 0:t[n];return e.historyValue(r||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 r=this.target;return r?(0,i.xH)((0,i.SA)(r).map(function(t){return n.getFromRelativePath(t)})):n.initialStateNodes}var o=(0,i.gk)(n.path,"states")(t).current;return(0,i.HD)(o)?[n.getStateNode(o)]:(0,i.xH)((0,i.SA)(o).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=(0,i.xH)(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(){if(this.__cache.events)return this.__cache.events;var t,e,n,i,o=this.states,a=new Set(this.ownEvents);if(o)try{for(var s=(0,r.XA)(Object.keys(o)),c=s.next();!c.done;c=s.next()){var u=o[c.value];if(u.states)try{for(var f=(n=void 0,(0,r.XA)(u.events)),h=f.next();!h.done;h=f.next()){var l=h.value;a.add("".concat(l))}}catch(t){n={error:t}}finally{try{h&&!h.done&&(i=f.return)&&i.call(f)}finally{if(n)throw n.error}}}}catch(e){t={error:e}}finally{try{c&&!c.done&&(e=s.return)&&e.call(s)}finally{if(t)throw t.error}}return this.__cache.events=Array.from(a)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ownEvents",{get:function(){return Array.from(new Set(this.transitions.filter(function(t){return!(!t.target&&!t.actions.length&&t.internal)}).map(function(t){return t.eventType})))},enumerable:!1,configurable:!0}),t.prototype.resolveTarget=function(t){var e=this;if(void 0!==t)return t.map(function(t){if(!(0,i.HD)(t))return t;var n=t[0]===e.delimiter;if(n&&!e.parent)return e.getStateNodeByPath(t.slice(1));var r=n?e.key+t:t;if(!e.parent)return e.getStateNodeByPath(r);try{return e.parent.getStateNodeByPath(r)}catch(t){throw Error("Invalid transition definition for state node '".concat(e.id,"':\n").concat(t.message))}})},t.prototype.formatTransition=function(t){var e=this,n=(0,i.rg)(t.target),o="internal"in t?t.internal:!n||n.some(function(t){return(0,i.HD)(t)&&t[0]===e.delimiter}),a=this.machine.options.guards,c=this.resolveTarget(n),u=(0,r.pi)((0,r.pi)({},t),{actions:(0,s.AE)((0,i.qo)(t.actions)),cond:(0,i.Qi)(t.cond,a),target:c,source:this,internal:o,eventType:t.event,toJSON:function(){return(0,r.pi)((0,r.pi)({},u),{target:u.target?u.target.map(function(t){return"#".concat(t.id)}):void 0,source:"#".concat(e.id)})}});return u},t.prototype.formatTransitions=function(){var t,e,n,o=this;if(this.config.on){if(Array.isArray(this.config.on))n=this.config.on;else{var a=this.config.on,u=a["*"],f=void 0===u?[]:u,h=(0,r._T)(a,["*"]);n=(0,i.xH)(Object.keys(h).map(function(t){c.M||""!==t||(0,i.ZK)(!1,"Empty string transition configs (e.g., `{ on: { '': ... }}`) for transient transitions are deprecated. Specify the transition in the `{ always: ... }` property instead. "+'Please check the `on` configuration for "#'.concat(o.id,'".'));var e=(0,i.jh)(t,h[t]);return c.M||p(o,t,e),e}).concat((0,i.jh)("*",f)))}}else n=[];var l=this.config.always?(0,i.jh)("",this.config.always):[],d=this.config.onDone?(0,i.jh)(String((0,s.aT)(this.id)),this.config.onDone):[];c.M||(0,i.ZK)(!(this.config.onDone&&!this.parent),'Root nodes cannot have an ".onDone" transition. Please check the config of "'.concat(this.id,'".'));var v=(0,i.xH)(this.invoke.map(function(t){var e=[];return t.onDone&&e.push.apply(e,(0,r.ev)([],(0,r.CR)((0,i.jh)(String((0,s.Sl)(t.id)),t.onDone)),!1)),t.onError&&e.push.apply(e,(0,r.ev)([],(0,r.CR)((0,i.jh)(String((0,s.vU)(t.id)),t.onError)),!1)),e})),y=this.after,g=(0,i.xH)((0,r.ev)((0,r.ev)((0,r.ev)((0,r.ev)([],(0,r.CR)(d),!1),(0,r.CR)(v),!1),(0,r.CR)(n),!1),(0,r.CR)(l),!1).map(function(t){return(0,i.qo)(t).map(function(t){return o.formatTransition(t)})}));try{for(var m=(0,r.XA)(y),x=m.next();!x.done;x=m.next()){var b=x.value;g.push(b)}}catch(e){t={error:e}}finally{try{x&&!x.done&&(e=m.return)&&e.call(m)}finally{if(t)throw t.error}}return g},t}(),g=!1;function m(t,e){return c.M||"predictableActionArguments"in t||g||(g=!0,console.warn("It is highly recommended to set `predictableActionArguments` to `true` when using `createMachine`. https://xstate.js.org/docs/guides/actions.html")),new y(t,e)}},54911:function(t,e,n){n.d(e,{TL:function(){return u},ZM:function(){return h},j1:function(){return f},j_:function(){return function t(e,n){if(e===n)return!0;if(void 0===e||void 0===n)return!1;if((0,o.HD)(e)||(0,o.HD)(n))return e===n;var r=Object.keys(e),i=Object.keys(n);return r.length===i.length&&r.every(function(r){return t(e[r],n[r])})}}});var r=n(63056),i=n(87353),o=n(89823),a=n(56115),s=n(30375),c=n(14066);function u(t){return"object"==typeof t&&null!==t&&"value"in t&&"_event"in t}function f(t,e){var n=t.exec;return(0,r.pi)((0,r.pi)({},t),{exec:void 0!==n?function(){return n(e.context,e.event,{action:t,state:e,_event:e._event})}:void 0})}var h=function(){function t(t){var e,n=this;this.actions=[],this.activities=i.qP,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||i.qP,this.meta=(0,a.xZ)(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(0,a.nJ)(n.configuration)}})}return t.from=function(e,n){if(e instanceof t)return 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;var r=s.bf;return new t({value:e,context:n,_event:r,_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 r=s.bf;return new t({value:e.value,context:n,_event:r,_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="."),(0,o.HD)(t))return[t];var i=Object.keys(t);return i.concat.apply(i,(0,r.ev)([],(0,r.CR)(i.map(function(r){return n.toStrings(t[r],e).map(function(t){return r+e+t})})),!1))},t.prototype.toJSON=function(){this.configuration,this.transitions;var t=this.tags;this.machine;var e=(0,r._T)(this,["configuration","transitions","tags","machine"]);return(0,r.pi)((0,r.pi)({},e),{tags:Array.from(t)})},t.prototype.matches=function(t){return(0,o.W)(t,this.value)},t.prototype.hasTag=function(t){return this.tags.has(t)},t.prototype.can=function(t){c.M&&(0,o.ZK)(!!this.machine,"state.can(...) used outside of a machine-created State object; this will always return false.");var e,n=null===(e=this.machine)||void 0===e?void 0:e.getTransitionData(this,t);return!!(null==n?void 0:n.transitions.length)&&n.transitions.some(function(t){return void 0!==t.target||t.actions.length})},t}()},63056:function(t,e,n){n.d(e,{CR:function(){return a},XA:function(){return o},_T:function(){return i},ev:function(){return s},pi:function(){return r}});/*! *****************************************************************************
|
|
Copyright (c) Microsoft Corporation.
|
|
|
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
purpose with or without fee is hereby granted.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
PERFORMANCE OF THIS SOFTWARE.
|
|
***************************************************************************** */var r=function(){return(r=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function i(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&0>e.indexOf(r)&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)0>e.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n}function o(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function a(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function s(t,e,n){if(n||2==arguments.length)for(var r,i=0,o=e.length;i<o;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))}},3884:function(t,e,n){n.d(e,{BL:function(){return i},IA:function(){return u},Le:function(){return m},Mg:function(){return v},OU:function(){return a},RN:function(){return g},S1:function(){return l},Vx:function(){return y},al:function(){return c},cM:function(){return h},dw:function(){return d},f0:function(){return f},lW:function(){return s},sT:function(){return o},vU:function(){return p}});var r=n(59043),i=r.M.Start,o=r.M.Stop,a=r.M.Raise,s=r.M.Send,c=r.M.Cancel,u=r.M.NullEvent,f=r.M.Assign;r.M.After,r.M.DoneState;var h=r.M.Log,l=r.M.Init,d=r.M.Invoke;r.M.ErrorExecution;var v=r.M.ErrorPlatform,p=r.M.ErrorCustom,y=r.M.Update,g=r.M.Choose,m=r.M.Pure},30375:function(t,e,n){n.d(e,{AE:function(){return h},BL:function(){return y},OU:function(){return d},Q8:function(){return f},Sl:function(){return b},XA:function(){return l},aT:function(){return x},al:function(){return p},bf:function(){return c},e4:function(){return m},lW:function(){return v},o$:function(){return u},sT:function(){return g},vU:function(){return S},yC:function(){return function t(e,n,c,u,l,d,v){void 0===v&&(v=!1);var p=v?[]:w(l),y=p.length?(0,a.dt)(c,u,p,n):c,g=v?[c]:void 0,m=[];return[(0,a.xH)(l.map(function(l){var p,x,b=[];try{for(var S=(0,r.XA)(l.actions),w=S.next();!w.done;w=S.next()){var _=w.value,E=function(l,p){var x;switch(p.type){case o.OU:var b=function(t,e,n,i){var s,c={_event:n},u=(0,a.g5)((0,a.mf)(t.event)?t.event(e,n.data,c):t.event);if((0,a.HD)(t.delay)){var f=i&&i[t.delay];s=(0,a.mf)(f)?f(e,n.data,c):f}else s=(0,a.mf)(t.delay)?t.delay(e,n.data,c):t.delay;return(0,r.pi)((0,r.pi)({},t),{type:o.OU,_event:u,delay:s})}(p,y,u,e.options.delays);return d&&"number"==typeof b.delay&&d(b,y,u),b;case o.lW:var S=function(t,e,n,i){var o,s={_event:n},c=(0,a.g5)((0,a.mf)(t.event)?t.event(e,n.data,s):t.event);if((0,a.HD)(t.delay)){var u=i&&i[t.delay];o=(0,a.mf)(u)?u(e,n.data,s):u}else o=(0,a.mf)(t.delay)?t.delay(e,n.data,s):t.delay;var f=(0,a.mf)(t.to)?t.to(e,n.data,s):t.to;return(0,r.pi)((0,r.pi)({},t),{to:f,_event:c,event:c.data,delay:o})}(p,y,u,e.options.delays);if(!s.M){var w=p.delay;(0,a.ZK)(!(0,a.HD)(w)||"number"==typeof S.delay,"No delay reference for delay expression '".concat(w,"' was found on machine '").concat(e.id,"'"))}return d&&S.to!==i.K.Internal&&("entry"===l?m.push(S):d(S,y,u)),S;case o.cM:var _,E=(_=y,(0,r.pi)((0,r.pi)({},p),{value:(0,a.HD)(p.expr)?p.expr:p.expr(_,u.data,{_event:u})}));return null==d||d(E,y,u),E;case o.RN:var O=null===(x=p.conds.find(function(t){var r=(0,a.Qi)(t.cond,e.options.guards);return!r||(0,a.vx)(e,r,y,u,d?void 0:n)}))||void 0===x?void 0:x.actions;if(!O)return[];var A=(0,r.CR)(t(e,n,y,u,[{type:l,actions:h((0,a.qo)(O),e.options.actions)}],d,v),2),k=A[0];return y=A[1],null==g||g.push(y),k;case o.Le:var O=p.get(y,u.data);if(!O)return[];var M=(0,r.CR)(t(e,n,y,u,[{type:l,actions:h((0,a.qo)(O),e.options.actions)}],d,v),2),j=M[0];return y=M[1],null==g||g.push(y),j;case o.sT:var T,N,E=(T=y,N=(0,a.mf)(p.activity)?p.activity(T,u.data):p.activity,{type:i.M.Stop,activity:"string"==typeof N?{id:N}:N});return null==d||d(E,c,u),E;case o.f0:y=(0,a.dt)(y,u,[p],d?void 0:n),null==g||g.push(y);break;default:var C=f(p,e.options.actions),R=C.exec;if(d)d(C,y,u);else if(R&&g){var P=g.length-1;C=(0,r.pi)((0,r.pi)({},C),{exec:function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];R.apply(void 0,(0,r.ev)([g[P]],(0,r.CR)(e),!1))}})}return C}}(l.type,_);E&&(b=b.concat(E))}}catch(t){p={error:t}}finally{try{w&&!w.done&&(x=S.return)&&x.call(S)}finally{if(p)throw p.error}}return m.forEach(function(t){d(t,y,u)}),m.length=0,b})),y]}}});var r=n(63056),i=n(59043),o=n(3884),a=n(89823),s=n(14066),c=(0,a.g5)({type:o.S1});function u(t,e){return e&&e[t]||void 0}function f(t,e){var n;if((0,a.HD)(t)||"number"==typeof t){var i=u(t,e);n=(0,a.mf)(i)?{type:t,exec:i}:i||{type:t,exec:void 0}}else if((0,a.mf)(t))n={type:t.name||t.toString(),exec:t};else{var i=u(t.type,e);if((0,a.mf)(i))n=(0,r.pi)((0,r.pi)({},t),{exec:i});else if(i){var o=i.type||t.type;n=(0,r.pi)((0,r.pi)((0,r.pi)({},i),t),{type:o})}else n=t}return n}var h=function(t,e){return t?((0,a.kJ)(t)?t:[t]).map(function(t){return f(t,e)}):[]};function l(t){var e=f(t);return(0,r.pi)((0,r.pi)({id:(0,a.HD)(t)?t:e.id},e),{type:e.type})}function d(t,e){return{type:o.OU,event:"function"==typeof t?t:(0,a._v)(t),delay:e?e.delay:void 0,id:null==e?void 0:e.id}}function v(t,e){return{to:e?e.to:void 0,type:o.lW,event:(0,a.mf)(t)?t:(0,a._v)(t),delay:e?e.delay:void 0,id:e&&void 0!==e.id?e.id:(0,a.mf)(t)?t.name:(0,a.x6)(t)}}var p=function(t){return{type:o.al,sendId:t}};function y(t){var e=l(t);return{type:i.M.Start,activity:e,exec:void 0}}function g(t){var e=(0,a.mf)(t)?t:l(t);return{type:i.M.Stop,activity:e,exec:void 0}}function m(t,e){var n=e?"#".concat(e):"";return"".concat(i.M.After,"(").concat(t,")").concat(n)}function x(t,e){var n="".concat(i.M.DoneState,".").concat(t),r={type:n,data:e};return r.toString=function(){return n},r}function b(t,e){var n="".concat(i.M.DoneInvoke,".").concat(t),r={type:n,data:e};return r.toString=function(){return n},r}function S(t,e){var n="".concat(i.M.ErrorPlatform,".").concat(t),r={type:n,data:e};return r.toString=function(){return n},r}var w=function(t){var e,n,i=[];try{for(var a=(0,r.XA)(t),s=a.next();!s.done;s=a.next())for(var c=s.value,u=0;u<c.actions.length;){if(c.actions[u].type===o.f0){i.push(c.actions[u]),c.actions.splice(u,1);continue}u++}}catch(t){e={error:t}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(e)throw e.error}}return i}},87353:function(t,e,n){n.d(e,{TV:function(){return o},iS:function(){return r},qP:function(){return i},rt:function(){return a}});var r=".",i={},o="xstate.guard",a=""},14066:function(t,e,n){n.d(e,{M:function(){return r}});var r=!0},10797:function(t,e,n){n.d(e,{J:function(){return i}});var r=[],i=function(t,e){r.push(t);var n=e(t);return r.pop(),n}},56115:function(t,e,n){n.d(e,{G:function(){return s},Ij:function(){return function t(e,n){return"compound"===n.type?s(n).some(function(t){return"final"===t.type&&l(e,t)}):"parallel"===n.type&&s(n).every(function(n){return t(e,n)})}},N9:function(){return o},NA:function(){return h},Oe:function(){return p},P_:function(){return u},ac:function(){return c},e$:function(){return l},nI:function(){return a},nJ:function(){return d},xZ:function(){return v}});var r=n(63056),i=n(89823),o=function(t){return"atomic"===t.type||"final"===t.type};function a(t){return Object.keys(t.states).map(function(e){return t.states[e]})}function s(t){return a(t).filter(function(t){return"history"!==t.type})}function c(t){var e=[t];return o(t)?e:e.concat((0,i.xH)(s(t).map(c)))}function u(t,e){var n,i,o,a,c,u,h,l,d=f(new Set(t)),v=new Set(e);try{for(var p=(0,r.XA)(v),y=p.next();!y.done;y=p.next())for(var g=y.value,m=g.parent;m&&!v.has(m);)v.add(m),m=m.parent}catch(t){n={error:t}}finally{try{y&&!y.done&&(i=p.return)&&i.call(p)}finally{if(n)throw n.error}}var x=f(v);try{for(var b=(0,r.XA)(v),S=b.next();!S.done;S=b.next()){var g=S.value;if("compound"!==g.type||x.get(g)&&x.get(g).length){if("parallel"===g.type)try{for(var w=(c=void 0,(0,r.XA)(s(g))),_=w.next();!_.done;_=w.next()){var E=_.value;v.has(E)||(v.add(E),d.get(E)?d.get(E).forEach(function(t){return v.add(t)}):E.initialStateNodes.forEach(function(t){return v.add(t)}))}}catch(t){c={error:t}}finally{try{_&&!_.done&&(u=w.return)&&u.call(w)}finally{if(c)throw c.error}}}else d.get(g)?d.get(g).forEach(function(t){return v.add(t)}):g.initialStateNodes.forEach(function(t){return v.add(t)})}}catch(t){o={error:t}}finally{try{S&&!S.done&&(a=b.return)&&a.call(b)}finally{if(o)throw o.error}}try{for(var O=(0,r.XA)(v),A=O.next();!A.done;A=O.next())for(var g=A.value,m=g.parent;m&&!v.has(m);)v.add(m),m=m.parent}catch(t){h={error:t}}finally{try{A&&!A.done&&(l=O.return)&&l.call(O)}finally{if(h)throw h.error}}return v}function f(t){var e,n,i=new Map;try{for(var o=(0,r.XA)(t),a=o.next();!a.done;a=o.next()){var s=a.value;i.has(s)||i.set(s,[]),s.parent&&(i.has(s.parent)||i.set(s.parent,[]),i.get(s.parent).push(s))}}catch(t){e={error:t}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}return i}function h(t,e){var n=u([t],e);return function t(e,n){var r=n.get(e);if(!r)return{};if("compound"===e.type){var i=r[0];if(!i)return{};if(o(i))return i.key}var a={};return r.forEach(function(e){a[e.key]=t(e,n)}),a}(t,f(n))}function l(t,e){return Array.isArray(t)?t.some(function(t){return t===e}):t instanceof Set&&t.has(e)}function d(t){return(0,r.ev)([],(0,r.CR)(new Set((0,i.xH)((0,r.ev)([],(0,r.CR)(t.map(function(t){return t.ownEvents})),!1)))),!1)}function v(t){return void 0===t&&(t=[]),t.reduce(function(t,e){return void 0!==e.meta&&(t[e.id]=e.meta),t},{})}function p(t){return new Set((0,i.xH)(t.map(function(t){return t.tags})))}},59043:function(t,e,n){var r,i,o,a;n.d(e,{K:function(){return i},M:function(){return r}}),(o=r||(r={})).Start="xstate.start",o.Stop="xstate.stop",o.Raise="xstate.raise",o.Send="xstate.send",o.Cancel="xstate.cancel",o.NullEvent="",o.Assign="xstate.assign",o.After="xstate.after",o.DoneState="done.state",o.DoneInvoke="done.invoke",o.Log="xstate.log",o.Init="xstate.init",o.Invoke="xstate.invoke",o.ErrorExecution="error.execution",o.ErrorCommunication="error.communication",o.ErrorPlatform="error.platform",o.ErrorCustom="xstate.error",o.Update="xstate.update",o.Pure="xstate.pure",o.Choose="xstate.choose",(a=i||(i={})).Parent="#_parent",a.Internal="#_internal"},89823:function(t,e,n){n.d(e,{Bc:function(){return P},ET:function(){return p},HD:function(){return j},HV:function(){return w},JQ:function(){return b},L$:function(){return C},O4:function(){return R},Q8:function(){return d},Q9:function(){return f},QX:function(){return x},Qi:function(){return T},SA:function(){return function t(e){return e?j(e)?[[e]]:g(Object.keys(e).map(function(n){var r=e[n];return"string"==typeof r||r&&Object.keys(r).length?t(e[n]).map(function(t){return[n].concat(t)}):[[n]]})):[[]]}},W:function(){return function t(e,n,r){void 0===r&&(r=s.iS);var i=h(e,r),o=h(n,r);return j(o)?!!j(i)&&o===i:j(i)?i in o:Object.keys(i).every(function(e){return e in o&&t(i[e],o[e])})}},WM:function(){return h},ZK:function(){return A},_v:function(){return D},bi:function(){return N},bx:function(){return J},dt:function(){return O},g5:function(){return L},gk:function(){return y},ib:function(){return v},j:function(){return Z},jh:function(){return H},kJ:function(){return k},mf:function(){return M},on:function(){return l},qo:function(){return m},rg:function(){return V},uK:function(){return _},v4:function(){return X},vK:function(){return U},vx:function(){return I},x6:function(){return u},xH:function(){return g},y8:function(){return S},yv:function(){return E},zM:function(){return K}});var r,i=n(63056),o=n(59043),a=n(3884),s=n(87353),c=n(14066);function u(t){try{return j(t)||"number"==typeof t?"".concat(t):t.type}catch(t){throw Error("Events must be strings or objects with a string event.type property.")}}function f(t,e){try{if(k(t))return t;return t.toString().split(e)}catch(e){throw Error("'".concat(t,"' is not a valid state path."))}}function h(t,e){return"object"==typeof t&&"value"in t&&"context"in t&&"event"in t&&"_event"in t?t.value:k(t)?l(t):"string"!=typeof t?t:l(f(t,e))}function l(t){if(1===t.length)return t[0];for(var e={},n=e,r=0;r<t.length-1;r++)r===t.length-2?n[t[r]]=t[r+1]:(n[t[r]]={},n=n[t[r]]);return e}function d(t,e){for(var n={},r=Object.keys(t),i=0;i<r.length;i++){var o=r[i];n[o]=e(t[o],o,t,i)}return n}function v(t,e,n){var r,o,a={};try{for(var s=(0,i.XA)(Object.keys(t)),c=s.next();!c.done;c=s.next()){var u=c.value,f=t[u];n(f)&&(a[u]=e(f,u,t))}}catch(t){r={error:t}}finally{try{c&&!c.done&&(o=s.return)&&o.call(s)}finally{if(r)throw r.error}}return a}var p=function(t){return function(e){var n,r,o=e;try{for(var a=(0,i.XA)(t),s=a.next();!s.done;s=a.next())o=o[s.value]}catch(t){n={error:t}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return o}};function y(t,e){return function(n){var r,o,a=n;try{for(var s=(0,i.XA)(t),c=s.next();!c.done;c=s.next()){var u=c.value;a=a[e][u]}}catch(t){r={error:t}}finally{try{c&&!c.done&&(o=s.return)&&o.call(s)}finally{if(r)throw r.error}}return a}}function g(t){var e;return(e=[]).concat.apply(e,(0,i.ev)([],(0,i.CR)(t),!1))}function m(t){return void 0===t?[]:k(t)?t:[t]}function x(t,e,n){if(M(t))return t(e,n.data);var r,o,a={};try{for(var s=(0,i.XA)(Object.keys(t)),c=s.next();!c.done;c=s.next()){var u=c.value,f=t[u];M(f)?a[u]=f(e,n.data):a[u]=f}}catch(t){r={error:t}}finally{try{c&&!c.done&&(o=s.return)&&o.call(s)}finally{if(r)throw r.error}}return a}function b(t){return/^(done|error)\./.test(t)}function S(t){return!!(t instanceof Promise||null!==t&&(M(t)||"object"==typeof t)&&M(t.then))}function w(t){return null!==t&&"object"==typeof t&&"transition"in t&&"function"==typeof t.transition}function _(t,e){var n,r,o=(0,i.CR)([[],[]],2),a=o[0],s=o[1];try{for(var c=(0,i.XA)(t),u=c.next();!u.done;u=c.next()){var f=u.value;e(f)?a.push(f):s.push(f)}}catch(t){n={error:t}}finally{try{u&&!u.done&&(r=c.return)&&r.call(c)}finally{if(n)throw n.error}}return[a,s]}function E(t,e){return{current:e,states:function t(e,n){return d(e.states,function(e,r){if(e){var i=(j(n)?void 0:n[r])||(e?e.current:void 0);if(i)return{current:i,states:t(e,i)}}})}(t,e)}}function O(t,e,n,r){return c.M||A(!!t,"Attempting to update undefined context"),t?n.reduce(function(t,n){var o,a,s=n.assignment,c={state:r,action:n,_event:e},u={};if(M(s))u=s(t,e.data,c);else try{for(var f=(0,i.XA)(Object.keys(s)),h=f.next();!h.done;h=f.next()){var l=h.value,d=s[l];u[l]=M(d)?d(t,e.data,c):d}}catch(t){o={error:t}}finally{try{h&&!h.done&&(a=f.return)&&a.call(f)}finally{if(o)throw o.error}}return Object.assign({},t,u)},t):t}var A=function(){};function k(t){return Array.isArray(t)}function M(t){return"function"==typeof t}function j(t){return"string"==typeof t}function T(t,e){return t?j(t)?{type:s.TV,name:t,predicate:e?e[t]:void 0}:M(t)?{type:s.TV,name:t.name,predicate:t}:t:void 0}function N(t){try{return"subscribe"in t&&M(t.subscribe)}catch(t){return!1}}c.M||(A=function(t,e){var n=t instanceof Error?t:void 0;if((n||!t)&&void 0!==console){var r=["Warning: ".concat(e)];n&&r.push(n),console.warn.apply(console,r)}});var C="function"==typeof Symbol&&Symbol.observable||"@@observable";function R(t){return!!t&&"__xstatenode"in t}function P(t){return!!t&&"function"==typeof t.send}function D(t,e){return j(t)||"number"==typeof t?(0,i.pi)({type:t},e):t}function L(t,e){if(!j(t)&&"$$type"in t&&"scxml"===t.$$type)return t;var n=D(t);return(0,i.pi)({name:n.type,data:n,$$type:"scxml",type:"external"},e)}function H(t,e){return(k(e)?e:[e]).map(function(e){return void 0===e||"string"==typeof e||R(e)?{target:e,event:t}:(0,i.pi)((0,i.pi)({},e),{event:t})})}function V(t){if(void 0!==t&&t!==s.rt)return m(t)}function X(t,e,n){if(!c.M){var r=t.stack?" Stacktrace was '".concat(t.stack,"'"):"";if(t===e)console.error("Missing onError handler for invocation '".concat(n,"', error was '").concat(t,"'.").concat(r));else{var i=e.stack?" Stacktrace was '".concat(e.stack,"'"):"";console.error("Missing onError handler and/or unhandled exception/promise rejection for invocation '".concat(n,"'. ")+"Original error: '".concat(t,"'. ").concat(r," Current error is '").concat(e,"'.").concat(i))}}}function I(t,e,n,r,i){var o=t.options.guards,a={state:i,cond:e,_event:r};if(e.type===s.TV)return((null==o?void 0:o[e.name])||e.predicate)(n,r.data,a);var c=null==o?void 0:o[e.type];if(!c)throw Error("Guard '".concat(e.type,"' is not implemented on machine '").concat(t.id,"'."));return c(n,r.data,a)}function Z(t){return"string"==typeof t?{type:t}:t}function K(t,e,n){var r=function(){},i="object"==typeof t,o=i?t:null;return{next:((i?t.next:t)||r).bind(o),error:((i?t.error:e)||r).bind(o),complete:((i?t.complete:n)||r).bind(o)}}function J(t,e){return"".concat(t,":invocation[").concat(e,"]")}function U(t){return(t.type===a.OU||t.type===a.lW&&t.to===o.K.Internal)&&"number"!=typeof t.delay}(r={})[C]=function(){return this},r[Symbol.observable]=function(){return this}}}]); |