mobx.min.js 53.1 KB
/** MobX - (c) Michel Weststrate 2015, 2016 - MIT Licensed */
"use strict";function e(e,t){function n(){this.constructor=e}Ht(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),xe(function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)})}function r(e,t){var n=ct();try{var r=e.interceptors;if(r)for(var o=0,i=r.length;o<i&&(t=r[o](t),ye(!t||t.type,"Intercept handlers should return nothing or a change object"),t);o++);return t}finally{lt(n)}}function o(e){return e.changeListeners&&e.changeListeners.length>0}function i(e,t){var n=e.changeListeners||(e.changeListeners=[]);return n.push(t),xe(function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)})}function a(e,t){var n=ct(),r=e.changeListeners;if(r){r=r.slice();for(var o=0,i=r.length;o<i;o++)r[o](t);lt(n)}}function s(){return!!Rn.spyListeners.length}function u(e){if(Rn.spyListeners.length)for(var t=Rn.spyListeners,n=0,r=t.length;n<r;n++)t[n](e)}function c(e){u(Ae({},e,{spyReportStart:!0}))}function l(e){u(e?Ae({},e,Jt):Jt)}function p(e){return Rn.spyListeners.push(e),xe(function(){var t=Rn.spyListeners.indexOf(e);-1!==t&&Rn.spyListeners.splice(t,1)})}function h(){return"function"==typeof Symbol&&Symbol.iterator||"@@iterator"}function f(e){ye(!0!==e[Yt],"Illegal state: cannot recycle array as iterator"),Te(e,Yt,!0);var t=-1;return Te(e,"next",function(){return t++,{done:t>=this.length,value:t<this.length?this[t]:void 0}}),e}function d(e,t){Te(e,h(),t)}function v(e,t){void 0!==Object.setPrototypeOf?Object.setPrototypeOf(e.prototype,t):void 0!==e.prototype.__proto__?e.prototype.__proto__=t:e.prototype=t}function b(e){return{enumerable:!1,configurable:!1,get:function(){return this.get(e)},set:function(t){this.set(e,t)}}}function m(e){Object.defineProperty(en.prototype,""+e,b(e))}function y(e){for(var t=qt;t<e;t++)m(t);qt=e}function g(e){return Se(e)&&nn(e.$mobx)}function x(e){return sn[e]}function w(e,t){ye("function"==typeof t,x("m026")),ye("string"==typeof e&&e.length>0,"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=S(e,t,n,r);try{return t.apply(n,r)}finally{O(o)}}function S(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<a;l++)u[l]=r[l];c({type:"action",name:e,fn:t,object:n,arguments:u})}var p=ct();return Fe(),{prevDerivation:p,prevAllowStateChanges:j(!0),notifySpy:o,startTime:i}}function O(e){k(e.prevAllowStateChanges),Xe(),lt(e.prevDerivation),e.notifySpy&&l({time:Date.now()-e.startTime})}function A(e){ye(null===Rn.trackingDerivation,x("m028")),Rn.strictMode=e,Rn.allowStateChanges=!e}function I(){return Rn.strictMode}function D(e,t){var n,r=j(e);try{n=t()}finally{k(r)}return n}function j(e){var t=Rn.allowStateChanges;return Rn.allowStateChanges=e,t}function k(e){Rn.allowStateChanges=e}function T(e,t,n,r,o){function i(i,a,s,u,c){if(void 0===c&&(c=0),ye(o||R(arguments),"This function is a decorator, but it wasn't invoked like a decorator"),s){De(i,"__mobxLazyInitializers")||ke(i,"__mobxLazyInitializers",i.__mobxLazyInitializers&&i.__mobxLazyInitializers.slice()||[]);var l=s.value,p=s.initializer;return i.__mobxLazyInitializers.push(function(t){e(t,a,p?p.call(t):l,u,s)}),{enumerable:r,configurable:!0,get:function(){return!0!==this.__mobxDidRunLazyInitializers&&V(this),t.call(this,a)},set:function(e){!0!==this.__mobxDidRunLazyInitializers&&V(this),n.call(this,a,e)}}}var h={enumerable:r,configurable:!0,get:function(){return this.__mobxInitializedProps&&!0===this.__mobxInitializedProps[a]||E(this,a,void 0,e,u,s),t.call(this,a)},set:function(t){this.__mobxInitializedProps&&!0===this.__mobxInitializedProps[a]?n.call(this,a,t):E(this,a,t,e,u,s)}};return(arguments.length<3||5===arguments.length&&c<3)&&Object.defineProperty(i,a,h),h}return o?function(){if(R(arguments))return i.apply(null,arguments);var e=arguments,t=arguments.length;return function(n,r,o){return i(n,r,o,e,t)}}:i}function E(e,t,n,r,o,i){De(e,"__mobxInitializedProps")||ke(e,"__mobxInitializedProps",{}),e.__mobxInitializedProps[t]=!0,r(e,t,n,o,i)}function V(e){!0!==e.__mobxDidRunLazyInitializers&&e.__mobxLazyInitializers&&(ke(e,"__mobxDidRunLazyInitializers",!0),e.__mobxDidRunLazyInitializers&&e.__mobxLazyInitializers.forEach(function(t){return t(e)}))}function R(e){return(2===e.length||3===e.length)&&"string"==typeof e[1]}function L(e){return function(t,n,r){return r&&"function"==typeof r.value?(r.value=w(e,r.value),r.enumerable=!1,r.configurable=!0,r):un(e).apply(this,arguments)}}function P(e,t,n){var r="string"==typeof e?e:e.name||"<unnamed action>",o="function"==typeof e?e:t,i="function"==typeof e?t:n;return ye("function"==typeof o,x("m002")),ye(0===o.length,x("m003")),ye("string"==typeof r&&r.length>0,"actions should have valid names, got: '"+r+"'"),_(r,o,i,void 0)}function M(e){return"function"==typeof e&&!0===e.isMobxAction}function C(e,t,n){var r=function(){return _(t,n,e,arguments)};r.isMobxAction=!0,ke(e,t,r)}function $(e,t,n){function r(){i(s)}var o,i,a;"string"==typeof e?(o=e,i=t,a=n):(o=e.name||"Autorun@"+be(),i=e,a=t),ye("function"==typeof i,x("m004")),ye(!1===M(i),x("m005")),a&&(i=i.bind(a));var s=new Pn(o,function(){this.track(r)});return s.schedule(),s.getDisposer()}function B(e,t,n,r){var o,i,a,s;return"string"==typeof e?(o=e,i=t,a=n,s=r):(o="When@"+be(),i=e,a=t,s=n),$(o,function(e){if(i.call(s)){e.dispose();var t=ct();a.call(s),lt(t)}})}function U(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@"+be(),a=e,s=t,u=n),ye(!1===M(a),x("m006")),void 0===s&&(s=1),u&&(a=a.bind(u));var c=!1,l=new Pn(i,function(){c||(c=!0,setTimeout(function(){c=!1,l.isDisposed||l.track(o)},s))});return l.schedule(),l.getDisposer()}function N(e,t,n){function r(){if(!u.isDisposed){var n=!1;u.track(function(){var t=e(u);n=Ie(o.compareStructural,i,t),i=t}),a&&o.fireImmediately&&t(i,u),a||!0!==n||t(i,u),a&&(a=!1)}}arguments.length>3&&me(x("m007")),ie(e)&&me(x("m008"));var o;o="object"==typeof n?n:{},o.name=o.name||e.name||t.name||"Reaction@"+be(),o.fireImmediately=!0===n||!0===o.fireImmediately,o.delay=o.delay||0,o.compareStructural=o.compareStructural||o.struct||!1,t=ln(o.name,o.context?t.bind(o.context):t),o.context&&(e=e.bind(o.context));var i,a=!0,s=!1,u=new Pn(o.name,function(){a||o.delay<1?r():s||(s=!0,setTimeout(function(){s=!1,r()},o.delay))});return u.schedule(),u.getDisposer()}function z(e,t){if(q(e))return e.$mobx;ye(Object.isExtensible(e),x("m035")),Oe(e)||(t=(e.constructor.name||"ObservableObject")+"@"+be()),t||(t="ObservableObject@"+be());var n=new fn(e,t);return Te(e,"$mobx",n),n}function H(e,t,n,r){if(e.values[t])return ye("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(ie(n.value)){var o=n.value;G(e,t,o.initialValue,o.enhancer)}else M(n.value)&&!0===n.value.autoBind?C(e.target,t,n.value.originalFn):hn(n.value)?W(e,t,n.value):G(e,t,n.value,r);else K(e,t,n.get,n.set,!1,!0)}function G(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 on(o,i,e.name+"."+n,!1)).value,Object.defineProperty(e.target,n,J(n)),X(e,e.target,n,o)}function K(e,t,n,r,o,i){i&&Ve(e.target,t),e.values[t]=new pn(n,e.target,o,e.name+"."+t,r),i&&Object.defineProperty(e.target,t,Y(t))}function W(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,Y(t))}function J(e){return dn[e]||(dn[e]={configurable:!0,enumerable:!0,get:function(){return this.$mobx.values[e].get()},set:function(t){F(this,e,t)}})}function Y(e){return vn[e]||(vn[e]={configurable:!0,enumerable:!1,get:function(){return this.$mobx.values[e].get()},set:function(t){return this.$mobx.values[e].set(t)}})}function F(e,n,i){var u=e.$mobx,p=u.values[n];if(t(u)){var h=r(u,{type:"update",object:e,name:n,newValue:i});if(!h)return;i=h.newValue}if((i=p.prepareNewValue(i))!==rn){var f=o(u),d=s(),h=f||d?{type:"update",object:e,oldValue:p.value,name:n,newValue:i}:null;d&&c(h),p.setNewValue(i),f&&a(u,h),d&&l()}}function X(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 q(e){return!!Se(e)&&(V(e),bn(e.$mobx))}function Q(e,t){if(null===e||void 0===e)return!1;if(void 0!==t){if(g(e)||In(e))throw new Error(x("m019"));if(q(e)){var n=e.$mobx;return n.values&&!!n.values[t]}return!1}return q(e)||!!e.$mobx||Wt(e)||$n(e)||hn(e)}function Z(e){return ye(!!e,":("),T(function(t,n,r,o,i){Ve(t,n),ye(!i||!i.get,x("m022")),G(z(t,void 0),n,r,e)},function(e){var t=this.$mobx.values[e];if(void 0!==t)return t.get()},function(e,t){F(this,e,t)},!0,!1)}function ee(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return ne(e,se,t)}function te(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return ne(e,ce,t)}function ne(e,t,n){ye(arguments.length>=2,x("m014")),ye("object"==typeof e,x("m015")),ye(!In(e),x("m016")),n.forEach(function(e){ye("object"==typeof e,x("m017")),ye(!Q(e),x("m018"))});for(var r=z(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&&!Ee(e,s))continue;var u=Object.getOwnPropertyDescriptor(a,s);H(r,s,u,t)}}return e}function re(e){if(void 0===e&&(e=void 0),"string"==typeof arguments[1])return mn.apply(null,arguments);if(ye(arguments.length<=1,x("m021")),ye(!ie(e),x("m020")),Q(e))return e;var t=se(e,void 0,void 0);return t!==e?t:Sn.box(e)}function oe(e){me("Expected one or two arguments to observable."+e+". Did you accidentally try to use observable."+e+" as decorator?")}function ie(e){return"object"==typeof e&&null!==e&&!0===e.isMobxModifierDescriptor}function ae(e,t){return ye(!ie(t),"Modifiers cannot be nested"),{isMobxModifierDescriptor:!0,initialValue:t,enhancer:e}}function se(e,t,n){return ie(e)&&me("You tried to assign a modifier wrapped value to a collection, please define modifiers when creating the collection, not when modifying it"),Q(e)?e:Array.isArray(e)?Sn.array(e,n):Oe(e)?Sn.object(e,n):$e(e)?Sn.map(e,n):e}function ue(e,t,n){return ie(e)&&me("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:q(e)||g(e)||In(e)?e:Array.isArray(e)?Sn.shallowArray(e,n):Oe(e)?Sn.shallowObject(e,n):$e(e)?Sn.shallowMap(e,n):me("The shallow modifier / decorator can only used in combination with arrays, objects and maps")}function ce(e){return e}function le(e,t,n){if(Le(e,t))return t;if(Q(e))return e;if(Array.isArray(e))return new en(e,le,n);if($e(e))return new An(e,le,n);if(Oe(e)){var r={};return z(r,n),ne(r,le,[e]),r}return e}function pe(e,t,n){return Le(e,t)?t:e}function he(e,t){return void 0===t&&(t=void 0),ge(x("m023")),fe.apply(void 0,arguments)}function fe(e,t){return void 0===t&&(t=void 0),_("",e)}function de(e){return ge("`mobx.map` is deprecated, use `new ObservableMap` or `mobx.observable.map` instead"),Sn.map(e)}function ve(){return global}function be(){return++Rn.mobxGuid}function me(e,t){throw ye(!1,e,t),"X"}function ye(e,t,n){if(!e)throw new Error("[mobx] Invariant failed: "+t+(n?" in '"+n+"'":""))}function ge(e){return-1===jn.indexOf(e)&&(jn.push(e),console.error("[mobx] Deprecated: "+e),!0)}function xe(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}function we(e){var t=[];return e.forEach(function(e){-1===t.indexOf(e)&&t.push(e)}),t}function _e(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 Se(e){return null!==e&&"object"==typeof e}function Oe(e){if(null===e||"object"!=typeof e)return!1;var t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}function Ae(){for(var e=arguments[0],t=1,n=arguments.length;t<n;t++){var r=arguments[t];for(var o in r)De(r,o)&&(e[o]=r[o])}return e}function Ie(e,t,n){return"number"==typeof t&&isNaN(t)?"number"!=typeof n||!isNaN(n):e?!Le(t,n):t!==n}function De(e,t){return Tn.call(e,t)}function je(e,t){for(var n=0;n<t.length;n++)ke(e,t[n],e[t[n]])}function ke(e,t,n){Object.defineProperty(e,t,{enumerable:!1,writable:!0,configurable:!0,value:n})}function Te(e,t,n){Object.defineProperty(e,t,{enumerable:!1,writable:!1,configurable:!0,value:n})}function Ee(e,t){var n=Object.getOwnPropertyDescriptor(e,t);return!n||!1!==n.configurable&&!1!==n.writable}function Ve(e,t){ye(Ee(e,t),"Cannot make property '"+t+"' observable, it is not configurable and writable in the target object")}function Re(e){var t=[];for(var n in e)t.push(n);return t}function Le(e,t){if(null===e&&null===t)return!0;if(void 0===e&&void 0===t)return!0;if("object"!=typeof e)return e===t;var n=Me(e),r=Ce(e);if(n!==Me(t))return!1;if(r!==Ce(t))return!1;if(n){if(e.length!==t.length)return!1;for(var o=e.length-1;o>=0;o--)if(!Le(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&&Le(t.get(n),e)}),i}if("object"==typeof e&&"object"==typeof t){if(null===e||null===t)return!1;if(Ce(e)&&Ce(t))return e.size===t.size&&Le(Sn.shallowMap(e).entries(),Sn.shallowMap(t).entries());if(Re(e).length!==Re(t).length)return!1;for(var a in e){if(!(a in t))return!1;if(!Le(e[a],t[a]))return!1}return!0}return!1}function Pe(e,t){var n="isMobX"+e;return t.prototype[n]=!0,function(e){return Se(e)&&!0===e[n]}}function Me(e){return Array.isArray(e)||g(e)}function Ce(e){return $e(e)||In(e)}function $e(e){return void 0!==ve().Map&&e instanceof ve().Map}function Be(){return"function"==typeof Symbol&&Symbol.toPrimitive||"@@toPrimitive"}function Ue(e){return null===e?null:"object"==typeof e?""+e:e}function Ne(){var e=ve(),t=Rn;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?Rn=e.__mobxGlobal:e.__mobxGlobal=t}function ze(){return Rn}function He(){Rn.resetId++;var e=new Vn;for(var t in e)-1===En.indexOf(t)&&(Rn[t]=e[t]);Rn.allowStateChanges=!Rn.strictMode}function Ge(e){return e.observers&&e.observers.length>0}function Ke(e){return e.observers}function We(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 Je(e,t){if(1===e.observers.length)e.observers.length=0,Ye(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 Ye(e){e.isPendingUnobservation||(e.isPendingUnobservation=!0,Rn.pendingUnobservations.push(e))}function Fe(){Rn.inBatch++}function Xe(){if(0==--Rn.inBatch){dt();for(var e=Rn.pendingUnobservations,t=0;t<e.length;t++){var n=e[t];n.isPendingUnobservation=!1,0===n.observers.length&&n.onBecomeUnobserved()}Rn.pendingUnobservations=[]}}function qe(e){var t=Rn.trackingDerivation;null!==t?t.runId!==e.lastAccessedBy&&(e.lastAccessedBy=t.runId,t.newObserving[t.unboundDepsCount++]=e):0===e.observers.length&&Ye(e)}function Qe(e){if(e.lowestObserverState!==exports.IDerivationState.STALE){e.lowestObserverState=exports.IDerivationState.STALE;for(var t=e.observers,n=t.length;n--;){var r=t[n];r.dependenciesState===exports.IDerivationState.UP_TO_DATE&&r.onBecomeStale(),r.dependenciesState=exports.IDerivationState.STALE}}}function Ze(e){if(e.lowestObserverState!==exports.IDerivationState.STALE){e.lowestObserverState=exports.IDerivationState.STALE;for(var t=e.observers,n=t.length;n--;){var r=t[n];r.dependenciesState===exports.IDerivationState.POSSIBLY_STALE?r.dependenciesState=exports.IDerivationState.STALE:r.dependenciesState===exports.IDerivationState.UP_TO_DATE&&(e.lowestObserverState=exports.IDerivationState.UP_TO_DATE)}}}function et(e){if(e.lowestObserverState===exports.IDerivationState.UP_TO_DATE){e.lowestObserverState=exports.IDerivationState.POSSIBLY_STALE;for(var t=e.observers,n=t.length;n--;){var r=t[n];r.dependenciesState===exports.IDerivationState.UP_TO_DATE&&(r.dependenciesState=exports.IDerivationState.POSSIBLY_STALE,r.onBecomeStale())}}}function tt(e){return e instanceof Ln}function nt(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=ct(),n=e.observing,r=n.length,o=0;o<r;o++){var i=n[o];if(hn(i)){try{i.get()}catch(e){return lt(t),!0}if(e.dependenciesState===exports.IDerivationState.STALE)return lt(t),!0}}return pt(e),lt(t),!1}}function rt(){return null!==Rn.trackingDerivation}function ot(e){var t=e.observers.length>0;Rn.computationDepth>0&&t&&me(x("m031")+e.name),!Rn.allowStateChanges&&t&&me(x(Rn.strictMode?"m030a":"m030b")+e.name)}function it(e,t,n){pt(e),e.newObserving=new Array(e.observing.length+100),e.unboundDepsCount=0,e.runId=++Rn.runId;var r=Rn.trackingDerivation;Rn.trackingDerivation=e;var o;try{o=t.call(n)}catch(e){o=new Ln(e)}return Rn.trackingDerivation=r,at(e),o}function at(e){var t=e.observing,n=e.observing=e.newObserving,r=exports.IDerivationState.UP_TO_DATE;e.newObserving=null;for(var o=0,i=e.unboundDepsCount,a=0;a<i;a++){var s=n[a];0===s.diffValue&&(s.diffValue=1,o!==a&&(n[o]=s),o++),s.dependenciesState>r&&(r=s.dependenciesState)}for(n.length=o,i=t.length;i--;){var s=t[i];0===s.diffValue&&Je(s,e),s.diffValue=0}for(;o--;){var s=n[o];1===s.diffValue&&(s.diffValue=0,We(s,e))}r!==exports.IDerivationState.UP_TO_DATE&&(e.dependenciesState=r,e.onBecomeStale())}function st(e){var t=e.observing;e.observing=[];for(var n=t.length;n--;)Je(t[n],e);e.dependenciesState=exports.IDerivationState.NOT_TRACKING}function ut(e){var t=ct(),n=e();return lt(t),n}function ct(){var e=Rn.trackingDerivation;return Rn.trackingDerivation=null,e}function lt(e){Rn.trackingDerivation=e}function pt(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 ht(e){ye(this&&this.$mobx&&$n(this.$mobx),"Invalid `this`"),ye(!this.$mobx.errorHandler,"Only one onErrorHandler can be registered"),this.$mobx.errorHandler=e}function ft(e){return Rn.globalReactionErrorHandlers.push(e),function(){var t=Rn.globalReactionErrorHandlers.indexOf(e);t>=0&&Rn.globalReactionErrorHandlers.splice(t,1)}}function dt(){Rn.inBatch>0||Rn.isRunningReactions||Cn(vt)}function vt(){Rn.isRunningReactions=!0;for(var e=Rn.pendingReactions,t=0;e.length>0;){++t===Mn&&(console.error("Reaction doesn't converge to a stable state after "+Mn+" 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;r<o;r++)n[r].runReaction()}Rn.isRunningReactions=!1}function bt(e){var t=Cn;Cn=function(n){return e(function(){return t(n)})}}function mt(e){return ge("asReference is deprecated, use observable.ref instead"),Sn.ref(e)}function yt(e){return ge("asStructure is deprecated. Use observable.struct, computed.struct or reaction options instead."),Sn.struct(e)}function gt(e){return ge("asFlat is deprecated, use observable.shallow instead"),Sn.shallow(e)}function xt(e){return ge("asMap is deprecated, use observable.map or observable.shallowMap instead"),Sn.map(e||{})}function wt(e){return T(function(t,n,r,o,i){ye(void 0!==i,x("m009")),ye("function"==typeof i.get,x("m010")),K(z(t,""),n,i.get,i.set,e,!1)},function(e){var t=this.$mobx.values[e];if(void 0!==t)return t.get()},function(e,t){this.$mobx.values[e].set(t)},!1,!1)}function _t(e,t){if("object"==typeof e&&null!==e){if(g(e))return ye(void 0===t,x("m036")),e.$mobx.atom;if(In(e)){var n=e;if(void 0===t)return _t(n._keys);var r=n._data[t]||n._hasMap[t];return ye(!!r,"the entry '"+t+"' does not exist in the observable map '"+Ot(e)+"'"),r}if(V(e),q(e)){if(!t)return me("please specify a property");var r=e.$mobx.values[t];return ye(!!r,"no observable property '"+t+"' found on the observable object '"+Ot(e)+"'"),r}if(Wt(e)||hn(e)||$n(e))return e}else if("function"==typeof e&&$n(e.$mobx))return e.$mobx;return me("Cannot obtain atom from "+e)}function St(e,t){return ye(e,"Expecting some object"),void 0!==t?St(_t(e,t)):Wt(e)||hn(e)||$n(e)?e:In(e)?e:(V(e),e.$mobx?e.$mobx:void ye(!1,"Cannot obtain administration from "+e))}function Ot(e,t){var n;return n=void 0!==t?_t(e,t):q(e)||In(e)?St(e):_t(e),n.name}function At(e,t){if(null===e||void 0===e)return!1;if(void 0!==t){if(!1===q(e))return!1;var n=_t(e,t);return hn(n)}return hn(e)}function It(e,t,n,r){return"function"==typeof n?jt(e,t,n,r):Dt(e,t,n)}function Dt(e,t,n){return St(e).observe(t,n)}function jt(e,t,n,r){return St(e,t).observe(n,r)}function kt(e,t,n){return"function"==typeof n?Et(e,t,n):Tt(e,t)}function Tt(e,t){return St(e).intercept(t)}function Et(e,t,n){return St(e,t).intercept(n)}function Vt(e,t){return rt()||console.warn(x("m013")),Nn(e,{context:t}).get()}function Rt(e,t,n){function r(r){return t&&n.push([e,r]),r}if(void 0===t&&(t=!0),void 0===n&&(n=[]),Q(e)){if(t&&null===n&&(n=[]),t&&null!==e&&"object"==typeof e)for(var o=0,i=n.length;o<i;o++)if(n[o][0]===e)return n[o][1];if(g(e)){var a=r([]),s=e.map(function(e){return Rt(e,t,n)});a.length=s.length;for(var o=0,i=s.length;o<i;o++)a[o]=s[o];return a}if(q(e)){var a=r({});for(var u in e)a[u]=Rt(e[u],t,n);return a}if(In(e)){var c=r({});return e.forEach(function(e,r){return c[r]=Rt(e,t,n)}),c}if(an(e))return Rt(e.get(),t,n)}return e}function Lt(t,n){ye("function"==typeof t&&t.length<2,"createTransformer expects a function that accepts one argument");var r={},o=Rn.resetId,i=function(o){function i(e,n){var r=o.call(this,function(){return t(n)},void 0,!1,"Transformer-"+t.name+"-"+e,void 0)||this;return r.sourceIdentifier=e,r.sourceObject=n,r}return e(i,o),i.prototype.onBecomeUnobserved=function(){var e=this.value;o.prototype.onBecomeUnobserved.call(this),delete r[this.sourceIdentifier],n&&n(e,this.sourceObject)},i}(pn);return function(e){o!==Rn.resetId&&(r={},o=Rn.resetId);var t=Pt(e),n=r[t];return n?n.get():(n=r[t]=new i(t,e),n.get())}}function Pt(e){if("string"==typeof e||"number"==typeof e)return e;if(null===e||"object"!=typeof e)throw new Error("[mobx] transform expected some kind of object or primitive value, got: "+e);var t=e.$transformId;return void 0===t&&(t=be(),ke(e,"$transformId",t)),t}function Mt(e){return console.log(e),e}function Ct(e,t){switch(arguments.length){case 0:if(!(e=Rn.trackingDerivation))return Mt(x("m024"));break;case 2:e=_t(e,t)}return e=_t(e),hn(e)?Mt(e.whyRun()):$n(e)?Mt(e.whyRun()):me(x("m025"))}function $t(e,t){return Bt(_t(e,t))}function Bt(e){var t={name:e.name};return e.observing&&e.observing.length>0&&(t.dependencies=we(e.observing).map(Bt)),t}function Ut(e,t){return Nt(_t(e,t))}function Nt(e){var t={name:e.name};return Ge(e)&&(t.observers=Ke(e).map(Nt)),t}function zt(e,t,n){var r;if(In(e)||g(e)||an(e))r=St(e);else{if(!q(e))return me("Expected observable map, object or array as first array");if("string"!=typeof t)return me("InterceptReads can only be used with a specific property, not with an object in general");r=St(e,t)}return void 0!==r.dehancer?me("An intercept reader was already established"):(r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0})}Object.defineProperty(exports,"__esModule",{value:!0});var Ht=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])},Gt=function(){function e(e){void 0===e&&(e="Atom@"+be()),this.name=e,this.isPendingUnobservation=!0,this.observers=[],this.observersIndexes={},this.diffValue=0,this.lastAccessedBy=0,this.lowestObserverState=exports.IDerivationState.NOT_TRACKING}return e.prototype.onBecomeUnobserved=function(){},e.prototype.reportObserved=function(){qe(this)},e.prototype.reportChanged=function(){Fe(),Qe(this),Xe()},e.prototype.toString=function(){return this.name},e}(),Kt=function(t){function n(e,n,r){void 0===e&&(e="Atom@"+be()),void 0===n&&(n=kn),void 0===r&&(r=kn);var o=t.call(this,e)||this;return o.name=e,o.onBecomeObservedHandler=n,o.onBecomeUnobservedHandler=r,o.isPendingUnobservation=!1,o.isBeingTracked=!1,o}return e(n,t),n.prototype.reportObserved=function(){return Fe(),t.prototype.reportObserved.call(this),this.isBeingTracked||(this.isBeingTracked=!0,this.onBecomeObservedHandler()),Xe(),!!Rn.trackingDerivation},n.prototype.onBecomeUnobserved=function(){this.isBeingTracked=!1,this.onBecomeUnobservedHandler()},n}(Gt),Wt=Pe("Atom",Gt),Jt={spyReportEnd:!0},Yt="__$$iterating",Ft=1e4,Xt=function(){var e=!1,t={};return Object.defineProperty(t,"0",{set:function(){e=!0}}),Object.create(t)[0]=1,!1===e}(),qt=0,Qt=function(){function e(){}return e}();v(Qt,Array.prototype);var Zt=function(){function e(e,t,n,r){this.array=n,this.owned=r,this.values=[],this.lastKnownLength=0,this.interceptors=null,this.changeListeners=null,this.atom=new Gt(e||"ObservableArray@"+be()),this.enhancer=function(n,r){return t(n,r,e+"[..]")}}return e.prototype.dehanceValue=function(e){return void 0!==this.dehancer?this.dehancer(e):e},e.prototype.dehanceValues=function(e){return void 0!==this.dehancer?e.map(this.dehancer):e},e.prototype.intercept=function(e){return n(this,e)},e.prototype.observe=function(e,t){return void 0===t&&(t=!1),t&&e({object:this.array,type:"splice",index:0,added:this.values.slice(),addedCount:this.values.length,removed:[],removedCount:0}),i(this,e)},e.prototype.getArrayLength=function(){return this.atom.reportObserved(),this.values.length},e.prototype.setArrayLength=function(e){if("number"!=typeof e||e<0)throw new Error("[mobx.array] Out of range: "+e);var t=this.values.length;if(e!==t)if(e>t){for(var n=new Array(e-t),r=0;r<e-t;r++)n[r]=void 0;this.spliceWithArray(t,0,n)}else this.spliceWithArray(e,t-e)},e.prototype.updateArrayLength=function(e,t){if(e!==this.lastKnownLength)throw new Error("[mobx] Modification exception: the internal structure of an observable array was changed. Did you use peek() to change it?");this.lastKnownLength+=t,t>0&&e+t+1>qt&&y(e+t+1)},e.prototype.spliceWithArray=function(e,n,o){var i=this;ot(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 Dn;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<Ft)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&&s(),i=o(this),u=i||r?{object:this.array,type:"update",index:e,newValue:t,oldValue:n}:null;r&&c(u),this.atom.reportChanged(),i&&a(this,u),r&&l()},e.prototype.notifyArraySplice=function(e,t,n){var r=!this.owned&&s(),i=o(this),u=i||r?{object:this.array,type:"splice",index:e,removed:n,added:t,removedCount:n.length,addedCount:t.length}:null;r&&c(u),this.atom.reportChanged(),i&&a(this,u),r&&l()},e}(),en=function(n){function o(e,t,r,o){void 0===r&&(r="ObservableArray@"+be()),void 0===o&&(o=!1);var i=n.call(this)||this,a=new Zt(r,t,i,o);return Te(i,"$mobx",a),e&&e.length&&i.spliceWithArray(0,0,e),Xt&&Object.defineProperty(a.array,"0",tn),i}return e(o,n),o.prototype.intercept=function(e){return this.$mobx.intercept(e)},o.prototype.observe=function(e,t){return void 0===t&&(t=!1),this.$mobx.observe(e,t)},o.prototype.clear=function(){return this.splice(0)},o.prototype.concat=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this.$mobx.atom.reportObserved(),Array.prototype.concat.apply(this.peek(),e.map(function(e){return g(e)?e.peek():e}))},o.prototype.replace=function(e){return this.$mobx.spliceWithArray(0,this.$mobx.values.length,e)},o.prototype.toJS=function(){return this.slice()},o.prototype.toJSON=function(){return this.toJS()},o.prototype.peek=function(){return this.$mobx.atom.reportObserved(),this.$mobx.dehanceValues(this.$mobx.values)},o.prototype.find=function(e,t,n){void 0===n&&(n=0);var r=this.findIndex.apply(this,arguments);return-1===r?void 0:this.get(r)},o.prototype.findIndex=function(e,t,n){void 0===n&&(n=0);for(var r=this.peek(),o=r.length,i=n;i<o;i++)if(e.call(t,r[i],i,this))return i;return-1},o.prototype.splice=function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];switch(arguments.length){case 0:return[];case 1:return this.$mobx.spliceWithArray(e);case 2:return this.$mobx.spliceWithArray(e,t)}return this.$mobx.spliceWithArray(e,t,n)},o.prototype.spliceWithArray=function(e,t,n){return this.$mobx.spliceWithArray(e,t,n)},o.prototype.push=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=this.$mobx;return n.spliceWithArray(n.values.length,0,e),n.values.length},o.prototype.pop=function(){return this.splice(Math.max(this.$mobx.values.length-1,0),1)[0]},o.prototype.shift=function(){return this.splice(0,1)[0]},o.prototype.unshift=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=this.$mobx;return n.spliceWithArray(0,0,e),n.values.length},o.prototype.reverse=function(){var e=this.slice();return e.reverse.apply(e,arguments)},o.prototype.sort=function(e){var t=this.slice();return t.sort.apply(t,arguments)},o.prototype.remove=function(e){var t=this.$mobx.dehanceValues(this.$mobx.values).indexOf(e);return t>-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<t?o.slice(0,e).concat(o.slice(e+1,t+1),[o[e]],o.slice(t+1)):o.slice(0,t).concat([o[e]],o.slice(t,e),o.slice(e+1)),this.replace(r)}},o.prototype.get=function(e){var t=this.$mobx;if(t){if(e<t.values.length)return t.atom.reportObserved(),t.dehanceValue(t.values[e]);console.warn("[mobx.array] Attempt to read an array index ("+e+") that is out of bounds ("+t.values.length+"). Please check length first. Out of bound indices will not be tracked by MobX")}},o.prototype.set=function(e,n){var o=this.$mobx,i=o.values;if(e<i.length){ot(o.atom);var a=i[e];if(t(o)){var s=r(o,{type:"update",object:this,index:e,newValue:n});if(!s)return;n=s.newValue}n=o.enhancer(n,a);n!==a&&(i[e]=n,o.notifyArrayChildUpdate(e,n,a))}else{if(e!==i.length)throw new Error("[mobx.array] Index out of bounds, "+e+" is larger than "+i.length);o.spliceWithArray(e,0,[n])}},o}(Qt);d(en.prototype,function(){return f(this.slice())}),Object.defineProperty(en.prototype,"length",{enumerable:!1,configurable:!0,get:function(){return this.$mobx.getArrayLength()},set:function(e){this.$mobx.setArrayLength(e)}}),["every","filter","forEach","indexOf","join","lastIndexOf","map","reduce","reduceRight","slice","some","toString","toLocaleString"].forEach(function(e){var t=Array.prototype[e];ye("function"==typeof t,"Base function not defined on Array prototype: '"+e+"'"),ke(en.prototype,e,function(){return t.apply(this.peek(),arguments)})}),je(en.prototype,["constructor","intercept","observe","clear","concat","get","replace","toJS","toJSON","peek","find","findIndex","splice","spliceWithArray","push","pop","set","shift","unshift","reverse","sort","remove","move","toString","toLocaleString"]);var tn=b(0);y(1e3)
;var nn=Pe("ObservableArrayAdministration",Zt),rn={},on=function(p){function h(e,t,n,r){void 0===n&&(n="ObservableValue@"+be()),void 0===r&&(r=!0);var o=p.call(this,n)||this;return o.enhancer=t,o.hasUnreportedChange=!1,o.dehancer=void 0,o.value=t(e,void 0,n),r&&s()&&u({type:"create",object:o,newValue:o.value}),o}return e(h,p),h.prototype.dehanceValue=function(e){return void 0!==this.dehancer?this.dehancer(e):e},h.prototype.set=function(e){var t=this.value;if((e=this.prepareNewValue(e))!==rn){var n=s();n&&c({type:"update",object:this,newValue:e,oldValue:t}),this.setNewValue(e),n&&l()}},h.prototype.prepareNewValue=function(e){if(ot(this),t(this)){var n=r(this,{object:this,type:"update",newValue:e});if(!n)return rn;e=n.newValue}return e=this.enhancer(e,this.value,this.name),this.value!==e?e:rn},h.prototype.setNewValue=function(e){var t=this.value;this.value=e,this.reportChanged(),o(this)&&a(this,{type:"update",object:this,newValue:e,oldValue:t})},h.prototype.get=function(){return this.reportObserved(),this.dehanceValue(this.value)},h.prototype.intercept=function(e){return n(this,e)},h.prototype.observe=function(e,t){return t&&e({object:this,type:"update",newValue:this.value,oldValue:void 0}),i(this,e)},h.prototype.toJSON=function(){return this.get()},h.prototype.toString=function(){return this.name+"["+this.value+"]"},h.prototype.valueOf=function(){return Ue(this.get())},h}(Gt);on.prototype[Be()]=on.prototype.valueOf;var an=Pe("ObservableValue",on),sn={m001:"It is not allowed to assign new values to @action fields",m002:"`runInAction` expects a function",m003:"`runInAction` expects a function without arguments",m004:"autorun expects a function",m005:"Warning: attempted to pass an action to autorun. Actions are untracked and will not trigger on state changes. Use `reaction` or wrap only your state modification code in an action.",m006:"Warning: attempted to pass an action to autorunAsync. Actions are untracked and will not trigger on state changes. Use `reaction` or wrap only your state modification code in an action.",m007:"reaction only accepts 2 or 3 arguments. If migrating from MobX 2, please provide an options object",m008:"wrapping reaction expression in `asReference` is no longer supported, use options object instead",m009:"@computed can only be used on getter functions, like: '@computed get myProps() { return ...; }'. It looks like it was used on a property.",m010:"@computed can only be used on getter functions, like: '@computed get myProps() { return ...; }'",m011:"First argument to `computed` should be an expression. If using computed as decorator, don't pass it arguments",m012:"computed takes one or two arguments if used as function",m013:"[mobx.expr] 'expr' should only be used inside other reactive functions.",m014:"extendObservable expected 2 or more arguments",m015:"extendObservable expects an object as first argument",m016:"extendObservable should not be used on maps, use map.merge instead",m017:"all arguments of extendObservable should be objects",m018:"extending an object with another observable (object) is not supported. Please construct an explicit propertymap, using `toJS` if need. See issue #540",m019:"[mobx.isObservable] isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead.",m020:"modifiers can only be used for individual object properties",m021:"observable expects zero or one arguments",m022:"@observable can not be used on getters, use @computed instead",m023:"Using `transaction` is deprecated, use `runInAction` or `(@)action` instead.",m024:"whyRun() can only be used if a derivation is active, or by passing an computed value / reaction explicitly. If you invoked whyRun from inside a computation; the computation is currently suspended but re-evaluating because somebody requested its value.",m025:"whyRun can only be used on reactions and computed values",m026:"`action` can only be invoked on functions",m028:"It is not allowed to set `useStrict` when a derivation is running",m029:"INTERNAL ERROR only onBecomeUnobserved shouldn't be called twice in a row",m030a:"Since strict-mode is enabled, changing observed observable values outside actions is not allowed. Please wrap the code in an `action` if this change is intended. Tried to modify: ",m030b:"Side effects like changing state are not allowed at this point. Are you trying to modify state from, for example, the render function of a React component? Tried to modify: ",m031:"Computed values are not allowed to cause side effects by changing observables that are already being observed. Tried to modify: ",m032:"* This computation is suspended (not in use by any reaction) and won't run automatically.\n\tDidn't expect this computation to be suspended at this point?\n\t  1. Make sure this computation is used by a reaction (reaction, autorun, observer).\n\t  2. Check whether you are using this computation synchronously (in the same stack as they reaction that needs it).",m033:"`observe` doesn't support the fire immediately property for observable maps.",m034:"`mobx.map` is deprecated, use `new ObservableMap` or `mobx.observable.map` instead",m035:"Cannot make the designated object observable; it is not extensible",m036:"It is not possible to get index atoms from arrays",m037:'Hi there! I\'m sorry you have just run into an exception.\nIf your debugger ends up here, know that some reaction (like the render() of an observer component, autorun or reaction)\nthrew an exception and that mobx caught it, to avoid that it brings the rest of your application down.\nThe original cause of the exception (the code that caused this reaction to run (again)), is still in the stack.\n\nHowever, more interesting is the actual stack trace of the error itself.\nHopefully the error is an instanceof Error, because in that case you can inspect the original stack of the error from where it was thrown.\nSee `error.stack` property, or press the very subtle "(...)" link you see near the console.error message that probably brought you here.\nThat stack is more interesting than the stack of this console.error itself.\n\nIf the exception you see is an exception you created yourself, make sure to use `throw new Error("Oops")` instead of `throw "Oops"`,\nbecause the javascript environment will only preserve the original stack trace in the first form.\n\nYou can also make sure the debugger pauses the next time this very same exception is thrown by enabling "Pause on caught exception".\n(Note that it might pause on many other, unrelated exception as well).\n\nIf that all doesn\'t help you out, feel free to open an issue https://github.com/mobxjs/mobx/issues!\n',m038:"Missing items in this list?\n    1. Check whether all used values are properly marked as observable (use isObservable to verify)\n    2. Make sure you didn't dereference values too early. MobX observes props, not primitives. E.g: use 'person.name' instead of 'name' in your computation.\n"},un=T(function(e,t,n,r,o){var i=r&&1===r.length?r[0]:n.name||t||"<unnamed action>";ke(e,t,ln(i,n))},function(e){return this[e]},function(){ye(!1,x("m001"))},!1,!0),cn=T(function(e,t,n){C(e,t,n)},function(e){return this[e]},function(){ye(!1,x("m001"))},!1,!1),ln=function(e,t,n,r){return 1===arguments.length&&"function"==typeof e?w(e.name||"<unnamed action>",e):2===arguments.length&&"function"==typeof t?w(e,t):1===arguments.length&&"string"==typeof e?L(e):L(t).apply(null,arguments)};ln.bound=function(e,t,n){if("function"==typeof e){var r=w("<not yet bound action>",e);return r.autoBind=!0,r}return cn.apply(null,arguments)};var pn=function(){function e(e,t,n,r,o){this.derivation=e,this.scope=t,this.compareStructural=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="#"+be(),this.value=void 0,this.isComputing=!1,this.isRunningSetter=!1,this.name=r||"ComputedValue@"+be(),o&&(this.setter=w(r+"-setter",o))}return e.prototype.onBecomeStale=function(){et(this)},e.prototype.onBecomeUnobserved=function(){st(this),this.value=void 0},e.prototype.get=function(){ye(!this.isComputing,"Cycle detected in computation "+this.name,this.derivation),0===Rn.inBatch?(Fe(),nt(this)&&(this.value=this.computeValue(!1)),Xe()):(qe(this),nt(this)&&this.trackAndCompute()&&Ze(this));var e=this.value;if(tt(e))throw e.cause;return e},e.prototype.peek=function(){var e=this.computeValue(!1);if(tt(e))throw e.cause;return e},e.prototype.set=function(e){if(this.setter){ye(!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 ye(!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.value=this.computeValue(!0);return tt(t)||Ie(this.compareStructural,t,e)},e.prototype.computeValue=function(e){this.isComputing=!0,Rn.computationDepth++;var t;if(e)t=it(this,this.derivation,this.scope);else try{t=this.derivation.call(this.scope)}catch(e){t=new Ln(e)}return Rn.computationDepth--,this.isComputing=!1,t},e.prototype.observe=function(e,t){var n=this,r=!0,o=void 0;return $(function(){var i=n.get();if(!r||t){var a=ct();e({type:"update",object:n,newValue:i,oldValue:o}),lt(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 Ue(this.get())},e.prototype.whyRun=function(){var e=Boolean(Rn.trackingDerivation),t=we(this.isComputing?this.newObserving:this.observing).map(function(e){return e.name}),n=we(Ke(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    "+_e(t)+"\n    "+(this.isComputing&&e?" (... or any observable accessed during the remainder of the current run)":"")+"\n\t"+x("m038")+"\n\n  * If the outcome of this computation changes, the following observers will be re-run:\n    "+_e(n)+"\n")},e}();pn.prototype[Be()]=pn.prototype.valueOf;var hn=Pe("ComputedValue",pn),fn=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 ye(!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}(),dn={},vn={},bn=Pe("ObservableObjectAdministration",fn),mn=Z(se),yn=Z(ue),gn=Z(ce),xn=Z(le),wn=Z(pe),_n=function(){function e(){}return e.prototype.box=function(e,t){return arguments.length>2&&oe("box"),new on(e,se,t)},e.prototype.shallowBox=function(e,t){return arguments.length>2&&oe("shallowBox"),new on(e,ce,t)},e.prototype.array=function(e,t){return arguments.length>2&&oe("array"),new en(e,se,t)},e.prototype.shallowArray=function(e,t){return arguments.length>2&&oe("shallowArray"),new en(e,ce,t)},e.prototype.map=function(e,t){return arguments.length>2&&oe("map"),new An(e,se,t)},e.prototype.shallowMap=function(e,t){return arguments.length>2&&oe("shallowMap"),new An(e,ce,t)},e.prototype.object=function(e,t){arguments.length>2&&oe("object");var n={};return z(n,t),ee(n,e),n},e.prototype.shallowObject=function(e,t){arguments.length>2&&oe("shallowObject");var n={};return z(n,t),te(n,e),n},e.prototype.ref=function(){return arguments.length<2?ae(ce,arguments[0]):gn.apply(null,arguments)},e.prototype.shallow=function(){return arguments.length<2?ae(ue,arguments[0]):yn.apply(null,arguments)},e.prototype.deep=function(){return arguments.length<2?ae(se,arguments[0]):mn.apply(null,arguments)},e.prototype.struct=function(){return arguments.length<2?ae(le,arguments[0]):xn.apply(null,arguments)},e}(),Sn=re;Object.getOwnPropertyNames(_n.prototype).filter(function(e){return"constructor"!==e}).forEach(function(e){return Sn[e]=_n.prototype[e]}),Sn.deep.struct=Sn.struct,Sn.ref.struct=function(){return arguments.length<2?ae(pe,arguments[0]):wn.apply(null,arguments)};var On={},An=function(){function e(e,t,n){void 0===t&&(t=se),void 0===n&&(n="ObservableMap@"+be()),this.enhancer=t,this.name=n,this.$mobx=On,this._data=Object.create(null),this._hasMap=Object.create(null),this._keys=new en(void 0,ce,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),fe(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 on(t,ce,this.name+"."+e+"?",!1),n},e.prototype._updateValue=function(e,t){var n=this._data[e];if((t=n.prepareNewValue(t))!==rn){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;fe(function(){var r=n._data[e]=new on(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 f(this._keys.slice())},e.prototype.values=function(){return f(this._keys.map(this.get,this))},e.prototype.entries=function(){var e=this;return f(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 In(e)&&(e=e.toJS()),fe(function(){Oe(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)}):$e(e)?e.forEach(function(e,n){return t.set(n,e)}):null!==e&&void 0!==e&&me("Cannot initialize map from "+e)}),this},e.prototype.clear=function(){var e=this;fe(function(){ut(function(){e.keys().forEach(e.delete,e)})})},e.prototype.replace=function(e){var t=this;return fe(function(){t.clear(),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 ye(!0!==t,x("m033")),i(this,e)},e.prototype.intercept=function(e){return n(this,e)},e}();d(An.prototype,function(){return this.entries()});var In=Pe("ObservableMap",An),Dn=[];Object.freeze(Dn);var jn=[],kn=function(){},Tn=Object.prototype.hasOwnProperty,En=["mobxGuid","resetId","spyListeners","strictMode","runId"],Vn=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}(),Rn=new Vn;!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 Ln=function(){function e(e){this.cause=e}return e}(),Pn=function(){function e(e,t){void 0===e&&(e="Reaction@"+be()),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="#"+be(),this.isDisposed=!1,this._isScheduled=!1,this._isTrackPending=!1,this._isRunning=!1}return e.prototype.onBecomeStale=function(){this.schedule()},e.prototype.schedule=function(){this._isScheduled||(this._isScheduled=!0,Rn.pendingReactions.push(this),dt())},e.prototype.isScheduled=function(){return this._isScheduled},e.prototype.runReaction=function(){this.isDisposed||(Fe(),this._isScheduled=!1,nt(this)&&(this._isTrackPending=!0,this.onInvalidate(),this._isTrackPending&&s()&&u({object:this,type:"scheduled-reaction"})),Xe())},e.prototype.track=function(e){Fe();var t,n=s();n&&(t=Date.now(),c({object:this,type:"reaction",fn:e})),this._isRunning=!0;var r=it(this,e,void 0);this._isRunning=!1,this._isTrackPending=!1,this.isDisposed&&st(this),tt(r)&&this.reportExceptionInDerivation(r.cause),n&&l({time:Date.now()-t}),Xe()},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}),Rn.globalReactionErrorHandlers.forEach(function(n){return n(e,t)})},e.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,this._isRunning||(Fe(),st(this),Xe()))},e.prototype.getDisposer=function(){var e=this.dispose.bind(this);return e.$mobx=this,e.onError=ht,e},e.prototype.toString=function(){return"Reaction["+this.name+"]"},e.prototype.whyRun=function(){var e=we(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    "+_e(e)+"\n    "+(this._isRunning?" (... or any observable accessed during the remainder of the current run)":"")+"\n\t"+x("m038")+"\n"},e}(),Mn=100,Cn=function(e){return e()},$n=Pe("Reaction",Pn),Bn=wt(!1),Un=wt(!0),Nn=function(e,t,n){if("string"==typeof t)return Bn.apply(null,arguments);ye("function"==typeof e,x("m011")),ye(arguments.length<3,x("m012"));var r="object"==typeof t?t:{};return r.setter="function"==typeof t?t:r.setter,new pn(e,r.context,r.compareStructural||r.struct||!1,r.name||e.name||"",r.setter)};Nn.struct=Un;var zn={allowStateChanges:D,deepEqual:Le,getAtom:_t,getDebugName:Ot,getDependencyTree:$t,getAdministration:St,getGlobalState:ze,getObserverTree:Ut,interceptReads:zt,isComputingDerivation:rt,isSpyEnabled:s,onReactionError:ft,reserveArrayBuffer:y,resetGlobalState:He,shareGlobalState:Ne,spyReport:u,spyReportEnd:l,spyReportStart:c,setReactionScheduler:bt},Hn={Reaction:Pn,untracked:ut,Atom:Kt,BaseAtom:Gt,useStrict:A,isStrictModeEnabled:I,spy:p,asReference:mt,asFlat:gt,asStructure:yt,asMap:xt,isModifierDescriptor:ie,isObservableObject:q,isBoxedObservable:an,isObservableArray:g,ObservableMap:An,isObservableMap:In,map:de,transaction:he,observable:Sn,computed:Nn,isObservable:Q,isComputed:At,extendObservable:ee,extendShallowObservable:te,observe:It,intercept:kt,autorun:$,autorunAsync:U,when:B,reaction:N,action:ln,isAction:M,runInAction:P,expr:Vt,toJS:Rt,createTransformer:Lt,whyRun:Ct,isArrayLike:Me,extras:zn},Gn=!1,Kn=function(e){var t=Hn[e];Object.defineProperty(Hn,e,{get:function(){return Gn||(Gn=!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 Wn in Hn)Kn(Wn);"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:p,extras:zn}),exports.extras=zn,exports.default=Hn,exports.Reaction=Pn,exports.untracked=ut,exports.Atom=Kt,exports.BaseAtom=Gt,exports.useStrict=A,exports.isStrictModeEnabled=I,exports.spy=p,exports.asReference=mt,exports.asFlat=gt,exports.asStructure=yt,exports.asMap=xt,exports.isModifierDescriptor=ie,exports.isObservableObject=q,exports.isBoxedObservable=an,exports.isObservableArray=g,exports.ObservableMap=An,exports.isObservableMap=In,exports.map=de,exports.transaction=he,exports.observable=Sn,exports.IObservableFactories=_n,exports.computed=Nn,exports.isObservable=Q,exports.isComputed=At,exports.extendObservable=ee,exports.extendShallowObservable=te,exports.observe=It,exports.intercept=kt,exports.autorun=$,exports.autorunAsync=U,exports.when=B,exports.reaction=N,exports.action=ln,exports.isAction=M,exports.runInAction=P,exports.expr=Vt,exports.toJS=Rt,exports.createTransformer=Lt,exports.whyRun=Ct,exports.isArrayLike=Me;
//# sourceMappingURL=lib/mobx.min.js.map