polotno-node 0.3.3 → 0.3.5

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.
@@ -14,7 +14,7 @@ parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcel
14
14
  "use strict";function _(){if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE){0;try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(_)}catch(O){console.error(O)}}}_(),module.exports=require("./cjs/react-dom.production.min.js");
15
15
  },{"./cjs/react-dom.production.min.js":"jF7N"}],"BzvP":[function(require,module,exports) {
16
16
  var global = arguments[3];
17
- var e=arguments[3];Object.defineProperty(exports,"__esModule",{value:!0}),exports.FlowCancellationError=ar,exports._allowStateChanges=pt,exports.runInAction=exports._allowStateChangesInsideComputed=Ln,exports._allowStateReadsEnd=Kt,exports._allowStateReadsStart=Ut,exports._endAction=_t,exports._getAdministration=Xi,exports._getGlobalState=Yt,exports._interceptReads=dr,exports._isComputingDerivation=Tt,exports._resetGlobalState=Jt,exports._startAction=dt,exports.autorun=In,exports.configure=Qn,exports.createAtom=Z,exports.defineProperty=Cr,exports.entries=jr,exports.extendObservable=Zn,exports.flowResult=hr,exports.get=Tr,exports.getAtom=Wi,exports.getDebugName=Fi,exports.getDependencyTree=er,exports.getObserverTree=nr,exports.has=Pr,exports.intercept=_r,exports.isAction=Mn,exports.isComputed=gr,exports.isComputedProp=mr,exports.isFlow=vr,exports.isFlowCancellationError=sr,exports.isObservable=xr,exports.isObservableArray=bi,exports.isObservableObject=Di,exports.isObservableProp=wr,exports.keys=Ar,exports.makeAutoObservable=ni,exports.makeObservable=ei,exports.observe=Vr,exports.onBecomeObserved=Wn,exports.onBecomeUnobserved=Xn,exports.onReactionError=hn,exports.ownKeys=Rr,exports.reaction=Gn,exports.remove=Er,exports.set=kr,exports.spy=An,exports.toJS=Mr,exports.trace=Ir,exports.transaction=Kr,exports.untracked=Lt,exports.values=Sr,exports.when=Gr,exports.override=exports.observable=exports.isObservableSet=exports.isObservableMap=exports.isBoxedObservable=exports.flow=exports.computed=exports.comparer=exports.action=exports._autoAction=exports.Reaction=exports.ObservableSet=exports.ObservableMap=exports.$mobx=void 0;var t={0:"Invalid value for configuration 'enforceActions', expected 'never', 'always' or 'observed'",1:function(e,t){return"Cannot apply '"+e+"' to '"+t.toString()+"': Field not found."},5:"'keys()' can only be used on observable objects, arrays, sets and maps",6:"'values()' can only be used on observable objects, arrays, sets and maps",7:"'entries()' can only be used on observable objects, arrays and maps",8:"'set()' can only be used on observable objects, arrays and maps",9:"'remove()' can only be used on observable objects, arrays and maps",10:"'has()' can only be used on observable objects, arrays and maps",11:"'get()' can only be used on observable objects, arrays and maps",12:"Invalid annotation",13:"Dynamic observable objects cannot be frozen",14:"Intercept handlers should return nothing or a change object",15:"Observable arrays cannot be frozen",16:"Modification exception: the internal structure of an observable array was changed.",17:function(e,t){return"[mobx.array] Index out of bounds, "+e+" is larger than "+t},18:"mobx.map requires Map polyfill for the current browser. Check babel-polyfill or core-js/es6/map.js",19:function(e){return"Cannot initialize from classes that inherit from Map: "+e.constructor.name},20:function(e){return"Cannot initialize map from "+e},21:function(e){return"Cannot convert to map from '"+e+"'"},22:"mobx.set requires Set polyfill for the current browser. Check babel-polyfill or core-js/es6/set.js",23:"It is not possible to get index atoms from arrays",24:function(e){return"Cannot obtain administration from "+e},25:function(e,t){return"the entry '"+e+"' does not exist in the observable map '"+t+"'"},26:"please specify a property",27:function(e,t){return"no observable property '"+e.toString()+"' found on the observable object '"+t+"'"},28:function(e){return"Cannot obtain atom from "+e},29:"Expecting some object",30:"invalid action stack. did you forget to finish an action?",31:"missing option for computed: get",32:function(e,t){return"Cycle detected in computation "+e+": "+t},33:function(e){return"The setter of computed value '"+e+"' is trying to update itself. Did you intend to update an _observable_ value, instead of the computed property?"},34:function(e){return"[ComputedValue '"+e+"'] It is not possible to assign a new value to a computed value."},35:"There are multiple, different versions of MobX active. Make sure MobX is loaded only once or use `configure({ isolateGlobalState: true })`",36:"isolateGlobalState should be called before MobX is running any reactions",37:function(e){return"[mobx] `observableArray."+e+"()` mutates the array in-place, which is not allowed inside a derivation. Use `array.slice()."+e+"()` instead"},38:"'ownKeys()' can only be used on observable objects",39:"'defineProperty()' can only be used on observable objects"},n={};function r(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];throw new Error("number"==typeof e?"[MobX] minified error nr: "+e+(n.length?" "+n.map(String).join(","):"")+". Find the full error at: https://github.com/mobxjs/mobx/blob/main/packages/mobx/src/errors.ts":"[MobX] "+e)}var i={};function o(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==e?e:"undefined"!=typeof self?self:i}var a=Object.assign,s=Object.getOwnPropertyDescriptor,u=Object.defineProperty,c=Object.prototype,l=[];Object.freeze(l);var f={};Object.freeze(f);var h="undefined"!=typeof Proxy,v=Object.toString();function d(){h||r("Proxy not available")}function _(e){0}function p(){return++Xt.mobxGuid}function b(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}var y=function(){};function g(e){return"function"==typeof e}function m(e){switch(typeof e){case"string":case"symbol":case"number":return!0}return!1}function O(e){return null!==e&&"object"==typeof e}function x(e){if(!O(e))return!1;var t=Object.getPrototypeOf(e);if(null==t)return!0;var n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n.toString()===v}function w(e){var t=null==e?void 0:e.constructor;return!!t&&("GeneratorFunction"===t.name||"GeneratorFunction"===t.displayName)}function A(e,t,n){u(e,t,{enumerable:!1,writable:!0,configurable:!0,value:n})}function S(e,t,n){u(e,t,{enumerable:!1,writable:!1,configurable:!0,value:n})}function j(e,t){var n="isMobX"+e;return t.prototype[n]=!0,function(e){return O(e)&&!0===e[n]}}function k(e){return e instanceof Map}function E(e){return e instanceof Set}var P=void 0!==Object.getOwnPropertySymbols;function T(e){var t=Object.keys(e);if(!P)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter(function(t){return c.propertyIsEnumerable.call(e,t)})):t}var C="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:P?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames;function R(e){return"string"==typeof e?e:"symbol"==typeof e?e.toString():new String(e).toString()}function V(e){return null===e?null:"object"==typeof e?""+e:e}function N(e,t){return c.hasOwnProperty.call(e,t)}var D=Object.getOwnPropertyDescriptors||function(e){var t={};return C(e).forEach(function(n){t[n]=s(e,n)}),t};function B(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function L(e,t,n){return t&&B(e.prototype,t),n&&B(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function M(){return(M=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function I(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,U(e,t)}function U(e,t){return(U=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function K(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function G(e,t){if(e){if("string"==typeof e)return q(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?q(e,t):void 0}}function q(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function H(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=G(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function W(e){return Object.assign(function(t,n){X(t,n,e)},e)}function X(e,t,n){N(e,z)||A(e,z,M({},e[z])),F(e,n,t),fe(n)||(e[z][t]=n)}function F(e,t,n){}function Y(e){return N(e,z)||A(e,z,M({},e[z])),e[z]}var J=Symbol("mobx administration");exports.$mobx=J;var $=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=wt.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach(function(e){return e()})},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(e){return e()})},t.reportObserved=function(){return on(this)},t.reportChanged=function(){nn(),an(this),rn()},t.toString=function(){return this.name_},e}(),Q=j("Atom",$);function Z(e,t,n){void 0===t&&(t=y),void 0===n&&(n=y);var r=new $(e);return t!==y&&Wn(r,t),n!==y&&Xn(r,n),r}function ee(e,t){return e===t}function te(e,t){return Ji(e,t)}function ne(e,t){return Ji(e,t,1)}function re(e,t){return Object.is?Object.is(e,t):e===t?0!==e||1/e==1/t:e!=e&&t!=t}var ie={identity:ee,structural:te,default:re,shallow:ne};function oe(e,t,n){return xr(e)?e:Array.isArray(e)?Ze.array(e,{name:n}):x(e)?Ze.object(e,void 0,{name:n}):k(e)?Ze.map(e,{name:n}):E(e)?Ze.set(e,{name:n}):"function"!=typeof e||Mn(e)||vr(e)?e:w(e)?lr(e):Bn(n,e)}function ae(e,t,n){return null==e?e:Di(e)||bi(e)||Ai(e)||Ei(e)?e:Array.isArray(e)?Ze.array(e,{name:n,deep:!1}):x(e)?Ze.object(e,void 0,{name:n,deep:!1}):k(e)?Ze.map(e,{name:n,deep:!1}):E(e)?Ze.set(e,{name:n,deep:!1}):void 0}function se(e){return e}function ue(e,t){return Ji(e,t)?t:e}exports.comparer=ie;var ce="override",le=W({annotationType_:ce,make_:he,extend_:ve});function fe(e){return e.annotationType_===ce}function he(e,t){return 0}function ve(e,t,n,i){r("'"+this.annotationType_+"' can only be used with 'makeObservable'")}function de(e,t){return{annotationType_:e,options_:t,make_:_e,extend_:pe}}function _e(e,t,n,r){var i;if(null!=(i=this.options_)&&i.bound)return null===this.extend_(e,t,n,!1)?0:1;if(r===e.target_)return null===this.extend_(e,t,n,!1)?0:2;if(Mn(n.value))return 1;var o=ye(e,this,t,n,!1);return u(r,t,o),2}function pe(e,t,n,r){var i=ye(e,this,t,n);return e.defineProperty_(t,i,r)}function be(e,t,n,r){t.annotationType_,r.value}function ye(e,t,n,r,i){var o,a,s,u,c,l,f;void 0===i&&(i=Xt.safeDescriptors),be(e,t,n,r);var h,v=r.value;null!=(o=t.options_)&&o.bound&&(v=v.bind(null!=(h=e.proxy_)?h:e.target_));return{value:ht(null!=(a=null==(s=t.options_)?void 0:s.name)?a:n.toString(),v,null!=(u=null==(c=t.options_)?void 0:c.autoAction)&&u,null!=(l=t.options_)&&l.bound?null!=(f=e.proxy_)?f:e.target_:void 0),configurable:!i||e.isPlainObject_,enumerable:!1,writable:!i}}function ge(e,t){return{annotationType_:e,options_:t,make_:me,extend_:Oe}}function me(e,t,n,r){var i;if(r===e.target_)return null===this.extend_(e,t,n,!1)?0:2;if(null!=(i=this.options_)&&i.bound&&(!N(e.target_,t)||!vr(e.target_[t]))&&null===this.extend_(e,t,n,!1))return 0;if(vr(n.value))return 1;var o=we(e,this,t,n,!1,!1);return u(r,t,o),2}function Oe(e,t,n,r){var i,o=we(e,this,t,n,null==(i=this.options_)?void 0:i.bound);return e.defineProperty_(t,o,r)}function xe(e,t,n,r){t.annotationType_,r.value}function we(e,t,n,r,i,o){void 0===o&&(o=Xt.safeDescriptors),xe(e,t,n,r);var a,s=r.value;(vr(s)||(s=lr(s)),i)&&((s=s.bind(null!=(a=e.proxy_)?a:e.target_)).isMobXFlow=!0);return{value:s,configurable:!o||e.isPlainObject_,enumerable:!1,writable:!o}}function Ae(e,t){return{annotationType_:e,options_:t,make_:Se,extend_:je}}function Se(e,t,n){return null===this.extend_(e,t,n,!1)?0:1}function je(e,t,n,r){return ke(e,this,t,n),e.defineComputedProperty_(t,M({},this.options_,{get:n.get,set:n.set}),r)}function ke(e,t,n,r){t.annotationType_,r.get}function Ee(e,t){return{annotationType_:e,options_:t,make_:Pe,extend_:Te}}function Pe(e,t,n){return null===this.extend_(e,t,n,!1)?0:1}function Te(e,t,n,r){var i,o;return Ce(e,this,t,n),e.defineObservableProperty_(t,n.value,null!=(i=null==(o=this.options_)?void 0:o.enhancer)?i:oe,r)}function Ce(e,t,n,r){t.annotationType_}exports.override=le;var Re="true",Ve=Ne();function Ne(e){return{annotationType_:Re,options_:e,make_:De,extend_:Be}}function De(e,t,n,r){var i,o,a,s;if(n.get)return at.make_(e,t,n,r);if(n.set){var c=ht(t.toString(),n.set);return r===e.target_?null===e.defineProperty_(t,{configurable:!Xt.safeDescriptors||e.isPlainObject_,set:c})?0:2:(u(r,t,{configurable:!0,set:c}),2)}if(r!==e.target_&&"function"==typeof n.value)return w(n.value)?(null!=(s=this.options_)&&s.autoBind?lr.bound:lr).make_(e,t,n,r):(null!=(a=this.options_)&&a.autoBind?Bn.bound:Bn).make_(e,t,n,r);var l,f=!1===(null==(i=this.options_)?void 0:i.deep)?Ze.ref:Ze;"function"==typeof n.value&&null!=(o=this.options_)&&o.autoBind&&(n.value=n.value.bind(null!=(l=e.proxy_)?l:e.target_));return f.make_(e,t,n,r)}function Be(e,t,n,r){var i,o,a;if(n.get)return at.extend_(e,t,n,r);if(n.set)return e.defineProperty_(t,{configurable:!Xt.safeDescriptors||e.isPlainObject_,set:ht(t.toString(),n.set)},r);"function"==typeof n.value&&null!=(i=this.options_)&&i.autoBind&&(n.value=n.value.bind(null!=(a=e.proxy_)?a:e.target_));return(!1===(null==(o=this.options_)?void 0:o.deep)?Ze.ref:Ze).extend_(e,t,n,r)}var Le="observable",Me="observable.ref",Ie="observable.shallow",Ue="observable.struct",Ke={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};function Ge(e){return e||Ke}Object.freeze(Ke);var qe=Ee(Le),He=Ee(Me,{enhancer:se}),ze=Ee(Ie,{enhancer:ae}),We=Ee(Ue,{enhancer:ue}),Xe=W(qe);function Fe(e){return!0===e.deep?oe:!1===e.deep?se:Je(e.defaultDecorator)}function Ye(e){var t;return e?null!=(t=e.defaultDecorator)?t:Ne(e):void 0}function Je(e){var t,n;return e&&null!=(t=null==(n=e.options_)?void 0:n.enhancer)?t:oe}function $e(e,t,n){if(!m(t))return xr(e)?e:x(e)?Ze.object(e,t,n):Array.isArray(e)?Ze.array(e,t):k(e)?Ze.map(e,t):E(e)?Ze.set(e,t):"object"==typeof e&&null!==e?e:Ze.box(e,t);X(e,t,qe)}Object.assign($e,Xe);var Qe={box:function(e,t){var n=Ge(t);return new Ot(e,Fe(n),n.name,!0,n.equals)},array:function(e,t){var n=Ge(t);return(!1===Xt.useProxies||!1===n.proxy?zi:ui)(e,Fe(n),n.name)},map:function(e,t){var n=Ge(t);return new Oi(e,Fe(n),n.name)},set:function(e,t){var n=Ge(t);return new ki(e,Fe(n),n.name)},object:function(e,t,n){return Zn(!1===Xt.useProxies||!1===(null==n?void 0:n.proxy)?Ri({},n):Xr({},n),e,t)},ref:W(He),shallow:W(ze),deep:Xe,struct:W(We)},Ze=a($e,Qe);exports.observable=Ze;var et,tt,nt="computed",rt="computed.struct",it=Ae(nt),ot=Ae(rt,{equals:ie.structural}),at=function(e,t){if(m(t))return X(e,t,it);if(x(e))return W(Ae(nt,e));var n=x(t)?t:{};return n.get=e,n.name||(n.name=e.name||""),new St(n)};exports.computed=at,Object.assign(at,it),at.struct=W(ot);var st,ut=0,ct=1,lt=null!=(et=null==(tt=s(function(){},"name"))?void 0:tt.configurable)&&et,ft={value:"action",configurable:!0,writable:!1,enumerable:!1};function ht(e,t,n,r){function i(){return vt(e,n,t,r||this,arguments)}return void 0===n&&(n=!1),i.isMobxAction=!0,lt&&(ft.value=e,Object.defineProperty(i,"name",ft)),i}function vt(e,t,n,r,i){var o=dt(e,t,r,i);try{return n.apply(r,i)}catch(a){throw o.error_=a,a}finally{_t(o)}}function dt(e,t,n,r){var i=0,o=Xt.trackingDerivation,a=!t||!o;nn();var s=Xt.allowStateChanges;a&&(Mt(),s=bt(!0));var u={runAsAction_:a,prevDerivation_:o,prevAllowStateChanges_:s,prevAllowStateReads_:Ut(!0),notifySpy_:!1,startTime_:i,actionId_:ct++,parentActionId_:ut};return ut=u.actionId_,u}function _t(e){ut!==e.actionId_&&r(30),ut=e.parentActionId_,void 0!==e.error_&&(Xt.suppressReactionErrors=!0),yt(e.prevAllowStateChanges_),Kt(e.prevAllowStateReads_),rn(),e.runAsAction_&&It(e.prevDerivation_),Xt.suppressReactionErrors=!1}function pt(e,t){var n=bt(e);try{return t()}finally{yt(n)}}function bt(e){var t=Xt.allowStateChanges;return Xt.allowStateChanges=e,t}function yt(e){Xt.allowStateChanges=e}var gt="create";st=Symbol.toPrimitive;var mt,Ot=function(e,t){function n(t,n,r,i,o){var a;return void 0===r&&(r="ObservableValue"),void 0===i&&(i=!0),void 0===o&&(o=ie.default),(a=e.call(this,r)||this).enhancer=void 0,a.name_=void 0,a.equals=void 0,a.hasUnreportedChange_=!1,a.interceptors_=void 0,a.changeListeners_=void 0,a.value_=void 0,a.dehancer=void 0,a.enhancer=n,a.name_=r,a.equals=o,a.value_=n(t,void 0,r),a}I(n,e);var r=n.prototype;return r.dehanceValue=function(e){return void 0!==this.dehancer?this.dehancer(e):e},r.set=function(e){this.value_;if((e=this.prepareNewValue_(e))!==Xt.UNCHANGED){gn();0,this.setNewValue_(e)}},r.prepareNewValue_=function(e){if(Ct(this),Fr(this)){var t=Jr(this,{object:this,type:ii,newValue:e});if(!t)return Xt.UNCHANGED;e=t.newValue}return e=this.enhancer(e,this.value_,this.name_),this.equals(this.value_,e)?Xt.UNCHANGED:e},r.setNewValue_=function(e){var t=this.value_;this.value_=e,this.reportChanged(),$r(this)&&Zr(this,{type:ii,object:this,newValue:e,oldValue:t})},r.get=function(){return this.reportObserved(),this.dehanceValue(this.value_)},r.intercept_=function(e){return Yr(this,e)},r.observe_=function(e,t){return t&&e({observableKind:"value",debugObjectName:this.name_,object:this,type:ii,newValue:this.value_,oldValue:void 0}),Qr(this,e)},r.raw=function(){return this.value_},r.toJSON=function(){return this.get()},r.toString=function(){return this.name_+"["+this.value_+"]"},r.valueOf=function(){return V(this.get())},r[t]=function(){return this.valueOf()},n}($,st),xt=j("ObservableValue",Ot);exports.isBoxedObservable=xt;var wt,At,St=function(e){function t(e){this.dependenciesState_=wt.NOT_TRACKING_,this.observing_=[],this.newObserving_=null,this.isBeingObserved_=!1,this.isPendingUnobservation_=!1,this.observers_=new Set,this.diffValue_=0,this.runId_=0,this.lastAccessedBy_=0,this.lowestObserverState_=wt.UP_TO_DATE_,this.unboundDepsCount_=0,this.value_=new kt(null),this.name_=void 0,this.triggeredBy_=void 0,this.isComputing_=!1,this.isRunningSetter_=!1,this.derivation=void 0,this.setter_=void 0,this.isTracing_=At.NONE,this.scope_=void 0,this.equals_=void 0,this.requiresReaction_=void 0,this.keepAlive_=void 0,this.onBOL=void 0,this.onBUOL=void 0,e.get||r(31),this.derivation=e.get,this.name_=e.name||"ComputedValue",e.set&&(this.setter_=ht("ComputedValue-setter",e.set)),this.equals_=e.equals||(e.compareStructural||e.struct?ie.structural:ie.default),this.scope_=e.context,this.requiresReaction_=e.requiresReaction,this.keepAlive_=!!e.keepAlive}var n=t.prototype;return n.onBecomeStale_=function(){un(this)},n.onBO=function(){this.onBOL&&this.onBOL.forEach(function(e){return e()})},n.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(e){return e()})},n.get=function(){if(this.isComputing_&&r(32,this.name_,this.derivation),0!==Xt.inBatch||0!==this.observers_.size||this.keepAlive_){if(on(this),Pt(this)){var e=Xt.trackingContext;this.keepAlive_&&!e&&(Xt.trackingContext=this),this.trackAndCompute()&&sn(this),Xt.trackingContext=e}}else Pt(this)&&(this.warnAboutUntrackedRead_(),nn(),this.value_=this.computeValue_(!1),rn());var t=this.value_;if(Et(t))throw t.cause;return t},n.set=function(e){if(this.setter_){this.isRunningSetter_&&r(33,this.name_),this.isRunningSetter_=!0;try{this.setter_.call(this.scope_,e)}finally{this.isRunningSetter_=!1}}else r(34,this.name_)},n.trackAndCompute=function(){var e=this.value_,t=this.dependenciesState_===wt.NOT_TRACKING_,n=this.computeValue_(!0),r=t||Et(e)||Et(n)||!this.equals_(e,n);return r&&(this.value_=n),r},n.computeValue_=function(e){this.isComputing_=!0;var t,n=bt(!1);if(e)t=Vt(this,this.derivation,this.scope_);else if(!0===Xt.disableErrorBoundaries)t=this.derivation.call(this.scope_);else try{t=this.derivation.call(this.scope_)}catch(r){t=new kt(r)}return yt(n),this.isComputing_=!1,t},n.suspend_=function(){this.keepAlive_||(Bt(this),this.value_=void 0)},n.observe_=function(e,t){var n=this,r=!0,i=void 0;return In(function(){var o=n.get();if(!r||t){var a=Mt();e({observableKind:"computed",debugObjectName:n.name_,type:ii,object:n,newValue:o,oldValue:i}),It(a)}r=!1,i=o})},n.warnAboutUntrackedRead_=function(){},n.toString=function(){return this.name_+"["+this.derivation.toString()+"]"},n.valueOf=function(){return V(this.get())},n[e]=function(){return this.valueOf()},t}(mt=Symbol.toPrimitive),jt=j("ComputedValue",St);!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_"}(wt||(wt={})),function(e){e[e.NONE=0]="NONE",e[e.LOG=1]="LOG",e[e.BREAK=2]="BREAK"}(At||(At={}));var kt=function(e){this.cause=void 0,this.cause=e};function Et(e){return e instanceof kt}function Pt(e){switch(e.dependenciesState_){case wt.UP_TO_DATE_:return!1;case wt.NOT_TRACKING_:case wt.STALE_:return!0;case wt.POSSIBLY_STALE_:for(var t=Ut(!0),n=Mt(),r=e.observing_,i=r.length,o=0;o<i;o++){var a=r[o];if(jt(a)){if(Xt.disableErrorBoundaries)a.get();else try{a.get()}catch(s){return It(n),Kt(t),!0}if(e.dependenciesState_===wt.STALE_)return It(n),Kt(t),!0}}return Gt(e),It(n),Kt(t),!1}}function Tt(){return null!==Xt.trackingDerivation}function Ct(e){}function Rt(e){0}function Vt(e,t,n){var r=Ut(!0);Gt(e),e.newObserving_=new Array(e.observing_.length+100),e.unboundDepsCount_=0,e.runId_=++Xt.runId;var i,o=Xt.trackingDerivation;if(Xt.trackingDerivation=e,Xt.inBatch++,!0===Xt.disableErrorBoundaries)i=t.call(n);else try{i=t.call(n)}catch(a){i=new kt(a)}return Xt.inBatch--,Xt.trackingDerivation=o,Dt(e),Nt(e),Kt(r),i}function Nt(e){}function Dt(e){for(var t=e.observing_,n=e.observing_=e.newObserving_,r=wt.UP_TO_DATE_,i=0,o=e.unboundDepsCount_,a=0;a<o;a++){var s=n[a];0===s.diffValue_&&(s.diffValue_=1,i!==a&&(n[i]=s),i++),s.dependenciesState_>r&&(r=s.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var u=t[o];0===u.diffValue_&&en(u,e),u.diffValue_=0}for(;i--;){var c=n[i];1===c.diffValue_&&(c.diffValue_=0,Zt(c,e))}r!==wt.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}function Bt(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)en(t[n],e);e.dependenciesState_=wt.NOT_TRACKING_}function Lt(e){var t=Mt();try{return e()}finally{It(t)}}function Mt(){var e=Xt.trackingDerivation;return Xt.trackingDerivation=null,e}function It(e){Xt.trackingDerivation=e}function Ut(e){var t=Xt.allowStateReads;return Xt.allowStateReads=e,t}function Kt(e){Xt.allowStateReads=e}function Gt(e){if(e.dependenciesState_!==wt.UP_TO_DATE_){e.dependenciesState_=wt.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=wt.UP_TO_DATE_}}var qt=["mobxGuid","spyListeners","enforceActions","computedRequiresReaction","reactionRequiresObservable","observableRequiresReaction","allowStateReads","disableErrorBoundaries","runId","UNCHANGED","useProxies"],Ht=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0},zt=!0,Wt=!1,Xt=function(){var e=o();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(zt=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new Ht).version&&(zt=!1),zt?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new Ht):(setTimeout(function(){Wt||r(35)},1),new Ht)}();function Ft(){if((Xt.pendingReactions.length||Xt.inBatch||Xt.isRunningReactions)&&r(36),Wt=!0,zt){var e=o();0==--e.__mobxInstanceCount&&(e.__mobxGlobals=void 0),Xt=new Ht}}function Yt(){return Xt}function Jt(){var e=new Ht;for(var t in e)-1===qt.indexOf(t)&&(Xt[t]=e[t]);Xt.allowStateChanges=!Xt.enforceActions}function $t(e){return e.observers_&&e.observers_.size>0}function Qt(e){return e.observers_}function Zt(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function en(e,t){e.observers_.delete(t),0===e.observers_.size&&tn(e)}function tn(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,Xt.pendingUnobservations.push(e))}function nn(){Xt.inBatch++}function rn(){if(0==--Xt.inBatch){_n();for(var e=Xt.pendingUnobservations,t=0;t<e.length;t++){var n=e[t];n.isPendingUnobservation_=!1,0===n.observers_.size&&(n.isBeingObserved_&&(n.isBeingObserved_=!1,n.onBUO()),n instanceof St&&n.suspend_())}Xt.pendingUnobservations=[]}}function on(e){Rt(e);var t=Xt.trackingDerivation;return null!==t?(t.runId_!==e.lastAccessedBy_&&(e.lastAccessedBy_=t.runId_,t.newObserving_[t.unboundDepsCount_++]=e,!e.isBeingObserved_&&Xt.trackingContext&&(e.isBeingObserved_=!0,e.onBO())),!0):(0===e.observers_.size&&Xt.inBatch>0&&tn(e),!1)}function an(e){e.lowestObserverState_!==wt.STALE_&&(e.lowestObserverState_=wt.STALE_,e.observers_.forEach(function(e){e.dependenciesState_===wt.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=wt.STALE_}))}function sn(e){e.lowestObserverState_!==wt.STALE_&&(e.lowestObserverState_=wt.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===wt.POSSIBLY_STALE_?t.dependenciesState_=wt.STALE_:t.dependenciesState_===wt.UP_TO_DATE_&&(e.lowestObserverState_=wt.UP_TO_DATE_)}))}function un(e){e.lowestObserverState_===wt.UP_TO_DATE_&&(e.lowestObserverState_=wt.POSSIBLY_STALE_,e.observers_.forEach(function(e){e.dependenciesState_===wt.UP_TO_DATE_&&(e.dependenciesState_=wt.POSSIBLY_STALE_,e.onBecomeStale_())}))}function cn(e,t){if(console.log("[mobx.trace] '"+e.name_+"' is invalidated due to a change in: '"+t.name_+"'"),e.isTracing_===At.BREAK){var n=[];ln(er(e),n,1),new Function("debugger;\n/*\nTracing '"+e.name_+"'\n\nYou are entering this break point because derivation '"+e.name_+"' is being traced and '"+t.name_+"' is now forcing it to update.\nJust follow the stacktrace you should now see in the devtools to see precisely what piece of your code is causing this update\nThe stackframe you are looking for is at least ~6-8 stack-frames up.\n\n"+(e instanceof St?e.derivation.toString().replace(/[*]\//g,"/"):"")+"\n\nThe dependencies for this derivation are:\n\n"+n.join("\n")+"\n*/\n ")()}}function ln(e,t,n){t.length>=1e3?t.push("(and many more)"):(t.push(""+"\t".repeat(n-1)+e.name),e.dependencies&&e.dependencies.forEach(function(e){return ln(e,t,n+1)}))}var fn=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),void 0===r&&(r=!1),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=wt.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=At.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,Xt.pendingReactions.push(this),_n())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){nn(),this.isScheduled_=!1;var e=Xt.trackingContext;if(Xt.trackingContext=this,Pt(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(t){this.reportExceptionInDerivation_(t)}}Xt.trackingContext=e,rn()}},t.track=function(e){if(!this.isDisposed_){nn();gn();0,this.isRunning_=!0;var t=Xt.trackingContext;Xt.trackingContext=this;var n=Vt(this,e,void 0);Xt.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Bt(this),Et(n)&&this.reportExceptionInDerivation_(n.cause),rn()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(Xt.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";Xt.suppressReactionErrors||console.error(n,e),Xt.globalReactionErrorHandlers.forEach(function(n){return n(e,t)})}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(nn(),Bt(this),rn()))},t.getDisposer_=function(){var e=this.dispose.bind(this);return e[J]=this,e},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1),Ir(this,e)},e}();function hn(e){return Xt.globalReactionErrorHandlers.push(e),function(){var t=Xt.globalReactionErrorHandlers.indexOf(e);t>=0&&Xt.globalReactionErrorHandlers.splice(t,1)}}exports.Reaction=fn;var vn=100,dn=function(e){return e()};function _n(){Xt.inBatch>0||Xt.isRunningReactions||dn(pn)}function pn(){Xt.isRunningReactions=!0;for(var e=Xt.pendingReactions,t=0;e.length>0;){++t===vn&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r<i;r++)n[r].runReaction_()}Xt.isRunningReactions=!1}var bn=j("Reaction",fn);function yn(e){var t=dn;dn=function(n){return e(function(){return t(n)})}}function gn(){return!1}function mn(e){}function On(e){}var xn={type:"report-end",spyReportEnd:!0};function wn(e){}function An(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}}var Sn="action",jn="action.bound",kn="autoAction",En="autoAction.bound",Pn="<unnamed action>",Tn=de(Sn),Cn=de(jn,{bound:!0}),Rn=de(kn,{autoAction:!0}),Vn=de(En,{autoAction:!0,bound:!0});function Nn(e){return function(t,n){return g(t)?ht(t.name||Pn,t,e):g(n)?ht(t,n,e):m(n)?X(t,n,e?Rn:Tn):m(t)?W(de(e?kn:Sn,{name:t,autoAction:e})):void 0}}var Dn=Nn(!1);exports.action=Dn,Object.assign(Dn,Tn);var Bn=Nn(!0);function Ln(e){return vt(e.name||Pn,!1,e,this,void 0)}function Mn(e){return g(e)&&!0===e.isMobxAction}function In(e,t){var n,r;void 0===t&&(t=f);var i,o=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(!t.scheduler&&!t.delay)i=new fn(o,function(){this.track(u)},t.onError,t.requiresObservable);else{var a=Kn(t),s=!1;i=new fn(o,function(){s||(s=!0,a(function(){s=!1,i.isDisposed_||i.track(u)}))},t.onError,t.requiresObservable)}function u(){e(i)}return i.schedule_(),i.getDisposer_()}exports._autoAction=Bn,Object.assign(Bn,Rn),Dn.bound=W(Cn),Bn.bound=W(Vn);var Un=function(e){return e()};function Kn(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Un}function Gn(e,t,n){var r;void 0===n&&(n=f);var i,o,a=null!=(r=n.name)?r:"Reaction",s=Dn(a,n.onError?qn(n.onError,t):t),u=!n.scheduler&&!n.delay,c=Kn(n),l=!0,h=!1,v=n.compareStructural?ie.structural:n.equals||ie.default,d=new fn(a,function(){l||u?_():h||(h=!0,c(_))},n.onError,n.requiresObservable);function _(){if(h=!1,!d.isDisposed_){var t=!1;d.track(function(){var n=pt(!1,function(){return e(d)});t=l||!v(i,n),o=i,i=n}),l&&n.fireImmediately?s(i,o,d):!l&&t&&s(i,o,d),l=!1}}return d.schedule_(),d.getDisposer_()}function qn(e,t){return function(){try{return t.apply(this,arguments)}catch(n){e.call(this,n)}}}var Hn="onBO",zn="onBUO";function Wn(e,t,n){return Fn(Hn,e,t,n)}function Xn(e,t,n){return Fn(zn,e,t,n)}function Fn(e,t,n,r){var i="function"==typeof r?Wi(t,n):Wi(t),o=g(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var Yn="never",Jn="always",$n="observed";function Qn(e){!0===e.isolateGlobalState&&Ft();var t=e.useProxies,n=e.enforceActions;if(void 0!==t&&(Xt.useProxies=t===Jn||t!==Yn&&"undefined"!=typeof Proxy),"ifavailable"===t&&(Xt.verifyProxies=!0),void 0!==n){var r=n===Jn?Jn:n===$n;Xt.enforceActions=r,Xt.allowStateChanges=!0!==r&&r!==Jn}["computedRequiresReaction","reactionRequiresObservable","observableRequiresReaction","disableErrorBoundaries","safeDescriptors"].forEach(function(t){t in e&&(Xt[t]=!!e[t])}),Xt.allowStateReads=!Xt.observableRequiresReaction,e.reactionScheduler&&yn(e.reactionScheduler)}function Zn(e,t,n,r){var i=D(t),o=Ri(e,r)[J];nn();try{C(i).forEach(function(e){o.extend_(e,i[e],!n||(!(e in n)||n[e]))})}finally{rn()}return e}function er(e,t){return tr(Wi(e,t))}function tr(e){var t={name:e.name_};return e.observing_&&e.observing_.length>0&&(t.dependencies=ir(e.observing_).map(tr)),t}function nr(e,t){return rr(Wi(e,t))}function rr(e){var t={name:e.name_};return $t(e)&&(t.observers=Array.from(Qt(e)).map(rr)),t}function ir(e){return Array.from(new Set(e))}var or=0;function ar(){this.message="FLOW_CANCELLED"}function sr(e){return e instanceof ar}ar.prototype=Object.create(Error.prototype);var ur=ge("flow"),cr=ge("flow.bound",{bound:!0}),lr=Object.assign(function(e,t){if(m(t))return X(e,t,ur);var n=e,r=n.name||"<unnamed flow>",i=function(){var e,t=arguments,i=++or,o=Dn(r+" - runid: "+i+" - init",n).apply(this,t),a=void 0,s=new Promise(function(t,n){var s=0;function u(e){var t;a=void 0;try{t=Dn(r+" - runid: "+i+" - yield "+s++,o.next).call(o,e)}catch(u){return n(u)}l(t)}function c(e){var t;a=void 0;try{t=Dn(r+" - runid: "+i+" - yield "+s++,o.throw).call(o,e)}catch(u){return n(u)}l(t)}function l(e){if(!g(null==e?void 0:e.then))return e.done?t(e.value):(a=Promise.resolve(e.value)).then(u,c);e.then(l,n)}e=n,u(void 0)});return s.cancel=Dn(r+" - runid: "+i+" - cancel",function(){try{a&&fr(a);var t=o.return(void 0),n=Promise.resolve(t.value);n.then(y,y),fr(n),e(new ar)}catch(r){e(r)}}),s};return i.isMobXFlow=!0,i},ur);function fr(e){g(e.cancel)&&e.cancel()}function hr(e){return e}function vr(e){return!0===(null==e?void 0:e.isMobXFlow)}function dr(e,t,n){var r;return Ai(e)||bi(e)||xt(e)?r=Xi(e):Di(e)&&(r=Xi(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function _r(e,t,n){return g(n)?br(e,t,n):pr(e,t)}function pr(e,t){return Xi(e).intercept_(t)}function br(e,t,n){return Xi(e,t).intercept_(n)}function yr(e,t){if(void 0===t)return jt(e);if(!1===Di(e))return!1;if(!e[J].values_.has(t))return!1;var n=Wi(e,t);return jt(n)}function gr(e){return yr(e)}function mr(e,t){return yr(e,t)}function Or(e,t){return!!e&&(void 0!==t?!!Di(e)&&e[J].values_.has(t):Di(e)||!!e[J]||Q(e)||bn(e)||jt(e))}function xr(e){return Or(e)}function wr(e,t){return Or(e,t)}function Ar(e){return Di(e)?e[J].keys_():Ai(e)||Ei(e)?Array.from(e.keys()):bi(e)?e.map(function(e,t){return t}):void r(5)}function Sr(e){return Di(e)?Ar(e).map(function(t){return e[t]}):Ai(e)?Ar(e).map(function(t){return e.get(t)}):Ei(e)?Array.from(e.values()):bi(e)?e.slice():void r(6)}function jr(e){return Di(e)?Ar(e).map(function(t){return[t,e[t]]}):Ai(e)?Ar(e).map(function(t){return[t,e.get(t)]}):Ei(e)?Array.from(e.entries()):bi(e)?e.map(function(e,t){return[t,e]}):void r(7)}function kr(e,t,n){if(2!==arguments.length||Ei(e))Di(e)?e[J].set_(t,n):Ai(e)?e.set(t,n):Ei(e)?e.add(t):bi(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&r("Invalid index: '"+t+"'"),nn(),t>=e.length&&(e.length=t+1),e[t]=n,rn()):r(8);else{nn();var i=t;try{for(var o in i)kr(e,o,i[o])}finally{rn()}}}function Er(e,t){Di(e)?e[J].delete_(t):Ai(e)?e.delete(t):Ei(e)?e.delete(t):bi(e)?("number"!=typeof t&&(t=parseInt(t,10)),e.splice(t,1)):r(9)}function Pr(e,t){return Di(e)?e[J].has_(t):Ai(e)?e.has(t):Ei(e)?e.has(t):bi(e)?t>=0&&t<e.length:void r(10)}function Tr(e,t){if(Pr(e,t))return Di(e)?e[J].get_(t):Ai(e)?e.get(t):bi(e)?e[t]:void r(11)}function Cr(e,t,n){if(Di(e))return e[J].defineProperty_(t,n);r(39)}function Rr(e){if(Di(e))return e[J].ownKeys_();r(38)}function Vr(e,t,n,r){return g(n)?Dr(e,t,n,r):Nr(e,t,n)}function Nr(e,t,n){return Xi(e).observe_(t,n)}function Dr(e,t,n,r){return Xi(e,t).observe_(n,r)}function Br(e,t,n){return e.set(t,n),n}function Lr(e,t){if(null==e||"object"!=typeof e||e instanceof Date||!xr(e))return e;if(xt(e)||jt(e))return Lr(e.get(),t);if(t.has(e))return t.get(e);if(bi(e)){var n=Br(t,e,new Array(e.length));return e.forEach(function(e,r){n[r]=Lr(e,t)}),n}if(Ei(e)){var r=Br(t,e,new Set);return e.forEach(function(e){r.add(Lr(e,t))}),r}if(Ai(e)){var i=Br(t,e,new Map);return e.forEach(function(e,n){i.set(n,Lr(e,t))}),i}var o=Br(t,e,{});return Rr(e).forEach(function(n){c.propertyIsEnumerable.call(e,n)&&(o[n]=Lr(e[n],t))}),o}function Mr(e,t){return Lr(e,new Map)}function Ir(){r("trace() is not available in production builds");for(var e=!1,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];"boolean"==typeof n[n.length-1]&&(e=n.pop());var o=Ur(n);if(!o)return r("'trace(break?)' can only be used inside a tracked computed value or a Reaction. Consider passing in the computed value or reaction explicitly");o.isTracing_===At.NONE&&console.log("[mobx.trace] '"+o.name_+"' tracing enabled"),o.isTracing_=e?At.BREAK:At.LOG}function Ur(e){switch(e.length){case 0:return Xt.trackingDerivation;case 1:return Wi(e[0]);case 2:return Wi(e[0],e[1])}}function Kr(e,t){void 0===t&&(t=void 0),nn();try{return e.apply(t)}finally{rn()}}function Gr(e,t,n){return 1===arguments.length||t&&"object"==typeof t?Hr(e,t):qr(e,t,n||{})}function qr(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout(function(){if(!a[J].isDisposed_){if(a(),!n.onError)throw i;n.onError(i)}},n.timeout)}n.name="When";var o=ht("When-effect",t),a=In(function(t){pt(!1,e)&&(t.dispose(),r&&clearTimeout(r),o())},n);return a}function Hr(e,t){var n;var r=new Promise(function(r,i){var o=qr(e,r,M({},t,{onError:i}));n=function(){o(),i(new Error("WHEN_CANCELLED"))}});return r.cancel=n,r}function zr(e){return e[J]}exports.flow=lr,lr.bound=W(cr);var Wr={has:function(e,t){return zr(e).has_(t)},get:function(e,t){return zr(e).get_(t)},set:function(e,t,n){var r;return!!m(t)&&(null==(r=zr(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!m(t)&&(null==(n=zr(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=zr(e).defineProperty_(t,n))||r},ownKeys:function(e){return zr(e).ownKeys_()},preventExtensions:function(e){r(13)}};function Xr(e,t){var n,r;return d(),null!=(r=(n=(e=Ri(e,t))[J]).proxy_)?r:n.proxy_=new Proxy(e,Wr)}function Fr(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function Yr(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),b(function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)})}function Jr(e,t){var n=Mt();try{for(var i=[].concat(e.interceptors_||[]),o=0,a=i.length;o<a&&((t=i[o](t))&&!t.type&&r(14),t);o++);return t}finally{It(n)}}function $r(e){return void 0!==e.changeListeners_&&e.changeListeners_.length>0}function Qr(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),b(function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)})}function Zr(e,t){var n=Mt(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i<o;i++)r[i](t);It(n)}}function ei(e,t,n){var r=Ri(e,n)[J];nn();try{0,null!=t||(t=Y(e)),C(t).forEach(function(e){return r.make_(e,t[e])})}finally{rn()}return e}var ti=Symbol("mobx-keys");function ni(e,t,n){if(x(e))return Zn(e,e,t,n);var r=Ri(e,n)[J];if(!e[ti]){var i=Object.getPrototypeOf(e),o=new Set([].concat(C(e),C(i)));o.delete("constructor"),o.delete(J),A(i,ti,o)}nn();try{e[ti].forEach(function(e){return r.make_(e,!t||(!(e in t)||t[e]))})}finally{rn()}return e}var ri="splice",ii="update",oi=1e4,ai={get:function(e,t){var n=e[J];return t===J?n:"length"===t?n.getArrayLength_():"string"!=typeof t||isNaN(t)?N(ci,t)?ci[t]:e[t]:n.get_(parseInt(t))},set:function(e,t,n){var r=e[J];return"length"===t&&r.setArrayLength_(n),"symbol"==typeof t||isNaN(t)?e[t]=n:r.set_(parseInt(t),n),!0},preventExtensions:function(){r(15)}},si=function(){function e(e,t,n,r){void 0===e&&(e="ObservableArray"),this.owned_=void 0,this.legacyMode_=void 0,this.atom_=void 0,this.values_=[],this.interceptors_=void 0,this.changeListeners_=void 0,this.enhancer_=void 0,this.dehancer=void 0,this.proxy_=void 0,this.lastKnownLength_=0,this.owned_=n,this.legacyMode_=r,this.atom_=new $(e),this.enhancer_=function(e,n){return t(e,n,"ObservableArray[..]")}}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.dehanceValues_=function(e){return void 0!==this.dehancer&&e.length>0?e.map(this.dehancer):e},t.intercept_=function(e){return Yr(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),Qr(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&r("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i<e-t;i++)n[i]=void 0;this.spliceWithArray_(t,0,n)}else this.spliceWithArray_(e,t-e)},t.updateArrayLength_=function(e,t){e!==this.lastKnownLength_&&r(16),this.lastKnownLength_+=t,this.legacyMode_&&t>0&&Hi(e+t+1)},t.spliceWithArray_=function(e,t,n){var r=this;Ct(this.atom_);var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=l),Fr(this)){var o=Jr(this,{object:this.proxy_,type:ri,index:e,removedCount:t,added:n});if(!o)return l;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map(function(e){return r.enhancer_(e,void 0)}),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var s=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,s),this.dehanceValues_(s)},t.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<oi)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a<n.length;a++)this.values_[e+a]=n[a];for(var s=0;s<o.length;s++)this.values_[e+n.length+s]=o[s];return i},t.notifyArrayChildUpdate_=function(e,t,n){var r=!this.owned_&&gn(),i=$r(this),o=i||r?{observableKind:"array",object:this.proxy_,type:ii,debugObjectName:this.atom_.name_,index:e,newValue:t,oldValue:n}:null;this.atom_.reportChanged(),i&&Zr(this,o)},t.notifyArraySplice_=function(e,t,n){var r=!this.owned_&&gn(),i=$r(this),o=i||r?{observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:ri,index:e,removed:n,added:t,removedCount:n.length,addedCount:t.length}:null;this.atom_.reportChanged(),i&&Zr(this,o)},t.get_=function(e){if(e<this.values_.length)return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx.array] Attempt to read an array index ("+e+") that is out of bounds ("+this.values_.length+"). Please check length first. Out of bound indices will not be tracked by MobX")},t.set_=function(e,t){var n=this.values_;if(e<n.length){Ct(this.atom_);var i=n[e];if(Fr(this)){var o=Jr(this,{type:ii,object:this.proxy_,index:e,newValue:t});if(!o)return;t=o.newValue}(t=this.enhancer_(t,i))!==i&&(n[e]=t,this.notifyArrayChildUpdate_(e,t,i))}else e===n.length?this.spliceWithArray_(e,0,[t]):r(17,e,n.length)},e}();function ui(e,t,n,r){void 0===n&&(n="ObservableArray"),void 0===r&&(r=!1),d();var i=new si(n,t,r,!1);S(i.values_,J,i);var o=new Proxy(i.values_,ai);if(i.proxy_=o,e&&e.length){var a=bt(!0);i.spliceWithArray_(0,0,e),yt(a)}return o}var ci={clear:function(){return this.splice(0)},replace:function(e){var t=this[J];return t.spliceWithArray_(0,t.values_.length,e)},toJSON:function(){return this.slice()},splice:function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];var o=this[J];switch(arguments.length){case 0:return[];case 1:return o.spliceWithArray_(e);case 2:return o.spliceWithArray_(e,t)}return o.spliceWithArray_(e,t,r)},spliceWithArray:function(e,t,n){return this[J].spliceWithArray_(e,t,n)},push:function(){for(var e=this[J],t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return e.spliceWithArray_(e.values_.length,0,n),e.values_.length},pop:function(){return this.splice(Math.max(this[J].values_.length-1,0),1)[0]},shift:function(){return this.splice(0,1)[0]},unshift:function(){for(var e=this[J],t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return e.spliceWithArray_(0,0,n),e.values_.length},reverse:function(){return Xt.trackingDerivation&&r(37,"reverse"),this.replace(this.slice().reverse()),this},sort:function(){Xt.trackingDerivation&&r(37,"sort");var e=this.slice();return e.sort.apply(e,arguments),this.replace(e),this},remove:function(e){var t=this[J],n=t.dehanceValues_(t.values_).indexOf(e);return n>-1&&(this.splice(n,1),!0)}};function li(e,t){"function"==typeof Array.prototype[e]&&(ci[e]=t(e))}function fi(e){return function(){var t=this[J];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function hi(e){return function(t,n){var r=this,i=this[J];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e](function(e,i){return t.call(n,e,i,r)})}}function vi(e){return function(){var t=this,n=this[J];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}li("concat",fi),li("flat",fi),li("includes",fi),li("indexOf",fi),li("join",fi),li("lastIndexOf",fi),li("slice",fi),li("toString",fi),li("toLocaleString",fi),li("every",hi),li("filter",hi),li("find",hi),li("findIndex",hi),li("flatMap",hi),li("forEach",hi),li("map",hi),li("some",hi),li("reduce",vi),li("reduceRight",vi);var di,_i,pi=j("ObservableArrayAdministration",si);function bi(e){return O(e)&&pi(e[J])}var yi={},gi="add",mi="delete",Oi=function(e,t){function n(e,t,n){var i=this;void 0===t&&(t=oe),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[J]=yi,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,g(Map)||r(18),this.keysAtom_=Z("ObservableMap.keys()"),this.data_=new Map,this.hasMap_=new Map,pt(!0,function(){i.merge(e)})}var i=n.prototype;return i.has_=function(e){return this.data_.has(e)},i.has=function(e){var t=this;if(!Xt.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Ot(this.has_(e),se,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Xn(r,function(){return t.hasMap_.delete(e)})}return n.get()},i.set=function(e,t){var n=this.has_(e);if(Fr(this)){var r=Jr(this,{type:n?ii:gi,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},i.delete=function(e){var t=this;if((Ct(this.keysAtom_),Fr(this))&&!Jr(this,{type:mi,object:this,name:e}))return!1;if(this.has_(e)){var n=gn(),r=$r(this),i=r||n?{observableKind:"map",debugObjectName:this.name_,type:mi,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return Kr(function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)}),r&&Zr(this,i),!0}return!1},i.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==Xt.UNCHANGED){var r=gn(),i=$r(this),o=i||r?{observableKind:"map",debugObjectName:this.name_,type:ii,object:this,oldValue:n.value_,name:e,newValue:t}:null;0,n.setNewValue_(t),i&&Zr(this,o)}},i.addValue_=function(e,t){var n=this;Ct(this.keysAtom_),Kr(function(){var r,i=new Ot(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()});var r=gn(),i=$r(this),o=i||r?{observableKind:"map",debugObjectName:this.name_,type:gi,object:this,name:e,newValue:t}:null;i&&Zr(this,o)},i.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},i.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},i.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},i.values=function(){var e=this,t=this.keys();return Zi({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},i.entries=function(){var e=this,t=this.keys();return Zi({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},i[e]=function(){return this.entries()},i.forEach=function(e,t){for(var n,r=H(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},i.merge=function(e){var t=this;return Ai(e)&&(e=new Map(e)),Kr(function(){x(e)?T(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)}):k(e)?(e.constructor!==Map&&r(19,e),e.forEach(function(e,n){return t.set(n,e)})):null!=e&&r(20,e)}),this},i.clear=function(){var e=this;Kr(function(){Lt(function(){for(var t,n=H(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}})})},i.replace=function(e){var t=this;return Kr(function(){for(var n,r=Si(e),i=new Map,o=!1,a=H(t.data_.keys());!(n=a()).done;){var s=n.value;if(!r.has(s))if(t.delete(s))o=!0;else{var u=t.data_.get(s);i.set(s,u)}}for(var c,l=H(r.entries());!(c=l()).done;){var f=c.value,h=f[0],v=f[1],d=t.data_.has(h);if(t.set(h,v),t.data_.has(h)){var _=t.data_.get(h);i.set(h,_),d||(o=!0)}}if(!o)if(t.data_.size!==i.size)t.keysAtom_.reportChanged();else for(var p=t.data_.keys(),b=i.keys(),y=p.next(),g=b.next();!y.done;){if(y.value!==g.value){t.keysAtom_.reportChanged();break}y=p.next(),g=b.next()}t.data_=i}),this},i.toString=function(){return"[object ObservableMap]"},i.toJSON=function(){return Array.from(this)},i.observe_=function(e,t){return Qr(this,e)},i.intercept_=function(e){return Yr(this,e)},L(n,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:t,get:function(){return"Map"}}]),n}(di=Symbol.iterator,_i=Symbol.toStringTag);exports.ObservableMap=Oi;var xi,wi,Ai=j("ObservableMap",Oi);function Si(e){if(k(e)||Ai(e))return e;if(Array.isArray(e))return new Map(e);if(x(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return r(21,e)}exports.isObservableMap=Ai;var ji={},ki=function(e,t){function n(e,t,n){void 0===t&&(t=oe),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[J]=ji,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,g(Set)||r(22),this.atom_=Z(this.name_),this.enhancer_=function(e,r){return t(e,r,n)},e&&this.replace(e)}var i=n.prototype;return i.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},i.clear=function(){var e=this;Kr(function(){Lt(function(){for(var t,n=H(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}})})},i.forEach=function(e,t){for(var n,r=H(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},i.add=function(e){var t=this;if((Ct(this.atom_),Fr(this))&&!Jr(this,{type:gi,object:this,newValue:e}))return this;if(!this.has(e)){Kr(function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()});var n=$r(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:gi,object:this,newValue:e}:null;0,n&&Zr(this,r)}return this},i.delete=function(e){var t=this;if(Fr(this)&&!Jr(this,{type:mi,object:this,oldValue:e}))return!1;if(this.has(e)){var n=$r(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:mi,object:this,oldValue:e}:null;return Kr(function(){t.atom_.reportChanged(),t.data_.delete(e)}),n&&Zr(this,r),!0}return!1},i.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},i.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return Zi({next:function(){var r=e;return e+=1,r<n.length?{value:[t[r],n[r]],done:!1}:{done:!0}}})},i.keys=function(){return this.values()},i.values=function(){this.atom_.reportObserved();var e=this,t=0,n=Array.from(this.data_.values());return Zi({next:function(){return t<n.length?{value:e.dehanceValue_(n[t++]),done:!1}:{done:!0}}})},i.replace=function(e){var t=this;return Ei(e)&&(e=new Set(e)),Kr(function(){Array.isArray(e)?(t.clear(),e.forEach(function(e){return t.add(e)})):E(e)?(t.clear(),e.forEach(function(e){return t.add(e)})):null!=e&&r("Cannot initialize set from "+e)}),this},i.observe_=function(e,t){return Qr(this,e)},i.intercept_=function(e){return Yr(this,e)},i.toJSON=function(){return Array.from(this)},i.toString=function(){return"[object ObservableSet]"},i[e]=function(){return this.values()},L(n,[{key:"size",get:function(){return this.atom_.reportObserved(),this.data_.size}},{key:t,get:function(){return"Set"}}]),n}(xi=Symbol.iterator,wi=Symbol.toStringTag);exports.ObservableSet=ki;var Ei=j("ObservableSet",ki);exports.isObservableSet=Ei;var Pi=Object.create(null),Ti="remove",Ci=function(){function e(e,t,n,r){void 0===t&&(t=new Map),void 0===r&&(r=Ve),this.target_=void 0,this.values_=void 0,this.name_=void 0,this.defaultAnnotation_=void 0,this.keysAtom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.proxy_=void 0,this.isPlainObject_=void 0,this.appliedAnnotations_=void 0,this.pendingKeys_=void 0,this.target_=e,this.values_=t,this.name_=n,this.defaultAnnotation_=r,this.keysAtom_=new $("ObservableObject.keys"),this.isPlainObject_=x(this.target_)}var t=e.prototype;return t.getObservablePropValue_=function(e){return this.values_.get(e).get()},t.setObservablePropValue_=function(e,t){var n=this.values_.get(e);if(n instanceof St)return n.set(t),!0;if(Fr(this)){var r=Jr(this,{type:ii,object:this.proxy_||this.target_,name:e,newValue:t});if(!r)return null;t=r.newValue}if((t=n.prepareNewValue_(t))!==Xt.UNCHANGED){var i=$r(this),o=i?{type:ii,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:n.value_,name:e,newValue:t}:null;0,n.setNewValue_(t),i&&Zr(this,o)}return!0},t.get_=function(e){return Xt.trackingDerivation&&!N(this.target_,e)&&this.has_(e),this.target_[e]},t.set_=function(e,t,n){return void 0===n&&(n=!1),N(this.target_,e)?this.values_.has(e)?this.setObservablePropValue_(e,t):n?Reflect.set(this.target_,e,t):(this.target_[e]=t,!0):this.extend_(e,{value:t,enumerable:!0,writable:!0,configurable:!0},this.defaultAnnotation_,n)},t.has_=function(e){if(!Xt.trackingDerivation)return e in this.target_;this.pendingKeys_||(this.pendingKeys_=new Map);var t=this.pendingKeys_.get(e);return t||(t=new Ot(e in this.target_,se,"ObservableObject.key?",!1),this.pendingKeys_.set(e,t)),t.get()},t.make_=function(e,t){if(!0===t&&(t=this.defaultAnnotation_),!1!==t){if(Li(this,t,e),!(e in this.target_)){var n;if(null!=(n=this.target_[z])&&n[e])return;r(1,t.annotationType_,this.name_+"."+e.toString())}for(var i=this.target_;i&&i!==c;){var o=s(i,e);if(o){var a=t.make_(this,e,o,i);if(0===a)return;if(1===a)break}i=Object.getPrototypeOf(i)}Bi(this,t,e)}},t.extend_=function(e,t,n,r){if(void 0===r&&(r=!1),!0===n&&(n=this.defaultAnnotation_),!1===n)return this.defineProperty_(e,t,r);Li(this,n,e);var i=n.extend_(this,e,t,r);return i&&Bi(this,n,e),i},t.defineProperty_=function(e,t,n){void 0===n&&(n=!1);try{nn();var r=this.delete_(e);if(!r)return r;if(Fr(this)){var i=Jr(this,{object:this.proxy_||this.target_,name:e,type:gi,newValue:t.value});if(!i)return null;var o=i.newValue;t.value!==o&&(t=M({},t,{value:o}))}if(n){if(!Reflect.defineProperty(this.target_,e,t))return!1}else u(this.target_,e,t);this.notifyPropertyAddition_(e,t.value)}finally{rn()}return!0},t.defineObservableProperty_=function(e,t,n,r){void 0===r&&(r=!1);try{nn();var i=this.delete_(e);if(!i)return i;if(Fr(this)){var o=Jr(this,{object:this.proxy_||this.target_,name:e,type:gi,newValue:t});if(!o)return null;t=o.newValue}var a=Ni(e),s={configurable:!Xt.safeDescriptors||this.isPlainObject_,enumerable:!0,get:a.get,set:a.set};if(r){if(!Reflect.defineProperty(this.target_,e,s))return!1}else u(this.target_,e,s);var c=new Ot(t,n,"ObservableObject.key",!1);this.values_.set(e,c),this.notifyPropertyAddition_(e,c.value_)}finally{rn()}return!0},t.defineComputedProperty_=function(e,t,n){void 0===n&&(n=!1);try{nn();var r=this.delete_(e);if(!r)return r;if(Fr(this))if(!Jr(this,{object:this.proxy_||this.target_,name:e,type:gi,newValue:void 0}))return null;t.name||(t.name="ObservableObject.key"),t.context=this.proxy_||this.target_;var i=Ni(e),o={configurable:!Xt.safeDescriptors||this.isPlainObject_,enumerable:!1,get:i.get,set:i.set};if(n){if(!Reflect.defineProperty(this.target_,e,o))return!1}else u(this.target_,e,o);this.values_.set(e,new St(t)),this.notifyPropertyAddition_(e,void 0)}finally{rn()}return!0},t.delete_=function(e,t){if(void 0===t&&(t=!1),!N(this.target_,e))return!0;if(Fr(this)&&!Jr(this,{object:this.proxy_||this.target_,name:e,type:Ti}))return null;try{var n,r;nn();var i,o=$r(this),a=this.values_.get(e),u=void 0;if(!a&&o)u=null==(i=s(this.target_,e))?void 0:i.value;if(t){if(!Reflect.deleteProperty(this.target_,e))return!1}else delete this.target_[e];if(a&&(this.values_.delete(e),a instanceof Ot&&(u=a.value_),an(a)),this.keysAtom_.reportChanged(),null==(n=this.pendingKeys_)||null==(r=n.get(e))||r.set(e in this.target_),o){var c={type:Ti,observableKind:"object",object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:u,name:e};0,o&&Zr(this,c)}}finally{rn()}return!0},t.observe_=function(e,t){return Qr(this,e)},t.intercept_=function(e){return Yr(this,e)},t.notifyPropertyAddition_=function(e,t){var n,r,i=$r(this);if(i){var o=i?{type:gi,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,name:e,newValue:t}:null;0,i&&Zr(this,o)}null==(n=this.pendingKeys_)||null==(r=n.get(e))||r.set(!0),this.keysAtom_.reportChanged()},t.ownKeys_=function(){return this.keysAtom_.reportObserved(),C(this.target_)},t.keys_=function(){return this.keysAtom_.reportObserved(),Object.keys(this.target_)},e}();function Ri(e,t){var n;if(N(e,J))return e;var r=null!=(n=null==t?void 0:t.name)?n:"ObservableObject",i=new Ci(e,new Map,String(r),Ye(t));return A(e,J,i),e}var Vi=j("ObservableObjectAdministration",Ci);function Ni(e){return Pi[e]||(Pi[e]={get:function(){return this[J].getObservablePropValue_(e)},set:function(t){return this[J].setObservablePropValue_(e,t)}})}function Di(e){return!!O(e)&&Vi(e[J])}function Bi(e,t,n){var r;null==(r=e.target_[z])||delete r[n]}function Li(e,t,n){}var Mi=0,Ii=function(){};function Ui(e,t){Object.setPrototypeOf?Object.setPrototypeOf(e.prototype,t):void 0!==e.prototype.__proto__?e.prototype.__proto__=t:e.prototype=t}Ui(Ii,Array.prototype);var Ki=function(e,t,n){function r(t,n,r,i){var o;void 0===r&&(r="ObservableArray"),void 0===i&&(i=!1),o=e.call(this)||this;var a=new si(r,n,i,!0);if(a.proxy_=K(o),S(K(o),J,a),t&&t.length){var s=bt(!0);o.spliceWithArray(0,0,t),yt(s)}return o}I(r,e);var i=r.prototype;return i.concat=function(){this[J].atom_.reportObserved();for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return Array.prototype.concat.apply(this.slice(),t.map(function(e){return bi(e)?e.slice():e}))},i[n]=function(){var e=this,t=0;return Zi({next:function(){return t<e.length?{value:e[t++],done:!1}:{done:!0,value:void 0}}})},L(r,[{key:"length",get:function(){return this[J].getArrayLength_()},set:function(e){this[J].setArrayLength_(e)}},{key:t,get:function(){return"Array"}}]),r}(Ii,Symbol.toStringTag,Symbol.iterator);function Gi(e){return{enumerable:!1,configurable:!0,get:function(){return this[J].get_(e)},set:function(t){this[J].set_(e,t)}}}function qi(e){u(Ki.prototype,""+e,Gi(e))}function Hi(e){if(e>Mi){for(var t=Mi;t<e+100;t++)qi(t);Mi=e}}function zi(e,t,n){return new Ki(e,t,n)}function Wi(e,t){if("object"==typeof e&&null!==e){if(bi(e))return void 0!==t&&r(23),e[J].atom_;if(Ei(e))return e[J];if(Ai(e)){if(void 0===t)return e.keysAtom_;var n=e.data_.get(t)||e.hasMap_.get(t);return n||r(25,t,Fi(e)),n}if(Di(e)){if(!t)return r(26);var i=e[J].values_.get(t);return i||r(27,t,Fi(e)),i}if(Q(e)||jt(e)||bn(e))return e}else if(g(e)&&bn(e[J]))return e[J];r(28)}function Xi(e,t){return e||r(29),void 0!==t?Xi(Wi(e,t)):Q(e)||jt(e)||bn(e)?e:Ai(e)||Ei(e)?e:e[J]?e[J]:void r(24,e)}function Fi(e,t){var n;if(void 0!==t)n=Wi(e,t);else{if(Mn(e))return e.name;n=Di(e)||Ai(e)||Ei(e)?Xi(e):Wi(e)}return n.name_}Object.entries(ci).forEach(function(e){var t=e[0],n=e[1];"concat"!==t&&A(Ki.prototype,t,n)}),Hi(1e3);var Yi=c.toString;function Ji(e,t,n){return void 0===n&&(n=-1),$i(e,t,n)}function $i(e,t,n,r,i){if(e===t)return 0!==e||1/e==1/t;if(null==e||null==t)return!1;if(e!=e)return t!=t;var o=typeof e;if("function"!==o&&"object"!==o&&"object"!=typeof t)return!1;var a=Yi.call(e);if(a!==Yi.call(t))return!1;switch(a){case"[object RegExp]":case"[object String]":return""+e==""+t;case"[object Number]":return+e!=+e?+t!=+t:0==+e?1/+e==1/t:+e==+t;case"[object Date]":case"[object Boolean]":return+e==+t;case"[object Symbol]":return"undefined"!=typeof Symbol&&Symbol.valueOf.call(e)===Symbol.valueOf.call(t);case"[object Map]":case"[object Set]":n>=0&&n++}e=Qi(e),t=Qi(t);var s="[object Array]"===a;if(!s){if("object"!=typeof e||"object"!=typeof t)return!1;var u=e.constructor,c=t.constructor;if(u!==c&&!(g(u)&&u instanceof u&&g(c)&&c instanceof c)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var l=(r=r||[]).length;l--;)if(r[l]===e)return i[l]===t;if(r.push(e),i.push(t),s){if((l=e.length)!==t.length)return!1;for(;l--;)if(!$i(e[l],t[l],n-1,r,i))return!1}else{var f,h=Object.keys(e);if(l=h.length,Object.keys(t).length!==l)return!1;for(;l--;)if(!N(t,f=h[l])||!$i(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function Qi(e){return bi(e)?e.slice():k(e)||Ai(e)?Array.from(e.entries()):E(e)||Ei(e)?Array.from(e.entries()):e}function Zi(e){return e[Symbol.iterator]=eo,e}function eo(){return this}function to(e){return e instanceof Object&&"string"==typeof e.annotationType_&&g(e.make_)&&g(e.extend_)}["Symbol","Map","Set"].forEach(function(e){void 0===o()[e]&&r("MobX requires global '"+e+"' to be available or polyfilled")}),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:An,extras:{getDebugName:Fi},$mobx:J});
17
+ var e=arguments[3];Object.defineProperty(exports,"__esModule",{value:!0}),exports.FlowCancellationError=ar,exports._allowStateChanges=pt,exports.runInAction=exports._allowStateChangesInsideComputed=Ln,exports._allowStateReadsEnd=Kt,exports._allowStateReadsStart=Ut,exports._endAction=_t,exports._getAdministration=Xi,exports._getGlobalState=Jt,exports._interceptReads=dr,exports._isComputingDerivation=Tt,exports._resetGlobalState=Yt,exports._startAction=dt,exports.autorun=In,exports.configure=Qn,exports.createAtom=Z,exports.defineProperty=Cr,exports.entries=jr,exports.extendObservable=Zn,exports.flowResult=hr,exports.get=Tr,exports.getAtom=Wi,exports.getDebugName=Fi,exports.getDependencyTree=er,exports.getObserverTree=nr,exports.has=Pr,exports.intercept=_r,exports.isAction=Mn,exports.isComputed=gr,exports.isComputedProp=mr,exports.isFlow=vr,exports.isFlowCancellationError=sr,exports.isObservable=xr,exports.isObservableArray=bi,exports.isObservableObject=Di,exports.isObservableProp=wr,exports.keys=Ar,exports.makeAutoObservable=ni,exports.makeObservable=ei,exports.observe=Vr,exports.onBecomeObserved=Wn,exports.onBecomeUnobserved=Xn,exports.onReactionError=hn,exports.ownKeys=Rr,exports.reaction=Gn,exports.remove=Er,exports.set=kr,exports.spy=An,exports.toJS=Mr,exports.trace=Ir,exports.transaction=Kr,exports.untracked=Lt,exports.values=Sr,exports.when=Gr,exports.override=exports.observable=exports.isObservableSet=exports.isObservableMap=exports.isBoxedObservable=exports.flow=exports.computed=exports.comparer=exports.action=exports._autoAction=exports.Reaction=exports.ObservableSet=exports.ObservableMap=exports.$mobx=void 0;var t={0:"Invalid value for configuration 'enforceActions', expected 'never', 'always' or 'observed'",1:function(e,t){return"Cannot apply '"+e+"' to '"+t.toString()+"': Field not found."},5:"'keys()' can only be used on observable objects, arrays, sets and maps",6:"'values()' can only be used on observable objects, arrays, sets and maps",7:"'entries()' can only be used on observable objects, arrays and maps",8:"'set()' can only be used on observable objects, arrays and maps",9:"'remove()' can only be used on observable objects, arrays and maps",10:"'has()' can only be used on observable objects, arrays and maps",11:"'get()' can only be used on observable objects, arrays and maps",12:"Invalid annotation",13:"Dynamic observable objects cannot be frozen. If you're passing observables to 3rd party component/function that calls Object.freeze, pass copy instead: toJS(observable)",14:"Intercept handlers should return nothing or a change object",15:"Observable arrays cannot be frozen. If you're passing observables to 3rd party component/function that calls Object.freeze, pass copy instead: toJS(observable)",16:"Modification exception: the internal structure of an observable array was changed.",17:function(e,t){return"[mobx.array] Index out of bounds, "+e+" is larger than "+t},18:"mobx.map requires Map polyfill for the current browser. Check babel-polyfill or core-js/es6/map.js",19:function(e){return"Cannot initialize from classes that inherit from Map: "+e.constructor.name},20:function(e){return"Cannot initialize map from "+e},21:function(e){return"Cannot convert to map from '"+e+"'"},22:"mobx.set requires Set polyfill for the current browser. Check babel-polyfill or core-js/es6/set.js",23:"It is not possible to get index atoms from arrays",24:function(e){return"Cannot obtain administration from "+e},25:function(e,t){return"the entry '"+e+"' does not exist in the observable map '"+t+"'"},26:"please specify a property",27:function(e,t){return"no observable property '"+e.toString()+"' found on the observable object '"+t+"'"},28:function(e){return"Cannot obtain atom from "+e},29:"Expecting some object",30:"invalid action stack. did you forget to finish an action?",31:"missing option for computed: get",32:function(e,t){return"Cycle detected in computation "+e+": "+t},33:function(e){return"The setter of computed value '"+e+"' is trying to update itself. Did you intend to update an _observable_ value, instead of the computed property?"},34:function(e){return"[ComputedValue '"+e+"'] It is not possible to assign a new value to a computed value."},35:"There are multiple, different versions of MobX active. Make sure MobX is loaded only once or use `configure({ isolateGlobalState: true })`",36:"isolateGlobalState should be called before MobX is running any reactions",37:function(e){return"[mobx] `observableArray."+e+"()` mutates the array in-place, which is not allowed inside a derivation. Use `array.slice()."+e+"()` instead"},38:"'ownKeys()' can only be used on observable objects",39:"'defineProperty()' can only be used on observable objects"},n={};function r(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];throw new Error("number"==typeof e?"[MobX] minified error nr: "+e+(n.length?" "+n.map(String).join(","):"")+". Find the full error at: https://github.com/mobxjs/mobx/blob/main/packages/mobx/src/errors.ts":"[MobX] "+e)}var i={};function o(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==e?e:"undefined"!=typeof self?self:i}var a=Object.assign,s=Object.getOwnPropertyDescriptor,u=Object.defineProperty,c=Object.prototype,l=[];Object.freeze(l);var f={};Object.freeze(f);var h="undefined"!=typeof Proxy,v=Object.toString();function d(){h||r("Proxy not available")}function _(e){0}function p(){return++Xt.mobxGuid}function b(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}var y=function(){};function g(e){return"function"==typeof e}function m(e){switch(typeof e){case"string":case"symbol":case"number":return!0}return!1}function O(e){return null!==e&&"object"==typeof e}function x(e){if(!O(e))return!1;var t=Object.getPrototypeOf(e);if(null==t)return!0;var n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n.toString()===v}function w(e){var t=null==e?void 0:e.constructor;return!!t&&("GeneratorFunction"===t.name||"GeneratorFunction"===t.displayName)}function A(e,t,n){u(e,t,{enumerable:!1,writable:!0,configurable:!0,value:n})}function S(e,t,n){u(e,t,{enumerable:!1,writable:!1,configurable:!0,value:n})}function j(e,t){var n="isMobX"+e;return t.prototype[n]=!0,function(e){return O(e)&&!0===e[n]}}function k(e){return e instanceof Map}function E(e){return e instanceof Set}var P=void 0!==Object.getOwnPropertySymbols;function T(e){var t=Object.keys(e);if(!P)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter(function(t){return c.propertyIsEnumerable.call(e,t)})):t}var C="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:P?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames;function R(e){return"string"==typeof e?e:"symbol"==typeof e?e.toString():new String(e).toString()}function V(e){return null===e?null:"object"==typeof e?""+e:e}function N(e,t){return c.hasOwnProperty.call(e,t)}var D=Object.getOwnPropertyDescriptors||function(e){var t={};return C(e).forEach(function(n){t[n]=s(e,n)}),t};function B(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function L(e,t,n){return t&&B(e.prototype,t),n&&B(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function M(){return(M=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function I(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,U(e,t)}function U(e,t){return(U=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function K(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function G(e,t){if(e){if("string"==typeof e)return q(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?q(e,t):void 0}}function q(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function z(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=G(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var H=Symbol("mobx-stored-annotations");function W(e){return Object.assign(function(t,n){X(t,n,e)},e)}function X(e,t,n){N(e,H)||A(e,H,M({},e[H])),F(e,n,t),fe(n)||(e[H][t]=n)}function F(e,t,n){}function J(e){return N(e,H)||A(e,H,M({},e[H])),e[H]}var Y=Symbol("mobx administration");exports.$mobx=Y;var $=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=wt.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach(function(e){return e()})},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(e){return e()})},t.reportObserved=function(){return on(this)},t.reportChanged=function(){nn(),an(this),rn()},t.toString=function(){return this.name_},e}(),Q=j("Atom",$);function Z(e,t,n){void 0===t&&(t=y),void 0===n&&(n=y);var r=new $(e);return t!==y&&Wn(r,t),n!==y&&Xn(r,n),r}function ee(e,t){return e===t}function te(e,t){return Yi(e,t)}function ne(e,t){return Yi(e,t,1)}function re(e,t){return Object.is?Object.is(e,t):e===t?0!==e||1/e==1/t:e!=e&&t!=t}var ie={identity:ee,structural:te,default:re,shallow:ne};function oe(e,t,n){return xr(e)?e:Array.isArray(e)?Ze.array(e,{name:n}):x(e)?Ze.object(e,void 0,{name:n}):k(e)?Ze.map(e,{name:n}):E(e)?Ze.set(e,{name:n}):"function"!=typeof e||Mn(e)||vr(e)?e:w(e)?lr(e):Bn(n,e)}function ae(e,t,n){return null==e?e:Di(e)||bi(e)||Ai(e)||Ei(e)?e:Array.isArray(e)?Ze.array(e,{name:n,deep:!1}):x(e)?Ze.object(e,void 0,{name:n,deep:!1}):k(e)?Ze.map(e,{name:n,deep:!1}):E(e)?Ze.set(e,{name:n,deep:!1}):void 0}function se(e){return e}function ue(e,t){return Yi(e,t)?t:e}exports.comparer=ie;var ce="override",le=W({annotationType_:ce,make_:he,extend_:ve});function fe(e){return e.annotationType_===ce}function he(e,t){return 0}function ve(e,t,n,i){r("'"+this.annotationType_+"' can only be used with 'makeObservable'")}function de(e,t){return{annotationType_:e,options_:t,make_:_e,extend_:pe}}function _e(e,t,n,r){var i;if(null!=(i=this.options_)&&i.bound)return null===this.extend_(e,t,n,!1)?0:1;if(r===e.target_)return null===this.extend_(e,t,n,!1)?0:2;if(Mn(n.value))return 1;var o=ye(e,this,t,n,!1);return u(r,t,o),2}function pe(e,t,n,r){var i=ye(e,this,t,n);return e.defineProperty_(t,i,r)}function be(e,t,n,r){t.annotationType_,r.value}function ye(e,t,n,r,i){var o,a,s,u,c,l,f;void 0===i&&(i=Xt.safeDescriptors),be(e,t,n,r);var h,v=r.value;null!=(o=t.options_)&&o.bound&&(v=v.bind(null!=(h=e.proxy_)?h:e.target_));return{value:ht(null!=(a=null==(s=t.options_)?void 0:s.name)?a:n.toString(),v,null!=(u=null==(c=t.options_)?void 0:c.autoAction)&&u,null!=(l=t.options_)&&l.bound?null!=(f=e.proxy_)?f:e.target_:void 0),configurable:!i||e.isPlainObject_,enumerable:!1,writable:!i}}function ge(e,t){return{annotationType_:e,options_:t,make_:me,extend_:Oe}}function me(e,t,n,r){var i;if(r===e.target_)return null===this.extend_(e,t,n,!1)?0:2;if(null!=(i=this.options_)&&i.bound&&(!N(e.target_,t)||!vr(e.target_[t]))&&null===this.extend_(e,t,n,!1))return 0;if(vr(n.value))return 1;var o=we(e,this,t,n,!1,!1);return u(r,t,o),2}function Oe(e,t,n,r){var i,o=we(e,this,t,n,null==(i=this.options_)?void 0:i.bound);return e.defineProperty_(t,o,r)}function xe(e,t,n,r){t.annotationType_,r.value}function we(e,t,n,r,i,o){void 0===o&&(o=Xt.safeDescriptors),xe(e,t,n,r);var a,s=r.value;(vr(s)||(s=lr(s)),i)&&((s=s.bind(null!=(a=e.proxy_)?a:e.target_)).isMobXFlow=!0);return{value:s,configurable:!o||e.isPlainObject_,enumerable:!1,writable:!o}}function Ae(e,t){return{annotationType_:e,options_:t,make_:Se,extend_:je}}function Se(e,t,n){return null===this.extend_(e,t,n,!1)?0:1}function je(e,t,n,r){return ke(e,this,t,n),e.defineComputedProperty_(t,M({},this.options_,{get:n.get,set:n.set}),r)}function ke(e,t,n,r){t.annotationType_,r.get}function Ee(e,t){return{annotationType_:e,options_:t,make_:Pe,extend_:Te}}function Pe(e,t,n){return null===this.extend_(e,t,n,!1)?0:1}function Te(e,t,n,r){var i,o;return Ce(e,this,t,n),e.defineObservableProperty_(t,n.value,null!=(i=null==(o=this.options_)?void 0:o.enhancer)?i:oe,r)}function Ce(e,t,n,r){t.annotationType_}exports.override=le;var Re="true",Ve=Ne();function Ne(e){return{annotationType_:Re,options_:e,make_:De,extend_:Be}}function De(e,t,n,r){var i,o,a,s;if(n.get)return at.make_(e,t,n,r);if(n.set){var c=ht(t.toString(),n.set);return r===e.target_?null===e.defineProperty_(t,{configurable:!Xt.safeDescriptors||e.isPlainObject_,set:c})?0:2:(u(r,t,{configurable:!0,set:c}),2)}if(r!==e.target_&&"function"==typeof n.value)return w(n.value)?(null!=(s=this.options_)&&s.autoBind?lr.bound:lr).make_(e,t,n,r):(null!=(a=this.options_)&&a.autoBind?Bn.bound:Bn).make_(e,t,n,r);var l,f=!1===(null==(i=this.options_)?void 0:i.deep)?Ze.ref:Ze;"function"==typeof n.value&&null!=(o=this.options_)&&o.autoBind&&(n.value=n.value.bind(null!=(l=e.proxy_)?l:e.target_));return f.make_(e,t,n,r)}function Be(e,t,n,r){var i,o,a;if(n.get)return at.extend_(e,t,n,r);if(n.set)return e.defineProperty_(t,{configurable:!Xt.safeDescriptors||e.isPlainObject_,set:ht(t.toString(),n.set)},r);"function"==typeof n.value&&null!=(i=this.options_)&&i.autoBind&&(n.value=n.value.bind(null!=(a=e.proxy_)?a:e.target_));return(!1===(null==(o=this.options_)?void 0:o.deep)?Ze.ref:Ze).extend_(e,t,n,r)}var Le="observable",Me="observable.ref",Ie="observable.shallow",Ue="observable.struct",Ke={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};function Ge(e){return e||Ke}Object.freeze(Ke);var qe=Ee(Le),ze=Ee(Me,{enhancer:se}),He=Ee(Ie,{enhancer:ae}),We=Ee(Ue,{enhancer:ue}),Xe=W(qe);function Fe(e){return!0===e.deep?oe:!1===e.deep?se:Ye(e.defaultDecorator)}function Je(e){var t;return e?null!=(t=e.defaultDecorator)?t:Ne(e):void 0}function Ye(e){var t,n;return e&&null!=(t=null==(n=e.options_)?void 0:n.enhancer)?t:oe}function $e(e,t,n){if(!m(t))return xr(e)?e:x(e)?Ze.object(e,t,n):Array.isArray(e)?Ze.array(e,t):k(e)?Ze.map(e,t):E(e)?Ze.set(e,t):"object"==typeof e&&null!==e?e:Ze.box(e,t);X(e,t,qe)}Object.assign($e,Xe);var Qe={box:function(e,t){var n=Ge(t);return new Ot(e,Fe(n),n.name,!0,n.equals)},array:function(e,t){var n=Ge(t);return(!1===Xt.useProxies||!1===n.proxy?Hi:ui)(e,Fe(n),n.name)},map:function(e,t){var n=Ge(t);return new Oi(e,Fe(n),n.name)},set:function(e,t){var n=Ge(t);return new ki(e,Fe(n),n.name)},object:function(e,t,n){return Zn(!1===Xt.useProxies||!1===(null==n?void 0:n.proxy)?Ri({},n):Xr({},n),e,t)},ref:W(ze),shallow:W(He),deep:Xe,struct:W(We)},Ze=a($e,Qe);exports.observable=Ze;var et,tt,nt="computed",rt="computed.struct",it=Ae(nt),ot=Ae(rt,{equals:ie.structural}),at=function(e,t){if(m(t))return X(e,t,it);if(x(e))return W(Ae(nt,e));var n=x(t)?t:{};return n.get=e,n.name||(n.name=e.name||""),new St(n)};exports.computed=at,Object.assign(at,it),at.struct=W(ot);var st,ut=0,ct=1,lt=null!=(et=null==(tt=s(function(){},"name"))?void 0:tt.configurable)&&et,ft={value:"action",configurable:!0,writable:!1,enumerable:!1};function ht(e,t,n,r){function i(){return vt(e,n,t,r||this,arguments)}return void 0===n&&(n=!1),i.isMobxAction=!0,lt&&(ft.value=e,Object.defineProperty(i,"name",ft)),i}function vt(e,t,n,r,i){var o=dt(e,t,r,i);try{return n.apply(r,i)}catch(a){throw o.error_=a,a}finally{_t(o)}}function dt(e,t,n,r){var i=0,o=Xt.trackingDerivation,a=!t||!o;nn();var s=Xt.allowStateChanges;a&&(Mt(),s=bt(!0));var u={runAsAction_:a,prevDerivation_:o,prevAllowStateChanges_:s,prevAllowStateReads_:Ut(!0),notifySpy_:!1,startTime_:i,actionId_:ct++,parentActionId_:ut};return ut=u.actionId_,u}function _t(e){ut!==e.actionId_&&r(30),ut=e.parentActionId_,void 0!==e.error_&&(Xt.suppressReactionErrors=!0),yt(e.prevAllowStateChanges_),Kt(e.prevAllowStateReads_),rn(),e.runAsAction_&&It(e.prevDerivation_),Xt.suppressReactionErrors=!1}function pt(e,t){var n=bt(e);try{return t()}finally{yt(n)}}function bt(e){var t=Xt.allowStateChanges;return Xt.allowStateChanges=e,t}function yt(e){Xt.allowStateChanges=e}var gt="create";st=Symbol.toPrimitive;var mt,Ot=function(e,t){function n(t,n,r,i,o){var a;return void 0===r&&(r="ObservableValue"),void 0===i&&(i=!0),void 0===o&&(o=ie.default),(a=e.call(this,r)||this).enhancer=void 0,a.name_=void 0,a.equals=void 0,a.hasUnreportedChange_=!1,a.interceptors_=void 0,a.changeListeners_=void 0,a.value_=void 0,a.dehancer=void 0,a.enhancer=n,a.name_=r,a.equals=o,a.value_=n(t,void 0,r),a}I(n,e);var r=n.prototype;return r.dehanceValue=function(e){return void 0!==this.dehancer?this.dehancer(e):e},r.set=function(e){this.value_;if((e=this.prepareNewValue_(e))!==Xt.UNCHANGED){gn();0,this.setNewValue_(e)}},r.prepareNewValue_=function(e){if(Ct(this),Fr(this)){var t=Yr(this,{object:this,type:ii,newValue:e});if(!t)return Xt.UNCHANGED;e=t.newValue}return e=this.enhancer(e,this.value_,this.name_),this.equals(this.value_,e)?Xt.UNCHANGED:e},r.setNewValue_=function(e){var t=this.value_;this.value_=e,this.reportChanged(),$r(this)&&Zr(this,{type:ii,object:this,newValue:e,oldValue:t})},r.get=function(){return this.reportObserved(),this.dehanceValue(this.value_)},r.intercept_=function(e){return Jr(this,e)},r.observe_=function(e,t){return t&&e({observableKind:"value",debugObjectName:this.name_,object:this,type:ii,newValue:this.value_,oldValue:void 0}),Qr(this,e)},r.raw=function(){return this.value_},r.toJSON=function(){return this.get()},r.toString=function(){return this.name_+"["+this.value_+"]"},r.valueOf=function(){return V(this.get())},r[t]=function(){return this.valueOf()},n}($,st),xt=j("ObservableValue",Ot);exports.isBoxedObservable=xt;var wt,At,St=function(e){function t(e){this.dependenciesState_=wt.NOT_TRACKING_,this.observing_=[],this.newObserving_=null,this.isBeingObserved_=!1,this.isPendingUnobservation_=!1,this.observers_=new Set,this.diffValue_=0,this.runId_=0,this.lastAccessedBy_=0,this.lowestObserverState_=wt.UP_TO_DATE_,this.unboundDepsCount_=0,this.value_=new kt(null),this.name_=void 0,this.triggeredBy_=void 0,this.isComputing_=!1,this.isRunningSetter_=!1,this.derivation=void 0,this.setter_=void 0,this.isTracing_=At.NONE,this.scope_=void 0,this.equals_=void 0,this.requiresReaction_=void 0,this.keepAlive_=void 0,this.onBOL=void 0,this.onBUOL=void 0,e.get||r(31),this.derivation=e.get,this.name_=e.name||"ComputedValue",e.set&&(this.setter_=ht("ComputedValue-setter",e.set)),this.equals_=e.equals||(e.compareStructural||e.struct?ie.structural:ie.default),this.scope_=e.context,this.requiresReaction_=e.requiresReaction,this.keepAlive_=!!e.keepAlive}var n=t.prototype;return n.onBecomeStale_=function(){un(this)},n.onBO=function(){this.onBOL&&this.onBOL.forEach(function(e){return e()})},n.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(e){return e()})},n.get=function(){if(this.isComputing_&&r(32,this.name_,this.derivation),0!==Xt.inBatch||0!==this.observers_.size||this.keepAlive_){if(on(this),Pt(this)){var e=Xt.trackingContext;this.keepAlive_&&!e&&(Xt.trackingContext=this),this.trackAndCompute()&&sn(this),Xt.trackingContext=e}}else Pt(this)&&(this.warnAboutUntrackedRead_(),nn(),this.value_=this.computeValue_(!1),rn());var t=this.value_;if(Et(t))throw t.cause;return t},n.set=function(e){if(this.setter_){this.isRunningSetter_&&r(33,this.name_),this.isRunningSetter_=!0;try{this.setter_.call(this.scope_,e)}finally{this.isRunningSetter_=!1}}else r(34,this.name_)},n.trackAndCompute=function(){var e=this.value_,t=this.dependenciesState_===wt.NOT_TRACKING_,n=this.computeValue_(!0),r=t||Et(e)||Et(n)||!this.equals_(e,n);return r&&(this.value_=n),r},n.computeValue_=function(e){this.isComputing_=!0;var t,n=bt(!1);if(e)t=Vt(this,this.derivation,this.scope_);else if(!0===Xt.disableErrorBoundaries)t=this.derivation.call(this.scope_);else try{t=this.derivation.call(this.scope_)}catch(r){t=new kt(r)}return yt(n),this.isComputing_=!1,t},n.suspend_=function(){this.keepAlive_||(Bt(this),this.value_=void 0)},n.observe_=function(e,t){var n=this,r=!0,i=void 0;return In(function(){var o=n.get();if(!r||t){var a=Mt();e({observableKind:"computed",debugObjectName:n.name_,type:ii,object:n,newValue:o,oldValue:i}),It(a)}r=!1,i=o})},n.warnAboutUntrackedRead_=function(){},n.toString=function(){return this.name_+"["+this.derivation.toString()+"]"},n.valueOf=function(){return V(this.get())},n[e]=function(){return this.valueOf()},t}(mt=Symbol.toPrimitive),jt=j("ComputedValue",St);!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_"}(wt||(wt={})),function(e){e[e.NONE=0]="NONE",e[e.LOG=1]="LOG",e[e.BREAK=2]="BREAK"}(At||(At={}));var kt=function(e){this.cause=void 0,this.cause=e};function Et(e){return e instanceof kt}function Pt(e){switch(e.dependenciesState_){case wt.UP_TO_DATE_:return!1;case wt.NOT_TRACKING_:case wt.STALE_:return!0;case wt.POSSIBLY_STALE_:for(var t=Ut(!0),n=Mt(),r=e.observing_,i=r.length,o=0;o<i;o++){var a=r[o];if(jt(a)){if(Xt.disableErrorBoundaries)a.get();else try{a.get()}catch(s){return It(n),Kt(t),!0}if(e.dependenciesState_===wt.STALE_)return It(n),Kt(t),!0}}return Gt(e),It(n),Kt(t),!1}}function Tt(){return null!==Xt.trackingDerivation}function Ct(e){}function Rt(e){0}function Vt(e,t,n){var r=Ut(!0);Gt(e),e.newObserving_=new Array(e.observing_.length+100),e.unboundDepsCount_=0,e.runId_=++Xt.runId;var i,o=Xt.trackingDerivation;if(Xt.trackingDerivation=e,Xt.inBatch++,!0===Xt.disableErrorBoundaries)i=t.call(n);else try{i=t.call(n)}catch(a){i=new kt(a)}return Xt.inBatch--,Xt.trackingDerivation=o,Dt(e),Nt(e),Kt(r),i}function Nt(e){}function Dt(e){for(var t=e.observing_,n=e.observing_=e.newObserving_,r=wt.UP_TO_DATE_,i=0,o=e.unboundDepsCount_,a=0;a<o;a++){var s=n[a];0===s.diffValue_&&(s.diffValue_=1,i!==a&&(n[i]=s),i++),s.dependenciesState_>r&&(r=s.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var u=t[o];0===u.diffValue_&&en(u,e),u.diffValue_=0}for(;i--;){var c=n[i];1===c.diffValue_&&(c.diffValue_=0,Zt(c,e))}r!==wt.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}function Bt(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)en(t[n],e);e.dependenciesState_=wt.NOT_TRACKING_}function Lt(e){var t=Mt();try{return e()}finally{It(t)}}function Mt(){var e=Xt.trackingDerivation;return Xt.trackingDerivation=null,e}function It(e){Xt.trackingDerivation=e}function Ut(e){var t=Xt.allowStateReads;return Xt.allowStateReads=e,t}function Kt(e){Xt.allowStateReads=e}function Gt(e){if(e.dependenciesState_!==wt.UP_TO_DATE_){e.dependenciesState_=wt.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=wt.UP_TO_DATE_}}var qt=["mobxGuid","spyListeners","enforceActions","computedRequiresReaction","reactionRequiresObservable","observableRequiresReaction","allowStateReads","disableErrorBoundaries","runId","UNCHANGED","useProxies"],zt=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0},Ht=!0,Wt=!1,Xt=function(){var e=o();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(Ht=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new zt).version&&(Ht=!1),Ht?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new zt):(setTimeout(function(){Wt||r(35)},1),new zt)}();function Ft(){if((Xt.pendingReactions.length||Xt.inBatch||Xt.isRunningReactions)&&r(36),Wt=!0,Ht){var e=o();0==--e.__mobxInstanceCount&&(e.__mobxGlobals=void 0),Xt=new zt}}function Jt(){return Xt}function Yt(){var e=new zt;for(var t in e)-1===qt.indexOf(t)&&(Xt[t]=e[t]);Xt.allowStateChanges=!Xt.enforceActions}function $t(e){return e.observers_&&e.observers_.size>0}function Qt(e){return e.observers_}function Zt(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function en(e,t){e.observers_.delete(t),0===e.observers_.size&&tn(e)}function tn(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,Xt.pendingUnobservations.push(e))}function nn(){Xt.inBatch++}function rn(){if(0==--Xt.inBatch){_n();for(var e=Xt.pendingUnobservations,t=0;t<e.length;t++){var n=e[t];n.isPendingUnobservation_=!1,0===n.observers_.size&&(n.isBeingObserved_&&(n.isBeingObserved_=!1,n.onBUO()),n instanceof St&&n.suspend_())}Xt.pendingUnobservations=[]}}function on(e){Rt(e);var t=Xt.trackingDerivation;return null!==t?(t.runId_!==e.lastAccessedBy_&&(e.lastAccessedBy_=t.runId_,t.newObserving_[t.unboundDepsCount_++]=e,!e.isBeingObserved_&&Xt.trackingContext&&(e.isBeingObserved_=!0,e.onBO())),!0):(0===e.observers_.size&&Xt.inBatch>0&&tn(e),!1)}function an(e){e.lowestObserverState_!==wt.STALE_&&(e.lowestObserverState_=wt.STALE_,e.observers_.forEach(function(e){e.dependenciesState_===wt.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=wt.STALE_}))}function sn(e){e.lowestObserverState_!==wt.STALE_&&(e.lowestObserverState_=wt.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===wt.POSSIBLY_STALE_?t.dependenciesState_=wt.STALE_:t.dependenciesState_===wt.UP_TO_DATE_&&(e.lowestObserverState_=wt.UP_TO_DATE_)}))}function un(e){e.lowestObserverState_===wt.UP_TO_DATE_&&(e.lowestObserverState_=wt.POSSIBLY_STALE_,e.observers_.forEach(function(e){e.dependenciesState_===wt.UP_TO_DATE_&&(e.dependenciesState_=wt.POSSIBLY_STALE_,e.onBecomeStale_())}))}function cn(e,t){if(console.log("[mobx.trace] '"+e.name_+"' is invalidated due to a change in: '"+t.name_+"'"),e.isTracing_===At.BREAK){var n=[];ln(er(e),n,1),new Function("debugger;\n/*\nTracing '"+e.name_+"'\n\nYou are entering this break point because derivation '"+e.name_+"' is being traced and '"+t.name_+"' is now forcing it to update.\nJust follow the stacktrace you should now see in the devtools to see precisely what piece of your code is causing this update\nThe stackframe you are looking for is at least ~6-8 stack-frames up.\n\n"+(e instanceof St?e.derivation.toString().replace(/[*]\//g,"/"):"")+"\n\nThe dependencies for this derivation are:\n\n"+n.join("\n")+"\n*/\n ")()}}function ln(e,t,n){t.length>=1e3?t.push("(and many more)"):(t.push(""+"\t".repeat(n-1)+e.name),e.dependencies&&e.dependencies.forEach(function(e){return ln(e,t,n+1)}))}var fn=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),void 0===r&&(r=!1),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=wt.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=At.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,Xt.pendingReactions.push(this),_n())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){nn(),this.isScheduled_=!1;var e=Xt.trackingContext;if(Xt.trackingContext=this,Pt(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(t){this.reportExceptionInDerivation_(t)}}Xt.trackingContext=e,rn()}},t.track=function(e){if(!this.isDisposed_){nn();gn();0,this.isRunning_=!0;var t=Xt.trackingContext;Xt.trackingContext=this;var n=Vt(this,e,void 0);Xt.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Bt(this),Et(n)&&this.reportExceptionInDerivation_(n.cause),rn()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(Xt.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";Xt.suppressReactionErrors||console.error(n,e),Xt.globalReactionErrorHandlers.forEach(function(n){return n(e,t)})}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(nn(),Bt(this),rn()))},t.getDisposer_=function(){var e=this.dispose.bind(this);return e[Y]=this,e},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1),Ir(this,e)},e}();function hn(e){return Xt.globalReactionErrorHandlers.push(e),function(){var t=Xt.globalReactionErrorHandlers.indexOf(e);t>=0&&Xt.globalReactionErrorHandlers.splice(t,1)}}exports.Reaction=fn;var vn=100,dn=function(e){return e()};function _n(){Xt.inBatch>0||Xt.isRunningReactions||dn(pn)}function pn(){Xt.isRunningReactions=!0;for(var e=Xt.pendingReactions,t=0;e.length>0;){++t===vn&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r<i;r++)n[r].runReaction_()}Xt.isRunningReactions=!1}var bn=j("Reaction",fn);function yn(e){var t=dn;dn=function(n){return e(function(){return t(n)})}}function gn(){return!1}function mn(e){}function On(e){}var xn={type:"report-end",spyReportEnd:!0};function wn(e){}function An(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}}var Sn="action",jn="action.bound",kn="autoAction",En="autoAction.bound",Pn="<unnamed action>",Tn=de(Sn),Cn=de(jn,{bound:!0}),Rn=de(kn,{autoAction:!0}),Vn=de(En,{autoAction:!0,bound:!0});function Nn(e){return function(t,n){return g(t)?ht(t.name||Pn,t,e):g(n)?ht(t,n,e):m(n)?X(t,n,e?Rn:Tn):m(t)?W(de(e?kn:Sn,{name:t,autoAction:e})):void 0}}var Dn=Nn(!1);exports.action=Dn,Object.assign(Dn,Tn);var Bn=Nn(!0);function Ln(e){return vt(e.name||Pn,!1,e,this,void 0)}function Mn(e){return g(e)&&!0===e.isMobxAction}function In(e,t){var n,r;void 0===t&&(t=f);var i,o=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(!t.scheduler&&!t.delay)i=new fn(o,function(){this.track(u)},t.onError,t.requiresObservable);else{var a=Kn(t),s=!1;i=new fn(o,function(){s||(s=!0,a(function(){s=!1,i.isDisposed_||i.track(u)}))},t.onError,t.requiresObservable)}function u(){e(i)}return i.schedule_(),i.getDisposer_()}exports._autoAction=Bn,Object.assign(Bn,Rn),Dn.bound=W(Cn),Bn.bound=W(Vn);var Un=function(e){return e()};function Kn(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Un}function Gn(e,t,n){var r;void 0===n&&(n=f);var i,o,a=null!=(r=n.name)?r:"Reaction",s=Dn(a,n.onError?qn(n.onError,t):t),u=!n.scheduler&&!n.delay,c=Kn(n),l=!0,h=!1,v=n.compareStructural?ie.structural:n.equals||ie.default,d=new fn(a,function(){l||u?_():h||(h=!0,c(_))},n.onError,n.requiresObservable);function _(){if(h=!1,!d.isDisposed_){var t=!1;d.track(function(){var n=pt(!1,function(){return e(d)});t=l||!v(i,n),o=i,i=n}),l&&n.fireImmediately?s(i,o,d):!l&&t&&s(i,o,d),l=!1}}return d.schedule_(),d.getDisposer_()}function qn(e,t){return function(){try{return t.apply(this,arguments)}catch(n){e.call(this,n)}}}var zn="onBO",Hn="onBUO";function Wn(e,t,n){return Fn(zn,e,t,n)}function Xn(e,t,n){return Fn(Hn,e,t,n)}function Fn(e,t,n,r){var i="function"==typeof r?Wi(t,n):Wi(t),o=g(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var Jn="never",Yn="always",$n="observed";function Qn(e){!0===e.isolateGlobalState&&Ft();var t=e.useProxies,n=e.enforceActions;if(void 0!==t&&(Xt.useProxies=t===Yn||t!==Jn&&"undefined"!=typeof Proxy),"ifavailable"===t&&(Xt.verifyProxies=!0),void 0!==n){var r=n===Yn?Yn:n===$n;Xt.enforceActions=r,Xt.allowStateChanges=!0!==r&&r!==Yn}["computedRequiresReaction","reactionRequiresObservable","observableRequiresReaction","disableErrorBoundaries","safeDescriptors"].forEach(function(t){t in e&&(Xt[t]=!!e[t])}),Xt.allowStateReads=!Xt.observableRequiresReaction,e.reactionScheduler&&yn(e.reactionScheduler)}function Zn(e,t,n,r){var i=D(t),o=Ri(e,r)[Y];nn();try{C(i).forEach(function(e){o.extend_(e,i[e],!n||(!(e in n)||n[e]))})}finally{rn()}return e}function er(e,t){return tr(Wi(e,t))}function tr(e){var t={name:e.name_};return e.observing_&&e.observing_.length>0&&(t.dependencies=ir(e.observing_).map(tr)),t}function nr(e,t){return rr(Wi(e,t))}function rr(e){var t={name:e.name_};return $t(e)&&(t.observers=Array.from(Qt(e)).map(rr)),t}function ir(e){return Array.from(new Set(e))}var or=0;function ar(){this.message="FLOW_CANCELLED"}function sr(e){return e instanceof ar}ar.prototype=Object.create(Error.prototype);var ur=ge("flow"),cr=ge("flow.bound",{bound:!0}),lr=Object.assign(function(e,t){if(m(t))return X(e,t,ur);var n=e,r=n.name||"<unnamed flow>",i=function(){var e,t=arguments,i=++or,o=Dn(r+" - runid: "+i+" - init",n).apply(this,t),a=void 0,s=new Promise(function(t,n){var s=0;function u(e){var t;a=void 0;try{t=Dn(r+" - runid: "+i+" - yield "+s++,o.next).call(o,e)}catch(u){return n(u)}l(t)}function c(e){var t;a=void 0;try{t=Dn(r+" - runid: "+i+" - yield "+s++,o.throw).call(o,e)}catch(u){return n(u)}l(t)}function l(e){if(!g(null==e?void 0:e.then))return e.done?t(e.value):(a=Promise.resolve(e.value)).then(u,c);e.then(l,n)}e=n,u(void 0)});return s.cancel=Dn(r+" - runid: "+i+" - cancel",function(){try{a&&fr(a);var t=o.return(void 0),n=Promise.resolve(t.value);n.then(y,y),fr(n),e(new ar)}catch(r){e(r)}}),s};return i.isMobXFlow=!0,i},ur);function fr(e){g(e.cancel)&&e.cancel()}function hr(e){return e}function vr(e){return!0===(null==e?void 0:e.isMobXFlow)}function dr(e,t,n){var r;return Ai(e)||bi(e)||xt(e)?r=Xi(e):Di(e)&&(r=Xi(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function _r(e,t,n){return g(n)?br(e,t,n):pr(e,t)}function pr(e,t){return Xi(e).intercept_(t)}function br(e,t,n){return Xi(e,t).intercept_(n)}function yr(e,t){if(void 0===t)return jt(e);if(!1===Di(e))return!1;if(!e[Y].values_.has(t))return!1;var n=Wi(e,t);return jt(n)}function gr(e){return yr(e)}function mr(e,t){return yr(e,t)}function Or(e,t){return!!e&&(void 0!==t?!!Di(e)&&e[Y].values_.has(t):Di(e)||!!e[Y]||Q(e)||bn(e)||jt(e))}function xr(e){return Or(e)}function wr(e,t){return Or(e,t)}function Ar(e){return Di(e)?e[Y].keys_():Ai(e)||Ei(e)?Array.from(e.keys()):bi(e)?e.map(function(e,t){return t}):void r(5)}function Sr(e){return Di(e)?Ar(e).map(function(t){return e[t]}):Ai(e)?Ar(e).map(function(t){return e.get(t)}):Ei(e)?Array.from(e.values()):bi(e)?e.slice():void r(6)}function jr(e){return Di(e)?Ar(e).map(function(t){return[t,e[t]]}):Ai(e)?Ar(e).map(function(t){return[t,e.get(t)]}):Ei(e)?Array.from(e.entries()):bi(e)?e.map(function(e,t){return[t,e]}):void r(7)}function kr(e,t,n){if(2!==arguments.length||Ei(e))Di(e)?e[Y].set_(t,n):Ai(e)?e.set(t,n):Ei(e)?e.add(t):bi(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&r("Invalid index: '"+t+"'"),nn(),t>=e.length&&(e.length=t+1),e[t]=n,rn()):r(8);else{nn();var i=t;try{for(var o in i)kr(e,o,i[o])}finally{rn()}}}function Er(e,t){Di(e)?e[Y].delete_(t):Ai(e)?e.delete(t):Ei(e)?e.delete(t):bi(e)?("number"!=typeof t&&(t=parseInt(t,10)),e.splice(t,1)):r(9)}function Pr(e,t){return Di(e)?e[Y].has_(t):Ai(e)?e.has(t):Ei(e)?e.has(t):bi(e)?t>=0&&t<e.length:void r(10)}function Tr(e,t){if(Pr(e,t))return Di(e)?e[Y].get_(t):Ai(e)?e.get(t):bi(e)?e[t]:void r(11)}function Cr(e,t,n){if(Di(e))return e[Y].defineProperty_(t,n);r(39)}function Rr(e){if(Di(e))return e[Y].ownKeys_();r(38)}function Vr(e,t,n,r){return g(n)?Dr(e,t,n,r):Nr(e,t,n)}function Nr(e,t,n){return Xi(e).observe_(t,n)}function Dr(e,t,n,r){return Xi(e,t).observe_(n,r)}function Br(e,t,n){return e.set(t,n),n}function Lr(e,t){if(null==e||"object"!=typeof e||e instanceof Date||!xr(e))return e;if(xt(e)||jt(e))return Lr(e.get(),t);if(t.has(e))return t.get(e);if(bi(e)){var n=Br(t,e,new Array(e.length));return e.forEach(function(e,r){n[r]=Lr(e,t)}),n}if(Ei(e)){var r=Br(t,e,new Set);return e.forEach(function(e){r.add(Lr(e,t))}),r}if(Ai(e)){var i=Br(t,e,new Map);return e.forEach(function(e,n){i.set(n,Lr(e,t))}),i}var o=Br(t,e,{});return Rr(e).forEach(function(n){c.propertyIsEnumerable.call(e,n)&&(o[n]=Lr(e[n],t))}),o}function Mr(e,t){return Lr(e,new Map)}function Ir(){r("trace() is not available in production builds");for(var e=!1,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];"boolean"==typeof n[n.length-1]&&(e=n.pop());var o=Ur(n);if(!o)return r("'trace(break?)' can only be used inside a tracked computed value or a Reaction. Consider passing in the computed value or reaction explicitly");o.isTracing_===At.NONE&&console.log("[mobx.trace] '"+o.name_+"' tracing enabled"),o.isTracing_=e?At.BREAK:At.LOG}function Ur(e){switch(e.length){case 0:return Xt.trackingDerivation;case 1:return Wi(e[0]);case 2:return Wi(e[0],e[1])}}function Kr(e,t){void 0===t&&(t=void 0),nn();try{return e.apply(t)}finally{rn()}}function Gr(e,t,n){return 1===arguments.length||t&&"object"==typeof t?zr(e,t):qr(e,t,n||{})}function qr(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout(function(){if(!a[Y].isDisposed_){if(a(),!n.onError)throw i;n.onError(i)}},n.timeout)}n.name="When";var o=ht("When-effect",t),a=In(function(t){pt(!1,e)&&(t.dispose(),r&&clearTimeout(r),o())},n);return a}function zr(e,t){var n;var r=new Promise(function(r,i){var o=qr(e,r,M({},t,{onError:i}));n=function(){o(),i(new Error("WHEN_CANCELLED"))}});return r.cancel=n,r}function Hr(e){return e[Y]}exports.flow=lr,lr.bound=W(cr);var Wr={has:function(e,t){return Hr(e).has_(t)},get:function(e,t){return Hr(e).get_(t)},set:function(e,t,n){var r;return!!m(t)&&(null==(r=Hr(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!m(t)&&(null==(n=Hr(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=Hr(e).defineProperty_(t,n))||r},ownKeys:function(e){return Hr(e).ownKeys_()},preventExtensions:function(e){r(13)}};function Xr(e,t){var n,r;return d(),null!=(r=(n=(e=Ri(e,t))[Y]).proxy_)?r:n.proxy_=new Proxy(e,Wr)}function Fr(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function Jr(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),b(function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)})}function Yr(e,t){var n=Mt();try{for(var i=[].concat(e.interceptors_||[]),o=0,a=i.length;o<a&&((t=i[o](t))&&!t.type&&r(14),t);o++);return t}finally{It(n)}}function $r(e){return void 0!==e.changeListeners_&&e.changeListeners_.length>0}function Qr(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),b(function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)})}function Zr(e,t){var n=Mt(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i<o;i++)r[i](t);It(n)}}function ei(e,t,n){var r=Ri(e,n)[Y];nn();try{0,null!=t||(t=J(e)),C(t).forEach(function(e){return r.make_(e,t[e])})}finally{rn()}return e}var ti=Symbol("mobx-keys");function ni(e,t,n){if(x(e))return Zn(e,e,t,n);var r=Ri(e,n)[Y];if(!e[ti]){var i=Object.getPrototypeOf(e),o=new Set([].concat(C(e),C(i)));o.delete("constructor"),o.delete(Y),A(i,ti,o)}nn();try{e[ti].forEach(function(e){return r.make_(e,!t||(!(e in t)||t[e]))})}finally{rn()}return e}var ri="splice",ii="update",oi=1e4,ai={get:function(e,t){var n=e[Y];return t===Y?n:"length"===t?n.getArrayLength_():"string"!=typeof t||isNaN(t)?N(ci,t)?ci[t]:e[t]:n.get_(parseInt(t))},set:function(e,t,n){var r=e[Y];return"length"===t&&r.setArrayLength_(n),"symbol"==typeof t||isNaN(t)?e[t]=n:r.set_(parseInt(t),n),!0},preventExtensions:function(){r(15)}},si=function(){function e(e,t,n,r){void 0===e&&(e="ObservableArray"),this.owned_=void 0,this.legacyMode_=void 0,this.atom_=void 0,this.values_=[],this.interceptors_=void 0,this.changeListeners_=void 0,this.enhancer_=void 0,this.dehancer=void 0,this.proxy_=void 0,this.lastKnownLength_=0,this.owned_=n,this.legacyMode_=r,this.atom_=new $(e),this.enhancer_=function(e,n){return t(e,n,"ObservableArray[..]")}}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.dehanceValues_=function(e){return void 0!==this.dehancer&&e.length>0?e.map(this.dehancer):e},t.intercept_=function(e){return Jr(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),Qr(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&r("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i<e-t;i++)n[i]=void 0;this.spliceWithArray_(t,0,n)}else this.spliceWithArray_(e,t-e)},t.updateArrayLength_=function(e,t){e!==this.lastKnownLength_&&r(16),this.lastKnownLength_+=t,this.legacyMode_&&t>0&&zi(e+t+1)},t.spliceWithArray_=function(e,t,n){var r=this;Ct(this.atom_);var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=l),Fr(this)){var o=Yr(this,{object:this.proxy_,type:ri,index:e,removedCount:t,added:n});if(!o)return l;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map(function(e){return r.enhancer_(e,void 0)}),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var s=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,s),this.dehanceValues_(s)},t.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<oi)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a<n.length;a++)this.values_[e+a]=n[a];for(var s=0;s<o.length;s++)this.values_[e+n.length+s]=o[s];return i},t.notifyArrayChildUpdate_=function(e,t,n){var r=!this.owned_&&gn(),i=$r(this),o=i||r?{observableKind:"array",object:this.proxy_,type:ii,debugObjectName:this.atom_.name_,index:e,newValue:t,oldValue:n}:null;this.atom_.reportChanged(),i&&Zr(this,o)},t.notifyArraySplice_=function(e,t,n){var r=!this.owned_&&gn(),i=$r(this),o=i||r?{observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:ri,index:e,removed:n,added:t,removedCount:n.length,addedCount:t.length}:null;this.atom_.reportChanged(),i&&Zr(this,o)},t.get_=function(e){if(e<this.values_.length)return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx.array] Attempt to read an array index ("+e+") that is out of bounds ("+this.values_.length+"). Please check length first. Out of bound indices will not be tracked by MobX")},t.set_=function(e,t){var n=this.values_;if(e<n.length){Ct(this.atom_);var i=n[e];if(Fr(this)){var o=Yr(this,{type:ii,object:this.proxy_,index:e,newValue:t});if(!o)return;t=o.newValue}(t=this.enhancer_(t,i))!==i&&(n[e]=t,this.notifyArrayChildUpdate_(e,t,i))}else e===n.length?this.spliceWithArray_(e,0,[t]):r(17,e,n.length)},e}();function ui(e,t,n,r){void 0===n&&(n="ObservableArray"),void 0===r&&(r=!1),d();var i=new si(n,t,r,!1);S(i.values_,Y,i);var o=new Proxy(i.values_,ai);if(i.proxy_=o,e&&e.length){var a=bt(!0);i.spliceWithArray_(0,0,e),yt(a)}return o}var ci={clear:function(){return this.splice(0)},replace:function(e){var t=this[Y];return t.spliceWithArray_(0,t.values_.length,e)},toJSON:function(){return this.slice()},splice:function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];var o=this[Y];switch(arguments.length){case 0:return[];case 1:return o.spliceWithArray_(e);case 2:return o.spliceWithArray_(e,t)}return o.spliceWithArray_(e,t,r)},spliceWithArray:function(e,t,n){return this[Y].spliceWithArray_(e,t,n)},push:function(){for(var e=this[Y],t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return e.spliceWithArray_(e.values_.length,0,n),e.values_.length},pop:function(){return this.splice(Math.max(this[Y].values_.length-1,0),1)[0]},shift:function(){return this.splice(0,1)[0]},unshift:function(){for(var e=this[Y],t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return e.spliceWithArray_(0,0,n),e.values_.length},reverse:function(){return Xt.trackingDerivation&&r(37,"reverse"),this.replace(this.slice().reverse()),this},sort:function(){Xt.trackingDerivation&&r(37,"sort");var e=this.slice();return e.sort.apply(e,arguments),this.replace(e),this},remove:function(e){var t=this[Y],n=t.dehanceValues_(t.values_).indexOf(e);return n>-1&&(this.splice(n,1),!0)}};function li(e,t){"function"==typeof Array.prototype[e]&&(ci[e]=t(e))}function fi(e){return function(){var t=this[Y];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function hi(e){return function(t,n){var r=this,i=this[Y];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e](function(e,i){return t.call(n,e,i,r)})}}function vi(e){return function(){var t=this,n=this[Y];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}li("concat",fi),li("flat",fi),li("includes",fi),li("indexOf",fi),li("join",fi),li("lastIndexOf",fi),li("slice",fi),li("toString",fi),li("toLocaleString",fi),li("every",hi),li("filter",hi),li("find",hi),li("findIndex",hi),li("flatMap",hi),li("forEach",hi),li("map",hi),li("some",hi),li("reduce",vi),li("reduceRight",vi);var di,_i,pi=j("ObservableArrayAdministration",si);function bi(e){return O(e)&&pi(e[Y])}var yi={},gi="add",mi="delete",Oi=function(e,t){function n(e,t,n){var i=this;void 0===t&&(t=oe),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[Y]=yi,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,g(Map)||r(18),this.keysAtom_=Z("ObservableMap.keys()"),this.data_=new Map,this.hasMap_=new Map,pt(!0,function(){i.merge(e)})}var i=n.prototype;return i.has_=function(e){return this.data_.has(e)},i.has=function(e){var t=this;if(!Xt.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Ot(this.has_(e),se,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Xn(r,function(){return t.hasMap_.delete(e)})}return n.get()},i.set=function(e,t){var n=this.has_(e);if(Fr(this)){var r=Yr(this,{type:n?ii:gi,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},i.delete=function(e){var t=this;if((Ct(this.keysAtom_),Fr(this))&&!Yr(this,{type:mi,object:this,name:e}))return!1;if(this.has_(e)){var n=gn(),r=$r(this),i=r||n?{observableKind:"map",debugObjectName:this.name_,type:mi,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return Kr(function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)}),r&&Zr(this,i),!0}return!1},i.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==Xt.UNCHANGED){var r=gn(),i=$r(this),o=i||r?{observableKind:"map",debugObjectName:this.name_,type:ii,object:this,oldValue:n.value_,name:e,newValue:t}:null;0,n.setNewValue_(t),i&&Zr(this,o)}},i.addValue_=function(e,t){var n=this;Ct(this.keysAtom_),Kr(function(){var r,i=new Ot(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()});var r=gn(),i=$r(this),o=i||r?{observableKind:"map",debugObjectName:this.name_,type:gi,object:this,name:e,newValue:t}:null;i&&Zr(this,o)},i.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},i.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},i.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},i.values=function(){var e=this,t=this.keys();return Zi({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},i.entries=function(){var e=this,t=this.keys();return Zi({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},i[e]=function(){return this.entries()},i.forEach=function(e,t){for(var n,r=z(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},i.merge=function(e){var t=this;return Ai(e)&&(e=new Map(e)),Kr(function(){x(e)?T(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)}):k(e)?(e.constructor!==Map&&r(19,e),e.forEach(function(e,n){return t.set(n,e)})):null!=e&&r(20,e)}),this},i.clear=function(){var e=this;Kr(function(){Lt(function(){for(var t,n=z(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}})})},i.replace=function(e){var t=this;return Kr(function(){for(var n,r=Si(e),i=new Map,o=!1,a=z(t.data_.keys());!(n=a()).done;){var s=n.value;if(!r.has(s))if(t.delete(s))o=!0;else{var u=t.data_.get(s);i.set(s,u)}}for(var c,l=z(r.entries());!(c=l()).done;){var f=c.value,h=f[0],v=f[1],d=t.data_.has(h);if(t.set(h,v),t.data_.has(h)){var _=t.data_.get(h);i.set(h,_),d||(o=!0)}}if(!o)if(t.data_.size!==i.size)t.keysAtom_.reportChanged();else for(var p=t.data_.keys(),b=i.keys(),y=p.next(),g=b.next();!y.done;){if(y.value!==g.value){t.keysAtom_.reportChanged();break}y=p.next(),g=b.next()}t.data_=i}),this},i.toString=function(){return"[object ObservableMap]"},i.toJSON=function(){return Array.from(this)},i.observe_=function(e,t){return Qr(this,e)},i.intercept_=function(e){return Jr(this,e)},L(n,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:t,get:function(){return"Map"}}]),n}(di=Symbol.iterator,_i=Symbol.toStringTag);exports.ObservableMap=Oi;var xi,wi,Ai=j("ObservableMap",Oi);function Si(e){if(k(e)||Ai(e))return e;if(Array.isArray(e))return new Map(e);if(x(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return r(21,e)}exports.isObservableMap=Ai;var ji={},ki=function(e,t){function n(e,t,n){void 0===t&&(t=oe),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[Y]=ji,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,g(Set)||r(22),this.atom_=Z(this.name_),this.enhancer_=function(e,r){return t(e,r,n)},e&&this.replace(e)}var i=n.prototype;return i.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},i.clear=function(){var e=this;Kr(function(){Lt(function(){for(var t,n=z(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}})})},i.forEach=function(e,t){for(var n,r=z(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},i.add=function(e){var t=this;if((Ct(this.atom_),Fr(this))&&!Yr(this,{type:gi,object:this,newValue:e}))return this;if(!this.has(e)){Kr(function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()});var n=$r(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:gi,object:this,newValue:e}:null;0,n&&Zr(this,r)}return this},i.delete=function(e){var t=this;if(Fr(this)&&!Yr(this,{type:mi,object:this,oldValue:e}))return!1;if(this.has(e)){var n=$r(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:mi,object:this,oldValue:e}:null;return Kr(function(){t.atom_.reportChanged(),t.data_.delete(e)}),n&&Zr(this,r),!0}return!1},i.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},i.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return Zi({next:function(){var r=e;return e+=1,r<n.length?{value:[t[r],n[r]],done:!1}:{done:!0}}})},i.keys=function(){return this.values()},i.values=function(){this.atom_.reportObserved();var e=this,t=0,n=Array.from(this.data_.values());return Zi({next:function(){return t<n.length?{value:e.dehanceValue_(n[t++]),done:!1}:{done:!0}}})},i.replace=function(e){var t=this;return Ei(e)&&(e=new Set(e)),Kr(function(){Array.isArray(e)?(t.clear(),e.forEach(function(e){return t.add(e)})):E(e)?(t.clear(),e.forEach(function(e){return t.add(e)})):null!=e&&r("Cannot initialize set from "+e)}),this},i.observe_=function(e,t){return Qr(this,e)},i.intercept_=function(e){return Jr(this,e)},i.toJSON=function(){return Array.from(this)},i.toString=function(){return"[object ObservableSet]"},i[e]=function(){return this.values()},L(n,[{key:"size",get:function(){return this.atom_.reportObserved(),this.data_.size}},{key:t,get:function(){return"Set"}}]),n}(xi=Symbol.iterator,wi=Symbol.toStringTag);exports.ObservableSet=ki;var Ei=j("ObservableSet",ki);exports.isObservableSet=Ei;var Pi=Object.create(null),Ti="remove",Ci=function(){function e(e,t,n,r){void 0===t&&(t=new Map),void 0===r&&(r=Ve),this.target_=void 0,this.values_=void 0,this.name_=void 0,this.defaultAnnotation_=void 0,this.keysAtom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.proxy_=void 0,this.isPlainObject_=void 0,this.appliedAnnotations_=void 0,this.pendingKeys_=void 0,this.target_=e,this.values_=t,this.name_=n,this.defaultAnnotation_=r,this.keysAtom_=new $("ObservableObject.keys"),this.isPlainObject_=x(this.target_)}var t=e.prototype;return t.getObservablePropValue_=function(e){return this.values_.get(e).get()},t.setObservablePropValue_=function(e,t){var n=this.values_.get(e);if(n instanceof St)return n.set(t),!0;if(Fr(this)){var r=Yr(this,{type:ii,object:this.proxy_||this.target_,name:e,newValue:t});if(!r)return null;t=r.newValue}if((t=n.prepareNewValue_(t))!==Xt.UNCHANGED){var i=$r(this),o=i?{type:ii,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:n.value_,name:e,newValue:t}:null;0,n.setNewValue_(t),i&&Zr(this,o)}return!0},t.get_=function(e){return Xt.trackingDerivation&&!N(this.target_,e)&&this.has_(e),this.target_[e]},t.set_=function(e,t,n){return void 0===n&&(n=!1),N(this.target_,e)?this.values_.has(e)?this.setObservablePropValue_(e,t):n?Reflect.set(this.target_,e,t):(this.target_[e]=t,!0):this.extend_(e,{value:t,enumerable:!0,writable:!0,configurable:!0},this.defaultAnnotation_,n)},t.has_=function(e){if(!Xt.trackingDerivation)return e in this.target_;this.pendingKeys_||(this.pendingKeys_=new Map);var t=this.pendingKeys_.get(e);return t||(t=new Ot(e in this.target_,se,"ObservableObject.key?",!1),this.pendingKeys_.set(e,t)),t.get()},t.make_=function(e,t){if(!0===t&&(t=this.defaultAnnotation_),!1!==t){if(Li(this,t,e),!(e in this.target_)){var n;if(null!=(n=this.target_[H])&&n[e])return;r(1,t.annotationType_,this.name_+"."+e.toString())}for(var i=this.target_;i&&i!==c;){var o=s(i,e);if(o){var a=t.make_(this,e,o,i);if(0===a)return;if(1===a)break}i=Object.getPrototypeOf(i)}Bi(this,t,e)}},t.extend_=function(e,t,n,r){if(void 0===r&&(r=!1),!0===n&&(n=this.defaultAnnotation_),!1===n)return this.defineProperty_(e,t,r);Li(this,n,e);var i=n.extend_(this,e,t,r);return i&&Bi(this,n,e),i},t.defineProperty_=function(e,t,n){void 0===n&&(n=!1);try{nn();var r=this.delete_(e);if(!r)return r;if(Fr(this)){var i=Yr(this,{object:this.proxy_||this.target_,name:e,type:gi,newValue:t.value});if(!i)return null;var o=i.newValue;t.value!==o&&(t=M({},t,{value:o}))}if(n){if(!Reflect.defineProperty(this.target_,e,t))return!1}else u(this.target_,e,t);this.notifyPropertyAddition_(e,t.value)}finally{rn()}return!0},t.defineObservableProperty_=function(e,t,n,r){void 0===r&&(r=!1);try{nn();var i=this.delete_(e);if(!i)return i;if(Fr(this)){var o=Yr(this,{object:this.proxy_||this.target_,name:e,type:gi,newValue:t});if(!o)return null;t=o.newValue}var a=Ni(e),s={configurable:!Xt.safeDescriptors||this.isPlainObject_,enumerable:!0,get:a.get,set:a.set};if(r){if(!Reflect.defineProperty(this.target_,e,s))return!1}else u(this.target_,e,s);var c=new Ot(t,n,"ObservableObject.key",!1);this.values_.set(e,c),this.notifyPropertyAddition_(e,c.value_)}finally{rn()}return!0},t.defineComputedProperty_=function(e,t,n){void 0===n&&(n=!1);try{nn();var r=this.delete_(e);if(!r)return r;if(Fr(this))if(!Yr(this,{object:this.proxy_||this.target_,name:e,type:gi,newValue:void 0}))return null;t.name||(t.name="ObservableObject.key"),t.context=this.proxy_||this.target_;var i=Ni(e),o={configurable:!Xt.safeDescriptors||this.isPlainObject_,enumerable:!1,get:i.get,set:i.set};if(n){if(!Reflect.defineProperty(this.target_,e,o))return!1}else u(this.target_,e,o);this.values_.set(e,new St(t)),this.notifyPropertyAddition_(e,void 0)}finally{rn()}return!0},t.delete_=function(e,t){if(void 0===t&&(t=!1),!N(this.target_,e))return!0;if(Fr(this)&&!Yr(this,{object:this.proxy_||this.target_,name:e,type:Ti}))return null;try{var n,r;nn();var i,o=$r(this),a=this.values_.get(e),u=void 0;if(!a&&o)u=null==(i=s(this.target_,e))?void 0:i.value;if(t){if(!Reflect.deleteProperty(this.target_,e))return!1}else delete this.target_[e];if(a&&(this.values_.delete(e),a instanceof Ot&&(u=a.value_),an(a)),this.keysAtom_.reportChanged(),null==(n=this.pendingKeys_)||null==(r=n.get(e))||r.set(e in this.target_),o){var c={type:Ti,observableKind:"object",object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:u,name:e};0,o&&Zr(this,c)}}finally{rn()}return!0},t.observe_=function(e,t){return Qr(this,e)},t.intercept_=function(e){return Jr(this,e)},t.notifyPropertyAddition_=function(e,t){var n,r,i=$r(this);if(i){var o=i?{type:gi,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,name:e,newValue:t}:null;0,i&&Zr(this,o)}null==(n=this.pendingKeys_)||null==(r=n.get(e))||r.set(!0),this.keysAtom_.reportChanged()},t.ownKeys_=function(){return this.keysAtom_.reportObserved(),C(this.target_)},t.keys_=function(){return this.keysAtom_.reportObserved(),Object.keys(this.target_)},e}();function Ri(e,t){var n;if(N(e,Y))return e;var r=null!=(n=null==t?void 0:t.name)?n:"ObservableObject",i=new Ci(e,new Map,String(r),Je(t));return A(e,Y,i),e}var Vi=j("ObservableObjectAdministration",Ci);function Ni(e){return Pi[e]||(Pi[e]={get:function(){return this[Y].getObservablePropValue_(e)},set:function(t){return this[Y].setObservablePropValue_(e,t)}})}function Di(e){return!!O(e)&&Vi(e[Y])}function Bi(e,t,n){var r;null==(r=e.target_[H])||delete r[n]}function Li(e,t,n){}var Mi=0,Ii=function(){};function Ui(e,t){Object.setPrototypeOf?Object.setPrototypeOf(e.prototype,t):void 0!==e.prototype.__proto__?e.prototype.__proto__=t:e.prototype=t}Ui(Ii,Array.prototype);var Ki=function(e,t,n){function r(t,n,r,i){var o;void 0===r&&(r="ObservableArray"),void 0===i&&(i=!1),o=e.call(this)||this;var a=new si(r,n,i,!0);if(a.proxy_=K(o),S(K(o),Y,a),t&&t.length){var s=bt(!0);o.spliceWithArray(0,0,t),yt(s)}return o}I(r,e);var i=r.prototype;return i.concat=function(){this[Y].atom_.reportObserved();for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return Array.prototype.concat.apply(this.slice(),t.map(function(e){return bi(e)?e.slice():e}))},i[n]=function(){var e=this,t=0;return Zi({next:function(){return t<e.length?{value:e[t++],done:!1}:{done:!0,value:void 0}}})},L(r,[{key:"length",get:function(){return this[Y].getArrayLength_()},set:function(e){this[Y].setArrayLength_(e)}},{key:t,get:function(){return"Array"}}]),r}(Ii,Symbol.toStringTag,Symbol.iterator);function Gi(e){return{enumerable:!1,configurable:!0,get:function(){return this[Y].get_(e)},set:function(t){this[Y].set_(e,t)}}}function qi(e){u(Ki.prototype,""+e,Gi(e))}function zi(e){if(e>Mi){for(var t=Mi;t<e+100;t++)qi(t);Mi=e}}function Hi(e,t,n){return new Ki(e,t,n)}function Wi(e,t){if("object"==typeof e&&null!==e){if(bi(e))return void 0!==t&&r(23),e[Y].atom_;if(Ei(e))return e[Y];if(Ai(e)){if(void 0===t)return e.keysAtom_;var n=e.data_.get(t)||e.hasMap_.get(t);return n||r(25,t,Fi(e)),n}if(Di(e)){if(!t)return r(26);var i=e[Y].values_.get(t);return i||r(27,t,Fi(e)),i}if(Q(e)||jt(e)||bn(e))return e}else if(g(e)&&bn(e[Y]))return e[Y];r(28)}function Xi(e,t){return e||r(29),void 0!==t?Xi(Wi(e,t)):Q(e)||jt(e)||bn(e)?e:Ai(e)||Ei(e)?e:e[Y]?e[Y]:void r(24,e)}function Fi(e,t){var n;if(void 0!==t)n=Wi(e,t);else{if(Mn(e))return e.name;n=Di(e)||Ai(e)||Ei(e)?Xi(e):Wi(e)}return n.name_}Object.entries(ci).forEach(function(e){var t=e[0],n=e[1];"concat"!==t&&A(Ki.prototype,t,n)}),zi(1e3);var Ji=c.toString;function Yi(e,t,n){return void 0===n&&(n=-1),$i(e,t,n)}function $i(e,t,n,r,i){if(e===t)return 0!==e||1/e==1/t;if(null==e||null==t)return!1;if(e!=e)return t!=t;var o=typeof e;if("function"!==o&&"object"!==o&&"object"!=typeof t)return!1;var a=Ji.call(e);if(a!==Ji.call(t))return!1;switch(a){case"[object RegExp]":case"[object String]":return""+e==""+t;case"[object Number]":return+e!=+e?+t!=+t:0==+e?1/+e==1/t:+e==+t;case"[object Date]":case"[object Boolean]":return+e==+t;case"[object Symbol]":return"undefined"!=typeof Symbol&&Symbol.valueOf.call(e)===Symbol.valueOf.call(t);case"[object Map]":case"[object Set]":n>=0&&n++}e=Qi(e),t=Qi(t);var s="[object Array]"===a;if(!s){if("object"!=typeof e||"object"!=typeof t)return!1;var u=e.constructor,c=t.constructor;if(u!==c&&!(g(u)&&u instanceof u&&g(c)&&c instanceof c)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var l=(r=r||[]).length;l--;)if(r[l]===e)return i[l]===t;if(r.push(e),i.push(t),s){if((l=e.length)!==t.length)return!1;for(;l--;)if(!$i(e[l],t[l],n-1,r,i))return!1}else{var f,h=Object.keys(e);if(l=h.length,Object.keys(t).length!==l)return!1;for(;l--;)if(!N(t,f=h[l])||!$i(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function Qi(e){return bi(e)?e.slice():k(e)||Ai(e)?Array.from(e.entries()):E(e)||Ei(e)?Array.from(e.entries()):e}function Zi(e){return e[Symbol.iterator]=eo,e}function eo(){return this}function to(e){return e instanceof Object&&"string"==typeof e.annotationType_&&g(e.make_)&&g(e.extend_)}["Symbol","Map","Set"].forEach(function(e){void 0===o()[e]&&r("MobX requires global '"+e+"' to be available or polyfilled")}),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:An,extras:{getDebugName:Fi},$mobx:Y});
18
18
  },{}],"moAD":[function(require,module,exports) {
19
19
  "use strict";var e=require("mobx"),r=require("react");if(!r.useState)throw new Error("mobx-react-lite requires React with Hooks support");if(!e.makeObservable)throw new Error("mobx-react-lite@3 requires mobx at least version 6 to be available");
20
20
  },{"mobx":"BzvP","react":"HdMw"}],"ZFRm":[function(require,module,exports) {
@@ -40,7 +40,7 @@ var e=arguments[3];Object.defineProperty(exports,"__esModule",{value:!0}),export
40
40
  },{}],"fdT3":[function(require,module,exports) {
41
41
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.useObserver=l;var e=require("mobx"),r=o(require("react")),t=require("./utils/printDebugValue"),n=require("./utils/reactionCleanupTracking"),u=require("./staticRendering");function o(e){return e&&e.__esModule?e:{default:e}}var c=function(e,r){var t="function"==typeof Symbol&&e[Symbol.iterator];if(!t)return e;var n,u,o=t.call(e),c=[];try{for(;(void 0===r||r-- >0)&&!(n=o.next()).done;)c.push(n.value)}catch(i){u={error:i}}finally{try{n&&!n.done&&(t=o.return)&&t.call(o)}finally{if(u)throw u.error}}return c};function i(e){return"observer".concat(e)}var a=function(){return function(){}}();function f(){return new a}function l(o,a){if(void 0===a&&(a="observed"),(0,u.isUsingStaticRendering)())return o();var l=c(r.default.useState(f),1)[0],d=c(r.default.useState(),2)[1],s=function(){return d([])},v=r.default.useRef(null);if(!v.current)var g=new e.Reaction(i(a),function(){b.mounted?s():b.changedBeforeMount=!0}),b=(0,n.addReactionToTrack)(v,g,l);var h,p,y=v.current.reaction;if(r.default.useDebugValue(y,t.printDebugValue),r.default.useEffect(function(){return(0,n.recordReactionAsCommitted)(v),v.current?(v.current.mounted=!0,v.current.changedBeforeMount&&(v.current.changedBeforeMount=!1,s())):(v.current={reaction:new e.Reaction(i(a),function(){s()}),mounted:!0,changedBeforeMount:!1,cleanAt:1/0},s()),function(){v.current.reaction.dispose(),v.current=null}},[]),y.track(function(){try{h=o()}catch(e){p=e}}),p)throw p;return h}
42
42
  },{"mobx":"BzvP","react":"HdMw","./utils/printDebugValue":"zABi","./utils/reactionCleanupTracking":"ROlb","./staticRendering":"vLuz"}],"Ocog":[function(require,module,exports) {
43
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.observer=o;var e=require("react"),r=require("./staticRendering"),t=require("./useObserver"),n=function(){return(n=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var o in r=arguments[t])Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o]);return e}).apply(this,arguments)};function o(o,i){if((0,r.isUsingStaticRendering)())return o;var s,c=n({forwardRef:!1},i),u=o.displayName||o.name,f=function(e,r){return(0,t.useObserver)(function(){return o(e,r)},u)};return""!==u&&(f.displayName=u),o.contextTypes&&(f.contextTypes=o.contextTypes),s=c.forwardRef?(0,e.memo)((0,e.forwardRef)(f)):(0,e.memo)(f),a(o,s),s}var i={$$typeof:!0,render:!0,compare:!0,type:!0,displayName:!0};function a(e,r){Object.keys(e).forEach(function(t){i[t]||Object.defineProperty(r,t,Object.getOwnPropertyDescriptor(e,t))})}
43
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.observer=a;var e=require("react"),r=require("./staticRendering"),o=require("./useObserver"),t=!0,n="function"==typeof Symbol&&Symbol.for,f=n?Symbol.for("react.forward_ref"):"function"==typeof e.forwardRef&&(0,e.forwardRef)(function(e){return null}).$$typeof,i=n?Symbol.for("react.memo"):"function"==typeof e.memo&&(0,e.memo)(function(e){return null}).$$typeof;function a(t,n){var a;if(i&&t.$$typeof===i)throw new Error("[mobx-react-lite] You are trying to use `observer` on a function component wrapped in either another `observer` or `React.memo`. The observer already applies 'React.memo' for you.");if((0,r.isUsingStaticRendering)())return t;var c=null!==(a=null==n?void 0:n.forwardRef)&&void 0!==a&&a,p=t,y=t.displayName||t.name;if(f&&t.$$typeof===f&&(c=!0,"function"!=typeof(p=t.render)))throw new Error("[mobx-react-lite] `render` property of ForwardRef was not a function");var s=function(e,r){return(0,o.useObserver)(function(){return p(e,r)},y)};return""!==y&&(s.displayName=y),t.contextTypes&&(s.contextTypes=t.contextTypes),c&&(s=(0,e.forwardRef)(s)),u(t,s=(0,e.memo)(s)),s}var c={$$typeof:!0,render:!0,compare:!0,type:!0,displayName:!0};function u(e,r){Object.keys(e).forEach(function(o){c[o]||Object.defineProperty(r,o,Object.getOwnPropertyDescriptor(e,o))})}
44
44
  },{"react":"HdMw","./staticRendering":"vLuz","./useObserver":"fdT3"}],"I8te":[function(require,module,exports) {
45
45
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Observer=r;var e=require("./useObserver");function r(r){var n=r.children,t=r.render,o=n||t;return"function"!=typeof o?null:(0,e.useObserver)(o)}function n(e,r,n,t,o){var i="children"===r?"render":"children",u="function"==typeof e[r],s="function"==typeof e[i];return u&&s?new Error("MobX Observer: Do not use children and render in the same time in`"+n):u||s?null:new Error("Invalid prop `"+o+"` of type `"+typeof e[r]+"` supplied to `"+n+"`, expected `function`.")}r.displayName="Observer";
46
46
  },{"./useObserver":"fdT3"}],"KZGF":[function(require,module,exports) {
@@ -179,7 +179,7 @@ module.exports=function(e){var n={},t=require("object-assign"),r=require("react"
179
179
  },{"react":"HdMw","konva/lib/Core":"cQlj","react-reconciler":"lCn1","./ReactKonvaHostConfig":"yskO","./makeUpdates":"UEmO"}],"Sgug":[function(require,module,exports) {
180
180
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),require("konva");var e=require("./ReactKonvaCore");Object.keys(e).forEach(function(r){"default"!==r&&"__esModule"!==r&&(r in exports&&exports[r]===e[r]||Object.defineProperty(exports,r,{enumerable:!0,get:function(){return e[r]}}))});
181
181
  },{"konva":"aTGn","./ReactKonvaCore":"JVlA"}],"MJM3":[function(require,module,exports) {
182
- var e=require("react"),t={image:void 0,status:"loading"};module.exports=function(r,n){var i=e.useState(t),a=i[0].image,o=i[0].status,s=i[1];return e.useEffect(function(){if(r){var e=document.createElement("img");return e.addEventListener("load",i),e.addEventListener("error",a),n&&(e.crossOrigin=n),e.src=r,function(){e.removeEventListener("load",i),e.removeEventListener("error",a),s(t)}}function i(){s({image:e,status:"loaded"})}function a(){s({image:void 0,status:"failed"})}},[r,n]),[a,o]};
182
+ var e=require("react");module.exports=function(r,n){const t=e.useRef("loading"),u=e.useRef(),[c,o]=e.useState(0),i=e.useRef(),a=e.useRef();return i.current===r&&a.current===n||(t.current="loading",u.current=void 0,i.current=r,a.current=n),e.useLayoutEffect(function(){if(r){var e=document.createElement("img");return e.addEventListener("load",c),e.addEventListener("error",i),n&&(e.crossOrigin=n),e.src=r,function(){e.removeEventListener("load",c),e.removeEventListener("error",i)}}function c(){t.current="loaded",u.current=e,o(Math.random())}function i(){t.current="failed",u.current=void 0,o(Math.random())}},[r,n]),[u.current,t.current]};
183
183
  },{"react":"HdMw"}],"XdpJ":[function(require,module,exports) {
184
184
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Html=void 0;var e=o(require("react")),t=o(require("react-dom")),r=require("react-konva");function o(e){return e&&e.__esModule?e:{default:e}}var n=function(e,t){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(o=Object.getOwnPropertySymbols(e);n<o.length;n++)t.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(r[o[n]]=e[o[n]])}return r};const l=e=>{const t=window.getComputedStyle(e).position;return!("absolute"===t||"relative"===t)},s=({children:o,groupProps:s,divProps:a,transform:u,transformFunc:f})=>{const i=e.default.useRef(null),c=e.default.useRef(),d=null==u||u,p=()=>{const e=c.current;if(!e)return;if(d&&i.current){let t=i.current.getAbsoluteTransform().decompose();f&&(t=f(t)),e.style.position="absolute",e.style.zIndex="10",e.style.top="0px",e.style.left="0px",e.style.transform=`translate(${t.x}px, ${t.y}px) rotate(${t.rotation}deg) scaleX(${t.scaleX}) scaleY(${t.scaleY})`,e.style.transformOrigin="top left"}else e.style.position="",e.style.zIndex="",e.style.top="",e.style.left="",e.style.transform="",e.style.transformOrigin="";const t=a||{},{style:r}=t,o=n(t,["style"]);Object.assign(e.style,r),Object.assign(e,o)};return e.default.useLayoutEffect(()=>{var e;const r=i.current;if(!r)return;const o=null===(e=r.getStage())||void 0===e?void 0:e.container();if(!o)return;let n=document.createElement("div");return c.current=n,o.appendChild(n),d&&l(o)&&(o.style.position="relative"),r.on("absoluteTransformChange",p),p(),()=>{var e;r.off("absoluteTransformChange",p),t.default.unmountComponentAtNode(n),null===(e=n.parentNode)||void 0===e||e.removeChild(n)}},[d]),e.default.useLayoutEffect(()=>{p()},[a]),e.default.useLayoutEffect(()=>{t.default.render(o,c.current)}),e.default.createElement(r.Group,Object.assign({ref:i},s))};exports.Html=s;
185
185
  },{"react":"HdMw","react-dom":"X9zx","react-konva":"Sgug"}],"beYE":[function(require,module,exports) {
@@ -193,7 +193,7 @@ var e=require("react"),t={image:void 0,status:"loading"};module.exports=function
193
193
  },{"react":"HdMw","konva":"aTGn"}],"bN4e":[function(require,module,exports) {
194
194
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.whenLoaded=exports.decrementLoader=exports.incrementLoader=void 0;const e=require("../canvas/use-fadein");let o=0,t=[];function r(e){o+=1;let t=!1;Date.now();const r=setTimeout(()=>{t||(console.error("Timeout triggered for loader. Some assets may not have loaded.",e),t=!0,n())},15e3);return()=>{t||(clearTimeout(r),n())}}function n(){0===(o-=1)&&(t.forEach(e=>e()),t=[])}function s(e){0===o?e():t.push(e)}function i(){return new Promise(o=>s(()=>{(0,e.isAnimationUsed)()?setTimeout(o,300):o(!0)}))}exports.incrementLoader=r,exports.decrementLoader=n,exports.whenLoaded=i;
195
195
  },{"../canvas/use-fadein":"N3c2"}],"XXLd":[function(require,module,exports) {
196
- "use strict";var t=this&&this.__createBinding||(Object.create?function(t,e,o,n){void 0===n&&(n=o),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[o]}})}:function(t,e,o,n){void 0===n&&(n=o),t[n]=e[o]}),e=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o=this&&this.__importStar||function(o){if(o&&o.__esModule)return o;var n={};if(null!=o)for(var r in o)"default"!==r&&Object.prototype.hasOwnProperty.call(o,r)&&t(n,o,r);return e(n,o),n};Object.defineProperty(exports,"__esModule",{value:!0}),exports.injectCustomFont=exports.injectGoogleFont=exports.loadFont=exports.isFontLoaded=exports.addGlobalFont=exports.globalFonts=exports.getFontsList=exports.setGoogleFonts=exports.isGoogleFontChanged=void 0;const n=o(require("mobx"));let r=n.observable(["Roboto","Amatic SC","Press Start 2P","Marck Script","Rubik Mono One"]),s=!1;function i(){return s}function l(t){s=!0,r.splice(0,r.length),r.push(...t)}function a(){return r}function c(t){exports.globalFonts.push(t)}exports.isGoogleFontChanged=i,exports.setGoogleFonts=l,exports.getFontsList=a,exports.globalFonts=n.observable([]),exports.addGlobalFont=c;var u="Some test text;?#D-ПРИВЕТ!",f=document.createElement("canvas"),d=f.getContext("2d");function p(){return m("Arial")}function m(t){return d.font=`normal 40px '${t}', Arial`,d.measureText(u).width}const x=100,g={Arial:!0},h=t=>g[t];async function y(t){var e;if(g[t])return;const o=!!(null===(e=document.fonts)||void 0===e?void 0:e.load),n=p();if(o)try{if(await document.fonts.load(`16px '${t}'`),n!==m(t))return void(g[t]=!0)}catch(t){}const r=m(t);for(let s=0;s<100;s++){const e=m(t);if(e!==r||e!==n)return void(g[t]=!0);await new Promise(t=>setTimeout(t,60))}console.warn(`Timeout for loading font "${t}". Looks like polotno can't load it. Is it a correct font family?`)}exports.isFontLoaded=h,exports.loadFont=y;const F={};function b(t){if(F[t])return;const e=`https://fonts.googleapis.com/css?family=${t.replace(/ /g,"+")}`,o=document.createElement("link");o.type="text/css",o.href=e,o.rel="stylesheet",document.getElementsByTagName("head")[0].appendChild(o),F[t]=!0}exports.injectGoogleFont=b;const v={};function j(t){const e=t.fontFamily;if(v[e])return;if(!t.url&&!t.styles)return;const o=document.createElement("style");o.type="text/css";const n=t.styles||(t.url?[{src:`url("${t.url}")`}]:[]);let r="";n.forEach(t=>{r+=`\n @font-face {\n font-family: '${e}';\n src: ${t.src};\n font-style: ${t.fontStyle||"normal"};\n font-weight: ${t.fontWeight||"normal"};\n }\n `}),o.innerHTML=r,document.getElementsByTagName("head")[0].appendChild(o),v[t.fontFamily]=!0}exports.injectCustomFont=j;
196
+ "use strict";var t=this&&this.__createBinding||(Object.create?function(t,e,o,n){void 0===n&&(n=o),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[o]}})}:function(t,e,o,n){void 0===n&&(n=o),t[n]=e[o]}),e=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o=this&&this.__importStar||function(o){if(o&&o.__esModule)return o;var n={};if(null!=o)for(var r in o)"default"!==r&&Object.prototype.hasOwnProperty.call(o,r)&&t(n,o,r);return e(n,o),n};Object.defineProperty(exports,"__esModule",{value:!0}),exports.injectCustomFont=exports.injectGoogleFont=exports.loadFont=exports.isFontLoaded=exports.addGlobalFont=exports.globalFonts=exports.getFontsList=exports.setGoogleFonts=exports.isGoogleFontChanged=void 0;const n=o(require("mobx"));let r=n.observable(["Roboto","Amatic SC","Press Start 2P","Marck Script","Rubik Mono One"]),s=!1;function i(){return s}function l(t){s=!0,r.splice(0,r.length),r.push(...t)}function a(){return r}function c(t){exports.globalFonts.push(t)}exports.isGoogleFontChanged=i,exports.setGoogleFonts=l,exports.getFontsList=a,exports.globalFonts=n.observable([]),exports.addGlobalFont=c;var u="Some test text;?#D-ПРИВЕТ!",f=document.createElement("canvas");function d(){return p("Arial")}function p(t){var e=f.getContext("2d");return e.font=`normal 40px '${t}', Arial`,e.measureText(u).width}const m=100,x={Arial:!0},g=t=>x[t];async function h(t){var e;if(x[t])return;const o=!!(null===(e=document.fonts)||void 0===e?void 0:e.load),n=d();if(o)try{if(await document.fonts.load(`16px '${t}'`),n!==p(t))return void(x[t]=!0)}catch(t){}const r=p(t);for(let s=0;s<100;s++){const e=p(t);if(e!==r||e!==n)return void(x[t]=!0);await new Promise(t=>setTimeout(t,60))}console.warn(`Timeout for loading font "${t}". Looks like polotno can't load it. Is it a correct font family?`)}exports.isFontLoaded=g,exports.loadFont=h;const y={};function F(t){if(y[t])return;const e=`https://fonts.googleapis.com/css?family=${t.replace(/ /g,"+")}`,o=document.createElement("link");o.type="text/css",o.href=e,o.rel="stylesheet",document.getElementsByTagName("head")[0].appendChild(o),y[t]=!0}exports.injectGoogleFont=F;const b={};function v(t){const e=t.fontFamily;if(b[e])return;if(!t.url&&!t.styles)return;const o=document.createElement("style");o.type="text/css";const n=t.styles||(t.url?[{src:`url("${t.url}")`}]:[]);let r="";n.forEach(t=>{r+=`\n @font-face {\n font-family: '${e}';\n src: ${t.src};\n font-style: ${t.fontStyle||"normal"};\n font-weight: ${t.fontWeight||"normal"};\n }\n `}),o.innerHTML=r,document.getElementsByTagName("head")[0].appendChild(o),b[t.fontFamily]=!0}exports.injectCustomFont=v;
197
197
  },{"mobx":"BzvP"}],"SIWI":[function(require,module,exports) {
198
198
  "use strict";var e=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.applyFilter=void 0;const t=e(require("konva"));function l(e,l){var r;const s={filters:[]};l.brightnessEnabled&&(s.filters.push(t.default.Filters.Brighten),s.brightness=l.brightness),l.blurEnabled&&(s.filters.push(t.default.Filters.Blur),s.blurRadius=l.blurRadius),l.sepiaEnabled&&s.filters.push(t.default.Filters.Sepia),l.grayscaleEnabled&&s.filters.push(t.default.Filters.Grayscale),e.setAttrs(s),s.filters.length?e.cache({pixelRatio:l.store._elementsPixelRatio}):e.clearCache(),null===(r=e.getLayer())||void 0===r||r.batchDraw()}exports.applyFilter=l;
199
199
  },{"konva":"aTGn"}],"cEy1":[function(require,module,exports) {
@@ -839,7 +839,7 @@ var e="undefined"!=typeof Element,r="function"==typeof Map,t="function"==typeof
839
839
  },{"react":"HdMw","mobx-react-lite":"ZfSi","@blueprintjs/core":"Ydrz","@blueprintjs/popover2":"mZnF","../utils/l10n":"FlVj"}],"Ic0q":[function(require,module,exports) {
840
840
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.setAPI=exports.iconscoutDownload=exports.iconscoutList=exports.unsplashDownload=exports.unsplashList=exports.textTemplateList=exports.templateList=exports.removeBackground=exports.polotnoShapesList=exports.getGoogleFontImage=exports.getGoogleFontsListAPI=exports.URLS=exports.URL=exports.API=void 0;const e=require("./validate-key");exports.API="https://api.polotno.dev/api",exports.URL="https://api.polotno.dev";const o={},t=(e,t)=>{o[e]||(o[e]=!0,console.error(t))},s=(e,o,t)=>e.replace(new RegExp(o,"g"),t),p="API for iconscout is provided as a demonstration.\nFor production usage you have to use your own API endpoint.\nhttps://iconscout.com/developers, https://iconscout.com/legal/api-license-development-agreement\nhttps://polotno.dev/docs/server-api";exports.URLS={unsplashList:({query:o,page:t=1})=>`${exports.API}/get-unsplash?query=${o}&per_page=20&page=${t}&KEY=${(0,e.getKey)()}`,unsplashDownload:o=>`${exports.API}/download-unsplash?id=${o}&KEY=${(0,e.getKey)()}`,iconscoutList:({query:o,page:s=1})=>(t("iconscout",p),`${exports.API}/get-iconscout?query=${o}&page=${s}&KEY=${(0,e.getKey)()}`),iconscoutDownload:o=>(t("iconscout",p),`${exports.API}/download-iconscout?uuid=${o}&KEY=${(0,e.getKey)()}`),templateList:({query:o,page:t=1,sizeQuery:s})=>`${exports.API}/get-templates?${s}&query=${o}&per_page=30&page=${t}&KEY=${(0,e.getKey)()}`};const r=()=>`${exports.API}/get-google-fonts?KEY=${(0,e.getKey)()}`;exports.getGoogleFontsListAPI=r;const n=e=>{return`${exports.URL}/google-fonts-previews/black/${o=e," ","-",o.replace(new RegExp(" ","g"),"-")}.png`;var o};exports.getGoogleFontImage=n;const a=()=>`${exports.API}/get-basic-shapes?KEY=${(0,e.getKey)()}`;exports.polotnoShapesList=a;const c=()=>`${exports.API}/remove-image-background?KEY=${(0,e.getKey)()}`;exports.removeBackground=c;const i=e=>exports.URLS.templateList(e);exports.templateList=i;const l=()=>`${exports.API}/get-text-templates?KEY=${(0,e.getKey)()}`;exports.textTemplateList=l;const x=e=>exports.URLS.unsplashList(e);exports.unsplashList=x;const g=e=>exports.URLS.unsplashDownload(e);exports.unsplashDownload=g;const u=e=>exports.URLS.iconscoutList(e);exports.iconscoutList=u;const d=e=>exports.URLS.iconscoutDownload(e);exports.iconscoutDownload=d;const L=(e,o)=>{exports.URLS[e]=o};exports.setAPI=L;
841
841
  },{"./validate-key":"zree"}],"zree":[function(require,module,exports) {
842
- "use strict";var e=this&&this.__createBinding||(Object.create?function(e,t,o,n){void 0===n&&(n=o),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[o]}})}:function(e,t,o,n){void 0===n&&(n=o),e[n]=t[o]}),t=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(o){if(o&&o.__esModule)return o;var n={};if(null!=o)for(var i in o)"default"!==i&&Object.prototype.hasOwnProperty.call(o,i)&&e(n,o,i);return t(n,o),n};Object.defineProperty(exports,"__esModule",{value:!0}),exports.validateKey=exports.isKeyPaid=exports.getKey=exports.shouldShowCredit=void 0;const n=o(require("mobx")),i=require("./api"),a=require("./flags");exports.shouldShowCredit=n.observable({value:!1});const r=n.action(()=>{exports.shouldShowCredit.value=!0});let s="";const l=()=>s||"";exports.getKey=l;const d=5,c=3e3,u="Polotno API is initialized without API key. It may lead to unexpected behavior and stop working. Please create API key here: https://polotno.dev/cabinet",p="Polotno API key is not valid. Please get new API key here: https://polotno.dev/cabinet",h="Can not validate Polotno API key. Please report to anton@polotno.dev immediately.",v="%cPolotno Free Version. Development or non-commercial usage only. https://polotno.dev/";let f=location.origin;const g=navigator.userAgent.indexOf("Headless")>-1,y=navigator.userAgent.indexOf("Electron")>-1;"file://"===f&&g&&(f="headless"),"file://"===f&&y&&(f="electron");const P=`%cPolotno error! Current domain is not allowed. It may lead to unexpected behavior and stop working. Please add "${f}" here: https://polotno.dev/cabinet`;async function b(e){for(let t=0;t<5;t++)try{const t=await fetch(i.API+"/validate-key",{method:"POST",body:JSON.stringify({key:e,site:location.host+location.pathname})});if(!e)return console.warn(u),!1;if(200!==t.status){await new Promise(e=>setTimeout(e,3e3));continue}const o=await t.json();return o.is_valid||console.warn(p),o.is_paid||console.log(v,"background: rgb(0, 161, 255); color: white; padding: 5px; margin: 5px;"),o.is_domain_valid||console.log(P,"background: rgba(247, 101, 68, 1); color: white; padding: 5px; margin: 5px;"),(0,a.useRemoveBackground)(o.remove_background_enabled),o.is_paid||!1}catch(e){await new Promise(e=>setTimeout(e,3e3))}return console.error(h),!0}async function m(e,t){s=e,await b(e)&&!t||r()}exports.isKeyPaid=b,exports.validateKey=m;
842
+ "use strict";var e=this&&this.__createBinding||(Object.create?function(e,t,o,n){void 0===n&&(n=o),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[o]}})}:function(e,t,o,n){void 0===n&&(n=o),e[n]=t[o]}),t=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(o){if(o&&o.__esModule)return o;var n={};if(null!=o)for(var i in o)"default"!==i&&Object.prototype.hasOwnProperty.call(o,i)&&e(n,o,i);return t(n,o),n};Object.defineProperty(exports,"__esModule",{value:!0}),exports.validateKey=exports.isKeyPaid=exports.getKey=exports.shouldShowCredit=void 0;const n=o(require("mobx")),i=require("./api"),a=require("./flags");exports.shouldShowCredit=n.observable({value:!1});const r=n.action(()=>{exports.shouldShowCredit.value=!0});let s="";const l=()=>s||"";exports.getKey=l;const d=5,c=3e3,u="Polotno API is initialized without API key. It may lead to unexpected behavior and stop working. Please create API key here: https://polotno.dev/cabinet",p="Polotno API key is not valid. Please get new API key here: https://polotno.dev/cabinet",h="Can not validate Polotno API key. Please report to anton@polotno.dev immediately.",v="%cPolotno Free Version. Development or non-commercial usage only. https://polotno.dev/";let f=window.location.origin;const g=navigator.userAgent.indexOf("Headless")>-1,y=navigator.userAgent.indexOf("Electron")>-1;"file://"===f&&g&&(f="headless"),"file://"===f&&y&&(f="electron");const P=`%cPolotno error! Current domain is not allowed. It may lead to unexpected behavior and stop working. Please add "${f}" here: https://polotno.dev/cabinet`;async function b(e){for(let t=0;t<5;t++)try{const t=await fetch(i.API+"/validate-key",{method:"POST",body:JSON.stringify({key:e,site:location.host+location.pathname})});if(!e)return console.warn(u),!1;if(200!==t.status){await new Promise(e=>setTimeout(e,3e3));continue}const o=await t.json();return o.is_valid||console.warn(p),o.is_paid||console.log(v,"background: rgb(0, 161, 255); color: white; padding: 5px; margin: 5px;"),o.is_domain_valid||console.log(P,"background: rgba(247, 101, 68, 1); color: white; padding: 5px; margin: 5px;"),(0,a.useRemoveBackground)(o.remove_background_enabled),o.is_paid||!1}catch(e){await new Promise(e=>setTimeout(e,3e3))}return console.error(h),!0}async function m(e,t){s=e,await b(e)&&!t||r()}exports.isKeyPaid=b,exports.validateKey=m;
843
843
  },{"mobx":"BzvP","./api":"Ic0q","./flags":"IDY9"}],"Co9b":[function(require,module,exports) {
844
844
  "use strict";var e=this&&this.__rest||function(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n},t=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.registerNextDomDrop=exports.registerTransformerAttrs=void 0;const n=t(require("react")),i=require("mobx-react-lite"),r=require("mobx"),l=require("react-konva"),o=t(require("use-image")),a=t(require("konva")),s=t(require("./element")),d=require("./use-transformer-snap"),c=require("./image-element"),m=require("../utils/crop"),u=require("./page-controls"),h=require("../utils/validate-key"),g=require("../utils/math"),f={enabledAnchors:["top-left","top-center","top-right","middle-left","bottom-left","bottom-right","bottom-center","middle-right"],rotateEnabled:!0,rotationSnaps:[0,45,90,135,180,225,270,315],ignoreStroke:!0,anchorStrokeWidth:2,borderStrokeWidth:2},p={text:{enabledAnchors:["top-left","top-right","middle-left","bottom-left","bottom-right","middle-right"]},svg:{enabledAnchors:["top-left","top-right","bottom-left","bottom-right"]},many:{enabledAnchors:["top-left","top-right","bottom-left","bottom-right"]}};function x(e,t){p[e]=p[e]||t,Object.assign(p[e],t)}exports.registerTransformerAttrs=x;const b=e=>n.default.createElement(l.Rect,Object.assign({},e,{preventDefault:!1})),y=t=>{var{url:i}=t,r=e(t,["url"]);const[a,s]=(0,o.default)(i,"anonymous"),d=a?(0,m.getCrop)(a,{width:r.width,height:r.height},"center-middle"):{};return(0,c.useImageLoader)(s),n.default.createElement(l.Image,Object.assign({image:a},r,d))},v=e=>n.default.createElement(l.Rect,Object.assign({},e)),E=t=>{const{background:i,scale:r,borderColor:l}=t,o=e(t,["background","scale","borderColor"]),a=i.indexOf("http")>=0||i.indexOf(".png")>=0||i.indexOf(".jpg")>=0;return n.default.createElement(n.default.Fragment,null,a?n.default.createElement(y,Object.assign({url:i},o)):n.default.createElement(v,Object.assign({fill:i},o)))},w=(0,i.observer)(({selection:e})=>e.visible?n.default.createElement(l.Rect,{name:"selection",x:Math.min(e.x1,e.x2),y:Math.min(e.y1,e.y2),width:Math.abs(e.x1-e.x2),height:Math.abs(e.y1-e.y2),fill:"rgba(0, 161, 255, 0.3)"}):null),X=(0,i.observer)(({elements:e,store:t})=>{const i=e.filter(e=>e.alwaysOnTop),r=e.filter(e=>!e.alwaysOnTop).concat(i);return n.default.createElement(n.default.Fragment,null,r.map(e=>n.default.createElement(s.default,{key:e.id,store:t,element:e,onClick:()=>{console.warn("Polotno warning: onClick callback is deprecated. Just stop using it. Polotno will do selection automatically.")}})))});let Y=null;const k=e=>{Y=e};exports.registerNextDomDrop=k,exports.default=(0,i.observer)(({store:e,page:t,width:o,height:s,pageControlsEnabled:c,backColor:m,pageBorderColor:x,activePageBorderColor:y,components:v})=>{const k=e._bleedVisible?t.bleed:0,O=t.computedWidth+2*k,P=t.computedHeight+2*k,S=(o-O*e.scale)/2,A=(s-P*e.scale)/2,R=n.default.useRef(null),C=n.default.useRef(null),I=n.default.useRef(null),W=null==c||c,[j,D]=n.default.useState(null),L=e.selectedElements.find(e=>e._cropModeEnabled),M=e.selectedElements.filter(e=>e.locked).length>0,q=e.selectedElements.filter(e=>!e.visible).length>0;n.default.useEffect(()=>{var t,n;if(!R.current)return;const i=R.current.getStage(),r=e.selectedElements.map(e=>e._cropModeEnabled?null:i.findOne("#"+e.id)).filter(e=>e),l=1===e.selectedElements.length&&(null===(t=e.selectedElements[0])||void 0===t?void 0:t.type)||"many";M?(R.current.enabledAnchors([]),R.current.rotateEnabled(!1)):p[l]?(R.current.setAttrs(Object.assign(Object.assign({},f),p[l])),"svg"!==l||e.selectedElements[0].keepRatio||R.current.setAttrs({enabledAnchors:f.enabledAnchors})):R.current.setAttrs(f),R.current.nodes(r),null===(n=R.current.getLayer())||void 0===n||n.batchDraw()},[e.selectedElements,L,M,q]);const T=(0,i.useLocalObservable)(()=>({visible:!1,x1:0,y1:0,x2:0,y2:0})),_=n.default.useRef(!1),B=(0,r.action)(n=>{var i,r;_.current=!1,e.activePage!==t&&t.select();const l=n.target.findAncestor(".elements-container"),o=n.target.findAncestor("Transformer"),a=n.target.findAncestor(".page-abs-container");if(l||o||a)return;const s=null===(i=n.target.getStage())||void 0===i?void 0:i.getPointerPosition();s&&(T.visible=!0,T.x1=s.x,T.y1=s.y,T.x2=s.x,T.y2=s.y,(null===(r=n.target.getStage())||void 0===r?void 0:r.getPointersPositions().length)>=2&&(T.visible=!1))});n.default.useEffect(()=>{const t=(0,r.action)(e=>{var t,n;if(!T.visible)return;null===(t=C.current)||void 0===t||t.setPointersPositions(e);let i=(null===(n=C.current)||void 0===n?void 0:n.getPointerPosition())||{x:T.x2,y:T.y2};T.x2=i.x,T.y2=i.y}),n=(0,r.action)(()=>{if(!T.visible)return;if(!C.current)return;const t=C.current.findOne(".selection"),n=t?t.getClientRect():{width:0,height:0,x:0,y:0};if(n.width&&n.height){const t=[];C.current.find(".element").forEach(i=>{const r=i.getClientRect(),l=e.getElementById(i.id()),o=null==l?void 0:l.locked,s=null==l?void 0:l.selectable;a.default.Util.haveIntersection(n,r)&&!o&&s&&t.push(i.id())}),e.selectElements(t)}T.visible=!1,_.current=!0});return window.addEventListener("mousemove",t),window.addEventListener("touchmove",t),window.addEventListener("mouseup",n),window.addEventListener("touchend",n),()=>{window.removeEventListener("mousemove",t),window.removeEventListener("touchmove",t),window.removeEventListener("mouseup",n),window.removeEventListener("touchend",n)}},[]);const H=t=>{if(_.current)return;const n=t.evt.ctrlKey||t.evt.metaKey||t.evt.shiftKey,i=t.target.findAncestor(".elements-container"),r=t.target.findAncestor(".page-abs-container"),l=t.target.findAncestor("Transformer");if(!(n||i||l||r))return void e.selectElements([]);const o=t.target.findAncestor(".element",!0),a=e.selectedElementsIds.indexOf(null==o?void 0:o.id())>=0;o&&n&&!a&&e.selectElements(e.selectedElementsIds.concat([o.id()])),o&&n&&a&&e.selectElements(e.selectedElementsIds.filter(e=>e!==o.id())),!o||n||a||e.selectElements([o.id()])};(0,d.useSnap)(R);const G=e.activePage===t,N=(null==v?void 0:v.PageControls)||u.PageControls;return n.default.createElement("div",{ref:I,onDragOver:e=>e.preventDefault(),onDrop:t=>{if(t.preventDefault(),!C.current)return;C.current.setPointersPositions(t);const n=C.current.findOne(".elements-container").getRelativePointerPosition(),i=C.current.getPointerPosition(),r=C.current.getIntersection(i),l=r&&r.findAncestor(".element",!0),o=l?e.getElementById(l.id()):void 0;Y&&(Y(n,o),Y=null)},style:{position:"relative",width:o+"px"},className:"polotno-page-container"+(G?" active-page":"")},n.default.createElement(l.Stage,{ref:C,width:o,height:s,onClick:H,onTap:H,onMouseDown:B,onMouseMove:n=>{if(!n.evt.altKey&&j)return void D(null);if(!n.evt.altKey)return;const i=n.target.findAncestor(".element",!0),r=null==i?void 0:i.id();if(!e.selectedElements[0])return;if(e.selectedElementsIds.includes(r))return;const l=(0,g.getClientRect)(e.selectedElements[0]),o=r?e.getElementById(r):{x:0,y:0,width:t.computedWidth,height:t.computedHeight,rotation:0},a=(0,g.getClientRect)(o),s=[];l.minX>a.maxX&&s.push({distance:l.minX-a.maxX,box1:l,box2:a,points:[{x:l.minX,y:l.minY+l.height/2},{x:a.maxX,y:l.minY+l.height/2},{x:a.maxX,y:a.minY+a.height/2}]}),l.maxX<a.minX&&s.push({distance:a.minX-l.maxX,box1:l,box2:a,points:[{x:l.maxX,y:l.minY+l.height/2},{x:a.minX,y:l.minY+l.height/2},{x:a.minX,y:a.minY+a.height/2}]}),l.minY>a.maxY&&s.push({box1:l,box2:a,distance:l.minY-a.maxY,points:[{x:l.minX+l.width/2,y:l.minY},{x:l.minX+l.width/2,y:a.maxY},{x:a.minX+a.width/2,y:a.maxY}]}),l.maxY<a.minY&&s.push({box1:l,box2:a,distance:a.minY-l.maxY,points:[{x:l.minX+l.width/2,y:l.maxY},{x:l.minX+l.width/2,y:a.minY},{x:a.minX+a.width/2,y:a.minY}]}),l.minX>=a.minX&&l.maxX<=a.maxX&&l.minY>=a.minY&&l.maxY<=a.maxY&&(s.push({distance:l.minX-a.minX,box1:l,box2:a,points:[{x:l.minX,y:l.minY+l.height/2},{x:a.minX,y:l.minY+l.height/2},{x:a.minX,y:a.minY+a.height/2}]}),s.push({distance:a.maxX-l.maxX,box1:l,box2:a,points:[{x:l.maxX,y:l.minY+l.height/2},{x:a.maxX,y:l.minY+l.height/2},{x:a.maxX,y:a.minY+a.height/2}]}),s.push({box1:l,box2:a,distance:l.minY-a.minY,points:[{x:l.minX+l.width/2,y:l.minY},{x:l.minX+l.width/2,y:a.minY},{x:a.minX+a.width/2,y:a.minY}]}),s.push({box1:l,box2:a,distance:a.maxY-l.maxY,points:[{x:l.minX+l.width/2,y:l.maxY},{x:l.minX+l.width/2,y:a.maxY},{x:a.minX+a.width/2,y:a.maxY}]})),JSON.stringify(j)!==JSON.stringify(s)&&D(s)},onDragStart:t=>{var n;if(t.target.hasName("element")){const i=t.target.id();!(e.selectedElementsIds.indexOf(i)>=0)&&i&&(e.selectElements([i]),null===(n=R.current)||void 0===n||n.startDrag(t))}j&&D(null)},pageId:t.id,style:{position:"relative"}},n.default.createElement(l.Layer,null,n.default.createElement(b,{width:o,height:s,fill:m}),n.default.createElement(l.Group,{x:S,y:A,scaleX:e.scale,scaleY:e.scale,name:"page-container"},n.default.createElement(l.Rect,{name:"page-highlight",hideInExport:!0,x:-1.5/e.scale,y:-1.5/e.scale,width:O+3/e.scale,height:P+3/e.scale,stroke:G&&e.pages.length>1?y:x,strokeWidth:3,listening:!1,strokeScaleEnabled:!1}),n.default.createElement(l.Group,{name:"page-background-group",x:k,y:k,clipX:-k,clipY:-k,clipWidth:t.computedWidth+2*k,clipHeight:t.computedHeight+2*k},n.default.createElement(E,{x:-t.bleed,y:-t.bleed,width:t.computedWidth+2*t.bleed,height:t.computedHeight+2*t.bleed,background:t.background,shadowBlur:10,shadowColor:"lightgrey",name:"page-background",preventDefault:!1,scale:e.scale})),n.default.createElement(l.Group,{x:k,y:k,clipX:-k,clipY:-k,clipWidth:t.computedWidth+2*k,clipHeight:t.computedHeight+2*k,name:"elements-container"},n.default.createElement(l.Rect,{name:"elements-area",width:t.computedWidth,height:t.computedHeight,listening:!1}),n.default.createElement(X,{elements:t.children,store:e})),n.default.createElement(l.Rect,{stroke:"red",name:"bleed",strokeWidth:t.bleed,x:t.bleed/2,y:t.bleed/2,width:t.computedWidth+t.bleed,height:t.computedHeight+t.bleed,opacity:.1,listening:!1,visible:t.bleed>0&&e._bleedVisible,hideInExport:!0})),n.default.createElement(l.Group,{x:S,y:A,scaleX:e.scale,scaleY:e.scale,name:"page-abs-container"},n.default.createElement(l.Transformer,{ref:R,boundBoxFunc:(e,t)=>{const n=t.width<1||t.height<1,i=e.width<1||e.height<1;return n&&!i?e:t}}),j&&j.map(({points:t,distance:i,box1:r,box2:o},a)=>n.default.createElement(l.Group,{name:"distances-container",hideInExport:!0,key:a,listening:!1},n.default.createElement(l.Rect,Object.assign({},r,{stroke:"rgb(0, 161, 255)",strokeWidth:1,strokeScaleEnabled:!1})),n.default.createElement(l.Rect,Object.assign({},o,{stroke:"rgb(0, 161, 255)",strokeWidth:1,strokeScaleEnabled:!1})),n.default.createElement(l.Line,{points:[t[0].x,t[0].y,t[1].x,t[1].y],stroke:"rgb(0, 161, 255)",strokeWidth:1,strokeScaleEnabled:!1}),n.default.createElement(l.Line,{points:[t[1].x,t[1].y,t[2].x,t[2].y],stroke:"rgb(0, 161, 255)",strokeWidth:1,strokeScaleEnabled:!1}),n.default.createElement(l.Group,{x:(t[0].x+t[1].x)/2,y:(t[0].y+t[1].y)/2,scaleX:1/e.scale,scaleY:1/e.scale},n.default.createElement(l.Rect,{offsetX:25,offsetY:10,width:50,height:20,cornerRadius:5,fill:"rgb(0, 161, 255)"}),n.default.createElement(l.Text,{offsetX:25,offsetY:10,width:50,height:20,align:"center",verticalAlign:"middle",fill:"white",text:Math.round(i).toString()+" px"}))))),n.default.createElement(w,{selection:T}),h.shouldShowCredit.value&&n.default.createElement(l.Text,{text:"Powered by polotno.dev",fontSize:14,fill:"rgba(0,0,0,0.6)",x:o-170,y:s-18,onMouseEnter:e=>{e.target.getStage().container().style.cursor="pointer"},onMouseLeave:e=>{e.target.getStage().container().style.cursor=""},onTouchStart:e=>{e.cancelBubble=!0},onMouseDown:e=>{e.cancelBubble=!0},onClick:()=>{window.open("https://polotno.dev")},onTap:()=>{window.open("https://polotno.dev")}}),n.default.createElement(l.Group,{name:"line-guides"}))),W&&G&&n.default.createElement(N,{store:e,page:t,xPadding:S,yPadding:A}))});
845
845
  },{"react":"HdMw","mobx-react-lite":"ZfSi","mobx":"BzvP","react-konva":"Sgug","use-image":"MJM3","konva":"aTGn","./element":"XEPK","./use-transformer-snap":"F86d","./image-element":"VbEp","../utils/crop":"hfHf","./page-controls":"smDv","../utils/validate-key":"zree","../utils/math":"RXmf"}],"NI5R":[function(require,module,exports) {
@@ -849,19 +849,19 @@ var e="undefined"!=typeof Element,r="function"==typeof Map,t="function"==typeof
849
849
  },{"react":"HdMw","mobx-react-lite":"ZfSi","./page":"Co9b","./hotkeys":"NI5R","../utils/l10n":"FlVj"}],"pk4v":[function(require,module,exports) {
850
850
  var process = require("process");
851
851
  var e=require("process");Object.defineProperty(exports,"__esModule",{value:!0}),exports.addDisposer=G,exports.addMiddleware=Ve,exports.applyAction=Pe,exports.applyPatch=m,exports.applySnapshot=_,exports.cast=q,exports.castFlowReturn=Zt,exports.castToReferenceSnapshot=Q,exports.castToSnapshot=K,exports.clone=L,exports.createActionTrackingMiddleware=de,exports.createActionTrackingMiddleware2=ve,exports.decorate=Ne,exports.destroy=$,exports.detach=U,exports.escapeJsonPath=rr,exports.flow=Jt,exports.getChildType=y,exports.getEnv=Y,exports.getIdentifier=R,exports.getLivelinessChecking=o,exports.getMembers=B,exports.getNodeId=X,exports.getParent=I,exports.getParentOfType=T,exports.getPath=E,exports.getPathParts=V,exports.getPropertyMembers=Z,exports.getRelativePath=H,exports.getRoot=C,exports.getRunningActionContext=Re,exports.getSnapshot=S,exports.getType=d,exports.hasParent=A,exports.hasParentOfType=x,exports.isActionContextChildOf=Fe,exports.isActionContextThisOrChildOf=Me,exports.isAlive=W,exports.isArrayType=Or,exports.isFrozenType=dn,exports.isIdentifierType=Cn,exports.isLateType=pn,exports.isLiteralType=Gr,exports.isMapType=yr,exports.isModelType=Er,exports.isOptionalType=nn,exports.isPrimitiveType=Ur,exports.isProtected=j,exports.isReferenceType=jn,exports.isRefinementType=Zr,exports.isRoot=N,exports.isStateTreeNode=nt,exports.isType=fe,exports.isUnionType=Qr,exports.isValidReference=F,exports.joinJsonPath=ir,exports.onAction=_e,exports.onPatch=v,exports.onSnapshot=g,exports.process=ht,exports.protect=P,exports.recordActions=je,exports.recordPatches=w,exports.resolveIdentifier=k,exports.resolvePath=D,exports.setLivelinessChecking=i,exports.setLivelynessChecking=a,exports.splitJsonPath=or,exports.toGenerator=qt,exports.toGeneratorFunction=Bt,exports.tryReference=z,exports.tryResolve=M,exports.typecheck=Be,exports.unescapeJsonPath=nr,exports.unprotect=O,exports.walk=J,exports.types=void 0;var t,r=require("mobx"),n="warn";function i(e){n=e}function o(){return n}function a(e){i(e)}!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(t||(t={}));var u=function(e,t){return(u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)};function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}u(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var s=function(){return(s=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function c(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r}function p(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(o){return function(u){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(u){o=[6,u],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,u])}}}function f(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function b(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(u){i={error:u}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a}function h(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(b(arguments[t]));return e}function d(e){return it(e,1),ot(e).type}function y(e,t){return it(e,1),ot(e).getChildType(t)}function v(e,t){return it(e,1),$t(t,2),ot(e).onPatch(t)}function g(e,t){return it(e,1),$t(t,2),ot(e).onSnapshot(t)}function m(e,t){it(e,1),Ut(t,function(e){return"object"==typeof e},"object or array",2),ot(e).applyPatches(jt(t))}function w(e,t){it(e,1);var r,n={patches:[],reversedInversePatches:[]},i={},o={get recording(){return!!r},get patches(){return i.patches||(i.patches=n.patches.slice()),i.patches},get reversedInversePatches(){return i.reversedInversePatches||(i.reversedInversePatches=n.reversedInversePatches.slice()),i.reversedInversePatches},get inversePatches(){return i.inversePatches||(i.inversePatches=n.reversedInversePatches.slice().reverse()),i.inversePatches},stop:function(){r&&(r(),r=void 0)},resume:function(){r||(r=v(e,function(e,r){t&&!t(e,r,Re())||(n.patches.push(e),n.reversedInversePatches.unshift(r),i.patches=void 0,i.inversePatches=void 0,i.reversedInversePatches=void 0)}))},replay:function(t){m(t||e,n.patches)},undo:function(t){m(t||e,n.reversedInversePatches)}};return o.resume(),o}function P(e){it(e,1);var t=ot(e);if(!t.isRoot)throw mt("`protect` can only be invoked on root nodes");t.isProtectionEnabled=!0}function O(e){it(e,1);var t=ot(e);if(!t.isRoot)throw mt("`unprotect` can only be invoked on root nodes");t.isProtectionEnabled=!1}function j(e){return ot(e).isProtected}function _(e,t){return it(e,1),ot(e).applySnapshot(t)}function S(e,t){void 0===t&&(t=!0),it(e,1);var r=ot(e);return t?r.snapshot:xt(r.type.getSnapshot(r,!1))}function A(e,t){void 0===t&&(t=1),it(e,1),Wt(t,2,0);for(var r=ot(e).parent;r;){if(0==--t)return!0;r=r.parent}return!1}function I(e,t){void 0===t&&(t=1),it(e,1),Wt(t,2,0);for(var r=t,n=ot(e).parent;n;){if(0==--r)return n.storedValue;n=n.parent}throw mt("Failed to find the parent of "+ot(e)+" at depth "+t)}function x(e,t){it(e,1),be(t,2);for(var r=ot(e).parent;r;){if(t.is(r.storedValue))return!0;r=r.parent}return!1}function T(e,t){it(e,1),be(t,2);for(var r=ot(e).parent;r;){if(t.is(r.storedValue))return r.storedValue;r=r.parent}throw mt("Failed to find the parent of "+ot(e)+" of a given type")}function C(e){return it(e,1),ot(e).root.storedValue}function E(e){return it(e,1),ot(e).path}function V(e){return it(e,1),or(ot(e).path)}function N(e){return it(e,1),ot(e).isRoot}function D(e,t){it(e,1),Gt(t,2);var r=ct(ot(e),t);return r?r.value:void 0}function k(e,t,r){be(e,1),it(t,2),Nn(r,3);var n=ot(t).root.identifierCache.resolve(e,En(r));return null==n?void 0:n.value}function R(e){return it(e,1),ot(e).identifier}function z(e,t){void 0===t&&(t=!0);try{var r=e();if(null==r)return;if(nt(r))return t?W(r)?r:void 0:r;throw mt("The reference to be checked is not one of node, null or undefined")}catch(n){if(n instanceof gn)return;throw n}}function F(e,t){void 0===t&&(t=!0);try{var r=e();if(null==r)return!1;if(nt(r))return!t||W(r);throw mt("The reference to be checked is not one of node, null or undefined")}catch(n){if(n instanceof gn)return!1;throw n}}function M(e,t){it(e,1),Gt(t,2);var r=ct(ot(e),t,!1);if(void 0!==r)try{return r.value}catch(n){return}}function H(e,t){return it(e,1),it(t,2),st(ot(e),ot(t))}function L(e,t){void 0===t&&(t=!0),it(e,1);var r=ot(e);return r.type.create(r.snapshot,!0===t?r.root.environment:!1===t?void 0:t)}function U(e){return it(e,1),ot(e).detach(),e}function $(e){it(e,1);var t=ot(e);t.isRoot?t.die():t.parent.removeChild(t.subpath)}function W(e){return it(e,1),ot(e).observableIsAlive}function G(e,t){return it(e,1),$t(t,2),ot(e).addDisposer(t),t}function Y(e){it(e,1);var t=ot(e).root.environment;return t||vt}function J(e,t){it(e,1),$t(t,2);var r=ot(e);r.getChildren().forEach(function(e){nt(e.storedValue)&&J(e.storedValue,t)}),t(r.storedValue)}function Z(e){var t;return Ut(t=nt(e)?d(e):e,function(e){return Er(e)},"model type or model instance",1),{name:t.name,properties:s({},t.properties)}}function B(e){var t=ot(e).type,n=s(s({},Z(t)),{actions:[],volatile:[],views:[]});return Object.getOwnPropertyNames(e).forEach(function(t){if(!(t in n.properties)){var i=Object.getOwnPropertyDescriptor(e,t);i.get?(0,r.isComputedProp)(e,t)?n.views.push(t):n.volatile.push(t):!0===i.value._isMSTAction?n.actions.push(t):(0,r.isObservableProp)(e,t)?n.volatile.push(t):n.views.push(t)}}),n}function q(e){return e}function K(e){return e}function Q(e){return e}function X(e){return it(e,1),ot(e).nodeId}var ee=function(){function e(e,t,r,n){Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"environment",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_escapedSubpath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_subpath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_subpathUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_pathUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"storedValue",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"aliveAtom",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_state",{enumerable:!0,configurable:!0,writable:!0,value:Ke.INITIALIZING}),Object.defineProperty(this,"_hookSubscribers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_parent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"pathAtom",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.environment=n,this.baseSetParent(t,r)}return Object.defineProperty(e.prototype,"subpath",{get:function(){return this._subpath},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subpathUponDeath",{get:function(){return this._subpathUponDeath},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pathUponDeath",{get:function(){return this._pathUponDeath},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"value",{get:function(){return this.type.getValue(this)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"state",{get:function(){return this._state},set:function(e){var t=this.isAlive;this._state=e;var r=this.isAlive;this.aliveAtom&&t!==r&&this.aliveAtom.reportChanged()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fireInternalHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._hookSubscribers&&this._hookSubscribers.emit(e,this,e)}}),Object.defineProperty(e.prototype,"registerHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._hookSubscribers||(this._hookSubscribers=new kt),this._hookSubscribers.register(e,t)}}),Object.defineProperty(e.prototype,"parent",{get:function(){return this._parent},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getReconciliationType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type}}),Object.defineProperty(e.prototype,"baseSetParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._parent=e,this._subpath=t,this._escapedSubpath=void 0,this.pathAtom&&this.pathAtom.reportChanged()}}),Object.defineProperty(e.prototype,"path",{get:function(){return this.getEscapedPath(!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getEscapedPath",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e&&(this.pathAtom||(this.pathAtom=(0,r.createAtom)("path")),this.pathAtom.reportObserved()),this.parent?(void 0===this._escapedSubpath&&(this._escapedSubpath=this._subpath?rr(this._subpath):""),this.parent.getEscapedPath(e)+"/"+this._escapedSubpath):""}}),Object.defineProperty(e.prototype,"isRoot",{get:function(){return null===this.parent},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isAlive",{get:function(){return this.state!==Ke.DEAD},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isDetaching",{get:function(){return this.state===Ke.DETACHING},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"observableIsAlive",{get:function(){return this.aliveAtom||(this.aliveAtom=(0,r.createAtom)("alive")),this.aliveAtom.reportObserved(),this.isAlive},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"baseFinalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(Lt()&&!this.isAlive)throw fail("assertion failed: cannot finalize the creation of a node that is already dead");if(this.state===Ke.CREATED){if(this.parent){if(this.parent.state!==Ke.FINALIZED)return;this.fireHook(t.afterAttach)}this.state=Ke.FINALIZED,e&&e()}}}),Object.defineProperty(e.prototype,"baseFinalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._hookSubscribers&&this._hookSubscribers.clearAll(),this._subpathUponDeath=this._subpath,this._pathUponDeath=this.getEscapedPath(!1),this.baseSetParent(null,""),this.state=Ke.DEAD}}),Object.defineProperty(e.prototype,"baseAboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.fireHook(t.beforeDestroy)}}),e}(),te=function(e){function t(t,r,n,i,o){var a=e.call(this,t,r,n,i)||this;try{a.storedValue=t.createNewInstance(o)}catch(u){throw a.state=Ke.DEAD,u}return a.state=Ke.CREATED,a.finalizeCreation(),a}return l(t,e),Object.defineProperty(t.prototype,"root",{get:function(){if(!this.parent)throw mt("This scalar node is not part of a tree");return this.parent.root},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.parent!==e,n=this.subpath!==t;if(r||n){if(Lt()){if(!t)throw mt("assertion failed: subpath expected");if(!e)throw mt("assertion failed: parent expected");if(r)throw mt("assertion failed: scalar nodes cannot change their parent")}this.environment=void 0,this.baseSetParent(this.parent,t)}}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return xt(this.getSnapshot())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"<root>";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Ke.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(ee);te.prototype.die=(0,r.action)(te.prototype.die);var re,ne,ie=1,oe={onError:function(e){throw e}},ae=function(e){function n(t,n,i,o,a){var u=e.call(this,t,n,i,o)||this;if(Object.defineProperty(u,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++ie}),Object.defineProperty(u,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(u,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(u,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(u,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(u,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(u,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(u,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(u,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(u,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(u,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(u,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(u,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(u,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(u,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(u,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(u,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(u,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(u,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(u,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),u._snapshotComputed=(0,r.computed)(function(){return xt(u.getSnapshot())}),u.unbox=u.unbox.bind(u),u._initialSnapshot=xt(a),u.identifierAttribute=t.identifierAttribute,n||(u.identifierCache=new Xe),u._childNodes=t.initializeChildNodes(u,u._initialSnapshot),u.identifier=null,u.unnormalizedIdentifier=null,u.identifierAttribute&&u._initialSnapshot){var l=u._initialSnapshot[u.identifierAttribute];if(void 0===l){var s=u._childNodes[u.identifierAttribute];s&&(l=s.value)}if("string"!=typeof l&&"number"!=typeof l)throw mt("Instance identifier '"+u.identifierAttribute+"' for type '"+u.type.name+"' must be a string or a number");u.identifier=En(l),u.unnormalizedIdentifier=l}return n?n.root.identifierCache.addNodeToCache(u):u.identifierCache.addNodeToCache(u),u}return l(n,e),Object.defineProperty(n.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(n.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(n.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(){0===this._observableInstanceState&&this.createObservableInstance()}}),Object.defineProperty(n.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e,r;if(Lt()&&this.state!==Ke.INITIALIZING)throw mt("assertion failed: the creation of the observable instance must be done on the initializing phase");this._observableInstanceState=1;for(var n=[],i=this.parent;i&&0===i._observableInstanceState;)n.unshift(i),i=i.parent;try{for(var o=f(n),a=o.next();!a.done;a=o.next()){a.value.createObservableInstanceIfNeeded()}}catch(l){e={error:l}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}var u=this.type;try{this.storedValue=u.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,u.finalizeNewInstance(this,this.storedValue)}catch(s){throw this.state=Ke.DEAD,s}finally{this._isRunningAction=!1}this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=vt,this.state=Ke.CREATED,this.fireHook(t.afterCreate),this.finalizeCreation()}}),Object.defineProperty(n.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(t.beforeDetach);var e=this.state;this.state=Ke.DETACHING;var r=this.root,n=r.environment,i=r.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=i}finally{this.state=e}}}}),Object.defineProperty(n.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r){var n=e!==this.parent,i=r!==this.subpath;if(n||i){if(Lt()){if(!r)throw mt("assertion failed: subpath expected");if(!e)throw mt("assertion failed: new parent expected");if(this.parent&&n)throw mt("A node cannot exists twice in the state tree. Failed to add "+this+" to path '"+e.path+"/"+r+"'.");if(!this.parent&&e.root===this)throw mt("A state tree is not allowed to contain itself. Cannot assign "+this+" to path '"+e.path+"/"+r+"'");if(!this.parent&&this.environment&&this.environment!==e.root.environment)throw mt("A state tree cannot be made part of another state tree as long as their environments are different.")}n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,r),this.fireHook(t.afterAttach)):i&&this.baseSetParent(this.parent,r)}}}),Object.defineProperty(n.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof n&&(r._allowStateChangesInsideComputed?(0,r._allowStateChangesInsideComputed)(function(){n.apply(t.storedValue)}):n.apply(this.storedValue))}}),Object.defineProperty(n.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(n.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(n.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,r=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,r),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(n.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(n.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=o();if(!this.isAlive&&"ignore"!==t){var r=this._getAssertAliveError(e);switch(t){case"error":throw mt(r);case"warn":Mt(r)}}}}),Object.defineProperty(n.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",r=e.subpath&&rr(e.subpath)||"",n=e.actionContext||Ie();n&&"action"!==n.type&&n.parentActionEvent&&(n=n.parentActionEvent);var i="";n&&null!=n.name&&(i=(n&&n.context&&E(n.context)||t)+"."+n.name+"()");return"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+r+"', Action: '"+i+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(n.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(n.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(vt),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ft(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(n.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(n.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw mt("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(n.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(n.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(n.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"<root>",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(n.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation(function(){var r,n;try{for(var i=f(e.getChildren()),o=i.next();!o.done;o=i.next()){o.value.finalizeCreation()}}catch(a){r={error:a}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}e.fireInternalHook(t.afterCreationFinalization)})}}),Object.defineProperty(n.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw mt("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(n.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Ee(this.storedValue,"@APPLY_PATCHES",function(t){t.forEach(function(t){if(t.path){var r=or(t.path);pt(e,r.slice(0,-1)).applyPatchLocally(r[r.length-1],t)}else e.type.applySnapshot(e,t.value)})}),this._applySnapshot=Ee(this.storedValue,"@APPLY_SNAPSHOT",function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)}),Vt(this.storedValue,"$treenode",this),Vt(this.storedValue,"toJSON",ut)}}),Object.defineProperty(n.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Ke.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(n.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach(function(e){e.aboutToDie()}),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(n.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach(function(e){e.finalizeDeath()}),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(n.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(n.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(n.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(n.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var r=b(Qt(_t({},e,{path:t.path.substr(this.path.length)+"/"+e.path})),2),n=r[0],i=r[1];this._internalEventsEmit("patch",n,i)}this.parent&&this.parent.emitPatch(e,t)}}),Object.defineProperty(n.prototype,"hasDisposer",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsHas("dispose",e)}}),Object.defineProperty(n.prototype,"addDisposer",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.hasDisposer(e))throw mt("cannot add a disposer when it is already registered for execution");this._internalEventsRegister("dispose",e,!0)}}),Object.defineProperty(n.prototype,"removeDisposer",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._internalEventsHas("dispose",e))throw mt("cannot remove a disposer which was never registered for execution");this._internalEventsUnregister("dispose",e)}}),Object.defineProperty(n.prototype,"removeMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.middlewares){var t=this.middlewares.indexOf(e);t>=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(n.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;void 0===t&&(t=!0);var n={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(n):this.middlewares=[n],function(){r.removeMiddleware(n)}}}),Object.defineProperty(n.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(n.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=(0,r.reaction)(function(){return e.snapshot},function(t){return e.emitSnapshot(t)},oe);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(n.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(n.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this._internalEvents||(this._internalEvents=new kt),this._internalEvents.register(e,t,r)}}),Object.defineProperty(n.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(n.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(n.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];this._internalEvents&&(t=this._internalEvents).emit.apply(t,h([e],r))}}),Object.defineProperty(n.prototype,"_internalEventsClear",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEvents&&this._internalEvents.clear(e)}}),Object.defineProperty(n.prototype,"_internalEventsClearAll",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._internalEvents&&this._internalEvents.clearAll()}}),n}(ee);ae.prototype.createObservableInstance=(0,r.action)(ae.prototype.createObservableInstance),ae.prototype.detach=(0,r.action)(ae.prototype.detach),ae.prototype.die=(0,r.action)(ae.prototype.die),function(e){e[e.String=1]="String",e[e.Number=2]="Number",e[e.Boolean=4]="Boolean",e[e.Date=8]="Date",e[e.Literal=16]="Literal",e[e.Array=32]="Array",e[e.Map=64]="Map",e[e.Object=128]="Object",e[e.Frozen=256]="Frozen",e[e.Optional=512]="Optional",e[e.Reference=1024]="Reference",e[e.Identifier=2048]="Identifier",e[e.Late=4096]="Late",e[e.Refinement=8192]="Refinement",e[e.Union=16384]="Union",e[e.Null=32768]="Null",e[e.Undefined=65536]="Undefined",e[e.Integer=131072]="Integer",e[e.Custom=262144]="Custom",e[e.SnapshotProcessor=524288]="SnapshotProcessor"}(ne||(ne={}));var ue="cannotDetermine",le=Symbol("$type"),se=function(){function e(e){Object.defineProperty(this,re,{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"C",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"S",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"T",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"N",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"isType",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=e}return Object.defineProperty(e.prototype,"create",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Ze(this,e),this.instantiate(null,"",t,e).value}}),Object.defineProperty(e.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){throw mt("unimplemented method")}}),Object.defineProperty(e.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e===this}}),Object.defineProperty(e.prototype,"validate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(at(e)){var r=d(e);return this.isAssignableFrom(r)?Ge():Ye(t,e)}return this.isValidSnapshot(e,t)}}),Object.defineProperty(e.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return 0===this.validate(e,[{path:"",type:this}]).length}}),Object.defineProperty(e.prototype,"Type",{get:function(){throw mt("Factory.Type should not be actually called. It is just a Type signature that can be used at compile time with Typescript, by using `typeof type.Type`")},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"TypeWithoutSTN",{get:function(){throw mt("Factory.TypeWithoutSTN should not be actually called. It is just a Type signature that can be used at compile time with Typescript, by using `typeof type.TypeWithoutSTN`")},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"SnapshotType",{get:function(){throw mt("Factory.SnapshotType should not be actually called. It is just a Type signature that can be used at compile time with Typescript, by using `typeof type.SnapshotType`")},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"CreationType",{get:function(){throw mt("Factory.CreationType should not be actually called. It is just a Type signature that can be used at compile time with Typescript, by using `typeof type.CreationType`")},enumerable:!1,configurable:!0}),e}();re=le,se.prototype.create=(0,r.action)(se.prototype.create);var ce=function(e){function t(t){var r=e.call(this,t)||this;return Object.defineProperty(r,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return l(t,e),Object.defineProperty(t.prototype,"create",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return void 0===t&&(t=this.getDefaultSnapshot()),e.prototype.create.call(this,t,r)}}),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.createObservableInstanceIfNeeded(),e.storedValue}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!e.identifierAttribute||e.identifier===En(t[e.identifierAttribute])}}),Object.defineProperty(t.prototype,"tryToReconcileNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!e.isDetaching&&(e.snapshot===t||(!(!nt(t)||ot(t)!==e)||!(e.type!==this||!At(t)||nt(t)||!this.isMatchingSnapshotId(e,t))&&(e.applySnapshot(t),!0)))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(this.tryToReconcileNode(e,t))return e.setParent(r,n),e;if(e.die(),nt(t)&&this.isAssignableFrom(d(t))){var i=ot(t);return i.setParent(r,n),i}return this.instantiate(r,n,void 0,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return null}}),t}(se);ce.prototype.create=(0,r.action)(ce.prototype.create);var pe=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return l(t,e),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e}}),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!e.isDetaching&&e.type===this&&e.storedValue===t)return e;var i=this.instantiate(r,n,void 0,t);return e.die(),i}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return null}}),t}(se);function fe(e){return"object"==typeof e&&e&&!0===e.isType}function be(e,t){Ut(e,fe,"mobx-state-tree type",t)}var he=new Map;function de(e){return function(t,r,n){switch(t.type){case"action":if(e.filter&&!0!==e.filter(t))return r(t);var i=e.onStart(t);e.onResume(t,i),he.set(t.id,{call:t,context:i,async:!1});try{var o=r(t);return e.onSuspend(t,i),!1===he.get(t.id).async&&(he.delete(t.id),e.onSuccess(t,i,o)),o}catch(u){throw he.delete(t.id),e.onFail(t,i,u),u}case"flow_spawn":return(a=he.get(t.rootId)).async=!0,r(t);case"flow_resume":case"flow_resume_error":var a=he.get(t.rootId);e.onResume(t,a.context);try{return r(t)}finally{e.onSuspend(t,a.context)}case"flow_throw":a=he.get(t.rootId);return he.delete(t.rootId),e.onFail(t,a.context,t.args[0]),r(t);case"flow_return":a=he.get(t.rootId);return he.delete(t.rootId),e.onSuccess(t,a.context,t.args[0]),r(t)}}}var ye=function(){function e(e,t){Object.defineProperty(this,"hooks",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"call",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"flowsPending",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"running",{enumerable:!0,configurable:!0,writable:!0,value:!0}),e&&e.onStart(t)}return Object.defineProperty(e.prototype,"finish",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.running&&(this.running=!1,this.hooks&&this.hooks.onFinish(this.call,e))}}),Object.defineProperty(e.prototype,"incFlowsPending",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.flowsPending++}}),Object.defineProperty(e.prototype,"decFlowsPending",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.flowsPending--}}),Object.defineProperty(e.prototype,"hasFlowsPending",{get:function(){return this.flowsPending>0},enumerable:!1,configurable:!0}),e}();function ve(e){var t=new WeakMap;return function(r,n){var i=r.parentActionEvent?t.get(r.parentActionEvent):void 0;if("action"===r.type){var o=s(s({},r),{env:i&&i.call.env,parentCall:i&&i.call}),a=!e.filter||e.filter(o),u=new ye(a?e:void 0,o);t.set(r,u);var l=void 0;try{l=n(r)}catch(p){throw u.finish(p),p}return u.hasFlowsPending||u.finish(),l}if(!i)return n(r);switch(r.type){case"flow_spawn":return i.incFlowsPending(),n(r);case"flow_resume":case"flow_resume_error":return n(r);case"flow_throw":var c=r.args[0];try{return n(r)}finally{i.decFlowsPending(),i.hasFlowsPending||i.finish(c)}case"flow_return":try{return n(r)}finally{i.decFlowsPending(),i.hasFlowsPending||i.finish()}}}}function ge(e,t,r,n){if(n instanceof Date)return{$MST_DATE:n.getTime()};if(It(n))return n;if(nt(n))return we("[MSTNode: "+d(n).name+"]");if("function"==typeof n)return we("[function]");if("object"==typeof n&&!St(n)&&!Ot(n))return we("[object "+(n&&n.constructor&&n.constructor.name||"Complex Object")+"]");try{return JSON.stringify(n),n}catch(i){return we(""+i)}}function me(e,t){return t&&"object"==typeof t&&"$MST_DATE"in t?new Date(t.$MST_DATE):t}function we(e){return{$MST_UNSERIALIZABLE:!0,type:e}}function Pe(e,t){it(e,1),Ut(t,function(e){return"object"==typeof e},"object or array",2),(0,r.runInAction)(function(){jt(t).forEach(function(t){return Oe(e,t)})})}function Oe(e,t){var r=M(e,t.path||"");if(!r)throw mt("Invalid action path: "+(t.path||""));var n=ot(r);if("@APPLY_PATCHES"===t.name)return m.call(null,r,t.args[0]);if("@APPLY_SNAPSHOT"===t.name)return _.call(null,r,t.args[0]);if("function"!=typeof r[t.name])throw mt("Action '"+t.name+"' does not exist in '"+n.path+"'");return r[t.name].apply(r,t.args?t.args.map(function(e){return me(n,e)}):[])}function je(e,t){it(e,1);var r,n=[],i=function(e){(!t||t(e,Re()))&&n.push(e)},o={actions:n,get recording(){return!!r},stop:function(){r&&(r(),r=void 0)},resume:function(){r||(r=_e(e,i))},replay:function(e){Pe(e,n)}};return o.resume(),o}function _e(e,t,r){return void 0===r&&(r=!1),it(e,1),Lt()&&(N(e)||Mt("Warning: Attaching onAction listeners to non root nodes is dangerous: No events will be emitted for actions initiated higher up in the tree."),j(e)||Mt("Warning: Attaching onAction listeners to non protected nodes is dangerous: No events will be emitted for direct modifications without action.")),Ve(e,function(n,i){if("action"===n.type&&n.id===n.rootId){var o=ot(n.context),a={name:n.name,path:st(ot(e),o),args:n.args.map(function(e,t){return ge(o,n.name,t,e)})};if(r){var u=i(n);return t(a),u}return t(a),i(n)}return i(n)})}var Se,Ae=1;function Ie(){return Se}function xe(){return Ae++}function Te(e,t){var r=ot(e.context);"action"===e.type&&r.assertAlive({actionContext:e});var n=r._isRunningAction;r._isRunningAction=!0;var i=Se;Se=e;try{return ke(r,e,t)}finally{Se=i,r._isRunningAction=n}}function Ce(e){if(e)return"action"===e.type?e:e.parentActionEvent}function Ee(e,t,r){var n=function(){var n=xe(),i=Se,o=Ce(i);return Te({type:"action",name:t,id:n,args:Rt(arguments),context:e,tree:C(e),rootId:i?i.rootId:n,parentId:i?i.id:0,allParentIds:i?h(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:o},r)};return n._isMSTAction=!0,n}function Ve(e,t,r){void 0===r&&(r=!0);var n=ot(e);return Lt()&&(n.isProtectionEnabled||Mt("It is recommended to protect the state tree before attaching action middleware, as otherwise it cannot be guaranteed that all changes are passed through middleware. See `protect`")),n.addMiddleWare(t,r)}function Ne(e,t,r){void 0===r&&(r=!0);var n={handler:e,includeHooks:r};return t.$mst_middleware=t.$mst_middleware||[],t.$mst_middleware.push(n),t}var De=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var r=e;r;)r.middlewares&&this.middlewares.push(r.middlewares),r=r.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e){var t=e[this.inArrayIndex++];return t||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}}),e}();function ke(e,n,i){var o=new De(e,i);if(o.isEmpty)return(0,r.action)(i).apply(null,n.args);var a=null;return function e(n){var u=o.getNextMiddleware(),l=u&&u.handler;if(!l)return(0,r.action)(i).apply(null,n.args);if(!u.includeHooks&&t[n.name])return e(n);var s=!1;var c=!1;if(l(n,function(t,r){s=!0,a=e(t),r&&(a=r(a))},function(e){c=!0,a=e}),Lt()){if(!s&&!c){var p=ot(n.tree);throw mt("Neither the next() nor the abort() callback within the middleware "+l.name+' for the action: "'+n.name+'" on the node: '+p.type.name+" was invoked.")}if(s&&c)throw p=ot(n.tree),mt("The next() and abort() callback within the middleware "+l.name+' for the action: "'+n.name+'" on the node: '+p.type.name+" were invoked.")}return a}(n)}function Re(){for(var e=Ie();e&&"action"!==e.type;)e=e.parentActionEvent;return e}function ze(e,t,r){for(var n="number"==typeof t?t:t.id,i=r?e:e.parentActionEvent;i;){if(i.id===n)return!0;i=i.parentActionEvent}return!1}function Fe(e,t){return ze(e,t,!1)}function Me(e,t){return ze(e,t,!0)}function He(e){try{return JSON.stringify(e)}catch(t){return"<Unserializable: "+t+">"}}function Le(e){return"function"==typeof e?"<function"+(e.name?" "+e.name:"")+">":nt(e)?"<"+e+">":"`"+He(e)+"`"}function Ue(e){return e.length<280?e:e.substring(0,272)+"......"+e.substring(e.length-8)}function $e(e){var t=e.value,r=e.context[e.context.length-1].type,n=e.context.map(function(e){return e.path}).filter(function(e){return e.length>0}).join("/"),i=n.length>0?'at path "/'+n+'" ':"",o=nt(t)?"value of type "+ot(t).type.name+":":It(t)?"value":"snapshot",a=r&&nt(t)&&r.is(ot(t).snapshot);return""+i+o+" "+Le(t)+" is not assignable "+(r?"to type: `"+r.name+"`":"")+(e.message?" ("+e.message+")":"")+(r?Ur(r)||It(t)?".":", expected an instance of `"+r.name+"` or a snapshot like `"+r.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function We(e,t,r){return e.concat([{path:t,type:r}])}function Ge(){return yt}function Ye(e,t,r){return[{context:e,value:t,message:r}]}function Je(e){return e.reduce(function(e,t){return e.concat(t)},[])}function Ze(e,t){Ht()&&Be(e,t)}function Be(e,t){var r=e.validate(t,[{path:"",type:e}]);if(r.length>0)throw mt(qe(e,t,r))}function qe(e,t,r){if(0!==r.length)return"Error while converting "+Ue(Le(t))+" to `"+e.name+"`:\n\n "+r.map($e).join("\n ")}var Ke,Qe=0,Xe=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Qe++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:r.observable.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:r.observable.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,r.observable.array([],gt));var i=this.cache.get(n);if(-1!==i.indexOf(e))throw mt("Already registered");i.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;(0,r.values)(e.identifierCache.cache).forEach(function(e){return e.forEach(function(e){t.addNodeToCache(e)})})}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,r=this.cache.get(t);r&&(r.remove(e),r.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n=this,i=new e,o=t.path;return(0,r.entries)(this.cache).forEach(function(e){for(var t=b(e,2),r=t[0],a=t[1],u=!1,l=a.length-1;l>=0;l--)0===a[l].path.indexOf(o)&&(i.addNodeToCache(a[l],!1),a.splice(l,1),u=!0);u&&n.updateLastCacheModificationPerId(r)}),i}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);return!!r&&r.some(function(t){return e.isAssignableFrom(t.type)})}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);if(!r)return null;var n=r.filter(function(t){return e.isAssignableFrom(t.type)});switch(n.length){case 0:return null;case 1:return n[0];default:throw mt("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+n.map(function(e){return e.path}).join(", "))}}}),e}();function et(e,t,r,n,i){var o=at(i);if(o){if(o.parent)throw mt("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+r+"', but it lives already at '"+o.path+"'");return t&&o.setParent(t,r),o}return new ae(e,t,r,n,i)}function tt(e,t,r,n,i){return new te(e,t,r,n,i)}function rt(e){return e instanceof te||e instanceof ae}function nt(e){return!(!e||!e.$treenode)}function it(e,t){Ut(e,nt,"mobx-state-tree node",t)}function ot(e){if(!nt(e))throw mt("Value "+e+" is no MST Node");return e.$treenode}function at(e){return e&&e.$treenode||null}function ut(){return ot(this).snapshot}!function(e){e[e.INITIALIZING=0]="INITIALIZING",e[e.CREATED=1]="CREATED",e[e.FINALIZED=2]="FINALIZED",e[e.DETACHING=3]="DETACHING",e[e.DEAD=4]="DEAD"}(Ke||(Ke={}));var lt=function(e){return".."};function st(e,t){if(e.root!==t.root)throw mt("Cannot calculate relative path: objects '"+e+"' and '"+t+"' are not part of the same object tree");for(var r=or(e.path),n=or(t.path),i=0;i<r.length&&r[i]===n[i];i++);return r.slice(i).map(lt).join("/")+ir(n.slice(i))}function ct(e,t,r){return void 0===r&&(r=!0),pt(e,or(t),r)}function pt(e,t,r){void 0===r&&(r=!0);for(var n=e,i=0;i<t.length;i++){var o=t[i];if(".."===o){if(n=n.parent)continue}else{if("."===o)continue;if(n){if(n instanceof te)try{var a=n.value;nt(a)&&(n=ot(a))}catch(u){if(!r)return;throw u}if(n instanceof ae)if(n.getChildType(o)&&(n=n.getChildNode(o)))continue}}if(r)throw mt("Could not resolve '"+o+"' in path '"+(ir(t.slice(0,i))||"/")+"' while resolving '"+ir(t)+"'");return}return n}function ft(e){if(!e)return yt;var t=Object.keys(e);if(!t.length)return yt;var r=new Array(t.length);return t.forEach(function(t,n){r[n]=e[t]}),r}var bt="See https://github.com/mobxjs/mobx-state-tree/issues/399 for more information. Note that the middleware event types starting with `process` now start with `flow`.";function ht(e){return Ft("process","`process()` has been renamed to `flow()`. "+bt),Jt(e)}var dt=Object.toString(),yt=Object.freeze([]),vt=Object.freeze({}),gt=(0,r._getGlobalState)().useProxies?{deep:!1}:{deep:!1,proxy:!1};function mt(e){return void 0===e&&(e="Illegal state"),new Error("[mobx-state-tree] "+e)}function wt(e){return e}Object.freeze(gt);var Pt=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e};function Ot(e){return Array.isArray(e)||(0,r.isObservableArray)(e)}function jt(e){return e?Ot(e)?e:[e]:yt}function _t(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];for(var n=0;n<t.length;n++){var i=t[n];for(var o in i)e[o]=i[o]}return e}function St(e){var t;if(null===e||"object"!=typeof e)return!1;var r=Object.getPrototypeOf(e);return null==r||(null===(t=r.constructor)||void 0===t?void 0:t.toString())===dt}function At(e){return!(null===e||"object"!=typeof e||e instanceof Date||e instanceof RegExp)}function It(e,t){return void 0===t&&(t=!0),null==e||"string"==typeof e||"number"==typeof e||"boolean"==typeof e||t&&e instanceof Date}function xt(e){return Lt()?It(e)||(0,r.isObservableArray)(e)?e:Object.freeze(e):e}function Tt(e){return Lt()?(xt(e),St(e)&&Object.keys(e).forEach(function(t){It(e[t])||Object.isFrozen(e[t])||Tt(e[t])}),e):e}function Ct(e){return"function"!=typeof e}function Et(e,t,n){(0,r.isObservableObject)(e)?(0,r.defineProperty)(e,t,n):Object.defineProperty(e,t,n)}function Vt(e,t,r){Et(e,t,{enumerable:!1,writable:!1,configurable:!0,value:r})}function Nt(e,t,r){Et(e,t,{enumerable:!1,writable:!0,configurable:!0,value:r})}var Dt=function(){function e(){Object.defineProperty(this,"handlers",{enumerable:!0,configurable:!0,writable:!0,value:[]})}return Object.defineProperty(e.prototype,"hasSubscribers",{get:function(){return this.handlers.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){r.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.handlers.slice().forEach(function(t){return t.apply(void 0,h(e))})}}),e}(),kt=function(){function e(){Object.defineProperty(this,"eventHandlers",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}return Object.defineProperty(e.prototype,"hasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.eventHandlers&&this.eventHandlers[e];return!!t&&t.hasSubscribers}}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){void 0===r&&(r=!1),this.eventHandlers||(this.eventHandlers={});var n=this.eventHandlers[e];return n||(n=this.eventHandlers[e]=new Dt),n.register(t,r)}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.eventHandlers&&this.eventHandlers[e];return!!r&&r.has(t)}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.eventHandlers&&this.eventHandlers[e];r&&r.unregister(t)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.eventHandlers&&delete this.eventHandlers[e]}}),Object.defineProperty(e.prototype,"clearAll",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.eventHandlers=void 0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];var i=this.eventHandlers&&this.eventHandlers[e];i&&(t=i).emit.apply(t,h(r))}}),e}();function Rt(e){for(var t=new Array(e.length),r=0;r<e.length;r++)t[r]=e[r];return t}function zt(e,t){return 0===e.indexOf(t)}var Ft=function(e,t){Lt()&&(Ft.ids&&!Ft.ids.hasOwnProperty(e)&&Mt("Deprecation warning: "+t),Ft.ids&&(Ft.ids[e]=!0))};function Mt(e){console.warn(new Error("[mobx-state-tree] "+e))}function Ht(){return Lt()||void 0!==e&&e.env&&!1}function Lt(){return!1}function Ut(e,t,r,n){if(Lt()&&!t(e))throw mt("expected "+r+" as argument "+jt(n).join(" or ")+", got "+e+" instead")}function $t(e,t){Ut(e,function(e){return"function"==typeof e},"function",t)}function Wt(e,t,r,n){Ut(e,function(e){return"number"==typeof e},"number",t),void 0!==r&&Ut(e,function(e){return e>=r},"number greater than "+r,t),void 0!==n&&Ut(e,function(e){return e<=n},"number lesser than "+n,t)}function Gt(e,t,r){void 0===r&&(r=!0),Ut(e,function(e){return"string"==typeof e},"string",t),r||Ut(e,function(e){return""!==e},"not empty string",t)}function Yt(e){"function"==typeof queueMicrotask?queueMicrotask(e):"function"==typeof setImmediate?setImmediate(e):setTimeout(e,1)}function Jt(e){return Kt(e.name,e)}function Zt(e){return e}function Bt(e){return function(){var t,r=[];for(t=0;t<arguments.length;t++)r[t]=arguments[t];return p(this,function(t){switch(t.label){case 0:return[4,e.apply(void 0,h(r))];case 1:return[2,t.sent()]}})}}function qt(e){return p(this,function(t){switch(t.label){case 0:return[4,e];case 1:return[2,t.sent()]}})}function Kt(e,t){var r=function(){var n=xe(),i=Ie();if(!i)throw mt("a mst flow must always have a parent context");var o=Ce(i);if(!o)throw mt("a mst flow must always have a parent action context");var a={name:e,id:n,tree:i.tree,context:i.context,parentId:i.id,allParentIds:h(i.allParentIds,[i.id]),rootId:i.rootId,parentEvent:i,parentActionEvent:o},u=arguments;function l(e,t,n){e.$mst_middleware=r.$mst_middleware,Te(s(s({},a),{type:t,args:[n]}),e)}return new Promise(function(e,n){var i,o=function(){i=t.apply(null,arguments),c(void 0)};function c(e){var t;try{l(function(e){t=i.next(e)},"flow_resume",e)}catch(r){return void Yt(function(){l(function(e){n(r)},"flow_throw",r)})}f(t)}function p(e){var t;try{l(function(e){t=i.throw(e)},"flow_resume_error",e)}catch(r){return void Yt(function(){l(function(e){n(r)},"flow_throw",r)})}f(t)}function f(t){if(!t.done){if(!t.value||"function"!=typeof t.value.then)throw mt("Only promises can be yielded to `async`, got: "+t);return t.value.then(c,p)}Yt(function(){l(function(t){e(t)},"flow_return",t.value)})}o.$mst_middleware=r.$mst_middleware,Te(s(s({},a),{type:"flow_spawn",args:Rt(u)}),o)})};return r}function Qt(e){if(!("oldValue"in e))throw mt("Patches without `oldValue` field cannot be inversed");return[Xt(e),er(e)]}function Xt(e){switch(e.op){case"add":return{op:"add",path:e.path,value:e.value};case"remove":return{op:"remove",path:e.path};case"replace":return{op:"replace",path:e.path,value:e.value}}}function er(e){switch(e.op){case"add":return{op:"remove",path:e.path};case"remove":return{op:"add",path:e.path,value:e.oldValue};case"replace":return{op:"replace",path:e.path,value:e.oldValue}}}function tr(e){return"number"==typeof e}function rr(e){return!0===tr(e)?""+e:-1===e.indexOf("/")&&-1===e.indexOf("~")?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function nr(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function ir(e){if(0===e.length)return"";var t=function(e){return e.map(rr).join("/")};return"."===e[0]||".."===e[0]?t(e):"/"+t(e)}function or(e){var t=e.split("/").map(nr);if(!(""===e||"."===e||".."===e||zt(e,"/")||zt(e,"./")||zt(e,"../")))throw mt("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}Ft.ids={};var ar=Symbol("$preProcessorFailed"),ur=function(e){function t(t,r,n){var i=e.call(this,n||t.name)||this;return Object.defineProperty(i,"_subtype",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(i,"_processors",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return l(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return this._subtype.flags|ne.SnapshotProcessor},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"snapshotProcessor("+this._subtype.describe()+")"}}),Object.defineProperty(t.prototype,"preProcessSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._processors.preProcessor?this._processors.preProcessor.call(null,e):e}}),Object.defineProperty(t.prototype,"preProcessSnapshotSafe",{enumerable:!1,configurable:!0,writable:!0,value:function(e){try{return this.preProcessSnapshot(e)}catch(t){return ar}}}),Object.defineProperty(t.prototype,"postProcessSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._processors.postProcessor?this._processors.postProcessor.call(null,e):e}}),Object.defineProperty(t.prototype,"_fixNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;lr(e.type,this,"create");var r=e.getSnapshot;e.getSnapshot=function(){return t.postProcessSnapshot(r.call(e))},e.getReconciliationType=function(){return t}}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=nt(n)?n:this.preProcessSnapshot(n),o=this._subtype.instantiate(e,t,r,i);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._subtype.reconcile(e,nt(t)?t:this.preProcessSnapshot(t),r,n);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var r=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(r):r}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.preProcessSnapshotSafe(e);return r===ar?Ye(t,e,"Failed to preprocess value"):this._subtype.validate(r,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=fe(e)?this._subtype:nt(e)?S(e,!1):this.preProcessSnapshotSafe(e);return t!==ar&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof ce))return!1;var r=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,r)}}),t}(se);function lr(e,t){for(var r,n,i=[],o=2;o<arguments.length;o++)i[o-2]=arguments[o];try{for(var a=f(i),u=a.next();!u.done;u=a.next()){var l=u.value;e[l]=t[l].bind(t)}}catch(s){r={error:s}}finally{try{u&&!u.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}}function sr(e,t,r){if(be(e,1),Lt()){if(t.postProcessor&&"function"!=typeof t.postProcessor)throw fail("postSnapshotProcessor must be a function");if(t.preProcessor&&"function"!=typeof t.preProcessor)throw fail("preSnapshotProcessor must be a function")}return new ur(e,t,r)}var cr,pr="Map.put can only be used to store complex values that have an identifier type attribute";function fr(e,t){var r,n,i=e.getSubTypes();if(i===ue)return!1;if(i){var o=jt(i);try{for(var a=f(o),u=a.next();!u.done;u=a.next()){if(!fr(u.value,t))return!1}}catch(l){r={error:l}}finally{try{u&&!u.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}}return e instanceof xr&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(cr||(cr={}));var br=function(e){function t(t){return e.call(this,t,r.observable.ref.enhancer)||this}return l(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.prototype.set.call(this,""+t,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw mt("Map.put cannot be used to set empty values");if(nt(e)){var t=ot(e);if(Lt()&&!t.identifierAttribute)throw mt(pr);if(null===t.identifier)throw mt(pr);return this.set(t.identifier,e),e}if(At(e)){var r=ot(this),n=r.type;if(n.identifierMode!==cr.YES)throw mt(pr);var i=e[n.mapIdentifierAttribute];if(!Vn(i)){var o=this.put(n.getChildType().create(e,r.environment));return this.put(S(o))}var a=En(i);return this.set(a,e),this.get(a)}throw mt("Map.put can only be used to store complex values")}}),t}(r.ObservableMap),hr=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:cr.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:ne.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=n,i}return l(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._determineIdentifierMode(),et(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===cr.UNKNOWN){var e=[];if(fr(this._subType,e)){var t=e.reduce(function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw mt("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute},void 0);t?(this.identifierMode=cr.YES,this.mapIdentifierAttribute=t):this.identifierMode=cr.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var r=e.type._subType,n={};return Object.keys(t).forEach(function(i){n[i]=r.instantiate(e,i,void 0,t[i])}),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new br(e)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){(0,r._interceptReads)(t,e.unbox),e.type.hookInitializers.forEach(function(e){var r=e(t);Object.keys(r).forEach(function(e){var n=r[e],i=Ee(t,e,n);(Lt()?Nt:Vt)(t,e,i)})}),(0,r.intercept)(t,this.willChange),(0,r.observe)(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"Map<string, "+this._subType.describe()+">"}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return(0,r.values)(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.storedValue.get(""+t);if(!r)throw mt("Not a child "+t);return r}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ot(e.object),r=e.name;t.assertWritable({subpath:r});var n=t.type,i=n._subType;switch(e.type){case"update":var o=e.newValue;if(o===e.object.get(r))return null;Ze(i,o),e.newValue=i.reconcile(t.getChildNode(r),e.newValue,t,r),n.processIdentifier(r,e.newValue);break;case"add":Ze(i,e.newValue),e.newValue=i.instantiate(t,r,void 0,e.newValue),n.processIdentifier(r,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===cr.YES&&t instanceof ae){var r=t.identifier;if(r!==e)throw mt("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+r+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach(function(e){t[e.subpath]=e.snapshot}),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach(function(r){t[r]=e[r].getSnapshot()}),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ot(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:rr(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:rr(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var r=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:rr(e.name),oldValue:r},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=e.storedValue;switch(r.op){case"add":case"replace":n.set(t,r.value);break;case"remove":n.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Ze(this,t);var r=e.storedValue,n={};if(Array.from(r.keys()).forEach(function(e){n[e]=!1}),t)for(var i in t)r.set(i,t[i]),n[""+i]=!0;Object.keys(n).forEach(function(e){!1===n[e]&&r.delete(e)})}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return St(e)?Je(Object.keys(e).map(function(n){return r._subType.validate(e[n],We(t,n,r._subType))})):Ye(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return vt}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(ce);function dr(e){return new hr("map<string, "+e.name+">",e)}function yr(e){return fe(e)&&(e.flags&ne.Map)>0}hr.prototype.applySnapshot=(0,r.action)(hr.prototype.applySnapshot);var vr=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:ne.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=n,i}return l(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return et(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var r=e.type._subType,n={};return t.forEach(function(t,i){var o=""+i;n[o]=r.instantiate(e,o,void 0,t)}),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return r.observable.array(ft(e),gt)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){(0,r._getAdministration)(t).dehancer=e.unbox,e.type.hookInitializers.forEach(function(e){var r=e(t);Object.keys(r).forEach(function(e){var n=r[e],i=Ee(t,e,n);(Lt()?Nt:Vt)(t,e,i)})}),(0,r.intercept)(t,this.willChange),(0,r.observe)(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType.describe()+"[]"}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Number(t);if(r<e.storedValue.length)return e.storedValue[r];throw mt("Not a child: "+t)}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ot(e.object);t.assertWritable({subpath:""+e.index});var r=t.type._subType,n=t.getChildren();switch(e.type){case"update":if(e.newValue===e.object[e.index])return null;var i=mr(t,r,[n[e.index]],[e.newValue],[e.index]);if(!i)return null;e.newValue=i[0];break;case"splice":var o=e.index,a=e.removedCount,u=e.added,l=mr(t,r,n.slice(o,o+a),u,u.map(function(e,t){return o+t}));if(!l)return null;e.added=l;for(var s=o+a;s<n.length;s++)n[s].setParent(t,""+(s+u.length-a))}return e}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.getChildren().map(function(e){return e.snapshot})}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=[];return Object.keys(e).forEach(function(r){t.push(e[r].getSnapshot())}),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ot(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:""+e.index,value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"splice":for(var r=e.removedCount-1;r>=0;r--)t.emitPatch({op:"remove",path:""+(e.index+r),oldValue:e.removed[r].snapshot},t);for(r=0;r<e.addedCount;r++)t.emitPatch({op:"add",path:""+(e.index+r),value:t.getChildNode(""+(e.index+r)).snapshot,oldValue:void 0},t);return}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=e.storedValue,i="-"===t?n.length:Number(t);switch(r.op){case"replace":n[i]=r.value;break;case"add":n.splice(i,0,r.value);break;case"remove":n.splice(i,1)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Ze(this,t),e.storedValue.replace(t)}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return Ot(e)?Je(e.map(function(e,n){return r._subType.validate(e,We(t,""+n,r._subType))})):Ye(t,e,"Value is not an array")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return yt}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.splice(Number(t),1)}}),t}(ce);function gr(e){return be(e,1),new vr(e.name+"[]",e)}function mr(e,t,r,n,i){for(var o=!0,a=0;;a++){var u=a<=n.length-1,l=r[a],s=u?n[a]:void 0,c=""+i[a];if(rt(s)&&(s=s.storedValue),!l&&!u)break;if(u)if(l)if(Pr(l,s))r[a]=wr(t,e,c,s,l);else{for(var p=void 0,f=a;f<r.length;f++)if(Pr(r[f],s)){p=r.splice(f,1)[0];break}o=!1;b=wr(t,e,c,s,p);r.splice(a,0,b)}else{if(nt(s)&&ot(s).parent===e)throw mt("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+e.path+"/"+c+"', but it lives already at '"+ot(s).path+"'");o=!1;var b=wr(t,e,c,s);r.splice(a,0,b)}else o=!1,r.splice(a,1),l instanceof ae&&l.createObservableInstanceIfNeeded(),l.die(),a--}return o?null:r}function wr(e,t,r,n,i){Ze(e,n);var o=function(){if(nt(n)){var o=ot(n);if(o.assertAlive(vt),null!==o.parent&&o.parent===t)return o.setParent(t,r),o}return i?e.reconcile(i,n,t,r):e.instantiate(t,r,void 0,n)}();return i&&i!==o&&(i instanceof ae&&i.createObservableInstanceIfNeeded(),i.die()),o}function Pr(e,t){if(!e.isAlive)return!1;if(nt(t)){var r=ot(t);return r.isAlive&&r===e}if(e.snapshot===t)return!0;if(!(e instanceof ae))return!1;var n=e.getReconciliationType();return null!==e.identifier&&e.identifierAttribute&&St(t)&&n.is(t)&&n.isMatchingSnapshotId(e,t)}function Or(e){return fe(e)&&(e.flags&ne.Array)>0}vr.prototype.applySnapshot=(0,r.action)(vr.prototype.applySnapshot);var jr="preProcessSnapshot",_r="postProcessSnapshot";function Sr(){return ot(this).toString()}var Ar={name:"AnonymousModel",properties:{},initializers:yt};function Ir(e){return Object.keys(e).reduce(function(e,r){var n,i,o;if(r in t)throw mt("Hook '"+r+"' was defined as property. Hooks should be defined as part of the actions");var a=Object.getOwnPropertyDescriptor(e,r);if("get"in a)throw mt("Getters are not supported as properties. Please use views instead");var u=a.value;if(null==u)throw mt("The default value of an attribute cannot be null or undefined as the type cannot be inferred. Did you mean `types.maybe(someType)`?");if(It(u))return Object.assign({},e,((n={})[r]=tn(Lr(u),u),n));if(u instanceof hr)return Object.assign({},e,((i={})[r]=tn(u,{}),i));if(u instanceof vr)return Object.assign({},e,((o={})[r]=tn(u,[]),o));if(fe(u))return e;throw Lt()&&"function"==typeof u?mt("Invalid type definition for property '"+r+"', it looks like you passed a function. Did you forget to invoke it, or did you intend to declare a view / action?"):Lt()&&"object"==typeof u?mt("Invalid type definition for property '"+r+"', it looks like you passed an object. Try passing another model type or a types.frozen."):mt("Invalid type definition for property '"+r+"', cannot infer a type from a value like '"+u+"' ("+typeof u+")")},e)}var xr=function(e){function n(t){var r=e.call(this,t.name||Ar.name)||this;return Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:ne.Object}),Object.defineProperty(r,"initializers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(r,"properties",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(r,"preProcessor",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(r,"postProcessor",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(r,"propertyNames",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(r,"named",{enumerable:!0,configurable:!0,writable:!0,value:function(e){return r.cloneAndEnhance({name:e})}}),Object.defineProperty(r,"props",{enumerable:!0,configurable:!0,writable:!0,value:function(e){return r.cloneAndEnhance({properties:e})}}),Object.defineProperty(r,"preProcessSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:function(e){var t=r.preProcessor;return t?r.cloneAndEnhance({preProcessor:function(r){return t(e(r))}}):r.cloneAndEnhance({preProcessor:e})}}),Object.defineProperty(r,"postProcessSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:function(e){var t=r.postProcessor;return t?r.cloneAndEnhance({postProcessor:function(r){return e(t(r))}}):r.cloneAndEnhance({postProcessor:e})}}),Object.assign(r,Ar,t),r.properties=Ir(r.properties),xt(r.properties),r.propertyNames=Object.keys(r.properties),r.identifierAttribute=r._getIdentifierAttribute(),r}return l(n,e),Object.defineProperty(n.prototype,"_getIdentifierAttribute",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=void 0;return this.forAllProps(function(t,r){if(r.flags&ne.Identifier){if(e)throw mt("Cannot define property '"+t+"' as object identifier, property '"+e+"' is already defined as identifier property");e=t}}),e}}),Object.defineProperty(n.prototype,"cloneAndEnhance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new n({name:e.name||this.name,properties:Object.assign({},this.properties,e.properties),initializers:this.initializers.concat(e.initializers||[]),preProcessor:e.preProcessor||this.preProcessor,postProcessor:e.postProcessor||this.postProcessor})}}),Object.defineProperty(n.prototype,"actions",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;return this.cloneAndEnhance({initializers:[function(r){return t.instantiateActions(r,e(r)),r}]})}}),Object.defineProperty(n.prototype,"instantiateActions",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r){if(!St(r))throw mt("actions initializer should return a plain object containing actions");Object.keys(r).forEach(function(n){if(n===jr)throw mt("Cannot define action '"+jr+"', it should be defined using 'type.preProcessSnapshot(fn)' instead");if(n===_r)throw mt("Cannot define action '"+_r+"', it should be defined using 'type.postProcessSnapshot(fn)' instead");var i=r[n],o=e[n];if(n in t&&o){var a=i;i=function(){o.apply(null,arguments),a.apply(null,arguments)}}var u=i.$mst_middleware,l=i.bind(r);l.$mst_middleware=u;var s=Ee(e,n,l);r[n]=s,(Lt()?Nt:Vt)(e,n,s)})}}),Object.defineProperty(n.prototype,"volatile",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;if("function"!=typeof e)throw mt("You passed an "+typeof e+" to volatile state as an argument, when function is expected");return this.cloneAndEnhance({initializers:[function(r){return t.instantiateVolatileState(r,e(r)),r}]})}}),Object.defineProperty(n.prototype,"instantiateVolatileState",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!St(t))throw mt("volatile state initializer should return a plain object containing state");(0,r.set)(e,t)}}),Object.defineProperty(n.prototype,"extend",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;return this.cloneAndEnhance({initializers:[function(r){var n=e(r),i=n.actions,o=n.views,a=n.state,u=c(n,["actions","views","state"]);for(var l in u)throw mt("The `extend` function should return an object with a subset of the fields 'actions', 'views' and 'state'. Found invalid key '"+l+"'");return a&&t.instantiateVolatileState(r,a),o&&t.instantiateViews(r,o),i&&t.instantiateActions(r,i),r}]})}}),Object.defineProperty(n.prototype,"views",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;return this.cloneAndEnhance({initializers:[function(r){return t.instantiateViews(r,e(r)),r}]})}}),Object.defineProperty(n.prototype,"instantiateViews",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!St(t))throw mt("views initializer should return a plain object containing views");Object.keys(t).forEach(function(n){var i,o=Object.getOwnPropertyDescriptor(t,n);if("get"in o)(0,r.defineProperty)(e,n,o),(0,r.makeObservable)(e,((i={})[n]=r.computed,i));else{if("function"!=typeof o.value)throw mt("A view member should either be a function or getter based property");(Lt()?Nt:Vt)(e,n,o.value)}})}}),Object.defineProperty(n.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return et(this,e,t,r,nt(n)?n:this.applySnapshotPreProcessor(n))}}),Object.defineProperty(n.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var r=e.type,n={};return r.forAllProps(function(r,i){n[r]=i.instantiate(e,r,void 0,t[r])}),n}}),Object.defineProperty(n.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return r.observable.object(e,vt,gt)}}),Object.defineProperty(n.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Vt(t,"toString",Sr),this.forAllProps(function(n){(0,r._interceptReads)(t,n,e.unbox)}),this.initializers.reduce(function(e,t){return t(e)},t),(0,r.intercept)(t,this.willChange),(0,r.observe)(t,this.didChange)}}),Object.defineProperty(n.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e,r=ot(t.object),n=t.name;r.assertWritable({subpath:n});var i=r.type.properties[n];return i&&(Ze(i,t.newValue),t.newValue=i.reconcile(r.getChildNode(n),t.newValue,r,n)),t}}),Object.defineProperty(n.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e,r=ot(t.object);if(r.type.properties[t.name]){var n=t.oldValue?t.oldValue.snapshot:void 0;r.emitPatch({op:"replace",path:rr(t.name),value:t.newValue.snapshot,oldValue:n},r)}}}),Object.defineProperty(n.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this,r=[];return this.forAllProps(function(n){r.push(t.getChildNode(e,n))}),r}}),Object.defineProperty(n.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(t in this.properties))throw mt("Not a value property: "+t);var n=(0,r._getAdministration)(e.storedValue,t).raw();if(!n)throw mt("Node not available for property "+t);return n}}),Object.defineProperty(n.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;void 0===t&&(t=!0);var i={};return this.forAllProps(function(t,o){(0,r.getAtom)(e.storedValue,t).reportObserved(),i[t]=n.getChildNode(e,t).snapshot}),t?this.applySnapshotPostProcessor(i):i}}),Object.defineProperty(n.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach(function(r){t[r]=e[r].getSnapshot()}),this.applySnapshotPostProcessor(t)}}),Object.defineProperty(n.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){if("replace"!==r.op&&"add"!==r.op)throw mt("object does not support operation "+r.op);e.storedValue[t]=r.value}}),Object.defineProperty(n.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.applySnapshotPreProcessor(t);Ze(this,r),this.forAllProps(function(t){e.storedValue[t]=r[t]})}}),Object.defineProperty(n.prototype,"applySnapshotPreProcessor",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.preProcessor;return t?t.call(null,e):e}}),Object.defineProperty(n.prototype,"applySnapshotPostProcessor",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.postProcessor;return t?t.call(null,e):e}}),Object.defineProperty(n.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Gt(e,1),this.properties[e]}}),Object.defineProperty(n.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=this.applySnapshotPreProcessor(e);return St(n)?Je(this.propertyNames.map(function(e){return r.properties[e].validate(n[e],We(t,e,r.properties[e]))})):Ye(t,n,"Value is not a plain object")}}),Object.defineProperty(n.prototype,"forAllProps",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.propertyNames.forEach(function(r){return e(r,t.properties[r])})}}),Object.defineProperty(n.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;return"{ "+this.propertyNames.map(function(t){return t+": "+e.properties[t].describe()}).join("; ")+" }"}}),Object.defineProperty(n.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return vt}}),Object.defineProperty(n.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue[t]=void 0}}),n}(ce);function Tr(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r="string"==typeof e[0]?e.shift():"AnonymousModel",n=e.shift()||{};return new xr({name:r,properties:n})}function Cr(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r="string"==typeof e[0],n=r?e[0]:"AnonymousModel";return r&&e.shift(),Lt()&&e.forEach(function(e,t){Ut(e,Er,"mobx-state-tree model type",r?t+2:t+1)}),e.reduce(function(e,t){return e.cloneAndEnhance({name:e.name+"_"+t.name,properties:t.properties,initializers:t.initializers,preProcessor:function(r){return t.applySnapshotPreProcessor(e.applySnapshotPreProcessor(r))},postProcessor:function(r){return t.applySnapshotPostProcessor(e.applySnapshotPostProcessor(r))}})}).named(n)}function Er(e){return fe(e)&&(e.flags&ne.Object)>0}xr.prototype.applySnapshot=(0,r.action)(xr.prototype.applySnapshot);var Vr=function(e){function t(t,r,n,i){void 0===i&&(i=wt);var o=e.call(this,t)||this;return Object.defineProperty(o,"flags",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(o,"checker",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(o,"initializer",{enumerable:!0,configurable:!0,writable:!0,value:i}),o.flags=r,o}return l(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return tt(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.initializer(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return It(e)&&this.checker(e)?Ge():Ye(t,e,"Value is not a "+("Date"===this.name?"Date or a unix milliseconds timestamp":this.name))}}),t}(pe),Nr=new Vr("string",ne.String,function(e){return"string"==typeof e}),Dr=new Vr("number",ne.Number,function(e){return"number"==typeof e}),kr=new Vr("integer",ne.Integer,function(e){return Pt(e)}),Rr=new Vr("boolean",ne.Boolean,function(e){return"boolean"==typeof e}),zr=new Vr("null",ne.Null,function(e){return null===e}),Fr=new Vr("undefined",ne.Undefined,function(e){return void 0===e}),Mr=new Vr("Date",ne.Date,function(e){return"number"==typeof e||e instanceof Date},function(e){return e instanceof Date?e:new Date(e)});Mr.getSnapshot=function(e){return e.storedValue.getTime()};var Hr=Mr;function Lr(e){switch(typeof e){case"string":return Nr;case"number":return Dr;case"boolean":return Rr;case"object":if(e instanceof Date)return Hr}throw mt("Cannot determine primitive type from value "+e)}function Ur(e){return fe(e)&&(e.flags&(ne.String|ne.Number|ne.Integer|ne.Boolean|ne.Date))>0}var $r=function(e){function t(t){var r=e.call(this,JSON.stringify(t))||this;return Object.defineProperty(r,"value",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:ne.Literal}),r.value=t,r}return l(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return tt(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return JSON.stringify(this.value)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return It(e)&&e===this.value?Ge():Ye(t,e,"Value is not a literal "+JSON.stringify(this.value))}}),t}(pe);function Wr(e){return Ut(e,It,"primitive",1),new $r(e)}function Gr(e){return fe(e)&&(e.flags&ne.Literal)>0}var Yr=function(e){function t(t,r,n,i){var o=e.call(this,t)||this;return Object.defineProperty(o,"_subtype",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(o,"_predicate",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(o,"_message",{enumerable:!0,configurable:!0,writable:!0,value:i}),o}return l(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return this._subtype.flags|ne.Refinement},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this._subtype.validate(e,t);if(r.length>0)return r;var n=nt(e)?ot(e).snapshot:e;return this._predicate(n)?Ge():Ye(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(se);function Jr(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r="string"==typeof e[0]?e.shift():fe(e[0])?e[0].name:null,n=e[0],i=e[1],o=e[2]?e[2]:function(e){return"Value does not respect the refinement predicate"};return be(n,[1,2]),Gt(r,1),$t(i,[2,3]),$t(o,[3,4]),new Yr(r,n,i,o)}function Zr(e){return(e.flags&ne.Refinement)>0}function Br(e,t){var r="string"==typeof e?t:e;Lt()&&r.forEach(function(e,t){Gt(e,t+1)});var n=Kr.apply(void 0,h(r.map(function(e){return Wr(""+e)})));return"string"==typeof e&&(n.name=e),n}var qr=function(e){function t(t,r,n){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),n=s({eager:!0,dispatcher:void 0},n),i._dispatcher=n.dispatcher,n.eager||(i._eager=!1),i}return l(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=ne.Union;return this._types.forEach(function(t){e|=t.flags}),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some(function(t){return t.isAssignableFrom(e)})}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map(function(e){return e.describe()}).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(n,void 0);if(!i)throw mt("No matching type for union "+this.describe());return i.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(t,e.getReconciliationType());if(!i)throw mt("No matching type for union "+this.describe());return i.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter(function(e){return e!==t}).find(function(t){return t.is(e)}):this._types.find(function(t){return t.is(e)})}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var r=[],n=0,i=0;i<this._types.length;i++){var o=this._types[i].validate(e,t);if(0===o.length){if(this._eager)return Ge();n++}else r.push(o)}return 1===n?Ge():Ye(t,e,"No type is applicable for the union").concat(Je(r))}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._types}}),t}(se);function Kr(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];var n=fe(e)?void 0:e,i=fe(e)?h([e],t):t,o="("+i.map(function(e){return e.name}).join(" | ")+")";return Lt()&&(n&&Ut(n,function(e){return St(e)},"object { eager?: boolean, dispatcher?: Function }",1),i.forEach(function(e,t){be(e,n?t+2:t+1)})),new qr(o,i,n)}function Qr(e){return(e.flags&ne.Union)>0}var Xr=function(e){function t(t,r,n){var i=e.call(this,t.name)||this;return Object.defineProperty(i,"_subtype",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(i,"_defaultValue",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"optionalValues",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return l(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return this._subtype.flags|ne.Optional},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype.describe()+"?"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(this.optionalValues.indexOf(n)>=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,r,i)}return this._subtype.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),r,n)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Ze(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Ge():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(se);function en(e,t){if("function"!=typeof t&&nt(t))throw mt("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");be(e,1),Lt()&&"function"!=typeof t&&Ze(e,t)}function tn(e,t,r){return en(e,t),new Xr(e,t,r||rn)}var rn=[void 0];function nn(e){return fe(e)&&(e.flags&ne.Optional)>0}var on=tn(Fr,void 0),an=tn(zr,null);function un(e){return be(e,1),Kr(e,on)}function ln(e){return be(e,1),Kr(e,an)}var sn=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return l(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|ne.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(r){if(!(r instanceof ReferenceError))throw r;t=void 0}if(e&&void 0===t)throw mt("Late type seems to be used too early, the definition (still) returns undefined");if(t){if(Lt()&&!fe(t))throw mt("Failed to determine subtype, make sure types.late returns a type definition.");this._subType=t}}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:"<uknown late type>"}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getSubType(!1);return r?r.validate(e,t):Ge()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e||ue}}),t}(se);function cn(e,t){var r="string"==typeof e?e:"late("+e.toString()+")",n="string"==typeof e?t:e;if(Lt()&&("function"!=typeof n||0!==n.length))throw mt("Invalid late type, expected a function with zero arguments that returns a type, got: "+n);return new sn(r,n)}function pn(e){return fe(e)&&(e.flags&ne.Late)>0}var fn=function(e){function t(t){var r=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:ne.Frozen}),r}return l(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"<any immutable value>"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return tt(this,e,t,r,Tt(n))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Ct(e)?this.subType?this.subType.validate(e,t):Ge():Ye(t,e,"Value is not serializable and cannot be frozen")}}),t}(pe),bn=new fn;function hn(e){return 0===arguments.length?bn:fe(e)?new fn(e):tn(bn,e)}function dn(e){return fe(e)&&(e.flags&ne.Frozen)>0}function yn(e){switch(e){case t.beforeDestroy:return"destroy";case t.beforeDetach:return"detach";default:return}}var vn=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Vn(e))this.identifier=e;else{if(!nt(e))throw mt("Can only store references to tree nodes or identifiers, got: '"+e+"'");var r=ot(e);if(!r.identifierAttribute)throw mt("Can only store references with a defined identifier attribute.");var n=r.unnormalizedIdentifier;if(null==n)throw mt("Can only store references to tree nodes with a defined identifier.");this.identifier=n}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=En(this.identifier),r=e.root,n=r.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==n){var i=this.targetType,o=r.identifierCache.resolve(i,t);if(!o)throw new gn("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:o,lastCacheModification:n}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),gn=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return l(t,e),t}(Error),mn=function(e){function r(t,r){var n=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(n,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:ne.Reference}),n}return l(r,e),Object.defineProperty(r.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(r.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(r.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Vn(e)?Ge():Ye(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(r.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=t.parent;if(i&&i.isAlive){var o=i.storedValue;o&&this.onInvalidated({cause:e,parent:o,invalidTarget:n?n.storedValue:void 0,invalidId:r,replaceRef:function(e){m(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){Er(i.type)?this.replaceRef(void 0):m(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(r.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r){var n=this,i=this.getValue(e);if(i){var o=ot(i),a=function(t,i){var a=yn(i);a&&n.fireInvalidated(a,e,r,o)},u=o.registerHook(t.beforeDetach,a),l=o.registerHook(t.beforeDestroy,a);return function(){u(),l()}}}}),Object.defineProperty(r.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r,n){var i=this;if(this.onInvalidated){var o;e.registerHook(t.beforeDestroy,function(){o&&o()});var a=function(t){o&&o();var a=e.parent,u=a&&a.storedValue;if(a&&a.isAlive&&u){(n?!!n.get(r,u):e.root.identifierCache.has(i.targetType,En(r)))?o=i.addTargetNodeWatcher(e,r):t||i.fireInvalidated("invalidSnapshotReference",e,r,null)}};e.state===Ke.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(t.afterCreationFinalization,function(){e.parent&&e.parent.createObservableInstanceIfNeeded()}),e.registerHook(t.afterAttach,function(){a(!1)}))}}}),r}(pe),wn=function(e){function t(t,r){return e.call(this,t,r)||this}return l(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=nt(n)?R(n):n,o=new vn(n,this.targetType),a=tt(this,e,t,r,o);return o.node=a,this.watchTargetNodeForInvalidations(a,i,void 0),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!e.isDetaching&&e.type===this){var i=nt(t),o=e.storedValue;if(!i&&o.identifier===t||i&&o.resolvedValue===t)return e.setParent(r,n),e}var a=this.instantiate(r,n,void 0,t);return e.die(),a}}),t}(mn),Pn=function(e){function t(t,r,n){var i=e.call(this,t,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return l(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=nt(n)?this.options.set(n,e?e.storedValue:null):n,o=tt(this,e,t,r,i);return this.watchTargetNodeForInvalidations(o,i,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=nt(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(r,n),e;var o=this.instantiate(r,n,void 0,i);return e.die(),o}}),t}(mn);function On(e,t){if(be(e,1),Lt()&&2===arguments.length&&"string"==typeof arguments[1])throw mt("References with base path are no longer supported. Please remove the base path.");var r=t||void 0,n=t?t.onInvalidated:void 0;if(r&&(r.get||r.set)){if(Lt()&&(!r.get||!r.set))throw mt("reference options must either contain both a 'get' and a 'set' method or none of them");return new Pn(e,{get:r.get,set:r.set},n)}return new wn(e,n)}function jn(e){return(e.flags&ne.Reference)>0}function _n(e,t){var r=On(e,s(s({},t),{onInvalidated:function(e){t&&t.onInvalidated&&t.onInvalidated(e),e.removeRef()}}));return t&&!1===t.acceptsUndefined?r:un(r)}var Sn=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:ne.Identifier}),n}return l(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!(e&&e.type instanceof xr))throw mt("Identifier types can only be instantiated as direct child of a model type");return tt(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(e.storedValue!==t)throw mt("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(r,n),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Ye(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Ge()}}),t}(pe),An=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:ne.Identifier}),t}return l(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(Sn),In=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return l(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(Sn),xn=new An,Tn=new In;function Cn(e){return fe(e)&&(e.flags&ne.Identifier)>0}function En(e){return""+e}function Vn(e){return"string"==typeof e||"number"==typeof e}function Nn(e,t){Ut(e,Vn,"string or number (identifier)",t)}function Dn(e){return new kn(e)}var kn=function(e){function t(t){var r=e.call(this,t.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:ne.Custom}),r}return l(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Ge();var r=this.options.getValidationMessage(e);return r?Ye(t,e,"Invalid value for type '"+this.name+"': "+r):Ge()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return tt(this,e,t,r,this.options.isTargetType(n)?n:this.options.fromSnapshot(n,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=!this.options.isTargetType(t);if(!e.isDetaching&&(e.type===this&&(i?t===e.snapshot:t===e.storedValue)))return e.setParent(r,n),e;var o=i?this.options.fromSnapshot(t,r.root.environment):t,a=this.instantiate(r,n,void 0,o);return e.die(),a}}),t}(pe),Rn={enumeration:Br,model:Tr,compose:Cr,custom:Dn,reference:On,safeReference:_n,union:Kr,optional:tn,literal:Wr,maybe:un,maybeNull:ln,refinement:Jr,string:Nr,boolean:Rr,number:Dr,integer:kr,Date:Hr,map:dr,array:gr,frozen:hn,identifier:xn,identifierNumber:Tn,late:cn,undefined:Fr,null:zr,snapshotProcessor:sr};exports.types=Rn;
852
- },{"mobx":"BzvP","process":"g5IB"}],"lvYv":[function(require,module,exports) {
853
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.UndoManager=void 0;const t=require("mobx-state-tree");exports.UndoManager=t.types.model("UndoManager",{history:t.types.array(t.types.frozen()),undoIdx:-1,targetPath:""}).views(t=>({get canUndo(){return t.undoIdx>0},get canRedo(){return t.undoIdx<t.history.length-1}})).actions(e=>{let o,r,n=!1,a=null,d=0,s=!1;function i(){const e=(0,t.getSnapshot)(o);return{pages:e.pages,width:e.width,height:e.height}}function h(e){(0,t.applySnapshot)(o.pages,e.pages),o.setSize(e.width,e.height)}return{startTransaction(){s=!0},endTransaction(t){s=!1,t||this.requestAddState(i())},async ignore(t){e.startTransaction();try{await t()}catch(e){setTimeout(()=>{throw e})}e.endTransaction(!0),clearTimeout(d),d=0},async transaction(t){await e.ignore(t),this.addUndoState()},requestAddState(t){a=t,d||s||(n?n=!1:d=setTimeout(()=>{d=0,clearTimeout(d),s||this.addUndoState()},100))},addUndoState(){if(n)return void(n=!1);const t=e.history[e.undoIdx];JSON.stringify(t)!==JSON.stringify(a)&&(e.history.splice(e.undoIdx+1),e.history.push(a),e.undoIdx=e.history.length-1)},afterCreate(){if(!(o=(0,t.resolvePath)(e,"..")))throw new Error("Failed to find target store for UndoManager. Please provide `targetPath` property, or a `targetStore` in the environment");r=(0,t.onSnapshot)(o,()=>this.requestAddState(i())),0===e.history.length&&this.requestAddState(i())},clear(){clearTimeout(d),d=0,e.history.splice(0,e.history.length),e.undoIdx=-1,e.addUndoState(i())},beforeDestroy(){r()},undo(){d&&this.addUndoState(),e.canUndo?(e.undoIdx--,n=!0,h(e.history[e.undoIdx])):console.warn("No undo history. Please check `store.history.canUndo` before calling undo action.")},redo(){d&&this.addUndoState(),e.canRedo?(e.undoIdx++,n=!0,h(e.history[e.undoIdx])):console.warn("No redo history. Please check `store.history.canRedo` before calling redo action.")},replaceState(){e.history[e.undoIdx]=i()}}}),exports.default=exports.UndoManager;
852
+ },{"mobx":"BzvP","process":"g5IB"}],"X9z9":[function(require,module,exports) {
853
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.UndoManager=void 0;const t=require("mobx-state-tree");exports.UndoManager=t.types.model("UndoManager",{history:t.types.array(t.types.frozen()),undoIdx:-1,targetPath:""}).views(t=>({get canUndo(){return t.undoIdx>0},get canRedo(){return t.undoIdx<t.history.length-1}})).actions(e=>{let o,n,r=!1,a=null,d=0,s=!1;function i(){const e=(0,t.getSnapshot)(o);return{pages:e.pages,width:e.width,height:e.height}}function h(e){(0,t.applySnapshot)(o.pages,e.pages),o.setSize(e.width,e.height)}return{startTransaction(){s=!0},endTransaction(t){s=!1,t||this.requestAddState(i())},async ignore(t){d&&e.addUndoState(),e.startTransaction();try{await t()}catch(e){setTimeout(()=>{throw e})}e.endTransaction(!0),clearTimeout(d),d=0},async transaction(t){await e.ignore(t),this.addUndoState()},requestAddState(t){a=t,d||s||(r?r=!1:d=setTimeout(()=>{d=0,clearTimeout(d),s||this.addUndoState()},100))},addUndoState(){if(r)return void(r=!1);const t=e.history[e.undoIdx];JSON.stringify(t)!==JSON.stringify(a)&&(e.history.splice(e.undoIdx+1),e.history.push(a),e.undoIdx=e.history.length-1)},afterCreate(){if(!(o=(0,t.resolvePath)(e,"..")))throw new Error("Failed to find target store for UndoManager. Please provide `targetPath` property, or a `targetStore` in the environment");n=(0,t.onSnapshot)(o,()=>{this.requestAddState(i())}),0===e.history.length&&this.requestAddState(i())},clear(){clearTimeout(d),d=0,e.history.splice(0,e.history.length),e.undoIdx=-1,e.addUndoState(i())},beforeDestroy(){n()},undo(){d&&this.addUndoState(),e.canUndo?(e.undoIdx--,r=!0,h(e.history[e.undoIdx])):console.warn("No undo history. Please check `store.history.canUndo` before calling undo action.")},redo(){d&&this.addUndoState(),e.canRedo?(e.undoIdx++,r=!0,h(e.history[e.undoIdx])):console.warn("No redo history. Please check `store.history.canRedo` before calling redo action.")},replaceState(){e.history[e.undoIdx]=i()}}}),exports.default=exports.UndoManager;
854
854
  },{"mobx-state-tree":"pk4v"}],"n29C":[function(require,module,exports) {
855
855
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.urlAlphabet=void 0;let e="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";exports.urlAlphabet=e;
856
856
  },{}],"iDyL":[function(require,module,exports) {
857
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"urlAlphabet",{enumerable:!0,get:function(){return r.urlAlphabet}}),exports.random=exports.customRandom=exports.customAlphabet=exports.nanoid=void 0;var r=require("./url-alphabet/index.js");var t=function(r){return crypto.getRandomValues(new Uint8Array(r))};exports.random=t;var e=function(r,t,e){var n=(2<<Math.log(r.length-1)/Math.LN2)-1,o=-~(1.6*n*t/r.length);return function(){for(var a="";;)for(var u=e(o),p=o;p--;)if((a+=r[u[p]&n]||"").length===t)return a}};exports.customRandom=e;var n=function(r,n){return e(r,n,t)};exports.customAlphabet=n;var o=function(){for(var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:21,t="",e=crypto.getRandomValues(new Uint8Array(r));r--;){var n=63&e[r];t+=n<36?n.toString(36):n<62?(n-26).toString(36).toUpperCase():n<63?"_":"-"}return t};exports.nanoid=o;
857
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"urlAlphabet",{enumerable:!0,get:function(){return r.urlAlphabet}}),exports.random=exports.customRandom=exports.customAlphabet=exports.nanoid=void 0;var r=require("./url-alphabet/index.js"),t=function(r){return crypto.getRandomValues(new Uint8Array(r))};exports.random=t;var e=function(r,t,e){var n=(2<<Math.log(r.length-1)/Math.LN2)-1,o=-~(1.6*n*t/r.length);return function(){for(var a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t,u="";;)for(var i=e(o),p=o;p--;)if((u+=r[i[p]&n]||"").length===a)return u}};exports.customRandom=e;var n=function(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:21;return e(r,n,t)};exports.customAlphabet=n;var o=function(){for(var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:21,t="",e=crypto.getRandomValues(new Uint8Array(r));r--;){var n=63&e[r];t+=n<36?n.toString(36):n<62?(n-26).toString(36).toUpperCase():n<63?"_":"-"}return t};exports.nanoid=o;
858
858
  },{"./url-alphabet/index.js":"n29C"}],"HWHW":[function(require,module,exports) {
859
859
  "use strict";async function e(e,o){const t=await(await fetch(e)).blob(),d=document.createElement("a"),c=URL.createObjectURL(t);d.href=c,d.download=o,document.body.appendChild(d),d.click(),setTimeout(function(){document.body.removeChild(d),window.URL.revokeObjectURL(c)},0)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.downloadFile=void 0,exports.downloadFile=e;
860
860
  },{}],"sptl":[function(require,module,exports) {
861
861
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getPdfKit=exports.getJsPDF=void 0;const e="https://unpkg.com/jspdf@2.2.0/dist/jspdf.umd.min.js";let t;function o(){return t?Promise.resolve(t):new Promise(o=>{var n=document.createElement("script");n.onload=function(){t=window.jspdf.jsPDF,o(t)},n.src=e,document.head.appendChild(n)})}exports.getJsPDF=o;const n="https://unpkg.com/pdfkit@0.13.0/js/pdfkit.standalone.js",s="https://github.com/devongovett/blob-stream/releases/download/v0.1.3/blob-stream.js";async function r(e){return new Promise(t=>{var o=document.createElement("script");o.onload=function(){t(null)},o.src=e,document.head.appendChild(o)})}let d;async function i(){return d?Promise.resolve(d):(await r(n),await r(s),d=window.PDFDocument)}exports.getPdfKit=i;
862
862
  },{}],"GRkH":[function(require,module,exports) {
863
- "use strict";var e=this&&this.__createBinding||(Object.create?function(e,t,o,n){void 0===n&&(n=o),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[o]}})}:function(e,t,o,n){void 0===n&&(n=o),e[n]=t[o]}),t=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(o){if(o&&o.__esModule)return o;var n={};if(null!=o)for(var s in o)"default"!==s&&Object.prototype.hasOwnProperty.call(o,s)&&e(n,o,s);return t(n,o),n},n=this&&this.__rest||function(e,t){var o={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(e);s<n.length;s++)t.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(e,n[s])&&(o[n[s]]=e[n[s]])}return o},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.createStore=exports.Store=exports.Font=exports.Page=exports.registerShapeModel=exports.SVGElement=exports.ImageElement=exports.TextElement=exports.Element=void 0;const i=require("mobx-state-tree"),r=require("./undo-manager"),a=require("nanoid"),l=s(require("konva")),d=require("../utils/download"),c=require("../utils/pdf"),p=require("../utils/validate-key"),g=o(require("../utils/fonts")),h=require("../utils/svg"),f=require("../utils/loader");(0,i.setLivelinessChecking)("ignore"),exports.Element=i.types.model("Element",{id:i.types.identifier,type:"none",x:0,y:0,rotation:0,opacity:1,visible:!0,locked:!1,blurEnabled:!1,blurRadius:10,brightnessEnabled:!1,brightness:0,sepiaEnabled:!1,grayscaleEnabled:!1,shadowEnabled:!1,shadowBlur:5,shadowOffsetX:0,shadowOffsetY:0,shadowColor:"black",custom:i.types.frozen(),selectable:!0,alwaysOnTop:!1,showInExport:!0}).preProcessSnapshot(e=>{const t=Object.assign(Object.assign({},e),{x:e.x||0,y:e.y||0});return"width"in e&&(t.width=t.width||1),"height"in e&&(t.height=t.height||1),t}).postProcessSnapshot(e=>{const t=Object.assign({},e),o={};for(var n in t)"_"!==n[0]&&(o[n]=e[n]);return o}).views(e=>({get page(){return(0,i.getParentOfType)(e,exports.Page)},get store(){return(0,i.getParentOfType)(e,exports.Store)}})).actions(e=>({toJSON:()=>Object.assign({},(0,i.getSnapshot)(e))})).actions(e=>({clone(t){const o=e.toJSON();return t.id=t.id||(0,a.nanoid)(10),Object.assign(o,t),e.page.addElement(o)},set(t){Object.assign(e,t)},moveUp(){e.page.moveElementUp(e.id)},moveTop(){e.page.moveElementTop(e.id)},moveDown(){e.page.moveElementDown(e.id)},moveBottom(){e.page.moveElementBottom(e.id)},beforeDestroy(){e.store.history.endTransaction()}})),exports.TextElement=exports.Element.named("Text").props({type:"text",text:"",placeholder:"",fontSize:14,fontFamily:"Roboto",fontStyle:"normal",fontWeight:"normal",textDecoration:"",fill:"black",align:"center",width:100,height:14,strokeWidth:0,stroke:"black",lineHeight:i.types.optional(i.types.union(i.types.number,i.types.string),1.2),letterSpacing:0,_editModeEnabled:!1}).preProcessSnapshot(e=>Object.assign({},e)).actions(e=>({toggleEditMode(t){e._editModeEnabled=null!=t?t:!e._editModeEnabled,e._editModeEnabled?e.store.history.startTransaction():e.store.history.endTransaction()}})),exports.ImageElement=exports.Element.named("Image").props({type:"image",width:100,height:100,src:"",cropX:0,cropY:0,cropWidth:1,cropHeight:1,cornerRadius:0,flipX:!1,flipY:!1,clipSrc:"",borderColor:"black",borderSize:0,_cropModeEnabled:!1}).actions(e=>({toggleCropMode(t){e._cropModeEnabled=null!=t?t:!e._cropModeEnabled,e._cropModeEnabled?e.store.history.startTransaction():e.store.history.endTransaction()}})),exports.SVGElement=exports.Element.named("SVG").props({type:"svg",src:"",maskSrc:"",__svgString:"",cropX:0,cropY:0,cropWidth:1,cropHeight:1,keepRatio:!0,flipX:!1,flipY:!1,width:100,height:100,borderColor:"black",borderSize:0,colorsReplace:i.types.map(i.types.string)}).preProcessSnapshot(e=>Object.assign(Object.assign({},e),{src:e.src||e.svgSource})).views(e=>({get colors(){return e.__svgString?(0,h.getColors)(e.__svgString):[]},get __finalSrc(){return e.__svgString?(0,h.replaceColors)(e.__svgString,e.colorsReplace):this.src},get __isLoaded(){return!!e.__svgString&&(!(Array.from(e.colorsReplace.keys()).length>0)||e.__finalSrc!==e.src)}})).actions(e=>{let t=()=>{};return{async _loadSVG(){if(!e.src)return;const t=await(0,h.urlToString)(e.src);(0,i.isAlive)(e)&&(0,i.hasParent)(e)&&e.store.history.ignore(()=>{e.set({__svgString:(0,h.fixSize)(t)})})},async afterCreate(){e._loadSVG();let o=e.src;t=(0,i.onSnapshot)(e,t=>{t.src===o&&e.__svgString||(e._loadSVG(),o=e.src)})},beforeDestroy(){t()},replaceColor(t,o){e.colorsReplace.set(t,o)}}});const m={svg:exports.SVGElement,text:exports.TextElement,image:exports.ImageElement},u=[];function y(e){const t=e.type;if(!t)throw new Error('You must pass "type" attribute to custom model.');const o=exports.Element.named(t).props(e);m[t]=o,u.push(o)}exports.registerShapeModel=y;const b=[...new Array(20)].map((e,t)=>i.types.late(()=>u[t])),x=i.types.union({dispatcher:e=>{const t=m[e.type];if(!t)throw new Error(`Unknown element type: "${e.type}"`);return t}},exports.SVGElement,exports.TextElement,exports.ImageElement,...b);function v({key:e,showCredit:t}={key:"",showCredit:!1}){const o=exports.Store.create();return(0,p.validateKey)(e,t),o}exports.Page=i.types.model("Page",{id:i.types.identifier,children:i.types.array(x),width:i.types.optional(i.types.union(i.types.number,i.types.literal("auto")),"auto"),height:i.types.optional(i.types.union(i.types.number,i.types.literal("auto")),"auto"),background:"white",bleed:0,custom:i.types.frozen(),_exporting:!1}).postProcessSnapshot(e=>{const t=Object.assign({},e),o={};for(var n in t)"_"!==n[0]&&(o[n]=e[n]);return o}).views(e=>({get store(){return(0,i.getParentOfType)(e,exports.Store)}})).views(e=>({get computedWidth(){return"auto"===e.width?e.store.width:e.width},get computedHeight(){return"auto"===e.height?e.store.height:e.height}})).actions(e=>({toJSON:()=>JSON.parse(JSON.stringify((0,i.getSnapshot)(e))),clone(t){const o=e.toJSON();o.children.forEach(e=>{e.id=(0,a.nanoid)(10)});const n=Object.assign(Object.assign(Object.assign({},o),{id:(0,a.nanoid)(10)}),t),s=e.store.addPage(n),i=e.store.pages.indexOf(e);s.setZIndex(i+1),s.select()},setZIndex(t){e.store.setPageZIndex(e.id,t)},set(t){Object.assign(e,t)},select(){e.store.selectPage(e.id)},addElement(t){const o=m[t.type];if(!o)return void console.error("Can not find model with type "+t.type);const n=o.create(Object.assign({id:(0,a.nanoid)(10)},t));return e.children.push(n),n.selectable&&e.store.selectElements([n.id]),n},moveElementUp(t){const o=e.children.findIndex(e=>e.id===t),n=e.children[o];(0,i.detach)(n),e.children.remove(n),e.children.splice(o+1,0,n)},moveElementDown(t){const o=e.children.findIndex(e=>e.id===t),n=e.children[o];(0,i.detach)(n),e.children.remove(n),e.children.splice(o-1,0,n)},moveElementTop(t){const o=e.children.findIndex(e=>e.id===t),n=e.children[o];(0,i.detach)(n),e.children.remove(n),e.children.push(n)},moveElementBottom(t){const o=e.children.findIndex(e=>e.id===t),n=e.children[o];(0,i.detach)(n),e.children.remove(n),e.children.splice(0,0,n)}})),exports.Font=i.types.model("Font",{fontFamily:i.types.string,url:i.types.optional(i.types.string,""),styles:i.types.frozen()}).preProcessSnapshot(e=>Object.assign(Object.assign({},e),{fontFamily:e.fontFamily||e.name})),exports.Store=i.types.model("Store",{role:"",pages:i.types.array(exports.Page),fonts:i.types.array(exports.Font),width:1080,height:1080,scale:1,scaleToFit:1,_bleedVisible:!1,openedSidePanel:"",selectedElementsIds:i.types.array(i.types.string),history:i.types.optional(r.UndoManager,{targetPath:"../pages"}),_elementsPixelRatio:2,_activePageId:""}).views(e=>({get selectedElements(){return e.selectedElementsIds.map(t=>{for(const o of e.pages)for(const e of o.children)if(e.id===t)return e}).filter(e=>!!e)},get activePage(){return e.pages.slice().find(t=>t.id===e._activePageId)||(e.pages.length?e.pages[0]:null)}})).actions(e=>({setRole(t){e.role=t},getElementById(t){for(const o of e.pages)for(const e of o.children)if(e.id===t)return e},addPage(t){const o=exports.Page.create(Object.assign({id:(0,a.nanoid)(10)},t));return e.pages.push(o),e._activePageId=o.id,o},selectPage(t){e._activePageId=t},selectElements(t){e.selectedElementsIds=(0,i.cast)(t)},_toggleBleed(t){e._bleedVisible=null!=t?t:!e._bleedVisible},openSidePanel(t){e.openedSidePanel=t},setScale(t){e.scale=t},_setScaleToFit(t){e.scaleToFit=t},setElementsPixelRatio(t){e._elementsPixelRatio=t},setSize(t,o,n){if(n){const n=t/e.width,s=o/e.height;for(const t of e.pages)for(const e of t.children)e.set({x:e.x*n,y:e.y*s}),"text"===e.type?e.set({fontSize:e.fontSize*n,width:Math.max(e.width*n,2)}):"image"===e.type?e.set({width:e.width*n,height:e.height*s}):"svg"===e.type&&e.set({width:Math.max(e.width*n,2),height:Math.max(e.height*n,2)})}e.width=t,e.height=o},setPageZIndex(t,o){const n=e.pages.find(e=>e.id===t);n&&((0,i.detach)(n),e.pages.remove(n),e.pages.splice(o,0,n))},deletePages(t){const o=e.pages.indexOf(e.activePage);t.forEach(t=>{const o=e.pages.find(e=>e.id===t);(0,i.destroy)(o)});const n=Math.min(e.pages.length-1,o),s=e.pages[n];s&&(e._activePageId=s.id),e.selectedElementsIds=(0,i.cast)(e.selectedElementsIds.filter(t=>e.getElementById(t)))},deleteElements(t){t.forEach(t=>{e.pages.forEach(e=>{const o=e.children.find(e=>e.id===t);o&&(0,i.destroy)(o)})}),e.selectedElementsIds=(0,i.cast)([])},on(t,o){if("change"===t){let t=e.toJSON();return(0,i.onSnapshot)(e,n=>{const s=e.toJSON();JSON.stringify(s)!==JSON.stringify(t)&&(t=s,o(s))})}},async toDataURL({pixelRatio:t,ignoreBackground:o,pageId:n,mimeType:s,includeBleed:i,quality:r}={}){var a;const d=t||1;n=n||(null===(a=e.pages[0])||void 0===a?void 0:a.id);const c=e.pages.find(e=>e.id===n);if(!c)throw new Error(`No page for export with id ${n}`);null==c||c.set({_exporting:!0}),await new Promise(e=>{setTimeout(e,0)}),await e.waitLoading();const p=l.default.stages.find(e=>e.getAttr("pageId")===n);if(!p)throw new Error(`Export is failed. Can not find stage for page ${n}. Looks like <Workspace /> component is not mounted, but it is required in order to process the export.`);const g=p.findOne(".page-container");p.find("Transformer").forEach(e=>e.visible(!1)),g.findOne(".page-background").shadowEnabled(!1),g.findOne(".page-background").strokeEnabled(!1),g.find(".highlighter").forEach(e=>e.visible(!1));const h=g.findOne(".page-background-group"),f=h.clip();h.clip({x:null,y:null,width:null,height:null});const m=g.find(e=>e.getAttr("hideInExport"));m.forEach(e=>{e.setAttr("oldVisible",e.visible()),e.hide()}),o&&g.findOne(".page-background").hide();const u=i?c.bleed:0;let y=u;e._bleedVisible&&i?y=0:e._bleedVisible&&!i&&(y=-c.bleed);const b=g.toDataURL({x:g.x()-y*g.scaleX(),y:g.y()-y*g.scaleY(),width:(c.computedWidth+2*u)*g.scaleX(),height:(c.computedHeight+2*u)*g.scaleY(),pixelRatio:1/g.scaleX()*d,mimeType:s,quality:r});return o&&g.findOne(".page-background").show(),m.forEach(e=>{e.visible(e.getAttr("oldVisible"))}),g.findOne(".page-background").shadowEnabled(!0),g.findOne(".page-background").strokeEnabled(!0),p.find("Transformer").forEach(e=>e.visible(!0)),g.find(".highlighter").forEach(e=>e.visible(!0)),h.clip(f),null==c||c.set({_exporting:!1}),b},async saveAsImage(t={}){var{fileName:o}=t,s=n(t,["fileName"]);const i=s.mimeType||"image/png",r=i.split("/")[1];(0,d.downloadFile)(await e.toDataURL(s),o||"polotno."+r,i)},async _toPDF(t){const o=t.dpi||300,n=t.parallel||1,s=await(0,c.getJsPDF)(),i=e=>.75*e;var r=new s({unit:"pt",orientation:e.width>e.height?"landscape":"portrait",format:[i(e.width),i(e.height)],compress:!0});r.deletePage(1);const a=e._elementsPixelRatio,l=o/72;e.setElementsPixelRatio(l),await new Promise(e=>setTimeout(e));const d=((e,t)=>{for(var o=[],n=0;n<e.length;n+=t)o.push(e.slice(n,n+t));return o})(e.pages,n);for(const c of d){const o=c.map(async o=>{const n=t.includeBleed?o.bleed:0,s=i(o.computedWidth+n),r=i(o.computedHeight+n);let a=0,d=l;for(;a<10;){2===(a+=1)&&console.error("Polotno can not export PDF with current settings. Quality is automatically reduced.");const n=await e.toDataURL(Object.assign(Object.assign({},t),{pageId:o.id,pixelRatio:d}));if(n.length>20)return{url:n,width:s,height:r};d*=.8}});(await Promise.all(o)).forEach(({url:e,width:t,height:o})=>{r.addPage([t,o],t>o?"landscape":"portrait"),r.addImage(e,0,0,t,o,void 0,"FAST")})}return e.setElementsPixelRatio(a),r},toPDFDataURL:async t=>(await e._toPDF(Object.assign({mimeType:"image/jpeg"},t))).output("datauristring"),async saveAsPDF(t={}){var{fileName:o}=t,s=n(t,["fileName"]);(await e._toPDF(Object.assign({mimeType:"image/jpeg"},s))).save(o||"polotno.pdf")},async waitLoading(){await(0,f.whenLoaded)()},toJSON:()=>({width:e.width,height:e.height,fonts:(0,i.getSnapshot)(e.fonts),pages:(0,i.getSnapshot)(e.pages)}),loadJSON(t,o=!1){var n;const s=Object.assign({},t);e.pages.forEach(e=>e.children.forEach(e=>(0,i.detach)(e)));const r=e.pages.indexOf(e.activePage);let a=null===(n=s.pages[r]||s.pages[0])||void 0===n?void 0:n.id;e.pages=(0,i.cast)([]),s._activePageId=a,s.scale=e.scale,s.openedSidePanel=e.openedSidePanel,s._bleedVisible=e._bleedVisible,o&&(s.history=e.history.toJSON()),(0,i.applySnapshot)(e,s)},addFont(t){e.removeFont(t.fontFamily),e.fonts.push(t),e.loadFont(t.fontFamily)},removeFont(t){e.fonts.filter(e=>e.fontFamily===t).forEach(e=>(0,i.destroy)(e))},async loadFont(t){const o=e.fonts.find(e=>e.fontFamily===t)||g.globalFonts.find(e=>e.fontFamily===t);o?g.injectCustomFont(o):g.injectGoogleFont(t),await g.loadFont(t)}})),exports.createStore=v,exports.default=v;
864
- },{"mobx-state-tree":"pk4v","./undo-manager":"lvYv","nanoid":"iDyL","konva":"aTGn","../utils/download":"HWHW","../utils/pdf":"sptl","../utils/validate-key":"zree","../utils/fonts":"XXLd","../utils/svg":"B1DI","../utils/loader":"bN4e"}],"IVsl":[function(require,module,exports) {
863
+ "use strict";var e=this&&this.__createBinding||(Object.create?function(e,t,o,n){void 0===n&&(n=o),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[o]}})}:function(e,t,o,n){void 0===n&&(n=o),e[n]=t[o]}),t=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(o){if(o&&o.__esModule)return o;var n={};if(null!=o)for(var s in o)"default"!==s&&Object.prototype.hasOwnProperty.call(o,s)&&e(n,o,s);return t(n,o),n},n=this&&this.__rest||function(e,t){var o={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(e);s<n.length;s++)t.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(e,n[s])&&(o[n[s]]=e[n[s]])}return o},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.createStore=exports.Store=exports.Font=exports.Page=exports.registerShapeModel=exports.SVGElement=exports.ImageElement=exports.TextElement=exports.Element=void 0;const i=require("mobx-state-tree"),r=require("./history"),a=require("nanoid"),l=s(require("konva")),d=require("../utils/download"),c=require("../utils/pdf"),p=require("../utils/validate-key"),g=o(require("../utils/fonts")),h=require("../utils/svg"),m=require("../utils/loader");(0,i.setLivelinessChecking)("ignore"),exports.Element=i.types.model("Element",{id:i.types.identifier,type:"none",x:0,y:0,rotation:0,opacity:1,visible:!0,locked:!1,blurEnabled:!1,blurRadius:10,brightnessEnabled:!1,brightness:0,sepiaEnabled:!1,grayscaleEnabled:!1,shadowEnabled:!1,shadowBlur:5,shadowOffsetX:0,shadowOffsetY:0,shadowColor:"black",custom:i.types.frozen(),selectable:!0,alwaysOnTop:!1,showInExport:!0}).preProcessSnapshot(e=>{const t=Object.assign(Object.assign({},e),{x:e.x||0,y:e.y||0});return"width"in e&&(t.width=t.width||1),"height"in e&&(t.height=t.height||1),t}).postProcessSnapshot(e=>{const t=Object.assign({},e),o={};for(var n in t)"_"!==n[0]&&(o[n]=e[n]);return o}).views(e=>({get page(){return(0,i.getParentOfType)(e,exports.Page)},get store(){return(0,i.getParentOfType)(e,exports.Store)}})).actions(e=>({toJSON:()=>Object.assign({},(0,i.getSnapshot)(e))})).actions(e=>({clone(t){const o=e.toJSON();return t.id=t.id||(0,a.nanoid)(10),Object.assign(o,t),e.page.addElement(o)},set(t){Object.assign(e,t)},moveUp(){e.page.moveElementsUp([e.id])},moveTop(){e.page.moveElementsTop([e.id])},moveDown(){e.page.moveElementsDown([e.id])},moveBottom(){e.page.moveElementsBottom([e.id])},beforeDestroy(){e.store.history.endTransaction()}})),exports.TextElement=exports.Element.named("Text").props({type:"text",text:"",placeholder:"",fontSize:14,fontFamily:"Roboto",fontStyle:"normal",fontWeight:"normal",textDecoration:"",fill:"black",align:"center",width:100,height:14,strokeWidth:0,stroke:"black",lineHeight:i.types.optional(i.types.union(i.types.number,i.types.string),1.2),letterSpacing:0,_editModeEnabled:!1}).preProcessSnapshot(e=>Object.assign({},e)).actions(e=>({toggleEditMode(t){e._editModeEnabled=null!=t?t:!e._editModeEnabled,e._editModeEnabled?e.store.history.startTransaction():e.store.history.endTransaction()}})),exports.ImageElement=exports.Element.named("Image").props({type:"image",width:100,height:100,src:"",cropX:0,cropY:0,cropWidth:1,cropHeight:1,cornerRadius:0,flipX:!1,flipY:!1,clipSrc:"",borderColor:"black",borderSize:0,_cropModeEnabled:!1}).actions(e=>({toggleCropMode(t){e._cropModeEnabled=null!=t?t:!e._cropModeEnabled,e._cropModeEnabled?e.store.history.startTransaction():e.store.history.endTransaction()}})),exports.SVGElement=exports.Element.named("SVG").props({type:"svg",src:"",maskSrc:"",__svgString:"",cropX:0,cropY:0,cropWidth:1,cropHeight:1,keepRatio:!0,flipX:!1,flipY:!1,width:100,height:100,borderColor:"black",borderSize:0,colorsReplace:i.types.map(i.types.string)}).preProcessSnapshot(e=>Object.assign(Object.assign({},e),{src:e.src||e.svgSource})).views(e=>({get colors(){return e.__svgString?(0,h.getColors)(e.__svgString):[]},get __finalSrc(){return e.__svgString?(0,h.replaceColors)(e.__svgString,e.colorsReplace):this.src},get __isLoaded(){return!!e.__svgString&&(!(Array.from(e.colorsReplace.keys()).length>0)||e.__finalSrc!==e.src)}})).actions(e=>{let t=()=>{};return{async _loadSVG(){if(!e.src)return;const t=await(0,h.urlToString)(e.src);(0,i.isAlive)(e)&&(0,i.hasParent)(e)&&e.store.history.ignore(()=>{e.set({__svgString:(0,h.fixSize)(t)})})},async afterCreate(){e._loadSVG();let o=e.src;t=(0,i.onSnapshot)(e,t=>{t.src===o&&e.__svgString||(e._loadSVG(),o=e.src)})},beforeDestroy(){t()},replaceColor(t,o){e.colorsReplace.set(t,o)}}});const f={svg:exports.SVGElement,text:exports.TextElement,image:exports.ImageElement},u=[];function y(e){const t=e.type;if(!t)throw new Error('You must pass "type" attribute to custom model.');const o=exports.Element.named(t).props(e);f[t]=o,u.push(o)}exports.registerShapeModel=y;const E=[...new Array(20)].map((e,t)=>i.types.late(()=>u[t])),b=i.types.union({dispatcher:e=>{const t=f[e.type];if(!t)throw new Error(`Unknown element type: "${e.type}"`);return t}},exports.SVGElement,exports.TextElement,exports.ImageElement,...E);function v({key:e,showCredit:t}={key:"",showCredit:!1}){const o=exports.Store.create();return(0,p.validateKey)(e,t),o}exports.Page=i.types.model("Page",{id:i.types.identifier,children:i.types.array(b),width:i.types.optional(i.types.union(i.types.number,i.types.literal("auto")),"auto"),height:i.types.optional(i.types.union(i.types.number,i.types.literal("auto")),"auto"),background:"white",bleed:0,custom:i.types.frozen(),_exporting:!1}).postProcessSnapshot(e=>{const t=Object.assign({},e),o={};for(var n in t)"_"!==n[0]&&(o[n]=e[n]);return o}).views(e=>({get store(){return(0,i.getParentOfType)(e,exports.Store)}})).views(e=>({get computedWidth(){return"auto"===e.width?e.store.width:e.width},get computedHeight(){return"auto"===e.height?e.store.height:e.height}})).actions(e=>({toJSON:()=>JSON.parse(JSON.stringify((0,i.getSnapshot)(e))),_forEachElementUp(t,o){const n=t.map(t=>({id:t,index:e.children.findIndex(e=>e.id===t)}));n.sort((e,t)=>t.index-e.index);for(const{index:s}of n){if(-1==s)continue;const n=s<e.children.length-1&&e.children[s+1],i=t.indexOf(null==n?void 0:n.id)>=0;s===e.children.length-1||i||o(s)}},_forEachElementDown(t,o){const n=t.map(t=>({id:t,index:e.children.findIndex(e=>e.id===t)}));n.sort((e,t)=>e.index-t.index);for(const{index:s}of n){if(-1==s)continue;const n=s>0&&e.children[s-1],i=t.indexOf(null==n?void 0:n.id)>=0;0===s||i||o(s)}return!1}})).actions(e=>({clone(t){const o=e.toJSON();o.children.forEach(e=>{e.id=(0,a.nanoid)(10)});const n=Object.assign(Object.assign(Object.assign({},o),{id:(0,a.nanoid)(10)}),t),s=e.store.addPage(n),i=e.store.pages.indexOf(e);s.setZIndex(i+1),s.select()},setZIndex(t){e.store.setPageZIndex(e.id,t)},set(t){Object.assign(e,t)},select(){e.store.selectPage(e.id)},addElement(t){const o=f[t.type];if(!o)return void console.error("Can not find model with type "+t.type);const n=o.create(Object.assign({id:(0,a.nanoid)(10)},t));return e.children.push(n),n.selectable&&e.store.selectElements([n.id]),n},canMoveElementsUp(t){let o=!1;return e._forEachElementUp(t,()=>{o=o||!0}),o},moveElementsUp(t){e._forEachElementUp(t,t=>{const o=e.children[t];(0,i.detach)(o),e.children.splice(t+1,0,o)})},canMoveElementsTop(e){return this.canMoveElementsUp(e)},moveElementsTop(t){const o=[],n=[];e.children.forEach(e=>{t.indexOf(e.id)>=0?o.push(e):n.push(e)}),e.children.replace(n.concat(o))},canMoveElementsDown(t){let o=!1;return e._forEachElementDown(t,()=>{o=o||!0}),o},moveElementsDown(t){e._forEachElementDown(t,t=>{const o=e.children[t];(0,i.detach)(o),e.children.splice(t-1,0,o)})},canMoveElementsBottom(e){return this.canMoveElementsDown(e)},moveElementsBottom(t){const o=[],n=[];e.children.forEach(e=>{t.indexOf(e.id)>=0?o.push(e):n.push(e)}),e.children.replace(o.concat(n))}})).actions(e=>({moveElementUp(t){console.warn("page.moveElementUp(id) is deprecated. Please use page.moveElementsUp([id1, id2]) instead."),e.moveElementsUp([t])},moveElementDown(t){console.warn("page.moveElementDown(id) is deprecated. Please use page.moveElementsDown([id1, id2]) instead."),e.moveElementsDown([t])},moveElementTop(t){console.warn("page.moveElementTop(id) is deprecated. Please use page.moveElementsTop([id1, id2]) instead."),e.moveElementsTop([t])},moveElementBottom(t){console.warn("page.moveElementBottom(id) is deprecated. Please use page.moveElementsBottom([id1, id2]) instead."),e.moveElementsBottom([t])}})),exports.Font=i.types.model("Font",{fontFamily:i.types.string,url:i.types.optional(i.types.string,""),styles:i.types.frozen()}).preProcessSnapshot(e=>Object.assign(Object.assign({},e),{fontFamily:e.fontFamily||e.name})),exports.Store=i.types.model("Store",{role:"",pages:i.types.array(exports.Page),fonts:i.types.array(exports.Font),width:1080,height:1080,scale:1,scaleToFit:1,_bleedVisible:!1,openedSidePanel:"",selectedElementsIds:i.types.array(i.types.string),history:i.types.optional(r.UndoManager,{targetPath:"../pages"}),_elementsPixelRatio:2,_activePageId:""}).views(e=>({get selectedElements(){return e.selectedElementsIds.map(t=>{for(const o of e.pages)for(const e of o.children)if(e.id===t)return e}).filter(e=>!!e)},get activePage(){return e.pages.slice().find(t=>t.id===e._activePageId)||(e.pages.length?e.pages[0]:null)}})).actions(e=>({setRole(t){e.role=t},getElementById(t){for(const o of e.pages)for(const e of o.children)if(e.id===t)return e},addPage(t){const o=exports.Page.create(Object.assign({id:(0,a.nanoid)(10)},t));return e.pages.push(o),e._activePageId=o.id,o},selectPage(t){e._activePageId=t},selectElements(t){e.selectedElementsIds=(0,i.cast)(t)},_toggleBleed(t){e._bleedVisible=null!=t?t:!e._bleedVisible},openSidePanel(t){e.openedSidePanel=t},setScale(t){e.scale=t},_setScaleToFit(t){e.scaleToFit=t},setElementsPixelRatio(t){e._elementsPixelRatio=t},setSize(t,o,n){if(n){const n=t/e.width,s=o/e.height;for(const t of e.pages)for(const e of t.children)e.set({x:e.x*n,y:e.y*s}),"text"===e.type?e.set({fontSize:e.fontSize*n,width:Math.max(e.width*n,2)}):"image"===e.type?e.set({width:e.width*n,height:e.height*s}):"svg"===e.type&&e.set({width:Math.max(e.width*n,2),height:Math.max(e.height*n,2)})}e.width=t,e.height=o},setPageZIndex(t,o){const n=e.pages.find(e=>e.id===t);n&&((0,i.detach)(n),e.pages.remove(n),e.pages.splice(o,0,n))},deletePages(t){const o=e.pages.indexOf(e.activePage);t.forEach(t=>{const o=e.pages.find(e=>e.id===t);(0,i.destroy)(o)});const n=Math.min(e.pages.length-1,o),s=e.pages[n];s&&(e._activePageId=s.id),e.selectedElementsIds=(0,i.cast)(e.selectedElementsIds.filter(t=>e.getElementById(t)))},deleteElements(t){t.forEach(t=>{e.pages.forEach(e=>{const o=e.children.find(e=>e.id===t);o&&(0,i.destroy)(o)})}),e.selectedElementsIds=(0,i.cast)([])},on(t,o){if("change"===t){let t=e.toJSON();return(0,i.onSnapshot)(e,n=>{const s=e.toJSON();JSON.stringify(s)!==JSON.stringify(t)&&(t=s,o(s))})}},async toDataURL({pixelRatio:t,ignoreBackground:o,pageId:n,mimeType:s,includeBleed:i,quality:r}={}){var a;const d=t||1;n=n||(null===(a=e.pages[0])||void 0===a?void 0:a.id);const c=e.pages.find(e=>e.id===n);if(!c)throw new Error(`No page for export with id ${n}`);null==c||c.set({_exporting:!0}),await new Promise(e=>{setTimeout(e,0)}),await e.waitLoading();const p=l.default.stages.find(e=>e.getAttr("pageId")===n);if(!p)throw new Error(`Export is failed. Can not find stage for page ${n}. Looks like <Workspace /> component is not mounted, but it is required in order to process the export.`);const g=p.findOne(".page-container");p.find("Transformer").forEach(e=>e.visible(!1)),g.findOne(".page-background").shadowEnabled(!1),g.findOne(".page-background").strokeEnabled(!1),g.find(".highlighter").forEach(e=>e.visible(!1));const h=g.findOne(".page-background-group"),m=h.clip();h.clip({x:null,y:null,width:null,height:null});const f=g.find(e=>e.getAttr("hideInExport"));f.forEach(e=>{e.setAttr("oldVisible",e.visible()),e.hide()}),o&&g.findOne(".page-background").hide();const u=i?c.bleed:0;let y=u;e._bleedVisible&&i?y=0:e._bleedVisible&&!i&&(y=-c.bleed);const E=g.toDataURL({x:g.x()-y*g.scaleX(),y:g.y()-y*g.scaleY(),width:(c.computedWidth+2*u)*g.scaleX(),height:(c.computedHeight+2*u)*g.scaleY(),pixelRatio:1/g.scaleX()*d,mimeType:s,quality:r});return o&&g.findOne(".page-background").show(),f.forEach(e=>{e.visible(e.getAttr("oldVisible"))}),g.findOne(".page-background").shadowEnabled(!0),g.findOne(".page-background").strokeEnabled(!0),p.find("Transformer").forEach(e=>e.visible(!0)),g.find(".highlighter").forEach(e=>e.visible(!0)),h.clip(m),null==c||c.set({_exporting:!1}),E},async saveAsImage(t={}){var{fileName:o}=t,s=n(t,["fileName"]);const i=s.mimeType||"image/png",r=i.split("/")[1];(0,d.downloadFile)(await e.toDataURL(s),o||"polotno."+r,i)},async _toPDF(t){const o=t.dpi||300,n=t.parallel||1,s=await(0,c.getJsPDF)(),i=e=>.75*e;var r=new s({unit:"pt",orientation:e.width>e.height?"landscape":"portrait",format:[i(e.width),i(e.height)],compress:!0});r.deletePage(1);const a=e._elementsPixelRatio,l=o/72;e.setElementsPixelRatio(l),await new Promise(e=>setTimeout(e));const d=((e,t)=>{for(var o=[],n=0;n<e.length;n+=t)o.push(e.slice(n,n+t));return o})(e.pages,n);for(const c of d){const o=c.map(async o=>{const n=t.includeBleed?o.bleed:0,s=i(o.computedWidth+n),r=i(o.computedHeight+n);let a=0,d=l;for(;a<10;){2===(a+=1)&&console.error("Polotno can not export PDF with current settings. Quality is automatically reduced.");const n=await e.toDataURL(Object.assign(Object.assign({},t),{pageId:o.id,pixelRatio:d}));if(n.length>20)return{url:n,width:s,height:r};d*=.8}});(await Promise.all(o)).forEach(({url:e,width:t,height:o})=>{r.addPage([t,o],t>o?"landscape":"portrait"),r.addImage(e,0,0,t,o,void 0,"FAST")})}return e.setElementsPixelRatio(a),r},toPDFDataURL:async t=>(await e._toPDF(Object.assign({mimeType:"image/jpeg"},t))).output("datauristring"),async saveAsPDF(t={}){var{fileName:o}=t,s=n(t,["fileName"]);(await e._toPDF(Object.assign({mimeType:"image/jpeg"},s))).save(o||"polotno.pdf")},async waitLoading(){await(0,m.whenLoaded)()},toJSON:()=>({width:e.width,height:e.height,fonts:(0,i.getSnapshot)(e.fonts),pages:(0,i.getSnapshot)(e.pages)}),loadJSON(t,o=!1){var n;const s=Object.assign({},t);e.pages.forEach(e=>e.children.forEach(e=>(0,i.detach)(e)));const r=e.pages.indexOf(e.activePage);let a=null===(n=s.pages[r]||s.pages[0])||void 0===n?void 0:n.id;e.pages=(0,i.cast)([]),s._activePageId=a,s.scale=e.scale,s.openedSidePanel=e.openedSidePanel,s._bleedVisible=e._bleedVisible,o&&(s.history=e.history.toJSON()),(0,i.applySnapshot)(e,s)},addFont(t){e.removeFont(t.fontFamily),e.fonts.push(t),e.loadFont(t.fontFamily)},removeFont(t){e.fonts.filter(e=>e.fontFamily===t).forEach(e=>(0,i.destroy)(e))},async loadFont(t){const o=e.fonts.find(e=>e.fontFamily===t)||g.globalFonts.find(e=>e.fontFamily===t);o?g.injectCustomFont(o):g.injectGoogleFont(t),await g.loadFont(t)}})),exports.createStore=v,exports.default=v;
864
+ },{"mobx-state-tree":"pk4v","./history":"X9z9","nanoid":"iDyL","konva":"aTGn","../utils/download":"HWHW","../utils/pdf":"sptl","../utils/validate-key":"zree","../utils/fonts":"XXLd","../utils/svg":"B1DI","../utils/loader":"bN4e"}],"IVsl":[function(require,module,exports) {
865
865
  "use strict";var e=l(require("react")),o=l(require("react-dom")),r=require("polotno/canvas/workspace"),t=require("polotno/model/store"),a=require("polotno/canvas/use-fadein"),n=require("polotno/utils/fonts");function l(e){return e&&e.__esModule?e:{default:e}}(0,a.toggleFadeInAnimation)(!1);var d=new URLSearchParams(location.search).get("key"),i=(0,t.createStore)({key:d});window.store=i,window.config={addGlobalFont:n.addGlobalFont},o.default.render(e.default.createElement(r.Workspace,{store:i}),document.getElementById("root"));
866
866
  },{"react":"HdMw","react-dom":"X9zx","polotno/canvas/workspace":"twsc","polotno/model/store":"GRkH","polotno/canvas/use-fadein":"N3c2","polotno/utils/fonts":"XXLd"}]},{},["IVsl"], null)
867
- //# sourceMappingURL=client.6ea1044c.js.map
867
+ //# sourceMappingURL=client.fb50402b.js.map
package/dist/client.html CHANGED
@@ -1 +1 @@
1
- <html><head><title>Canvas editor</title><style>body{padding:0;margin:0}</style><meta name="viewport" content="width=device-width, initial-scale=1"></head><body class="bp3-dark"> <div id="root"></div> <script src="client.6ea1044c.js"></script> </body></html>
1
+ <html><head><title>Canvas editor</title><style>body{padding:0;margin:0}</style><meta name="viewport" content="width=device-width, initial-scale=1"></head><body class="bp3-dark"> <div id="root"></div> <script src="client.fb50402b.js"></script> </body></html>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "polotno-node",
3
- "version": "0.3.3",
3
+ "version": "0.3.5",
4
4
  "description": "Polotno workflow from NodeJS",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -15,7 +15,7 @@
15
15
  ],
16
16
  "devDependencies": {
17
17
  "parcel-bundler": "^1.12.4",
18
- "polotno": "^0.39.3",
18
+ "polotno": "^0.39.6",
19
19
  "react": "^17.0.2",
20
20
  "react-dom": "^17.0.2"
21
21
  },