/** MobX - (c) Michel Weststrate 2015, 2016 - MIT Licensed */ !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.mobx=e()}}(function(){return function e(t,n,r){function o(a,s){if(!n[a]){if(!t[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(i)return i(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var l=n[a]={exports:{}};t[a][0].call(l.exports,function(e){var n=t[a][1][e];return o(n||e)},l,l.exports,e,t,n,r)}return n[a].exports}for(var i="function"==typeof require&&require,a=0;a0}function o(e,t){var n=e.interceptors||(e.interceptors=[]);return n.push(t),Oe(function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)})}function i(e,t){var n=_t();try{var r=e.interceptors;if(r)for(var o=0,i=r.length;o0}function s(e,t){var n=e.changeListeners||(e.changeListeners=[]);return n.push(t),Oe(function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)})}function u(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 O(e,t,this,arguments)};return n.originalFn=t,n.isMobxAction=!0,n}function O(e,t,n,r){var o=S(e,t,n,r);try{return t.apply(n,r)}finally{A(o)}}function S(e,t,n,r){var o=c()&&!!e,i=0;if(o){i=Date.now();var a=r&&r.length||0,s=new Array(a);if(a>0)for(var u=0;u",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+"'"),O(r,o,i,void 0)}function M(e){return"function"==typeof e&&!0===e.isMobxAction}function N(e,t,n){var r=function(){return O(t,n,e,arguments)};r.isMobxAction=!0,ke(e,t,r)}function $(e,t){return e===t}function B(e,t){return Pe(e,t)}function U(e,t){return Me(e,t)||$(e,t)}function z(e,t,n){function r(){i(s)}var o,i,a;"string"==typeof e?(o=e,i=t,a=n):(o=e.name||"Autorun@"+ge(),i=e,a=t),xe("function"==typeof i,x("m004")),xe(!1===M(i),x("m005")),a&&(i=i.bind(a));var s=new qn(o,function(){this.track(r)});return s.schedule(),s.getDisposer()}function G(e,t,n,r){var o,i,a,s;return"string"==typeof e?(o=e,i=t,a=n,s=r):(o="When@"+ge(),i=e,a=t,s=n),z(o,function(e){if(i.call(s)){e.dispose();var t=_t();a.call(s),Ot(t)}})}function K(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@"+ge(),a=e,s=t,u=n),xe(!1===M(a),x("m006")),void 0===s&&(s=1),u&&(a=a.bind(u));var c=!1,l=new qn(i,function(){c||(c=!0,setTimeout(function(){c=!1,l.isDisposed||l.track(o)},s))});return l.schedule(),l.getDisposer()}function H(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&&we(x("m007")),ce(e)&&we(x("m008"));var o;o="object"==typeof n?n:{},o.name=o.name||e.name||t.name||"Reaction@"+ge(),o.fireImmediately=!0===n||!0===o.fireImmediately,o.delay=o.delay||0,o.compareStructural=o.compareStructural||o.struct||!1,t=mn(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?yn.structural:yn.default,c=new qn(o.name,function(){a||o.delay<1?r():s||(s=!0,setTimeout(function(){s=!1,r()},o.delay))});return c.schedule(),c.getDisposer()}function W(e,t){if(te(e)&&e.hasOwnProperty("$mobx"))return e.$mobx;xe(Object.isExtensible(e),x("m035")),je(e)||(t=(e.constructor.name||"ObservableObject")+"@"+ge()),t||(t="ObservableObject@"+ge());var n=new xn(e,t);return Ee(e,"$mobx",n),n}function J(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(ce(n.value)){var o=n.value;q(e,t,o.initialValue,o.enhancer)}else M(n.value)&&!0===n.value.autoBind?N(e.target,t,n.value.originalFn):wn(n.value)?F(e,t,n.value):q(e,t,n.value,r);else Y(e,t,n.get,n.set,yn.default,!0)}function q(e,t,n,o){if(Ve(e.target,t),r(e)){var a=i(e,{object:e.target,name:t,type:"add",newValue:n});if(!a)return;n=a.newValue}n=(e.values[t]=new pn(n,o,e.name+"."+t,!1)).value,Object.defineProperty(e.target,t,X(t)),ee(e,e.target,t,n)}function Y(e,t,n,r,o,i){i&&Ve(e.target,t),e.values[t]=new gn(n,e.target,o,e.name+"."+t,r),i&&Object.defineProperty(e.target,t,Q(t))}function F(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,Q(t))}function X(e){return _n[e]||(_n[e]={configurable:!0,enumerable:!0,get:function(){return this.$mobx.values[e].get()},set:function(t){Z(this,e,t)}})}function Q(e){return On[e]||(On[e]={configurable:!0,enumerable:!1,get:function(){return this.$mobx.values[e].get()},set:function(t){return this.$mobx.values[e].set(t)}})}function Z(e,t,n){var o=e.$mobx,s=o.values[t];if(r(o)){var l=i(o,{type:"update",object:e,name:t,newValue:n});if(!l)return;n=l.newValue}if((n=s.prepareNewValue(n))!==fn){var h=a(o),d=c(),l=h||d?{type:"update",object:e,oldValue:s.value,name:t,newValue:n}:null;d&&f(l),s.setNewValue(n),h&&u(o,l),d&&p()}}function ee(e,t,n,r){var o=a(e),i=c(),s=o||i?{type:"add",object:t,name:n,newValue:r}:null;i&&f(s),o&&u(e,s),i&&p()}function te(e){return!!Ie(e)&&(V(e),Sn(e.$mobx))}function ne(e,t){if(null===e||void 0===e)return!1;if(void 0!==t){if(w(e)||Ln(e))throw new Error(x("m019"));if(te(e)){var n=e.$mobx;return n.values&&!!n.values[t]}return!1}return te(e)||!!e.$mobx||en(e)||Xn(e)||wn(e)}function re(e){return xe(!!e,":("),E(function(t,n,r,o,i){Ve(t,n),xe(!i||!i.get,x("m022")),q(W(t,void 0),n,r,e)},function(e){var t=this.$mobx.values[e];if(void 0!==t)return t.get()},function(e,t){Z(this,e,t)},!0,!1)}function oe(e){for(var t=[],n=1;n=2,x("m014")),xe("object"==typeof e,x("m015")),xe(!Ln(e),x("m016")),n.forEach(function(e){xe("object"==typeof e,x("m017")),xe(!ne(e),x("m018"))});for(var r=W(e),o={},i=n.length-1;i>=0;i--){var a=n[i];for(var s in a)if(!0!==o[s]&&Te(a,s)){if(o[s]=!0,e===a&&!Re(e,s))continue;var u=Object.getOwnPropertyDescriptor(a,s);J(r,s,u,t)}}return e}function se(e){if(void 0===e&&(e=void 0),"string"==typeof arguments[1])return An.apply(null,arguments);if(xe(arguments.length<=1,x("m021")),xe(!ce(e),x("m020")),ne(e))return e;var t=fe(e,void 0,void 0);return t!==e?t:En.box(e)}function ue(e){we("Expected one or two arguments to observable."+e+". Did you accidentally try to use observable."+e+" as decorator?")}function ce(e){return"object"==typeof e&&null!==e&&!0===e.isMobxModifierDescriptor}function le(e,t){return xe(!ce(t),"Modifiers cannot be nested"),{isMobxModifierDescriptor:!0,initialValue:t,enhancer:e}}function fe(e,t,n){return ce(e)&&we("You tried to assign a modifier wrapped value to a collection, please define modifiers when creating the collection, not when modifying it"),ne(e)?e:Array.isArray(e)?En.array(e,n):je(e)?En.object(e,n):Be(e)?En.map(e,n):e}function pe(e,t,n){return ce(e)&&we("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:te(e)||w(e)||Ln(e)?e:Array.isArray(e)?En.shallowArray(e,n):je(e)?En.shallowObject(e,n):Be(e)?En.shallowMap(e,n):we("The shallow modifier / decorator can only used in combination with arrays, objects and maps")}function he(e){return e}function de(e,t,n){if(Pe(e,t))return t;if(ne(e))return e;if(Array.isArray(e))return new un(e,de,n);if(Be(e))return new Vn(e,de,n);if(je(e)){var r={};return W(r,n),ae(r,de,[e]),r}return e}function ve(e,t,n){return Pe(e,t)?t:e}function be(e,t){void 0===t&&(t=void 0),at();try{return e.apply(t)}finally{st()}}function me(e){return _e("`mobx.map` is deprecated, use `new ObservableMap` or `mobx.observable.map` instead"),En.map(e)}function ye(){return"undefined"!=typeof window?window:e}function ge(){return++Un.mobxGuid}function we(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 _e(e){return-1===Cn.indexOf(e)&&(Cn.push(e),console.error("[mobx] Deprecated: "+e),!0)}function Oe(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}function Se(e){var t=[];return e.forEach(function(e){-1===t.indexOf(e)&&t.push(e)}),t}function Ae(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 Ie(e){return null!==e&&"object"==typeof e}function je(e){if(null===e||"object"!=typeof e)return!1;var t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}function De(){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(En.shallowMap(e).entries(),En.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 Ie(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)||w(e)}function $e(e){return Be(e)||Ln(e)}function Be(e){return void 0!==ye().Map&&e instanceof ye().Map}function Ue(e){var t;return je(e)?t=Object.keys(e):Array.isArray(e)?t=e.map(function(e){return e[0]}):$e(e)?t=Array.from(e.keys()):we("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(){Gn=!0,ye().__mobxInstanceCount--}function He(){_e("Using `shareGlobalState` is not recommended, use peer dependencies instead. See https://github.com/mobxjs/mobx/issues/1082 for details."),zn=!0;var e=ye(),t=Un;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?Un=e.__mobxGlobal:e.__mobxGlobal=t}function We(){return Un}function Je(){Un.resetId++;var e=new Bn;for(var t in e)-1===$n.indexOf(t)&&(Un[t]=e[t]);Un.allowStateChanges=!Un.strictMode}function qe(e,t){if("object"==typeof e&&null!==e){if(w(e))return xe(void 0===t,x("m036")),e.$mobx.atom;if(Ln(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(V(e),t&&!e.$mobx&&e[t],te(e)){if(!t)return we("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)||Xn(e))return e}else if("function"==typeof e&&Xn(e.$mobx))return e.$mobx;return we("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)||Xn(e)?e:Ln(e)?e:(V(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):te(e)||Ln(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=Se(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,Un.pendingUnobservations.push(e))}function at(){Un.inBatch++}function st(){if(0==--Un.inBatch){Et();for(var e=Un.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 Jn}function vt(e){switch(e.dependenciesState){case n.IDerivationState.UP_TO_DATE:return!1;case n.IDerivationState.NOT_TRACKING:case n.IDerivationState.STALE:return!0;case n.IDerivationState.POSSIBLY_STALE:for(var t=_t(),r=e.observing,o=r.length,i=0;i0;Un.computationDepth>0&&t&&we(x("m031")+e.name),!Un.allowStateChanges&&t&&we(x(Un.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=++Un.runId;var r=Un.trackingDerivation;Un.trackingDerivation=e;var o;try{o=t.call(n)}catch(e){o=new Jn(e)}return Un.trackingDerivation=r,gt(e),o}function gt(e){for(var t=e.observing,r=e.observing=e.newObserving,o=n.IDerivationState.UP_TO_DATE,i=0,a=e.unboundDepsCount,s=0;so&&(o=u.dependenciesState)}for(r.length=i,e.newObserving=null,a=t.length;a--;){var u=t[a];0===u.diffValue&&ot(u,e),u.diffValue=0}for(;i--;){var u=r[i];1===u.diffValue&&(u.diffValue=0,rt(u,e))}o!==n.IDerivationState.UP_TO_DATE&&(e.dependenciesState=o,e.onBecomeStale())}function wt(e){var t=e.observing;e.observing=[];for(var r=t.length;r--;)ot(t[r],e);e.dependenciesState=n.IDerivationState.NOT_TRACKING}function xt(e){var t=_t(),n=e();return Ot(t),n}function _t(){var e=Un.trackingDerivation;return Un.trackingDerivation=null,e}function Ot(e){Un.trackingDerivation=e}function St(e){if(e.dependenciesState!==n.IDerivationState.UP_TO_DATE){e.dependenciesState=n.IDerivationState.UP_TO_DATE;for(var t=e.observing,r=t.length;r--;)t[r].lowestObserverState=n.IDerivationState.UP_TO_DATE}}function At(e){return console.log(e),e}function It(e,t){return _e("`whyRun` is deprecated in favor of `trace`"),e=Dt(arguments),e?wn(e)||Xn(e)?At(e.whyRun()):we(x("m025")):At(x("m024"))}function jt(){for(var e=[],t=0;t=0&&Un.globalReactionErrorHandlers.splice(t,1)}}function Et(){Un.inBatch>0||Un.isRunningReactions||Fn(Rt)}function Rt(){Un.isRunningReactions=!0;for(var e=Un.pendingReactions,t=0;e.length>0;){++t===Yn&&(console.error("Reaction doesn't converge to a stable state after "+Yn+" 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>on&&g(e+t+1)},e.prototype.spliceWithArray=function(e,t,n){var o=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)),t=1===arguments.length?a-e:void 0===t||null===t?0:Math.max(0,Math.min(t,a-e)),void 0===n&&(n=[]),r(this)){var s=i(this,{object:this.array,type:"splice",index:e,removedCount:t,added:n});if(!s)return Pn;t=s.removedCount,n=s.added}n=n.map(function(e){return o.enhancer(e,void 0)});var u=n.length-t;this.updateArrayLength(a,u);var c=this.spliceItemsIntoValues(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice(e,n,c),this.dehanceValues(c)},e.prototype.spliceItemsIntoValues=function(e,t,n){if(n.length<1e4)return(o=this.values).splice.apply(o,[e,t].concat(n));var r=this.values.slice(e,e+t);return this.values=this.values.slice(0,e).concat(n,this.values.slice(e+t)),r;var o},e.prototype.notifyArrayChildUpdate=function(e,t,n){var r=!this.owned&&c(),o=a(this),i=o||r?{object:this.array,type:"update",index:e,newValue:t,oldValue:n}:null;r&&f(i),this.atom.reportChanged(),o&&u(this,i),r&&p()},e.prototype.notifyArraySplice=function(e,t,n){var r=!this.owned&&c(),o=a(this),i=o||r?{object:this.array,type:"splice",index:e,removed:n,added:t,removedCount:n.length,addedCount:t.length}:null;r&&f(i),this.atom.reportChanged(),o&&u(this,i),r&&p()},e}(),un=function(e){function n(t,n,r,o){void 0===r&&(r="ObservableArray@"+ge()),void 0===o&&(o=!1);var i=e.call(this)||this,a=new sn(r,n,i,o);return Ee(i,"$mobx",a),t&&t.length&&i.spliceWithArray(0,0,t),rn&&Object.defineProperty(a.array,"0",cn),i}return t(n,e),n.prototype.intercept=function(e){return this.$mobx.intercept(e)},n.prototype.observe=function(e,t){return void 0===t&&(t=!1),this.$mobx.observe(e,t)},n.prototype.clear=function(){return this.splice(0)},n.prototype.concat=function(){for(var e=[],t=0;t-1&&(this.splice(t,1),!0)},n.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,mn(i,n))},function(e){return this[e]},function(){xe(!1,x("m001"))},!1,!0),bn=E(function(e,t,n){N(e,t,n)},function(e){return this[e]},function(){xe(!1,x("m001"))},!1,!1),mn=function(e,t,n,r){return 1===arguments.length&&"function"==typeof e?_(e.name||"",e):2===arguments.length&&"function"==typeof t?_(e,t):1===arguments.length&&"string"==typeof e?P(e):P(t).apply(null,arguments)};mn.bound=function(e,t,n){if("function"==typeof e){var r=_("",e);return r.autoBind=!0,r}return bn.apply(null,arguments)};var yn={identity:$,structural:B,default:U},gn=function(){function e(e,t,r,o,i){this.derivation=e,this.scope=t,this.equals=r,this.dependenciesState=n.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=n.IDerivationState.UP_TO_DATE,this.unboundDepsCount=0,this.__mapid="#"+ge(),this.value=new Jn(null),this.isComputing=!1,this.isRunningSetter=!1,this.isTracing=Wn.NONE,this.name=o||"ComputedValue@"+ge(),i&&(this.setter=_(o+"-setter",i))}return e.prototype.onBecomeStale=function(){ft(this)},e.prototype.onBecomeUnobserved=function(){wt(this),this.value=void 0},e.prototype.get=function(){xe(!this.isComputing,"Cycle detected in computation "+this.name,this.derivation),0===Un.inBatch?(at(),vt(this)&&(this.isTracing!==Wn.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(){c()&&l({object:this.scope,type:"compute",fn:this.derivation});var e=this.value,t=this.dependenciesState===n.IDerivationState.NOT_TRACKING,r=this.value=this.computeValue(!0);return t||dt(e)||dt(r)||!this.equals(e,r)},e.prototype.computeValue=function(e){this.isComputing=!0,Un.computationDepth++;var t;if(e)t=yt(this,this.derivation,this.scope);else try{t=this.derivation.call(this.scope)}catch(e){t=new Jn(e)}return Un.computationDepth--,this.isComputing=!1,t},e.prototype.observe=function(e,t){var n=this,r=!0,o=void 0;return z(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(Un.trackingDerivation),t=Se(this.isComputing?this.newObserving:this.observing).map(function(e){return e.name}),r=Se(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===n.IDerivationState.NOT_TRACKING?x("m032"):" * This computation will re-run if any of the following observables changes:\n "+Ae(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 "+Ae(r)+"\n")},e}();gn.prototype[ze()]=gn.prototype.valueOf;var wn=Ce("ComputedValue",gn),xn=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."),s(this,e)},e.prototype.intercept=function(e){return o(this,e)},e}(),_n={},On={},Sn=Ce("ObservableObjectAdministration",xn),An=re(fe),In=re(pe),jn=re(he),Dn=re(de),Tn=re(ve),kn={box:function(e,t){return arguments.length>2&&ue("box"),new pn(e,fe,t)},shallowBox:function(e,t){return arguments.length>2&&ue("shallowBox"),new pn(e,he,t)},array:function(e,t){return arguments.length>2&&ue("array"),new un(e,fe,t)},shallowArray:function(e,t){return arguments.length>2&&ue("shallowArray"),new un(e,he,t)},map:function(e,t){return arguments.length>2&&ue("map"),new Vn(e,fe,t)},shallowMap:function(e,t){return arguments.length>2&&ue("shallowMap"),new Vn(e,he,t)},object:function(e,t){arguments.length>2&&ue("object");var n={};return W(n,t),oe(n,e),n},shallowObject:function(e,t){arguments.length>2&&ue("shallowObject");var n={};return W(n,t),ie(n,e),n},ref:function(){return arguments.length<2?le(he,arguments[0]):jn.apply(null,arguments)},shallow:function(){return arguments.length<2?le(pe,arguments[0]):In.apply(null,arguments)},deep:function(){return arguments.length<2?le(fe,arguments[0]):An.apply(null,arguments)},struct:function(){return arguments.length<2?le(de,arguments[0]):Dn.apply(null,arguments)}},En=se;Object.keys(kn).forEach(function(e){return En[e]=kn[e]}),En.deep.struct=En.struct,En.ref.struct=function(){return arguments.length<2?le(ve,arguments[0]):Tn.apply(null,arguments)};var Rn={},Vn=function(){function e(e,t,n){void 0===t&&(t=fe),void 0===n&&(n="ObservableMap@"+ge()),this.enhancer=t,this.name=n,this.$mobx=Rn,this._data=Object.create(null),this._hasMap=Object.create(null),this._keys=new un(void 0,he,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,t){this.assertValidKey(e),e=""+e;var n=this._has(e);if(r(this)){var o=i(this,{type:n?"update":"add",object:this,newValue:t,name:e});if(!o)return this;t=o.newValue}return n?this._updateValue(e,t):this._addValue(e,t),this},e.prototype.delete=function(e){var t=this;if(this.assertValidKey(e),e=""+e,r(this)){var n=i(this,{type:"delete",object:this,name:e});if(!n)return!1}if(this._has(e)){var o=c(),s=a(this),n=s||o?{type:"delete",object:this,oldValue:this._data[e].value,name:e}:null;return o&&f(n),be(function(){t._keys.remove(e),t._updateHasMapEntry(e,!1),t._data[e].setNewValue(void 0),t._data[e]=void 0}),s&&u(this,n),o&&p(),!0}return!1},e.prototype._updateHasMapEntry=function(e,t){var n=this._hasMap[e];return n?n.setNewValue(t):n=this._hasMap[e]=new pn(t,he,this.name+"."+e+"?",!1),n},e.prototype._updateValue=function(e,t){var n=this._data[e];if((t=n.prepareNewValue(t))!==fn){var r=c(),o=a(this),i=o||r?{type:"update",object:this,oldValue:n.value,name:e,newValue:t}:null;r&&f(i),n.setNewValue(t),o&&u(this,i),r&&p()}},e.prototype._addValue=function(e,t){var n=this;be(function(){var r=n._data[e]=new pn(t,n.enhancer,n.name+"."+e,!1);t=r.value,n._updateHasMapEntry(e,!0),n._keys.push(e)});var r=c(),o=a(this),i=o||r?{type:"add",object:this,name:e,newValue:t}:null;r&&f(i),o&&u(this,i),r&&p()},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 v(this._keys.slice())},e.prototype.values=function(){return v(this._keys.map(this.get,this))},e.prototype.entries=function(){var e=this;return v(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 Ln(e)&&(e=e.toJS()),be(function(){je(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&&we("Cannot initialize map from "+e)}),this},e.prototype.clear=function(){var e=this;be(function(){xt(function(){e.keys().forEach(e.delete,e)})})},e.prototype.replace=function(e){var t=this;return be(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")),s(this,e)},e.prototype.intercept=function(e){return o(this,e)},e}();b(Vn.prototype,function(){return this.entries()});var Ln=Ce("ObservableMap",Vn),Pn=[];Object.freeze(Pn);var Cn=[],Mn=function(){},Nn=Object.prototype.hasOwnProperty,$n=["mobxGuid","resetId","spyListeners","strictMode","runId"],Bn=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}(),Un=new Bn,zn=!1,Gn=!1,Kn=!1,Hn=ye();Hn.__mobxInstanceCount?(Hn.__mobxInstanceCount++,setTimeout(function(){zn||Gn||Kn||(Kn=!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."))})):Hn.__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"}(n.IDerivationState||(n.IDerivationState={}));var Wn;!function(e){e[e.NONE=0]="NONE",e[e.LOG=1]="LOG",e[e.BREAK=2]="BREAK"}(Wn||(Wn={}));var Jn=function(){function e(e){this.cause=e}return e}(),qn=function(){function e(e,t){void 0===e&&(e="Reaction@"+ge()),this.name=e,this.onInvalidate=t,this.observing=[],this.newObserving=[],this.dependenciesState=n.IDerivationState.NOT_TRACKING,this.diffValue=0,this.runId=0,this.unboundDepsCount=0,this.__mapid="#"+ge(),this.isDisposed=!1,this._isScheduled=!1,this._isTrackPending=!1,this._isRunning=!1,this.isTracing=Wn.NONE}return e.prototype.onBecomeStale=function(){this.schedule()},e.prototype.schedule=function(){this._isScheduled||(this._isScheduled=!0,Un.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&&c()&&l({object:this,type:"scheduled-reaction"})),st())},e.prototype.track=function(e){at();var t,n=c();n&&(t=Date.now(),f({object:this,type:"reaction",fn:e})),this._isRunning=!0;var r=yt(this,e,void 0);this._isRunning=!1,this._isTrackPending=!1,this.isDisposed&&wt(this),dt(r)&&this.reportExceptionInDerivation(r.cause),n&&p({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),c()&&l({type:"error",message:n,error:e,object:this}),Un.globalReactionErrorHandlers.forEach(function(n){return n(e,t)})},e.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,this._isRunning||(at(),wt(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=Se(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 "+Ae(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}(),Yn=100,Fn=function(e){return e()},Xn=Ce("Reaction",qn),Qn=Nt(yn.default),Zn=Nt(yn.structural),er=function(e,t,n){if("string"==typeof t)return Qn.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?yn.structural:yn.default;return new gn(e,r.context,o,r.name||e.name||"",r.setter)};er.struct=Zn,er.equals=Nt;var tr={allowStateChanges:D,deepEqual:Pe,getAtom:qe,getDebugName:Fe,getDependencyTree:Xe,getAdministration:Ye,getGlobalState:We,getObserverTree:Ze,interceptReads:Ft,isComputingDerivation:bt,isSpyEnabled:c,onReactionError:kt,reserveArrayBuffer:g,resetGlobalState:Je,isolateGlobalState:Ke,shareGlobalState:He,spyReport:l,spyReportEnd:p,spyReportStart:f,setReactionScheduler:Vt},nr={Reaction:qn,untracked:xt,Atom:Zt,BaseAtom:Qt,useStrict:I,isStrictModeEnabled:j,spy:h,comparer:yn,asReference:Lt,asFlat:Ct,asStructure:Pt,asMap:Mt,isModifierDescriptor:ce,isObservableObject:te,isBoxedObservable:hn,isObservableArray:w,ObservableMap:Vn,isObservableMap:Ln,map:me,transaction:be,observable:En,computed:er,isObservable:ne,isComputed:$t,extendObservable:oe,extendShallowObservable:ie,observe:Bt,intercept:Gt,autorun:z,autorunAsync:K,when:G,reaction:H,action:mn,isAction:M,runInAction:C,expr:Wt,toJS:Jt,createTransformer:qt,whyRun:It,isArrayLike:Ne,extras:tr},rr=!1;for(var or in nr)!function(e){var t=nr[e];Object.defineProperty(nr,e,{get:function(){return rr||(rr=!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}})}(or);"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:h,extras:tr}),n.extras=tr,n.default=nr,n.Reaction=qn,n.untracked=xt,n.Atom=Zt,n.BaseAtom=Qt,n.useStrict=I,n.isStrictModeEnabled=j,n.spy=h,n.comparer=yn,n.asReference=Lt,n.asFlat=Ct,n.asStructure=Pt,n.asMap=Mt,n.isModifierDescriptor=ce,n.isObservableObject=te,n.isBoxedObservable=hn,n.isObservableArray=w,n.ObservableMap=Vn,n.isObservableMap=Ln,n.map=me,n.transaction=be,n.observable=En,n.computed=er,n.isObservable=ne,n.isComputed=$t,n.extendObservable=oe,n.extendShallowObservable=ie,n.observe=Bt,n.intercept=Gt,n.autorun=z,n.autorunAsync=K,n.when=G,n.reaction=H,n.action=mn,n.isAction=M,n.runInAction=C,n.expr=Wt,n.toJS=Jt,n.createTransformer=qt,n.whyRun=It,n.trace=jt,n.isArrayLike=Ne}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1])(1)}); //# sourceMappingURL=lib/mobx.umd.min.js.map