/*! For license information please see 7c2fe9ca71d2d4c839914525b72b580d6be96835-1f11f6f3.870fcf5f.chunk.js.LICENSE.txt */
(window.__LOADABLE_LOADED_CHUNKS__=window.__LOADABLE_LOADED_CHUNKS__||[]).push([[1],{
/***/AknM:
/***/function(t,e,n){"use strict";
/* harmony export (binding) */n.d(e,"a",(function(){return r}));var r=!0;
/***/},
/***/AsJ6:
/***/function(t,e,n){"use strict";
/* harmony export (binding) */n.d(e,"a",(function(){return O})),
/* unused harmony export assign */
/* harmony export (binding) */n.d(e,"b",(function(){return p})),
/* unused harmony export choose */
/* harmony export (binding) */n.d(e,"c",(function(){return j})),
/* harmony export (binding) */n.d(e,"d",(function(){return g})),
/* harmony export (binding) */n.d(e,"e",(function(){return m})),
/* unused harmony export escalate */
/* unused harmony export forwardTo */
/* harmony export (binding) */n.d(e,"f",(function(){return u})),
/* harmony export (binding) */n.d(e,"g",(function(){return c})),
/* unused harmony export log */
/* unused harmony export pure */
/* harmony export (binding) */n.d(e,"h",(function(){return l})),
/* harmony export (binding) */n.d(e,"i",(function(){return w})),
/* unused harmony export resolveLog */
/* unused harmony export resolveRaise */
/* unused harmony export resolveSend */
/* unused harmony export resolveStop */
/* unused harmony export respond */
/* harmony export (binding) */n.d(e,"j",(function(){return v})),
/* unused harmony export sendParent */
/* unused harmony export sendUpdate */
/* harmony export (binding) */n.d(e,"k",(function(){return b})),
/* harmony export (binding) */n.d(e,"l",(function(){return y})),
/* harmony export (binding) */n.d(e,"m",(function(){return f})),
/* harmony export (binding) */n.d(e,"n",(function(){return h})),
/* harmony export (binding) */n.d(e,"o",(function(){return d}));
/* harmony import */var r=n("WDwj"),i=n("AknM"),o=n("Hhoo"),a=n("C1IE"),s=n("mq7k"),c=Object(o.C)({type:s.f});
/* harmony import */function u(t,e){return e&&e[t]||void 0}function f(t,e){var n;if(Object(o.k)(t)||"number"===typeof t){var i=u(t,e);n=Object(o.g)(i)?{type:t,exec:i}:i||{type:t,exec:void 0}}else if(Object(o.g)(t))n={
// Convert action to string if unnamed
type:t.name||t.toString(),exec:t};else{i=u(t.type,e);if(Object(o.g)(i))n=Object(r.a)(Object(r.a)({},t),{exec:i});else if(i){var a=i.type||t.type;n=Object(r.a)(Object(r.a)(Object(r.a)({},i),t),{type:a})}else n=t}return Object.defineProperty(n,"toString",{value:function(){return n.type},enumerable:!1,configurable:!0}),n}var h=function(t,e){return t?(Object(o.e)(t)?t:[t]).map((function(t){return f(t,e)})):[]};function d(t){var e=f(t);return Object(r.a)(Object(r.a)({id:Object(o.k)(t)?t:e.id},e),{type:e.type})}
/**
 * Raises an event. This places the event in the internal event queue, so that
 * the event is immediately consumed by the machine in the current step.
 *
 * @param eventType The event to raise.
 */function l(t){return Object(o.k)(t)?{type:s.k,event:t}:v(t,{to:a.b.Internal})}
/**
 * Sends an event. This returns an action that will be read by an interpreter to
 * send the event in the next step, after the current step is finished executing.
 *
 * @param event The event to send.
 * @param options Options to pass into the send event:
 *  - `id` - The unique send event identifier (used with `cancel()`).
 *  - `delay` - The number of milliseconds to delay the sending of the event.
 *  - `to` - The target of this event (by default, the machine the event was sent from).
 */
function v(t,e){return{to:e?e.to:void 0,type:s.l,event:Object(o.g)(t)?t:Object(o.y)(t),delay:e?e.delay:void 0,id:e&&void 0!==e.id?e.id:Object(o.g)(t)?t.name:Object(o.c)(t)}}var p=function(t){return{type:s.b,sendId:t}};
/**
 * Cancels an in-flight `send(...)` action. A canceled sent action will not
 * be executed, nor will its event be sent, unless it has already been sent
 * (e.g., if `cancel(...)` is called after the `send(...)` action's `delay`).
 *
 * @param sendId The `id` of the `send(...)` action to cancel.
 */
/**
 * Starts an activity.
 *
 * @param activity The activity to start.
 */
function b(t){var e=d(t);return{type:a.a.Start,activity:e,exec:void 0}}
/**
 * Stops an activity.
 *
 * @param actorRef The activity to stop.
 */function y(t){var e=Object(o.g)(t)?t:d(t);return{type:a.a.Stop,activity:e,exec:void 0}}
/**
 * Returns an event type that represents an implicit event that
 * is sent after the specified `delay`.
 *
 * @param delayRef The delay in milliseconds
 * @param id The state node ID where this event is handled
 */
function O(t,e){var n=e?"#"+e:"";return a.a.After+"("+t+")"+n}
/**
 * Returns an event that represents that a final state node
 * has been reached in the parent state node.
 *
 * @param id The final state node's parent state node `id`
 * @param data The data to pass into the event
 */function j(t,e){var n=a.a.DoneState+"."+t,r={type:n,data:e,toString:function(){return n}};return r}
/**
 * Returns an event that represents that an invoked service has terminated.
 *
 * An invoked service is terminated when it has reached a top-level final state node,
 * but not when it is canceled.
 *
 * @param id The final state node ID
 * @param data The data to pass into the event
 */function g(t,e){var n=a.a.DoneInvoke+"."+t,r={type:n,data:e,toString:function(){return n}};return r}function m(t,e){var n=a.a.ErrorPlatform+"."+t,r={type:n,data:e,toString:function(){return n}};return r}function w(t,e,n,c,u){var d=Object(r.b)(Object(o.s)(u,(function(t){return t.type===s.a})),2),l=d[0],v=d[1],p=l.length?Object(o.I)(n,c,l,e):n;return[Object(o.b)(v.map((function(n){var u,d;switch(n.type){case s.k:return d=n,{type:s.k,_event:Object(o.C)(d.event)};case s.l:var l=function(t,e,n,i){var a,s={_event:n},c=Object(o.C)(Object(o.g)(t.event)?t.event(e,n.data,s):t.event);// TODO: helper function for resolving Expr
if(Object(o.k)(t.delay)){var u=i&&i[t.delay];a=Object(o.g)(u)?u(e,n.data,s):u}else a=Object(o.g)(t.delay)?t.delay(e,n.data,s):t.delay;var f=Object(o.g)(t.to)?t.to(e,n.data,s):t.to;return Object(r.a)(Object(r.a)({},t),{to:f,_event:c,event:c.data,delay:a})}
/**
 * Sends an event to this machine's parent.
 *
 * @param event The event to send to the parent machine.
 * @param options Options to pass into the send event.
 */(n,p,c,t.options.delays);// TODO: fix ActionTypes.Init
return i.a||
// warn after resolving as we can create better contextual message here
Object(o.K)(!Object(o.k)(n.delay)||"number"===typeof l.delay,// tslint:disable-next-line:max-line-length
"No delay reference for delay expression '"+n.delay+"' was found on machine '"+t.id+"'"),l;case s.h:return function(t,e,n){return Object(r.a)(Object(r.a)({},t),{value:Object(o.k)(t.expr)?t.expr:t.expr(e,n.data,{_event:n})})}(n,p,c);case s.c:if(!(b=null===(u=n.conds.find((function(n){var r=Object(o.z)(n.cond,t.options.guards);return!r||Object(o.a)(t,r,p,c,e)})))||void 0===u?void 0:u.actions))return[];var v=w(t,e,p,c,h(Object(o.x)(b),t.options.actions));return p=v[1],v[0];case s.j:var b;if(!(b=n.get(p,c.data)))return[];v=w(t,e,p,c,h(Object(o.x)(b),t.options.actions));return p=v[1],v[0];case s.n:return function(t,e,n){var r=Object(o.g)(t.activity)?t.activity(e,n.data):t.activity,i="string"===typeof r?{id:r}:r;return{type:a.a.Stop,activity:i}}
/**
 * Updates the current context of the machine.
 *
 * @param assignment An object that represents the partial context to update.
 */(n,p,c);default:return f(n,t.options.actions)}}))),p]}
/***/},
/***/"C+hi":
/***/function(t,e,n){"use strict";
/* harmony export (binding) */n.d(e,"a",(function(){return h})),
/* harmony export (binding) */n.d(e,"b",(function(){return f})),
/* harmony export (binding) */n.d(e,"c",(function(){return u})),
/* harmony export (binding) */n.d(e,"d",(function(){return c}));
/* harmony import */var r=n("WDwj"),i=n("UVQZ"),o=n("Hhoo"),a=n("CWip"),s=n("AsJ6");
/* harmony import */function c(t,e){if(t===e)return!0;if(void 0===t||void 0===e)return!1;if(Object(o.k)(t)||Object(o.k)(e))return t===e;var n=Object(o.l)(t),r=Object(o.l)(e);return n.length===r.length&&n.every((function(n){return c(t[n],e[n])}))}function u(t){return!Object(o.k)(t)&&("value"in t&&"history"in t)}function f(t,e){var n=t.exec;return Object(r.a)(Object(r.a)({},t),{exec:void 0!==n?function(){return n(e.context,e.event,{action:t,state:e,_event:e._event})}:void 0})}var h=

/** @class */
function(){
/**
   * Creates a new State instance.
   * @param value The state value
   * @param context The extended state
   * @param historyValue The tree representing historical values of the state nodes
   * @param history The previous state
   * @param actions An array of action objects to execute as side-effects
   * @param activities A mapping of activities and whether they are started (`true`) or stopped (`false`).
   * @param meta
   * @param events Internal event queue. Should be empty with run-to-completion semantics.
   * @param configuration
   */
function t(t){var e,n=this;this.actions=[],this.activities=i.b,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.b,this.meta=t.meta||{},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=t.tags)&&void 0!==e?e:new Set,Object.defineProperty(this,"nextEvents",{get:function(){return Object(a.h)(n.configuration)}})}
/**
   * Creates a new State instance for the given `stateValue` and `context`.
   * @param stateValue
   * @param context
   */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:s.g,_sessionid:null,historyValue:void 0,history:void 0,actions:[],activities:void 0,meta:void 0,events:[],configuration:[],transitions:[],children:{}})},
/**
   * Creates a new State instance for the given `config`.
   * @param config The state config
   */
t.create=function(e){return new t(e)},
/**
   * Creates a new `State` instance for the given `stateValue` and `context` with no actions (side-effects).
   * @param stateValue
   * @param context
   */
t.inert=function(e,n){if(e instanceof t){if(!e.actions.length)return e;var r=s.g;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)},
/**
   * Returns an array of all the string leaf state node paths.
   * @param stateValue
   * @param delimiter The character(s) that separate each subpath in the string state node path.
   */
t.prototype.toStrings=function(t,e){var n=this;if(void 0===t&&(t=this.value),void 0===e&&(e="."),Object(o.k)(t))return[t];var i=Object(o.l)(t);return i.concat.apply(i,Object(r.d)([],Object(r.b)(i.map((function(r){return n.toStrings(t[r],e).map((function(t){return r+e+t}))})))))},t.prototype.toJSON=function(){var t=this,e=(t.configuration,t.transitions,t.tags),n=Object(r.c)(t,["configuration","transitions","tags"]);return Object(r.a)(Object(r.a)({},n),{tags:Array.from(e)})},
/**
   * Whether the current state value is a subset of the given parent state value.
   * @param parentStateValue
   */
t.prototype.matches=function(t){return Object(o.p)(t,this.value)},
/**
   * Whether the current state configuration has a state node with the specified `tag`.
   * @param tag
   */
t.prototype.hasTag=function(t){return this.tags.has(t)},t}();
/***/},
/***/C1IE:
/***/function(t,e,n){"use strict";
/* harmony export (binding) */var r,i;n.d(e,"a",(function(){return r})),
/* harmony export (binding) */n.d(e,"b",(function(){return i})),function(t){t.Start="xstate.start",t.Stop="xstate.stop",t.Raise="xstate.raise",t.Send="xstate.send",t.Cancel="xstate.cancel",t.NullEvent="",t.Assign="xstate.assign",t.After="xstate.after",t.DoneState="done.state",t.DoneInvoke="done.invoke",t.Log="xstate.log",t.Init="xstate.init",t.Invoke="xstate.invoke",t.ErrorExecution="error.execution",t.ErrorCommunication="error.communication",t.ErrorPlatform="error.platform",t.ErrorCustom="xstate.error",t.Update="xstate.update",t.Pure="xstate.pure",t.Choose="xstate.choose"}(r||(r={})),function(t){t.Parent="#_parent",t.Internal="#_internal"}(i||(i={}))},
/***/CWip:
/***/function(t,e,n){"use strict";
/* unused harmony export getAdjList */
/* harmony export (binding) */n.d(e,"a",(function(){return s})),
/* harmony export (binding) */n.d(e,"b",(function(){return a})),
/* harmony export (binding) */n.d(e,"c",(function(){return c})),
/* harmony export (binding) */n.d(e,"d",(function(){return h})),
/* harmony export (binding) */n.d(e,"e",(function(){return d})),
/* harmony export (binding) */n.d(e,"f",(function(){return v})),
/* harmony export (binding) */n.d(e,"g",(function(){return o})),
/* harmony export (binding) */n.d(e,"h",(function(){return l}));
/* harmony import */var r=n("WDwj"),i=n("Hhoo"),o=function(t){return"atomic"===t.type||"final"===t.type};
/* harmony import */function a(t){return Object(i.l)(t.states).map((function(e){return t.states[e]}))}function s(t){var e=[t];return o(t)?e:e.concat(Object(i.b)(a(t).map(s)))}function c(t,e){var n,i,o,s,c,u,h,d,l=f(new Set(t)),v=new Set(e);try{
// add all ancestors
for(var p=Object(r.e)(v),b=p.next();!b.done;b=p.next())for(var y=(E=b.value).parent;y&&!v.has(y);)v.add(y),y=y.parent}catch(k){n={error:k}}finally{try{b&&!b.done&&(i=p.return)&&i.call(p)}finally{if(n)throw n.error}}var O=f(v);try{
// add descendants
for(var j=Object(r.e)(v),g=j.next();!g.done;g=j.next()){// if previously active, add existing child nodes
if("compound"!==(E=g.value).type||O.get(E)&&O.get(E).length){if("parallel"===E.type)try{for(var m=(c=void 0,Object(r.e)(a(E))),w=m.next();!w.done;w=m.next()){var x=w.value;"history"!==x.type&&(v.has(x)||(v.add(x),l.get(x)?l.get(x).forEach((function(t){return v.add(t)})):x.initialStateNodes.forEach((function(t){return v.add(t)}))))}}catch(N){c={error:N}}finally{try{w&&!w.done&&(u=m.return)&&u.call(m)}finally{if(c)throw c.error}}}else l.get(E)?l.get(E).forEach((function(t){return v.add(t)})):E.initialStateNodes.forEach((function(t){return v.add(t)}))}}catch(C){o={error:C}}finally{try{g&&!g.done&&(s=j.return)&&s.call(j)}finally{if(o)throw o.error}}try{
// add all ancestors
for(var S=Object(r.e)(v),_=S.next();!_.done;_=S.next()){var E;for(y=(E=_.value).parent;y&&!v.has(y);)v.add(y),y=y.parent}}catch(T){h={error:T}}finally{try{_&&!_.done&&(d=S.return)&&d.call(S)}finally{if(h)throw h.error}}return v}function u(t,e){var n=e.get(t);if(!n)return{};// todo: fix?
if("compound"===t.type){var r=n[0];if(!r)return{};if(o(r))return r.key}var i={};return n.forEach((function(t){i[t.key]=u(t,e)})),i}function f(t){var e,n,i=new Map;try{for(var o=Object(r.e)(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(c){e={error:c}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}return i}function h(t,e){return u(t,f(c([t],e)))}function d(t,e){return Array.isArray(t)?t.some((function(t){return t===e})):t instanceof Set&&t.has(e)}function l(t){return Object(r.d)([],Object(r.b)(new Set(Object(i.b)(Object(r.d)([],Object(r.b)(t.map((function(t){return t.ownEvents}))))))))}function v(t,e){return"compound"===e.type?a(e).some((function(e){return"final"===e.type&&d(t,e)})):"parallel"===e.type&&a(e).every((function(e){return v(t,e)}))}
/***/},
/***/Du1H:
/***/function(t,e,n){"use strict";
/* harmony export (binding) */n.d(e,"a",(function(){return o}));var r=new Map,i=0,o={bookId:function(){return"x:"+i++},register:function(t,e){return r.set(t,e),t},get:function(t){return r.get(t)},free:function(t){r.delete(t)}}},
/***/GKv7:
/***/function(t,e){t.exports=function(){for(var t={},e=0;e<arguments.length;e++){var r=arguments[e];for(var i in r)n.call(r,i)&&(t[i]=r[i])}return t}
/***/;var n=Object.prototype.hasOwnProperty},
/***/Hhoo:
/***/function(t,e,n){"use strict";
/* harmony export (binding) */n.d(e,"a",(function(){return F})),
/* harmony export (binding) */n.d(e,"b",(function(){return y})),
/* harmony export (binding) */n.d(e,"c",(function(){return c})),
/* harmony export (binding) */n.d(e,"d",(function(){return V})),
/* harmony export (binding) */n.d(e,"e",(function(){return N})),
/* harmony export (binding) */n.d(e,"f",(function(){return m})),
/* harmony export (binding) */n.d(e,"g",(function(){return C})),
/* harmony export (binding) */n.d(e,"h",(function(){return I})),
/* harmony export (binding) */n.d(e,"i",(function(){return D})),
/* harmony export (binding) */n.d(e,"j",(function(){return w})),
/* unused harmony export isStateLike */
/* harmony export (binding) */n.d(e,"k",(function(){return T})),
/* harmony export (binding) */n.d(e,"l",(function(){return a})),
/* harmony export (binding) */n.d(e,"m",(function(){return g})),
/* harmony export (binding) */n.d(e,"n",(function(){return l})),
/* harmony export (binding) */n.d(e,"o",(function(){return d})),
/* harmony export (binding) */n.d(e,"p",(function(){return s})),
/* harmony export (binding) */n.d(e,"q",(function(){return p})),
/* harmony export (binding) */n.d(e,"r",(function(){return z})),
/* harmony export (binding) */n.d(e,"s",(function(){return x})),
/* harmony export (binding) */n.d(e,"t",(function(){return v})),
/* harmony export (binding) */n.d(e,"u",(function(){return h})),
/* harmony export (binding) */n.d(e,"v",(function(){return K})),
/* harmony export (binding) */n.d(e,"w",(function(){return A})),
/* harmony export (binding) */n.d(e,"x",(function(){return j})),
/* unused harmony export toArrayStrict */
/* harmony export (binding) */n.d(e,"y",(function(){return M})),
/* harmony export (binding) */n.d(e,"z",(function(){return P})),
/* harmony export (binding) */n.d(e,"A",(function(){return U})),
/* harmony export (binding) */n.d(e,"B",(function(){return W})),
/* harmony export (binding) */n.d(e,"C",(function(){return R})),
/* harmony export (binding) */n.d(e,"D",(function(){return u})),
/* harmony export (binding) */n.d(e,"E",(function(){return b})),
/* harmony export (binding) */n.d(e,"F",(function(){return f})),
/* harmony export (binding) */n.d(e,"G",(function(){return J})),
/* harmony export (binding) */n.d(e,"H",(function(){return L})),
/* harmony export (binding) */n.d(e,"I",(function(){return E})),
/* unused harmony export updateHistoryStates */
/* harmony export (binding) */n.d(e,"J",(function(){return _})),
/* harmony export (binding) */n.d(e,"K",(function(){return k}));
/* harmony import */var r=n("WDwj"),i=n("UVQZ"),o=n("AknM");
/* harmony import */function a(t){return Object.keys(t)}function s(t,e,n){void 0===n&&(n=i.c);var r=f(t,n),o=f(e,n);return T(o)?!!T(r)&&o===r:T(r)?r in o:a(r).every((function(t){return t in o&&s(r[t],o[t])}))}function c(t){try{return T(t)||"number"===typeof t?""+t:t.type}catch(e){throw new Error("Events must be strings or objects with a string event.type property.")}}function u(t,e){try{return N(t)?t:t.toString().split(e)}catch(n){throw new Error("'"+t+"' is not a valid state path.")}}function f(t,e){return"object"===typeof(n=t)&&"value"in n&&"context"in n&&"event"in n&&"_event"in n?t.value:N(t)?h(t):"string"!==typeof t?t:h(u(t,e));var n}function h(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=a(t),i=0;i<r.length;i++){var o=r[i];n[o]=e(t[o],o,t,i)}return n}function l(t,e,n){var i,o,s={};try{for(var c=Object(r.e)(a(t)),u=c.next();!u.done;u=c.next()){var f=u.value,h=t[f];n(h)&&(s[f]=e(h,f,t))}}catch(d){i={error:d}}finally{try{u&&!u.done&&(o=c.return)&&o.call(c)}finally{if(i)throw i.error}}return s}
/**
 * Retrieves a value at the given path.
 * @param props The deep path to the prop of the desired value
 */var v=function(t){return function(e){var n,i,o=e;try{for(var a=Object(r.e)(t),s=a.next();!s.done;s=a.next()){o=o[s.value]}}catch(c){n={error:c}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}return o}};
/**
 * Retrieves a value at the given path via the nested accessor prop.
 * @param props The deep path to the prop of the desired value
 */function p(t,e){return function(n){var i,o,a=n;try{for(var s=Object(r.e)(t),c=s.next();!c.done;c=s.next()){var u=c.value;a=a[e][u]}}catch(f){i={error:f}}finally{try{c&&!c.done&&(o=s.return)&&o.call(s)}finally{if(i)throw i.error}}return a}}function b(t){return t?T(t)?[[t]]:y(a(t).map((function(e){var n=t[e];return"string"===typeof n||n&&Object.keys(n).length?b(t[e]).map((function(t){return[e].concat(t)})):[[e]]}))):[[]]}function y(t){var e;return(e=[]).concat.apply(e,Object(r.d)([],Object(r.b)(t)))}function O(t){return N(t)?t:[t]}function j(t){return void 0===t?[]:O(t)}function g(t,e,n){var i,o;if(C(t))return t(e,n.data);var a={};try{for(var s=Object(r.e)(Object.keys(t)),c=s.next();!c.done;c=s.next()){var u=c.value,f=t[u];C(f)?a[u]=f(e,n.data):a[u]=f}}catch(h){i={error:h}}finally{try{c&&!c.done&&(o=s.return)&&o.call(s)}finally{if(i)throw i.error}}return a}function m(t){return/^(done|error)\./.test(t)}function w(t){return t instanceof Promise||!(null===t||!C(t)&&"object"!==typeof t||!C(t.then));// Check if shape matches the Promise/A+ specification for a "thenable".
}function x(t,e){var n,i,o=Object(r.b)([[],[]],2),a=o[0],s=o[1];try{for(var c=Object(r.e)(t),u=c.next();!u.done;u=c.next()){var f=u.value;e(f)?a.push(f):s.push(f)}}catch(h){n={error:h}}finally{try{u&&!u.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}return[a,s]}function S(t,e){return d(t.states,(function(t,n){if(t){var r=(T(e)?void 0:e[n])||(t?t.current:void 0);if(r)return{current:r,states:S(t,r)}}}))}function _(t,e){return{current:e,states:S(t,e)}}function E(t,e,n,i){return o.a||k(!!t,"Attempting to update undefined context"),t?n.reduce((function(t,n){var o,s,c=n.assignment,u={state:i,action:n,_event:e},f={};if(C(c))f=c(t,e.data,u);else try{for(var h=Object(r.e)(a(c)),d=h.next();!d.done;d=h.next()){var l=d.value,v=c[l];f[l]=C(v)?v(t,e.data,u):v}}catch(p){o={error:p}}finally{try{d&&!d.done&&(s=h.return)&&s.call(h)}finally{if(o)throw o.error}}return Object.assign({},t,f)}),t):t}// tslint:disable-next-line:no-empty
var k=function(){};function N(t){return Array.isArray(t)}// tslint:disable-next-line:ban-types
function C(t){return"function"===typeof t}function T(t){return"string"===typeof t}// export function memoizedGetter<T, TP extends { prototype: object }>(
//   o: TP,
//   property: string,
//   getter: () => T
// ): void {
//   Object.defineProperty(o.prototype, property, {
//     get: getter,
//     enumerable: false,
//     configurable: false
//   });
// }
function P(t,e){if(t)return T(t)?{type:i.a,name:t,predicate:e?e[t]:void 0}:C(t)?{type:i.a,name:t.name,predicate:t}:t}function D(t){try{return"subscribe"in t&&C(t.subscribe)}catch(e){return!1}}o.a||(k=function(t,e){var n=t instanceof Error?t:void 0;if((n||!t)&&void 0!==console){var r=["Warning: "+e];n&&r.push(n),// tslint:disable-next-line:no-console
console.warn.apply(console,r)}});var A=function(){return"function"===typeof Symbol&&Symbol.observable||"@@observable"}();function I(t){try{return"__xstatenode"in t}catch(e){return!1}}function V(t){return!!t&&"function"===typeof t.send}var L=function(){var t=0;return function(){return(++t).toString(16)}}();function M(t,e){return T(t)||"number"===typeof t?Object(r.a)({type:t},e):t}function R(t,e){if(!T(t)&&"$$type"in t&&"scxml"===t.$$type)return t;var n=M(t);return Object(r.a)({name:n.type,data:n,$$type:"scxml",type:"external"},e)}function J(t,e){return O(e).map((function(e){return"undefined"===typeof e||"string"===typeof e||I(e)?{target:e,event:t}:Object(r.a)(Object(r.a)({},e),{event:t})}))}function z(t){if(void 0!==t&&t!==i.d)return j(t)}function K(t,e,n){if(!o.a){var r=t.stack?" Stacktrace was '"+t.stack+"'":"";if(t===e)
// tslint:disable-next-line:no-console
console.error("Missing onError handler for invocation '"+n+"', error was '"+t+"'."+r);else{var i=e.stack?" Stacktrace was '"+e.stack+"'":"";// tslint:disable-next-line:no-console
console.error("Missing onError handler and/or unhandled exception/promise rejection for invocation '"+n+"'. Original error: '"+t+"'. "+r+" Current error is '"+e+"'."+i)}}}function F(t,e,n,r,o){var a=t.options.guards,s={state:o,cond:e,_event:r};// TODO: do not hardcode!
if(e.type===i.a)return e.predicate(n,r.data,s);var c=a[e.type];if(!c)throw new Error("Guard '"+e.type+"' is not implemented on machine '"+t.id+"'.");return c(n,r.data,s)}function U(t){return"string"===typeof t?{type:t}:t}function W(t,e,n){if("object"===typeof t)return t;var r=function(){};return{next:t,error:e||r,complete:n||r}}
/***/},
/***/NWYr:
/***/function(t,e,n){"use strict";
/* harmony export (binding) */n.d(e,"a",(function(){return o})),
/* harmony export (binding) */n.d(e,"b",(function(){return i}));
/**
 * Maintains a stack of the current service in scope.
 * This is used to provide the correct service to spawn().
 */
var r=[],i=function(t,e){r.push(t);var n=e(t);return r.pop(),n},o=function(t){return t(r[r.length-1])}},
/***/UVQZ:
/***/function(t,e,n){"use strict";
/* harmony export (binding) */n.d(e,"a",(function(){return o})),
/* harmony export (binding) */n.d(e,"b",(function(){return i})),
/* harmony export (binding) */n.d(e,"c",(function(){return r})),
/* harmony export (binding) */n.d(e,"d",(function(){return a}));var r=".",i={},o="xstate.guard",a=""},
/***/WDwj:
/***/function(t,e,n){"use strict";
/* harmony export (binding) */n.d(e,"a",(function(){return r})),
/* harmony export (binding) */n.d(e,"b",(function(){return a})),
/* harmony export (binding) */n.d(e,"c",(function(){return i})),
/* harmony export (binding) */n.d(e,"d",(function(){return s})),
/* harmony export (binding) */n.d(e,"e",(function(){return o}));
/*! *****************************************************************************
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)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&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 new 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(s){i={error:s}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function s(t,e){for(var n=0,r=e.length,i=t.length;n<r;n++,i++)t[i]=e[n];return t}
/***/},
/***/iJGL:
/***/function(t,e,n){"use strict";
/* harmony export (binding) */n.d(e,"a",(function(){return o}));
/* harmony import */var r=n("WDwj"),i={deferEvents:!1},o=

/** @class */
function(){function t(t){this.processingEvent=!1,this.queue=[],this.initialized=!1,this.options=Object(r.a)(Object(r.a)({},i),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(e){
// there is no use to keep the future events
// as the situation is not anymore the same
throw this.clear(),e}finally{this.processingEvent=!1}},t}()},
/***/mq7k:
/***/function(t,e,n){"use strict";
/* unused harmony export after */
/* harmony export (binding) */n.d(e,"a",(function(){return f})),
/* harmony export (binding) */n.d(e,"b",(function(){return c})),
/* harmony export (binding) */n.d(e,"c",(function(){return y})),
/* unused harmony export doneState */
/* harmony export (binding) */n.d(e,"d",(function(){return p})),
/* unused harmony export errorExecution */
/* harmony export (binding) */n.d(e,"e",(function(){return v})),
/* harmony export (binding) */n.d(e,"f",(function(){return d})),
/* harmony export (binding) */n.d(e,"g",(function(){return l})),
/* harmony export (binding) */n.d(e,"h",(function(){return h})),
/* harmony export (binding) */n.d(e,"i",(function(){return u})),
/* harmony export (binding) */n.d(e,"j",(function(){return O})),
/* harmony export (binding) */n.d(e,"k",(function(){return a})),
/* harmony export (binding) */n.d(e,"l",(function(){return s})),
/* harmony export (binding) */n.d(e,"m",(function(){return i})),
/* harmony export (binding) */n.d(e,"n",(function(){return o})),
/* harmony export (binding) */n.d(e,"o",(function(){return b}));
/* harmony import */var r=n("C1IE"),i=r.a.Start,o=r.a.Stop,a=r.a.Raise,s=r.a.Send,c=r.a.Cancel,u=r.a.NullEvent,f=r.a.Assign,h=(r.a.After,r.a.DoneState,r.a.Log),d=r.a.Init,l=r.a.Invoke,v=(r.a.ErrorExecution,r.a.ErrorPlatform),p=r.a.ErrorCustom,b=r.a.Update,y=r.a.Choose,O=r.a.Pure;
// xstate-specific action types
},
/***/mwJI:
/***/function(t,e,n){"use strict";
/* WEBPACK VAR INJECTION */(function(t){
// From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis
function r(){return"undefined"!==typeof self?self:"undefined"!==typeof window?window:"undefined"!==typeof t?t:void 0}function i(t){if(r()){var e=function(){var t=r();if(t&&"__xstate__"in t)return t.__xstate__}();e&&e.register(t)}}
/* WEBPACK VAR INJECTION */ /* harmony export (binding) */n.d(e,"a",(function(){return r})),
/* harmony export (binding) */n.d(e,"b",(function(){return i}))}).call(this,n("fRV1"))
/***/},
/***/"rpJ/":
/***/function(t,e,n){"use strict";
// EXPORTS
n.d(e,"a",(function(){/* binding */return j}));
// UNUSED EXPORTS: createMachine
// EXTERNAL MODULE: /Users/paulcowan/projects/cuttingedge/node_modules/xstate/es/_virtual/_tslib.js
var r=n("WDwj"),i=n("UVQZ"),o=n("AknM"),a=n("Hhoo"),s=n("C1IE"),c=n("CWip"),u=n("mq7k"),f=n("AsJ6"),h=n("C+hi"),d=n("zcQ/");
// EXTERNAL MODULE: /Users/paulcowan/projects/cuttingedge/node_modules/xstate/es/constants.js
// CONCATENATED MODULE: /Users/paulcowan/projects/cuttingedge/node_modules/xstate/es/invokeUtils.js
function l(t){if("string"===typeof t){var e={type:t,toString:function(){return t}};// v4 compat - TODO: remove in v5
return e}return t}function v(t){return Object(r.a)(Object(r.a)({type:u.g},t),{toJSON:function(){t.onDone,t.onError;var e=Object(r.c)(t,["onDone","onError"]);return Object(r.a)(Object(r.a)({},e),{type:u.g,src:l(t.src)})}})}
// CONCATENATED MODULE: /Users/paulcowan/projects/cuttingedge/node_modules/xstate/es/StateNode.js
var p="*",b={},y=function(t){return"#"===t[0]},O=

/** @class */
function(){function t(
/**
   * The raw config used to create the machine.
   */
e,n,
/**
   * The initial extended state
   */
s){var u,h=this;void 0===s&&(s=void 0),this.config=e,this.context=s,
/**
     * The order this state node appears. Corresponds to the implicit SCXML document order.
     */
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=this.options._parent,this.key=this.config.key||this.options._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:i.c),this.id=this.config.id||Object(r.d)([this.machine.key],Object(r.b)(this.path)).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(a.l)(this.config.states).length?"compound":this.config.history?"history":"atomic"),this.schema=this.parent?this.machine.schema:null!==(u=this.config.schema)&&void 0!==u?u:{},o.a||Object(a.K)(!("parallel"in this.config),'The "parallel" property is deprecated and will be removed in version 4.1. '+(this.config.parallel?"Replace with `type: 'parallel'`":"Use `type: '"+this.type+"'`")+" in the config for state node '"+this.id+"' instead."),this.initial=this.config.initial,this.states=this.config.states?Object(a.o)(this.config.states,(function(e,n){var i,o=new t(e,{_parent:h,_key:n});return Object.assign(h.idMap,Object(r.a)(((i={})[o.id]=o,i),o.idMap)),o})):b;// Document order
var d=0;!function t(e){var n,i;e.order=d++;try{for(var o=Object(r.e)(Object(c.b)(e)),a=o.next();!a.done;a=o.next()){t(a.value)}}catch(s){n={error:s}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}}(this),// History config
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,// TODO: deprecate (entry)
this.onEntry=Object(a.x)(this.config.entry||this.config.onEntry).map((function(t){return Object(f.m)(t)})),// TODO: deprecate (exit)
this.onExit=Object(a.x)(this.config.exit||this.config.onExit).map((function(t){return Object(f.m)(t)})),this.meta=this.config.meta,this.doneData="final"===this.type?this.config.data:void 0,this.invoke=Object(a.x)(this.config.invoke).map((function(t,e){var n,i;if(Object(a.h)(t))return h.machine.options.services=Object(r.a)(((n={})[t.id]=t,n),h.machine.options.services),v({src:t.id,id:t.id});if(Object(a.k)(t.src))return v(Object(r.a)(Object(r.a)({},t),{id:t.id||t.src,src:t.src}));if(Object(a.h)(t.src)||Object(a.g)(t.src)){var o=h.id+":invocation["+e+"]";// TODO: util function
return h.machine.options.services=Object(r.a)(((i={})[o]=t.src,i),h.machine.options.services),v(Object(r.a)(Object(r.a)({id:o},t),{src:o}))}var s=t.src;return v(Object(r.a)(Object(r.a)({id:s.type},t),{src:s}))})),this.activities=Object(a.x)(this.config.activities).concat(this.invoke).map((function(t){return Object(f.o)(t)})),this.transition=this.transition.bind(this),this.tags=Object(a.x)(this.config.tags)}return t.prototype._init=function(){this.__cache.transitions||Object(c.a)(this).forEach((function(t){return t.on}))},
/**
   * Clones this state machine with custom options and context.
   *
   * @param options Options (actions, guards, activities, services) to recursively merge with the existing options.
   * @param context Custom context (will override predefined context)
   */
t.prototype.withConfig=function(e,n){void 0===n&&(n=this.context);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:Object(r.a)(Object(r.a)({},o),e.actions),activities:Object(r.a)(Object(r.a)({},a),e.activities),guards:Object(r.a)(Object(r.a)({},s),e.guards),services:Object(r.a)(Object(r.a)({},c),e.services),delays:Object(r.a)(Object(r.a)({},u),e.delays)},n)},
/**
   * Clones this state machine with custom context.
   *
   * @param context Custom context (will override predefined context, not recursive)
   */
t.prototype.withContext=function(e){return new t(this.config,this.options,e)},Object.defineProperty(t.prototype,"definition",{
/**
     * The well-structured state node 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:Object(a.o)(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}},enumerable:!1,configurable:!0}),t.prototype.toJSON=function(){return this.definition},Object.defineProperty(t.prototype,"on",{
/**
     * The mapping of events to transitions.
     */
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",{
/**
     * All the transitions that can be taken from this state node.
     */
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;// null events should only match against eventless transitions
return e?r:r||n.eventType===p}));return this.__cache.candidates[t]=n,n},
/**
   * All delayed transitions from the config.
   */
