/** MobX - (c) Michel Weststrate 2015, 2016 - MIT Licensed */ "use strict";function e(e,t){function n(){this.constructor=e}Xt(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function t(e){return e.interceptors&&e.interceptors.length>0}function n(e,t){var n=e.interceptors||(e.interceptors=[]);return n.push(t),_e(function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)})}function r(e,t){var n=_t();try{var r=e.interceptors;if(r)for(var o=0,i=r.length;o0}function i(e,t){var n=e.changeListeners||(e.changeListeners=[]);return n.push(t),_e(function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)})}function a(e,t){var n=_t(),r=e.changeListeners;if(r){r=r.slice();for(var o=0,i=r.length;o=this.length,value:t0,"actions should have valid names, got: '"+e+"'");var n=function(){return _(e,t,this,arguments)};return n.originalFn=t,n.isMobxAction=!0,n}function _(e,t,n,r){var o=O(e,t,n,r);try{return t.apply(n,r)}finally{S(o)}}function O(e,t,n,r){var o=s()&&!!e,i=0;if(o){i=Date.now();var a=r&&r.length||0,u=new Array(a);if(a>0)for(var l=0;l",o="function"==typeof e?e:t,i="function"==typeof e?t:n;return xe("function"==typeof o,x("m002")),xe(0===o.length,x("m003")),xe("string"==typeof r&&r.length>0,"actions should have valid names, got: '"+r+"'"),_(r,o,i,void 0)}function C(e){return"function"==typeof e&&!0===e.isMobxAction}function M(e,t,n){var r=function(){return _(t,n,e,arguments)};r.isMobxAction=!0,ke(e,t,r)}function N(e,t){return e===t}function $(e,t){return Pe(e,t)}function B(e,t){return Me(e,t)||N(e,t)}function U(e,t,n){function r(){i(s)}var o,i,a;"string"==typeof e?(o=e,i=t,a=n):(o=e.name||"Autorun@"+ye(),i=e,a=t),xe("function"==typeof i,x("m004")),xe(!1===C(i),x("m005")),a&&(i=i.bind(a));var s=new Yn(o,function(){this.track(r)});return s.schedule(),s.getDisposer()}function z(e,t,n,r){var o,i,a,s;return"string"==typeof e?(o=e,i=t,a=n,s=r):(o="When@"+ye(),i=e,a=t,s=n),U(o,function(e){if(i.call(s)){e.dispose();var t=_t();a.call(s),Ot(t)}})}function G(e,t,n,r){function o(){a(l)}var i,a,s,u;"string"==typeof e?(i=e,a=t,s=n,u=r):(i=e.name||"AutorunAsync@"+ye(),a=e,s=t,u=n),xe(!1===C(a),x("m006")),void 0===s&&(s=1),u&&(a=a.bind(u));var c=!1,l=new Yn(i,function(){c||(c=!0,setTimeout(function(){c=!1,l.isDisposed||l.track(o)},s))});return l.schedule(),l.getDisposer()}function K(e,t,n){function r(){if(!c.isDisposed){var n=!1;c.track(function(){var t=e(c);n=a||!u(i,t),i=t}),a&&o.fireImmediately&&t(i,c),a||!0!==n||t(i,c),a&&(a=!1)}}arguments.length>3&&ge(x("m007")),ue(e)&&ge(x("m008"));var o;o="object"==typeof n?n:{},o.name=o.name||e.name||t.name||"Reaction@"+ye(),o.fireImmediately=!0===n||!0===o.fireImmediately,o.delay=o.delay||0,o.compareStructural=o.compareStructural||o.struct||!1,t=yn(o.name,o.context?t.bind(o.context):t),o.context&&(e=e.bind(o.context));var i,a=!0,s=!1,u=o.equals?o.equals:o.compareStructural||o.struct?gn.structural:gn.default,c=new Yn(o.name,function(){a||o.delay<1?r():s||(s=!0,setTimeout(function(){s=!1,r()},o.delay))});return c.schedule(),c.getDisposer()}function H(e,t){if(ee(e)&&e.hasOwnProperty("$mobx"))return e.$mobx;xe(Object.isExtensible(e),x("m035")),Ie(e)||(t=(e.constructor.name||"ObservableObject")+"@"+ye()),t||(t="ObservableObject@"+ye());var n=new _n(e,t);return Ee(e,"$mobx",n),n}function W(e,t,n,r){if(e.values[t]&&!wn(e.values[t]))return xe("value"in n,"The property "+t+" in "+e.name+" is already observable, cannot redefine it as computed property"),void(e.target[t]=n.value);if("value"in n)if(ue(n.value)){var o=n.value;J(e,t,o.initialValue,o.enhancer)}else C(n.value)&&!0===n.value.autoBind?M(e.target,t,n.value.originalFn):wn(n.value)?Y(e,t,n.value):J(e,t,n.value,r);else q(e,t,n.get,n.set,gn.default,!0)}function J(e,n,o,i){if(Ve(e.target,n),t(e)){var a=r(e,{object:e.target,name:n,type:"add",newValue:o});if(!a)return;o=a.newValue}o=(e.values[n]=new hn(o,i,e.name+"."+n,!1)).value,Object.defineProperty(e.target,n,F(n)),Z(e,e.target,n,o)}function q(e,t,n,r,o,i){i&&Ve(e.target,t),e.values[t]=new xn(n,e.target,o,e.name+"."+t,r),i&&Object.defineProperty(e.target,t,X(t))}function Y(e,t,n){var r=e.name+"."+t;n.name=r,n.scope||(n.scope=e.target),e.values[t]=n,Object.defineProperty(e.target,t,X(t))}function F(e){return On[e]||(On[e]={configurable:!0,enumerable:!0,get:function(){return this.$mobx.values[e].get()},set:function(t){Q(this,e,t)}})}function X(e){return Sn[e]||(Sn[e]={configurable:!0,enumerable:!1,get:function(){return this.$mobx.values[e].get()},set:function(t){return this.$mobx.values[e].set(t)}})}function Q(e,n,i){var u=e.$mobx,p=u.values[n];if(t(u)){var f=r(u,{type:"update",object:e,name:n,newValue:i});if(!f)return;i=f.newValue}if((i=p.prepareNewValue(i))!==fn){var h=o(u),d=s(),f=h||d?{type:"update",object:e,oldValue:p.value,name:n,newValue:i}:null;d&&c(f),p.setNewValue(i),h&&a(u,f),d&&l()}}function Z(e,t,n,r){var i=o(e),u=s(),p=i||u?{type:"add",object:t,name:n,newValue:r}:null;u&&c(p),i&&a(e,p),u&&l()}function ee(e){return!!Ae(e)&&(R(e),An(e.$mobx))}function te(e,t){if(null===e||void 0===e)return!1;if(void 0!==t){if(g(e)||Pn(e))throw new Error(x("m019"));if(ee(e)){var n=e.$mobx;return n.values&&!!n.values[t]}return!1}return ee(e)||!!e.$mobx||en(e)||Qn(e)||wn(e)}function ne(e){return xe(!!e,":("),k(function(t,n,r,o,i){Ve(t,n),xe(!i||!i.get,x("m022")),J(H(t,void 0),n,r,e)},function(e){var t=this.$mobx.values[e];if(void 0!==t)return t.get()},function(e,t){Q(this,e,t)},!0,!1)}function re(e){for(var t=[],n=1;n=2,x("m014")),xe("object"==typeof e,x("m015")),xe(!Pn(e),x("m016")),n.forEach(function(e){xe("object"==typeof e,x("m017")),xe(!te(e),x("m018"))});for(var r=H(e),o={},i=n.length-1;i>=0;i--){var a=n[i];for(var s in a)if(!0!==o[s]&&De(a,s)){if(o[s]=!0,e===a&&!Re(e,s))continue;var u=Object.getOwnPropertyDescriptor(a,s);W(r,s,u,t)}}return e}function ae(e){if(void 0===e&&(e=void 0),"string"==typeof arguments[1])return In.apply(null,arguments);if(xe(arguments.length<=1,x("m021")),xe(!ue(e),x("m020")),te(e))return e;var t=le(e,void 0,void 0);return t!==e?t:Rn.box(e)}function se(e){ge("Expected one or two arguments to observable."+e+". Did you accidentally try to use observable."+e+" as decorator?")}function ue(e){return"object"==typeof e&&null!==e&&!0===e.isMobxModifierDescriptor}function ce(e,t){return xe(!ue(t),"Modifiers cannot be nested"),{isMobxModifierDescriptor:!0,initialValue:t,enhancer:e}}function le(e,t,n){return ue(e)&&ge("You tried to assign a modifier wrapped value to a collection, please define modifiers when creating the collection, not when modifying it"),te(e)?e:Array.isArray(e)?Rn.array(e,n):Ie(e)?Rn.object(e,n):Be(e)?Rn.map(e,n):e}function pe(e,t,n){return ue(e)&&ge("You tried to assign a modifier wrapped value to a collection, please define modifiers when creating the collection, not when modifying it"),void 0===e||null===e?e:ee(e)||g(e)||Pn(e)?e:Array.isArray(e)?Rn.shallowArray(e,n):Ie(e)?Rn.shallowObject(e,n):Be(e)?Rn.shallowMap(e,n):ge("The shallow modifier / decorator can only used in combination with arrays, objects and maps")}function fe(e){return e}function he(e,t,n){if(Pe(e,t))return t;if(te(e))return e;if(Array.isArray(e))return new cn(e,he,n);if(Be(e))return new Ln(e,he,n);if(Ie(e)){var r={};return H(r,n),ie(r,he,[e]),r}return e}function de(e,t,n){return Pe(e,t)?t:e}function ve(e,t){void 0===t&&(t=void 0),at();try{return e.apply(t)}finally{st()}}function be(e){return we("`mobx.map` is deprecated, use `new ObservableMap` or `mobx.observable.map` instead"),Rn.map(e)}function me(){return"undefined"!=typeof window?window:global}function ye(){return++zn.mobxGuid}function ge(e,t){throw xe(!1,e,t),"X"}function xe(e,t,n){if(!e)throw new Error("[mobx] Invariant failed: "+t+(n?" in '"+n+"'":""))}function we(e){return-1===Mn.indexOf(e)&&(Mn.push(e),console.error("[mobx] Deprecated: "+e),!0)}function _e(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}function Oe(e){var t=[];return e.forEach(function(e){-1===t.indexOf(e)&&t.push(e)}),t}function Se(e,t,n){return void 0===t&&(t=100),void 0===n&&(n=" - "),e?e.slice(0,t).join(n)+(e.length>t?" (... and "+(e.length-t)+"more)":""):""}function Ae(e){return null!==e&&"object"==typeof e}function Ie(e){if(null===e||"object"!=typeof e)return!1;var t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}function je(){for(var e=arguments[0],t=1,n=arguments.length;t=0;o--)if(!Pe(e[o],t[o]))return!1;return!0}if(r){if(e.size!==t.size)return!1;var i=!0;return e.forEach(function(e,n){i=i&&Pe(t.get(n),e)}),i}if("object"==typeof e&&"object"==typeof t){if(null===e||null===t)return!1;if($e(e)&&$e(t))return e.size===t.size&&Pe(Rn.shallowMap(e).entries(),Rn.shallowMap(t).entries());if(Le(e).length!==Le(t).length)return!1;for(var a in e){if(!(a in t))return!1;if(!Pe(e[a],t[a]))return!1}return!0}return!1}function Ce(e,t){var n="isMobX"+e;return t.prototype[n]=!0,function(e){return Ae(e)&&!0===e[n]}}function Me(e,t){return"number"==typeof e&&"number"==typeof t&&isNaN(e)&&isNaN(t)}function Ne(e){return Array.isArray(e)||g(e)}function $e(e){return Be(e)||Pn(e)}function Be(e){return void 0!==me().Map&&e instanceof me().Map}function Ue(e){var t;return Ie(e)?t=Object.keys(e):Array.isArray(e)?t=e.map(function(e){return e[0]}):$e(e)?t=Array.from(e.keys()):ge("Cannot get keys from "+e),t}function ze(){return"function"==typeof Symbol&&Symbol.toPrimitive||"@@toPrimitive"}function Ge(e){return null===e?null:"object"==typeof e?""+e:e}function Ke(){Kn=!0,me().__mobxInstanceCount--}function He(){we("Using `shareGlobalState` is not recommended, use peer dependencies instead. See https://github.com/mobxjs/mobx/issues/1082 for details."),Gn=!0;var e=me(),t=zn;if(e.__mobservableTrackingStack||e.__mobservableViewStack)throw new Error("[mobx] An incompatible version of mobservable is already loaded.");if(e.__mobxGlobal&&e.__mobxGlobal.version!==t.version)throw new Error("[mobx] An incompatible version of mobx is already loaded.");e.__mobxGlobal?zn=e.__mobxGlobal:e.__mobxGlobal=t}function We(){return zn}function Je(){zn.resetId++;var e=new Un;for(var t in e)-1===Bn.indexOf(t)&&(zn[t]=e[t]);zn.allowStateChanges=!zn.strictMode}function qe(e,t){if("object"==typeof e&&null!==e){if(g(e))return xe(void 0===t,x("m036")),e.$mobx.atom;if(Pn(e)){var n=e;if(void 0===t)return qe(n._keys);var r=n._data[t]||n._hasMap[t];return xe(!!r,"the entry '"+t+"' does not exist in the observable map '"+Fe(e)+"'"),r}if(R(e),t&&!e.$mobx&&e[t],ee(e)){if(!t)return ge("please specify a property");var r=e.$mobx.values[t];return xe(!!r,"no observable property '"+t+"' found on the observable object '"+Fe(e)+"'"),r}if(en(e)||wn(e)||Qn(e))return e}else if("function"==typeof e&&Qn(e.$mobx))return e.$mobx;return ge("Cannot obtain atom from "+e)}function Ye(e,t){return xe(e,"Expecting some object"),void 0!==t?Ye(qe(e,t)):en(e)||wn(e)||Qn(e)?e:Pn(e)?e:(R(e),e.$mobx?e.$mobx:void xe(!1,"Cannot obtain administration from "+e))}function Fe(e,t){var n;return n=void 0!==t?qe(e,t):ee(e)||Pn(e)?Ye(e):qe(e),n.name}function Xe(e,t){return Qe(qe(e,t))}function Qe(e){var t={name:e.name};return e.observing&&e.observing.length>0&&(t.dependencies=Oe(e.observing).map(Qe)),t}function Ze(e,t){return et(qe(e,t))}function et(e){var t={name:e.name};return tt(e)&&(t.observers=nt(e).map(et)),t}function tt(e){return e.observers&&e.observers.length>0}function nt(e){return e.observers}function rt(e,t){var n=e.observers.length;n&&(e.observersIndexes[t.__mapid]=n),e.observers[n]=t,e.lowestObserverState>t.dependenciesState&&(e.lowestObserverState=t.dependenciesState)}function ot(e,t){if(1===e.observers.length)e.observers.length=0,it(e);else{var n=e.observers,r=e.observersIndexes,o=n.pop();if(o!==t){var i=r[t.__mapid]||0;i?r[o.__mapid]=i:delete r[o.__mapid],n[i]=o}delete r[t.__mapid]}}function it(e){e.isPendingUnobservation||(e.isPendingUnobservation=!0,zn.pendingUnobservations.push(e))}function at(){zn.inBatch++}function st(){if(0==--zn.inBatch){Et();for(var e=zn.pendingUnobservations,t=0;t=1e3)return void t.push("(and many more)");t.push(""+new Array(n).join("\t")+e.name),e.dependencies&&e.dependencies.forEach(function(e){return ht(e,t,n+1)})}function dt(e){return e instanceof qn}function vt(e){switch(e.dependenciesState){case exports.IDerivationState.UP_TO_DATE:return!1;case exports.IDerivationState.NOT_TRACKING:case exports.IDerivationState.STALE:return!0;case exports.IDerivationState.POSSIBLY_STALE:for(var t=_t(),n=e.observing,r=n.length,o=0;o0;zn.computationDepth>0&&t&&ge(x("m031")+e.name),!zn.allowStateChanges&&t&&ge(x(zn.strictMode?"m030a":"m030b")+e.name)}function yt(e,t,n){St(e),e.newObserving=new Array(e.observing.length+100),e.unboundDepsCount=0,e.runId=++zn.runId;var r=zn.trackingDerivation;zn.trackingDerivation=e;var o;try{o=t.call(n)}catch(e){o=new qn(e)}return zn.trackingDerivation=r,gt(e),o}function gt(e){for(var t=e.observing,n=e.observing=e.newObserving,r=exports.IDerivationState.UP_TO_DATE,o=0,i=e.unboundDepsCount,a=0;ar&&(r=s.dependenciesState)}for(n.length=o,e.newObserving=null,i=t.length;i--;){var s=t[i];0===s.diffValue&&ot(s,e),s.diffValue=0}for(;o--;){var s=n[o];1===s.diffValue&&(s.diffValue=0,rt(s,e))}r!==exports.IDerivationState.UP_TO_DATE&&(e.dependenciesState=r,e.onBecomeStale())}function xt(e){var t=e.observing;e.observing=[];for(var n=t.length;n--;)ot(t[n],e);e.dependenciesState=exports.IDerivationState.NOT_TRACKING}function wt(e){var t=_t(),n=e();return Ot(t),n}function _t(){var e=zn.trackingDerivation;return zn.trackingDerivation=null,e}function Ot(e){zn.trackingDerivation=e}function St(e){if(e.dependenciesState!==exports.IDerivationState.UP_TO_DATE){e.dependenciesState=exports.IDerivationState.UP_TO_DATE;for(var t=e.observing,n=t.length;n--;)t[n].lowestObserverState=exports.IDerivationState.UP_TO_DATE}}function At(e){return console.log(e),e}function It(e,t){return we("`whyRun` is deprecated in favor of `trace`"),e=Dt(arguments),e?wn(e)||Qn(e)?At(e.whyRun()):ge(x("m025")):At(x("m024"))}function jt(){for(var e=[],t=0;t=0&&zn.globalReactionErrorHandlers.splice(t,1)}}function Et(){zn.inBatch>0||zn.isRunningReactions||Xn(Rt)}function Rt(){zn.isRunningReactions=!0;for(var e=zn.pendingReactions,t=0;e.length>0;){++t===Fn&&(console.error("Reaction doesn't converge to a stable state after "+Fn+" iterations. Probably there is a cycle in the reactive function: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,o=n.length;rt){for(var n=new Array(e-t),r=0;r0&&e+t+1>an&&y(e+t+1)},e.prototype.spliceWithArray=function(e,n,o){var i=this;mt(this.atom);var a=this.values.length;if(void 0===e?e=0:e>a?e=a:e<0&&(e=Math.max(0,a+e)),n=1===arguments.length?a-e:void 0===n||null===n?0:Math.max(0,Math.min(n,a-e)),void 0===o&&(o=[]),t(this)){var s=r(this,{object:this.array,type:"splice",index:e,removedCount:n,added:o});if(!s)return Cn;n=s.removedCount,o=s.added}o=o.map(function(e){return i.enhancer(e,void 0)});var u=o.length-n;this.updateArrayLength(a,u);var c=this.spliceItemsIntoValues(e,n,o);return 0===n&&0===o.length||this.notifyArraySplice(e,o,c),this.dehanceValues(c)},e.prototype.spliceItemsIntoValues=function(e,t,n){if(n.length-1&&(this.splice(t,1),!0)},o.prototype.move=function(e,t){function n(e){if(e<0)throw new Error("[mobx.array] Index out of bounds: "+e+" is negative");var t=this.$mobx.values.length;if(e>=t)throw new Error("[mobx.array] Index out of bounds: "+e+" is not smaller than "+t)}if(n.call(this,e),n.call(this,t),e!==t){var r,o=this.$mobx.values;r=e";ke(e,t,yn(i,n))},function(e){return this[e]},function(){xe(!1,x("m001"))},!1,!0),mn=k(function(e,t,n){M(e,t,n)},function(e){return this[e]},function(){xe(!1,x("m001"))},!1,!1),yn=function(e,t,n,r){return 1===arguments.length&&"function"==typeof e?w(e.name||"",e):2===arguments.length&&"function"==typeof t?w(e,t):1===arguments.length&&"string"==typeof e?L(e):L(t).apply(null,arguments)};yn.bound=function(e,t,n){if("function"==typeof e){var r=w("",e);return r.autoBind=!0,r}return mn.apply(null,arguments)};var gn={identity:N,structural:$,default:B},xn=function(){function e(e,t,n,r,o){this.derivation=e,this.scope=t,this.equals=n,this.dependenciesState=exports.IDerivationState.NOT_TRACKING,this.observing=[],this.newObserving=null,this.isPendingUnobservation=!1,this.observers=[],this.observersIndexes={},this.diffValue=0,this.runId=0,this.lastAccessedBy=0,this.lowestObserverState=exports.IDerivationState.UP_TO_DATE,this.unboundDepsCount=0,this.__mapid="#"+ye(),this.value=new qn(null),this.isComputing=!1,this.isRunningSetter=!1,this.isTracing=Jn.NONE,this.name=r||"ComputedValue@"+ye(),o&&(this.setter=w(r+"-setter",o))}return e.prototype.onBecomeStale=function(){pt(this)},e.prototype.onBecomeUnobserved=function(){xt(this),this.value=void 0},e.prototype.get=function(){xe(!this.isComputing,"Cycle detected in computation "+this.name,this.derivation),0===zn.inBatch?(at(),vt(this)&&(this.isTracing!==Jn.NONE&&console.log("[mobx.trace] '"+this.name+"' is being read outside a reactive context and doing a full recompute"),this.value=this.computeValue(!1)),st()):(ut(this),vt(this)&&this.trackAndCompute()&<(this));var e=this.value;if(dt(e))throw e.cause;return e},e.prototype.peek=function(){var e=this.computeValue(!1);if(dt(e))throw e.cause;return e},e.prototype.set=function(e){if(this.setter){xe(!this.isRunningSetter,"The setter of computed value '"+this.name+"' is trying to update itself. Did you intend to update an _observable_ value, instead of the computed property?"),this.isRunningSetter=!0;try{this.setter.call(this.scope,e)}finally{this.isRunningSetter=!1}}else xe(!1,"[ComputedValue '"+this.name+"'] It is not possible to assign a new value to a computed value.")},e.prototype.trackAndCompute=function(){s()&&u({object:this.scope,type:"compute",fn:this.derivation});var e=this.value,t=this.dependenciesState===exports.IDerivationState.NOT_TRACKING,n=this.value=this.computeValue(!0);return t||dt(e)||dt(n)||!this.equals(e,n)},e.prototype.computeValue=function(e){this.isComputing=!0,zn.computationDepth++;var t;if(e)t=yt(this,this.derivation,this.scope);else try{t=this.derivation.call(this.scope)}catch(e){t=new qn(e)}return zn.computationDepth--,this.isComputing=!1,t},e.prototype.observe=function(e,t){var n=this,r=!0,o=void 0;return U(function(){var i=n.get();if(!r||t){var a=_t();e({type:"update",object:n,newValue:i,oldValue:o}),Ot(a)}r=!1,o=i})},e.prototype.toJSON=function(){return this.get()},e.prototype.toString=function(){return this.name+"["+this.derivation.toString()+"]"},e.prototype.valueOf=function(){return Ge(this.get())},e.prototype.whyRun=function(){var e=Boolean(zn.trackingDerivation),t=Oe(this.isComputing?this.newObserving:this.observing).map(function(e){return e.name}),n=Oe(nt(this).map(function(e){return e.name}));return"\nWhyRun? computation '"+this.name+"':\n * Running because: "+(e?"[active] the value of this computation is needed by a reaction":this.isComputing?"[get] The value of this computed was requested outside a reaction":"[idle] not running at the moment")+"\n"+(this.dependenciesState===exports.IDerivationState.NOT_TRACKING?x("m032"):" * This computation will re-run if any of the following observables changes:\n "+Se(t)+"\n "+(this.isComputing&&e?" (... or any observable accessed during the remainder of the current run)":"")+"\n "+x("m038")+"\n\n * If the outcome of this computation changes, the following observers will be re-run:\n "+Se(n)+"\n")},e}();xn.prototype[ze()]=xn.prototype.valueOf;var wn=Ce("ComputedValue",xn),_n=function(){function e(e,t){this.target=e,this.name=t,this.values={},this.changeListeners=null,this.interceptors=null}return e.prototype.observe=function(e,t){return xe(!0!==t,"`observe` doesn't support the fire immediately property for observable objects."),i(this,e)},e.prototype.intercept=function(e){return n(this,e)},e}(),On={},Sn={},An=Ce("ObservableObjectAdministration",_n),In=ne(le),jn=ne(pe),Dn=ne(fe),Tn=ne(he),kn=ne(de),En={box:function(e,t){return arguments.length>2&&se("box"),new hn(e,le,t)},shallowBox:function(e,t){return arguments.length>2&&se("shallowBox"),new hn(e,fe,t)},array:function(e,t){return arguments.length>2&&se("array"),new cn(e,le,t)},shallowArray:function(e,t){return arguments.length>2&&se("shallowArray"),new cn(e,fe,t)},map:function(e,t){return arguments.length>2&&se("map"),new Ln(e,le,t)},shallowMap:function(e,t){return arguments.length>2&&se("shallowMap"),new Ln(e,fe,t)},object:function(e,t){arguments.length>2&&se("object");var n={};return H(n,t),re(n,e),n},shallowObject:function(e,t){arguments.length>2&&se("shallowObject");var n={};return H(n,t),oe(n,e),n},ref:function(){return arguments.length<2?ce(fe,arguments[0]):Dn.apply(null,arguments)},shallow:function(){return arguments.length<2?ce(pe,arguments[0]):jn.apply(null,arguments)},deep:function(){return arguments.length<2?ce(le,arguments[0]):In.apply(null,arguments)},struct:function(){return arguments.length<2?ce(he,arguments[0]):Tn.apply(null,arguments)}},Rn=ae;Object.keys(En).forEach(function(e){return Rn[e]=En[e]}),Rn.deep.struct=Rn.struct,Rn.ref.struct=function(){return arguments.length<2?ce(de,arguments[0]):kn.apply(null,arguments)};var Vn={},Ln=function(){function e(e,t,n){void 0===t&&(t=le),void 0===n&&(n="ObservableMap@"+ye()),this.enhancer=t,this.name=n,this.$mobx=Vn,this._data=Object.create(null),this._hasMap=Object.create(null),this._keys=new cn(void 0,fe,this.name+".keys()",!0),this.interceptors=null,this.changeListeners=null,this.dehancer=void 0,this.merge(e)}return e.prototype._has=function(e){return void 0!==this._data[e]},e.prototype.has=function(e){return!!this.isValidKey(e)&&(e=""+e,this._hasMap[e]?this._hasMap[e].get():this._updateHasMapEntry(e,!1).get())},e.prototype.set=function(e,n){this.assertValidKey(e),e=""+e;var o=this._has(e);if(t(this)){var i=r(this,{type:o?"update":"add",object:this,newValue:n,name:e});if(!i)return this;n=i.newValue}return o?this._updateValue(e,n):this._addValue(e,n),this},e.prototype.delete=function(e){var n=this;if(this.assertValidKey(e),e=""+e,t(this)){var i=r(this,{type:"delete",object:this,name:e});if(!i)return!1}if(this._has(e)){var u=s(),p=o(this),i=p||u?{type:"delete",object:this,oldValue:this._data[e].value,name:e}:null;return u&&c(i),ve(function(){n._keys.remove(e),n._updateHasMapEntry(e,!1),n._data[e].setNewValue(void 0),n._data[e]=void 0}),p&&a(this,i),u&&l(),!0}return!1},e.prototype._updateHasMapEntry=function(e,t){var n=this._hasMap[e];return n?n.setNewValue(t):n=this._hasMap[e]=new hn(t,fe,this.name+"."+e+"?",!1),n},e.prototype._updateValue=function(e,t){var n=this._data[e];if((t=n.prepareNewValue(t))!==fn){var r=s(),i=o(this),u=i||r?{type:"update",object:this,oldValue:n.value,name:e,newValue:t}:null;r&&c(u),n.setNewValue(t),i&&a(this,u),r&&l()}},e.prototype._addValue=function(e,t){var n=this;ve(function(){var r=n._data[e]=new hn(t,n.enhancer,n.name+"."+e,!1);t=r.value,n._updateHasMapEntry(e,!0),n._keys.push(e)});var r=s(),i=o(this),u=i||r?{type:"add",object:this,name:e,newValue:t}:null;r&&c(u),i&&a(this,u),r&&l()},e.prototype.get=function(e){return e=""+e,this.has(e)?this.dehanceValue(this._data[e].get()):this.dehanceValue(void 0)},e.prototype.dehanceValue=function(e){return void 0!==this.dehancer?this.dehancer(e):e},e.prototype.keys=function(){return h(this._keys.slice())},e.prototype.values=function(){return h(this._keys.map(this.get,this))},e.prototype.entries=function(){var e=this;return h(this._keys.map(function(t){return[t,e.get(t)]}))},e.prototype.forEach=function(e,t){var n=this;this.keys().forEach(function(r){return e.call(t,n.get(r),r,n)})},e.prototype.merge=function(e){var t=this;return Pn(e)&&(e=e.toJS()),ve(function(){Ie(e)?Object.keys(e).forEach(function(n){return t.set(n,e[n])}):Array.isArray(e)?e.forEach(function(e){var n=e[0],r=e[1];return t.set(n,r)}):Be(e)?e.forEach(function(e,n){return t.set(n,e)}):null!==e&&void 0!==e&&ge("Cannot initialize map from "+e)}),this},e.prototype.clear=function(){var e=this;ve(function(){wt(function(){e.keys().forEach(e.delete,e)})})},e.prototype.replace=function(e){var t=this;return ve(function(){var n=Ue(e);t.keys().filter(function(e){return-1===n.indexOf(e)}).forEach(function(e){return t.delete(e)}),t.merge(e)}),this},Object.defineProperty(e.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),e.prototype.toJS=function(){var e=this,t={};return this.keys().forEach(function(n){return t[n]=e.get(n)}),t},e.prototype.toJSON=function(){return this.toJS()},e.prototype.isValidKey=function(e){return null!==e&&void 0!==e&&("string"==typeof e||"number"==typeof e||"boolean"==typeof e)},e.prototype.assertValidKey=function(e){if(!this.isValidKey(e))throw new Error("[mobx.map] Invalid key: '"+e+"', only strings, numbers and booleans are accepted as key in observable maps.")},e.prototype.toString=function(){var e=this;return this.name+"[{ "+this.keys().map(function(t){return t+": "+e.get(t)}).join(", ")+" }]"},e.prototype.observe=function(e,t){return xe(!0!==t,x("m033")),i(this,e)},e.prototype.intercept=function(e){return n(this,e)},e}();d(Ln.prototype,function(){return this.entries()});var Pn=Ce("ObservableMap",Ln),Cn=[];Object.freeze(Cn);var Mn=[],Nn=function(){},$n=Object.prototype.hasOwnProperty,Bn=["mobxGuid","resetId","spyListeners","strictMode","runId"],Un=function(){function e(){this.version=5,this.trackingDerivation=null,this.computationDepth=0,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!0,this.strictMode=!1,this.resetId=0,this.spyListeners=[],this.globalReactionErrorHandlers=[]}return e}(),zn=new Un,Gn=!1,Kn=!1,Hn=!1,Wn=me();Wn.__mobxInstanceCount?(Wn.__mobxInstanceCount++,setTimeout(function(){Gn||Kn||Hn||(Hn=!0,console.warn("[mobx] Warning: there are multiple mobx instances active. This might lead to unexpected results. See https://github.com/mobxjs/mobx/issues/1082 for details."))})):Wn.__mobxInstanceCount=1,function(e){e[e.NOT_TRACKING=-1]="NOT_TRACKING",e[e.UP_TO_DATE=0]="UP_TO_DATE",e[e.POSSIBLY_STALE=1]="POSSIBLY_STALE",e[e.STALE=2]="STALE"}(exports.IDerivationState||(exports.IDerivationState={}));var Jn;!function(e){e[e.NONE=0]="NONE",e[e.LOG=1]="LOG",e[e.BREAK=2]="BREAK"}(Jn||(Jn={}));var qn=function(){function e(e){this.cause=e}return e}(),Yn=function(){function e(e,t){void 0===e&&(e="Reaction@"+ye()),this.name=e,this.onInvalidate=t,this.observing=[],this.newObserving=[],this.dependenciesState=exports.IDerivationState.NOT_TRACKING,this.diffValue=0,this.runId=0,this.unboundDepsCount=0,this.__mapid="#"+ye(),this.isDisposed=!1,this._isScheduled=!1,this._isTrackPending=!1,this._isRunning=!1,this.isTracing=Jn.NONE}return e.prototype.onBecomeStale=function(){this.schedule()},e.prototype.schedule=function(){this._isScheduled||(this._isScheduled=!0,zn.pendingReactions.push(this),Et())},e.prototype.isScheduled=function(){return this._isScheduled},e.prototype.runReaction=function(){this.isDisposed||(at(),this._isScheduled=!1,vt(this)&&(this._isTrackPending=!0,this.onInvalidate(),this._isTrackPending&&s()&&u({object:this,type:"scheduled-reaction"})),st())},e.prototype.track=function(e){at();var t,n=s();n&&(t=Date.now(),c({object:this,type:"reaction",fn:e})),this._isRunning=!0;var r=yt(this,e,void 0);this._isRunning=!1,this._isTrackPending=!1,this.isDisposed&&xt(this),dt(r)&&this.reportExceptionInDerivation(r.cause),n&&l({time:Date.now()-t}),st()},e.prototype.reportExceptionInDerivation=function(e){var t=this;if(this.errorHandler)return void this.errorHandler(e,this);var n="[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '"+this,r=x("m037");console.error(n||r,e),s()&&u({type:"error",message:n,error:e,object:this}),zn.globalReactionErrorHandlers.forEach(function(n){return n(e,t)})},e.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,this._isRunning||(at(),xt(this),st()))},e.prototype.getDisposer=function(){var e=this.dispose.bind(this);return e.$mobx=this,e.onError=Tt,e},e.prototype.toString=function(){return"Reaction["+this.name+"]"},e.prototype.whyRun=function(){var e=Oe(this._isRunning?this.newObserving:this.observing).map(function(e){return e.name});return"\nWhyRun? reaction '"+this.name+"':\n * Status: ["+(this.isDisposed?"stopped":this._isRunning?"running":this.isScheduled()?"scheduled":"idle")+"]\n * This reaction will re-run if any of the following observables changes:\n "+Se(e)+"\n "+(this._isRunning?" (... or any observable accessed during the remainder of the current run)":"")+"\n\t"+x("m038")+"\n"},e.prototype.trace=function(e){void 0===e&&(e=!1),jt(this,e)},e}(),Fn=100,Xn=function(e){return e()},Qn=Ce("Reaction",Yn),Zn=Nt(gn.default),er=Nt(gn.structural),tr=function(e,t,n){if("string"==typeof t)return Zn.apply(null,arguments);xe("function"==typeof e,x("m011")),xe(arguments.length<3,x("m012"));var r="object"==typeof t?t:{};r.setter="function"==typeof t?t:r.setter;var o=r.equals?r.equals:r.compareStructural||r.struct?gn.structural:gn.default;return new xn(e,r.context,o,r.name||e.name||"",r.setter)};tr.struct=er,tr.equals=Nt;var nr={allowStateChanges:j,deepEqual:Pe,getAtom:qe,getDebugName:Fe,getDependencyTree:Xe,getAdministration:Ye,getGlobalState:We,getObserverTree:Ze,interceptReads:Ft,isComputingDerivation:bt,isSpyEnabled:s,onReactionError:kt,reserveArrayBuffer:y,resetGlobalState:Je,isolateGlobalState:Ke,shareGlobalState:He,spyReport:u,spyReportEnd:l,spyReportStart:c,setReactionScheduler:Vt},rr={Reaction:Yn,untracked:wt,Atom:Zt,BaseAtom:Qt,useStrict:A,isStrictModeEnabled:I,spy:p,comparer:gn,asReference:Lt,asFlat:Ct,asStructure:Pt,asMap:Mt,isModifierDescriptor:ue,isObservableObject:ee,isBoxedObservable:dn,isObservableArray:g,ObservableMap:Ln,isObservableMap:Pn,map:be,transaction:ve,observable:Rn,computed:tr,isObservable:te,isComputed:$t,extendObservable:re,extendShallowObservable:oe,observe:Bt,intercept:Gt,autorun:U,autorunAsync:G,when:z,reaction:K,action:yn,isAction:C,runInAction:P,expr:Wt,toJS:Jt,createTransformer:qt,whyRun:It,isArrayLike:Ne,extras:nr},or=!1,ir=function(e){var t=rr[e];Object.defineProperty(rr,e,{get:function(){return or||(or=!0,console.warn("Using default export (`import mobx from 'mobx'`) is deprecated and won’t work in mobx@4.0.0\nUse `import * as mobx from 'mobx'` instead")),t}})};for(var ar in rr)ir(ar);"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:p,extras:nr}),exports.extras=nr,exports.default=rr,exports.Reaction=Yn,exports.untracked=wt,exports.Atom=Zt,exports.BaseAtom=Qt,exports.useStrict=A,exports.isStrictModeEnabled=I,exports.spy=p,exports.comparer=gn,exports.asReference=Lt,exports.asFlat=Ct,exports.asStructure=Pt,exports.asMap=Mt,exports.isModifierDescriptor=ue,exports.isObservableObject=ee,exports.isBoxedObservable=dn,exports.isObservableArray=g,exports.ObservableMap=Ln,exports.isObservableMap=Pn,exports.map=be,exports.transaction=ve,exports.observable=Rn,exports.computed=tr,exports.isObservable=te,exports.isComputed=$t,exports.extendObservable=re,exports.extendShallowObservable=oe,exports.observe=Bt,exports.intercept=Gt,exports.autorun=U,exports.autorunAsync=G,exports.when=z,exports.reaction=K,exports.action=yn,exports.isAction=C,exports.runInAction=P,exports.expr=Wt,exports.toJS=Jt,exports.createTransformer=qt,exports.whyRun=It,exports.trace=jt,exports.isArrayLike=Ne; //# sourceMappingURL=lib/mobx.min.js.map