mobx 3.1.17 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +26 -0
- package/README.md +2 -1
- package/lib/api/autorun.d.ts +2 -0
- package/lib/api/computed.d.ts +3 -0
- package/lib/api/expr.d.ts +13 -13
- package/lib/api/intercept-read.d.ts +4 -4
- package/lib/api/intercept.d.ts +1 -1
- package/lib/api/isobservable.d.ts +4 -4
- package/lib/api/tojs.d.ts +2 -2
- package/lib/core/action.d.ts +1 -1
- package/lib/core/computedvalue.d.ts +11 -6
- package/lib/core/derivation.d.ts +7 -6
- package/lib/core/globalstate.d.ts +1 -0
- package/lib/core/observable.d.ts +1 -1
- package/lib/mobx.d.ts +12 -4
- package/lib/mobx.js +425 -253
- package/lib/mobx.js.flow +487 -549
- package/lib/mobx.min.js +2 -2
- package/lib/mobx.min.js.map +1 -1
- package/lib/mobx.module.js +425 -254
- package/lib/mobx.umd.js +425 -253
- package/lib/mobx.umd.min.js +2 -2
- package/lib/mobx.umd.min.js.map +1 -1
- package/lib/types/comparer.d.ts +8 -0
- package/lib/types/modifiers-old.d.ts +1 -1
- package/lib/types/observablearray.d.ts +1 -1
- package/lib/types/observablemap.d.ts +1 -1
- package/lib/types/observableobject.d.ts +7 -6
- package/lib/types/observablevalue.d.ts +1 -1
- package/lib/utils/utils.d.ts +0 -1
- package/package.json +15 -3
package/lib/mobx.umd.min.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/** MobX - (c) Michel Weststrate 2015, 2016 - MIT Licensed */
|
|
2
|
-
!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;a<r.length;a++)o(r[a]);return o}({1:[function(e,t,n){(function(e){"use strict";function t(e,t){function n(){this.constructor=e}Ht(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function r(e){return e.interceptors&&e.interceptors.length>0}function o(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 i(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),ge(!t||t.type,"Intercept handlers should return nothing or a change object"),t);o++);return t}finally{lt(n)}}function a(e){return e.changeListeners&&e.changeListeners.length>0}function s(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 u(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 c(){return!!Vn.spyListeners.length}function l(e){if(Vn.spyListeners.length)for(var t=Vn.spyListeners,n=0,r=t.length;n<r;n++)t[n](e)}function p(e){l(Ie({},e,{spyReportStart:!0}))}function f(e){l(e?Ie({},e,Jt):Jt)}function h(e){return Vn.spyListeners.push(e),xe(function(){var t=Vn.spyListeners.indexOf(e);-1!==t&&Vn.spyListeners.splice(t,1)})}function d(){return"function"==typeof Symbol&&Symbol.iterator||"@@iterator"}function v(e){ge(!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 b(e,t){Te(e,d(),t)}function y(e){return{enumerable:!1,configurable:!1,get:function(){return this.get(e)},set:function(t){this.set(e,t)}}}function m(e){Object.defineProperty(Zt.prototype,""+e,y(e))}function g(e){for(var t=qt;t<e;t++)m(t);qt=e}function w(e){return Se(e)&&tn(e.$mobx)}function x(e){return an[e]}function _(e,t){ge("function"==typeof t,x("m026")),ge("string"==typeof e&&e.length>0,"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<a;u++)s[u]=r[u];p({type:"action",name:e,fn:t,object:n,arguments:s})}var l=ct();return Fe(),{prevDerivation:l,prevAllowStateChanges:k(!0),notifySpy:o,startTime:i}}function A(e){T(e.prevAllowStateChanges),qe(),lt(e.prevDerivation),e.notifySpy&&f({time:Date.now()-e.startTime})}function I(e){ge(null===Vn.trackingDerivation,x("m028")),Vn.strictMode=e,Vn.allowStateChanges=!e}function D(){return Vn.strictMode}function j(e,t){var n,r=k(e);try{n=t()}finally{T(r)}return n}function k(e){var t=Vn.allowStateChanges;return Vn.allowStateChanges=e,t}function T(e){Vn.allowStateChanges=e}function E(e,t,n,r,o){function i(i,a,s,u,c){if(void 0===c&&(c=0),ge(o||L(arguments),"This function is a decorator, but it wasn't invoked like a decorator"),s){je(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&&R(this),t.call(this,a)},set:function(e){!0!==this.__mobxDidRunLazyInitializers&&R(this),n.call(this,a,e)}}}var f={enumerable:r,configurable:!0,get:function(){return this.__mobxInitializedProps&&!0===this.__mobxInitializedProps[a]||V(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):V(this,a,t,e,u,s)}};return(arguments.length<3||5===arguments.length&&c<3)&&Object.defineProperty(i,a,f),f}return o?function(){if(L(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 V(e,t,n,r,o,i){je(e,"__mobxInitializedProps")||ke(e,"__mobxInitializedProps",{}),e.__mobxInitializedProps[t]=!0,r(e,t,n,o,i)}function R(e){!0!==e.__mobxDidRunLazyInitializers&&e.__mobxLazyInitializers&&(ke(e,"__mobxDidRunLazyInitializers",!0),e.__mobxDidRunLazyInitializers&&e.__mobxLazyInitializers.forEach(function(t){return t(e)}))}function L(e){return(2===e.length||3===e.length)&&"string"==typeof e[1]}function P(e){return function(t,n,r){return r&&"function"==typeof r.value?(r.value=_(e,r.value),r.enumerable=!1,r.configurable=!0,r):sn(e).apply(this,arguments)}}function M(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 ge("function"==typeof o,x("m002")),ge(0===o.length,x("m003")),ge("string"==typeof r&&r.length>0,"actions should have valid names, got: '"+r+"'"),O(r,o,i,void 0)}function C(e){return"function"==typeof e&&!0===e.isMobxAction}function $(e,t,n){var r=function(){return O(t,n,e,arguments)};r.isMobxAction=!0,ke(e,t,r)}function B(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),ge("function"==typeof i,x("m004")),ge(!1===C(i),x("m005")),a&&(i=i.bind(a));var s=new Ln(o,function(){this.track(r)});return s.schedule(),s.getDisposer()}function U(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),B(o,function(e){if(i.call(s)){e.dispose();var t=ct();a.call(s),lt(t)}})}function N(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),ge(!1===C(a),x("m006")),void 0===s&&(s=1),u&&(a=a.bind(u));var c=!1,l=new Ln(i,function(){c||(c=!0,setTimeout(function(){c=!1,l.isDisposed||l.track(o)},s))});return l.schedule(),l.getDisposer()}function z(e,t,n){function r(){if(!u.isDisposed){var n=!1;u.track(function(){var t=e(u);n=De(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")),ae(e)&&me(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=cn(o.name,o.context?t.bind(o.context):t),o.context&&(e=e.bind(o.context));var i,a=!0,s=!1,u=new Ln(o.name,function(){a||o.delay<1?r():s||(s=!0,setTimeout(function(){s=!1,r()},o.delay))});return u.schedule(),u.getDisposer()}function H(e,t){if(Q(e))return e.$mobx;ge(Object.isExtensible(e),x("m035")),Ae(e)||(t=(e.constructor.name||"ObservableObject")+"@"+ye()),t||(t="ObservableObject@"+ye());var n=new fn(e,t);return Te(e,"$mobx",n),n}function G(e,t,n,r){if(e.values[t])return ge("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(ae(n.value)){var o=n.value;K(e,t,o.initialValue,o.enhancer)}else C(n.value)&&!0===n.value.autoBind?$(e.target,t,n.value.originalFn):pn(n.value)?J(e,t,n.value):K(e,t,n.value,r);else W(e,t,n.get,n.set,!1,!0)}function K(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 rn(n,o,e.name+"."+t,!1)).value,Object.defineProperty(e.target,t,Y(t)),X(e,e.target,t,n)}function W(e,t,n,r,o,i){i&&Ve(e.target,t),e.values[t]=new ln(n,e.target,o,e.name+"."+t,r),i&&Object.defineProperty(e.target,t,F(t))}function J(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,F(t))}function Y(e){return hn[e]||(hn[e]={configurable:!0,enumerable:!0,get:function(){return this.$mobx.values[e].get()},set:function(t){q(this,e,t)}})}function F(e){return dn[e]||(dn[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,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))!==nn){var h=a(o),d=c(),l=h||d?{type:"update",object:e,oldValue:s.value,name:t,newValue:n}:null;d&&p(l),s.setNewValue(n),h&&u(o,l),d&&f()}}function X(e,t,n,r){var o=a(e),i=c(),s=o||i?{type:"add",object:t,name:n,newValue:r}:null;i&&p(s),o&&u(e,s),i&&f()}function Q(e){return!!Se(e)&&(R(e),vn(e.$mobx))}function Z(e,t){if(null===e||void 0===e)return!1;if(void 0!==t){if(w(e)||An(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)||Cn(e)||pn(e)}function ee(e){return ge(!!e,":("),E(function(t,n,r,o,i){Ve(t,n),ge(!i||!i.get,x("m022")),K(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 te(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return re(e,ue,t)}function ne(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return re(e,le,t)}function re(e,t,n){ge(arguments.length>=2,x("m014")),ge("object"==typeof e,x("m015")),ge(!An(e),x("m016")),n.forEach(function(e){ge("object"==typeof e,x("m017")),ge(!Z(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]&&je(a,s)){if(o[s]=!0,e===a&&!Ee(e,s))continue;var u=Object.getOwnPropertyDescriptor(a,s);G(r,s,u,t)}}return e}function oe(e){if(void 0===e&&(e=void 0),"string"==typeof arguments[1])return bn.apply(null,arguments);if(ge(arguments.length<=1,x("m021")),ge(!ae(e),x("m020")),Z(e))return e;var t=ue(e,void 0,void 0);return t!==e?t:_n.box(e)}function ie(e){me("Expected one or two arguments to observable."+e+". Did you accidentally try to use observable."+e+" as decorator?")}function ae(e){return"object"==typeof e&&null!==e&&!0===e.isMobxModifierDescriptor}function se(e,t){return ge(!ae(t),"Modifiers cannot be nested"),{isMobxModifierDescriptor:!0,initialValue:t,enhancer:e}}function ue(e,t,n){return ae(e)&&me("You tried to assign a modifier wrapped value to a collection, please define modifiers when creating the collection, not when modifying it"),Z(e)?e:Array.isArray(e)?_n.array(e,n):Ae(e)?_n.object(e,n):$e(e)?_n.map(e,n):e}function ce(e,t,n){return ae(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)||w(e)||An(e)?e:Array.isArray(e)?_n.shallowArray(e,n):Ae(e)?_n.shallowObject(e,n):$e(e)?_n.shallowMap(e,n):me("The shallow modifier / decorator can only used in combination with arrays, objects and maps")}function le(e){return e}function pe(e,t,n){if(Le(e,t))return t;if(Z(e))return e;if(Array.isArray(e))return new Zt(e,pe,n);if($e(e))return new Sn(e,pe,n);if(Ae(e)){var r={};return H(r,n),re(r,pe,[e]),r}return e}function fe(e,t,n){return Le(e,t)?t:e}function he(e,t){return void 0===t&&(t=void 0),we(x("m023")),de.apply(void 0,arguments)}function de(e,t){return void 0===t&&(t=void 0),O("",e)}function ve(e){return we("`mobx.map` is deprecated, use `new ObservableMap` or `mobx.observable.map` instead"),_n.map(e)}function be(){return e}function ye(){return++Vn.mobxGuid}function me(e,t){throw ge(!1,e,t),"X"}function ge(e,t,n){if(!e)throw new Error("[mobx] Invariant failed: "+t+(n?" in '"+n+"'":""))}function we(e){return-1===Dn.indexOf(e)&&(Dn.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 _e(e){var t=[];return e.forEach(function(e){-1===t.indexOf(e)&&t.push(e)}),t}function Oe(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 Ae(e){if(null===e||"object"!=typeof e)return!1;var t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}function Ie(){for(var e=arguments[0],t=1,n=arguments.length;t<n;t++){var r=arguments[t];for(var o in r)je(r,o)&&(e[o]=r[o])}return e}function De(e,t,n){return"number"==typeof t&&isNaN(t)?"number"!=typeof n||!isNaN(n):e?!Le(t,n):t!==n}function je(e,t){return kn.call(e,t)}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){ge(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(_n.shallowMap(e).entries(),_n.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)||w(e)}function Ce(e){return $e(e)||An(e)}function $e(e){return void 0!==be().Map&&e instanceof be().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=be(),t=Vn;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?Vn=e.__mobxGlobal:e.__mobxGlobal=t}function ze(){return Vn}function He(){Vn.resetId++;var e=new En;for(var t in e)-1===Tn.indexOf(t)&&(Vn[t]=e[t]);Vn.allowStateChanges=!Vn.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,Vn.pendingUnobservations.push(e))}function Fe(){Vn.inBatch++}function qe(){if(0==--Vn.inBatch){dt();for(var e=Vn.pendingUnobservations,t=0;t<e.length;t++){var n=e[t];n.isPendingUnobservation=!1,0===n.observers.length&&n.onBecomeUnobserved()}Vn.pendingUnobservations=[]}}function Xe(e){var t=Vn.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!==n.IDerivationState.STALE){e.lowestObserverState=n.IDerivationState.STALE;for(var t=e.observers,r=t.length;r--;){var o=t[r];o.dependenciesState===n.IDerivationState.UP_TO_DATE&&o.onBecomeStale(),o.dependenciesState=n.IDerivationState.STALE}}}function Ze(e){if(e.lowestObserverState!==n.IDerivationState.STALE){e.lowestObserverState=n.IDerivationState.STALE;for(var t=e.observers,r=t.length;r--;){var o=t[r];o.dependenciesState===n.IDerivationState.POSSIBLY_STALE?o.dependenciesState=n.IDerivationState.STALE:o.dependenciesState===n.IDerivationState.UP_TO_DATE&&(e.lowestObserverState=n.IDerivationState.UP_TO_DATE)}}}function et(e){if(e.lowestObserverState===n.IDerivationState.UP_TO_DATE){e.lowestObserverState=n.IDerivationState.POSSIBLY_STALE;for(var t=e.observers,r=t.length;r--;){var o=t[r];o.dependenciesState===n.IDerivationState.UP_TO_DATE&&(o.dependenciesState=n.IDerivationState.POSSIBLY_STALE,o.onBecomeStale())}}}function tt(e){return e instanceof Rn}function nt(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=ct(),r=e.observing,o=r.length,i=0;i<o;i++){var a=r[i];if(pn(a)){try{a.get()}catch(e){return lt(t),!0}if(e.dependenciesState===n.IDerivationState.STALE)return lt(t),!0}}return pt(e),lt(t),!1}}function rt(){return null!==Vn.trackingDerivation}function ot(e){var t=e.observers.length>0;Vn.computationDepth>0&&t&&me(x("m031")+e.name),!Vn.allowStateChanges&&t&&me(x(Vn.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=++Vn.runId;var r=Vn.trackingDerivation;Vn.trackingDerivation=e;var o;try{o=t.call(n)}catch(e){o=new Rn(e)}return Vn.trackingDerivation=r,at(e),o}function at(e){var t=e.observing,r=e.observing=e.newObserving,o=n.IDerivationState.UP_TO_DATE;e.newObserving=null;for(var i=0,a=e.unboundDepsCount,s=0;s<a;s++){var u=r[s];0===u.diffValue&&(u.diffValue=1,i!==s&&(r[i]=u),i++),u.dependenciesState>o&&(o=u.dependenciesState)}for(r.length=i,a=t.length;a--;){var u=t[a];0===u.diffValue&&Je(u,e),u.diffValue=0}for(;i--;){var u=r[i];1===u.diffValue&&(u.diffValue=0,We(u,e))}o!==n.IDerivationState.UP_TO_DATE&&(e.dependenciesState=o,e.onBecomeStale())}function st(e){var t=e.observing;e.observing=[];for(var r=t.length;r--;)Je(t[r],e);e.dependenciesState=n.IDerivationState.NOT_TRACKING}function ut(e){var t=ct(),n=e();return lt(t),n}function ct(){var e=Vn.trackingDerivation;return Vn.trackingDerivation=null,e}function lt(e){Vn.trackingDerivation=e}function pt(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 ft(e){ge(this&&this.$mobx&&Cn(this.$mobx),"Invalid `this`"),ge(!this.$mobx.errorHandler,"Only one onErrorHandler can be registered"),this.$mobx.errorHandler=e}function ht(e){return Vn.globalReactionErrorHandlers.push(e),function(){var t=Vn.globalReactionErrorHandlers.indexOf(e);t>=0&&Vn.globalReactionErrorHandlers.splice(t,1)}}function dt(){Vn.inBatch>0||Vn.isRunningReactions||Mn(vt)}function vt(){Vn.isRunningReactions=!0;for(var e=Vn.pendingReactions,t=0;e.length>0;){++t===Pn&&(console.error("Reaction doesn't converge to a stable state after "+Pn+" 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()}Vn.isRunningReactions=!1}function bt(e){var t=Mn;Mn=function(n){return e(function(){return t(n)})}}function yt(e){return we("asReference is deprecated, use observable.ref instead"),_n.ref(e)}function mt(e){return we("asStructure is deprecated. Use observable.struct, computed.struct or reaction options instead."),_n.struct(e)}function gt(e){return we("asFlat is deprecated, use observable.shallow instead"),_n.shallow(e)}function wt(e){return we("asMap is deprecated, use observable.map or observable.shallowMap instead"),_n.map(e||{})}function xt(e){return E(function(t,n,r,o,i){ge(void 0!==i,x("m009")),ge("function"==typeof i.get,x("m010")),W(H(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(w(e))return ge(void 0===t,x("m036")),e.$mobx.atom;if(An(e)){var n=e;if(void 0===t)return _t(n._keys);var r=n._data[t]||n._hasMap[t];return ge(!!r,"the entry '"+t+"' does not exist in the observable map '"+St(e)+"'"),r}if(R(e),t&&!e.$mobx&&e[t],Q(e)){if(!t)return me("please specify a property");var r=e.$mobx.values[t];return ge(!!r,"no observable property '"+t+"' found on the observable object '"+St(e)+"'"),r}if(Wt(e)||pn(e)||Cn(e))return e}else if("function"==typeof e&&Cn(e.$mobx))return e.$mobx;return me("Cannot obtain atom from "+e)}function Ot(e,t){return ge(e,"Expecting some object"),void 0!==t?Ot(_t(e,t)):Wt(e)||pn(e)||Cn(e)?e:An(e)?e:(R(e),e.$mobx?e.$mobx:void ge(!1,"Cannot obtain administration from "+e))}function St(e,t){var n;return n=void 0!==t?_t(e,t):Q(e)||An(e)?Ot(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 pn(n)}return pn(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 Ot(e).observe(t,n)}function jt(e,t,n,r){return Ot(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 Ot(e).intercept(t)}function Et(e,t,n){return Ot(e,t).intercept(n)}function Vt(e,t){return rt()||console.warn(x("m013")),Un(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=[]),Z(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(w(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(An(e)){var c=r({});return e.forEach(function(e,r){return c[r]=Rt(e,t,n)}),c}if(on(e))return Rt(e.get(),t,n)}return e}function Lt(e,n){ge("function"==typeof e&&e.length<2,"createTransformer expects a function that accepts one argument");var r={},o=Vn.resetId,i=function(o){function i(t,n){var r=o.call(this,function(){return e(n)},void 0,!1,"Transformer-"+e.name+"-"+t,void 0)||this;return r.sourceIdentifier=t,r.sourceObject=n,r}return t(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}(ln);return function(e){o!==Vn.resetId&&(r={},o=Vn.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=ye(),ke(e,"$transformId",t)),t}function Mt(e){return console.log(e),e}function Ct(e,t){switch(arguments.length){case 0:if(!(e=Vn.trackingDerivation))return Mt(x("m024"));break;case 2:e=_t(e,t)}return e=_t(e),pn(e)?Mt(e.whyRun()):Cn(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=_e(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(An(e)||w(e)||on(e))r=Ot(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=Ot(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(n,"__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@"+ye()),this.name=e,this.isPendingUnobservation=!0,this.observers=[],this.observersIndexes={},this.diffValue=0,this.lastAccessedBy=0,this.lowestObserverState=n.IDerivationState.NOT_TRACKING}return e.prototype.onBecomeUnobserved=function(){},e.prototype.reportObserved=function(){Xe(this)},e.prototype.reportChanged=function(){Fe(),Qe(this),qe()},e.prototype.toString=function(){return this.name},e}(),Kt=function(e){function n(t,n,r){void 0===t&&(t="Atom@"+ye()),void 0===n&&(n=jn),void 0===r&&(r=jn);var o=e.call(this,t)||this;return o.name=t,o.onBecomeObservedHandler=n,o.onBecomeUnobservedHandler=r,o.isPendingUnobservation=!1,o.isBeingTracked=!1,o}return t(n,e),n.prototype.reportObserved=function(){return Fe(),e.prototype.reportObserved.call(this),this.isBeingTracked||(this.isBeingTracked=!0,this.onBecomeObservedHandler()),qe(),!!Vn.trackingDerivation},n.prototype.onBecomeUnobserved=function(){this.isBeingTracked=!1,this.onBecomeUnobservedHandler()},n}(Gt),Wt=Pe("Atom",Gt),Jt={spyReportEnd:!0},Yt="__$$iterating",Ft=function(){var e=!1,t={};return Object.defineProperty(t,"0",{set:function(){e=!0}}),Object.create(t)[0]=1,!1===e}(),qt=0,Xt=function(){function e(){}return e}();!function(e,t){void 0!==Object.setPrototypeOf?Object.setPrototypeOf(e.prototype,t):void 0!==e.prototype.__proto__?e.prototype.__proto__=t:e.prototype=t}(Xt,Array.prototype);var Qt=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@"+ye()),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 o(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}),s(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&&g(e+t+1)},e.prototype.spliceWithArray=function(e,t,n){var o=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)),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 In;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&&p(i),this.atom.reportChanged(),o&&u(this,i),r&&f()},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&&p(i),this.atom.reportChanged(),o&&u(this,i),r&&f()},e}(),Zt=function(e){function n(t,n,r,o){void 0===r&&(r="ObservableArray@"+ye()),void 0===o&&(o=!1);var i=e.call(this)||this,a=new Qt(r,n,i,o);return Te(i,"$mobx",a),t&&t.length&&i.spliceWithArray(0,0,t),Ft&&Object.defineProperty(a.array,"0",en),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<arguments.length;t++)e[t]=arguments[t];return this.$mobx.atom.reportObserved(),Array.prototype.concat.apply(this.peek(),e.map(function(e){return w(e)?e.peek():e}))},n.prototype.replace=function(e){return this.$mobx.spliceWithArray(0,this.$mobx.values.length,e)},n.prototype.toJS=function(){return this.slice()},n.prototype.toJSON=function(){return this.toJS()},n.prototype.peek=function(){return this.$mobx.atom.reportObserved(),this.$mobx.dehanceValues(this.$mobx.values)},n.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)},n.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},n.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)},n.prototype.spliceWithArray=function(e,t,n){return this.$mobx.spliceWithArray(e,t,n)},n.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},n.prototype.pop=function(){return this.splice(Math.max(this.$mobx.values.length-1,0),1)[0]},n.prototype.shift=function(){return this.splice(0,1)[0]},n.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},n.prototype.reverse=function(){var e=this.slice();return e.reverse.apply(e,arguments)},n.prototype.sort=function(e){var t=this.slice();return t.sort.apply(t,arguments)},n.prototype.remove=function(e){var t=this.$mobx.dehanceValues(this.$mobx.values).indexOf(e);return 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<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)}},n.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")}},n.prototype.set=function(e,t){var n=this.$mobx,o=n.values;if(e<o.length){ot(n.atom);var a=o[e];if(r(n)){var s=i(n,{type:"update",object:this,index:e,newValue:t});if(!s)return;t=s.newValue}t=n.enhancer(t,a);t!==a&&(o[e]=t,n.notifyArrayChildUpdate(e,t,a))}else{if(e!==o.length)throw new Error("[mobx.array] Index out of bounds, "+e+" is larger than "+o.length);n.spliceWithArray(e,0,[t])}},n}(Xt);b(Zt.prototype,function(){return v(this.slice())}),Object.defineProperty(Zt.prototype,"length",{enumerable:!1,configurable:!0,get:function(){return this.$mobx.getArrayLength()},set:function(e){this.$mobx.setArrayLength(e)}}),
|
|
3
|
-
["every","filter","forEach","indexOf","join","lastIndexOf","map","reduce","reduceRight","slice","some","toString","toLocaleString"].forEach(function(e){var t=Array.prototype[e];ge("function"==typeof t,"Base function not defined on Array prototype: '"+e+"'"),ke(Zt.prototype,e,function(){return t.apply(this.peek(),arguments)})}),function(e,t){for(var n=0;n<t.length;n++)ke(e,t[n],e[t[n]])}(Zt.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 en=y(0);g(1e3);var tn=Pe("ObservableArrayAdministration",Qt),nn={},rn=function(e){function n(t,n,r,o){void 0===r&&(r="ObservableValue@"+ye()),void 0===o&&(o=!0);var i=e.call(this,r)||this;return i.enhancer=n,i.hasUnreportedChange=!1,i.dehancer=void 0,i.value=n(t,void 0,r),o&&c()&&l({type:"create",object:i,newValue:i.value}),i}return t(n,e),n.prototype.dehanceValue=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.prototype.set=function(e){var t=this.value;if((e=this.prepareNewValue(e))!==nn){var n=c();n&&p({type:"update",object:this,newValue:e,oldValue:t}),this.setNewValue(e),n&&f()}},n.prototype.prepareNewValue=function(e){if(ot(this),r(this)){var t=i(this,{object:this,type:"update",newValue:e});if(!t)return nn;e=t.newValue}return e=this.enhancer(e,this.value,this.name),this.value!==e?e:nn},n.prototype.setNewValue=function(e){var t=this.value;this.value=e,this.reportChanged(),a(this)&&u(this,{type:"update",object:this,newValue:e,oldValue:t})},n.prototype.get=function(){return this.reportObserved(),this.dehanceValue(this.value)},n.prototype.intercept=function(e){return o(this,e)},n.prototype.observe=function(e,t){return t&&e({object:this,type:"update",newValue:this.value,oldValue:void 0}),s(this,e)},n.prototype.toJSON=function(){return this.get()},n.prototype.toString=function(){return this.name+"["+this.value+"]"},n.prototype.valueOf=function(){return Ue(this.get())},n}(Gt);rn.prototype[Be()]=rn.prototype.valueOf;var on=Pe("ObservableValue",rn),an={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"},sn=E(function(e,t,n,r,o){var i=r&&1===r.length?r[0]:n.name||t||"<unnamed action>";ke(e,t,cn(i,n))},function(e){return this[e]},function(){ge(!1,x("m001"))},!1,!0),un=E(function(e,t,n){$(e,t,n)},function(e){return this[e]},function(){ge(!1,x("m001"))},!1,!1),cn=function(e,t,n,r){return 1===arguments.length&&"function"==typeof e?_(e.name||"<unnamed action>",e):2===arguments.length&&"function"==typeof t?_(e,t):1===arguments.length&&"string"==typeof e?P(e):P(t).apply(null,arguments)};cn.bound=function(e,t,n){if("function"==typeof e){var r=_("<not yet bound action>",e);return r.autoBind=!0,r}return un.apply(null,arguments)};var ln=function(){function e(e,t,r,o,i){this.derivation=e,this.scope=t,this.compareStructural=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="#"+ye(),this.value=void 0,this.isComputing=!1,this.isRunningSetter=!1,this.name=o||"ComputedValue@"+ye(),i&&(this.setter=_(o+"-setter",i))}return e.prototype.onBecomeStale=function(){et(this)},e.prototype.onBecomeUnobserved=function(){st(this),this.value=void 0},e.prototype.get=function(){ge(!this.isComputing,"Cycle detected in computation "+this.name,this.derivation),0===Vn.inBatch?(Fe(),nt(this)&&(this.value=this.computeValue(!1)),qe()):(Xe(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){ge(!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 ge(!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.value=this.computeValue(!0);return tt(t)||De(this.compareStructural,t,e)},e.prototype.computeValue=function(e){this.isComputing=!0,Vn.computationDepth++;var t;if(e)t=it(this,this.derivation,this.scope);else try{t=this.derivation.call(this.scope)}catch(e){t=new Rn(e)}return Vn.computationDepth--,this.isComputing=!1,t},e.prototype.observe=function(e,t){var n=this,r=!0,o=void 0;return B(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(Vn.trackingDerivation),t=_e(this.isComputing?this.newObserving:this.observing).map(function(e){return e.name}),r=_e(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===n.IDerivationState.NOT_TRACKING?x("m032"):" * This computation will re-run if any of the following observables changes:\n "+Oe(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 "+Oe(r)+"\n")},e}();ln.prototype[Be()]=ln.prototype.valueOf;var pn=Pe("ComputedValue",ln),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 ge(!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}(),hn={},dn={},vn=Pe("ObservableObjectAdministration",fn),bn=ee(ue),yn=ee(ce),mn=ee(le),gn=ee(pe),wn=ee(fe),xn=function(){function e(){}return e.prototype.box=function(e,t){return arguments.length>2&&ie("box"),new rn(e,ue,t)},e.prototype.shallowBox=function(e,t){return arguments.length>2&&ie("shallowBox"),new rn(e,le,t)},e.prototype.array=function(e,t){return arguments.length>2&&ie("array"),new Zt(e,ue,t)},e.prototype.shallowArray=function(e,t){return arguments.length>2&&ie("shallowArray"),new Zt(e,le,t)},e.prototype.map=function(e,t){return arguments.length>2&&ie("map"),new Sn(e,ue,t)},e.prototype.shallowMap=function(e,t){return arguments.length>2&&ie("shallowMap"),new Sn(e,le,t)},e.prototype.object=function(e,t){arguments.length>2&&ie("object");var n={};return H(n,t),te(n,e),n},e.prototype.shallowObject=function(e,t){arguments.length>2&&ie("shallowObject");var n={};return H(n,t),ne(n,e),n},e.prototype.ref=function(){return arguments.length<2?se(le,arguments[0]):mn.apply(null,arguments)},e.prototype.shallow=function(){return arguments.length<2?se(ce,arguments[0]):yn.apply(null,arguments)},e.prototype.deep=function(){return arguments.length<2?se(ue,arguments[0]):bn.apply(null,arguments)},e.prototype.struct=function(){return arguments.length<2?se(pe,arguments[0]):gn.apply(null,arguments)},e}(),_n=oe;Object.getOwnPropertyNames(xn.prototype).filter(function(e){return"constructor"!==e}).forEach(function(e){return _n[e]=xn.prototype[e]}),_n.deep.struct=_n.struct,_n.ref.struct=function(){return arguments.length<2?se(fe,arguments[0]):wn.apply(null,arguments)};var On={},Sn=function(){function e(e,t,n){void 0===t&&(t=ue),void 0===n&&(n="ObservableMap@"+ye()),this.enhancer=t,this.name=n,this.$mobx=On,this._data=Object.create(null),this._hasMap=Object.create(null),this._keys=new Zt(void 0,le,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&&p(n),de(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&&f(),!0}return!1},e.prototype._updateHasMapEntry=function(e,t){var n=this._hasMap[e];return n?n.setNewValue(t):n=this._hasMap[e]=new rn(t,le,this.name+"."+e+"?",!1),n},e.prototype._updateValue=function(e,t){var n=this._data[e];if((t=n.prepareNewValue(t))!==nn){var r=c(),o=a(this),i=o||r?{type:"update",object:this,oldValue:n.value,name:e,newValue:t}:null;r&&p(i),n.setNewValue(t),o&&u(this,i),r&&f()}},e.prototype._addValue=function(e,t){var n=this;de(function(){var r=n._data[e]=new rn(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&&p(i),o&&u(this,i),r&&f()},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 An(e)&&(e=e.toJS()),de(function(){Ae(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;de(function(){ut(function(){e.keys().forEach(e.delete,e)})})},e.prototype.replace=function(e){var t=this;return de(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 ge(!0!==t,x("m033")),s(this,e)},e.prototype.intercept=function(e){return o(this,e)},e}();b(Sn.prototype,function(){return this.entries()});var An=Pe("ObservableMap",Sn),In=[];Object.freeze(In);var Dn=[],jn=function(){},kn=Object.prototype.hasOwnProperty,Tn=["mobxGuid","resetId","spyListeners","strictMode","runId"],En=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}(),Vn=new En;!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 Rn=function(){function e(e){this.cause=e}return e}(),Ln=function(){function e(e,t){void 0===e&&(e="Reaction@"+ye()),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="#"+ye(),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,Vn.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&&c()&&l({object:this,type:"scheduled-reaction"})),qe())},e.prototype.track=function(e){Fe();var t,n=c();n&&(t=Date.now(),p({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&&f({time:Date.now()-t}),qe()},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}),Vn.globalReactionErrorHandlers.forEach(function(n){return n(e,t)})},e.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,this._isRunning||(Fe(),st(this),qe()))},e.prototype.getDisposer=function(){var e=this.dispose.bind(this);return e.$mobx=this,e.onError=ft,e},e.prototype.toString=function(){return"Reaction["+this.name+"]"},e.prototype.whyRun=function(){var e=_e(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 "+Oe(e)+"\n "+(this._isRunning?" (... or any observable accessed during the remainder of the current run)":"")+"\n\t"+x("m038")+"\n"},e}(),Pn=100,Mn=function(e){return e()},Cn=Pe("Reaction",Ln),$n=xt(!1),Bn=xt(!0),Un=function(e,t,n){if("string"==typeof t)return $n.apply(null,arguments);ge("function"==typeof e,x("m011")),ge(arguments.length<3,x("m012"));var r="object"==typeof t?t:{};return r.setter="function"==typeof t?t:r.setter,new ln(e,r.context,r.compareStructural||r.struct||!1,r.name||e.name||"",r.setter)};Un.struct=Bn;var Nn={allowStateChanges:j,deepEqual:Le,getAtom:_t,getDebugName:St,getDependencyTree:$t,getAdministration:Ot,getGlobalState:ze,getObserverTree:Ut,interceptReads:zt,isComputingDerivation:rt,isSpyEnabled:c,onReactionError:ht,reserveArrayBuffer:g,resetGlobalState:He,shareGlobalState:Ne,spyReport:l,spyReportEnd:f,spyReportStart:p,setReactionScheduler:bt},zn={Reaction:Ln,untracked:ut,Atom:Kt,BaseAtom:Gt,useStrict:I,isStrictModeEnabled:D,spy:h,asReference:yt,asFlat:gt,asStructure:mt,asMap:wt,isModifierDescriptor:ae,isObservableObject:Q,isBoxedObservable:on,isObservableArray:w,ObservableMap:Sn,isObservableMap:An,map:ve,transaction:he,observable:_n,computed:Un,isObservable:Z,isComputed:At,extendObservable:te,extendShallowObservable:ne,observe:It,intercept:kt,autorun:B,autorunAsync:N,when:U,reaction:z,action:cn,isAction:C,runInAction:M,expr:Vt,toJS:Rt,createTransformer:Lt,whyRun:Ct,isArrayLike:Me,extras:Nn},Hn=!1;for(var Gn in zn)!function(e){var t=zn[e];Object.defineProperty(zn,e,{get:function(){return Hn||(Hn=!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}})}(Gn);"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:h,extras:Nn}),n.extras=Nn,n.default=zn,n.Reaction=Ln,n.untracked=ut,n.Atom=Kt,n.BaseAtom=Gt,n.useStrict=I,n.isStrictModeEnabled=D,n.spy=h,n.asReference=yt,n.asFlat=gt,n.asStructure=mt,n.asMap=wt,n.isModifierDescriptor=ae,n.isObservableObject=Q,n.isBoxedObservable=on,n.isObservableArray=w,n.ObservableMap=Sn,n.isObservableMap=An,n.map=ve,n.transaction=he,n.observable=_n,n.IObservableFactories=xn,n.computed=Un,n.isObservable=Z,n.isComputed=At,n.extendObservable=te,n.extendShallowObservable=ne,n.observe=It,n.intercept=kt,n.autorun=B,n.autorunAsync=N,n.when=U,n.reaction=z,n.action=cn,n.isAction=C,n.runInAction=M,n.expr=Vt,n.toJS=Rt,n.createTransformer=Lt,n.whyRun=Ct,n.isArrayLike=Me}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1])(1)});
|
|
2
|
+
!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;a<r.length;a++)o(r[a]);return o}({1:[function(e,t,n){(function(e){"use strict";function t(e,t){function n(){this.constructor=e}Kt(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function r(e){return e.interceptors&&e.interceptors.length>0}function o(e,t){var n=e.interceptors||(e.interceptors=[]);return n.push(t),Se(function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)})}function i(e,t){var n=ft();try{var r=e.interceptors;if(r)for(var o=0,i=r.length;o<i&&(t=r[o](t),_e(!t||t.type,"Intercept handlers should return nothing or a change object"),t);o++);return t}finally{ht(n)}}function a(e){return e.changeListeners&&e.changeListeners.length>0}function s(e,t){var n=e.changeListeners||(e.changeListeners=[]);return n.push(t),Se(function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)})}function u(e,t){var n=ft(),r=e.changeListeners;if(r){r=r.slice();for(var o=0,i=r.length;o<i;o++)r[o](t);ht(n)}}function c(){return!!Cn.spyListeners.length}function l(e){if(Cn.spyListeners.length)for(var t=Cn.spyListeners,n=0,r=t.length;n<r;n++)t[n](e)}function p(e){l(Te({},e,{spyReportStart:!0}))}function f(e){l(e?Te({},e,Yt):Yt)}function h(e){return Cn.spyListeners.push(e),Se(function(){var t=Cn.spyListeners.indexOf(e);-1!==t&&Cn.spyListeners.splice(t,1)})}function d(){return"function"==typeof Symbol&&Symbol.iterator||"@@iterator"}function v(e){_e(!0!==e[Xt],"Illegal state: cannot recycle array as iterator"),Ve(e,Xt,!0);var t=-1;return Ve(e,"next",function(){return t++,{done:t>=this.length,value:t<this.length?this[t]:void 0}}),e}function b(e,t){Ve(e,d(),t)}function m(e){return{enumerable:!1,configurable:!1,get:function(){return this.get(e)},set:function(t){this.set(e,t)}}}function y(e){Object.defineProperty(nn.prototype,""+e,m(e))}function g(e){for(var t=Zt;t<e;t++)y(t);Zt=e}function w(e){return je(e)&&on(e.$mobx)}function x(e){return cn[e]}function _(e,t){_e("function"==typeof t,x("m026")),_e("string"==typeof e&&e.length>0,"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<a;u++)s[u]=r[u];p({type:"action",name:e,fn:t,object:n,arguments:s})}var l=ft();return Qe(),{prevDerivation:l,prevAllowStateChanges:T(!0),notifySpy:o,startTime:i}}function A(e){k(e.prevAllowStateChanges),Ze(),ht(e.prevDerivation),e.notifySpy&&f({time:Date.now()-e.startTime})}function I(e){_e(null===Cn.trackingDerivation,x("m028")),Cn.strictMode=e,Cn.allowStateChanges=!e}function j(){return Cn.strictMode}function D(e,t){var n,r=T(e);try{n=t()}finally{k(r)}return n}function T(e){var t=Cn.allowStateChanges;return Cn.allowStateChanges=e,t}function k(e){Cn.allowStateChanges=e}function E(e,t,n,r,o){function i(i,a,s,u,c){if(void 0===c&&(c=0),_e(o||L(arguments),"This function is a decorator, but it wasn't invoked like a decorator"),s){ke(i,"__mobxLazyInitializers")||Ee(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&&R(this),t.call(this,a)},set:function(e){!0!==this.__mobxDidRunLazyInitializers&&R(this),n.call(this,a,e)}}}var f={enumerable:r,configurable:!0,get:function(){return this.__mobxInitializedProps&&!0===this.__mobxInitializedProps[a]||V(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):V(this,a,t,e,u,s)}};return(arguments.length<3||5===arguments.length&&c<3)&&Object.defineProperty(i,a,f),f}return o?function(){if(L(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 V(e,t,n,r,o,i){ke(e,"__mobxInitializedProps")||Ee(e,"__mobxInitializedProps",{}),e.__mobxInitializedProps[t]=!0,r(e,t,n,o,i)}function R(e){!0!==e.__mobxDidRunLazyInitializers&&e.__mobxLazyInitializers&&(Ee(e,"__mobxDidRunLazyInitializers",!0),e.__mobxDidRunLazyInitializers&&e.__mobxLazyInitializers.forEach(function(t){return t(e)}))}function L(e){return(2===e.length||3===e.length)&&"string"==typeof e[1]}function P(e){return function(t,n,r){if(r&&"function"==typeof r.value)return r.value=_(e,r.value),r.enumerable=!1,r.configurable=!0,r;if(void 0!==r&&void 0!==r.get)throw new Error("[mobx] action is not expected to be used with getters");return ln(e).apply(this,arguments)}}function C(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 _e("function"==typeof o,x("m002")),_e(0===o.length,x("m003")),_e("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 $(e,t,n){var r=function(){return O(t,n,e,arguments)};r.isMobxAction=!0,Ee(e,t,r)}function B(e,t){return e===t}function N(e,t){return!("number"!=typeof e||"number"!=typeof t||!isNaN(e)||!isNaN(t))||Ce(e,t)}function U(e,t){return!("number"!=typeof e||"number"!=typeof t||!isNaN(e)||!isNaN(t))||B(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@"+we(),i=e,a=t),_e("function"==typeof i,x("m004")),_e(!1===M(i),x("m005")),a&&(i=i.bind(a));var s=new zn(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@"+we(),i=e,a=t,s=n),z(o,function(e){if(i.call(s)){e.dispose();var t=ft();a.call(s),ht(t)}})}function H(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@"+we(),a=e,s=t,u=n),_e(!1===M(a),x("m006")),void 0===s&&(s=1),u&&(a=a.bind(u));var c=!1,l=new zn(i,function(){c||(c=!0,setTimeout(function(){c=!1,l.isDisposed||l.track(o)},s))});return l.schedule(),l.getDisposer()}function W(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&&xe(x("m007")),ce(e)&&xe(x("m008"));var o;o="object"==typeof n?n:{},o.name=o.name||e.name||t.name||"Reaction@"+we(),o.fireImmediately=!0===n||!0===o.fireImmediately,o.delay=o.delay||0,o.compareStructural=o.compareStructural||o.struct||!1,t=fn(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?hn.structural:hn.default,c=new zn(o.name,function(){a||o.delay<1?r():s||(s=!0,setTimeout(function(){s=!1,r()},o.delay))});return c.schedule(),c.getDisposer()}function K(e,t){if(te(e)&&e.hasOwnProperty("$mobx"))return e.$mobx;_e(Object.isExtensible(e),x("m035")),De(e)||(t=(e.constructor.name||"ObservableObject")+"@"+we()),t||(t="ObservableObject@"+we());var n=new bn(e,t);return Ve(e,"$mobx",n),n}function q(e,t,n,r){if(e.values[t]&&!vn(e.values[t]))return _e("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;J(e,t,o.initialValue,o.enhancer)}else M(n.value)&&!0===n.value.autoBind?$(e.target,t,n.value.originalFn):vn(n.value)?Y(e,t,n.value):J(e,t,n.value,r);else F(e,t,n.get,n.set,hn.default,!0)}function J(e,t,n,o){if(Le(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 sn(n,o,e.name+"."+t,!1)).value,Object.defineProperty(e.target,t,X(t)),ee(e,e.target,t,n)}function F(e,t,n,r,o,i){i&&Le(e.target,t),e.values[t]=new dn(n,e.target,o,e.name+"."+t,r),i&&Object.defineProperty(e.target,t,Q(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,Q(t))}function X(e){return mn[e]||(mn[e]={configurable:!0,enumerable:!0,get:function(){return this.$mobx.values[e].get()},set:function(t){Z(this,e,t)}})}function Q(e){return yn[e]||(yn[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))!==an){var h=a(o),d=c(),l=h||d?{type:"update",object:e,oldValue:s.value,name:t,newValue:n}:null;d&&p(l),s.setNewValue(n),h&&u(o,l),d&&f()}}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&&p(s),o&&u(e,s),i&&f()}function te(e){return!!je(e)&&(R(e),gn(e.$mobx))}function ne(e,t){if(null===e||void 0===e)return!1;if(void 0!==t){if(w(e)||Tn(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||Ft(e)||Wn(e)||vn(e)}function re(e){return _e(!!e,":("),E(function(t,n,r,o,i){Le(t,n),_e(!i||!i.get,x("m022")),J(K(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<arguments.length;n++)t[n-1]=arguments[n];return ae(e,pe,t)}function ie(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return ae(e,he,t)}function ae(e,t,n){_e(arguments.length>=2,x("m014")),_e("object"==typeof e,x("m015")),_e(!Tn(e),x("m016")),n.forEach(function(e){_e("object"==typeof e,x("m017")),_e(!ne(e),x("m018"))});for(var r=K(e),o={},i=n.length-1;i>=0;i--){var a=n[i];for(var s in a)if(!0!==o[s]&&ke(a,s)){if(o[s]=!0,e===a&&!Re(e,s))continue;var u=Object.getOwnPropertyDescriptor(a,s);q(r,s,u,t)}}return e}function se(e){if(void 0===e&&(e=void 0),"string"==typeof arguments[1])return wn.apply(null,arguments);if(_e(arguments.length<=1,x("m021")),_e(!ce(e),x("m020")),ne(e))return e;var t=pe(e,void 0,void 0);return t!==e?t:In.box(e)}function ue(e){xe("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 _e(!ce(t),"Modifiers cannot be nested"),{isMobxModifierDescriptor:!0,initialValue:t,enhancer:e}}function pe(e,t,n){return ce(e)&&xe("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)?In.array(e,n):De(e)?In.object(e,n):Ne(e)?In.map(e,n):e}function fe(e,t,n){return ce(e)&&xe("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)||Tn(e)?e:Array.isArray(e)?In.shallowArray(e,n):De(e)?In.shallowObject(e,n):Ne(e)?In.shallowMap(e,n):xe("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(Ce(e,t))return t;if(ne(e))return e;if(Array.isArray(e))return new nn(e,de,n);if(Ne(e))return new Dn(e,de,n);if(De(e)){var r={};return K(r,n),ae(r,de,[e]),r}return e}function ve(e,t,n){return Ce(e,t)?t:e}function be(e,t){return void 0===t&&(t=void 0),me.apply(void 0,arguments)}function me(e,t){return void 0===t&&(t=void 0),O("",e)}function ye(e){return Oe("`mobx.map` is deprecated, use `new ObservableMap` or `mobx.observable.map` instead"),In.map(e)}function ge(){return"undefined"!=typeof window?window:e}function we(){return++Cn.mobxGuid}function xe(e,t){throw _e(!1,e,t),"X"}function _e(e,t,n){if(!e)throw new Error("[mobx] Invariant failed: "+t+(n?" in '"+n+"'":""))}function Oe(e){return-1===En.indexOf(e)&&(En.push(e),console.error("[mobx] Deprecated: "+e),!0)}function Se(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}function Ae(e){var t=[];return e.forEach(function(e){-1===t.indexOf(e)&&t.push(e)}),t}function Ie(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 je(e){return null!==e&&"object"==typeof e}function De(e){if(null===e||"object"!=typeof e)return!1;var t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}function Te(){for(var e=arguments[0],t=1,n=arguments.length;t<n;t++){var r=arguments[t];for(var o in r)ke(r,o)&&(e[o]=r[o])}return e}function ke(e,t){return Rn.call(e,t)}function Ee(e,t,n){Object.defineProperty(e,t,{enumerable:!1,writable:!0,configurable:!0,value:n})}function Ve(e,t,n){Object.defineProperty(e,t,{enumerable:!1,writable:!1,configurable:!0,value:n})}function Re(e,t){var n=Object.getOwnPropertyDescriptor(e,t);return!n||!1!==n.configurable&&!1!==n.writable}function Le(e,t){_e(Re(e,t),"Cannot make property '"+t+"' observable, it is not configurable and writable in the target object")}function Pe(e){var t=[];for(var n in e)t.push(n);return t}function Ce(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=$e(e),r=Be(e);if(n!==$e(t))return!1;if(r!==Be(t))return!1;if(n){if(e.length!==t.length)return!1;for(var o=e.length-1;o>=0;o--)if(!Ce(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&&Ce(t.get(n),e)}),i}if("object"==typeof e&&"object"==typeof t){if(null===e||null===t)return!1;if(Be(e)&&Be(t))return e.size===t.size&&Ce(In.shallowMap(e).entries(),In.shallowMap(t).entries());if(Pe(e).length!==Pe(t).length)return!1;for(var a in e){if(!(a in t))return!1;if(!Ce(e[a],t[a]))return!1}return!0}return!1}function Me(e,t){var n="isMobX"+e;return t.prototype[n]=!0,function(e){return je(e)&&!0===e[n]}}function $e(e){return Array.isArray(e)||w(e)}function Be(e){return Ne(e)||Tn(e)}function Ne(e){return void 0!==ge().Map&&e instanceof ge().Map}function Ue(){return"function"==typeof Symbol&&Symbol.toPrimitive||"@@toPrimitive"}function ze(e){return null===e?null:"object"==typeof e?""+e:e}function Ge(){$n=!0,ge().__mobxInstanceCount--}function He(){Oe("Using `shareGlobalState` is not recommended, use peer dependencies instead. See https://github.com/mobxjs/mobx/issues/1082 for details."),Mn=!0;var e=ge(),t=Cn;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?Cn=e.__mobxGlobal:e.__mobxGlobal=t}function We(){return Cn}function Ke(){Cn.resetId++;var e=new Pn;for(var t in e)-1===Ln.indexOf(t)&&(Cn[t]=e[t]);Cn.allowStateChanges=!Cn.strictMode}function qe(e){return e.observers&&e.observers.length>0}function Je(e){return e.observers}function Fe(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 Ye(e,t){if(1===e.observers.length)e.observers.length=0,Xe(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 Xe(e){e.isPendingUnobservation||(e.isPendingUnobservation=!0,Cn.pendingUnobservations.push(e))}function Qe(){Cn.inBatch++}function Ze(){if(0==--Cn.inBatch){mt();for(var e=Cn.pendingUnobservations,t=0;t<e.length;t++){var n=e[t];n.isPendingUnobservation=!1,0===n.observers.length&&n.onBecomeUnobserved()}Cn.pendingUnobservations=[]}}function et(e){var t=Cn.trackingDerivation;null!==t?t.runId!==e.lastAccessedBy&&(e.lastAccessedBy=t.runId,t.newObserving[t.unboundDepsCount++]=e):0===e.observers.length&&Xe(e)}function tt(e){if(e.lowestObserverState!==n.IDerivationState.STALE){e.lowestObserverState=n.IDerivationState.STALE;for(var t=e.observers,r=t.length;r--;){var o=t[r];o.dependenciesState===n.IDerivationState.UP_TO_DATE&&o.onBecomeStale(),o.dependenciesState=n.IDerivationState.STALE}}}function nt(e){if(e.lowestObserverState!==n.IDerivationState.STALE){e.lowestObserverState=n.IDerivationState.STALE;for(var t=e.observers,r=t.length;r--;){var o=t[r];o.dependenciesState===n.IDerivationState.POSSIBLY_STALE?o.dependenciesState=n.IDerivationState.STALE:o.dependenciesState===n.IDerivationState.UP_TO_DATE&&(e.lowestObserverState=n.IDerivationState.UP_TO_DATE)}}}function rt(e){if(e.lowestObserverState===n.IDerivationState.UP_TO_DATE){e.lowestObserverState=n.IDerivationState.POSSIBLY_STALE;for(var t=e.observers,r=t.length;r--;){var o=t[r];o.dependenciesState===n.IDerivationState.UP_TO_DATE&&(o.dependenciesState=n.IDerivationState.POSSIBLY_STALE,o.onBecomeStale())}}}function ot(e){return e instanceof Un}function it(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=ft(),r=e.observing,o=r.length,i=0;i<o;i++){var a=r[i];if(vn(a)){try{a.get()}catch(e){return ht(t),!0}if(e.dependenciesState===n.IDerivationState.STALE)return ht(t),!0}}return dt(e),ht(t),!1}}function at(){return null!==Cn.trackingDerivation}function st(e){var t=e.observers.length>0;Cn.computationDepth>0&&t&&xe(x("m031")+e.name),!Cn.allowStateChanges&&t&&xe(x(Cn.strictMode?"m030a":"m030b")+e.name)}function ut(e,t,n){dt(e),e.newObserving=new Array(e.observing.length+100),e.unboundDepsCount=0,e.runId=++Cn.runId;var r=Cn.trackingDerivation;Cn.trackingDerivation=e;var o;try{o=t.call(n)}catch(e){o=new Un(e)}return Cn.trackingDerivation=r,ct(e),o}function ct(e){for(var t=e.observing,r=e.observing=e.newObserving,o=n.IDerivationState.UP_TO_DATE,i=0,a=e.unboundDepsCount,s=0;s<a;s++){var u=r[s];0===u.diffValue&&(u.diffValue=1,i!==s&&(r[i]=u),i++),u.dependenciesState>o&&(o=u.dependenciesState)}for(r.length=i,e.newObserving=null,a=t.length;a--;){var u=t[a];0===u.diffValue&&Ye(u,e),u.diffValue=0}for(;i--;){var u=r[i];1===u.diffValue&&(u.diffValue=0,Fe(u,e))}o!==n.IDerivationState.UP_TO_DATE&&(e.dependenciesState=o,e.onBecomeStale())}function lt(e){var t=e.observing;e.observing=[];for(var r=t.length;r--;)Ye(t[r],e);e.dependenciesState=n.IDerivationState.NOT_TRACKING}function pt(e){var t=ft(),n=e();return ht(t),n}function ft(){var e=Cn.trackingDerivation;return Cn.trackingDerivation=null,e}function ht(e){Cn.trackingDerivation=e}function dt(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 vt(e){_e(this&&this.$mobx&&Wn(this.$mobx),"Invalid `this`"),_e(!this.$mobx.errorHandler,"Only one onErrorHandler can be registered"),this.$mobx.errorHandler=e}function bt(e){return Cn.globalReactionErrorHandlers.push(e),function(){var t=Cn.globalReactionErrorHandlers.indexOf(e);t>=0&&Cn.globalReactionErrorHandlers.splice(t,1)}}function mt(){Cn.inBatch>0||Cn.isRunningReactions||Hn(yt)}function yt(){Cn.isRunningReactions=!0;for(var e=Cn.pendingReactions,t=0;e.length>0;){++t===Gn&&(console.error("Reaction doesn't converge to a stable state after "+Gn+" 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()}Cn.isRunningReactions=!1}function gt(e){var t=Hn;Hn=function(n){return e(function(){return t(n)})}}function wt(e){return Oe("asReference is deprecated, use observable.ref instead"),In.ref(e)}function xt(e){return Oe("asStructure is deprecated. Use observable.struct, computed.struct or reaction options instead."),In.struct(e)}function _t(e){return Oe("asFlat is deprecated, use observable.shallow instead"),In.shallow(e)}function Ot(e){return Oe("asMap is deprecated, use observable.map or observable.shallowMap instead"),In.map(e||{})}function St(e){return E(function(t,n,r,o,i){_e(void 0!==i,x("m009")),_e("function"==typeof i.get,x("m010")),F(K(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 At(e,t){if("object"==typeof e&&null!==e){if(w(e))return _e(void 0===t,x("m036")),e.$mobx.atom;if(Tn(e)){var n=e;if(void 0===t)return At(n._keys);var r=n._data[t]||n._hasMap[t];return _e(!!r,"the entry '"+t+"' does not exist in the observable map '"+jt(e)+"'"),r}if(R(e),t&&!e.$mobx&&e[t],te(e)){if(!t)return xe("please specify a property");var r=e.$mobx.values[t];return _e(!!r,"no observable property '"+t+"' found on the observable object '"+jt(e)+"'"),r}if(Ft(e)||vn(e)||Wn(e))return e}else if("function"==typeof e&&Wn(e.$mobx))return e.$mobx;return xe("Cannot obtain atom from "+e)}function It(e,t){return _e(e,"Expecting some object"),void 0!==t?It(At(e,t)):Ft(e)||vn(e)||Wn(e)?e:Tn(e)?e:(R(e),e.$mobx?e.$mobx:void _e(!1,"Cannot obtain administration from "+e))}function jt(e,t){var n;return n=void 0!==t?At(e,t):te(e)||Tn(e)?It(e):At(e),n.name}function Dt(e,t){if(null===e||void 0===e)return!1;if(void 0!==t){if(!1===te(e))return!1;var n=At(e,t);return vn(n)}return vn(e)}function Tt(e,t,n,r){return"function"==typeof n?Et(e,t,n,r):kt(e,t,n)}function kt(e,t,n){return It(e).observe(t,n)}function Et(e,t,n,r){return It(e,t).observe(n,r)}function Vt(e,t,n){return"function"==typeof n?Lt(e,t,n):Rt(e,t)}function Rt(e,t){return It(e).intercept(t)}function Lt(e,t,n){return It(e,t).intercept(n)}function Pt(e,t){return at()||console.warn(x("m013")),Jn(e,{context:t}).get()}function Ct(e,t,n){function r(r){return t&&n.push([e,r]),r}if(void 0===t&&(t=!0),void 0===n&&(n=[]),ne(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(w(e)){var a=r([]),s=e.map(function(e){return Ct(e,t,n)});a.length=s.length;for(var o=0,i=s.length;o<i;o++)a[o]=s[o];return a}if(te(e)){var a=r({});for(var u in e)a[u]=Ct(e[u],t,n);return a}if(Tn(e)){var c=r({});return e.forEach(function(e,r){return c[r]=Ct(e,t,n)}),c}if(un(e))return Ct(e.get(),t,n)}return e}function Mt(e,n){_e("function"==typeof e&&e.length<2,"createTransformer expects a function that accepts one argument");var r={},o=Cn.resetId,i=function(o){function i(t,n){var r=o.call(this,function(){return e(n)},void 0,hn.default,"Transformer-"+e.name+"-"+t,void 0)||this;return r.sourceIdentifier=t,r.sourceObject=n,r}return t(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}(dn);return function(e){o!==Cn.resetId&&(r={},o=Cn.resetId);var t=$t(e),n=r[t];return n?n.get():(n=r[t]=new i(t,e),n.get())}}function $t(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=we(),Ee(e,"$transformId",t)),t}function Bt(e){return console.log(e),e}function Nt(e,t){switch(arguments.length){case 0:if(!(e=Cn.trackingDerivation))return Bt(x("m024"));break;case 2:e=At(e,t)}return e=At(e),vn(e)?Bt(e.whyRun()):Wn(e)?Bt(e.whyRun()):xe(x("m025"))}function Ut(e,t){return zt(At(e,t))}function zt(e){var t={name:e.name};return e.observing&&e.observing.length>0&&(t.dependencies=Ae(e.observing).map(zt)),t}function Gt(e,t){return Ht(At(e,t))}function Ht(e){var t={name:e.name};return qe(e)&&(t.observers=Je(e).map(Ht)),t}function Wt(e,t,n){var r;if(Tn(e)||w(e)||un(e))r=It(e);else{if(!te(e))return xe("Expected observable map, object or array as first array");if("string"!=typeof t)return xe("InterceptReads can only be used with a specific property, not with an object in general");r=It(e,t)}return void 0!==r.dehancer?xe("An intercept reader was already established"):(r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0})}Object.defineProperty(n,"__esModule",{value:!0});var Kt=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])},qt=function(){function e(e){void 0===e&&(e="Atom@"+we()),this.name=e,this.isPendingUnobservation=!0,this.observers=[],this.observersIndexes={},this.diffValue=0,this.lastAccessedBy=0,this.lowestObserverState=n.IDerivationState.NOT_TRACKING}return e.prototype.onBecomeUnobserved=function(){},e.prototype.reportObserved=function(){et(this)},e.prototype.reportChanged=function(){Qe(),tt(this),Ze()},e.prototype.toString=function(){return this.name},e}(),Jt=function(e){function n(t,n,r){void 0===t&&(t="Atom@"+we()),void 0===n&&(n=Vn),void 0===r&&(r=Vn);var o=e.call(this,t)||this;return o.name=t,o.onBecomeObservedHandler=n,o.onBecomeUnobservedHandler=r,o.isPendingUnobservation=!1,o.isBeingTracked=!1,o}return t(n,e),n.prototype.reportObserved=function(){return Qe(),e.prototype.reportObserved.call(this),this.isBeingTracked||(this.isBeingTracked=!0,this.onBecomeObservedHandler()),Ze(),!!Cn.trackingDerivation},n.prototype.onBecomeUnobserved=function(){this.isBeingTracked=!1,this.onBecomeUnobservedHandler()},n}(qt),Ft=Me("Atom",qt),Yt={spyReportEnd:!0},Xt="__$$iterating",Qt=function(){var e=!1,t={};return Object.defineProperty(t,"0",{set:function(){e=!0}}),Object.create(t)[0]=1,!1===e}(),Zt=0,en=function(){function e(){}return e}();!function(e,t){void 0!==Object.setPrototypeOf?Object.setPrototypeOf(e.prototype,t):void 0!==e.prototype.__proto__?e.prototype.__proto__=t:e.prototype=t}(en,Array.prototype),Object.isFrozen(Array)&&["constructor","push","shift","concat","pop","unshift","replace","find","findIndex","splice","reverse","sort"].forEach(function(e){Object.defineProperty(en.prototype,e,{configurable:!0,writable:!0,value:Array.prototype[e]})});var tn=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 qt(e||"ObservableArray@"+we()),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 o(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}),s(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>Zt&&g(e+t+1)},e.prototype.spliceWithArray=function(e,t,n){var o=this;st(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 kn;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&&p(i),this.atom.reportChanged(),o&&u(this,i),r&&f()},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&&p(i),this.atom.reportChanged(),o&&u(this,i),r&&f()},e}(),nn=function(e){function n(t,n,r,o){void 0===r&&(r="ObservableArray@"+we()),void 0===o&&(o=!1);var i=e.call(this)||this,a=new tn(r,n,i,o);return Ve(i,"$mobx",a),t&&t.length&&i.spliceWithArray(0,0,t),Qt&&Object.defineProperty(a.array,"0",rn),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<arguments.length;t++)e[t]=arguments[t];return this.$mobx.atom.reportObserved(),Array.prototype.concat.apply(this.peek(),e.map(function(e){return w(e)?e.peek():e}))},n.prototype.replace=function(e){return this.$mobx.spliceWithArray(0,this.$mobx.values.length,e)},n.prototype.toJS=function(){return this.slice()},n.prototype.toJSON=function(){return this.toJS()},n.prototype.peek=function(){return this.$mobx.atom.reportObserved(),this.$mobx.dehanceValues(this.$mobx.values)},n.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)},n.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},n.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)},n.prototype.spliceWithArray=function(e,t,n){return this.$mobx.spliceWithArray(e,t,n)},n.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},n.prototype.pop=function(){return this.splice(Math.max(this.$mobx.values.length-1,0),1)[0]},n.prototype.shift=function(){return this.splice(0,1)[0]},n.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},n.prototype.reverse=function(){var e=this.slice();return e.reverse.apply(e,arguments)},n.prototype.sort=function(e){var t=this.slice();return t.sort.apply(t,arguments)},n.prototype.remove=function(e){var t=this.$mobx.dehanceValues(this.$mobx.values).indexOf(e);return 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<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)}},n.prototype.get=function(e){var t=this.$mobx;if(t){if(e<t.values.length)return t.atom.reportObserved(),t.dehanceValue(t.values[e])
|
|
3
|
+
;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")}},n.prototype.set=function(e,t){var n=this.$mobx,o=n.values;if(e<o.length){st(n.atom);var a=o[e];if(r(n)){var s=i(n,{type:"update",object:this,index:e,newValue:t});if(!s)return;t=s.newValue}t=n.enhancer(t,a);t!==a&&(o[e]=t,n.notifyArrayChildUpdate(e,t,a))}else{if(e!==o.length)throw new Error("[mobx.array] Index out of bounds, "+e+" is larger than "+o.length);n.spliceWithArray(e,0,[t])}},n}(en);b(nn.prototype,function(){return v(this.slice())}),Object.defineProperty(nn.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];_e("function"==typeof t,"Base function not defined on Array prototype: '"+e+"'"),Ee(nn.prototype,e,function(){return t.apply(this.peek(),arguments)})}),function(e,t){for(var n=0;n<t.length;n++)Ee(e,t[n],e[t[n]])}(nn.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 rn=m(0);g(1e3);var on=Me("ObservableArrayAdministration",tn),an={},sn=function(e){function n(t,n,r,o){void 0===r&&(r="ObservableValue@"+we()),void 0===o&&(o=!0);var i=e.call(this,r)||this;return i.enhancer=n,i.hasUnreportedChange=!1,i.dehancer=void 0,i.value=n(t,void 0,r),o&&c()&&l({type:"create",object:i,newValue:i.value}),i}return t(n,e),n.prototype.dehanceValue=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.prototype.set=function(e){var t=this.value;if((e=this.prepareNewValue(e))!==an){var n=c();n&&p({type:"update",object:this,newValue:e,oldValue:t}),this.setNewValue(e),n&&f()}},n.prototype.prepareNewValue=function(e){if(st(this),r(this)){var t=i(this,{object:this,type:"update",newValue:e});if(!t)return an;e=t.newValue}return e=this.enhancer(e,this.value,this.name),this.value!==e?e:an},n.prototype.setNewValue=function(e){var t=this.value;this.value=e,this.reportChanged(),a(this)&&u(this,{type:"update",object:this,newValue:e,oldValue:t})},n.prototype.get=function(){return this.reportObserved(),this.dehanceValue(this.value)},n.prototype.intercept=function(e){return o(this,e)},n.prototype.observe=function(e,t){return t&&e({object:this,type:"update",newValue:this.value,oldValue:void 0}),s(this,e)},n.prototype.toJSON=function(){return this.get()},n.prototype.toString=function(){return this.name+"["+this.value+"]"},n.prototype.valueOf=function(){return ze(this.get())},n}(qt);sn.prototype[Ue()]=sn.prototype.valueOf;var un=Me("ObservableValue",sn),cn={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",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"},ln=E(function(e,t,n,r,o){var i=r&&1===r.length?r[0]:n.name||t||"<unnamed action>";Ee(e,t,fn(i,n))},function(e){return this[e]},function(){_e(!1,x("m001"))},!1,!0),pn=E(function(e,t,n){$(e,t,n)},function(e){return this[e]},function(){_e(!1,x("m001"))},!1,!1),fn=function(e,t,n,r){return 1===arguments.length&&"function"==typeof e?_(e.name||"<unnamed action>",e):2===arguments.length&&"function"==typeof t?_(e,t):1===arguments.length&&"string"==typeof e?P(e):P(t).apply(null,arguments)};fn.bound=function(e,t,n){if("function"==typeof e){var r=_("<not yet bound action>",e);return r.autoBind=!0,r}return pn.apply(null,arguments)};var hn={identity:B,structural:N,default:U},dn=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="#"+we(),this.value=new Un(null),this.isComputing=!1,this.isRunningSetter=!1,this.name=o||"ComputedValue@"+we(),i&&(this.setter=_(o+"-setter",i))}return e.prototype.onBecomeStale=function(){rt(this)},e.prototype.onBecomeUnobserved=function(){lt(this),this.value=void 0},e.prototype.get=function(){_e(!this.isComputing,"Cycle detected in computation "+this.name,this.derivation),0===Cn.inBatch?(Qe(),it(this)&&(this.value=this.computeValue(!1)),Ze()):(et(this),it(this)&&this.trackAndCompute()&&nt(this));var e=this.value;if(ot(e))throw e.cause;return e},e.prototype.peek=function(){var e=this.computeValue(!1);if(ot(e))throw e.cause;return e},e.prototype.set=function(e){if(this.setter){_e(!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 _e(!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.value=this.computeValue(!0);return ot(e)||ot(t)||!this.equals(e,t)},e.prototype.computeValue=function(e){this.isComputing=!0,Cn.computationDepth++;var t;if(e)t=ut(this,this.derivation,this.scope);else try{t=this.derivation.call(this.scope)}catch(e){t=new Un(e)}return Cn.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=ft();e({type:"update",object:n,newValue:i,oldValue:o}),ht(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 ze(this.get())},e.prototype.whyRun=function(){var e=Boolean(Cn.trackingDerivation),t=Ae(this.isComputing?this.newObserving:this.observing).map(function(e){return e.name}),r=Ae(Je(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 "+Ie(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 "+Ie(r)+"\n")},e}();dn.prototype[Ue()]=dn.prototype.valueOf;var vn=Me("ComputedValue",dn),bn=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 _e(!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}(),mn={},yn={},gn=Me("ObservableObjectAdministration",bn),wn=re(pe),xn=re(fe),_n=re(he),On=re(de),Sn=re(ve),An=function(){function e(){}return e.prototype.box=function(e,t){return arguments.length>2&&ue("box"),new sn(e,pe,t)},e.prototype.shallowBox=function(e,t){return arguments.length>2&&ue("shallowBox"),new sn(e,he,t)},e.prototype.array=function(e,t){return arguments.length>2&&ue("array"),new nn(e,pe,t)},e.prototype.shallowArray=function(e,t){return arguments.length>2&&ue("shallowArray"),new nn(e,he,t)},e.prototype.map=function(e,t){return arguments.length>2&&ue("map"),new Dn(e,pe,t)},e.prototype.shallowMap=function(e,t){return arguments.length>2&&ue("shallowMap"),new Dn(e,he,t)},e.prototype.object=function(e,t){arguments.length>2&&ue("object");var n={};return K(n,t),oe(n,e),n},e.prototype.shallowObject=function(e,t){arguments.length>2&&ue("shallowObject");var n={};return K(n,t),ie(n,e),n},e.prototype.ref=function(){return arguments.length<2?le(he,arguments[0]):_n.apply(null,arguments)},e.prototype.shallow=function(){return arguments.length<2?le(fe,arguments[0]):xn.apply(null,arguments)},e.prototype.deep=function(){return arguments.length<2?le(pe,arguments[0]):wn.apply(null,arguments)},e.prototype.struct=function(){return arguments.length<2?le(de,arguments[0]):On.apply(null,arguments)},e}(),In=se;Object.getOwnPropertyNames(An.prototype).filter(function(e){return"constructor"!==e}).forEach(function(e){return In[e]=An.prototype[e]}),In.deep.struct=In.struct,In.ref.struct=function(){return arguments.length<2?le(ve,arguments[0]):Sn.apply(null,arguments)};var jn={},Dn=function(){function e(e,t,n){void 0===t&&(t=pe),void 0===n&&(n="ObservableMap@"+we()),this.enhancer=t,this.name=n,this.$mobx=jn,this._data=Object.create(null),this._hasMap=Object.create(null),this._keys=new nn(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&&p(n),me(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&&f(),!0}return!1},e.prototype._updateHasMapEntry=function(e,t){var n=this._hasMap[e];return n?n.setNewValue(t):n=this._hasMap[e]=new sn(t,he,this.name+"."+e+"?",!1),n},e.prototype._updateValue=function(e,t){var n=this._data[e];if((t=n.prepareNewValue(t))!==an){var r=c(),o=a(this),i=o||r?{type:"update",object:this,oldValue:n.value,name:e,newValue:t}:null;r&&p(i),n.setNewValue(t),o&&u(this,i),r&&f()}},e.prototype._addValue=function(e,t){var n=this;me(function(){var r=n._data[e]=new sn(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&&p(i),o&&u(this,i),r&&f()},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 Tn(e)&&(e=e.toJS()),me(function(){De(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)}):Ne(e)?e.forEach(function(e,n){return t.set(n,e)}):null!==e&&void 0!==e&&xe("Cannot initialize map from "+e)}),this},e.prototype.clear=function(){var e=this;me(function(){pt(function(){e.keys().forEach(e.delete,e)})})},e.prototype.replace=function(e){var t=this;return me(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 _e(!0!==t,x("m033")),s(this,e)},e.prototype.intercept=function(e){return o(this,e)},e}();b(Dn.prototype,function(){return this.entries()});var Tn=Me("ObservableMap",Dn),kn=[];Object.freeze(kn);var En=[],Vn=function(){},Rn=Object.prototype.hasOwnProperty,Ln=["mobxGuid","resetId","spyListeners","strictMode","runId"],Pn=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}(),Cn=new Pn,Mn=!1,$n=!1,Bn=!1,Nn=ge();Nn.__mobxInstanceCount?(Nn.__mobxInstanceCount++,setTimeout(function(){Mn||$n||Bn||(Bn=!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."))})):Nn.__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 Un=function(){function e(e){this.cause=e}return e}(),zn=function(){function e(e,t){void 0===e&&(e="Reaction@"+we()),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="#"+we(),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,Cn.pendingReactions.push(this),mt())},e.prototype.isScheduled=function(){return this._isScheduled},e.prototype.runReaction=function(){this.isDisposed||(Qe(),this._isScheduled=!1,it(this)&&(this._isTrackPending=!0,this.onInvalidate(),this._isTrackPending&&c()&&l({object:this,type:"scheduled-reaction"})),Ze())},e.prototype.track=function(e){Qe();var t,n=c();n&&(t=Date.now(),p({object:this,type:"reaction",fn:e})),this._isRunning=!0;var r=ut(this,e,void 0);this._isRunning=!1,this._isTrackPending=!1,this.isDisposed&<(this),ot(r)&&this.reportExceptionInDerivation(r.cause),n&&f({time:Date.now()-t}),Ze()},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}),Cn.globalReactionErrorHandlers.forEach(function(n){return n(e,t)})},e.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,this._isRunning||(Qe(),lt(this),Ze()))},e.prototype.getDisposer=function(){var e=this.dispose.bind(this);return e.$mobx=this,e.onError=vt,e},e.prototype.toString=function(){return"Reaction["+this.name+"]"},e.prototype.whyRun=function(){var e=Ae(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 "+Ie(e)+"\n "+(this._isRunning?" (... or any observable accessed during the remainder of the current run)":"")+"\n\t"+x("m038")+"\n"},e}(),Gn=100,Hn=function(e){return e()},Wn=Me("Reaction",zn),Kn=St(hn.default),qn=St(hn.structural),Jn=function(e,t,n){if("string"==typeof t)return Kn.apply(null,arguments);_e("function"==typeof e,x("m011")),_e(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?hn.structural:hn.default;return new dn(e,r.context,o,r.name||e.name||"",r.setter)};Jn.struct=qn,Jn.equals=St;var Fn={allowStateChanges:D,deepEqual:Ce,getAtom:At,getDebugName:jt,getDependencyTree:Ut,getAdministration:It,getGlobalState:We,getObserverTree:Gt,interceptReads:Wt,isComputingDerivation:at,isSpyEnabled:c,onReactionError:bt,reserveArrayBuffer:g,resetGlobalState:Ke,isolateGlobalState:Ge,shareGlobalState:He,spyReport:l,spyReportEnd:f,spyReportStart:p,setReactionScheduler:gt},Yn={Reaction:zn,untracked:pt,Atom:Jt,BaseAtom:qt,useStrict:I,isStrictModeEnabled:j,spy:h,comparer:hn,asReference:wt,asFlat:_t,asStructure:xt,asMap:Ot,isModifierDescriptor:ce,isObservableObject:te,isBoxedObservable:un,isObservableArray:w,ObservableMap:Dn,isObservableMap:Tn,map:ye,transaction:be,observable:In,computed:Jn,isObservable:ne,isComputed:Dt,extendObservable:oe,extendShallowObservable:ie,observe:Tt,intercept:Vt,autorun:z,autorunAsync:H,when:G,reaction:W,action:fn,isAction:M,runInAction:C,expr:Pt,toJS:Ct,createTransformer:Mt,whyRun:Nt,isArrayLike:$e,extras:Fn},Xn=!1;for(var Qn in Yn)!function(e){var t=Yn[e];Object.defineProperty(Yn,e,{get:function(){return Xn||(Xn=!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}})}(Qn);"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:h,extras:Fn}),n.extras=Fn,n.default=Yn,n.Reaction=zn,n.untracked=pt,n.Atom=Jt,n.BaseAtom=qt,n.useStrict=I,n.isStrictModeEnabled=j,n.spy=h,n.comparer=hn,n.asReference=wt,n.asFlat=_t,n.asStructure=xt,n.asMap=Ot,n.isModifierDescriptor=ce,n.isObservableObject=te,n.isBoxedObservable=un,n.isObservableArray=w,n.ObservableMap=Dn,n.isObservableMap=Tn,n.map=ye,n.transaction=be,n.observable=In,n.IObservableFactories=An,n.computed=Jn,n.isObservable=ne,n.isComputed=Dt,n.extendObservable=oe,n.extendShallowObservable=ie,n.observe=Tt,n.intercept=Vt,n.autorun=z,n.autorunAsync=H,n.when=G,n.reaction=W,n.action=fn,n.isAction=M,n.runInAction=C,n.expr=Pt,n.toJS=Ct,n.createTransformer=Mt,n.whyRun=Nt,n.isArrayLike=$e}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1])(1)});
|
|
4
4
|
//# sourceMappingURL=lib/mobx.umd.min.js.map
|