t.prototype.getDelayedTransitions=function(){var t=this,e=this.config.after;if(!e)return[];var n=function(e,n){var r=Object(a.g)(e)?t.id+":delay["+n+"]":e,i=Object(f.a)(r,t.id);return t.onEntry.push(Object(f.j)(i,{delay:e})),t.onExit.push(Object(f.b)(i)),i};return(Object(a.e)(e)?e.map((function(t,e){var i=n(t.delay,e);return Object(r.a)(Object(r.a)({},t),{event:i})})):Object(a.b)(Object(a.l)(e).map((function(t,i){var o=e[t],s=Object(a.k)(o)?{target:o}:o,c=isNaN(+t)?t:+t,u=n(c,i);return Object(a.x)(s).map((function(t){return Object(r.a)(Object(r.a)({},t),{event:u,delay:c})}))})))).map((function(e){var n=e.delay;return Object(r.a)(Object(r.a)({},t.formatTransition(e)),{delay:n})}))},
/**
   * Returns the state nodes represented by the current state value.
   *
   * @param state The state value or State instance
   */
t.prototype.getStateNodes=function(t){var e,n=this;if(!t)return[];var r=t instanceof h.a?t.value:Object(a.F)(t,this.delimiter);if(Object(a.k)(r)){var i=this.getStateNode(r).initial;return void 0!==i?this.getStateNodes(((e={})[r]=i,e)):[this,this.states[r]]}var o=Object(a.l)(r),s=o.map((function(t){return n.getStateNode(t)}));return s.push(this),s.concat(o.reduce((function(t,e){var i=n.getStateNode(e).getStateNodes(r[e]);return t.concat(i)}),[]))},
/**
   * Returns `true` if this state node explicitly handles the given event.
   *
   * @param event The event in question
   */
