You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

4 lines
56 KiB

7 years ago
/** MobX - (c) Michel Weststrate 2015, 2016 - MIT Licensed */
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.mobx=e()}}(function(){return function e(t,n,r){function o(a,s){if(!n[a]){if(!t[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(i)return i(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var l=n[a]={exports:{}};t[a][0].call(l.exports,function(e){var n=t[a][1][e];return o(n||e)},l,l.exports,e,t,n,r)}return n[a].exports}for(var i="function"==typeof require&&require,a=0;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}Xt(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),Oe(function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)})}function i(e,t){var n=_t();try{var r=e.interceptors;if(r)for(var o=0,i=r.length;o<i&&(t=r[o](t),xe(!t||t.type,"Intercept handlers should return nothing or a change object"),t);o++);return t}finally{Ot(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),Oe(function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)})}function u(e,t){var n=_t(),r=e.changeListeners;if(r){r=r.slice();for(var o=0,i=r.length;o<i;o++)r[o](t);Ot(n)}}function c(){return!!Un.spyListeners.length}function l(e){if(Un.spyListeners.length)for(var t=Un.spyListeners,n=0,r=t.length;n<r;n++)t[n](e)}function f(e){l(De({},e,{spyReportStart:!0}))}function p(e){l(e?De({},e,tn):tn)}function h(e){return Un.spyListeners.push(e),Oe(function(){var t=Un.spyListeners.indexOf(e);-1!==t&&Un.spyListeners.splice(t,1)})}function d(){return"function"==typeof Symbol&&Symbol.iterator||"@@iterator"}function v(e){xe(!0!==e[nn],"Illegal state: cannot recycle array as iterator"),Ee(e,nn,!0);var t=-1;return Ee(e,"next",function(){return t++,{done:t>=this.length,value:t<this.length?this[t]:void 0}}),e}function b(e,t){Ee(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(un.prototype,""+e,m(e))}function g(e){for(var t=on;t<e;t++)y(t);on=e}function w(e){return Ie(e)&&ln(e.$mobx)}function x(e){return dn[e]}function _(e,t){xe("function"==typeof t,x("m026")),xe("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];f({type:"action",name:e,fn:t,object:n,arguments:s})}var l=_t();return at(),{prevDerivation:l,prevAllowStateChanges:T(!0),notifySpy:o,startTime:i}}function A(e){k(e.prevAllowStateChanges),st(),Ot(e.prevDerivation),e.notifySpy&&p({time:Date.now()-e.startTime})}function I(e){xe(null===Un.trackingDerivation,x("m028")),Un.strictMode=e,Un.allowStateChanges=!e}function j(){return Un.strictMode}function D(e,t){var n,r=T(e);try{n=t()}finally{k(r)}return n}function T(e){var t=Un.allowStateChanges;return Un.allowStateChanges=e,t}function k(e){Un.allowStateChanges=e}function E(e,t,n,r,o){function i(i,a,s,u,c){if(void 0===c&&(c=0),xe(o||L(arguments),"This function is a decorator, but it wasn't invoked like a decorator"),s){Te(i,"__mobxLazyInitializers")||ke(i,"__mobxLazyInitializers",i.__mobxLazyInitializers&&i.__mobxLazyInitializers.slice()||[]);var l=s.value,f=s.initializer;return i.__mobxLazyInitializers.push(function(t){e(t,a,f?f.call(t):l,u,s)}),{enumerable:r,configurable:!0,get:function(){return!0!==this.__mobxDidRunLazyInitializers&&V(this),t.call(this,a)},set:function(e){!0!==this.__mobxDidR
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){mt(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}(an);b(un.prototype,function(){return v(this.slice())}),Object.defineProperty(un.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];xe("function"==typeof t,"Base function not defined on Array prototype: '"+e+"'"),ke(un.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]])}(un.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 cn=m(0);g(1e3);var ln=Ce("ObservableArrayAdministration",sn),fn={},pn=function(e){function n(t,n,r,o){void 0===r&&(r="ObservableValue@"+ge()),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))!==fn){var n=c();n&&f({type:"update",object:this,newValue:e,oldValue:t}),this.setNewValue(e),n&&p()}},n.prototype.prepareNewValue=function(e){if(mt(this),r(this)){var t=i(this,{object:this,type:"update",newValue:e});if(!t)return fn;e=t.newValue}return e=this.enhancer(e,this.value,this.name),this.value!==e?e:fn},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:t
//# sourceMappingURL=lib/mobx.umd.min.js.map