label-studio
Version:
Data Labeling Tool that is backend agnostic and can be embedded into your applications
2 lines • 1.9 MB
JavaScript
/*! For license information please see main.e963e015.js.LICENSE.txt */
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=311)}([function(e,t,n){"use strict";e.exports=n(312)},function(e,t,n){"use strict";(function(e,r){n.d(t,"a",(function(){return b})),n.d(t,"b",(function(){return k})),n.d(t,"c",(function(){return C})),n.d(t,"d",(function(){return j})),n.d(t,"e",(function(){return O})),n.d(t,"f",(function(){return x})),n.d(t,"g",(function(){return E})),n.d(t,"h",(function(){return w})),n.d(t,"i",(function(){return m})),n.d(t,"j",(function(){return _})),n.d(t,"k",(function(){return y})),n.d(t,"l",(function(){return v})),n.d(t,"m",(function(){return S})),n.d(t,"n",(function(){return Ut}));var o,i=n(9),a="warn";function s(){return a}!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(o||(o={}));var l=function(e,t){return(l=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function c(e,t){function n(){this.constructor=e}l(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var u=function(){return(u=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function f(e,t,n,r){var o,i=arguments.length,a=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}function d(e){var t="function"===typeof Symbol&&e[Symbol.iterator],n=0;return t?t.call(e):{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}function p(e,t){var n="function"===typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(s){o={error:s}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a}function h(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(p(arguments[t]));return e}function m(e){return ce(e,1),ue(e).type}function y(e,t){return ce(e,1),Ie(t,2),ue(e).onPatch(t)}function v(e,t){return ce(e,1),Ie(t,2),ue(e).onSnapshot(t)}function g(e,t){ce(e,1),De(t,(function(e){return"object"===typeof e}),"object or array",2),ue(e).applyPatches(Ee(t))}function b(e,t){return ce(e,1),ue(e).applySnapshot(t)}function w(e,t){void 0===t&&(t=!0),ce(e,1);var n=ue(e);return t?n.snapshot:ke(n.type.getSnapshot(n,!1))}function O(e,t){void 0===t&&(t=1),ce(e,1),Fe(t,2,0);for(var n=t,r=ue(e).parent;r;){if(0===--n)return r.storedValue;r=r.parent}throw be("Failed to find the parent of "+ue(e)+" at depth "+t)}function x(e,t){ce(e,1),V(t,2);for(var n=ue(e).parent;n;){if(t.is(n.storedValue))return n.storedValue;n=n.parent}throw be("Failed to find the parent of "+ue(e)+" of a given type")}function E(e){return ce(e,1),ue(e).root.storedValue}function S(e,t){ce(e,1),Le(t,2);var n=pe(ue(e),t);return n?n.value:void 0}function _(e,t){void 0===t&&(t=!0);try{var n=e();if(void 0===n||null===n)return!1;if(le(n))return!t||P(n);throw be("The reference to be checked is not one of node, null or undefined")}catch(r){if(r instanceof jt)return!1;throw r}}function C(e){return ce(e,1),ue(e).detach(),e}function k(e){ce(e,1);var t=ue(e);t.isRoot?t.die():t.parent.removeChild(t.subpath)}function P(e){return ce(e,1),ue(e).observableIsAlive}function j(e){ce(e,1);var t=ue(e).root.environment;return t||ve}var T,N=function(){function e(e,t,n,r){this.type=e,this.environment=r,this._state=ne.INITIALIZING,this.environment=r,this.baseSetParent(t,n)}return Object.defineProperty(e.prototype,"subpath",{get:function(){return this._subpath},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"subpathUponDeath",{get:function(){return this._subpathUponDeath},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"pathUponDeath",{get:function(){return this._pathUponDeath},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"value",{get:function(){return this.type.getValue(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"state",{get:function(){return this._state},set:function(e){var t=this.isAlive;this._state=e;var n=this.isAlive;this.aliveAtom&&t!==n&&this.aliveAtom.reportChanged()},enumerable:!0,configurable:!0}),e.prototype.fireInternalHook=function(e){this._hookSubscribers&&this._hookSubscribers.emit(e,this,e)},e.prototype.registerHook=function(e,t){return this._hookSubscribers||(this._hookSubscribers=new Te),this._hookSubscribers.register(e,t)},Object.defineProperty(e.prototype,"parent",{get:function(){return this._parent},enumerable:!0,configurable:!0}),e.prototype.baseSetParent=function(e,t){this._parent=e,this._subpath=t,this._escapedSubpath=void 0,this.pathAtom&&this.pathAtom.reportChanged()},Object.defineProperty(e.prototype,"path",{get:function(){return this.getEscapedPath(!0)},enumerable:!0,configurable:!0}),e.prototype.getEscapedPath=function(e){return e&&(this.pathAtom||(this.pathAtom=Object(i.k)("path")),this.pathAtom.reportObserved()),this.parent?(void 0===this._escapedSubpath&&(this._escapedSubpath=this._subpath?Be(this._subpath):""),this.parent.getEscapedPath(e)+"/"+this._escapedSubpath):""},Object.defineProperty(e.prototype,"isRoot",{get:function(){return null===this.parent},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isAlive",{get:function(){return this.state!==ne.DEAD},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isDetaching",{get:function(){return this.state===ne.DETACHING},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"observableIsAlive",{get:function(){return this.aliveAtom||(this.aliveAtom=Object(i.k)("alive")),this.aliveAtom.reportObserved(),this.isAlive},enumerable:!0,configurable:!0}),e.prototype.baseFinalizeCreation=function(e){if(this.state===ne.CREATED){if(this.parent){if(this.parent.state!==ne.FINALIZED)return;this.fireHook(o.afterAttach)}this.state=ne.FINALIZED,e&&e()}},e.prototype.baseFinalizeDeath=function(){this._hookSubscribers&&this._hookSubscribers.clearAll(),this._subpathUponDeath=this._subpath,this._pathUponDeath=this.getEscapedPath(!1),this.baseSetParent(null,""),this.state=ne.DEAD},e.prototype.baseAboutToDie=function(){this.fireHook(o.beforeDestroy)},e}(),M=function(e){function t(t,n,r,o,i){var a=e.call(this,t,n,r,o)||this;try{a.storedValue=t.createNewInstance(i)}catch(s){throw a.state=ne.DEAD,s}return a.state=ne.CREATED,a.finalizeCreation(),a}return c(t,e),Object.defineProperty(t.prototype,"root",{get:function(){if(!this.parent)throw be("This scalar node is not part of a tree");return this.parent.root},enumerable:!0,configurable:!0}),t.prototype.setParent=function(e,t){var n=this.parent!==e,r=this.subpath!==t;(n||r)&&(this.environment=void 0,this.baseSetParent(this.parent,t))},Object.defineProperty(t.prototype,"snapshot",{get:function(){return ke(this.getSnapshot())},enumerable:!0,configurable:!0}),t.prototype.getSnapshot=function(){return this.type.getSnapshot(this)},t.prototype.toString=function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"<root>";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")},t.prototype.die=function(){this.isAlive&&this.state!==ne.DETACHING&&(this.aboutToDie(),this.finalizeDeath())},t.prototype.finalizeCreation=function(){this.baseFinalizeCreation()},t.prototype.aboutToDie=function(){this.baseAboutToDie()},t.prototype.finalizeDeath=function(){this.baseFinalizeDeath()},t.prototype.fireHook=function(e){this.fireInternalHook(e)},f([i.h],t.prototype,"die",null),t}(N),A=1,R={onError:function(e){throw e}},D=function(e){function t(t,n,r,o,i){var a=e.call(this,t,n,r,o)||this;if(a.nodeId=++A,a.isProtectionEnabled=!0,a._autoUnbox=!0,a._isRunningAction=!1,a._hasSnapshotReaction=!1,a._observableInstanceState=0,a._cachedInitialSnapshotCreated=!1,a.unbox=a.unbox.bind(a),a._initialSnapshot=ke(i),a.identifierAttribute=t.identifierAttribute,n||(a.identifierCache=new oe),a._childNodes=t.initializeChildNodes(a,a._initialSnapshot),a.identifier=null,a.unnormalizedIdentifier=null,a.identifierAttribute&&a._initialSnapshot){var s=a._initialSnapshot[a.identifierAttribute];if(void 0===s){var l=a._childNodes[a.identifierAttribute];l&&(s=l.value)}if("string"!==typeof s&&"number"!==typeof s)throw be("Instance identifier '"+a.identifierAttribute+"' for type '"+a.type.name+"' must be a string or a number");a.identifier=zt(s),a.unnormalizedIdentifier=s}return n?n.root.identifierCache.addNodeToCache(a):a.identifierCache.addNodeToCache(a),a}return c(t,e),t.prototype.applyPatches=function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)},t.prototype.applySnapshot=function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)},t.prototype.createObservableInstanceIfNeeded=function(){0===this._observableInstanceState&&this.createObservableInstance()},t.prototype.createObservableInstance=function(){var e,t;this._observableInstanceState=1;for(var n=[],r=this.parent;r&&0===r._observableInstanceState;)n.unshift(r),r=r.parent;try{for(var a=d(n),s=a.next();!s.done;s=a.next()){s.value.createObservableInstanceIfNeeded()}}catch(f){e={error:f}}finally{try{s&&!s.done&&(t=a.return)&&t.call(a)}finally{if(e)throw e.error}}var l,c,u=this.type;try{this.storedValue=u.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,u.finalizeNewInstance(this,this.storedValue)}catch(p){throw this.state=ne.DEAD,p}finally{this._isRunningAction=!1}this._observableInstanceState=2,l=this,c="snapshot",Object(i.m)(l,c).trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ve,this.state=ne.CREATED,this.fireHook(o.afterCreate),this.finalizeCreation()},Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!0,configurable:!0}),t.prototype.clearParent=function(){if(this.parent){this.fireHook(o.beforeDetach);var e=this.state;this.state=ne.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}},t.prototype.setParent=function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(o.afterAttach)):r&&this.baseSetParent(this.parent,t))},t.prototype.fireHook=function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"===typeof this.storedValue&&this.storedValue[e];"function"===typeof n&&(i.e?Object(i.e)((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))},Object.defineProperty(t.prototype,"snapshot",{get:function(){return ke(this.getSnapshot())},enumerable:!0,configurable:!0}),t.prototype.getSnapshot=function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath},t.prototype._getActualSnapshot=function(){return this.type.getSnapshot(this)},t.prototype._getCachedInitialSnapshot=function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot},t.prototype.isRunningAction=function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()},t.prototype.assertAlive=function(e){var t=s();if(!this.isAlive&&"ignore"!==t){var n=this._getAssertAliveError(e);switch(t){case"error":throw be(n);case"warn":Re(n)}}},t.prototype._getAssertAliveError=function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&Be(e.subpath)||"",r=e.actionContext||H();r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var o,i="";r&&null!=r.name&&(i=(r&&r.context&&(ce(o=r.context,1),ue(o).path)||t)+"."+r.name+"()");return"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+i+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."},t.prototype.getChildNode=function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}},t.prototype.getChildren=function(){this.assertAlive(ve),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):me(this._childNodes)}finally{this._autoUnbox=!0}},t.prototype.getChildType=function(e){return this.type.getChildType(e)},Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!0,configurable:!0}),t.prototype.assertWritable=function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw be("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")},t.prototype.removeChild=function(e){this.type.removeChild(this,e)},t.prototype.unbox=function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e},t.prototype.toString=function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"<root>",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")},t.prototype.finalizeCreation=function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=d(e.getChildren()),i=r.next();!i.done;i=r.next()){i.value.finalizeCreation()}}catch(a){t={error:a}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(o.afterCreationFinalization)}))},t.prototype.detach=function(){if(!this.isAlive)throw be("Error while detaching, node is not alive.");this.clearParent()},t.prototype.preboot=function(){var e=this;this._applyPatches=Y(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){var n=We(t.path);he(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}))})),this._applySnapshot=Y(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),Pe(this.storedValue,"$treenode",this),Pe(this.storedValue,"toJSON",de)},t.prototype.die=function(){this.isAlive&&this.state!==ne.DETACHING&&(this.aboutToDie(),this.finalizeDeath())},t.prototype.aboutToDie=function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))},t.prototype.finalizeDeath=function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()},t.prototype.onSnapshot=function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)},t.prototype.emitSnapshot=function(e){this._internalEventsEmit("snapshot",e)},t.prototype.onPatch=function(e){return this._internalEventsRegister("patch",e)},t.prototype.emitPatch=function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=p(function(e){if(!("oldValue"in e))throw be("Patches without `oldValue` field cannot be inversed");return[ze(e),Ve(e)]}(function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];for(var r=0;r<t.length;r++){var o=t[r];for(var i in o)e[i]=o[i]}return e}({},e,{path:t.path.substr(this.path.length)+"/"+e.path})),2),r=n[0],o=n[1];this._internalEventsEmit("patch",r,o)}this.parent&&this.parent.emitPatch(e,t)},t.prototype.hasDisposer=function(e){return this._internalEventsHas("dispose",e)},t.prototype.addDisposer=function(e){if(this.hasDisposer(e))throw be("cannot add a disposer when it is already registered for execution");this._internalEventsRegister("dispose",e,!0)},t.prototype.removeDisposer=function(e){if(!this._internalEventsHas("dispose",e))throw be("cannot remove a disposer which was never registered for execution");this._internalEventsUnregister("dispose",e)},t.prototype.removeMiddleware=function(e){if(this.middlewares){var t=this.middlewares.indexOf(e);t>=0&&this.middlewares.splice(t,1)}},t.prototype.addMiddleWare=function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}},t.prototype.applyPatchLocally=function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)},t.prototype._addSnapshotReaction=function(){var e=this;if(!this._hasSnapshotReaction){var t=Object(i.w)((function(){return e.snapshot}),(function(t){return e.emitSnapshot(t)}),R);this.addDisposer(t),this._hasSnapshotReaction=!0}},t.prototype._internalEventsHasSubscribers=function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)},t.prototype._internalEventsRegister=function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new Te),this._internalEvents.register(e,t,n)},t.prototype._internalEventsHas=function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)},t.prototype._internalEventsUnregister=function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)},t.prototype._internalEventsEmit=function(e){for(var t,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];this._internalEvents&&(t=this._internalEvents).emit.apply(t,h([e],n))},t.prototype._internalEventsClear=function(e){this._internalEvents&&this._internalEvents.clear(e)},t.prototype._internalEventsClearAll=function(){this._internalEvents&&this._internalEvents.clearAll()},f([i.h],t.prototype,"createObservableInstance",null),f([i.i],t.prototype,"snapshot",null),f([i.h],t.prototype,"detach",null),f([i.h],t.prototype,"die",null),t}(N);!function(e){e[e.String=1]="String",e[e.Number=2]="Number",e[e.Boolean=4]="Boolean",e[e.Date=8]="Date",e[e.Literal=16]="Literal",e[e.Array=32]="Array",e[e.Map=64]="Map",e[e.Object=128]="Object",e[e.Frozen=256]="Frozen",e[e.Optional=512]="Optional",e[e.Reference=1024]="Reference",e[e.Identifier=2048]="Identifier",e[e.Late=4096]="Late",e[e.Refinement=8192]="Refinement",e[e.Union=16384]="Union",e[e.Null=32768]="Null",e[e.Undefined=65536]="Undefined",e[e.Integer=131072]="Integer",e[e.Custom=262144]="Custom",e[e.SnapshotProcessor=524288]="SnapshotProcessor"}(T||(T={}));var I=function(){function e(e){this.isType=!0,this.name=e}return e.prototype.create=function(e,t){return te(this,e),this.instantiate(null,"",t,e).value},e.prototype.getSnapshot=function(e,t){throw be("unimplemented method")},e.prototype.isAssignableFrom=function(e){return e===this},e.prototype.validate=function(e,t){if(fe(e)){var n=m(e);return this.isAssignableFrom(n)?J():Z(t,e)}return this.isValidSnapshot(e,t)},e.prototype.is=function(e){return 0===this.validate(e,[{path:"",type:this}]).length},Object.defineProperty(e.prototype,"Type",{get:function(){throw be("Factory.Type should not be actually called. It is just a Type signature that can be used at compile time with Typescript, by using `typeof type.Type`")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"TypeWithoutSTN",{get:function(){throw be("Factory.TypeWithoutSTN should not be actually called. It is just a Type signature that can be used at compile time with Typescript, by using `typeof type.TypeWithoutSTN`")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"SnapshotType",{get:function(){throw be("Factory.SnapshotType should not be actually called. It is just a Type signature that can be used at compile time with Typescript, by using `typeof type.SnapshotType`")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"CreationType",{get:function(){throw be("Factory.CreationType should not be actually called. It is just a Type signature that can be used at compile time with Typescript, by using `typeof type.CreationType`")},enumerable:!0,configurable:!0}),f([i.h],e.prototype,"create",null),e}(),F=function(e){function t(t){return e.call(this,t)||this}return c(t,e),t.prototype.create=function(t,n){return void 0===t&&(t=this.getDefaultSnapshot()),e.prototype.create.call(this,t,n)},t.prototype.getValue=function(e){return e.createObservableInstanceIfNeeded(),e.storedValue},t.prototype.tryToReconcileNode=function(e,t){return!e.isDetaching&&(e.snapshot===t||(!(!le(t)||ue(t)!==e)||!(e.type!==this||!_e(t)||le(t)||e.identifierAttribute&&e.identifier!==zt(t[e.identifierAttribute]))&&(e.applySnapshot(t),!0)))},t.prototype.reconcile=function(e,t,n,r){if(this.tryToReconcileNode(e,t))return e.setParent(n,r),e;if(e.die(),le(t)&&this.isAssignableFrom(m(t))){var o=ue(t);return o.setParent(n,r),o}return this.instantiate(n,r,void 0,t)},t.prototype.getSubTypes=function(){return null},f([i.h],t.prototype,"create",null),t}(I),L=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return c(t,e),t.prototype.createNewInstance=function(e){return e},t.prototype.getValue=function(e){return e.storedValue},t.prototype.getSnapshot=function(e){return e.storedValue},t.prototype.reconcile=function(e,t,n,r){if(!e.isDetaching&&e.type===this&&e.storedValue===t)return e;var o=this.instantiate(n,r,void 0,t);return e.die(),o},t.prototype.getSubTypes=function(){return null},t}(I);function z(e){return"object"===typeof e&&e&&!0===e.isType}function V(e,t){De(e,z,"mobx-state-tree type",t)}new Map;!function(){function e(e,t){this.hooks=e,this.call=t,this.flowsPending=0,this.running=!0,e&&e.onStart(t)}e.prototype.finish=function(e){this.running&&(this.running=!1,this.hooks&&this.hooks.onFinish(this.call,e))},e.prototype.incFlowsPending=function(){this.flowsPending++},e.prototype.decFlowsPending=function(){this.flowsPending--},Object.defineProperty(e.prototype,"hasFlowsPending",{get:function(){return this.flowsPending>0},enumerable:!0,configurable:!0})}();var B,U=1;function H(){return B}function W(){return U++}function K(e,t){var n=ue(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var a=B;B=e;try{return function(e,t,n){var r=new q(e,n);if(r.isEmpty)return Object(i.h)(n).apply(null,t.args);var a=null;return function e(t){var s=r.getNextMiddleware(),l=s&&s.handler;return l?!s.includeHooks&&o[t.name]?e(t):(l(t,(function(t,n){!0,a=e(t),n&&(a=n(a))}),(function(e){!0,a=e})),a):Object(i.h)(n).apply(null,t.args)}(t)}(n,e,t)}finally{B=a,n._isRunningAction=r}}function G(e){if(e)return"action"===e.type?e:e.parentActionEvent}function Y(e,t,n){var r=function(){var r=W(),o=B,i=G(o);return K({type:"action",name:t,id:r,args:Ne(arguments),context:e,tree:E(e),rootId:o?o.rootId:r,parentId:o?o.id:0,allParentIds:o?h(o.allParentIds,[o.id]):[],parentEvent:o,parentActionEvent:i},n)};return r._isMSTAction=!0,r}var q=function(){function e(e,t){this.arrayIndex=0,this.inArrayIndex=0,this.middlewares=[],t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!0,configurable:!0}),e.prototype.getNextMiddleware=function(){var e=this.middlewares[this.arrayIndex];if(e){var t=e[this.inArrayIndex++];return t||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}},e}();function X(e){return"function"===typeof e?"<function"+(e.name?" "+e.name:"")+">":le(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(t){return"<Unserializable: "+t+">"}}(e)+"`"}function $(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),o=r.length>0?'at path "/'+r+'" ':"",i=le(t)?"value of type "+ue(t).type.name+":":Ce(t)?"value":"snapshot",a=n&&le(t)&&n.is(ue(t).snapshot);return""+o+i+" "+X(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?function(e){return z(e)&&(e.flags&(T.String|T.Number|T.Integer|T.Boolean|T.Date))>0}(n)||Ce(t)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Q(e,t,n){return e.concat([{path:t,type:n}])}function J(){return ye}function Z(e,t,n){return[{context:e,value:t,message:n}]}function ee(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function te(t,n){"undefined"!==typeof e&&Object({NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0})&&"true"===Object({NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0}).ENABLE_TYPE_CHECK&&function(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw be(function(e,t,n){if(0===n.length)return;return"Error while converting "+(r=X(t),(r.length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map($).join("\n ");var r}(e,t,n))}(t,n)}var ne,re=0,oe=function(){function e(){this.cacheId=re++,this.cache=i.u.map(),this.lastCacheModificationPerId=i.u.map()}return e.prototype.updateLastCacheModificationPerId=function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)},e.prototype.getLastCacheModificationPerId=function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t},e.prototype.addNodeToCache=function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,i.u.array([],ge));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw be("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}},e.prototype.mergeCache=function(e){var t=this;Object(i.B)(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))},e.prototype.notifyDied=function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}},e.prototype.splitCache=function(t){var n=this,r=new e,o=t.path;return Object(i.l)(this.cache).forEach((function(e){for(var t=p(e,2),i=t[0],a=t[1],s=!1,l=a.length-1;l>=0;l--)0===a[l].path.indexOf(o)&&(r.addNodeToCache(a[l],!1),a.splice(l,1),s=!0);s&&n.updateLastCacheModificationPerId(i)})),r},e.prototype.has=function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))},e.prototype.resolve=function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw be("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}},e}();function ie(e,t,n,r,o){var i=fe(o);if(i){if(i.parent)throw be("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+i.path+"'");return t&&i.setParent(t,n),i}return new D(e,t,n,r,o)}function ae(e,t,n,r,o){return new M(e,t,n,r,o)}function se(e){return e instanceof M||e instanceof D}function le(e){return!(!e||!e.$treenode)}function ce(e,t){De(e,le,"mobx-state-tree node",t)}function ue(e){if(!le(e))throw be("Value "+e+" is no MST Node");return e.$treenode}function fe(e){return e&&e.$treenode||null}function de(){return ue(this).snapshot}!function(e){e[e.INITIALIZING=0]="INITIALIZING",e[e.CREATED=1]="CREATED",e[e.FINALIZED=2]="FINALIZED",e[e.DETACHING=3]="DETACHING",e[e.DEAD=4]="DEAD"}(ne||(ne={}));function pe(e,t,n){return void 0===n&&(n=!0),he(e,We(t),n)}function he(e,t,n){void 0===n&&(n=!0);for(var r=e,o=0;o<t.length;o++){var i=t[o];if(".."===i){if(r=r.parent)continue}else{if("."===i)continue;if(r){if(r instanceof M)try{var a=r.value;le(a)&&(r=ue(a))}catch(s){if(!n)return;throw s}if(r instanceof D)if(r.getChildType(i)&&(r=r.getChildNode(i)))continue}}if(n)throw be("Could not resolve '"+i+"' in path '"+(He(t.slice(0,o))||"/")+"' while resolving '"+He(t)+"'");return}return r}function me(e){if(!e)return ye;var t=Object.keys(e);if(!t.length)return ye;var n=new Array(t.length);return t.forEach((function(t,r){n[r]=e[t]})),n}var ye=Object.freeze([]),ve=Object.freeze({}),ge="string"===typeof i.a?{deep:!1}:{deep:!1,proxy:!1};function be(e){return void 0===e&&(e="Illegal state"),new Error("[mobx-state-tree] "+e)}function we(e){return e}Object.freeze(ge);var Oe=Number.isInteger||function(e){return"number"===typeof e&&isFinite(e)&&Math.floor(e)===e};function xe(e){return Array.isArray(e)||Object(i.q)(e)}function Ee(e){return e?xe(e)?e:[e]:ye}function Se(e){if(null===e||"object"!==typeof e)return!1;var t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}function _e(e){return null!==e&&"object"===typeof e&&!(e instanceof Date)&&!(e instanceof RegExp)}function Ce(e,t){return void 0===t&&(t=!0),null===e||void 0===e||!!("string"===typeof e||"number"===typeof e||"boolean"===typeof e||t&&e instanceof Date)}function ke(e){return e}function Pe(e,t,n){Object.defineProperty(e,t,{enumerable:!1,writable:!1,configurable:!0,value:n})}var je=function(){function e(){this.handlers=[]}return Object.defineProperty(e.prototype,"hasSubscribers",{get:function(){return this.handlers.length>0},enumerable:!0,configurable:!0}),e.prototype.register=function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}},e.prototype.has=function(e){return this.handlers.indexOf(e)>=0},e.prototype.unregister=function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)},e.prototype.clear=function(){this.handlers.length=0},e.prototype.emit=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=this.handlers.slice();n.forEach((function(t){return t.apply(void 0,h(e))}))},e}(),Te=function(){function e(){}return e.prototype.hasSubscribers=function(e){var t=this.eventHandlers&&this.eventHandlers[e];return!!t&&t.hasSubscribers},e.prototype.register=function(e,t,n){void 0===n&&(n=!1),this.eventHandlers||(this.eventHandlers={});var r=this.eventHandlers[e];return r||(r=this.eventHandlers[e]=new je),r.register(t,n)},e.prototype.has=function(e,t){var n=this.eventHandlers&&this.eventHandlers[e];return!!n&&n.has(t)},e.prototype.unregister=function(e,t){var n=this.eventHandlers&&this.eventHandlers[e];n&&n.unregister(t)},e.prototype.clear=function(e){this.eventHandlers&&delete this.eventHandlers[e]},e.prototype.clearAll=function(){this.eventHandlers=void 0},e.prototype.emit=function(e){for(var t,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var o=this.eventHandlers&&this.eventHandlers[e];o&&(t=o).emit.apply(t,h(n))},e}();function Ne(e){for(var t=new Array(e.length),n=0;n<e.length;n++)t[n]=e[n];return t}function Me(e,t){return 0===e.indexOf(t)}var Ae=function(e,t){};function Re(e){console.warn(new Error("[mobx-state-tree] "+e))}function De(e,t,n,r){0}function Ie(e,t){De()}function Fe(e,t,n,r){De(),void 0!==n&&De(),void 0!==r&&De()}function Le(e,t,n){void 0===n&&(n=!0),De(),n||De()}function ze(e){switch(e.op){case"add":return{op:"add",path:e.path,value:e.value};case"remove":return{op:"remove",path:e.path};case"replace":return{op:"replace",path:e.path,value:e.value}}}function Ve(e){switch(e.op){case"add":return{op:"remove",path:e.path};case"remove":return{op:"add",path:e.path,value:e.oldValue};case"replace":return{op:"replace",path:e.path,value:e.oldValue}}}function Be(e){return!0===("number"===typeof e)?""+e:-1===e.indexOf("/")&&-1===e.indexOf("~")?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function Ue(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function He(e){if(0===e.length)return"";var t=function(e){return e.map(Be).join("/")};return"."===e[0]||".."===e[0]?t(e):"/"+t(e)}function We(e){var t=e.split("/").map(Ue);if(!(""===e||"."===e||".."===e||Me(e,"/")||Me(e,"./")||Me(e,"../")))throw be("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}Ae.ids={};var Ke=function(e){function t(t,n,r){var o=e.call(this,r||t.name)||this;return o._subtype=t,o._processors=n,o}return c(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return this._subtype.flags|T.SnapshotProcessor},enumerable:!0,configurable:!0}),t.prototype.describe=function(){return"snapshotProcessor("+this._subtype.describe()+")"},t.prototype.preProcessSnapshot=function(e){return this._processors.preProcessor?this._processors.preProcessor.call(null,e):e},t.prototype.postProcessSnapshot=function(e){return this._processors.postProcessor?this._processors.postProcessor.call(null,e):e},t.prototype._fixNode=function(e){var t=this;!function(e,t){for(var n,r,o=[],i=2;i<arguments.length;i++)o[i-2]=arguments[i];try{for(var a=d(o),s=a.next();!s.done;s=a.next()){var l=s.value;e[l]=t[l].bind(t)}}catch(c){n={error:c}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}(e.type,this,"isAssignableFrom","create");var n=e.getSnapshot;e.getSnapshot=function(){return t.postProcessSnapshot(n.call(e))}},t.prototype.instantiate=function(e,t,n,r){var o=le(r)?r:this.preProcessSnapshot(r),i=this._subtype.instantiate(e,t,n,o);return this._fixNode(i),i},t.prototype.reconcile=function(e,t,n,r){var o=this._subtype.reconcile(e,le(t)?t:this.preProcessSnapshot(t),n,r);return o!==e&&this._fixNode(o),o},t.prototype.getSnapshot=function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n},t.prototype.isValidSnapshot=function(e,t){var n=this.preProcessSnapshot(e);return this._subtype.validate(n,t)},t.prototype.getSubTypes=function(){return this._subtype},t.prototype.is=function(e){var t=z(e)?this._subtype:le(e)?w(e,!1):this.preProcessSnapshot(e);return 0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length},t}(I);var Ge,Ye="Map.put can only be used to store complex values that have an identifier type attribute";!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ge||(Ge={}));var qe=function(e){function t(t){return e.call(this,t,i.u.ref.enhancer)||this}return c(t,e),t.prototype.get=function(t){return e.prototype.get.call(this,""+t)},t.prototype.has=function(t){return e.prototype.has.call(this,""+t)},t.prototype.delete=function(t){return e.prototype.delete.call(this,""+t)},t.prototype.set=function(t,n){return e.prototype.set.call(this,""+t,n)},t.prototype.put=function(e){if(!e)throw be("Map.put cannot be used to set empty values");if(le(e)){var t=ue(e);if(null===t.identifier)throw be(Ye);return this.set(t.identifier,e),e}if(_e(e)){var n=ue(this),r=n.type;if(r.identifierMode!==Ge.YES)throw be(Ye);var o=e[r.mapIdentifierAttribute];if(!Vt(o)){var i=this.put(r.getChildType().create(e,n.environment));return this.put(w(i))}var a=zt(o);return this.set(a,e),this.get(a)}throw be("Map.put can only be used to store complex values")},t}(i.b),Xe=function(e){function t(t,n,r){void 0===r&&(r=[]);var o=e.call(this,t)||this;return o._subType=n,o.identifierMode=Ge.UNKNOWN,o.mapIdentifierAttribute=void 0,o.flags=T.Map,o.hookInitializers=[],o._determineIdentifierMode(),o.hookInitializers=r,o}return c(t,e),t.prototype.hooks=function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)},t.prototype.instantiate=function(e,t,n,r){return this._determineIdentifierMode(),ie(this,e,t,n,r)},t.prototype._determineIdentifierMode=function(){if(this.identifierMode===Ge.UNKNOWN){var e=[];if(function e(t,n){var r,o,i=t.getSubTypes();if("cannotDetermine"===i)return!1;if(i){var a=Ee(i);try{for(var s=d(a),l=s.next();!l.done;l=s.next()){if(!e(l.value,n))return!1}}catch(c){r={error:c}}finally{try{l&&!l.done&&(o=s.return)&&o.call(s)}finally{if(r)throw r.error}}}return t instanceof rt&&n.push(t),!0}(this._subType,e)){var t=void 0;e.forEach((function(e){if(e.identifierAttribute){if(t&&t!==e.identifierAttribute)throw be("The objects in a map should all have the same identifier attribute, expected '"+t+"', but child of type '"+e.name+"' declared attribute '"+e.identifierAttribute+"' as identifier");t=e.identifierAttribute}})),t?(this.identifierMode=Ge.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ge.NO}}},t.prototype.initializeChildNodes=function(e,t){void 0===t&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach((function(o){r[o]=n.instantiate(e,o,void 0,t[o])})),r},t.prototype.createNewInstance=function(e){return new qe(e)},t.prototype.finalizeNewInstance=function(e,t){Object(i.g)(t,e.unbox),e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],o=Y(t,e,r);Pe(t,e,o)}))})),Object(i.o)(t,this.willChange),Object(i.v)(t,this.didChange)},t.prototype.describe=function(){return"Map<string, "+this._subType.describe()+">"},t.prototype.getChildren=function(e){return Object(i.B)(e.storedValue)},t.prototype.getChildNode=function(e,t){var n=e.storedValue.get(""+t);if(!n)throw be("Not a child "+t);return n},t.prototype.willChange=function(e){var t=ue(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,o=r._subType;switch(e.type){case"update":var i=e.newValue;if(i===e.object.get(n))return null;te(o,i),e.newValue=o.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case"add":te(o,e.newValue),e.newValue=o.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e},t.prototype.processIdentifier=function(e,t){if(this.identifierMode===Ge.YES&&t instanceof D){var n=t.identifier;if(n!==e)throw be("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+e+"'")}},t.prototype.getSnapshot=function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t},t.prototype.processInitialSnapshot=function(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].getSnapshot()})),t},t.prototype.didChange=function(e){var t=ue(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Be(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Be(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var n=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Be(e.name),oldValue:n},t)}},t.prototype.applyPatchLocally=function(e,t,n){var r=e.storedValue;switch(n.op){case"add":case"replace":r.set(t,n.value);break;case"remove":r.delete(t)}},t.prototype.applySnapshot=function(e,t){te(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach((function(e){r[e]=!1})),t)for(var o in t)n.set(o,t[o]),r[""+o]=!0;Object.keys(r).forEach((function(e){!1===r[e]&&n.delete(e)}))},t.prototype.getChildType=function(){return this._subType},t.prototype.isValidSnapshot=function(e,t){var n=this;return Se(e)?ee(Object.keys(e).map((function(r){return n._subType.validate(e[r],Q(t,r,n._subType))}))):Z(t,e,"Value is not a plain object")},t.prototype.getDefaultSnapshot=function(){return ve},t.prototype.removeChild=function(e,t){e.storedValue.delete(t)},f([i.h],t.prototype,"applySnapshot",null),t}(F);var $e=function(e){function t(t,n,r){void 0===r&&(r=[]);var o=e.call(this,t)||this;return o._subType=n,o.flags=T.Array,o.hookInitializers=[],o.hookInitializers=r,o}return c(t,e),t.prototype.hooks=function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)},t.prototype.instantiate=function(e,t,n,r){return ie(this,e,t,n,r)},t.prototype.initializeChildNodes=function(e,t){void 0===t&&(t=[]);var n=e.type._subType,r={};return t.forEach((function(t,o){var i=""+o;r[i]=n.instantiate(e,i,void 0,t)})),r},t.prototype.createNewInstance=function(e){return i.u.array(me(e),ge)},t.prototype.finalizeNewInstance=function(e,t){Object(i.f)(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],o=Y(t,e,r);Pe(t,e,o)}))})),Object(i.o)(t,this.willChange),Object(i.v)(t,this.didChange)},t.prototype.describe=function(){return this._subType.describe()+"[]"},t.prototype.getChildren=function(e){return e.storedValue.slice()},t.prototype.getChildNode=function(e,t){var n=Number(t);if(n<e.storedValue.length)return e.storedValue[n];throw be("Not a child: "+t)},t.prototype.willChange=function(e){var t=ue(e.object);t.assertWritable({subpath:""+e.index});var n=t.type._subType,r=t.getChildren();switch(e.type){case"update":if(e.newValue===e.object[e.index])return null;var o=Qe(t,n,[r[e.index]],[e.newValue],[e.index]);if(!o)return null;e.newValue=o[0];break;case"splice":var i=e.index,a=e.removedCount,s=e.added,l=Qe(t,n,r.slice(i,i+a),s,s.map((function(e,t){return i+t})));if(!l)return null;e.added=l;for(var c=i+a;c<r.length;c++)r[c].setParent(t,""+(c+s.length-a))}return e},t.prototype.getSnapshot=function(e){return e.getChildren().map((function(e){return e.snapshot}))},t.prototype.processInitialSnapshot=function(e){var t=[];return Object.keys(e).forEach((function(n){t.push(e[n].getSnapshot())})),t},t.prototype.didChange=function(e){var t=ue(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:""+e.index,value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"splice":for(var n=e.removedCount-1;n>=0;n--)t.emitPatch({op:"remove",path:""+(e.index+n),oldValue:e.removed[n].snapshot},t);for(n=0;n<e.addedCount;n++)t.emitPatch({op:"add",path:""+(e.index+n),value:t.getChildNode(""+(e.index+n)).snapshot,oldValue:void 0},t);return}},t.prototype.applyPatchLocally=function(e,t,n){var r=e.storedValue,o="-"===t?r.length:Number(t);switch(n.op){case"replace":r[o]=n.value;break;case"add":r.splice(o,0,n.value);break;case"remove":r.splice(o,1)}},t.prototype.applySnapshot=function(e,t){te(this,t),e.storedValue.replace(t)},t.prototype.getChildType=function(){return this._subType},t.prototype.isValidSnapshot=function(e,t){var n=this;return xe(e)?ee(e.map((function(e,r){return n._subType.validate(e,Q(t,""+r,n._subType))}))):Z(t,e,"Value is not an array")},t.prototype.getDefaultSnapshot=function(){return ye},t.prototype.removeChild=function(e,t){e.storedValue.splice(Number(t),1)},f([i.h],t.prototype,"applySnapshot",null),t}(F);function Qe(e,t,n,r,o){for(var i=!0,a=0;;a++){var s=a<=r.length-1,l=n[a],c=s?r[a]:void 0,u=""+o[a];if(se(c)&&(c=c.storedValue),!l&&!s)break;if(s)if(l)if(Ze(l,c))n[a]=Je(t,e,u,c,l);else{for(var f=void 0,d=a;d<n.length;d++)if(Ze(n[d],c)){f=n.splice(d,1)[0];break}i=!1;p=Je(t,e,u,c,f);n.splice(a,0,p)}else{if(le(c)&&ue(c).parent===e)throw be("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+e.path+"/"+u+"', but it lives already at '"+ue(c).path+"'");i=!1;var p=Je(t,e,u,c);n.splice(a,0,p)}else i=!1,n.splice(a,1),l instanceof D&&l.createObservableInstanceIfNeeded(),l.die(),a--}return i?null:n}function Je(e,t,n,r,o){te(e,r);var i=function(){if(le(r)){var i=ue(r);if(i.assertAlive(ve),null!==i.parent&&i.parent===t)return i.setParent(t,n),i}return o?e.reconcile(o,r,t,n):e.instantiate(t,n,void 0,r)}();return o&&o!==i&&(o instanceof D&&o.createObservableInstanceIfNeeded(),o.die()),i}function Ze(e,t){if(!e.isAlive)return!1;if(le(t)){var n=ue(t);return n.isAlive&&n===e}return e.snapshot===t||e instanceof D&&null!==e.identifier&&e.identifierAttribute&&Se(t)&&e.identifier===zt(t[e.identifierAttribute])&&e.type.is(t)}function et(){return ue(this).toString()}var tt={name:"AnonymousModel",properties:{},initializers:ye};function nt(e){return Object.keys(e).reduce((function(e,t){var n,r,i;if(t in o)throw be("Hook '"+t+"' was defined as property. Hooks should be defined as part of the actions");var a=Object.getOwnPropertyDescriptor(e,t);if("get"in a)throw be("Getters are not supported as properties. Please use views instead");var s=a.value;if(null===s||void 0===s)throw be("The default value of an attribute cannot be null or undefined as the type cannot be inferred. Did you mean `types.maybe(someType)`?");if(Ce(s))return Object.assign({},e,((n={})[t]=wt(function(e){switch(typeof e){case"string":return at;case"number":return st;case"boolean":return ct;case"object":if(e instanceof Date)return pt}throw be("Cannot determine primitive type from value "+e)}(s),s),n));if(s instanceof Xe)return Object.assign({},e,((r={})[t]=wt(s,{}),r));if(s instanceof $e)return Object.assign({},e,((i={})[t]=wt(s,[]),i));if(z(s))return e;throw be("Invalid type definition for property '"+t+"', cannot infer a type from a value like '"+s+"' ("+typeof s+")")}),e)}var rt=function(e){function t(t){var n=e.call(this,t.name||tt.name)||this;return n.flags=T.Object,n.named=function(e){return n.cloneAndEnhance({name:e})},n.props=function(e){return n.cloneAndEnhance({properties:e})},n.preProcessSnapshot=function(e){var t=n.preProcessor;return t?n.cloneAndEnhance({preProcessor:function(n){return t(e(n))}}):n.cloneAndEnhance({preProcessor:e})},n.postProcessSnapshot=function(e){var t=n.postProcessor;return t?n.cloneAndEnhance({postProcessor:function(n){return e(t(n))}}):n.cloneAndEnhance({postProcessor:e})},Object.assign(n,tt,t),n.properties=nt(n.properties),n.properties,n.propertyNames=Object.keys(n.properties),n.identifierAttribute=n._getIdentifierAttribute(),n}return c(t,e),t.prototype._getIdentifierAttribute=function(){var e=void 0;return this.forAllProps((function(t,n){if(n.flags&T.Identifier){if(e)throw be("Cannot define property '"+t+"' as object identifier, property '"+e+"' is already defined as identifier property");e=t}})),e},t.prototype.cloneAndEnhance=function(e){return new t({name:e.name||this.name,properties:Object.assign({},this.properties,e.properties),initializers:this.initializers.concat(e.initializers||[]),preProcessor:e.preProcessor||this.preProcessor,postProcessor:e.postProcessor||this.postProcessor})},t.prototype.actions=function(e){var t=this;return this.cloneAndEnhance({initializers:[function(n){return t.instantiateActions(n,e(n)),n}]})},t.prototype.instantiateActions=function(e,t){if(!Se(t))throw be("actions initializer should return a plain object containing actions");Object.keys(t).forEach((function(n){if("preProcessSnapshot"===n)throw be("Cannot define action 'preProcessSnapshot', it should be defined using 'type.preProcessSnapshot(fn)' instead");if("postProcessSnapshot"===n)throw be("Cannot define action 'postProcessSnapshot', it should be defined using 'type.postProcessSnapshot(fn)' instead");var r=t[n],i=e[n];if(n in o&&i){var a=r;r=function(){i.apply(null,arguments),a.apply(null,arguments)}}var s=r.$mst_middleware,l=r.bind(t);l.$mst_middleware=s;var c=Y(e,n,l);t[n]=c,Pe(e,n,c)}))},t.prototype.volatile=function(e){var t=this;return this.cloneAndEnhance({initializers:[function(n){return t.instantiateVolatileState(n,e(n)),n}]})},t.prototype.instantiateVolatileState=function(e,t){if(!Se(t))throw be("volatile state initializer should return a plain object containing state");Object(i.y)(e,t)},t.prototype.extend=function(e){var t=this;return this.cloneAndEnhance({initializers:[function(n){var r=e(n),o=r.actions,i=r.views,a=r.state,s=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"===typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(r,["actions","views","state"]);for(var l in s)throw be("The `extend` function should return an object with a subset of the fields 'actions', 'views' and 'state'. Found invalid key '"+l+"'");return a&&t.instantiateVolatileState(n,a),i&&t.instantiateViews(n,i),o&&t.instantiateActions(n,o),n}]})},t.prototype.views=function(e){var t=this;return this.cloneAndEnhance({initializers:[function(n){return t.instantiateViews(n,e(n)),n}]})},t.prototype.instantiateViews=function(e,t){if(!Se(t))throw be("views initializer should return a plain object containing views");Object.keys(t).forEach((function(n){var r=Object.getOwnPropertyDescriptor(t,n);if("get"in r)if(Object(i.p)(e,n)){var o=Object(i.f)(e,n);o.derivation=r.get,o.scope=e,r.set&&(o.setter=Object(i.h)(o.name+"-setter",r.set))}else Object(i.i)(e,n,r,!0);else{if("function"!==typeof r.value)throw be("A view member should either be a function or getter based property");Pe(e,n,r.value)}}))},t.prototype.instantiate=function(e,t,n,r){return ie(this,e,t,n,le(r)?r:this.applySnapshotPreProcessor(r))},t.prototype.initializeChildNodes=function(e,t){void 0===t&&(t={});var n=e.type,r={};return n.forAllPr