t.prototype.handles=function(t){var e=Object(a.c)(t);return this.events.includes(e)},
/**
   * Resolves the given `state` to a new `State` instance relative to this machine.
   *
   * This ensures that `.events` and `.nextEvents` represent the correct values.
   *
   * @param state The state to resolve
   */
t.prototype.resolveState=function(t){var e=Array.from(Object(c.c)([],this.getStateNodes(t.value)));return new h.a(Object(r.a)(Object(r.a)({},t),{value:this.resolve(t.value),configuration:e,done:Object(c.f)(e,this)}))},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(a.l)(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 i,o,s={};try{for(var c=Object(r.e)(Object(a.l)(t)),u=c.next();!u.done;u=c.next()){var f=u.value,h=t[f];if(h){var d=this.getStateNode(f)._transition(h,e,n);d&&(s[f]=d)}}}catch(y){i={error:y}}finally{try{u&&!u.done&&(o=c.return)&&o.call(c)}finally{if(i)throw i.error}}var l=Object(a.l)(s).map((function(t){return s[t]})),v=Object(a.b)(l.map((function(t){return t.transitions})));if(!l.some((function(t){return t.transitions.length>0})))return this.next(e,n);var p=Object(a.b)(l.map((function(t){return t.entrySet}))),b=Object(a.b)(Object(a.l)(s).map((function(t){return s[t].configuration})));return{transitions:v,entrySet:p,exitSet:Object(a.b)(l.map((function(t){return t.exitSet}))),configuration:b,source:e,actions:Object(a.b)(Object(a.l)(s).map((function(t){return s[t].actions})))}},t.prototype._transition=function(t,e,n){
// leaf node
return Object(a.k)(t)?this.transitionLeafNode(t,e,n):// hierarchical node
1===Object(a.l)(t).length?this.transitionCompoundNode(t,e,n):this.transitionParallelNode(t,e,n)},t.prototype.next=function(t,e){var n,i,o,s=this,c=e.name,u=[],f=[];try{for(var h=Object(r.e)(this.getCandidates(c)),d=h.next();!d.done;d=h.next()){var l=d.value,v=l.cond,p=l.in,b=t.context,O=!p||(Object(a.k)(p)&&y(p)?// Check if in state by ID
t.matches(Object(a.F)(this.getStateNodeById(p).path,this.delimiter)):// Check if in state by relative grandparent
Object(a.p)(Object(a.F)(p,this.delimiter),Object(a.t)(this.path.slice(0,-2))(t.value))),j=!1;try{j=!v||Object(a.a)(this.machine,v,b,e,t)}catch(w){throw new Error("Unable to evaluate guard '"+(v.name||v.type)+"' in transition for event '"+c+"' in state node '"+this.id+"':\n"+w.message)}if(j&&O){void 0!==l.target&&(f=l.target),u.push.apply(u,Object(r.d)([],Object(r.b)(l.actions))),o=l;break}}}catch(x){n={error:x}}finally{try{d&&!d.done&&(i=h.return)&&i.call(h)}finally{if(n)throw n.error}}if(o){if(!f.length)return{transitions:[o],entrySet:[],exitSet:[],configuration:t.value?[this]:[],source:t,actions:u};var g=Object(a.b)(f.map((function(e){return s.getRelativeStateNodes(e,t.historyValue)}))),m=!!o.internal;return{transitions:[o],entrySet:m?[]:Object(a.b)(g.map((function(t){return s.nodesFromChild(t)}))),exitSet:m?[]:[this],configuration:g,source:t,actions:u}}},t.prototype.nodesFromChild=function(t){if(t.escapes(this))return[];for(var e=[],n=t;n&&n!==this;)e.push(n),n=n.parent;// inclusive
return e.push(this),e},
/**
   * Whether the given state node "escapes" this state node. If the `stateNode` is equal to or the parent of
   * this state node, it does not escape.
   */
t.prototype.escapes=function(t){if(this===t)return!1;for(var e=this.parent;e;){if(e===t)return!1;e=e.parent}return!0},t.prototype.getActions=function(t,e,n,i){var o,s,u,h,d=Object(c.c)([],i?this.getStateNodes(i.value):[this]),l=t.configuration.length?Object(c.c)(d,t.configuration):d;try{for(var v=Object(r.e)(l),p=v.next();!p.done;p=v.next()){var b=p.value;Object(c.e)(d,b)||t.entrySet.push(b)}}catch(_){o={error:_}}finally{try{p&&!p.done&&(s=v.return)&&s.call(v)}finally{if(o)throw o.error}}try{for(var y=Object(r.e)(d),O=y.next();!O.done;O=y.next()){b=O.value;Object(c.e)(l,b)&&!Object(c.e)(t.exitSet,b.parent)||t.exitSet.push(b)}}catch(E){u={error:E}}finally{try{O&&!O.done&&(h=y.return)&&h.call(y)}finally{if(u)throw u.error}}t.source||(t.exitSet=[],// Ensure that root StateNode (machine) is entered
t.entrySet.push(this));var j=Object(a.b)(t.entrySet.map((function(r){var i=[];if("final"!==r.type)return i;var o=r.parent;if(!o.parent)return i;i.push(Object(f.c)(r.id,r.doneData),// TODO: deprecate - final states should not emit done events for their own state.
Object(f.c)(o.id,r.doneData?Object(a.m)(r.doneData,e,n):void 0));var s=o.parent;return"parallel"===s.type&&Object(c.b)(s).every((function(e){return Object(c.f)(t.configuration,e)}))&&i.push(Object(f.c)(s.id)),i})));t.exitSet.sort((function(t,e){return e.order-t.order})),t.entrySet.sort((function(t,e){return t.order-e.order}));var g=new Set(t.entrySet),m=new Set(t.exitSet),w=Object(r.b)([Object(a.b)(Array.from(g).map((function(t){return Object(r.d)(Object(r.d)([],Object(r.b)(t.activities.map((function(t){return Object(f.k)(t)})))),Object(r.b)(t.onEntry))}))).concat(j.map(f.h)),Object(a.b)(Array.from(m).map((function(t){return Object(r.d)(Object(r.d)([],Object(r.b)(t.onExit)),Object(r.b)(t.activities.map((function(t){return Object(f.l)(t)}))))})))],2),x=w[0],S=w[1];return Object(f.n)(S.concat(t.actions).concat(x),this.machine.options.actions)},
/**
   * Determines the next state given the current `state` and sent `event`.
   *
   * @param state The current State instance or state value
   * @param event The event that was sent at the current state
   * @param context The current context (extended state) of the current state
   */
t.prototype.transition=function(t,e,n){void 0===t&&(t=this.initialState);var i,s=Object(a.C)(e);if(t instanceof h.a)i=void 0===n?t:this.resolveState(h.a.from(t,n));else{var u=Object(a.k)(t)?this.resolve(Object(a.u)(this.getResolvedPath(t))):this.resolve(t),f=n||this.machine.context;i=this.resolveState(h.a.from(u,f))}if(!o.a&&s.name===p)throw new Error("An event cannot have the wildcard type ('*')");if(this.strict&&!this.events.includes(s.name)&&!Object(a.f)(s.name))throw new Error("Machine '"+this.id+"' does not accept event '"+s.name+"'");var d=this._transition(i.value,i,s)||{transitions:[],configuration:[],entrySet:[],exitSet:[],source:i,actions:[]},l=Object(c.c)([],this.getStateNodes(i.value)),v=d.configuration.length?Object(c.c)(l,d.configuration):l;return d.configuration=Object(r.d)([],Object(r.b)(v)),this.resolveTransition(d,i,s)},t.prototype.resolveRaisedTransition=function(t,e,n){var i,o=t.actions;// Save original event to state
// TODO: this should be the raised event! Delete in V5 (breaking)
return(t=this.transition(t,e))._event=n,t.event=n.data,(i=t.actions).unshift.apply(i,Object(r.d)([],Object(r.b)(o))),t},t.prototype.resolveTransition=function(t,e,n,i){var o,l,v=this;void 0===n&&(n=f.g),void 0===i&&(i=this.machine.context);var p=t.configuration,b=!e||t.transitions.length>0?Object(c.d)(this.machine,p):void 0,y=e?e.historyValue?e.historyValue:t.source?this.machine.historyValue(e.value):void 0:void 0,O=e?e.context:i,j=this.getActions(t,O,n,e),g=e?Object(r.a)({},e.activities):{};// Transition will "apply" if:
// - this is the initial state (there is no current state)
// - OR there are transitions
try{for(var m=Object(r.e)(j),w=m.next();!w.done;w=m.next()){var x=w.value;x.type===u.m?g[x.activity.id||x.activity.type]=x:x.type===u.n&&(g[x.activity.id||x.activity.type]=!1)}}catch(z){o={error:z}}finally{try{w&&!w.done&&(l=m.return)&&l.call(m)}finally{if(o)throw o.error}}var S=Object(r.b)(Object(f.i)(this,e,O,n,j),2),_=S[0],E=S[1],k=Object(r.b)(Object(a.s)(_,(function(t){return t.type===u.k||t.type===u.l&&t.to===s.b.Internal})),2),N=k[0],C=k[1],T=_.filter((function(t){var e;return t.type===u.m&&(null===(e=t.activity)||void 0===e?void 0:e.type)===u.g})).reduce((function(t,e){return t[e.activity.id]=Object(d.b)(e.activity,v.machine,E,n),t}),e?Object(r.a)({},e.children):{}),P=b?t.configuration:e?e.configuration:[],D=P.reduce((function(t,e){return void 0!==e.meta&&(t[e.id]=e.meta),t}),{}),A=Object(c.f)(P,this),I=new h.a({value:b||e.value,context:E,_event:n,
// Persist _sessionid between states
_sessionid:e?e._sessionid:null,historyValue:b?y?Object(a.J)(y,b):void 0:e?e.historyValue:void 0,history:!b||t.source?e:void 0,actions:b?C:[],activities:b?g:e?e.activities:{},meta:b?D:e?e.meta:void 0,events:[],configuration:P,transitions:t.transitions,children:T,done:A,tags:null===e||void 0===e?void 0:e.tags}),V=O!==E;I.changed=n.name===u.o||V;// Dispose of penultimate histories to prevent memory leaks
var L=I.history;if(L&&delete L.history,!b)return I;var M=I;if(!A)for((this._transient||p.some((function(t){return t._transient})))&&(M=this.resolveRaisedTransition(M,{type:u.i},n));N.length;){var R=N.shift();M=this.resolveRaisedTransition(M,R._event,n)}// Detect if state changed
var J=M.changed||(L?!!M.actions.length||V||typeof L.value!==typeof M.value||!Object(h.d)(M.value,L.value):void 0);return M.changed=J,// Preserve original history after raised events
M.history=L,M.tags=new Set(Object(a.b)(M.configuration.map((function(t){return t.tags})))),M},
/**
   * Returns the child state node from its relative `stateKey`, or throws.
   */
t.prototype.getStateNode=function(t){if(y(t))return this.machine.getStateNodeById(t);if(!this.states)throw new Error("Unable to retrieve child state '"+t+"' from '"+this.id+"'; no child states exist.");var e=this.states[t];if(!e)throw new Error("Child state '"+t+"' does not exist on '"+this.id+"'");return e},
/**
   * Returns the state node with the given `stateId`, or throws.
   *
   * @param stateId The state ID. The prefix "#" is removed.
   */
t.prototype.getStateNodeById=function(t){var e=y(t)?t.slice("#".length):t;if(e===this.id)return this;var n=this.machine.idMap[e];if(!n)throw new Error("Child state node '#"+e+"' does not exist on machine '"+this.id+"'");return n},
/**
   * Returns the relative state node from the given `statePath`, or throws.
   *
   * @param statePath The string or string array relative path to the state node.
   */
t.prototype.getStateNodeByPath=function(t){if("string"===typeof t&&y(t))try{return this.getStateNodeById(t.slice(1))}catch(i){// try individual paths
// throw e;
}for(var e=Object(a.D)(t,this.delimiter).slice(),n=this;e.length;){var r=e.shift();if(!r.length)break;n=n.getStateNode(r)}return n},
/**
   * Resolves a partial state value with its full representation in this machine.
   *
   * @param stateValue The partial state value to resolve.
   */
t.prototype.resolve=function(t){var e,n=this;if(!t)return this.initialStateValue||b;// TODO: type-specific properties
switch(this.type){case"parallel":return Object(a.o)(this.initialStateValue,(function(e,r){return e?n.getStateNode(r).resolve(t[r]||e):b}));case"compound":if(Object(a.k)(t)){var r=this.getStateNode(t);return"parallel"===r.type||"compound"===r.type?((e={})[t]=r.initialStateValue,e):t}return Object(a.l)(t).length?Object(a.o)(t,(function(t,e){return t?n.getStateNode(e).resolve(t):b})):this.initialStateValue||{};default:return t||b}},t.prototype.getResolvedPath=function(t){if(y(t)){var e=this.machine.idMap[t.slice("#".length)];if(!e)throw new Error("Unable to find state node '"+t+"'");return e.path}return Object(a.D)(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=Object(a.n)(this.states,(function(t){return t.initialStateValue||b}),(function(t){return!("history"===t.type)}));else if(void 0!==this.initial){if(!this.states[this.initial])throw new Error("Initial state '"+this.initial+"' not found on '"+this.key+"'");e=Object(c.g)(this.states[this.initial])?this.initial:((t={})[this.initial]=this.states[this.initial].initialStateValue,t)}else
// The finite state value of a machine without child states is just an empty object
e={};return this.__cache.initialStateValue=e,this.__cache.initialStateValue},enumerable:!1,configurable:!0}),t.prototype.getInitialState=function(t,e){var n=this.getStateNodes(t);return this.resolveTransition({configuration:n,entrySet:n,exitSet:[],transitions:[],source:void 0,actions:[]},void 0,void 0,e)},Object.defineProperty(t.prototype,"initialState",{
/**
     * The initial State instance, which includes all actions to be executed from
     * entering the initial state.
     */
get:function(){this._init();// TODO: this should be in the constructor (see note in constructor)
var t=this.initialStateValue;if(!t)throw new Error("Cannot retrieve initial state from simple state '"+this.id+"'.");return this.getInitialState(t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"target",{
/**
     * The target state value of the history state node, if it exists. This represents the
     * default state value to transition to if no history value exists yet.
     */
get:function(){var t;if("history"===this.type){var e=this.config;t=Object(a.k)(e.target)&&y(e.target)?Object(a.u)(this.machine.getStateNodeById(e.target).path.slice(this.path.length-1)):e.target}return t},enumerable:!1,configurable:!0}),
/**
   * Returns the leaf nodes from a state path relative to this state node.
   *
   * @param relativeStateId The relative state path to retrieve the state nodes
   * @param history The previous state to retrieve history
   * @param resolve Whether state nodes should resolve to initial child state nodes
   */
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(Object(c.g)(this))return[this];// Case when state node is compound but no initial state is defined
if("compound"===this.type&&!this.initial)return o.a||Object(a.K)(!1,"Compound state node '"+this.id+"' has no initial state."),[this];var e=Object(a.E)(this.initialStateValue);return Object(a.b)(e.map((function(e){return t.getFromRelativePath(e)})))},enumerable:!1,configurable:!0}),
/**
   * Retrieves state nodes from a relative path to this state node.
   *
   * @param relativePath The relative path from this state node
   * @param historyValue
   */
t.prototype.getFromRelativePath=function(t){if(!t.length)return[this];var e=Object(r.b)(t),n=e[0],i=e.slice(1);if(!this.states)throw new Error("Cannot retrieve subPath '"+n+"' from node with no states");var o=this.getStateNode(n);if("history"===o.type)return o.resolveHistory();if(!this.states[n])throw new Error("Child state '"+n+"' does not exist on '"+this.id+"'");return this.states[n].getFromRelativePath(i)},t.prototype.historyValue=function(t){if(Object(a.l)(this.states).length)return{current:t||this.initialStateValue,states:Object(a.n)(this.states,(function(e,n){if(!t)return e.historyValue();var r=Object(a.k)(t)?void 0:t[n];return e.historyValue(r||e.initialStateValue)}),(function(t){return!t.history}))}},
/**
   * Resolves to the historical value(s) of the parent state node,
   * represented by state nodes.
   *
   * @param historyValue
   */
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?Object(a.b)(Object(a.E)(r).map((function(t){return n.getFromRelativePath(t)}))):n.initialStateNodes}var i=Object(a.q)(n.path,"states")(t).current;return Object(a.k)(i)?[n.getStateNode(i)]:Object(a.b)(Object(a.E)(i).map((function(t){return"deep"===e.history?n.getFromRelativePath(t):[n.states[t[0]]]})))},Object.defineProperty(t.prototype,"stateIds",{
/**
     * All the state node IDs of this state node and its descendant state nodes.
     */
get:function(){var t=this,e=Object(a.b)(Object(a.l)(this.states).map((function(e){return t.states[e].stateIds})));return[this.id].concat(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"events",{
/**
     * All the event types accepted by this state node and its descendants.
     */
get:function(){var t,e,n,i;if(this.__cache.events)return this.__cache.events;var o=this.states,s=new Set(this.ownEvents);if(o)try{for(var c=Object(r.e)(Object(a.l)(o)),u=c.next();!u.done;u=c.next()){var f=o[u.value];if(f.states)try{for(var h=(n=void 0,Object(r.e)(f.events)),d=h.next();!d.done;d=h.next()){var l=d.value;s.add(""+l)}}catch(v){n={error:v}}finally{try{d&&!d.done&&(i=h.return)&&i.call(h)}finally{if(n)throw n.error}}}}catch(p){t={error:p}}finally{try{u&&!u.done&&(e=c.return)&&e.call(c)}finally{if(t)throw t.error}}return this.__cache.events=Array.from(s)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ownEvents",{
/**
     * All the events that have transitions directly from this state node.
     *
     * Excludes any inert events.
     */
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(!Object(a.k)(t))return t;var n=t[0]===e.delimiter;// If internal target is defined on machine,
// do not include machine key on target
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(i){throw new Error("Invalid transition definition for state node '"+e.id+"':\n"+i.message)}}))},t.prototype.formatTransition=function(t){var e=this,n=Object(a.r)(t.target),i="internal"in t?t.internal:!n||n.some((function(t){return Object(a.k)(t)&&t[0]===e.delimiter})),o=this.machine.options.guards,s=this.resolveTarget(n),c=Object(r.a)(Object(r.a)({},t),{actions:Object(f.n)(Object(a.x)(t.actions)),cond:Object(a.z)(t.cond,o),target:s,source:this,internal:i,eventType:t.event,toJSON:function(){return Object(r.a)(Object(r.a)({},c),{target:c.target?c.target.map((function(t){return"#"+t.id})):void 0,source:"#"+e.id})}});return c},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 s=this.config.on,c=p,u=s[c],h=void 0===u?[]:u,d=Object(r.c)(s,["*"]);n=Object(a.b)(Object(a.l)(d).map((function(t){o.a||""!==t||Object(a.K)(!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 \"#"+i.id+'".');var e=Object(a.G)(t,d[t]);return o.a||function(t,e,n){var r=n.slice(0,-1).some((function(t){return!("cond"in t)&&!("in"in t)&&(Object(a.k)(t.target)||Object(a.h)(t.target))})),i=""===e?"the transient event":"event '"+e+"'";Object(a.K)(!r,"One or more transitions for "+i+" on state '"+t.id+"' are unreachable. Make sure that the default transition is the last one defined.")}(i,t,e),e})).concat(Object(a.G)(p,h)))}else n=[];var l=this.config.always?Object(a.G)("",this.config.always):[],v=this.config.onDone?Object(a.G)(String(Object(f.c)(this.id)),this.config.onDone):[];o.a||Object(a.K)(!(this.config.onDone&&!this.parent),'Root nodes cannot have an ".onDone" transition. Please check the config of "'+this.id+'".');var b=Object(a.b)(this.invoke.map((function(t){var e=[];return t.onDone&&e.push.apply(e,Object(r.d)([],Object(r.b)(Object(a.G)(String(Object(f.d)(t.id)),t.onDone)))),t.onError&&e.push.apply(e,Object(r.d)([],Object(r.b)(Object(a.G)(String(Object(f.e)(t.id)),t.onError)))),e}))),y=this.after,O=Object(a.b)(Object(r.d)(Object(r.d)(Object(r.d)(Object(r.d)([],Object(r.b)(v)),Object(r.b)(b)),Object(r.b)(n)),Object(r.b)(l)).map((function(t){return Object(a.x)(t).map((function(t){return i.formatTransition(t)}))})));try{for(var j=Object(r.e)(y),g=j.next();!g.done;g=j.next()){var m=g.value;O.push(m)}}catch(w){t={error:w}}finally{try{g&&!g.done&&(e=j.return)&&e.call(j)}finally{if(t)throw t.error}}return O},t}();
// CONCATENATED MODULE: /Users/paulcowan/projects/cuttingedge/node_modules/xstate/es/Machine.js
function j(t,e,n){void 0===n&&(n=t.context);var r="function"===typeof n?n():n;return new O(t,e,r)}},
/***/wMhT:
/***/function(t,e,n){"use strict";
/* WEBPACK VAR INJECTION */(function(t){/* unused harmony export Interpreter */
/* unused harmony export InterpreterStatus */
/* harmony export (binding) */n.d(e,"a",(function(){return j}));
/* unused harmony export spawn */
/* harmony import */var r,i=n("WDwj"),o=n("AknM"),a=n("Hhoo"),s=n("C1IE"),c=n("CWip"),u=n("mq7k"),f=n("AsJ6"),h=n("C+hi"),d=n("NWYr"),l=n("zcQ/"),v=n("iJGL"),p=n("Du1H"),b=n("mwJI"),y={sync:!1,autoForward:!1};
/* harmony import */!function(t){t[t.NotStarted=0]="NotStarted",t[t.Running=1]="Running",t[t.Stopped=2]="Stopped"}(r||(r={}));var O=

/** @class */
function(){
/**
   * Creates a new Interpreter instance (i.e., service) for the given machine with the provided options, if any.
   *
   * @param machine The machine to be interpreted
   * @param options Interpreter options
   */
function e(t,n){var c=this;void 0===n&&(n=e.defaultOptions),this.machine=t,this.scheduler=new v.a,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,
/**
     * Whether the service is started.
     */
this.initialized=!1,this.status=r.NotStarted,this.children=new Map,this.forwardTo=new Set,
/**
     * Alias for Interpreter.prototype.start
     */
this.init=this.start,
/**
     * Sends an event to the running interpreter to trigger a transition.
     *
     * An array of events (batched) can be sent as well, which will send all
     * batched events to the running interpreter. The listeners will be
     * notified only **once** when all events are processed.
     *
     * @param event The event(s) to send
     */
this.send=function(t,e){if(Object(a.e)(t))return c.batch(t),c.state;var n=Object(a.C)(Object(a.y)(t,e));if(c.status===r.Stopped)
// do nothing
return o.a||Object(a.K)(!1,'Event "'+n.name+'" was sent to stopped service "'+c.machine.id+'". This service has already reached its final state, and will not transition.\nEvent: '+JSON.stringify(n.data)),c.state;if(c.status!==r.Running&&!c.options.deferEvents)throw new Error('Event "'+n.name+'" was sent to uninitialized service "'+c.machine.id+'". Make sure .start() is called for this service, or set { deferEvents: true } in the service options.\nEvent: '+JSON.stringify(n.data));return c.scheduler.schedule((function(){
// Forward copy of event to child actors
c.forward(n);var t=c.nextState(n);c.update(t,n)})),c._state;// TODO: deprecate (should return void)
// tslint:disable-next-line:semicolon
},this.sendTo=function(t,e){var n=c.parent&&(e===s.b.Parent||c.parent.id===e),r=n?c.parent:Object(a.k)(e)?c.children.get(e)||p.a.get(e):Object(a.d)(e)?e:void 0;if(r)"machine"in r?
// Send SCXML events to machines
r.send(Object(i.a)(Object(i.a)({},t),{name:t.name===u.d?""+Object(f.e)(c.id):t.name,origin:c.sessionId})):
// Send normal events to other targets
r.send(t.data);else{if(!n)throw new Error("Unable to send event to child '"+e+"' from service '"+c.id+"'.");// tslint:disable-next-line:no-console
o.a||Object(a.K)(!1,"Service '"+c.id+"' has no parent: unable to send event "+t.type)}};var h=Object(i.a)(Object(i.a)({},e.defaultOptions),n),d=h.clock,l=h.logger,b=h.parent,y=h.id,O=void 0!==y?y:t.id;this.id=O,this.logger=l,this.clock=d,this.parent=b,this.options=h,this.scheduler=new v.a({deferEvents:this.options.deferEvents}),this.sessionId=p.a.bookId()}return Object.defineProperty(e.prototype,"initialState",{get:function(){var t=this;return this._initialState?this._initialState:Object(d.b)(this,(function(){return t._initialState=t.machine.initialState,t._initialState}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"state",{get:function(){return o.a||Object(a.K)(this.status!==r.NotStarted,"Attempted to read state from uninitialized service '"+this.id+"'. Make sure the service is started first."),this._state},enumerable:!1,configurable:!0}),
/**
   * Executes the actions of the given state, with that state's `context` and `event`.
   *
   * @param state The state whose actions will be executed
   * @param actionsConfig The action implementations to use
   */
e.prototype.execute=function(t,e){var n,r;try{for(var o=Object(i.e)(t.actions),a=o.next();!a.done;a=o.next()){var s=a.value;this.exec(s,t,e)}}catch(c){n={error:c}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}},e.prototype.update=function(t,e){var n,r,o,s,u,h,d,l,v=this;// Execute listeners
if(// Attach session ID to state
t._sessionid=this.sessionId,// Update state
this._state=t,// Execute actions
this.options.execute&&this.execute(this.state),// Update children
this.children.forEach((function(t){v.state.children[t.id]=t})),// Dev tools
this.devTools&&this.devTools.send(e.data,t),t.event)try{for(var p=Object(i.e)(this.eventListeners),b=p.next();!b.done;b=p.next()){(0,b.value)(t.event)}}catch(E){n={error:E}}finally{try{b&&!b.done&&(r=p.return)&&r.call(p)}finally{if(n)throw n.error}}try{for(var y=Object(i.e)(this.listeners),O=y.next();!O.done;O=y.next()){(0,O.value)(t,t.event)}}catch(k){o={error:k}}finally{try{O&&!O.done&&(s=y.return)&&s.call(y)}finally{if(o)throw o.error}}try{for(var j=Object(i.e)(this.contextListeners),g=j.next();!g.done;g=j.next()){(0,g.value)(this.state.context,this.state.history?this.state.history.context:void 0)}}catch(N){u={error:N}}finally{try{g&&!g.done&&(h=j.return)&&h.call(j)}finally{if(u)throw u.error}}var m=Object(c.f)(t.configuration||[],this.machine);if(this.state.configuration&&m){
// get final child state node
var w=t.configuration.find((function(t){return"final"===t.type&&t.parent===v.machine})),x=w&&w.doneData?Object(a.m)(w.doneData,t.context,e):void 0;try{for(var S=Object(i.e)(this.doneListeners),_=S.next();!_.done;_=S.next()){(0,_.value)(Object(f.d)(this.id,x))}}catch(C){d={error:C}}finally{try{_&&!_.done&&(l=S.return)&&l.call(S)}finally{if(d)throw d.error}}this.stop()}},
/*
   * Adds a listener that is notified whenever a state transition happens. The listener is called with
   * the next state and the event object that caused the state transition.
   *
   * @param listener The state listener
   */
e.prototype.onTransition=function(t){return this.listeners.add(t),// Send current state to listener
this.status===r.Running&&t(this.state,this.state.event),this},e.prototype.subscribe=function(t,e,// TODO: error listener
n){var i,o=this;if(!t)return{unsubscribe:function(){}};var a=n;return"function"===typeof t?i=t:(i=t.next.bind(t),a=t.complete.bind(t)),this.listeners.add(i),// Send current state to listener
this.status===r.Running&&i(this.state),a&&this.onDone(a),{unsubscribe:function(){i&&o.listeners.delete(i),a&&o.doneListeners.delete(a)}}},
/**
   * Adds an event listener that is notified whenever an event is sent to the running interpreter.
   * @param listener The event listener
   */
e.prototype.onEvent=function(t){return this.eventListeners.add(t),this},
/**
   * Adds an event listener that is notified whenever a `send` event occurs.
   * @param listener The event listener
   */
e.prototype.onSend=function(t){return this.sendListeners.add(t),this},
/**
   * Adds a context listener that is notified whenever the state context changes.
   * @param listener The context listener
   */
e.prototype.onChange=function(t){return this.contextListeners.add(t),this},
/**
   * Adds a listener that is notified when the machine is stopped.
   * @param listener The listener
   */
e.prototype.onStop=function(t){return this.stopListeners.add(t),this},
/**
   * Adds a state listener that is notified when the statechart has reached its final state.
   * @param listener The state listener
   */
e.prototype.onDone=function(t){return this.doneListeners.add(t),this},
/**
   * Removes a listener.
   * @param listener The listener to remove
   */
e.prototype.off=function(t){return this.listeners.delete(t),this.eventListeners.delete(t),this.sendListeners.delete(t),this.stopListeners.delete(t),this.doneListeners.delete(t),this.contextListeners.delete(t),this},
/**
   * Starts the interpreter from the given state, or the initial state.
   * @param initialState The state to start the statechart from
   */
e.prototype.start=function(t){var e=this;if(this.status===r.Running)
// Do not restart the service if it is already started
return this;p.a.register(this.sessionId,this),this.initialized=!0,this.status=r.Running;var n=void 0===t?this.initialState:Object(d.b)(this,(function(){return Object(h.c)(t)?e.machine.resolveState(t):e.machine.resolveState(h.a.from(t,e.machine.context))}));return this.options.devTools&&this.attachDev(),this.scheduler.initialize((function(){e.update(n,f.g)})),this},
/**
   * Stops the interpreter and unsubscribe all listeners.
   *
   * This will also notify the `onStop` listeners.
   */
e.prototype.stop=function(){var t,e,n,o,s,c,u,f,h,d,l=this;try{for(var v=Object(i.e)(this.listeners),b=v.next();!b.done;b=v.next()){var y=b.value;this.listeners.delete(y)}}catch(k){t={error:k}}finally{try{b&&!b.done&&(e=v.return)&&e.call(v)}finally{if(t)throw t.error}}try{for(var O=Object(i.e)(this.stopListeners),j=O.next();!j.done;j=O.next()){// call listener, then remove
(y=j.value)(),this.stopListeners.delete(y)}}catch(N){n={error:N}}finally{try{j&&!j.done&&(o=O.return)&&o.call(O)}finally{if(n)throw n.error}}try{for(var g=Object(i.e)(this.contextListeners),m=g.next();!m.done;m=g.next()){y=m.value;this.contextListeners.delete(y)}}catch(C){s={error:C}}finally{try{m&&!m.done&&(c=g.return)&&c.call(g)}finally{if(s)throw s.error}}try{for(var w=Object(i.e)(this.doneListeners),x=w.next();!x.done;x=w.next()){y=x.value;this.doneListeners.delete(y)}}catch(T){u={error:T}}finally{try{x&&!x.done&&(f=w.return)&&f.call(w)}finally{if(u)throw u.error}}if(!this.initialized)
// Interpreter already stopped; do nothing
return this;this.state.configuration.forEach((function(t){var e,n;try{for(var r=Object(i.e)(t.definition.exit),o=r.next();!o.done;o=r.next()){var a=o.value;l.exec(a,l.state)}}catch(s){e={error:s}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(e)throw e.error}}})),// Stop all children
this.children.forEach((function(t){Object(a.g)(t.stop)&&t.stop()}));try{
// Cancel all delayed events
for(var S=Object(i.e)(Object(a.l)(this.delayedEventsMap)),_=S.next();!_.done;_=S.next()){var E=_.value;this.clock.clearTimeout(this.delayedEventsMap[E])}}catch(P){h={error:P}}finally{try{_&&!_.done&&(d=S.return)&&d.call(S)}finally{if(h)throw h.error}}return this.scheduler.clear(),this.initialized=!1,this.status=r.Stopped,p.a.free(this.sessionId),this},e.prototype.batch=function(t){var e=this;if(this.status===r.NotStarted&&this.options.deferEvents)
// tslint:disable-next-line:no-console
o.a||Object(a.K)(!1,t.length+' event(s) were sent to uninitialized service "'+this.machine.id+'" and are deferred. Make sure .start() is called for this service.\nEvent: '+JSON.stringify(event));else if(this.status!==r.Running)throw new Error(// tslint:disable-next-line:max-line-length
t.length+' event(s) were sent to uninitialized service "'+this.machine.id+'". Make sure .start() is called for this service, or set { deferEvents: true } in the service options.');this.scheduler.schedule((function(){var n,r,o=e.state,s=!1,c=[],u=function(t){var n=Object(a.C)(t);e.forward(n),o=Object(d.b)(e,(function(){return e.machine.transition(o,n)})),c.push.apply(c,Object(i.d)([],Object(i.b)(o.actions.map((function(t){return Object(h.b)(t,o)}))))),s=s||!!o.changed};try{for(var f=Object(i.e)(t),l=f.next();!l.done;l=f.next()){u(l.value)}}catch(v){n={error:v}}finally{try{l&&!l.done&&(r=f.return)&&r.call(f)}finally{if(n)throw n.error}}o.changed=s,o.actions=c,e.update(o,Object(a.C)(t[t.length-1]))}))},
/**
   * Returns a send function bound to this interpreter instance.
   *
   * @param event The event to be sent by the sender.
   */
e.prototype.sender=function(t){return this.send.bind(this,t)},
/**
   * Returns the next state given the interpreter's current state and the event.
   *
   * This is a pure method that does _not_ update the interpreter's state.
   *
   * @param event The event to determine the next state
   */
e.prototype.nextState=function(t){var e=this,n=Object(a.C)(t);if(0===n.name.indexOf(u.e)&&!this.state.nextEvents.some((function(t){return 0===t.indexOf(u.e)})))throw n.data.data;return Object(d.b)(this,(function(){return e.machine.transition(e.state,n)}))},e.prototype.forward=function(t){var e,n;try{for(var r=Object(i.e)(this.forwardTo),o=r.next();!o.done;o=r.next()){var a=o.value,s=this.children.get(a);if(!s)throw new Error("Unable to forward event '"+t+"' from interpreter '"+this.id+"' to nonexistant child '"+a+"'.");s.send(t)}}catch(c){e={error:c}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(e)throw e.error}}},e.prototype.defer=function(t){var e=this;this.delayedEventsMap[t.id]=this.clock.setTimeout((function(){t.to?e.sendTo(t._event,t.to):e.send(t._event)}),t.delay)},e.prototype.cancel=function(t){this.clock.clearTimeout(this.delayedEventsMap[t]),delete this.delayedEventsMap[t]},e.prototype.exec=function(t,e,n){void 0===n&&(n=this.machine.options.actions);var r=e.context,i=e._event,c=t.exec||Object(f.f)(t.type,n),h=Object(a.g)(c)?c:c?c.exec:t.exec;if(h)try{return h(r,i.data,{action:t,state:this.state,_event:i})}catch(x){throw this.parent&&this.parent.send({type:"xstate.error",data:x}),x}switch(t.type){case u.l:var d=t;if("number"===typeof d.delay)return void this.defer(d);d.to?this.sendTo(d._event,d.to):this.send(d._event);break;case u.b:this.cancel(t.sendId);break;case u.m:var l=t.activity;// If the activity will be stopped right after it's started
// (such as in transient states)
// don't bother starting the activity.
if(!this.state.activities[l.id||l.type])break;// Invoked services
if(l.type===s.a.Invoke){var v=Object(a.A)(l.src),p=this.machine.options.services?this.machine.options.services[v.type]:void 0,b=l.id,y=l.data;o.a||Object(a.K)(!("forward"in l),// tslint:disable-next-line:max-line-length
"`forward` property is deprecated (found in invocation of '"+l.src+"' in in machine '"+this.machine.id+"'). Please use `autoForward` instead.");var O="autoForward"in l?l.autoForward:!!l.forward;if(!p)
// tslint:disable-next-line:no-console
return void(o.a||Object(a.K)(!1,"No service found for invocation '"+l.src+"' in machine '"+this.machine.id+"'."));var j=y?Object(a.m)(y,r,i):void 0,g=Object(a.g)(p)?p(r,i.data,{data:j,src:v}):p;Object(a.j)(g)?this.spawnPromise(Promise.resolve(g),b):Object(a.g)(g)?this.spawnCallback(g,b):Object(a.i)(g)?this.spawnObservable(g,b):Object(a.h)(g)&&
// TODO: try/catch here
this.spawnMachine(j?g.withContext(j):g,{id:b,autoForward:O})}else this.spawnActivity(l);break;case u.n:this.stopChild(t.activity.id);break;case u.h:var m=t.label,w=t.value;m?this.logger(m,w):this.logger(w);break;default:o.a||Object(a.K)(!1,"No implementation found for action type '"+t.type+"'")}},e.prototype.removeChild=function(t){this.children.delete(t),this.forwardTo.delete(t),delete this.state.children[t]},e.prototype.stopChild=function(t){var e=this.children.get(t);e&&(this.removeChild(t),Object(a.g)(e.stop)&&e.stop())},e.prototype.spawn=function(t,e,n){if(Object(a.j)(t))return this.spawnPromise(Promise.resolve(t),e);if(Object(a.g)(t))return this.spawnCallback(t,e);if(Object(l.c)(t))return this.spawnActor(t);if(Object(a.i)(t))return this.spawnObservable(t,e);if(Object(a.h)(t))return this.spawnMachine(t,Object(i.a)(Object(i.a)({},n),{id:e}));throw new Error('Unable to spawn entity "'+e+'" of type "'+typeof t+'".')},e.prototype.spawnMachine=function(t,n){var r=this;void 0===n&&(n={});var o=new e(t,Object(i.a)(Object(i.a)({},this.options),{parent:this,id:n.id||t.id})),s=Object(i.a)(Object(i.a)({},y),n);s.sync&&o.onTransition((function(t){r.send(u.o,{state:t,id:o.id})}));var c=o;return this.children.set(o.id,c),s.autoForward&&this.forwardTo.add(o.id),o.onDone((function(t){r.removeChild(o.id),r.send(Object(a.C)(t,{origin:o.id}))})).start(),c},e.prototype.spawnPromise=function(t,e){var n=this,r=!1,i=void 0;t.then((function(t){r||(i=t,n.removeChild(e),n.send(Object(a.C)(Object(f.d)(e,t),{origin:e})))}),(function(t){if(!r){n.removeChild(e);var i=Object(f.e)(e,t);try{
// Send "error.platform.id" to this (parent).
n.send(Object(a.C)(i,{origin:e}))}catch(o){Object(a.v)(t,o,e),n.devTools&&n.devTools.send(i,n.state),n.machine.strict&&
// it would be better to always stop the state machine if unhandled
// exception/promise rejection happens but because we don't want to
// break existing code so enforce it on strict mode only especially so
// because documentation says that onError is optional
n.stop()}}}));var o={id:e,send:function(){},subscribe:function(e,n,r){var i=Object(a.B)(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(){r=!0},toJSON:function(){return{id:e}},getSnapshot:function(){return i}};return this.children.set(e,o),o},e.prototype.spawnCallback=function(t,e){var n,r=this,i=!1,o=new Set,s=new Set,c=void 0;try{n=t((function(t){c=t,s.forEach((function(e){return e(t)})),i||r.send(Object(a.C)(t,{origin:e}))}),(function(t){o.add(t)}))}catch(h){this.send(Object(f.e)(e,h))}if(Object(a.j)(n))
// it turned out to be an async function, can't reliably check this before calling `callback`
// because transpiled async functions are not recognizable
return this.spawnPromise(n,e);var u={id:e,send:function(t){return o.forEach((function(e){return e(t)}))},subscribe:function(t){return s.add(t),{unsubscribe:function(){s.delete(t)}}},stop:function(){i=!0,Object(a.g)(n)&&n()},toJSON:function(){return{id:e}},getSnapshot:function(){return c}};return this.children.set(e,u),u},e.prototype.spawnObservable=function(t,e){var n=this,r=void 0,i=t.subscribe((function(t){r=t,n.send(Object(a.C)(t,{origin:e}))}),(function(t){n.removeChild(e),n.send(Object(a.C)(Object(f.e)(e,t),{origin:e}))}),(function(){n.removeChild(e),n.send(Object(a.C)(Object(f.d)(e),{origin:e}))})),o={id:e,send:function(){},subscribe:function(e,n,r){return t.subscribe(e,n,r)},stop:function(){return i.unsubscribe()},getSnapshot:function(){return r},toJSON:function(){return{id:e}}};return this.children.set(e,o),o},e.prototype.spawnActor=function(t){return this.children.set(t.id,t),t},e.prototype.spawnActivity=function(t){var e=this.machine.options&&this.machine.options.activities?this.machine.options.activities[t.type]:void 0;if(e){// Start implementation
var n=e(this.state.context,t);this.spawnEffect(t.id,n)}else o.a||Object(a.K)(!1,"No implementation found for activity '"+t.type+"'");// tslint:disable-next-line:no-console
},e.prototype.spawnEffect=function(t,e){this.children.set(t,{id:t,send:function(){},subscribe:function(){return{unsubscribe:function(){}}},stop:e||void 0,getSnapshot:function(){},toJSON:function(){return{id:t}}})},e.prototype.attachDev=function(){var t=Object(b.a)();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(Object(i.a)(Object(i.a)({name:this.id,autoPause:!0,stateSanitizer:function(t){return{value:t.value,context:t.context,actions:t.actions}}},e),{features:Object(i.a)({jump:!1,skip:!1},e?e.features:void 0)}),this.machine),this.devTools.init(this.state)}// add XState-specific dev tooling hook
Object(b.b)(this)}},e.prototype.toJSON=function(){return{id:this.id}},e.prototype[a.w]=function(){return this},e.prototype.getSnapshot=function(){return this._state},
/**
   * The default interpreter options:
   *
   * - `clock` uses the global `setTimeout` and `clearTimeout` functions
   * - `logger` uses the global `console.log()` method
   */
e.defaultOptions=function(t){return{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:t.console.log.bind(console),devTools:!1}}("undefined"!==typeof self?self:t),e.interpret=j,e}();
/**
 * Creates a new Interpreter instance for the given machine with the provided options, if any.
 *
 * @param machine The machine to interpret
 * @param options Interpreter options
 */
function j(t,e){return new O(t,e)}
/* WEBPACK VAR INJECTION */}).call(this,n("fRV1"))
/***/},
/***/"zcQ/":
/***/function(t,e,n){"use strict";
/* harmony export (binding) */n.d(e,"a",(function(){return s})),
/* harmony export (binding) */n.d(e,"b",(function(){return a})),
/* unused harmony export createNullActor */
/* unused harmony export isActor */
/* harmony export (binding) */n.d(e,"c",(function(){return c}));
/* harmony import */var r=n("Hhoo"),i=n("NWYr");
/* harmony import */function o(t){return{id:t,send:function(){},subscribe:function(){return{unsubscribe:function(){}}},getSnapshot:function(){},toJSON:function(){return{id:t}}}}
/**
 * Creates a deferred actor that is able to be invoked given the provided
 * invocation information in its `.meta` value.
 *
 * @param invokeDefinition The meta information needed to invoke the actor.
 */function a(t,e,n,i){var a,c=Object(r.A)(t.src),u=null===(a=null===e||void 0===e?void 0:e.options.services)||void 0===a?void 0:a[c.type],f=t.data?Object(r.m)(t.data,n,i):void 0,h=u?s(u,t.id,f):o(t.id);// @ts-ignore
return h.meta=t,h}function s(t,e,n){var a=o(e);// @ts-ignore
return a.deferred=!0,Object(r.h)(t)&&(
// "mute" the existing service scope so potential spawned actors within the `.initialState` stay deferred here
// @ts-ignore
a.state=Object(i.b)(void 0,(function(){return(n?t.withContext(n):t).initialState}))),a}function c(t){return function(t){try{return"function"===typeof t.send}catch(e){return!1}}(t)&&"id"in t}
/***/}}]);
//# sourceMappingURL=7c2fe9ca71d2d4c839914525b72b580d6be96835-1f11f6f3.870fcf5f.chunk.js.map