diff --git a/.github/workflows/release-upload.yml b/.github/workflows/release-upload.yml new file mode 100644 index 000000000..dd6e4162a --- /dev/null +++ b/.github/workflows/release-upload.yml @@ -0,0 +1,104 @@ +name: Release upload + +on: + pull_request: + +jobs: + upload-release: + if: | + github.event_name == 'pull_request' && + contains(github.head_ref, 'release') && + github.event.pull_request.base.ref == 'main' + runs-on: ubuntu-latest + timeout-minutes: 5 + strategy: + fail-fast: false + matrix: + include: + - sfra-version: 'v6.1.0' + node-version: '14' + sfcc-hostname-secret: 'SFCC_STOREFRONT_URL_004' + code-version-secret: 'SFCC_CODE_VERSION_COMMON' + - sfra-version: 'v6.1.0' + node-version: '14' + sfcc-hostname-secret: 'SFCC_STOREFRONT_URL_006' + code-version-secret: 'SFCC_CODE_VERSION_COMMON' + - sfra-version: 'v5.3.0' + node-version: '14' + sfcc-hostname-secret: 'SFCC_STOREFRONT_URL_007' + code-version-secret: 'SFCC_CODE_VERSION_COMMON' + - sfra-version: 'v5.3.0' + node-version: '14' + sfcc-hostname-secret: 'SFCC_STOREFRONT_URL_018' + code-version-secret: 'SFCC_CODE_VERSION_COMMON' + - sfra-version: 'v6.1.0' + node-version: '14' + sfcc-hostname-secret: 'SFCC_STOREFRONT_URL_019' + code-version-secret: 'SFCC_CODE_VERSION_COMMON' + - sfra-version: 'v6.1.0' + node-version: '14' + sfcc-hostname-secret: 'SFCC_STOREFRONT_URL_020' + code-version-secret: 'SFCC_CODE_VERSION_COMMON' + - sfra-version: 'v6.1.0' + node-version: '14' + sfcc-hostname-secret: 'SFCC_STOREFRONT_URL_022' + code-version-secret: 'SFCC_CODE_VERSION_COMMON' + steps: + - name: Checkout SFRA code + uses: actions/checkout@v4 + with: + repository: SalesforceCommerceCloud/storefront-reference-architecture + ref: ${{ matrix.sfra-version }} + ssh-key: ${{ secrets.SERVICE_ACCOUNT_SSH_KEY }} + path: storefront-reference-architecture + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + - name: Checkout + uses: actions/checkout@v4 + with: + path: adyen-salesforce-commerce-cloud + - name: Install SFRA dependencies + working-directory: storefront-reference-architecture + run: npm install + - name: Install Adyen SFCC dependencies + working-directory: adyen-salesforce-commerce-cloud + run: npm install + - name: Create dw.json file + working-directory: adyen-salesforce-commerce-cloud + run: | + echo '{ + "username": "${{ secrets.SFCC_USERNAME }}", + "password": "${{ secrets.SFCC_PASSWORD }}", + "hostname": "${{ secrets[matrix.sfcc-hostname-secret] }}", + "code-version": "${{ secrets[matrix.code-version-secret] }}" + }' >> dw.json + - name: Transpile the code + working-directory: adyen-salesforce-commerce-cloud + run: npm run transpile + - name: Compile the code + working-directory: adyen-salesforce-commerce-cloud + run: npm run compile:js + - name: Build the cartridge + working-directory: adyen-salesforce-commerce-cloud + run: npm run uploadCartridge > output-sfra.txt + - name: Check build result + working-directory: adyen-salesforce-commerce-cloud + run: npm run check-build:sfra + - name: Install Salesforce CLI + run: | + npm install -g sfcc-ci + - name: Zip site_import + working-directory: adyen-salesforce-commerce-cloud/metadata + run: | + zip -r $GITHUB_WORKSPACE/site_import.zip site_import + - name: Upload the metadata to the sandbox + working-directory: adyen-salesforce-commerce-cloud/metadata + run: | + sfcc-ci client:auth '${{ secrets.SFCC_CLIENT_ID }}' '${{ secrets.SFCC_CLIENT_SECRET }}' + sfcc-ci instance:upload $GITHUB_WORKSPACE/site_import.zip -i "${{ secrets[matrix.sfcc-hostname-secret] }}" + - name: Import the metadata to the sandbox + working-directory: adyen-salesforce-commerce-cloud/metadata + run: | + sfcc-ci instance:import site_import.zip -i "${{ secrets[matrix.sfcc-hostname-secret] }}" -s diff --git a/cartridges/app_adyen_SFRA/.project b/cartridges/app_adyen_SFRA/.project index 5441eaff7..5938f6a0f 100644 --- a/cartridges/app_adyen_SFRA/.project +++ b/cartridges/app_adyen_SFRA/.project @@ -1,7 +1,7 @@ app_adyen_SFRA - v24.4.0 + v24.4.1 diff --git a/cartridges/app_adyen_SFRA/cartridge/client/default/js/adyenCheckout.js b/cartridges/app_adyen_SFRA/cartridge/client/default/js/adyenCheckout.js index c76613323..21e2608de 100644 --- a/cartridges/app_adyen_SFRA/cartridge/client/default/js/adyenCheckout.js +++ b/cartridges/app_adyen_SFRA/cartridge/client/default/js/adyenCheckout.js @@ -32,6 +32,12 @@ if (window.googleMerchantID !== 'null' && window.Configuration.environment.inclu store.checkoutConfiguration.paymentMethodsConfiguration.paywithgoogle.configuration[id] = window.googleMerchantID; store.checkoutConfiguration.paymentMethodsConfiguration.googlepay.configuration[id] = window.googleMerchantID; } +$('body').on('checkout:updateCheckoutView', function (event, data) { + if (data.order.orderEmail) { + var clickToPayConfiguration = store.checkoutConfiguration.paymentMethodsConfiguration.card.clickToPayConfiguration; + clickToPayConfiguration.shopperEmail = data.order.orderEmail; + } +}); // Submit the payment $('button[value="submit-payment"]').on('click', function () { diff --git a/cartridges/app_adyen_SFRA/cartridge/client/default/js/adyen_checkout/checkoutConfiguration.js b/cartridges/app_adyen_SFRA/cartridge/client/default/js/adyen_checkout/checkoutConfiguration.js index 1c2cede5a..f41c8a850 100644 --- a/cartridges/app_adyen_SFRA/cartridge/client/default/js/adyen_checkout/checkoutConfiguration.js +++ b/cartridges/app_adyen_SFRA/cartridge/client/default/js/adyen_checkout/checkoutConfiguration.js @@ -2,13 +2,13 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; } -function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); } -function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; } function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; } function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } +function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); } +function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; } var helpers = require('./helpers'); var _require = require('./makePartialPayment'), makePartialPayment = _require.makePartialPayment; @@ -35,21 +35,11 @@ function getCardConfig() { merchantDisplayName: window.merchantAccount }, exposeExpiryDate: false, - onChange: function onChange(state, component) { - var _state$data, _state$data$paymentMe; + onChange: function onChange(state) { store.isValid = state.isValid; var method = state.data.paymentMethod.storedPaymentMethodId ? "storedCard".concat(state.data.paymentMethod.storedPaymentMethodId) : store.selectedMethod; store.updateSelectedPayment(method, 'isValid', store.isValid); - if ((_state$data = state.data) !== null && _state$data !== void 0 && (_state$data$paymentMe = _state$data.paymentMethod) !== null && _state$data$paymentMe !== void 0 && _state$data$paymentMe.storedPaymentMethodId) { - var holderName = component.props.holderName; - var paymentMethod = state.data.paymentMethod; - paymentMethod.holderName = holderName; - store.updateSelectedPayment(method, 'stateData', _objectSpread(_objectSpread({}, state.data), {}, { - paymentMethod: paymentMethod - })); - } else { - store.updateSelectedPayment(method, 'stateData', state.data); - } + store.updateSelectedPayment(method, 'stateData', state.data); }, onSubmit: function onSubmit() { helpers.assignPaymentMethodValue(); @@ -280,10 +270,6 @@ function getGiftCardConfig() { } function handleOnChange(state) { var type = state.data.paymentMethod.type; - var multipleTxVariantComponents = constants.MULTIPLE_TX_VARIANTS_COMPONENTS; - if (multipleTxVariantComponents.includes(store.selectedMethod)) { - type = store.selectedMethod; - } store.isValid = state.isValid; if (!store.componentsObj[type]) { store.componentsObj[type] = {}; @@ -397,6 +383,26 @@ function getKlarnaConfig() { } return null; } +function getUpiConfig() { + return { + showPayButton: true, + onSubmit: function onSubmit(state, component) { + $('#dwfrm_billing').trigger('submit'); + helpers.assignPaymentMethodValue(); + helpers.paymentFromComponent(state.data, component); + }, + onAdditionalDetails: function onAdditionalDetails(state) { + document.querySelector('#additionalDetailsHidden').value = JSON.stringify(state.data); + document.querySelector('#showConfirmationForm').submit(); + }, + onError: function onError(component) { + if (component) { + component.setStatus('ready'); + } + document.querySelector('#showConfirmationForm').submit(); + } + }; +} function setCheckoutConfiguration() { store.checkoutConfiguration.onChange = handleOnChange; store.checkoutConfiguration.onAdditionalDetails = handleOnAdditionalDetails; @@ -424,7 +430,8 @@ function setCheckoutConfiguration() { klarna: getKlarnaConfig(), klarna_account: getKlarnaConfig(), klarna_paynow: getKlarnaConfig(), - cashapp: getCashAppConfig() + cashapp: getCashAppConfig(), + upi: getUpiConfig() }; } module.exports = { diff --git a/cartridges/app_adyen_SFRA/cartridge/client/default/js/constants.js b/cartridges/app_adyen_SFRA/cartridge/client/default/js/constants.js index 6ba6f6f6d..17fb75199 100644 --- a/cartridges/app_adyen_SFRA/cartridge/client/default/js/constants.js +++ b/cartridges/app_adyen_SFRA/cartridge/client/default/js/constants.js @@ -18,6 +18,5 @@ module.exports = { ACTIONTYPE: { QRCODE: 'qrCode' }, - DISABLED_SUBMIT_BUTTON_METHODS: ['paypal', 'paywithgoogle', 'googlepay', 'amazonpay', 'applepay', 'cashapp'], - MULTIPLE_TX_VARIANTS_COMPONENTS: ['upi'] + DISABLED_SUBMIT_BUTTON_METHODS: ['paypal', 'paywithgoogle', 'googlepay', 'amazonpay', 'applepay', 'cashapp', 'upi'] }; \ No newline at end of file diff --git a/cartridges/app_adyen_SFRA/cartridge/static/default/js/adyenAccount.js b/cartridges/app_adyen_SFRA/cartridge/static/default/js/adyenAccount.js index ab9aeef24..f7757cdb1 100644 --- a/cartridges/app_adyen_SFRA/cartridge/static/default/js/adyenAccount.js +++ b/cartridges/app_adyen_SFRA/cartridge/static/default/js/adyenAccount.js @@ -36,7 +36,7 @@ eval("\n\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \" \****************************************************************************/ /***/ ((module) => { -eval("\n\n// Adyen constants\n\nmodule.exports = {\n METHOD_ADYEN: 'Adyen',\n METHOD_ADYEN_POS: 'AdyenPOS',\n METHOD_ADYEN_COMPONENT: 'AdyenComponent',\n RECEIVED: 'Received',\n NOTENOUGHBALANCE: 'NotEnoughBalance',\n SUCCESS: 'Success',\n GIFTCARD: 'giftcard',\n SCHEME: 'scheme',\n GIROPAY: 'giropay',\n APPLE_PAY: 'applepay',\n PAYPAL: 'paypal',\n AMAZON_PAY: 'amazonpay',\n ACTIONTYPE: {\n QRCODE: 'qrCode'\n },\n DISABLED_SUBMIT_BUTTON_METHODS: ['paypal', 'paywithgoogle', 'googlepay', 'amazonpay', 'applepay', 'cashapp'],\n MULTIPLE_TX_VARIANTS_COMPONENTS: ['upi']\n};\n\n//# sourceURL=webpack://app_adyen_SFRA/./cartridges/app_adyen_SFRA/cartridge/client/default/js/constants.js?"); +eval("\n\n// Adyen constants\n\nmodule.exports = {\n METHOD_ADYEN: 'Adyen',\n METHOD_ADYEN_POS: 'AdyenPOS',\n METHOD_ADYEN_COMPONENT: 'AdyenComponent',\n RECEIVED: 'Received',\n NOTENOUGHBALANCE: 'NotEnoughBalance',\n SUCCESS: 'Success',\n GIFTCARD: 'giftcard',\n SCHEME: 'scheme',\n GIROPAY: 'giropay',\n APPLE_PAY: 'applepay',\n PAYPAL: 'paypal',\n AMAZON_PAY: 'amazonpay',\n ACTIONTYPE: {\n QRCODE: 'qrCode'\n },\n DISABLED_SUBMIT_BUTTON_METHODS: ['paypal', 'paywithgoogle', 'googlepay', 'amazonpay', 'applepay', 'cashapp', 'upi']\n};\n\n//# sourceURL=webpack://app_adyen_SFRA/./cartridges/app_adyen_SFRA/cartridge/client/default/js/constants.js?"); /***/ }), @@ -56,7 +56,7 @@ eval("\n\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \" \********************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ $mobx: () => (/* binding */ $mobx),\n/* harmony export */ FlowCancellationError: () => (/* binding */ FlowCancellationError),\n/* harmony export */ ObservableMap: () => (/* binding */ ObservableMap),\n/* harmony export */ ObservableSet: () => (/* binding */ ObservableSet),\n/* harmony export */ Reaction: () => (/* binding */ Reaction),\n/* harmony export */ _allowStateChanges: () => (/* binding */ allowStateChanges),\n/* harmony export */ _allowStateChangesInsideComputed: () => (/* binding */ runInAction),\n/* harmony export */ _allowStateReadsEnd: () => (/* binding */ allowStateReadsEnd),\n/* harmony export */ _allowStateReadsStart: () => (/* binding */ allowStateReadsStart),\n/* harmony export */ _autoAction: () => (/* binding */ autoAction),\n/* harmony export */ _endAction: () => (/* binding */ _endAction),\n/* harmony export */ _getAdministration: () => (/* binding */ getAdministration),\n/* harmony export */ _getGlobalState: () => (/* binding */ getGlobalState),\n/* harmony export */ _interceptReads: () => (/* binding */ interceptReads),\n/* harmony export */ _isComputingDerivation: () => (/* binding */ isComputingDerivation),\n/* harmony export */ _resetGlobalState: () => (/* binding */ resetGlobalState),\n/* harmony export */ _startAction: () => (/* binding */ _startAction),\n/* harmony export */ action: () => (/* binding */ action),\n/* harmony export */ autorun: () => (/* binding */ autorun),\n/* harmony export */ comparer: () => (/* binding */ comparer),\n/* harmony export */ computed: () => (/* binding */ computed),\n/* harmony export */ configure: () => (/* binding */ configure),\n/* harmony export */ createAtom: () => (/* binding */ createAtom),\n/* harmony export */ defineProperty: () => (/* binding */ apiDefineProperty),\n/* harmony export */ entries: () => (/* binding */ entries),\n/* harmony export */ extendObservable: () => (/* binding */ extendObservable),\n/* harmony export */ flow: () => (/* binding */ flow),\n/* harmony export */ flowResult: () => (/* binding */ flowResult),\n/* harmony export */ get: () => (/* binding */ get),\n/* harmony export */ getAtom: () => (/* binding */ getAtom),\n/* harmony export */ getDebugName: () => (/* binding */ getDebugName),\n/* harmony export */ getDependencyTree: () => (/* binding */ getDependencyTree),\n/* harmony export */ getObserverTree: () => (/* binding */ getObserverTree),\n/* harmony export */ has: () => (/* binding */ has),\n/* harmony export */ intercept: () => (/* binding */ intercept),\n/* harmony export */ isAction: () => (/* binding */ isAction),\n/* harmony export */ isBoxedObservable: () => (/* binding */ isObservableValue),\n/* harmony export */ isComputed: () => (/* binding */ isComputed),\n/* harmony export */ isComputedProp: () => (/* binding */ isComputedProp),\n/* harmony export */ isFlow: () => (/* binding */ isFlow),\n/* harmony export */ isFlowCancellationError: () => (/* binding */ isFlowCancellationError),\n/* harmony export */ isObservable: () => (/* binding */ isObservable),\n/* harmony export */ isObservableArray: () => (/* binding */ isObservableArray),\n/* harmony export */ isObservableMap: () => (/* binding */ isObservableMap),\n/* harmony export */ isObservableObject: () => (/* binding */ isObservableObject),\n/* harmony export */ isObservableProp: () => (/* binding */ isObservableProp),\n/* harmony export */ isObservableSet: () => (/* binding */ isObservableSet),\n/* harmony export */ keys: () => (/* binding */ keys),\n/* harmony export */ makeAutoObservable: () => (/* binding */ makeAutoObservable),\n/* harmony export */ makeObservable: () => (/* binding */ makeObservable),\n/* harmony export */ observable: () => (/* binding */ observable),\n/* harmony export */ observe: () => (/* binding */ observe),\n/* harmony export */ onBecomeObserved: () => (/* binding */ onBecomeObserved),\n/* harmony export */ onBecomeUnobserved: () => (/* binding */ onBecomeUnobserved),\n/* harmony export */ onReactionError: () => (/* binding */ onReactionError),\n/* harmony export */ override: () => (/* binding */ override),\n/* harmony export */ ownKeys: () => (/* binding */ apiOwnKeys),\n/* harmony export */ reaction: () => (/* binding */ reaction),\n/* harmony export */ remove: () => (/* binding */ remove),\n/* harmony export */ runInAction: () => (/* binding */ runInAction),\n/* harmony export */ set: () => (/* binding */ set),\n/* harmony export */ spy: () => (/* binding */ spy),\n/* harmony export */ toJS: () => (/* binding */ toJS),\n/* harmony export */ trace: () => (/* binding */ trace),\n/* harmony export */ transaction: () => (/* binding */ transaction),\n/* harmony export */ untracked: () => (/* binding */ untracked),\n/* harmony export */ values: () => (/* binding */ values),\n/* harmony export */ when: () => (/* binding */ when)\n/* harmony export */ });\nvar niceErrors = {\n 0: \"Invalid value for configuration 'enforceActions', expected 'never', 'always' or 'observed'\",\n 1: function _(annotationType, key) {\n return \"Cannot apply '\" + annotationType + \"' to '\" + key.toString() + \"': Field not found.\";\n },\n /*\n 2(prop) {\n return `invalid decorator for '${prop.toString()}'`\n },\n 3(prop) {\n return `Cannot decorate '${prop.toString()}': action can only be used on properties with a function value.`\n },\n 4(prop) {\n return `Cannot decorate '${prop.toString()}': computed can only be used on getter properties.`\n },\n */\n 5: \"'keys()' can only be used on observable objects, arrays, sets and maps\",\n 6: \"'values()' can only be used on observable objects, arrays, sets and maps\",\n 7: \"'entries()' can only be used on observable objects, arrays and maps\",\n 8: \"'set()' can only be used on observable objects, arrays and maps\",\n 9: \"'remove()' can only be used on observable objects, arrays and maps\",\n 10: \"'has()' can only be used on observable objects, arrays and maps\",\n 11: \"'get()' can only be used on observable objects, arrays and maps\",\n 12: \"Invalid annotation\",\n 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)\",\n 14: \"Intercept handlers should return nothing or a change object\",\n 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)\",\n 16: \"Modification exception: the internal structure of an observable array was changed.\",\n 17: function _(index, length) {\n return \"[mobx.array] Index out of bounds, \" + index + \" is larger than \" + length;\n },\n 18: \"mobx.map requires Map polyfill for the current browser. Check babel-polyfill or core-js/es6/map.js\",\n 19: function _(other) {\n return \"Cannot initialize from classes that inherit from Map: \" + other.constructor.name;\n },\n 20: function _(other) {\n return \"Cannot initialize map from \" + other;\n },\n 21: function _(dataStructure) {\n return \"Cannot convert to map from '\" + dataStructure + \"'\";\n },\n 22: \"mobx.set requires Set polyfill for the current browser. Check babel-polyfill or core-js/es6/set.js\",\n 23: \"It is not possible to get index atoms from arrays\",\n 24: function _(thing) {\n return \"Cannot obtain administration from \" + thing;\n },\n 25: function _(property, name) {\n return \"the entry '\" + property + \"' does not exist in the observable map '\" + name + \"'\";\n },\n 26: \"please specify a property\",\n 27: function _(property, name) {\n return \"no observable property '\" + property.toString() + \"' found on the observable object '\" + name + \"'\";\n },\n 28: function _(thing) {\n return \"Cannot obtain atom from \" + thing;\n },\n 29: \"Expecting some object\",\n 30: \"invalid action stack. did you forget to finish an action?\",\n 31: \"missing option for computed: get\",\n 32: function _(name, derivation) {\n return \"Cycle detected in computation \" + name + \": \" + derivation;\n },\n 33: function _(name) {\n return \"The setter of computed value '\" + name + \"' is trying to update itself. Did you intend to update an _observable_ value, instead of the computed property?\";\n },\n 34: function _(name) {\n return \"[ComputedValue '\" + name + \"'] It is not possible to assign a new value to a computed value.\";\n },\n 35: \"There are multiple, different versions of MobX active. Make sure MobX is loaded only once or use `configure({ isolateGlobalState: true })`\",\n 36: \"isolateGlobalState should be called before MobX is running any reactions\",\n 37: function _(method) {\n return \"[mobx] `observableArray.\" + method + \"()` mutates the array in-place, which is not allowed inside a derivation. Use `array.slice().\" + method + \"()` instead\";\n },\n 38: \"'ownKeys()' can only be used on observable objects\",\n 39: \"'defineProperty()' can only be used on observable objects\"\n};\nvar errors = true ? niceErrors : 0;\nfunction die(error) {\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n if (true) {\n var e = typeof error === \"string\" ? error : errors[error];\n if (typeof e === \"function\") e = e.apply(null, args);\n throw new Error(\"[MobX] \" + e);\n }\n throw new Error(typeof error === \"number\" ? \"[MobX] minified error nr: \" + error + (args.length ? \" \" + args.map(String).join(\",\") : \"\") + \". Find the full error at: https://github.com/mobxjs/mobx/blob/main/packages/mobx/src/errors.ts\" : \"[MobX] \" + error);\n}\n\nvar mockGlobal = {};\nfunction getGlobal() {\n if (typeof globalThis !== \"undefined\") {\n return globalThis;\n }\n if (typeof window !== \"undefined\") {\n return window;\n }\n if (typeof __webpack_require__.g !== \"undefined\") {\n return __webpack_require__.g;\n }\n if (typeof self !== \"undefined\") {\n return self;\n }\n return mockGlobal;\n}\n\n// We shorten anything used > 5 times\nvar assign = Object.assign;\nvar getDescriptor = Object.getOwnPropertyDescriptor;\nvar defineProperty = Object.defineProperty;\nvar objectPrototype = Object.prototype;\nvar EMPTY_ARRAY = [];\nObject.freeze(EMPTY_ARRAY);\nvar EMPTY_OBJECT = {};\nObject.freeze(EMPTY_OBJECT);\nvar hasProxy = typeof Proxy !== \"undefined\";\nvar plainObjectString = /*#__PURE__*/Object.toString();\nfunction assertProxies() {\n if (!hasProxy) {\n die( true ? \"`Proxy` objects are not available in the current environment. Please configure MobX to enable a fallback implementation.`\" : 0);\n }\n}\nfunction warnAboutProxyRequirement(msg) {\n if ( true && globalState.verifyProxies) {\n die(\"MobX is currently configured to be able to run in ES5 mode, but in ES5 MobX won't be able to \" + msg);\n }\n}\nfunction getNextId() {\n return ++globalState.mobxGuid;\n}\n/**\n * Makes sure that the provided function is invoked at most once.\n */\nfunction once(func) {\n var invoked = false;\n return function () {\n if (invoked) {\n return;\n }\n invoked = true;\n return func.apply(this, arguments);\n };\n}\nvar noop = function noop() {};\nfunction isFunction(fn) {\n return typeof fn === \"function\";\n}\nfunction isStringish(value) {\n var t = typeof value;\n switch (t) {\n case \"string\":\n case \"symbol\":\n case \"number\":\n return true;\n }\n return false;\n}\nfunction isObject(value) {\n return value !== null && typeof value === \"object\";\n}\nfunction isPlainObject(value) {\n if (!isObject(value)) {\n return false;\n }\n var proto = Object.getPrototypeOf(value);\n if (proto == null) {\n return true;\n }\n var protoConstructor = Object.hasOwnProperty.call(proto, \"constructor\") && proto.constructor;\n return typeof protoConstructor === \"function\" && protoConstructor.toString() === plainObjectString;\n}\n// https://stackoverflow.com/a/37865170\nfunction isGenerator(obj) {\n var constructor = obj == null ? void 0 : obj.constructor;\n if (!constructor) {\n return false;\n }\n if (\"GeneratorFunction\" === constructor.name || \"GeneratorFunction\" === constructor.displayName) {\n return true;\n }\n return false;\n}\nfunction addHiddenProp(object, propName, value) {\n defineProperty(object, propName, {\n enumerable: false,\n writable: true,\n configurable: true,\n value: value\n });\n}\nfunction addHiddenFinalProp(object, propName, value) {\n defineProperty(object, propName, {\n enumerable: false,\n writable: false,\n configurable: true,\n value: value\n });\n}\nfunction createInstanceofPredicate(name, theClass) {\n var propName = \"isMobX\" + name;\n theClass.prototype[propName] = true;\n return function (x) {\n return isObject(x) && x[propName] === true;\n };\n}\n/**\n * Yields true for both native and observable Map, even across different windows.\n */\nfunction isES6Map(thing) {\n return thing != null && Object.prototype.toString.call(thing) === \"[object Map]\";\n}\n/**\n * Makes sure a Map is an instance of non-inherited native or observable Map.\n */\nfunction isPlainES6Map(thing) {\n var mapProto = Object.getPrototypeOf(thing);\n var objectProto = Object.getPrototypeOf(mapProto);\n var nullProto = Object.getPrototypeOf(objectProto);\n return nullProto === null;\n}\n/**\n * Yields true for both native and observable Set, even across different windows.\n */\nfunction isES6Set(thing) {\n return thing != null && Object.prototype.toString.call(thing) === \"[object Set]\";\n}\nvar hasGetOwnPropertySymbols = typeof Object.getOwnPropertySymbols !== \"undefined\";\n/**\n * Returns the following: own enumerable keys and symbols.\n */\nfunction getPlainObjectKeys(object) {\n var keys = Object.keys(object);\n // Not supported in IE, so there are not going to be symbol props anyway...\n if (!hasGetOwnPropertySymbols) {\n return keys;\n }\n var symbols = Object.getOwnPropertySymbols(object);\n if (!symbols.length) {\n return keys;\n }\n return [].concat(keys, symbols.filter(function (s) {\n return objectPrototype.propertyIsEnumerable.call(object, s);\n }));\n}\n// From Immer utils\n// Returns all own keys, including non-enumerable and symbolic\nvar ownKeys = typeof Reflect !== \"undefined\" && Reflect.ownKeys ? Reflect.ownKeys : hasGetOwnPropertySymbols ? function (obj) {\n return Object.getOwnPropertyNames(obj).concat(Object.getOwnPropertySymbols(obj));\n} : /* istanbul ignore next */Object.getOwnPropertyNames;\nfunction stringifyKey(key) {\n if (typeof key === \"string\") {\n return key;\n }\n if (typeof key === \"symbol\") {\n return key.toString();\n }\n return new String(key).toString();\n}\nfunction toPrimitive(value) {\n return value === null ? null : typeof value === \"object\" ? \"\" + value : value;\n}\nfunction hasProp(target, prop) {\n return objectPrototype.hasOwnProperty.call(target, prop);\n}\n// From Immer utils\nvar getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors || function getOwnPropertyDescriptors(target) {\n // Polyfill needed for Hermes and IE, see https://github.com/facebook/hermes/issues/274\n var res = {};\n // Note: without polyfill for ownKeys, symbols won't be picked up\n ownKeys(target).forEach(function (key) {\n res[key] = getDescriptor(target, key);\n });\n return res;\n};\nfunction getFlag(flags, mask) {\n return !!(flags & mask);\n}\nfunction setFlag(flags, mask, newValue) {\n if (newValue) {\n flags |= mask;\n } else {\n flags &= ~mask;\n }\n return flags;\n}\n\nfunction _arrayLikeToArray(r, a) {\n (null == a || a > r.length) && (a = r.length);\n for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];\n return n;\n}\nfunction _defineProperties(e, r) {\n for (var t = 0; t < r.length; t++) {\n var o = r[t];\n o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);\n }\n}\nfunction _createClass(e, r, t) {\n return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", {\n writable: !1\n }), e;\n}\nfunction _createForOfIteratorHelperLoose(r, e) {\n var t = \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"];\n if (t) return (t = t.call(r)).next.bind(t);\n if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && \"number\" == typeof r.length) {\n t && (r = t);\n var o = 0;\n return function () {\n return o >= r.length ? {\n done: !0\n } : {\n done: !1,\n value: r[o++]\n };\n };\n }\n throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\nfunction _extends() {\n return _extends = Object.assign ? Object.assign.bind() : function (n) {\n for (var e = 1; e < arguments.length; e++) {\n var t = arguments[e];\n for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);\n }\n return n;\n }, _extends.apply(null, arguments);\n}\nfunction _inheritsLoose(t, o) {\n t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);\n}\nfunction _setPrototypeOf(t, e) {\n return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {\n return t.__proto__ = e, t;\n }, _setPrototypeOf(t, e);\n}\nfunction _toPrimitive(t, r) {\n if (\"object\" != typeof t || !t) return t;\n var e = t[Symbol.toPrimitive];\n if (void 0 !== e) {\n var i = e.call(t, r || \"default\");\n if (\"object\" != typeof i) return i;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (\"string\" === r ? String : Number)(t);\n}\nfunction _toPropertyKey(t) {\n var i = _toPrimitive(t, \"string\");\n return \"symbol\" == typeof i ? i : i + \"\";\n}\nfunction _unsupportedIterableToArray(r, a) {\n if (r) {\n if (\"string\" == typeof r) return _arrayLikeToArray(r, a);\n var t = {}.toString.call(r).slice(8, -1);\n return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;\n }\n}\n\nvar storedAnnotationsSymbol = /*#__PURE__*/Symbol(\"mobx-stored-annotations\");\n/**\n * Creates a function that acts as\n * - decorator\n * - annotation object\n */\nfunction createDecoratorAnnotation(annotation) {\n function decorator(target, property) {\n if (is20223Decorator(property)) {\n return annotation.decorate_20223_(target, property);\n } else {\n storeAnnotation(target, property, annotation);\n }\n }\n return Object.assign(decorator, annotation);\n}\n/**\n * Stores annotation to prototype,\n * so it can be inspected later by `makeObservable` called from constructor\n */\nfunction storeAnnotation(prototype, key, annotation) {\n if (!hasProp(prototype, storedAnnotationsSymbol)) {\n addHiddenProp(prototype, storedAnnotationsSymbol, _extends({}, prototype[storedAnnotationsSymbol]));\n }\n // @override must override something\n if ( true && isOverride(annotation) && !hasProp(prototype[storedAnnotationsSymbol], key)) {\n var fieldName = prototype.constructor.name + \".prototype.\" + key.toString();\n die(\"'\" + fieldName + \"' is decorated with 'override', \" + \"but no such decorated member was found on prototype.\");\n }\n // Cannot re-decorate\n assertNotDecorated(prototype, annotation, key);\n // Ignore override\n if (!isOverride(annotation)) {\n prototype[storedAnnotationsSymbol][key] = annotation;\n }\n}\nfunction assertNotDecorated(prototype, annotation, key) {\n if ( true && !isOverride(annotation) && hasProp(prototype[storedAnnotationsSymbol], key)) {\n var fieldName = prototype.constructor.name + \".prototype.\" + key.toString();\n var currentAnnotationType = prototype[storedAnnotationsSymbol][key].annotationType_;\n var requestedAnnotationType = annotation.annotationType_;\n die(\"Cannot apply '@\" + requestedAnnotationType + \"' to '\" + fieldName + \"':\" + (\"\\nThe field is already decorated with '@\" + currentAnnotationType + \"'.\") + \"\\nRe-decorating fields is not allowed.\" + \"\\nUse '@override' decorator for methods overridden by subclass.\");\n }\n}\n/**\n * Collects annotations from prototypes and stores them on target (instance)\n */\nfunction collectStoredAnnotations(target) {\n if (!hasProp(target, storedAnnotationsSymbol)) {\n // if (__DEV__ && !target[storedAnnotationsSymbol]) {\n // die(\n // `No annotations were passed to makeObservable, but no decorated members have been found either`\n // )\n // }\n // We need a copy as we will remove annotation from the list once it's applied.\n addHiddenProp(target, storedAnnotationsSymbol, _extends({}, target[storedAnnotationsSymbol]));\n }\n return target[storedAnnotationsSymbol];\n}\nfunction is20223Decorator(context) {\n return typeof context == \"object\" && typeof context[\"kind\"] == \"string\";\n}\nfunction assert20223DecoratorType(context, types) {\n if ( true && !types.includes(context.kind)) {\n die(\"The decorator applied to '\" + String(context.name) + \"' cannot be used on a \" + context.kind + \" element\");\n }\n}\n\nvar $mobx = /*#__PURE__*/Symbol(\"mobx administration\");\nvar Atom = /*#__PURE__*/function () {\n /**\n * Create a new atom. For debugging purposes it is recommended to give it a name.\n * The onBecomeObserved and onBecomeUnobserved callbacks can be used for resource management.\n */\n function Atom(name_) {\n if (name_ === void 0) {\n name_ = true ? \"Atom@\" + getNextId() : 0;\n }\n this.name_ = void 0;\n this.flags_ = 0;\n this.observers_ = new Set();\n this.lastAccessedBy_ = 0;\n this.lowestObserverState_ = IDerivationState_.NOT_TRACKING_;\n // onBecomeObservedListeners\n this.onBOL = void 0;\n // onBecomeUnobservedListeners\n this.onBUOL = void 0;\n this.name_ = name_;\n }\n // for effective unobserving. BaseAtom has true, for extra optimization, so its onBecomeUnobserved never gets called, because it's not needed\n var _proto = Atom.prototype;\n _proto.onBO = function onBO() {\n if (this.onBOL) {\n this.onBOL.forEach(function (listener) {\n return listener();\n });\n }\n };\n _proto.onBUO = function onBUO() {\n if (this.onBUOL) {\n this.onBUOL.forEach(function (listener) {\n return listener();\n });\n }\n }\n /**\n * Invoke this method to notify mobx that your atom has been used somehow.\n * Returns true if there is currently a reactive context.\n */;\n _proto.reportObserved = function reportObserved$1() {\n return reportObserved(this);\n }\n /**\n * Invoke this method _after_ this method has changed to signal mobx that all its observers should invalidate.\n */;\n _proto.reportChanged = function reportChanged() {\n startBatch();\n propagateChanged(this);\n endBatch();\n };\n _proto.toString = function toString() {\n return this.name_;\n };\n return _createClass(Atom, [{\n key: \"isBeingObserved\",\n get: function get() {\n return getFlag(this.flags_, Atom.isBeingObservedMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Atom.isBeingObservedMask_, newValue);\n }\n }, {\n key: \"isPendingUnobservation\",\n get: function get() {\n return getFlag(this.flags_, Atom.isPendingUnobservationMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Atom.isPendingUnobservationMask_, newValue);\n }\n }, {\n key: \"diffValue\",\n get: function get() {\n return getFlag(this.flags_, Atom.diffValueMask_) ? 1 : 0;\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Atom.diffValueMask_, newValue === 1 ? true : false);\n }\n }]);\n}();\nAtom.isBeingObservedMask_ = 1;\nAtom.isPendingUnobservationMask_ = 2;\nAtom.diffValueMask_ = 4;\nvar isAtom = /*#__PURE__*/createInstanceofPredicate(\"Atom\", Atom);\nfunction createAtom(name, onBecomeObservedHandler, onBecomeUnobservedHandler) {\n if (onBecomeObservedHandler === void 0) {\n onBecomeObservedHandler = noop;\n }\n if (onBecomeUnobservedHandler === void 0) {\n onBecomeUnobservedHandler = noop;\n }\n var atom = new Atom(name);\n // default `noop` listener will not initialize the hook Set\n if (onBecomeObservedHandler !== noop) {\n onBecomeObserved(atom, onBecomeObservedHandler);\n }\n if (onBecomeUnobservedHandler !== noop) {\n onBecomeUnobserved(atom, onBecomeUnobservedHandler);\n }\n return atom;\n}\n\nfunction identityComparer(a, b) {\n return a === b;\n}\nfunction structuralComparer(a, b) {\n return deepEqual(a, b);\n}\nfunction shallowComparer(a, b) {\n return deepEqual(a, b, 1);\n}\nfunction defaultComparer(a, b) {\n if (Object.is) {\n return Object.is(a, b);\n }\n return a === b ? a !== 0 || 1 / a === 1 / b : a !== a && b !== b;\n}\nvar comparer = {\n identity: identityComparer,\n structural: structuralComparer,\n \"default\": defaultComparer,\n shallow: shallowComparer\n};\n\nfunction deepEnhancer(v, _, name) {\n // it is an observable already, done\n if (isObservable(v)) {\n return v;\n }\n // something that can be converted and mutated?\n if (Array.isArray(v)) {\n return observable.array(v, {\n name: name\n });\n }\n if (isPlainObject(v)) {\n return observable.object(v, undefined, {\n name: name\n });\n }\n if (isES6Map(v)) {\n return observable.map(v, {\n name: name\n });\n }\n if (isES6Set(v)) {\n return observable.set(v, {\n name: name\n });\n }\n if (typeof v === \"function\" && !isAction(v) && !isFlow(v)) {\n if (isGenerator(v)) {\n return flow(v);\n } else {\n return autoAction(name, v);\n }\n }\n return v;\n}\nfunction shallowEnhancer(v, _, name) {\n if (v === undefined || v === null) {\n return v;\n }\n if (isObservableObject(v) || isObservableArray(v) || isObservableMap(v) || isObservableSet(v)) {\n return v;\n }\n if (Array.isArray(v)) {\n return observable.array(v, {\n name: name,\n deep: false\n });\n }\n if (isPlainObject(v)) {\n return observable.object(v, undefined, {\n name: name,\n deep: false\n });\n }\n if (isES6Map(v)) {\n return observable.map(v, {\n name: name,\n deep: false\n });\n }\n if (isES6Set(v)) {\n return observable.set(v, {\n name: name,\n deep: false\n });\n }\n if (true) {\n die(\"The shallow modifier / decorator can only used in combination with arrays, objects, maps and sets\");\n }\n}\nfunction referenceEnhancer(newValue) {\n // never turn into an observable\n return newValue;\n}\nfunction refStructEnhancer(v, oldValue) {\n if ( true && isObservable(v)) {\n die(\"observable.struct should not be used with observable values\");\n }\n if (deepEqual(v, oldValue)) {\n return oldValue;\n }\n return v;\n}\n\nvar OVERRIDE = \"override\";\nvar override = /*#__PURE__*/createDecoratorAnnotation({\n annotationType_: OVERRIDE,\n make_: make_,\n extend_: extend_,\n decorate_20223_: decorate_20223_\n});\nfunction isOverride(annotation) {\n return annotation.annotationType_ === OVERRIDE;\n}\nfunction make_(adm, key) {\n // Must not be plain object\n if ( true && adm.isPlainObject_) {\n die(\"Cannot apply '\" + this.annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + this.annotationType_ + \"' cannot be used on plain objects.\"));\n }\n // Must override something\n if ( true && !hasProp(adm.appliedAnnotations_, key)) {\n die(\"'\" + adm.name_ + \".\" + key.toString() + \"' is annotated with '\" + this.annotationType_ + \"', \" + \"but no such annotated member was found on prototype.\");\n }\n return 0 /* MakeResult.Cancel */;\n}\nfunction extend_(adm, key, descriptor, proxyTrap) {\n die(\"'\" + this.annotationType_ + \"' can only be used with 'makeObservable'\");\n}\nfunction decorate_20223_(desc, context) {\n console.warn(\"'\" + this.annotationType_ + \"' cannot be used with decorators - this is a no-op\");\n}\n\nfunction createActionAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$1,\n extend_: extend_$1,\n decorate_20223_: decorate_20223_$1\n };\n}\nfunction make_$1(adm, key, descriptor, source) {\n var _this$options_;\n // bound\n if ((_this$options_ = this.options_) != null && _this$options_.bound) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;\n }\n // own\n if (source === adm.target_) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 2 /* MakeResult.Continue */;\n }\n // prototype\n if (isAction(descriptor.value)) {\n // A prototype could have been annotated already by other constructor,\n // rest of the proto chain must be annotated already\n return 1 /* MakeResult.Break */;\n }\n var actionDescriptor = createActionDescriptor(adm, this, key, descriptor, false);\n defineProperty(source, key, actionDescriptor);\n return 2 /* MakeResult.Continue */;\n}\nfunction extend_$1(adm, key, descriptor, proxyTrap) {\n var actionDescriptor = createActionDescriptor(adm, this, key, descriptor);\n return adm.defineProperty_(key, actionDescriptor, proxyTrap);\n}\nfunction decorate_20223_$1(mthd, context) {\n if (true) {\n assert20223DecoratorType(context, [\"method\", \"field\"]);\n }\n var kind = context.kind,\n name = context.name,\n addInitializer = context.addInitializer;\n var ann = this;\n var _createAction = function _createAction(m) {\n var _ann$options_$name, _ann$options_, _ann$options_$autoAct, _ann$options_2;\n return createAction((_ann$options_$name = (_ann$options_ = ann.options_) == null ? void 0 : _ann$options_.name) != null ? _ann$options_$name : name.toString(), m, (_ann$options_$autoAct = (_ann$options_2 = ann.options_) == null ? void 0 : _ann$options_2.autoAction) != null ? _ann$options_$autoAct : false);\n };\n // Backwards/Legacy behavior, expects makeObservable(this)\n if (kind == \"field\") {\n addInitializer(function () {\n storeAnnotation(this, name, ann);\n });\n return;\n }\n if (kind == \"method\") {\n var _this$options_2;\n if (!isAction(mthd)) {\n mthd = _createAction(mthd);\n }\n if ((_this$options_2 = this.options_) != null && _this$options_2.bound) {\n addInitializer(function () {\n var self = this;\n var bound = self[name].bind(self);\n bound.isMobxAction = true;\n self[name] = bound;\n });\n }\n return mthd;\n }\n die(\"Cannot apply '\" + ann.annotationType_ + \"' to '\" + String(name) + \"' (kind: \" + kind + \"):\" + (\"\\n'\" + ann.annotationType_ + \"' can only be used on properties with a function value.\"));\n}\nfunction assertActionDescriptor(adm, _ref, key, _ref2) {\n var annotationType_ = _ref.annotationType_;\n var value = _ref2.value;\n if ( true && !isFunction(value)) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' can only be used on properties with a function value.\"));\n }\n}\nfunction createActionDescriptor(adm, annotation, key, descriptor,\n// provides ability to disable safeDescriptors for prototypes\nsafeDescriptors) {\n var _annotation$options_, _annotation$options_$, _annotation$options_2, _annotation$options_$2, _annotation$options_3, _annotation$options_4, _adm$proxy_2;\n if (safeDescriptors === void 0) {\n safeDescriptors = globalState.safeDescriptors;\n }\n assertActionDescriptor(adm, annotation, key, descriptor);\n var value = descriptor.value;\n if ((_annotation$options_ = annotation.options_) != null && _annotation$options_.bound) {\n var _adm$proxy_;\n value = value.bind((_adm$proxy_ = adm.proxy_) != null ? _adm$proxy_ : adm.target_);\n }\n return {\n value: createAction((_annotation$options_$ = (_annotation$options_2 = annotation.options_) == null ? void 0 : _annotation$options_2.name) != null ? _annotation$options_$ : key.toString(), value, (_annotation$options_$2 = (_annotation$options_3 = annotation.options_) == null ? void 0 : _annotation$options_3.autoAction) != null ? _annotation$options_$2 : false,\n // https://github.com/mobxjs/mobx/discussions/3140\n (_annotation$options_4 = annotation.options_) != null && _annotation$options_4.bound ? (_adm$proxy_2 = adm.proxy_) != null ? _adm$proxy_2 : adm.target_ : undefined),\n // Non-configurable for classes\n // prevents accidental field redefinition in subclass\n configurable: safeDescriptors ? adm.isPlainObject_ : true,\n // https://github.com/mobxjs/mobx/pull/2641#issuecomment-737292058\n enumerable: false,\n // Non-obsevable, therefore non-writable\n // Also prevents rewriting in subclass constructor\n writable: safeDescriptors ? false : true\n };\n}\n\nfunction createFlowAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$2,\n extend_: extend_$2,\n decorate_20223_: decorate_20223_$2\n };\n}\nfunction make_$2(adm, key, descriptor, source) {\n var _this$options_;\n // own\n if (source === adm.target_) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 2 /* MakeResult.Continue */;\n }\n // prototype\n // bound - must annotate protos to support super.flow()\n if ((_this$options_ = this.options_) != null && _this$options_.bound && (!hasProp(adm.target_, key) || !isFlow(adm.target_[key]))) {\n if (this.extend_(adm, key, descriptor, false) === null) {\n return 0 /* MakeResult.Cancel */;\n }\n }\n if (isFlow(descriptor.value)) {\n // A prototype could have been annotated already by other constructor,\n // rest of the proto chain must be annotated already\n return 1 /* MakeResult.Break */;\n }\n var flowDescriptor = createFlowDescriptor(adm, this, key, descriptor, false, false);\n defineProperty(source, key, flowDescriptor);\n return 2 /* MakeResult.Continue */;\n}\nfunction extend_$2(adm, key, descriptor, proxyTrap) {\n var _this$options_2;\n var flowDescriptor = createFlowDescriptor(adm, this, key, descriptor, (_this$options_2 = this.options_) == null ? void 0 : _this$options_2.bound);\n return adm.defineProperty_(key, flowDescriptor, proxyTrap);\n}\nfunction decorate_20223_$2(mthd, context) {\n var _this$options_3;\n if (true) {\n assert20223DecoratorType(context, [\"method\"]);\n }\n var name = context.name,\n addInitializer = context.addInitializer;\n if (!isFlow(mthd)) {\n mthd = flow(mthd);\n }\n if ((_this$options_3 = this.options_) != null && _this$options_3.bound) {\n addInitializer(function () {\n var self = this;\n var bound = self[name].bind(self);\n bound.isMobXFlow = true;\n self[name] = bound;\n });\n }\n return mthd;\n}\nfunction assertFlowDescriptor(adm, _ref, key, _ref2) {\n var annotationType_ = _ref.annotationType_;\n var value = _ref2.value;\n if ( true && !isFunction(value)) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' can only be used on properties with a generator function value.\"));\n }\n}\nfunction createFlowDescriptor(adm, annotation, key, descriptor, bound,\n// provides ability to disable safeDescriptors for prototypes\nsafeDescriptors) {\n if (safeDescriptors === void 0) {\n safeDescriptors = globalState.safeDescriptors;\n }\n assertFlowDescriptor(adm, annotation, key, descriptor);\n var value = descriptor.value;\n // In case of flow.bound, the descriptor can be from already annotated prototype\n if (!isFlow(value)) {\n value = flow(value);\n }\n if (bound) {\n var _adm$proxy_;\n // We do not keep original function around, so we bind the existing flow\n value = value.bind((_adm$proxy_ = adm.proxy_) != null ? _adm$proxy_ : adm.target_);\n // This is normally set by `flow`, but `bind` returns new function...\n value.isMobXFlow = true;\n }\n return {\n value: value,\n // Non-configurable for classes\n // prevents accidental field redefinition in subclass\n configurable: safeDescriptors ? adm.isPlainObject_ : true,\n // https://github.com/mobxjs/mobx/pull/2641#issuecomment-737292058\n enumerable: false,\n // Non-obsevable, therefore non-writable\n // Also prevents rewriting in subclass constructor\n writable: safeDescriptors ? false : true\n };\n}\n\nfunction createComputedAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$3,\n extend_: extend_$3,\n decorate_20223_: decorate_20223_$3\n };\n}\nfunction make_$3(adm, key, descriptor) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;\n}\nfunction extend_$3(adm, key, descriptor, proxyTrap) {\n assertComputedDescriptor(adm, this, key, descriptor);\n return adm.defineComputedProperty_(key, _extends({}, this.options_, {\n get: descriptor.get,\n set: descriptor.set\n }), proxyTrap);\n}\nfunction decorate_20223_$3(get, context) {\n if (true) {\n assert20223DecoratorType(context, [\"getter\"]);\n }\n var ann = this;\n var key = context.name,\n addInitializer = context.addInitializer;\n addInitializer(function () {\n var adm = asObservableObject(this)[$mobx];\n var options = _extends({}, ann.options_, {\n get: get,\n context: this\n });\n options.name || (options.name = true ? adm.name_ + \".\" + key.toString() : 0);\n adm.values_.set(key, new ComputedValue(options));\n });\n return function () {\n return this[$mobx].getObservablePropValue_(key);\n };\n}\nfunction assertComputedDescriptor(adm, _ref, key, _ref2) {\n var annotationType_ = _ref.annotationType_;\n var get = _ref2.get;\n if ( true && !get) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' can only be used on getter(+setter) properties.\"));\n }\n}\n\nfunction createObservableAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$4,\n extend_: extend_$4,\n decorate_20223_: decorate_20223_$4\n };\n}\nfunction make_$4(adm, key, descriptor) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;\n}\nfunction extend_$4(adm, key, descriptor, proxyTrap) {\n var _this$options_$enhanc, _this$options_;\n assertObservableDescriptor(adm, this, key, descriptor);\n return adm.defineObservableProperty_(key, descriptor.value, (_this$options_$enhanc = (_this$options_ = this.options_) == null ? void 0 : _this$options_.enhancer) != null ? _this$options_$enhanc : deepEnhancer, proxyTrap);\n}\nfunction decorate_20223_$4(desc, context) {\n if (true) {\n if (context.kind === \"field\") {\n throw die(\"Please use `@observable accessor \" + String(context.name) + \"` instead of `@observable \" + String(context.name) + \"`\");\n }\n assert20223DecoratorType(context, [\"accessor\"]);\n }\n var ann = this;\n var kind = context.kind,\n name = context.name;\n // The laziness here is not ideal... It's a workaround to how 2022.3 Decorators are implemented:\n // `addInitializer` callbacks are executed _before_ any accessors are defined (instead of the ideal-for-us right after each).\n // This means that, if we were to do our stuff in an `addInitializer`, we'd attempt to read a private slot\n // before it has been initialized. The runtime doesn't like that and throws a `Cannot read private member\n // from an object whose class did not declare it` error.\n // TODO: it seems that this will not be required anymore in the final version of the spec\n // See TODO: link\n var initializedObjects = new WeakSet();\n function initializeObservable(target, value) {\n var _ann$options_$enhance, _ann$options_;\n var adm = asObservableObject(target)[$mobx];\n var observable = new ObservableValue(value, (_ann$options_$enhance = (_ann$options_ = ann.options_) == null ? void 0 : _ann$options_.enhancer) != null ? _ann$options_$enhance : deepEnhancer, true ? adm.name_ + \".\" + name.toString() : 0, false);\n adm.values_.set(name, observable);\n initializedObjects.add(target);\n }\n if (kind == \"accessor\") {\n return {\n get: function get() {\n if (!initializedObjects.has(this)) {\n initializeObservable(this, desc.get.call(this));\n }\n return this[$mobx].getObservablePropValue_(name);\n },\n set: function set(value) {\n if (!initializedObjects.has(this)) {\n initializeObservable(this, value);\n }\n return this[$mobx].setObservablePropValue_(name, value);\n },\n init: function init(value) {\n if (!initializedObjects.has(this)) {\n initializeObservable(this, value);\n }\n return value;\n }\n };\n }\n return;\n}\nfunction assertObservableDescriptor(adm, _ref, key, descriptor) {\n var annotationType_ = _ref.annotationType_;\n if ( true && !(\"value\" in descriptor)) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' cannot be used on getter/setter properties\"));\n }\n}\n\nvar AUTO = \"true\";\nvar autoAnnotation = /*#__PURE__*/createAutoAnnotation();\nfunction createAutoAnnotation(options) {\n return {\n annotationType_: AUTO,\n options_: options,\n make_: make_$5,\n extend_: extend_$5,\n decorate_20223_: decorate_20223_$5\n };\n}\nfunction make_$5(adm, key, descriptor, source) {\n var _this$options_3, _this$options_4;\n // getter -> computed\n if (descriptor.get) {\n return computed.make_(adm, key, descriptor, source);\n }\n // lone setter -> action setter\n if (descriptor.set) {\n // TODO make action applicable to setter and delegate to action.make_\n var set = createAction(key.toString(), descriptor.set);\n // own\n if (source === adm.target_) {\n return adm.defineProperty_(key, {\n configurable: globalState.safeDescriptors ? adm.isPlainObject_ : true,\n set: set\n }) === null ? 0 /* MakeResult.Cancel */ : 2 /* MakeResult.Continue */;\n }\n // proto\n defineProperty(source, key, {\n configurable: true,\n set: set\n });\n return 2 /* MakeResult.Continue */;\n }\n // function on proto -> autoAction/flow\n if (source !== adm.target_ && typeof descriptor.value === \"function\") {\n var _this$options_2;\n if (isGenerator(descriptor.value)) {\n var _this$options_;\n var flowAnnotation = (_this$options_ = this.options_) != null && _this$options_.autoBind ? flow.bound : flow;\n return flowAnnotation.make_(adm, key, descriptor, source);\n }\n var actionAnnotation = (_this$options_2 = this.options_) != null && _this$options_2.autoBind ? autoAction.bound : autoAction;\n return actionAnnotation.make_(adm, key, descriptor, source);\n }\n // other -> observable\n // Copy props from proto as well, see test:\n // \"decorate should work with Object.create\"\n var observableAnnotation = ((_this$options_3 = this.options_) == null ? void 0 : _this$options_3.deep) === false ? observable.ref : observable;\n // if function respect autoBind option\n if (typeof descriptor.value === \"function\" && (_this$options_4 = this.options_) != null && _this$options_4.autoBind) {\n var _adm$proxy_;\n descriptor.value = descriptor.value.bind((_adm$proxy_ = adm.proxy_) != null ? _adm$proxy_ : adm.target_);\n }\n return observableAnnotation.make_(adm, key, descriptor, source);\n}\nfunction extend_$5(adm, key, descriptor, proxyTrap) {\n var _this$options_5, _this$options_6;\n // getter -> computed\n if (descriptor.get) {\n return computed.extend_(adm, key, descriptor, proxyTrap);\n }\n // lone setter -> action setter\n if (descriptor.set) {\n // TODO make action applicable to setter and delegate to action.extend_\n return adm.defineProperty_(key, {\n configurable: globalState.safeDescriptors ? adm.isPlainObject_ : true,\n set: createAction(key.toString(), descriptor.set)\n }, proxyTrap);\n }\n // other -> observable\n // if function respect autoBind option\n if (typeof descriptor.value === \"function\" && (_this$options_5 = this.options_) != null && _this$options_5.autoBind) {\n var _adm$proxy_2;\n descriptor.value = descriptor.value.bind((_adm$proxy_2 = adm.proxy_) != null ? _adm$proxy_2 : adm.target_);\n }\n var observableAnnotation = ((_this$options_6 = this.options_) == null ? void 0 : _this$options_6.deep) === false ? observable.ref : observable;\n return observableAnnotation.extend_(adm, key, descriptor, proxyTrap);\n}\nfunction decorate_20223_$5(desc, context) {\n die(\"'\" + this.annotationType_ + \"' cannot be used as a decorator\");\n}\n\nvar OBSERVABLE = \"observable\";\nvar OBSERVABLE_REF = \"observable.ref\";\nvar OBSERVABLE_SHALLOW = \"observable.shallow\";\nvar OBSERVABLE_STRUCT = \"observable.struct\";\n// Predefined bags of create observable options, to avoid allocating temporarily option objects\n// in the majority of cases\nvar defaultCreateObservableOptions = {\n deep: true,\n name: undefined,\n defaultDecorator: undefined,\n proxy: true\n};\nObject.freeze(defaultCreateObservableOptions);\nfunction asCreateObservableOptions(thing) {\n return thing || defaultCreateObservableOptions;\n}\nvar observableAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE);\nvar observableRefAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE_REF, {\n enhancer: referenceEnhancer\n});\nvar observableShallowAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE_SHALLOW, {\n enhancer: shallowEnhancer\n});\nvar observableStructAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE_STRUCT, {\n enhancer: refStructEnhancer\n});\nvar observableDecoratorAnnotation = /*#__PURE__*/createDecoratorAnnotation(observableAnnotation);\nfunction getEnhancerFromOptions(options) {\n return options.deep === true ? deepEnhancer : options.deep === false ? referenceEnhancer : getEnhancerFromAnnotation(options.defaultDecorator);\n}\nfunction getAnnotationFromOptions(options) {\n var _options$defaultDecor;\n return options ? (_options$defaultDecor = options.defaultDecorator) != null ? _options$defaultDecor : createAutoAnnotation(options) : undefined;\n}\nfunction getEnhancerFromAnnotation(annotation) {\n var _annotation$options_$, _annotation$options_;\n return !annotation ? deepEnhancer : (_annotation$options_$ = (_annotation$options_ = annotation.options_) == null ? void 0 : _annotation$options_.enhancer) != null ? _annotation$options_$ : deepEnhancer;\n}\n/**\n * Turns an object, array or function into a reactive structure.\n * @param v the value which should become observable.\n */\nfunction createObservable(v, arg2, arg3) {\n // @observable someProp; (2022.3 Decorators)\n if (is20223Decorator(arg2)) {\n return observableAnnotation.decorate_20223_(v, arg2);\n }\n // @observable someProp;\n if (isStringish(arg2)) {\n storeAnnotation(v, arg2, observableAnnotation);\n return;\n }\n // already observable - ignore\n if (isObservable(v)) {\n return v;\n }\n // plain object\n if (isPlainObject(v)) {\n return observable.object(v, arg2, arg3);\n }\n // Array\n if (Array.isArray(v)) {\n return observable.array(v, arg2);\n }\n // Map\n if (isES6Map(v)) {\n return observable.map(v, arg2);\n }\n // Set\n if (isES6Set(v)) {\n return observable.set(v, arg2);\n }\n // other object - ignore\n if (typeof v === \"object\" && v !== null) {\n return v;\n }\n // anything else\n return observable.box(v, arg2);\n}\nassign(createObservable, observableDecoratorAnnotation);\nvar observableFactories = {\n box: function box(value, options) {\n var o = asCreateObservableOptions(options);\n return new ObservableValue(value, getEnhancerFromOptions(o), o.name, true, o.equals);\n },\n array: function array(initialValues, options) {\n var o = asCreateObservableOptions(options);\n return (globalState.useProxies === false || o.proxy === false ? createLegacyArray : createObservableArray)(initialValues, getEnhancerFromOptions(o), o.name);\n },\n map: function map(initialValues, options) {\n var o = asCreateObservableOptions(options);\n return new ObservableMap(initialValues, getEnhancerFromOptions(o), o.name);\n },\n set: function set(initialValues, options) {\n var o = asCreateObservableOptions(options);\n return new ObservableSet(initialValues, getEnhancerFromOptions(o), o.name);\n },\n object: function object(props, decorators, options) {\n return initObservable(function () {\n return extendObservable(globalState.useProxies === false || (options == null ? void 0 : options.proxy) === false ? asObservableObject({}, options) : asDynamicObservableObject({}, options), props, decorators);\n });\n },\n ref: /*#__PURE__*/createDecoratorAnnotation(observableRefAnnotation),\n shallow: /*#__PURE__*/createDecoratorAnnotation(observableShallowAnnotation),\n deep: observableDecoratorAnnotation,\n struct: /*#__PURE__*/createDecoratorAnnotation(observableStructAnnotation)\n};\n// eslint-disable-next-line\nvar observable = /*#__PURE__*/assign(createObservable, observableFactories);\n\nvar COMPUTED = \"computed\";\nvar COMPUTED_STRUCT = \"computed.struct\";\nvar computedAnnotation = /*#__PURE__*/createComputedAnnotation(COMPUTED);\nvar computedStructAnnotation = /*#__PURE__*/createComputedAnnotation(COMPUTED_STRUCT, {\n equals: comparer.structural\n});\n/**\n * Decorator for class properties: @computed get value() { return expr; }.\n * For legacy purposes also invokable as ES5 observable created: `computed(() => expr)`;\n */\nvar computed = function computed(arg1, arg2) {\n if (is20223Decorator(arg2)) {\n // @computed (2022.3 Decorators)\n return computedAnnotation.decorate_20223_(arg1, arg2);\n }\n if (isStringish(arg2)) {\n // @computed\n return storeAnnotation(arg1, arg2, computedAnnotation);\n }\n if (isPlainObject(arg1)) {\n // @computed({ options })\n return createDecoratorAnnotation(createComputedAnnotation(COMPUTED, arg1));\n }\n // computed(expr, options?)\n if (true) {\n if (!isFunction(arg1)) {\n die(\"First argument to `computed` should be an expression.\");\n }\n if (isFunction(arg2)) {\n die(\"A setter as second argument is no longer supported, use `{ set: fn }` option instead\");\n }\n }\n var opts = isPlainObject(arg2) ? arg2 : {};\n opts.get = arg1;\n opts.name || (opts.name = arg1.name || \"\"); /* for generated name */\n return new ComputedValue(opts);\n};\nObject.assign(computed, computedAnnotation);\ncomputed.struct = /*#__PURE__*/createDecoratorAnnotation(computedStructAnnotation);\n\nvar _getDescriptor$config, _getDescriptor;\n// we don't use globalState for these in order to avoid possible issues with multiple\n// mobx versions\nvar currentActionId = 0;\nvar nextActionId = 1;\nvar isFunctionNameConfigurable = (_getDescriptor$config = (_getDescriptor = /*#__PURE__*/getDescriptor(function () {}, \"name\")) == null ? void 0 : _getDescriptor.configurable) != null ? _getDescriptor$config : false;\n// we can safely recycle this object\nvar tmpNameDescriptor = {\n value: \"action\",\n configurable: true,\n writable: false,\n enumerable: false\n};\nfunction createAction(actionName, fn, autoAction, ref) {\n if (autoAction === void 0) {\n autoAction = false;\n }\n if (true) {\n if (!isFunction(fn)) {\n die(\"`action` can only be invoked on functions\");\n }\n if (typeof actionName !== \"string\" || !actionName) {\n die(\"actions should have valid names, got: '\" + actionName + \"'\");\n }\n }\n function res() {\n return executeAction(actionName, autoAction, fn, ref || this, arguments);\n }\n res.isMobxAction = true;\n res.toString = function () {\n return fn.toString();\n };\n if (isFunctionNameConfigurable) {\n tmpNameDescriptor.value = actionName;\n defineProperty(res, \"name\", tmpNameDescriptor);\n }\n return res;\n}\nfunction executeAction(actionName, canRunAsDerivation, fn, scope, args) {\n var runInfo = _startAction(actionName, canRunAsDerivation, scope, args);\n try {\n return fn.apply(scope, args);\n } catch (err) {\n runInfo.error_ = err;\n throw err;\n } finally {\n _endAction(runInfo);\n }\n}\nfunction _startAction(actionName, canRunAsDerivation,\n// true for autoAction\nscope, args) {\n var notifySpy_ = true && isSpyEnabled() && !!actionName;\n var startTime_ = 0;\n if ( true && notifySpy_) {\n startTime_ = Date.now();\n var flattenedArgs = args ? Array.from(args) : EMPTY_ARRAY;\n spyReportStart({\n type: ACTION,\n name: actionName,\n object: scope,\n arguments: flattenedArgs\n });\n }\n var prevDerivation_ = globalState.trackingDerivation;\n var runAsAction = !canRunAsDerivation || !prevDerivation_;\n startBatch();\n var prevAllowStateChanges_ = globalState.allowStateChanges; // by default preserve previous allow\n if (runAsAction) {\n untrackedStart();\n prevAllowStateChanges_ = allowStateChangesStart(true);\n }\n var prevAllowStateReads_ = allowStateReadsStart(true);\n var runInfo = {\n runAsAction_: runAsAction,\n prevDerivation_: prevDerivation_,\n prevAllowStateChanges_: prevAllowStateChanges_,\n prevAllowStateReads_: prevAllowStateReads_,\n notifySpy_: notifySpy_,\n startTime_: startTime_,\n actionId_: nextActionId++,\n parentActionId_: currentActionId\n };\n currentActionId = runInfo.actionId_;\n return runInfo;\n}\nfunction _endAction(runInfo) {\n if (currentActionId !== runInfo.actionId_) {\n die(30);\n }\n currentActionId = runInfo.parentActionId_;\n if (runInfo.error_ !== undefined) {\n globalState.suppressReactionErrors = true;\n }\n allowStateChangesEnd(runInfo.prevAllowStateChanges_);\n allowStateReadsEnd(runInfo.prevAllowStateReads_);\n endBatch();\n if (runInfo.runAsAction_) {\n untrackedEnd(runInfo.prevDerivation_);\n }\n if ( true && runInfo.notifySpy_) {\n spyReportEnd({\n time: Date.now() - runInfo.startTime_\n });\n }\n globalState.suppressReactionErrors = false;\n}\nfunction allowStateChanges(allowStateChanges, func) {\n var prev = allowStateChangesStart(allowStateChanges);\n try {\n return func();\n } finally {\n allowStateChangesEnd(prev);\n }\n}\nfunction allowStateChangesStart(allowStateChanges) {\n var prev = globalState.allowStateChanges;\n globalState.allowStateChanges = allowStateChanges;\n return prev;\n}\nfunction allowStateChangesEnd(prev) {\n globalState.allowStateChanges = prev;\n}\n\nvar CREATE = \"create\";\nvar ObservableValue = /*#__PURE__*/function (_Atom) {\n function ObservableValue(value, enhancer, name_, notifySpy, equals) {\n var _this;\n if (name_ === void 0) {\n name_ = true ? \"ObservableValue@\" + getNextId() : 0;\n }\n if (notifySpy === void 0) {\n notifySpy = true;\n }\n if (equals === void 0) {\n equals = comparer[\"default\"];\n }\n _this = _Atom.call(this, name_) || this;\n _this.enhancer = void 0;\n _this.name_ = void 0;\n _this.equals = void 0;\n _this.hasUnreportedChange_ = false;\n _this.interceptors_ = void 0;\n _this.changeListeners_ = void 0;\n _this.value_ = void 0;\n _this.dehancer = void 0;\n _this.enhancer = enhancer;\n _this.name_ = name_;\n _this.equals = equals;\n _this.value_ = enhancer(value, undefined, name_);\n if ( true && notifySpy && isSpyEnabled()) {\n // only notify spy if this is a stand-alone observable\n spyReport({\n type: CREATE,\n object: _this,\n observableKind: \"value\",\n debugObjectName: _this.name_,\n newValue: \"\" + _this.value_\n });\n }\n return _this;\n }\n _inheritsLoose(ObservableValue, _Atom);\n var _proto = ObservableValue.prototype;\n _proto.dehanceValue = function dehanceValue(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.set = function set(newValue) {\n var oldValue = this.value_;\n newValue = this.prepareNewValue_(newValue);\n if (newValue !== globalState.UNCHANGED) {\n var notifySpy = isSpyEnabled();\n if ( true && notifySpy) {\n spyReportStart({\n type: UPDATE,\n object: this,\n observableKind: \"value\",\n debugObjectName: this.name_,\n newValue: newValue,\n oldValue: oldValue\n });\n }\n this.setNewValue_(newValue);\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n };\n _proto.prepareNewValue_ = function prepareNewValue_(newValue) {\n checkIfStateModificationsAreAllowed(this);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this,\n type: UPDATE,\n newValue: newValue\n });\n if (!change) {\n return globalState.UNCHANGED;\n }\n newValue = change.newValue;\n }\n // apply modifier\n newValue = this.enhancer(newValue, this.value_, this.name_);\n return this.equals(this.value_, newValue) ? globalState.UNCHANGED : newValue;\n };\n _proto.setNewValue_ = function setNewValue_(newValue) {\n var oldValue = this.value_;\n this.value_ = newValue;\n this.reportChanged();\n if (hasListeners(this)) {\n notifyListeners(this, {\n type: UPDATE,\n object: this,\n newValue: newValue,\n oldValue: oldValue\n });\n }\n };\n _proto.get = function get() {\n this.reportObserved();\n return this.dehanceValue(this.value_);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n if (fireImmediately) {\n listener({\n observableKind: \"value\",\n debugObjectName: this.name_,\n object: this,\n type: UPDATE,\n newValue: this.value_,\n oldValue: undefined\n });\n }\n return registerListener(this, listener);\n };\n _proto.raw = function raw() {\n // used by MST ot get undehanced value\n return this.value_;\n };\n _proto.toJSON = function toJSON() {\n return this.get();\n };\n _proto.toString = function toString() {\n return this.name_ + \"[\" + this.value_ + \"]\";\n };\n _proto.valueOf = function valueOf() {\n return toPrimitive(this.get());\n };\n _proto[Symbol.toPrimitive] = function () {\n return this.valueOf();\n };\n return ObservableValue;\n}(Atom);\nvar isObservableValue = /*#__PURE__*/createInstanceofPredicate(\"ObservableValue\", ObservableValue);\n\n/**\n * A node in the state dependency root that observes other nodes, and can be observed itself.\n *\n * ComputedValue will remember the result of the computation for the duration of the batch, or\n * while being observed.\n *\n * During this time it will recompute only when one of its direct dependencies changed,\n * but only when it is being accessed with `ComputedValue.get()`.\n *\n * Implementation description:\n * 1. First time it's being accessed it will compute and remember result\n * give back remembered result until 2. happens\n * 2. First time any deep dependency change, propagate POSSIBLY_STALE to all observers, wait for 3.\n * 3. When it's being accessed, recompute if any shallow dependency changed.\n * if result changed: propagate STALE to all observers, that were POSSIBLY_STALE from the last step.\n * go to step 2. either way\n *\n * If at any point it's outside batch and it isn't observed: reset everything and go to 1.\n */\nvar ComputedValue = /*#__PURE__*/function () {\n /**\n * Create a new computed value based on a function expression.\n *\n * The `name` property is for debug purposes only.\n *\n * The `equals` property specifies the comparer function to use to determine if a newly produced\n * value differs from the previous value. Two comparers are provided in the library; `defaultComparer`\n * compares based on identity comparison (===), and `structuralComparer` deeply compares the structure.\n * Structural comparison can be convenient if you always produce a new aggregated object and\n * don't want to notify observers if it is structurally the same.\n * This is useful for working with vectors, mouse coordinates etc.\n */\n function ComputedValue(options) {\n this.dependenciesState_ = IDerivationState_.NOT_TRACKING_;\n this.observing_ = [];\n // nodes we are looking at. Our value depends on these nodes\n this.newObserving_ = null;\n // during tracking it's an array with new observed observers\n this.observers_ = new Set();\n this.runId_ = 0;\n this.lastAccessedBy_ = 0;\n this.lowestObserverState_ = IDerivationState_.UP_TO_DATE_;\n this.unboundDepsCount_ = 0;\n this.value_ = new CaughtException(null);\n this.name_ = void 0;\n this.triggeredBy_ = void 0;\n this.flags_ = 0;\n this.derivation = void 0;\n // N.B: unminified as it is used by MST\n this.setter_ = void 0;\n this.isTracing_ = TraceMode.NONE;\n this.scope_ = void 0;\n this.equals_ = void 0;\n this.requiresReaction_ = void 0;\n this.keepAlive_ = void 0;\n this.onBOL = void 0;\n this.onBUOL = void 0;\n if (!options.get) {\n die(31);\n }\n this.derivation = options.get;\n this.name_ = options.name || ( true ? \"ComputedValue@\" + getNextId() : 0);\n if (options.set) {\n this.setter_ = createAction( true ? this.name_ + \"-setter\" : 0, options.set);\n }\n this.equals_ = options.equals || (options.compareStructural || options.struct ? comparer.structural : comparer[\"default\"]);\n this.scope_ = options.context;\n this.requiresReaction_ = options.requiresReaction;\n this.keepAlive_ = !!options.keepAlive;\n }\n var _proto = ComputedValue.prototype;\n _proto.onBecomeStale_ = function onBecomeStale_() {\n propagateMaybeChanged(this);\n };\n _proto.onBO = function onBO() {\n if (this.onBOL) {\n this.onBOL.forEach(function (listener) {\n return listener();\n });\n }\n };\n _proto.onBUO = function onBUO() {\n if (this.onBUOL) {\n this.onBUOL.forEach(function (listener) {\n return listener();\n });\n }\n }\n // to check for cycles\n ;\n /**\n * Returns the current value of this computed value.\n * Will evaluate its computation first if needed.\n */\n _proto.get = function get() {\n if (this.isComputing) {\n die(32, this.name_, this.derivation);\n }\n if (globalState.inBatch === 0 &&\n // !globalState.trackingDerivatpion &&\n this.observers_.size === 0 && !this.keepAlive_) {\n if (shouldCompute(this)) {\n this.warnAboutUntrackedRead_();\n startBatch(); // See perf test 'computed memoization'\n this.value_ = this.computeValue_(false);\n endBatch();\n }\n } else {\n reportObserved(this);\n if (shouldCompute(this)) {\n var prevTrackingContext = globalState.trackingContext;\n if (this.keepAlive_ && !prevTrackingContext) {\n globalState.trackingContext = this;\n }\n if (this.trackAndCompute()) {\n propagateChangeConfirmed(this);\n }\n globalState.trackingContext = prevTrackingContext;\n }\n }\n var result = this.value_;\n if (isCaughtException(result)) {\n throw result.cause;\n }\n return result;\n };\n _proto.set = function set(value) {\n if (this.setter_) {\n if (this.isRunningSetter) {\n die(33, this.name_);\n }\n this.isRunningSetter = true;\n try {\n this.setter_.call(this.scope_, value);\n } finally {\n this.isRunningSetter = false;\n }\n } else {\n die(34, this.name_);\n }\n };\n _proto.trackAndCompute = function trackAndCompute() {\n // N.B: unminified as it is used by MST\n var oldValue = this.value_;\n var wasSuspended = /* see #1208 */this.dependenciesState_ === IDerivationState_.NOT_TRACKING_;\n var newValue = this.computeValue_(true);\n var changed = wasSuspended || isCaughtException(oldValue) || isCaughtException(newValue) || !this.equals_(oldValue, newValue);\n if (changed) {\n this.value_ = newValue;\n if ( true && isSpyEnabled()) {\n spyReport({\n observableKind: \"computed\",\n debugObjectName: this.name_,\n object: this.scope_,\n type: \"update\",\n oldValue: oldValue,\n newValue: newValue\n });\n }\n }\n return changed;\n };\n _proto.computeValue_ = function computeValue_(track) {\n this.isComputing = true;\n // don't allow state changes during computation\n var prev = allowStateChangesStart(false);\n var res;\n if (track) {\n res = trackDerivedFunction(this, this.derivation, this.scope_);\n } else {\n if (globalState.disableErrorBoundaries === true) {\n res = this.derivation.call(this.scope_);\n } else {\n try {\n res = this.derivation.call(this.scope_);\n } catch (e) {\n res = new CaughtException(e);\n }\n }\n }\n allowStateChangesEnd(prev);\n this.isComputing = false;\n return res;\n };\n _proto.suspend_ = function suspend_() {\n if (!this.keepAlive_) {\n clearObserving(this);\n this.value_ = undefined; // don't hold on to computed value!\n if ( true && this.isTracing_ !== TraceMode.NONE) {\n console.log(\"[mobx.trace] Computed value '\" + this.name_ + \"' was suspended and it will recompute on the next access.\");\n }\n }\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n var _this = this;\n var firstTime = true;\n var prevValue = undefined;\n return autorun(function () {\n // TODO: why is this in a different place than the spyReport() function? in all other observables it's called in the same place\n var newValue = _this.get();\n if (!firstTime || fireImmediately) {\n var prevU = untrackedStart();\n listener({\n observableKind: \"computed\",\n debugObjectName: _this.name_,\n type: UPDATE,\n object: _this,\n newValue: newValue,\n oldValue: prevValue\n });\n untrackedEnd(prevU);\n }\n firstTime = false;\n prevValue = newValue;\n });\n };\n _proto.warnAboutUntrackedRead_ = function warnAboutUntrackedRead_() {\n if (false) {}\n if (this.isTracing_ !== TraceMode.NONE) {\n console.log(\"[mobx.trace] Computed value '\" + this.name_ + \"' is being read outside a reactive context. Doing a full recompute.\");\n }\n if (typeof this.requiresReaction_ === \"boolean\" ? this.requiresReaction_ : globalState.computedRequiresReaction) {\n console.warn(\"[mobx] Computed value '\" + this.name_ + \"' is being read outside a reactive context. Doing a full recompute.\");\n }\n };\n _proto.toString = function toString() {\n return this.name_ + \"[\" + this.derivation.toString() + \"]\";\n };\n _proto.valueOf = function valueOf() {\n return toPrimitive(this.get());\n };\n _proto[Symbol.toPrimitive] = function () {\n return this.valueOf();\n };\n return _createClass(ComputedValue, [{\n key: \"isComputing\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isComputingMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isComputingMask_, newValue);\n }\n }, {\n key: \"isRunningSetter\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isRunningSetterMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isRunningSetterMask_, newValue);\n }\n }, {\n key: \"isBeingObserved\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isBeingObservedMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isBeingObservedMask_, newValue);\n }\n }, {\n key: \"isPendingUnobservation\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isPendingUnobservationMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isPendingUnobservationMask_, newValue);\n }\n }, {\n key: \"diffValue\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.diffValueMask_) ? 1 : 0;\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.diffValueMask_, newValue === 1 ? true : false);\n }\n }]);\n}();\nComputedValue.isComputingMask_ = 1;\nComputedValue.isRunningSetterMask_ = 2;\nComputedValue.isBeingObservedMask_ = 4;\nComputedValue.isPendingUnobservationMask_ = 8;\nComputedValue.diffValueMask_ = 16;\nvar isComputedValue = /*#__PURE__*/createInstanceofPredicate(\"ComputedValue\", ComputedValue);\n\nvar IDerivationState_;\n(function (IDerivationState_) {\n // before being run or (outside batch and not being observed)\n // at this point derivation is not holding any data about dependency tree\n IDerivationState_[IDerivationState_[\"NOT_TRACKING_\"] = -1] = \"NOT_TRACKING_\";\n // no shallow dependency changed since last computation\n // won't recalculate derivation\n // this is what makes mobx fast\n IDerivationState_[IDerivationState_[\"UP_TO_DATE_\"] = 0] = \"UP_TO_DATE_\";\n // some deep dependency changed, but don't know if shallow dependency changed\n // will require to check first if UP_TO_DATE or POSSIBLY_STALE\n // currently only ComputedValue will propagate POSSIBLY_STALE\n //\n // having this state is second big optimization:\n // don't have to recompute on every dependency change, but only when it's needed\n IDerivationState_[IDerivationState_[\"POSSIBLY_STALE_\"] = 1] = \"POSSIBLY_STALE_\";\n // A shallow dependency has changed since last computation and the derivation\n // will need to recompute when it's needed next.\n IDerivationState_[IDerivationState_[\"STALE_\"] = 2] = \"STALE_\";\n})(IDerivationState_ || (IDerivationState_ = {}));\nvar TraceMode;\n(function (TraceMode) {\n TraceMode[TraceMode[\"NONE\"] = 0] = \"NONE\";\n TraceMode[TraceMode[\"LOG\"] = 1] = \"LOG\";\n TraceMode[TraceMode[\"BREAK\"] = 2] = \"BREAK\";\n})(TraceMode || (TraceMode = {}));\nvar CaughtException = function CaughtException(cause) {\n this.cause = void 0;\n this.cause = cause;\n // Empty\n};\nfunction isCaughtException(e) {\n return e instanceof CaughtException;\n}\n/**\n * Finds out whether any dependency of the derivation has actually changed.\n * If dependenciesState is 1 then it will recalculate dependencies,\n * if any dependency changed it will propagate it by changing dependenciesState to 2.\n *\n * By iterating over the dependencies in the same order that they were reported and\n * stopping on the first change, all the recalculations are only called for ComputedValues\n * that will be tracked by derivation. That is because we assume that if the first x\n * dependencies of the derivation doesn't change then the derivation should run the same way\n * up until accessing x-th dependency.\n */\nfunction shouldCompute(derivation) {\n switch (derivation.dependenciesState_) {\n case IDerivationState_.UP_TO_DATE_:\n return false;\n case IDerivationState_.NOT_TRACKING_:\n case IDerivationState_.STALE_:\n return true;\n case IDerivationState_.POSSIBLY_STALE_:\n {\n // state propagation can occur outside of action/reactive context #2195\n var prevAllowStateReads = allowStateReadsStart(true);\n var prevUntracked = untrackedStart(); // no need for those computeds to be reported, they will be picked up in trackDerivedFunction.\n var obs = derivation.observing_,\n l = obs.length;\n for (var i = 0; i < l; i++) {\n var obj = obs[i];\n if (isComputedValue(obj)) {\n if (globalState.disableErrorBoundaries) {\n obj.get();\n } else {\n try {\n obj.get();\n } catch (e) {\n // we are not interested in the value *or* exception at this moment, but if there is one, notify all\n untrackedEnd(prevUntracked);\n allowStateReadsEnd(prevAllowStateReads);\n return true;\n }\n }\n // if ComputedValue `obj` actually changed it will be computed and propagated to its observers.\n // and `derivation` is an observer of `obj`\n // invariantShouldCompute(derivation)\n if (derivation.dependenciesState_ === IDerivationState_.STALE_) {\n untrackedEnd(prevUntracked);\n allowStateReadsEnd(prevAllowStateReads);\n return true;\n }\n }\n }\n changeDependenciesStateTo0(derivation);\n untrackedEnd(prevUntracked);\n allowStateReadsEnd(prevAllowStateReads);\n return false;\n }\n }\n}\nfunction isComputingDerivation() {\n return globalState.trackingDerivation !== null; // filter out actions inside computations\n}\nfunction checkIfStateModificationsAreAllowed(atom) {\n if (false) {}\n var hasObservers = atom.observers_.size > 0;\n // Should not be possible to change observed state outside strict mode, except during initialization, see #563\n if (!globalState.allowStateChanges && (hasObservers || globalState.enforceActions === \"always\")) {\n console.warn(\"[MobX] \" + (globalState.enforceActions ? \"Since strict-mode is enabled, changing (observed) observable values without using an action is not allowed. Tried to modify: \" : \"Side effects like changing state are not allowed at this point. Are you trying to modify state from, for example, a computed value or the render function of a React component? You can wrap side effects in 'runInAction' (or decorate functions with 'action') if needed. Tried to modify: \") + atom.name_);\n }\n}\nfunction checkIfStateReadsAreAllowed(observable) {\n if ( true && !globalState.allowStateReads && globalState.observableRequiresReaction) {\n console.warn(\"[mobx] Observable '\" + observable.name_ + \"' being read outside a reactive context.\");\n }\n}\n/**\n * Executes the provided function `f` and tracks which observables are being accessed.\n * The tracking information is stored on the `derivation` object and the derivation is registered\n * as observer of any of the accessed observables.\n */\nfunction trackDerivedFunction(derivation, f, context) {\n var prevAllowStateReads = allowStateReadsStart(true);\n changeDependenciesStateTo0(derivation);\n // Preallocate array; will be trimmed by bindDependencies.\n derivation.newObserving_ = new Array(\n // Reserve constant space for initial dependencies, dynamic space otherwise.\n // See https://github.com/mobxjs/mobx/pull/3833\n derivation.runId_ === 0 ? 100 : derivation.observing_.length);\n derivation.unboundDepsCount_ = 0;\n derivation.runId_ = ++globalState.runId;\n var prevTracking = globalState.trackingDerivation;\n globalState.trackingDerivation = derivation;\n globalState.inBatch++;\n var result;\n if (globalState.disableErrorBoundaries === true) {\n result = f.call(context);\n } else {\n try {\n result = f.call(context);\n } catch (e) {\n result = new CaughtException(e);\n }\n }\n globalState.inBatch--;\n globalState.trackingDerivation = prevTracking;\n bindDependencies(derivation);\n warnAboutDerivationWithoutDependencies(derivation);\n allowStateReadsEnd(prevAllowStateReads);\n return result;\n}\nfunction warnAboutDerivationWithoutDependencies(derivation) {\n if (false) {}\n if (derivation.observing_.length !== 0) {\n return;\n }\n if (typeof derivation.requiresObservable_ === \"boolean\" ? derivation.requiresObservable_ : globalState.reactionRequiresObservable) {\n console.warn(\"[mobx] Derivation '\" + derivation.name_ + \"' is created/updated without reading any observable value.\");\n }\n}\n/**\n * diffs newObserving with observing.\n * update observing to be newObserving with unique observables\n * notify observers that become observed/unobserved\n */\nfunction bindDependencies(derivation) {\n // invariant(derivation.dependenciesState !== IDerivationState.NOT_TRACKING, \"INTERNAL ERROR bindDependencies expects derivation.dependenciesState !== -1\");\n var prevObserving = derivation.observing_;\n var observing = derivation.observing_ = derivation.newObserving_;\n var lowestNewObservingDerivationState = IDerivationState_.UP_TO_DATE_;\n // Go through all new observables and check diffValue: (this list can contain duplicates):\n // 0: first occurrence, change to 1 and keep it\n // 1: extra occurrence, drop it\n var i0 = 0,\n l = derivation.unboundDepsCount_;\n for (var i = 0; i < l; i++) {\n var dep = observing[i];\n if (dep.diffValue === 0) {\n dep.diffValue = 1;\n if (i0 !== i) {\n observing[i0] = dep;\n }\n i0++;\n }\n // Upcast is 'safe' here, because if dep is IObservable, `dependenciesState` will be undefined,\n // not hitting the condition\n if (dep.dependenciesState_ > lowestNewObservingDerivationState) {\n lowestNewObservingDerivationState = dep.dependenciesState_;\n }\n }\n observing.length = i0;\n derivation.newObserving_ = null; // newObserving shouldn't be needed outside tracking (statement moved down to work around FF bug, see #614)\n // Go through all old observables and check diffValue: (it is unique after last bindDependencies)\n // 0: it's not in new observables, unobserve it\n // 1: it keeps being observed, don't want to notify it. change to 0\n l = prevObserving.length;\n while (l--) {\n var _dep = prevObserving[l];\n if (_dep.diffValue === 0) {\n removeObserver(_dep, derivation);\n }\n _dep.diffValue = 0;\n }\n // Go through all new observables and check diffValue: (now it should be unique)\n // 0: it was set to 0 in last loop. don't need to do anything.\n // 1: it wasn't observed, let's observe it. set back to 0\n while (i0--) {\n var _dep2 = observing[i0];\n if (_dep2.diffValue === 1) {\n _dep2.diffValue = 0;\n addObserver(_dep2, derivation);\n }\n }\n // Some new observed derivations may become stale during this derivation computation\n // so they have had no chance to propagate staleness (#916)\n if (lowestNewObservingDerivationState !== IDerivationState_.UP_TO_DATE_) {\n derivation.dependenciesState_ = lowestNewObservingDerivationState;\n derivation.onBecomeStale_();\n }\n}\nfunction clearObserving(derivation) {\n // invariant(globalState.inBatch > 0, \"INTERNAL ERROR clearObserving should be called only inside batch\");\n var obs = derivation.observing_;\n derivation.observing_ = [];\n var i = obs.length;\n while (i--) {\n removeObserver(obs[i], derivation);\n }\n derivation.dependenciesState_ = IDerivationState_.NOT_TRACKING_;\n}\nfunction untracked(action) {\n var prev = untrackedStart();\n try {\n return action();\n } finally {\n untrackedEnd(prev);\n }\n}\nfunction untrackedStart() {\n var prev = globalState.trackingDerivation;\n globalState.trackingDerivation = null;\n return prev;\n}\nfunction untrackedEnd(prev) {\n globalState.trackingDerivation = prev;\n}\nfunction allowStateReadsStart(allowStateReads) {\n var prev = globalState.allowStateReads;\n globalState.allowStateReads = allowStateReads;\n return prev;\n}\nfunction allowStateReadsEnd(prev) {\n globalState.allowStateReads = prev;\n}\n/**\n * needed to keep `lowestObserverState` correct. when changing from (2 or 1) to 0\n *\n */\nfunction changeDependenciesStateTo0(derivation) {\n if (derivation.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {\n return;\n }\n derivation.dependenciesState_ = IDerivationState_.UP_TO_DATE_;\n var obs = derivation.observing_;\n var i = obs.length;\n while (i--) {\n obs[i].lowestObserverState_ = IDerivationState_.UP_TO_DATE_;\n }\n}\n\n/**\n * These values will persist if global state is reset\n */\nvar persistentKeys = [\"mobxGuid\", \"spyListeners\", \"enforceActions\", \"computedRequiresReaction\", \"reactionRequiresObservable\", \"observableRequiresReaction\", \"allowStateReads\", \"disableErrorBoundaries\", \"runId\", \"UNCHANGED\", \"useProxies\"];\nvar MobXGlobals = function MobXGlobals() {\n /**\n * MobXGlobals version.\n * MobX compatiblity with other versions loaded in memory as long as this version matches.\n * It indicates that the global state still stores similar information\n *\n * N.B: this version is unrelated to the package version of MobX, and is only the version of the\n * internal state storage of MobX, and can be the same across many different package versions\n */\n this.version = 6;\n /**\n * globally unique token to signal unchanged\n */\n this.UNCHANGED = {};\n /**\n * Currently running derivation\n */\n this.trackingDerivation = null;\n /**\n * Currently running reaction. This determines if we currently have a reactive context.\n * (Tracking derivation is also set for temporal tracking of computed values inside actions,\n * but trackingReaction can only be set by a form of Reaction)\n */\n this.trackingContext = null;\n /**\n * Each time a derivation is tracked, it is assigned a unique run-id\n */\n this.runId = 0;\n /**\n * 'guid' for general purpose. Will be persisted amongst resets.\n */\n this.mobxGuid = 0;\n /**\n * Are we in a batch block? (and how many of them)\n */\n this.inBatch = 0;\n /**\n * Observables that don't have observers anymore, and are about to be\n * suspended, unless somebody else accesses it in the same batch\n *\n * @type {IObservable[]}\n */\n this.pendingUnobservations = [];\n /**\n * List of scheduled, not yet executed, reactions.\n */\n this.pendingReactions = [];\n /**\n * Are we currently processing reactions?\n */\n this.isRunningReactions = false;\n /**\n * Is it allowed to change observables at this point?\n * In general, MobX doesn't allow that when running computations and React.render.\n * To ensure that those functions stay pure.\n */\n this.allowStateChanges = false;\n /**\n * Is it allowed to read observables at this point?\n * Used to hold the state needed for `observableRequiresReaction`\n */\n this.allowStateReads = true;\n /**\n * If strict mode is enabled, state changes are by default not allowed\n */\n this.enforceActions = true;\n /**\n * Spy callbacks\n */\n this.spyListeners = [];\n /**\n * Globally attached error handlers that react specifically to errors in reactions\n */\n this.globalReactionErrorHandlers = [];\n /**\n * Warn if computed values are accessed outside a reactive context\n */\n this.computedRequiresReaction = false;\n /**\n * (Experimental)\n * Warn if you try to create to derivation / reactive context without accessing any observable.\n */\n this.reactionRequiresObservable = false;\n /**\n * (Experimental)\n * Warn if observables are accessed outside a reactive context\n */\n this.observableRequiresReaction = false;\n /*\n * Don't catch and rethrow exceptions. This is useful for inspecting the state of\n * the stack when an exception occurs while debugging.\n */\n this.disableErrorBoundaries = false;\n /*\n * If true, we are already handling an exception in an action. Any errors in reactions should be suppressed, as\n * they are not the cause, see: https://github.com/mobxjs/mobx/issues/1836\n */\n this.suppressReactionErrors = false;\n this.useProxies = true;\n /*\n * print warnings about code that would fail if proxies weren't available\n */\n this.verifyProxies = false;\n /**\n * False forces all object's descriptors to\n * writable: true\n * configurable: true\n */\n this.safeDescriptors = true;\n};\nvar canMergeGlobalState = true;\nvar isolateCalled = false;\nvar globalState = /*#__PURE__*/function () {\n var global = /*#__PURE__*/getGlobal();\n if (global.__mobxInstanceCount > 0 && !global.__mobxGlobals) {\n canMergeGlobalState = false;\n }\n if (global.__mobxGlobals && global.__mobxGlobals.version !== new MobXGlobals().version) {\n canMergeGlobalState = false;\n }\n if (!canMergeGlobalState) {\n // Because this is a IIFE we need to let isolateCalled a chance to change\n // so we run it after the event loop completed at least 1 iteration\n setTimeout(function () {\n if (!isolateCalled) {\n die(35);\n }\n }, 1);\n return new MobXGlobals();\n } else if (global.__mobxGlobals) {\n global.__mobxInstanceCount += 1;\n if (!global.__mobxGlobals.UNCHANGED) {\n global.__mobxGlobals.UNCHANGED = {};\n } // make merge backward compatible\n return global.__mobxGlobals;\n } else {\n global.__mobxInstanceCount = 1;\n return global.__mobxGlobals = /*#__PURE__*/new MobXGlobals();\n }\n}();\nfunction isolateGlobalState() {\n if (globalState.pendingReactions.length || globalState.inBatch || globalState.isRunningReactions) {\n die(36);\n }\n isolateCalled = true;\n if (canMergeGlobalState) {\n var global = getGlobal();\n if (--global.__mobxInstanceCount === 0) {\n global.__mobxGlobals = undefined;\n }\n globalState = new MobXGlobals();\n }\n}\nfunction getGlobalState() {\n return globalState;\n}\n/**\n * For testing purposes only; this will break the internal state of existing observables,\n * but can be used to get back at a stable state after throwing errors\n */\nfunction resetGlobalState() {\n var defaultGlobals = new MobXGlobals();\n for (var key in defaultGlobals) {\n if (persistentKeys.indexOf(key) === -1) {\n globalState[key] = defaultGlobals[key];\n }\n }\n globalState.allowStateChanges = !globalState.enforceActions;\n}\n\nfunction hasObservers(observable) {\n return observable.observers_ && observable.observers_.size > 0;\n}\nfunction getObservers(observable) {\n return observable.observers_;\n}\n// function invariantObservers(observable: IObservable) {\n// const list = observable.observers\n// const map = observable.observersIndexes\n// const l = list.length\n// for (let i = 0; i < l; i++) {\n// const id = list[i].__mapid\n// if (i) {\n// invariant(map[id] === i, \"INTERNAL ERROR maps derivation.__mapid to index in list\") // for performance\n// } else {\n// invariant(!(id in map), \"INTERNAL ERROR observer on index 0 shouldn't be held in map.\") // for performance\n// }\n// }\n// invariant(\n// list.length === 0 || Object.keys(map).length === list.length - 1,\n// \"INTERNAL ERROR there is no junk in map\"\n// )\n// }\nfunction addObserver(observable, node) {\n // invariant(node.dependenciesState !== -1, \"INTERNAL ERROR, can add only dependenciesState !== -1\");\n // invariant(observable._observers.indexOf(node) === -1, \"INTERNAL ERROR add already added node\");\n // invariantObservers(observable);\n observable.observers_.add(node);\n if (observable.lowestObserverState_ > node.dependenciesState_) {\n observable.lowestObserverState_ = node.dependenciesState_;\n }\n // invariantObservers(observable);\n // invariant(observable._observers.indexOf(node) !== -1, \"INTERNAL ERROR didn't add node\");\n}\nfunction removeObserver(observable, node) {\n // invariant(globalState.inBatch > 0, \"INTERNAL ERROR, remove should be called only inside batch\");\n // invariant(observable._observers.indexOf(node) !== -1, \"INTERNAL ERROR remove already removed node\");\n // invariantObservers(observable);\n observable.observers_[\"delete\"](node);\n if (observable.observers_.size === 0) {\n // deleting last observer\n queueForUnobservation(observable);\n }\n // invariantObservers(observable);\n // invariant(observable._observers.indexOf(node) === -1, \"INTERNAL ERROR remove already removed node2\");\n}\nfunction queueForUnobservation(observable) {\n if (observable.isPendingUnobservation === false) {\n // invariant(observable._observers.length === 0, \"INTERNAL ERROR, should only queue for unobservation unobserved observables\");\n observable.isPendingUnobservation = true;\n globalState.pendingUnobservations.push(observable);\n }\n}\n/**\n * Batch starts a transaction, at least for purposes of memoizing ComputedValues when nothing else does.\n * During a batch `onBecomeUnobserved` will be called at most once per observable.\n * Avoids unnecessary recalculations.\n */\nfunction startBatch() {\n globalState.inBatch++;\n}\nfunction endBatch() {\n if (--globalState.inBatch === 0) {\n runReactions();\n // the batch is actually about to finish, all unobserving should happen here.\n var list = globalState.pendingUnobservations;\n for (var i = 0; i < list.length; i++) {\n var observable = list[i];\n observable.isPendingUnobservation = false;\n if (observable.observers_.size === 0) {\n if (observable.isBeingObserved) {\n // if this observable had reactive observers, trigger the hooks\n observable.isBeingObserved = false;\n observable.onBUO();\n }\n if (observable instanceof ComputedValue) {\n // computed values are automatically teared down when the last observer leaves\n // this process happens recursively, this computed might be the last observabe of another, etc..\n observable.suspend_();\n }\n }\n }\n globalState.pendingUnobservations = [];\n }\n}\nfunction reportObserved(observable) {\n checkIfStateReadsAreAllowed(observable);\n var derivation = globalState.trackingDerivation;\n if (derivation !== null) {\n /**\n * Simple optimization, give each derivation run an unique id (runId)\n * Check if last time this observable was accessed the same runId is used\n * if this is the case, the relation is already known\n */\n if (derivation.runId_ !== observable.lastAccessedBy_) {\n observable.lastAccessedBy_ = derivation.runId_;\n // Tried storing newObserving, or observing, or both as Set, but performance didn't come close...\n derivation.newObserving_[derivation.unboundDepsCount_++] = observable;\n if (!observable.isBeingObserved && globalState.trackingContext) {\n observable.isBeingObserved = true;\n observable.onBO();\n }\n }\n return observable.isBeingObserved;\n } else if (observable.observers_.size === 0 && globalState.inBatch > 0) {\n queueForUnobservation(observable);\n }\n return false;\n}\n// function invariantLOS(observable: IObservable, msg: string) {\n// // it's expensive so better not run it in produciton. but temporarily helpful for testing\n// const min = getObservers(observable).reduce((a, b) => Math.min(a, b.dependenciesState), 2)\n// if (min >= observable.lowestObserverState) return // <- the only assumption about `lowestObserverState`\n// throw new Error(\n// \"lowestObserverState is wrong for \" +\n// msg +\n// \" because \" +\n// min +\n// \" < \" +\n// observable.lowestObserverState\n// )\n// }\n/**\n * NOTE: current propagation mechanism will in case of self reruning autoruns behave unexpectedly\n * It will propagate changes to observers from previous run\n * It's hard or maybe impossible (with reasonable perf) to get it right with current approach\n * Hopefully self reruning autoruns aren't a feature people should depend on\n * Also most basic use cases should be ok\n */\n// Called by Atom when its value changes\nfunction propagateChanged(observable) {\n // invariantLOS(observable, \"changed start\");\n if (observable.lowestObserverState_ === IDerivationState_.STALE_) {\n return;\n }\n observable.lowestObserverState_ = IDerivationState_.STALE_;\n // Ideally we use for..of here, but the downcompiled version is really slow...\n observable.observers_.forEach(function (d) {\n if (d.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {\n if ( true && d.isTracing_ !== TraceMode.NONE) {\n logTraceInfo(d, observable);\n }\n d.onBecomeStale_();\n }\n d.dependenciesState_ = IDerivationState_.STALE_;\n });\n // invariantLOS(observable, \"changed end\");\n}\n// Called by ComputedValue when it recalculate and its value changed\nfunction propagateChangeConfirmed(observable) {\n // invariantLOS(observable, \"confirmed start\");\n if (observable.lowestObserverState_ === IDerivationState_.STALE_) {\n return;\n }\n observable.lowestObserverState_ = IDerivationState_.STALE_;\n observable.observers_.forEach(function (d) {\n if (d.dependenciesState_ === IDerivationState_.POSSIBLY_STALE_) {\n d.dependenciesState_ = IDerivationState_.STALE_;\n if ( true && d.isTracing_ !== TraceMode.NONE) {\n logTraceInfo(d, observable);\n }\n } else if (d.dependenciesState_ === IDerivationState_.UP_TO_DATE_ // this happens during computing of `d`, just keep lowestObserverState up to date.\n ) {\n observable.lowestObserverState_ = IDerivationState_.UP_TO_DATE_;\n }\n });\n // invariantLOS(observable, \"confirmed end\");\n}\n// Used by computed when its dependency changed, but we don't wan't to immediately recompute.\nfunction propagateMaybeChanged(observable) {\n // invariantLOS(observable, \"maybe start\");\n if (observable.lowestObserverState_ !== IDerivationState_.UP_TO_DATE_) {\n return;\n }\n observable.lowestObserverState_ = IDerivationState_.POSSIBLY_STALE_;\n observable.observers_.forEach(function (d) {\n if (d.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {\n d.dependenciesState_ = IDerivationState_.POSSIBLY_STALE_;\n d.onBecomeStale_();\n }\n });\n // invariantLOS(observable, \"maybe end\");\n}\nfunction logTraceInfo(derivation, observable) {\n console.log(\"[mobx.trace] '\" + derivation.name_ + \"' is invalidated due to a change in: '\" + observable.name_ + \"'\");\n if (derivation.isTracing_ === TraceMode.BREAK) {\n var lines = [];\n printDepTree(getDependencyTree(derivation), lines, 1);\n // prettier-ignore\n new Function(\"debugger;\\n/*\\nTracing '\" + derivation.name_ + \"'\\n\\nYou are entering this break point because derivation '\" + derivation.name_ + \"' is being traced and '\" + observable.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\" + (derivation instanceof ComputedValue ? derivation.derivation.toString().replace(/[*]\\//g, \"/\") : \"\") + \"\\n\\nThe dependencies for this derivation are:\\n\\n\" + lines.join(\"\\n\") + \"\\n*/\\n \")();\n }\n}\nfunction printDepTree(tree, lines, depth) {\n if (lines.length >= 1000) {\n lines.push(\"(and many more)\");\n return;\n }\n lines.push(\"\" + \"\\t\".repeat(depth - 1) + tree.name);\n if (tree.dependencies) {\n tree.dependencies.forEach(function (child) {\n return printDepTree(child, lines, depth + 1);\n });\n }\n}\n\nvar Reaction = /*#__PURE__*/function () {\n function Reaction(name_, onInvalidate_, errorHandler_, requiresObservable_) {\n if (name_ === void 0) {\n name_ = true ? \"Reaction@\" + getNextId() : 0;\n }\n this.name_ = void 0;\n this.onInvalidate_ = void 0;\n this.errorHandler_ = void 0;\n this.requiresObservable_ = void 0;\n this.observing_ = [];\n // nodes we are looking at. Our value depends on these nodes\n this.newObserving_ = [];\n this.dependenciesState_ = IDerivationState_.NOT_TRACKING_;\n this.runId_ = 0;\n this.unboundDepsCount_ = 0;\n this.flags_ = 0;\n this.isTracing_ = TraceMode.NONE;\n this.name_ = name_;\n this.onInvalidate_ = onInvalidate_;\n this.errorHandler_ = errorHandler_;\n this.requiresObservable_ = requiresObservable_;\n }\n var _proto = Reaction.prototype;\n _proto.onBecomeStale_ = function onBecomeStale_() {\n this.schedule_();\n };\n _proto.schedule_ = function schedule_() {\n if (!this.isScheduled) {\n this.isScheduled = true;\n globalState.pendingReactions.push(this);\n runReactions();\n }\n }\n /**\n * internal, use schedule() if you intend to kick off a reaction\n */;\n _proto.runReaction_ = function runReaction_() {\n if (!this.isDisposed) {\n startBatch();\n this.isScheduled = false;\n var prev = globalState.trackingContext;\n globalState.trackingContext = this;\n if (shouldCompute(this)) {\n this.isTrackPending = true;\n try {\n this.onInvalidate_();\n if ( true && this.isTrackPending && isSpyEnabled()) {\n // onInvalidate didn't trigger track right away..\n spyReport({\n name: this.name_,\n type: \"scheduled-reaction\"\n });\n }\n } catch (e) {\n this.reportExceptionInDerivation_(e);\n }\n }\n globalState.trackingContext = prev;\n endBatch();\n }\n };\n _proto.track = function track(fn) {\n if (this.isDisposed) {\n return;\n // console.warn(\"Reaction already disposed\") // Note: Not a warning / error in mobx 4 either\n }\n startBatch();\n var notify = isSpyEnabled();\n var startTime;\n if ( true && notify) {\n startTime = Date.now();\n spyReportStart({\n name: this.name_,\n type: \"reaction\"\n });\n }\n this.isRunning = true;\n var prevReaction = globalState.trackingContext; // reactions could create reactions...\n globalState.trackingContext = this;\n var result = trackDerivedFunction(this, fn, undefined);\n globalState.trackingContext = prevReaction;\n this.isRunning = false;\n this.isTrackPending = false;\n if (this.isDisposed) {\n // disposed during last run. Clean up everything that was bound after the dispose call.\n clearObserving(this);\n }\n if (isCaughtException(result)) {\n this.reportExceptionInDerivation_(result.cause);\n }\n if ( true && notify) {\n spyReportEnd({\n time: Date.now() - startTime\n });\n }\n endBatch();\n };\n _proto.reportExceptionInDerivation_ = function reportExceptionInDerivation_(error) {\n var _this = this;\n if (this.errorHandler_) {\n this.errorHandler_(error, this);\n return;\n }\n if (globalState.disableErrorBoundaries) {\n throw error;\n }\n var message = true ? \"[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '\" + this + \"'\" : 0;\n if (!globalState.suppressReactionErrors) {\n console.error(message, error);\n /** If debugging brought you here, please, read the above message :-). Tnx! */\n } else if (true) {\n console.warn(\"[mobx] (error in reaction '\" + this.name_ + \"' suppressed, fix error of causing action below)\");\n } // prettier-ignore\n if ( true && isSpyEnabled()) {\n spyReport({\n type: \"error\",\n name: this.name_,\n message: message,\n error: \"\" + error\n });\n }\n globalState.globalReactionErrorHandlers.forEach(function (f) {\n return f(error, _this);\n });\n };\n _proto.dispose = function dispose() {\n if (!this.isDisposed) {\n this.isDisposed = true;\n if (!this.isRunning) {\n // if disposed while running, clean up later. Maybe not optimal, but rare case\n startBatch();\n clearObserving(this);\n endBatch();\n }\n }\n };\n _proto.getDisposer_ = function getDisposer_(abortSignal) {\n var _this2 = this;\n var dispose = function dispose() {\n _this2.dispose();\n abortSignal == null || abortSignal.removeEventListener == null || abortSignal.removeEventListener(\"abort\", dispose);\n };\n abortSignal == null || abortSignal.addEventListener == null || abortSignal.addEventListener(\"abort\", dispose);\n dispose[$mobx] = this;\n return dispose;\n };\n _proto.toString = function toString() {\n return \"Reaction[\" + this.name_ + \"]\";\n };\n _proto.trace = function trace$1(enterBreakPoint) {\n if (enterBreakPoint === void 0) {\n enterBreakPoint = false;\n }\n trace(this, enterBreakPoint);\n };\n return _createClass(Reaction, [{\n key: \"isDisposed\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isDisposedMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isDisposedMask_, newValue);\n }\n }, {\n key: \"isScheduled\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isScheduledMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isScheduledMask_, newValue);\n }\n }, {\n key: \"isTrackPending\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isTrackPendingMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isTrackPendingMask_, newValue);\n }\n }, {\n key: \"isRunning\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isRunningMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isRunningMask_, newValue);\n }\n }, {\n key: \"diffValue\",\n get: function get() {\n return getFlag(this.flags_, Reaction.diffValueMask_) ? 1 : 0;\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.diffValueMask_, newValue === 1 ? true : false);\n }\n }]);\n}();\nReaction.isDisposedMask_ = 1;\nReaction.isScheduledMask_ = 2;\nReaction.isTrackPendingMask_ = 4;\nReaction.isRunningMask_ = 8;\nReaction.diffValueMask_ = 16;\nfunction onReactionError(handler) {\n globalState.globalReactionErrorHandlers.push(handler);\n return function () {\n var idx = globalState.globalReactionErrorHandlers.indexOf(handler);\n if (idx >= 0) {\n globalState.globalReactionErrorHandlers.splice(idx, 1);\n }\n };\n}\n/**\n * Magic number alert!\n * Defines within how many times a reaction is allowed to re-trigger itself\n * until it is assumed that this is gonna be a never ending loop...\n */\nvar MAX_REACTION_ITERATIONS = 100;\nvar reactionScheduler = function reactionScheduler(f) {\n return f();\n};\nfunction runReactions() {\n // Trampolining, if runReactions are already running, new reactions will be picked up\n if (globalState.inBatch > 0 || globalState.isRunningReactions) {\n return;\n }\n reactionScheduler(runReactionsHelper);\n}\nfunction runReactionsHelper() {\n globalState.isRunningReactions = true;\n var allReactions = globalState.pendingReactions;\n var iterations = 0;\n // While running reactions, new reactions might be triggered.\n // Hence we work with two variables and check whether\n // we converge to no remaining reactions after a while.\n while (allReactions.length > 0) {\n if (++iterations === MAX_REACTION_ITERATIONS) {\n console.error( true ? \"Reaction doesn't converge to a stable state after \" + MAX_REACTION_ITERATIONS + \" iterations.\" + (\" Probably there is a cycle in the reactive function: \" + allReactions[0]) : 0);\n allReactions.splice(0); // clear reactions\n }\n var remainingReactions = allReactions.splice(0);\n for (var i = 0, l = remainingReactions.length; i < l; i++) {\n remainingReactions[i].runReaction_();\n }\n }\n globalState.isRunningReactions = false;\n}\nvar isReaction = /*#__PURE__*/createInstanceofPredicate(\"Reaction\", Reaction);\nfunction setReactionScheduler(fn) {\n var baseScheduler = reactionScheduler;\n reactionScheduler = function reactionScheduler(f) {\n return fn(function () {\n return baseScheduler(f);\n });\n };\n}\n\nfunction isSpyEnabled() {\n return true && !!globalState.spyListeners.length;\n}\nfunction spyReport(event) {\n if (false) {} // dead code elimination can do the rest\n if (!globalState.spyListeners.length) {\n return;\n }\n var listeners = globalState.spyListeners;\n for (var i = 0, l = listeners.length; i < l; i++) {\n listeners[i](event);\n }\n}\nfunction spyReportStart(event) {\n if (false) {}\n var change = _extends({}, event, {\n spyReportStart: true\n });\n spyReport(change);\n}\nvar END_EVENT = {\n type: \"report-end\",\n spyReportEnd: true\n};\nfunction spyReportEnd(change) {\n if (false) {}\n if (change) {\n spyReport(_extends({}, change, {\n type: \"report-end\",\n spyReportEnd: true\n }));\n } else {\n spyReport(END_EVENT);\n }\n}\nfunction spy(listener) {\n if (false) {} else {\n globalState.spyListeners.push(listener);\n return once(function () {\n globalState.spyListeners = globalState.spyListeners.filter(function (l) {\n return l !== listener;\n });\n });\n }\n}\n\nvar ACTION = \"action\";\nvar ACTION_BOUND = \"action.bound\";\nvar AUTOACTION = \"autoAction\";\nvar AUTOACTION_BOUND = \"autoAction.bound\";\nvar DEFAULT_ACTION_NAME = \"\";\nvar actionAnnotation = /*#__PURE__*/createActionAnnotation(ACTION);\nvar actionBoundAnnotation = /*#__PURE__*/createActionAnnotation(ACTION_BOUND, {\n bound: true\n});\nvar autoActionAnnotation = /*#__PURE__*/createActionAnnotation(AUTOACTION, {\n autoAction: true\n});\nvar autoActionBoundAnnotation = /*#__PURE__*/createActionAnnotation(AUTOACTION_BOUND, {\n autoAction: true,\n bound: true\n});\nfunction createActionFactory(autoAction) {\n var res = function action(arg1, arg2) {\n // action(fn() {})\n if (isFunction(arg1)) {\n return createAction(arg1.name || DEFAULT_ACTION_NAME, arg1, autoAction);\n }\n // action(\"name\", fn() {})\n if (isFunction(arg2)) {\n return createAction(arg1, arg2, autoAction);\n }\n // @action (2022.3 Decorators)\n if (is20223Decorator(arg2)) {\n return (autoAction ? autoActionAnnotation : actionAnnotation).decorate_20223_(arg1, arg2);\n }\n // @action\n if (isStringish(arg2)) {\n return storeAnnotation(arg1, arg2, autoAction ? autoActionAnnotation : actionAnnotation);\n }\n // action(\"name\") & @action(\"name\")\n if (isStringish(arg1)) {\n return createDecoratorAnnotation(createActionAnnotation(autoAction ? AUTOACTION : ACTION, {\n name: arg1,\n autoAction: autoAction\n }));\n }\n if (true) {\n die(\"Invalid arguments for `action`\");\n }\n };\n return res;\n}\nvar action = /*#__PURE__*/createActionFactory(false);\nObject.assign(action, actionAnnotation);\nvar autoAction = /*#__PURE__*/createActionFactory(true);\nObject.assign(autoAction, autoActionAnnotation);\naction.bound = /*#__PURE__*/createDecoratorAnnotation(actionBoundAnnotation);\nautoAction.bound = /*#__PURE__*/createDecoratorAnnotation(autoActionBoundAnnotation);\nfunction runInAction(fn) {\n return executeAction(fn.name || DEFAULT_ACTION_NAME, false, fn, this, undefined);\n}\nfunction isAction(thing) {\n return isFunction(thing) && thing.isMobxAction === true;\n}\n\n/**\n * Creates a named reactive view and keeps it alive, so that the view is always\n * updated if one of the dependencies changes, even when the view is not further used by something else.\n * @param view The reactive view\n * @returns disposer function, which can be used to stop the view from being updated in the future.\n */\nfunction autorun(view, opts) {\n var _opts$name, _opts, _opts2, _opts3;\n if (opts === void 0) {\n opts = EMPTY_OBJECT;\n }\n if (true) {\n if (!isFunction(view)) {\n die(\"Autorun expects a function as first argument\");\n }\n if (isAction(view)) {\n die(\"Autorun does not accept actions since actions are untrackable\");\n }\n }\n var name = (_opts$name = (_opts = opts) == null ? void 0 : _opts.name) != null ? _opts$name : true ? view.name || \"Autorun@\" + getNextId() : 0;\n var runSync = !opts.scheduler && !opts.delay;\n var reaction;\n if (runSync) {\n // normal autorun\n reaction = new Reaction(name, function () {\n this.track(reactionRunner);\n }, opts.onError, opts.requiresObservable);\n } else {\n var scheduler = createSchedulerFromOptions(opts);\n // debounced autorun\n var isScheduled = false;\n reaction = new Reaction(name, function () {\n if (!isScheduled) {\n isScheduled = true;\n scheduler(function () {\n isScheduled = false;\n if (!reaction.isDisposed) {\n reaction.track(reactionRunner);\n }\n });\n }\n }, opts.onError, opts.requiresObservable);\n }\n function reactionRunner() {\n view(reaction);\n }\n if (!((_opts2 = opts) != null && (_opts2 = _opts2.signal) != null && _opts2.aborted)) {\n reaction.schedule_();\n }\n return reaction.getDisposer_((_opts3 = opts) == null ? void 0 : _opts3.signal);\n}\nvar run = function run(f) {\n return f();\n};\nfunction createSchedulerFromOptions(opts) {\n return opts.scheduler ? opts.scheduler : opts.delay ? function (f) {\n return setTimeout(f, opts.delay);\n } : run;\n}\nfunction reaction(expression, effect, opts) {\n var _opts$name2, _opts4, _opts5;\n if (opts === void 0) {\n opts = EMPTY_OBJECT;\n }\n if (true) {\n if (!isFunction(expression) || !isFunction(effect)) {\n die(\"First and second argument to reaction should be functions\");\n }\n if (!isPlainObject(opts)) {\n die(\"Third argument of reactions should be an object\");\n }\n }\n var name = (_opts$name2 = opts.name) != null ? _opts$name2 : true ? \"Reaction@\" + getNextId() : 0;\n var effectAction = action(name, opts.onError ? wrapErrorHandler(opts.onError, effect) : effect);\n var runSync = !opts.scheduler && !opts.delay;\n var scheduler = createSchedulerFromOptions(opts);\n var firstTime = true;\n var isScheduled = false;\n var value;\n var equals = opts.compareStructural ? comparer.structural : opts.equals || comparer[\"default\"];\n var r = new Reaction(name, function () {\n if (firstTime || runSync) {\n reactionRunner();\n } else if (!isScheduled) {\n isScheduled = true;\n scheduler(reactionRunner);\n }\n }, opts.onError, opts.requiresObservable);\n function reactionRunner() {\n isScheduled = false;\n if (r.isDisposed) {\n return;\n }\n var changed = false;\n var oldValue = value;\n r.track(function () {\n var nextValue = allowStateChanges(false, function () {\n return expression(r);\n });\n changed = firstTime || !equals(value, nextValue);\n value = nextValue;\n });\n if (firstTime && opts.fireImmediately) {\n effectAction(value, oldValue, r);\n } else if (!firstTime && changed) {\n effectAction(value, oldValue, r);\n }\n firstTime = false;\n }\n if (!((_opts4 = opts) != null && (_opts4 = _opts4.signal) != null && _opts4.aborted)) {\n r.schedule_();\n }\n return r.getDisposer_((_opts5 = opts) == null ? void 0 : _opts5.signal);\n}\nfunction wrapErrorHandler(errorHandler, baseFn) {\n return function () {\n try {\n return baseFn.apply(this, arguments);\n } catch (e) {\n errorHandler.call(this, e);\n }\n };\n}\n\nvar ON_BECOME_OBSERVED = \"onBO\";\nvar ON_BECOME_UNOBSERVED = \"onBUO\";\nfunction onBecomeObserved(thing, arg2, arg3) {\n return interceptHook(ON_BECOME_OBSERVED, thing, arg2, arg3);\n}\nfunction onBecomeUnobserved(thing, arg2, arg3) {\n return interceptHook(ON_BECOME_UNOBSERVED, thing, arg2, arg3);\n}\nfunction interceptHook(hook, thing, arg2, arg3) {\n var atom = typeof arg3 === \"function\" ? getAtom(thing, arg2) : getAtom(thing);\n var cb = isFunction(arg3) ? arg3 : arg2;\n var listenersKey = hook + \"L\";\n if (atom[listenersKey]) {\n atom[listenersKey].add(cb);\n } else {\n atom[listenersKey] = new Set([cb]);\n }\n return function () {\n var hookListeners = atom[listenersKey];\n if (hookListeners) {\n hookListeners[\"delete\"](cb);\n if (hookListeners.size === 0) {\n delete atom[listenersKey];\n }\n }\n };\n}\n\nvar NEVER = \"never\";\nvar ALWAYS = \"always\";\nvar OBSERVED = \"observed\";\n// const IF_AVAILABLE = \"ifavailable\"\nfunction configure(options) {\n if (options.isolateGlobalState === true) {\n isolateGlobalState();\n }\n var useProxies = options.useProxies,\n enforceActions = options.enforceActions;\n if (useProxies !== undefined) {\n globalState.useProxies = useProxies === ALWAYS ? true : useProxies === NEVER ? false : typeof Proxy !== \"undefined\";\n }\n if (useProxies === \"ifavailable\") {\n globalState.verifyProxies = true;\n }\n if (enforceActions !== undefined) {\n var ea = enforceActions === ALWAYS ? ALWAYS : enforceActions === OBSERVED;\n globalState.enforceActions = ea;\n globalState.allowStateChanges = ea === true || ea === ALWAYS ? false : true;\n }\n [\"computedRequiresReaction\", \"reactionRequiresObservable\", \"observableRequiresReaction\", \"disableErrorBoundaries\", \"safeDescriptors\"].forEach(function (key) {\n if (key in options) {\n globalState[key] = !!options[key];\n }\n });\n globalState.allowStateReads = !globalState.observableRequiresReaction;\n if ( true && globalState.disableErrorBoundaries === true) {\n console.warn(\"WARNING: Debug feature only. MobX will NOT recover from errors when `disableErrorBoundaries` is enabled.\");\n }\n if (options.reactionScheduler) {\n setReactionScheduler(options.reactionScheduler);\n }\n}\n\nfunction extendObservable(target, properties, annotations, options) {\n if (true) {\n if (arguments.length > 4) {\n die(\"'extendObservable' expected 2-4 arguments\");\n }\n if (typeof target !== \"object\") {\n die(\"'extendObservable' expects an object as first argument\");\n }\n if (isObservableMap(target)) {\n die(\"'extendObservable' should not be used on maps, use map.merge instead\");\n }\n if (!isPlainObject(properties)) {\n die(\"'extendObservable' only accepts plain objects as second argument\");\n }\n if (isObservable(properties) || isObservable(annotations)) {\n die(\"Extending an object with another observable (object) is not supported\");\n }\n }\n // Pull descriptors first, so we don't have to deal with props added by administration ($mobx)\n var descriptors = getOwnPropertyDescriptors(properties);\n initObservable(function () {\n var adm = asObservableObject(target, options)[$mobx];\n ownKeys(descriptors).forEach(function (key) {\n adm.extend_(key, descriptors[key],\n // must pass \"undefined\" for { key: undefined }\n !annotations ? true : key in annotations ? annotations[key] : true);\n });\n });\n return target;\n}\n\nfunction getDependencyTree(thing, property) {\n return nodeToDependencyTree(getAtom(thing, property));\n}\nfunction nodeToDependencyTree(node) {\n var result = {\n name: node.name_\n };\n if (node.observing_ && node.observing_.length > 0) {\n result.dependencies = unique(node.observing_).map(nodeToDependencyTree);\n }\n return result;\n}\nfunction getObserverTree(thing, property) {\n return nodeToObserverTree(getAtom(thing, property));\n}\nfunction nodeToObserverTree(node) {\n var result = {\n name: node.name_\n };\n if (hasObservers(node)) {\n result.observers = Array.from(getObservers(node)).map(nodeToObserverTree);\n }\n return result;\n}\nfunction unique(list) {\n return Array.from(new Set(list));\n}\n\nvar generatorId = 0;\nfunction FlowCancellationError() {\n this.message = \"FLOW_CANCELLED\";\n}\nFlowCancellationError.prototype = /*#__PURE__*/Object.create(Error.prototype);\nfunction isFlowCancellationError(error) {\n return error instanceof FlowCancellationError;\n}\nvar flowAnnotation = /*#__PURE__*/createFlowAnnotation(\"flow\");\nvar flowBoundAnnotation = /*#__PURE__*/createFlowAnnotation(\"flow.bound\", {\n bound: true\n});\nvar flow = /*#__PURE__*/Object.assign(function flow(arg1, arg2) {\n // @flow (2022.3 Decorators)\n if (is20223Decorator(arg2)) {\n return flowAnnotation.decorate_20223_(arg1, arg2);\n }\n // @flow\n if (isStringish(arg2)) {\n return storeAnnotation(arg1, arg2, flowAnnotation);\n }\n // flow(fn)\n if ( true && arguments.length !== 1) {\n die(\"Flow expects single argument with generator function\");\n }\n var generator = arg1;\n var name = generator.name || \"\";\n // Implementation based on https://github.com/tj/co/blob/master/index.js\n var res = function res() {\n var ctx = this;\n var args = arguments;\n var runId = ++generatorId;\n var gen = action(name + \" - runid: \" + runId + \" - init\", generator).apply(ctx, args);\n var rejector;\n var pendingPromise = undefined;\n var promise = new Promise(function (resolve, reject) {\n var stepId = 0;\n rejector = reject;\n function onFulfilled(res) {\n pendingPromise = undefined;\n var ret;\n try {\n ret = action(name + \" - runid: \" + runId + \" - yield \" + stepId++, gen.next).call(gen, res);\n } catch (e) {\n return reject(e);\n }\n next(ret);\n }\n function onRejected(err) {\n pendingPromise = undefined;\n var ret;\n try {\n ret = action(name + \" - runid: \" + runId + \" - yield \" + stepId++, gen[\"throw\"]).call(gen, err);\n } catch (e) {\n return reject(e);\n }\n next(ret);\n }\n function next(ret) {\n if (isFunction(ret == null ? void 0 : ret.then)) {\n // an async iterator\n ret.then(next, reject);\n return;\n }\n if (ret.done) {\n return resolve(ret.value);\n }\n pendingPromise = Promise.resolve(ret.value);\n return pendingPromise.then(onFulfilled, onRejected);\n }\n onFulfilled(undefined); // kick off the process\n });\n promise.cancel = action(name + \" - runid: \" + runId + \" - cancel\", function () {\n try {\n if (pendingPromise) {\n cancelPromise(pendingPromise);\n }\n // Finally block can return (or yield) stuff..\n var _res = gen[\"return\"](undefined);\n // eat anything that promise would do, it's cancelled!\n var yieldedPromise = Promise.resolve(_res.value);\n yieldedPromise.then(noop, noop);\n cancelPromise(yieldedPromise); // maybe it can be cancelled :)\n // reject our original promise\n rejector(new FlowCancellationError());\n } catch (e) {\n rejector(e); // there could be a throwing finally block\n }\n });\n return promise;\n };\n res.isMobXFlow = true;\n return res;\n}, flowAnnotation);\nflow.bound = /*#__PURE__*/createDecoratorAnnotation(flowBoundAnnotation);\nfunction cancelPromise(promise) {\n if (isFunction(promise.cancel)) {\n promise.cancel();\n }\n}\nfunction flowResult(result) {\n return result; // just tricking TypeScript :)\n}\nfunction isFlow(fn) {\n return (fn == null ? void 0 : fn.isMobXFlow) === true;\n}\n\nfunction interceptReads(thing, propOrHandler, handler) {\n var target;\n if (isObservableMap(thing) || isObservableArray(thing) || isObservableValue(thing)) {\n target = getAdministration(thing);\n } else if (isObservableObject(thing)) {\n if ( true && !isStringish(propOrHandler)) {\n return die(\"InterceptReads can only be used with a specific property, not with an object in general\");\n }\n target = getAdministration(thing, propOrHandler);\n } else if (true) {\n return die(\"Expected observable map, object or array as first array\");\n }\n if ( true && target.dehancer !== undefined) {\n return die(\"An intercept reader was already established\");\n }\n target.dehancer = typeof propOrHandler === \"function\" ? propOrHandler : handler;\n return function () {\n target.dehancer = undefined;\n };\n}\n\nfunction intercept(thing, propOrHandler, handler) {\n if (isFunction(handler)) {\n return interceptProperty(thing, propOrHandler, handler);\n } else {\n return interceptInterceptable(thing, propOrHandler);\n }\n}\nfunction interceptInterceptable(thing, handler) {\n return getAdministration(thing).intercept_(handler);\n}\nfunction interceptProperty(thing, property, handler) {\n return getAdministration(thing, property).intercept_(handler);\n}\n\nfunction _isComputed(value, property) {\n if (property === undefined) {\n return isComputedValue(value);\n }\n if (isObservableObject(value) === false) {\n return false;\n }\n if (!value[$mobx].values_.has(property)) {\n return false;\n }\n var atom = getAtom(value, property);\n return isComputedValue(atom);\n}\nfunction isComputed(value) {\n if ( true && arguments.length > 1) {\n return die(\"isComputed expects only 1 argument. Use isComputedProp to inspect the observability of a property\");\n }\n return _isComputed(value);\n}\nfunction isComputedProp(value, propName) {\n if ( true && !isStringish(propName)) {\n return die(\"isComputed expected a property name as second argument\");\n }\n return _isComputed(value, propName);\n}\n\nfunction _isObservable(value, property) {\n if (!value) {\n return false;\n }\n if (property !== undefined) {\n if ( true && (isObservableMap(value) || isObservableArray(value))) {\n return die(\"isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead.\");\n }\n if (isObservableObject(value)) {\n return value[$mobx].values_.has(property);\n }\n return false;\n }\n // For first check, see #701\n return isObservableObject(value) || !!value[$mobx] || isAtom(value) || isReaction(value) || isComputedValue(value);\n}\nfunction isObservable(value) {\n if ( true && arguments.length !== 1) {\n die(\"isObservable expects only 1 argument. Use isObservableProp to inspect the observability of a property\");\n }\n return _isObservable(value);\n}\nfunction isObservableProp(value, propName) {\n if ( true && !isStringish(propName)) {\n return die(\"expected a property name as second argument\");\n }\n return _isObservable(value, propName);\n}\n\nfunction keys(obj) {\n if (isObservableObject(obj)) {\n return obj[$mobx].keys_();\n }\n if (isObservableMap(obj) || isObservableSet(obj)) {\n return Array.from(obj.keys());\n }\n if (isObservableArray(obj)) {\n return obj.map(function (_, index) {\n return index;\n });\n }\n die(5);\n}\nfunction values(obj) {\n if (isObservableObject(obj)) {\n return keys(obj).map(function (key) {\n return obj[key];\n });\n }\n if (isObservableMap(obj)) {\n return keys(obj).map(function (key) {\n return obj.get(key);\n });\n }\n if (isObservableSet(obj)) {\n return Array.from(obj.values());\n }\n if (isObservableArray(obj)) {\n return obj.slice();\n }\n die(6);\n}\nfunction entries(obj) {\n if (isObservableObject(obj)) {\n return keys(obj).map(function (key) {\n return [key, obj[key]];\n });\n }\n if (isObservableMap(obj)) {\n return keys(obj).map(function (key) {\n return [key, obj.get(key)];\n });\n }\n if (isObservableSet(obj)) {\n return Array.from(obj.entries());\n }\n if (isObservableArray(obj)) {\n return obj.map(function (key, index) {\n return [index, key];\n });\n }\n die(7);\n}\nfunction set(obj, key, value) {\n if (arguments.length === 2 && !isObservableSet(obj)) {\n startBatch();\n var _values = key;\n try {\n for (var _key in _values) {\n set(obj, _key, _values[_key]);\n }\n } finally {\n endBatch();\n }\n return;\n }\n if (isObservableObject(obj)) {\n obj[$mobx].set_(key, value);\n } else if (isObservableMap(obj)) {\n obj.set(key, value);\n } else if (isObservableSet(obj)) {\n obj.add(key);\n } else if (isObservableArray(obj)) {\n if (typeof key !== \"number\") {\n key = parseInt(key, 10);\n }\n if (key < 0) {\n die(\"Invalid index: '\" + key + \"'\");\n }\n startBatch();\n if (key >= obj.length) {\n obj.length = key + 1;\n }\n obj[key] = value;\n endBatch();\n } else {\n die(8);\n }\n}\nfunction remove(obj, key) {\n if (isObservableObject(obj)) {\n obj[$mobx].delete_(key);\n } else if (isObservableMap(obj)) {\n obj[\"delete\"](key);\n } else if (isObservableSet(obj)) {\n obj[\"delete\"](key);\n } else if (isObservableArray(obj)) {\n if (typeof key !== \"number\") {\n key = parseInt(key, 10);\n }\n obj.splice(key, 1);\n } else {\n die(9);\n }\n}\nfunction has(obj, key) {\n if (isObservableObject(obj)) {\n return obj[$mobx].has_(key);\n } else if (isObservableMap(obj)) {\n return obj.has(key);\n } else if (isObservableSet(obj)) {\n return obj.has(key);\n } else if (isObservableArray(obj)) {\n return key >= 0 && key < obj.length;\n }\n die(10);\n}\nfunction get(obj, key) {\n if (!has(obj, key)) {\n return undefined;\n }\n if (isObservableObject(obj)) {\n return obj[$mobx].get_(key);\n } else if (isObservableMap(obj)) {\n return obj.get(key);\n } else if (isObservableArray(obj)) {\n return obj[key];\n }\n die(11);\n}\nfunction apiDefineProperty(obj, key, descriptor) {\n if (isObservableObject(obj)) {\n return obj[$mobx].defineProperty_(key, descriptor);\n }\n die(39);\n}\nfunction apiOwnKeys(obj) {\n if (isObservableObject(obj)) {\n return obj[$mobx].ownKeys_();\n }\n die(38);\n}\n\nfunction observe(thing, propOrCb, cbOrFire, fireImmediately) {\n if (isFunction(cbOrFire)) {\n return observeObservableProperty(thing, propOrCb, cbOrFire, fireImmediately);\n } else {\n return observeObservable(thing, propOrCb, cbOrFire);\n }\n}\nfunction observeObservable(thing, listener, fireImmediately) {\n return getAdministration(thing).observe_(listener, fireImmediately);\n}\nfunction observeObservableProperty(thing, property, listener, fireImmediately) {\n return getAdministration(thing, property).observe_(listener, fireImmediately);\n}\n\nfunction cache(map, key, value) {\n map.set(key, value);\n return value;\n}\nfunction toJSHelper(source, __alreadySeen) {\n if (source == null || typeof source !== \"object\" || source instanceof Date || !isObservable(source)) {\n return source;\n }\n if (isObservableValue(source) || isComputedValue(source)) {\n return toJSHelper(source.get(), __alreadySeen);\n }\n if (__alreadySeen.has(source)) {\n return __alreadySeen.get(source);\n }\n if (isObservableArray(source)) {\n var res = cache(__alreadySeen, source, new Array(source.length));\n source.forEach(function (value, idx) {\n res[idx] = toJSHelper(value, __alreadySeen);\n });\n return res;\n }\n if (isObservableSet(source)) {\n var _res = cache(__alreadySeen, source, new Set());\n source.forEach(function (value) {\n _res.add(toJSHelper(value, __alreadySeen));\n });\n return _res;\n }\n if (isObservableMap(source)) {\n var _res2 = cache(__alreadySeen, source, new Map());\n source.forEach(function (value, key) {\n _res2.set(key, toJSHelper(value, __alreadySeen));\n });\n return _res2;\n } else {\n // must be observable object\n var _res3 = cache(__alreadySeen, source, {});\n apiOwnKeys(source).forEach(function (key) {\n if (objectPrototype.propertyIsEnumerable.call(source, key)) {\n _res3[key] = toJSHelper(source[key], __alreadySeen);\n }\n });\n return _res3;\n }\n}\n/**\n * Recursively converts an observable to it's non-observable native counterpart.\n * It does NOT recurse into non-observables, these are left as they are, even if they contain observables.\n * Computed and other non-enumerable properties are completely ignored.\n * Complex scenarios require custom solution, eg implementing `toJSON` or using `serializr` lib.\n */\nfunction toJS(source, options) {\n if ( true && options) {\n die(\"toJS no longer supports options\");\n }\n return toJSHelper(source, new Map());\n}\n\nfunction trace() {\n if (false) {}\n var enterBreakPoint = false;\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n if (typeof args[args.length - 1] === \"boolean\") {\n enterBreakPoint = args.pop();\n }\n var derivation = getAtomFromArgs(args);\n if (!derivation) {\n return die(\"'trace(break?)' can only be used inside a tracked computed value or a Reaction. Consider passing in the computed value or reaction explicitly\");\n }\n if (derivation.isTracing_ === TraceMode.NONE) {\n console.log(\"[mobx.trace] '\" + derivation.name_ + \"' tracing enabled\");\n }\n derivation.isTracing_ = enterBreakPoint ? TraceMode.BREAK : TraceMode.LOG;\n}\nfunction getAtomFromArgs(args) {\n switch (args.length) {\n case 0:\n return globalState.trackingDerivation;\n case 1:\n return getAtom(args[0]);\n case 2:\n return getAtom(args[0], args[1]);\n }\n}\n\n/**\n * During a transaction no views are updated until the end of the transaction.\n * The transaction will be run synchronously nonetheless.\n *\n * @param action a function that updates some reactive state\n * @returns any value that was returned by the 'action' parameter.\n */\nfunction transaction(action, thisArg) {\n if (thisArg === void 0) {\n thisArg = undefined;\n }\n startBatch();\n try {\n return action.apply(thisArg);\n } finally {\n endBatch();\n }\n}\n\nfunction when(predicate, arg1, arg2) {\n if (arguments.length === 1 || arg1 && typeof arg1 === \"object\") {\n return whenPromise(predicate, arg1);\n }\n return _when(predicate, arg1, arg2 || {});\n}\nfunction _when(predicate, effect, opts) {\n var timeoutHandle;\n if (typeof opts.timeout === \"number\") {\n var error = new Error(\"WHEN_TIMEOUT\");\n timeoutHandle = setTimeout(function () {\n if (!disposer[$mobx].isDisposed) {\n disposer();\n if (opts.onError) {\n opts.onError(error);\n } else {\n throw error;\n }\n }\n }, opts.timeout);\n }\n opts.name = true ? opts.name || \"When@\" + getNextId() : 0;\n var effectAction = createAction( true ? opts.name + \"-effect\" : 0, effect);\n // eslint-disable-next-line\n var disposer = autorun(function (r) {\n // predicate should not change state\n var cond = allowStateChanges(false, predicate);\n if (cond) {\n r.dispose();\n if (timeoutHandle) {\n clearTimeout(timeoutHandle);\n }\n effectAction();\n }\n }, opts);\n return disposer;\n}\nfunction whenPromise(predicate, opts) {\n var _opts$signal;\n if ( true && opts && opts.onError) {\n return die(\"the options 'onError' and 'promise' cannot be combined\");\n }\n if (opts != null && (_opts$signal = opts.signal) != null && _opts$signal.aborted) {\n return Object.assign(Promise.reject(new Error(\"WHEN_ABORTED\")), {\n cancel: function cancel() {\n return null;\n }\n });\n }\n var cancel;\n var abort;\n var res = new Promise(function (resolve, reject) {\n var _opts$signal2;\n var disposer = _when(predicate, resolve, _extends({}, opts, {\n onError: reject\n }));\n cancel = function cancel() {\n disposer();\n reject(new Error(\"WHEN_CANCELLED\"));\n };\n abort = function abort() {\n disposer();\n reject(new Error(\"WHEN_ABORTED\"));\n };\n opts == null || (_opts$signal2 = opts.signal) == null || _opts$signal2.addEventListener == null || _opts$signal2.addEventListener(\"abort\", abort);\n })[\"finally\"](function () {\n var _opts$signal3;\n return opts == null || (_opts$signal3 = opts.signal) == null || _opts$signal3.removeEventListener == null ? void 0 : _opts$signal3.removeEventListener(\"abort\", abort);\n });\n res.cancel = cancel;\n return res;\n}\n\nfunction getAdm(target) {\n return target[$mobx];\n}\n// Optimization: we don't need the intermediate objects and could have a completely custom administration for DynamicObjects,\n// and skip either the internal values map, or the base object with its property descriptors!\nvar objectProxyTraps = {\n has: function has(target, name) {\n if ( true && globalState.trackingDerivation) {\n warnAboutProxyRequirement(\"detect new properties using the 'in' operator. Use 'has' from 'mobx' instead.\");\n }\n return getAdm(target).has_(name);\n },\n get: function get(target, name) {\n return getAdm(target).get_(name);\n },\n set: function set(target, name, value) {\n var _getAdm$set_;\n if (!isStringish(name)) {\n return false;\n }\n if ( true && !getAdm(target).values_.has(name)) {\n warnAboutProxyRequirement(\"add a new observable property through direct assignment. Use 'set' from 'mobx' instead.\");\n }\n // null (intercepted) -> true (success)\n return (_getAdm$set_ = getAdm(target).set_(name, value, true)) != null ? _getAdm$set_ : true;\n },\n deleteProperty: function deleteProperty(target, name) {\n var _getAdm$delete_;\n if (true) {\n warnAboutProxyRequirement(\"delete properties from an observable object. Use 'remove' from 'mobx' instead.\");\n }\n if (!isStringish(name)) {\n return false;\n }\n // null (intercepted) -> true (success)\n return (_getAdm$delete_ = getAdm(target).delete_(name, true)) != null ? _getAdm$delete_ : true;\n },\n defineProperty: function defineProperty(target, name, descriptor) {\n var _getAdm$definePropert;\n if (true) {\n warnAboutProxyRequirement(\"define property on an observable object. Use 'defineProperty' from 'mobx' instead.\");\n }\n // null (intercepted) -> true (success)\n return (_getAdm$definePropert = getAdm(target).defineProperty_(name, descriptor)) != null ? _getAdm$definePropert : true;\n },\n ownKeys: function ownKeys(target) {\n if ( true && globalState.trackingDerivation) {\n warnAboutProxyRequirement(\"iterate keys to detect added / removed properties. Use 'keys' from 'mobx' instead.\");\n }\n return getAdm(target).ownKeys_();\n },\n preventExtensions: function preventExtensions(target) {\n die(13);\n }\n};\nfunction asDynamicObservableObject(target, options) {\n var _target$$mobx, _target$$mobx$proxy_;\n assertProxies();\n target = asObservableObject(target, options);\n return (_target$$mobx$proxy_ = (_target$$mobx = target[$mobx]).proxy_) != null ? _target$$mobx$proxy_ : _target$$mobx.proxy_ = new Proxy(target, objectProxyTraps);\n}\n\nfunction hasInterceptors(interceptable) {\n return interceptable.interceptors_ !== undefined && interceptable.interceptors_.length > 0;\n}\nfunction registerInterceptor(interceptable, handler) {\n var interceptors = interceptable.interceptors_ || (interceptable.interceptors_ = []);\n interceptors.push(handler);\n return once(function () {\n var idx = interceptors.indexOf(handler);\n if (idx !== -1) {\n interceptors.splice(idx, 1);\n }\n });\n}\nfunction interceptChange(interceptable, change) {\n var prevU = untrackedStart();\n try {\n // Interceptor can modify the array, copy it to avoid concurrent modification, see #1950\n var interceptors = [].concat(interceptable.interceptors_ || []);\n for (var i = 0, l = interceptors.length; i < l; i++) {\n change = interceptors[i](change);\n if (change && !change.type) {\n die(14);\n }\n if (!change) {\n break;\n }\n }\n return change;\n } finally {\n untrackedEnd(prevU);\n }\n}\n\nfunction hasListeners(listenable) {\n return listenable.changeListeners_ !== undefined && listenable.changeListeners_.length > 0;\n}\nfunction registerListener(listenable, handler) {\n var listeners = listenable.changeListeners_ || (listenable.changeListeners_ = []);\n listeners.push(handler);\n return once(function () {\n var idx = listeners.indexOf(handler);\n if (idx !== -1) {\n listeners.splice(idx, 1);\n }\n });\n}\nfunction notifyListeners(listenable, change) {\n var prevU = untrackedStart();\n var listeners = listenable.changeListeners_;\n if (!listeners) {\n return;\n }\n listeners = listeners.slice();\n for (var i = 0, l = listeners.length; i < l; i++) {\n listeners[i](change);\n }\n untrackedEnd(prevU);\n}\n\nfunction makeObservable(target, annotations, options) {\n initObservable(function () {\n var _annotations;\n var adm = asObservableObject(target, options)[$mobx];\n if ( true && annotations && target[storedAnnotationsSymbol]) {\n die(\"makeObservable second arg must be nullish when using decorators. Mixing @decorator syntax with annotations is not supported.\");\n }\n // Default to decorators\n (_annotations = annotations) != null ? _annotations : annotations = collectStoredAnnotations(target);\n // Annotate\n ownKeys(annotations).forEach(function (key) {\n return adm.make_(key, annotations[key]);\n });\n });\n return target;\n}\n// proto[keysSymbol] = new Set()\nvar keysSymbol = /*#__PURE__*/Symbol(\"mobx-keys\");\nfunction makeAutoObservable(target, overrides, options) {\n if (true) {\n if (!isPlainObject(target) && !isPlainObject(Object.getPrototypeOf(target))) {\n die(\"'makeAutoObservable' can only be used for classes that don't have a superclass\");\n }\n if (isObservableObject(target)) {\n die(\"makeAutoObservable can only be used on objects not already made observable\");\n }\n }\n // Optimization: avoid visiting protos\n // Assumes that annotation.make_/.extend_ works the same for plain objects\n if (isPlainObject(target)) {\n return extendObservable(target, target, overrides, options);\n }\n initObservable(function () {\n var adm = asObservableObject(target, options)[$mobx];\n // Optimization: cache keys on proto\n // Assumes makeAutoObservable can be called only once per object and can't be used in subclass\n if (!target[keysSymbol]) {\n var proto = Object.getPrototypeOf(target);\n var keys = new Set([].concat(ownKeys(target), ownKeys(proto)));\n keys[\"delete\"](\"constructor\");\n keys[\"delete\"]($mobx);\n addHiddenProp(proto, keysSymbol, keys);\n }\n target[keysSymbol].forEach(function (key) {\n return adm.make_(key,\n // must pass \"undefined\" for { key: undefined }\n !overrides ? true : key in overrides ? overrides[key] : true);\n });\n });\n return target;\n}\n\nvar SPLICE = \"splice\";\nvar UPDATE = \"update\";\nvar MAX_SPLICE_SIZE = 10000; // See e.g. https://github.com/mobxjs/mobx/issues/859\nvar arrayTraps = {\n get: function get(target, name) {\n var adm = target[$mobx];\n if (name === $mobx) {\n return adm;\n }\n if (name === \"length\") {\n return adm.getArrayLength_();\n }\n if (typeof name === \"string\" && !isNaN(name)) {\n return adm.get_(parseInt(name));\n }\n if (hasProp(arrayExtensions, name)) {\n return arrayExtensions[name];\n }\n return target[name];\n },\n set: function set(target, name, value) {\n var adm = target[$mobx];\n if (name === \"length\") {\n adm.setArrayLength_(value);\n }\n if (typeof name === \"symbol\" || isNaN(name)) {\n target[name] = value;\n } else {\n // numeric string\n adm.set_(parseInt(name), value);\n }\n return true;\n },\n preventExtensions: function preventExtensions() {\n die(15);\n }\n};\nvar ObservableArrayAdministration = /*#__PURE__*/function () {\n function ObservableArrayAdministration(name, enhancer, owned_, legacyMode_) {\n if (name === void 0) {\n name = true ? \"ObservableArray@\" + getNextId() : 0;\n }\n this.owned_ = void 0;\n this.legacyMode_ = void 0;\n this.atom_ = void 0;\n this.values_ = [];\n // this is the prop that gets proxied, so can't replace it!\n this.interceptors_ = void 0;\n this.changeListeners_ = void 0;\n this.enhancer_ = void 0;\n this.dehancer = void 0;\n this.proxy_ = void 0;\n this.lastKnownLength_ = 0;\n this.owned_ = owned_;\n this.legacyMode_ = legacyMode_;\n this.atom_ = new Atom(name);\n this.enhancer_ = function (newV, oldV) {\n return enhancer(newV, oldV, true ? name + \"[..]\" : 0);\n };\n }\n var _proto = ObservableArrayAdministration.prototype;\n _proto.dehanceValue_ = function dehanceValue_(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.dehanceValues_ = function dehanceValues_(values) {\n if (this.dehancer !== undefined && values.length > 0) {\n return values.map(this.dehancer);\n }\n return values;\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n if (fireImmediately === void 0) {\n fireImmediately = false;\n }\n if (fireImmediately) {\n listener({\n observableKind: \"array\",\n object: this.proxy_,\n debugObjectName: this.atom_.name_,\n type: \"splice\",\n index: 0,\n added: this.values_.slice(),\n addedCount: this.values_.length,\n removed: [],\n removedCount: 0\n });\n }\n return registerListener(this, listener);\n };\n _proto.getArrayLength_ = function getArrayLength_() {\n this.atom_.reportObserved();\n return this.values_.length;\n };\n _proto.setArrayLength_ = function setArrayLength_(newLength) {\n if (typeof newLength !== \"number\" || isNaN(newLength) || newLength < 0) {\n die(\"Out of range: \" + newLength);\n }\n var currentLength = this.values_.length;\n if (newLength === currentLength) {\n return;\n } else if (newLength > currentLength) {\n var newItems = new Array(newLength - currentLength);\n for (var i = 0; i < newLength - currentLength; i++) {\n newItems[i] = undefined;\n } // No Array.fill everywhere...\n this.spliceWithArray_(currentLength, 0, newItems);\n } else {\n this.spliceWithArray_(newLength, currentLength - newLength);\n }\n };\n _proto.updateArrayLength_ = function updateArrayLength_(oldLength, delta) {\n if (oldLength !== this.lastKnownLength_) {\n die(16);\n }\n this.lastKnownLength_ += delta;\n if (this.legacyMode_ && delta > 0) {\n reserveArrayBuffer(oldLength + delta + 1);\n }\n };\n _proto.spliceWithArray_ = function spliceWithArray_(index, deleteCount, newItems) {\n var _this = this;\n checkIfStateModificationsAreAllowed(this.atom_);\n var length = this.values_.length;\n if (index === undefined) {\n index = 0;\n } else if (index > length) {\n index = length;\n } else if (index < 0) {\n index = Math.max(0, length + index);\n }\n if (arguments.length === 1) {\n deleteCount = length - index;\n } else if (deleteCount === undefined || deleteCount === null) {\n deleteCount = 0;\n } else {\n deleteCount = Math.max(0, Math.min(deleteCount, length - index));\n }\n if (newItems === undefined) {\n newItems = EMPTY_ARRAY;\n }\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_,\n type: SPLICE,\n index: index,\n removedCount: deleteCount,\n added: newItems\n });\n if (!change) {\n return EMPTY_ARRAY;\n }\n deleteCount = change.removedCount;\n newItems = change.added;\n }\n newItems = newItems.length === 0 ? newItems : newItems.map(function (v) {\n return _this.enhancer_(v, undefined);\n });\n if (this.legacyMode_ || \"development\" !== \"production\") {\n var lengthDelta = newItems.length - deleteCount;\n this.updateArrayLength_(length, lengthDelta); // checks if internal array wasn't modified\n }\n var res = this.spliceItemsIntoValues_(index, deleteCount, newItems);\n if (deleteCount !== 0 || newItems.length !== 0) {\n this.notifyArraySplice_(index, newItems, res);\n }\n return this.dehanceValues_(res);\n };\n _proto.spliceItemsIntoValues_ = function spliceItemsIntoValues_(index, deleteCount, newItems) {\n if (newItems.length < MAX_SPLICE_SIZE) {\n var _this$values_;\n return (_this$values_ = this.values_).splice.apply(_this$values_, [index, deleteCount].concat(newItems));\n } else {\n // The items removed by the splice\n var res = this.values_.slice(index, index + deleteCount);\n // The items that that should remain at the end of the array\n var oldItems = this.values_.slice(index + deleteCount);\n // New length is the previous length + addition count - deletion count\n this.values_.length += newItems.length - deleteCount;\n for (var i = 0; i < newItems.length; i++) {\n this.values_[index + i] = newItems[i];\n }\n for (var _i = 0; _i < oldItems.length; _i++) {\n this.values_[index + newItems.length + _i] = oldItems[_i];\n }\n return res;\n }\n };\n _proto.notifyArrayChildUpdate_ = function notifyArrayChildUpdate_(index, newValue, oldValue) {\n var notifySpy = !this.owned_ && isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"array\",\n object: this.proxy_,\n type: UPDATE,\n debugObjectName: this.atom_.name_,\n index: index,\n newValue: newValue,\n oldValue: oldValue\n } : null;\n // The reason why this is on right hand side here (and not above), is this way the uglifier will drop it, but it won't\n // cause any runtime overhead in development mode without NODE_ENV set, unless spying is enabled\n if ( true && notifySpy) {\n spyReportStart(change);\n }\n this.atom_.reportChanged();\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n };\n _proto.notifyArraySplice_ = function notifyArraySplice_(index, added, removed) {\n var notifySpy = !this.owned_ && isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"array\",\n object: this.proxy_,\n debugObjectName: this.atom_.name_,\n type: SPLICE,\n index: index,\n removed: removed,\n added: added,\n removedCount: removed.length,\n addedCount: added.length\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n }\n this.atom_.reportChanged();\n // conform: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/observe\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n };\n _proto.get_ = function get_(index) {\n if (this.legacyMode_ && index >= this.values_.length) {\n console.warn( true ? \"[mobx.array] Attempt to read an array index (\" + index + \") that is out of bounds (\" + this.values_.length + \"). Please check length first. Out of bound indices will not be tracked by MobX\" : 0);\n return undefined;\n }\n this.atom_.reportObserved();\n return this.dehanceValue_(this.values_[index]);\n };\n _proto.set_ = function set_(index, newValue) {\n var values = this.values_;\n if (this.legacyMode_ && index > values.length) {\n // out of bounds\n die(17, index, values.length);\n }\n if (index < values.length) {\n // update at index in range\n checkIfStateModificationsAreAllowed(this.atom_);\n var oldValue = values[index];\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: UPDATE,\n object: this.proxy_,\n // since \"this\" is the real array we need to pass its proxy\n index: index,\n newValue: newValue\n });\n if (!change) {\n return;\n }\n newValue = change.newValue;\n }\n newValue = this.enhancer_(newValue, oldValue);\n var changed = newValue !== oldValue;\n if (changed) {\n values[index] = newValue;\n this.notifyArrayChildUpdate_(index, newValue, oldValue);\n }\n } else {\n // For out of bound index, we don't create an actual sparse array,\n // but rather fill the holes with undefined (same as setArrayLength_).\n // This could be considered a bug.\n var newItems = new Array(index + 1 - values.length);\n for (var i = 0; i < newItems.length - 1; i++) {\n newItems[i] = undefined;\n } // No Array.fill everywhere...\n newItems[newItems.length - 1] = newValue;\n this.spliceWithArray_(values.length, 0, newItems);\n }\n };\n return ObservableArrayAdministration;\n}();\nfunction createObservableArray(initialValues, enhancer, name, owned) {\n if (name === void 0) {\n name = true ? \"ObservableArray@\" + getNextId() : 0;\n }\n if (owned === void 0) {\n owned = false;\n }\n assertProxies();\n return initObservable(function () {\n var adm = new ObservableArrayAdministration(name, enhancer, owned, false);\n addHiddenFinalProp(adm.values_, $mobx, adm);\n var proxy = new Proxy(adm.values_, arrayTraps);\n adm.proxy_ = proxy;\n if (initialValues && initialValues.length) {\n adm.spliceWithArray_(0, 0, initialValues);\n }\n return proxy;\n });\n}\n// eslint-disable-next-line\nvar arrayExtensions = {\n clear: function clear() {\n return this.splice(0);\n },\n replace: function replace(newItems) {\n var adm = this[$mobx];\n return adm.spliceWithArray_(0, adm.values_.length, newItems);\n },\n // Used by JSON.stringify\n toJSON: function toJSON() {\n return this.slice();\n },\n /*\n * functions that do alter the internal structure of the array, (based on lib.es6.d.ts)\n * since these functions alter the inner structure of the array, the have side effects.\n * Because the have side effects, they should not be used in computed function,\n * and for that reason the do not call dependencyState.notifyObserved\n */\n splice: function splice(index, deleteCount) {\n for (var _len = arguments.length, newItems = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {\n newItems[_key - 2] = arguments[_key];\n }\n var adm = this[$mobx];\n switch (arguments.length) {\n case 0:\n return [];\n case 1:\n return adm.spliceWithArray_(index);\n case 2:\n return adm.spliceWithArray_(index, deleteCount);\n }\n return adm.spliceWithArray_(index, deleteCount, newItems);\n },\n spliceWithArray: function spliceWithArray(index, deleteCount, newItems) {\n return this[$mobx].spliceWithArray_(index, deleteCount, newItems);\n },\n push: function push() {\n var adm = this[$mobx];\n for (var _len2 = arguments.length, items = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n items[_key2] = arguments[_key2];\n }\n adm.spliceWithArray_(adm.values_.length, 0, items);\n return adm.values_.length;\n },\n pop: function pop() {\n return this.splice(Math.max(this[$mobx].values_.length - 1, 0), 1)[0];\n },\n shift: function shift() {\n return this.splice(0, 1)[0];\n },\n unshift: function unshift() {\n var adm = this[$mobx];\n for (var _len3 = arguments.length, items = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n items[_key3] = arguments[_key3];\n }\n adm.spliceWithArray_(0, 0, items);\n return adm.values_.length;\n },\n reverse: function reverse() {\n // reverse by default mutates in place before returning the result\n // which makes it both a 'derivation' and a 'mutation'.\n if (globalState.trackingDerivation) {\n die(37, \"reverse\");\n }\n this.replace(this.slice().reverse());\n return this;\n },\n sort: function sort() {\n // sort by default mutates in place before returning the result\n // which goes against all good practices. Let's not change the array in place!\n if (globalState.trackingDerivation) {\n die(37, \"sort\");\n }\n var copy = this.slice();\n copy.sort.apply(copy, arguments);\n this.replace(copy);\n return this;\n },\n remove: function remove(value) {\n var adm = this[$mobx];\n var idx = adm.dehanceValues_(adm.values_).indexOf(value);\n if (idx > -1) {\n this.splice(idx, 1);\n return true;\n }\n return false;\n }\n};\n/**\n * Wrap function from prototype\n * Without this, everything works as well, but this works\n * faster as everything works on unproxied values\n */\naddArrayExtension(\"at\", simpleFunc);\naddArrayExtension(\"concat\", simpleFunc);\naddArrayExtension(\"flat\", simpleFunc);\naddArrayExtension(\"includes\", simpleFunc);\naddArrayExtension(\"indexOf\", simpleFunc);\naddArrayExtension(\"join\", simpleFunc);\naddArrayExtension(\"lastIndexOf\", simpleFunc);\naddArrayExtension(\"slice\", simpleFunc);\naddArrayExtension(\"toString\", simpleFunc);\naddArrayExtension(\"toLocaleString\", simpleFunc);\naddArrayExtension(\"toSorted\", simpleFunc);\naddArrayExtension(\"toSpliced\", simpleFunc);\naddArrayExtension(\"with\", simpleFunc);\n// map\naddArrayExtension(\"every\", mapLikeFunc);\naddArrayExtension(\"filter\", mapLikeFunc);\naddArrayExtension(\"find\", mapLikeFunc);\naddArrayExtension(\"findIndex\", mapLikeFunc);\naddArrayExtension(\"findLast\", mapLikeFunc);\naddArrayExtension(\"findLastIndex\", mapLikeFunc);\naddArrayExtension(\"flatMap\", mapLikeFunc);\naddArrayExtension(\"forEach\", mapLikeFunc);\naddArrayExtension(\"map\", mapLikeFunc);\naddArrayExtension(\"some\", mapLikeFunc);\naddArrayExtension(\"toReversed\", mapLikeFunc);\n// reduce\naddArrayExtension(\"reduce\", reduceLikeFunc);\naddArrayExtension(\"reduceRight\", reduceLikeFunc);\nfunction addArrayExtension(funcName, funcFactory) {\n if (typeof Array.prototype[funcName] === \"function\") {\n arrayExtensions[funcName] = funcFactory(funcName);\n }\n}\n// Report and delegate to dehanced array\nfunction simpleFunc(funcName) {\n return function () {\n var adm = this[$mobx];\n adm.atom_.reportObserved();\n var dehancedValues = adm.dehanceValues_(adm.values_);\n return dehancedValues[funcName].apply(dehancedValues, arguments);\n };\n}\n// Make sure callbacks receive correct array arg #2326\nfunction mapLikeFunc(funcName) {\n return function (callback, thisArg) {\n var _this2 = this;\n var adm = this[$mobx];\n adm.atom_.reportObserved();\n var dehancedValues = adm.dehanceValues_(adm.values_);\n return dehancedValues[funcName](function (element, index) {\n return callback.call(thisArg, element, index, _this2);\n });\n };\n}\n// Make sure callbacks receive correct array arg #2326\nfunction reduceLikeFunc(funcName) {\n return function () {\n var _this3 = this;\n var adm = this[$mobx];\n adm.atom_.reportObserved();\n var dehancedValues = adm.dehanceValues_(adm.values_);\n // #2432 - reduce behavior depends on arguments.length\n var callback = arguments[0];\n arguments[0] = function (accumulator, currentValue, index) {\n return callback(accumulator, currentValue, index, _this3);\n };\n return dehancedValues[funcName].apply(dehancedValues, arguments);\n };\n}\nvar isObservableArrayAdministration = /*#__PURE__*/createInstanceofPredicate(\"ObservableArrayAdministration\", ObservableArrayAdministration);\nfunction isObservableArray(thing) {\n return isObject(thing) && isObservableArrayAdministration(thing[$mobx]);\n}\n\nvar ObservableMapMarker = {};\nvar ADD = \"add\";\nvar DELETE = \"delete\";\n// just extend Map? See also https://gist.github.com/nestharus/13b4d74f2ef4a2f4357dbd3fc23c1e54\n// But: https://github.com/mobxjs/mobx/issues/1556\nvar ObservableMap = /*#__PURE__*/function () {\n function ObservableMap(initialData, enhancer_, name_) {\n var _this = this;\n if (enhancer_ === void 0) {\n enhancer_ = deepEnhancer;\n }\n if (name_ === void 0) {\n name_ = true ? \"ObservableMap@\" + getNextId() : 0;\n }\n this.enhancer_ = void 0;\n this.name_ = void 0;\n this[$mobx] = ObservableMapMarker;\n this.data_ = void 0;\n this.hasMap_ = void 0;\n // hasMap, not hashMap >-).\n this.keysAtom_ = void 0;\n this.interceptors_ = void 0;\n this.changeListeners_ = void 0;\n this.dehancer = void 0;\n this.enhancer_ = enhancer_;\n this.name_ = name_;\n if (!isFunction(Map)) {\n die(18);\n }\n initObservable(function () {\n _this.keysAtom_ = createAtom( true ? _this.name_ + \".keys()\" : 0);\n _this.data_ = new Map();\n _this.hasMap_ = new Map();\n if (initialData) {\n _this.merge(initialData);\n }\n });\n }\n var _proto = ObservableMap.prototype;\n _proto.has_ = function has_(key) {\n return this.data_.has(key);\n };\n _proto.has = function has(key) {\n var _this2 = this;\n if (!globalState.trackingDerivation) {\n return this.has_(key);\n }\n var entry = this.hasMap_.get(key);\n if (!entry) {\n var newEntry = entry = new ObservableValue(this.has_(key), referenceEnhancer, true ? this.name_ + \".\" + stringifyKey(key) + \"?\" : 0, false);\n this.hasMap_.set(key, newEntry);\n onBecomeUnobserved(newEntry, function () {\n return _this2.hasMap_[\"delete\"](key);\n });\n }\n return entry.get();\n };\n _proto.set = function set(key, value) {\n var hasKey = this.has_(key);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: hasKey ? UPDATE : ADD,\n object: this,\n newValue: value,\n name: key\n });\n if (!change) {\n return this;\n }\n value = change.newValue;\n }\n if (hasKey) {\n this.updateValue_(key, value);\n } else {\n this.addValue_(key, value);\n }\n return this;\n };\n _proto[\"delete\"] = function _delete(key) {\n var _this3 = this;\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: DELETE,\n object: this,\n name: key\n });\n if (!change) {\n return false;\n }\n }\n if (this.has_(key)) {\n var notifySpy = isSpyEnabled();\n var notify = hasListeners(this);\n var _change = notify || notifySpy ? {\n observableKind: \"map\",\n debugObjectName: this.name_,\n type: DELETE,\n object: this,\n oldValue: this.data_.get(key).value_,\n name: key\n } : null;\n if ( true && notifySpy) {\n spyReportStart(_change);\n } // TODO fix type\n transaction(function () {\n var _this3$hasMap_$get;\n _this3.keysAtom_.reportChanged();\n (_this3$hasMap_$get = _this3.hasMap_.get(key)) == null || _this3$hasMap_$get.setNewValue_(false);\n var observable = _this3.data_.get(key);\n observable.setNewValue_(undefined);\n _this3.data_[\"delete\"](key);\n });\n if (notify) {\n notifyListeners(this, _change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n return true;\n }\n return false;\n };\n _proto.updateValue_ = function updateValue_(key, newValue) {\n var observable = this.data_.get(key);\n newValue = observable.prepareNewValue_(newValue);\n if (newValue !== globalState.UNCHANGED) {\n var notifySpy = isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"map\",\n debugObjectName: this.name_,\n type: UPDATE,\n object: this,\n oldValue: observable.value_,\n name: key,\n newValue: newValue\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n } // TODO fix type\n observable.setNewValue_(newValue);\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n };\n _proto.addValue_ = function addValue_(key, newValue) {\n var _this4 = this;\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n transaction(function () {\n var _this4$hasMap_$get;\n var observable = new ObservableValue(newValue, _this4.enhancer_, true ? _this4.name_ + \".\" + stringifyKey(key) : 0, false);\n _this4.data_.set(key, observable);\n newValue = observable.value_; // value might have been changed\n (_this4$hasMap_$get = _this4.hasMap_.get(key)) == null || _this4$hasMap_$get.setNewValue_(true);\n _this4.keysAtom_.reportChanged();\n });\n var notifySpy = isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"map\",\n debugObjectName: this.name_,\n type: ADD,\n object: this,\n name: key,\n newValue: newValue\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n } // TODO fix type\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n };\n _proto.get = function get(key) {\n if (this.has(key)) {\n return this.dehanceValue_(this.data_.get(key).get());\n }\n return this.dehanceValue_(undefined);\n };\n _proto.dehanceValue_ = function dehanceValue_(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.keys = function keys() {\n this.keysAtom_.reportObserved();\n return this.data_.keys();\n };\n _proto.values = function values() {\n var self = this;\n var keys = this.keys();\n return makeIterable({\n next: function next() {\n var _keys$next = keys.next(),\n done = _keys$next.done,\n value = _keys$next.value;\n return {\n done: done,\n value: done ? undefined : self.get(value)\n };\n }\n });\n };\n _proto.entries = function entries() {\n var self = this;\n var keys = this.keys();\n return makeIterable({\n next: function next() {\n var _keys$next2 = keys.next(),\n done = _keys$next2.done,\n value = _keys$next2.value;\n return {\n done: done,\n value: done ? undefined : [value, self.get(value)]\n };\n }\n });\n };\n _proto[Symbol.iterator] = function () {\n return this.entries();\n };\n _proto.forEach = function forEach(callback, thisArg) {\n for (var _iterator = _createForOfIteratorHelperLoose(this), _step; !(_step = _iterator()).done;) {\n var _step$value = _step.value,\n key = _step$value[0],\n value = _step$value[1];\n callback.call(thisArg, value, key, this);\n }\n }\n /** Merge another object into this object, returns this. */;\n _proto.merge = function merge(other) {\n var _this5 = this;\n if (isObservableMap(other)) {\n other = new Map(other);\n }\n transaction(function () {\n if (isPlainObject(other)) {\n getPlainObjectKeys(other).forEach(function (key) {\n return _this5.set(key, other[key]);\n });\n } else if (Array.isArray(other)) {\n other.forEach(function (_ref) {\n var key = _ref[0],\n value = _ref[1];\n return _this5.set(key, value);\n });\n } else if (isES6Map(other)) {\n if (!isPlainES6Map(other)) {\n die(19, other);\n }\n other.forEach(function (value, key) {\n return _this5.set(key, value);\n });\n } else if (other !== null && other !== undefined) {\n die(20, other);\n }\n });\n return this;\n };\n _proto.clear = function clear() {\n var _this6 = this;\n transaction(function () {\n untracked(function () {\n for (var _iterator2 = _createForOfIteratorHelperLoose(_this6.keys()), _step2; !(_step2 = _iterator2()).done;) {\n var key = _step2.value;\n _this6[\"delete\"](key);\n }\n });\n });\n };\n _proto.replace = function replace(values) {\n var _this7 = this;\n // Implementation requirements:\n // - respect ordering of replacement map\n // - allow interceptors to run and potentially prevent individual operations\n // - don't recreate observables that already exist in original map (so we don't destroy existing subscriptions)\n // - don't _keysAtom.reportChanged if the keys of resulting map are indentical (order matters!)\n // - note that result map may differ from replacement map due to the interceptors\n transaction(function () {\n // Convert to map so we can do quick key lookups\n var replacementMap = convertToMap(values);\n var orderedData = new Map();\n // Used for optimization\n var keysReportChangedCalled = false;\n // Delete keys that don't exist in replacement map\n // if the key deletion is prevented by interceptor\n // add entry at the beginning of the result map\n for (var _iterator3 = _createForOfIteratorHelperLoose(_this7.data_.keys()), _step3; !(_step3 = _iterator3()).done;) {\n var key = _step3.value;\n // Concurrently iterating/deleting keys\n // iterator should handle this correctly\n if (!replacementMap.has(key)) {\n var deleted = _this7[\"delete\"](key);\n // Was the key removed?\n if (deleted) {\n // _keysAtom.reportChanged() was already called\n keysReportChangedCalled = true;\n } else {\n // Delete prevented by interceptor\n var value = _this7.data_.get(key);\n orderedData.set(key, value);\n }\n }\n }\n // Merge entries\n for (var _iterator4 = _createForOfIteratorHelperLoose(replacementMap.entries()), _step4; !(_step4 = _iterator4()).done;) {\n var _step4$value = _step4.value,\n _key = _step4$value[0],\n _value = _step4$value[1];\n // We will want to know whether a new key is added\n var keyExisted = _this7.data_.has(_key);\n // Add or update value\n _this7.set(_key, _value);\n // The addition could have been prevent by interceptor\n if (_this7.data_.has(_key)) {\n // The update could have been prevented by interceptor\n // and also we want to preserve existing values\n // so use value from _data map (instead of replacement map)\n var _value2 = _this7.data_.get(_key);\n orderedData.set(_key, _value2);\n // Was a new key added?\n if (!keyExisted) {\n // _keysAtom.reportChanged() was already called\n keysReportChangedCalled = true;\n }\n }\n }\n // Check for possible key order change\n if (!keysReportChangedCalled) {\n if (_this7.data_.size !== orderedData.size) {\n // If size differs, keys are definitely modified\n _this7.keysAtom_.reportChanged();\n } else {\n var iter1 = _this7.data_.keys();\n var iter2 = orderedData.keys();\n var next1 = iter1.next();\n var next2 = iter2.next();\n while (!next1.done) {\n if (next1.value !== next2.value) {\n _this7.keysAtom_.reportChanged();\n break;\n }\n next1 = iter1.next();\n next2 = iter2.next();\n }\n }\n }\n // Use correctly ordered map\n _this7.data_ = orderedData;\n });\n return this;\n };\n _proto.toString = function toString() {\n return \"[object ObservableMap]\";\n };\n _proto.toJSON = function toJSON() {\n return Array.from(this);\n };\n /**\n * Observes this object. Triggers for the events 'add', 'update' and 'delete'.\n * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe\n * for callback details\n */\n _proto.observe_ = function observe_(listener, fireImmediately) {\n if ( true && fireImmediately === true) {\n die(\"`observe` doesn't support fireImmediately=true in combination with maps.\");\n }\n return registerListener(this, listener);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n return _createClass(ObservableMap, [{\n key: \"size\",\n get: function get() {\n this.keysAtom_.reportObserved();\n return this.data_.size;\n }\n }, {\n key: Symbol.toStringTag,\n get: function get() {\n return \"Map\";\n }\n }]);\n}();\n// eslint-disable-next-line\nvar isObservableMap = /*#__PURE__*/createInstanceofPredicate(\"ObservableMap\", ObservableMap);\nfunction convertToMap(dataStructure) {\n if (isES6Map(dataStructure) || isObservableMap(dataStructure)) {\n return dataStructure;\n } else if (Array.isArray(dataStructure)) {\n return new Map(dataStructure);\n } else if (isPlainObject(dataStructure)) {\n var map = new Map();\n for (var key in dataStructure) {\n map.set(key, dataStructure[key]);\n }\n return map;\n } else {\n return die(21, dataStructure);\n }\n}\n\nvar ObservableSetMarker = {};\nvar ObservableSet = /*#__PURE__*/function () {\n function ObservableSet(initialData, enhancer, name_) {\n var _this = this;\n if (enhancer === void 0) {\n enhancer = deepEnhancer;\n }\n if (name_ === void 0) {\n name_ = true ? \"ObservableSet@\" + getNextId() : 0;\n }\n this.name_ = void 0;\n this[$mobx] = ObservableSetMarker;\n this.data_ = new Set();\n this.atom_ = void 0;\n this.changeListeners_ = void 0;\n this.interceptors_ = void 0;\n this.dehancer = void 0;\n this.enhancer_ = void 0;\n this.name_ = name_;\n if (!isFunction(Set)) {\n die(22);\n }\n this.enhancer_ = function (newV, oldV) {\n return enhancer(newV, oldV, name_);\n };\n initObservable(function () {\n _this.atom_ = createAtom(_this.name_);\n if (initialData) {\n _this.replace(initialData);\n }\n });\n }\n var _proto = ObservableSet.prototype;\n _proto.dehanceValue_ = function dehanceValue_(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.clear = function clear() {\n var _this2 = this;\n transaction(function () {\n untracked(function () {\n for (var _iterator = _createForOfIteratorHelperLoose(_this2.data_.values()), _step; !(_step = _iterator()).done;) {\n var value = _step.value;\n _this2[\"delete\"](value);\n }\n });\n });\n };\n _proto.forEach = function forEach(callbackFn, thisArg) {\n for (var _iterator2 = _createForOfIteratorHelperLoose(this), _step2; !(_step2 = _iterator2()).done;) {\n var value = _step2.value;\n callbackFn.call(thisArg, value, value, this);\n }\n };\n _proto.add = function add(value) {\n var _this3 = this;\n checkIfStateModificationsAreAllowed(this.atom_);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: ADD,\n object: this,\n newValue: value\n });\n if (!change) {\n return this;\n }\n // ideally, value = change.value would be done here, so that values can be\n // changed by interceptor. Same applies for other Set and Map api's.\n }\n if (!this.has(value)) {\n transaction(function () {\n _this3.data_.add(_this3.enhancer_(value, undefined));\n _this3.atom_.reportChanged();\n });\n var notifySpy = true && isSpyEnabled();\n var notify = hasListeners(this);\n var _change = notify || notifySpy ? {\n observableKind: \"set\",\n debugObjectName: this.name_,\n type: ADD,\n object: this,\n newValue: value\n } : null;\n if (notifySpy && \"development\" !== \"production\") {\n spyReportStart(_change);\n }\n if (notify) {\n notifyListeners(this, _change);\n }\n if (notifySpy && \"development\" !== \"production\") {\n spyReportEnd();\n }\n }\n return this;\n };\n _proto[\"delete\"] = function _delete(value) {\n var _this4 = this;\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: DELETE,\n object: this,\n oldValue: value\n });\n if (!change) {\n return false;\n }\n }\n if (this.has(value)) {\n var notifySpy = true && isSpyEnabled();\n var notify = hasListeners(this);\n var _change2 = notify || notifySpy ? {\n observableKind: \"set\",\n debugObjectName: this.name_,\n type: DELETE,\n object: this,\n oldValue: value\n } : null;\n if (notifySpy && \"development\" !== \"production\") {\n spyReportStart(_change2);\n }\n transaction(function () {\n _this4.atom_.reportChanged();\n _this4.data_[\"delete\"](value);\n });\n if (notify) {\n notifyListeners(this, _change2);\n }\n if (notifySpy && \"development\" !== \"production\") {\n spyReportEnd();\n }\n return true;\n }\n return false;\n };\n _proto.has = function has(value) {\n this.atom_.reportObserved();\n return this.data_.has(this.dehanceValue_(value));\n };\n _proto.entries = function entries() {\n var nextIndex = 0;\n var keys = Array.from(this.keys());\n var values = Array.from(this.values());\n return makeIterable({\n next: function next() {\n var index = nextIndex;\n nextIndex += 1;\n return index < values.length ? {\n value: [keys[index], values[index]],\n done: false\n } : {\n done: true\n };\n }\n });\n };\n _proto.keys = function keys() {\n return this.values();\n };\n _proto.values = function values() {\n this.atom_.reportObserved();\n var self = this;\n var nextIndex = 0;\n var observableValues = Array.from(this.data_.values());\n return makeIterable({\n next: function next() {\n return nextIndex < observableValues.length ? {\n value: self.dehanceValue_(observableValues[nextIndex++]),\n done: false\n } : {\n done: true\n };\n }\n });\n };\n _proto.intersection = function intersection(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.intersection(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.intersection(otherSet);\n }\n };\n _proto.union = function union(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.union(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.union(otherSet);\n }\n };\n _proto.difference = function difference(otherSet) {\n return new Set(this).difference(otherSet);\n };\n _proto.symmetricDifference = function symmetricDifference(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.symmetricDifference(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.symmetricDifference(otherSet);\n }\n };\n _proto.isSubsetOf = function isSubsetOf(otherSet) {\n return new Set(this).isSubsetOf(otherSet);\n };\n _proto.isSupersetOf = function isSupersetOf(otherSet) {\n return new Set(this).isSupersetOf(otherSet);\n };\n _proto.isDisjointFrom = function isDisjointFrom(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.isDisjointFrom(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.isDisjointFrom(otherSet);\n }\n };\n _proto.replace = function replace(other) {\n var _this5 = this;\n if (isObservableSet(other)) {\n other = new Set(other);\n }\n transaction(function () {\n if (Array.isArray(other)) {\n _this5.clear();\n other.forEach(function (value) {\n return _this5.add(value);\n });\n } else if (isES6Set(other)) {\n _this5.clear();\n other.forEach(function (value) {\n return _this5.add(value);\n });\n } else if (other !== null && other !== undefined) {\n die(\"Cannot initialize set from \" + other);\n }\n });\n return this;\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n // ... 'fireImmediately' could also be true?\n if ( true && fireImmediately === true) {\n die(\"`observe` doesn't support fireImmediately=true in combination with sets.\");\n }\n return registerListener(this, listener);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.toJSON = function toJSON() {\n return Array.from(this);\n };\n _proto.toString = function toString() {\n return \"[object ObservableSet]\";\n };\n _proto[Symbol.iterator] = function () {\n return this.values();\n };\n return _createClass(ObservableSet, [{\n key: \"size\",\n get: function get() {\n this.atom_.reportObserved();\n return this.data_.size;\n }\n }, {\n key: Symbol.toStringTag,\n get: function get() {\n return \"Set\";\n }\n }]);\n}();\n// eslint-disable-next-line\nvar isObservableSet = /*#__PURE__*/createInstanceofPredicate(\"ObservableSet\", ObservableSet);\n\nvar descriptorCache = /*#__PURE__*/Object.create(null);\nvar REMOVE = \"remove\";\nvar ObservableObjectAdministration = /*#__PURE__*/function () {\n function ObservableObjectAdministration(target_, values_, name_,\n // Used anytime annotation is not explicitely provided\n defaultAnnotation_) {\n if (values_ === void 0) {\n values_ = new Map();\n }\n if (defaultAnnotation_ === void 0) {\n defaultAnnotation_ = autoAnnotation;\n }\n this.target_ = void 0;\n this.values_ = void 0;\n this.name_ = void 0;\n this.defaultAnnotation_ = void 0;\n this.keysAtom_ = void 0;\n this.changeListeners_ = void 0;\n this.interceptors_ = void 0;\n this.proxy_ = void 0;\n this.isPlainObject_ = void 0;\n this.appliedAnnotations_ = void 0;\n this.pendingKeys_ = void 0;\n this.target_ = target_;\n this.values_ = values_;\n this.name_ = name_;\n this.defaultAnnotation_ = defaultAnnotation_;\n this.keysAtom_ = new Atom( true ? this.name_ + \".keys\" : 0);\n // Optimization: we use this frequently\n this.isPlainObject_ = isPlainObject(this.target_);\n if ( true && !isAnnotation(this.defaultAnnotation_)) {\n die(\"defaultAnnotation must be valid annotation\");\n }\n if (true) {\n // Prepare structure for tracking which fields were already annotated\n this.appliedAnnotations_ = {};\n }\n }\n var _proto = ObservableObjectAdministration.prototype;\n _proto.getObservablePropValue_ = function getObservablePropValue_(key) {\n return this.values_.get(key).get();\n };\n _proto.setObservablePropValue_ = function setObservablePropValue_(key, newValue) {\n var observable = this.values_.get(key);\n if (observable instanceof ComputedValue) {\n observable.set(newValue);\n return true;\n }\n // intercept\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: UPDATE,\n object: this.proxy_ || this.target_,\n name: key,\n newValue: newValue\n });\n if (!change) {\n return null;\n }\n newValue = change.newValue;\n }\n newValue = observable.prepareNewValue_(newValue);\n // notify spy & observers\n if (newValue !== globalState.UNCHANGED) {\n var notify = hasListeners(this);\n var notifySpy = true && isSpyEnabled();\n var _change = notify || notifySpy ? {\n type: UPDATE,\n observableKind: \"object\",\n debugObjectName: this.name_,\n object: this.proxy_ || this.target_,\n oldValue: observable.value_,\n name: key,\n newValue: newValue\n } : null;\n if ( true && notifySpy) {\n spyReportStart(_change);\n }\n observable.setNewValue_(newValue);\n if (notify) {\n notifyListeners(this, _change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n return true;\n };\n _proto.get_ = function get_(key) {\n if (globalState.trackingDerivation && !hasProp(this.target_, key)) {\n // Key doesn't exist yet, subscribe for it in case it's added later\n this.has_(key);\n }\n return this.target_[key];\n }\n /**\n * @param {PropertyKey} key\n * @param {any} value\n * @param {Annotation|boolean} annotation true - use default annotation, false - copy as is\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.set_ = function set_(key, value, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n // Don't use .has(key) - we care about own\n if (hasProp(this.target_, key)) {\n // Existing prop\n if (this.values_.has(key)) {\n // Observable (can be intercepted)\n return this.setObservablePropValue_(key, value);\n } else if (proxyTrap) {\n // Non-observable - proxy\n return Reflect.set(this.target_, key, value);\n } else {\n // Non-observable\n this.target_[key] = value;\n return true;\n }\n } else {\n // New prop\n return this.extend_(key, {\n value: value,\n enumerable: true,\n writable: true,\n configurable: true\n }, this.defaultAnnotation_, proxyTrap);\n }\n }\n // Trap for \"in\"\n ;\n _proto.has_ = function has_(key) {\n if (!globalState.trackingDerivation) {\n // Skip key subscription outside derivation\n return key in this.target_;\n }\n this.pendingKeys_ || (this.pendingKeys_ = new Map());\n var entry = this.pendingKeys_.get(key);\n if (!entry) {\n entry = new ObservableValue(key in this.target_, referenceEnhancer, true ? this.name_ + \".\" + stringifyKey(key) + \"?\" : 0, false);\n this.pendingKeys_.set(key, entry);\n }\n return entry.get();\n }\n /**\n * @param {PropertyKey} key\n * @param {Annotation|boolean} annotation true - use default annotation, false - ignore prop\n */;\n _proto.make_ = function make_(key, annotation) {\n if (annotation === true) {\n annotation = this.defaultAnnotation_;\n }\n if (annotation === false) {\n return;\n }\n assertAnnotable(this, annotation, key);\n if (!(key in this.target_)) {\n var _this$target_$storedA;\n // Throw on missing key, except for decorators:\n // Decorator annotations are collected from whole prototype chain.\n // When called from super() some props may not exist yet.\n // However we don't have to worry about missing prop,\n // because the decorator must have been applied to something.\n if ((_this$target_$storedA = this.target_[storedAnnotationsSymbol]) != null && _this$target_$storedA[key]) {\n return; // will be annotated by subclass constructor\n } else {\n die(1, annotation.annotationType_, this.name_ + \".\" + key.toString());\n }\n }\n var source = this.target_;\n while (source && source !== objectPrototype) {\n var descriptor = getDescriptor(source, key);\n if (descriptor) {\n var outcome = annotation.make_(this, key, descriptor, source);\n if (outcome === 0 /* MakeResult.Cancel */) {\n return;\n }\n if (outcome === 1 /* MakeResult.Break */) {\n break;\n }\n }\n source = Object.getPrototypeOf(source);\n }\n recordAnnotationApplied(this, annotation, key);\n }\n /**\n * @param {PropertyKey} key\n * @param {PropertyDescriptor} descriptor\n * @param {Annotation|boolean} annotation true - use default annotation, false - copy as is\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.extend_ = function extend_(key, descriptor, annotation, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n if (annotation === true) {\n annotation = this.defaultAnnotation_;\n }\n if (annotation === false) {\n return this.defineProperty_(key, descriptor, proxyTrap);\n }\n assertAnnotable(this, annotation, key);\n var outcome = annotation.extend_(this, key, descriptor, proxyTrap);\n if (outcome) {\n recordAnnotationApplied(this, annotation, key);\n }\n return outcome;\n }\n /**\n * @param {PropertyKey} key\n * @param {PropertyDescriptor} descriptor\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.defineProperty_ = function defineProperty_(key, descriptor, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n try {\n startBatch();\n // Delete\n var deleteOutcome = this.delete_(key);\n if (!deleteOutcome) {\n // Failure or intercepted\n return deleteOutcome;\n }\n // ADD interceptor\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: ADD,\n newValue: descriptor.value\n });\n if (!change) {\n return null;\n }\n var newValue = change.newValue;\n if (descriptor.value !== newValue) {\n descriptor = _extends({}, descriptor, {\n value: newValue\n });\n }\n }\n // Define\n if (proxyTrap) {\n if (!Reflect.defineProperty(this.target_, key, descriptor)) {\n return false;\n }\n } else {\n defineProperty(this.target_, key, descriptor);\n }\n // Notify\n this.notifyPropertyAddition_(key, descriptor.value);\n } finally {\n endBatch();\n }\n return true;\n }\n // If original descriptor becomes relevant, move this to annotation directly\n ;\n _proto.defineObservableProperty_ = function defineObservableProperty_(key, value, enhancer, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n try {\n startBatch();\n // Delete\n var deleteOutcome = this.delete_(key);\n if (!deleteOutcome) {\n // Failure or intercepted\n return deleteOutcome;\n }\n // ADD interceptor\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: ADD,\n newValue: value\n });\n if (!change) {\n return null;\n }\n value = change.newValue;\n }\n var cachedDescriptor = getCachedObservablePropDescriptor(key);\n var descriptor = {\n configurable: globalState.safeDescriptors ? this.isPlainObject_ : true,\n enumerable: true,\n get: cachedDescriptor.get,\n set: cachedDescriptor.set\n };\n // Define\n if (proxyTrap) {\n if (!Reflect.defineProperty(this.target_, key, descriptor)) {\n return false;\n }\n } else {\n defineProperty(this.target_, key, descriptor);\n }\n var observable = new ObservableValue(value, enhancer, true ? this.name_ + \".\" + key.toString() : 0, false);\n this.values_.set(key, observable);\n // Notify (value possibly changed by ObservableValue)\n this.notifyPropertyAddition_(key, observable.value_);\n } finally {\n endBatch();\n }\n return true;\n }\n // If original descriptor becomes relevant, move this to annotation directly\n ;\n _proto.defineComputedProperty_ = function defineComputedProperty_(key, options, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n try {\n startBatch();\n // Delete\n var deleteOutcome = this.delete_(key);\n if (!deleteOutcome) {\n // Failure or intercepted\n return deleteOutcome;\n }\n // ADD interceptor\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: ADD,\n newValue: undefined\n });\n if (!change) {\n return null;\n }\n }\n options.name || (options.name = true ? this.name_ + \".\" + key.toString() : 0);\n options.context = this.proxy_ || this.target_;\n var cachedDescriptor = getCachedObservablePropDescriptor(key);\n var descriptor = {\n configurable: globalState.safeDescriptors ? this.isPlainObject_ : true,\n enumerable: false,\n get: cachedDescriptor.get,\n set: cachedDescriptor.set\n };\n // Define\n if (proxyTrap) {\n if (!Reflect.defineProperty(this.target_, key, descriptor)) {\n return false;\n }\n } else {\n defineProperty(this.target_, key, descriptor);\n }\n this.values_.set(key, new ComputedValue(options));\n // Notify\n this.notifyPropertyAddition_(key, undefined);\n } finally {\n endBatch();\n }\n return true;\n }\n /**\n * @param {PropertyKey} key\n * @param {PropertyDescriptor} descriptor\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.delete_ = function delete_(key, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n // No such prop\n if (!hasProp(this.target_, key)) {\n return true;\n }\n // Intercept\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: REMOVE\n });\n // Cancelled\n if (!change) {\n return null;\n }\n }\n // Delete\n try {\n var _this$pendingKeys_;\n startBatch();\n var notify = hasListeners(this);\n var notifySpy = true && isSpyEnabled();\n var observable = this.values_.get(key);\n // Value needed for spies/listeners\n var value = undefined;\n // Optimization: don't pull the value unless we will need it\n if (!observable && (notify || notifySpy)) {\n var _getDescriptor;\n value = (_getDescriptor = getDescriptor(this.target_, key)) == null ? void 0 : _getDescriptor.value;\n }\n // delete prop (do first, may fail)\n if (proxyTrap) {\n if (!Reflect.deleteProperty(this.target_, key)) {\n return false;\n }\n } else {\n delete this.target_[key];\n }\n // Allow re-annotating this field\n if (true) {\n delete this.appliedAnnotations_[key];\n }\n // Clear observable\n if (observable) {\n this.values_[\"delete\"](key);\n // for computed, value is undefined\n if (observable instanceof ObservableValue) {\n value = observable.value_;\n }\n // Notify: autorun(() => obj[key]), see #1796\n propagateChanged(observable);\n }\n // Notify \"keys/entries/values\" observers\n this.keysAtom_.reportChanged();\n // Notify \"has\" observers\n // \"in\" as it may still exist in proto\n (_this$pendingKeys_ = this.pendingKeys_) == null || (_this$pendingKeys_ = _this$pendingKeys_.get(key)) == null || _this$pendingKeys_.set(key in this.target_);\n // Notify spies/listeners\n if (notify || notifySpy) {\n var _change2 = {\n type: REMOVE,\n observableKind: \"object\",\n object: this.proxy_ || this.target_,\n debugObjectName: this.name_,\n oldValue: value,\n name: key\n };\n if ( true && notifySpy) {\n spyReportStart(_change2);\n }\n if (notify) {\n notifyListeners(this, _change2);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n } finally {\n endBatch();\n }\n return true;\n }\n /**\n * Observes this object. Triggers for the events 'add', 'update' and 'delete'.\n * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe\n * for callback details\n */;\n _proto.observe_ = function observe_(callback, fireImmediately) {\n if ( true && fireImmediately === true) {\n die(\"`observe` doesn't support the fire immediately property for observable objects.\");\n }\n return registerListener(this, callback);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.notifyPropertyAddition_ = function notifyPropertyAddition_(key, value) {\n var _this$pendingKeys_2;\n var notify = hasListeners(this);\n var notifySpy = true && isSpyEnabled();\n if (notify || notifySpy) {\n var change = notify || notifySpy ? {\n type: ADD,\n observableKind: \"object\",\n debugObjectName: this.name_,\n object: this.proxy_ || this.target_,\n name: key,\n newValue: value\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n }\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n (_this$pendingKeys_2 = this.pendingKeys_) == null || (_this$pendingKeys_2 = _this$pendingKeys_2.get(key)) == null || _this$pendingKeys_2.set(true);\n // Notify \"keys/entries/values\" observers\n this.keysAtom_.reportChanged();\n };\n _proto.ownKeys_ = function ownKeys_() {\n this.keysAtom_.reportObserved();\n return ownKeys(this.target_);\n };\n _proto.keys_ = function keys_() {\n // Returns enumerable && own, but unfortunately keysAtom will report on ANY key change.\n // There is no way to distinguish between Object.keys(object) and Reflect.ownKeys(object) - both are handled by ownKeys trap.\n // We can either over-report in Object.keys(object) or under-report in Reflect.ownKeys(object)\n // We choose to over-report in Object.keys(object), because:\n // - typically it's used with simple data objects\n // - when symbolic/non-enumerable keys are relevant Reflect.ownKeys works as expected\n this.keysAtom_.reportObserved();\n return Object.keys(this.target_);\n };\n return ObservableObjectAdministration;\n}();\nfunction asObservableObject(target, options) {\n var _options$name;\n if ( true && options && isObservableObject(target)) {\n die(\"Options can't be provided for already observable objects.\");\n }\n if (hasProp(target, $mobx)) {\n if ( true && !(getAdministration(target) instanceof ObservableObjectAdministration)) {\n die(\"Cannot convert '\" + getDebugName(target) + \"' into observable object:\" + \"\\nThe target is already observable of different type.\" + \"\\nExtending builtins is not supported.\");\n }\n return target;\n }\n if ( true && !Object.isExtensible(target)) {\n die(\"Cannot make the designated object observable; it is not extensible\");\n }\n var name = (_options$name = options == null ? void 0 : options.name) != null ? _options$name : true ? (isPlainObject(target) ? \"ObservableObject\" : target.constructor.name) + \"@\" + getNextId() : 0;\n var adm = new ObservableObjectAdministration(target, new Map(), String(name), getAnnotationFromOptions(options));\n addHiddenProp(target, $mobx, adm);\n return target;\n}\nvar isObservableObjectAdministration = /*#__PURE__*/createInstanceofPredicate(\"ObservableObjectAdministration\", ObservableObjectAdministration);\nfunction getCachedObservablePropDescriptor(key) {\n return descriptorCache[key] || (descriptorCache[key] = {\n get: function get() {\n return this[$mobx].getObservablePropValue_(key);\n },\n set: function set(value) {\n return this[$mobx].setObservablePropValue_(key, value);\n }\n });\n}\nfunction isObservableObject(thing) {\n if (isObject(thing)) {\n return isObservableObjectAdministration(thing[$mobx]);\n }\n return false;\n}\nfunction recordAnnotationApplied(adm, annotation, key) {\n var _adm$target_$storedAn;\n if (true) {\n adm.appliedAnnotations_[key] = annotation;\n }\n // Remove applied decorator annotation so we don't try to apply it again in subclass constructor\n (_adm$target_$storedAn = adm.target_[storedAnnotationsSymbol]) == null || delete _adm$target_$storedAn[key];\n}\nfunction assertAnnotable(adm, annotation, key) {\n // Valid annotation\n if ( true && !isAnnotation(annotation)) {\n die(\"Cannot annotate '\" + adm.name_ + \".\" + key.toString() + \"': Invalid annotation.\");\n }\n /*\n // Configurable, not sealed, not frozen\n // Possibly not needed, just a little better error then the one thrown by engine.\n // Cases where this would be useful the most (subclass field initializer) are not interceptable by this.\n if (__DEV__) {\n const configurable = getDescriptor(adm.target_, key)?.configurable\n const frozen = Object.isFrozen(adm.target_)\n const sealed = Object.isSealed(adm.target_)\n if (!configurable || frozen || sealed) {\n const fieldName = `${adm.name_}.${key.toString()}`\n const requestedAnnotationType = annotation.annotationType_\n let error = `Cannot apply '${requestedAnnotationType}' to '${fieldName}':`\n if (frozen) {\n error += `\\nObject is frozen.`\n }\n if (sealed) {\n error += `\\nObject is sealed.`\n }\n if (!configurable) {\n error += `\\nproperty is not configurable.`\n // Mention only if caused by us to avoid confusion\n if (hasProp(adm.appliedAnnotations!, key)) {\n error += `\\nTo prevent accidental re-definition of a field by a subclass, `\n error += `all annotated fields of non-plain objects (classes) are not configurable.`\n }\n }\n die(error)\n }\n }\n */\n // Not annotated\n if ( true && !isOverride(annotation) && hasProp(adm.appliedAnnotations_, key)) {\n var fieldName = adm.name_ + \".\" + key.toString();\n var currentAnnotationType = adm.appliedAnnotations_[key].annotationType_;\n var requestedAnnotationType = annotation.annotationType_;\n die(\"Cannot apply '\" + requestedAnnotationType + \"' to '\" + fieldName + \"':\" + (\"\\nThe field is already annotated with '\" + currentAnnotationType + \"'.\") + \"\\nRe-annotating fields is not allowed.\" + \"\\nUse 'override' annotation for methods overridden by subclass.\");\n }\n}\n\n// Bug in safari 9.* (or iOS 9 safari mobile). See #364\nvar ENTRY_0 = /*#__PURE__*/createArrayEntryDescriptor(0);\nvar safariPrototypeSetterInheritanceBug = /*#__PURE__*/function () {\n var v = false;\n var p = {};\n Object.defineProperty(p, \"0\", {\n set: function set() {\n v = true;\n }\n });\n /*#__PURE__*/Object.create(p)[\"0\"] = 1;\n return v === false;\n}();\n/**\n * This array buffer contains two lists of properties, so that all arrays\n * can recycle their property definitions, which significantly improves performance of creating\n * properties on the fly.\n */\nvar OBSERVABLE_ARRAY_BUFFER_SIZE = 0;\n// Typescript workaround to make sure ObservableArray extends Array\nvar StubArray = function StubArray() {};\nfunction inherit(ctor, proto) {\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(ctor.prototype, proto);\n } else if (ctor.prototype.__proto__ !== undefined) {\n ctor.prototype.__proto__ = proto;\n } else {\n ctor.prototype = proto;\n }\n}\ninherit(StubArray, Array.prototype);\n// Weex proto freeze protection was here,\n// but it is unclear why the hack is need as MobX never changed the prototype\n// anyway, so removed it in V6\nvar LegacyObservableArray = /*#__PURE__*/function (_StubArray) {\n function LegacyObservableArray(initialValues, enhancer, name, owned) {\n var _this;\n if (name === void 0) {\n name = true ? \"ObservableArray@\" + getNextId() : 0;\n }\n if (owned === void 0) {\n owned = false;\n }\n _this = _StubArray.call(this) || this;\n initObservable(function () {\n var adm = new ObservableArrayAdministration(name, enhancer, owned, true);\n adm.proxy_ = _this;\n addHiddenFinalProp(_this, $mobx, adm);\n if (initialValues && initialValues.length) {\n // @ts-ignore\n _this.spliceWithArray(0, 0, initialValues);\n }\n if (safariPrototypeSetterInheritanceBug) {\n // Seems that Safari won't use numeric prototype setter until any * numeric property is\n // defined on the instance. After that it works fine, even if this property is deleted.\n Object.defineProperty(_this, \"0\", ENTRY_0);\n }\n });\n return _this;\n }\n _inheritsLoose(LegacyObservableArray, _StubArray);\n var _proto = LegacyObservableArray.prototype;\n _proto.concat = function concat() {\n this[$mobx].atom_.reportObserved();\n for (var _len = arguments.length, arrays = new Array(_len), _key = 0; _key < _len; _key++) {\n arrays[_key] = arguments[_key];\n }\n return Array.prototype.concat.apply(this.slice(),\n //@ts-ignore\n arrays.map(function (a) {\n return isObservableArray(a) ? a.slice() : a;\n }));\n };\n _proto[Symbol.iterator] = function () {\n var self = this;\n var nextIndex = 0;\n return makeIterable({\n next: function next() {\n return nextIndex < self.length ? {\n value: self[nextIndex++],\n done: false\n } : {\n done: true,\n value: undefined\n };\n }\n });\n };\n return _createClass(LegacyObservableArray, [{\n key: \"length\",\n get: function get() {\n return this[$mobx].getArrayLength_();\n },\n set: function set(newLength) {\n this[$mobx].setArrayLength_(newLength);\n }\n }, {\n key: Symbol.toStringTag,\n get: function get() {\n return \"Array\";\n }\n }]);\n}(StubArray);\nObject.entries(arrayExtensions).forEach(function (_ref) {\n var prop = _ref[0],\n fn = _ref[1];\n if (prop !== \"concat\") {\n addHiddenProp(LegacyObservableArray.prototype, prop, fn);\n }\n});\nfunction createArrayEntryDescriptor(index) {\n return {\n enumerable: false,\n configurable: true,\n get: function get() {\n return this[$mobx].get_(index);\n },\n set: function set(value) {\n this[$mobx].set_(index, value);\n }\n };\n}\nfunction createArrayBufferItem(index) {\n defineProperty(LegacyObservableArray.prototype, \"\" + index, createArrayEntryDescriptor(index));\n}\nfunction reserveArrayBuffer(max) {\n if (max > OBSERVABLE_ARRAY_BUFFER_SIZE) {\n for (var index = OBSERVABLE_ARRAY_BUFFER_SIZE; index < max + 100; index++) {\n createArrayBufferItem(index);\n }\n OBSERVABLE_ARRAY_BUFFER_SIZE = max;\n }\n}\nreserveArrayBuffer(1000);\nfunction createLegacyArray(initialValues, enhancer, name) {\n return new LegacyObservableArray(initialValues, enhancer, name);\n}\n\nfunction getAtom(thing, property) {\n if (typeof thing === \"object\" && thing !== null) {\n if (isObservableArray(thing)) {\n if (property !== undefined) {\n die(23);\n }\n return thing[$mobx].atom_;\n }\n if (isObservableSet(thing)) {\n return thing.atom_;\n }\n if (isObservableMap(thing)) {\n if (property === undefined) {\n return thing.keysAtom_;\n }\n var observable = thing.data_.get(property) || thing.hasMap_.get(property);\n if (!observable) {\n die(25, property, getDebugName(thing));\n }\n return observable;\n }\n if (isObservableObject(thing)) {\n if (!property) {\n return die(26);\n }\n var _observable = thing[$mobx].values_.get(property);\n if (!_observable) {\n die(27, property, getDebugName(thing));\n }\n return _observable;\n }\n if (isAtom(thing) || isComputedValue(thing) || isReaction(thing)) {\n return thing;\n }\n } else if (isFunction(thing)) {\n if (isReaction(thing[$mobx])) {\n // disposer function\n return thing[$mobx];\n }\n }\n die(28);\n}\nfunction getAdministration(thing, property) {\n if (!thing) {\n die(29);\n }\n if (property !== undefined) {\n return getAdministration(getAtom(thing, property));\n }\n if (isAtom(thing) || isComputedValue(thing) || isReaction(thing)) {\n return thing;\n }\n if (isObservableMap(thing) || isObservableSet(thing)) {\n return thing;\n }\n if (thing[$mobx]) {\n return thing[$mobx];\n }\n die(24, thing);\n}\nfunction getDebugName(thing, property) {\n var named;\n if (property !== undefined) {\n named = getAtom(thing, property);\n } else if (isAction(thing)) {\n return thing.name;\n } else if (isObservableObject(thing) || isObservableMap(thing) || isObservableSet(thing)) {\n named = getAdministration(thing);\n } else {\n // valid for arrays as well\n named = getAtom(thing);\n }\n return named.name_;\n}\n/**\n * Helper function for initializing observable structures, it applies:\n * 1. allowStateChanges so we don't violate enforceActions.\n * 2. untracked so we don't accidentaly subscribe to anything observable accessed during init in case the observable is created inside derivation.\n * 3. batch to avoid state version updates\n */\nfunction initObservable(cb) {\n var derivation = untrackedStart();\n var allowStateChanges = allowStateChangesStart(true);\n startBatch();\n try {\n return cb();\n } finally {\n endBatch();\n allowStateChangesEnd(allowStateChanges);\n untrackedEnd(derivation);\n }\n}\n\nvar toString = objectPrototype.toString;\nfunction deepEqual(a, b, depth) {\n if (depth === void 0) {\n depth = -1;\n }\n return eq(a, b, depth);\n}\n// Copied from https://github.com/jashkenas/underscore/blob/5c237a7c682fb68fd5378203f0bf22dce1624854/underscore.js#L1186-L1289\n// Internal recursive comparison function for `isEqual`.\nfunction eq(a, b, depth, aStack, bStack) {\n // Identical objects are equal. `0 === -0`, but they aren't identical.\n // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).\n if (a === b) {\n return a !== 0 || 1 / a === 1 / b;\n }\n // `null` or `undefined` only equal to itself (strict comparison).\n if (a == null || b == null) {\n return false;\n }\n // `NaN`s are equivalent, but non-reflexive.\n if (a !== a) {\n return b !== b;\n }\n // Exhaust primitive checks\n var type = typeof a;\n if (type !== \"function\" && type !== \"object\" && typeof b != \"object\") {\n return false;\n }\n // Compare `[[Class]]` names.\n var className = toString.call(a);\n if (className !== toString.call(b)) {\n return false;\n }\n switch (className) {\n // Strings, numbers, regular expressions, dates, and booleans are compared by value.\n case \"[object RegExp]\":\n // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i')\n case \"[object String]\":\n // Primitives and their corresponding object wrappers are equivalent; thus, `\"5\"` is\n // equivalent to `new String(\"5\")`.\n return \"\" + a === \"\" + b;\n case \"[object Number]\":\n // `NaN`s are equivalent, but non-reflexive.\n // Object(NaN) is equivalent to NaN.\n if (+a !== +a) {\n return +b !== +b;\n }\n // An `egal` comparison is performed for other numeric values.\n return +a === 0 ? 1 / +a === 1 / b : +a === +b;\n case \"[object Date]\":\n case \"[object Boolean]\":\n // Coerce dates and booleans to numeric primitive values. Dates are compared by their\n // millisecond representations. Note that invalid dates with millisecond representations\n // of `NaN` are not equivalent.\n return +a === +b;\n case \"[object Symbol]\":\n return typeof Symbol !== \"undefined\" && Symbol.valueOf.call(a) === Symbol.valueOf.call(b);\n case \"[object Map]\":\n case \"[object Set]\":\n // Maps and Sets are unwrapped to arrays of entry-pairs, adding an incidental level.\n // Hide this extra level by increasing the depth.\n if (depth >= 0) {\n depth++;\n }\n break;\n }\n // Unwrap any wrapped objects.\n a = unwrap(a);\n b = unwrap(b);\n var areArrays = className === \"[object Array]\";\n if (!areArrays) {\n if (typeof a != \"object\" || typeof b != \"object\") {\n return false;\n }\n // Objects with different constructors are not equivalent, but `Object`s or `Array`s\n // from different frames are.\n var aCtor = a.constructor,\n bCtor = b.constructor;\n if (aCtor !== bCtor && !(isFunction(aCtor) && aCtor instanceof aCtor && isFunction(bCtor) && bCtor instanceof bCtor) && \"constructor\" in a && \"constructor\" in b) {\n return false;\n }\n }\n if (depth === 0) {\n return false;\n } else if (depth < 0) {\n depth = -1;\n }\n // Assume equality for cyclic structures. The algorithm for detecting cyclic\n // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.\n // Initializing stack of traversed objects.\n // It's done here since we only need them for objects and arrays comparison.\n aStack = aStack || [];\n bStack = bStack || [];\n var length = aStack.length;\n while (length--) {\n // Linear search. Performance is inversely proportional to the number of\n // unique nested structures.\n if (aStack[length] === a) {\n return bStack[length] === b;\n }\n }\n // Add the first object to the stack of traversed objects.\n aStack.push(a);\n bStack.push(b);\n // Recursively compare objects and arrays.\n if (areArrays) {\n // Compare array lengths to determine if a deep comparison is necessary.\n length = a.length;\n if (length !== b.length) {\n return false;\n }\n // Deep compare the contents, ignoring non-numeric properties.\n while (length--) {\n if (!eq(a[length], b[length], depth - 1, aStack, bStack)) {\n return false;\n }\n }\n } else {\n // Deep compare objects.\n var keys = Object.keys(a);\n var key;\n length = keys.length;\n // Ensure that both objects contain the same number of properties before comparing deep equality.\n if (Object.keys(b).length !== length) {\n return false;\n }\n while (length--) {\n // Deep compare each member\n key = keys[length];\n if (!(hasProp(b, key) && eq(a[key], b[key], depth - 1, aStack, bStack))) {\n return false;\n }\n }\n }\n // Remove the first object from the stack of traversed objects.\n aStack.pop();\n bStack.pop();\n return true;\n}\nfunction unwrap(a) {\n if (isObservableArray(a)) {\n return a.slice();\n }\n if (isES6Map(a) || isObservableMap(a)) {\n return Array.from(a.entries());\n }\n if (isES6Set(a) || isObservableSet(a)) {\n return Array.from(a.entries());\n }\n return a;\n}\n\nfunction makeIterable(iterator) {\n iterator[Symbol.iterator] = getSelf;\n return iterator;\n}\nfunction getSelf() {\n return this;\n}\n\nfunction isAnnotation(thing) {\n return (\n // Can be function\n thing instanceof Object && typeof thing.annotationType_ === \"string\" && isFunction(thing.make_) && isFunction(thing.extend_)\n );\n}\n\n/**\n * (c) Michel Weststrate 2015 - 2020\n * MIT Licensed\n *\n * Welcome to the mobx sources! To get a global overview of how MobX internally works,\n * this is a good place to start:\n * https://medium.com/@mweststrate/becoming-fully-reactive-an-in-depth-explanation-of-mobservable-55995262a254#.xvbh6qd74\n *\n * Source folders:\n * ===============\n *\n * - api/ Most of the public static methods exposed by the module can be found here.\n * - core/ Implementation of the MobX algorithm; atoms, derivations, reactions, dependency trees, optimizations. Cool stuff can be found here.\n * - types/ All the magic that is need to have observable objects, arrays and values is in this folder. Including the modifiers like `asFlat`.\n * - utils/ Utility stuff.\n *\n */\n[\"Symbol\", \"Map\", \"Set\"].forEach(function (m) {\n var g = getGlobal();\n if (typeof g[m] === \"undefined\") {\n die(\"MobX requires global '\" + m + \"' to be available or polyfilled\");\n }\n});\nif (typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__ === \"object\") {\n // See: https://github.com/andykog/mobx-devtools/\n __MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({\n spy: spy,\n extras: {\n getDebugName: getDebugName\n },\n $mobx: $mobx\n });\n}\n\n\n//# sourceMappingURL=mobx.esm.js.map\n\n\n//# sourceURL=webpack://app_adyen_SFRA/./node_modules/mobx/dist/mobx.esm.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ $mobx: () => (/* binding */ $mobx),\n/* harmony export */ FlowCancellationError: () => (/* binding */ FlowCancellationError),\n/* harmony export */ ObservableMap: () => (/* binding */ ObservableMap),\n/* harmony export */ ObservableSet: () => (/* binding */ ObservableSet),\n/* harmony export */ Reaction: () => (/* binding */ Reaction),\n/* harmony export */ _allowStateChanges: () => (/* binding */ allowStateChanges),\n/* harmony export */ _allowStateChangesInsideComputed: () => (/* binding */ runInAction),\n/* harmony export */ _allowStateReadsEnd: () => (/* binding */ allowStateReadsEnd),\n/* harmony export */ _allowStateReadsStart: () => (/* binding */ allowStateReadsStart),\n/* harmony export */ _autoAction: () => (/* binding */ autoAction),\n/* harmony export */ _endAction: () => (/* binding */ _endAction),\n/* harmony export */ _getAdministration: () => (/* binding */ getAdministration),\n/* harmony export */ _getGlobalState: () => (/* binding */ getGlobalState),\n/* harmony export */ _interceptReads: () => (/* binding */ interceptReads),\n/* harmony export */ _isComputingDerivation: () => (/* binding */ isComputingDerivation),\n/* harmony export */ _resetGlobalState: () => (/* binding */ resetGlobalState),\n/* harmony export */ _startAction: () => (/* binding */ _startAction),\n/* harmony export */ action: () => (/* binding */ action),\n/* harmony export */ autorun: () => (/* binding */ autorun),\n/* harmony export */ comparer: () => (/* binding */ comparer),\n/* harmony export */ computed: () => (/* binding */ computed),\n/* harmony export */ configure: () => (/* binding */ configure),\n/* harmony export */ createAtom: () => (/* binding */ createAtom),\n/* harmony export */ defineProperty: () => (/* binding */ apiDefineProperty),\n/* harmony export */ entries: () => (/* binding */ entries),\n/* harmony export */ extendObservable: () => (/* binding */ extendObservable),\n/* harmony export */ flow: () => (/* binding */ flow),\n/* harmony export */ flowResult: () => (/* binding */ flowResult),\n/* harmony export */ get: () => (/* binding */ get),\n/* harmony export */ getAtom: () => (/* binding */ getAtom),\n/* harmony export */ getDebugName: () => (/* binding */ getDebugName),\n/* harmony export */ getDependencyTree: () => (/* binding */ getDependencyTree),\n/* harmony export */ getObserverTree: () => (/* binding */ getObserverTree),\n/* harmony export */ has: () => (/* binding */ has),\n/* harmony export */ intercept: () => (/* binding */ intercept),\n/* harmony export */ isAction: () => (/* binding */ isAction),\n/* harmony export */ isBoxedObservable: () => (/* binding */ isObservableValue),\n/* harmony export */ isComputed: () => (/* binding */ isComputed),\n/* harmony export */ isComputedProp: () => (/* binding */ isComputedProp),\n/* harmony export */ isFlow: () => (/* binding */ isFlow),\n/* harmony export */ isFlowCancellationError: () => (/* binding */ isFlowCancellationError),\n/* harmony export */ isObservable: () => (/* binding */ isObservable),\n/* harmony export */ isObservableArray: () => (/* binding */ isObservableArray),\n/* harmony export */ isObservableMap: () => (/* binding */ isObservableMap),\n/* harmony export */ isObservableObject: () => (/* binding */ isObservableObject),\n/* harmony export */ isObservableProp: () => (/* binding */ isObservableProp),\n/* harmony export */ isObservableSet: () => (/* binding */ isObservableSet),\n/* harmony export */ keys: () => (/* binding */ keys),\n/* harmony export */ makeAutoObservable: () => (/* binding */ makeAutoObservable),\n/* harmony export */ makeObservable: () => (/* binding */ makeObservable),\n/* harmony export */ observable: () => (/* binding */ observable),\n/* harmony export */ observe: () => (/* binding */ observe),\n/* harmony export */ onBecomeObserved: () => (/* binding */ onBecomeObserved),\n/* harmony export */ onBecomeUnobserved: () => (/* binding */ onBecomeUnobserved),\n/* harmony export */ onReactionError: () => (/* binding */ onReactionError),\n/* harmony export */ override: () => (/* binding */ override),\n/* harmony export */ ownKeys: () => (/* binding */ apiOwnKeys),\n/* harmony export */ reaction: () => (/* binding */ reaction),\n/* harmony export */ remove: () => (/* binding */ remove),\n/* harmony export */ runInAction: () => (/* binding */ runInAction),\n/* harmony export */ set: () => (/* binding */ set),\n/* harmony export */ spy: () => (/* binding */ spy),\n/* harmony export */ toJS: () => (/* binding */ toJS),\n/* harmony export */ trace: () => (/* binding */ trace),\n/* harmony export */ transaction: () => (/* binding */ transaction),\n/* harmony export */ untracked: () => (/* binding */ untracked),\n/* harmony export */ values: () => (/* binding */ values),\n/* harmony export */ when: () => (/* binding */ when)\n/* harmony export */ });\nvar niceErrors = {\n 0: \"Invalid value for configuration 'enforceActions', expected 'never', 'always' or 'observed'\",\n 1: function _(annotationType, key) {\n return \"Cannot apply '\" + annotationType + \"' to '\" + key.toString() + \"': Field not found.\";\n },\n /*\n 2(prop) {\n return `invalid decorator for '${prop.toString()}'`\n },\n 3(prop) {\n return `Cannot decorate '${prop.toString()}': action can only be used on properties with a function value.`\n },\n 4(prop) {\n return `Cannot decorate '${prop.toString()}': computed can only be used on getter properties.`\n },\n */\n 5: \"'keys()' can only be used on observable objects, arrays, sets and maps\",\n 6: \"'values()' can only be used on observable objects, arrays, sets and maps\",\n 7: \"'entries()' can only be used on observable objects, arrays and maps\",\n 8: \"'set()' can only be used on observable objects, arrays and maps\",\n 9: \"'remove()' can only be used on observable objects, arrays and maps\",\n 10: \"'has()' can only be used on observable objects, arrays and maps\",\n 11: \"'get()' can only be used on observable objects, arrays and maps\",\n 12: \"Invalid annotation\",\n 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)\",\n 14: \"Intercept handlers should return nothing or a change object\",\n 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)\",\n 16: \"Modification exception: the internal structure of an observable array was changed.\",\n 17: function _(index, length) {\n return \"[mobx.array] Index out of bounds, \" + index + \" is larger than \" + length;\n },\n 18: \"mobx.map requires Map polyfill for the current browser. Check babel-polyfill or core-js/es6/map.js\",\n 19: function _(other) {\n return \"Cannot initialize from classes that inherit from Map: \" + other.constructor.name;\n },\n 20: function _(other) {\n return \"Cannot initialize map from \" + other;\n },\n 21: function _(dataStructure) {\n return \"Cannot convert to map from '\" + dataStructure + \"'\";\n },\n 22: \"mobx.set requires Set polyfill for the current browser. Check babel-polyfill or core-js/es6/set.js\",\n 23: \"It is not possible to get index atoms from arrays\",\n 24: function _(thing) {\n return \"Cannot obtain administration from \" + thing;\n },\n 25: function _(property, name) {\n return \"the entry '\" + property + \"' does not exist in the observable map '\" + name + \"'\";\n },\n 26: \"please specify a property\",\n 27: function _(property, name) {\n return \"no observable property '\" + property.toString() + \"' found on the observable object '\" + name + \"'\";\n },\n 28: function _(thing) {\n return \"Cannot obtain atom from \" + thing;\n },\n 29: \"Expecting some object\",\n 30: \"invalid action stack. did you forget to finish an action?\",\n 31: \"missing option for computed: get\",\n 32: function _(name, derivation) {\n return \"Cycle detected in computation \" + name + \": \" + derivation;\n },\n 33: function _(name) {\n return \"The setter of computed value '\" + name + \"' is trying to update itself. Did you intend to update an _observable_ value, instead of the computed property?\";\n },\n 34: function _(name) {\n return \"[ComputedValue '\" + name + \"'] It is not possible to assign a new value to a computed value.\";\n },\n 35: \"There are multiple, different versions of MobX active. Make sure MobX is loaded only once or use `configure({ isolateGlobalState: true })`\",\n 36: \"isolateGlobalState should be called before MobX is running any reactions\",\n 37: function _(method) {\n return \"[mobx] `observableArray.\" + method + \"()` mutates the array in-place, which is not allowed inside a derivation. Use `array.slice().\" + method + \"()` instead\";\n },\n 38: \"'ownKeys()' can only be used on observable objects\",\n 39: \"'defineProperty()' can only be used on observable objects\"\n};\nvar errors = true ? niceErrors : 0;\nfunction die(error) {\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n if (true) {\n var e = typeof error === \"string\" ? error : errors[error];\n if (typeof e === \"function\") e = e.apply(null, args);\n throw new Error(\"[MobX] \" + e);\n }\n throw new Error(typeof error === \"number\" ? \"[MobX] minified error nr: \" + error + (args.length ? \" \" + args.map(String).join(\",\") : \"\") + \". Find the full error at: https://github.com/mobxjs/mobx/blob/main/packages/mobx/src/errors.ts\" : \"[MobX] \" + error);\n}\n\nvar mockGlobal = {};\nfunction getGlobal() {\n if (typeof globalThis !== \"undefined\") {\n return globalThis;\n }\n if (typeof window !== \"undefined\") {\n return window;\n }\n if (typeof __webpack_require__.g !== \"undefined\") {\n return __webpack_require__.g;\n }\n if (typeof self !== \"undefined\") {\n return self;\n }\n return mockGlobal;\n}\n\n// We shorten anything used > 5 times\nvar assign = Object.assign;\nvar getDescriptor = Object.getOwnPropertyDescriptor;\nvar defineProperty = Object.defineProperty;\nvar objectPrototype = Object.prototype;\nvar EMPTY_ARRAY = [];\nObject.freeze(EMPTY_ARRAY);\nvar EMPTY_OBJECT = {};\nObject.freeze(EMPTY_OBJECT);\nvar hasProxy = typeof Proxy !== \"undefined\";\nvar plainObjectString = /*#__PURE__*/Object.toString();\nfunction assertProxies() {\n if (!hasProxy) {\n die( true ? \"`Proxy` objects are not available in the current environment. Please configure MobX to enable a fallback implementation.`\" : 0);\n }\n}\nfunction warnAboutProxyRequirement(msg) {\n if ( true && globalState.verifyProxies) {\n die(\"MobX is currently configured to be able to run in ES5 mode, but in ES5 MobX won't be able to \" + msg);\n }\n}\nfunction getNextId() {\n return ++globalState.mobxGuid;\n}\n/**\n * Makes sure that the provided function is invoked at most once.\n */\nfunction once(func) {\n var invoked = false;\n return function () {\n if (invoked) {\n return;\n }\n invoked = true;\n return func.apply(this, arguments);\n };\n}\nvar noop = function noop() {};\nfunction isFunction(fn) {\n return typeof fn === \"function\";\n}\nfunction isStringish(value) {\n var t = typeof value;\n switch (t) {\n case \"string\":\n case \"symbol\":\n case \"number\":\n return true;\n }\n return false;\n}\nfunction isObject(value) {\n return value !== null && typeof value === \"object\";\n}\nfunction isPlainObject(value) {\n if (!isObject(value)) {\n return false;\n }\n var proto = Object.getPrototypeOf(value);\n if (proto == null) {\n return true;\n }\n var protoConstructor = Object.hasOwnProperty.call(proto, \"constructor\") && proto.constructor;\n return typeof protoConstructor === \"function\" && protoConstructor.toString() === plainObjectString;\n}\n// https://stackoverflow.com/a/37865170\nfunction isGenerator(obj) {\n var constructor = obj == null ? void 0 : obj.constructor;\n if (!constructor) {\n return false;\n }\n if (\"GeneratorFunction\" === constructor.name || \"GeneratorFunction\" === constructor.displayName) {\n return true;\n }\n return false;\n}\nfunction addHiddenProp(object, propName, value) {\n defineProperty(object, propName, {\n enumerable: false,\n writable: true,\n configurable: true,\n value: value\n });\n}\nfunction addHiddenFinalProp(object, propName, value) {\n defineProperty(object, propName, {\n enumerable: false,\n writable: false,\n configurable: true,\n value: value\n });\n}\nfunction createInstanceofPredicate(name, theClass) {\n var propName = \"isMobX\" + name;\n theClass.prototype[propName] = true;\n return function (x) {\n return isObject(x) && x[propName] === true;\n };\n}\n/**\n * Yields true for both native and observable Map, even across different windows.\n */\nfunction isES6Map(thing) {\n return thing != null && Object.prototype.toString.call(thing) === \"[object Map]\";\n}\n/**\n * Makes sure a Map is an instance of non-inherited native or observable Map.\n */\nfunction isPlainES6Map(thing) {\n var mapProto = Object.getPrototypeOf(thing);\n var objectProto = Object.getPrototypeOf(mapProto);\n var nullProto = Object.getPrototypeOf(objectProto);\n return nullProto === null;\n}\n/**\n * Yields true for both native and observable Set, even across different windows.\n */\nfunction isES6Set(thing) {\n return thing != null && Object.prototype.toString.call(thing) === \"[object Set]\";\n}\nvar hasGetOwnPropertySymbols = typeof Object.getOwnPropertySymbols !== \"undefined\";\n/**\n * Returns the following: own enumerable keys and symbols.\n */\nfunction getPlainObjectKeys(object) {\n var keys = Object.keys(object);\n // Not supported in IE, so there are not going to be symbol props anyway...\n if (!hasGetOwnPropertySymbols) {\n return keys;\n }\n var symbols = Object.getOwnPropertySymbols(object);\n if (!symbols.length) {\n return keys;\n }\n return [].concat(keys, symbols.filter(function (s) {\n return objectPrototype.propertyIsEnumerable.call(object, s);\n }));\n}\n// From Immer utils\n// Returns all own keys, including non-enumerable and symbolic\nvar ownKeys = typeof Reflect !== \"undefined\" && Reflect.ownKeys ? Reflect.ownKeys : hasGetOwnPropertySymbols ? function (obj) {\n return Object.getOwnPropertyNames(obj).concat(Object.getOwnPropertySymbols(obj));\n} : /* istanbul ignore next */Object.getOwnPropertyNames;\nfunction stringifyKey(key) {\n if (typeof key === \"string\") {\n return key;\n }\n if (typeof key === \"symbol\") {\n return key.toString();\n }\n return new String(key).toString();\n}\nfunction toPrimitive(value) {\n return value === null ? null : typeof value === \"object\" ? \"\" + value : value;\n}\nfunction hasProp(target, prop) {\n return objectPrototype.hasOwnProperty.call(target, prop);\n}\n// From Immer utils\nvar getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors || function getOwnPropertyDescriptors(target) {\n // Polyfill needed for Hermes and IE, see https://github.com/facebook/hermes/issues/274\n var res = {};\n // Note: without polyfill for ownKeys, symbols won't be picked up\n ownKeys(target).forEach(function (key) {\n res[key] = getDescriptor(target, key);\n });\n return res;\n};\nfunction getFlag(flags, mask) {\n return !!(flags & mask);\n}\nfunction setFlag(flags, mask, newValue) {\n if (newValue) {\n flags |= mask;\n } else {\n flags &= ~mask;\n }\n return flags;\n}\n\nfunction _arrayLikeToArray(r, a) {\n (null == a || a > r.length) && (a = r.length);\n for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];\n return n;\n}\nfunction _defineProperties(e, r) {\n for (var t = 0; t < r.length; t++) {\n var o = r[t];\n o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);\n }\n}\nfunction _createClass(e, r, t) {\n return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", {\n writable: !1\n }), e;\n}\nfunction _createForOfIteratorHelperLoose(r, e) {\n var t = \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"];\n if (t) return (t = t.call(r)).next.bind(t);\n if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && \"number\" == typeof r.length) {\n t && (r = t);\n var o = 0;\n return function () {\n return o >= r.length ? {\n done: !0\n } : {\n done: !1,\n value: r[o++]\n };\n };\n }\n throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\nfunction _extends() {\n return _extends = Object.assign ? Object.assign.bind() : function (n) {\n for (var e = 1; e < arguments.length; e++) {\n var t = arguments[e];\n for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);\n }\n return n;\n }, _extends.apply(null, arguments);\n}\nfunction _inheritsLoose(t, o) {\n t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);\n}\nfunction _setPrototypeOf(t, e) {\n return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {\n return t.__proto__ = e, t;\n }, _setPrototypeOf(t, e);\n}\nfunction _toPrimitive(t, r) {\n if (\"object\" != typeof t || !t) return t;\n var e = t[Symbol.toPrimitive];\n if (void 0 !== e) {\n var i = e.call(t, r || \"default\");\n if (\"object\" != typeof i) return i;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (\"string\" === r ? String : Number)(t);\n}\nfunction _toPropertyKey(t) {\n var i = _toPrimitive(t, \"string\");\n return \"symbol\" == typeof i ? i : i + \"\";\n}\nfunction _unsupportedIterableToArray(r, a) {\n if (r) {\n if (\"string\" == typeof r) return _arrayLikeToArray(r, a);\n var t = {}.toString.call(r).slice(8, -1);\n return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;\n }\n}\n\nvar storedAnnotationsSymbol = /*#__PURE__*/Symbol(\"mobx-stored-annotations\");\n/**\n * Creates a function that acts as\n * - decorator\n * - annotation object\n */\nfunction createDecoratorAnnotation(annotation) {\n function decorator(target, property) {\n if (is20223Decorator(property)) {\n return annotation.decorate_20223_(target, property);\n } else {\n storeAnnotation(target, property, annotation);\n }\n }\n return Object.assign(decorator, annotation);\n}\n/**\n * Stores annotation to prototype,\n * so it can be inspected later by `makeObservable` called from constructor\n */\nfunction storeAnnotation(prototype, key, annotation) {\n if (!hasProp(prototype, storedAnnotationsSymbol)) {\n addHiddenProp(prototype, storedAnnotationsSymbol, _extends({}, prototype[storedAnnotationsSymbol]));\n }\n // @override must override something\n if ( true && isOverride(annotation) && !hasProp(prototype[storedAnnotationsSymbol], key)) {\n var fieldName = prototype.constructor.name + \".prototype.\" + key.toString();\n die(\"'\" + fieldName + \"' is decorated with 'override', \" + \"but no such decorated member was found on prototype.\");\n }\n // Cannot re-decorate\n assertNotDecorated(prototype, annotation, key);\n // Ignore override\n if (!isOverride(annotation)) {\n prototype[storedAnnotationsSymbol][key] = annotation;\n }\n}\nfunction assertNotDecorated(prototype, annotation, key) {\n if ( true && !isOverride(annotation) && hasProp(prototype[storedAnnotationsSymbol], key)) {\n var fieldName = prototype.constructor.name + \".prototype.\" + key.toString();\n var currentAnnotationType = prototype[storedAnnotationsSymbol][key].annotationType_;\n var requestedAnnotationType = annotation.annotationType_;\n die(\"Cannot apply '@\" + requestedAnnotationType + \"' to '\" + fieldName + \"':\" + (\"\\nThe field is already decorated with '@\" + currentAnnotationType + \"'.\") + \"\\nRe-decorating fields is not allowed.\" + \"\\nUse '@override' decorator for methods overridden by subclass.\");\n }\n}\n/**\n * Collects annotations from prototypes and stores them on target (instance)\n */\nfunction collectStoredAnnotations(target) {\n if (!hasProp(target, storedAnnotationsSymbol)) {\n // if (__DEV__ && !target[storedAnnotationsSymbol]) {\n // die(\n // `No annotations were passed to makeObservable, but no decorated members have been found either`\n // )\n // }\n // We need a copy as we will remove annotation from the list once it's applied.\n addHiddenProp(target, storedAnnotationsSymbol, _extends({}, target[storedAnnotationsSymbol]));\n }\n return target[storedAnnotationsSymbol];\n}\nfunction is20223Decorator(context) {\n return typeof context == \"object\" && typeof context[\"kind\"] == \"string\";\n}\nfunction assert20223DecoratorType(context, types) {\n if ( true && !types.includes(context.kind)) {\n die(\"The decorator applied to '\" + String(context.name) + \"' cannot be used on a \" + context.kind + \" element\");\n }\n}\n\nvar $mobx = /*#__PURE__*/Symbol(\"mobx administration\");\nvar Atom = /*#__PURE__*/function () {\n /**\n * Create a new atom. For debugging purposes it is recommended to give it a name.\n * The onBecomeObserved and onBecomeUnobserved callbacks can be used for resource management.\n */\n function Atom(name_) {\n if (name_ === void 0) {\n name_ = true ? \"Atom@\" + getNextId() : 0;\n }\n this.name_ = void 0;\n this.flags_ = 0;\n this.observers_ = new Set();\n this.lastAccessedBy_ = 0;\n this.lowestObserverState_ = IDerivationState_.NOT_TRACKING_;\n // onBecomeObservedListeners\n this.onBOL = void 0;\n // onBecomeUnobservedListeners\n this.onBUOL = void 0;\n this.name_ = name_;\n }\n // for effective unobserving. BaseAtom has true, for extra optimization, so its onBecomeUnobserved never gets called, because it's not needed\n var _proto = Atom.prototype;\n _proto.onBO = function onBO() {\n if (this.onBOL) {\n this.onBOL.forEach(function (listener) {\n return listener();\n });\n }\n };\n _proto.onBUO = function onBUO() {\n if (this.onBUOL) {\n this.onBUOL.forEach(function (listener) {\n return listener();\n });\n }\n }\n /**\n * Invoke this method to notify mobx that your atom has been used somehow.\n * Returns true if there is currently a reactive context.\n */;\n _proto.reportObserved = function reportObserved$1() {\n return reportObserved(this);\n }\n /**\n * Invoke this method _after_ this method has changed to signal mobx that all its observers should invalidate.\n */;\n _proto.reportChanged = function reportChanged() {\n startBatch();\n propagateChanged(this);\n endBatch();\n };\n _proto.toString = function toString() {\n return this.name_;\n };\n return _createClass(Atom, [{\n key: \"isBeingObserved\",\n get: function get() {\n return getFlag(this.flags_, Atom.isBeingObservedMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Atom.isBeingObservedMask_, newValue);\n }\n }, {\n key: \"isPendingUnobservation\",\n get: function get() {\n return getFlag(this.flags_, Atom.isPendingUnobservationMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Atom.isPendingUnobservationMask_, newValue);\n }\n }, {\n key: \"diffValue\",\n get: function get() {\n return getFlag(this.flags_, Atom.diffValueMask_) ? 1 : 0;\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Atom.diffValueMask_, newValue === 1 ? true : false);\n }\n }]);\n}();\nAtom.isBeingObservedMask_ = 1;\nAtom.isPendingUnobservationMask_ = 2;\nAtom.diffValueMask_ = 4;\nvar isAtom = /*#__PURE__*/createInstanceofPredicate(\"Atom\", Atom);\nfunction createAtom(name, onBecomeObservedHandler, onBecomeUnobservedHandler) {\n if (onBecomeObservedHandler === void 0) {\n onBecomeObservedHandler = noop;\n }\n if (onBecomeUnobservedHandler === void 0) {\n onBecomeUnobservedHandler = noop;\n }\n var atom = new Atom(name);\n // default `noop` listener will not initialize the hook Set\n if (onBecomeObservedHandler !== noop) {\n onBecomeObserved(atom, onBecomeObservedHandler);\n }\n if (onBecomeUnobservedHandler !== noop) {\n onBecomeUnobserved(atom, onBecomeUnobservedHandler);\n }\n return atom;\n}\n\nfunction identityComparer(a, b) {\n return a === b;\n}\nfunction structuralComparer(a, b) {\n return deepEqual(a, b);\n}\nfunction shallowComparer(a, b) {\n return deepEqual(a, b, 1);\n}\nfunction defaultComparer(a, b) {\n if (Object.is) {\n return Object.is(a, b);\n }\n return a === b ? a !== 0 || 1 / a === 1 / b : a !== a && b !== b;\n}\nvar comparer = {\n identity: identityComparer,\n structural: structuralComparer,\n \"default\": defaultComparer,\n shallow: shallowComparer\n};\n\nfunction deepEnhancer(v, _, name) {\n // it is an observable already, done\n if (isObservable(v)) {\n return v;\n }\n // something that can be converted and mutated?\n if (Array.isArray(v)) {\n return observable.array(v, {\n name: name\n });\n }\n if (isPlainObject(v)) {\n return observable.object(v, undefined, {\n name: name\n });\n }\n if (isES6Map(v)) {\n return observable.map(v, {\n name: name\n });\n }\n if (isES6Set(v)) {\n return observable.set(v, {\n name: name\n });\n }\n if (typeof v === \"function\" && !isAction(v) && !isFlow(v)) {\n if (isGenerator(v)) {\n return flow(v);\n } else {\n return autoAction(name, v);\n }\n }\n return v;\n}\nfunction shallowEnhancer(v, _, name) {\n if (v === undefined || v === null) {\n return v;\n }\n if (isObservableObject(v) || isObservableArray(v) || isObservableMap(v) || isObservableSet(v)) {\n return v;\n }\n if (Array.isArray(v)) {\n return observable.array(v, {\n name: name,\n deep: false\n });\n }\n if (isPlainObject(v)) {\n return observable.object(v, undefined, {\n name: name,\n deep: false\n });\n }\n if (isES6Map(v)) {\n return observable.map(v, {\n name: name,\n deep: false\n });\n }\n if (isES6Set(v)) {\n return observable.set(v, {\n name: name,\n deep: false\n });\n }\n if (true) {\n die(\"The shallow modifier / decorator can only used in combination with arrays, objects, maps and sets\");\n }\n}\nfunction referenceEnhancer(newValue) {\n // never turn into an observable\n return newValue;\n}\nfunction refStructEnhancer(v, oldValue) {\n if ( true && isObservable(v)) {\n die(\"observable.struct should not be used with observable values\");\n }\n if (deepEqual(v, oldValue)) {\n return oldValue;\n }\n return v;\n}\n\nvar OVERRIDE = \"override\";\nvar override = /*#__PURE__*/createDecoratorAnnotation({\n annotationType_: OVERRIDE,\n make_: make_,\n extend_: extend_,\n decorate_20223_: decorate_20223_\n});\nfunction isOverride(annotation) {\n return annotation.annotationType_ === OVERRIDE;\n}\nfunction make_(adm, key) {\n // Must not be plain object\n if ( true && adm.isPlainObject_) {\n die(\"Cannot apply '\" + this.annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + this.annotationType_ + \"' cannot be used on plain objects.\"));\n }\n // Must override something\n if ( true && !hasProp(adm.appliedAnnotations_, key)) {\n die(\"'\" + adm.name_ + \".\" + key.toString() + \"' is annotated with '\" + this.annotationType_ + \"', \" + \"but no such annotated member was found on prototype.\");\n }\n return 0 /* MakeResult.Cancel */;\n}\nfunction extend_(adm, key, descriptor, proxyTrap) {\n die(\"'\" + this.annotationType_ + \"' can only be used with 'makeObservable'\");\n}\nfunction decorate_20223_(desc, context) {\n console.warn(\"'\" + this.annotationType_ + \"' cannot be used with decorators - this is a no-op\");\n}\n\nfunction createActionAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$1,\n extend_: extend_$1,\n decorate_20223_: decorate_20223_$1\n };\n}\nfunction make_$1(adm, key, descriptor, source) {\n var _this$options_;\n // bound\n if ((_this$options_ = this.options_) != null && _this$options_.bound) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;\n }\n // own\n if (source === adm.target_) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 2 /* MakeResult.Continue */;\n }\n // prototype\n if (isAction(descriptor.value)) {\n // A prototype could have been annotated already by other constructor,\n // rest of the proto chain must be annotated already\n return 1 /* MakeResult.Break */;\n }\n var actionDescriptor = createActionDescriptor(adm, this, key, descriptor, false);\n defineProperty(source, key, actionDescriptor);\n return 2 /* MakeResult.Continue */;\n}\nfunction extend_$1(adm, key, descriptor, proxyTrap) {\n var actionDescriptor = createActionDescriptor(adm, this, key, descriptor);\n return adm.defineProperty_(key, actionDescriptor, proxyTrap);\n}\nfunction decorate_20223_$1(mthd, context) {\n if (true) {\n assert20223DecoratorType(context, [\"method\", \"field\"]);\n }\n var kind = context.kind,\n name = context.name,\n addInitializer = context.addInitializer;\n var ann = this;\n var _createAction = function _createAction(m) {\n var _ann$options_$name, _ann$options_, _ann$options_$autoAct, _ann$options_2;\n return createAction((_ann$options_$name = (_ann$options_ = ann.options_) == null ? void 0 : _ann$options_.name) != null ? _ann$options_$name : name.toString(), m, (_ann$options_$autoAct = (_ann$options_2 = ann.options_) == null ? void 0 : _ann$options_2.autoAction) != null ? _ann$options_$autoAct : false);\n };\n if (kind == \"field\") {\n return function (initMthd) {\n var _ann$options_3;\n var mthd = initMthd;\n if (!isAction(mthd)) {\n mthd = _createAction(mthd);\n }\n if ((_ann$options_3 = ann.options_) != null && _ann$options_3.bound) {\n mthd = mthd.bind(this);\n mthd.isMobxAction = true;\n }\n return mthd;\n };\n }\n if (kind == \"method\") {\n var _this$options_2;\n if (!isAction(mthd)) {\n mthd = _createAction(mthd);\n }\n if ((_this$options_2 = this.options_) != null && _this$options_2.bound) {\n addInitializer(function () {\n var self = this;\n var bound = self[name].bind(self);\n bound.isMobxAction = true;\n self[name] = bound;\n });\n }\n return mthd;\n }\n die(\"Cannot apply '\" + ann.annotationType_ + \"' to '\" + String(name) + \"' (kind: \" + kind + \"):\" + (\"\\n'\" + ann.annotationType_ + \"' can only be used on properties with a function value.\"));\n}\nfunction assertActionDescriptor(adm, _ref, key, _ref2) {\n var annotationType_ = _ref.annotationType_;\n var value = _ref2.value;\n if ( true && !isFunction(value)) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' can only be used on properties with a function value.\"));\n }\n}\nfunction createActionDescriptor(adm, annotation, key, descriptor,\n// provides ability to disable safeDescriptors for prototypes\nsafeDescriptors) {\n var _annotation$options_, _annotation$options_$, _annotation$options_2, _annotation$options_$2, _annotation$options_3, _annotation$options_4, _adm$proxy_2;\n if (safeDescriptors === void 0) {\n safeDescriptors = globalState.safeDescriptors;\n }\n assertActionDescriptor(adm, annotation, key, descriptor);\n var value = descriptor.value;\n if ((_annotation$options_ = annotation.options_) != null && _annotation$options_.bound) {\n var _adm$proxy_;\n value = value.bind((_adm$proxy_ = adm.proxy_) != null ? _adm$proxy_ : adm.target_);\n }\n return {\n value: createAction((_annotation$options_$ = (_annotation$options_2 = annotation.options_) == null ? void 0 : _annotation$options_2.name) != null ? _annotation$options_$ : key.toString(), value, (_annotation$options_$2 = (_annotation$options_3 = annotation.options_) == null ? void 0 : _annotation$options_3.autoAction) != null ? _annotation$options_$2 : false,\n // https://github.com/mobxjs/mobx/discussions/3140\n (_annotation$options_4 = annotation.options_) != null && _annotation$options_4.bound ? (_adm$proxy_2 = adm.proxy_) != null ? _adm$proxy_2 : adm.target_ : undefined),\n // Non-configurable for classes\n // prevents accidental field redefinition in subclass\n configurable: safeDescriptors ? adm.isPlainObject_ : true,\n // https://github.com/mobxjs/mobx/pull/2641#issuecomment-737292058\n enumerable: false,\n // Non-obsevable, therefore non-writable\n // Also prevents rewriting in subclass constructor\n writable: safeDescriptors ? false : true\n };\n}\n\nfunction createFlowAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$2,\n extend_: extend_$2,\n decorate_20223_: decorate_20223_$2\n };\n}\nfunction make_$2(adm, key, descriptor, source) {\n var _this$options_;\n // own\n if (source === adm.target_) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 2 /* MakeResult.Continue */;\n }\n // prototype\n // bound - must annotate protos to support super.flow()\n if ((_this$options_ = this.options_) != null && _this$options_.bound && (!hasProp(adm.target_, key) || !isFlow(adm.target_[key]))) {\n if (this.extend_(adm, key, descriptor, false) === null) {\n return 0 /* MakeResult.Cancel */;\n }\n }\n if (isFlow(descriptor.value)) {\n // A prototype could have been annotated already by other constructor,\n // rest of the proto chain must be annotated already\n return 1 /* MakeResult.Break */;\n }\n var flowDescriptor = createFlowDescriptor(adm, this, key, descriptor, false, false);\n defineProperty(source, key, flowDescriptor);\n return 2 /* MakeResult.Continue */;\n}\nfunction extend_$2(adm, key, descriptor, proxyTrap) {\n var _this$options_2;\n var flowDescriptor = createFlowDescriptor(adm, this, key, descriptor, (_this$options_2 = this.options_) == null ? void 0 : _this$options_2.bound);\n return adm.defineProperty_(key, flowDescriptor, proxyTrap);\n}\nfunction decorate_20223_$2(mthd, context) {\n var _this$options_3;\n if (true) {\n assert20223DecoratorType(context, [\"method\"]);\n }\n var name = context.name,\n addInitializer = context.addInitializer;\n if (!isFlow(mthd)) {\n mthd = flow(mthd);\n }\n if ((_this$options_3 = this.options_) != null && _this$options_3.bound) {\n addInitializer(function () {\n var self = this;\n var bound = self[name].bind(self);\n bound.isMobXFlow = true;\n self[name] = bound;\n });\n }\n return mthd;\n}\nfunction assertFlowDescriptor(adm, _ref, key, _ref2) {\n var annotationType_ = _ref.annotationType_;\n var value = _ref2.value;\n if ( true && !isFunction(value)) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' can only be used on properties with a generator function value.\"));\n }\n}\nfunction createFlowDescriptor(adm, annotation, key, descriptor, bound,\n// provides ability to disable safeDescriptors for prototypes\nsafeDescriptors) {\n if (safeDescriptors === void 0) {\n safeDescriptors = globalState.safeDescriptors;\n }\n assertFlowDescriptor(adm, annotation, key, descriptor);\n var value = descriptor.value;\n // In case of flow.bound, the descriptor can be from already annotated prototype\n if (!isFlow(value)) {\n value = flow(value);\n }\n if (bound) {\n var _adm$proxy_;\n // We do not keep original function around, so we bind the existing flow\n value = value.bind((_adm$proxy_ = adm.proxy_) != null ? _adm$proxy_ : adm.target_);\n // This is normally set by `flow`, but `bind` returns new function...\n value.isMobXFlow = true;\n }\n return {\n value: value,\n // Non-configurable for classes\n // prevents accidental field redefinition in subclass\n configurable: safeDescriptors ? adm.isPlainObject_ : true,\n // https://github.com/mobxjs/mobx/pull/2641#issuecomment-737292058\n enumerable: false,\n // Non-obsevable, therefore non-writable\n // Also prevents rewriting in subclass constructor\n writable: safeDescriptors ? false : true\n };\n}\n\nfunction createComputedAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$3,\n extend_: extend_$3,\n decorate_20223_: decorate_20223_$3\n };\n}\nfunction make_$3(adm, key, descriptor) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;\n}\nfunction extend_$3(adm, key, descriptor, proxyTrap) {\n assertComputedDescriptor(adm, this, key, descriptor);\n return adm.defineComputedProperty_(key, _extends({}, this.options_, {\n get: descriptor.get,\n set: descriptor.set\n }), proxyTrap);\n}\nfunction decorate_20223_$3(get, context) {\n if (true) {\n assert20223DecoratorType(context, [\"getter\"]);\n }\n var ann = this;\n var key = context.name,\n addInitializer = context.addInitializer;\n addInitializer(function () {\n var adm = asObservableObject(this)[$mobx];\n var options = _extends({}, ann.options_, {\n get: get,\n context: this\n });\n options.name || (options.name = true ? adm.name_ + \".\" + key.toString() : 0);\n adm.values_.set(key, new ComputedValue(options));\n });\n return function () {\n return this[$mobx].getObservablePropValue_(key);\n };\n}\nfunction assertComputedDescriptor(adm, _ref, key, _ref2) {\n var annotationType_ = _ref.annotationType_;\n var get = _ref2.get;\n if ( true && !get) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' can only be used on getter(+setter) properties.\"));\n }\n}\n\nfunction createObservableAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$4,\n extend_: extend_$4,\n decorate_20223_: decorate_20223_$4\n };\n}\nfunction make_$4(adm, key, descriptor) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;\n}\nfunction extend_$4(adm, key, descriptor, proxyTrap) {\n var _this$options_$enhanc, _this$options_;\n assertObservableDescriptor(adm, this, key, descriptor);\n return adm.defineObservableProperty_(key, descriptor.value, (_this$options_$enhanc = (_this$options_ = this.options_) == null ? void 0 : _this$options_.enhancer) != null ? _this$options_$enhanc : deepEnhancer, proxyTrap);\n}\nfunction decorate_20223_$4(desc, context) {\n if (true) {\n if (context.kind === \"field\") {\n throw die(\"Please use `@observable accessor \" + String(context.name) + \"` instead of `@observable \" + String(context.name) + \"`\");\n }\n assert20223DecoratorType(context, [\"accessor\"]);\n }\n var ann = this;\n var kind = context.kind,\n name = context.name;\n // The laziness here is not ideal... It's a workaround to how 2022.3 Decorators are implemented:\n // `addInitializer` callbacks are executed _before_ any accessors are defined (instead of the ideal-for-us right after each).\n // This means that, if we were to do our stuff in an `addInitializer`, we'd attempt to read a private slot\n // before it has been initialized. The runtime doesn't like that and throws a `Cannot read private member\n // from an object whose class did not declare it` error.\n // TODO: it seems that this will not be required anymore in the final version of the spec\n // See TODO: link\n var initializedObjects = new WeakSet();\n function initializeObservable(target, value) {\n var _ann$options_$enhance, _ann$options_;\n var adm = asObservableObject(target)[$mobx];\n var observable = new ObservableValue(value, (_ann$options_$enhance = (_ann$options_ = ann.options_) == null ? void 0 : _ann$options_.enhancer) != null ? _ann$options_$enhance : deepEnhancer, true ? adm.name_ + \".\" + name.toString() : 0, false);\n adm.values_.set(name, observable);\n initializedObjects.add(target);\n }\n if (kind == \"accessor\") {\n return {\n get: function get() {\n if (!initializedObjects.has(this)) {\n initializeObservable(this, desc.get.call(this));\n }\n return this[$mobx].getObservablePropValue_(name);\n },\n set: function set(value) {\n if (!initializedObjects.has(this)) {\n initializeObservable(this, value);\n }\n return this[$mobx].setObservablePropValue_(name, value);\n },\n init: function init(value) {\n if (!initializedObjects.has(this)) {\n initializeObservable(this, value);\n }\n return value;\n }\n };\n }\n return;\n}\nfunction assertObservableDescriptor(adm, _ref, key, descriptor) {\n var annotationType_ = _ref.annotationType_;\n if ( true && !(\"value\" in descriptor)) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' cannot be used on getter/setter properties\"));\n }\n}\n\nvar AUTO = \"true\";\nvar autoAnnotation = /*#__PURE__*/createAutoAnnotation();\nfunction createAutoAnnotation(options) {\n return {\n annotationType_: AUTO,\n options_: options,\n make_: make_$5,\n extend_: extend_$5,\n decorate_20223_: decorate_20223_$5\n };\n}\nfunction make_$5(adm, key, descriptor, source) {\n var _this$options_3, _this$options_4;\n // getter -> computed\n if (descriptor.get) {\n return computed.make_(adm, key, descriptor, source);\n }\n // lone setter -> action setter\n if (descriptor.set) {\n // TODO make action applicable to setter and delegate to action.make_\n var set = createAction(key.toString(), descriptor.set);\n // own\n if (source === adm.target_) {\n return adm.defineProperty_(key, {\n configurable: globalState.safeDescriptors ? adm.isPlainObject_ : true,\n set: set\n }) === null ? 0 /* MakeResult.Cancel */ : 2 /* MakeResult.Continue */;\n }\n // proto\n defineProperty(source, key, {\n configurable: true,\n set: set\n });\n return 2 /* MakeResult.Continue */;\n }\n // function on proto -> autoAction/flow\n if (source !== adm.target_ && typeof descriptor.value === \"function\") {\n var _this$options_2;\n if (isGenerator(descriptor.value)) {\n var _this$options_;\n var flowAnnotation = (_this$options_ = this.options_) != null && _this$options_.autoBind ? flow.bound : flow;\n return flowAnnotation.make_(adm, key, descriptor, source);\n }\n var actionAnnotation = (_this$options_2 = this.options_) != null && _this$options_2.autoBind ? autoAction.bound : autoAction;\n return actionAnnotation.make_(adm, key, descriptor, source);\n }\n // other -> observable\n // Copy props from proto as well, see test:\n // \"decorate should work with Object.create\"\n var observableAnnotation = ((_this$options_3 = this.options_) == null ? void 0 : _this$options_3.deep) === false ? observable.ref : observable;\n // if function respect autoBind option\n if (typeof descriptor.value === \"function\" && (_this$options_4 = this.options_) != null && _this$options_4.autoBind) {\n var _adm$proxy_;\n descriptor.value = descriptor.value.bind((_adm$proxy_ = adm.proxy_) != null ? _adm$proxy_ : adm.target_);\n }\n return observableAnnotation.make_(adm, key, descriptor, source);\n}\nfunction extend_$5(adm, key, descriptor, proxyTrap) {\n var _this$options_5, _this$options_6;\n // getter -> computed\n if (descriptor.get) {\n return computed.extend_(adm, key, descriptor, proxyTrap);\n }\n // lone setter -> action setter\n if (descriptor.set) {\n // TODO make action applicable to setter and delegate to action.extend_\n return adm.defineProperty_(key, {\n configurable: globalState.safeDescriptors ? adm.isPlainObject_ : true,\n set: createAction(key.toString(), descriptor.set)\n }, proxyTrap);\n }\n // other -> observable\n // if function respect autoBind option\n if (typeof descriptor.value === \"function\" && (_this$options_5 = this.options_) != null && _this$options_5.autoBind) {\n var _adm$proxy_2;\n descriptor.value = descriptor.value.bind((_adm$proxy_2 = adm.proxy_) != null ? _adm$proxy_2 : adm.target_);\n }\n var observableAnnotation = ((_this$options_6 = this.options_) == null ? void 0 : _this$options_6.deep) === false ? observable.ref : observable;\n return observableAnnotation.extend_(adm, key, descriptor, proxyTrap);\n}\nfunction decorate_20223_$5(desc, context) {\n die(\"'\" + this.annotationType_ + \"' cannot be used as a decorator\");\n}\n\nvar OBSERVABLE = \"observable\";\nvar OBSERVABLE_REF = \"observable.ref\";\nvar OBSERVABLE_SHALLOW = \"observable.shallow\";\nvar OBSERVABLE_STRUCT = \"observable.struct\";\n// Predefined bags of create observable options, to avoid allocating temporarily option objects\n// in the majority of cases\nvar defaultCreateObservableOptions = {\n deep: true,\n name: undefined,\n defaultDecorator: undefined,\n proxy: true\n};\nObject.freeze(defaultCreateObservableOptions);\nfunction asCreateObservableOptions(thing) {\n return thing || defaultCreateObservableOptions;\n}\nvar observableAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE);\nvar observableRefAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE_REF, {\n enhancer: referenceEnhancer\n});\nvar observableShallowAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE_SHALLOW, {\n enhancer: shallowEnhancer\n});\nvar observableStructAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE_STRUCT, {\n enhancer: refStructEnhancer\n});\nvar observableDecoratorAnnotation = /*#__PURE__*/createDecoratorAnnotation(observableAnnotation);\nfunction getEnhancerFromOptions(options) {\n return options.deep === true ? deepEnhancer : options.deep === false ? referenceEnhancer : getEnhancerFromAnnotation(options.defaultDecorator);\n}\nfunction getAnnotationFromOptions(options) {\n var _options$defaultDecor;\n return options ? (_options$defaultDecor = options.defaultDecorator) != null ? _options$defaultDecor : createAutoAnnotation(options) : undefined;\n}\nfunction getEnhancerFromAnnotation(annotation) {\n var _annotation$options_$, _annotation$options_;\n return !annotation ? deepEnhancer : (_annotation$options_$ = (_annotation$options_ = annotation.options_) == null ? void 0 : _annotation$options_.enhancer) != null ? _annotation$options_$ : deepEnhancer;\n}\n/**\n * Turns an object, array or function into a reactive structure.\n * @param v the value which should become observable.\n */\nfunction createObservable(v, arg2, arg3) {\n // @observable someProp; (2022.3 Decorators)\n if (is20223Decorator(arg2)) {\n return observableAnnotation.decorate_20223_(v, arg2);\n }\n // @observable someProp;\n if (isStringish(arg2)) {\n storeAnnotation(v, arg2, observableAnnotation);\n return;\n }\n // already observable - ignore\n if (isObservable(v)) {\n return v;\n }\n // plain object\n if (isPlainObject(v)) {\n return observable.object(v, arg2, arg3);\n }\n // Array\n if (Array.isArray(v)) {\n return observable.array(v, arg2);\n }\n // Map\n if (isES6Map(v)) {\n return observable.map(v, arg2);\n }\n // Set\n if (isES6Set(v)) {\n return observable.set(v, arg2);\n }\n // other object - ignore\n if (typeof v === \"object\" && v !== null) {\n return v;\n }\n // anything else\n return observable.box(v, arg2);\n}\nassign(createObservable, observableDecoratorAnnotation);\nvar observableFactories = {\n box: function box(value, options) {\n var o = asCreateObservableOptions(options);\n return new ObservableValue(value, getEnhancerFromOptions(o), o.name, true, o.equals);\n },\n array: function array(initialValues, options) {\n var o = asCreateObservableOptions(options);\n return (globalState.useProxies === false || o.proxy === false ? createLegacyArray : createObservableArray)(initialValues, getEnhancerFromOptions(o), o.name);\n },\n map: function map(initialValues, options) {\n var o = asCreateObservableOptions(options);\n return new ObservableMap(initialValues, getEnhancerFromOptions(o), o.name);\n },\n set: function set(initialValues, options) {\n var o = asCreateObservableOptions(options);\n return new ObservableSet(initialValues, getEnhancerFromOptions(o), o.name);\n },\n object: function object(props, decorators, options) {\n return initObservable(function () {\n return extendObservable(globalState.useProxies === false || (options == null ? void 0 : options.proxy) === false ? asObservableObject({}, options) : asDynamicObservableObject({}, options), props, decorators);\n });\n },\n ref: /*#__PURE__*/createDecoratorAnnotation(observableRefAnnotation),\n shallow: /*#__PURE__*/createDecoratorAnnotation(observableShallowAnnotation),\n deep: observableDecoratorAnnotation,\n struct: /*#__PURE__*/createDecoratorAnnotation(observableStructAnnotation)\n};\n// eslint-disable-next-line\nvar observable = /*#__PURE__*/assign(createObservable, observableFactories);\n\nvar COMPUTED = \"computed\";\nvar COMPUTED_STRUCT = \"computed.struct\";\nvar computedAnnotation = /*#__PURE__*/createComputedAnnotation(COMPUTED);\nvar computedStructAnnotation = /*#__PURE__*/createComputedAnnotation(COMPUTED_STRUCT, {\n equals: comparer.structural\n});\n/**\n * Decorator for class properties: @computed get value() { return expr; }.\n * For legacy purposes also invokable as ES5 observable created: `computed(() => expr)`;\n */\nvar computed = function computed(arg1, arg2) {\n if (is20223Decorator(arg2)) {\n // @computed (2022.3 Decorators)\n return computedAnnotation.decorate_20223_(arg1, arg2);\n }\n if (isStringish(arg2)) {\n // @computed\n return storeAnnotation(arg1, arg2, computedAnnotation);\n }\n if (isPlainObject(arg1)) {\n // @computed({ options })\n return createDecoratorAnnotation(createComputedAnnotation(COMPUTED, arg1));\n }\n // computed(expr, options?)\n if (true) {\n if (!isFunction(arg1)) {\n die(\"First argument to `computed` should be an expression.\");\n }\n if (isFunction(arg2)) {\n die(\"A setter as second argument is no longer supported, use `{ set: fn }` option instead\");\n }\n }\n var opts = isPlainObject(arg2) ? arg2 : {};\n opts.get = arg1;\n opts.name || (opts.name = arg1.name || \"\"); /* for generated name */\n return new ComputedValue(opts);\n};\nObject.assign(computed, computedAnnotation);\ncomputed.struct = /*#__PURE__*/createDecoratorAnnotation(computedStructAnnotation);\n\nvar _getDescriptor$config, _getDescriptor;\n// we don't use globalState for these in order to avoid possible issues with multiple\n// mobx versions\nvar currentActionId = 0;\nvar nextActionId = 1;\nvar isFunctionNameConfigurable = (_getDescriptor$config = (_getDescriptor = /*#__PURE__*/getDescriptor(function () {}, \"name\")) == null ? void 0 : _getDescriptor.configurable) != null ? _getDescriptor$config : false;\n// we can safely recycle this object\nvar tmpNameDescriptor = {\n value: \"action\",\n configurable: true,\n writable: false,\n enumerable: false\n};\nfunction createAction(actionName, fn, autoAction, ref) {\n if (autoAction === void 0) {\n autoAction = false;\n }\n if (true) {\n if (!isFunction(fn)) {\n die(\"`action` can only be invoked on functions\");\n }\n if (typeof actionName !== \"string\" || !actionName) {\n die(\"actions should have valid names, got: '\" + actionName + \"'\");\n }\n }\n function res() {\n return executeAction(actionName, autoAction, fn, ref || this, arguments);\n }\n res.isMobxAction = true;\n res.toString = function () {\n return fn.toString();\n };\n if (isFunctionNameConfigurable) {\n tmpNameDescriptor.value = actionName;\n defineProperty(res, \"name\", tmpNameDescriptor);\n }\n return res;\n}\nfunction executeAction(actionName, canRunAsDerivation, fn, scope, args) {\n var runInfo = _startAction(actionName, canRunAsDerivation, scope, args);\n try {\n return fn.apply(scope, args);\n } catch (err) {\n runInfo.error_ = err;\n throw err;\n } finally {\n _endAction(runInfo);\n }\n}\nfunction _startAction(actionName, canRunAsDerivation,\n// true for autoAction\nscope, args) {\n var notifySpy_ = true && isSpyEnabled() && !!actionName;\n var startTime_ = 0;\n if ( true && notifySpy_) {\n startTime_ = Date.now();\n var flattenedArgs = args ? Array.from(args) : EMPTY_ARRAY;\n spyReportStart({\n type: ACTION,\n name: actionName,\n object: scope,\n arguments: flattenedArgs\n });\n }\n var prevDerivation_ = globalState.trackingDerivation;\n var runAsAction = !canRunAsDerivation || !prevDerivation_;\n startBatch();\n var prevAllowStateChanges_ = globalState.allowStateChanges; // by default preserve previous allow\n if (runAsAction) {\n untrackedStart();\n prevAllowStateChanges_ = allowStateChangesStart(true);\n }\n var prevAllowStateReads_ = allowStateReadsStart(true);\n var runInfo = {\n runAsAction_: runAsAction,\n prevDerivation_: prevDerivation_,\n prevAllowStateChanges_: prevAllowStateChanges_,\n prevAllowStateReads_: prevAllowStateReads_,\n notifySpy_: notifySpy_,\n startTime_: startTime_,\n actionId_: nextActionId++,\n parentActionId_: currentActionId\n };\n currentActionId = runInfo.actionId_;\n return runInfo;\n}\nfunction _endAction(runInfo) {\n if (currentActionId !== runInfo.actionId_) {\n die(30);\n }\n currentActionId = runInfo.parentActionId_;\n if (runInfo.error_ !== undefined) {\n globalState.suppressReactionErrors = true;\n }\n allowStateChangesEnd(runInfo.prevAllowStateChanges_);\n allowStateReadsEnd(runInfo.prevAllowStateReads_);\n endBatch();\n if (runInfo.runAsAction_) {\n untrackedEnd(runInfo.prevDerivation_);\n }\n if ( true && runInfo.notifySpy_) {\n spyReportEnd({\n time: Date.now() - runInfo.startTime_\n });\n }\n globalState.suppressReactionErrors = false;\n}\nfunction allowStateChanges(allowStateChanges, func) {\n var prev = allowStateChangesStart(allowStateChanges);\n try {\n return func();\n } finally {\n allowStateChangesEnd(prev);\n }\n}\nfunction allowStateChangesStart(allowStateChanges) {\n var prev = globalState.allowStateChanges;\n globalState.allowStateChanges = allowStateChanges;\n return prev;\n}\nfunction allowStateChangesEnd(prev) {\n globalState.allowStateChanges = prev;\n}\n\nvar CREATE = \"create\";\nvar ObservableValue = /*#__PURE__*/function (_Atom) {\n function ObservableValue(value, enhancer, name_, notifySpy, equals) {\n var _this;\n if (name_ === void 0) {\n name_ = true ? \"ObservableValue@\" + getNextId() : 0;\n }\n if (notifySpy === void 0) {\n notifySpy = true;\n }\n if (equals === void 0) {\n equals = comparer[\"default\"];\n }\n _this = _Atom.call(this, name_) || this;\n _this.enhancer = void 0;\n _this.name_ = void 0;\n _this.equals = void 0;\n _this.hasUnreportedChange_ = false;\n _this.interceptors_ = void 0;\n _this.changeListeners_ = void 0;\n _this.value_ = void 0;\n _this.dehancer = void 0;\n _this.enhancer = enhancer;\n _this.name_ = name_;\n _this.equals = equals;\n _this.value_ = enhancer(value, undefined, name_);\n if ( true && notifySpy && isSpyEnabled()) {\n // only notify spy if this is a stand-alone observable\n spyReport({\n type: CREATE,\n object: _this,\n observableKind: \"value\",\n debugObjectName: _this.name_,\n newValue: \"\" + _this.value_\n });\n }\n return _this;\n }\n _inheritsLoose(ObservableValue, _Atom);\n var _proto = ObservableValue.prototype;\n _proto.dehanceValue = function dehanceValue(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.set = function set(newValue) {\n var oldValue = this.value_;\n newValue = this.prepareNewValue_(newValue);\n if (newValue !== globalState.UNCHANGED) {\n var notifySpy = isSpyEnabled();\n if ( true && notifySpy) {\n spyReportStart({\n type: UPDATE,\n object: this,\n observableKind: \"value\",\n debugObjectName: this.name_,\n newValue: newValue,\n oldValue: oldValue\n });\n }\n this.setNewValue_(newValue);\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n };\n _proto.prepareNewValue_ = function prepareNewValue_(newValue) {\n checkIfStateModificationsAreAllowed(this);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this,\n type: UPDATE,\n newValue: newValue\n });\n if (!change) {\n return globalState.UNCHANGED;\n }\n newValue = change.newValue;\n }\n // apply modifier\n newValue = this.enhancer(newValue, this.value_, this.name_);\n return this.equals(this.value_, newValue) ? globalState.UNCHANGED : newValue;\n };\n _proto.setNewValue_ = function setNewValue_(newValue) {\n var oldValue = this.value_;\n this.value_ = newValue;\n this.reportChanged();\n if (hasListeners(this)) {\n notifyListeners(this, {\n type: UPDATE,\n object: this,\n newValue: newValue,\n oldValue: oldValue\n });\n }\n };\n _proto.get = function get() {\n this.reportObserved();\n return this.dehanceValue(this.value_);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n if (fireImmediately) {\n listener({\n observableKind: \"value\",\n debugObjectName: this.name_,\n object: this,\n type: UPDATE,\n newValue: this.value_,\n oldValue: undefined\n });\n }\n return registerListener(this, listener);\n };\n _proto.raw = function raw() {\n // used by MST ot get undehanced value\n return this.value_;\n };\n _proto.toJSON = function toJSON() {\n return this.get();\n };\n _proto.toString = function toString() {\n return this.name_ + \"[\" + this.value_ + \"]\";\n };\n _proto.valueOf = function valueOf() {\n return toPrimitive(this.get());\n };\n _proto[Symbol.toPrimitive] = function () {\n return this.valueOf();\n };\n return ObservableValue;\n}(Atom);\nvar isObservableValue = /*#__PURE__*/createInstanceofPredicate(\"ObservableValue\", ObservableValue);\n\n/**\n * A node in the state dependency root that observes other nodes, and can be observed itself.\n *\n * ComputedValue will remember the result of the computation for the duration of the batch, or\n * while being observed.\n *\n * During this time it will recompute only when one of its direct dependencies changed,\n * but only when it is being accessed with `ComputedValue.get()`.\n *\n * Implementation description:\n * 1. First time it's being accessed it will compute and remember result\n * give back remembered result until 2. happens\n * 2. First time any deep dependency change, propagate POSSIBLY_STALE to all observers, wait for 3.\n * 3. When it's being accessed, recompute if any shallow dependency changed.\n * if result changed: propagate STALE to all observers, that were POSSIBLY_STALE from the last step.\n * go to step 2. either way\n *\n * If at any point it's outside batch and it isn't observed: reset everything and go to 1.\n */\nvar ComputedValue = /*#__PURE__*/function () {\n /**\n * Create a new computed value based on a function expression.\n *\n * The `name` property is for debug purposes only.\n *\n * The `equals` property specifies the comparer function to use to determine if a newly produced\n * value differs from the previous value. Two comparers are provided in the library; `defaultComparer`\n * compares based on identity comparison (===), and `structuralComparer` deeply compares the structure.\n * Structural comparison can be convenient if you always produce a new aggregated object and\n * don't want to notify observers if it is structurally the same.\n * This is useful for working with vectors, mouse coordinates etc.\n */\n function ComputedValue(options) {\n this.dependenciesState_ = IDerivationState_.NOT_TRACKING_;\n this.observing_ = [];\n // nodes we are looking at. Our value depends on these nodes\n this.newObserving_ = null;\n // during tracking it's an array with new observed observers\n this.observers_ = new Set();\n this.runId_ = 0;\n this.lastAccessedBy_ = 0;\n this.lowestObserverState_ = IDerivationState_.UP_TO_DATE_;\n this.unboundDepsCount_ = 0;\n this.value_ = new CaughtException(null);\n this.name_ = void 0;\n this.triggeredBy_ = void 0;\n this.flags_ = 0;\n this.derivation = void 0;\n // N.B: unminified as it is used by MST\n this.setter_ = void 0;\n this.isTracing_ = TraceMode.NONE;\n this.scope_ = void 0;\n this.equals_ = void 0;\n this.requiresReaction_ = void 0;\n this.keepAlive_ = void 0;\n this.onBOL = void 0;\n this.onBUOL = void 0;\n if (!options.get) {\n die(31);\n }\n this.derivation = options.get;\n this.name_ = options.name || ( true ? \"ComputedValue@\" + getNextId() : 0);\n if (options.set) {\n this.setter_ = createAction( true ? this.name_ + \"-setter\" : 0, options.set);\n }\n this.equals_ = options.equals || (options.compareStructural || options.struct ? comparer.structural : comparer[\"default\"]);\n this.scope_ = options.context;\n this.requiresReaction_ = options.requiresReaction;\n this.keepAlive_ = !!options.keepAlive;\n }\n var _proto = ComputedValue.prototype;\n _proto.onBecomeStale_ = function onBecomeStale_() {\n propagateMaybeChanged(this);\n };\n _proto.onBO = function onBO() {\n if (this.onBOL) {\n this.onBOL.forEach(function (listener) {\n return listener();\n });\n }\n };\n _proto.onBUO = function onBUO() {\n if (this.onBUOL) {\n this.onBUOL.forEach(function (listener) {\n return listener();\n });\n }\n }\n // to check for cycles\n ;\n /**\n * Returns the current value of this computed value.\n * Will evaluate its computation first if needed.\n */\n _proto.get = function get() {\n if (this.isComputing) {\n die(32, this.name_, this.derivation);\n }\n if (globalState.inBatch === 0 &&\n // !globalState.trackingDerivatpion &&\n this.observers_.size === 0 && !this.keepAlive_) {\n if (shouldCompute(this)) {\n this.warnAboutUntrackedRead_();\n startBatch(); // See perf test 'computed memoization'\n this.value_ = this.computeValue_(false);\n endBatch();\n }\n } else {\n reportObserved(this);\n if (shouldCompute(this)) {\n var prevTrackingContext = globalState.trackingContext;\n if (this.keepAlive_ && !prevTrackingContext) {\n globalState.trackingContext = this;\n }\n if (this.trackAndCompute()) {\n propagateChangeConfirmed(this);\n }\n globalState.trackingContext = prevTrackingContext;\n }\n }\n var result = this.value_;\n if (isCaughtException(result)) {\n throw result.cause;\n }\n return result;\n };\n _proto.set = function set(value) {\n if (this.setter_) {\n if (this.isRunningSetter) {\n die(33, this.name_);\n }\n this.isRunningSetter = true;\n try {\n this.setter_.call(this.scope_, value);\n } finally {\n this.isRunningSetter = false;\n }\n } else {\n die(34, this.name_);\n }\n };\n _proto.trackAndCompute = function trackAndCompute() {\n // N.B: unminified as it is used by MST\n var oldValue = this.value_;\n var wasSuspended = /* see #1208 */this.dependenciesState_ === IDerivationState_.NOT_TRACKING_;\n var newValue = this.computeValue_(true);\n var changed = wasSuspended || isCaughtException(oldValue) || isCaughtException(newValue) || !this.equals_(oldValue, newValue);\n if (changed) {\n this.value_ = newValue;\n if ( true && isSpyEnabled()) {\n spyReport({\n observableKind: \"computed\",\n debugObjectName: this.name_,\n object: this.scope_,\n type: \"update\",\n oldValue: oldValue,\n newValue: newValue\n });\n }\n }\n return changed;\n };\n _proto.computeValue_ = function computeValue_(track) {\n this.isComputing = true;\n // don't allow state changes during computation\n var prev = allowStateChangesStart(false);\n var res;\n if (track) {\n res = trackDerivedFunction(this, this.derivation, this.scope_);\n } else {\n if (globalState.disableErrorBoundaries === true) {\n res = this.derivation.call(this.scope_);\n } else {\n try {\n res = this.derivation.call(this.scope_);\n } catch (e) {\n res = new CaughtException(e);\n }\n }\n }\n allowStateChangesEnd(prev);\n this.isComputing = false;\n return res;\n };\n _proto.suspend_ = function suspend_() {\n if (!this.keepAlive_) {\n clearObserving(this);\n this.value_ = undefined; // don't hold on to computed value!\n if ( true && this.isTracing_ !== TraceMode.NONE) {\n console.log(\"[mobx.trace] Computed value '\" + this.name_ + \"' was suspended and it will recompute on the next access.\");\n }\n }\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n var _this = this;\n var firstTime = true;\n var prevValue = undefined;\n return autorun(function () {\n // TODO: why is this in a different place than the spyReport() function? in all other observables it's called in the same place\n var newValue = _this.get();\n if (!firstTime || fireImmediately) {\n var prevU = untrackedStart();\n listener({\n observableKind: \"computed\",\n debugObjectName: _this.name_,\n type: UPDATE,\n object: _this,\n newValue: newValue,\n oldValue: prevValue\n });\n untrackedEnd(prevU);\n }\n firstTime = false;\n prevValue = newValue;\n });\n };\n _proto.warnAboutUntrackedRead_ = function warnAboutUntrackedRead_() {\n if (false) {}\n if (this.isTracing_ !== TraceMode.NONE) {\n console.log(\"[mobx.trace] Computed value '\" + this.name_ + \"' is being read outside a reactive context. Doing a full recompute.\");\n }\n if (typeof this.requiresReaction_ === \"boolean\" ? this.requiresReaction_ : globalState.computedRequiresReaction) {\n console.warn(\"[mobx] Computed value '\" + this.name_ + \"' is being read outside a reactive context. Doing a full recompute.\");\n }\n };\n _proto.toString = function toString() {\n return this.name_ + \"[\" + this.derivation.toString() + \"]\";\n };\n _proto.valueOf = function valueOf() {\n return toPrimitive(this.get());\n };\n _proto[Symbol.toPrimitive] = function () {\n return this.valueOf();\n };\n return _createClass(ComputedValue, [{\n key: \"isComputing\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isComputingMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isComputingMask_, newValue);\n }\n }, {\n key: \"isRunningSetter\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isRunningSetterMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isRunningSetterMask_, newValue);\n }\n }, {\n key: \"isBeingObserved\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isBeingObservedMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isBeingObservedMask_, newValue);\n }\n }, {\n key: \"isPendingUnobservation\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isPendingUnobservationMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isPendingUnobservationMask_, newValue);\n }\n }, {\n key: \"diffValue\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.diffValueMask_) ? 1 : 0;\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.diffValueMask_, newValue === 1 ? true : false);\n }\n }]);\n}();\nComputedValue.isComputingMask_ = 1;\nComputedValue.isRunningSetterMask_ = 2;\nComputedValue.isBeingObservedMask_ = 4;\nComputedValue.isPendingUnobservationMask_ = 8;\nComputedValue.diffValueMask_ = 16;\nvar isComputedValue = /*#__PURE__*/createInstanceofPredicate(\"ComputedValue\", ComputedValue);\n\nvar IDerivationState_;\n(function (IDerivationState_) {\n // before being run or (outside batch and not being observed)\n // at this point derivation is not holding any data about dependency tree\n IDerivationState_[IDerivationState_[\"NOT_TRACKING_\"] = -1] = \"NOT_TRACKING_\";\n // no shallow dependency changed since last computation\n // won't recalculate derivation\n // this is what makes mobx fast\n IDerivationState_[IDerivationState_[\"UP_TO_DATE_\"] = 0] = \"UP_TO_DATE_\";\n // some deep dependency changed, but don't know if shallow dependency changed\n // will require to check first if UP_TO_DATE or POSSIBLY_STALE\n // currently only ComputedValue will propagate POSSIBLY_STALE\n //\n // having this state is second big optimization:\n // don't have to recompute on every dependency change, but only when it's needed\n IDerivationState_[IDerivationState_[\"POSSIBLY_STALE_\"] = 1] = \"POSSIBLY_STALE_\";\n // A shallow dependency has changed since last computation and the derivation\n // will need to recompute when it's needed next.\n IDerivationState_[IDerivationState_[\"STALE_\"] = 2] = \"STALE_\";\n})(IDerivationState_ || (IDerivationState_ = {}));\nvar TraceMode;\n(function (TraceMode) {\n TraceMode[TraceMode[\"NONE\"] = 0] = \"NONE\";\n TraceMode[TraceMode[\"LOG\"] = 1] = \"LOG\";\n TraceMode[TraceMode[\"BREAK\"] = 2] = \"BREAK\";\n})(TraceMode || (TraceMode = {}));\nvar CaughtException = function CaughtException(cause) {\n this.cause = void 0;\n this.cause = cause;\n // Empty\n};\nfunction isCaughtException(e) {\n return e instanceof CaughtException;\n}\n/**\n * Finds out whether any dependency of the derivation has actually changed.\n * If dependenciesState is 1 then it will recalculate dependencies,\n * if any dependency changed it will propagate it by changing dependenciesState to 2.\n *\n * By iterating over the dependencies in the same order that they were reported and\n * stopping on the first change, all the recalculations are only called for ComputedValues\n * that will be tracked by derivation. That is because we assume that if the first x\n * dependencies of the derivation doesn't change then the derivation should run the same way\n * up until accessing x-th dependency.\n */\nfunction shouldCompute(derivation) {\n switch (derivation.dependenciesState_) {\n case IDerivationState_.UP_TO_DATE_:\n return false;\n case IDerivationState_.NOT_TRACKING_:\n case IDerivationState_.STALE_:\n return true;\n case IDerivationState_.POSSIBLY_STALE_:\n {\n // state propagation can occur outside of action/reactive context #2195\n var prevAllowStateReads = allowStateReadsStart(true);\n var prevUntracked = untrackedStart(); // no need for those computeds to be reported, they will be picked up in trackDerivedFunction.\n var obs = derivation.observing_,\n l = obs.length;\n for (var i = 0; i < l; i++) {\n var obj = obs[i];\n if (isComputedValue(obj)) {\n if (globalState.disableErrorBoundaries) {\n obj.get();\n } else {\n try {\n obj.get();\n } catch (e) {\n // we are not interested in the value *or* exception at this moment, but if there is one, notify all\n untrackedEnd(prevUntracked);\n allowStateReadsEnd(prevAllowStateReads);\n return true;\n }\n }\n // if ComputedValue `obj` actually changed it will be computed and propagated to its observers.\n // and `derivation` is an observer of `obj`\n // invariantShouldCompute(derivation)\n if (derivation.dependenciesState_ === IDerivationState_.STALE_) {\n untrackedEnd(prevUntracked);\n allowStateReadsEnd(prevAllowStateReads);\n return true;\n }\n }\n }\n changeDependenciesStateTo0(derivation);\n untrackedEnd(prevUntracked);\n allowStateReadsEnd(prevAllowStateReads);\n return false;\n }\n }\n}\nfunction isComputingDerivation() {\n return globalState.trackingDerivation !== null; // filter out actions inside computations\n}\nfunction checkIfStateModificationsAreAllowed(atom) {\n if (false) {}\n var hasObservers = atom.observers_.size > 0;\n // Should not be possible to change observed state outside strict mode, except during initialization, see #563\n if (!globalState.allowStateChanges && (hasObservers || globalState.enforceActions === \"always\")) {\n console.warn(\"[MobX] \" + (globalState.enforceActions ? \"Since strict-mode is enabled, changing (observed) observable values without using an action is not allowed. Tried to modify: \" : \"Side effects like changing state are not allowed at this point. Are you trying to modify state from, for example, a computed value or the render function of a React component? You can wrap side effects in 'runInAction' (or decorate functions with 'action') if needed. Tried to modify: \") + atom.name_);\n }\n}\nfunction checkIfStateReadsAreAllowed(observable) {\n if ( true && !globalState.allowStateReads && globalState.observableRequiresReaction) {\n console.warn(\"[mobx] Observable '\" + observable.name_ + \"' being read outside a reactive context.\");\n }\n}\n/**\n * Executes the provided function `f` and tracks which observables are being accessed.\n * The tracking information is stored on the `derivation` object and the derivation is registered\n * as observer of any of the accessed observables.\n */\nfunction trackDerivedFunction(derivation, f, context) {\n var prevAllowStateReads = allowStateReadsStart(true);\n changeDependenciesStateTo0(derivation);\n // Preallocate array; will be trimmed by bindDependencies.\n derivation.newObserving_ = new Array(\n // Reserve constant space for initial dependencies, dynamic space otherwise.\n // See https://github.com/mobxjs/mobx/pull/3833\n derivation.runId_ === 0 ? 100 : derivation.observing_.length);\n derivation.unboundDepsCount_ = 0;\n derivation.runId_ = ++globalState.runId;\n var prevTracking = globalState.trackingDerivation;\n globalState.trackingDerivation = derivation;\n globalState.inBatch++;\n var result;\n if (globalState.disableErrorBoundaries === true) {\n result = f.call(context);\n } else {\n try {\n result = f.call(context);\n } catch (e) {\n result = new CaughtException(e);\n }\n }\n globalState.inBatch--;\n globalState.trackingDerivation = prevTracking;\n bindDependencies(derivation);\n warnAboutDerivationWithoutDependencies(derivation);\n allowStateReadsEnd(prevAllowStateReads);\n return result;\n}\nfunction warnAboutDerivationWithoutDependencies(derivation) {\n if (false) {}\n if (derivation.observing_.length !== 0) {\n return;\n }\n if (typeof derivation.requiresObservable_ === \"boolean\" ? derivation.requiresObservable_ : globalState.reactionRequiresObservable) {\n console.warn(\"[mobx] Derivation '\" + derivation.name_ + \"' is created/updated without reading any observable value.\");\n }\n}\n/**\n * diffs newObserving with observing.\n * update observing to be newObserving with unique observables\n * notify observers that become observed/unobserved\n */\nfunction bindDependencies(derivation) {\n // invariant(derivation.dependenciesState !== IDerivationState.NOT_TRACKING, \"INTERNAL ERROR bindDependencies expects derivation.dependenciesState !== -1\");\n var prevObserving = derivation.observing_;\n var observing = derivation.observing_ = derivation.newObserving_;\n var lowestNewObservingDerivationState = IDerivationState_.UP_TO_DATE_;\n // Go through all new observables and check diffValue: (this list can contain duplicates):\n // 0: first occurrence, change to 1 and keep it\n // 1: extra occurrence, drop it\n var i0 = 0,\n l = derivation.unboundDepsCount_;\n for (var i = 0; i < l; i++) {\n var dep = observing[i];\n if (dep.diffValue === 0) {\n dep.diffValue = 1;\n if (i0 !== i) {\n observing[i0] = dep;\n }\n i0++;\n }\n // Upcast is 'safe' here, because if dep is IObservable, `dependenciesState` will be undefined,\n // not hitting the condition\n if (dep.dependenciesState_ > lowestNewObservingDerivationState) {\n lowestNewObservingDerivationState = dep.dependenciesState_;\n }\n }\n observing.length = i0;\n derivation.newObserving_ = null; // newObserving shouldn't be needed outside tracking (statement moved down to work around FF bug, see #614)\n // Go through all old observables and check diffValue: (it is unique after last bindDependencies)\n // 0: it's not in new observables, unobserve it\n // 1: it keeps being observed, don't want to notify it. change to 0\n l = prevObserving.length;\n while (l--) {\n var _dep = prevObserving[l];\n if (_dep.diffValue === 0) {\n removeObserver(_dep, derivation);\n }\n _dep.diffValue = 0;\n }\n // Go through all new observables and check diffValue: (now it should be unique)\n // 0: it was set to 0 in last loop. don't need to do anything.\n // 1: it wasn't observed, let's observe it. set back to 0\n while (i0--) {\n var _dep2 = observing[i0];\n if (_dep2.diffValue === 1) {\n _dep2.diffValue = 0;\n addObserver(_dep2, derivation);\n }\n }\n // Some new observed derivations may become stale during this derivation computation\n // so they have had no chance to propagate staleness (#916)\n if (lowestNewObservingDerivationState !== IDerivationState_.UP_TO_DATE_) {\n derivation.dependenciesState_ = lowestNewObservingDerivationState;\n derivation.onBecomeStale_();\n }\n}\nfunction clearObserving(derivation) {\n // invariant(globalState.inBatch > 0, \"INTERNAL ERROR clearObserving should be called only inside batch\");\n var obs = derivation.observing_;\n derivation.observing_ = [];\n var i = obs.length;\n while (i--) {\n removeObserver(obs[i], derivation);\n }\n derivation.dependenciesState_ = IDerivationState_.NOT_TRACKING_;\n}\nfunction untracked(action) {\n var prev = untrackedStart();\n try {\n return action();\n } finally {\n untrackedEnd(prev);\n }\n}\nfunction untrackedStart() {\n var prev = globalState.trackingDerivation;\n globalState.trackingDerivation = null;\n return prev;\n}\nfunction untrackedEnd(prev) {\n globalState.trackingDerivation = prev;\n}\nfunction allowStateReadsStart(allowStateReads) {\n var prev = globalState.allowStateReads;\n globalState.allowStateReads = allowStateReads;\n return prev;\n}\nfunction allowStateReadsEnd(prev) {\n globalState.allowStateReads = prev;\n}\n/**\n * needed to keep `lowestObserverState` correct. when changing from (2 or 1) to 0\n *\n */\nfunction changeDependenciesStateTo0(derivation) {\n if (derivation.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {\n return;\n }\n derivation.dependenciesState_ = IDerivationState_.UP_TO_DATE_;\n var obs = derivation.observing_;\n var i = obs.length;\n while (i--) {\n obs[i].lowestObserverState_ = IDerivationState_.UP_TO_DATE_;\n }\n}\n\n/**\n * These values will persist if global state is reset\n */\nvar persistentKeys = [\"mobxGuid\", \"spyListeners\", \"enforceActions\", \"computedRequiresReaction\", \"reactionRequiresObservable\", \"observableRequiresReaction\", \"allowStateReads\", \"disableErrorBoundaries\", \"runId\", \"UNCHANGED\", \"useProxies\"];\nvar MobXGlobals = function MobXGlobals() {\n /**\n * MobXGlobals version.\n * MobX compatiblity with other versions loaded in memory as long as this version matches.\n * It indicates that the global state still stores similar information\n *\n * N.B: this version is unrelated to the package version of MobX, and is only the version of the\n * internal state storage of MobX, and can be the same across many different package versions\n */\n this.version = 6;\n /**\n * globally unique token to signal unchanged\n */\n this.UNCHANGED = {};\n /**\n * Currently running derivation\n */\n this.trackingDerivation = null;\n /**\n * Currently running reaction. This determines if we currently have a reactive context.\n * (Tracking derivation is also set for temporal tracking of computed values inside actions,\n * but trackingReaction can only be set by a form of Reaction)\n */\n this.trackingContext = null;\n /**\n * Each time a derivation is tracked, it is assigned a unique run-id\n */\n this.runId = 0;\n /**\n * 'guid' for general purpose. Will be persisted amongst resets.\n */\n this.mobxGuid = 0;\n /**\n * Are we in a batch block? (and how many of them)\n */\n this.inBatch = 0;\n /**\n * Observables that don't have observers anymore, and are about to be\n * suspended, unless somebody else accesses it in the same batch\n *\n * @type {IObservable[]}\n */\n this.pendingUnobservations = [];\n /**\n * List of scheduled, not yet executed, reactions.\n */\n this.pendingReactions = [];\n /**\n * Are we currently processing reactions?\n */\n this.isRunningReactions = false;\n /**\n * Is it allowed to change observables at this point?\n * In general, MobX doesn't allow that when running computations and React.render.\n * To ensure that those functions stay pure.\n */\n this.allowStateChanges = false;\n /**\n * Is it allowed to read observables at this point?\n * Used to hold the state needed for `observableRequiresReaction`\n */\n this.allowStateReads = true;\n /**\n * If strict mode is enabled, state changes are by default not allowed\n */\n this.enforceActions = true;\n /**\n * Spy callbacks\n */\n this.spyListeners = [];\n /**\n * Globally attached error handlers that react specifically to errors in reactions\n */\n this.globalReactionErrorHandlers = [];\n /**\n * Warn if computed values are accessed outside a reactive context\n */\n this.computedRequiresReaction = false;\n /**\n * (Experimental)\n * Warn if you try to create to derivation / reactive context without accessing any observable.\n */\n this.reactionRequiresObservable = false;\n /**\n * (Experimental)\n * Warn if observables are accessed outside a reactive context\n */\n this.observableRequiresReaction = false;\n /*\n * Don't catch and rethrow exceptions. This is useful for inspecting the state of\n * the stack when an exception occurs while debugging.\n */\n this.disableErrorBoundaries = false;\n /*\n * If true, we are already handling an exception in an action. Any errors in reactions should be suppressed, as\n * they are not the cause, see: https://github.com/mobxjs/mobx/issues/1836\n */\n this.suppressReactionErrors = false;\n this.useProxies = true;\n /*\n * print warnings about code that would fail if proxies weren't available\n */\n this.verifyProxies = false;\n /**\n * False forces all object's descriptors to\n * writable: true\n * configurable: true\n */\n this.safeDescriptors = true;\n};\nvar canMergeGlobalState = true;\nvar isolateCalled = false;\nvar globalState = /*#__PURE__*/function () {\n var global = /*#__PURE__*/getGlobal();\n if (global.__mobxInstanceCount > 0 && !global.__mobxGlobals) {\n canMergeGlobalState = false;\n }\n if (global.__mobxGlobals && global.__mobxGlobals.version !== new MobXGlobals().version) {\n canMergeGlobalState = false;\n }\n if (!canMergeGlobalState) {\n // Because this is a IIFE we need to let isolateCalled a chance to change\n // so we run it after the event loop completed at least 1 iteration\n setTimeout(function () {\n if (!isolateCalled) {\n die(35);\n }\n }, 1);\n return new MobXGlobals();\n } else if (global.__mobxGlobals) {\n global.__mobxInstanceCount += 1;\n if (!global.__mobxGlobals.UNCHANGED) {\n global.__mobxGlobals.UNCHANGED = {};\n } // make merge backward compatible\n return global.__mobxGlobals;\n } else {\n global.__mobxInstanceCount = 1;\n return global.__mobxGlobals = /*#__PURE__*/new MobXGlobals();\n }\n}();\nfunction isolateGlobalState() {\n if (globalState.pendingReactions.length || globalState.inBatch || globalState.isRunningReactions) {\n die(36);\n }\n isolateCalled = true;\n if (canMergeGlobalState) {\n var global = getGlobal();\n if (--global.__mobxInstanceCount === 0) {\n global.__mobxGlobals = undefined;\n }\n globalState = new MobXGlobals();\n }\n}\nfunction getGlobalState() {\n return globalState;\n}\n/**\n * For testing purposes only; this will break the internal state of existing observables,\n * but can be used to get back at a stable state after throwing errors\n */\nfunction resetGlobalState() {\n var defaultGlobals = new MobXGlobals();\n for (var key in defaultGlobals) {\n if (persistentKeys.indexOf(key) === -1) {\n globalState[key] = defaultGlobals[key];\n }\n }\n globalState.allowStateChanges = !globalState.enforceActions;\n}\n\nfunction hasObservers(observable) {\n return observable.observers_ && observable.observers_.size > 0;\n}\nfunction getObservers(observable) {\n return observable.observers_;\n}\n// function invariantObservers(observable: IObservable) {\n// const list = observable.observers\n// const map = observable.observersIndexes\n// const l = list.length\n// for (let i = 0; i < l; i++) {\n// const id = list[i].__mapid\n// if (i) {\n// invariant(map[id] === i, \"INTERNAL ERROR maps derivation.__mapid to index in list\") // for performance\n// } else {\n// invariant(!(id in map), \"INTERNAL ERROR observer on index 0 shouldn't be held in map.\") // for performance\n// }\n// }\n// invariant(\n// list.length === 0 || Object.keys(map).length === list.length - 1,\n// \"INTERNAL ERROR there is no junk in map\"\n// )\n// }\nfunction addObserver(observable, node) {\n // invariant(node.dependenciesState !== -1, \"INTERNAL ERROR, can add only dependenciesState !== -1\");\n // invariant(observable._observers.indexOf(node) === -1, \"INTERNAL ERROR add already added node\");\n // invariantObservers(observable);\n observable.observers_.add(node);\n if (observable.lowestObserverState_ > node.dependenciesState_) {\n observable.lowestObserverState_ = node.dependenciesState_;\n }\n // invariantObservers(observable);\n // invariant(observable._observers.indexOf(node) !== -1, \"INTERNAL ERROR didn't add node\");\n}\nfunction removeObserver(observable, node) {\n // invariant(globalState.inBatch > 0, \"INTERNAL ERROR, remove should be called only inside batch\");\n // invariant(observable._observers.indexOf(node) !== -1, \"INTERNAL ERROR remove already removed node\");\n // invariantObservers(observable);\n observable.observers_[\"delete\"](node);\n if (observable.observers_.size === 0) {\n // deleting last observer\n queueForUnobservation(observable);\n }\n // invariantObservers(observable);\n // invariant(observable._observers.indexOf(node) === -1, \"INTERNAL ERROR remove already removed node2\");\n}\nfunction queueForUnobservation(observable) {\n if (observable.isPendingUnobservation === false) {\n // invariant(observable._observers.length === 0, \"INTERNAL ERROR, should only queue for unobservation unobserved observables\");\n observable.isPendingUnobservation = true;\n globalState.pendingUnobservations.push(observable);\n }\n}\n/**\n * Batch starts a transaction, at least for purposes of memoizing ComputedValues when nothing else does.\n * During a batch `onBecomeUnobserved` will be called at most once per observable.\n * Avoids unnecessary recalculations.\n */\nfunction startBatch() {\n globalState.inBatch++;\n}\nfunction endBatch() {\n if (--globalState.inBatch === 0) {\n runReactions();\n // the batch is actually about to finish, all unobserving should happen here.\n var list = globalState.pendingUnobservations;\n for (var i = 0; i < list.length; i++) {\n var observable = list[i];\n observable.isPendingUnobservation = false;\n if (observable.observers_.size === 0) {\n if (observable.isBeingObserved) {\n // if this observable had reactive observers, trigger the hooks\n observable.isBeingObserved = false;\n observable.onBUO();\n }\n if (observable instanceof ComputedValue) {\n // computed values are automatically teared down when the last observer leaves\n // this process happens recursively, this computed might be the last observabe of another, etc..\n observable.suspend_();\n }\n }\n }\n globalState.pendingUnobservations = [];\n }\n}\nfunction reportObserved(observable) {\n checkIfStateReadsAreAllowed(observable);\n var derivation = globalState.trackingDerivation;\n if (derivation !== null) {\n /**\n * Simple optimization, give each derivation run an unique id (runId)\n * Check if last time this observable was accessed the same runId is used\n * if this is the case, the relation is already known\n */\n if (derivation.runId_ !== observable.lastAccessedBy_) {\n observable.lastAccessedBy_ = derivation.runId_;\n // Tried storing newObserving, or observing, or both as Set, but performance didn't come close...\n derivation.newObserving_[derivation.unboundDepsCount_++] = observable;\n if (!observable.isBeingObserved && globalState.trackingContext) {\n observable.isBeingObserved = true;\n observable.onBO();\n }\n }\n return observable.isBeingObserved;\n } else if (observable.observers_.size === 0 && globalState.inBatch > 0) {\n queueForUnobservation(observable);\n }\n return false;\n}\n// function invariantLOS(observable: IObservable, msg: string) {\n// // it's expensive so better not run it in produciton. but temporarily helpful for testing\n// const min = getObservers(observable).reduce((a, b) => Math.min(a, b.dependenciesState), 2)\n// if (min >= observable.lowestObserverState) return // <- the only assumption about `lowestObserverState`\n// throw new Error(\n// \"lowestObserverState is wrong for \" +\n// msg +\n// \" because \" +\n// min +\n// \" < \" +\n// observable.lowestObserverState\n// )\n// }\n/**\n * NOTE: current propagation mechanism will in case of self reruning autoruns behave unexpectedly\n * It will propagate changes to observers from previous run\n * It's hard or maybe impossible (with reasonable perf) to get it right with current approach\n * Hopefully self reruning autoruns aren't a feature people should depend on\n * Also most basic use cases should be ok\n */\n// Called by Atom when its value changes\nfunction propagateChanged(observable) {\n // invariantLOS(observable, \"changed start\");\n if (observable.lowestObserverState_ === IDerivationState_.STALE_) {\n return;\n }\n observable.lowestObserverState_ = IDerivationState_.STALE_;\n // Ideally we use for..of here, but the downcompiled version is really slow...\n observable.observers_.forEach(function (d) {\n if (d.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {\n if ( true && d.isTracing_ !== TraceMode.NONE) {\n logTraceInfo(d, observable);\n }\n d.onBecomeStale_();\n }\n d.dependenciesState_ = IDerivationState_.STALE_;\n });\n // invariantLOS(observable, \"changed end\");\n}\n// Called by ComputedValue when it recalculate and its value changed\nfunction propagateChangeConfirmed(observable) {\n // invariantLOS(observable, \"confirmed start\");\n if (observable.lowestObserverState_ === IDerivationState_.STALE_) {\n return;\n }\n observable.lowestObserverState_ = IDerivationState_.STALE_;\n observable.observers_.forEach(function (d) {\n if (d.dependenciesState_ === IDerivationState_.POSSIBLY_STALE_) {\n d.dependenciesState_ = IDerivationState_.STALE_;\n if ( true && d.isTracing_ !== TraceMode.NONE) {\n logTraceInfo(d, observable);\n }\n } else if (d.dependenciesState_ === IDerivationState_.UP_TO_DATE_ // this happens during computing of `d`, just keep lowestObserverState up to date.\n ) {\n observable.lowestObserverState_ = IDerivationState_.UP_TO_DATE_;\n }\n });\n // invariantLOS(observable, \"confirmed end\");\n}\n// Used by computed when its dependency changed, but we don't wan't to immediately recompute.\nfunction propagateMaybeChanged(observable) {\n // invariantLOS(observable, \"maybe start\");\n if (observable.lowestObserverState_ !== IDerivationState_.UP_TO_DATE_) {\n return;\n }\n observable.lowestObserverState_ = IDerivationState_.POSSIBLY_STALE_;\n observable.observers_.forEach(function (d) {\n if (d.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {\n d.dependenciesState_ = IDerivationState_.POSSIBLY_STALE_;\n d.onBecomeStale_();\n }\n });\n // invariantLOS(observable, \"maybe end\");\n}\nfunction logTraceInfo(derivation, observable) {\n console.log(\"[mobx.trace] '\" + derivation.name_ + \"' is invalidated due to a change in: '\" + observable.name_ + \"'\");\n if (derivation.isTracing_ === TraceMode.BREAK) {\n var lines = [];\n printDepTree(getDependencyTree(derivation), lines, 1);\n // prettier-ignore\n new Function(\"debugger;\\n/*\\nTracing '\" + derivation.name_ + \"'\\n\\nYou are entering this break point because derivation '\" + derivation.name_ + \"' is being traced and '\" + observable.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\" + (derivation instanceof ComputedValue ? derivation.derivation.toString().replace(/[*]\\//g, \"/\") : \"\") + \"\\n\\nThe dependencies for this derivation are:\\n\\n\" + lines.join(\"\\n\") + \"\\n*/\\n \")();\n }\n}\nfunction printDepTree(tree, lines, depth) {\n if (lines.length >= 1000) {\n lines.push(\"(and many more)\");\n return;\n }\n lines.push(\"\" + \"\\t\".repeat(depth - 1) + tree.name);\n if (tree.dependencies) {\n tree.dependencies.forEach(function (child) {\n return printDepTree(child, lines, depth + 1);\n });\n }\n}\n\nvar Reaction = /*#__PURE__*/function () {\n function Reaction(name_, onInvalidate_, errorHandler_, requiresObservable_) {\n if (name_ === void 0) {\n name_ = true ? \"Reaction@\" + getNextId() : 0;\n }\n this.name_ = void 0;\n this.onInvalidate_ = void 0;\n this.errorHandler_ = void 0;\n this.requiresObservable_ = void 0;\n this.observing_ = [];\n // nodes we are looking at. Our value depends on these nodes\n this.newObserving_ = [];\n this.dependenciesState_ = IDerivationState_.NOT_TRACKING_;\n this.runId_ = 0;\n this.unboundDepsCount_ = 0;\n this.flags_ = 0;\n this.isTracing_ = TraceMode.NONE;\n this.name_ = name_;\n this.onInvalidate_ = onInvalidate_;\n this.errorHandler_ = errorHandler_;\n this.requiresObservable_ = requiresObservable_;\n }\n var _proto = Reaction.prototype;\n _proto.onBecomeStale_ = function onBecomeStale_() {\n this.schedule_();\n };\n _proto.schedule_ = function schedule_() {\n if (!this.isScheduled) {\n this.isScheduled = true;\n globalState.pendingReactions.push(this);\n runReactions();\n }\n }\n /**\n * internal, use schedule() if you intend to kick off a reaction\n */;\n _proto.runReaction_ = function runReaction_() {\n if (!this.isDisposed) {\n startBatch();\n this.isScheduled = false;\n var prev = globalState.trackingContext;\n globalState.trackingContext = this;\n if (shouldCompute(this)) {\n this.isTrackPending = true;\n try {\n this.onInvalidate_();\n if ( true && this.isTrackPending && isSpyEnabled()) {\n // onInvalidate didn't trigger track right away..\n spyReport({\n name: this.name_,\n type: \"scheduled-reaction\"\n });\n }\n } catch (e) {\n this.reportExceptionInDerivation_(e);\n }\n }\n globalState.trackingContext = prev;\n endBatch();\n }\n };\n _proto.track = function track(fn) {\n if (this.isDisposed) {\n return;\n // console.warn(\"Reaction already disposed\") // Note: Not a warning / error in mobx 4 either\n }\n startBatch();\n var notify = isSpyEnabled();\n var startTime;\n if ( true && notify) {\n startTime = Date.now();\n spyReportStart({\n name: this.name_,\n type: \"reaction\"\n });\n }\n this.isRunning = true;\n var prevReaction = globalState.trackingContext; // reactions could create reactions...\n globalState.trackingContext = this;\n var result = trackDerivedFunction(this, fn, undefined);\n globalState.trackingContext = prevReaction;\n this.isRunning = false;\n this.isTrackPending = false;\n if (this.isDisposed) {\n // disposed during last run. Clean up everything that was bound after the dispose call.\n clearObserving(this);\n }\n if (isCaughtException(result)) {\n this.reportExceptionInDerivation_(result.cause);\n }\n if ( true && notify) {\n spyReportEnd({\n time: Date.now() - startTime\n });\n }\n endBatch();\n };\n _proto.reportExceptionInDerivation_ = function reportExceptionInDerivation_(error) {\n var _this = this;\n if (this.errorHandler_) {\n this.errorHandler_(error, this);\n return;\n }\n if (globalState.disableErrorBoundaries) {\n throw error;\n }\n var message = true ? \"[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '\" + this + \"'\" : 0;\n if (!globalState.suppressReactionErrors) {\n console.error(message, error);\n /** If debugging brought you here, please, read the above message :-). Tnx! */\n } else if (true) {\n console.warn(\"[mobx] (error in reaction '\" + this.name_ + \"' suppressed, fix error of causing action below)\");\n } // prettier-ignore\n if ( true && isSpyEnabled()) {\n spyReport({\n type: \"error\",\n name: this.name_,\n message: message,\n error: \"\" + error\n });\n }\n globalState.globalReactionErrorHandlers.forEach(function (f) {\n return f(error, _this);\n });\n };\n _proto.dispose = function dispose() {\n if (!this.isDisposed) {\n this.isDisposed = true;\n if (!this.isRunning) {\n // if disposed while running, clean up later. Maybe not optimal, but rare case\n startBatch();\n clearObserving(this);\n endBatch();\n }\n }\n };\n _proto.getDisposer_ = function getDisposer_(abortSignal) {\n var _this2 = this;\n var dispose = function dispose() {\n _this2.dispose();\n abortSignal == null || abortSignal.removeEventListener == null || abortSignal.removeEventListener(\"abort\", dispose);\n };\n abortSignal == null || abortSignal.addEventListener == null || abortSignal.addEventListener(\"abort\", dispose);\n dispose[$mobx] = this;\n return dispose;\n };\n _proto.toString = function toString() {\n return \"Reaction[\" + this.name_ + \"]\";\n };\n _proto.trace = function trace$1(enterBreakPoint) {\n if (enterBreakPoint === void 0) {\n enterBreakPoint = false;\n }\n trace(this, enterBreakPoint);\n };\n return _createClass(Reaction, [{\n key: \"isDisposed\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isDisposedMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isDisposedMask_, newValue);\n }\n }, {\n key: \"isScheduled\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isScheduledMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isScheduledMask_, newValue);\n }\n }, {\n key: \"isTrackPending\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isTrackPendingMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isTrackPendingMask_, newValue);\n }\n }, {\n key: \"isRunning\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isRunningMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isRunningMask_, newValue);\n }\n }, {\n key: \"diffValue\",\n get: function get() {\n return getFlag(this.flags_, Reaction.diffValueMask_) ? 1 : 0;\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.diffValueMask_, newValue === 1 ? true : false);\n }\n }]);\n}();\nReaction.isDisposedMask_ = 1;\nReaction.isScheduledMask_ = 2;\nReaction.isTrackPendingMask_ = 4;\nReaction.isRunningMask_ = 8;\nReaction.diffValueMask_ = 16;\nfunction onReactionError(handler) {\n globalState.globalReactionErrorHandlers.push(handler);\n return function () {\n var idx = globalState.globalReactionErrorHandlers.indexOf(handler);\n if (idx >= 0) {\n globalState.globalReactionErrorHandlers.splice(idx, 1);\n }\n };\n}\n/**\n * Magic number alert!\n * Defines within how many times a reaction is allowed to re-trigger itself\n * until it is assumed that this is gonna be a never ending loop...\n */\nvar MAX_REACTION_ITERATIONS = 100;\nvar reactionScheduler = function reactionScheduler(f) {\n return f();\n};\nfunction runReactions() {\n // Trampolining, if runReactions are already running, new reactions will be picked up\n if (globalState.inBatch > 0 || globalState.isRunningReactions) {\n return;\n }\n reactionScheduler(runReactionsHelper);\n}\nfunction runReactionsHelper() {\n globalState.isRunningReactions = true;\n var allReactions = globalState.pendingReactions;\n var iterations = 0;\n // While running reactions, new reactions might be triggered.\n // Hence we work with two variables and check whether\n // we converge to no remaining reactions after a while.\n while (allReactions.length > 0) {\n if (++iterations === MAX_REACTION_ITERATIONS) {\n console.error( true ? \"Reaction doesn't converge to a stable state after \" + MAX_REACTION_ITERATIONS + \" iterations.\" + (\" Probably there is a cycle in the reactive function: \" + allReactions[0]) : 0);\n allReactions.splice(0); // clear reactions\n }\n var remainingReactions = allReactions.splice(0);\n for (var i = 0, l = remainingReactions.length; i < l; i++) {\n remainingReactions[i].runReaction_();\n }\n }\n globalState.isRunningReactions = false;\n}\nvar isReaction = /*#__PURE__*/createInstanceofPredicate(\"Reaction\", Reaction);\nfunction setReactionScheduler(fn) {\n var baseScheduler = reactionScheduler;\n reactionScheduler = function reactionScheduler(f) {\n return fn(function () {\n return baseScheduler(f);\n });\n };\n}\n\nfunction isSpyEnabled() {\n return true && !!globalState.spyListeners.length;\n}\nfunction spyReport(event) {\n if (false) {} // dead code elimination can do the rest\n if (!globalState.spyListeners.length) {\n return;\n }\n var listeners = globalState.spyListeners;\n for (var i = 0, l = listeners.length; i < l; i++) {\n listeners[i](event);\n }\n}\nfunction spyReportStart(event) {\n if (false) {}\n var change = _extends({}, event, {\n spyReportStart: true\n });\n spyReport(change);\n}\nvar END_EVENT = {\n type: \"report-end\",\n spyReportEnd: true\n};\nfunction spyReportEnd(change) {\n if (false) {}\n if (change) {\n spyReport(_extends({}, change, {\n type: \"report-end\",\n spyReportEnd: true\n }));\n } else {\n spyReport(END_EVENT);\n }\n}\nfunction spy(listener) {\n if (false) {} else {\n globalState.spyListeners.push(listener);\n return once(function () {\n globalState.spyListeners = globalState.spyListeners.filter(function (l) {\n return l !== listener;\n });\n });\n }\n}\n\nvar ACTION = \"action\";\nvar ACTION_BOUND = \"action.bound\";\nvar AUTOACTION = \"autoAction\";\nvar AUTOACTION_BOUND = \"autoAction.bound\";\nvar DEFAULT_ACTION_NAME = \"\";\nvar actionAnnotation = /*#__PURE__*/createActionAnnotation(ACTION);\nvar actionBoundAnnotation = /*#__PURE__*/createActionAnnotation(ACTION_BOUND, {\n bound: true\n});\nvar autoActionAnnotation = /*#__PURE__*/createActionAnnotation(AUTOACTION, {\n autoAction: true\n});\nvar autoActionBoundAnnotation = /*#__PURE__*/createActionAnnotation(AUTOACTION_BOUND, {\n autoAction: true,\n bound: true\n});\nfunction createActionFactory(autoAction) {\n var res = function action(arg1, arg2) {\n // action(fn() {})\n if (isFunction(arg1)) {\n return createAction(arg1.name || DEFAULT_ACTION_NAME, arg1, autoAction);\n }\n // action(\"name\", fn() {})\n if (isFunction(arg2)) {\n return createAction(arg1, arg2, autoAction);\n }\n // @action (2022.3 Decorators)\n if (is20223Decorator(arg2)) {\n return (autoAction ? autoActionAnnotation : actionAnnotation).decorate_20223_(arg1, arg2);\n }\n // @action\n if (isStringish(arg2)) {\n return storeAnnotation(arg1, arg2, autoAction ? autoActionAnnotation : actionAnnotation);\n }\n // action(\"name\") & @action(\"name\")\n if (isStringish(arg1)) {\n return createDecoratorAnnotation(createActionAnnotation(autoAction ? AUTOACTION : ACTION, {\n name: arg1,\n autoAction: autoAction\n }));\n }\n if (true) {\n die(\"Invalid arguments for `action`\");\n }\n };\n return res;\n}\nvar action = /*#__PURE__*/createActionFactory(false);\nObject.assign(action, actionAnnotation);\nvar autoAction = /*#__PURE__*/createActionFactory(true);\nObject.assign(autoAction, autoActionAnnotation);\naction.bound = /*#__PURE__*/createDecoratorAnnotation(actionBoundAnnotation);\nautoAction.bound = /*#__PURE__*/createDecoratorAnnotation(autoActionBoundAnnotation);\nfunction runInAction(fn) {\n return executeAction(fn.name || DEFAULT_ACTION_NAME, false, fn, this, undefined);\n}\nfunction isAction(thing) {\n return isFunction(thing) && thing.isMobxAction === true;\n}\n\n/**\n * Creates a named reactive view and keeps it alive, so that the view is always\n * updated if one of the dependencies changes, even when the view is not further used by something else.\n * @param view The reactive view\n * @returns disposer function, which can be used to stop the view from being updated in the future.\n */\nfunction autorun(view, opts) {\n var _opts$name, _opts, _opts2, _opts3;\n if (opts === void 0) {\n opts = EMPTY_OBJECT;\n }\n if (true) {\n if (!isFunction(view)) {\n die(\"Autorun expects a function as first argument\");\n }\n if (isAction(view)) {\n die(\"Autorun does not accept actions since actions are untrackable\");\n }\n }\n var name = (_opts$name = (_opts = opts) == null ? void 0 : _opts.name) != null ? _opts$name : true ? view.name || \"Autorun@\" + getNextId() : 0;\n var runSync = !opts.scheduler && !opts.delay;\n var reaction;\n if (runSync) {\n // normal autorun\n reaction = new Reaction(name, function () {\n this.track(reactionRunner);\n }, opts.onError, opts.requiresObservable);\n } else {\n var scheduler = createSchedulerFromOptions(opts);\n // debounced autorun\n var isScheduled = false;\n reaction = new Reaction(name, function () {\n if (!isScheduled) {\n isScheduled = true;\n scheduler(function () {\n isScheduled = false;\n if (!reaction.isDisposed) {\n reaction.track(reactionRunner);\n }\n });\n }\n }, opts.onError, opts.requiresObservable);\n }\n function reactionRunner() {\n view(reaction);\n }\n if (!((_opts2 = opts) != null && (_opts2 = _opts2.signal) != null && _opts2.aborted)) {\n reaction.schedule_();\n }\n return reaction.getDisposer_((_opts3 = opts) == null ? void 0 : _opts3.signal);\n}\nvar run = function run(f) {\n return f();\n};\nfunction createSchedulerFromOptions(opts) {\n return opts.scheduler ? opts.scheduler : opts.delay ? function (f) {\n return setTimeout(f, opts.delay);\n } : run;\n}\nfunction reaction(expression, effect, opts) {\n var _opts$name2, _opts4, _opts5;\n if (opts === void 0) {\n opts = EMPTY_OBJECT;\n }\n if (true) {\n if (!isFunction(expression) || !isFunction(effect)) {\n die(\"First and second argument to reaction should be functions\");\n }\n if (!isPlainObject(opts)) {\n die(\"Third argument of reactions should be an object\");\n }\n }\n var name = (_opts$name2 = opts.name) != null ? _opts$name2 : true ? \"Reaction@\" + getNextId() : 0;\n var effectAction = action(name, opts.onError ? wrapErrorHandler(opts.onError, effect) : effect);\n var runSync = !opts.scheduler && !opts.delay;\n var scheduler = createSchedulerFromOptions(opts);\n var firstTime = true;\n var isScheduled = false;\n var value;\n var equals = opts.compareStructural ? comparer.structural : opts.equals || comparer[\"default\"];\n var r = new Reaction(name, function () {\n if (firstTime || runSync) {\n reactionRunner();\n } else if (!isScheduled) {\n isScheduled = true;\n scheduler(reactionRunner);\n }\n }, opts.onError, opts.requiresObservable);\n function reactionRunner() {\n isScheduled = false;\n if (r.isDisposed) {\n return;\n }\n var changed = false;\n var oldValue = value;\n r.track(function () {\n var nextValue = allowStateChanges(false, function () {\n return expression(r);\n });\n changed = firstTime || !equals(value, nextValue);\n value = nextValue;\n });\n if (firstTime && opts.fireImmediately) {\n effectAction(value, oldValue, r);\n } else if (!firstTime && changed) {\n effectAction(value, oldValue, r);\n }\n firstTime = false;\n }\n if (!((_opts4 = opts) != null && (_opts4 = _opts4.signal) != null && _opts4.aborted)) {\n r.schedule_();\n }\n return r.getDisposer_((_opts5 = opts) == null ? void 0 : _opts5.signal);\n}\nfunction wrapErrorHandler(errorHandler, baseFn) {\n return function () {\n try {\n return baseFn.apply(this, arguments);\n } catch (e) {\n errorHandler.call(this, e);\n }\n };\n}\n\nvar ON_BECOME_OBSERVED = \"onBO\";\nvar ON_BECOME_UNOBSERVED = \"onBUO\";\nfunction onBecomeObserved(thing, arg2, arg3) {\n return interceptHook(ON_BECOME_OBSERVED, thing, arg2, arg3);\n}\nfunction onBecomeUnobserved(thing, arg2, arg3) {\n return interceptHook(ON_BECOME_UNOBSERVED, thing, arg2, arg3);\n}\nfunction interceptHook(hook, thing, arg2, arg3) {\n var atom = typeof arg3 === \"function\" ? getAtom(thing, arg2) : getAtom(thing);\n var cb = isFunction(arg3) ? arg3 : arg2;\n var listenersKey = hook + \"L\";\n if (atom[listenersKey]) {\n atom[listenersKey].add(cb);\n } else {\n atom[listenersKey] = new Set([cb]);\n }\n return function () {\n var hookListeners = atom[listenersKey];\n if (hookListeners) {\n hookListeners[\"delete\"](cb);\n if (hookListeners.size === 0) {\n delete atom[listenersKey];\n }\n }\n };\n}\n\nvar NEVER = \"never\";\nvar ALWAYS = \"always\";\nvar OBSERVED = \"observed\";\n// const IF_AVAILABLE = \"ifavailable\"\nfunction configure(options) {\n if (options.isolateGlobalState === true) {\n isolateGlobalState();\n }\n var useProxies = options.useProxies,\n enforceActions = options.enforceActions;\n if (useProxies !== undefined) {\n globalState.useProxies = useProxies === ALWAYS ? true : useProxies === NEVER ? false : typeof Proxy !== \"undefined\";\n }\n if (useProxies === \"ifavailable\") {\n globalState.verifyProxies = true;\n }\n if (enforceActions !== undefined) {\n var ea = enforceActions === ALWAYS ? ALWAYS : enforceActions === OBSERVED;\n globalState.enforceActions = ea;\n globalState.allowStateChanges = ea === true || ea === ALWAYS ? false : true;\n }\n [\"computedRequiresReaction\", \"reactionRequiresObservable\", \"observableRequiresReaction\", \"disableErrorBoundaries\", \"safeDescriptors\"].forEach(function (key) {\n if (key in options) {\n globalState[key] = !!options[key];\n }\n });\n globalState.allowStateReads = !globalState.observableRequiresReaction;\n if ( true && globalState.disableErrorBoundaries === true) {\n console.warn(\"WARNING: Debug feature only. MobX will NOT recover from errors when `disableErrorBoundaries` is enabled.\");\n }\n if (options.reactionScheduler) {\n setReactionScheduler(options.reactionScheduler);\n }\n}\n\nfunction extendObservable(target, properties, annotations, options) {\n if (true) {\n if (arguments.length > 4) {\n die(\"'extendObservable' expected 2-4 arguments\");\n }\n if (typeof target !== \"object\") {\n die(\"'extendObservable' expects an object as first argument\");\n }\n if (isObservableMap(target)) {\n die(\"'extendObservable' should not be used on maps, use map.merge instead\");\n }\n if (!isPlainObject(properties)) {\n die(\"'extendObservable' only accepts plain objects as second argument\");\n }\n if (isObservable(properties) || isObservable(annotations)) {\n die(\"Extending an object with another observable (object) is not supported\");\n }\n }\n // Pull descriptors first, so we don't have to deal with props added by administration ($mobx)\n var descriptors = getOwnPropertyDescriptors(properties);\n initObservable(function () {\n var adm = asObservableObject(target, options)[$mobx];\n ownKeys(descriptors).forEach(function (key) {\n adm.extend_(key, descriptors[key],\n // must pass \"undefined\" for { key: undefined }\n !annotations ? true : key in annotations ? annotations[key] : true);\n });\n });\n return target;\n}\n\nfunction getDependencyTree(thing, property) {\n return nodeToDependencyTree(getAtom(thing, property));\n}\nfunction nodeToDependencyTree(node) {\n var result = {\n name: node.name_\n };\n if (node.observing_ && node.observing_.length > 0) {\n result.dependencies = unique(node.observing_).map(nodeToDependencyTree);\n }\n return result;\n}\nfunction getObserverTree(thing, property) {\n return nodeToObserverTree(getAtom(thing, property));\n}\nfunction nodeToObserverTree(node) {\n var result = {\n name: node.name_\n };\n if (hasObservers(node)) {\n result.observers = Array.from(getObservers(node)).map(nodeToObserverTree);\n }\n return result;\n}\nfunction unique(list) {\n return Array.from(new Set(list));\n}\n\nvar generatorId = 0;\nfunction FlowCancellationError() {\n this.message = \"FLOW_CANCELLED\";\n}\nFlowCancellationError.prototype = /*#__PURE__*/Object.create(Error.prototype);\nfunction isFlowCancellationError(error) {\n return error instanceof FlowCancellationError;\n}\nvar flowAnnotation = /*#__PURE__*/createFlowAnnotation(\"flow\");\nvar flowBoundAnnotation = /*#__PURE__*/createFlowAnnotation(\"flow.bound\", {\n bound: true\n});\nvar flow = /*#__PURE__*/Object.assign(function flow(arg1, arg2) {\n // @flow (2022.3 Decorators)\n if (is20223Decorator(arg2)) {\n return flowAnnotation.decorate_20223_(arg1, arg2);\n }\n // @flow\n if (isStringish(arg2)) {\n return storeAnnotation(arg1, arg2, flowAnnotation);\n }\n // flow(fn)\n if ( true && arguments.length !== 1) {\n die(\"Flow expects single argument with generator function\");\n }\n var generator = arg1;\n var name = generator.name || \"\";\n // Implementation based on https://github.com/tj/co/blob/master/index.js\n var res = function res() {\n var ctx = this;\n var args = arguments;\n var runId = ++generatorId;\n var gen = action(name + \" - runid: \" + runId + \" - init\", generator).apply(ctx, args);\n var rejector;\n var pendingPromise = undefined;\n var promise = new Promise(function (resolve, reject) {\n var stepId = 0;\n rejector = reject;\n function onFulfilled(res) {\n pendingPromise = undefined;\n var ret;\n try {\n ret = action(name + \" - runid: \" + runId + \" - yield \" + stepId++, gen.next).call(gen, res);\n } catch (e) {\n return reject(e);\n }\n next(ret);\n }\n function onRejected(err) {\n pendingPromise = undefined;\n var ret;\n try {\n ret = action(name + \" - runid: \" + runId + \" - yield \" + stepId++, gen[\"throw\"]).call(gen, err);\n } catch (e) {\n return reject(e);\n }\n next(ret);\n }\n function next(ret) {\n if (isFunction(ret == null ? void 0 : ret.then)) {\n // an async iterator\n ret.then(next, reject);\n return;\n }\n if (ret.done) {\n return resolve(ret.value);\n }\n pendingPromise = Promise.resolve(ret.value);\n return pendingPromise.then(onFulfilled, onRejected);\n }\n onFulfilled(undefined); // kick off the process\n });\n promise.cancel = action(name + \" - runid: \" + runId + \" - cancel\", function () {\n try {\n if (pendingPromise) {\n cancelPromise(pendingPromise);\n }\n // Finally block can return (or yield) stuff..\n var _res = gen[\"return\"](undefined);\n // eat anything that promise would do, it's cancelled!\n var yieldedPromise = Promise.resolve(_res.value);\n yieldedPromise.then(noop, noop);\n cancelPromise(yieldedPromise); // maybe it can be cancelled :)\n // reject our original promise\n rejector(new FlowCancellationError());\n } catch (e) {\n rejector(e); // there could be a throwing finally block\n }\n });\n return promise;\n };\n res.isMobXFlow = true;\n return res;\n}, flowAnnotation);\nflow.bound = /*#__PURE__*/createDecoratorAnnotation(flowBoundAnnotation);\nfunction cancelPromise(promise) {\n if (isFunction(promise.cancel)) {\n promise.cancel();\n }\n}\nfunction flowResult(result) {\n return result; // just tricking TypeScript :)\n}\nfunction isFlow(fn) {\n return (fn == null ? void 0 : fn.isMobXFlow) === true;\n}\n\nfunction interceptReads(thing, propOrHandler, handler) {\n var target;\n if (isObservableMap(thing) || isObservableArray(thing) || isObservableValue(thing)) {\n target = getAdministration(thing);\n } else if (isObservableObject(thing)) {\n if ( true && !isStringish(propOrHandler)) {\n return die(\"InterceptReads can only be used with a specific property, not with an object in general\");\n }\n target = getAdministration(thing, propOrHandler);\n } else if (true) {\n return die(\"Expected observable map, object or array as first array\");\n }\n if ( true && target.dehancer !== undefined) {\n return die(\"An intercept reader was already established\");\n }\n target.dehancer = typeof propOrHandler === \"function\" ? propOrHandler : handler;\n return function () {\n target.dehancer = undefined;\n };\n}\n\nfunction intercept(thing, propOrHandler, handler) {\n if (isFunction(handler)) {\n return interceptProperty(thing, propOrHandler, handler);\n } else {\n return interceptInterceptable(thing, propOrHandler);\n }\n}\nfunction interceptInterceptable(thing, handler) {\n return getAdministration(thing).intercept_(handler);\n}\nfunction interceptProperty(thing, property, handler) {\n return getAdministration(thing, property).intercept_(handler);\n}\n\nfunction _isComputed(value, property) {\n if (property === undefined) {\n return isComputedValue(value);\n }\n if (isObservableObject(value) === false) {\n return false;\n }\n if (!value[$mobx].values_.has(property)) {\n return false;\n }\n var atom = getAtom(value, property);\n return isComputedValue(atom);\n}\nfunction isComputed(value) {\n if ( true && arguments.length > 1) {\n return die(\"isComputed expects only 1 argument. Use isComputedProp to inspect the observability of a property\");\n }\n return _isComputed(value);\n}\nfunction isComputedProp(value, propName) {\n if ( true && !isStringish(propName)) {\n return die(\"isComputed expected a property name as second argument\");\n }\n return _isComputed(value, propName);\n}\n\nfunction _isObservable(value, property) {\n if (!value) {\n return false;\n }\n if (property !== undefined) {\n if ( true && (isObservableMap(value) || isObservableArray(value))) {\n return die(\"isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead.\");\n }\n if (isObservableObject(value)) {\n return value[$mobx].values_.has(property);\n }\n return false;\n }\n // For first check, see #701\n return isObservableObject(value) || !!value[$mobx] || isAtom(value) || isReaction(value) || isComputedValue(value);\n}\nfunction isObservable(value) {\n if ( true && arguments.length !== 1) {\n die(\"isObservable expects only 1 argument. Use isObservableProp to inspect the observability of a property\");\n }\n return _isObservable(value);\n}\nfunction isObservableProp(value, propName) {\n if ( true && !isStringish(propName)) {\n return die(\"expected a property name as second argument\");\n }\n return _isObservable(value, propName);\n}\n\nfunction keys(obj) {\n if (isObservableObject(obj)) {\n return obj[$mobx].keys_();\n }\n if (isObservableMap(obj) || isObservableSet(obj)) {\n return Array.from(obj.keys());\n }\n if (isObservableArray(obj)) {\n return obj.map(function (_, index) {\n return index;\n });\n }\n die(5);\n}\nfunction values(obj) {\n if (isObservableObject(obj)) {\n return keys(obj).map(function (key) {\n return obj[key];\n });\n }\n if (isObservableMap(obj)) {\n return keys(obj).map(function (key) {\n return obj.get(key);\n });\n }\n if (isObservableSet(obj)) {\n return Array.from(obj.values());\n }\n if (isObservableArray(obj)) {\n return obj.slice();\n }\n die(6);\n}\nfunction entries(obj) {\n if (isObservableObject(obj)) {\n return keys(obj).map(function (key) {\n return [key, obj[key]];\n });\n }\n if (isObservableMap(obj)) {\n return keys(obj).map(function (key) {\n return [key, obj.get(key)];\n });\n }\n if (isObservableSet(obj)) {\n return Array.from(obj.entries());\n }\n if (isObservableArray(obj)) {\n return obj.map(function (key, index) {\n return [index, key];\n });\n }\n die(7);\n}\nfunction set(obj, key, value) {\n if (arguments.length === 2 && !isObservableSet(obj)) {\n startBatch();\n var _values = key;\n try {\n for (var _key in _values) {\n set(obj, _key, _values[_key]);\n }\n } finally {\n endBatch();\n }\n return;\n }\n if (isObservableObject(obj)) {\n obj[$mobx].set_(key, value);\n } else if (isObservableMap(obj)) {\n obj.set(key, value);\n } else if (isObservableSet(obj)) {\n obj.add(key);\n } else if (isObservableArray(obj)) {\n if (typeof key !== \"number\") {\n key = parseInt(key, 10);\n }\n if (key < 0) {\n die(\"Invalid index: '\" + key + \"'\");\n }\n startBatch();\n if (key >= obj.length) {\n obj.length = key + 1;\n }\n obj[key] = value;\n endBatch();\n } else {\n die(8);\n }\n}\nfunction remove(obj, key) {\n if (isObservableObject(obj)) {\n obj[$mobx].delete_(key);\n } else if (isObservableMap(obj)) {\n obj[\"delete\"](key);\n } else if (isObservableSet(obj)) {\n obj[\"delete\"](key);\n } else if (isObservableArray(obj)) {\n if (typeof key !== \"number\") {\n key = parseInt(key, 10);\n }\n obj.splice(key, 1);\n } else {\n die(9);\n }\n}\nfunction has(obj, key) {\n if (isObservableObject(obj)) {\n return obj[$mobx].has_(key);\n } else if (isObservableMap(obj)) {\n return obj.has(key);\n } else if (isObservableSet(obj)) {\n return obj.has(key);\n } else if (isObservableArray(obj)) {\n return key >= 0 && key < obj.length;\n }\n die(10);\n}\nfunction get(obj, key) {\n if (!has(obj, key)) {\n return undefined;\n }\n if (isObservableObject(obj)) {\n return obj[$mobx].get_(key);\n } else if (isObservableMap(obj)) {\n return obj.get(key);\n } else if (isObservableArray(obj)) {\n return obj[key];\n }\n die(11);\n}\nfunction apiDefineProperty(obj, key, descriptor) {\n if (isObservableObject(obj)) {\n return obj[$mobx].defineProperty_(key, descriptor);\n }\n die(39);\n}\nfunction apiOwnKeys(obj) {\n if (isObservableObject(obj)) {\n return obj[$mobx].ownKeys_();\n }\n die(38);\n}\n\nfunction observe(thing, propOrCb, cbOrFire, fireImmediately) {\n if (isFunction(cbOrFire)) {\n return observeObservableProperty(thing, propOrCb, cbOrFire, fireImmediately);\n } else {\n return observeObservable(thing, propOrCb, cbOrFire);\n }\n}\nfunction observeObservable(thing, listener, fireImmediately) {\n return getAdministration(thing).observe_(listener, fireImmediately);\n}\nfunction observeObservableProperty(thing, property, listener, fireImmediately) {\n return getAdministration(thing, property).observe_(listener, fireImmediately);\n}\n\nfunction cache(map, key, value) {\n map.set(key, value);\n return value;\n}\nfunction toJSHelper(source, __alreadySeen) {\n if (source == null || typeof source !== \"object\" || source instanceof Date || !isObservable(source)) {\n return source;\n }\n if (isObservableValue(source) || isComputedValue(source)) {\n return toJSHelper(source.get(), __alreadySeen);\n }\n if (__alreadySeen.has(source)) {\n return __alreadySeen.get(source);\n }\n if (isObservableArray(source)) {\n var res = cache(__alreadySeen, source, new Array(source.length));\n source.forEach(function (value, idx) {\n res[idx] = toJSHelper(value, __alreadySeen);\n });\n return res;\n }\n if (isObservableSet(source)) {\n var _res = cache(__alreadySeen, source, new Set());\n source.forEach(function (value) {\n _res.add(toJSHelper(value, __alreadySeen));\n });\n return _res;\n }\n if (isObservableMap(source)) {\n var _res2 = cache(__alreadySeen, source, new Map());\n source.forEach(function (value, key) {\n _res2.set(key, toJSHelper(value, __alreadySeen));\n });\n return _res2;\n } else {\n // must be observable object\n var _res3 = cache(__alreadySeen, source, {});\n apiOwnKeys(source).forEach(function (key) {\n if (objectPrototype.propertyIsEnumerable.call(source, key)) {\n _res3[key] = toJSHelper(source[key], __alreadySeen);\n }\n });\n return _res3;\n }\n}\n/**\n * Recursively converts an observable to it's non-observable native counterpart.\n * It does NOT recurse into non-observables, these are left as they are, even if they contain observables.\n * Computed and other non-enumerable properties are completely ignored.\n * Complex scenarios require custom solution, eg implementing `toJSON` or using `serializr` lib.\n */\nfunction toJS(source, options) {\n if ( true && options) {\n die(\"toJS no longer supports options\");\n }\n return toJSHelper(source, new Map());\n}\n\nfunction trace() {\n if (false) {}\n var enterBreakPoint = false;\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n if (typeof args[args.length - 1] === \"boolean\") {\n enterBreakPoint = args.pop();\n }\n var derivation = getAtomFromArgs(args);\n if (!derivation) {\n return die(\"'trace(break?)' can only be used inside a tracked computed value or a Reaction. Consider passing in the computed value or reaction explicitly\");\n }\n if (derivation.isTracing_ === TraceMode.NONE) {\n console.log(\"[mobx.trace] '\" + derivation.name_ + \"' tracing enabled\");\n }\n derivation.isTracing_ = enterBreakPoint ? TraceMode.BREAK : TraceMode.LOG;\n}\nfunction getAtomFromArgs(args) {\n switch (args.length) {\n case 0:\n return globalState.trackingDerivation;\n case 1:\n return getAtom(args[0]);\n case 2:\n return getAtom(args[0], args[1]);\n }\n}\n\n/**\n * During a transaction no views are updated until the end of the transaction.\n * The transaction will be run synchronously nonetheless.\n *\n * @param action a function that updates some reactive state\n * @returns any value that was returned by the 'action' parameter.\n */\nfunction transaction(action, thisArg) {\n if (thisArg === void 0) {\n thisArg = undefined;\n }\n startBatch();\n try {\n return action.apply(thisArg);\n } finally {\n endBatch();\n }\n}\n\nfunction when(predicate, arg1, arg2) {\n if (arguments.length === 1 || arg1 && typeof arg1 === \"object\") {\n return whenPromise(predicate, arg1);\n }\n return _when(predicate, arg1, arg2 || {});\n}\nfunction _when(predicate, effect, opts) {\n var timeoutHandle;\n if (typeof opts.timeout === \"number\") {\n var error = new Error(\"WHEN_TIMEOUT\");\n timeoutHandle = setTimeout(function () {\n if (!disposer[$mobx].isDisposed) {\n disposer();\n if (opts.onError) {\n opts.onError(error);\n } else {\n throw error;\n }\n }\n }, opts.timeout);\n }\n opts.name = true ? opts.name || \"When@\" + getNextId() : 0;\n var effectAction = createAction( true ? opts.name + \"-effect\" : 0, effect);\n // eslint-disable-next-line\n var disposer = autorun(function (r) {\n // predicate should not change state\n var cond = allowStateChanges(false, predicate);\n if (cond) {\n r.dispose();\n if (timeoutHandle) {\n clearTimeout(timeoutHandle);\n }\n effectAction();\n }\n }, opts);\n return disposer;\n}\nfunction whenPromise(predicate, opts) {\n var _opts$signal;\n if ( true && opts && opts.onError) {\n return die(\"the options 'onError' and 'promise' cannot be combined\");\n }\n if (opts != null && (_opts$signal = opts.signal) != null && _opts$signal.aborted) {\n return Object.assign(Promise.reject(new Error(\"WHEN_ABORTED\")), {\n cancel: function cancel() {\n return null;\n }\n });\n }\n var cancel;\n var abort;\n var res = new Promise(function (resolve, reject) {\n var _opts$signal2;\n var disposer = _when(predicate, resolve, _extends({}, opts, {\n onError: reject\n }));\n cancel = function cancel() {\n disposer();\n reject(new Error(\"WHEN_CANCELLED\"));\n };\n abort = function abort() {\n disposer();\n reject(new Error(\"WHEN_ABORTED\"));\n };\n opts == null || (_opts$signal2 = opts.signal) == null || _opts$signal2.addEventListener == null || _opts$signal2.addEventListener(\"abort\", abort);\n })[\"finally\"](function () {\n var _opts$signal3;\n return opts == null || (_opts$signal3 = opts.signal) == null || _opts$signal3.removeEventListener == null ? void 0 : _opts$signal3.removeEventListener(\"abort\", abort);\n });\n res.cancel = cancel;\n return res;\n}\n\nfunction getAdm(target) {\n return target[$mobx];\n}\n// Optimization: we don't need the intermediate objects and could have a completely custom administration for DynamicObjects,\n// and skip either the internal values map, or the base object with its property descriptors!\nvar objectProxyTraps = {\n has: function has(target, name) {\n if ( true && globalState.trackingDerivation) {\n warnAboutProxyRequirement(\"detect new properties using the 'in' operator. Use 'has' from 'mobx' instead.\");\n }\n return getAdm(target).has_(name);\n },\n get: function get(target, name) {\n return getAdm(target).get_(name);\n },\n set: function set(target, name, value) {\n var _getAdm$set_;\n if (!isStringish(name)) {\n return false;\n }\n if ( true && !getAdm(target).values_.has(name)) {\n warnAboutProxyRequirement(\"add a new observable property through direct assignment. Use 'set' from 'mobx' instead.\");\n }\n // null (intercepted) -> true (success)\n return (_getAdm$set_ = getAdm(target).set_(name, value, true)) != null ? _getAdm$set_ : true;\n },\n deleteProperty: function deleteProperty(target, name) {\n var _getAdm$delete_;\n if (true) {\n warnAboutProxyRequirement(\"delete properties from an observable object. Use 'remove' from 'mobx' instead.\");\n }\n if (!isStringish(name)) {\n return false;\n }\n // null (intercepted) -> true (success)\n return (_getAdm$delete_ = getAdm(target).delete_(name, true)) != null ? _getAdm$delete_ : true;\n },\n defineProperty: function defineProperty(target, name, descriptor) {\n var _getAdm$definePropert;\n if (true) {\n warnAboutProxyRequirement(\"define property on an observable object. Use 'defineProperty' from 'mobx' instead.\");\n }\n // null (intercepted) -> true (success)\n return (_getAdm$definePropert = getAdm(target).defineProperty_(name, descriptor)) != null ? _getAdm$definePropert : true;\n },\n ownKeys: function ownKeys(target) {\n if ( true && globalState.trackingDerivation) {\n warnAboutProxyRequirement(\"iterate keys to detect added / removed properties. Use 'keys' from 'mobx' instead.\");\n }\n return getAdm(target).ownKeys_();\n },\n preventExtensions: function preventExtensions(target) {\n die(13);\n }\n};\nfunction asDynamicObservableObject(target, options) {\n var _target$$mobx, _target$$mobx$proxy_;\n assertProxies();\n target = asObservableObject(target, options);\n return (_target$$mobx$proxy_ = (_target$$mobx = target[$mobx]).proxy_) != null ? _target$$mobx$proxy_ : _target$$mobx.proxy_ = new Proxy(target, objectProxyTraps);\n}\n\nfunction hasInterceptors(interceptable) {\n return interceptable.interceptors_ !== undefined && interceptable.interceptors_.length > 0;\n}\nfunction registerInterceptor(interceptable, handler) {\n var interceptors = interceptable.interceptors_ || (interceptable.interceptors_ = []);\n interceptors.push(handler);\n return once(function () {\n var idx = interceptors.indexOf(handler);\n if (idx !== -1) {\n interceptors.splice(idx, 1);\n }\n });\n}\nfunction interceptChange(interceptable, change) {\n var prevU = untrackedStart();\n try {\n // Interceptor can modify the array, copy it to avoid concurrent modification, see #1950\n var interceptors = [].concat(interceptable.interceptors_ || []);\n for (var i = 0, l = interceptors.length; i < l; i++) {\n change = interceptors[i](change);\n if (change && !change.type) {\n die(14);\n }\n if (!change) {\n break;\n }\n }\n return change;\n } finally {\n untrackedEnd(prevU);\n }\n}\n\nfunction hasListeners(listenable) {\n return listenable.changeListeners_ !== undefined && listenable.changeListeners_.length > 0;\n}\nfunction registerListener(listenable, handler) {\n var listeners = listenable.changeListeners_ || (listenable.changeListeners_ = []);\n listeners.push(handler);\n return once(function () {\n var idx = listeners.indexOf(handler);\n if (idx !== -1) {\n listeners.splice(idx, 1);\n }\n });\n}\nfunction notifyListeners(listenable, change) {\n var prevU = untrackedStart();\n var listeners = listenable.changeListeners_;\n if (!listeners) {\n return;\n }\n listeners = listeners.slice();\n for (var i = 0, l = listeners.length; i < l; i++) {\n listeners[i](change);\n }\n untrackedEnd(prevU);\n}\n\nfunction makeObservable(target, annotations, options) {\n initObservable(function () {\n var _annotations;\n var adm = asObservableObject(target, options)[$mobx];\n if ( true && annotations && target[storedAnnotationsSymbol]) {\n die(\"makeObservable second arg must be nullish when using decorators. Mixing @decorator syntax with annotations is not supported.\");\n }\n // Default to decorators\n (_annotations = annotations) != null ? _annotations : annotations = collectStoredAnnotations(target);\n // Annotate\n ownKeys(annotations).forEach(function (key) {\n return adm.make_(key, annotations[key]);\n });\n });\n return target;\n}\n// proto[keysSymbol] = new Set()\nvar keysSymbol = /*#__PURE__*/Symbol(\"mobx-keys\");\nfunction makeAutoObservable(target, overrides, options) {\n if (true) {\n if (!isPlainObject(target) && !isPlainObject(Object.getPrototypeOf(target))) {\n die(\"'makeAutoObservable' can only be used for classes that don't have a superclass\");\n }\n if (isObservableObject(target)) {\n die(\"makeAutoObservable can only be used on objects not already made observable\");\n }\n }\n // Optimization: avoid visiting protos\n // Assumes that annotation.make_/.extend_ works the same for plain objects\n if (isPlainObject(target)) {\n return extendObservable(target, target, overrides, options);\n }\n initObservable(function () {\n var adm = asObservableObject(target, options)[$mobx];\n // Optimization: cache keys on proto\n // Assumes makeAutoObservable can be called only once per object and can't be used in subclass\n if (!target[keysSymbol]) {\n var proto = Object.getPrototypeOf(target);\n var keys = new Set([].concat(ownKeys(target), ownKeys(proto)));\n keys[\"delete\"](\"constructor\");\n keys[\"delete\"]($mobx);\n addHiddenProp(proto, keysSymbol, keys);\n }\n target[keysSymbol].forEach(function (key) {\n return adm.make_(key,\n // must pass \"undefined\" for { key: undefined }\n !overrides ? true : key in overrides ? overrides[key] : true);\n });\n });\n return target;\n}\n\nvar SPLICE = \"splice\";\nvar UPDATE = \"update\";\nvar MAX_SPLICE_SIZE = 10000; // See e.g. https://github.com/mobxjs/mobx/issues/859\nvar arrayTraps = {\n get: function get(target, name) {\n var adm = target[$mobx];\n if (name === $mobx) {\n return adm;\n }\n if (name === \"length\") {\n return adm.getArrayLength_();\n }\n if (typeof name === \"string\" && !isNaN(name)) {\n return adm.get_(parseInt(name));\n }\n if (hasProp(arrayExtensions, name)) {\n return arrayExtensions[name];\n }\n return target[name];\n },\n set: function set(target, name, value) {\n var adm = target[$mobx];\n if (name === \"length\") {\n adm.setArrayLength_(value);\n }\n if (typeof name === \"symbol\" || isNaN(name)) {\n target[name] = value;\n } else {\n // numeric string\n adm.set_(parseInt(name), value);\n }\n return true;\n },\n preventExtensions: function preventExtensions() {\n die(15);\n }\n};\nvar ObservableArrayAdministration = /*#__PURE__*/function () {\n function ObservableArrayAdministration(name, enhancer, owned_, legacyMode_) {\n if (name === void 0) {\n name = true ? \"ObservableArray@\" + getNextId() : 0;\n }\n this.owned_ = void 0;\n this.legacyMode_ = void 0;\n this.atom_ = void 0;\n this.values_ = [];\n // this is the prop that gets proxied, so can't replace it!\n this.interceptors_ = void 0;\n this.changeListeners_ = void 0;\n this.enhancer_ = void 0;\n this.dehancer = void 0;\n this.proxy_ = void 0;\n this.lastKnownLength_ = 0;\n this.owned_ = owned_;\n this.legacyMode_ = legacyMode_;\n this.atom_ = new Atom(name);\n this.enhancer_ = function (newV, oldV) {\n return enhancer(newV, oldV, true ? name + \"[..]\" : 0);\n };\n }\n var _proto = ObservableArrayAdministration.prototype;\n _proto.dehanceValue_ = function dehanceValue_(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.dehanceValues_ = function dehanceValues_(values) {\n if (this.dehancer !== undefined && values.length > 0) {\n return values.map(this.dehancer);\n }\n return values;\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n if (fireImmediately === void 0) {\n fireImmediately = false;\n }\n if (fireImmediately) {\n listener({\n observableKind: \"array\",\n object: this.proxy_,\n debugObjectName: this.atom_.name_,\n type: \"splice\",\n index: 0,\n added: this.values_.slice(),\n addedCount: this.values_.length,\n removed: [],\n removedCount: 0\n });\n }\n return registerListener(this, listener);\n };\n _proto.getArrayLength_ = function getArrayLength_() {\n this.atom_.reportObserved();\n return this.values_.length;\n };\n _proto.setArrayLength_ = function setArrayLength_(newLength) {\n if (typeof newLength !== \"number\" || isNaN(newLength) || newLength < 0) {\n die(\"Out of range: \" + newLength);\n }\n var currentLength = this.values_.length;\n if (newLength === currentLength) {\n return;\n } else if (newLength > currentLength) {\n var newItems = new Array(newLength - currentLength);\n for (var i = 0; i < newLength - currentLength; i++) {\n newItems[i] = undefined;\n } // No Array.fill everywhere...\n this.spliceWithArray_(currentLength, 0, newItems);\n } else {\n this.spliceWithArray_(newLength, currentLength - newLength);\n }\n };\n _proto.updateArrayLength_ = function updateArrayLength_(oldLength, delta) {\n if (oldLength !== this.lastKnownLength_) {\n die(16);\n }\n this.lastKnownLength_ += delta;\n if (this.legacyMode_ && delta > 0) {\n reserveArrayBuffer(oldLength + delta + 1);\n }\n };\n _proto.spliceWithArray_ = function spliceWithArray_(index, deleteCount, newItems) {\n var _this = this;\n checkIfStateModificationsAreAllowed(this.atom_);\n var length = this.values_.length;\n if (index === undefined) {\n index = 0;\n } else if (index > length) {\n index = length;\n } else if (index < 0) {\n index = Math.max(0, length + index);\n }\n if (arguments.length === 1) {\n deleteCount = length - index;\n } else if (deleteCount === undefined || deleteCount === null) {\n deleteCount = 0;\n } else {\n deleteCount = Math.max(0, Math.min(deleteCount, length - index));\n }\n if (newItems === undefined) {\n newItems = EMPTY_ARRAY;\n }\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_,\n type: SPLICE,\n index: index,\n removedCount: deleteCount,\n added: newItems\n });\n if (!change) {\n return EMPTY_ARRAY;\n }\n deleteCount = change.removedCount;\n newItems = change.added;\n }\n newItems = newItems.length === 0 ? newItems : newItems.map(function (v) {\n return _this.enhancer_(v, undefined);\n });\n if (this.legacyMode_ || \"development\" !== \"production\") {\n var lengthDelta = newItems.length - deleteCount;\n this.updateArrayLength_(length, lengthDelta); // checks if internal array wasn't modified\n }\n var res = this.spliceItemsIntoValues_(index, deleteCount, newItems);\n if (deleteCount !== 0 || newItems.length !== 0) {\n this.notifyArraySplice_(index, newItems, res);\n }\n return this.dehanceValues_(res);\n };\n _proto.spliceItemsIntoValues_ = function spliceItemsIntoValues_(index, deleteCount, newItems) {\n if (newItems.length < MAX_SPLICE_SIZE) {\n var _this$values_;\n return (_this$values_ = this.values_).splice.apply(_this$values_, [index, deleteCount].concat(newItems));\n } else {\n // The items removed by the splice\n var res = this.values_.slice(index, index + deleteCount);\n // The items that that should remain at the end of the array\n var oldItems = this.values_.slice(index + deleteCount);\n // New length is the previous length + addition count - deletion count\n this.values_.length += newItems.length - deleteCount;\n for (var i = 0; i < newItems.length; i++) {\n this.values_[index + i] = newItems[i];\n }\n for (var _i = 0; _i < oldItems.length; _i++) {\n this.values_[index + newItems.length + _i] = oldItems[_i];\n }\n return res;\n }\n };\n _proto.notifyArrayChildUpdate_ = function notifyArrayChildUpdate_(index, newValue, oldValue) {\n var notifySpy = !this.owned_ && isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"array\",\n object: this.proxy_,\n type: UPDATE,\n debugObjectName: this.atom_.name_,\n index: index,\n newValue: newValue,\n oldValue: oldValue\n } : null;\n // The reason why this is on right hand side here (and not above), is this way the uglifier will drop it, but it won't\n // cause any runtime overhead in development mode without NODE_ENV set, unless spying is enabled\n if ( true && notifySpy) {\n spyReportStart(change);\n }\n this.atom_.reportChanged();\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n };\n _proto.notifyArraySplice_ = function notifyArraySplice_(index, added, removed) {\n var notifySpy = !this.owned_ && isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"array\",\n object: this.proxy_,\n debugObjectName: this.atom_.name_,\n type: SPLICE,\n index: index,\n removed: removed,\n added: added,\n removedCount: removed.length,\n addedCount: added.length\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n }\n this.atom_.reportChanged();\n // conform: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/observe\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n };\n _proto.get_ = function get_(index) {\n if (this.legacyMode_ && index >= this.values_.length) {\n console.warn( true ? \"[mobx.array] Attempt to read an array index (\" + index + \") that is out of bounds (\" + this.values_.length + \"). Please check length first. Out of bound indices will not be tracked by MobX\" : 0);\n return undefined;\n }\n this.atom_.reportObserved();\n return this.dehanceValue_(this.values_[index]);\n };\n _proto.set_ = function set_(index, newValue) {\n var values = this.values_;\n if (this.legacyMode_ && index > values.length) {\n // out of bounds\n die(17, index, values.length);\n }\n if (index < values.length) {\n // update at index in range\n checkIfStateModificationsAreAllowed(this.atom_);\n var oldValue = values[index];\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: UPDATE,\n object: this.proxy_,\n // since \"this\" is the real array we need to pass its proxy\n index: index,\n newValue: newValue\n });\n if (!change) {\n return;\n }\n newValue = change.newValue;\n }\n newValue = this.enhancer_(newValue, oldValue);\n var changed = newValue !== oldValue;\n if (changed) {\n values[index] = newValue;\n this.notifyArrayChildUpdate_(index, newValue, oldValue);\n }\n } else {\n // For out of bound index, we don't create an actual sparse array,\n // but rather fill the holes with undefined (same as setArrayLength_).\n // This could be considered a bug.\n var newItems = new Array(index + 1 - values.length);\n for (var i = 0; i < newItems.length - 1; i++) {\n newItems[i] = undefined;\n } // No Array.fill everywhere...\n newItems[newItems.length - 1] = newValue;\n this.spliceWithArray_(values.length, 0, newItems);\n }\n };\n return ObservableArrayAdministration;\n}();\nfunction createObservableArray(initialValues, enhancer, name, owned) {\n if (name === void 0) {\n name = true ? \"ObservableArray@\" + getNextId() : 0;\n }\n if (owned === void 0) {\n owned = false;\n }\n assertProxies();\n return initObservable(function () {\n var adm = new ObservableArrayAdministration(name, enhancer, owned, false);\n addHiddenFinalProp(adm.values_, $mobx, adm);\n var proxy = new Proxy(adm.values_, arrayTraps);\n adm.proxy_ = proxy;\n if (initialValues && initialValues.length) {\n adm.spliceWithArray_(0, 0, initialValues);\n }\n return proxy;\n });\n}\n// eslint-disable-next-line\nvar arrayExtensions = {\n clear: function clear() {\n return this.splice(0);\n },\n replace: function replace(newItems) {\n var adm = this[$mobx];\n return adm.spliceWithArray_(0, adm.values_.length, newItems);\n },\n // Used by JSON.stringify\n toJSON: function toJSON() {\n return this.slice();\n },\n /*\n * functions that do alter the internal structure of the array, (based on lib.es6.d.ts)\n * since these functions alter the inner structure of the array, the have side effects.\n * Because the have side effects, they should not be used in computed function,\n * and for that reason the do not call dependencyState.notifyObserved\n */\n splice: function splice(index, deleteCount) {\n for (var _len = arguments.length, newItems = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {\n newItems[_key - 2] = arguments[_key];\n }\n var adm = this[$mobx];\n switch (arguments.length) {\n case 0:\n return [];\n case 1:\n return adm.spliceWithArray_(index);\n case 2:\n return adm.spliceWithArray_(index, deleteCount);\n }\n return adm.spliceWithArray_(index, deleteCount, newItems);\n },\n spliceWithArray: function spliceWithArray(index, deleteCount, newItems) {\n return this[$mobx].spliceWithArray_(index, deleteCount, newItems);\n },\n push: function push() {\n var adm = this[$mobx];\n for (var _len2 = arguments.length, items = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n items[_key2] = arguments[_key2];\n }\n adm.spliceWithArray_(adm.values_.length, 0, items);\n return adm.values_.length;\n },\n pop: function pop() {\n return this.splice(Math.max(this[$mobx].values_.length - 1, 0), 1)[0];\n },\n shift: function shift() {\n return this.splice(0, 1)[0];\n },\n unshift: function unshift() {\n var adm = this[$mobx];\n for (var _len3 = arguments.length, items = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n items[_key3] = arguments[_key3];\n }\n adm.spliceWithArray_(0, 0, items);\n return adm.values_.length;\n },\n reverse: function reverse() {\n // reverse by default mutates in place before returning the result\n // which makes it both a 'derivation' and a 'mutation'.\n if (globalState.trackingDerivation) {\n die(37, \"reverse\");\n }\n this.replace(this.slice().reverse());\n return this;\n },\n sort: function sort() {\n // sort by default mutates in place before returning the result\n // which goes against all good practices. Let's not change the array in place!\n if (globalState.trackingDerivation) {\n die(37, \"sort\");\n }\n var copy = this.slice();\n copy.sort.apply(copy, arguments);\n this.replace(copy);\n return this;\n },\n remove: function remove(value) {\n var adm = this[$mobx];\n var idx = adm.dehanceValues_(adm.values_).indexOf(value);\n if (idx > -1) {\n this.splice(idx, 1);\n return true;\n }\n return false;\n }\n};\n/**\n * Wrap function from prototype\n * Without this, everything works as well, but this works\n * faster as everything works on unproxied values\n */\naddArrayExtension(\"at\", simpleFunc);\naddArrayExtension(\"concat\", simpleFunc);\naddArrayExtension(\"flat\", simpleFunc);\naddArrayExtension(\"includes\", simpleFunc);\naddArrayExtension(\"indexOf\", simpleFunc);\naddArrayExtension(\"join\", simpleFunc);\naddArrayExtension(\"lastIndexOf\", simpleFunc);\naddArrayExtension(\"slice\", simpleFunc);\naddArrayExtension(\"toString\", simpleFunc);\naddArrayExtension(\"toLocaleString\", simpleFunc);\naddArrayExtension(\"toSorted\", simpleFunc);\naddArrayExtension(\"toSpliced\", simpleFunc);\naddArrayExtension(\"with\", simpleFunc);\n// map\naddArrayExtension(\"every\", mapLikeFunc);\naddArrayExtension(\"filter\", mapLikeFunc);\naddArrayExtension(\"find\", mapLikeFunc);\naddArrayExtension(\"findIndex\", mapLikeFunc);\naddArrayExtension(\"findLast\", mapLikeFunc);\naddArrayExtension(\"findLastIndex\", mapLikeFunc);\naddArrayExtension(\"flatMap\", mapLikeFunc);\naddArrayExtension(\"forEach\", mapLikeFunc);\naddArrayExtension(\"map\", mapLikeFunc);\naddArrayExtension(\"some\", mapLikeFunc);\naddArrayExtension(\"toReversed\", mapLikeFunc);\n// reduce\naddArrayExtension(\"reduce\", reduceLikeFunc);\naddArrayExtension(\"reduceRight\", reduceLikeFunc);\nfunction addArrayExtension(funcName, funcFactory) {\n if (typeof Array.prototype[funcName] === \"function\") {\n arrayExtensions[funcName] = funcFactory(funcName);\n }\n}\n// Report and delegate to dehanced array\nfunction simpleFunc(funcName) {\n return function () {\n var adm = this[$mobx];\n adm.atom_.reportObserved();\n var dehancedValues = adm.dehanceValues_(adm.values_);\n return dehancedValues[funcName].apply(dehancedValues, arguments);\n };\n}\n// Make sure callbacks receive correct array arg #2326\nfunction mapLikeFunc(funcName) {\n return function (callback, thisArg) {\n var _this2 = this;\n var adm = this[$mobx];\n adm.atom_.reportObserved();\n var dehancedValues = adm.dehanceValues_(adm.values_);\n return dehancedValues[funcName](function (element, index) {\n return callback.call(thisArg, element, index, _this2);\n });\n };\n}\n// Make sure callbacks receive correct array arg #2326\nfunction reduceLikeFunc(funcName) {\n return function () {\n var _this3 = this;\n var adm = this[$mobx];\n adm.atom_.reportObserved();\n var dehancedValues = adm.dehanceValues_(adm.values_);\n // #2432 - reduce behavior depends on arguments.length\n var callback = arguments[0];\n arguments[0] = function (accumulator, currentValue, index) {\n return callback(accumulator, currentValue, index, _this3);\n };\n return dehancedValues[funcName].apply(dehancedValues, arguments);\n };\n}\nvar isObservableArrayAdministration = /*#__PURE__*/createInstanceofPredicate(\"ObservableArrayAdministration\", ObservableArrayAdministration);\nfunction isObservableArray(thing) {\n return isObject(thing) && isObservableArrayAdministration(thing[$mobx]);\n}\n\nvar ObservableMapMarker = {};\nvar ADD = \"add\";\nvar DELETE = \"delete\";\n// just extend Map? See also https://gist.github.com/nestharus/13b4d74f2ef4a2f4357dbd3fc23c1e54\n// But: https://github.com/mobxjs/mobx/issues/1556\nvar ObservableMap = /*#__PURE__*/function () {\n function ObservableMap(initialData, enhancer_, name_) {\n var _this = this;\n if (enhancer_ === void 0) {\n enhancer_ = deepEnhancer;\n }\n if (name_ === void 0) {\n name_ = true ? \"ObservableMap@\" + getNextId() : 0;\n }\n this.enhancer_ = void 0;\n this.name_ = void 0;\n this[$mobx] = ObservableMapMarker;\n this.data_ = void 0;\n this.hasMap_ = void 0;\n // hasMap, not hashMap >-).\n this.keysAtom_ = void 0;\n this.interceptors_ = void 0;\n this.changeListeners_ = void 0;\n this.dehancer = void 0;\n this.enhancer_ = enhancer_;\n this.name_ = name_;\n if (!isFunction(Map)) {\n die(18);\n }\n initObservable(function () {\n _this.keysAtom_ = createAtom( true ? _this.name_ + \".keys()\" : 0);\n _this.data_ = new Map();\n _this.hasMap_ = new Map();\n if (initialData) {\n _this.merge(initialData);\n }\n });\n }\n var _proto = ObservableMap.prototype;\n _proto.has_ = function has_(key) {\n return this.data_.has(key);\n };\n _proto.has = function has(key) {\n var _this2 = this;\n if (!globalState.trackingDerivation) {\n return this.has_(key);\n }\n var entry = this.hasMap_.get(key);\n if (!entry) {\n var newEntry = entry = new ObservableValue(this.has_(key), referenceEnhancer, true ? this.name_ + \".\" + stringifyKey(key) + \"?\" : 0, false);\n this.hasMap_.set(key, newEntry);\n onBecomeUnobserved(newEntry, function () {\n return _this2.hasMap_[\"delete\"](key);\n });\n }\n return entry.get();\n };\n _proto.set = function set(key, value) {\n var hasKey = this.has_(key);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: hasKey ? UPDATE : ADD,\n object: this,\n newValue: value,\n name: key\n });\n if (!change) {\n return this;\n }\n value = change.newValue;\n }\n if (hasKey) {\n this.updateValue_(key, value);\n } else {\n this.addValue_(key, value);\n }\n return this;\n };\n _proto[\"delete\"] = function _delete(key) {\n var _this3 = this;\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: DELETE,\n object: this,\n name: key\n });\n if (!change) {\n return false;\n }\n }\n if (this.has_(key)) {\n var notifySpy = isSpyEnabled();\n var notify = hasListeners(this);\n var _change = notify || notifySpy ? {\n observableKind: \"map\",\n debugObjectName: this.name_,\n type: DELETE,\n object: this,\n oldValue: this.data_.get(key).value_,\n name: key\n } : null;\n if ( true && notifySpy) {\n spyReportStart(_change);\n } // TODO fix type\n transaction(function () {\n var _this3$hasMap_$get;\n _this3.keysAtom_.reportChanged();\n (_this3$hasMap_$get = _this3.hasMap_.get(key)) == null || _this3$hasMap_$get.setNewValue_(false);\n var observable = _this3.data_.get(key);\n observable.setNewValue_(undefined);\n _this3.data_[\"delete\"](key);\n });\n if (notify) {\n notifyListeners(this, _change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n return true;\n }\n return false;\n };\n _proto.updateValue_ = function updateValue_(key, newValue) {\n var observable = this.data_.get(key);\n newValue = observable.prepareNewValue_(newValue);\n if (newValue !== globalState.UNCHANGED) {\n var notifySpy = isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"map\",\n debugObjectName: this.name_,\n type: UPDATE,\n object: this,\n oldValue: observable.value_,\n name: key,\n newValue: newValue\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n } // TODO fix type\n observable.setNewValue_(newValue);\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n };\n _proto.addValue_ = function addValue_(key, newValue) {\n var _this4 = this;\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n transaction(function () {\n var _this4$hasMap_$get;\n var observable = new ObservableValue(newValue, _this4.enhancer_, true ? _this4.name_ + \".\" + stringifyKey(key) : 0, false);\n _this4.data_.set(key, observable);\n newValue = observable.value_; // value might have been changed\n (_this4$hasMap_$get = _this4.hasMap_.get(key)) == null || _this4$hasMap_$get.setNewValue_(true);\n _this4.keysAtom_.reportChanged();\n });\n var notifySpy = isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"map\",\n debugObjectName: this.name_,\n type: ADD,\n object: this,\n name: key,\n newValue: newValue\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n } // TODO fix type\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n };\n _proto.get = function get(key) {\n if (this.has(key)) {\n return this.dehanceValue_(this.data_.get(key).get());\n }\n return this.dehanceValue_(undefined);\n };\n _proto.dehanceValue_ = function dehanceValue_(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.keys = function keys() {\n this.keysAtom_.reportObserved();\n return this.data_.keys();\n };\n _proto.values = function values() {\n var self = this;\n var keys = this.keys();\n return makeIterableForMap({\n next: function next() {\n var _keys$next = keys.next(),\n done = _keys$next.done,\n value = _keys$next.value;\n return {\n done: done,\n value: done ? undefined : self.get(value)\n };\n }\n });\n };\n _proto.entries = function entries() {\n var self = this;\n var keys = this.keys();\n return makeIterableForMap({\n next: function next() {\n var _keys$next2 = keys.next(),\n done = _keys$next2.done,\n value = _keys$next2.value;\n return {\n done: done,\n value: done ? undefined : [value, self.get(value)]\n };\n }\n });\n };\n _proto[Symbol.iterator] = function () {\n return this.entries();\n };\n _proto.forEach = function forEach(callback, thisArg) {\n for (var _iterator = _createForOfIteratorHelperLoose(this), _step; !(_step = _iterator()).done;) {\n var _step$value = _step.value,\n key = _step$value[0],\n value = _step$value[1];\n callback.call(thisArg, value, key, this);\n }\n }\n /** Merge another object into this object, returns this. */;\n _proto.merge = function merge(other) {\n var _this5 = this;\n if (isObservableMap(other)) {\n other = new Map(other);\n }\n transaction(function () {\n if (isPlainObject(other)) {\n getPlainObjectKeys(other).forEach(function (key) {\n return _this5.set(key, other[key]);\n });\n } else if (Array.isArray(other)) {\n other.forEach(function (_ref) {\n var key = _ref[0],\n value = _ref[1];\n return _this5.set(key, value);\n });\n } else if (isES6Map(other)) {\n if (!isPlainES6Map(other)) {\n die(19, other);\n }\n other.forEach(function (value, key) {\n return _this5.set(key, value);\n });\n } else if (other !== null && other !== undefined) {\n die(20, other);\n }\n });\n return this;\n };\n _proto.clear = function clear() {\n var _this6 = this;\n transaction(function () {\n untracked(function () {\n for (var _iterator2 = _createForOfIteratorHelperLoose(_this6.keys()), _step2; !(_step2 = _iterator2()).done;) {\n var key = _step2.value;\n _this6[\"delete\"](key);\n }\n });\n });\n };\n _proto.replace = function replace(values) {\n var _this7 = this;\n // Implementation requirements:\n // - respect ordering of replacement map\n // - allow interceptors to run and potentially prevent individual operations\n // - don't recreate observables that already exist in original map (so we don't destroy existing subscriptions)\n // - don't _keysAtom.reportChanged if the keys of resulting map are indentical (order matters!)\n // - note that result map may differ from replacement map due to the interceptors\n transaction(function () {\n // Convert to map so we can do quick key lookups\n var replacementMap = convertToMap(values);\n var orderedData = new Map();\n // Used for optimization\n var keysReportChangedCalled = false;\n // Delete keys that don't exist in replacement map\n // if the key deletion is prevented by interceptor\n // add entry at the beginning of the result map\n for (var _iterator3 = _createForOfIteratorHelperLoose(_this7.data_.keys()), _step3; !(_step3 = _iterator3()).done;) {\n var key = _step3.value;\n // Concurrently iterating/deleting keys\n // iterator should handle this correctly\n if (!replacementMap.has(key)) {\n var deleted = _this7[\"delete\"](key);\n // Was the key removed?\n if (deleted) {\n // _keysAtom.reportChanged() was already called\n keysReportChangedCalled = true;\n } else {\n // Delete prevented by interceptor\n var value = _this7.data_.get(key);\n orderedData.set(key, value);\n }\n }\n }\n // Merge entries\n for (var _iterator4 = _createForOfIteratorHelperLoose(replacementMap.entries()), _step4; !(_step4 = _iterator4()).done;) {\n var _step4$value = _step4.value,\n _key = _step4$value[0],\n _value = _step4$value[1];\n // We will want to know whether a new key is added\n var keyExisted = _this7.data_.has(_key);\n // Add or update value\n _this7.set(_key, _value);\n // The addition could have been prevent by interceptor\n if (_this7.data_.has(_key)) {\n // The update could have been prevented by interceptor\n // and also we want to preserve existing values\n // so use value from _data map (instead of replacement map)\n var _value2 = _this7.data_.get(_key);\n orderedData.set(_key, _value2);\n // Was a new key added?\n if (!keyExisted) {\n // _keysAtom.reportChanged() was already called\n keysReportChangedCalled = true;\n }\n }\n }\n // Check for possible key order change\n if (!keysReportChangedCalled) {\n if (_this7.data_.size !== orderedData.size) {\n // If size differs, keys are definitely modified\n _this7.keysAtom_.reportChanged();\n } else {\n var iter1 = _this7.data_.keys();\n var iter2 = orderedData.keys();\n var next1 = iter1.next();\n var next2 = iter2.next();\n while (!next1.done) {\n if (next1.value !== next2.value) {\n _this7.keysAtom_.reportChanged();\n break;\n }\n next1 = iter1.next();\n next2 = iter2.next();\n }\n }\n }\n // Use correctly ordered map\n _this7.data_ = orderedData;\n });\n return this;\n };\n _proto.toString = function toString() {\n return \"[object ObservableMap]\";\n };\n _proto.toJSON = function toJSON() {\n return Array.from(this);\n };\n /**\n * Observes this object. Triggers for the events 'add', 'update' and 'delete'.\n * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe\n * for callback details\n */\n _proto.observe_ = function observe_(listener, fireImmediately) {\n if ( true && fireImmediately === true) {\n die(\"`observe` doesn't support fireImmediately=true in combination with maps.\");\n }\n return registerListener(this, listener);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n return _createClass(ObservableMap, [{\n key: \"size\",\n get: function get() {\n this.keysAtom_.reportObserved();\n return this.data_.size;\n }\n }, {\n key: Symbol.toStringTag,\n get: function get() {\n return \"Map\";\n }\n }]);\n}();\n// eslint-disable-next-line\nvar isObservableMap = /*#__PURE__*/createInstanceofPredicate(\"ObservableMap\", ObservableMap);\nfunction makeIterableForMap(iterator) {\n iterator[Symbol.toStringTag] = \"MapIterator\";\n return makeIterable(iterator);\n}\nfunction convertToMap(dataStructure) {\n if (isES6Map(dataStructure) || isObservableMap(dataStructure)) {\n return dataStructure;\n } else if (Array.isArray(dataStructure)) {\n return new Map(dataStructure);\n } else if (isPlainObject(dataStructure)) {\n var map = new Map();\n for (var key in dataStructure) {\n map.set(key, dataStructure[key]);\n }\n return map;\n } else {\n return die(21, dataStructure);\n }\n}\n\nvar ObservableSetMarker = {};\nvar ObservableSet = /*#__PURE__*/function () {\n function ObservableSet(initialData, enhancer, name_) {\n var _this = this;\n if (enhancer === void 0) {\n enhancer = deepEnhancer;\n }\n if (name_ === void 0) {\n name_ = true ? \"ObservableSet@\" + getNextId() : 0;\n }\n this.name_ = void 0;\n this[$mobx] = ObservableSetMarker;\n this.data_ = new Set();\n this.atom_ = void 0;\n this.changeListeners_ = void 0;\n this.interceptors_ = void 0;\n this.dehancer = void 0;\n this.enhancer_ = void 0;\n this.name_ = name_;\n if (!isFunction(Set)) {\n die(22);\n }\n this.enhancer_ = function (newV, oldV) {\n return enhancer(newV, oldV, name_);\n };\n initObservable(function () {\n _this.atom_ = createAtom(_this.name_);\n if (initialData) {\n _this.replace(initialData);\n }\n });\n }\n var _proto = ObservableSet.prototype;\n _proto.dehanceValue_ = function dehanceValue_(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.clear = function clear() {\n var _this2 = this;\n transaction(function () {\n untracked(function () {\n for (var _iterator = _createForOfIteratorHelperLoose(_this2.data_.values()), _step; !(_step = _iterator()).done;) {\n var value = _step.value;\n _this2[\"delete\"](value);\n }\n });\n });\n };\n _proto.forEach = function forEach(callbackFn, thisArg) {\n for (var _iterator2 = _createForOfIteratorHelperLoose(this), _step2; !(_step2 = _iterator2()).done;) {\n var value = _step2.value;\n callbackFn.call(thisArg, value, value, this);\n }\n };\n _proto.add = function add(value) {\n var _this3 = this;\n checkIfStateModificationsAreAllowed(this.atom_);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: ADD,\n object: this,\n newValue: value\n });\n if (!change) {\n return this;\n }\n // ideally, value = change.value would be done here, so that values can be\n // changed by interceptor. Same applies for other Set and Map api's.\n }\n if (!this.has(value)) {\n transaction(function () {\n _this3.data_.add(_this3.enhancer_(value, undefined));\n _this3.atom_.reportChanged();\n });\n var notifySpy = true && isSpyEnabled();\n var notify = hasListeners(this);\n var _change = notify || notifySpy ? {\n observableKind: \"set\",\n debugObjectName: this.name_,\n type: ADD,\n object: this,\n newValue: value\n } : null;\n if (notifySpy && \"development\" !== \"production\") {\n spyReportStart(_change);\n }\n if (notify) {\n notifyListeners(this, _change);\n }\n if (notifySpy && \"development\" !== \"production\") {\n spyReportEnd();\n }\n }\n return this;\n };\n _proto[\"delete\"] = function _delete(value) {\n var _this4 = this;\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: DELETE,\n object: this,\n oldValue: value\n });\n if (!change) {\n return false;\n }\n }\n if (this.has(value)) {\n var notifySpy = true && isSpyEnabled();\n var notify = hasListeners(this);\n var _change2 = notify || notifySpy ? {\n observableKind: \"set\",\n debugObjectName: this.name_,\n type: DELETE,\n object: this,\n oldValue: value\n } : null;\n if (notifySpy && \"development\" !== \"production\") {\n spyReportStart(_change2);\n }\n transaction(function () {\n _this4.atom_.reportChanged();\n _this4.data_[\"delete\"](value);\n });\n if (notify) {\n notifyListeners(this, _change2);\n }\n if (notifySpy && \"development\" !== \"production\") {\n spyReportEnd();\n }\n return true;\n }\n return false;\n };\n _proto.has = function has(value) {\n this.atom_.reportObserved();\n return this.data_.has(this.dehanceValue_(value));\n };\n _proto.entries = function entries() {\n var nextIndex = 0;\n var keys = Array.from(this.keys());\n var values = Array.from(this.values());\n return makeIterableForSet({\n next: function next() {\n var index = nextIndex;\n nextIndex += 1;\n return index < values.length ? {\n value: [keys[index], values[index]],\n done: false\n } : {\n value: undefined,\n done: true\n };\n }\n });\n };\n _proto.keys = function keys() {\n return this.values();\n };\n _proto.values = function values() {\n this.atom_.reportObserved();\n var self = this;\n var nextIndex = 0;\n var observableValues = Array.from(this.data_.values());\n return makeIterableForSet({\n next: function next() {\n return nextIndex < observableValues.length ? {\n value: self.dehanceValue_(observableValues[nextIndex++]),\n done: false\n } : {\n value: undefined,\n done: true\n };\n }\n });\n };\n _proto.intersection = function intersection(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.intersection(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.intersection(otherSet);\n }\n };\n _proto.union = function union(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.union(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.union(otherSet);\n }\n };\n _proto.difference = function difference(otherSet) {\n return new Set(this).difference(otherSet);\n };\n _proto.symmetricDifference = function symmetricDifference(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.symmetricDifference(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.symmetricDifference(otherSet);\n }\n };\n _proto.isSubsetOf = function isSubsetOf(otherSet) {\n return new Set(this).isSubsetOf(otherSet);\n };\n _proto.isSupersetOf = function isSupersetOf(otherSet) {\n return new Set(this).isSupersetOf(otherSet);\n };\n _proto.isDisjointFrom = function isDisjointFrom(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.isDisjointFrom(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.isDisjointFrom(otherSet);\n }\n };\n _proto.replace = function replace(other) {\n var _this5 = this;\n if (isObservableSet(other)) {\n other = new Set(other);\n }\n transaction(function () {\n if (Array.isArray(other)) {\n _this5.clear();\n other.forEach(function (value) {\n return _this5.add(value);\n });\n } else if (isES6Set(other)) {\n _this5.clear();\n other.forEach(function (value) {\n return _this5.add(value);\n });\n } else if (other !== null && other !== undefined) {\n die(\"Cannot initialize set from \" + other);\n }\n });\n return this;\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n // ... 'fireImmediately' could also be true?\n if ( true && fireImmediately === true) {\n die(\"`observe` doesn't support fireImmediately=true in combination with sets.\");\n }\n return registerListener(this, listener);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.toJSON = function toJSON() {\n return Array.from(this);\n };\n _proto.toString = function toString() {\n return \"[object ObservableSet]\";\n };\n _proto[Symbol.iterator] = function () {\n return this.values();\n };\n return _createClass(ObservableSet, [{\n key: \"size\",\n get: function get() {\n this.atom_.reportObserved();\n return this.data_.size;\n }\n }, {\n key: Symbol.toStringTag,\n get: function get() {\n return \"Set\";\n }\n }]);\n}();\n// eslint-disable-next-line\nvar isObservableSet = /*#__PURE__*/createInstanceofPredicate(\"ObservableSet\", ObservableSet);\nfunction makeIterableForSet(iterator) {\n iterator[Symbol.toStringTag] = \"SetIterator\";\n return makeIterable(iterator);\n}\n\nvar descriptorCache = /*#__PURE__*/Object.create(null);\nvar REMOVE = \"remove\";\nvar ObservableObjectAdministration = /*#__PURE__*/function () {\n function ObservableObjectAdministration(target_, values_, name_,\n // Used anytime annotation is not explicitely provided\n defaultAnnotation_) {\n if (values_ === void 0) {\n values_ = new Map();\n }\n if (defaultAnnotation_ === void 0) {\n defaultAnnotation_ = autoAnnotation;\n }\n this.target_ = void 0;\n this.values_ = void 0;\n this.name_ = void 0;\n this.defaultAnnotation_ = void 0;\n this.keysAtom_ = void 0;\n this.changeListeners_ = void 0;\n this.interceptors_ = void 0;\n this.proxy_ = void 0;\n this.isPlainObject_ = void 0;\n this.appliedAnnotations_ = void 0;\n this.pendingKeys_ = void 0;\n this.target_ = target_;\n this.values_ = values_;\n this.name_ = name_;\n this.defaultAnnotation_ = defaultAnnotation_;\n this.keysAtom_ = new Atom( true ? this.name_ + \".keys\" : 0);\n // Optimization: we use this frequently\n this.isPlainObject_ = isPlainObject(this.target_);\n if ( true && !isAnnotation(this.defaultAnnotation_)) {\n die(\"defaultAnnotation must be valid annotation\");\n }\n if (true) {\n // Prepare structure for tracking which fields were already annotated\n this.appliedAnnotations_ = {};\n }\n }\n var _proto = ObservableObjectAdministration.prototype;\n _proto.getObservablePropValue_ = function getObservablePropValue_(key) {\n return this.values_.get(key).get();\n };\n _proto.setObservablePropValue_ = function setObservablePropValue_(key, newValue) {\n var observable = this.values_.get(key);\n if (observable instanceof ComputedValue) {\n observable.set(newValue);\n return true;\n }\n // intercept\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: UPDATE,\n object: this.proxy_ || this.target_,\n name: key,\n newValue: newValue\n });\n if (!change) {\n return null;\n }\n newValue = change.newValue;\n }\n newValue = observable.prepareNewValue_(newValue);\n // notify spy & observers\n if (newValue !== globalState.UNCHANGED) {\n var notify = hasListeners(this);\n var notifySpy = true && isSpyEnabled();\n var _change = notify || notifySpy ? {\n type: UPDATE,\n observableKind: \"object\",\n debugObjectName: this.name_,\n object: this.proxy_ || this.target_,\n oldValue: observable.value_,\n name: key,\n newValue: newValue\n } : null;\n if ( true && notifySpy) {\n spyReportStart(_change);\n }\n observable.setNewValue_(newValue);\n if (notify) {\n notifyListeners(this, _change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n return true;\n };\n _proto.get_ = function get_(key) {\n if (globalState.trackingDerivation && !hasProp(this.target_, key)) {\n // Key doesn't exist yet, subscribe for it in case it's added later\n this.has_(key);\n }\n return this.target_[key];\n }\n /**\n * @param {PropertyKey} key\n * @param {any} value\n * @param {Annotation|boolean} annotation true - use default annotation, false - copy as is\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.set_ = function set_(key, value, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n // Don't use .has(key) - we care about own\n if (hasProp(this.target_, key)) {\n // Existing prop\n if (this.values_.has(key)) {\n // Observable (can be intercepted)\n return this.setObservablePropValue_(key, value);\n } else if (proxyTrap) {\n // Non-observable - proxy\n return Reflect.set(this.target_, key, value);\n } else {\n // Non-observable\n this.target_[key] = value;\n return true;\n }\n } else {\n // New prop\n return this.extend_(key, {\n value: value,\n enumerable: true,\n writable: true,\n configurable: true\n }, this.defaultAnnotation_, proxyTrap);\n }\n }\n // Trap for \"in\"\n ;\n _proto.has_ = function has_(key) {\n if (!globalState.trackingDerivation) {\n // Skip key subscription outside derivation\n return key in this.target_;\n }\n this.pendingKeys_ || (this.pendingKeys_ = new Map());\n var entry = this.pendingKeys_.get(key);\n if (!entry) {\n entry = new ObservableValue(key in this.target_, referenceEnhancer, true ? this.name_ + \".\" + stringifyKey(key) + \"?\" : 0, false);\n this.pendingKeys_.set(key, entry);\n }\n return entry.get();\n }\n /**\n * @param {PropertyKey} key\n * @param {Annotation|boolean} annotation true - use default annotation, false - ignore prop\n */;\n _proto.make_ = function make_(key, annotation) {\n if (annotation === true) {\n annotation = this.defaultAnnotation_;\n }\n if (annotation === false) {\n return;\n }\n assertAnnotable(this, annotation, key);\n if (!(key in this.target_)) {\n var _this$target_$storedA;\n // Throw on missing key, except for decorators:\n // Decorator annotations are collected from whole prototype chain.\n // When called from super() some props may not exist yet.\n // However we don't have to worry about missing prop,\n // because the decorator must have been applied to something.\n if ((_this$target_$storedA = this.target_[storedAnnotationsSymbol]) != null && _this$target_$storedA[key]) {\n return; // will be annotated by subclass constructor\n } else {\n die(1, annotation.annotationType_, this.name_ + \".\" + key.toString());\n }\n }\n var source = this.target_;\n while (source && source !== objectPrototype) {\n var descriptor = getDescriptor(source, key);\n if (descriptor) {\n var outcome = annotation.make_(this, key, descriptor, source);\n if (outcome === 0 /* MakeResult.Cancel */) {\n return;\n }\n if (outcome === 1 /* MakeResult.Break */) {\n break;\n }\n }\n source = Object.getPrototypeOf(source);\n }\n recordAnnotationApplied(this, annotation, key);\n }\n /**\n * @param {PropertyKey} key\n * @param {PropertyDescriptor} descriptor\n * @param {Annotation|boolean} annotation true - use default annotation, false - copy as is\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.extend_ = function extend_(key, descriptor, annotation, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n if (annotation === true) {\n annotation = this.defaultAnnotation_;\n }\n if (annotation === false) {\n return this.defineProperty_(key, descriptor, proxyTrap);\n }\n assertAnnotable(this, annotation, key);\n var outcome = annotation.extend_(this, key, descriptor, proxyTrap);\n if (outcome) {\n recordAnnotationApplied(this, annotation, key);\n }\n return outcome;\n }\n /**\n * @param {PropertyKey} key\n * @param {PropertyDescriptor} descriptor\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.defineProperty_ = function defineProperty_(key, descriptor, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n try {\n startBatch();\n // Delete\n var deleteOutcome = this.delete_(key);\n if (!deleteOutcome) {\n // Failure or intercepted\n return deleteOutcome;\n }\n // ADD interceptor\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: ADD,\n newValue: descriptor.value\n });\n if (!change) {\n return null;\n }\n var newValue = change.newValue;\n if (descriptor.value !== newValue) {\n descriptor = _extends({}, descriptor, {\n value: newValue\n });\n }\n }\n // Define\n if (proxyTrap) {\n if (!Reflect.defineProperty(this.target_, key, descriptor)) {\n return false;\n }\n } else {\n defineProperty(this.target_, key, descriptor);\n }\n // Notify\n this.notifyPropertyAddition_(key, descriptor.value);\n } finally {\n endBatch();\n }\n return true;\n }\n // If original descriptor becomes relevant, move this to annotation directly\n ;\n _proto.defineObservableProperty_ = function defineObservableProperty_(key, value, enhancer, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n try {\n startBatch();\n // Delete\n var deleteOutcome = this.delete_(key);\n if (!deleteOutcome) {\n // Failure or intercepted\n return deleteOutcome;\n }\n // ADD interceptor\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: ADD,\n newValue: value\n });\n if (!change) {\n return null;\n }\n value = change.newValue;\n }\n var cachedDescriptor = getCachedObservablePropDescriptor(key);\n var descriptor = {\n configurable: globalState.safeDescriptors ? this.isPlainObject_ : true,\n enumerable: true,\n get: cachedDescriptor.get,\n set: cachedDescriptor.set\n };\n // Define\n if (proxyTrap) {\n if (!Reflect.defineProperty(this.target_, key, descriptor)) {\n return false;\n }\n } else {\n defineProperty(this.target_, key, descriptor);\n }\n var observable = new ObservableValue(value, enhancer, true ? this.name_ + \".\" + key.toString() : 0, false);\n this.values_.set(key, observable);\n // Notify (value possibly changed by ObservableValue)\n this.notifyPropertyAddition_(key, observable.value_);\n } finally {\n endBatch();\n }\n return true;\n }\n // If original descriptor becomes relevant, move this to annotation directly\n ;\n _proto.defineComputedProperty_ = function defineComputedProperty_(key, options, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n try {\n startBatch();\n // Delete\n var deleteOutcome = this.delete_(key);\n if (!deleteOutcome) {\n // Failure or intercepted\n return deleteOutcome;\n }\n // ADD interceptor\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: ADD,\n newValue: undefined\n });\n if (!change) {\n return null;\n }\n }\n options.name || (options.name = true ? this.name_ + \".\" + key.toString() : 0);\n options.context = this.proxy_ || this.target_;\n var cachedDescriptor = getCachedObservablePropDescriptor(key);\n var descriptor = {\n configurable: globalState.safeDescriptors ? this.isPlainObject_ : true,\n enumerable: false,\n get: cachedDescriptor.get,\n set: cachedDescriptor.set\n };\n // Define\n if (proxyTrap) {\n if (!Reflect.defineProperty(this.target_, key, descriptor)) {\n return false;\n }\n } else {\n defineProperty(this.target_, key, descriptor);\n }\n this.values_.set(key, new ComputedValue(options));\n // Notify\n this.notifyPropertyAddition_(key, undefined);\n } finally {\n endBatch();\n }\n return true;\n }\n /**\n * @param {PropertyKey} key\n * @param {PropertyDescriptor} descriptor\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.delete_ = function delete_(key, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n // No such prop\n if (!hasProp(this.target_, key)) {\n return true;\n }\n // Intercept\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: REMOVE\n });\n // Cancelled\n if (!change) {\n return null;\n }\n }\n // Delete\n try {\n var _this$pendingKeys_;\n startBatch();\n var notify = hasListeners(this);\n var notifySpy = true && isSpyEnabled();\n var observable = this.values_.get(key);\n // Value needed for spies/listeners\n var value = undefined;\n // Optimization: don't pull the value unless we will need it\n if (!observable && (notify || notifySpy)) {\n var _getDescriptor;\n value = (_getDescriptor = getDescriptor(this.target_, key)) == null ? void 0 : _getDescriptor.value;\n }\n // delete prop (do first, may fail)\n if (proxyTrap) {\n if (!Reflect.deleteProperty(this.target_, key)) {\n return false;\n }\n } else {\n delete this.target_[key];\n }\n // Allow re-annotating this field\n if (true) {\n delete this.appliedAnnotations_[key];\n }\n // Clear observable\n if (observable) {\n this.values_[\"delete\"](key);\n // for computed, value is undefined\n if (observable instanceof ObservableValue) {\n value = observable.value_;\n }\n // Notify: autorun(() => obj[key]), see #1796\n propagateChanged(observable);\n }\n // Notify \"keys/entries/values\" observers\n this.keysAtom_.reportChanged();\n // Notify \"has\" observers\n // \"in\" as it may still exist in proto\n (_this$pendingKeys_ = this.pendingKeys_) == null || (_this$pendingKeys_ = _this$pendingKeys_.get(key)) == null || _this$pendingKeys_.set(key in this.target_);\n // Notify spies/listeners\n if (notify || notifySpy) {\n var _change2 = {\n type: REMOVE,\n observableKind: \"object\",\n object: this.proxy_ || this.target_,\n debugObjectName: this.name_,\n oldValue: value,\n name: key\n };\n if ( true && notifySpy) {\n spyReportStart(_change2);\n }\n if (notify) {\n notifyListeners(this, _change2);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n } finally {\n endBatch();\n }\n return true;\n }\n /**\n * Observes this object. Triggers for the events 'add', 'update' and 'delete'.\n * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe\n * for callback details\n */;\n _proto.observe_ = function observe_(callback, fireImmediately) {\n if ( true && fireImmediately === true) {\n die(\"`observe` doesn't support the fire immediately property for observable objects.\");\n }\n return registerListener(this, callback);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.notifyPropertyAddition_ = function notifyPropertyAddition_(key, value) {\n var _this$pendingKeys_2;\n var notify = hasListeners(this);\n var notifySpy = true && isSpyEnabled();\n if (notify || notifySpy) {\n var change = notify || notifySpy ? {\n type: ADD,\n observableKind: \"object\",\n debugObjectName: this.name_,\n object: this.proxy_ || this.target_,\n name: key,\n newValue: value\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n }\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n (_this$pendingKeys_2 = this.pendingKeys_) == null || (_this$pendingKeys_2 = _this$pendingKeys_2.get(key)) == null || _this$pendingKeys_2.set(true);\n // Notify \"keys/entries/values\" observers\n this.keysAtom_.reportChanged();\n };\n _proto.ownKeys_ = function ownKeys_() {\n this.keysAtom_.reportObserved();\n return ownKeys(this.target_);\n };\n _proto.keys_ = function keys_() {\n // Returns enumerable && own, but unfortunately keysAtom will report on ANY key change.\n // There is no way to distinguish between Object.keys(object) and Reflect.ownKeys(object) - both are handled by ownKeys trap.\n // We can either over-report in Object.keys(object) or under-report in Reflect.ownKeys(object)\n // We choose to over-report in Object.keys(object), because:\n // - typically it's used with simple data objects\n // - when symbolic/non-enumerable keys are relevant Reflect.ownKeys works as expected\n this.keysAtom_.reportObserved();\n return Object.keys(this.target_);\n };\n return ObservableObjectAdministration;\n}();\nfunction asObservableObject(target, options) {\n var _options$name;\n if ( true && options && isObservableObject(target)) {\n die(\"Options can't be provided for already observable objects.\");\n }\n if (hasProp(target, $mobx)) {\n if ( true && !(getAdministration(target) instanceof ObservableObjectAdministration)) {\n die(\"Cannot convert '\" + getDebugName(target) + \"' into observable object:\" + \"\\nThe target is already observable of different type.\" + \"\\nExtending builtins is not supported.\");\n }\n return target;\n }\n if ( true && !Object.isExtensible(target)) {\n die(\"Cannot make the designated object observable; it is not extensible\");\n }\n var name = (_options$name = options == null ? void 0 : options.name) != null ? _options$name : true ? (isPlainObject(target) ? \"ObservableObject\" : target.constructor.name) + \"@\" + getNextId() : 0;\n var adm = new ObservableObjectAdministration(target, new Map(), String(name), getAnnotationFromOptions(options));\n addHiddenProp(target, $mobx, adm);\n return target;\n}\nvar isObservableObjectAdministration = /*#__PURE__*/createInstanceofPredicate(\"ObservableObjectAdministration\", ObservableObjectAdministration);\nfunction getCachedObservablePropDescriptor(key) {\n return descriptorCache[key] || (descriptorCache[key] = {\n get: function get() {\n return this[$mobx].getObservablePropValue_(key);\n },\n set: function set(value) {\n return this[$mobx].setObservablePropValue_(key, value);\n }\n });\n}\nfunction isObservableObject(thing) {\n if (isObject(thing)) {\n return isObservableObjectAdministration(thing[$mobx]);\n }\n return false;\n}\nfunction recordAnnotationApplied(adm, annotation, key) {\n var _adm$target_$storedAn;\n if (true) {\n adm.appliedAnnotations_[key] = annotation;\n }\n // Remove applied decorator annotation so we don't try to apply it again in subclass constructor\n (_adm$target_$storedAn = adm.target_[storedAnnotationsSymbol]) == null || delete _adm$target_$storedAn[key];\n}\nfunction assertAnnotable(adm, annotation, key) {\n // Valid annotation\n if ( true && !isAnnotation(annotation)) {\n die(\"Cannot annotate '\" + adm.name_ + \".\" + key.toString() + \"': Invalid annotation.\");\n }\n /*\n // Configurable, not sealed, not frozen\n // Possibly not needed, just a little better error then the one thrown by engine.\n // Cases where this would be useful the most (subclass field initializer) are not interceptable by this.\n if (__DEV__) {\n const configurable = getDescriptor(adm.target_, key)?.configurable\n const frozen = Object.isFrozen(adm.target_)\n const sealed = Object.isSealed(adm.target_)\n if (!configurable || frozen || sealed) {\n const fieldName = `${adm.name_}.${key.toString()}`\n const requestedAnnotationType = annotation.annotationType_\n let error = `Cannot apply '${requestedAnnotationType}' to '${fieldName}':`\n if (frozen) {\n error += `\\nObject is frozen.`\n }\n if (sealed) {\n error += `\\nObject is sealed.`\n }\n if (!configurable) {\n error += `\\nproperty is not configurable.`\n // Mention only if caused by us to avoid confusion\n if (hasProp(adm.appliedAnnotations!, key)) {\n error += `\\nTo prevent accidental re-definition of a field by a subclass, `\n error += `all annotated fields of non-plain objects (classes) are not configurable.`\n }\n }\n die(error)\n }\n }\n */\n // Not annotated\n if ( true && !isOverride(annotation) && hasProp(adm.appliedAnnotations_, key)) {\n var fieldName = adm.name_ + \".\" + key.toString();\n var currentAnnotationType = adm.appliedAnnotations_[key].annotationType_;\n var requestedAnnotationType = annotation.annotationType_;\n die(\"Cannot apply '\" + requestedAnnotationType + \"' to '\" + fieldName + \"':\" + (\"\\nThe field is already annotated with '\" + currentAnnotationType + \"'.\") + \"\\nRe-annotating fields is not allowed.\" + \"\\nUse 'override' annotation for methods overridden by subclass.\");\n }\n}\n\n// Bug in safari 9.* (or iOS 9 safari mobile). See #364\nvar ENTRY_0 = /*#__PURE__*/createArrayEntryDescriptor(0);\nvar safariPrototypeSetterInheritanceBug = /*#__PURE__*/function () {\n var v = false;\n var p = {};\n Object.defineProperty(p, \"0\", {\n set: function set() {\n v = true;\n }\n });\n /*#__PURE__*/Object.create(p)[\"0\"] = 1;\n return v === false;\n}();\n/**\n * This array buffer contains two lists of properties, so that all arrays\n * can recycle their property definitions, which significantly improves performance of creating\n * properties on the fly.\n */\nvar OBSERVABLE_ARRAY_BUFFER_SIZE = 0;\n// Typescript workaround to make sure ObservableArray extends Array\nvar StubArray = function StubArray() {};\nfunction inherit(ctor, proto) {\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(ctor.prototype, proto);\n } else if (ctor.prototype.__proto__ !== undefined) {\n ctor.prototype.__proto__ = proto;\n } else {\n ctor.prototype = proto;\n }\n}\ninherit(StubArray, Array.prototype);\n// Weex proto freeze protection was here,\n// but it is unclear why the hack is need as MobX never changed the prototype\n// anyway, so removed it in V6\nvar LegacyObservableArray = /*#__PURE__*/function (_StubArray) {\n function LegacyObservableArray(initialValues, enhancer, name, owned) {\n var _this;\n if (name === void 0) {\n name = true ? \"ObservableArray@\" + getNextId() : 0;\n }\n if (owned === void 0) {\n owned = false;\n }\n _this = _StubArray.call(this) || this;\n initObservable(function () {\n var adm = new ObservableArrayAdministration(name, enhancer, owned, true);\n adm.proxy_ = _this;\n addHiddenFinalProp(_this, $mobx, adm);\n if (initialValues && initialValues.length) {\n // @ts-ignore\n _this.spliceWithArray(0, 0, initialValues);\n }\n if (safariPrototypeSetterInheritanceBug) {\n // Seems that Safari won't use numeric prototype setter until any * numeric property is\n // defined on the instance. After that it works fine, even if this property is deleted.\n Object.defineProperty(_this, \"0\", ENTRY_0);\n }\n });\n return _this;\n }\n _inheritsLoose(LegacyObservableArray, _StubArray);\n var _proto = LegacyObservableArray.prototype;\n _proto.concat = function concat() {\n this[$mobx].atom_.reportObserved();\n for (var _len = arguments.length, arrays = new Array(_len), _key = 0; _key < _len; _key++) {\n arrays[_key] = arguments[_key];\n }\n return Array.prototype.concat.apply(this.slice(),\n //@ts-ignore\n arrays.map(function (a) {\n return isObservableArray(a) ? a.slice() : a;\n }));\n };\n _proto[Symbol.iterator] = function () {\n var self = this;\n var nextIndex = 0;\n return makeIterable({\n next: function next() {\n return nextIndex < self.length ? {\n value: self[nextIndex++],\n done: false\n } : {\n done: true,\n value: undefined\n };\n }\n });\n };\n return _createClass(LegacyObservableArray, [{\n key: \"length\",\n get: function get() {\n return this[$mobx].getArrayLength_();\n },\n set: function set(newLength) {\n this[$mobx].setArrayLength_(newLength);\n }\n }, {\n key: Symbol.toStringTag,\n get: function get() {\n return \"Array\";\n }\n }]);\n}(StubArray);\nObject.entries(arrayExtensions).forEach(function (_ref) {\n var prop = _ref[0],\n fn = _ref[1];\n if (prop !== \"concat\") {\n addHiddenProp(LegacyObservableArray.prototype, prop, fn);\n }\n});\nfunction createArrayEntryDescriptor(index) {\n return {\n enumerable: false,\n configurable: true,\n get: function get() {\n return this[$mobx].get_(index);\n },\n set: function set(value) {\n this[$mobx].set_(index, value);\n }\n };\n}\nfunction createArrayBufferItem(index) {\n defineProperty(LegacyObservableArray.prototype, \"\" + index, createArrayEntryDescriptor(index));\n}\nfunction reserveArrayBuffer(max) {\n if (max > OBSERVABLE_ARRAY_BUFFER_SIZE) {\n for (var index = OBSERVABLE_ARRAY_BUFFER_SIZE; index < max + 100; index++) {\n createArrayBufferItem(index);\n }\n OBSERVABLE_ARRAY_BUFFER_SIZE = max;\n }\n}\nreserveArrayBuffer(1000);\nfunction createLegacyArray(initialValues, enhancer, name) {\n return new LegacyObservableArray(initialValues, enhancer, name);\n}\n\nfunction getAtom(thing, property) {\n if (typeof thing === \"object\" && thing !== null) {\n if (isObservableArray(thing)) {\n if (property !== undefined) {\n die(23);\n }\n return thing[$mobx].atom_;\n }\n if (isObservableSet(thing)) {\n return thing.atom_;\n }\n if (isObservableMap(thing)) {\n if (property === undefined) {\n return thing.keysAtom_;\n }\n var observable = thing.data_.get(property) || thing.hasMap_.get(property);\n if (!observable) {\n die(25, property, getDebugName(thing));\n }\n return observable;\n }\n if (isObservableObject(thing)) {\n if (!property) {\n return die(26);\n }\n var _observable = thing[$mobx].values_.get(property);\n if (!_observable) {\n die(27, property, getDebugName(thing));\n }\n return _observable;\n }\n if (isAtom(thing) || isComputedValue(thing) || isReaction(thing)) {\n return thing;\n }\n } else if (isFunction(thing)) {\n if (isReaction(thing[$mobx])) {\n // disposer function\n return thing[$mobx];\n }\n }\n die(28);\n}\nfunction getAdministration(thing, property) {\n if (!thing) {\n die(29);\n }\n if (property !== undefined) {\n return getAdministration(getAtom(thing, property));\n }\n if (isAtom(thing) || isComputedValue(thing) || isReaction(thing)) {\n return thing;\n }\n if (isObservableMap(thing) || isObservableSet(thing)) {\n return thing;\n }\n if (thing[$mobx]) {\n return thing[$mobx];\n }\n die(24, thing);\n}\nfunction getDebugName(thing, property) {\n var named;\n if (property !== undefined) {\n named = getAtom(thing, property);\n } else if (isAction(thing)) {\n return thing.name;\n } else if (isObservableObject(thing) || isObservableMap(thing) || isObservableSet(thing)) {\n named = getAdministration(thing);\n } else {\n // valid for arrays as well\n named = getAtom(thing);\n }\n return named.name_;\n}\n/**\n * Helper function for initializing observable structures, it applies:\n * 1. allowStateChanges so we don't violate enforceActions.\n * 2. untracked so we don't accidentaly subscribe to anything observable accessed during init in case the observable is created inside derivation.\n * 3. batch to avoid state version updates\n */\nfunction initObservable(cb) {\n var derivation = untrackedStart();\n var allowStateChanges = allowStateChangesStart(true);\n startBatch();\n try {\n return cb();\n } finally {\n endBatch();\n allowStateChangesEnd(allowStateChanges);\n untrackedEnd(derivation);\n }\n}\n\nvar toString = objectPrototype.toString;\nfunction deepEqual(a, b, depth) {\n if (depth === void 0) {\n depth = -1;\n }\n return eq(a, b, depth);\n}\n// Copied from https://github.com/jashkenas/underscore/blob/5c237a7c682fb68fd5378203f0bf22dce1624854/underscore.js#L1186-L1289\n// Internal recursive comparison function for `isEqual`.\nfunction eq(a, b, depth, aStack, bStack) {\n // Identical objects are equal. `0 === -0`, but they aren't identical.\n // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).\n if (a === b) {\n return a !== 0 || 1 / a === 1 / b;\n }\n // `null` or `undefined` only equal to itself (strict comparison).\n if (a == null || b == null) {\n return false;\n }\n // `NaN`s are equivalent, but non-reflexive.\n if (a !== a) {\n return b !== b;\n }\n // Exhaust primitive checks\n var type = typeof a;\n if (type !== \"function\" && type !== \"object\" && typeof b != \"object\") {\n return false;\n }\n // Compare `[[Class]]` names.\n var className = toString.call(a);\n if (className !== toString.call(b)) {\n return false;\n }\n switch (className) {\n // Strings, numbers, regular expressions, dates, and booleans are compared by value.\n case \"[object RegExp]\":\n // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i')\n case \"[object String]\":\n // Primitives and their corresponding object wrappers are equivalent; thus, `\"5\"` is\n // equivalent to `new String(\"5\")`.\n return \"\" + a === \"\" + b;\n case \"[object Number]\":\n // `NaN`s are equivalent, but non-reflexive.\n // Object(NaN) is equivalent to NaN.\n if (+a !== +a) {\n return +b !== +b;\n }\n // An `egal` comparison is performed for other numeric values.\n return +a === 0 ? 1 / +a === 1 / b : +a === +b;\n case \"[object Date]\":\n case \"[object Boolean]\":\n // Coerce dates and booleans to numeric primitive values. Dates are compared by their\n // millisecond representations. Note that invalid dates with millisecond representations\n // of `NaN` are not equivalent.\n return +a === +b;\n case \"[object Symbol]\":\n return typeof Symbol !== \"undefined\" && Symbol.valueOf.call(a) === Symbol.valueOf.call(b);\n case \"[object Map]\":\n case \"[object Set]\":\n // Maps and Sets are unwrapped to arrays of entry-pairs, adding an incidental level.\n // Hide this extra level by increasing the depth.\n if (depth >= 0) {\n depth++;\n }\n break;\n }\n // Unwrap any wrapped objects.\n a = unwrap(a);\n b = unwrap(b);\n var areArrays = className === \"[object Array]\";\n if (!areArrays) {\n if (typeof a != \"object\" || typeof b != \"object\") {\n return false;\n }\n // Objects with different constructors are not equivalent, but `Object`s or `Array`s\n // from different frames are.\n var aCtor = a.constructor,\n bCtor = b.constructor;\n if (aCtor !== bCtor && !(isFunction(aCtor) && aCtor instanceof aCtor && isFunction(bCtor) && bCtor instanceof bCtor) && \"constructor\" in a && \"constructor\" in b) {\n return false;\n }\n }\n if (depth === 0) {\n return false;\n } else if (depth < 0) {\n depth = -1;\n }\n // Assume equality for cyclic structures. The algorithm for detecting cyclic\n // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.\n // Initializing stack of traversed objects.\n // It's done here since we only need them for objects and arrays comparison.\n aStack = aStack || [];\n bStack = bStack || [];\n var length = aStack.length;\n while (length--) {\n // Linear search. Performance is inversely proportional to the number of\n // unique nested structures.\n if (aStack[length] === a) {\n return bStack[length] === b;\n }\n }\n // Add the first object to the stack of traversed objects.\n aStack.push(a);\n bStack.push(b);\n // Recursively compare objects and arrays.\n if (areArrays) {\n // Compare array lengths to determine if a deep comparison is necessary.\n length = a.length;\n if (length !== b.length) {\n return false;\n }\n // Deep compare the contents, ignoring non-numeric properties.\n while (length--) {\n if (!eq(a[length], b[length], depth - 1, aStack, bStack)) {\n return false;\n }\n }\n } else {\n // Deep compare objects.\n var keys = Object.keys(a);\n var key;\n length = keys.length;\n // Ensure that both objects contain the same number of properties before comparing deep equality.\n if (Object.keys(b).length !== length) {\n return false;\n }\n while (length--) {\n // Deep compare each member\n key = keys[length];\n if (!(hasProp(b, key) && eq(a[key], b[key], depth - 1, aStack, bStack))) {\n return false;\n }\n }\n }\n // Remove the first object from the stack of traversed objects.\n aStack.pop();\n bStack.pop();\n return true;\n}\nfunction unwrap(a) {\n if (isObservableArray(a)) {\n return a.slice();\n }\n if (isES6Map(a) || isObservableMap(a)) {\n return Array.from(a.entries());\n }\n if (isES6Set(a) || isObservableSet(a)) {\n return Array.from(a.entries());\n }\n return a;\n}\n\nvar _getGlobal$Iterator;\n// safely get iterator prototype if available\nvar maybeIteratorPrototype = ((_getGlobal$Iterator = /*#__PURE__*/getGlobal().Iterator) == null ? void 0 : _getGlobal$Iterator.prototype) || {};\nfunction makeIterable(iterator) {\n iterator[Symbol.iterator] = getSelf;\n return Object.assign(Object.create(maybeIteratorPrototype), iterator);\n}\nfunction getSelf() {\n return this;\n}\n\nfunction isAnnotation(thing) {\n return (\n // Can be function\n thing instanceof Object && typeof thing.annotationType_ === \"string\" && isFunction(thing.make_) && isFunction(thing.extend_)\n );\n}\n\n/**\n * (c) Michel Weststrate 2015 - 2020\n * MIT Licensed\n *\n * Welcome to the mobx sources! To get a global overview of how MobX internally works,\n * this is a good place to start:\n * https://medium.com/@mweststrate/becoming-fully-reactive-an-in-depth-explanation-of-mobservable-55995262a254#.xvbh6qd74\n *\n * Source folders:\n * ===============\n *\n * - api/ Most of the public static methods exposed by the module can be found here.\n * - core/ Implementation of the MobX algorithm; atoms, derivations, reactions, dependency trees, optimizations. Cool stuff can be found here.\n * - types/ All the magic that is need to have observable objects, arrays and values is in this folder. Including the modifiers like `asFlat`.\n * - utils/ Utility stuff.\n *\n */\n[\"Symbol\", \"Map\", \"Set\"].forEach(function (m) {\n var g = getGlobal();\n if (typeof g[m] === \"undefined\") {\n die(\"MobX requires global '\" + m + \"' to be available or polyfilled\");\n }\n});\nif (typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__ === \"object\") {\n // See: https://github.com/andykog/mobx-devtools/\n __MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({\n spy: spy,\n extras: {\n getDebugName: getDebugName\n },\n $mobx: $mobx\n });\n}\n\n\n//# sourceMappingURL=mobx.esm.js.map\n\n\n//# sourceURL=webpack://app_adyen_SFRA/./node_modules/mobx/dist/mobx.esm.js?"); /***/ }) diff --git a/cartridges/app_adyen_SFRA/cartridge/static/default/js/adyenCheckout.js b/cartridges/app_adyen_SFRA/cartridge/static/default/js/adyenCheckout.js index a35aec6bf..c446bb40c 100644 --- a/cartridges/app_adyen_SFRA/cartridge/static/default/js/adyenCheckout.js +++ b/cartridges/app_adyen_SFRA/cartridge/static/default/js/adyenCheckout.js @@ -16,7 +16,7 @@ \********************************************************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -eval("\n\nvar store = __webpack_require__(/*! ../../../store */ \"./cartridges/app_adyen_SFRA/cartridge/store/index.js\");\nvar _require = __webpack_require__(/*! ./adyen_checkout/renderGenericComponent */ \"./cartridges/app_adyen_SFRA/cartridge/client/default/js/adyen_checkout/renderGenericComponent.js\"),\n renderGenericComponent = _require.renderGenericComponent;\nvar _require2 = __webpack_require__(/*! ./adyen_checkout/checkoutConfiguration */ \"./cartridges/app_adyen_SFRA/cartridge/client/default/js/adyen_checkout/checkoutConfiguration.js\"),\n setCheckoutConfiguration = _require2.setCheckoutConfiguration,\n actionHandler = _require2.actionHandler;\nvar _require3 = __webpack_require__(/*! ./adyen_checkout/helpers */ \"./cartridges/app_adyen_SFRA/cartridge/client/default/js/adyen_checkout/helpers.js\"),\n assignPaymentMethodValue = _require3.assignPaymentMethodValue,\n showValidation = _require3.showValidation,\n paymentFromComponent = _require3.paymentFromComponent;\nvar _require4 = __webpack_require__(/*! ./adyen_checkout/validateComponents */ \"./cartridges/app_adyen_SFRA/cartridge/client/default/js/adyen_checkout/validateComponents.js\"),\n validateComponents = _require4.validateComponents;\n$('#dwfrm_billing').submit(function apiRequest(e) {\n e.preventDefault();\n var form = $(this);\n var url = form.attr('action');\n $.ajax({\n type: 'POST',\n url: url,\n data: form.serialize(),\n async: false,\n success: function success(data) {\n store.formErrorsExist = 'fieldErrors' in data;\n }\n });\n});\nsetCheckoutConfiguration();\nif (window.googleMerchantID !== 'null' && window.Configuration.environment.includes('live')) {\n var id = 'merchantId';\n store.checkoutConfiguration.paymentMethodsConfiguration.paywithgoogle.configuration[id] = window.googleMerchantID;\n store.checkoutConfiguration.paymentMethodsConfiguration.googlepay.configuration[id] = window.googleMerchantID;\n}\n\n// Submit the payment\n$('button[value=\"submit-payment\"]').on('click', function () {\n if (store.paypalTerminatedEarly) {\n paymentFromComponent({\n cancelTransaction: true,\n merchantReference: document.querySelector('#merchantReference').value\n });\n store.paypalTerminatedEarly = false;\n }\n if (document.querySelector('#selectedPaymentOption').value === 'AdyenPOS') {\n document.querySelector('#terminalId').value = document.querySelector('#terminalList').value;\n }\n if (document.querySelector('#selectedPaymentOption').value === 'AdyenComponent' || document.querySelector('#selectedPaymentOption').value === 'CREDIT_CARD') {\n assignPaymentMethodValue();\n validateComponents();\n return showValidation();\n }\n return true;\n});\nmodule.exports = {\n renderGenericComponent: renderGenericComponent,\n actionHandler: actionHandler\n};\n\n//# sourceURL=webpack://app_adyen_SFRA/./cartridges/app_adyen_SFRA/cartridge/client/default/js/adyenCheckout.js?"); +eval("\n\nvar store = __webpack_require__(/*! ../../../store */ \"./cartridges/app_adyen_SFRA/cartridge/store/index.js\");\nvar _require = __webpack_require__(/*! ./adyen_checkout/renderGenericComponent */ \"./cartridges/app_adyen_SFRA/cartridge/client/default/js/adyen_checkout/renderGenericComponent.js\"),\n renderGenericComponent = _require.renderGenericComponent;\nvar _require2 = __webpack_require__(/*! ./adyen_checkout/checkoutConfiguration */ \"./cartridges/app_adyen_SFRA/cartridge/client/default/js/adyen_checkout/checkoutConfiguration.js\"),\n setCheckoutConfiguration = _require2.setCheckoutConfiguration,\n actionHandler = _require2.actionHandler;\nvar _require3 = __webpack_require__(/*! ./adyen_checkout/helpers */ \"./cartridges/app_adyen_SFRA/cartridge/client/default/js/adyen_checkout/helpers.js\"),\n assignPaymentMethodValue = _require3.assignPaymentMethodValue,\n showValidation = _require3.showValidation,\n paymentFromComponent = _require3.paymentFromComponent;\nvar _require4 = __webpack_require__(/*! ./adyen_checkout/validateComponents */ \"./cartridges/app_adyen_SFRA/cartridge/client/default/js/adyen_checkout/validateComponents.js\"),\n validateComponents = _require4.validateComponents;\n$('#dwfrm_billing').submit(function apiRequest(e) {\n e.preventDefault();\n var form = $(this);\n var url = form.attr('action');\n $.ajax({\n type: 'POST',\n url: url,\n data: form.serialize(),\n async: false,\n success: function success(data) {\n store.formErrorsExist = 'fieldErrors' in data;\n }\n });\n});\nsetCheckoutConfiguration();\nif (window.googleMerchantID !== 'null' && window.Configuration.environment.includes('live')) {\n var id = 'merchantId';\n store.checkoutConfiguration.paymentMethodsConfiguration.paywithgoogle.configuration[id] = window.googleMerchantID;\n store.checkoutConfiguration.paymentMethodsConfiguration.googlepay.configuration[id] = window.googleMerchantID;\n}\n$('body').on('checkout:updateCheckoutView', function (event, data) {\n if (data.order.orderEmail) {\n var clickToPayConfiguration = store.checkoutConfiguration.paymentMethodsConfiguration.card.clickToPayConfiguration;\n clickToPayConfiguration.shopperEmail = data.order.orderEmail;\n }\n});\n\n// Submit the payment\n$('button[value=\"submit-payment\"]').on('click', function () {\n if (store.paypalTerminatedEarly) {\n paymentFromComponent({\n cancelTransaction: true,\n merchantReference: document.querySelector('#merchantReference').value\n });\n store.paypalTerminatedEarly = false;\n }\n if (document.querySelector('#selectedPaymentOption').value === 'AdyenPOS') {\n document.querySelector('#terminalId').value = document.querySelector('#terminalList').value;\n }\n if (document.querySelector('#selectedPaymentOption').value === 'AdyenComponent' || document.querySelector('#selectedPaymentOption').value === 'CREDIT_CARD') {\n assignPaymentMethodValue();\n validateComponents();\n return showValidation();\n }\n return true;\n});\nmodule.exports = {\n renderGenericComponent: renderGenericComponent,\n actionHandler: actionHandler\n};\n\n//# sourceURL=webpack://app_adyen_SFRA/./cartridges/app_adyen_SFRA/cartridge/client/default/js/adyenCheckout.js?"); /***/ }), @@ -26,7 +26,7 @@ eval("\n\nvar store = __webpack_require__(/*! ../../../store */ \"./cartridges/a \*******************************************************************************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -eval("\n\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }\nfunction _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, \"next\", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, \"throw\", n); } _next(void 0); }); }; }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nvar helpers = __webpack_require__(/*! ./helpers */ \"./cartridges/app_adyen_SFRA/cartridge/client/default/js/adyen_checkout/helpers.js\");\nvar _require = __webpack_require__(/*! ./makePartialPayment */ \"./cartridges/app_adyen_SFRA/cartridge/client/default/js/adyen_checkout/makePartialPayment.js\"),\n makePartialPayment = _require.makePartialPayment;\nvar _require2 = __webpack_require__(/*! ../commons */ \"./cartridges/app_adyen_SFRA/cartridge/client/default/js/commons/index.js\"),\n onBrand = _require2.onBrand,\n onFieldValid = _require2.onFieldValid;\nvar store = __webpack_require__(/*! ../../../../store */ \"./cartridges/app_adyen_SFRA/cartridge/store/index.js\");\nvar constants = __webpack_require__(/*! ../constants */ \"./cartridges/app_adyen_SFRA/cartridge/client/default/js/constants.js\");\nvar _require3 = __webpack_require__(/*! ./renderGiftcardComponent */ \"./cartridges/app_adyen_SFRA/cartridge/client/default/js/adyen_checkout/renderGiftcardComponent.js\"),\n createElementsToShowRemainingGiftCardAmount = _require3.createElementsToShowRemainingGiftCardAmount,\n renderAddedGiftCard = _require3.renderAddedGiftCard,\n getGiftCardElements = _require3.getGiftCardElements,\n showGiftCardInfoMessage = _require3.showGiftCardInfoMessage,\n showGiftCardCancelButton = _require3.showGiftCardCancelButton,\n attachGiftCardCancelListener = _require3.attachGiftCardCancelListener;\nfunction getCardConfig() {\n return {\n hasHolderName: true,\n holderNameRequired: true,\n enableStoreDetails: window.showStoreDetails,\n showBrandsUnderCardNumber: false,\n clickToPayConfiguration: {\n shopperEmail: window.customerEmail,\n merchantDisplayName: window.merchantAccount\n },\n exposeExpiryDate: false,\n onChange: function onChange(state, component) {\n var _state$data, _state$data$paymentMe;\n store.isValid = state.isValid;\n var method = state.data.paymentMethod.storedPaymentMethodId ? \"storedCard\".concat(state.data.paymentMethod.storedPaymentMethodId) : store.selectedMethod;\n store.updateSelectedPayment(method, 'isValid', store.isValid);\n if ((_state$data = state.data) !== null && _state$data !== void 0 && (_state$data$paymentMe = _state$data.paymentMethod) !== null && _state$data$paymentMe !== void 0 && _state$data$paymentMe.storedPaymentMethodId) {\n var holderName = component.props.holderName;\n var paymentMethod = state.data.paymentMethod;\n paymentMethod.holderName = holderName;\n store.updateSelectedPayment(method, 'stateData', _objectSpread(_objectSpread({}, state.data), {}, {\n paymentMethod: paymentMethod\n }));\n } else {\n store.updateSelectedPayment(method, 'stateData', state.data);\n }\n },\n onSubmit: function onSubmit() {\n helpers.assignPaymentMethodValue();\n document.querySelector('button[value=\"submit-payment\"]').disabled = false;\n document.querySelector('button[value=\"submit-payment\"]').click();\n },\n onFieldValid: onFieldValid,\n onBrand: onBrand\n };\n}\nfunction getPaypalConfig() {\n store.paypalTerminatedEarly = false;\n return {\n showPayButton: true,\n environment: window.Configuration.environment,\n onSubmit: function onSubmit(state, component) {\n helpers.assignPaymentMethodValue();\n document.querySelector('#adyenStateData').value = JSON.stringify(store.selectedPayment.stateData);\n helpers.paymentFromComponent(state.data, component);\n },\n onCancel: function onCancel(data, component) {\n store.paypalTerminatedEarly = false;\n helpers.paymentFromComponent({\n cancelTransaction: true,\n merchantReference: document.querySelector('#merchantReference').value,\n orderToken: document.querySelector('#orderToken').value\n }, component);\n },\n onError: function onError(error, component) {\n store.paypalTerminatedEarly = false;\n if (component) {\n component.setStatus('ready');\n }\n document.querySelector('#showConfirmationForm').submit();\n },\n onAdditionalDetails: function onAdditionalDetails(state) {\n store.paypalTerminatedEarly = false;\n document.querySelector('#additionalDetailsHidden').value = JSON.stringify(state.data);\n document.querySelector('#showConfirmationForm').submit();\n },\n onClick: function onClick(data, actions) {\n $('#dwfrm_billing').trigger('submit');\n if (store.formErrorsExist) {\n return actions.reject();\n }\n if (store.paypalTerminatedEarly) {\n helpers.paymentFromComponent({\n cancelTransaction: true,\n merchantReference: document.querySelector('#merchantReference').value\n });\n store.paypalTerminatedEarly = false;\n return actions.resolve();\n }\n store.paypalTerminatedEarly = true;\n return null;\n }\n };\n}\nfunction getGooglePayConfig() {\n return {\n environment: window.Configuration.environment,\n onSubmit: function onSubmit() {\n helpers.assignPaymentMethodValue();\n document.querySelector('button[value=\"submit-payment\"]').disabled = false;\n document.querySelector('button[value=\"submit-payment\"]').click();\n },\n configuration: {\n gatewayMerchantId: window.merchantAccount\n },\n showPayButton: true,\n buttonColor: 'white'\n };\n}\nfunction handlePartialPaymentSuccess() {\n var _store$addedGiftCards;\n var _getGiftCardElements = getGiftCardElements(),\n giftCardSelectContainer = _getGiftCardElements.giftCardSelectContainer,\n giftCardSelect = _getGiftCardElements.giftCardSelect,\n giftCardsList = _getGiftCardElements.giftCardsList,\n cancelMainPaymentGiftCard = _getGiftCardElements.cancelMainPaymentGiftCard,\n giftCardAddButton = _getGiftCardElements.giftCardAddButton;\n giftCardSelectContainer.classList.add('invisible');\n giftCardSelect.value = null;\n giftCardsList.innerHTML = '';\n cancelMainPaymentGiftCard.addEventListener('click', function () {\n store.componentsObj.giftcard.node.unmount('component_giftcard');\n cancelMainPaymentGiftCard.classList.add('invisible');\n giftCardAddButton.style.display = 'block';\n giftCardSelect.value = 'null';\n });\n if (store.componentsObj.giftcard) {\n store.componentsObj.giftcard.node.unmount('component_giftcard');\n }\n store.addedGiftCards.forEach(function (card) {\n renderAddedGiftCard(card);\n });\n if ((_store$addedGiftCards = store.addedGiftCards) !== null && _store$addedGiftCards !== void 0 && _store$addedGiftCards.length) {\n showGiftCardInfoMessage();\n }\n showGiftCardCancelButton(true);\n attachGiftCardCancelListener();\n createElementsToShowRemainingGiftCardAmount();\n}\nfunction makeGiftcardPaymentRequest(_x, _x2, _x3) {\n return _makeGiftcardPaymentRequest.apply(this, arguments);\n}\nfunction _makeGiftcardPaymentRequest() {\n _makeGiftcardPaymentRequest = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(giftCardData, giftcardBalance, reject) {\n var brandSelect, selectedBrandIndex, giftcardBrand, partialPaymentRequest, partialPaymentResponse;\n return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n while (1) switch (_context2.prev = _context2.next) {\n case 0:\n brandSelect = document.getElementById('giftCardSelect');\n selectedBrandIndex = brandSelect.selectedIndex;\n giftcardBrand = brandSelect.options[selectedBrandIndex].text;\n partialPaymentRequest = {\n paymentMethod: giftCardData,\n amount: giftcardBalance,\n partialPaymentsOrder: {\n pspReference: store.adyenOrderData.pspReference,\n orderData: store.adyenOrderData.orderData\n },\n giftcardBrand: giftcardBrand\n };\n _context2.next = 6;\n return makePartialPayment(partialPaymentRequest);\n case 6:\n partialPaymentResponse = _context2.sent;\n if (partialPaymentResponse !== null && partialPaymentResponse !== void 0 && partialPaymentResponse.error) {\n reject();\n } else {\n handlePartialPaymentSuccess();\n }\n case 8:\n case \"end\":\n return _context2.stop();\n }\n }, _callee2);\n }));\n return _makeGiftcardPaymentRequest.apply(this, arguments);\n}\nfunction getGiftCardConfig() {\n var giftcardBalance;\n return {\n showPayButton: true,\n onChange: function onChange(state) {\n store.updateSelectedPayment(constants.GIFTCARD, 'isValid', state.isValid);\n store.updateSelectedPayment(constants.GIFTCARD, 'stateData', state.data);\n },\n onBalanceCheck: function onBalanceCheck(resolve, reject, requestData) {\n $.ajax({\n type: 'POST',\n url: window.checkBalanceUrl,\n data: JSON.stringify(requestData),\n contentType: 'application/json; charset=utf-8',\n async: false,\n success: function success(data) {\n giftcardBalance = data.balance;\n document.querySelector('button[value=\"submit-payment\"]').disabled = false;\n if (data.resultCode === constants.SUCCESS) {\n var _getGiftCardElements2 = getGiftCardElements(),\n giftCardsInfoMessageContainer = _getGiftCardElements2.giftCardsInfoMessageContainer,\n giftCardSelect = _getGiftCardElements2.giftCardSelect,\n cancelMainPaymentGiftCard = _getGiftCardElements2.cancelMainPaymentGiftCard,\n giftCardAddButton = _getGiftCardElements2.giftCardAddButton,\n giftCardSelectWrapper = _getGiftCardElements2.giftCardSelectWrapper;\n if (giftCardSelectWrapper) {\n giftCardSelectWrapper.classList.add('invisible');\n }\n var initialPartialObject = _objectSpread({}, store.partialPaymentsOrderObj);\n cancelMainPaymentGiftCard.classList.remove('invisible');\n cancelMainPaymentGiftCard.addEventListener('click', function () {\n store.componentsObj.giftcard.node.unmount('component_giftcard');\n cancelMainPaymentGiftCard.classList.add('invisible');\n giftCardAddButton.style.display = 'block';\n giftCardSelect.value = 'null';\n store.partialPaymentsOrderObj.remainingAmountFormatted = initialPartialObject.remainingAmountFormatted;\n store.partialPaymentsOrderObj.totalDiscountedAmount = initialPartialObject.totalDiscountedAmount;\n });\n document.querySelector('button[value=\"submit-payment\"]').disabled = true;\n giftCardsInfoMessageContainer.innerHTML = '';\n giftCardsInfoMessageContainer.classList.remove('gift-cards-info-message-container');\n store.partialPaymentsOrderObj.remainingAmountFormatted = data.remainingAmountFormatted;\n store.partialPaymentsOrderObj.totalDiscountedAmount = data.totalAmountFormatted;\n resolve(data);\n } else if (data.resultCode === constants.NOTENOUGHBALANCE) {\n resolve(data);\n } else {\n reject();\n }\n },\n fail: function fail() {\n reject();\n }\n });\n },\n onOrderRequest: function onOrderRequest(resolve, reject, requestData) {\n // Make a POST /orders request\n // Create an order for the total transaction amount\n var giftCardData = requestData.paymentMethod;\n if (store.adyenOrderData) {\n makeGiftcardPaymentRequest(giftCardData, giftcardBalance, reject);\n } else {\n $.ajax({\n type: 'POST',\n url: window.partialPaymentsOrderUrl,\n data: JSON.stringify(requestData),\n contentType: 'application/json; charset=utf-8',\n async: false,\n success: function success(data) {\n if (data.resultCode === 'Success') {\n store.adyenOrderData = data;\n // make payments call including giftcard data and order data\n makeGiftcardPaymentRequest(giftCardData, giftcardBalance, reject);\n }\n }\n });\n }\n },\n onSubmit: function onSubmit(state, component) {\n store.selectedMethod = state.data.paymentMethod.type;\n store.brand = component === null || component === void 0 ? void 0 : component.displayName;\n document.querySelector('input[name=\"brandCode\"]').checked = false;\n document.querySelector('button[value=\"submit-payment\"]').disabled = false;\n document.querySelector('button[value=\"submit-payment\"]').click();\n }\n };\n}\nfunction handleOnChange(state) {\n var type = state.data.paymentMethod.type;\n var multipleTxVariantComponents = constants.MULTIPLE_TX_VARIANTS_COMPONENTS;\n if (multipleTxVariantComponents.includes(store.selectedMethod)) {\n type = store.selectedMethod;\n }\n store.isValid = state.isValid;\n if (!store.componentsObj[type]) {\n store.componentsObj[type] = {};\n }\n store.componentsObj[type].isValid = store.isValid;\n store.componentsObj[type].stateData = state.data;\n}\nvar actionHandler = /*#__PURE__*/function () {\n var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(action) {\n var checkout;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n _context.next = 2;\n return AdyenCheckout(store.checkoutConfiguration);\n case 2:\n checkout = _context.sent;\n checkout.createFromAction(action).mount('#action-container');\n $('#action-modal').modal({\n backdrop: 'static',\n keyboard: false\n });\n if (action.type === constants.ACTIONTYPE.QRCODE) {\n document.getElementById('cancelQrMethodsButton').classList.remove('invisible');\n }\n case 6:\n case \"end\":\n return _context.stop();\n }\n }, _callee);\n }));\n return function actionHandler(_x4) {\n return _ref.apply(this, arguments);\n };\n}();\nfunction handleOnAdditionalDetails(state) {\n $.ajax({\n type: 'POST',\n url: window.paymentsDetailsURL,\n data: JSON.stringify({\n data: state.data,\n orderToken: window.orderToken\n }),\n contentType: 'application/json; charset=utf-8',\n async: false,\n success: function success(data) {\n if (!data.isFinal && _typeof(data.action) === 'object') {\n actionHandler(data.action);\n } else {\n window.location.href = data.redirectUrl;\n }\n }\n });\n}\nfunction getAmazonpayConfig() {\n return {\n showPayButton: true,\n productType: 'PayAndShip',\n checkoutMode: 'ProcessOrder',\n locale: window.Configuration.locale,\n returnUrl: window.returnURL,\n onClick: function onClick(resolve, reject) {\n $('#dwfrm_billing').trigger('submit');\n if (store.formErrorsExist) {\n reject();\n } else {\n helpers.assignPaymentMethodValue();\n resolve();\n }\n },\n onError: function onError() {}\n };\n}\nfunction getApplePayConfig() {\n return {\n showPayButton: true,\n buttonColor: 'black',\n onSubmit: function onSubmit(state, component) {\n $('#dwfrm_billing').trigger('submit');\n helpers.assignPaymentMethodValue();\n helpers.paymentFromComponent(state.data, component);\n }\n };\n}\nfunction getCashAppConfig() {\n return {\n showPayButton: true,\n onSubmit: function onSubmit(state, component) {\n $('#dwfrm_billing').trigger('submit');\n helpers.assignPaymentMethodValue();\n helpers.paymentFromComponent(state.data, component);\n }\n };\n}\nfunction getKlarnaConfig() {\n var _window = window,\n klarnaWidgetEnabled = _window.klarnaWidgetEnabled;\n if (klarnaWidgetEnabled) {\n return {\n showPayButton: true,\n useKlarnaWidget: true,\n onSubmit: function onSubmit(state, component) {\n helpers.assignPaymentMethodValue();\n helpers.paymentFromComponent(state.data, component);\n },\n onAdditionalDetails: function onAdditionalDetails(state) {\n document.querySelector('#additionalDetailsHidden').value = JSON.stringify(state.data);\n document.querySelector('#showConfirmationForm').submit();\n }\n };\n }\n return null;\n}\nfunction setCheckoutConfiguration() {\n store.checkoutConfiguration.onChange = handleOnChange;\n store.checkoutConfiguration.onAdditionalDetails = handleOnAdditionalDetails;\n store.checkoutConfiguration.showPayButton = false;\n store.checkoutConfiguration.clientKey = window.adyenClientKey;\n store.checkoutConfiguration.paymentMethodsConfiguration = {\n card: getCardConfig(),\n bcmc: getCardConfig(),\n storedCard: _objectSpread(_objectSpread({}, getCardConfig()), {}, {\n holderNameRequired: false\n }),\n boletobancario: {\n personalDetailsRequired: true,\n // turn personalDetails section on/off\n billingAddressRequired: false,\n // turn billingAddress section on/off\n showEmailAddress: false // allow shopper to specify their email address\n },\n paywithgoogle: getGooglePayConfig(),\n googlepay: getGooglePayConfig(),\n paypal: getPaypalConfig(),\n amazonpay: getAmazonpayConfig(),\n giftcard: getGiftCardConfig(),\n applepay: getApplePayConfig(),\n klarna: getKlarnaConfig(),\n klarna_account: getKlarnaConfig(),\n klarna_paynow: getKlarnaConfig(),\n cashapp: getCashAppConfig()\n };\n}\nmodule.exports = {\n getCardConfig: getCardConfig,\n getPaypalConfig: getPaypalConfig,\n getGooglePayConfig: getGooglePayConfig,\n getAmazonpayConfig: getAmazonpayConfig,\n getGiftCardConfig: getGiftCardConfig,\n getApplePayConfig: getApplePayConfig,\n getCashAppConfig: getCashAppConfig,\n getKlarnaConfig: getKlarnaConfig,\n setCheckoutConfiguration: setCheckoutConfiguration,\n actionHandler: actionHandler\n};\n\n//# sourceURL=webpack://app_adyen_SFRA/./cartridges/app_adyen_SFRA/cartridge/client/default/js/adyen_checkout/checkoutConfiguration.js?"); +eval("\n\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }\nfunction _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, \"next\", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, \"throw\", n); } _next(void 0); }); }; }\nvar helpers = __webpack_require__(/*! ./helpers */ \"./cartridges/app_adyen_SFRA/cartridge/client/default/js/adyen_checkout/helpers.js\");\nvar _require = __webpack_require__(/*! ./makePartialPayment */ \"./cartridges/app_adyen_SFRA/cartridge/client/default/js/adyen_checkout/makePartialPayment.js\"),\n makePartialPayment = _require.makePartialPayment;\nvar _require2 = __webpack_require__(/*! ../commons */ \"./cartridges/app_adyen_SFRA/cartridge/client/default/js/commons/index.js\"),\n onBrand = _require2.onBrand,\n onFieldValid = _require2.onFieldValid;\nvar store = __webpack_require__(/*! ../../../../store */ \"./cartridges/app_adyen_SFRA/cartridge/store/index.js\");\nvar constants = __webpack_require__(/*! ../constants */ \"./cartridges/app_adyen_SFRA/cartridge/client/default/js/constants.js\");\nvar _require3 = __webpack_require__(/*! ./renderGiftcardComponent */ \"./cartridges/app_adyen_SFRA/cartridge/client/default/js/adyen_checkout/renderGiftcardComponent.js\"),\n createElementsToShowRemainingGiftCardAmount = _require3.createElementsToShowRemainingGiftCardAmount,\n renderAddedGiftCard = _require3.renderAddedGiftCard,\n getGiftCardElements = _require3.getGiftCardElements,\n showGiftCardInfoMessage = _require3.showGiftCardInfoMessage,\n showGiftCardCancelButton = _require3.showGiftCardCancelButton,\n attachGiftCardCancelListener = _require3.attachGiftCardCancelListener;\nfunction getCardConfig() {\n return {\n hasHolderName: true,\n holderNameRequired: true,\n enableStoreDetails: window.showStoreDetails,\n showBrandsUnderCardNumber: false,\n clickToPayConfiguration: {\n shopperEmail: window.customerEmail,\n merchantDisplayName: window.merchantAccount\n },\n exposeExpiryDate: false,\n onChange: function onChange(state) {\n store.isValid = state.isValid;\n var method = state.data.paymentMethod.storedPaymentMethodId ? \"storedCard\".concat(state.data.paymentMethod.storedPaymentMethodId) : store.selectedMethod;\n store.updateSelectedPayment(method, 'isValid', store.isValid);\n store.updateSelectedPayment(method, 'stateData', state.data);\n },\n onSubmit: function onSubmit() {\n helpers.assignPaymentMethodValue();\n document.querySelector('button[value=\"submit-payment\"]').disabled = false;\n document.querySelector('button[value=\"submit-payment\"]').click();\n },\n onFieldValid: onFieldValid,\n onBrand: onBrand\n };\n}\nfunction getPaypalConfig() {\n store.paypalTerminatedEarly = false;\n return {\n showPayButton: true,\n environment: window.Configuration.environment,\n onSubmit: function onSubmit(state, component) {\n helpers.assignPaymentMethodValue();\n document.querySelector('#adyenStateData').value = JSON.stringify(store.selectedPayment.stateData);\n helpers.paymentFromComponent(state.data, component);\n },\n onCancel: function onCancel(data, component) {\n store.paypalTerminatedEarly = false;\n helpers.paymentFromComponent({\n cancelTransaction: true,\n merchantReference: document.querySelector('#merchantReference').value,\n orderToken: document.querySelector('#orderToken').value\n }, component);\n },\n onError: function onError(error, component) {\n store.paypalTerminatedEarly = false;\n if (component) {\n component.setStatus('ready');\n }\n document.querySelector('#showConfirmationForm').submit();\n },\n onAdditionalDetails: function onAdditionalDetails(state) {\n store.paypalTerminatedEarly = false;\n document.querySelector('#additionalDetailsHidden').value = JSON.stringify(state.data);\n document.querySelector('#showConfirmationForm').submit();\n },\n onClick: function onClick(data, actions) {\n $('#dwfrm_billing').trigger('submit');\n if (store.formErrorsExist) {\n return actions.reject();\n }\n if (store.paypalTerminatedEarly) {\n helpers.paymentFromComponent({\n cancelTransaction: true,\n merchantReference: document.querySelector('#merchantReference').value\n });\n store.paypalTerminatedEarly = false;\n return actions.resolve();\n }\n store.paypalTerminatedEarly = true;\n return null;\n }\n };\n}\nfunction getGooglePayConfig() {\n return {\n environment: window.Configuration.environment,\n onSubmit: function onSubmit() {\n helpers.assignPaymentMethodValue();\n document.querySelector('button[value=\"submit-payment\"]').disabled = false;\n document.querySelector('button[value=\"submit-payment\"]').click();\n },\n configuration: {\n gatewayMerchantId: window.merchantAccount\n },\n showPayButton: true,\n buttonColor: 'white'\n };\n}\nfunction handlePartialPaymentSuccess() {\n var _store$addedGiftCards;\n var _getGiftCardElements = getGiftCardElements(),\n giftCardSelectContainer = _getGiftCardElements.giftCardSelectContainer,\n giftCardSelect = _getGiftCardElements.giftCardSelect,\n giftCardsList = _getGiftCardElements.giftCardsList,\n cancelMainPaymentGiftCard = _getGiftCardElements.cancelMainPaymentGiftCard,\n giftCardAddButton = _getGiftCardElements.giftCardAddButton;\n giftCardSelectContainer.classList.add('invisible');\n giftCardSelect.value = null;\n giftCardsList.innerHTML = '';\n cancelMainPaymentGiftCard.addEventListener('click', function () {\n store.componentsObj.giftcard.node.unmount('component_giftcard');\n cancelMainPaymentGiftCard.classList.add('invisible');\n giftCardAddButton.style.display = 'block';\n giftCardSelect.value = 'null';\n });\n if (store.componentsObj.giftcard) {\n store.componentsObj.giftcard.node.unmount('component_giftcard');\n }\n store.addedGiftCards.forEach(function (card) {\n renderAddedGiftCard(card);\n });\n if ((_store$addedGiftCards = store.addedGiftCards) !== null && _store$addedGiftCards !== void 0 && _store$addedGiftCards.length) {\n showGiftCardInfoMessage();\n }\n showGiftCardCancelButton(true);\n attachGiftCardCancelListener();\n createElementsToShowRemainingGiftCardAmount();\n}\nfunction makeGiftcardPaymentRequest(_x, _x2, _x3) {\n return _makeGiftcardPaymentRequest.apply(this, arguments);\n}\nfunction _makeGiftcardPaymentRequest() {\n _makeGiftcardPaymentRequest = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(giftCardData, giftcardBalance, reject) {\n var brandSelect, selectedBrandIndex, giftcardBrand, partialPaymentRequest, partialPaymentResponse;\n return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n while (1) switch (_context2.prev = _context2.next) {\n case 0:\n brandSelect = document.getElementById('giftCardSelect');\n selectedBrandIndex = brandSelect.selectedIndex;\n giftcardBrand = brandSelect.options[selectedBrandIndex].text;\n partialPaymentRequest = {\n paymentMethod: giftCardData,\n amount: giftcardBalance,\n partialPaymentsOrder: {\n pspReference: store.adyenOrderData.pspReference,\n orderData: store.adyenOrderData.orderData\n },\n giftcardBrand: giftcardBrand\n };\n _context2.next = 6;\n return makePartialPayment(partialPaymentRequest);\n case 6:\n partialPaymentResponse = _context2.sent;\n if (partialPaymentResponse !== null && partialPaymentResponse !== void 0 && partialPaymentResponse.error) {\n reject();\n } else {\n handlePartialPaymentSuccess();\n }\n case 8:\n case \"end\":\n return _context2.stop();\n }\n }, _callee2);\n }));\n return _makeGiftcardPaymentRequest.apply(this, arguments);\n}\nfunction getGiftCardConfig() {\n var giftcardBalance;\n return {\n showPayButton: true,\n onChange: function onChange(state) {\n store.updateSelectedPayment(constants.GIFTCARD, 'isValid', state.isValid);\n store.updateSelectedPayment(constants.GIFTCARD, 'stateData', state.data);\n },\n onBalanceCheck: function onBalanceCheck(resolve, reject, requestData) {\n $.ajax({\n type: 'POST',\n url: window.checkBalanceUrl,\n data: JSON.stringify(requestData),\n contentType: 'application/json; charset=utf-8',\n async: false,\n success: function success(data) {\n giftcardBalance = data.balance;\n document.querySelector('button[value=\"submit-payment\"]').disabled = false;\n if (data.resultCode === constants.SUCCESS) {\n var _getGiftCardElements2 = getGiftCardElements(),\n giftCardsInfoMessageContainer = _getGiftCardElements2.giftCardsInfoMessageContainer,\n giftCardSelect = _getGiftCardElements2.giftCardSelect,\n cancelMainPaymentGiftCard = _getGiftCardElements2.cancelMainPaymentGiftCard,\n giftCardAddButton = _getGiftCardElements2.giftCardAddButton,\n giftCardSelectWrapper = _getGiftCardElements2.giftCardSelectWrapper;\n if (giftCardSelectWrapper) {\n giftCardSelectWrapper.classList.add('invisible');\n }\n var initialPartialObject = _objectSpread({}, store.partialPaymentsOrderObj);\n cancelMainPaymentGiftCard.classList.remove('invisible');\n cancelMainPaymentGiftCard.addEventListener('click', function () {\n store.componentsObj.giftcard.node.unmount('component_giftcard');\n cancelMainPaymentGiftCard.classList.add('invisible');\n giftCardAddButton.style.display = 'block';\n giftCardSelect.value = 'null';\n store.partialPaymentsOrderObj.remainingAmountFormatted = initialPartialObject.remainingAmountFormatted;\n store.partialPaymentsOrderObj.totalDiscountedAmount = initialPartialObject.totalDiscountedAmount;\n });\n document.querySelector('button[value=\"submit-payment\"]').disabled = true;\n giftCardsInfoMessageContainer.innerHTML = '';\n giftCardsInfoMessageContainer.classList.remove('gift-cards-info-message-container');\n store.partialPaymentsOrderObj.remainingAmountFormatted = data.remainingAmountFormatted;\n store.partialPaymentsOrderObj.totalDiscountedAmount = data.totalAmountFormatted;\n resolve(data);\n } else if (data.resultCode === constants.NOTENOUGHBALANCE) {\n resolve(data);\n } else {\n reject();\n }\n },\n fail: function fail() {\n reject();\n }\n });\n },\n onOrderRequest: function onOrderRequest(resolve, reject, requestData) {\n // Make a POST /orders request\n // Create an order for the total transaction amount\n var giftCardData = requestData.paymentMethod;\n if (store.adyenOrderData) {\n makeGiftcardPaymentRequest(giftCardData, giftcardBalance, reject);\n } else {\n $.ajax({\n type: 'POST',\n url: window.partialPaymentsOrderUrl,\n data: JSON.stringify(requestData),\n contentType: 'application/json; charset=utf-8',\n async: false,\n success: function success(data) {\n if (data.resultCode === 'Success') {\n store.adyenOrderData = data;\n // make payments call including giftcard data and order data\n makeGiftcardPaymentRequest(giftCardData, giftcardBalance, reject);\n }\n }\n });\n }\n },\n onSubmit: function onSubmit(state, component) {\n store.selectedMethod = state.data.paymentMethod.type;\n store.brand = component === null || component === void 0 ? void 0 : component.displayName;\n document.querySelector('input[name=\"brandCode\"]').checked = false;\n document.querySelector('button[value=\"submit-payment\"]').disabled = false;\n document.querySelector('button[value=\"submit-payment\"]').click();\n }\n };\n}\nfunction handleOnChange(state) {\n var type = state.data.paymentMethod.type;\n store.isValid = state.isValid;\n if (!store.componentsObj[type]) {\n store.componentsObj[type] = {};\n }\n store.componentsObj[type].isValid = store.isValid;\n store.componentsObj[type].stateData = state.data;\n}\nvar actionHandler = /*#__PURE__*/function () {\n var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(action) {\n var checkout;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n _context.next = 2;\n return AdyenCheckout(store.checkoutConfiguration);\n case 2:\n checkout = _context.sent;\n checkout.createFromAction(action).mount('#action-container');\n $('#action-modal').modal({\n backdrop: 'static',\n keyboard: false\n });\n if (action.type === constants.ACTIONTYPE.QRCODE) {\n document.getElementById('cancelQrMethodsButton').classList.remove('invisible');\n }\n case 6:\n case \"end\":\n return _context.stop();\n }\n }, _callee);\n }));\n return function actionHandler(_x4) {\n return _ref.apply(this, arguments);\n };\n}();\nfunction handleOnAdditionalDetails(state) {\n $.ajax({\n type: 'POST',\n url: window.paymentsDetailsURL,\n data: JSON.stringify({\n data: state.data,\n orderToken: window.orderToken\n }),\n contentType: 'application/json; charset=utf-8',\n async: false,\n success: function success(data) {\n if (!data.isFinal && _typeof(data.action) === 'object') {\n actionHandler(data.action);\n } else {\n window.location.href = data.redirectUrl;\n }\n }\n });\n}\nfunction getAmazonpayConfig() {\n return {\n showPayButton: true,\n productType: 'PayAndShip',\n checkoutMode: 'ProcessOrder',\n locale: window.Configuration.locale,\n returnUrl: window.returnURL,\n onClick: function onClick(resolve, reject) {\n $('#dwfrm_billing').trigger('submit');\n if (store.formErrorsExist) {\n reject();\n } else {\n helpers.assignPaymentMethodValue();\n resolve();\n }\n },\n onError: function onError() {}\n };\n}\nfunction getApplePayConfig() {\n return {\n showPayButton: true,\n buttonColor: 'black',\n onSubmit: function onSubmit(state, component) {\n $('#dwfrm_billing').trigger('submit');\n helpers.assignPaymentMethodValue();\n helpers.paymentFromComponent(state.data, component);\n }\n };\n}\nfunction getCashAppConfig() {\n return {\n showPayButton: true,\n onSubmit: function onSubmit(state, component) {\n $('#dwfrm_billing').trigger('submit');\n helpers.assignPaymentMethodValue();\n helpers.paymentFromComponent(state.data, component);\n }\n };\n}\nfunction getKlarnaConfig() {\n var _window = window,\n klarnaWidgetEnabled = _window.klarnaWidgetEnabled;\n if (klarnaWidgetEnabled) {\n return {\n showPayButton: true,\n useKlarnaWidget: true,\n onSubmit: function onSubmit(state, component) {\n helpers.assignPaymentMethodValue();\n helpers.paymentFromComponent(state.data, component);\n },\n onAdditionalDetails: function onAdditionalDetails(state) {\n document.querySelector('#additionalDetailsHidden').value = JSON.stringify(state.data);\n document.querySelector('#showConfirmationForm').submit();\n }\n };\n }\n return null;\n}\nfunction getUpiConfig() {\n return {\n showPayButton: true,\n onSubmit: function onSubmit(state, component) {\n $('#dwfrm_billing').trigger('submit');\n helpers.assignPaymentMethodValue();\n helpers.paymentFromComponent(state.data, component);\n },\n onAdditionalDetails: function onAdditionalDetails(state) {\n document.querySelector('#additionalDetailsHidden').value = JSON.stringify(state.data);\n document.querySelector('#showConfirmationForm').submit();\n },\n onError: function onError(component) {\n if (component) {\n component.setStatus('ready');\n }\n document.querySelector('#showConfirmationForm').submit();\n }\n };\n}\nfunction setCheckoutConfiguration() {\n store.checkoutConfiguration.onChange = handleOnChange;\n store.checkoutConfiguration.onAdditionalDetails = handleOnAdditionalDetails;\n store.checkoutConfiguration.showPayButton = false;\n store.checkoutConfiguration.clientKey = window.adyenClientKey;\n store.checkoutConfiguration.paymentMethodsConfiguration = {\n card: getCardConfig(),\n bcmc: getCardConfig(),\n storedCard: _objectSpread(_objectSpread({}, getCardConfig()), {}, {\n holderNameRequired: false\n }),\n boletobancario: {\n personalDetailsRequired: true,\n // turn personalDetails section on/off\n billingAddressRequired: false,\n // turn billingAddress section on/off\n showEmailAddress: false // allow shopper to specify their email address\n },\n paywithgoogle: getGooglePayConfig(),\n googlepay: getGooglePayConfig(),\n paypal: getPaypalConfig(),\n amazonpay: getAmazonpayConfig(),\n giftcard: getGiftCardConfig(),\n applepay: getApplePayConfig(),\n klarna: getKlarnaConfig(),\n klarna_account: getKlarnaConfig(),\n klarna_paynow: getKlarnaConfig(),\n cashapp: getCashAppConfig(),\n upi: getUpiConfig()\n };\n}\nmodule.exports = {\n getCardConfig: getCardConfig,\n getPaypalConfig: getPaypalConfig,\n getGooglePayConfig: getGooglePayConfig,\n getAmazonpayConfig: getAmazonpayConfig,\n getGiftCardConfig: getGiftCardConfig,\n getApplePayConfig: getApplePayConfig,\n getCashAppConfig: getCashAppConfig,\n getKlarnaConfig: getKlarnaConfig,\n setCheckoutConfiguration: setCheckoutConfiguration,\n actionHandler: actionHandler\n};\n\n//# sourceURL=webpack://app_adyen_SFRA/./cartridges/app_adyen_SFRA/cartridge/client/default/js/adyen_checkout/checkoutConfiguration.js?"); /***/ }), @@ -116,7 +116,7 @@ eval("\n\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \" \****************************************************************************/ /***/ ((module) => { -eval("\n\n// Adyen constants\n\nmodule.exports = {\n METHOD_ADYEN: 'Adyen',\n METHOD_ADYEN_POS: 'AdyenPOS',\n METHOD_ADYEN_COMPONENT: 'AdyenComponent',\n RECEIVED: 'Received',\n NOTENOUGHBALANCE: 'NotEnoughBalance',\n SUCCESS: 'Success',\n GIFTCARD: 'giftcard',\n SCHEME: 'scheme',\n GIROPAY: 'giropay',\n APPLE_PAY: 'applepay',\n PAYPAL: 'paypal',\n AMAZON_PAY: 'amazonpay',\n ACTIONTYPE: {\n QRCODE: 'qrCode'\n },\n DISABLED_SUBMIT_BUTTON_METHODS: ['paypal', 'paywithgoogle', 'googlepay', 'amazonpay', 'applepay', 'cashapp'],\n MULTIPLE_TX_VARIANTS_COMPONENTS: ['upi']\n};\n\n//# sourceURL=webpack://app_adyen_SFRA/./cartridges/app_adyen_SFRA/cartridge/client/default/js/constants.js?"); +eval("\n\n// Adyen constants\n\nmodule.exports = {\n METHOD_ADYEN: 'Adyen',\n METHOD_ADYEN_POS: 'AdyenPOS',\n METHOD_ADYEN_COMPONENT: 'AdyenComponent',\n RECEIVED: 'Received',\n NOTENOUGHBALANCE: 'NotEnoughBalance',\n SUCCESS: 'Success',\n GIFTCARD: 'giftcard',\n SCHEME: 'scheme',\n GIROPAY: 'giropay',\n APPLE_PAY: 'applepay',\n PAYPAL: 'paypal',\n AMAZON_PAY: 'amazonpay',\n ACTIONTYPE: {\n QRCODE: 'qrCode'\n },\n DISABLED_SUBMIT_BUTTON_METHODS: ['paypal', 'paywithgoogle', 'googlepay', 'amazonpay', 'applepay', 'cashapp', 'upi']\n};\n\n//# sourceURL=webpack://app_adyen_SFRA/./cartridges/app_adyen_SFRA/cartridge/client/default/js/constants.js?"); /***/ }), @@ -136,7 +136,7 @@ eval("\n\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \" \********************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ $mobx: () => (/* binding */ $mobx),\n/* harmony export */ FlowCancellationError: () => (/* binding */ FlowCancellationError),\n/* harmony export */ ObservableMap: () => (/* binding */ ObservableMap),\n/* harmony export */ ObservableSet: () => (/* binding */ ObservableSet),\n/* harmony export */ Reaction: () => (/* binding */ Reaction),\n/* harmony export */ _allowStateChanges: () => (/* binding */ allowStateChanges),\n/* harmony export */ _allowStateChangesInsideComputed: () => (/* binding */ runInAction),\n/* harmony export */ _allowStateReadsEnd: () => (/* binding */ allowStateReadsEnd),\n/* harmony export */ _allowStateReadsStart: () => (/* binding */ allowStateReadsStart),\n/* harmony export */ _autoAction: () => (/* binding */ autoAction),\n/* harmony export */ _endAction: () => (/* binding */ _endAction),\n/* harmony export */ _getAdministration: () => (/* binding */ getAdministration),\n/* harmony export */ _getGlobalState: () => (/* binding */ getGlobalState),\n/* harmony export */ _interceptReads: () => (/* binding */ interceptReads),\n/* harmony export */ _isComputingDerivation: () => (/* binding */ isComputingDerivation),\n/* harmony export */ _resetGlobalState: () => (/* binding */ resetGlobalState),\n/* harmony export */ _startAction: () => (/* binding */ _startAction),\n/* harmony export */ action: () => (/* binding */ action),\n/* harmony export */ autorun: () => (/* binding */ autorun),\n/* harmony export */ comparer: () => (/* binding */ comparer),\n/* harmony export */ computed: () => (/* binding */ computed),\n/* harmony export */ configure: () => (/* binding */ configure),\n/* harmony export */ createAtom: () => (/* binding */ createAtom),\n/* harmony export */ defineProperty: () => (/* binding */ apiDefineProperty),\n/* harmony export */ entries: () => (/* binding */ entries),\n/* harmony export */ extendObservable: () => (/* binding */ extendObservable),\n/* harmony export */ flow: () => (/* binding */ flow),\n/* harmony export */ flowResult: () => (/* binding */ flowResult),\n/* harmony export */ get: () => (/* binding */ get),\n/* harmony export */ getAtom: () => (/* binding */ getAtom),\n/* harmony export */ getDebugName: () => (/* binding */ getDebugName),\n/* harmony export */ getDependencyTree: () => (/* binding */ getDependencyTree),\n/* harmony export */ getObserverTree: () => (/* binding */ getObserverTree),\n/* harmony export */ has: () => (/* binding */ has),\n/* harmony export */ intercept: () => (/* binding */ intercept),\n/* harmony export */ isAction: () => (/* binding */ isAction),\n/* harmony export */ isBoxedObservable: () => (/* binding */ isObservableValue),\n/* harmony export */ isComputed: () => (/* binding */ isComputed),\n/* harmony export */ isComputedProp: () => (/* binding */ isComputedProp),\n/* harmony export */ isFlow: () => (/* binding */ isFlow),\n/* harmony export */ isFlowCancellationError: () => (/* binding */ isFlowCancellationError),\n/* harmony export */ isObservable: () => (/* binding */ isObservable),\n/* harmony export */ isObservableArray: () => (/* binding */ isObservableArray),\n/* harmony export */ isObservableMap: () => (/* binding */ isObservableMap),\n/* harmony export */ isObservableObject: () => (/* binding */ isObservableObject),\n/* harmony export */ isObservableProp: () => (/* binding */ isObservableProp),\n/* harmony export */ isObservableSet: () => (/* binding */ isObservableSet),\n/* harmony export */ keys: () => (/* binding */ keys),\n/* harmony export */ makeAutoObservable: () => (/* binding */ makeAutoObservable),\n/* harmony export */ makeObservable: () => (/* binding */ makeObservable),\n/* harmony export */ observable: () => (/* binding */ observable),\n/* harmony export */ observe: () => (/* binding */ observe),\n/* harmony export */ onBecomeObserved: () => (/* binding */ onBecomeObserved),\n/* harmony export */ onBecomeUnobserved: () => (/* binding */ onBecomeUnobserved),\n/* harmony export */ onReactionError: () => (/* binding */ onReactionError),\n/* harmony export */ override: () => (/* binding */ override),\n/* harmony export */ ownKeys: () => (/* binding */ apiOwnKeys),\n/* harmony export */ reaction: () => (/* binding */ reaction),\n/* harmony export */ remove: () => (/* binding */ remove),\n/* harmony export */ runInAction: () => (/* binding */ runInAction),\n/* harmony export */ set: () => (/* binding */ set),\n/* harmony export */ spy: () => (/* binding */ spy),\n/* harmony export */ toJS: () => (/* binding */ toJS),\n/* harmony export */ trace: () => (/* binding */ trace),\n/* harmony export */ transaction: () => (/* binding */ transaction),\n/* harmony export */ untracked: () => (/* binding */ untracked),\n/* harmony export */ values: () => (/* binding */ values),\n/* harmony export */ when: () => (/* binding */ when)\n/* harmony export */ });\nvar niceErrors = {\n 0: \"Invalid value for configuration 'enforceActions', expected 'never', 'always' or 'observed'\",\n 1: function _(annotationType, key) {\n return \"Cannot apply '\" + annotationType + \"' to '\" + key.toString() + \"': Field not found.\";\n },\n /*\n 2(prop) {\n return `invalid decorator for '${prop.toString()}'`\n },\n 3(prop) {\n return `Cannot decorate '${prop.toString()}': action can only be used on properties with a function value.`\n },\n 4(prop) {\n return `Cannot decorate '${prop.toString()}': computed can only be used on getter properties.`\n },\n */\n 5: \"'keys()' can only be used on observable objects, arrays, sets and maps\",\n 6: \"'values()' can only be used on observable objects, arrays, sets and maps\",\n 7: \"'entries()' can only be used on observable objects, arrays and maps\",\n 8: \"'set()' can only be used on observable objects, arrays and maps\",\n 9: \"'remove()' can only be used on observable objects, arrays and maps\",\n 10: \"'has()' can only be used on observable objects, arrays and maps\",\n 11: \"'get()' can only be used on observable objects, arrays and maps\",\n 12: \"Invalid annotation\",\n 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)\",\n 14: \"Intercept handlers should return nothing or a change object\",\n 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)\",\n 16: \"Modification exception: the internal structure of an observable array was changed.\",\n 17: function _(index, length) {\n return \"[mobx.array] Index out of bounds, \" + index + \" is larger than \" + length;\n },\n 18: \"mobx.map requires Map polyfill for the current browser. Check babel-polyfill or core-js/es6/map.js\",\n 19: function _(other) {\n return \"Cannot initialize from classes that inherit from Map: \" + other.constructor.name;\n },\n 20: function _(other) {\n return \"Cannot initialize map from \" + other;\n },\n 21: function _(dataStructure) {\n return \"Cannot convert to map from '\" + dataStructure + \"'\";\n },\n 22: \"mobx.set requires Set polyfill for the current browser. Check babel-polyfill or core-js/es6/set.js\",\n 23: \"It is not possible to get index atoms from arrays\",\n 24: function _(thing) {\n return \"Cannot obtain administration from \" + thing;\n },\n 25: function _(property, name) {\n return \"the entry '\" + property + \"' does not exist in the observable map '\" + name + \"'\";\n },\n 26: \"please specify a property\",\n 27: function _(property, name) {\n return \"no observable property '\" + property.toString() + \"' found on the observable object '\" + name + \"'\";\n },\n 28: function _(thing) {\n return \"Cannot obtain atom from \" + thing;\n },\n 29: \"Expecting some object\",\n 30: \"invalid action stack. did you forget to finish an action?\",\n 31: \"missing option for computed: get\",\n 32: function _(name, derivation) {\n return \"Cycle detected in computation \" + name + \": \" + derivation;\n },\n 33: function _(name) {\n return \"The setter of computed value '\" + name + \"' is trying to update itself. Did you intend to update an _observable_ value, instead of the computed property?\";\n },\n 34: function _(name) {\n return \"[ComputedValue '\" + name + \"'] It is not possible to assign a new value to a computed value.\";\n },\n 35: \"There are multiple, different versions of MobX active. Make sure MobX is loaded only once or use `configure({ isolateGlobalState: true })`\",\n 36: \"isolateGlobalState should be called before MobX is running any reactions\",\n 37: function _(method) {\n return \"[mobx] `observableArray.\" + method + \"()` mutates the array in-place, which is not allowed inside a derivation. Use `array.slice().\" + method + \"()` instead\";\n },\n 38: \"'ownKeys()' can only be used on observable objects\",\n 39: \"'defineProperty()' can only be used on observable objects\"\n};\nvar errors = true ? niceErrors : 0;\nfunction die(error) {\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n if (true) {\n var e = typeof error === \"string\" ? error : errors[error];\n if (typeof e === \"function\") e = e.apply(null, args);\n throw new Error(\"[MobX] \" + e);\n }\n throw new Error(typeof error === \"number\" ? \"[MobX] minified error nr: \" + error + (args.length ? \" \" + args.map(String).join(\",\") : \"\") + \". Find the full error at: https://github.com/mobxjs/mobx/blob/main/packages/mobx/src/errors.ts\" : \"[MobX] \" + error);\n}\n\nvar mockGlobal = {};\nfunction getGlobal() {\n if (typeof globalThis !== \"undefined\") {\n return globalThis;\n }\n if (typeof window !== \"undefined\") {\n return window;\n }\n if (typeof __webpack_require__.g !== \"undefined\") {\n return __webpack_require__.g;\n }\n if (typeof self !== \"undefined\") {\n return self;\n }\n return mockGlobal;\n}\n\n// We shorten anything used > 5 times\nvar assign = Object.assign;\nvar getDescriptor = Object.getOwnPropertyDescriptor;\nvar defineProperty = Object.defineProperty;\nvar objectPrototype = Object.prototype;\nvar EMPTY_ARRAY = [];\nObject.freeze(EMPTY_ARRAY);\nvar EMPTY_OBJECT = {};\nObject.freeze(EMPTY_OBJECT);\nvar hasProxy = typeof Proxy !== \"undefined\";\nvar plainObjectString = /*#__PURE__*/Object.toString();\nfunction assertProxies() {\n if (!hasProxy) {\n die( true ? \"`Proxy` objects are not available in the current environment. Please configure MobX to enable a fallback implementation.`\" : 0);\n }\n}\nfunction warnAboutProxyRequirement(msg) {\n if ( true && globalState.verifyProxies) {\n die(\"MobX is currently configured to be able to run in ES5 mode, but in ES5 MobX won't be able to \" + msg);\n }\n}\nfunction getNextId() {\n return ++globalState.mobxGuid;\n}\n/**\n * Makes sure that the provided function is invoked at most once.\n */\nfunction once(func) {\n var invoked = false;\n return function () {\n if (invoked) {\n return;\n }\n invoked = true;\n return func.apply(this, arguments);\n };\n}\nvar noop = function noop() {};\nfunction isFunction(fn) {\n return typeof fn === \"function\";\n}\nfunction isStringish(value) {\n var t = typeof value;\n switch (t) {\n case \"string\":\n case \"symbol\":\n case \"number\":\n return true;\n }\n return false;\n}\nfunction isObject(value) {\n return value !== null && typeof value === \"object\";\n}\nfunction isPlainObject(value) {\n if (!isObject(value)) {\n return false;\n }\n var proto = Object.getPrototypeOf(value);\n if (proto == null) {\n return true;\n }\n var protoConstructor = Object.hasOwnProperty.call(proto, \"constructor\") && proto.constructor;\n return typeof protoConstructor === \"function\" && protoConstructor.toString() === plainObjectString;\n}\n// https://stackoverflow.com/a/37865170\nfunction isGenerator(obj) {\n var constructor = obj == null ? void 0 : obj.constructor;\n if (!constructor) {\n return false;\n }\n if (\"GeneratorFunction\" === constructor.name || \"GeneratorFunction\" === constructor.displayName) {\n return true;\n }\n return false;\n}\nfunction addHiddenProp(object, propName, value) {\n defineProperty(object, propName, {\n enumerable: false,\n writable: true,\n configurable: true,\n value: value\n });\n}\nfunction addHiddenFinalProp(object, propName, value) {\n defineProperty(object, propName, {\n enumerable: false,\n writable: false,\n configurable: true,\n value: value\n });\n}\nfunction createInstanceofPredicate(name, theClass) {\n var propName = \"isMobX\" + name;\n theClass.prototype[propName] = true;\n return function (x) {\n return isObject(x) && x[propName] === true;\n };\n}\n/**\n * Yields true for both native and observable Map, even across different windows.\n */\nfunction isES6Map(thing) {\n return thing != null && Object.prototype.toString.call(thing) === \"[object Map]\";\n}\n/**\n * Makes sure a Map is an instance of non-inherited native or observable Map.\n */\nfunction isPlainES6Map(thing) {\n var mapProto = Object.getPrototypeOf(thing);\n var objectProto = Object.getPrototypeOf(mapProto);\n var nullProto = Object.getPrototypeOf(objectProto);\n return nullProto === null;\n}\n/**\n * Yields true for both native and observable Set, even across different windows.\n */\nfunction isES6Set(thing) {\n return thing != null && Object.prototype.toString.call(thing) === \"[object Set]\";\n}\nvar hasGetOwnPropertySymbols = typeof Object.getOwnPropertySymbols !== \"undefined\";\n/**\n * Returns the following: own enumerable keys and symbols.\n */\nfunction getPlainObjectKeys(object) {\n var keys = Object.keys(object);\n // Not supported in IE, so there are not going to be symbol props anyway...\n if (!hasGetOwnPropertySymbols) {\n return keys;\n }\n var symbols = Object.getOwnPropertySymbols(object);\n if (!symbols.length) {\n return keys;\n }\n return [].concat(keys, symbols.filter(function (s) {\n return objectPrototype.propertyIsEnumerable.call(object, s);\n }));\n}\n// From Immer utils\n// Returns all own keys, including non-enumerable and symbolic\nvar ownKeys = typeof Reflect !== \"undefined\" && Reflect.ownKeys ? Reflect.ownKeys : hasGetOwnPropertySymbols ? function (obj) {\n return Object.getOwnPropertyNames(obj).concat(Object.getOwnPropertySymbols(obj));\n} : /* istanbul ignore next */Object.getOwnPropertyNames;\nfunction stringifyKey(key) {\n if (typeof key === \"string\") {\n return key;\n }\n if (typeof key === \"symbol\") {\n return key.toString();\n }\n return new String(key).toString();\n}\nfunction toPrimitive(value) {\n return value === null ? null : typeof value === \"object\" ? \"\" + value : value;\n}\nfunction hasProp(target, prop) {\n return objectPrototype.hasOwnProperty.call(target, prop);\n}\n// From Immer utils\nvar getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors || function getOwnPropertyDescriptors(target) {\n // Polyfill needed for Hermes and IE, see https://github.com/facebook/hermes/issues/274\n var res = {};\n // Note: without polyfill for ownKeys, symbols won't be picked up\n ownKeys(target).forEach(function (key) {\n res[key] = getDescriptor(target, key);\n });\n return res;\n};\nfunction getFlag(flags, mask) {\n return !!(flags & mask);\n}\nfunction setFlag(flags, mask, newValue) {\n if (newValue) {\n flags |= mask;\n } else {\n flags &= ~mask;\n }\n return flags;\n}\n\nfunction _arrayLikeToArray(r, a) {\n (null == a || a > r.length) && (a = r.length);\n for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];\n return n;\n}\nfunction _defineProperties(e, r) {\n for (var t = 0; t < r.length; t++) {\n var o = r[t];\n o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);\n }\n}\nfunction _createClass(e, r, t) {\n return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", {\n writable: !1\n }), e;\n}\nfunction _createForOfIteratorHelperLoose(r, e) {\n var t = \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"];\n if (t) return (t = t.call(r)).next.bind(t);\n if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && \"number\" == typeof r.length) {\n t && (r = t);\n var o = 0;\n return function () {\n return o >= r.length ? {\n done: !0\n } : {\n done: !1,\n value: r[o++]\n };\n };\n }\n throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\nfunction _extends() {\n return _extends = Object.assign ? Object.assign.bind() : function (n) {\n for (var e = 1; e < arguments.length; e++) {\n var t = arguments[e];\n for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);\n }\n return n;\n }, _extends.apply(null, arguments);\n}\nfunction _inheritsLoose(t, o) {\n t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);\n}\nfunction _setPrototypeOf(t, e) {\n return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {\n return t.__proto__ = e, t;\n }, _setPrototypeOf(t, e);\n}\nfunction _toPrimitive(t, r) {\n if (\"object\" != typeof t || !t) return t;\n var e = t[Symbol.toPrimitive];\n if (void 0 !== e) {\n var i = e.call(t, r || \"default\");\n if (\"object\" != typeof i) return i;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (\"string\" === r ? String : Number)(t);\n}\nfunction _toPropertyKey(t) {\n var i = _toPrimitive(t, \"string\");\n return \"symbol\" == typeof i ? i : i + \"\";\n}\nfunction _unsupportedIterableToArray(r, a) {\n if (r) {\n if (\"string\" == typeof r) return _arrayLikeToArray(r, a);\n var t = {}.toString.call(r).slice(8, -1);\n return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;\n }\n}\n\nvar storedAnnotationsSymbol = /*#__PURE__*/Symbol(\"mobx-stored-annotations\");\n/**\n * Creates a function that acts as\n * - decorator\n * - annotation object\n */\nfunction createDecoratorAnnotation(annotation) {\n function decorator(target, property) {\n if (is20223Decorator(property)) {\n return annotation.decorate_20223_(target, property);\n } else {\n storeAnnotation(target, property, annotation);\n }\n }\n return Object.assign(decorator, annotation);\n}\n/**\n * Stores annotation to prototype,\n * so it can be inspected later by `makeObservable` called from constructor\n */\nfunction storeAnnotation(prototype, key, annotation) {\n if (!hasProp(prototype, storedAnnotationsSymbol)) {\n addHiddenProp(prototype, storedAnnotationsSymbol, _extends({}, prototype[storedAnnotationsSymbol]));\n }\n // @override must override something\n if ( true && isOverride(annotation) && !hasProp(prototype[storedAnnotationsSymbol], key)) {\n var fieldName = prototype.constructor.name + \".prototype.\" + key.toString();\n die(\"'\" + fieldName + \"' is decorated with 'override', \" + \"but no such decorated member was found on prototype.\");\n }\n // Cannot re-decorate\n assertNotDecorated(prototype, annotation, key);\n // Ignore override\n if (!isOverride(annotation)) {\n prototype[storedAnnotationsSymbol][key] = annotation;\n }\n}\nfunction assertNotDecorated(prototype, annotation, key) {\n if ( true && !isOverride(annotation) && hasProp(prototype[storedAnnotationsSymbol], key)) {\n var fieldName = prototype.constructor.name + \".prototype.\" + key.toString();\n var currentAnnotationType = prototype[storedAnnotationsSymbol][key].annotationType_;\n var requestedAnnotationType = annotation.annotationType_;\n die(\"Cannot apply '@\" + requestedAnnotationType + \"' to '\" + fieldName + \"':\" + (\"\\nThe field is already decorated with '@\" + currentAnnotationType + \"'.\") + \"\\nRe-decorating fields is not allowed.\" + \"\\nUse '@override' decorator for methods overridden by subclass.\");\n }\n}\n/**\n * Collects annotations from prototypes and stores them on target (instance)\n */\nfunction collectStoredAnnotations(target) {\n if (!hasProp(target, storedAnnotationsSymbol)) {\n // if (__DEV__ && !target[storedAnnotationsSymbol]) {\n // die(\n // `No annotations were passed to makeObservable, but no decorated members have been found either`\n // )\n // }\n // We need a copy as we will remove annotation from the list once it's applied.\n addHiddenProp(target, storedAnnotationsSymbol, _extends({}, target[storedAnnotationsSymbol]));\n }\n return target[storedAnnotationsSymbol];\n}\nfunction is20223Decorator(context) {\n return typeof context == \"object\" && typeof context[\"kind\"] == \"string\";\n}\nfunction assert20223DecoratorType(context, types) {\n if ( true && !types.includes(context.kind)) {\n die(\"The decorator applied to '\" + String(context.name) + \"' cannot be used on a \" + context.kind + \" element\");\n }\n}\n\nvar $mobx = /*#__PURE__*/Symbol(\"mobx administration\");\nvar Atom = /*#__PURE__*/function () {\n /**\n * Create a new atom. For debugging purposes it is recommended to give it a name.\n * The onBecomeObserved and onBecomeUnobserved callbacks can be used for resource management.\n */\n function Atom(name_) {\n if (name_ === void 0) {\n name_ = true ? \"Atom@\" + getNextId() : 0;\n }\n this.name_ = void 0;\n this.flags_ = 0;\n this.observers_ = new Set();\n this.lastAccessedBy_ = 0;\n this.lowestObserverState_ = IDerivationState_.NOT_TRACKING_;\n // onBecomeObservedListeners\n this.onBOL = void 0;\n // onBecomeUnobservedListeners\n this.onBUOL = void 0;\n this.name_ = name_;\n }\n // for effective unobserving. BaseAtom has true, for extra optimization, so its onBecomeUnobserved never gets called, because it's not needed\n var _proto = Atom.prototype;\n _proto.onBO = function onBO() {\n if (this.onBOL) {\n this.onBOL.forEach(function (listener) {\n return listener();\n });\n }\n };\n _proto.onBUO = function onBUO() {\n if (this.onBUOL) {\n this.onBUOL.forEach(function (listener) {\n return listener();\n });\n }\n }\n /**\n * Invoke this method to notify mobx that your atom has been used somehow.\n * Returns true if there is currently a reactive context.\n */;\n _proto.reportObserved = function reportObserved$1() {\n return reportObserved(this);\n }\n /**\n * Invoke this method _after_ this method has changed to signal mobx that all its observers should invalidate.\n */;\n _proto.reportChanged = function reportChanged() {\n startBatch();\n propagateChanged(this);\n endBatch();\n };\n _proto.toString = function toString() {\n return this.name_;\n };\n return _createClass(Atom, [{\n key: \"isBeingObserved\",\n get: function get() {\n return getFlag(this.flags_, Atom.isBeingObservedMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Atom.isBeingObservedMask_, newValue);\n }\n }, {\n key: \"isPendingUnobservation\",\n get: function get() {\n return getFlag(this.flags_, Atom.isPendingUnobservationMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Atom.isPendingUnobservationMask_, newValue);\n }\n }, {\n key: \"diffValue\",\n get: function get() {\n return getFlag(this.flags_, Atom.diffValueMask_) ? 1 : 0;\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Atom.diffValueMask_, newValue === 1 ? true : false);\n }\n }]);\n}();\nAtom.isBeingObservedMask_ = 1;\nAtom.isPendingUnobservationMask_ = 2;\nAtom.diffValueMask_ = 4;\nvar isAtom = /*#__PURE__*/createInstanceofPredicate(\"Atom\", Atom);\nfunction createAtom(name, onBecomeObservedHandler, onBecomeUnobservedHandler) {\n if (onBecomeObservedHandler === void 0) {\n onBecomeObservedHandler = noop;\n }\n if (onBecomeUnobservedHandler === void 0) {\n onBecomeUnobservedHandler = noop;\n }\n var atom = new Atom(name);\n // default `noop` listener will not initialize the hook Set\n if (onBecomeObservedHandler !== noop) {\n onBecomeObserved(atom, onBecomeObservedHandler);\n }\n if (onBecomeUnobservedHandler !== noop) {\n onBecomeUnobserved(atom, onBecomeUnobservedHandler);\n }\n return atom;\n}\n\nfunction identityComparer(a, b) {\n return a === b;\n}\nfunction structuralComparer(a, b) {\n return deepEqual(a, b);\n}\nfunction shallowComparer(a, b) {\n return deepEqual(a, b, 1);\n}\nfunction defaultComparer(a, b) {\n if (Object.is) {\n return Object.is(a, b);\n }\n return a === b ? a !== 0 || 1 / a === 1 / b : a !== a && b !== b;\n}\nvar comparer = {\n identity: identityComparer,\n structural: structuralComparer,\n \"default\": defaultComparer,\n shallow: shallowComparer\n};\n\nfunction deepEnhancer(v, _, name) {\n // it is an observable already, done\n if (isObservable(v)) {\n return v;\n }\n // something that can be converted and mutated?\n if (Array.isArray(v)) {\n return observable.array(v, {\n name: name\n });\n }\n if (isPlainObject(v)) {\n return observable.object(v, undefined, {\n name: name\n });\n }\n if (isES6Map(v)) {\n return observable.map(v, {\n name: name\n });\n }\n if (isES6Set(v)) {\n return observable.set(v, {\n name: name\n });\n }\n if (typeof v === \"function\" && !isAction(v) && !isFlow(v)) {\n if (isGenerator(v)) {\n return flow(v);\n } else {\n return autoAction(name, v);\n }\n }\n return v;\n}\nfunction shallowEnhancer(v, _, name) {\n if (v === undefined || v === null) {\n return v;\n }\n if (isObservableObject(v) || isObservableArray(v) || isObservableMap(v) || isObservableSet(v)) {\n return v;\n }\n if (Array.isArray(v)) {\n return observable.array(v, {\n name: name,\n deep: false\n });\n }\n if (isPlainObject(v)) {\n return observable.object(v, undefined, {\n name: name,\n deep: false\n });\n }\n if (isES6Map(v)) {\n return observable.map(v, {\n name: name,\n deep: false\n });\n }\n if (isES6Set(v)) {\n return observable.set(v, {\n name: name,\n deep: false\n });\n }\n if (true) {\n die(\"The shallow modifier / decorator can only used in combination with arrays, objects, maps and sets\");\n }\n}\nfunction referenceEnhancer(newValue) {\n // never turn into an observable\n return newValue;\n}\nfunction refStructEnhancer(v, oldValue) {\n if ( true && isObservable(v)) {\n die(\"observable.struct should not be used with observable values\");\n }\n if (deepEqual(v, oldValue)) {\n return oldValue;\n }\n return v;\n}\n\nvar OVERRIDE = \"override\";\nvar override = /*#__PURE__*/createDecoratorAnnotation({\n annotationType_: OVERRIDE,\n make_: make_,\n extend_: extend_,\n decorate_20223_: decorate_20223_\n});\nfunction isOverride(annotation) {\n return annotation.annotationType_ === OVERRIDE;\n}\nfunction make_(adm, key) {\n // Must not be plain object\n if ( true && adm.isPlainObject_) {\n die(\"Cannot apply '\" + this.annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + this.annotationType_ + \"' cannot be used on plain objects.\"));\n }\n // Must override something\n if ( true && !hasProp(adm.appliedAnnotations_, key)) {\n die(\"'\" + adm.name_ + \".\" + key.toString() + \"' is annotated with '\" + this.annotationType_ + \"', \" + \"but no such annotated member was found on prototype.\");\n }\n return 0 /* MakeResult.Cancel */;\n}\nfunction extend_(adm, key, descriptor, proxyTrap) {\n die(\"'\" + this.annotationType_ + \"' can only be used with 'makeObservable'\");\n}\nfunction decorate_20223_(desc, context) {\n console.warn(\"'\" + this.annotationType_ + \"' cannot be used with decorators - this is a no-op\");\n}\n\nfunction createActionAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$1,\n extend_: extend_$1,\n decorate_20223_: decorate_20223_$1\n };\n}\nfunction make_$1(adm, key, descriptor, source) {\n var _this$options_;\n // bound\n if ((_this$options_ = this.options_) != null && _this$options_.bound) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;\n }\n // own\n if (source === adm.target_) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 2 /* MakeResult.Continue */;\n }\n // prototype\n if (isAction(descriptor.value)) {\n // A prototype could have been annotated already by other constructor,\n // rest of the proto chain must be annotated already\n return 1 /* MakeResult.Break */;\n }\n var actionDescriptor = createActionDescriptor(adm, this, key, descriptor, false);\n defineProperty(source, key, actionDescriptor);\n return 2 /* MakeResult.Continue */;\n}\nfunction extend_$1(adm, key, descriptor, proxyTrap) {\n var actionDescriptor = createActionDescriptor(adm, this, key, descriptor);\n return adm.defineProperty_(key, actionDescriptor, proxyTrap);\n}\nfunction decorate_20223_$1(mthd, context) {\n if (true) {\n assert20223DecoratorType(context, [\"method\", \"field\"]);\n }\n var kind = context.kind,\n name = context.name,\n addInitializer = context.addInitializer;\n var ann = this;\n var _createAction = function _createAction(m) {\n var _ann$options_$name, _ann$options_, _ann$options_$autoAct, _ann$options_2;\n return createAction((_ann$options_$name = (_ann$options_ = ann.options_) == null ? void 0 : _ann$options_.name) != null ? _ann$options_$name : name.toString(), m, (_ann$options_$autoAct = (_ann$options_2 = ann.options_) == null ? void 0 : _ann$options_2.autoAction) != null ? _ann$options_$autoAct : false);\n };\n // Backwards/Legacy behavior, expects makeObservable(this)\n if (kind == \"field\") {\n addInitializer(function () {\n storeAnnotation(this, name, ann);\n });\n return;\n }\n if (kind == \"method\") {\n var _this$options_2;\n if (!isAction(mthd)) {\n mthd = _createAction(mthd);\n }\n if ((_this$options_2 = this.options_) != null && _this$options_2.bound) {\n addInitializer(function () {\n var self = this;\n var bound = self[name].bind(self);\n bound.isMobxAction = true;\n self[name] = bound;\n });\n }\n return mthd;\n }\n die(\"Cannot apply '\" + ann.annotationType_ + \"' to '\" + String(name) + \"' (kind: \" + kind + \"):\" + (\"\\n'\" + ann.annotationType_ + \"' can only be used on properties with a function value.\"));\n}\nfunction assertActionDescriptor(adm, _ref, key, _ref2) {\n var annotationType_ = _ref.annotationType_;\n var value = _ref2.value;\n if ( true && !isFunction(value)) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' can only be used on properties with a function value.\"));\n }\n}\nfunction createActionDescriptor(adm, annotation, key, descriptor,\n// provides ability to disable safeDescriptors for prototypes\nsafeDescriptors) {\n var _annotation$options_, _annotation$options_$, _annotation$options_2, _annotation$options_$2, _annotation$options_3, _annotation$options_4, _adm$proxy_2;\n if (safeDescriptors === void 0) {\n safeDescriptors = globalState.safeDescriptors;\n }\n assertActionDescriptor(adm, annotation, key, descriptor);\n var value = descriptor.value;\n if ((_annotation$options_ = annotation.options_) != null && _annotation$options_.bound) {\n var _adm$proxy_;\n value = value.bind((_adm$proxy_ = adm.proxy_) != null ? _adm$proxy_ : adm.target_);\n }\n return {\n value: createAction((_annotation$options_$ = (_annotation$options_2 = annotation.options_) == null ? void 0 : _annotation$options_2.name) != null ? _annotation$options_$ : key.toString(), value, (_annotation$options_$2 = (_annotation$options_3 = annotation.options_) == null ? void 0 : _annotation$options_3.autoAction) != null ? _annotation$options_$2 : false,\n // https://github.com/mobxjs/mobx/discussions/3140\n (_annotation$options_4 = annotation.options_) != null && _annotation$options_4.bound ? (_adm$proxy_2 = adm.proxy_) != null ? _adm$proxy_2 : adm.target_ : undefined),\n // Non-configurable for classes\n // prevents accidental field redefinition in subclass\n configurable: safeDescriptors ? adm.isPlainObject_ : true,\n // https://github.com/mobxjs/mobx/pull/2641#issuecomment-737292058\n enumerable: false,\n // Non-obsevable, therefore non-writable\n // Also prevents rewriting in subclass constructor\n writable: safeDescriptors ? false : true\n };\n}\n\nfunction createFlowAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$2,\n extend_: extend_$2,\n decorate_20223_: decorate_20223_$2\n };\n}\nfunction make_$2(adm, key, descriptor, source) {\n var _this$options_;\n // own\n if (source === adm.target_) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 2 /* MakeResult.Continue */;\n }\n // prototype\n // bound - must annotate protos to support super.flow()\n if ((_this$options_ = this.options_) != null && _this$options_.bound && (!hasProp(adm.target_, key) || !isFlow(adm.target_[key]))) {\n if (this.extend_(adm, key, descriptor, false) === null) {\n return 0 /* MakeResult.Cancel */;\n }\n }\n if (isFlow(descriptor.value)) {\n // A prototype could have been annotated already by other constructor,\n // rest of the proto chain must be annotated already\n return 1 /* MakeResult.Break */;\n }\n var flowDescriptor = createFlowDescriptor(adm, this, key, descriptor, false, false);\n defineProperty(source, key, flowDescriptor);\n return 2 /* MakeResult.Continue */;\n}\nfunction extend_$2(adm, key, descriptor, proxyTrap) {\n var _this$options_2;\n var flowDescriptor = createFlowDescriptor(adm, this, key, descriptor, (_this$options_2 = this.options_) == null ? void 0 : _this$options_2.bound);\n return adm.defineProperty_(key, flowDescriptor, proxyTrap);\n}\nfunction decorate_20223_$2(mthd, context) {\n var _this$options_3;\n if (true) {\n assert20223DecoratorType(context, [\"method\"]);\n }\n var name = context.name,\n addInitializer = context.addInitializer;\n if (!isFlow(mthd)) {\n mthd = flow(mthd);\n }\n if ((_this$options_3 = this.options_) != null && _this$options_3.bound) {\n addInitializer(function () {\n var self = this;\n var bound = self[name].bind(self);\n bound.isMobXFlow = true;\n self[name] = bound;\n });\n }\n return mthd;\n}\nfunction assertFlowDescriptor(adm, _ref, key, _ref2) {\n var annotationType_ = _ref.annotationType_;\n var value = _ref2.value;\n if ( true && !isFunction(value)) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' can only be used on properties with a generator function value.\"));\n }\n}\nfunction createFlowDescriptor(adm, annotation, key, descriptor, bound,\n// provides ability to disable safeDescriptors for prototypes\nsafeDescriptors) {\n if (safeDescriptors === void 0) {\n safeDescriptors = globalState.safeDescriptors;\n }\n assertFlowDescriptor(adm, annotation, key, descriptor);\n var value = descriptor.value;\n // In case of flow.bound, the descriptor can be from already annotated prototype\n if (!isFlow(value)) {\n value = flow(value);\n }\n if (bound) {\n var _adm$proxy_;\n // We do not keep original function around, so we bind the existing flow\n value = value.bind((_adm$proxy_ = adm.proxy_) != null ? _adm$proxy_ : adm.target_);\n // This is normally set by `flow`, but `bind` returns new function...\n value.isMobXFlow = true;\n }\n return {\n value: value,\n // Non-configurable for classes\n // prevents accidental field redefinition in subclass\n configurable: safeDescriptors ? adm.isPlainObject_ : true,\n // https://github.com/mobxjs/mobx/pull/2641#issuecomment-737292058\n enumerable: false,\n // Non-obsevable, therefore non-writable\n // Also prevents rewriting in subclass constructor\n writable: safeDescriptors ? false : true\n };\n}\n\nfunction createComputedAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$3,\n extend_: extend_$3,\n decorate_20223_: decorate_20223_$3\n };\n}\nfunction make_$3(adm, key, descriptor) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;\n}\nfunction extend_$3(adm, key, descriptor, proxyTrap) {\n assertComputedDescriptor(adm, this, key, descriptor);\n return adm.defineComputedProperty_(key, _extends({}, this.options_, {\n get: descriptor.get,\n set: descriptor.set\n }), proxyTrap);\n}\nfunction decorate_20223_$3(get, context) {\n if (true) {\n assert20223DecoratorType(context, [\"getter\"]);\n }\n var ann = this;\n var key = context.name,\n addInitializer = context.addInitializer;\n addInitializer(function () {\n var adm = asObservableObject(this)[$mobx];\n var options = _extends({}, ann.options_, {\n get: get,\n context: this\n });\n options.name || (options.name = true ? adm.name_ + \".\" + key.toString() : 0);\n adm.values_.set(key, new ComputedValue(options));\n });\n return function () {\n return this[$mobx].getObservablePropValue_(key);\n };\n}\nfunction assertComputedDescriptor(adm, _ref, key, _ref2) {\n var annotationType_ = _ref.annotationType_;\n var get = _ref2.get;\n if ( true && !get) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' can only be used on getter(+setter) properties.\"));\n }\n}\n\nfunction createObservableAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$4,\n extend_: extend_$4,\n decorate_20223_: decorate_20223_$4\n };\n}\nfunction make_$4(adm, key, descriptor) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;\n}\nfunction extend_$4(adm, key, descriptor, proxyTrap) {\n var _this$options_$enhanc, _this$options_;\n assertObservableDescriptor(adm, this, key, descriptor);\n return adm.defineObservableProperty_(key, descriptor.value, (_this$options_$enhanc = (_this$options_ = this.options_) == null ? void 0 : _this$options_.enhancer) != null ? _this$options_$enhanc : deepEnhancer, proxyTrap);\n}\nfunction decorate_20223_$4(desc, context) {\n if (true) {\n if (context.kind === \"field\") {\n throw die(\"Please use `@observable accessor \" + String(context.name) + \"` instead of `@observable \" + String(context.name) + \"`\");\n }\n assert20223DecoratorType(context, [\"accessor\"]);\n }\n var ann = this;\n var kind = context.kind,\n name = context.name;\n // The laziness here is not ideal... It's a workaround to how 2022.3 Decorators are implemented:\n // `addInitializer` callbacks are executed _before_ any accessors are defined (instead of the ideal-for-us right after each).\n // This means that, if we were to do our stuff in an `addInitializer`, we'd attempt to read a private slot\n // before it has been initialized. The runtime doesn't like that and throws a `Cannot read private member\n // from an object whose class did not declare it` error.\n // TODO: it seems that this will not be required anymore in the final version of the spec\n // See TODO: link\n var initializedObjects = new WeakSet();\n function initializeObservable(target, value) {\n var _ann$options_$enhance, _ann$options_;\n var adm = asObservableObject(target)[$mobx];\n var observable = new ObservableValue(value, (_ann$options_$enhance = (_ann$options_ = ann.options_) == null ? void 0 : _ann$options_.enhancer) != null ? _ann$options_$enhance : deepEnhancer, true ? adm.name_ + \".\" + name.toString() : 0, false);\n adm.values_.set(name, observable);\n initializedObjects.add(target);\n }\n if (kind == \"accessor\") {\n return {\n get: function get() {\n if (!initializedObjects.has(this)) {\n initializeObservable(this, desc.get.call(this));\n }\n return this[$mobx].getObservablePropValue_(name);\n },\n set: function set(value) {\n if (!initializedObjects.has(this)) {\n initializeObservable(this, value);\n }\n return this[$mobx].setObservablePropValue_(name, value);\n },\n init: function init(value) {\n if (!initializedObjects.has(this)) {\n initializeObservable(this, value);\n }\n return value;\n }\n };\n }\n return;\n}\nfunction assertObservableDescriptor(adm, _ref, key, descriptor) {\n var annotationType_ = _ref.annotationType_;\n if ( true && !(\"value\" in descriptor)) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' cannot be used on getter/setter properties\"));\n }\n}\n\nvar AUTO = \"true\";\nvar autoAnnotation = /*#__PURE__*/createAutoAnnotation();\nfunction createAutoAnnotation(options) {\n return {\n annotationType_: AUTO,\n options_: options,\n make_: make_$5,\n extend_: extend_$5,\n decorate_20223_: decorate_20223_$5\n };\n}\nfunction make_$5(adm, key, descriptor, source) {\n var _this$options_3, _this$options_4;\n // getter -> computed\n if (descriptor.get) {\n return computed.make_(adm, key, descriptor, source);\n }\n // lone setter -> action setter\n if (descriptor.set) {\n // TODO make action applicable to setter and delegate to action.make_\n var set = createAction(key.toString(), descriptor.set);\n // own\n if (source === adm.target_) {\n return adm.defineProperty_(key, {\n configurable: globalState.safeDescriptors ? adm.isPlainObject_ : true,\n set: set\n }) === null ? 0 /* MakeResult.Cancel */ : 2 /* MakeResult.Continue */;\n }\n // proto\n defineProperty(source, key, {\n configurable: true,\n set: set\n });\n return 2 /* MakeResult.Continue */;\n }\n // function on proto -> autoAction/flow\n if (source !== adm.target_ && typeof descriptor.value === \"function\") {\n var _this$options_2;\n if (isGenerator(descriptor.value)) {\n var _this$options_;\n var flowAnnotation = (_this$options_ = this.options_) != null && _this$options_.autoBind ? flow.bound : flow;\n return flowAnnotation.make_(adm, key, descriptor, source);\n }\n var actionAnnotation = (_this$options_2 = this.options_) != null && _this$options_2.autoBind ? autoAction.bound : autoAction;\n return actionAnnotation.make_(adm, key, descriptor, source);\n }\n // other -> observable\n // Copy props from proto as well, see test:\n // \"decorate should work with Object.create\"\n var observableAnnotation = ((_this$options_3 = this.options_) == null ? void 0 : _this$options_3.deep) === false ? observable.ref : observable;\n // if function respect autoBind option\n if (typeof descriptor.value === \"function\" && (_this$options_4 = this.options_) != null && _this$options_4.autoBind) {\n var _adm$proxy_;\n descriptor.value = descriptor.value.bind((_adm$proxy_ = adm.proxy_) != null ? _adm$proxy_ : adm.target_);\n }\n return observableAnnotation.make_(adm, key, descriptor, source);\n}\nfunction extend_$5(adm, key, descriptor, proxyTrap) {\n var _this$options_5, _this$options_6;\n // getter -> computed\n if (descriptor.get) {\n return computed.extend_(adm, key, descriptor, proxyTrap);\n }\n // lone setter -> action setter\n if (descriptor.set) {\n // TODO make action applicable to setter and delegate to action.extend_\n return adm.defineProperty_(key, {\n configurable: globalState.safeDescriptors ? adm.isPlainObject_ : true,\n set: createAction(key.toString(), descriptor.set)\n }, proxyTrap);\n }\n // other -> observable\n // if function respect autoBind option\n if (typeof descriptor.value === \"function\" && (_this$options_5 = this.options_) != null && _this$options_5.autoBind) {\n var _adm$proxy_2;\n descriptor.value = descriptor.value.bind((_adm$proxy_2 = adm.proxy_) != null ? _adm$proxy_2 : adm.target_);\n }\n var observableAnnotation = ((_this$options_6 = this.options_) == null ? void 0 : _this$options_6.deep) === false ? observable.ref : observable;\n return observableAnnotation.extend_(adm, key, descriptor, proxyTrap);\n}\nfunction decorate_20223_$5(desc, context) {\n die(\"'\" + this.annotationType_ + \"' cannot be used as a decorator\");\n}\n\nvar OBSERVABLE = \"observable\";\nvar OBSERVABLE_REF = \"observable.ref\";\nvar OBSERVABLE_SHALLOW = \"observable.shallow\";\nvar OBSERVABLE_STRUCT = \"observable.struct\";\n// Predefined bags of create observable options, to avoid allocating temporarily option objects\n// in the majority of cases\nvar defaultCreateObservableOptions = {\n deep: true,\n name: undefined,\n defaultDecorator: undefined,\n proxy: true\n};\nObject.freeze(defaultCreateObservableOptions);\nfunction asCreateObservableOptions(thing) {\n return thing || defaultCreateObservableOptions;\n}\nvar observableAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE);\nvar observableRefAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE_REF, {\n enhancer: referenceEnhancer\n});\nvar observableShallowAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE_SHALLOW, {\n enhancer: shallowEnhancer\n});\nvar observableStructAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE_STRUCT, {\n enhancer: refStructEnhancer\n});\nvar observableDecoratorAnnotation = /*#__PURE__*/createDecoratorAnnotation(observableAnnotation);\nfunction getEnhancerFromOptions(options) {\n return options.deep === true ? deepEnhancer : options.deep === false ? referenceEnhancer : getEnhancerFromAnnotation(options.defaultDecorator);\n}\nfunction getAnnotationFromOptions(options) {\n var _options$defaultDecor;\n return options ? (_options$defaultDecor = options.defaultDecorator) != null ? _options$defaultDecor : createAutoAnnotation(options) : undefined;\n}\nfunction getEnhancerFromAnnotation(annotation) {\n var _annotation$options_$, _annotation$options_;\n return !annotation ? deepEnhancer : (_annotation$options_$ = (_annotation$options_ = annotation.options_) == null ? void 0 : _annotation$options_.enhancer) != null ? _annotation$options_$ : deepEnhancer;\n}\n/**\n * Turns an object, array or function into a reactive structure.\n * @param v the value which should become observable.\n */\nfunction createObservable(v, arg2, arg3) {\n // @observable someProp; (2022.3 Decorators)\n if (is20223Decorator(arg2)) {\n return observableAnnotation.decorate_20223_(v, arg2);\n }\n // @observable someProp;\n if (isStringish(arg2)) {\n storeAnnotation(v, arg2, observableAnnotation);\n return;\n }\n // already observable - ignore\n if (isObservable(v)) {\n return v;\n }\n // plain object\n if (isPlainObject(v)) {\n return observable.object(v, arg2, arg3);\n }\n // Array\n if (Array.isArray(v)) {\n return observable.array(v, arg2);\n }\n // Map\n if (isES6Map(v)) {\n return observable.map(v, arg2);\n }\n // Set\n if (isES6Set(v)) {\n return observable.set(v, arg2);\n }\n // other object - ignore\n if (typeof v === \"object\" && v !== null) {\n return v;\n }\n // anything else\n return observable.box(v, arg2);\n}\nassign(createObservable, observableDecoratorAnnotation);\nvar observableFactories = {\n box: function box(value, options) {\n var o = asCreateObservableOptions(options);\n return new ObservableValue(value, getEnhancerFromOptions(o), o.name, true, o.equals);\n },\n array: function array(initialValues, options) {\n var o = asCreateObservableOptions(options);\n return (globalState.useProxies === false || o.proxy === false ? createLegacyArray : createObservableArray)(initialValues, getEnhancerFromOptions(o), o.name);\n },\n map: function map(initialValues, options) {\n var o = asCreateObservableOptions(options);\n return new ObservableMap(initialValues, getEnhancerFromOptions(o), o.name);\n },\n set: function set(initialValues, options) {\n var o = asCreateObservableOptions(options);\n return new ObservableSet(initialValues, getEnhancerFromOptions(o), o.name);\n },\n object: function object(props, decorators, options) {\n return initObservable(function () {\n return extendObservable(globalState.useProxies === false || (options == null ? void 0 : options.proxy) === false ? asObservableObject({}, options) : asDynamicObservableObject({}, options), props, decorators);\n });\n },\n ref: /*#__PURE__*/createDecoratorAnnotation(observableRefAnnotation),\n shallow: /*#__PURE__*/createDecoratorAnnotation(observableShallowAnnotation),\n deep: observableDecoratorAnnotation,\n struct: /*#__PURE__*/createDecoratorAnnotation(observableStructAnnotation)\n};\n// eslint-disable-next-line\nvar observable = /*#__PURE__*/assign(createObservable, observableFactories);\n\nvar COMPUTED = \"computed\";\nvar COMPUTED_STRUCT = \"computed.struct\";\nvar computedAnnotation = /*#__PURE__*/createComputedAnnotation(COMPUTED);\nvar computedStructAnnotation = /*#__PURE__*/createComputedAnnotation(COMPUTED_STRUCT, {\n equals: comparer.structural\n});\n/**\n * Decorator for class properties: @computed get value() { return expr; }.\n * For legacy purposes also invokable as ES5 observable created: `computed(() => expr)`;\n */\nvar computed = function computed(arg1, arg2) {\n if (is20223Decorator(arg2)) {\n // @computed (2022.3 Decorators)\n return computedAnnotation.decorate_20223_(arg1, arg2);\n }\n if (isStringish(arg2)) {\n // @computed\n return storeAnnotation(arg1, arg2, computedAnnotation);\n }\n if (isPlainObject(arg1)) {\n // @computed({ options })\n return createDecoratorAnnotation(createComputedAnnotation(COMPUTED, arg1));\n }\n // computed(expr, options?)\n if (true) {\n if (!isFunction(arg1)) {\n die(\"First argument to `computed` should be an expression.\");\n }\n if (isFunction(arg2)) {\n die(\"A setter as second argument is no longer supported, use `{ set: fn }` option instead\");\n }\n }\n var opts = isPlainObject(arg2) ? arg2 : {};\n opts.get = arg1;\n opts.name || (opts.name = arg1.name || \"\"); /* for generated name */\n return new ComputedValue(opts);\n};\nObject.assign(computed, computedAnnotation);\ncomputed.struct = /*#__PURE__*/createDecoratorAnnotation(computedStructAnnotation);\n\nvar _getDescriptor$config, _getDescriptor;\n// we don't use globalState for these in order to avoid possible issues with multiple\n// mobx versions\nvar currentActionId = 0;\nvar nextActionId = 1;\nvar isFunctionNameConfigurable = (_getDescriptor$config = (_getDescriptor = /*#__PURE__*/getDescriptor(function () {}, \"name\")) == null ? void 0 : _getDescriptor.configurable) != null ? _getDescriptor$config : false;\n// we can safely recycle this object\nvar tmpNameDescriptor = {\n value: \"action\",\n configurable: true,\n writable: false,\n enumerable: false\n};\nfunction createAction(actionName, fn, autoAction, ref) {\n if (autoAction === void 0) {\n autoAction = false;\n }\n if (true) {\n if (!isFunction(fn)) {\n die(\"`action` can only be invoked on functions\");\n }\n if (typeof actionName !== \"string\" || !actionName) {\n die(\"actions should have valid names, got: '\" + actionName + \"'\");\n }\n }\n function res() {\n return executeAction(actionName, autoAction, fn, ref || this, arguments);\n }\n res.isMobxAction = true;\n res.toString = function () {\n return fn.toString();\n };\n if (isFunctionNameConfigurable) {\n tmpNameDescriptor.value = actionName;\n defineProperty(res, \"name\", tmpNameDescriptor);\n }\n return res;\n}\nfunction executeAction(actionName, canRunAsDerivation, fn, scope, args) {\n var runInfo = _startAction(actionName, canRunAsDerivation, scope, args);\n try {\n return fn.apply(scope, args);\n } catch (err) {\n runInfo.error_ = err;\n throw err;\n } finally {\n _endAction(runInfo);\n }\n}\nfunction _startAction(actionName, canRunAsDerivation,\n// true for autoAction\nscope, args) {\n var notifySpy_ = true && isSpyEnabled() && !!actionName;\n var startTime_ = 0;\n if ( true && notifySpy_) {\n startTime_ = Date.now();\n var flattenedArgs = args ? Array.from(args) : EMPTY_ARRAY;\n spyReportStart({\n type: ACTION,\n name: actionName,\n object: scope,\n arguments: flattenedArgs\n });\n }\n var prevDerivation_ = globalState.trackingDerivation;\n var runAsAction = !canRunAsDerivation || !prevDerivation_;\n startBatch();\n var prevAllowStateChanges_ = globalState.allowStateChanges; // by default preserve previous allow\n if (runAsAction) {\n untrackedStart();\n prevAllowStateChanges_ = allowStateChangesStart(true);\n }\n var prevAllowStateReads_ = allowStateReadsStart(true);\n var runInfo = {\n runAsAction_: runAsAction,\n prevDerivation_: prevDerivation_,\n prevAllowStateChanges_: prevAllowStateChanges_,\n prevAllowStateReads_: prevAllowStateReads_,\n notifySpy_: notifySpy_,\n startTime_: startTime_,\n actionId_: nextActionId++,\n parentActionId_: currentActionId\n };\n currentActionId = runInfo.actionId_;\n return runInfo;\n}\nfunction _endAction(runInfo) {\n if (currentActionId !== runInfo.actionId_) {\n die(30);\n }\n currentActionId = runInfo.parentActionId_;\n if (runInfo.error_ !== undefined) {\n globalState.suppressReactionErrors = true;\n }\n allowStateChangesEnd(runInfo.prevAllowStateChanges_);\n allowStateReadsEnd(runInfo.prevAllowStateReads_);\n endBatch();\n if (runInfo.runAsAction_) {\n untrackedEnd(runInfo.prevDerivation_);\n }\n if ( true && runInfo.notifySpy_) {\n spyReportEnd({\n time: Date.now() - runInfo.startTime_\n });\n }\n globalState.suppressReactionErrors = false;\n}\nfunction allowStateChanges(allowStateChanges, func) {\n var prev = allowStateChangesStart(allowStateChanges);\n try {\n return func();\n } finally {\n allowStateChangesEnd(prev);\n }\n}\nfunction allowStateChangesStart(allowStateChanges) {\n var prev = globalState.allowStateChanges;\n globalState.allowStateChanges = allowStateChanges;\n return prev;\n}\nfunction allowStateChangesEnd(prev) {\n globalState.allowStateChanges = prev;\n}\n\nvar CREATE = \"create\";\nvar ObservableValue = /*#__PURE__*/function (_Atom) {\n function ObservableValue(value, enhancer, name_, notifySpy, equals) {\n var _this;\n if (name_ === void 0) {\n name_ = true ? \"ObservableValue@\" + getNextId() : 0;\n }\n if (notifySpy === void 0) {\n notifySpy = true;\n }\n if (equals === void 0) {\n equals = comparer[\"default\"];\n }\n _this = _Atom.call(this, name_) || this;\n _this.enhancer = void 0;\n _this.name_ = void 0;\n _this.equals = void 0;\n _this.hasUnreportedChange_ = false;\n _this.interceptors_ = void 0;\n _this.changeListeners_ = void 0;\n _this.value_ = void 0;\n _this.dehancer = void 0;\n _this.enhancer = enhancer;\n _this.name_ = name_;\n _this.equals = equals;\n _this.value_ = enhancer(value, undefined, name_);\n if ( true && notifySpy && isSpyEnabled()) {\n // only notify spy if this is a stand-alone observable\n spyReport({\n type: CREATE,\n object: _this,\n observableKind: \"value\",\n debugObjectName: _this.name_,\n newValue: \"\" + _this.value_\n });\n }\n return _this;\n }\n _inheritsLoose(ObservableValue, _Atom);\n var _proto = ObservableValue.prototype;\n _proto.dehanceValue = function dehanceValue(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.set = function set(newValue) {\n var oldValue = this.value_;\n newValue = this.prepareNewValue_(newValue);\n if (newValue !== globalState.UNCHANGED) {\n var notifySpy = isSpyEnabled();\n if ( true && notifySpy) {\n spyReportStart({\n type: UPDATE,\n object: this,\n observableKind: \"value\",\n debugObjectName: this.name_,\n newValue: newValue,\n oldValue: oldValue\n });\n }\n this.setNewValue_(newValue);\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n };\n _proto.prepareNewValue_ = function prepareNewValue_(newValue) {\n checkIfStateModificationsAreAllowed(this);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this,\n type: UPDATE,\n newValue: newValue\n });\n if (!change) {\n return globalState.UNCHANGED;\n }\n newValue = change.newValue;\n }\n // apply modifier\n newValue = this.enhancer(newValue, this.value_, this.name_);\n return this.equals(this.value_, newValue) ? globalState.UNCHANGED : newValue;\n };\n _proto.setNewValue_ = function setNewValue_(newValue) {\n var oldValue = this.value_;\n this.value_ = newValue;\n this.reportChanged();\n if (hasListeners(this)) {\n notifyListeners(this, {\n type: UPDATE,\n object: this,\n newValue: newValue,\n oldValue: oldValue\n });\n }\n };\n _proto.get = function get() {\n this.reportObserved();\n return this.dehanceValue(this.value_);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n if (fireImmediately) {\n listener({\n observableKind: \"value\",\n debugObjectName: this.name_,\n object: this,\n type: UPDATE,\n newValue: this.value_,\n oldValue: undefined\n });\n }\n return registerListener(this, listener);\n };\n _proto.raw = function raw() {\n // used by MST ot get undehanced value\n return this.value_;\n };\n _proto.toJSON = function toJSON() {\n return this.get();\n };\n _proto.toString = function toString() {\n return this.name_ + \"[\" + this.value_ + \"]\";\n };\n _proto.valueOf = function valueOf() {\n return toPrimitive(this.get());\n };\n _proto[Symbol.toPrimitive] = function () {\n return this.valueOf();\n };\n return ObservableValue;\n}(Atom);\nvar isObservableValue = /*#__PURE__*/createInstanceofPredicate(\"ObservableValue\", ObservableValue);\n\n/**\n * A node in the state dependency root that observes other nodes, and can be observed itself.\n *\n * ComputedValue will remember the result of the computation for the duration of the batch, or\n * while being observed.\n *\n * During this time it will recompute only when one of its direct dependencies changed,\n * but only when it is being accessed with `ComputedValue.get()`.\n *\n * Implementation description:\n * 1. First time it's being accessed it will compute and remember result\n * give back remembered result until 2. happens\n * 2. First time any deep dependency change, propagate POSSIBLY_STALE to all observers, wait for 3.\n * 3. When it's being accessed, recompute if any shallow dependency changed.\n * if result changed: propagate STALE to all observers, that were POSSIBLY_STALE from the last step.\n * go to step 2. either way\n *\n * If at any point it's outside batch and it isn't observed: reset everything and go to 1.\n */\nvar ComputedValue = /*#__PURE__*/function () {\n /**\n * Create a new computed value based on a function expression.\n *\n * The `name` property is for debug purposes only.\n *\n * The `equals` property specifies the comparer function to use to determine if a newly produced\n * value differs from the previous value. Two comparers are provided in the library; `defaultComparer`\n * compares based on identity comparison (===), and `structuralComparer` deeply compares the structure.\n * Structural comparison can be convenient if you always produce a new aggregated object and\n * don't want to notify observers if it is structurally the same.\n * This is useful for working with vectors, mouse coordinates etc.\n */\n function ComputedValue(options) {\n this.dependenciesState_ = IDerivationState_.NOT_TRACKING_;\n this.observing_ = [];\n // nodes we are looking at. Our value depends on these nodes\n this.newObserving_ = null;\n // during tracking it's an array with new observed observers\n this.observers_ = new Set();\n this.runId_ = 0;\n this.lastAccessedBy_ = 0;\n this.lowestObserverState_ = IDerivationState_.UP_TO_DATE_;\n this.unboundDepsCount_ = 0;\n this.value_ = new CaughtException(null);\n this.name_ = void 0;\n this.triggeredBy_ = void 0;\n this.flags_ = 0;\n this.derivation = void 0;\n // N.B: unminified as it is used by MST\n this.setter_ = void 0;\n this.isTracing_ = TraceMode.NONE;\n this.scope_ = void 0;\n this.equals_ = void 0;\n this.requiresReaction_ = void 0;\n this.keepAlive_ = void 0;\n this.onBOL = void 0;\n this.onBUOL = void 0;\n if (!options.get) {\n die(31);\n }\n this.derivation = options.get;\n this.name_ = options.name || ( true ? \"ComputedValue@\" + getNextId() : 0);\n if (options.set) {\n this.setter_ = createAction( true ? this.name_ + \"-setter\" : 0, options.set);\n }\n this.equals_ = options.equals || (options.compareStructural || options.struct ? comparer.structural : comparer[\"default\"]);\n this.scope_ = options.context;\n this.requiresReaction_ = options.requiresReaction;\n this.keepAlive_ = !!options.keepAlive;\n }\n var _proto = ComputedValue.prototype;\n _proto.onBecomeStale_ = function onBecomeStale_() {\n propagateMaybeChanged(this);\n };\n _proto.onBO = function onBO() {\n if (this.onBOL) {\n this.onBOL.forEach(function (listener) {\n return listener();\n });\n }\n };\n _proto.onBUO = function onBUO() {\n if (this.onBUOL) {\n this.onBUOL.forEach(function (listener) {\n return listener();\n });\n }\n }\n // to check for cycles\n ;\n /**\n * Returns the current value of this computed value.\n * Will evaluate its computation first if needed.\n */\n _proto.get = function get() {\n if (this.isComputing) {\n die(32, this.name_, this.derivation);\n }\n if (globalState.inBatch === 0 &&\n // !globalState.trackingDerivatpion &&\n this.observers_.size === 0 && !this.keepAlive_) {\n if (shouldCompute(this)) {\n this.warnAboutUntrackedRead_();\n startBatch(); // See perf test 'computed memoization'\n this.value_ = this.computeValue_(false);\n endBatch();\n }\n } else {\n reportObserved(this);\n if (shouldCompute(this)) {\n var prevTrackingContext = globalState.trackingContext;\n if (this.keepAlive_ && !prevTrackingContext) {\n globalState.trackingContext = this;\n }\n if (this.trackAndCompute()) {\n propagateChangeConfirmed(this);\n }\n globalState.trackingContext = prevTrackingContext;\n }\n }\n var result = this.value_;\n if (isCaughtException(result)) {\n throw result.cause;\n }\n return result;\n };\n _proto.set = function set(value) {\n if (this.setter_) {\n if (this.isRunningSetter) {\n die(33, this.name_);\n }\n this.isRunningSetter = true;\n try {\n this.setter_.call(this.scope_, value);\n } finally {\n this.isRunningSetter = false;\n }\n } else {\n die(34, this.name_);\n }\n };\n _proto.trackAndCompute = function trackAndCompute() {\n // N.B: unminified as it is used by MST\n var oldValue = this.value_;\n var wasSuspended = /* see #1208 */this.dependenciesState_ === IDerivationState_.NOT_TRACKING_;\n var newValue = this.computeValue_(true);\n var changed = wasSuspended || isCaughtException(oldValue) || isCaughtException(newValue) || !this.equals_(oldValue, newValue);\n if (changed) {\n this.value_ = newValue;\n if ( true && isSpyEnabled()) {\n spyReport({\n observableKind: \"computed\",\n debugObjectName: this.name_,\n object: this.scope_,\n type: \"update\",\n oldValue: oldValue,\n newValue: newValue\n });\n }\n }\n return changed;\n };\n _proto.computeValue_ = function computeValue_(track) {\n this.isComputing = true;\n // don't allow state changes during computation\n var prev = allowStateChangesStart(false);\n var res;\n if (track) {\n res = trackDerivedFunction(this, this.derivation, this.scope_);\n } else {\n if (globalState.disableErrorBoundaries === true) {\n res = this.derivation.call(this.scope_);\n } else {\n try {\n res = this.derivation.call(this.scope_);\n } catch (e) {\n res = new CaughtException(e);\n }\n }\n }\n allowStateChangesEnd(prev);\n this.isComputing = false;\n return res;\n };\n _proto.suspend_ = function suspend_() {\n if (!this.keepAlive_) {\n clearObserving(this);\n this.value_ = undefined; // don't hold on to computed value!\n if ( true && this.isTracing_ !== TraceMode.NONE) {\n console.log(\"[mobx.trace] Computed value '\" + this.name_ + \"' was suspended and it will recompute on the next access.\");\n }\n }\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n var _this = this;\n var firstTime = true;\n var prevValue = undefined;\n return autorun(function () {\n // TODO: why is this in a different place than the spyReport() function? in all other observables it's called in the same place\n var newValue = _this.get();\n if (!firstTime || fireImmediately) {\n var prevU = untrackedStart();\n listener({\n observableKind: \"computed\",\n debugObjectName: _this.name_,\n type: UPDATE,\n object: _this,\n newValue: newValue,\n oldValue: prevValue\n });\n untrackedEnd(prevU);\n }\n firstTime = false;\n prevValue = newValue;\n });\n };\n _proto.warnAboutUntrackedRead_ = function warnAboutUntrackedRead_() {\n if (false) {}\n if (this.isTracing_ !== TraceMode.NONE) {\n console.log(\"[mobx.trace] Computed value '\" + this.name_ + \"' is being read outside a reactive context. Doing a full recompute.\");\n }\n if (typeof this.requiresReaction_ === \"boolean\" ? this.requiresReaction_ : globalState.computedRequiresReaction) {\n console.warn(\"[mobx] Computed value '\" + this.name_ + \"' is being read outside a reactive context. Doing a full recompute.\");\n }\n };\n _proto.toString = function toString() {\n return this.name_ + \"[\" + this.derivation.toString() + \"]\";\n };\n _proto.valueOf = function valueOf() {\n return toPrimitive(this.get());\n };\n _proto[Symbol.toPrimitive] = function () {\n return this.valueOf();\n };\n return _createClass(ComputedValue, [{\n key: \"isComputing\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isComputingMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isComputingMask_, newValue);\n }\n }, {\n key: \"isRunningSetter\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isRunningSetterMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isRunningSetterMask_, newValue);\n }\n }, {\n key: \"isBeingObserved\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isBeingObservedMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isBeingObservedMask_, newValue);\n }\n }, {\n key: \"isPendingUnobservation\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isPendingUnobservationMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isPendingUnobservationMask_, newValue);\n }\n }, {\n key: \"diffValue\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.diffValueMask_) ? 1 : 0;\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.diffValueMask_, newValue === 1 ? true : false);\n }\n }]);\n}();\nComputedValue.isComputingMask_ = 1;\nComputedValue.isRunningSetterMask_ = 2;\nComputedValue.isBeingObservedMask_ = 4;\nComputedValue.isPendingUnobservationMask_ = 8;\nComputedValue.diffValueMask_ = 16;\nvar isComputedValue = /*#__PURE__*/createInstanceofPredicate(\"ComputedValue\", ComputedValue);\n\nvar IDerivationState_;\n(function (IDerivationState_) {\n // before being run or (outside batch and not being observed)\n // at this point derivation is not holding any data about dependency tree\n IDerivationState_[IDerivationState_[\"NOT_TRACKING_\"] = -1] = \"NOT_TRACKING_\";\n // no shallow dependency changed since last computation\n // won't recalculate derivation\n // this is what makes mobx fast\n IDerivationState_[IDerivationState_[\"UP_TO_DATE_\"] = 0] = \"UP_TO_DATE_\";\n // some deep dependency changed, but don't know if shallow dependency changed\n // will require to check first if UP_TO_DATE or POSSIBLY_STALE\n // currently only ComputedValue will propagate POSSIBLY_STALE\n //\n // having this state is second big optimization:\n // don't have to recompute on every dependency change, but only when it's needed\n IDerivationState_[IDerivationState_[\"POSSIBLY_STALE_\"] = 1] = \"POSSIBLY_STALE_\";\n // A shallow dependency has changed since last computation and the derivation\n // will need to recompute when it's needed next.\n IDerivationState_[IDerivationState_[\"STALE_\"] = 2] = \"STALE_\";\n})(IDerivationState_ || (IDerivationState_ = {}));\nvar TraceMode;\n(function (TraceMode) {\n TraceMode[TraceMode[\"NONE\"] = 0] = \"NONE\";\n TraceMode[TraceMode[\"LOG\"] = 1] = \"LOG\";\n TraceMode[TraceMode[\"BREAK\"] = 2] = \"BREAK\";\n})(TraceMode || (TraceMode = {}));\nvar CaughtException = function CaughtException(cause) {\n this.cause = void 0;\n this.cause = cause;\n // Empty\n};\nfunction isCaughtException(e) {\n return e instanceof CaughtException;\n}\n/**\n * Finds out whether any dependency of the derivation has actually changed.\n * If dependenciesState is 1 then it will recalculate dependencies,\n * if any dependency changed it will propagate it by changing dependenciesState to 2.\n *\n * By iterating over the dependencies in the same order that they were reported and\n * stopping on the first change, all the recalculations are only called for ComputedValues\n * that will be tracked by derivation. That is because we assume that if the first x\n * dependencies of the derivation doesn't change then the derivation should run the same way\n * up until accessing x-th dependency.\n */\nfunction shouldCompute(derivation) {\n switch (derivation.dependenciesState_) {\n case IDerivationState_.UP_TO_DATE_:\n return false;\n case IDerivationState_.NOT_TRACKING_:\n case IDerivationState_.STALE_:\n return true;\n case IDerivationState_.POSSIBLY_STALE_:\n {\n // state propagation can occur outside of action/reactive context #2195\n var prevAllowStateReads = allowStateReadsStart(true);\n var prevUntracked = untrackedStart(); // no need for those computeds to be reported, they will be picked up in trackDerivedFunction.\n var obs = derivation.observing_,\n l = obs.length;\n for (var i = 0; i < l; i++) {\n var obj = obs[i];\n if (isComputedValue(obj)) {\n if (globalState.disableErrorBoundaries) {\n obj.get();\n } else {\n try {\n obj.get();\n } catch (e) {\n // we are not interested in the value *or* exception at this moment, but if there is one, notify all\n untrackedEnd(prevUntracked);\n allowStateReadsEnd(prevAllowStateReads);\n return true;\n }\n }\n // if ComputedValue `obj` actually changed it will be computed and propagated to its observers.\n // and `derivation` is an observer of `obj`\n // invariantShouldCompute(derivation)\n if (derivation.dependenciesState_ === IDerivationState_.STALE_) {\n untrackedEnd(prevUntracked);\n allowStateReadsEnd(prevAllowStateReads);\n return true;\n }\n }\n }\n changeDependenciesStateTo0(derivation);\n untrackedEnd(prevUntracked);\n allowStateReadsEnd(prevAllowStateReads);\n return false;\n }\n }\n}\nfunction isComputingDerivation() {\n return globalState.trackingDerivation !== null; // filter out actions inside computations\n}\nfunction checkIfStateModificationsAreAllowed(atom) {\n if (false) {}\n var hasObservers = atom.observers_.size > 0;\n // Should not be possible to change observed state outside strict mode, except during initialization, see #563\n if (!globalState.allowStateChanges && (hasObservers || globalState.enforceActions === \"always\")) {\n console.warn(\"[MobX] \" + (globalState.enforceActions ? \"Since strict-mode is enabled, changing (observed) observable values without using an action is not allowed. Tried to modify: \" : \"Side effects like changing state are not allowed at this point. Are you trying to modify state from, for example, a computed value or the render function of a React component? You can wrap side effects in 'runInAction' (or decorate functions with 'action') if needed. Tried to modify: \") + atom.name_);\n }\n}\nfunction checkIfStateReadsAreAllowed(observable) {\n if ( true && !globalState.allowStateReads && globalState.observableRequiresReaction) {\n console.warn(\"[mobx] Observable '\" + observable.name_ + \"' being read outside a reactive context.\");\n }\n}\n/**\n * Executes the provided function `f` and tracks which observables are being accessed.\n * The tracking information is stored on the `derivation` object and the derivation is registered\n * as observer of any of the accessed observables.\n */\nfunction trackDerivedFunction(derivation, f, context) {\n var prevAllowStateReads = allowStateReadsStart(true);\n changeDependenciesStateTo0(derivation);\n // Preallocate array; will be trimmed by bindDependencies.\n derivation.newObserving_ = new Array(\n // Reserve constant space for initial dependencies, dynamic space otherwise.\n // See https://github.com/mobxjs/mobx/pull/3833\n derivation.runId_ === 0 ? 100 : derivation.observing_.length);\n derivation.unboundDepsCount_ = 0;\n derivation.runId_ = ++globalState.runId;\n var prevTracking = globalState.trackingDerivation;\n globalState.trackingDerivation = derivation;\n globalState.inBatch++;\n var result;\n if (globalState.disableErrorBoundaries === true) {\n result = f.call(context);\n } else {\n try {\n result = f.call(context);\n } catch (e) {\n result = new CaughtException(e);\n }\n }\n globalState.inBatch--;\n globalState.trackingDerivation = prevTracking;\n bindDependencies(derivation);\n warnAboutDerivationWithoutDependencies(derivation);\n allowStateReadsEnd(prevAllowStateReads);\n return result;\n}\nfunction warnAboutDerivationWithoutDependencies(derivation) {\n if (false) {}\n if (derivation.observing_.length !== 0) {\n return;\n }\n if (typeof derivation.requiresObservable_ === \"boolean\" ? derivation.requiresObservable_ : globalState.reactionRequiresObservable) {\n console.warn(\"[mobx] Derivation '\" + derivation.name_ + \"' is created/updated without reading any observable value.\");\n }\n}\n/**\n * diffs newObserving with observing.\n * update observing to be newObserving with unique observables\n * notify observers that become observed/unobserved\n */\nfunction bindDependencies(derivation) {\n // invariant(derivation.dependenciesState !== IDerivationState.NOT_TRACKING, \"INTERNAL ERROR bindDependencies expects derivation.dependenciesState !== -1\");\n var prevObserving = derivation.observing_;\n var observing = derivation.observing_ = derivation.newObserving_;\n var lowestNewObservingDerivationState = IDerivationState_.UP_TO_DATE_;\n // Go through all new observables and check diffValue: (this list can contain duplicates):\n // 0: first occurrence, change to 1 and keep it\n // 1: extra occurrence, drop it\n var i0 = 0,\n l = derivation.unboundDepsCount_;\n for (var i = 0; i < l; i++) {\n var dep = observing[i];\n if (dep.diffValue === 0) {\n dep.diffValue = 1;\n if (i0 !== i) {\n observing[i0] = dep;\n }\n i0++;\n }\n // Upcast is 'safe' here, because if dep is IObservable, `dependenciesState` will be undefined,\n // not hitting the condition\n if (dep.dependenciesState_ > lowestNewObservingDerivationState) {\n lowestNewObservingDerivationState = dep.dependenciesState_;\n }\n }\n observing.length = i0;\n derivation.newObserving_ = null; // newObserving shouldn't be needed outside tracking (statement moved down to work around FF bug, see #614)\n // Go through all old observables and check diffValue: (it is unique after last bindDependencies)\n // 0: it's not in new observables, unobserve it\n // 1: it keeps being observed, don't want to notify it. change to 0\n l = prevObserving.length;\n while (l--) {\n var _dep = prevObserving[l];\n if (_dep.diffValue === 0) {\n removeObserver(_dep, derivation);\n }\n _dep.diffValue = 0;\n }\n // Go through all new observables and check diffValue: (now it should be unique)\n // 0: it was set to 0 in last loop. don't need to do anything.\n // 1: it wasn't observed, let's observe it. set back to 0\n while (i0--) {\n var _dep2 = observing[i0];\n if (_dep2.diffValue === 1) {\n _dep2.diffValue = 0;\n addObserver(_dep2, derivation);\n }\n }\n // Some new observed derivations may become stale during this derivation computation\n // so they have had no chance to propagate staleness (#916)\n if (lowestNewObservingDerivationState !== IDerivationState_.UP_TO_DATE_) {\n derivation.dependenciesState_ = lowestNewObservingDerivationState;\n derivation.onBecomeStale_();\n }\n}\nfunction clearObserving(derivation) {\n // invariant(globalState.inBatch > 0, \"INTERNAL ERROR clearObserving should be called only inside batch\");\n var obs = derivation.observing_;\n derivation.observing_ = [];\n var i = obs.length;\n while (i--) {\n removeObserver(obs[i], derivation);\n }\n derivation.dependenciesState_ = IDerivationState_.NOT_TRACKING_;\n}\nfunction untracked(action) {\n var prev = untrackedStart();\n try {\n return action();\n } finally {\n untrackedEnd(prev);\n }\n}\nfunction untrackedStart() {\n var prev = globalState.trackingDerivation;\n globalState.trackingDerivation = null;\n return prev;\n}\nfunction untrackedEnd(prev) {\n globalState.trackingDerivation = prev;\n}\nfunction allowStateReadsStart(allowStateReads) {\n var prev = globalState.allowStateReads;\n globalState.allowStateReads = allowStateReads;\n return prev;\n}\nfunction allowStateReadsEnd(prev) {\n globalState.allowStateReads = prev;\n}\n/**\n * needed to keep `lowestObserverState` correct. when changing from (2 or 1) to 0\n *\n */\nfunction changeDependenciesStateTo0(derivation) {\n if (derivation.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {\n return;\n }\n derivation.dependenciesState_ = IDerivationState_.UP_TO_DATE_;\n var obs = derivation.observing_;\n var i = obs.length;\n while (i--) {\n obs[i].lowestObserverState_ = IDerivationState_.UP_TO_DATE_;\n }\n}\n\n/**\n * These values will persist if global state is reset\n */\nvar persistentKeys = [\"mobxGuid\", \"spyListeners\", \"enforceActions\", \"computedRequiresReaction\", \"reactionRequiresObservable\", \"observableRequiresReaction\", \"allowStateReads\", \"disableErrorBoundaries\", \"runId\", \"UNCHANGED\", \"useProxies\"];\nvar MobXGlobals = function MobXGlobals() {\n /**\n * MobXGlobals version.\n * MobX compatiblity with other versions loaded in memory as long as this version matches.\n * It indicates that the global state still stores similar information\n *\n * N.B: this version is unrelated to the package version of MobX, and is only the version of the\n * internal state storage of MobX, and can be the same across many different package versions\n */\n this.version = 6;\n /**\n * globally unique token to signal unchanged\n */\n this.UNCHANGED = {};\n /**\n * Currently running derivation\n */\n this.trackingDerivation = null;\n /**\n * Currently running reaction. This determines if we currently have a reactive context.\n * (Tracking derivation is also set for temporal tracking of computed values inside actions,\n * but trackingReaction can only be set by a form of Reaction)\n */\n this.trackingContext = null;\n /**\n * Each time a derivation is tracked, it is assigned a unique run-id\n */\n this.runId = 0;\n /**\n * 'guid' for general purpose. Will be persisted amongst resets.\n */\n this.mobxGuid = 0;\n /**\n * Are we in a batch block? (and how many of them)\n */\n this.inBatch = 0;\n /**\n * Observables that don't have observers anymore, and are about to be\n * suspended, unless somebody else accesses it in the same batch\n *\n * @type {IObservable[]}\n */\n this.pendingUnobservations = [];\n /**\n * List of scheduled, not yet executed, reactions.\n */\n this.pendingReactions = [];\n /**\n * Are we currently processing reactions?\n */\n this.isRunningReactions = false;\n /**\n * Is it allowed to change observables at this point?\n * In general, MobX doesn't allow that when running computations and React.render.\n * To ensure that those functions stay pure.\n */\n this.allowStateChanges = false;\n /**\n * Is it allowed to read observables at this point?\n * Used to hold the state needed for `observableRequiresReaction`\n */\n this.allowStateReads = true;\n /**\n * If strict mode is enabled, state changes are by default not allowed\n */\n this.enforceActions = true;\n /**\n * Spy callbacks\n */\n this.spyListeners = [];\n /**\n * Globally attached error handlers that react specifically to errors in reactions\n */\n this.globalReactionErrorHandlers = [];\n /**\n * Warn if computed values are accessed outside a reactive context\n */\n this.computedRequiresReaction = false;\n /**\n * (Experimental)\n * Warn if you try to create to derivation / reactive context without accessing any observable.\n */\n this.reactionRequiresObservable = false;\n /**\n * (Experimental)\n * Warn if observables are accessed outside a reactive context\n */\n this.observableRequiresReaction = false;\n /*\n * Don't catch and rethrow exceptions. This is useful for inspecting the state of\n * the stack when an exception occurs while debugging.\n */\n this.disableErrorBoundaries = false;\n /*\n * If true, we are already handling an exception in an action. Any errors in reactions should be suppressed, as\n * they are not the cause, see: https://github.com/mobxjs/mobx/issues/1836\n */\n this.suppressReactionErrors = false;\n this.useProxies = true;\n /*\n * print warnings about code that would fail if proxies weren't available\n */\n this.verifyProxies = false;\n /**\n * False forces all object's descriptors to\n * writable: true\n * configurable: true\n */\n this.safeDescriptors = true;\n};\nvar canMergeGlobalState = true;\nvar isolateCalled = false;\nvar globalState = /*#__PURE__*/function () {\n var global = /*#__PURE__*/getGlobal();\n if (global.__mobxInstanceCount > 0 && !global.__mobxGlobals) {\n canMergeGlobalState = false;\n }\n if (global.__mobxGlobals && global.__mobxGlobals.version !== new MobXGlobals().version) {\n canMergeGlobalState = false;\n }\n if (!canMergeGlobalState) {\n // Because this is a IIFE we need to let isolateCalled a chance to change\n // so we run it after the event loop completed at least 1 iteration\n setTimeout(function () {\n if (!isolateCalled) {\n die(35);\n }\n }, 1);\n return new MobXGlobals();\n } else if (global.__mobxGlobals) {\n global.__mobxInstanceCount += 1;\n if (!global.__mobxGlobals.UNCHANGED) {\n global.__mobxGlobals.UNCHANGED = {};\n } // make merge backward compatible\n return global.__mobxGlobals;\n } else {\n global.__mobxInstanceCount = 1;\n return global.__mobxGlobals = /*#__PURE__*/new MobXGlobals();\n }\n}();\nfunction isolateGlobalState() {\n if (globalState.pendingReactions.length || globalState.inBatch || globalState.isRunningReactions) {\n die(36);\n }\n isolateCalled = true;\n if (canMergeGlobalState) {\n var global = getGlobal();\n if (--global.__mobxInstanceCount === 0) {\n global.__mobxGlobals = undefined;\n }\n globalState = new MobXGlobals();\n }\n}\nfunction getGlobalState() {\n return globalState;\n}\n/**\n * For testing purposes only; this will break the internal state of existing observables,\n * but can be used to get back at a stable state after throwing errors\n */\nfunction resetGlobalState() {\n var defaultGlobals = new MobXGlobals();\n for (var key in defaultGlobals) {\n if (persistentKeys.indexOf(key) === -1) {\n globalState[key] = defaultGlobals[key];\n }\n }\n globalState.allowStateChanges = !globalState.enforceActions;\n}\n\nfunction hasObservers(observable) {\n return observable.observers_ && observable.observers_.size > 0;\n}\nfunction getObservers(observable) {\n return observable.observers_;\n}\n// function invariantObservers(observable: IObservable) {\n// const list = observable.observers\n// const map = observable.observersIndexes\n// const l = list.length\n// for (let i = 0; i < l; i++) {\n// const id = list[i].__mapid\n// if (i) {\n// invariant(map[id] === i, \"INTERNAL ERROR maps derivation.__mapid to index in list\") // for performance\n// } else {\n// invariant(!(id in map), \"INTERNAL ERROR observer on index 0 shouldn't be held in map.\") // for performance\n// }\n// }\n// invariant(\n// list.length === 0 || Object.keys(map).length === list.length - 1,\n// \"INTERNAL ERROR there is no junk in map\"\n// )\n// }\nfunction addObserver(observable, node) {\n // invariant(node.dependenciesState !== -1, \"INTERNAL ERROR, can add only dependenciesState !== -1\");\n // invariant(observable._observers.indexOf(node) === -1, \"INTERNAL ERROR add already added node\");\n // invariantObservers(observable);\n observable.observers_.add(node);\n if (observable.lowestObserverState_ > node.dependenciesState_) {\n observable.lowestObserverState_ = node.dependenciesState_;\n }\n // invariantObservers(observable);\n // invariant(observable._observers.indexOf(node) !== -1, \"INTERNAL ERROR didn't add node\");\n}\nfunction removeObserver(observable, node) {\n // invariant(globalState.inBatch > 0, \"INTERNAL ERROR, remove should be called only inside batch\");\n // invariant(observable._observers.indexOf(node) !== -1, \"INTERNAL ERROR remove already removed node\");\n // invariantObservers(observable);\n observable.observers_[\"delete\"](node);\n if (observable.observers_.size === 0) {\n // deleting last observer\n queueForUnobservation(observable);\n }\n // invariantObservers(observable);\n // invariant(observable._observers.indexOf(node) === -1, \"INTERNAL ERROR remove already removed node2\");\n}\nfunction queueForUnobservation(observable) {\n if (observable.isPendingUnobservation === false) {\n // invariant(observable._observers.length === 0, \"INTERNAL ERROR, should only queue for unobservation unobserved observables\");\n observable.isPendingUnobservation = true;\n globalState.pendingUnobservations.push(observable);\n }\n}\n/**\n * Batch starts a transaction, at least for purposes of memoizing ComputedValues when nothing else does.\n * During a batch `onBecomeUnobserved` will be called at most once per observable.\n * Avoids unnecessary recalculations.\n */\nfunction startBatch() {\n globalState.inBatch++;\n}\nfunction endBatch() {\n if (--globalState.inBatch === 0) {\n runReactions();\n // the batch is actually about to finish, all unobserving should happen here.\n var list = globalState.pendingUnobservations;\n for (var i = 0; i < list.length; i++) {\n var observable = list[i];\n observable.isPendingUnobservation = false;\n if (observable.observers_.size === 0) {\n if (observable.isBeingObserved) {\n // if this observable had reactive observers, trigger the hooks\n observable.isBeingObserved = false;\n observable.onBUO();\n }\n if (observable instanceof ComputedValue) {\n // computed values are automatically teared down when the last observer leaves\n // this process happens recursively, this computed might be the last observabe of another, etc..\n observable.suspend_();\n }\n }\n }\n globalState.pendingUnobservations = [];\n }\n}\nfunction reportObserved(observable) {\n checkIfStateReadsAreAllowed(observable);\n var derivation = globalState.trackingDerivation;\n if (derivation !== null) {\n /**\n * Simple optimization, give each derivation run an unique id (runId)\n * Check if last time this observable was accessed the same runId is used\n * if this is the case, the relation is already known\n */\n if (derivation.runId_ !== observable.lastAccessedBy_) {\n observable.lastAccessedBy_ = derivation.runId_;\n // Tried storing newObserving, or observing, or both as Set, but performance didn't come close...\n derivation.newObserving_[derivation.unboundDepsCount_++] = observable;\n if (!observable.isBeingObserved && globalState.trackingContext) {\n observable.isBeingObserved = true;\n observable.onBO();\n }\n }\n return observable.isBeingObserved;\n } else if (observable.observers_.size === 0 && globalState.inBatch > 0) {\n queueForUnobservation(observable);\n }\n return false;\n}\n// function invariantLOS(observable: IObservable, msg: string) {\n// // it's expensive so better not run it in produciton. but temporarily helpful for testing\n// const min = getObservers(observable).reduce((a, b) => Math.min(a, b.dependenciesState), 2)\n// if (min >= observable.lowestObserverState) return // <- the only assumption about `lowestObserverState`\n// throw new Error(\n// \"lowestObserverState is wrong for \" +\n// msg +\n// \" because \" +\n// min +\n// \" < \" +\n// observable.lowestObserverState\n// )\n// }\n/**\n * NOTE: current propagation mechanism will in case of self reruning autoruns behave unexpectedly\n * It will propagate changes to observers from previous run\n * It's hard or maybe impossible (with reasonable perf) to get it right with current approach\n * Hopefully self reruning autoruns aren't a feature people should depend on\n * Also most basic use cases should be ok\n */\n// Called by Atom when its value changes\nfunction propagateChanged(observable) {\n // invariantLOS(observable, \"changed start\");\n if (observable.lowestObserverState_ === IDerivationState_.STALE_) {\n return;\n }\n observable.lowestObserverState_ = IDerivationState_.STALE_;\n // Ideally we use for..of here, but the downcompiled version is really slow...\n observable.observers_.forEach(function (d) {\n if (d.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {\n if ( true && d.isTracing_ !== TraceMode.NONE) {\n logTraceInfo(d, observable);\n }\n d.onBecomeStale_();\n }\n d.dependenciesState_ = IDerivationState_.STALE_;\n });\n // invariantLOS(observable, \"changed end\");\n}\n// Called by ComputedValue when it recalculate and its value changed\nfunction propagateChangeConfirmed(observable) {\n // invariantLOS(observable, \"confirmed start\");\n if (observable.lowestObserverState_ === IDerivationState_.STALE_) {\n return;\n }\n observable.lowestObserverState_ = IDerivationState_.STALE_;\n observable.observers_.forEach(function (d) {\n if (d.dependenciesState_ === IDerivationState_.POSSIBLY_STALE_) {\n d.dependenciesState_ = IDerivationState_.STALE_;\n if ( true && d.isTracing_ !== TraceMode.NONE) {\n logTraceInfo(d, observable);\n }\n } else if (d.dependenciesState_ === IDerivationState_.UP_TO_DATE_ // this happens during computing of `d`, just keep lowestObserverState up to date.\n ) {\n observable.lowestObserverState_ = IDerivationState_.UP_TO_DATE_;\n }\n });\n // invariantLOS(observable, \"confirmed end\");\n}\n// Used by computed when its dependency changed, but we don't wan't to immediately recompute.\nfunction propagateMaybeChanged(observable) {\n // invariantLOS(observable, \"maybe start\");\n if (observable.lowestObserverState_ !== IDerivationState_.UP_TO_DATE_) {\n return;\n }\n observable.lowestObserverState_ = IDerivationState_.POSSIBLY_STALE_;\n observable.observers_.forEach(function (d) {\n if (d.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {\n d.dependenciesState_ = IDerivationState_.POSSIBLY_STALE_;\n d.onBecomeStale_();\n }\n });\n // invariantLOS(observable, \"maybe end\");\n}\nfunction logTraceInfo(derivation, observable) {\n console.log(\"[mobx.trace] '\" + derivation.name_ + \"' is invalidated due to a change in: '\" + observable.name_ + \"'\");\n if (derivation.isTracing_ === TraceMode.BREAK) {\n var lines = [];\n printDepTree(getDependencyTree(derivation), lines, 1);\n // prettier-ignore\n new Function(\"debugger;\\n/*\\nTracing '\" + derivation.name_ + \"'\\n\\nYou are entering this break point because derivation '\" + derivation.name_ + \"' is being traced and '\" + observable.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\" + (derivation instanceof ComputedValue ? derivation.derivation.toString().replace(/[*]\\//g, \"/\") : \"\") + \"\\n\\nThe dependencies for this derivation are:\\n\\n\" + lines.join(\"\\n\") + \"\\n*/\\n \")();\n }\n}\nfunction printDepTree(tree, lines, depth) {\n if (lines.length >= 1000) {\n lines.push(\"(and many more)\");\n return;\n }\n lines.push(\"\" + \"\\t\".repeat(depth - 1) + tree.name);\n if (tree.dependencies) {\n tree.dependencies.forEach(function (child) {\n return printDepTree(child, lines, depth + 1);\n });\n }\n}\n\nvar Reaction = /*#__PURE__*/function () {\n function Reaction(name_, onInvalidate_, errorHandler_, requiresObservable_) {\n if (name_ === void 0) {\n name_ = true ? \"Reaction@\" + getNextId() : 0;\n }\n this.name_ = void 0;\n this.onInvalidate_ = void 0;\n this.errorHandler_ = void 0;\n this.requiresObservable_ = void 0;\n this.observing_ = [];\n // nodes we are looking at. Our value depends on these nodes\n this.newObserving_ = [];\n this.dependenciesState_ = IDerivationState_.NOT_TRACKING_;\n this.runId_ = 0;\n this.unboundDepsCount_ = 0;\n this.flags_ = 0;\n this.isTracing_ = TraceMode.NONE;\n this.name_ = name_;\n this.onInvalidate_ = onInvalidate_;\n this.errorHandler_ = errorHandler_;\n this.requiresObservable_ = requiresObservable_;\n }\n var _proto = Reaction.prototype;\n _proto.onBecomeStale_ = function onBecomeStale_() {\n this.schedule_();\n };\n _proto.schedule_ = function schedule_() {\n if (!this.isScheduled) {\n this.isScheduled = true;\n globalState.pendingReactions.push(this);\n runReactions();\n }\n }\n /**\n * internal, use schedule() if you intend to kick off a reaction\n */;\n _proto.runReaction_ = function runReaction_() {\n if (!this.isDisposed) {\n startBatch();\n this.isScheduled = false;\n var prev = globalState.trackingContext;\n globalState.trackingContext = this;\n if (shouldCompute(this)) {\n this.isTrackPending = true;\n try {\n this.onInvalidate_();\n if ( true && this.isTrackPending && isSpyEnabled()) {\n // onInvalidate didn't trigger track right away..\n spyReport({\n name: this.name_,\n type: \"scheduled-reaction\"\n });\n }\n } catch (e) {\n this.reportExceptionInDerivation_(e);\n }\n }\n globalState.trackingContext = prev;\n endBatch();\n }\n };\n _proto.track = function track(fn) {\n if (this.isDisposed) {\n return;\n // console.warn(\"Reaction already disposed\") // Note: Not a warning / error in mobx 4 either\n }\n startBatch();\n var notify = isSpyEnabled();\n var startTime;\n if ( true && notify) {\n startTime = Date.now();\n spyReportStart({\n name: this.name_,\n type: \"reaction\"\n });\n }\n this.isRunning = true;\n var prevReaction = globalState.trackingContext; // reactions could create reactions...\n globalState.trackingContext = this;\n var result = trackDerivedFunction(this, fn, undefined);\n globalState.trackingContext = prevReaction;\n this.isRunning = false;\n this.isTrackPending = false;\n if (this.isDisposed) {\n // disposed during last run. Clean up everything that was bound after the dispose call.\n clearObserving(this);\n }\n if (isCaughtException(result)) {\n this.reportExceptionInDerivation_(result.cause);\n }\n if ( true && notify) {\n spyReportEnd({\n time: Date.now() - startTime\n });\n }\n endBatch();\n };\n _proto.reportExceptionInDerivation_ = function reportExceptionInDerivation_(error) {\n var _this = this;\n if (this.errorHandler_) {\n this.errorHandler_(error, this);\n return;\n }\n if (globalState.disableErrorBoundaries) {\n throw error;\n }\n var message = true ? \"[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '\" + this + \"'\" : 0;\n if (!globalState.suppressReactionErrors) {\n console.error(message, error);\n /** If debugging brought you here, please, read the above message :-). Tnx! */\n } else if (true) {\n console.warn(\"[mobx] (error in reaction '\" + this.name_ + \"' suppressed, fix error of causing action below)\");\n } // prettier-ignore\n if ( true && isSpyEnabled()) {\n spyReport({\n type: \"error\",\n name: this.name_,\n message: message,\n error: \"\" + error\n });\n }\n globalState.globalReactionErrorHandlers.forEach(function (f) {\n return f(error, _this);\n });\n };\n _proto.dispose = function dispose() {\n if (!this.isDisposed) {\n this.isDisposed = true;\n if (!this.isRunning) {\n // if disposed while running, clean up later. Maybe not optimal, but rare case\n startBatch();\n clearObserving(this);\n endBatch();\n }\n }\n };\n _proto.getDisposer_ = function getDisposer_(abortSignal) {\n var _this2 = this;\n var dispose = function dispose() {\n _this2.dispose();\n abortSignal == null || abortSignal.removeEventListener == null || abortSignal.removeEventListener(\"abort\", dispose);\n };\n abortSignal == null || abortSignal.addEventListener == null || abortSignal.addEventListener(\"abort\", dispose);\n dispose[$mobx] = this;\n return dispose;\n };\n _proto.toString = function toString() {\n return \"Reaction[\" + this.name_ + \"]\";\n };\n _proto.trace = function trace$1(enterBreakPoint) {\n if (enterBreakPoint === void 0) {\n enterBreakPoint = false;\n }\n trace(this, enterBreakPoint);\n };\n return _createClass(Reaction, [{\n key: \"isDisposed\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isDisposedMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isDisposedMask_, newValue);\n }\n }, {\n key: \"isScheduled\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isScheduledMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isScheduledMask_, newValue);\n }\n }, {\n key: \"isTrackPending\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isTrackPendingMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isTrackPendingMask_, newValue);\n }\n }, {\n key: \"isRunning\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isRunningMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isRunningMask_, newValue);\n }\n }, {\n key: \"diffValue\",\n get: function get() {\n return getFlag(this.flags_, Reaction.diffValueMask_) ? 1 : 0;\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.diffValueMask_, newValue === 1 ? true : false);\n }\n }]);\n}();\nReaction.isDisposedMask_ = 1;\nReaction.isScheduledMask_ = 2;\nReaction.isTrackPendingMask_ = 4;\nReaction.isRunningMask_ = 8;\nReaction.diffValueMask_ = 16;\nfunction onReactionError(handler) {\n globalState.globalReactionErrorHandlers.push(handler);\n return function () {\n var idx = globalState.globalReactionErrorHandlers.indexOf(handler);\n if (idx >= 0) {\n globalState.globalReactionErrorHandlers.splice(idx, 1);\n }\n };\n}\n/**\n * Magic number alert!\n * Defines within how many times a reaction is allowed to re-trigger itself\n * until it is assumed that this is gonna be a never ending loop...\n */\nvar MAX_REACTION_ITERATIONS = 100;\nvar reactionScheduler = function reactionScheduler(f) {\n return f();\n};\nfunction runReactions() {\n // Trampolining, if runReactions are already running, new reactions will be picked up\n if (globalState.inBatch > 0 || globalState.isRunningReactions) {\n return;\n }\n reactionScheduler(runReactionsHelper);\n}\nfunction runReactionsHelper() {\n globalState.isRunningReactions = true;\n var allReactions = globalState.pendingReactions;\n var iterations = 0;\n // While running reactions, new reactions might be triggered.\n // Hence we work with two variables and check whether\n // we converge to no remaining reactions after a while.\n while (allReactions.length > 0) {\n if (++iterations === MAX_REACTION_ITERATIONS) {\n console.error( true ? \"Reaction doesn't converge to a stable state after \" + MAX_REACTION_ITERATIONS + \" iterations.\" + (\" Probably there is a cycle in the reactive function: \" + allReactions[0]) : 0);\n allReactions.splice(0); // clear reactions\n }\n var remainingReactions = allReactions.splice(0);\n for (var i = 0, l = remainingReactions.length; i < l; i++) {\n remainingReactions[i].runReaction_();\n }\n }\n globalState.isRunningReactions = false;\n}\nvar isReaction = /*#__PURE__*/createInstanceofPredicate(\"Reaction\", Reaction);\nfunction setReactionScheduler(fn) {\n var baseScheduler = reactionScheduler;\n reactionScheduler = function reactionScheduler(f) {\n return fn(function () {\n return baseScheduler(f);\n });\n };\n}\n\nfunction isSpyEnabled() {\n return true && !!globalState.spyListeners.length;\n}\nfunction spyReport(event) {\n if (false) {} // dead code elimination can do the rest\n if (!globalState.spyListeners.length) {\n return;\n }\n var listeners = globalState.spyListeners;\n for (var i = 0, l = listeners.length; i < l; i++) {\n listeners[i](event);\n }\n}\nfunction spyReportStart(event) {\n if (false) {}\n var change = _extends({}, event, {\n spyReportStart: true\n });\n spyReport(change);\n}\nvar END_EVENT = {\n type: \"report-end\",\n spyReportEnd: true\n};\nfunction spyReportEnd(change) {\n if (false) {}\n if (change) {\n spyReport(_extends({}, change, {\n type: \"report-end\",\n spyReportEnd: true\n }));\n } else {\n spyReport(END_EVENT);\n }\n}\nfunction spy(listener) {\n if (false) {} else {\n globalState.spyListeners.push(listener);\n return once(function () {\n globalState.spyListeners = globalState.spyListeners.filter(function (l) {\n return l !== listener;\n });\n });\n }\n}\n\nvar ACTION = \"action\";\nvar ACTION_BOUND = \"action.bound\";\nvar AUTOACTION = \"autoAction\";\nvar AUTOACTION_BOUND = \"autoAction.bound\";\nvar DEFAULT_ACTION_NAME = \"\";\nvar actionAnnotation = /*#__PURE__*/createActionAnnotation(ACTION);\nvar actionBoundAnnotation = /*#__PURE__*/createActionAnnotation(ACTION_BOUND, {\n bound: true\n});\nvar autoActionAnnotation = /*#__PURE__*/createActionAnnotation(AUTOACTION, {\n autoAction: true\n});\nvar autoActionBoundAnnotation = /*#__PURE__*/createActionAnnotation(AUTOACTION_BOUND, {\n autoAction: true,\n bound: true\n});\nfunction createActionFactory(autoAction) {\n var res = function action(arg1, arg2) {\n // action(fn() {})\n if (isFunction(arg1)) {\n return createAction(arg1.name || DEFAULT_ACTION_NAME, arg1, autoAction);\n }\n // action(\"name\", fn() {})\n if (isFunction(arg2)) {\n return createAction(arg1, arg2, autoAction);\n }\n // @action (2022.3 Decorators)\n if (is20223Decorator(arg2)) {\n return (autoAction ? autoActionAnnotation : actionAnnotation).decorate_20223_(arg1, arg2);\n }\n // @action\n if (isStringish(arg2)) {\n return storeAnnotation(arg1, arg2, autoAction ? autoActionAnnotation : actionAnnotation);\n }\n // action(\"name\") & @action(\"name\")\n if (isStringish(arg1)) {\n return createDecoratorAnnotation(createActionAnnotation(autoAction ? AUTOACTION : ACTION, {\n name: arg1,\n autoAction: autoAction\n }));\n }\n if (true) {\n die(\"Invalid arguments for `action`\");\n }\n };\n return res;\n}\nvar action = /*#__PURE__*/createActionFactory(false);\nObject.assign(action, actionAnnotation);\nvar autoAction = /*#__PURE__*/createActionFactory(true);\nObject.assign(autoAction, autoActionAnnotation);\naction.bound = /*#__PURE__*/createDecoratorAnnotation(actionBoundAnnotation);\nautoAction.bound = /*#__PURE__*/createDecoratorAnnotation(autoActionBoundAnnotation);\nfunction runInAction(fn) {\n return executeAction(fn.name || DEFAULT_ACTION_NAME, false, fn, this, undefined);\n}\nfunction isAction(thing) {\n return isFunction(thing) && thing.isMobxAction === true;\n}\n\n/**\n * Creates a named reactive view and keeps it alive, so that the view is always\n * updated if one of the dependencies changes, even when the view is not further used by something else.\n * @param view The reactive view\n * @returns disposer function, which can be used to stop the view from being updated in the future.\n */\nfunction autorun(view, opts) {\n var _opts$name, _opts, _opts2, _opts3;\n if (opts === void 0) {\n opts = EMPTY_OBJECT;\n }\n if (true) {\n if (!isFunction(view)) {\n die(\"Autorun expects a function as first argument\");\n }\n if (isAction(view)) {\n die(\"Autorun does not accept actions since actions are untrackable\");\n }\n }\n var name = (_opts$name = (_opts = opts) == null ? void 0 : _opts.name) != null ? _opts$name : true ? view.name || \"Autorun@\" + getNextId() : 0;\n var runSync = !opts.scheduler && !opts.delay;\n var reaction;\n if (runSync) {\n // normal autorun\n reaction = new Reaction(name, function () {\n this.track(reactionRunner);\n }, opts.onError, opts.requiresObservable);\n } else {\n var scheduler = createSchedulerFromOptions(opts);\n // debounced autorun\n var isScheduled = false;\n reaction = new Reaction(name, function () {\n if (!isScheduled) {\n isScheduled = true;\n scheduler(function () {\n isScheduled = false;\n if (!reaction.isDisposed) {\n reaction.track(reactionRunner);\n }\n });\n }\n }, opts.onError, opts.requiresObservable);\n }\n function reactionRunner() {\n view(reaction);\n }\n if (!((_opts2 = opts) != null && (_opts2 = _opts2.signal) != null && _opts2.aborted)) {\n reaction.schedule_();\n }\n return reaction.getDisposer_((_opts3 = opts) == null ? void 0 : _opts3.signal);\n}\nvar run = function run(f) {\n return f();\n};\nfunction createSchedulerFromOptions(opts) {\n return opts.scheduler ? opts.scheduler : opts.delay ? function (f) {\n return setTimeout(f, opts.delay);\n } : run;\n}\nfunction reaction(expression, effect, opts) {\n var _opts$name2, _opts4, _opts5;\n if (opts === void 0) {\n opts = EMPTY_OBJECT;\n }\n if (true) {\n if (!isFunction(expression) || !isFunction(effect)) {\n die(\"First and second argument to reaction should be functions\");\n }\n if (!isPlainObject(opts)) {\n die(\"Third argument of reactions should be an object\");\n }\n }\n var name = (_opts$name2 = opts.name) != null ? _opts$name2 : true ? \"Reaction@\" + getNextId() : 0;\n var effectAction = action(name, opts.onError ? wrapErrorHandler(opts.onError, effect) : effect);\n var runSync = !opts.scheduler && !opts.delay;\n var scheduler = createSchedulerFromOptions(opts);\n var firstTime = true;\n var isScheduled = false;\n var value;\n var equals = opts.compareStructural ? comparer.structural : opts.equals || comparer[\"default\"];\n var r = new Reaction(name, function () {\n if (firstTime || runSync) {\n reactionRunner();\n } else if (!isScheduled) {\n isScheduled = true;\n scheduler(reactionRunner);\n }\n }, opts.onError, opts.requiresObservable);\n function reactionRunner() {\n isScheduled = false;\n if (r.isDisposed) {\n return;\n }\n var changed = false;\n var oldValue = value;\n r.track(function () {\n var nextValue = allowStateChanges(false, function () {\n return expression(r);\n });\n changed = firstTime || !equals(value, nextValue);\n value = nextValue;\n });\n if (firstTime && opts.fireImmediately) {\n effectAction(value, oldValue, r);\n } else if (!firstTime && changed) {\n effectAction(value, oldValue, r);\n }\n firstTime = false;\n }\n if (!((_opts4 = opts) != null && (_opts4 = _opts4.signal) != null && _opts4.aborted)) {\n r.schedule_();\n }\n return r.getDisposer_((_opts5 = opts) == null ? void 0 : _opts5.signal);\n}\nfunction wrapErrorHandler(errorHandler, baseFn) {\n return function () {\n try {\n return baseFn.apply(this, arguments);\n } catch (e) {\n errorHandler.call(this, e);\n }\n };\n}\n\nvar ON_BECOME_OBSERVED = \"onBO\";\nvar ON_BECOME_UNOBSERVED = \"onBUO\";\nfunction onBecomeObserved(thing, arg2, arg3) {\n return interceptHook(ON_BECOME_OBSERVED, thing, arg2, arg3);\n}\nfunction onBecomeUnobserved(thing, arg2, arg3) {\n return interceptHook(ON_BECOME_UNOBSERVED, thing, arg2, arg3);\n}\nfunction interceptHook(hook, thing, arg2, arg3) {\n var atom = typeof arg3 === \"function\" ? getAtom(thing, arg2) : getAtom(thing);\n var cb = isFunction(arg3) ? arg3 : arg2;\n var listenersKey = hook + \"L\";\n if (atom[listenersKey]) {\n atom[listenersKey].add(cb);\n } else {\n atom[listenersKey] = new Set([cb]);\n }\n return function () {\n var hookListeners = atom[listenersKey];\n if (hookListeners) {\n hookListeners[\"delete\"](cb);\n if (hookListeners.size === 0) {\n delete atom[listenersKey];\n }\n }\n };\n}\n\nvar NEVER = \"never\";\nvar ALWAYS = \"always\";\nvar OBSERVED = \"observed\";\n// const IF_AVAILABLE = \"ifavailable\"\nfunction configure(options) {\n if (options.isolateGlobalState === true) {\n isolateGlobalState();\n }\n var useProxies = options.useProxies,\n enforceActions = options.enforceActions;\n if (useProxies !== undefined) {\n globalState.useProxies = useProxies === ALWAYS ? true : useProxies === NEVER ? false : typeof Proxy !== \"undefined\";\n }\n if (useProxies === \"ifavailable\") {\n globalState.verifyProxies = true;\n }\n if (enforceActions !== undefined) {\n var ea = enforceActions === ALWAYS ? ALWAYS : enforceActions === OBSERVED;\n globalState.enforceActions = ea;\n globalState.allowStateChanges = ea === true || ea === ALWAYS ? false : true;\n }\n [\"computedRequiresReaction\", \"reactionRequiresObservable\", \"observableRequiresReaction\", \"disableErrorBoundaries\", \"safeDescriptors\"].forEach(function (key) {\n if (key in options) {\n globalState[key] = !!options[key];\n }\n });\n globalState.allowStateReads = !globalState.observableRequiresReaction;\n if ( true && globalState.disableErrorBoundaries === true) {\n console.warn(\"WARNING: Debug feature only. MobX will NOT recover from errors when `disableErrorBoundaries` is enabled.\");\n }\n if (options.reactionScheduler) {\n setReactionScheduler(options.reactionScheduler);\n }\n}\n\nfunction extendObservable(target, properties, annotations, options) {\n if (true) {\n if (arguments.length > 4) {\n die(\"'extendObservable' expected 2-4 arguments\");\n }\n if (typeof target !== \"object\") {\n die(\"'extendObservable' expects an object as first argument\");\n }\n if (isObservableMap(target)) {\n die(\"'extendObservable' should not be used on maps, use map.merge instead\");\n }\n if (!isPlainObject(properties)) {\n die(\"'extendObservable' only accepts plain objects as second argument\");\n }\n if (isObservable(properties) || isObservable(annotations)) {\n die(\"Extending an object with another observable (object) is not supported\");\n }\n }\n // Pull descriptors first, so we don't have to deal with props added by administration ($mobx)\n var descriptors = getOwnPropertyDescriptors(properties);\n initObservable(function () {\n var adm = asObservableObject(target, options)[$mobx];\n ownKeys(descriptors).forEach(function (key) {\n adm.extend_(key, descriptors[key],\n // must pass \"undefined\" for { key: undefined }\n !annotations ? true : key in annotations ? annotations[key] : true);\n });\n });\n return target;\n}\n\nfunction getDependencyTree(thing, property) {\n return nodeToDependencyTree(getAtom(thing, property));\n}\nfunction nodeToDependencyTree(node) {\n var result = {\n name: node.name_\n };\n if (node.observing_ && node.observing_.length > 0) {\n result.dependencies = unique(node.observing_).map(nodeToDependencyTree);\n }\n return result;\n}\nfunction getObserverTree(thing, property) {\n return nodeToObserverTree(getAtom(thing, property));\n}\nfunction nodeToObserverTree(node) {\n var result = {\n name: node.name_\n };\n if (hasObservers(node)) {\n result.observers = Array.from(getObservers(node)).map(nodeToObserverTree);\n }\n return result;\n}\nfunction unique(list) {\n return Array.from(new Set(list));\n}\n\nvar generatorId = 0;\nfunction FlowCancellationError() {\n this.message = \"FLOW_CANCELLED\";\n}\nFlowCancellationError.prototype = /*#__PURE__*/Object.create(Error.prototype);\nfunction isFlowCancellationError(error) {\n return error instanceof FlowCancellationError;\n}\nvar flowAnnotation = /*#__PURE__*/createFlowAnnotation(\"flow\");\nvar flowBoundAnnotation = /*#__PURE__*/createFlowAnnotation(\"flow.bound\", {\n bound: true\n});\nvar flow = /*#__PURE__*/Object.assign(function flow(arg1, arg2) {\n // @flow (2022.3 Decorators)\n if (is20223Decorator(arg2)) {\n return flowAnnotation.decorate_20223_(arg1, arg2);\n }\n // @flow\n if (isStringish(arg2)) {\n return storeAnnotation(arg1, arg2, flowAnnotation);\n }\n // flow(fn)\n if ( true && arguments.length !== 1) {\n die(\"Flow expects single argument with generator function\");\n }\n var generator = arg1;\n var name = generator.name || \"\";\n // Implementation based on https://github.com/tj/co/blob/master/index.js\n var res = function res() {\n var ctx = this;\n var args = arguments;\n var runId = ++generatorId;\n var gen = action(name + \" - runid: \" + runId + \" - init\", generator).apply(ctx, args);\n var rejector;\n var pendingPromise = undefined;\n var promise = new Promise(function (resolve, reject) {\n var stepId = 0;\n rejector = reject;\n function onFulfilled(res) {\n pendingPromise = undefined;\n var ret;\n try {\n ret = action(name + \" - runid: \" + runId + \" - yield \" + stepId++, gen.next).call(gen, res);\n } catch (e) {\n return reject(e);\n }\n next(ret);\n }\n function onRejected(err) {\n pendingPromise = undefined;\n var ret;\n try {\n ret = action(name + \" - runid: \" + runId + \" - yield \" + stepId++, gen[\"throw\"]).call(gen, err);\n } catch (e) {\n return reject(e);\n }\n next(ret);\n }\n function next(ret) {\n if (isFunction(ret == null ? void 0 : ret.then)) {\n // an async iterator\n ret.then(next, reject);\n return;\n }\n if (ret.done) {\n return resolve(ret.value);\n }\n pendingPromise = Promise.resolve(ret.value);\n return pendingPromise.then(onFulfilled, onRejected);\n }\n onFulfilled(undefined); // kick off the process\n });\n promise.cancel = action(name + \" - runid: \" + runId + \" - cancel\", function () {\n try {\n if (pendingPromise) {\n cancelPromise(pendingPromise);\n }\n // Finally block can return (or yield) stuff..\n var _res = gen[\"return\"](undefined);\n // eat anything that promise would do, it's cancelled!\n var yieldedPromise = Promise.resolve(_res.value);\n yieldedPromise.then(noop, noop);\n cancelPromise(yieldedPromise); // maybe it can be cancelled :)\n // reject our original promise\n rejector(new FlowCancellationError());\n } catch (e) {\n rejector(e); // there could be a throwing finally block\n }\n });\n return promise;\n };\n res.isMobXFlow = true;\n return res;\n}, flowAnnotation);\nflow.bound = /*#__PURE__*/createDecoratorAnnotation(flowBoundAnnotation);\nfunction cancelPromise(promise) {\n if (isFunction(promise.cancel)) {\n promise.cancel();\n }\n}\nfunction flowResult(result) {\n return result; // just tricking TypeScript :)\n}\nfunction isFlow(fn) {\n return (fn == null ? void 0 : fn.isMobXFlow) === true;\n}\n\nfunction interceptReads(thing, propOrHandler, handler) {\n var target;\n if (isObservableMap(thing) || isObservableArray(thing) || isObservableValue(thing)) {\n target = getAdministration(thing);\n } else if (isObservableObject(thing)) {\n if ( true && !isStringish(propOrHandler)) {\n return die(\"InterceptReads can only be used with a specific property, not with an object in general\");\n }\n target = getAdministration(thing, propOrHandler);\n } else if (true) {\n return die(\"Expected observable map, object or array as first array\");\n }\n if ( true && target.dehancer !== undefined) {\n return die(\"An intercept reader was already established\");\n }\n target.dehancer = typeof propOrHandler === \"function\" ? propOrHandler : handler;\n return function () {\n target.dehancer = undefined;\n };\n}\n\nfunction intercept(thing, propOrHandler, handler) {\n if (isFunction(handler)) {\n return interceptProperty(thing, propOrHandler, handler);\n } else {\n return interceptInterceptable(thing, propOrHandler);\n }\n}\nfunction interceptInterceptable(thing, handler) {\n return getAdministration(thing).intercept_(handler);\n}\nfunction interceptProperty(thing, property, handler) {\n return getAdministration(thing, property).intercept_(handler);\n}\n\nfunction _isComputed(value, property) {\n if (property === undefined) {\n return isComputedValue(value);\n }\n if (isObservableObject(value) === false) {\n return false;\n }\n if (!value[$mobx].values_.has(property)) {\n return false;\n }\n var atom = getAtom(value, property);\n return isComputedValue(atom);\n}\nfunction isComputed(value) {\n if ( true && arguments.length > 1) {\n return die(\"isComputed expects only 1 argument. Use isComputedProp to inspect the observability of a property\");\n }\n return _isComputed(value);\n}\nfunction isComputedProp(value, propName) {\n if ( true && !isStringish(propName)) {\n return die(\"isComputed expected a property name as second argument\");\n }\n return _isComputed(value, propName);\n}\n\nfunction _isObservable(value, property) {\n if (!value) {\n return false;\n }\n if (property !== undefined) {\n if ( true && (isObservableMap(value) || isObservableArray(value))) {\n return die(\"isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead.\");\n }\n if (isObservableObject(value)) {\n return value[$mobx].values_.has(property);\n }\n return false;\n }\n // For first check, see #701\n return isObservableObject(value) || !!value[$mobx] || isAtom(value) || isReaction(value) || isComputedValue(value);\n}\nfunction isObservable(value) {\n if ( true && arguments.length !== 1) {\n die(\"isObservable expects only 1 argument. Use isObservableProp to inspect the observability of a property\");\n }\n return _isObservable(value);\n}\nfunction isObservableProp(value, propName) {\n if ( true && !isStringish(propName)) {\n return die(\"expected a property name as second argument\");\n }\n return _isObservable(value, propName);\n}\n\nfunction keys(obj) {\n if (isObservableObject(obj)) {\n return obj[$mobx].keys_();\n }\n if (isObservableMap(obj) || isObservableSet(obj)) {\n return Array.from(obj.keys());\n }\n if (isObservableArray(obj)) {\n return obj.map(function (_, index) {\n return index;\n });\n }\n die(5);\n}\nfunction values(obj) {\n if (isObservableObject(obj)) {\n return keys(obj).map(function (key) {\n return obj[key];\n });\n }\n if (isObservableMap(obj)) {\n return keys(obj).map(function (key) {\n return obj.get(key);\n });\n }\n if (isObservableSet(obj)) {\n return Array.from(obj.values());\n }\n if (isObservableArray(obj)) {\n return obj.slice();\n }\n die(6);\n}\nfunction entries(obj) {\n if (isObservableObject(obj)) {\n return keys(obj).map(function (key) {\n return [key, obj[key]];\n });\n }\n if (isObservableMap(obj)) {\n return keys(obj).map(function (key) {\n return [key, obj.get(key)];\n });\n }\n if (isObservableSet(obj)) {\n return Array.from(obj.entries());\n }\n if (isObservableArray(obj)) {\n return obj.map(function (key, index) {\n return [index, key];\n });\n }\n die(7);\n}\nfunction set(obj, key, value) {\n if (arguments.length === 2 && !isObservableSet(obj)) {\n startBatch();\n var _values = key;\n try {\n for (var _key in _values) {\n set(obj, _key, _values[_key]);\n }\n } finally {\n endBatch();\n }\n return;\n }\n if (isObservableObject(obj)) {\n obj[$mobx].set_(key, value);\n } else if (isObservableMap(obj)) {\n obj.set(key, value);\n } else if (isObservableSet(obj)) {\n obj.add(key);\n } else if (isObservableArray(obj)) {\n if (typeof key !== \"number\") {\n key = parseInt(key, 10);\n }\n if (key < 0) {\n die(\"Invalid index: '\" + key + \"'\");\n }\n startBatch();\n if (key >= obj.length) {\n obj.length = key + 1;\n }\n obj[key] = value;\n endBatch();\n } else {\n die(8);\n }\n}\nfunction remove(obj, key) {\n if (isObservableObject(obj)) {\n obj[$mobx].delete_(key);\n } else if (isObservableMap(obj)) {\n obj[\"delete\"](key);\n } else if (isObservableSet(obj)) {\n obj[\"delete\"](key);\n } else if (isObservableArray(obj)) {\n if (typeof key !== \"number\") {\n key = parseInt(key, 10);\n }\n obj.splice(key, 1);\n } else {\n die(9);\n }\n}\nfunction has(obj, key) {\n if (isObservableObject(obj)) {\n return obj[$mobx].has_(key);\n } else if (isObservableMap(obj)) {\n return obj.has(key);\n } else if (isObservableSet(obj)) {\n return obj.has(key);\n } else if (isObservableArray(obj)) {\n return key >= 0 && key < obj.length;\n }\n die(10);\n}\nfunction get(obj, key) {\n if (!has(obj, key)) {\n return undefined;\n }\n if (isObservableObject(obj)) {\n return obj[$mobx].get_(key);\n } else if (isObservableMap(obj)) {\n return obj.get(key);\n } else if (isObservableArray(obj)) {\n return obj[key];\n }\n die(11);\n}\nfunction apiDefineProperty(obj, key, descriptor) {\n if (isObservableObject(obj)) {\n return obj[$mobx].defineProperty_(key, descriptor);\n }\n die(39);\n}\nfunction apiOwnKeys(obj) {\n if (isObservableObject(obj)) {\n return obj[$mobx].ownKeys_();\n }\n die(38);\n}\n\nfunction observe(thing, propOrCb, cbOrFire, fireImmediately) {\n if (isFunction(cbOrFire)) {\n return observeObservableProperty(thing, propOrCb, cbOrFire, fireImmediately);\n } else {\n return observeObservable(thing, propOrCb, cbOrFire);\n }\n}\nfunction observeObservable(thing, listener, fireImmediately) {\n return getAdministration(thing).observe_(listener, fireImmediately);\n}\nfunction observeObservableProperty(thing, property, listener, fireImmediately) {\n return getAdministration(thing, property).observe_(listener, fireImmediately);\n}\n\nfunction cache(map, key, value) {\n map.set(key, value);\n return value;\n}\nfunction toJSHelper(source, __alreadySeen) {\n if (source == null || typeof source !== \"object\" || source instanceof Date || !isObservable(source)) {\n return source;\n }\n if (isObservableValue(source) || isComputedValue(source)) {\n return toJSHelper(source.get(), __alreadySeen);\n }\n if (__alreadySeen.has(source)) {\n return __alreadySeen.get(source);\n }\n if (isObservableArray(source)) {\n var res = cache(__alreadySeen, source, new Array(source.length));\n source.forEach(function (value, idx) {\n res[idx] = toJSHelper(value, __alreadySeen);\n });\n return res;\n }\n if (isObservableSet(source)) {\n var _res = cache(__alreadySeen, source, new Set());\n source.forEach(function (value) {\n _res.add(toJSHelper(value, __alreadySeen));\n });\n return _res;\n }\n if (isObservableMap(source)) {\n var _res2 = cache(__alreadySeen, source, new Map());\n source.forEach(function (value, key) {\n _res2.set(key, toJSHelper(value, __alreadySeen));\n });\n return _res2;\n } else {\n // must be observable object\n var _res3 = cache(__alreadySeen, source, {});\n apiOwnKeys(source).forEach(function (key) {\n if (objectPrototype.propertyIsEnumerable.call(source, key)) {\n _res3[key] = toJSHelper(source[key], __alreadySeen);\n }\n });\n return _res3;\n }\n}\n/**\n * Recursively converts an observable to it's non-observable native counterpart.\n * It does NOT recurse into non-observables, these are left as they are, even if they contain observables.\n * Computed and other non-enumerable properties are completely ignored.\n * Complex scenarios require custom solution, eg implementing `toJSON` or using `serializr` lib.\n */\nfunction toJS(source, options) {\n if ( true && options) {\n die(\"toJS no longer supports options\");\n }\n return toJSHelper(source, new Map());\n}\n\nfunction trace() {\n if (false) {}\n var enterBreakPoint = false;\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n if (typeof args[args.length - 1] === \"boolean\") {\n enterBreakPoint = args.pop();\n }\n var derivation = getAtomFromArgs(args);\n if (!derivation) {\n return die(\"'trace(break?)' can only be used inside a tracked computed value or a Reaction. Consider passing in the computed value or reaction explicitly\");\n }\n if (derivation.isTracing_ === TraceMode.NONE) {\n console.log(\"[mobx.trace] '\" + derivation.name_ + \"' tracing enabled\");\n }\n derivation.isTracing_ = enterBreakPoint ? TraceMode.BREAK : TraceMode.LOG;\n}\nfunction getAtomFromArgs(args) {\n switch (args.length) {\n case 0:\n return globalState.trackingDerivation;\n case 1:\n return getAtom(args[0]);\n case 2:\n return getAtom(args[0], args[1]);\n }\n}\n\n/**\n * During a transaction no views are updated until the end of the transaction.\n * The transaction will be run synchronously nonetheless.\n *\n * @param action a function that updates some reactive state\n * @returns any value that was returned by the 'action' parameter.\n */\nfunction transaction(action, thisArg) {\n if (thisArg === void 0) {\n thisArg = undefined;\n }\n startBatch();\n try {\n return action.apply(thisArg);\n } finally {\n endBatch();\n }\n}\n\nfunction when(predicate, arg1, arg2) {\n if (arguments.length === 1 || arg1 && typeof arg1 === \"object\") {\n return whenPromise(predicate, arg1);\n }\n return _when(predicate, arg1, arg2 || {});\n}\nfunction _when(predicate, effect, opts) {\n var timeoutHandle;\n if (typeof opts.timeout === \"number\") {\n var error = new Error(\"WHEN_TIMEOUT\");\n timeoutHandle = setTimeout(function () {\n if (!disposer[$mobx].isDisposed) {\n disposer();\n if (opts.onError) {\n opts.onError(error);\n } else {\n throw error;\n }\n }\n }, opts.timeout);\n }\n opts.name = true ? opts.name || \"When@\" + getNextId() : 0;\n var effectAction = createAction( true ? opts.name + \"-effect\" : 0, effect);\n // eslint-disable-next-line\n var disposer = autorun(function (r) {\n // predicate should not change state\n var cond = allowStateChanges(false, predicate);\n if (cond) {\n r.dispose();\n if (timeoutHandle) {\n clearTimeout(timeoutHandle);\n }\n effectAction();\n }\n }, opts);\n return disposer;\n}\nfunction whenPromise(predicate, opts) {\n var _opts$signal;\n if ( true && opts && opts.onError) {\n return die(\"the options 'onError' and 'promise' cannot be combined\");\n }\n if (opts != null && (_opts$signal = opts.signal) != null && _opts$signal.aborted) {\n return Object.assign(Promise.reject(new Error(\"WHEN_ABORTED\")), {\n cancel: function cancel() {\n return null;\n }\n });\n }\n var cancel;\n var abort;\n var res = new Promise(function (resolve, reject) {\n var _opts$signal2;\n var disposer = _when(predicate, resolve, _extends({}, opts, {\n onError: reject\n }));\n cancel = function cancel() {\n disposer();\n reject(new Error(\"WHEN_CANCELLED\"));\n };\n abort = function abort() {\n disposer();\n reject(new Error(\"WHEN_ABORTED\"));\n };\n opts == null || (_opts$signal2 = opts.signal) == null || _opts$signal2.addEventListener == null || _opts$signal2.addEventListener(\"abort\", abort);\n })[\"finally\"](function () {\n var _opts$signal3;\n return opts == null || (_opts$signal3 = opts.signal) == null || _opts$signal3.removeEventListener == null ? void 0 : _opts$signal3.removeEventListener(\"abort\", abort);\n });\n res.cancel = cancel;\n return res;\n}\n\nfunction getAdm(target) {\n return target[$mobx];\n}\n// Optimization: we don't need the intermediate objects and could have a completely custom administration for DynamicObjects,\n// and skip either the internal values map, or the base object with its property descriptors!\nvar objectProxyTraps = {\n has: function has(target, name) {\n if ( true && globalState.trackingDerivation) {\n warnAboutProxyRequirement(\"detect new properties using the 'in' operator. Use 'has' from 'mobx' instead.\");\n }\n return getAdm(target).has_(name);\n },\n get: function get(target, name) {\n return getAdm(target).get_(name);\n },\n set: function set(target, name, value) {\n var _getAdm$set_;\n if (!isStringish(name)) {\n return false;\n }\n if ( true && !getAdm(target).values_.has(name)) {\n warnAboutProxyRequirement(\"add a new observable property through direct assignment. Use 'set' from 'mobx' instead.\");\n }\n // null (intercepted) -> true (success)\n return (_getAdm$set_ = getAdm(target).set_(name, value, true)) != null ? _getAdm$set_ : true;\n },\n deleteProperty: function deleteProperty(target, name) {\n var _getAdm$delete_;\n if (true) {\n warnAboutProxyRequirement(\"delete properties from an observable object. Use 'remove' from 'mobx' instead.\");\n }\n if (!isStringish(name)) {\n return false;\n }\n // null (intercepted) -> true (success)\n return (_getAdm$delete_ = getAdm(target).delete_(name, true)) != null ? _getAdm$delete_ : true;\n },\n defineProperty: function defineProperty(target, name, descriptor) {\n var _getAdm$definePropert;\n if (true) {\n warnAboutProxyRequirement(\"define property on an observable object. Use 'defineProperty' from 'mobx' instead.\");\n }\n // null (intercepted) -> true (success)\n return (_getAdm$definePropert = getAdm(target).defineProperty_(name, descriptor)) != null ? _getAdm$definePropert : true;\n },\n ownKeys: function ownKeys(target) {\n if ( true && globalState.trackingDerivation) {\n warnAboutProxyRequirement(\"iterate keys to detect added / removed properties. Use 'keys' from 'mobx' instead.\");\n }\n return getAdm(target).ownKeys_();\n },\n preventExtensions: function preventExtensions(target) {\n die(13);\n }\n};\nfunction asDynamicObservableObject(target, options) {\n var _target$$mobx, _target$$mobx$proxy_;\n assertProxies();\n target = asObservableObject(target, options);\n return (_target$$mobx$proxy_ = (_target$$mobx = target[$mobx]).proxy_) != null ? _target$$mobx$proxy_ : _target$$mobx.proxy_ = new Proxy(target, objectProxyTraps);\n}\n\nfunction hasInterceptors(interceptable) {\n return interceptable.interceptors_ !== undefined && interceptable.interceptors_.length > 0;\n}\nfunction registerInterceptor(interceptable, handler) {\n var interceptors = interceptable.interceptors_ || (interceptable.interceptors_ = []);\n interceptors.push(handler);\n return once(function () {\n var idx = interceptors.indexOf(handler);\n if (idx !== -1) {\n interceptors.splice(idx, 1);\n }\n });\n}\nfunction interceptChange(interceptable, change) {\n var prevU = untrackedStart();\n try {\n // Interceptor can modify the array, copy it to avoid concurrent modification, see #1950\n var interceptors = [].concat(interceptable.interceptors_ || []);\n for (var i = 0, l = interceptors.length; i < l; i++) {\n change = interceptors[i](change);\n if (change && !change.type) {\n die(14);\n }\n if (!change) {\n break;\n }\n }\n return change;\n } finally {\n untrackedEnd(prevU);\n }\n}\n\nfunction hasListeners(listenable) {\n return listenable.changeListeners_ !== undefined && listenable.changeListeners_.length > 0;\n}\nfunction registerListener(listenable, handler) {\n var listeners = listenable.changeListeners_ || (listenable.changeListeners_ = []);\n listeners.push(handler);\n return once(function () {\n var idx = listeners.indexOf(handler);\n if (idx !== -1) {\n listeners.splice(idx, 1);\n }\n });\n}\nfunction notifyListeners(listenable, change) {\n var prevU = untrackedStart();\n var listeners = listenable.changeListeners_;\n if (!listeners) {\n return;\n }\n listeners = listeners.slice();\n for (var i = 0, l = listeners.length; i < l; i++) {\n listeners[i](change);\n }\n untrackedEnd(prevU);\n}\n\nfunction makeObservable(target, annotations, options) {\n initObservable(function () {\n var _annotations;\n var adm = asObservableObject(target, options)[$mobx];\n if ( true && annotations && target[storedAnnotationsSymbol]) {\n die(\"makeObservable second arg must be nullish when using decorators. Mixing @decorator syntax with annotations is not supported.\");\n }\n // Default to decorators\n (_annotations = annotations) != null ? _annotations : annotations = collectStoredAnnotations(target);\n // Annotate\n ownKeys(annotations).forEach(function (key) {\n return adm.make_(key, annotations[key]);\n });\n });\n return target;\n}\n// proto[keysSymbol] = new Set()\nvar keysSymbol = /*#__PURE__*/Symbol(\"mobx-keys\");\nfunction makeAutoObservable(target, overrides, options) {\n if (true) {\n if (!isPlainObject(target) && !isPlainObject(Object.getPrototypeOf(target))) {\n die(\"'makeAutoObservable' can only be used for classes that don't have a superclass\");\n }\n if (isObservableObject(target)) {\n die(\"makeAutoObservable can only be used on objects not already made observable\");\n }\n }\n // Optimization: avoid visiting protos\n // Assumes that annotation.make_/.extend_ works the same for plain objects\n if (isPlainObject(target)) {\n return extendObservable(target, target, overrides, options);\n }\n initObservable(function () {\n var adm = asObservableObject(target, options)[$mobx];\n // Optimization: cache keys on proto\n // Assumes makeAutoObservable can be called only once per object and can't be used in subclass\n if (!target[keysSymbol]) {\n var proto = Object.getPrototypeOf(target);\n var keys = new Set([].concat(ownKeys(target), ownKeys(proto)));\n keys[\"delete\"](\"constructor\");\n keys[\"delete\"]($mobx);\n addHiddenProp(proto, keysSymbol, keys);\n }\n target[keysSymbol].forEach(function (key) {\n return adm.make_(key,\n // must pass \"undefined\" for { key: undefined }\n !overrides ? true : key in overrides ? overrides[key] : true);\n });\n });\n return target;\n}\n\nvar SPLICE = \"splice\";\nvar UPDATE = \"update\";\nvar MAX_SPLICE_SIZE = 10000; // See e.g. https://github.com/mobxjs/mobx/issues/859\nvar arrayTraps = {\n get: function get(target, name) {\n var adm = target[$mobx];\n if (name === $mobx) {\n return adm;\n }\n if (name === \"length\") {\n return adm.getArrayLength_();\n }\n if (typeof name === \"string\" && !isNaN(name)) {\n return adm.get_(parseInt(name));\n }\n if (hasProp(arrayExtensions, name)) {\n return arrayExtensions[name];\n }\n return target[name];\n },\n set: function set(target, name, value) {\n var adm = target[$mobx];\n if (name === \"length\") {\n adm.setArrayLength_(value);\n }\n if (typeof name === \"symbol\" || isNaN(name)) {\n target[name] = value;\n } else {\n // numeric string\n adm.set_(parseInt(name), value);\n }\n return true;\n },\n preventExtensions: function preventExtensions() {\n die(15);\n }\n};\nvar ObservableArrayAdministration = /*#__PURE__*/function () {\n function ObservableArrayAdministration(name, enhancer, owned_, legacyMode_) {\n if (name === void 0) {\n name = true ? \"ObservableArray@\" + getNextId() : 0;\n }\n this.owned_ = void 0;\n this.legacyMode_ = void 0;\n this.atom_ = void 0;\n this.values_ = [];\n // this is the prop that gets proxied, so can't replace it!\n this.interceptors_ = void 0;\n this.changeListeners_ = void 0;\n this.enhancer_ = void 0;\n this.dehancer = void 0;\n this.proxy_ = void 0;\n this.lastKnownLength_ = 0;\n this.owned_ = owned_;\n this.legacyMode_ = legacyMode_;\n this.atom_ = new Atom(name);\n this.enhancer_ = function (newV, oldV) {\n return enhancer(newV, oldV, true ? name + \"[..]\" : 0);\n };\n }\n var _proto = ObservableArrayAdministration.prototype;\n _proto.dehanceValue_ = function dehanceValue_(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.dehanceValues_ = function dehanceValues_(values) {\n if (this.dehancer !== undefined && values.length > 0) {\n return values.map(this.dehancer);\n }\n return values;\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n if (fireImmediately === void 0) {\n fireImmediately = false;\n }\n if (fireImmediately) {\n listener({\n observableKind: \"array\",\n object: this.proxy_,\n debugObjectName: this.atom_.name_,\n type: \"splice\",\n index: 0,\n added: this.values_.slice(),\n addedCount: this.values_.length,\n removed: [],\n removedCount: 0\n });\n }\n return registerListener(this, listener);\n };\n _proto.getArrayLength_ = function getArrayLength_() {\n this.atom_.reportObserved();\n return this.values_.length;\n };\n _proto.setArrayLength_ = function setArrayLength_(newLength) {\n if (typeof newLength !== \"number\" || isNaN(newLength) || newLength < 0) {\n die(\"Out of range: \" + newLength);\n }\n var currentLength = this.values_.length;\n if (newLength === currentLength) {\n return;\n } else if (newLength > currentLength) {\n var newItems = new Array(newLength - currentLength);\n for (var i = 0; i < newLength - currentLength; i++) {\n newItems[i] = undefined;\n } // No Array.fill everywhere...\n this.spliceWithArray_(currentLength, 0, newItems);\n } else {\n this.spliceWithArray_(newLength, currentLength - newLength);\n }\n };\n _proto.updateArrayLength_ = function updateArrayLength_(oldLength, delta) {\n if (oldLength !== this.lastKnownLength_) {\n die(16);\n }\n this.lastKnownLength_ += delta;\n if (this.legacyMode_ && delta > 0) {\n reserveArrayBuffer(oldLength + delta + 1);\n }\n };\n _proto.spliceWithArray_ = function spliceWithArray_(index, deleteCount, newItems) {\n var _this = this;\n checkIfStateModificationsAreAllowed(this.atom_);\n var length = this.values_.length;\n if (index === undefined) {\n index = 0;\n } else if (index > length) {\n index = length;\n } else if (index < 0) {\n index = Math.max(0, length + index);\n }\n if (arguments.length === 1) {\n deleteCount = length - index;\n } else if (deleteCount === undefined || deleteCount === null) {\n deleteCount = 0;\n } else {\n deleteCount = Math.max(0, Math.min(deleteCount, length - index));\n }\n if (newItems === undefined) {\n newItems = EMPTY_ARRAY;\n }\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_,\n type: SPLICE,\n index: index,\n removedCount: deleteCount,\n added: newItems\n });\n if (!change) {\n return EMPTY_ARRAY;\n }\n deleteCount = change.removedCount;\n newItems = change.added;\n }\n newItems = newItems.length === 0 ? newItems : newItems.map(function (v) {\n return _this.enhancer_(v, undefined);\n });\n if (this.legacyMode_ || \"development\" !== \"production\") {\n var lengthDelta = newItems.length - deleteCount;\n this.updateArrayLength_(length, lengthDelta); // checks if internal array wasn't modified\n }\n var res = this.spliceItemsIntoValues_(index, deleteCount, newItems);\n if (deleteCount !== 0 || newItems.length !== 0) {\n this.notifyArraySplice_(index, newItems, res);\n }\n return this.dehanceValues_(res);\n };\n _proto.spliceItemsIntoValues_ = function spliceItemsIntoValues_(index, deleteCount, newItems) {\n if (newItems.length < MAX_SPLICE_SIZE) {\n var _this$values_;\n return (_this$values_ = this.values_).splice.apply(_this$values_, [index, deleteCount].concat(newItems));\n } else {\n // The items removed by the splice\n var res = this.values_.slice(index, index + deleteCount);\n // The items that that should remain at the end of the array\n var oldItems = this.values_.slice(index + deleteCount);\n // New length is the previous length + addition count - deletion count\n this.values_.length += newItems.length - deleteCount;\n for (var i = 0; i < newItems.length; i++) {\n this.values_[index + i] = newItems[i];\n }\n for (var _i = 0; _i < oldItems.length; _i++) {\n this.values_[index + newItems.length + _i] = oldItems[_i];\n }\n return res;\n }\n };\n _proto.notifyArrayChildUpdate_ = function notifyArrayChildUpdate_(index, newValue, oldValue) {\n var notifySpy = !this.owned_ && isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"array\",\n object: this.proxy_,\n type: UPDATE,\n debugObjectName: this.atom_.name_,\n index: index,\n newValue: newValue,\n oldValue: oldValue\n } : null;\n // The reason why this is on right hand side here (and not above), is this way the uglifier will drop it, but it won't\n // cause any runtime overhead in development mode without NODE_ENV set, unless spying is enabled\n if ( true && notifySpy) {\n spyReportStart(change);\n }\n this.atom_.reportChanged();\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n };\n _proto.notifyArraySplice_ = function notifyArraySplice_(index, added, removed) {\n var notifySpy = !this.owned_ && isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"array\",\n object: this.proxy_,\n debugObjectName: this.atom_.name_,\n type: SPLICE,\n index: index,\n removed: removed,\n added: added,\n removedCount: removed.length,\n addedCount: added.length\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n }\n this.atom_.reportChanged();\n // conform: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/observe\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n };\n _proto.get_ = function get_(index) {\n if (this.legacyMode_ && index >= this.values_.length) {\n console.warn( true ? \"[mobx.array] Attempt to read an array index (\" + index + \") that is out of bounds (\" + this.values_.length + \"). Please check length first. Out of bound indices will not be tracked by MobX\" : 0);\n return undefined;\n }\n this.atom_.reportObserved();\n return this.dehanceValue_(this.values_[index]);\n };\n _proto.set_ = function set_(index, newValue) {\n var values = this.values_;\n if (this.legacyMode_ && index > values.length) {\n // out of bounds\n die(17, index, values.length);\n }\n if (index < values.length) {\n // update at index in range\n checkIfStateModificationsAreAllowed(this.atom_);\n var oldValue = values[index];\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: UPDATE,\n object: this.proxy_,\n // since \"this\" is the real array we need to pass its proxy\n index: index,\n newValue: newValue\n });\n if (!change) {\n return;\n }\n newValue = change.newValue;\n }\n newValue = this.enhancer_(newValue, oldValue);\n var changed = newValue !== oldValue;\n if (changed) {\n values[index] = newValue;\n this.notifyArrayChildUpdate_(index, newValue, oldValue);\n }\n } else {\n // For out of bound index, we don't create an actual sparse array,\n // but rather fill the holes with undefined (same as setArrayLength_).\n // This could be considered a bug.\n var newItems = new Array(index + 1 - values.length);\n for (var i = 0; i < newItems.length - 1; i++) {\n newItems[i] = undefined;\n } // No Array.fill everywhere...\n newItems[newItems.length - 1] = newValue;\n this.spliceWithArray_(values.length, 0, newItems);\n }\n };\n return ObservableArrayAdministration;\n}();\nfunction createObservableArray(initialValues, enhancer, name, owned) {\n if (name === void 0) {\n name = true ? \"ObservableArray@\" + getNextId() : 0;\n }\n if (owned === void 0) {\n owned = false;\n }\n assertProxies();\n return initObservable(function () {\n var adm = new ObservableArrayAdministration(name, enhancer, owned, false);\n addHiddenFinalProp(adm.values_, $mobx, adm);\n var proxy = new Proxy(adm.values_, arrayTraps);\n adm.proxy_ = proxy;\n if (initialValues && initialValues.length) {\n adm.spliceWithArray_(0, 0, initialValues);\n }\n return proxy;\n });\n}\n// eslint-disable-next-line\nvar arrayExtensions = {\n clear: function clear() {\n return this.splice(0);\n },\n replace: function replace(newItems) {\n var adm = this[$mobx];\n return adm.spliceWithArray_(0, adm.values_.length, newItems);\n },\n // Used by JSON.stringify\n toJSON: function toJSON() {\n return this.slice();\n },\n /*\n * functions that do alter the internal structure of the array, (based on lib.es6.d.ts)\n * since these functions alter the inner structure of the array, the have side effects.\n * Because the have side effects, they should not be used in computed function,\n * and for that reason the do not call dependencyState.notifyObserved\n */\n splice: function splice(index, deleteCount) {\n for (var _len = arguments.length, newItems = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {\n newItems[_key - 2] = arguments[_key];\n }\n var adm = this[$mobx];\n switch (arguments.length) {\n case 0:\n return [];\n case 1:\n return adm.spliceWithArray_(index);\n case 2:\n return adm.spliceWithArray_(index, deleteCount);\n }\n return adm.spliceWithArray_(index, deleteCount, newItems);\n },\n spliceWithArray: function spliceWithArray(index, deleteCount, newItems) {\n return this[$mobx].spliceWithArray_(index, deleteCount, newItems);\n },\n push: function push() {\n var adm = this[$mobx];\n for (var _len2 = arguments.length, items = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n items[_key2] = arguments[_key2];\n }\n adm.spliceWithArray_(adm.values_.length, 0, items);\n return adm.values_.length;\n },\n pop: function pop() {\n return this.splice(Math.max(this[$mobx].values_.length - 1, 0), 1)[0];\n },\n shift: function shift() {\n return this.splice(0, 1)[0];\n },\n unshift: function unshift() {\n var adm = this[$mobx];\n for (var _len3 = arguments.length, items = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n items[_key3] = arguments[_key3];\n }\n adm.spliceWithArray_(0, 0, items);\n return adm.values_.length;\n },\n reverse: function reverse() {\n // reverse by default mutates in place before returning the result\n // which makes it both a 'derivation' and a 'mutation'.\n if (globalState.trackingDerivation) {\n die(37, \"reverse\");\n }\n this.replace(this.slice().reverse());\n return this;\n },\n sort: function sort() {\n // sort by default mutates in place before returning the result\n // which goes against all good practices. Let's not change the array in place!\n if (globalState.trackingDerivation) {\n die(37, \"sort\");\n }\n var copy = this.slice();\n copy.sort.apply(copy, arguments);\n this.replace(copy);\n return this;\n },\n remove: function remove(value) {\n var adm = this[$mobx];\n var idx = adm.dehanceValues_(adm.values_).indexOf(value);\n if (idx > -1) {\n this.splice(idx, 1);\n return true;\n }\n return false;\n }\n};\n/**\n * Wrap function from prototype\n * Without this, everything works as well, but this works\n * faster as everything works on unproxied values\n */\naddArrayExtension(\"at\", simpleFunc);\naddArrayExtension(\"concat\", simpleFunc);\naddArrayExtension(\"flat\", simpleFunc);\naddArrayExtension(\"includes\", simpleFunc);\naddArrayExtension(\"indexOf\", simpleFunc);\naddArrayExtension(\"join\", simpleFunc);\naddArrayExtension(\"lastIndexOf\", simpleFunc);\naddArrayExtension(\"slice\", simpleFunc);\naddArrayExtension(\"toString\", simpleFunc);\naddArrayExtension(\"toLocaleString\", simpleFunc);\naddArrayExtension(\"toSorted\", simpleFunc);\naddArrayExtension(\"toSpliced\", simpleFunc);\naddArrayExtension(\"with\", simpleFunc);\n// map\naddArrayExtension(\"every\", mapLikeFunc);\naddArrayExtension(\"filter\", mapLikeFunc);\naddArrayExtension(\"find\", mapLikeFunc);\naddArrayExtension(\"findIndex\", mapLikeFunc);\naddArrayExtension(\"findLast\", mapLikeFunc);\naddArrayExtension(\"findLastIndex\", mapLikeFunc);\naddArrayExtension(\"flatMap\", mapLikeFunc);\naddArrayExtension(\"forEach\", mapLikeFunc);\naddArrayExtension(\"map\", mapLikeFunc);\naddArrayExtension(\"some\", mapLikeFunc);\naddArrayExtension(\"toReversed\", mapLikeFunc);\n// reduce\naddArrayExtension(\"reduce\", reduceLikeFunc);\naddArrayExtension(\"reduceRight\", reduceLikeFunc);\nfunction addArrayExtension(funcName, funcFactory) {\n if (typeof Array.prototype[funcName] === \"function\") {\n arrayExtensions[funcName] = funcFactory(funcName);\n }\n}\n// Report and delegate to dehanced array\nfunction simpleFunc(funcName) {\n return function () {\n var adm = this[$mobx];\n adm.atom_.reportObserved();\n var dehancedValues = adm.dehanceValues_(adm.values_);\n return dehancedValues[funcName].apply(dehancedValues, arguments);\n };\n}\n// Make sure callbacks receive correct array arg #2326\nfunction mapLikeFunc(funcName) {\n return function (callback, thisArg) {\n var _this2 = this;\n var adm = this[$mobx];\n adm.atom_.reportObserved();\n var dehancedValues = adm.dehanceValues_(adm.values_);\n return dehancedValues[funcName](function (element, index) {\n return callback.call(thisArg, element, index, _this2);\n });\n };\n}\n// Make sure callbacks receive correct array arg #2326\nfunction reduceLikeFunc(funcName) {\n return function () {\n var _this3 = this;\n var adm = this[$mobx];\n adm.atom_.reportObserved();\n var dehancedValues = adm.dehanceValues_(adm.values_);\n // #2432 - reduce behavior depends on arguments.length\n var callback = arguments[0];\n arguments[0] = function (accumulator, currentValue, index) {\n return callback(accumulator, currentValue, index, _this3);\n };\n return dehancedValues[funcName].apply(dehancedValues, arguments);\n };\n}\nvar isObservableArrayAdministration = /*#__PURE__*/createInstanceofPredicate(\"ObservableArrayAdministration\", ObservableArrayAdministration);\nfunction isObservableArray(thing) {\n return isObject(thing) && isObservableArrayAdministration(thing[$mobx]);\n}\n\nvar ObservableMapMarker = {};\nvar ADD = \"add\";\nvar DELETE = \"delete\";\n// just extend Map? See also https://gist.github.com/nestharus/13b4d74f2ef4a2f4357dbd3fc23c1e54\n// But: https://github.com/mobxjs/mobx/issues/1556\nvar ObservableMap = /*#__PURE__*/function () {\n function ObservableMap(initialData, enhancer_, name_) {\n var _this = this;\n if (enhancer_ === void 0) {\n enhancer_ = deepEnhancer;\n }\n if (name_ === void 0) {\n name_ = true ? \"ObservableMap@\" + getNextId() : 0;\n }\n this.enhancer_ = void 0;\n this.name_ = void 0;\n this[$mobx] = ObservableMapMarker;\n this.data_ = void 0;\n this.hasMap_ = void 0;\n // hasMap, not hashMap >-).\n this.keysAtom_ = void 0;\n this.interceptors_ = void 0;\n this.changeListeners_ = void 0;\n this.dehancer = void 0;\n this.enhancer_ = enhancer_;\n this.name_ = name_;\n if (!isFunction(Map)) {\n die(18);\n }\n initObservable(function () {\n _this.keysAtom_ = createAtom( true ? _this.name_ + \".keys()\" : 0);\n _this.data_ = new Map();\n _this.hasMap_ = new Map();\n if (initialData) {\n _this.merge(initialData);\n }\n });\n }\n var _proto = ObservableMap.prototype;\n _proto.has_ = function has_(key) {\n return this.data_.has(key);\n };\n _proto.has = function has(key) {\n var _this2 = this;\n if (!globalState.trackingDerivation) {\n return this.has_(key);\n }\n var entry = this.hasMap_.get(key);\n if (!entry) {\n var newEntry = entry = new ObservableValue(this.has_(key), referenceEnhancer, true ? this.name_ + \".\" + stringifyKey(key) + \"?\" : 0, false);\n this.hasMap_.set(key, newEntry);\n onBecomeUnobserved(newEntry, function () {\n return _this2.hasMap_[\"delete\"](key);\n });\n }\n return entry.get();\n };\n _proto.set = function set(key, value) {\n var hasKey = this.has_(key);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: hasKey ? UPDATE : ADD,\n object: this,\n newValue: value,\n name: key\n });\n if (!change) {\n return this;\n }\n value = change.newValue;\n }\n if (hasKey) {\n this.updateValue_(key, value);\n } else {\n this.addValue_(key, value);\n }\n return this;\n };\n _proto[\"delete\"] = function _delete(key) {\n var _this3 = this;\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: DELETE,\n object: this,\n name: key\n });\n if (!change) {\n return false;\n }\n }\n if (this.has_(key)) {\n var notifySpy = isSpyEnabled();\n var notify = hasListeners(this);\n var _change = notify || notifySpy ? {\n observableKind: \"map\",\n debugObjectName: this.name_,\n type: DELETE,\n object: this,\n oldValue: this.data_.get(key).value_,\n name: key\n } : null;\n if ( true && notifySpy) {\n spyReportStart(_change);\n } // TODO fix type\n transaction(function () {\n var _this3$hasMap_$get;\n _this3.keysAtom_.reportChanged();\n (_this3$hasMap_$get = _this3.hasMap_.get(key)) == null || _this3$hasMap_$get.setNewValue_(false);\n var observable = _this3.data_.get(key);\n observable.setNewValue_(undefined);\n _this3.data_[\"delete\"](key);\n });\n if (notify) {\n notifyListeners(this, _change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n return true;\n }\n return false;\n };\n _proto.updateValue_ = function updateValue_(key, newValue) {\n var observable = this.data_.get(key);\n newValue = observable.prepareNewValue_(newValue);\n if (newValue !== globalState.UNCHANGED) {\n var notifySpy = isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"map\",\n debugObjectName: this.name_,\n type: UPDATE,\n object: this,\n oldValue: observable.value_,\n name: key,\n newValue: newValue\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n } // TODO fix type\n observable.setNewValue_(newValue);\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n };\n _proto.addValue_ = function addValue_(key, newValue) {\n var _this4 = this;\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n transaction(function () {\n var _this4$hasMap_$get;\n var observable = new ObservableValue(newValue, _this4.enhancer_, true ? _this4.name_ + \".\" + stringifyKey(key) : 0, false);\n _this4.data_.set(key, observable);\n newValue = observable.value_; // value might have been changed\n (_this4$hasMap_$get = _this4.hasMap_.get(key)) == null || _this4$hasMap_$get.setNewValue_(true);\n _this4.keysAtom_.reportChanged();\n });\n var notifySpy = isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"map\",\n debugObjectName: this.name_,\n type: ADD,\n object: this,\n name: key,\n newValue: newValue\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n } // TODO fix type\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n };\n _proto.get = function get(key) {\n if (this.has(key)) {\n return this.dehanceValue_(this.data_.get(key).get());\n }\n return this.dehanceValue_(undefined);\n };\n _proto.dehanceValue_ = function dehanceValue_(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.keys = function keys() {\n this.keysAtom_.reportObserved();\n return this.data_.keys();\n };\n _proto.values = function values() {\n var self = this;\n var keys = this.keys();\n return makeIterable({\n next: function next() {\n var _keys$next = keys.next(),\n done = _keys$next.done,\n value = _keys$next.value;\n return {\n done: done,\n value: done ? undefined : self.get(value)\n };\n }\n });\n };\n _proto.entries = function entries() {\n var self = this;\n var keys = this.keys();\n return makeIterable({\n next: function next() {\n var _keys$next2 = keys.next(),\n done = _keys$next2.done,\n value = _keys$next2.value;\n return {\n done: done,\n value: done ? undefined : [value, self.get(value)]\n };\n }\n });\n };\n _proto[Symbol.iterator] = function () {\n return this.entries();\n };\n _proto.forEach = function forEach(callback, thisArg) {\n for (var _iterator = _createForOfIteratorHelperLoose(this), _step; !(_step = _iterator()).done;) {\n var _step$value = _step.value,\n key = _step$value[0],\n value = _step$value[1];\n callback.call(thisArg, value, key, this);\n }\n }\n /** Merge another object into this object, returns this. */;\n _proto.merge = function merge(other) {\n var _this5 = this;\n if (isObservableMap(other)) {\n other = new Map(other);\n }\n transaction(function () {\n if (isPlainObject(other)) {\n getPlainObjectKeys(other).forEach(function (key) {\n return _this5.set(key, other[key]);\n });\n } else if (Array.isArray(other)) {\n other.forEach(function (_ref) {\n var key = _ref[0],\n value = _ref[1];\n return _this5.set(key, value);\n });\n } else if (isES6Map(other)) {\n if (!isPlainES6Map(other)) {\n die(19, other);\n }\n other.forEach(function (value, key) {\n return _this5.set(key, value);\n });\n } else if (other !== null && other !== undefined) {\n die(20, other);\n }\n });\n return this;\n };\n _proto.clear = function clear() {\n var _this6 = this;\n transaction(function () {\n untracked(function () {\n for (var _iterator2 = _createForOfIteratorHelperLoose(_this6.keys()), _step2; !(_step2 = _iterator2()).done;) {\n var key = _step2.value;\n _this6[\"delete\"](key);\n }\n });\n });\n };\n _proto.replace = function replace(values) {\n var _this7 = this;\n // Implementation requirements:\n // - respect ordering of replacement map\n // - allow interceptors to run and potentially prevent individual operations\n // - don't recreate observables that already exist in original map (so we don't destroy existing subscriptions)\n // - don't _keysAtom.reportChanged if the keys of resulting map are indentical (order matters!)\n // - note that result map may differ from replacement map due to the interceptors\n transaction(function () {\n // Convert to map so we can do quick key lookups\n var replacementMap = convertToMap(values);\n var orderedData = new Map();\n // Used for optimization\n var keysReportChangedCalled = false;\n // Delete keys that don't exist in replacement map\n // if the key deletion is prevented by interceptor\n // add entry at the beginning of the result map\n for (var _iterator3 = _createForOfIteratorHelperLoose(_this7.data_.keys()), _step3; !(_step3 = _iterator3()).done;) {\n var key = _step3.value;\n // Concurrently iterating/deleting keys\n // iterator should handle this correctly\n if (!replacementMap.has(key)) {\n var deleted = _this7[\"delete\"](key);\n // Was the key removed?\n if (deleted) {\n // _keysAtom.reportChanged() was already called\n keysReportChangedCalled = true;\n } else {\n // Delete prevented by interceptor\n var value = _this7.data_.get(key);\n orderedData.set(key, value);\n }\n }\n }\n // Merge entries\n for (var _iterator4 = _createForOfIteratorHelperLoose(replacementMap.entries()), _step4; !(_step4 = _iterator4()).done;) {\n var _step4$value = _step4.value,\n _key = _step4$value[0],\n _value = _step4$value[1];\n // We will want to know whether a new key is added\n var keyExisted = _this7.data_.has(_key);\n // Add or update value\n _this7.set(_key, _value);\n // The addition could have been prevent by interceptor\n if (_this7.data_.has(_key)) {\n // The update could have been prevented by interceptor\n // and also we want to preserve existing values\n // so use value from _data map (instead of replacement map)\n var _value2 = _this7.data_.get(_key);\n orderedData.set(_key, _value2);\n // Was a new key added?\n if (!keyExisted) {\n // _keysAtom.reportChanged() was already called\n keysReportChangedCalled = true;\n }\n }\n }\n // Check for possible key order change\n if (!keysReportChangedCalled) {\n if (_this7.data_.size !== orderedData.size) {\n // If size differs, keys are definitely modified\n _this7.keysAtom_.reportChanged();\n } else {\n var iter1 = _this7.data_.keys();\n var iter2 = orderedData.keys();\n var next1 = iter1.next();\n var next2 = iter2.next();\n while (!next1.done) {\n if (next1.value !== next2.value) {\n _this7.keysAtom_.reportChanged();\n break;\n }\n next1 = iter1.next();\n next2 = iter2.next();\n }\n }\n }\n // Use correctly ordered map\n _this7.data_ = orderedData;\n });\n return this;\n };\n _proto.toString = function toString() {\n return \"[object ObservableMap]\";\n };\n _proto.toJSON = function toJSON() {\n return Array.from(this);\n };\n /**\n * Observes this object. Triggers for the events 'add', 'update' and 'delete'.\n * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe\n * for callback details\n */\n _proto.observe_ = function observe_(listener, fireImmediately) {\n if ( true && fireImmediately === true) {\n die(\"`observe` doesn't support fireImmediately=true in combination with maps.\");\n }\n return registerListener(this, listener);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n return _createClass(ObservableMap, [{\n key: \"size\",\n get: function get() {\n this.keysAtom_.reportObserved();\n return this.data_.size;\n }\n }, {\n key: Symbol.toStringTag,\n get: function get() {\n return \"Map\";\n }\n }]);\n}();\n// eslint-disable-next-line\nvar isObservableMap = /*#__PURE__*/createInstanceofPredicate(\"ObservableMap\", ObservableMap);\nfunction convertToMap(dataStructure) {\n if (isES6Map(dataStructure) || isObservableMap(dataStructure)) {\n return dataStructure;\n } else if (Array.isArray(dataStructure)) {\n return new Map(dataStructure);\n } else if (isPlainObject(dataStructure)) {\n var map = new Map();\n for (var key in dataStructure) {\n map.set(key, dataStructure[key]);\n }\n return map;\n } else {\n return die(21, dataStructure);\n }\n}\n\nvar ObservableSetMarker = {};\nvar ObservableSet = /*#__PURE__*/function () {\n function ObservableSet(initialData, enhancer, name_) {\n var _this = this;\n if (enhancer === void 0) {\n enhancer = deepEnhancer;\n }\n if (name_ === void 0) {\n name_ = true ? \"ObservableSet@\" + getNextId() : 0;\n }\n this.name_ = void 0;\n this[$mobx] = ObservableSetMarker;\n this.data_ = new Set();\n this.atom_ = void 0;\n this.changeListeners_ = void 0;\n this.interceptors_ = void 0;\n this.dehancer = void 0;\n this.enhancer_ = void 0;\n this.name_ = name_;\n if (!isFunction(Set)) {\n die(22);\n }\n this.enhancer_ = function (newV, oldV) {\n return enhancer(newV, oldV, name_);\n };\n initObservable(function () {\n _this.atom_ = createAtom(_this.name_);\n if (initialData) {\n _this.replace(initialData);\n }\n });\n }\n var _proto = ObservableSet.prototype;\n _proto.dehanceValue_ = function dehanceValue_(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.clear = function clear() {\n var _this2 = this;\n transaction(function () {\n untracked(function () {\n for (var _iterator = _createForOfIteratorHelperLoose(_this2.data_.values()), _step; !(_step = _iterator()).done;) {\n var value = _step.value;\n _this2[\"delete\"](value);\n }\n });\n });\n };\n _proto.forEach = function forEach(callbackFn, thisArg) {\n for (var _iterator2 = _createForOfIteratorHelperLoose(this), _step2; !(_step2 = _iterator2()).done;) {\n var value = _step2.value;\n callbackFn.call(thisArg, value, value, this);\n }\n };\n _proto.add = function add(value) {\n var _this3 = this;\n checkIfStateModificationsAreAllowed(this.atom_);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: ADD,\n object: this,\n newValue: value\n });\n if (!change) {\n return this;\n }\n // ideally, value = change.value would be done here, so that values can be\n // changed by interceptor. Same applies for other Set and Map api's.\n }\n if (!this.has(value)) {\n transaction(function () {\n _this3.data_.add(_this3.enhancer_(value, undefined));\n _this3.atom_.reportChanged();\n });\n var notifySpy = true && isSpyEnabled();\n var notify = hasListeners(this);\n var _change = notify || notifySpy ? {\n observableKind: \"set\",\n debugObjectName: this.name_,\n type: ADD,\n object: this,\n newValue: value\n } : null;\n if (notifySpy && \"development\" !== \"production\") {\n spyReportStart(_change);\n }\n if (notify) {\n notifyListeners(this, _change);\n }\n if (notifySpy && \"development\" !== \"production\") {\n spyReportEnd();\n }\n }\n return this;\n };\n _proto[\"delete\"] = function _delete(value) {\n var _this4 = this;\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: DELETE,\n object: this,\n oldValue: value\n });\n if (!change) {\n return false;\n }\n }\n if (this.has(value)) {\n var notifySpy = true && isSpyEnabled();\n var notify = hasListeners(this);\n var _change2 = notify || notifySpy ? {\n observableKind: \"set\",\n debugObjectName: this.name_,\n type: DELETE,\n object: this,\n oldValue: value\n } : null;\n if (notifySpy && \"development\" !== \"production\") {\n spyReportStart(_change2);\n }\n transaction(function () {\n _this4.atom_.reportChanged();\n _this4.data_[\"delete\"](value);\n });\n if (notify) {\n notifyListeners(this, _change2);\n }\n if (notifySpy && \"development\" !== \"production\") {\n spyReportEnd();\n }\n return true;\n }\n return false;\n };\n _proto.has = function has(value) {\n this.atom_.reportObserved();\n return this.data_.has(this.dehanceValue_(value));\n };\n _proto.entries = function entries() {\n var nextIndex = 0;\n var keys = Array.from(this.keys());\n var values = Array.from(this.values());\n return makeIterable({\n next: function next() {\n var index = nextIndex;\n nextIndex += 1;\n return index < values.length ? {\n value: [keys[index], values[index]],\n done: false\n } : {\n done: true\n };\n }\n });\n };\n _proto.keys = function keys() {\n return this.values();\n };\n _proto.values = function values() {\n this.atom_.reportObserved();\n var self = this;\n var nextIndex = 0;\n var observableValues = Array.from(this.data_.values());\n return makeIterable({\n next: function next() {\n return nextIndex < observableValues.length ? {\n value: self.dehanceValue_(observableValues[nextIndex++]),\n done: false\n } : {\n done: true\n };\n }\n });\n };\n _proto.intersection = function intersection(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.intersection(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.intersection(otherSet);\n }\n };\n _proto.union = function union(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.union(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.union(otherSet);\n }\n };\n _proto.difference = function difference(otherSet) {\n return new Set(this).difference(otherSet);\n };\n _proto.symmetricDifference = function symmetricDifference(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.symmetricDifference(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.symmetricDifference(otherSet);\n }\n };\n _proto.isSubsetOf = function isSubsetOf(otherSet) {\n return new Set(this).isSubsetOf(otherSet);\n };\n _proto.isSupersetOf = function isSupersetOf(otherSet) {\n return new Set(this).isSupersetOf(otherSet);\n };\n _proto.isDisjointFrom = function isDisjointFrom(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.isDisjointFrom(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.isDisjointFrom(otherSet);\n }\n };\n _proto.replace = function replace(other) {\n var _this5 = this;\n if (isObservableSet(other)) {\n other = new Set(other);\n }\n transaction(function () {\n if (Array.isArray(other)) {\n _this5.clear();\n other.forEach(function (value) {\n return _this5.add(value);\n });\n } else if (isES6Set(other)) {\n _this5.clear();\n other.forEach(function (value) {\n return _this5.add(value);\n });\n } else if (other !== null && other !== undefined) {\n die(\"Cannot initialize set from \" + other);\n }\n });\n return this;\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n // ... 'fireImmediately' could also be true?\n if ( true && fireImmediately === true) {\n die(\"`observe` doesn't support fireImmediately=true in combination with sets.\");\n }\n return registerListener(this, listener);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.toJSON = function toJSON() {\n return Array.from(this);\n };\n _proto.toString = function toString() {\n return \"[object ObservableSet]\";\n };\n _proto[Symbol.iterator] = function () {\n return this.values();\n };\n return _createClass(ObservableSet, [{\n key: \"size\",\n get: function get() {\n this.atom_.reportObserved();\n return this.data_.size;\n }\n }, {\n key: Symbol.toStringTag,\n get: function get() {\n return \"Set\";\n }\n }]);\n}();\n// eslint-disable-next-line\nvar isObservableSet = /*#__PURE__*/createInstanceofPredicate(\"ObservableSet\", ObservableSet);\n\nvar descriptorCache = /*#__PURE__*/Object.create(null);\nvar REMOVE = \"remove\";\nvar ObservableObjectAdministration = /*#__PURE__*/function () {\n function ObservableObjectAdministration(target_, values_, name_,\n // Used anytime annotation is not explicitely provided\n defaultAnnotation_) {\n if (values_ === void 0) {\n values_ = new Map();\n }\n if (defaultAnnotation_ === void 0) {\n defaultAnnotation_ = autoAnnotation;\n }\n this.target_ = void 0;\n this.values_ = void 0;\n this.name_ = void 0;\n this.defaultAnnotation_ = void 0;\n this.keysAtom_ = void 0;\n this.changeListeners_ = void 0;\n this.interceptors_ = void 0;\n this.proxy_ = void 0;\n this.isPlainObject_ = void 0;\n this.appliedAnnotations_ = void 0;\n this.pendingKeys_ = void 0;\n this.target_ = target_;\n this.values_ = values_;\n this.name_ = name_;\n this.defaultAnnotation_ = defaultAnnotation_;\n this.keysAtom_ = new Atom( true ? this.name_ + \".keys\" : 0);\n // Optimization: we use this frequently\n this.isPlainObject_ = isPlainObject(this.target_);\n if ( true && !isAnnotation(this.defaultAnnotation_)) {\n die(\"defaultAnnotation must be valid annotation\");\n }\n if (true) {\n // Prepare structure for tracking which fields were already annotated\n this.appliedAnnotations_ = {};\n }\n }\n var _proto = ObservableObjectAdministration.prototype;\n _proto.getObservablePropValue_ = function getObservablePropValue_(key) {\n return this.values_.get(key).get();\n };\n _proto.setObservablePropValue_ = function setObservablePropValue_(key, newValue) {\n var observable = this.values_.get(key);\n if (observable instanceof ComputedValue) {\n observable.set(newValue);\n return true;\n }\n // intercept\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: UPDATE,\n object: this.proxy_ || this.target_,\n name: key,\n newValue: newValue\n });\n if (!change) {\n return null;\n }\n newValue = change.newValue;\n }\n newValue = observable.prepareNewValue_(newValue);\n // notify spy & observers\n if (newValue !== globalState.UNCHANGED) {\n var notify = hasListeners(this);\n var notifySpy = true && isSpyEnabled();\n var _change = notify || notifySpy ? {\n type: UPDATE,\n observableKind: \"object\",\n debugObjectName: this.name_,\n object: this.proxy_ || this.target_,\n oldValue: observable.value_,\n name: key,\n newValue: newValue\n } : null;\n if ( true && notifySpy) {\n spyReportStart(_change);\n }\n observable.setNewValue_(newValue);\n if (notify) {\n notifyListeners(this, _change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n return true;\n };\n _proto.get_ = function get_(key) {\n if (globalState.trackingDerivation && !hasProp(this.target_, key)) {\n // Key doesn't exist yet, subscribe for it in case it's added later\n this.has_(key);\n }\n return this.target_[key];\n }\n /**\n * @param {PropertyKey} key\n * @param {any} value\n * @param {Annotation|boolean} annotation true - use default annotation, false - copy as is\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.set_ = function set_(key, value, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n // Don't use .has(key) - we care about own\n if (hasProp(this.target_, key)) {\n // Existing prop\n if (this.values_.has(key)) {\n // Observable (can be intercepted)\n return this.setObservablePropValue_(key, value);\n } else if (proxyTrap) {\n // Non-observable - proxy\n return Reflect.set(this.target_, key, value);\n } else {\n // Non-observable\n this.target_[key] = value;\n return true;\n }\n } else {\n // New prop\n return this.extend_(key, {\n value: value,\n enumerable: true,\n writable: true,\n configurable: true\n }, this.defaultAnnotation_, proxyTrap);\n }\n }\n // Trap for \"in\"\n ;\n _proto.has_ = function has_(key) {\n if (!globalState.trackingDerivation) {\n // Skip key subscription outside derivation\n return key in this.target_;\n }\n this.pendingKeys_ || (this.pendingKeys_ = new Map());\n var entry = this.pendingKeys_.get(key);\n if (!entry) {\n entry = new ObservableValue(key in this.target_, referenceEnhancer, true ? this.name_ + \".\" + stringifyKey(key) + \"?\" : 0, false);\n this.pendingKeys_.set(key, entry);\n }\n return entry.get();\n }\n /**\n * @param {PropertyKey} key\n * @param {Annotation|boolean} annotation true - use default annotation, false - ignore prop\n */;\n _proto.make_ = function make_(key, annotation) {\n if (annotation === true) {\n annotation = this.defaultAnnotation_;\n }\n if (annotation === false) {\n return;\n }\n assertAnnotable(this, annotation, key);\n if (!(key in this.target_)) {\n var _this$target_$storedA;\n // Throw on missing key, except for decorators:\n // Decorator annotations are collected from whole prototype chain.\n // When called from super() some props may not exist yet.\n // However we don't have to worry about missing prop,\n // because the decorator must have been applied to something.\n if ((_this$target_$storedA = this.target_[storedAnnotationsSymbol]) != null && _this$target_$storedA[key]) {\n return; // will be annotated by subclass constructor\n } else {\n die(1, annotation.annotationType_, this.name_ + \".\" + key.toString());\n }\n }\n var source = this.target_;\n while (source && source !== objectPrototype) {\n var descriptor = getDescriptor(source, key);\n if (descriptor) {\n var outcome = annotation.make_(this, key, descriptor, source);\n if (outcome === 0 /* MakeResult.Cancel */) {\n return;\n }\n if (outcome === 1 /* MakeResult.Break */) {\n break;\n }\n }\n source = Object.getPrototypeOf(source);\n }\n recordAnnotationApplied(this, annotation, key);\n }\n /**\n * @param {PropertyKey} key\n * @param {PropertyDescriptor} descriptor\n * @param {Annotation|boolean} annotation true - use default annotation, false - copy as is\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.extend_ = function extend_(key, descriptor, annotation, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n if (annotation === true) {\n annotation = this.defaultAnnotation_;\n }\n if (annotation === false) {\n return this.defineProperty_(key, descriptor, proxyTrap);\n }\n assertAnnotable(this, annotation, key);\n var outcome = annotation.extend_(this, key, descriptor, proxyTrap);\n if (outcome) {\n recordAnnotationApplied(this, annotation, key);\n }\n return outcome;\n }\n /**\n * @param {PropertyKey} key\n * @param {PropertyDescriptor} descriptor\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.defineProperty_ = function defineProperty_(key, descriptor, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n try {\n startBatch();\n // Delete\n var deleteOutcome = this.delete_(key);\n if (!deleteOutcome) {\n // Failure or intercepted\n return deleteOutcome;\n }\n // ADD interceptor\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: ADD,\n newValue: descriptor.value\n });\n if (!change) {\n return null;\n }\n var newValue = change.newValue;\n if (descriptor.value !== newValue) {\n descriptor = _extends({}, descriptor, {\n value: newValue\n });\n }\n }\n // Define\n if (proxyTrap) {\n if (!Reflect.defineProperty(this.target_, key, descriptor)) {\n return false;\n }\n } else {\n defineProperty(this.target_, key, descriptor);\n }\n // Notify\n this.notifyPropertyAddition_(key, descriptor.value);\n } finally {\n endBatch();\n }\n return true;\n }\n // If original descriptor becomes relevant, move this to annotation directly\n ;\n _proto.defineObservableProperty_ = function defineObservableProperty_(key, value, enhancer, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n try {\n startBatch();\n // Delete\n var deleteOutcome = this.delete_(key);\n if (!deleteOutcome) {\n // Failure or intercepted\n return deleteOutcome;\n }\n // ADD interceptor\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: ADD,\n newValue: value\n });\n if (!change) {\n return null;\n }\n value = change.newValue;\n }\n var cachedDescriptor = getCachedObservablePropDescriptor(key);\n var descriptor = {\n configurable: globalState.safeDescriptors ? this.isPlainObject_ : true,\n enumerable: true,\n get: cachedDescriptor.get,\n set: cachedDescriptor.set\n };\n // Define\n if (proxyTrap) {\n if (!Reflect.defineProperty(this.target_, key, descriptor)) {\n return false;\n }\n } else {\n defineProperty(this.target_, key, descriptor);\n }\n var observable = new ObservableValue(value, enhancer, true ? this.name_ + \".\" + key.toString() : 0, false);\n this.values_.set(key, observable);\n // Notify (value possibly changed by ObservableValue)\n this.notifyPropertyAddition_(key, observable.value_);\n } finally {\n endBatch();\n }\n return true;\n }\n // If original descriptor becomes relevant, move this to annotation directly\n ;\n _proto.defineComputedProperty_ = function defineComputedProperty_(key, options, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n try {\n startBatch();\n // Delete\n var deleteOutcome = this.delete_(key);\n if (!deleteOutcome) {\n // Failure or intercepted\n return deleteOutcome;\n }\n // ADD interceptor\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: ADD,\n newValue: undefined\n });\n if (!change) {\n return null;\n }\n }\n options.name || (options.name = true ? this.name_ + \".\" + key.toString() : 0);\n options.context = this.proxy_ || this.target_;\n var cachedDescriptor = getCachedObservablePropDescriptor(key);\n var descriptor = {\n configurable: globalState.safeDescriptors ? this.isPlainObject_ : true,\n enumerable: false,\n get: cachedDescriptor.get,\n set: cachedDescriptor.set\n };\n // Define\n if (proxyTrap) {\n if (!Reflect.defineProperty(this.target_, key, descriptor)) {\n return false;\n }\n } else {\n defineProperty(this.target_, key, descriptor);\n }\n this.values_.set(key, new ComputedValue(options));\n // Notify\n this.notifyPropertyAddition_(key, undefined);\n } finally {\n endBatch();\n }\n return true;\n }\n /**\n * @param {PropertyKey} key\n * @param {PropertyDescriptor} descriptor\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.delete_ = function delete_(key, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n // No such prop\n if (!hasProp(this.target_, key)) {\n return true;\n }\n // Intercept\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: REMOVE\n });\n // Cancelled\n if (!change) {\n return null;\n }\n }\n // Delete\n try {\n var _this$pendingKeys_;\n startBatch();\n var notify = hasListeners(this);\n var notifySpy = true && isSpyEnabled();\n var observable = this.values_.get(key);\n // Value needed for spies/listeners\n var value = undefined;\n // Optimization: don't pull the value unless we will need it\n if (!observable && (notify || notifySpy)) {\n var _getDescriptor;\n value = (_getDescriptor = getDescriptor(this.target_, key)) == null ? void 0 : _getDescriptor.value;\n }\n // delete prop (do first, may fail)\n if (proxyTrap) {\n if (!Reflect.deleteProperty(this.target_, key)) {\n return false;\n }\n } else {\n delete this.target_[key];\n }\n // Allow re-annotating this field\n if (true) {\n delete this.appliedAnnotations_[key];\n }\n // Clear observable\n if (observable) {\n this.values_[\"delete\"](key);\n // for computed, value is undefined\n if (observable instanceof ObservableValue) {\n value = observable.value_;\n }\n // Notify: autorun(() => obj[key]), see #1796\n propagateChanged(observable);\n }\n // Notify \"keys/entries/values\" observers\n this.keysAtom_.reportChanged();\n // Notify \"has\" observers\n // \"in\" as it may still exist in proto\n (_this$pendingKeys_ = this.pendingKeys_) == null || (_this$pendingKeys_ = _this$pendingKeys_.get(key)) == null || _this$pendingKeys_.set(key in this.target_);\n // Notify spies/listeners\n if (notify || notifySpy) {\n var _change2 = {\n type: REMOVE,\n observableKind: \"object\",\n object: this.proxy_ || this.target_,\n debugObjectName: this.name_,\n oldValue: value,\n name: key\n };\n if ( true && notifySpy) {\n spyReportStart(_change2);\n }\n if (notify) {\n notifyListeners(this, _change2);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n } finally {\n endBatch();\n }\n return true;\n }\n /**\n * Observes this object. Triggers for the events 'add', 'update' and 'delete'.\n * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe\n * for callback details\n */;\n _proto.observe_ = function observe_(callback, fireImmediately) {\n if ( true && fireImmediately === true) {\n die(\"`observe` doesn't support the fire immediately property for observable objects.\");\n }\n return registerListener(this, callback);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.notifyPropertyAddition_ = function notifyPropertyAddition_(key, value) {\n var _this$pendingKeys_2;\n var notify = hasListeners(this);\n var notifySpy = true && isSpyEnabled();\n if (notify || notifySpy) {\n var change = notify || notifySpy ? {\n type: ADD,\n observableKind: \"object\",\n debugObjectName: this.name_,\n object: this.proxy_ || this.target_,\n name: key,\n newValue: value\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n }\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n (_this$pendingKeys_2 = this.pendingKeys_) == null || (_this$pendingKeys_2 = _this$pendingKeys_2.get(key)) == null || _this$pendingKeys_2.set(true);\n // Notify \"keys/entries/values\" observers\n this.keysAtom_.reportChanged();\n };\n _proto.ownKeys_ = function ownKeys_() {\n this.keysAtom_.reportObserved();\n return ownKeys(this.target_);\n };\n _proto.keys_ = function keys_() {\n // Returns enumerable && own, but unfortunately keysAtom will report on ANY key change.\n // There is no way to distinguish between Object.keys(object) and Reflect.ownKeys(object) - both are handled by ownKeys trap.\n // We can either over-report in Object.keys(object) or under-report in Reflect.ownKeys(object)\n // We choose to over-report in Object.keys(object), because:\n // - typically it's used with simple data objects\n // - when symbolic/non-enumerable keys are relevant Reflect.ownKeys works as expected\n this.keysAtom_.reportObserved();\n return Object.keys(this.target_);\n };\n return ObservableObjectAdministration;\n}();\nfunction asObservableObject(target, options) {\n var _options$name;\n if ( true && options && isObservableObject(target)) {\n die(\"Options can't be provided for already observable objects.\");\n }\n if (hasProp(target, $mobx)) {\n if ( true && !(getAdministration(target) instanceof ObservableObjectAdministration)) {\n die(\"Cannot convert '\" + getDebugName(target) + \"' into observable object:\" + \"\\nThe target is already observable of different type.\" + \"\\nExtending builtins is not supported.\");\n }\n return target;\n }\n if ( true && !Object.isExtensible(target)) {\n die(\"Cannot make the designated object observable; it is not extensible\");\n }\n var name = (_options$name = options == null ? void 0 : options.name) != null ? _options$name : true ? (isPlainObject(target) ? \"ObservableObject\" : target.constructor.name) + \"@\" + getNextId() : 0;\n var adm = new ObservableObjectAdministration(target, new Map(), String(name), getAnnotationFromOptions(options));\n addHiddenProp(target, $mobx, adm);\n return target;\n}\nvar isObservableObjectAdministration = /*#__PURE__*/createInstanceofPredicate(\"ObservableObjectAdministration\", ObservableObjectAdministration);\nfunction getCachedObservablePropDescriptor(key) {\n return descriptorCache[key] || (descriptorCache[key] = {\n get: function get() {\n return this[$mobx].getObservablePropValue_(key);\n },\n set: function set(value) {\n return this[$mobx].setObservablePropValue_(key, value);\n }\n });\n}\nfunction isObservableObject(thing) {\n if (isObject(thing)) {\n return isObservableObjectAdministration(thing[$mobx]);\n }\n return false;\n}\nfunction recordAnnotationApplied(adm, annotation, key) {\n var _adm$target_$storedAn;\n if (true) {\n adm.appliedAnnotations_[key] = annotation;\n }\n // Remove applied decorator annotation so we don't try to apply it again in subclass constructor\n (_adm$target_$storedAn = adm.target_[storedAnnotationsSymbol]) == null || delete _adm$target_$storedAn[key];\n}\nfunction assertAnnotable(adm, annotation, key) {\n // Valid annotation\n if ( true && !isAnnotation(annotation)) {\n die(\"Cannot annotate '\" + adm.name_ + \".\" + key.toString() + \"': Invalid annotation.\");\n }\n /*\n // Configurable, not sealed, not frozen\n // Possibly not needed, just a little better error then the one thrown by engine.\n // Cases where this would be useful the most (subclass field initializer) are not interceptable by this.\n if (__DEV__) {\n const configurable = getDescriptor(adm.target_, key)?.configurable\n const frozen = Object.isFrozen(adm.target_)\n const sealed = Object.isSealed(adm.target_)\n if (!configurable || frozen || sealed) {\n const fieldName = `${adm.name_}.${key.toString()}`\n const requestedAnnotationType = annotation.annotationType_\n let error = `Cannot apply '${requestedAnnotationType}' to '${fieldName}':`\n if (frozen) {\n error += `\\nObject is frozen.`\n }\n if (sealed) {\n error += `\\nObject is sealed.`\n }\n if (!configurable) {\n error += `\\nproperty is not configurable.`\n // Mention only if caused by us to avoid confusion\n if (hasProp(adm.appliedAnnotations!, key)) {\n error += `\\nTo prevent accidental re-definition of a field by a subclass, `\n error += `all annotated fields of non-plain objects (classes) are not configurable.`\n }\n }\n die(error)\n }\n }\n */\n // Not annotated\n if ( true && !isOverride(annotation) && hasProp(adm.appliedAnnotations_, key)) {\n var fieldName = adm.name_ + \".\" + key.toString();\n var currentAnnotationType = adm.appliedAnnotations_[key].annotationType_;\n var requestedAnnotationType = annotation.annotationType_;\n die(\"Cannot apply '\" + requestedAnnotationType + \"' to '\" + fieldName + \"':\" + (\"\\nThe field is already annotated with '\" + currentAnnotationType + \"'.\") + \"\\nRe-annotating fields is not allowed.\" + \"\\nUse 'override' annotation for methods overridden by subclass.\");\n }\n}\n\n// Bug in safari 9.* (or iOS 9 safari mobile). See #364\nvar ENTRY_0 = /*#__PURE__*/createArrayEntryDescriptor(0);\nvar safariPrototypeSetterInheritanceBug = /*#__PURE__*/function () {\n var v = false;\n var p = {};\n Object.defineProperty(p, \"0\", {\n set: function set() {\n v = true;\n }\n });\n /*#__PURE__*/Object.create(p)[\"0\"] = 1;\n return v === false;\n}();\n/**\n * This array buffer contains two lists of properties, so that all arrays\n * can recycle their property definitions, which significantly improves performance of creating\n * properties on the fly.\n */\nvar OBSERVABLE_ARRAY_BUFFER_SIZE = 0;\n// Typescript workaround to make sure ObservableArray extends Array\nvar StubArray = function StubArray() {};\nfunction inherit(ctor, proto) {\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(ctor.prototype, proto);\n } else if (ctor.prototype.__proto__ !== undefined) {\n ctor.prototype.__proto__ = proto;\n } else {\n ctor.prototype = proto;\n }\n}\ninherit(StubArray, Array.prototype);\n// Weex proto freeze protection was here,\n// but it is unclear why the hack is need as MobX never changed the prototype\n// anyway, so removed it in V6\nvar LegacyObservableArray = /*#__PURE__*/function (_StubArray) {\n function LegacyObservableArray(initialValues, enhancer, name, owned) {\n var _this;\n if (name === void 0) {\n name = true ? \"ObservableArray@\" + getNextId() : 0;\n }\n if (owned === void 0) {\n owned = false;\n }\n _this = _StubArray.call(this) || this;\n initObservable(function () {\n var adm = new ObservableArrayAdministration(name, enhancer, owned, true);\n adm.proxy_ = _this;\n addHiddenFinalProp(_this, $mobx, adm);\n if (initialValues && initialValues.length) {\n // @ts-ignore\n _this.spliceWithArray(0, 0, initialValues);\n }\n if (safariPrototypeSetterInheritanceBug) {\n // Seems that Safari won't use numeric prototype setter until any * numeric property is\n // defined on the instance. After that it works fine, even if this property is deleted.\n Object.defineProperty(_this, \"0\", ENTRY_0);\n }\n });\n return _this;\n }\n _inheritsLoose(LegacyObservableArray, _StubArray);\n var _proto = LegacyObservableArray.prototype;\n _proto.concat = function concat() {\n this[$mobx].atom_.reportObserved();\n for (var _len = arguments.length, arrays = new Array(_len), _key = 0; _key < _len; _key++) {\n arrays[_key] = arguments[_key];\n }\n return Array.prototype.concat.apply(this.slice(),\n //@ts-ignore\n arrays.map(function (a) {\n return isObservableArray(a) ? a.slice() : a;\n }));\n };\n _proto[Symbol.iterator] = function () {\n var self = this;\n var nextIndex = 0;\n return makeIterable({\n next: function next() {\n return nextIndex < self.length ? {\n value: self[nextIndex++],\n done: false\n } : {\n done: true,\n value: undefined\n };\n }\n });\n };\n return _createClass(LegacyObservableArray, [{\n key: \"length\",\n get: function get() {\n return this[$mobx].getArrayLength_();\n },\n set: function set(newLength) {\n this[$mobx].setArrayLength_(newLength);\n }\n }, {\n key: Symbol.toStringTag,\n get: function get() {\n return \"Array\";\n }\n }]);\n}(StubArray);\nObject.entries(arrayExtensions).forEach(function (_ref) {\n var prop = _ref[0],\n fn = _ref[1];\n if (prop !== \"concat\") {\n addHiddenProp(LegacyObservableArray.prototype, prop, fn);\n }\n});\nfunction createArrayEntryDescriptor(index) {\n return {\n enumerable: false,\n configurable: true,\n get: function get() {\n return this[$mobx].get_(index);\n },\n set: function set(value) {\n this[$mobx].set_(index, value);\n }\n };\n}\nfunction createArrayBufferItem(index) {\n defineProperty(LegacyObservableArray.prototype, \"\" + index, createArrayEntryDescriptor(index));\n}\nfunction reserveArrayBuffer(max) {\n if (max > OBSERVABLE_ARRAY_BUFFER_SIZE) {\n for (var index = OBSERVABLE_ARRAY_BUFFER_SIZE; index < max + 100; index++) {\n createArrayBufferItem(index);\n }\n OBSERVABLE_ARRAY_BUFFER_SIZE = max;\n }\n}\nreserveArrayBuffer(1000);\nfunction createLegacyArray(initialValues, enhancer, name) {\n return new LegacyObservableArray(initialValues, enhancer, name);\n}\n\nfunction getAtom(thing, property) {\n if (typeof thing === \"object\" && thing !== null) {\n if (isObservableArray(thing)) {\n if (property !== undefined) {\n die(23);\n }\n return thing[$mobx].atom_;\n }\n if (isObservableSet(thing)) {\n return thing.atom_;\n }\n if (isObservableMap(thing)) {\n if (property === undefined) {\n return thing.keysAtom_;\n }\n var observable = thing.data_.get(property) || thing.hasMap_.get(property);\n if (!observable) {\n die(25, property, getDebugName(thing));\n }\n return observable;\n }\n if (isObservableObject(thing)) {\n if (!property) {\n return die(26);\n }\n var _observable = thing[$mobx].values_.get(property);\n if (!_observable) {\n die(27, property, getDebugName(thing));\n }\n return _observable;\n }\n if (isAtom(thing) || isComputedValue(thing) || isReaction(thing)) {\n return thing;\n }\n } else if (isFunction(thing)) {\n if (isReaction(thing[$mobx])) {\n // disposer function\n return thing[$mobx];\n }\n }\n die(28);\n}\nfunction getAdministration(thing, property) {\n if (!thing) {\n die(29);\n }\n if (property !== undefined) {\n return getAdministration(getAtom(thing, property));\n }\n if (isAtom(thing) || isComputedValue(thing) || isReaction(thing)) {\n return thing;\n }\n if (isObservableMap(thing) || isObservableSet(thing)) {\n return thing;\n }\n if (thing[$mobx]) {\n return thing[$mobx];\n }\n die(24, thing);\n}\nfunction getDebugName(thing, property) {\n var named;\n if (property !== undefined) {\n named = getAtom(thing, property);\n } else if (isAction(thing)) {\n return thing.name;\n } else if (isObservableObject(thing) || isObservableMap(thing) || isObservableSet(thing)) {\n named = getAdministration(thing);\n } else {\n // valid for arrays as well\n named = getAtom(thing);\n }\n return named.name_;\n}\n/**\n * Helper function for initializing observable structures, it applies:\n * 1. allowStateChanges so we don't violate enforceActions.\n * 2. untracked so we don't accidentaly subscribe to anything observable accessed during init in case the observable is created inside derivation.\n * 3. batch to avoid state version updates\n */\nfunction initObservable(cb) {\n var derivation = untrackedStart();\n var allowStateChanges = allowStateChangesStart(true);\n startBatch();\n try {\n return cb();\n } finally {\n endBatch();\n allowStateChangesEnd(allowStateChanges);\n untrackedEnd(derivation);\n }\n}\n\nvar toString = objectPrototype.toString;\nfunction deepEqual(a, b, depth) {\n if (depth === void 0) {\n depth = -1;\n }\n return eq(a, b, depth);\n}\n// Copied from https://github.com/jashkenas/underscore/blob/5c237a7c682fb68fd5378203f0bf22dce1624854/underscore.js#L1186-L1289\n// Internal recursive comparison function for `isEqual`.\nfunction eq(a, b, depth, aStack, bStack) {\n // Identical objects are equal. `0 === -0`, but they aren't identical.\n // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).\n if (a === b) {\n return a !== 0 || 1 / a === 1 / b;\n }\n // `null` or `undefined` only equal to itself (strict comparison).\n if (a == null || b == null) {\n return false;\n }\n // `NaN`s are equivalent, but non-reflexive.\n if (a !== a) {\n return b !== b;\n }\n // Exhaust primitive checks\n var type = typeof a;\n if (type !== \"function\" && type !== \"object\" && typeof b != \"object\") {\n return false;\n }\n // Compare `[[Class]]` names.\n var className = toString.call(a);\n if (className !== toString.call(b)) {\n return false;\n }\n switch (className) {\n // Strings, numbers, regular expressions, dates, and booleans are compared by value.\n case \"[object RegExp]\":\n // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i')\n case \"[object String]\":\n // Primitives and their corresponding object wrappers are equivalent; thus, `\"5\"` is\n // equivalent to `new String(\"5\")`.\n return \"\" + a === \"\" + b;\n case \"[object Number]\":\n // `NaN`s are equivalent, but non-reflexive.\n // Object(NaN) is equivalent to NaN.\n if (+a !== +a) {\n return +b !== +b;\n }\n // An `egal` comparison is performed for other numeric values.\n return +a === 0 ? 1 / +a === 1 / b : +a === +b;\n case \"[object Date]\":\n case \"[object Boolean]\":\n // Coerce dates and booleans to numeric primitive values. Dates are compared by their\n // millisecond representations. Note that invalid dates with millisecond representations\n // of `NaN` are not equivalent.\n return +a === +b;\n case \"[object Symbol]\":\n return typeof Symbol !== \"undefined\" && Symbol.valueOf.call(a) === Symbol.valueOf.call(b);\n case \"[object Map]\":\n case \"[object Set]\":\n // Maps and Sets are unwrapped to arrays of entry-pairs, adding an incidental level.\n // Hide this extra level by increasing the depth.\n if (depth >= 0) {\n depth++;\n }\n break;\n }\n // Unwrap any wrapped objects.\n a = unwrap(a);\n b = unwrap(b);\n var areArrays = className === \"[object Array]\";\n if (!areArrays) {\n if (typeof a != \"object\" || typeof b != \"object\") {\n return false;\n }\n // Objects with different constructors are not equivalent, but `Object`s or `Array`s\n // from different frames are.\n var aCtor = a.constructor,\n bCtor = b.constructor;\n if (aCtor !== bCtor && !(isFunction(aCtor) && aCtor instanceof aCtor && isFunction(bCtor) && bCtor instanceof bCtor) && \"constructor\" in a && \"constructor\" in b) {\n return false;\n }\n }\n if (depth === 0) {\n return false;\n } else if (depth < 0) {\n depth = -1;\n }\n // Assume equality for cyclic structures. The algorithm for detecting cyclic\n // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.\n // Initializing stack of traversed objects.\n // It's done here since we only need them for objects and arrays comparison.\n aStack = aStack || [];\n bStack = bStack || [];\n var length = aStack.length;\n while (length--) {\n // Linear search. Performance is inversely proportional to the number of\n // unique nested structures.\n if (aStack[length] === a) {\n return bStack[length] === b;\n }\n }\n // Add the first object to the stack of traversed objects.\n aStack.push(a);\n bStack.push(b);\n // Recursively compare objects and arrays.\n if (areArrays) {\n // Compare array lengths to determine if a deep comparison is necessary.\n length = a.length;\n if (length !== b.length) {\n return false;\n }\n // Deep compare the contents, ignoring non-numeric properties.\n while (length--) {\n if (!eq(a[length], b[length], depth - 1, aStack, bStack)) {\n return false;\n }\n }\n } else {\n // Deep compare objects.\n var keys = Object.keys(a);\n var key;\n length = keys.length;\n // Ensure that both objects contain the same number of properties before comparing deep equality.\n if (Object.keys(b).length !== length) {\n return false;\n }\n while (length--) {\n // Deep compare each member\n key = keys[length];\n if (!(hasProp(b, key) && eq(a[key], b[key], depth - 1, aStack, bStack))) {\n return false;\n }\n }\n }\n // Remove the first object from the stack of traversed objects.\n aStack.pop();\n bStack.pop();\n return true;\n}\nfunction unwrap(a) {\n if (isObservableArray(a)) {\n return a.slice();\n }\n if (isES6Map(a) || isObservableMap(a)) {\n return Array.from(a.entries());\n }\n if (isES6Set(a) || isObservableSet(a)) {\n return Array.from(a.entries());\n }\n return a;\n}\n\nfunction makeIterable(iterator) {\n iterator[Symbol.iterator] = getSelf;\n return iterator;\n}\nfunction getSelf() {\n return this;\n}\n\nfunction isAnnotation(thing) {\n return (\n // Can be function\n thing instanceof Object && typeof thing.annotationType_ === \"string\" && isFunction(thing.make_) && isFunction(thing.extend_)\n );\n}\n\n/**\n * (c) Michel Weststrate 2015 - 2020\n * MIT Licensed\n *\n * Welcome to the mobx sources! To get a global overview of how MobX internally works,\n * this is a good place to start:\n * https://medium.com/@mweststrate/becoming-fully-reactive-an-in-depth-explanation-of-mobservable-55995262a254#.xvbh6qd74\n *\n * Source folders:\n * ===============\n *\n * - api/ Most of the public static methods exposed by the module can be found here.\n * - core/ Implementation of the MobX algorithm; atoms, derivations, reactions, dependency trees, optimizations. Cool stuff can be found here.\n * - types/ All the magic that is need to have observable objects, arrays and values is in this folder. Including the modifiers like `asFlat`.\n * - utils/ Utility stuff.\n *\n */\n[\"Symbol\", \"Map\", \"Set\"].forEach(function (m) {\n var g = getGlobal();\n if (typeof g[m] === \"undefined\") {\n die(\"MobX requires global '\" + m + \"' to be available or polyfilled\");\n }\n});\nif (typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__ === \"object\") {\n // See: https://github.com/andykog/mobx-devtools/\n __MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({\n spy: spy,\n extras: {\n getDebugName: getDebugName\n },\n $mobx: $mobx\n });\n}\n\n\n//# sourceMappingURL=mobx.esm.js.map\n\n\n//# sourceURL=webpack://app_adyen_SFRA/./node_modules/mobx/dist/mobx.esm.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ $mobx: () => (/* binding */ $mobx),\n/* harmony export */ FlowCancellationError: () => (/* binding */ FlowCancellationError),\n/* harmony export */ ObservableMap: () => (/* binding */ ObservableMap),\n/* harmony export */ ObservableSet: () => (/* binding */ ObservableSet),\n/* harmony export */ Reaction: () => (/* binding */ Reaction),\n/* harmony export */ _allowStateChanges: () => (/* binding */ allowStateChanges),\n/* harmony export */ _allowStateChangesInsideComputed: () => (/* binding */ runInAction),\n/* harmony export */ _allowStateReadsEnd: () => (/* binding */ allowStateReadsEnd),\n/* harmony export */ _allowStateReadsStart: () => (/* binding */ allowStateReadsStart),\n/* harmony export */ _autoAction: () => (/* binding */ autoAction),\n/* harmony export */ _endAction: () => (/* binding */ _endAction),\n/* harmony export */ _getAdministration: () => (/* binding */ getAdministration),\n/* harmony export */ _getGlobalState: () => (/* binding */ getGlobalState),\n/* harmony export */ _interceptReads: () => (/* binding */ interceptReads),\n/* harmony export */ _isComputingDerivation: () => (/* binding */ isComputingDerivation),\n/* harmony export */ _resetGlobalState: () => (/* binding */ resetGlobalState),\n/* harmony export */ _startAction: () => (/* binding */ _startAction),\n/* harmony export */ action: () => (/* binding */ action),\n/* harmony export */ autorun: () => (/* binding */ autorun),\n/* harmony export */ comparer: () => (/* binding */ comparer),\n/* harmony export */ computed: () => (/* binding */ computed),\n/* harmony export */ configure: () => (/* binding */ configure),\n/* harmony export */ createAtom: () => (/* binding */ createAtom),\n/* harmony export */ defineProperty: () => (/* binding */ apiDefineProperty),\n/* harmony export */ entries: () => (/* binding */ entries),\n/* harmony export */ extendObservable: () => (/* binding */ extendObservable),\n/* harmony export */ flow: () => (/* binding */ flow),\n/* harmony export */ flowResult: () => (/* binding */ flowResult),\n/* harmony export */ get: () => (/* binding */ get),\n/* harmony export */ getAtom: () => (/* binding */ getAtom),\n/* harmony export */ getDebugName: () => (/* binding */ getDebugName),\n/* harmony export */ getDependencyTree: () => (/* binding */ getDependencyTree),\n/* harmony export */ getObserverTree: () => (/* binding */ getObserverTree),\n/* harmony export */ has: () => (/* binding */ has),\n/* harmony export */ intercept: () => (/* binding */ intercept),\n/* harmony export */ isAction: () => (/* binding */ isAction),\n/* harmony export */ isBoxedObservable: () => (/* binding */ isObservableValue),\n/* harmony export */ isComputed: () => (/* binding */ isComputed),\n/* harmony export */ isComputedProp: () => (/* binding */ isComputedProp),\n/* harmony export */ isFlow: () => (/* binding */ isFlow),\n/* harmony export */ isFlowCancellationError: () => (/* binding */ isFlowCancellationError),\n/* harmony export */ isObservable: () => (/* binding */ isObservable),\n/* harmony export */ isObservableArray: () => (/* binding */ isObservableArray),\n/* harmony export */ isObservableMap: () => (/* binding */ isObservableMap),\n/* harmony export */ isObservableObject: () => (/* binding */ isObservableObject),\n/* harmony export */ isObservableProp: () => (/* binding */ isObservableProp),\n/* harmony export */ isObservableSet: () => (/* binding */ isObservableSet),\n/* harmony export */ keys: () => (/* binding */ keys),\n/* harmony export */ makeAutoObservable: () => (/* binding */ makeAutoObservable),\n/* harmony export */ makeObservable: () => (/* binding */ makeObservable),\n/* harmony export */ observable: () => (/* binding */ observable),\n/* harmony export */ observe: () => (/* binding */ observe),\n/* harmony export */ onBecomeObserved: () => (/* binding */ onBecomeObserved),\n/* harmony export */ onBecomeUnobserved: () => (/* binding */ onBecomeUnobserved),\n/* harmony export */ onReactionError: () => (/* binding */ onReactionError),\n/* harmony export */ override: () => (/* binding */ override),\n/* harmony export */ ownKeys: () => (/* binding */ apiOwnKeys),\n/* harmony export */ reaction: () => (/* binding */ reaction),\n/* harmony export */ remove: () => (/* binding */ remove),\n/* harmony export */ runInAction: () => (/* binding */ runInAction),\n/* harmony export */ set: () => (/* binding */ set),\n/* harmony export */ spy: () => (/* binding */ spy),\n/* harmony export */ toJS: () => (/* binding */ toJS),\n/* harmony export */ trace: () => (/* binding */ trace),\n/* harmony export */ transaction: () => (/* binding */ transaction),\n/* harmony export */ untracked: () => (/* binding */ untracked),\n/* harmony export */ values: () => (/* binding */ values),\n/* harmony export */ when: () => (/* binding */ when)\n/* harmony export */ });\nvar niceErrors = {\n 0: \"Invalid value for configuration 'enforceActions', expected 'never', 'always' or 'observed'\",\n 1: function _(annotationType, key) {\n return \"Cannot apply '\" + annotationType + \"' to '\" + key.toString() + \"': Field not found.\";\n },\n /*\n 2(prop) {\n return `invalid decorator for '${prop.toString()}'`\n },\n 3(prop) {\n return `Cannot decorate '${prop.toString()}': action can only be used on properties with a function value.`\n },\n 4(prop) {\n return `Cannot decorate '${prop.toString()}': computed can only be used on getter properties.`\n },\n */\n 5: \"'keys()' can only be used on observable objects, arrays, sets and maps\",\n 6: \"'values()' can only be used on observable objects, arrays, sets and maps\",\n 7: \"'entries()' can only be used on observable objects, arrays and maps\",\n 8: \"'set()' can only be used on observable objects, arrays and maps\",\n 9: \"'remove()' can only be used on observable objects, arrays and maps\",\n 10: \"'has()' can only be used on observable objects, arrays and maps\",\n 11: \"'get()' can only be used on observable objects, arrays and maps\",\n 12: \"Invalid annotation\",\n 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)\",\n 14: \"Intercept handlers should return nothing or a change object\",\n 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)\",\n 16: \"Modification exception: the internal structure of an observable array was changed.\",\n 17: function _(index, length) {\n return \"[mobx.array] Index out of bounds, \" + index + \" is larger than \" + length;\n },\n 18: \"mobx.map requires Map polyfill for the current browser. Check babel-polyfill or core-js/es6/map.js\",\n 19: function _(other) {\n return \"Cannot initialize from classes that inherit from Map: \" + other.constructor.name;\n },\n 20: function _(other) {\n return \"Cannot initialize map from \" + other;\n },\n 21: function _(dataStructure) {\n return \"Cannot convert to map from '\" + dataStructure + \"'\";\n },\n 22: \"mobx.set requires Set polyfill for the current browser. Check babel-polyfill or core-js/es6/set.js\",\n 23: \"It is not possible to get index atoms from arrays\",\n 24: function _(thing) {\n return \"Cannot obtain administration from \" + thing;\n },\n 25: function _(property, name) {\n return \"the entry '\" + property + \"' does not exist in the observable map '\" + name + \"'\";\n },\n 26: \"please specify a property\",\n 27: function _(property, name) {\n return \"no observable property '\" + property.toString() + \"' found on the observable object '\" + name + \"'\";\n },\n 28: function _(thing) {\n return \"Cannot obtain atom from \" + thing;\n },\n 29: \"Expecting some object\",\n 30: \"invalid action stack. did you forget to finish an action?\",\n 31: \"missing option for computed: get\",\n 32: function _(name, derivation) {\n return \"Cycle detected in computation \" + name + \": \" + derivation;\n },\n 33: function _(name) {\n return \"The setter of computed value '\" + name + \"' is trying to update itself. Did you intend to update an _observable_ value, instead of the computed property?\";\n },\n 34: function _(name) {\n return \"[ComputedValue '\" + name + \"'] It is not possible to assign a new value to a computed value.\";\n },\n 35: \"There are multiple, different versions of MobX active. Make sure MobX is loaded only once or use `configure({ isolateGlobalState: true })`\",\n 36: \"isolateGlobalState should be called before MobX is running any reactions\",\n 37: function _(method) {\n return \"[mobx] `observableArray.\" + method + \"()` mutates the array in-place, which is not allowed inside a derivation. Use `array.slice().\" + method + \"()` instead\";\n },\n 38: \"'ownKeys()' can only be used on observable objects\",\n 39: \"'defineProperty()' can only be used on observable objects\"\n};\nvar errors = true ? niceErrors : 0;\nfunction die(error) {\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n if (true) {\n var e = typeof error === \"string\" ? error : errors[error];\n if (typeof e === \"function\") e = e.apply(null, args);\n throw new Error(\"[MobX] \" + e);\n }\n throw new Error(typeof error === \"number\" ? \"[MobX] minified error nr: \" + error + (args.length ? \" \" + args.map(String).join(\",\") : \"\") + \". Find the full error at: https://github.com/mobxjs/mobx/blob/main/packages/mobx/src/errors.ts\" : \"[MobX] \" + error);\n}\n\nvar mockGlobal = {};\nfunction getGlobal() {\n if (typeof globalThis !== \"undefined\") {\n return globalThis;\n }\n if (typeof window !== \"undefined\") {\n return window;\n }\n if (typeof __webpack_require__.g !== \"undefined\") {\n return __webpack_require__.g;\n }\n if (typeof self !== \"undefined\") {\n return self;\n }\n return mockGlobal;\n}\n\n// We shorten anything used > 5 times\nvar assign = Object.assign;\nvar getDescriptor = Object.getOwnPropertyDescriptor;\nvar defineProperty = Object.defineProperty;\nvar objectPrototype = Object.prototype;\nvar EMPTY_ARRAY = [];\nObject.freeze(EMPTY_ARRAY);\nvar EMPTY_OBJECT = {};\nObject.freeze(EMPTY_OBJECT);\nvar hasProxy = typeof Proxy !== \"undefined\";\nvar plainObjectString = /*#__PURE__*/Object.toString();\nfunction assertProxies() {\n if (!hasProxy) {\n die( true ? \"`Proxy` objects are not available in the current environment. Please configure MobX to enable a fallback implementation.`\" : 0);\n }\n}\nfunction warnAboutProxyRequirement(msg) {\n if ( true && globalState.verifyProxies) {\n die(\"MobX is currently configured to be able to run in ES5 mode, but in ES5 MobX won't be able to \" + msg);\n }\n}\nfunction getNextId() {\n return ++globalState.mobxGuid;\n}\n/**\n * Makes sure that the provided function is invoked at most once.\n */\nfunction once(func) {\n var invoked = false;\n return function () {\n if (invoked) {\n return;\n }\n invoked = true;\n return func.apply(this, arguments);\n };\n}\nvar noop = function noop() {};\nfunction isFunction(fn) {\n return typeof fn === \"function\";\n}\nfunction isStringish(value) {\n var t = typeof value;\n switch (t) {\n case \"string\":\n case \"symbol\":\n case \"number\":\n return true;\n }\n return false;\n}\nfunction isObject(value) {\n return value !== null && typeof value === \"object\";\n}\nfunction isPlainObject(value) {\n if (!isObject(value)) {\n return false;\n }\n var proto = Object.getPrototypeOf(value);\n if (proto == null) {\n return true;\n }\n var protoConstructor = Object.hasOwnProperty.call(proto, \"constructor\") && proto.constructor;\n return typeof protoConstructor === \"function\" && protoConstructor.toString() === plainObjectString;\n}\n// https://stackoverflow.com/a/37865170\nfunction isGenerator(obj) {\n var constructor = obj == null ? void 0 : obj.constructor;\n if (!constructor) {\n return false;\n }\n if (\"GeneratorFunction\" === constructor.name || \"GeneratorFunction\" === constructor.displayName) {\n return true;\n }\n return false;\n}\nfunction addHiddenProp(object, propName, value) {\n defineProperty(object, propName, {\n enumerable: false,\n writable: true,\n configurable: true,\n value: value\n });\n}\nfunction addHiddenFinalProp(object, propName, value) {\n defineProperty(object, propName, {\n enumerable: false,\n writable: false,\n configurable: true,\n value: value\n });\n}\nfunction createInstanceofPredicate(name, theClass) {\n var propName = \"isMobX\" + name;\n theClass.prototype[propName] = true;\n return function (x) {\n return isObject(x) && x[propName] === true;\n };\n}\n/**\n * Yields true for both native and observable Map, even across different windows.\n */\nfunction isES6Map(thing) {\n return thing != null && Object.prototype.toString.call(thing) === \"[object Map]\";\n}\n/**\n * Makes sure a Map is an instance of non-inherited native or observable Map.\n */\nfunction isPlainES6Map(thing) {\n var mapProto = Object.getPrototypeOf(thing);\n var objectProto = Object.getPrototypeOf(mapProto);\n var nullProto = Object.getPrototypeOf(objectProto);\n return nullProto === null;\n}\n/**\n * Yields true for both native and observable Set, even across different windows.\n */\nfunction isES6Set(thing) {\n return thing != null && Object.prototype.toString.call(thing) === \"[object Set]\";\n}\nvar hasGetOwnPropertySymbols = typeof Object.getOwnPropertySymbols !== \"undefined\";\n/**\n * Returns the following: own enumerable keys and symbols.\n */\nfunction getPlainObjectKeys(object) {\n var keys = Object.keys(object);\n // Not supported in IE, so there are not going to be symbol props anyway...\n if (!hasGetOwnPropertySymbols) {\n return keys;\n }\n var symbols = Object.getOwnPropertySymbols(object);\n if (!symbols.length) {\n return keys;\n }\n return [].concat(keys, symbols.filter(function (s) {\n return objectPrototype.propertyIsEnumerable.call(object, s);\n }));\n}\n// From Immer utils\n// Returns all own keys, including non-enumerable and symbolic\nvar ownKeys = typeof Reflect !== \"undefined\" && Reflect.ownKeys ? Reflect.ownKeys : hasGetOwnPropertySymbols ? function (obj) {\n return Object.getOwnPropertyNames(obj).concat(Object.getOwnPropertySymbols(obj));\n} : /* istanbul ignore next */Object.getOwnPropertyNames;\nfunction stringifyKey(key) {\n if (typeof key === \"string\") {\n return key;\n }\n if (typeof key === \"symbol\") {\n return key.toString();\n }\n return new String(key).toString();\n}\nfunction toPrimitive(value) {\n return value === null ? null : typeof value === \"object\" ? \"\" + value : value;\n}\nfunction hasProp(target, prop) {\n return objectPrototype.hasOwnProperty.call(target, prop);\n}\n// From Immer utils\nvar getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors || function getOwnPropertyDescriptors(target) {\n // Polyfill needed for Hermes and IE, see https://github.com/facebook/hermes/issues/274\n var res = {};\n // Note: without polyfill for ownKeys, symbols won't be picked up\n ownKeys(target).forEach(function (key) {\n res[key] = getDescriptor(target, key);\n });\n return res;\n};\nfunction getFlag(flags, mask) {\n return !!(flags & mask);\n}\nfunction setFlag(flags, mask, newValue) {\n if (newValue) {\n flags |= mask;\n } else {\n flags &= ~mask;\n }\n return flags;\n}\n\nfunction _arrayLikeToArray(r, a) {\n (null == a || a > r.length) && (a = r.length);\n for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];\n return n;\n}\nfunction _defineProperties(e, r) {\n for (var t = 0; t < r.length; t++) {\n var o = r[t];\n o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);\n }\n}\nfunction _createClass(e, r, t) {\n return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", {\n writable: !1\n }), e;\n}\nfunction _createForOfIteratorHelperLoose(r, e) {\n var t = \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"];\n if (t) return (t = t.call(r)).next.bind(t);\n if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && \"number\" == typeof r.length) {\n t && (r = t);\n var o = 0;\n return function () {\n return o >= r.length ? {\n done: !0\n } : {\n done: !1,\n value: r[o++]\n };\n };\n }\n throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\nfunction _extends() {\n return _extends = Object.assign ? Object.assign.bind() : function (n) {\n for (var e = 1; e < arguments.length; e++) {\n var t = arguments[e];\n for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);\n }\n return n;\n }, _extends.apply(null, arguments);\n}\nfunction _inheritsLoose(t, o) {\n t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);\n}\nfunction _setPrototypeOf(t, e) {\n return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {\n return t.__proto__ = e, t;\n }, _setPrototypeOf(t, e);\n}\nfunction _toPrimitive(t, r) {\n if (\"object\" != typeof t || !t) return t;\n var e = t[Symbol.toPrimitive];\n if (void 0 !== e) {\n var i = e.call(t, r || \"default\");\n if (\"object\" != typeof i) return i;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (\"string\" === r ? String : Number)(t);\n}\nfunction _toPropertyKey(t) {\n var i = _toPrimitive(t, \"string\");\n return \"symbol\" == typeof i ? i : i + \"\";\n}\nfunction _unsupportedIterableToArray(r, a) {\n if (r) {\n if (\"string\" == typeof r) return _arrayLikeToArray(r, a);\n var t = {}.toString.call(r).slice(8, -1);\n return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;\n }\n}\n\nvar storedAnnotationsSymbol = /*#__PURE__*/Symbol(\"mobx-stored-annotations\");\n/**\n * Creates a function that acts as\n * - decorator\n * - annotation object\n */\nfunction createDecoratorAnnotation(annotation) {\n function decorator(target, property) {\n if (is20223Decorator(property)) {\n return annotation.decorate_20223_(target, property);\n } else {\n storeAnnotation(target, property, annotation);\n }\n }\n return Object.assign(decorator, annotation);\n}\n/**\n * Stores annotation to prototype,\n * so it can be inspected later by `makeObservable` called from constructor\n */\nfunction storeAnnotation(prototype, key, annotation) {\n if (!hasProp(prototype, storedAnnotationsSymbol)) {\n addHiddenProp(prototype, storedAnnotationsSymbol, _extends({}, prototype[storedAnnotationsSymbol]));\n }\n // @override must override something\n if ( true && isOverride(annotation) && !hasProp(prototype[storedAnnotationsSymbol], key)) {\n var fieldName = prototype.constructor.name + \".prototype.\" + key.toString();\n die(\"'\" + fieldName + \"' is decorated with 'override', \" + \"but no such decorated member was found on prototype.\");\n }\n // Cannot re-decorate\n assertNotDecorated(prototype, annotation, key);\n // Ignore override\n if (!isOverride(annotation)) {\n prototype[storedAnnotationsSymbol][key] = annotation;\n }\n}\nfunction assertNotDecorated(prototype, annotation, key) {\n if ( true && !isOverride(annotation) && hasProp(prototype[storedAnnotationsSymbol], key)) {\n var fieldName = prototype.constructor.name + \".prototype.\" + key.toString();\n var currentAnnotationType = prototype[storedAnnotationsSymbol][key].annotationType_;\n var requestedAnnotationType = annotation.annotationType_;\n die(\"Cannot apply '@\" + requestedAnnotationType + \"' to '\" + fieldName + \"':\" + (\"\\nThe field is already decorated with '@\" + currentAnnotationType + \"'.\") + \"\\nRe-decorating fields is not allowed.\" + \"\\nUse '@override' decorator for methods overridden by subclass.\");\n }\n}\n/**\n * Collects annotations from prototypes and stores them on target (instance)\n */\nfunction collectStoredAnnotations(target) {\n if (!hasProp(target, storedAnnotationsSymbol)) {\n // if (__DEV__ && !target[storedAnnotationsSymbol]) {\n // die(\n // `No annotations were passed to makeObservable, but no decorated members have been found either`\n // )\n // }\n // We need a copy as we will remove annotation from the list once it's applied.\n addHiddenProp(target, storedAnnotationsSymbol, _extends({}, target[storedAnnotationsSymbol]));\n }\n return target[storedAnnotationsSymbol];\n}\nfunction is20223Decorator(context) {\n return typeof context == \"object\" && typeof context[\"kind\"] == \"string\";\n}\nfunction assert20223DecoratorType(context, types) {\n if ( true && !types.includes(context.kind)) {\n die(\"The decorator applied to '\" + String(context.name) + \"' cannot be used on a \" + context.kind + \" element\");\n }\n}\n\nvar $mobx = /*#__PURE__*/Symbol(\"mobx administration\");\nvar Atom = /*#__PURE__*/function () {\n /**\n * Create a new atom. For debugging purposes it is recommended to give it a name.\n * The onBecomeObserved and onBecomeUnobserved callbacks can be used for resource management.\n */\n function Atom(name_) {\n if (name_ === void 0) {\n name_ = true ? \"Atom@\" + getNextId() : 0;\n }\n this.name_ = void 0;\n this.flags_ = 0;\n this.observers_ = new Set();\n this.lastAccessedBy_ = 0;\n this.lowestObserverState_ = IDerivationState_.NOT_TRACKING_;\n // onBecomeObservedListeners\n this.onBOL = void 0;\n // onBecomeUnobservedListeners\n this.onBUOL = void 0;\n this.name_ = name_;\n }\n // for effective unobserving. BaseAtom has true, for extra optimization, so its onBecomeUnobserved never gets called, because it's not needed\n var _proto = Atom.prototype;\n _proto.onBO = function onBO() {\n if (this.onBOL) {\n this.onBOL.forEach(function (listener) {\n return listener();\n });\n }\n };\n _proto.onBUO = function onBUO() {\n if (this.onBUOL) {\n this.onBUOL.forEach(function (listener) {\n return listener();\n });\n }\n }\n /**\n * Invoke this method to notify mobx that your atom has been used somehow.\n * Returns true if there is currently a reactive context.\n */;\n _proto.reportObserved = function reportObserved$1() {\n return reportObserved(this);\n }\n /**\n * Invoke this method _after_ this method has changed to signal mobx that all its observers should invalidate.\n */;\n _proto.reportChanged = function reportChanged() {\n startBatch();\n propagateChanged(this);\n endBatch();\n };\n _proto.toString = function toString() {\n return this.name_;\n };\n return _createClass(Atom, [{\n key: \"isBeingObserved\",\n get: function get() {\n return getFlag(this.flags_, Atom.isBeingObservedMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Atom.isBeingObservedMask_, newValue);\n }\n }, {\n key: \"isPendingUnobservation\",\n get: function get() {\n return getFlag(this.flags_, Atom.isPendingUnobservationMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Atom.isPendingUnobservationMask_, newValue);\n }\n }, {\n key: \"diffValue\",\n get: function get() {\n return getFlag(this.flags_, Atom.diffValueMask_) ? 1 : 0;\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Atom.diffValueMask_, newValue === 1 ? true : false);\n }\n }]);\n}();\nAtom.isBeingObservedMask_ = 1;\nAtom.isPendingUnobservationMask_ = 2;\nAtom.diffValueMask_ = 4;\nvar isAtom = /*#__PURE__*/createInstanceofPredicate(\"Atom\", Atom);\nfunction createAtom(name, onBecomeObservedHandler, onBecomeUnobservedHandler) {\n if (onBecomeObservedHandler === void 0) {\n onBecomeObservedHandler = noop;\n }\n if (onBecomeUnobservedHandler === void 0) {\n onBecomeUnobservedHandler = noop;\n }\n var atom = new Atom(name);\n // default `noop` listener will not initialize the hook Set\n if (onBecomeObservedHandler !== noop) {\n onBecomeObserved(atom, onBecomeObservedHandler);\n }\n if (onBecomeUnobservedHandler !== noop) {\n onBecomeUnobserved(atom, onBecomeUnobservedHandler);\n }\n return atom;\n}\n\nfunction identityComparer(a, b) {\n return a === b;\n}\nfunction structuralComparer(a, b) {\n return deepEqual(a, b);\n}\nfunction shallowComparer(a, b) {\n return deepEqual(a, b, 1);\n}\nfunction defaultComparer(a, b) {\n if (Object.is) {\n return Object.is(a, b);\n }\n return a === b ? a !== 0 || 1 / a === 1 / b : a !== a && b !== b;\n}\nvar comparer = {\n identity: identityComparer,\n structural: structuralComparer,\n \"default\": defaultComparer,\n shallow: shallowComparer\n};\n\nfunction deepEnhancer(v, _, name) {\n // it is an observable already, done\n if (isObservable(v)) {\n return v;\n }\n // something that can be converted and mutated?\n if (Array.isArray(v)) {\n return observable.array(v, {\n name: name\n });\n }\n if (isPlainObject(v)) {\n return observable.object(v, undefined, {\n name: name\n });\n }\n if (isES6Map(v)) {\n return observable.map(v, {\n name: name\n });\n }\n if (isES6Set(v)) {\n return observable.set(v, {\n name: name\n });\n }\n if (typeof v === \"function\" && !isAction(v) && !isFlow(v)) {\n if (isGenerator(v)) {\n return flow(v);\n } else {\n return autoAction(name, v);\n }\n }\n return v;\n}\nfunction shallowEnhancer(v, _, name) {\n if (v === undefined || v === null) {\n return v;\n }\n if (isObservableObject(v) || isObservableArray(v) || isObservableMap(v) || isObservableSet(v)) {\n return v;\n }\n if (Array.isArray(v)) {\n return observable.array(v, {\n name: name,\n deep: false\n });\n }\n if (isPlainObject(v)) {\n return observable.object(v, undefined, {\n name: name,\n deep: false\n });\n }\n if (isES6Map(v)) {\n return observable.map(v, {\n name: name,\n deep: false\n });\n }\n if (isES6Set(v)) {\n return observable.set(v, {\n name: name,\n deep: false\n });\n }\n if (true) {\n die(\"The shallow modifier / decorator can only used in combination with arrays, objects, maps and sets\");\n }\n}\nfunction referenceEnhancer(newValue) {\n // never turn into an observable\n return newValue;\n}\nfunction refStructEnhancer(v, oldValue) {\n if ( true && isObservable(v)) {\n die(\"observable.struct should not be used with observable values\");\n }\n if (deepEqual(v, oldValue)) {\n return oldValue;\n }\n return v;\n}\n\nvar OVERRIDE = \"override\";\nvar override = /*#__PURE__*/createDecoratorAnnotation({\n annotationType_: OVERRIDE,\n make_: make_,\n extend_: extend_,\n decorate_20223_: decorate_20223_\n});\nfunction isOverride(annotation) {\n return annotation.annotationType_ === OVERRIDE;\n}\nfunction make_(adm, key) {\n // Must not be plain object\n if ( true && adm.isPlainObject_) {\n die(\"Cannot apply '\" + this.annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + this.annotationType_ + \"' cannot be used on plain objects.\"));\n }\n // Must override something\n if ( true && !hasProp(adm.appliedAnnotations_, key)) {\n die(\"'\" + adm.name_ + \".\" + key.toString() + \"' is annotated with '\" + this.annotationType_ + \"', \" + \"but no such annotated member was found on prototype.\");\n }\n return 0 /* MakeResult.Cancel */;\n}\nfunction extend_(adm, key, descriptor, proxyTrap) {\n die(\"'\" + this.annotationType_ + \"' can only be used with 'makeObservable'\");\n}\nfunction decorate_20223_(desc, context) {\n console.warn(\"'\" + this.annotationType_ + \"' cannot be used with decorators - this is a no-op\");\n}\n\nfunction createActionAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$1,\n extend_: extend_$1,\n decorate_20223_: decorate_20223_$1\n };\n}\nfunction make_$1(adm, key, descriptor, source) {\n var _this$options_;\n // bound\n if ((_this$options_ = this.options_) != null && _this$options_.bound) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;\n }\n // own\n if (source === adm.target_) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 2 /* MakeResult.Continue */;\n }\n // prototype\n if (isAction(descriptor.value)) {\n // A prototype could have been annotated already by other constructor,\n // rest of the proto chain must be annotated already\n return 1 /* MakeResult.Break */;\n }\n var actionDescriptor = createActionDescriptor(adm, this, key, descriptor, false);\n defineProperty(source, key, actionDescriptor);\n return 2 /* MakeResult.Continue */;\n}\nfunction extend_$1(adm, key, descriptor, proxyTrap) {\n var actionDescriptor = createActionDescriptor(adm, this, key, descriptor);\n return adm.defineProperty_(key, actionDescriptor, proxyTrap);\n}\nfunction decorate_20223_$1(mthd, context) {\n if (true) {\n assert20223DecoratorType(context, [\"method\", \"field\"]);\n }\n var kind = context.kind,\n name = context.name,\n addInitializer = context.addInitializer;\n var ann = this;\n var _createAction = function _createAction(m) {\n var _ann$options_$name, _ann$options_, _ann$options_$autoAct, _ann$options_2;\n return createAction((_ann$options_$name = (_ann$options_ = ann.options_) == null ? void 0 : _ann$options_.name) != null ? _ann$options_$name : name.toString(), m, (_ann$options_$autoAct = (_ann$options_2 = ann.options_) == null ? void 0 : _ann$options_2.autoAction) != null ? _ann$options_$autoAct : false);\n };\n if (kind == \"field\") {\n return function (initMthd) {\n var _ann$options_3;\n var mthd = initMthd;\n if (!isAction(mthd)) {\n mthd = _createAction(mthd);\n }\n if ((_ann$options_3 = ann.options_) != null && _ann$options_3.bound) {\n mthd = mthd.bind(this);\n mthd.isMobxAction = true;\n }\n return mthd;\n };\n }\n if (kind == \"method\") {\n var _this$options_2;\n if (!isAction(mthd)) {\n mthd = _createAction(mthd);\n }\n if ((_this$options_2 = this.options_) != null && _this$options_2.bound) {\n addInitializer(function () {\n var self = this;\n var bound = self[name].bind(self);\n bound.isMobxAction = true;\n self[name] = bound;\n });\n }\n return mthd;\n }\n die(\"Cannot apply '\" + ann.annotationType_ + \"' to '\" + String(name) + \"' (kind: \" + kind + \"):\" + (\"\\n'\" + ann.annotationType_ + \"' can only be used on properties with a function value.\"));\n}\nfunction assertActionDescriptor(adm, _ref, key, _ref2) {\n var annotationType_ = _ref.annotationType_;\n var value = _ref2.value;\n if ( true && !isFunction(value)) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' can only be used on properties with a function value.\"));\n }\n}\nfunction createActionDescriptor(adm, annotation, key, descriptor,\n// provides ability to disable safeDescriptors for prototypes\nsafeDescriptors) {\n var _annotation$options_, _annotation$options_$, _annotation$options_2, _annotation$options_$2, _annotation$options_3, _annotation$options_4, _adm$proxy_2;\n if (safeDescriptors === void 0) {\n safeDescriptors = globalState.safeDescriptors;\n }\n assertActionDescriptor(adm, annotation, key, descriptor);\n var value = descriptor.value;\n if ((_annotation$options_ = annotation.options_) != null && _annotation$options_.bound) {\n var _adm$proxy_;\n value = value.bind((_adm$proxy_ = adm.proxy_) != null ? _adm$proxy_ : adm.target_);\n }\n return {\n value: createAction((_annotation$options_$ = (_annotation$options_2 = annotation.options_) == null ? void 0 : _annotation$options_2.name) != null ? _annotation$options_$ : key.toString(), value, (_annotation$options_$2 = (_annotation$options_3 = annotation.options_) == null ? void 0 : _annotation$options_3.autoAction) != null ? _annotation$options_$2 : false,\n // https://github.com/mobxjs/mobx/discussions/3140\n (_annotation$options_4 = annotation.options_) != null && _annotation$options_4.bound ? (_adm$proxy_2 = adm.proxy_) != null ? _adm$proxy_2 : adm.target_ : undefined),\n // Non-configurable for classes\n // prevents accidental field redefinition in subclass\n configurable: safeDescriptors ? adm.isPlainObject_ : true,\n // https://github.com/mobxjs/mobx/pull/2641#issuecomment-737292058\n enumerable: false,\n // Non-obsevable, therefore non-writable\n // Also prevents rewriting in subclass constructor\n writable: safeDescriptors ? false : true\n };\n}\n\nfunction createFlowAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$2,\n extend_: extend_$2,\n decorate_20223_: decorate_20223_$2\n };\n}\nfunction make_$2(adm, key, descriptor, source) {\n var _this$options_;\n // own\n if (source === adm.target_) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 2 /* MakeResult.Continue */;\n }\n // prototype\n // bound - must annotate protos to support super.flow()\n if ((_this$options_ = this.options_) != null && _this$options_.bound && (!hasProp(adm.target_, key) || !isFlow(adm.target_[key]))) {\n if (this.extend_(adm, key, descriptor, false) === null) {\n return 0 /* MakeResult.Cancel */;\n }\n }\n if (isFlow(descriptor.value)) {\n // A prototype could have been annotated already by other constructor,\n // rest of the proto chain must be annotated already\n return 1 /* MakeResult.Break */;\n }\n var flowDescriptor = createFlowDescriptor(adm, this, key, descriptor, false, false);\n defineProperty(source, key, flowDescriptor);\n return 2 /* MakeResult.Continue */;\n}\nfunction extend_$2(adm, key, descriptor, proxyTrap) {\n var _this$options_2;\n var flowDescriptor = createFlowDescriptor(adm, this, key, descriptor, (_this$options_2 = this.options_) == null ? void 0 : _this$options_2.bound);\n return adm.defineProperty_(key, flowDescriptor, proxyTrap);\n}\nfunction decorate_20223_$2(mthd, context) {\n var _this$options_3;\n if (true) {\n assert20223DecoratorType(context, [\"method\"]);\n }\n var name = context.name,\n addInitializer = context.addInitializer;\n if (!isFlow(mthd)) {\n mthd = flow(mthd);\n }\n if ((_this$options_3 = this.options_) != null && _this$options_3.bound) {\n addInitializer(function () {\n var self = this;\n var bound = self[name].bind(self);\n bound.isMobXFlow = true;\n self[name] = bound;\n });\n }\n return mthd;\n}\nfunction assertFlowDescriptor(adm, _ref, key, _ref2) {\n var annotationType_ = _ref.annotationType_;\n var value = _ref2.value;\n if ( true && !isFunction(value)) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' can only be used on properties with a generator function value.\"));\n }\n}\nfunction createFlowDescriptor(adm, annotation, key, descriptor, bound,\n// provides ability to disable safeDescriptors for prototypes\nsafeDescriptors) {\n if (safeDescriptors === void 0) {\n safeDescriptors = globalState.safeDescriptors;\n }\n assertFlowDescriptor(adm, annotation, key, descriptor);\n var value = descriptor.value;\n // In case of flow.bound, the descriptor can be from already annotated prototype\n if (!isFlow(value)) {\n value = flow(value);\n }\n if (bound) {\n var _adm$proxy_;\n // We do not keep original function around, so we bind the existing flow\n value = value.bind((_adm$proxy_ = adm.proxy_) != null ? _adm$proxy_ : adm.target_);\n // This is normally set by `flow`, but `bind` returns new function...\n value.isMobXFlow = true;\n }\n return {\n value: value,\n // Non-configurable for classes\n // prevents accidental field redefinition in subclass\n configurable: safeDescriptors ? adm.isPlainObject_ : true,\n // https://github.com/mobxjs/mobx/pull/2641#issuecomment-737292058\n enumerable: false,\n // Non-obsevable, therefore non-writable\n // Also prevents rewriting in subclass constructor\n writable: safeDescriptors ? false : true\n };\n}\n\nfunction createComputedAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$3,\n extend_: extend_$3,\n decorate_20223_: decorate_20223_$3\n };\n}\nfunction make_$3(adm, key, descriptor) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;\n}\nfunction extend_$3(adm, key, descriptor, proxyTrap) {\n assertComputedDescriptor(adm, this, key, descriptor);\n return adm.defineComputedProperty_(key, _extends({}, this.options_, {\n get: descriptor.get,\n set: descriptor.set\n }), proxyTrap);\n}\nfunction decorate_20223_$3(get, context) {\n if (true) {\n assert20223DecoratorType(context, [\"getter\"]);\n }\n var ann = this;\n var key = context.name,\n addInitializer = context.addInitializer;\n addInitializer(function () {\n var adm = asObservableObject(this)[$mobx];\n var options = _extends({}, ann.options_, {\n get: get,\n context: this\n });\n options.name || (options.name = true ? adm.name_ + \".\" + key.toString() : 0);\n adm.values_.set(key, new ComputedValue(options));\n });\n return function () {\n return this[$mobx].getObservablePropValue_(key);\n };\n}\nfunction assertComputedDescriptor(adm, _ref, key, _ref2) {\n var annotationType_ = _ref.annotationType_;\n var get = _ref2.get;\n if ( true && !get) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' can only be used on getter(+setter) properties.\"));\n }\n}\n\nfunction createObservableAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$4,\n extend_: extend_$4,\n decorate_20223_: decorate_20223_$4\n };\n}\nfunction make_$4(adm, key, descriptor) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;\n}\nfunction extend_$4(adm, key, descriptor, proxyTrap) {\n var _this$options_$enhanc, _this$options_;\n assertObservableDescriptor(adm, this, key, descriptor);\n return adm.defineObservableProperty_(key, descriptor.value, (_this$options_$enhanc = (_this$options_ = this.options_) == null ? void 0 : _this$options_.enhancer) != null ? _this$options_$enhanc : deepEnhancer, proxyTrap);\n}\nfunction decorate_20223_$4(desc, context) {\n if (true) {\n if (context.kind === \"field\") {\n throw die(\"Please use `@observable accessor \" + String(context.name) + \"` instead of `@observable \" + String(context.name) + \"`\");\n }\n assert20223DecoratorType(context, [\"accessor\"]);\n }\n var ann = this;\n var kind = context.kind,\n name = context.name;\n // The laziness here is not ideal... It's a workaround to how 2022.3 Decorators are implemented:\n // `addInitializer` callbacks are executed _before_ any accessors are defined (instead of the ideal-for-us right after each).\n // This means that, if we were to do our stuff in an `addInitializer`, we'd attempt to read a private slot\n // before it has been initialized. The runtime doesn't like that and throws a `Cannot read private member\n // from an object whose class did not declare it` error.\n // TODO: it seems that this will not be required anymore in the final version of the spec\n // See TODO: link\n var initializedObjects = new WeakSet();\n function initializeObservable(target, value) {\n var _ann$options_$enhance, _ann$options_;\n var adm = asObservableObject(target)[$mobx];\n var observable = new ObservableValue(value, (_ann$options_$enhance = (_ann$options_ = ann.options_) == null ? void 0 : _ann$options_.enhancer) != null ? _ann$options_$enhance : deepEnhancer, true ? adm.name_ + \".\" + name.toString() : 0, false);\n adm.values_.set(name, observable);\n initializedObjects.add(target);\n }\n if (kind == \"accessor\") {\n return {\n get: function get() {\n if (!initializedObjects.has(this)) {\n initializeObservable(this, desc.get.call(this));\n }\n return this[$mobx].getObservablePropValue_(name);\n },\n set: function set(value) {\n if (!initializedObjects.has(this)) {\n initializeObservable(this, value);\n }\n return this[$mobx].setObservablePropValue_(name, value);\n },\n init: function init(value) {\n if (!initializedObjects.has(this)) {\n initializeObservable(this, value);\n }\n return value;\n }\n };\n }\n return;\n}\nfunction assertObservableDescriptor(adm, _ref, key, descriptor) {\n var annotationType_ = _ref.annotationType_;\n if ( true && !(\"value\" in descriptor)) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' cannot be used on getter/setter properties\"));\n }\n}\n\nvar AUTO = \"true\";\nvar autoAnnotation = /*#__PURE__*/createAutoAnnotation();\nfunction createAutoAnnotation(options) {\n return {\n annotationType_: AUTO,\n options_: options,\n make_: make_$5,\n extend_: extend_$5,\n decorate_20223_: decorate_20223_$5\n };\n}\nfunction make_$5(adm, key, descriptor, source) {\n var _this$options_3, _this$options_4;\n // getter -> computed\n if (descriptor.get) {\n return computed.make_(adm, key, descriptor, source);\n }\n // lone setter -> action setter\n if (descriptor.set) {\n // TODO make action applicable to setter and delegate to action.make_\n var set = createAction(key.toString(), descriptor.set);\n // own\n if (source === adm.target_) {\n return adm.defineProperty_(key, {\n configurable: globalState.safeDescriptors ? adm.isPlainObject_ : true,\n set: set\n }) === null ? 0 /* MakeResult.Cancel */ : 2 /* MakeResult.Continue */;\n }\n // proto\n defineProperty(source, key, {\n configurable: true,\n set: set\n });\n return 2 /* MakeResult.Continue */;\n }\n // function on proto -> autoAction/flow\n if (source !== adm.target_ && typeof descriptor.value === \"function\") {\n var _this$options_2;\n if (isGenerator(descriptor.value)) {\n var _this$options_;\n var flowAnnotation = (_this$options_ = this.options_) != null && _this$options_.autoBind ? flow.bound : flow;\n return flowAnnotation.make_(adm, key, descriptor, source);\n }\n var actionAnnotation = (_this$options_2 = this.options_) != null && _this$options_2.autoBind ? autoAction.bound : autoAction;\n return actionAnnotation.make_(adm, key, descriptor, source);\n }\n // other -> observable\n // Copy props from proto as well, see test:\n // \"decorate should work with Object.create\"\n var observableAnnotation = ((_this$options_3 = this.options_) == null ? void 0 : _this$options_3.deep) === false ? observable.ref : observable;\n // if function respect autoBind option\n if (typeof descriptor.value === \"function\" && (_this$options_4 = this.options_) != null && _this$options_4.autoBind) {\n var _adm$proxy_;\n descriptor.value = descriptor.value.bind((_adm$proxy_ = adm.proxy_) != null ? _adm$proxy_ : adm.target_);\n }\n return observableAnnotation.make_(adm, key, descriptor, source);\n}\nfunction extend_$5(adm, key, descriptor, proxyTrap) {\n var _this$options_5, _this$options_6;\n // getter -> computed\n if (descriptor.get) {\n return computed.extend_(adm, key, descriptor, proxyTrap);\n }\n // lone setter -> action setter\n if (descriptor.set) {\n // TODO make action applicable to setter and delegate to action.extend_\n return adm.defineProperty_(key, {\n configurable: globalState.safeDescriptors ? adm.isPlainObject_ : true,\n set: createAction(key.toString(), descriptor.set)\n }, proxyTrap);\n }\n // other -> observable\n // if function respect autoBind option\n if (typeof descriptor.value === \"function\" && (_this$options_5 = this.options_) != null && _this$options_5.autoBind) {\n var _adm$proxy_2;\n descriptor.value = descriptor.value.bind((_adm$proxy_2 = adm.proxy_) != null ? _adm$proxy_2 : adm.target_);\n }\n var observableAnnotation = ((_this$options_6 = this.options_) == null ? void 0 : _this$options_6.deep) === false ? observable.ref : observable;\n return observableAnnotation.extend_(adm, key, descriptor, proxyTrap);\n}\nfunction decorate_20223_$5(desc, context) {\n die(\"'\" + this.annotationType_ + \"' cannot be used as a decorator\");\n}\n\nvar OBSERVABLE = \"observable\";\nvar OBSERVABLE_REF = \"observable.ref\";\nvar OBSERVABLE_SHALLOW = \"observable.shallow\";\nvar OBSERVABLE_STRUCT = \"observable.struct\";\n// Predefined bags of create observable options, to avoid allocating temporarily option objects\n// in the majority of cases\nvar defaultCreateObservableOptions = {\n deep: true,\n name: undefined,\n defaultDecorator: undefined,\n proxy: true\n};\nObject.freeze(defaultCreateObservableOptions);\nfunction asCreateObservableOptions(thing) {\n return thing || defaultCreateObservableOptions;\n}\nvar observableAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE);\nvar observableRefAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE_REF, {\n enhancer: referenceEnhancer\n});\nvar observableShallowAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE_SHALLOW, {\n enhancer: shallowEnhancer\n});\nvar observableStructAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE_STRUCT, {\n enhancer: refStructEnhancer\n});\nvar observableDecoratorAnnotation = /*#__PURE__*/createDecoratorAnnotation(observableAnnotation);\nfunction getEnhancerFromOptions(options) {\n return options.deep === true ? deepEnhancer : options.deep === false ? referenceEnhancer : getEnhancerFromAnnotation(options.defaultDecorator);\n}\nfunction getAnnotationFromOptions(options) {\n var _options$defaultDecor;\n return options ? (_options$defaultDecor = options.defaultDecorator) != null ? _options$defaultDecor : createAutoAnnotation(options) : undefined;\n}\nfunction getEnhancerFromAnnotation(annotation) {\n var _annotation$options_$, _annotation$options_;\n return !annotation ? deepEnhancer : (_annotation$options_$ = (_annotation$options_ = annotation.options_) == null ? void 0 : _annotation$options_.enhancer) != null ? _annotation$options_$ : deepEnhancer;\n}\n/**\n * Turns an object, array or function into a reactive structure.\n * @param v the value which should become observable.\n */\nfunction createObservable(v, arg2, arg3) {\n // @observable someProp; (2022.3 Decorators)\n if (is20223Decorator(arg2)) {\n return observableAnnotation.decorate_20223_(v, arg2);\n }\n // @observable someProp;\n if (isStringish(arg2)) {\n storeAnnotation(v, arg2, observableAnnotation);\n return;\n }\n // already observable - ignore\n if (isObservable(v)) {\n return v;\n }\n // plain object\n if (isPlainObject(v)) {\n return observable.object(v, arg2, arg3);\n }\n // Array\n if (Array.isArray(v)) {\n return observable.array(v, arg2);\n }\n // Map\n if (isES6Map(v)) {\n return observable.map(v, arg2);\n }\n // Set\n if (isES6Set(v)) {\n return observable.set(v, arg2);\n }\n // other object - ignore\n if (typeof v === \"object\" && v !== null) {\n return v;\n }\n // anything else\n return observable.box(v, arg2);\n}\nassign(createObservable, observableDecoratorAnnotation);\nvar observableFactories = {\n box: function box(value, options) {\n var o = asCreateObservableOptions(options);\n return new ObservableValue(value, getEnhancerFromOptions(o), o.name, true, o.equals);\n },\n array: function array(initialValues, options) {\n var o = asCreateObservableOptions(options);\n return (globalState.useProxies === false || o.proxy === false ? createLegacyArray : createObservableArray)(initialValues, getEnhancerFromOptions(o), o.name);\n },\n map: function map(initialValues, options) {\n var o = asCreateObservableOptions(options);\n return new ObservableMap(initialValues, getEnhancerFromOptions(o), o.name);\n },\n set: function set(initialValues, options) {\n var o = asCreateObservableOptions(options);\n return new ObservableSet(initialValues, getEnhancerFromOptions(o), o.name);\n },\n object: function object(props, decorators, options) {\n return initObservable(function () {\n return extendObservable(globalState.useProxies === false || (options == null ? void 0 : options.proxy) === false ? asObservableObject({}, options) : asDynamicObservableObject({}, options), props, decorators);\n });\n },\n ref: /*#__PURE__*/createDecoratorAnnotation(observableRefAnnotation),\n shallow: /*#__PURE__*/createDecoratorAnnotation(observableShallowAnnotation),\n deep: observableDecoratorAnnotation,\n struct: /*#__PURE__*/createDecoratorAnnotation(observableStructAnnotation)\n};\n// eslint-disable-next-line\nvar observable = /*#__PURE__*/assign(createObservable, observableFactories);\n\nvar COMPUTED = \"computed\";\nvar COMPUTED_STRUCT = \"computed.struct\";\nvar computedAnnotation = /*#__PURE__*/createComputedAnnotation(COMPUTED);\nvar computedStructAnnotation = /*#__PURE__*/createComputedAnnotation(COMPUTED_STRUCT, {\n equals: comparer.structural\n});\n/**\n * Decorator for class properties: @computed get value() { return expr; }.\n * For legacy purposes also invokable as ES5 observable created: `computed(() => expr)`;\n */\nvar computed = function computed(arg1, arg2) {\n if (is20223Decorator(arg2)) {\n // @computed (2022.3 Decorators)\n return computedAnnotation.decorate_20223_(arg1, arg2);\n }\n if (isStringish(arg2)) {\n // @computed\n return storeAnnotation(arg1, arg2, computedAnnotation);\n }\n if (isPlainObject(arg1)) {\n // @computed({ options })\n return createDecoratorAnnotation(createComputedAnnotation(COMPUTED, arg1));\n }\n // computed(expr, options?)\n if (true) {\n if (!isFunction(arg1)) {\n die(\"First argument to `computed` should be an expression.\");\n }\n if (isFunction(arg2)) {\n die(\"A setter as second argument is no longer supported, use `{ set: fn }` option instead\");\n }\n }\n var opts = isPlainObject(arg2) ? arg2 : {};\n opts.get = arg1;\n opts.name || (opts.name = arg1.name || \"\"); /* for generated name */\n return new ComputedValue(opts);\n};\nObject.assign(computed, computedAnnotation);\ncomputed.struct = /*#__PURE__*/createDecoratorAnnotation(computedStructAnnotation);\n\nvar _getDescriptor$config, _getDescriptor;\n// we don't use globalState for these in order to avoid possible issues with multiple\n// mobx versions\nvar currentActionId = 0;\nvar nextActionId = 1;\nvar isFunctionNameConfigurable = (_getDescriptor$config = (_getDescriptor = /*#__PURE__*/getDescriptor(function () {}, \"name\")) == null ? void 0 : _getDescriptor.configurable) != null ? _getDescriptor$config : false;\n// we can safely recycle this object\nvar tmpNameDescriptor = {\n value: \"action\",\n configurable: true,\n writable: false,\n enumerable: false\n};\nfunction createAction(actionName, fn, autoAction, ref) {\n if (autoAction === void 0) {\n autoAction = false;\n }\n if (true) {\n if (!isFunction(fn)) {\n die(\"`action` can only be invoked on functions\");\n }\n if (typeof actionName !== \"string\" || !actionName) {\n die(\"actions should have valid names, got: '\" + actionName + \"'\");\n }\n }\n function res() {\n return executeAction(actionName, autoAction, fn, ref || this, arguments);\n }\n res.isMobxAction = true;\n res.toString = function () {\n return fn.toString();\n };\n if (isFunctionNameConfigurable) {\n tmpNameDescriptor.value = actionName;\n defineProperty(res, \"name\", tmpNameDescriptor);\n }\n return res;\n}\nfunction executeAction(actionName, canRunAsDerivation, fn, scope, args) {\n var runInfo = _startAction(actionName, canRunAsDerivation, scope, args);\n try {\n return fn.apply(scope, args);\n } catch (err) {\n runInfo.error_ = err;\n throw err;\n } finally {\n _endAction(runInfo);\n }\n}\nfunction _startAction(actionName, canRunAsDerivation,\n// true for autoAction\nscope, args) {\n var notifySpy_ = true && isSpyEnabled() && !!actionName;\n var startTime_ = 0;\n if ( true && notifySpy_) {\n startTime_ = Date.now();\n var flattenedArgs = args ? Array.from(args) : EMPTY_ARRAY;\n spyReportStart({\n type: ACTION,\n name: actionName,\n object: scope,\n arguments: flattenedArgs\n });\n }\n var prevDerivation_ = globalState.trackingDerivation;\n var runAsAction = !canRunAsDerivation || !prevDerivation_;\n startBatch();\n var prevAllowStateChanges_ = globalState.allowStateChanges; // by default preserve previous allow\n if (runAsAction) {\n untrackedStart();\n prevAllowStateChanges_ = allowStateChangesStart(true);\n }\n var prevAllowStateReads_ = allowStateReadsStart(true);\n var runInfo = {\n runAsAction_: runAsAction,\n prevDerivation_: prevDerivation_,\n prevAllowStateChanges_: prevAllowStateChanges_,\n prevAllowStateReads_: prevAllowStateReads_,\n notifySpy_: notifySpy_,\n startTime_: startTime_,\n actionId_: nextActionId++,\n parentActionId_: currentActionId\n };\n currentActionId = runInfo.actionId_;\n return runInfo;\n}\nfunction _endAction(runInfo) {\n if (currentActionId !== runInfo.actionId_) {\n die(30);\n }\n currentActionId = runInfo.parentActionId_;\n if (runInfo.error_ !== undefined) {\n globalState.suppressReactionErrors = true;\n }\n allowStateChangesEnd(runInfo.prevAllowStateChanges_);\n allowStateReadsEnd(runInfo.prevAllowStateReads_);\n endBatch();\n if (runInfo.runAsAction_) {\n untrackedEnd(runInfo.prevDerivation_);\n }\n if ( true && runInfo.notifySpy_) {\n spyReportEnd({\n time: Date.now() - runInfo.startTime_\n });\n }\n globalState.suppressReactionErrors = false;\n}\nfunction allowStateChanges(allowStateChanges, func) {\n var prev = allowStateChangesStart(allowStateChanges);\n try {\n return func();\n } finally {\n allowStateChangesEnd(prev);\n }\n}\nfunction allowStateChangesStart(allowStateChanges) {\n var prev = globalState.allowStateChanges;\n globalState.allowStateChanges = allowStateChanges;\n return prev;\n}\nfunction allowStateChangesEnd(prev) {\n globalState.allowStateChanges = prev;\n}\n\nvar CREATE = \"create\";\nvar ObservableValue = /*#__PURE__*/function (_Atom) {\n function ObservableValue(value, enhancer, name_, notifySpy, equals) {\n var _this;\n if (name_ === void 0) {\n name_ = true ? \"ObservableValue@\" + getNextId() : 0;\n }\n if (notifySpy === void 0) {\n notifySpy = true;\n }\n if (equals === void 0) {\n equals = comparer[\"default\"];\n }\n _this = _Atom.call(this, name_) || this;\n _this.enhancer = void 0;\n _this.name_ = void 0;\n _this.equals = void 0;\n _this.hasUnreportedChange_ = false;\n _this.interceptors_ = void 0;\n _this.changeListeners_ = void 0;\n _this.value_ = void 0;\n _this.dehancer = void 0;\n _this.enhancer = enhancer;\n _this.name_ = name_;\n _this.equals = equals;\n _this.value_ = enhancer(value, undefined, name_);\n if ( true && notifySpy && isSpyEnabled()) {\n // only notify spy if this is a stand-alone observable\n spyReport({\n type: CREATE,\n object: _this,\n observableKind: \"value\",\n debugObjectName: _this.name_,\n newValue: \"\" + _this.value_\n });\n }\n return _this;\n }\n _inheritsLoose(ObservableValue, _Atom);\n var _proto = ObservableValue.prototype;\n _proto.dehanceValue = function dehanceValue(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.set = function set(newValue) {\n var oldValue = this.value_;\n newValue = this.prepareNewValue_(newValue);\n if (newValue !== globalState.UNCHANGED) {\n var notifySpy = isSpyEnabled();\n if ( true && notifySpy) {\n spyReportStart({\n type: UPDATE,\n object: this,\n observableKind: \"value\",\n debugObjectName: this.name_,\n newValue: newValue,\n oldValue: oldValue\n });\n }\n this.setNewValue_(newValue);\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n };\n _proto.prepareNewValue_ = function prepareNewValue_(newValue) {\n checkIfStateModificationsAreAllowed(this);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this,\n type: UPDATE,\n newValue: newValue\n });\n if (!change) {\n return globalState.UNCHANGED;\n }\n newValue = change.newValue;\n }\n // apply modifier\n newValue = this.enhancer(newValue, this.value_, this.name_);\n return this.equals(this.value_, newValue) ? globalState.UNCHANGED : newValue;\n };\n _proto.setNewValue_ = function setNewValue_(newValue) {\n var oldValue = this.value_;\n this.value_ = newValue;\n this.reportChanged();\n if (hasListeners(this)) {\n notifyListeners(this, {\n type: UPDATE,\n object: this,\n newValue: newValue,\n oldValue: oldValue\n });\n }\n };\n _proto.get = function get() {\n this.reportObserved();\n return this.dehanceValue(this.value_);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n if (fireImmediately) {\n listener({\n observableKind: \"value\",\n debugObjectName: this.name_,\n object: this,\n type: UPDATE,\n newValue: this.value_,\n oldValue: undefined\n });\n }\n return registerListener(this, listener);\n };\n _proto.raw = function raw() {\n // used by MST ot get undehanced value\n return this.value_;\n };\n _proto.toJSON = function toJSON() {\n return this.get();\n };\n _proto.toString = function toString() {\n return this.name_ + \"[\" + this.value_ + \"]\";\n };\n _proto.valueOf = function valueOf() {\n return toPrimitive(this.get());\n };\n _proto[Symbol.toPrimitive] = function () {\n return this.valueOf();\n };\n return ObservableValue;\n}(Atom);\nvar isObservableValue = /*#__PURE__*/createInstanceofPredicate(\"ObservableValue\", ObservableValue);\n\n/**\n * A node in the state dependency root that observes other nodes, and can be observed itself.\n *\n * ComputedValue will remember the result of the computation for the duration of the batch, or\n * while being observed.\n *\n * During this time it will recompute only when one of its direct dependencies changed,\n * but only when it is being accessed with `ComputedValue.get()`.\n *\n * Implementation description:\n * 1. First time it's being accessed it will compute and remember result\n * give back remembered result until 2. happens\n * 2. First time any deep dependency change, propagate POSSIBLY_STALE to all observers, wait for 3.\n * 3. When it's being accessed, recompute if any shallow dependency changed.\n * if result changed: propagate STALE to all observers, that were POSSIBLY_STALE from the last step.\n * go to step 2. either way\n *\n * If at any point it's outside batch and it isn't observed: reset everything and go to 1.\n */\nvar ComputedValue = /*#__PURE__*/function () {\n /**\n * Create a new computed value based on a function expression.\n *\n * The `name` property is for debug purposes only.\n *\n * The `equals` property specifies the comparer function to use to determine if a newly produced\n * value differs from the previous value. Two comparers are provided in the library; `defaultComparer`\n * compares based on identity comparison (===), and `structuralComparer` deeply compares the structure.\n * Structural comparison can be convenient if you always produce a new aggregated object and\n * don't want to notify observers if it is structurally the same.\n * This is useful for working with vectors, mouse coordinates etc.\n */\n function ComputedValue(options) {\n this.dependenciesState_ = IDerivationState_.NOT_TRACKING_;\n this.observing_ = [];\n // nodes we are looking at. Our value depends on these nodes\n this.newObserving_ = null;\n // during tracking it's an array with new observed observers\n this.observers_ = new Set();\n this.runId_ = 0;\n this.lastAccessedBy_ = 0;\n this.lowestObserverState_ = IDerivationState_.UP_TO_DATE_;\n this.unboundDepsCount_ = 0;\n this.value_ = new CaughtException(null);\n this.name_ = void 0;\n this.triggeredBy_ = void 0;\n this.flags_ = 0;\n this.derivation = void 0;\n // N.B: unminified as it is used by MST\n this.setter_ = void 0;\n this.isTracing_ = TraceMode.NONE;\n this.scope_ = void 0;\n this.equals_ = void 0;\n this.requiresReaction_ = void 0;\n this.keepAlive_ = void 0;\n this.onBOL = void 0;\n this.onBUOL = void 0;\n if (!options.get) {\n die(31);\n }\n this.derivation = options.get;\n this.name_ = options.name || ( true ? \"ComputedValue@\" + getNextId() : 0);\n if (options.set) {\n this.setter_ = createAction( true ? this.name_ + \"-setter\" : 0, options.set);\n }\n this.equals_ = options.equals || (options.compareStructural || options.struct ? comparer.structural : comparer[\"default\"]);\n this.scope_ = options.context;\n this.requiresReaction_ = options.requiresReaction;\n this.keepAlive_ = !!options.keepAlive;\n }\n var _proto = ComputedValue.prototype;\n _proto.onBecomeStale_ = function onBecomeStale_() {\n propagateMaybeChanged(this);\n };\n _proto.onBO = function onBO() {\n if (this.onBOL) {\n this.onBOL.forEach(function (listener) {\n return listener();\n });\n }\n };\n _proto.onBUO = function onBUO() {\n if (this.onBUOL) {\n this.onBUOL.forEach(function (listener) {\n return listener();\n });\n }\n }\n // to check for cycles\n ;\n /**\n * Returns the current value of this computed value.\n * Will evaluate its computation first if needed.\n */\n _proto.get = function get() {\n if (this.isComputing) {\n die(32, this.name_, this.derivation);\n }\n if (globalState.inBatch === 0 &&\n // !globalState.trackingDerivatpion &&\n this.observers_.size === 0 && !this.keepAlive_) {\n if (shouldCompute(this)) {\n this.warnAboutUntrackedRead_();\n startBatch(); // See perf test 'computed memoization'\n this.value_ = this.computeValue_(false);\n endBatch();\n }\n } else {\n reportObserved(this);\n if (shouldCompute(this)) {\n var prevTrackingContext = globalState.trackingContext;\n if (this.keepAlive_ && !prevTrackingContext) {\n globalState.trackingContext = this;\n }\n if (this.trackAndCompute()) {\n propagateChangeConfirmed(this);\n }\n globalState.trackingContext = prevTrackingContext;\n }\n }\n var result = this.value_;\n if (isCaughtException(result)) {\n throw result.cause;\n }\n return result;\n };\n _proto.set = function set(value) {\n if (this.setter_) {\n if (this.isRunningSetter) {\n die(33, this.name_);\n }\n this.isRunningSetter = true;\n try {\n this.setter_.call(this.scope_, value);\n } finally {\n this.isRunningSetter = false;\n }\n } else {\n die(34, this.name_);\n }\n };\n _proto.trackAndCompute = function trackAndCompute() {\n // N.B: unminified as it is used by MST\n var oldValue = this.value_;\n var wasSuspended = /* see #1208 */this.dependenciesState_ === IDerivationState_.NOT_TRACKING_;\n var newValue = this.computeValue_(true);\n var changed = wasSuspended || isCaughtException(oldValue) || isCaughtException(newValue) || !this.equals_(oldValue, newValue);\n if (changed) {\n this.value_ = newValue;\n if ( true && isSpyEnabled()) {\n spyReport({\n observableKind: \"computed\",\n debugObjectName: this.name_,\n object: this.scope_,\n type: \"update\",\n oldValue: oldValue,\n newValue: newValue\n });\n }\n }\n return changed;\n };\n _proto.computeValue_ = function computeValue_(track) {\n this.isComputing = true;\n // don't allow state changes during computation\n var prev = allowStateChangesStart(false);\n var res;\n if (track) {\n res = trackDerivedFunction(this, this.derivation, this.scope_);\n } else {\n if (globalState.disableErrorBoundaries === true) {\n res = this.derivation.call(this.scope_);\n } else {\n try {\n res = this.derivation.call(this.scope_);\n } catch (e) {\n res = new CaughtException(e);\n }\n }\n }\n allowStateChangesEnd(prev);\n this.isComputing = false;\n return res;\n };\n _proto.suspend_ = function suspend_() {\n if (!this.keepAlive_) {\n clearObserving(this);\n this.value_ = undefined; // don't hold on to computed value!\n if ( true && this.isTracing_ !== TraceMode.NONE) {\n console.log(\"[mobx.trace] Computed value '\" + this.name_ + \"' was suspended and it will recompute on the next access.\");\n }\n }\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n var _this = this;\n var firstTime = true;\n var prevValue = undefined;\n return autorun(function () {\n // TODO: why is this in a different place than the spyReport() function? in all other observables it's called in the same place\n var newValue = _this.get();\n if (!firstTime || fireImmediately) {\n var prevU = untrackedStart();\n listener({\n observableKind: \"computed\",\n debugObjectName: _this.name_,\n type: UPDATE,\n object: _this,\n newValue: newValue,\n oldValue: prevValue\n });\n untrackedEnd(prevU);\n }\n firstTime = false;\n prevValue = newValue;\n });\n };\n _proto.warnAboutUntrackedRead_ = function warnAboutUntrackedRead_() {\n if (false) {}\n if (this.isTracing_ !== TraceMode.NONE) {\n console.log(\"[mobx.trace] Computed value '\" + this.name_ + \"' is being read outside a reactive context. Doing a full recompute.\");\n }\n if (typeof this.requiresReaction_ === \"boolean\" ? this.requiresReaction_ : globalState.computedRequiresReaction) {\n console.warn(\"[mobx] Computed value '\" + this.name_ + \"' is being read outside a reactive context. Doing a full recompute.\");\n }\n };\n _proto.toString = function toString() {\n return this.name_ + \"[\" + this.derivation.toString() + \"]\";\n };\n _proto.valueOf = function valueOf() {\n return toPrimitive(this.get());\n };\n _proto[Symbol.toPrimitive] = function () {\n return this.valueOf();\n };\n return _createClass(ComputedValue, [{\n key: \"isComputing\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isComputingMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isComputingMask_, newValue);\n }\n }, {\n key: \"isRunningSetter\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isRunningSetterMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isRunningSetterMask_, newValue);\n }\n }, {\n key: \"isBeingObserved\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isBeingObservedMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isBeingObservedMask_, newValue);\n }\n }, {\n key: \"isPendingUnobservation\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isPendingUnobservationMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isPendingUnobservationMask_, newValue);\n }\n }, {\n key: \"diffValue\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.diffValueMask_) ? 1 : 0;\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.diffValueMask_, newValue === 1 ? true : false);\n }\n }]);\n}();\nComputedValue.isComputingMask_ = 1;\nComputedValue.isRunningSetterMask_ = 2;\nComputedValue.isBeingObservedMask_ = 4;\nComputedValue.isPendingUnobservationMask_ = 8;\nComputedValue.diffValueMask_ = 16;\nvar isComputedValue = /*#__PURE__*/createInstanceofPredicate(\"ComputedValue\", ComputedValue);\n\nvar IDerivationState_;\n(function (IDerivationState_) {\n // before being run or (outside batch and not being observed)\n // at this point derivation is not holding any data about dependency tree\n IDerivationState_[IDerivationState_[\"NOT_TRACKING_\"] = -1] = \"NOT_TRACKING_\";\n // no shallow dependency changed since last computation\n // won't recalculate derivation\n // this is what makes mobx fast\n IDerivationState_[IDerivationState_[\"UP_TO_DATE_\"] = 0] = \"UP_TO_DATE_\";\n // some deep dependency changed, but don't know if shallow dependency changed\n // will require to check first if UP_TO_DATE or POSSIBLY_STALE\n // currently only ComputedValue will propagate POSSIBLY_STALE\n //\n // having this state is second big optimization:\n // don't have to recompute on every dependency change, but only when it's needed\n IDerivationState_[IDerivationState_[\"POSSIBLY_STALE_\"] = 1] = \"POSSIBLY_STALE_\";\n // A shallow dependency has changed since last computation and the derivation\n // will need to recompute when it's needed next.\n IDerivationState_[IDerivationState_[\"STALE_\"] = 2] = \"STALE_\";\n})(IDerivationState_ || (IDerivationState_ = {}));\nvar TraceMode;\n(function (TraceMode) {\n TraceMode[TraceMode[\"NONE\"] = 0] = \"NONE\";\n TraceMode[TraceMode[\"LOG\"] = 1] = \"LOG\";\n TraceMode[TraceMode[\"BREAK\"] = 2] = \"BREAK\";\n})(TraceMode || (TraceMode = {}));\nvar CaughtException = function CaughtException(cause) {\n this.cause = void 0;\n this.cause = cause;\n // Empty\n};\nfunction isCaughtException(e) {\n return e instanceof CaughtException;\n}\n/**\n * Finds out whether any dependency of the derivation has actually changed.\n * If dependenciesState is 1 then it will recalculate dependencies,\n * if any dependency changed it will propagate it by changing dependenciesState to 2.\n *\n * By iterating over the dependencies in the same order that they were reported and\n * stopping on the first change, all the recalculations are only called for ComputedValues\n * that will be tracked by derivation. That is because we assume that if the first x\n * dependencies of the derivation doesn't change then the derivation should run the same way\n * up until accessing x-th dependency.\n */\nfunction shouldCompute(derivation) {\n switch (derivation.dependenciesState_) {\n case IDerivationState_.UP_TO_DATE_:\n return false;\n case IDerivationState_.NOT_TRACKING_:\n case IDerivationState_.STALE_:\n return true;\n case IDerivationState_.POSSIBLY_STALE_:\n {\n // state propagation can occur outside of action/reactive context #2195\n var prevAllowStateReads = allowStateReadsStart(true);\n var prevUntracked = untrackedStart(); // no need for those computeds to be reported, they will be picked up in trackDerivedFunction.\n var obs = derivation.observing_,\n l = obs.length;\n for (var i = 0; i < l; i++) {\n var obj = obs[i];\n if (isComputedValue(obj)) {\n if (globalState.disableErrorBoundaries) {\n obj.get();\n } else {\n try {\n obj.get();\n } catch (e) {\n // we are not interested in the value *or* exception at this moment, but if there is one, notify all\n untrackedEnd(prevUntracked);\n allowStateReadsEnd(prevAllowStateReads);\n return true;\n }\n }\n // if ComputedValue `obj` actually changed it will be computed and propagated to its observers.\n // and `derivation` is an observer of `obj`\n // invariantShouldCompute(derivation)\n if (derivation.dependenciesState_ === IDerivationState_.STALE_) {\n untrackedEnd(prevUntracked);\n allowStateReadsEnd(prevAllowStateReads);\n return true;\n }\n }\n }\n changeDependenciesStateTo0(derivation);\n untrackedEnd(prevUntracked);\n allowStateReadsEnd(prevAllowStateReads);\n return false;\n }\n }\n}\nfunction isComputingDerivation() {\n return globalState.trackingDerivation !== null; // filter out actions inside computations\n}\nfunction checkIfStateModificationsAreAllowed(atom) {\n if (false) {}\n var hasObservers = atom.observers_.size > 0;\n // Should not be possible to change observed state outside strict mode, except during initialization, see #563\n if (!globalState.allowStateChanges && (hasObservers || globalState.enforceActions === \"always\")) {\n console.warn(\"[MobX] \" + (globalState.enforceActions ? \"Since strict-mode is enabled, changing (observed) observable values without using an action is not allowed. Tried to modify: \" : \"Side effects like changing state are not allowed at this point. Are you trying to modify state from, for example, a computed value or the render function of a React component? You can wrap side effects in 'runInAction' (or decorate functions with 'action') if needed. Tried to modify: \") + atom.name_);\n }\n}\nfunction checkIfStateReadsAreAllowed(observable) {\n if ( true && !globalState.allowStateReads && globalState.observableRequiresReaction) {\n console.warn(\"[mobx] Observable '\" + observable.name_ + \"' being read outside a reactive context.\");\n }\n}\n/**\n * Executes the provided function `f` and tracks which observables are being accessed.\n * The tracking information is stored on the `derivation` object and the derivation is registered\n * as observer of any of the accessed observables.\n */\nfunction trackDerivedFunction(derivation, f, context) {\n var prevAllowStateReads = allowStateReadsStart(true);\n changeDependenciesStateTo0(derivation);\n // Preallocate array; will be trimmed by bindDependencies.\n derivation.newObserving_ = new Array(\n // Reserve constant space for initial dependencies, dynamic space otherwise.\n // See https://github.com/mobxjs/mobx/pull/3833\n derivation.runId_ === 0 ? 100 : derivation.observing_.length);\n derivation.unboundDepsCount_ = 0;\n derivation.runId_ = ++globalState.runId;\n var prevTracking = globalState.trackingDerivation;\n globalState.trackingDerivation = derivation;\n globalState.inBatch++;\n var result;\n if (globalState.disableErrorBoundaries === true) {\n result = f.call(context);\n } else {\n try {\n result = f.call(context);\n } catch (e) {\n result = new CaughtException(e);\n }\n }\n globalState.inBatch--;\n globalState.trackingDerivation = prevTracking;\n bindDependencies(derivation);\n warnAboutDerivationWithoutDependencies(derivation);\n allowStateReadsEnd(prevAllowStateReads);\n return result;\n}\nfunction warnAboutDerivationWithoutDependencies(derivation) {\n if (false) {}\n if (derivation.observing_.length !== 0) {\n return;\n }\n if (typeof derivation.requiresObservable_ === \"boolean\" ? derivation.requiresObservable_ : globalState.reactionRequiresObservable) {\n console.warn(\"[mobx] Derivation '\" + derivation.name_ + \"' is created/updated without reading any observable value.\");\n }\n}\n/**\n * diffs newObserving with observing.\n * update observing to be newObserving with unique observables\n * notify observers that become observed/unobserved\n */\nfunction bindDependencies(derivation) {\n // invariant(derivation.dependenciesState !== IDerivationState.NOT_TRACKING, \"INTERNAL ERROR bindDependencies expects derivation.dependenciesState !== -1\");\n var prevObserving = derivation.observing_;\n var observing = derivation.observing_ = derivation.newObserving_;\n var lowestNewObservingDerivationState = IDerivationState_.UP_TO_DATE_;\n // Go through all new observables and check diffValue: (this list can contain duplicates):\n // 0: first occurrence, change to 1 and keep it\n // 1: extra occurrence, drop it\n var i0 = 0,\n l = derivation.unboundDepsCount_;\n for (var i = 0; i < l; i++) {\n var dep = observing[i];\n if (dep.diffValue === 0) {\n dep.diffValue = 1;\n if (i0 !== i) {\n observing[i0] = dep;\n }\n i0++;\n }\n // Upcast is 'safe' here, because if dep is IObservable, `dependenciesState` will be undefined,\n // not hitting the condition\n if (dep.dependenciesState_ > lowestNewObservingDerivationState) {\n lowestNewObservingDerivationState = dep.dependenciesState_;\n }\n }\n observing.length = i0;\n derivation.newObserving_ = null; // newObserving shouldn't be needed outside tracking (statement moved down to work around FF bug, see #614)\n // Go through all old observables and check diffValue: (it is unique after last bindDependencies)\n // 0: it's not in new observables, unobserve it\n // 1: it keeps being observed, don't want to notify it. change to 0\n l = prevObserving.length;\n while (l--) {\n var _dep = prevObserving[l];\n if (_dep.diffValue === 0) {\n removeObserver(_dep, derivation);\n }\n _dep.diffValue = 0;\n }\n // Go through all new observables and check diffValue: (now it should be unique)\n // 0: it was set to 0 in last loop. don't need to do anything.\n // 1: it wasn't observed, let's observe it. set back to 0\n while (i0--) {\n var _dep2 = observing[i0];\n if (_dep2.diffValue === 1) {\n _dep2.diffValue = 0;\n addObserver(_dep2, derivation);\n }\n }\n // Some new observed derivations may become stale during this derivation computation\n // so they have had no chance to propagate staleness (#916)\n if (lowestNewObservingDerivationState !== IDerivationState_.UP_TO_DATE_) {\n derivation.dependenciesState_ = lowestNewObservingDerivationState;\n derivation.onBecomeStale_();\n }\n}\nfunction clearObserving(derivation) {\n // invariant(globalState.inBatch > 0, \"INTERNAL ERROR clearObserving should be called only inside batch\");\n var obs = derivation.observing_;\n derivation.observing_ = [];\n var i = obs.length;\n while (i--) {\n removeObserver(obs[i], derivation);\n }\n derivation.dependenciesState_ = IDerivationState_.NOT_TRACKING_;\n}\nfunction untracked(action) {\n var prev = untrackedStart();\n try {\n return action();\n } finally {\n untrackedEnd(prev);\n }\n}\nfunction untrackedStart() {\n var prev = globalState.trackingDerivation;\n globalState.trackingDerivation = null;\n return prev;\n}\nfunction untrackedEnd(prev) {\n globalState.trackingDerivation = prev;\n}\nfunction allowStateReadsStart(allowStateReads) {\n var prev = globalState.allowStateReads;\n globalState.allowStateReads = allowStateReads;\n return prev;\n}\nfunction allowStateReadsEnd(prev) {\n globalState.allowStateReads = prev;\n}\n/**\n * needed to keep `lowestObserverState` correct. when changing from (2 or 1) to 0\n *\n */\nfunction changeDependenciesStateTo0(derivation) {\n if (derivation.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {\n return;\n }\n derivation.dependenciesState_ = IDerivationState_.UP_TO_DATE_;\n var obs = derivation.observing_;\n var i = obs.length;\n while (i--) {\n obs[i].lowestObserverState_ = IDerivationState_.UP_TO_DATE_;\n }\n}\n\n/**\n * These values will persist if global state is reset\n */\nvar persistentKeys = [\"mobxGuid\", \"spyListeners\", \"enforceActions\", \"computedRequiresReaction\", \"reactionRequiresObservable\", \"observableRequiresReaction\", \"allowStateReads\", \"disableErrorBoundaries\", \"runId\", \"UNCHANGED\", \"useProxies\"];\nvar MobXGlobals = function MobXGlobals() {\n /**\n * MobXGlobals version.\n * MobX compatiblity with other versions loaded in memory as long as this version matches.\n * It indicates that the global state still stores similar information\n *\n * N.B: this version is unrelated to the package version of MobX, and is only the version of the\n * internal state storage of MobX, and can be the same across many different package versions\n */\n this.version = 6;\n /**\n * globally unique token to signal unchanged\n */\n this.UNCHANGED = {};\n /**\n * Currently running derivation\n */\n this.trackingDerivation = null;\n /**\n * Currently running reaction. This determines if we currently have a reactive context.\n * (Tracking derivation is also set for temporal tracking of computed values inside actions,\n * but trackingReaction can only be set by a form of Reaction)\n */\n this.trackingContext = null;\n /**\n * Each time a derivation is tracked, it is assigned a unique run-id\n */\n this.runId = 0;\n /**\n * 'guid' for general purpose. Will be persisted amongst resets.\n */\n this.mobxGuid = 0;\n /**\n * Are we in a batch block? (and how many of them)\n */\n this.inBatch = 0;\n /**\n * Observables that don't have observers anymore, and are about to be\n * suspended, unless somebody else accesses it in the same batch\n *\n * @type {IObservable[]}\n */\n this.pendingUnobservations = [];\n /**\n * List of scheduled, not yet executed, reactions.\n */\n this.pendingReactions = [];\n /**\n * Are we currently processing reactions?\n */\n this.isRunningReactions = false;\n /**\n * Is it allowed to change observables at this point?\n * In general, MobX doesn't allow that when running computations and React.render.\n * To ensure that those functions stay pure.\n */\n this.allowStateChanges = false;\n /**\n * Is it allowed to read observables at this point?\n * Used to hold the state needed for `observableRequiresReaction`\n */\n this.allowStateReads = true;\n /**\n * If strict mode is enabled, state changes are by default not allowed\n */\n this.enforceActions = true;\n /**\n * Spy callbacks\n */\n this.spyListeners = [];\n /**\n * Globally attached error handlers that react specifically to errors in reactions\n */\n this.globalReactionErrorHandlers = [];\n /**\n * Warn if computed values are accessed outside a reactive context\n */\n this.computedRequiresReaction = false;\n /**\n * (Experimental)\n * Warn if you try to create to derivation / reactive context without accessing any observable.\n */\n this.reactionRequiresObservable = false;\n /**\n * (Experimental)\n * Warn if observables are accessed outside a reactive context\n */\n this.observableRequiresReaction = false;\n /*\n * Don't catch and rethrow exceptions. This is useful for inspecting the state of\n * the stack when an exception occurs while debugging.\n */\n this.disableErrorBoundaries = false;\n /*\n * If true, we are already handling an exception in an action. Any errors in reactions should be suppressed, as\n * they are not the cause, see: https://github.com/mobxjs/mobx/issues/1836\n */\n this.suppressReactionErrors = false;\n this.useProxies = true;\n /*\n * print warnings about code that would fail if proxies weren't available\n */\n this.verifyProxies = false;\n /**\n * False forces all object's descriptors to\n * writable: true\n * configurable: true\n */\n this.safeDescriptors = true;\n};\nvar canMergeGlobalState = true;\nvar isolateCalled = false;\nvar globalState = /*#__PURE__*/function () {\n var global = /*#__PURE__*/getGlobal();\n if (global.__mobxInstanceCount > 0 && !global.__mobxGlobals) {\n canMergeGlobalState = false;\n }\n if (global.__mobxGlobals && global.__mobxGlobals.version !== new MobXGlobals().version) {\n canMergeGlobalState = false;\n }\n if (!canMergeGlobalState) {\n // Because this is a IIFE we need to let isolateCalled a chance to change\n // so we run it after the event loop completed at least 1 iteration\n setTimeout(function () {\n if (!isolateCalled) {\n die(35);\n }\n }, 1);\n return new MobXGlobals();\n } else if (global.__mobxGlobals) {\n global.__mobxInstanceCount += 1;\n if (!global.__mobxGlobals.UNCHANGED) {\n global.__mobxGlobals.UNCHANGED = {};\n } // make merge backward compatible\n return global.__mobxGlobals;\n } else {\n global.__mobxInstanceCount = 1;\n return global.__mobxGlobals = /*#__PURE__*/new MobXGlobals();\n }\n}();\nfunction isolateGlobalState() {\n if (globalState.pendingReactions.length || globalState.inBatch || globalState.isRunningReactions) {\n die(36);\n }\n isolateCalled = true;\n if (canMergeGlobalState) {\n var global = getGlobal();\n if (--global.__mobxInstanceCount === 0) {\n global.__mobxGlobals = undefined;\n }\n globalState = new MobXGlobals();\n }\n}\nfunction getGlobalState() {\n return globalState;\n}\n/**\n * For testing purposes only; this will break the internal state of existing observables,\n * but can be used to get back at a stable state after throwing errors\n */\nfunction resetGlobalState() {\n var defaultGlobals = new MobXGlobals();\n for (var key in defaultGlobals) {\n if (persistentKeys.indexOf(key) === -1) {\n globalState[key] = defaultGlobals[key];\n }\n }\n globalState.allowStateChanges = !globalState.enforceActions;\n}\n\nfunction hasObservers(observable) {\n return observable.observers_ && observable.observers_.size > 0;\n}\nfunction getObservers(observable) {\n return observable.observers_;\n}\n// function invariantObservers(observable: IObservable) {\n// const list = observable.observers\n// const map = observable.observersIndexes\n// const l = list.length\n// for (let i = 0; i < l; i++) {\n// const id = list[i].__mapid\n// if (i) {\n// invariant(map[id] === i, \"INTERNAL ERROR maps derivation.__mapid to index in list\") // for performance\n// } else {\n// invariant(!(id in map), \"INTERNAL ERROR observer on index 0 shouldn't be held in map.\") // for performance\n// }\n// }\n// invariant(\n// list.length === 0 || Object.keys(map).length === list.length - 1,\n// \"INTERNAL ERROR there is no junk in map\"\n// )\n// }\nfunction addObserver(observable, node) {\n // invariant(node.dependenciesState !== -1, \"INTERNAL ERROR, can add only dependenciesState !== -1\");\n // invariant(observable._observers.indexOf(node) === -1, \"INTERNAL ERROR add already added node\");\n // invariantObservers(observable);\n observable.observers_.add(node);\n if (observable.lowestObserverState_ > node.dependenciesState_) {\n observable.lowestObserverState_ = node.dependenciesState_;\n }\n // invariantObservers(observable);\n // invariant(observable._observers.indexOf(node) !== -1, \"INTERNAL ERROR didn't add node\");\n}\nfunction removeObserver(observable, node) {\n // invariant(globalState.inBatch > 0, \"INTERNAL ERROR, remove should be called only inside batch\");\n // invariant(observable._observers.indexOf(node) !== -1, \"INTERNAL ERROR remove already removed node\");\n // invariantObservers(observable);\n observable.observers_[\"delete\"](node);\n if (observable.observers_.size === 0) {\n // deleting last observer\n queueForUnobservation(observable);\n }\n // invariantObservers(observable);\n // invariant(observable._observers.indexOf(node) === -1, \"INTERNAL ERROR remove already removed node2\");\n}\nfunction queueForUnobservation(observable) {\n if (observable.isPendingUnobservation === false) {\n // invariant(observable._observers.length === 0, \"INTERNAL ERROR, should only queue for unobservation unobserved observables\");\n observable.isPendingUnobservation = true;\n globalState.pendingUnobservations.push(observable);\n }\n}\n/**\n * Batch starts a transaction, at least for purposes of memoizing ComputedValues when nothing else does.\n * During a batch `onBecomeUnobserved` will be called at most once per observable.\n * Avoids unnecessary recalculations.\n */\nfunction startBatch() {\n globalState.inBatch++;\n}\nfunction endBatch() {\n if (--globalState.inBatch === 0) {\n runReactions();\n // the batch is actually about to finish, all unobserving should happen here.\n var list = globalState.pendingUnobservations;\n for (var i = 0; i < list.length; i++) {\n var observable = list[i];\n observable.isPendingUnobservation = false;\n if (observable.observers_.size === 0) {\n if (observable.isBeingObserved) {\n // if this observable had reactive observers, trigger the hooks\n observable.isBeingObserved = false;\n observable.onBUO();\n }\n if (observable instanceof ComputedValue) {\n // computed values are automatically teared down when the last observer leaves\n // this process happens recursively, this computed might be the last observabe of another, etc..\n observable.suspend_();\n }\n }\n }\n globalState.pendingUnobservations = [];\n }\n}\nfunction reportObserved(observable) {\n checkIfStateReadsAreAllowed(observable);\n var derivation = globalState.trackingDerivation;\n if (derivation !== null) {\n /**\n * Simple optimization, give each derivation run an unique id (runId)\n * Check if last time this observable was accessed the same runId is used\n * if this is the case, the relation is already known\n */\n if (derivation.runId_ !== observable.lastAccessedBy_) {\n observable.lastAccessedBy_ = derivation.runId_;\n // Tried storing newObserving, or observing, or both as Set, but performance didn't come close...\n derivation.newObserving_[derivation.unboundDepsCount_++] = observable;\n if (!observable.isBeingObserved && globalState.trackingContext) {\n observable.isBeingObserved = true;\n observable.onBO();\n }\n }\n return observable.isBeingObserved;\n } else if (observable.observers_.size === 0 && globalState.inBatch > 0) {\n queueForUnobservation(observable);\n }\n return false;\n}\n// function invariantLOS(observable: IObservable, msg: string) {\n// // it's expensive so better not run it in produciton. but temporarily helpful for testing\n// const min = getObservers(observable).reduce((a, b) => Math.min(a, b.dependenciesState), 2)\n// if (min >= observable.lowestObserverState) return // <- the only assumption about `lowestObserverState`\n// throw new Error(\n// \"lowestObserverState is wrong for \" +\n// msg +\n// \" because \" +\n// min +\n// \" < \" +\n// observable.lowestObserverState\n// )\n// }\n/**\n * NOTE: current propagation mechanism will in case of self reruning autoruns behave unexpectedly\n * It will propagate changes to observers from previous run\n * It's hard or maybe impossible (with reasonable perf) to get it right with current approach\n * Hopefully self reruning autoruns aren't a feature people should depend on\n * Also most basic use cases should be ok\n */\n// Called by Atom when its value changes\nfunction propagateChanged(observable) {\n // invariantLOS(observable, \"changed start\");\n if (observable.lowestObserverState_ === IDerivationState_.STALE_) {\n return;\n }\n observable.lowestObserverState_ = IDerivationState_.STALE_;\n // Ideally we use for..of here, but the downcompiled version is really slow...\n observable.observers_.forEach(function (d) {\n if (d.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {\n if ( true && d.isTracing_ !== TraceMode.NONE) {\n logTraceInfo(d, observable);\n }\n d.onBecomeStale_();\n }\n d.dependenciesState_ = IDerivationState_.STALE_;\n });\n // invariantLOS(observable, \"changed end\");\n}\n// Called by ComputedValue when it recalculate and its value changed\nfunction propagateChangeConfirmed(observable) {\n // invariantLOS(observable, \"confirmed start\");\n if (observable.lowestObserverState_ === IDerivationState_.STALE_) {\n return;\n }\n observable.lowestObserverState_ = IDerivationState_.STALE_;\n observable.observers_.forEach(function (d) {\n if (d.dependenciesState_ === IDerivationState_.POSSIBLY_STALE_) {\n d.dependenciesState_ = IDerivationState_.STALE_;\n if ( true && d.isTracing_ !== TraceMode.NONE) {\n logTraceInfo(d, observable);\n }\n } else if (d.dependenciesState_ === IDerivationState_.UP_TO_DATE_ // this happens during computing of `d`, just keep lowestObserverState up to date.\n ) {\n observable.lowestObserverState_ = IDerivationState_.UP_TO_DATE_;\n }\n });\n // invariantLOS(observable, \"confirmed end\");\n}\n// Used by computed when its dependency changed, but we don't wan't to immediately recompute.\nfunction propagateMaybeChanged(observable) {\n // invariantLOS(observable, \"maybe start\");\n if (observable.lowestObserverState_ !== IDerivationState_.UP_TO_DATE_) {\n return;\n }\n observable.lowestObserverState_ = IDerivationState_.POSSIBLY_STALE_;\n observable.observers_.forEach(function (d) {\n if (d.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {\n d.dependenciesState_ = IDerivationState_.POSSIBLY_STALE_;\n d.onBecomeStale_();\n }\n });\n // invariantLOS(observable, \"maybe end\");\n}\nfunction logTraceInfo(derivation, observable) {\n console.log(\"[mobx.trace] '\" + derivation.name_ + \"' is invalidated due to a change in: '\" + observable.name_ + \"'\");\n if (derivation.isTracing_ === TraceMode.BREAK) {\n var lines = [];\n printDepTree(getDependencyTree(derivation), lines, 1);\n // prettier-ignore\n new Function(\"debugger;\\n/*\\nTracing '\" + derivation.name_ + \"'\\n\\nYou are entering this break point because derivation '\" + derivation.name_ + \"' is being traced and '\" + observable.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\" + (derivation instanceof ComputedValue ? derivation.derivation.toString().replace(/[*]\\//g, \"/\") : \"\") + \"\\n\\nThe dependencies for this derivation are:\\n\\n\" + lines.join(\"\\n\") + \"\\n*/\\n \")();\n }\n}\nfunction printDepTree(tree, lines, depth) {\n if (lines.length >= 1000) {\n lines.push(\"(and many more)\");\n return;\n }\n lines.push(\"\" + \"\\t\".repeat(depth - 1) + tree.name);\n if (tree.dependencies) {\n tree.dependencies.forEach(function (child) {\n return printDepTree(child, lines, depth + 1);\n });\n }\n}\n\nvar Reaction = /*#__PURE__*/function () {\n function Reaction(name_, onInvalidate_, errorHandler_, requiresObservable_) {\n if (name_ === void 0) {\n name_ = true ? \"Reaction@\" + getNextId() : 0;\n }\n this.name_ = void 0;\n this.onInvalidate_ = void 0;\n this.errorHandler_ = void 0;\n this.requiresObservable_ = void 0;\n this.observing_ = [];\n // nodes we are looking at. Our value depends on these nodes\n this.newObserving_ = [];\n this.dependenciesState_ = IDerivationState_.NOT_TRACKING_;\n this.runId_ = 0;\n this.unboundDepsCount_ = 0;\n this.flags_ = 0;\n this.isTracing_ = TraceMode.NONE;\n this.name_ = name_;\n this.onInvalidate_ = onInvalidate_;\n this.errorHandler_ = errorHandler_;\n this.requiresObservable_ = requiresObservable_;\n }\n var _proto = Reaction.prototype;\n _proto.onBecomeStale_ = function onBecomeStale_() {\n this.schedule_();\n };\n _proto.schedule_ = function schedule_() {\n if (!this.isScheduled) {\n this.isScheduled = true;\n globalState.pendingReactions.push(this);\n runReactions();\n }\n }\n /**\n * internal, use schedule() if you intend to kick off a reaction\n */;\n _proto.runReaction_ = function runReaction_() {\n if (!this.isDisposed) {\n startBatch();\n this.isScheduled = false;\n var prev = globalState.trackingContext;\n globalState.trackingContext = this;\n if (shouldCompute(this)) {\n this.isTrackPending = true;\n try {\n this.onInvalidate_();\n if ( true && this.isTrackPending && isSpyEnabled()) {\n // onInvalidate didn't trigger track right away..\n spyReport({\n name: this.name_,\n type: \"scheduled-reaction\"\n });\n }\n } catch (e) {\n this.reportExceptionInDerivation_(e);\n }\n }\n globalState.trackingContext = prev;\n endBatch();\n }\n };\n _proto.track = function track(fn) {\n if (this.isDisposed) {\n return;\n // console.warn(\"Reaction already disposed\") // Note: Not a warning / error in mobx 4 either\n }\n startBatch();\n var notify = isSpyEnabled();\n var startTime;\n if ( true && notify) {\n startTime = Date.now();\n spyReportStart({\n name: this.name_,\n type: \"reaction\"\n });\n }\n this.isRunning = true;\n var prevReaction = globalState.trackingContext; // reactions could create reactions...\n globalState.trackingContext = this;\n var result = trackDerivedFunction(this, fn, undefined);\n globalState.trackingContext = prevReaction;\n this.isRunning = false;\n this.isTrackPending = false;\n if (this.isDisposed) {\n // disposed during last run. Clean up everything that was bound after the dispose call.\n clearObserving(this);\n }\n if (isCaughtException(result)) {\n this.reportExceptionInDerivation_(result.cause);\n }\n if ( true && notify) {\n spyReportEnd({\n time: Date.now() - startTime\n });\n }\n endBatch();\n };\n _proto.reportExceptionInDerivation_ = function reportExceptionInDerivation_(error) {\n var _this = this;\n if (this.errorHandler_) {\n this.errorHandler_(error, this);\n return;\n }\n if (globalState.disableErrorBoundaries) {\n throw error;\n }\n var message = true ? \"[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '\" + this + \"'\" : 0;\n if (!globalState.suppressReactionErrors) {\n console.error(message, error);\n /** If debugging brought you here, please, read the above message :-). Tnx! */\n } else if (true) {\n console.warn(\"[mobx] (error in reaction '\" + this.name_ + \"' suppressed, fix error of causing action below)\");\n } // prettier-ignore\n if ( true && isSpyEnabled()) {\n spyReport({\n type: \"error\",\n name: this.name_,\n message: message,\n error: \"\" + error\n });\n }\n globalState.globalReactionErrorHandlers.forEach(function (f) {\n return f(error, _this);\n });\n };\n _proto.dispose = function dispose() {\n if (!this.isDisposed) {\n this.isDisposed = true;\n if (!this.isRunning) {\n // if disposed while running, clean up later. Maybe not optimal, but rare case\n startBatch();\n clearObserving(this);\n endBatch();\n }\n }\n };\n _proto.getDisposer_ = function getDisposer_(abortSignal) {\n var _this2 = this;\n var dispose = function dispose() {\n _this2.dispose();\n abortSignal == null || abortSignal.removeEventListener == null || abortSignal.removeEventListener(\"abort\", dispose);\n };\n abortSignal == null || abortSignal.addEventListener == null || abortSignal.addEventListener(\"abort\", dispose);\n dispose[$mobx] = this;\n return dispose;\n };\n _proto.toString = function toString() {\n return \"Reaction[\" + this.name_ + \"]\";\n };\n _proto.trace = function trace$1(enterBreakPoint) {\n if (enterBreakPoint === void 0) {\n enterBreakPoint = false;\n }\n trace(this, enterBreakPoint);\n };\n return _createClass(Reaction, [{\n key: \"isDisposed\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isDisposedMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isDisposedMask_, newValue);\n }\n }, {\n key: \"isScheduled\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isScheduledMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isScheduledMask_, newValue);\n }\n }, {\n key: \"isTrackPending\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isTrackPendingMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isTrackPendingMask_, newValue);\n }\n }, {\n key: \"isRunning\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isRunningMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isRunningMask_, newValue);\n }\n }, {\n key: \"diffValue\",\n get: function get() {\n return getFlag(this.flags_, Reaction.diffValueMask_) ? 1 : 0;\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.diffValueMask_, newValue === 1 ? true : false);\n }\n }]);\n}();\nReaction.isDisposedMask_ = 1;\nReaction.isScheduledMask_ = 2;\nReaction.isTrackPendingMask_ = 4;\nReaction.isRunningMask_ = 8;\nReaction.diffValueMask_ = 16;\nfunction onReactionError(handler) {\n globalState.globalReactionErrorHandlers.push(handler);\n return function () {\n var idx = globalState.globalReactionErrorHandlers.indexOf(handler);\n if (idx >= 0) {\n globalState.globalReactionErrorHandlers.splice(idx, 1);\n }\n };\n}\n/**\n * Magic number alert!\n * Defines within how many times a reaction is allowed to re-trigger itself\n * until it is assumed that this is gonna be a never ending loop...\n */\nvar MAX_REACTION_ITERATIONS = 100;\nvar reactionScheduler = function reactionScheduler(f) {\n return f();\n};\nfunction runReactions() {\n // Trampolining, if runReactions are already running, new reactions will be picked up\n if (globalState.inBatch > 0 || globalState.isRunningReactions) {\n return;\n }\n reactionScheduler(runReactionsHelper);\n}\nfunction runReactionsHelper() {\n globalState.isRunningReactions = true;\n var allReactions = globalState.pendingReactions;\n var iterations = 0;\n // While running reactions, new reactions might be triggered.\n // Hence we work with two variables and check whether\n // we converge to no remaining reactions after a while.\n while (allReactions.length > 0) {\n if (++iterations === MAX_REACTION_ITERATIONS) {\n console.error( true ? \"Reaction doesn't converge to a stable state after \" + MAX_REACTION_ITERATIONS + \" iterations.\" + (\" Probably there is a cycle in the reactive function: \" + allReactions[0]) : 0);\n allReactions.splice(0); // clear reactions\n }\n var remainingReactions = allReactions.splice(0);\n for (var i = 0, l = remainingReactions.length; i < l; i++) {\n remainingReactions[i].runReaction_();\n }\n }\n globalState.isRunningReactions = false;\n}\nvar isReaction = /*#__PURE__*/createInstanceofPredicate(\"Reaction\", Reaction);\nfunction setReactionScheduler(fn) {\n var baseScheduler = reactionScheduler;\n reactionScheduler = function reactionScheduler(f) {\n return fn(function () {\n return baseScheduler(f);\n });\n };\n}\n\nfunction isSpyEnabled() {\n return true && !!globalState.spyListeners.length;\n}\nfunction spyReport(event) {\n if (false) {} // dead code elimination can do the rest\n if (!globalState.spyListeners.length) {\n return;\n }\n var listeners = globalState.spyListeners;\n for (var i = 0, l = listeners.length; i < l; i++) {\n listeners[i](event);\n }\n}\nfunction spyReportStart(event) {\n if (false) {}\n var change = _extends({}, event, {\n spyReportStart: true\n });\n spyReport(change);\n}\nvar END_EVENT = {\n type: \"report-end\",\n spyReportEnd: true\n};\nfunction spyReportEnd(change) {\n if (false) {}\n if (change) {\n spyReport(_extends({}, change, {\n type: \"report-end\",\n spyReportEnd: true\n }));\n } else {\n spyReport(END_EVENT);\n }\n}\nfunction spy(listener) {\n if (false) {} else {\n globalState.spyListeners.push(listener);\n return once(function () {\n globalState.spyListeners = globalState.spyListeners.filter(function (l) {\n return l !== listener;\n });\n });\n }\n}\n\nvar ACTION = \"action\";\nvar ACTION_BOUND = \"action.bound\";\nvar AUTOACTION = \"autoAction\";\nvar AUTOACTION_BOUND = \"autoAction.bound\";\nvar DEFAULT_ACTION_NAME = \"\";\nvar actionAnnotation = /*#__PURE__*/createActionAnnotation(ACTION);\nvar actionBoundAnnotation = /*#__PURE__*/createActionAnnotation(ACTION_BOUND, {\n bound: true\n});\nvar autoActionAnnotation = /*#__PURE__*/createActionAnnotation(AUTOACTION, {\n autoAction: true\n});\nvar autoActionBoundAnnotation = /*#__PURE__*/createActionAnnotation(AUTOACTION_BOUND, {\n autoAction: true,\n bound: true\n});\nfunction createActionFactory(autoAction) {\n var res = function action(arg1, arg2) {\n // action(fn() {})\n if (isFunction(arg1)) {\n return createAction(arg1.name || DEFAULT_ACTION_NAME, arg1, autoAction);\n }\n // action(\"name\", fn() {})\n if (isFunction(arg2)) {\n return createAction(arg1, arg2, autoAction);\n }\n // @action (2022.3 Decorators)\n if (is20223Decorator(arg2)) {\n return (autoAction ? autoActionAnnotation : actionAnnotation).decorate_20223_(arg1, arg2);\n }\n // @action\n if (isStringish(arg2)) {\n return storeAnnotation(arg1, arg2, autoAction ? autoActionAnnotation : actionAnnotation);\n }\n // action(\"name\") & @action(\"name\")\n if (isStringish(arg1)) {\n return createDecoratorAnnotation(createActionAnnotation(autoAction ? AUTOACTION : ACTION, {\n name: arg1,\n autoAction: autoAction\n }));\n }\n if (true) {\n die(\"Invalid arguments for `action`\");\n }\n };\n return res;\n}\nvar action = /*#__PURE__*/createActionFactory(false);\nObject.assign(action, actionAnnotation);\nvar autoAction = /*#__PURE__*/createActionFactory(true);\nObject.assign(autoAction, autoActionAnnotation);\naction.bound = /*#__PURE__*/createDecoratorAnnotation(actionBoundAnnotation);\nautoAction.bound = /*#__PURE__*/createDecoratorAnnotation(autoActionBoundAnnotation);\nfunction runInAction(fn) {\n return executeAction(fn.name || DEFAULT_ACTION_NAME, false, fn, this, undefined);\n}\nfunction isAction(thing) {\n return isFunction(thing) && thing.isMobxAction === true;\n}\n\n/**\n * Creates a named reactive view and keeps it alive, so that the view is always\n * updated if one of the dependencies changes, even when the view is not further used by something else.\n * @param view The reactive view\n * @returns disposer function, which can be used to stop the view from being updated in the future.\n */\nfunction autorun(view, opts) {\n var _opts$name, _opts, _opts2, _opts3;\n if (opts === void 0) {\n opts = EMPTY_OBJECT;\n }\n if (true) {\n if (!isFunction(view)) {\n die(\"Autorun expects a function as first argument\");\n }\n if (isAction(view)) {\n die(\"Autorun does not accept actions since actions are untrackable\");\n }\n }\n var name = (_opts$name = (_opts = opts) == null ? void 0 : _opts.name) != null ? _opts$name : true ? view.name || \"Autorun@\" + getNextId() : 0;\n var runSync = !opts.scheduler && !opts.delay;\n var reaction;\n if (runSync) {\n // normal autorun\n reaction = new Reaction(name, function () {\n this.track(reactionRunner);\n }, opts.onError, opts.requiresObservable);\n } else {\n var scheduler = createSchedulerFromOptions(opts);\n // debounced autorun\n var isScheduled = false;\n reaction = new Reaction(name, function () {\n if (!isScheduled) {\n isScheduled = true;\n scheduler(function () {\n isScheduled = false;\n if (!reaction.isDisposed) {\n reaction.track(reactionRunner);\n }\n });\n }\n }, opts.onError, opts.requiresObservable);\n }\n function reactionRunner() {\n view(reaction);\n }\n if (!((_opts2 = opts) != null && (_opts2 = _opts2.signal) != null && _opts2.aborted)) {\n reaction.schedule_();\n }\n return reaction.getDisposer_((_opts3 = opts) == null ? void 0 : _opts3.signal);\n}\nvar run = function run(f) {\n return f();\n};\nfunction createSchedulerFromOptions(opts) {\n return opts.scheduler ? opts.scheduler : opts.delay ? function (f) {\n return setTimeout(f, opts.delay);\n } : run;\n}\nfunction reaction(expression, effect, opts) {\n var _opts$name2, _opts4, _opts5;\n if (opts === void 0) {\n opts = EMPTY_OBJECT;\n }\n if (true) {\n if (!isFunction(expression) || !isFunction(effect)) {\n die(\"First and second argument to reaction should be functions\");\n }\n if (!isPlainObject(opts)) {\n die(\"Third argument of reactions should be an object\");\n }\n }\n var name = (_opts$name2 = opts.name) != null ? _opts$name2 : true ? \"Reaction@\" + getNextId() : 0;\n var effectAction = action(name, opts.onError ? wrapErrorHandler(opts.onError, effect) : effect);\n var runSync = !opts.scheduler && !opts.delay;\n var scheduler = createSchedulerFromOptions(opts);\n var firstTime = true;\n var isScheduled = false;\n var value;\n var equals = opts.compareStructural ? comparer.structural : opts.equals || comparer[\"default\"];\n var r = new Reaction(name, function () {\n if (firstTime || runSync) {\n reactionRunner();\n } else if (!isScheduled) {\n isScheduled = true;\n scheduler(reactionRunner);\n }\n }, opts.onError, opts.requiresObservable);\n function reactionRunner() {\n isScheduled = false;\n if (r.isDisposed) {\n return;\n }\n var changed = false;\n var oldValue = value;\n r.track(function () {\n var nextValue = allowStateChanges(false, function () {\n return expression(r);\n });\n changed = firstTime || !equals(value, nextValue);\n value = nextValue;\n });\n if (firstTime && opts.fireImmediately) {\n effectAction(value, oldValue, r);\n } else if (!firstTime && changed) {\n effectAction(value, oldValue, r);\n }\n firstTime = false;\n }\n if (!((_opts4 = opts) != null && (_opts4 = _opts4.signal) != null && _opts4.aborted)) {\n r.schedule_();\n }\n return r.getDisposer_((_opts5 = opts) == null ? void 0 : _opts5.signal);\n}\nfunction wrapErrorHandler(errorHandler, baseFn) {\n return function () {\n try {\n return baseFn.apply(this, arguments);\n } catch (e) {\n errorHandler.call(this, e);\n }\n };\n}\n\nvar ON_BECOME_OBSERVED = \"onBO\";\nvar ON_BECOME_UNOBSERVED = \"onBUO\";\nfunction onBecomeObserved(thing, arg2, arg3) {\n return interceptHook(ON_BECOME_OBSERVED, thing, arg2, arg3);\n}\nfunction onBecomeUnobserved(thing, arg2, arg3) {\n return interceptHook(ON_BECOME_UNOBSERVED, thing, arg2, arg3);\n}\nfunction interceptHook(hook, thing, arg2, arg3) {\n var atom = typeof arg3 === \"function\" ? getAtom(thing, arg2) : getAtom(thing);\n var cb = isFunction(arg3) ? arg3 : arg2;\n var listenersKey = hook + \"L\";\n if (atom[listenersKey]) {\n atom[listenersKey].add(cb);\n } else {\n atom[listenersKey] = new Set([cb]);\n }\n return function () {\n var hookListeners = atom[listenersKey];\n if (hookListeners) {\n hookListeners[\"delete\"](cb);\n if (hookListeners.size === 0) {\n delete atom[listenersKey];\n }\n }\n };\n}\n\nvar NEVER = \"never\";\nvar ALWAYS = \"always\";\nvar OBSERVED = \"observed\";\n// const IF_AVAILABLE = \"ifavailable\"\nfunction configure(options) {\n if (options.isolateGlobalState === true) {\n isolateGlobalState();\n }\n var useProxies = options.useProxies,\n enforceActions = options.enforceActions;\n if (useProxies !== undefined) {\n globalState.useProxies = useProxies === ALWAYS ? true : useProxies === NEVER ? false : typeof Proxy !== \"undefined\";\n }\n if (useProxies === \"ifavailable\") {\n globalState.verifyProxies = true;\n }\n if (enforceActions !== undefined) {\n var ea = enforceActions === ALWAYS ? ALWAYS : enforceActions === OBSERVED;\n globalState.enforceActions = ea;\n globalState.allowStateChanges = ea === true || ea === ALWAYS ? false : true;\n }\n [\"computedRequiresReaction\", \"reactionRequiresObservable\", \"observableRequiresReaction\", \"disableErrorBoundaries\", \"safeDescriptors\"].forEach(function (key) {\n if (key in options) {\n globalState[key] = !!options[key];\n }\n });\n globalState.allowStateReads = !globalState.observableRequiresReaction;\n if ( true && globalState.disableErrorBoundaries === true) {\n console.warn(\"WARNING: Debug feature only. MobX will NOT recover from errors when `disableErrorBoundaries` is enabled.\");\n }\n if (options.reactionScheduler) {\n setReactionScheduler(options.reactionScheduler);\n }\n}\n\nfunction extendObservable(target, properties, annotations, options) {\n if (true) {\n if (arguments.length > 4) {\n die(\"'extendObservable' expected 2-4 arguments\");\n }\n if (typeof target !== \"object\") {\n die(\"'extendObservable' expects an object as first argument\");\n }\n if (isObservableMap(target)) {\n die(\"'extendObservable' should not be used on maps, use map.merge instead\");\n }\n if (!isPlainObject(properties)) {\n die(\"'extendObservable' only accepts plain objects as second argument\");\n }\n if (isObservable(properties) || isObservable(annotations)) {\n die(\"Extending an object with another observable (object) is not supported\");\n }\n }\n // Pull descriptors first, so we don't have to deal with props added by administration ($mobx)\n var descriptors = getOwnPropertyDescriptors(properties);\n initObservable(function () {\n var adm = asObservableObject(target, options)[$mobx];\n ownKeys(descriptors).forEach(function (key) {\n adm.extend_(key, descriptors[key],\n // must pass \"undefined\" for { key: undefined }\n !annotations ? true : key in annotations ? annotations[key] : true);\n });\n });\n return target;\n}\n\nfunction getDependencyTree(thing, property) {\n return nodeToDependencyTree(getAtom(thing, property));\n}\nfunction nodeToDependencyTree(node) {\n var result = {\n name: node.name_\n };\n if (node.observing_ && node.observing_.length > 0) {\n result.dependencies = unique(node.observing_).map(nodeToDependencyTree);\n }\n return result;\n}\nfunction getObserverTree(thing, property) {\n return nodeToObserverTree(getAtom(thing, property));\n}\nfunction nodeToObserverTree(node) {\n var result = {\n name: node.name_\n };\n if (hasObservers(node)) {\n result.observers = Array.from(getObservers(node)).map(nodeToObserverTree);\n }\n return result;\n}\nfunction unique(list) {\n return Array.from(new Set(list));\n}\n\nvar generatorId = 0;\nfunction FlowCancellationError() {\n this.message = \"FLOW_CANCELLED\";\n}\nFlowCancellationError.prototype = /*#__PURE__*/Object.create(Error.prototype);\nfunction isFlowCancellationError(error) {\n return error instanceof FlowCancellationError;\n}\nvar flowAnnotation = /*#__PURE__*/createFlowAnnotation(\"flow\");\nvar flowBoundAnnotation = /*#__PURE__*/createFlowAnnotation(\"flow.bound\", {\n bound: true\n});\nvar flow = /*#__PURE__*/Object.assign(function flow(arg1, arg2) {\n // @flow (2022.3 Decorators)\n if (is20223Decorator(arg2)) {\n return flowAnnotation.decorate_20223_(arg1, arg2);\n }\n // @flow\n if (isStringish(arg2)) {\n return storeAnnotation(arg1, arg2, flowAnnotation);\n }\n // flow(fn)\n if ( true && arguments.length !== 1) {\n die(\"Flow expects single argument with generator function\");\n }\n var generator = arg1;\n var name = generator.name || \"\";\n // Implementation based on https://github.com/tj/co/blob/master/index.js\n var res = function res() {\n var ctx = this;\n var args = arguments;\n var runId = ++generatorId;\n var gen = action(name + \" - runid: \" + runId + \" - init\", generator).apply(ctx, args);\n var rejector;\n var pendingPromise = undefined;\n var promise = new Promise(function (resolve, reject) {\n var stepId = 0;\n rejector = reject;\n function onFulfilled(res) {\n pendingPromise = undefined;\n var ret;\n try {\n ret = action(name + \" - runid: \" + runId + \" - yield \" + stepId++, gen.next).call(gen, res);\n } catch (e) {\n return reject(e);\n }\n next(ret);\n }\n function onRejected(err) {\n pendingPromise = undefined;\n var ret;\n try {\n ret = action(name + \" - runid: \" + runId + \" - yield \" + stepId++, gen[\"throw\"]).call(gen, err);\n } catch (e) {\n return reject(e);\n }\n next(ret);\n }\n function next(ret) {\n if (isFunction(ret == null ? void 0 : ret.then)) {\n // an async iterator\n ret.then(next, reject);\n return;\n }\n if (ret.done) {\n return resolve(ret.value);\n }\n pendingPromise = Promise.resolve(ret.value);\n return pendingPromise.then(onFulfilled, onRejected);\n }\n onFulfilled(undefined); // kick off the process\n });\n promise.cancel = action(name + \" - runid: \" + runId + \" - cancel\", function () {\n try {\n if (pendingPromise) {\n cancelPromise(pendingPromise);\n }\n // Finally block can return (or yield) stuff..\n var _res = gen[\"return\"](undefined);\n // eat anything that promise would do, it's cancelled!\n var yieldedPromise = Promise.resolve(_res.value);\n yieldedPromise.then(noop, noop);\n cancelPromise(yieldedPromise); // maybe it can be cancelled :)\n // reject our original promise\n rejector(new FlowCancellationError());\n } catch (e) {\n rejector(e); // there could be a throwing finally block\n }\n });\n return promise;\n };\n res.isMobXFlow = true;\n return res;\n}, flowAnnotation);\nflow.bound = /*#__PURE__*/createDecoratorAnnotation(flowBoundAnnotation);\nfunction cancelPromise(promise) {\n if (isFunction(promise.cancel)) {\n promise.cancel();\n }\n}\nfunction flowResult(result) {\n return result; // just tricking TypeScript :)\n}\nfunction isFlow(fn) {\n return (fn == null ? void 0 : fn.isMobXFlow) === true;\n}\n\nfunction interceptReads(thing, propOrHandler, handler) {\n var target;\n if (isObservableMap(thing) || isObservableArray(thing) || isObservableValue(thing)) {\n target = getAdministration(thing);\n } else if (isObservableObject(thing)) {\n if ( true && !isStringish(propOrHandler)) {\n return die(\"InterceptReads can only be used with a specific property, not with an object in general\");\n }\n target = getAdministration(thing, propOrHandler);\n } else if (true) {\n return die(\"Expected observable map, object or array as first array\");\n }\n if ( true && target.dehancer !== undefined) {\n return die(\"An intercept reader was already established\");\n }\n target.dehancer = typeof propOrHandler === \"function\" ? propOrHandler : handler;\n return function () {\n target.dehancer = undefined;\n };\n}\n\nfunction intercept(thing, propOrHandler, handler) {\n if (isFunction(handler)) {\n return interceptProperty(thing, propOrHandler, handler);\n } else {\n return interceptInterceptable(thing, propOrHandler);\n }\n}\nfunction interceptInterceptable(thing, handler) {\n return getAdministration(thing).intercept_(handler);\n}\nfunction interceptProperty(thing, property, handler) {\n return getAdministration(thing, property).intercept_(handler);\n}\n\nfunction _isComputed(value, property) {\n if (property === undefined) {\n return isComputedValue(value);\n }\n if (isObservableObject(value) === false) {\n return false;\n }\n if (!value[$mobx].values_.has(property)) {\n return false;\n }\n var atom = getAtom(value, property);\n return isComputedValue(atom);\n}\nfunction isComputed(value) {\n if ( true && arguments.length > 1) {\n return die(\"isComputed expects only 1 argument. Use isComputedProp to inspect the observability of a property\");\n }\n return _isComputed(value);\n}\nfunction isComputedProp(value, propName) {\n if ( true && !isStringish(propName)) {\n return die(\"isComputed expected a property name as second argument\");\n }\n return _isComputed(value, propName);\n}\n\nfunction _isObservable(value, property) {\n if (!value) {\n return false;\n }\n if (property !== undefined) {\n if ( true && (isObservableMap(value) || isObservableArray(value))) {\n return die(\"isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead.\");\n }\n if (isObservableObject(value)) {\n return value[$mobx].values_.has(property);\n }\n return false;\n }\n // For first check, see #701\n return isObservableObject(value) || !!value[$mobx] || isAtom(value) || isReaction(value) || isComputedValue(value);\n}\nfunction isObservable(value) {\n if ( true && arguments.length !== 1) {\n die(\"isObservable expects only 1 argument. Use isObservableProp to inspect the observability of a property\");\n }\n return _isObservable(value);\n}\nfunction isObservableProp(value, propName) {\n if ( true && !isStringish(propName)) {\n return die(\"expected a property name as second argument\");\n }\n return _isObservable(value, propName);\n}\n\nfunction keys(obj) {\n if (isObservableObject(obj)) {\n return obj[$mobx].keys_();\n }\n if (isObservableMap(obj) || isObservableSet(obj)) {\n return Array.from(obj.keys());\n }\n if (isObservableArray(obj)) {\n return obj.map(function (_, index) {\n return index;\n });\n }\n die(5);\n}\nfunction values(obj) {\n if (isObservableObject(obj)) {\n return keys(obj).map(function (key) {\n return obj[key];\n });\n }\n if (isObservableMap(obj)) {\n return keys(obj).map(function (key) {\n return obj.get(key);\n });\n }\n if (isObservableSet(obj)) {\n return Array.from(obj.values());\n }\n if (isObservableArray(obj)) {\n return obj.slice();\n }\n die(6);\n}\nfunction entries(obj) {\n if (isObservableObject(obj)) {\n return keys(obj).map(function (key) {\n return [key, obj[key]];\n });\n }\n if (isObservableMap(obj)) {\n return keys(obj).map(function (key) {\n return [key, obj.get(key)];\n });\n }\n if (isObservableSet(obj)) {\n return Array.from(obj.entries());\n }\n if (isObservableArray(obj)) {\n return obj.map(function (key, index) {\n return [index, key];\n });\n }\n die(7);\n}\nfunction set(obj, key, value) {\n if (arguments.length === 2 && !isObservableSet(obj)) {\n startBatch();\n var _values = key;\n try {\n for (var _key in _values) {\n set(obj, _key, _values[_key]);\n }\n } finally {\n endBatch();\n }\n return;\n }\n if (isObservableObject(obj)) {\n obj[$mobx].set_(key, value);\n } else if (isObservableMap(obj)) {\n obj.set(key, value);\n } else if (isObservableSet(obj)) {\n obj.add(key);\n } else if (isObservableArray(obj)) {\n if (typeof key !== \"number\") {\n key = parseInt(key, 10);\n }\n if (key < 0) {\n die(\"Invalid index: '\" + key + \"'\");\n }\n startBatch();\n if (key >= obj.length) {\n obj.length = key + 1;\n }\n obj[key] = value;\n endBatch();\n } else {\n die(8);\n }\n}\nfunction remove(obj, key) {\n if (isObservableObject(obj)) {\n obj[$mobx].delete_(key);\n } else if (isObservableMap(obj)) {\n obj[\"delete\"](key);\n } else if (isObservableSet(obj)) {\n obj[\"delete\"](key);\n } else if (isObservableArray(obj)) {\n if (typeof key !== \"number\") {\n key = parseInt(key, 10);\n }\n obj.splice(key, 1);\n } else {\n die(9);\n }\n}\nfunction has(obj, key) {\n if (isObservableObject(obj)) {\n return obj[$mobx].has_(key);\n } else if (isObservableMap(obj)) {\n return obj.has(key);\n } else if (isObservableSet(obj)) {\n return obj.has(key);\n } else if (isObservableArray(obj)) {\n return key >= 0 && key < obj.length;\n }\n die(10);\n}\nfunction get(obj, key) {\n if (!has(obj, key)) {\n return undefined;\n }\n if (isObservableObject(obj)) {\n return obj[$mobx].get_(key);\n } else if (isObservableMap(obj)) {\n return obj.get(key);\n } else if (isObservableArray(obj)) {\n return obj[key];\n }\n die(11);\n}\nfunction apiDefineProperty(obj, key, descriptor) {\n if (isObservableObject(obj)) {\n return obj[$mobx].defineProperty_(key, descriptor);\n }\n die(39);\n}\nfunction apiOwnKeys(obj) {\n if (isObservableObject(obj)) {\n return obj[$mobx].ownKeys_();\n }\n die(38);\n}\n\nfunction observe(thing, propOrCb, cbOrFire, fireImmediately) {\n if (isFunction(cbOrFire)) {\n return observeObservableProperty(thing, propOrCb, cbOrFire, fireImmediately);\n } else {\n return observeObservable(thing, propOrCb, cbOrFire);\n }\n}\nfunction observeObservable(thing, listener, fireImmediately) {\n return getAdministration(thing).observe_(listener, fireImmediately);\n}\nfunction observeObservableProperty(thing, property, listener, fireImmediately) {\n return getAdministration(thing, property).observe_(listener, fireImmediately);\n}\n\nfunction cache(map, key, value) {\n map.set(key, value);\n return value;\n}\nfunction toJSHelper(source, __alreadySeen) {\n if (source == null || typeof source !== \"object\" || source instanceof Date || !isObservable(source)) {\n return source;\n }\n if (isObservableValue(source) || isComputedValue(source)) {\n return toJSHelper(source.get(), __alreadySeen);\n }\n if (__alreadySeen.has(source)) {\n return __alreadySeen.get(source);\n }\n if (isObservableArray(source)) {\n var res = cache(__alreadySeen, source, new Array(source.length));\n source.forEach(function (value, idx) {\n res[idx] = toJSHelper(value, __alreadySeen);\n });\n return res;\n }\n if (isObservableSet(source)) {\n var _res = cache(__alreadySeen, source, new Set());\n source.forEach(function (value) {\n _res.add(toJSHelper(value, __alreadySeen));\n });\n return _res;\n }\n if (isObservableMap(source)) {\n var _res2 = cache(__alreadySeen, source, new Map());\n source.forEach(function (value, key) {\n _res2.set(key, toJSHelper(value, __alreadySeen));\n });\n return _res2;\n } else {\n // must be observable object\n var _res3 = cache(__alreadySeen, source, {});\n apiOwnKeys(source).forEach(function (key) {\n if (objectPrototype.propertyIsEnumerable.call(source, key)) {\n _res3[key] = toJSHelper(source[key], __alreadySeen);\n }\n });\n return _res3;\n }\n}\n/**\n * Recursively converts an observable to it's non-observable native counterpart.\n * It does NOT recurse into non-observables, these are left as they are, even if they contain observables.\n * Computed and other non-enumerable properties are completely ignored.\n * Complex scenarios require custom solution, eg implementing `toJSON` or using `serializr` lib.\n */\nfunction toJS(source, options) {\n if ( true && options) {\n die(\"toJS no longer supports options\");\n }\n return toJSHelper(source, new Map());\n}\n\nfunction trace() {\n if (false) {}\n var enterBreakPoint = false;\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n if (typeof args[args.length - 1] === \"boolean\") {\n enterBreakPoint = args.pop();\n }\n var derivation = getAtomFromArgs(args);\n if (!derivation) {\n return die(\"'trace(break?)' can only be used inside a tracked computed value or a Reaction. Consider passing in the computed value or reaction explicitly\");\n }\n if (derivation.isTracing_ === TraceMode.NONE) {\n console.log(\"[mobx.trace] '\" + derivation.name_ + \"' tracing enabled\");\n }\n derivation.isTracing_ = enterBreakPoint ? TraceMode.BREAK : TraceMode.LOG;\n}\nfunction getAtomFromArgs(args) {\n switch (args.length) {\n case 0:\n return globalState.trackingDerivation;\n case 1:\n return getAtom(args[0]);\n case 2:\n return getAtom(args[0], args[1]);\n }\n}\n\n/**\n * During a transaction no views are updated until the end of the transaction.\n * The transaction will be run synchronously nonetheless.\n *\n * @param action a function that updates some reactive state\n * @returns any value that was returned by the 'action' parameter.\n */\nfunction transaction(action, thisArg) {\n if (thisArg === void 0) {\n thisArg = undefined;\n }\n startBatch();\n try {\n return action.apply(thisArg);\n } finally {\n endBatch();\n }\n}\n\nfunction when(predicate, arg1, arg2) {\n if (arguments.length === 1 || arg1 && typeof arg1 === \"object\") {\n return whenPromise(predicate, arg1);\n }\n return _when(predicate, arg1, arg2 || {});\n}\nfunction _when(predicate, effect, opts) {\n var timeoutHandle;\n if (typeof opts.timeout === \"number\") {\n var error = new Error(\"WHEN_TIMEOUT\");\n timeoutHandle = setTimeout(function () {\n if (!disposer[$mobx].isDisposed) {\n disposer();\n if (opts.onError) {\n opts.onError(error);\n } else {\n throw error;\n }\n }\n }, opts.timeout);\n }\n opts.name = true ? opts.name || \"When@\" + getNextId() : 0;\n var effectAction = createAction( true ? opts.name + \"-effect\" : 0, effect);\n // eslint-disable-next-line\n var disposer = autorun(function (r) {\n // predicate should not change state\n var cond = allowStateChanges(false, predicate);\n if (cond) {\n r.dispose();\n if (timeoutHandle) {\n clearTimeout(timeoutHandle);\n }\n effectAction();\n }\n }, opts);\n return disposer;\n}\nfunction whenPromise(predicate, opts) {\n var _opts$signal;\n if ( true && opts && opts.onError) {\n return die(\"the options 'onError' and 'promise' cannot be combined\");\n }\n if (opts != null && (_opts$signal = opts.signal) != null && _opts$signal.aborted) {\n return Object.assign(Promise.reject(new Error(\"WHEN_ABORTED\")), {\n cancel: function cancel() {\n return null;\n }\n });\n }\n var cancel;\n var abort;\n var res = new Promise(function (resolve, reject) {\n var _opts$signal2;\n var disposer = _when(predicate, resolve, _extends({}, opts, {\n onError: reject\n }));\n cancel = function cancel() {\n disposer();\n reject(new Error(\"WHEN_CANCELLED\"));\n };\n abort = function abort() {\n disposer();\n reject(new Error(\"WHEN_ABORTED\"));\n };\n opts == null || (_opts$signal2 = opts.signal) == null || _opts$signal2.addEventListener == null || _opts$signal2.addEventListener(\"abort\", abort);\n })[\"finally\"](function () {\n var _opts$signal3;\n return opts == null || (_opts$signal3 = opts.signal) == null || _opts$signal3.removeEventListener == null ? void 0 : _opts$signal3.removeEventListener(\"abort\", abort);\n });\n res.cancel = cancel;\n return res;\n}\n\nfunction getAdm(target) {\n return target[$mobx];\n}\n// Optimization: we don't need the intermediate objects and could have a completely custom administration for DynamicObjects,\n// and skip either the internal values map, or the base object with its property descriptors!\nvar objectProxyTraps = {\n has: function has(target, name) {\n if ( true && globalState.trackingDerivation) {\n warnAboutProxyRequirement(\"detect new properties using the 'in' operator. Use 'has' from 'mobx' instead.\");\n }\n return getAdm(target).has_(name);\n },\n get: function get(target, name) {\n return getAdm(target).get_(name);\n },\n set: function set(target, name, value) {\n var _getAdm$set_;\n if (!isStringish(name)) {\n return false;\n }\n if ( true && !getAdm(target).values_.has(name)) {\n warnAboutProxyRequirement(\"add a new observable property through direct assignment. Use 'set' from 'mobx' instead.\");\n }\n // null (intercepted) -> true (success)\n return (_getAdm$set_ = getAdm(target).set_(name, value, true)) != null ? _getAdm$set_ : true;\n },\n deleteProperty: function deleteProperty(target, name) {\n var _getAdm$delete_;\n if (true) {\n warnAboutProxyRequirement(\"delete properties from an observable object. Use 'remove' from 'mobx' instead.\");\n }\n if (!isStringish(name)) {\n return false;\n }\n // null (intercepted) -> true (success)\n return (_getAdm$delete_ = getAdm(target).delete_(name, true)) != null ? _getAdm$delete_ : true;\n },\n defineProperty: function defineProperty(target, name, descriptor) {\n var _getAdm$definePropert;\n if (true) {\n warnAboutProxyRequirement(\"define property on an observable object. Use 'defineProperty' from 'mobx' instead.\");\n }\n // null (intercepted) -> true (success)\n return (_getAdm$definePropert = getAdm(target).defineProperty_(name, descriptor)) != null ? _getAdm$definePropert : true;\n },\n ownKeys: function ownKeys(target) {\n if ( true && globalState.trackingDerivation) {\n warnAboutProxyRequirement(\"iterate keys to detect added / removed properties. Use 'keys' from 'mobx' instead.\");\n }\n return getAdm(target).ownKeys_();\n },\n preventExtensions: function preventExtensions(target) {\n die(13);\n }\n};\nfunction asDynamicObservableObject(target, options) {\n var _target$$mobx, _target$$mobx$proxy_;\n assertProxies();\n target = asObservableObject(target, options);\n return (_target$$mobx$proxy_ = (_target$$mobx = target[$mobx]).proxy_) != null ? _target$$mobx$proxy_ : _target$$mobx.proxy_ = new Proxy(target, objectProxyTraps);\n}\n\nfunction hasInterceptors(interceptable) {\n return interceptable.interceptors_ !== undefined && interceptable.interceptors_.length > 0;\n}\nfunction registerInterceptor(interceptable, handler) {\n var interceptors = interceptable.interceptors_ || (interceptable.interceptors_ = []);\n interceptors.push(handler);\n return once(function () {\n var idx = interceptors.indexOf(handler);\n if (idx !== -1) {\n interceptors.splice(idx, 1);\n }\n });\n}\nfunction interceptChange(interceptable, change) {\n var prevU = untrackedStart();\n try {\n // Interceptor can modify the array, copy it to avoid concurrent modification, see #1950\n var interceptors = [].concat(interceptable.interceptors_ || []);\n for (var i = 0, l = interceptors.length; i < l; i++) {\n change = interceptors[i](change);\n if (change && !change.type) {\n die(14);\n }\n if (!change) {\n break;\n }\n }\n return change;\n } finally {\n untrackedEnd(prevU);\n }\n}\n\nfunction hasListeners(listenable) {\n return listenable.changeListeners_ !== undefined && listenable.changeListeners_.length > 0;\n}\nfunction registerListener(listenable, handler) {\n var listeners = listenable.changeListeners_ || (listenable.changeListeners_ = []);\n listeners.push(handler);\n return once(function () {\n var idx = listeners.indexOf(handler);\n if (idx !== -1) {\n listeners.splice(idx, 1);\n }\n });\n}\nfunction notifyListeners(listenable, change) {\n var prevU = untrackedStart();\n var listeners = listenable.changeListeners_;\n if (!listeners) {\n return;\n }\n listeners = listeners.slice();\n for (var i = 0, l = listeners.length; i < l; i++) {\n listeners[i](change);\n }\n untrackedEnd(prevU);\n}\n\nfunction makeObservable(target, annotations, options) {\n initObservable(function () {\n var _annotations;\n var adm = asObservableObject(target, options)[$mobx];\n if ( true && annotations && target[storedAnnotationsSymbol]) {\n die(\"makeObservable second arg must be nullish when using decorators. Mixing @decorator syntax with annotations is not supported.\");\n }\n // Default to decorators\n (_annotations = annotations) != null ? _annotations : annotations = collectStoredAnnotations(target);\n // Annotate\n ownKeys(annotations).forEach(function (key) {\n return adm.make_(key, annotations[key]);\n });\n });\n return target;\n}\n// proto[keysSymbol] = new Set()\nvar keysSymbol = /*#__PURE__*/Symbol(\"mobx-keys\");\nfunction makeAutoObservable(target, overrides, options) {\n if (true) {\n if (!isPlainObject(target) && !isPlainObject(Object.getPrototypeOf(target))) {\n die(\"'makeAutoObservable' can only be used for classes that don't have a superclass\");\n }\n if (isObservableObject(target)) {\n die(\"makeAutoObservable can only be used on objects not already made observable\");\n }\n }\n // Optimization: avoid visiting protos\n // Assumes that annotation.make_/.extend_ works the same for plain objects\n if (isPlainObject(target)) {\n return extendObservable(target, target, overrides, options);\n }\n initObservable(function () {\n var adm = asObservableObject(target, options)[$mobx];\n // Optimization: cache keys on proto\n // Assumes makeAutoObservable can be called only once per object and can't be used in subclass\n if (!target[keysSymbol]) {\n var proto = Object.getPrototypeOf(target);\n var keys = new Set([].concat(ownKeys(target), ownKeys(proto)));\n keys[\"delete\"](\"constructor\");\n keys[\"delete\"]($mobx);\n addHiddenProp(proto, keysSymbol, keys);\n }\n target[keysSymbol].forEach(function (key) {\n return adm.make_(key,\n // must pass \"undefined\" for { key: undefined }\n !overrides ? true : key in overrides ? overrides[key] : true);\n });\n });\n return target;\n}\n\nvar SPLICE = \"splice\";\nvar UPDATE = \"update\";\nvar MAX_SPLICE_SIZE = 10000; // See e.g. https://github.com/mobxjs/mobx/issues/859\nvar arrayTraps = {\n get: function get(target, name) {\n var adm = target[$mobx];\n if (name === $mobx) {\n return adm;\n }\n if (name === \"length\") {\n return adm.getArrayLength_();\n }\n if (typeof name === \"string\" && !isNaN(name)) {\n return adm.get_(parseInt(name));\n }\n if (hasProp(arrayExtensions, name)) {\n return arrayExtensions[name];\n }\n return target[name];\n },\n set: function set(target, name, value) {\n var adm = target[$mobx];\n if (name === \"length\") {\n adm.setArrayLength_(value);\n }\n if (typeof name === \"symbol\" || isNaN(name)) {\n target[name] = value;\n } else {\n // numeric string\n adm.set_(parseInt(name), value);\n }\n return true;\n },\n preventExtensions: function preventExtensions() {\n die(15);\n }\n};\nvar ObservableArrayAdministration = /*#__PURE__*/function () {\n function ObservableArrayAdministration(name, enhancer, owned_, legacyMode_) {\n if (name === void 0) {\n name = true ? \"ObservableArray@\" + getNextId() : 0;\n }\n this.owned_ = void 0;\n this.legacyMode_ = void 0;\n this.atom_ = void 0;\n this.values_ = [];\n // this is the prop that gets proxied, so can't replace it!\n this.interceptors_ = void 0;\n this.changeListeners_ = void 0;\n this.enhancer_ = void 0;\n this.dehancer = void 0;\n this.proxy_ = void 0;\n this.lastKnownLength_ = 0;\n this.owned_ = owned_;\n this.legacyMode_ = legacyMode_;\n this.atom_ = new Atom(name);\n this.enhancer_ = function (newV, oldV) {\n return enhancer(newV, oldV, true ? name + \"[..]\" : 0);\n };\n }\n var _proto = ObservableArrayAdministration.prototype;\n _proto.dehanceValue_ = function dehanceValue_(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.dehanceValues_ = function dehanceValues_(values) {\n if (this.dehancer !== undefined && values.length > 0) {\n return values.map(this.dehancer);\n }\n return values;\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n if (fireImmediately === void 0) {\n fireImmediately = false;\n }\n if (fireImmediately) {\n listener({\n observableKind: \"array\",\n object: this.proxy_,\n debugObjectName: this.atom_.name_,\n type: \"splice\",\n index: 0,\n added: this.values_.slice(),\n addedCount: this.values_.length,\n removed: [],\n removedCount: 0\n });\n }\n return registerListener(this, listener);\n };\n _proto.getArrayLength_ = function getArrayLength_() {\n this.atom_.reportObserved();\n return this.values_.length;\n };\n _proto.setArrayLength_ = function setArrayLength_(newLength) {\n if (typeof newLength !== \"number\" || isNaN(newLength) || newLength < 0) {\n die(\"Out of range: \" + newLength);\n }\n var currentLength = this.values_.length;\n if (newLength === currentLength) {\n return;\n } else if (newLength > currentLength) {\n var newItems = new Array(newLength - currentLength);\n for (var i = 0; i < newLength - currentLength; i++) {\n newItems[i] = undefined;\n } // No Array.fill everywhere...\n this.spliceWithArray_(currentLength, 0, newItems);\n } else {\n this.spliceWithArray_(newLength, currentLength - newLength);\n }\n };\n _proto.updateArrayLength_ = function updateArrayLength_(oldLength, delta) {\n if (oldLength !== this.lastKnownLength_) {\n die(16);\n }\n this.lastKnownLength_ += delta;\n if (this.legacyMode_ && delta > 0) {\n reserveArrayBuffer(oldLength + delta + 1);\n }\n };\n _proto.spliceWithArray_ = function spliceWithArray_(index, deleteCount, newItems) {\n var _this = this;\n checkIfStateModificationsAreAllowed(this.atom_);\n var length = this.values_.length;\n if (index === undefined) {\n index = 0;\n } else if (index > length) {\n index = length;\n } else if (index < 0) {\n index = Math.max(0, length + index);\n }\n if (arguments.length === 1) {\n deleteCount = length - index;\n } else if (deleteCount === undefined || deleteCount === null) {\n deleteCount = 0;\n } else {\n deleteCount = Math.max(0, Math.min(deleteCount, length - index));\n }\n if (newItems === undefined) {\n newItems = EMPTY_ARRAY;\n }\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_,\n type: SPLICE,\n index: index,\n removedCount: deleteCount,\n added: newItems\n });\n if (!change) {\n return EMPTY_ARRAY;\n }\n deleteCount = change.removedCount;\n newItems = change.added;\n }\n newItems = newItems.length === 0 ? newItems : newItems.map(function (v) {\n return _this.enhancer_(v, undefined);\n });\n if (this.legacyMode_ || \"development\" !== \"production\") {\n var lengthDelta = newItems.length - deleteCount;\n this.updateArrayLength_(length, lengthDelta); // checks if internal array wasn't modified\n }\n var res = this.spliceItemsIntoValues_(index, deleteCount, newItems);\n if (deleteCount !== 0 || newItems.length !== 0) {\n this.notifyArraySplice_(index, newItems, res);\n }\n return this.dehanceValues_(res);\n };\n _proto.spliceItemsIntoValues_ = function spliceItemsIntoValues_(index, deleteCount, newItems) {\n if (newItems.length < MAX_SPLICE_SIZE) {\n var _this$values_;\n return (_this$values_ = this.values_).splice.apply(_this$values_, [index, deleteCount].concat(newItems));\n } else {\n // The items removed by the splice\n var res = this.values_.slice(index, index + deleteCount);\n // The items that that should remain at the end of the array\n var oldItems = this.values_.slice(index + deleteCount);\n // New length is the previous length + addition count - deletion count\n this.values_.length += newItems.length - deleteCount;\n for (var i = 0; i < newItems.length; i++) {\n this.values_[index + i] = newItems[i];\n }\n for (var _i = 0; _i < oldItems.length; _i++) {\n this.values_[index + newItems.length + _i] = oldItems[_i];\n }\n return res;\n }\n };\n _proto.notifyArrayChildUpdate_ = function notifyArrayChildUpdate_(index, newValue, oldValue) {\n var notifySpy = !this.owned_ && isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"array\",\n object: this.proxy_,\n type: UPDATE,\n debugObjectName: this.atom_.name_,\n index: index,\n newValue: newValue,\n oldValue: oldValue\n } : null;\n // The reason why this is on right hand side here (and not above), is this way the uglifier will drop it, but it won't\n // cause any runtime overhead in development mode without NODE_ENV set, unless spying is enabled\n if ( true && notifySpy) {\n spyReportStart(change);\n }\n this.atom_.reportChanged();\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n };\n _proto.notifyArraySplice_ = function notifyArraySplice_(index, added, removed) {\n var notifySpy = !this.owned_ && isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"array\",\n object: this.proxy_,\n debugObjectName: this.atom_.name_,\n type: SPLICE,\n index: index,\n removed: removed,\n added: added,\n removedCount: removed.length,\n addedCount: added.length\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n }\n this.atom_.reportChanged();\n // conform: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/observe\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n };\n _proto.get_ = function get_(index) {\n if (this.legacyMode_ && index >= this.values_.length) {\n console.warn( true ? \"[mobx.array] Attempt to read an array index (\" + index + \") that is out of bounds (\" + this.values_.length + \"). Please check length first. Out of bound indices will not be tracked by MobX\" : 0);\n return undefined;\n }\n this.atom_.reportObserved();\n return this.dehanceValue_(this.values_[index]);\n };\n _proto.set_ = function set_(index, newValue) {\n var values = this.values_;\n if (this.legacyMode_ && index > values.length) {\n // out of bounds\n die(17, index, values.length);\n }\n if (index < values.length) {\n // update at index in range\n checkIfStateModificationsAreAllowed(this.atom_);\n var oldValue = values[index];\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: UPDATE,\n object: this.proxy_,\n // since \"this\" is the real array we need to pass its proxy\n index: index,\n newValue: newValue\n });\n if (!change) {\n return;\n }\n newValue = change.newValue;\n }\n newValue = this.enhancer_(newValue, oldValue);\n var changed = newValue !== oldValue;\n if (changed) {\n values[index] = newValue;\n this.notifyArrayChildUpdate_(index, newValue, oldValue);\n }\n } else {\n // For out of bound index, we don't create an actual sparse array,\n // but rather fill the holes with undefined (same as setArrayLength_).\n // This could be considered a bug.\n var newItems = new Array(index + 1 - values.length);\n for (var i = 0; i < newItems.length - 1; i++) {\n newItems[i] = undefined;\n } // No Array.fill everywhere...\n newItems[newItems.length - 1] = newValue;\n this.spliceWithArray_(values.length, 0, newItems);\n }\n };\n return ObservableArrayAdministration;\n}();\nfunction createObservableArray(initialValues, enhancer, name, owned) {\n if (name === void 0) {\n name = true ? \"ObservableArray@\" + getNextId() : 0;\n }\n if (owned === void 0) {\n owned = false;\n }\n assertProxies();\n return initObservable(function () {\n var adm = new ObservableArrayAdministration(name, enhancer, owned, false);\n addHiddenFinalProp(adm.values_, $mobx, adm);\n var proxy = new Proxy(adm.values_, arrayTraps);\n adm.proxy_ = proxy;\n if (initialValues && initialValues.length) {\n adm.spliceWithArray_(0, 0, initialValues);\n }\n return proxy;\n });\n}\n// eslint-disable-next-line\nvar arrayExtensions = {\n clear: function clear() {\n return this.splice(0);\n },\n replace: function replace(newItems) {\n var adm = this[$mobx];\n return adm.spliceWithArray_(0, adm.values_.length, newItems);\n },\n // Used by JSON.stringify\n toJSON: function toJSON() {\n return this.slice();\n },\n /*\n * functions that do alter the internal structure of the array, (based on lib.es6.d.ts)\n * since these functions alter the inner structure of the array, the have side effects.\n * Because the have side effects, they should not be used in computed function,\n * and for that reason the do not call dependencyState.notifyObserved\n */\n splice: function splice(index, deleteCount) {\n for (var _len = arguments.length, newItems = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {\n newItems[_key - 2] = arguments[_key];\n }\n var adm = this[$mobx];\n switch (arguments.length) {\n case 0:\n return [];\n case 1:\n return adm.spliceWithArray_(index);\n case 2:\n return adm.spliceWithArray_(index, deleteCount);\n }\n return adm.spliceWithArray_(index, deleteCount, newItems);\n },\n spliceWithArray: function spliceWithArray(index, deleteCount, newItems) {\n return this[$mobx].spliceWithArray_(index, deleteCount, newItems);\n },\n push: function push() {\n var adm = this[$mobx];\n for (var _len2 = arguments.length, items = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n items[_key2] = arguments[_key2];\n }\n adm.spliceWithArray_(adm.values_.length, 0, items);\n return adm.values_.length;\n },\n pop: function pop() {\n return this.splice(Math.max(this[$mobx].values_.length - 1, 0), 1)[0];\n },\n shift: function shift() {\n return this.splice(0, 1)[0];\n },\n unshift: function unshift() {\n var adm = this[$mobx];\n for (var _len3 = arguments.length, items = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n items[_key3] = arguments[_key3];\n }\n adm.spliceWithArray_(0, 0, items);\n return adm.values_.length;\n },\n reverse: function reverse() {\n // reverse by default mutates in place before returning the result\n // which makes it both a 'derivation' and a 'mutation'.\n if (globalState.trackingDerivation) {\n die(37, \"reverse\");\n }\n this.replace(this.slice().reverse());\n return this;\n },\n sort: function sort() {\n // sort by default mutates in place before returning the result\n // which goes against all good practices. Let's not change the array in place!\n if (globalState.trackingDerivation) {\n die(37, \"sort\");\n }\n var copy = this.slice();\n copy.sort.apply(copy, arguments);\n this.replace(copy);\n return this;\n },\n remove: function remove(value) {\n var adm = this[$mobx];\n var idx = adm.dehanceValues_(adm.values_).indexOf(value);\n if (idx > -1) {\n this.splice(idx, 1);\n return true;\n }\n return false;\n }\n};\n/**\n * Wrap function from prototype\n * Without this, everything works as well, but this works\n * faster as everything works on unproxied values\n */\naddArrayExtension(\"at\", simpleFunc);\naddArrayExtension(\"concat\", simpleFunc);\naddArrayExtension(\"flat\", simpleFunc);\naddArrayExtension(\"includes\", simpleFunc);\naddArrayExtension(\"indexOf\", simpleFunc);\naddArrayExtension(\"join\", simpleFunc);\naddArrayExtension(\"lastIndexOf\", simpleFunc);\naddArrayExtension(\"slice\", simpleFunc);\naddArrayExtension(\"toString\", simpleFunc);\naddArrayExtension(\"toLocaleString\", simpleFunc);\naddArrayExtension(\"toSorted\", simpleFunc);\naddArrayExtension(\"toSpliced\", simpleFunc);\naddArrayExtension(\"with\", simpleFunc);\n// map\naddArrayExtension(\"every\", mapLikeFunc);\naddArrayExtension(\"filter\", mapLikeFunc);\naddArrayExtension(\"find\", mapLikeFunc);\naddArrayExtension(\"findIndex\", mapLikeFunc);\naddArrayExtension(\"findLast\", mapLikeFunc);\naddArrayExtension(\"findLastIndex\", mapLikeFunc);\naddArrayExtension(\"flatMap\", mapLikeFunc);\naddArrayExtension(\"forEach\", mapLikeFunc);\naddArrayExtension(\"map\", mapLikeFunc);\naddArrayExtension(\"some\", mapLikeFunc);\naddArrayExtension(\"toReversed\", mapLikeFunc);\n// reduce\naddArrayExtension(\"reduce\", reduceLikeFunc);\naddArrayExtension(\"reduceRight\", reduceLikeFunc);\nfunction addArrayExtension(funcName, funcFactory) {\n if (typeof Array.prototype[funcName] === \"function\") {\n arrayExtensions[funcName] = funcFactory(funcName);\n }\n}\n// Report and delegate to dehanced array\nfunction simpleFunc(funcName) {\n return function () {\n var adm = this[$mobx];\n adm.atom_.reportObserved();\n var dehancedValues = adm.dehanceValues_(adm.values_);\n return dehancedValues[funcName].apply(dehancedValues, arguments);\n };\n}\n// Make sure callbacks receive correct array arg #2326\nfunction mapLikeFunc(funcName) {\n return function (callback, thisArg) {\n var _this2 = this;\n var adm = this[$mobx];\n adm.atom_.reportObserved();\n var dehancedValues = adm.dehanceValues_(adm.values_);\n return dehancedValues[funcName](function (element, index) {\n return callback.call(thisArg, element, index, _this2);\n });\n };\n}\n// Make sure callbacks receive correct array arg #2326\nfunction reduceLikeFunc(funcName) {\n return function () {\n var _this3 = this;\n var adm = this[$mobx];\n adm.atom_.reportObserved();\n var dehancedValues = adm.dehanceValues_(adm.values_);\n // #2432 - reduce behavior depends on arguments.length\n var callback = arguments[0];\n arguments[0] = function (accumulator, currentValue, index) {\n return callback(accumulator, currentValue, index, _this3);\n };\n return dehancedValues[funcName].apply(dehancedValues, arguments);\n };\n}\nvar isObservableArrayAdministration = /*#__PURE__*/createInstanceofPredicate(\"ObservableArrayAdministration\", ObservableArrayAdministration);\nfunction isObservableArray(thing) {\n return isObject(thing) && isObservableArrayAdministration(thing[$mobx]);\n}\n\nvar ObservableMapMarker = {};\nvar ADD = \"add\";\nvar DELETE = \"delete\";\n// just extend Map? See also https://gist.github.com/nestharus/13b4d74f2ef4a2f4357dbd3fc23c1e54\n// But: https://github.com/mobxjs/mobx/issues/1556\nvar ObservableMap = /*#__PURE__*/function () {\n function ObservableMap(initialData, enhancer_, name_) {\n var _this = this;\n if (enhancer_ === void 0) {\n enhancer_ = deepEnhancer;\n }\n if (name_ === void 0) {\n name_ = true ? \"ObservableMap@\" + getNextId() : 0;\n }\n this.enhancer_ = void 0;\n this.name_ = void 0;\n this[$mobx] = ObservableMapMarker;\n this.data_ = void 0;\n this.hasMap_ = void 0;\n // hasMap, not hashMap >-).\n this.keysAtom_ = void 0;\n this.interceptors_ = void 0;\n this.changeListeners_ = void 0;\n this.dehancer = void 0;\n this.enhancer_ = enhancer_;\n this.name_ = name_;\n if (!isFunction(Map)) {\n die(18);\n }\n initObservable(function () {\n _this.keysAtom_ = createAtom( true ? _this.name_ + \".keys()\" : 0);\n _this.data_ = new Map();\n _this.hasMap_ = new Map();\n if (initialData) {\n _this.merge(initialData);\n }\n });\n }\n var _proto = ObservableMap.prototype;\n _proto.has_ = function has_(key) {\n return this.data_.has(key);\n };\n _proto.has = function has(key) {\n var _this2 = this;\n if (!globalState.trackingDerivation) {\n return this.has_(key);\n }\n var entry = this.hasMap_.get(key);\n if (!entry) {\n var newEntry = entry = new ObservableValue(this.has_(key), referenceEnhancer, true ? this.name_ + \".\" + stringifyKey(key) + \"?\" : 0, false);\n this.hasMap_.set(key, newEntry);\n onBecomeUnobserved(newEntry, function () {\n return _this2.hasMap_[\"delete\"](key);\n });\n }\n return entry.get();\n };\n _proto.set = function set(key, value) {\n var hasKey = this.has_(key);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: hasKey ? UPDATE : ADD,\n object: this,\n newValue: value,\n name: key\n });\n if (!change) {\n return this;\n }\n value = change.newValue;\n }\n if (hasKey) {\n this.updateValue_(key, value);\n } else {\n this.addValue_(key, value);\n }\n return this;\n };\n _proto[\"delete\"] = function _delete(key) {\n var _this3 = this;\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: DELETE,\n object: this,\n name: key\n });\n if (!change) {\n return false;\n }\n }\n if (this.has_(key)) {\n var notifySpy = isSpyEnabled();\n var notify = hasListeners(this);\n var _change = notify || notifySpy ? {\n observableKind: \"map\",\n debugObjectName: this.name_,\n type: DELETE,\n object: this,\n oldValue: this.data_.get(key).value_,\n name: key\n } : null;\n if ( true && notifySpy) {\n spyReportStart(_change);\n } // TODO fix type\n transaction(function () {\n var _this3$hasMap_$get;\n _this3.keysAtom_.reportChanged();\n (_this3$hasMap_$get = _this3.hasMap_.get(key)) == null || _this3$hasMap_$get.setNewValue_(false);\n var observable = _this3.data_.get(key);\n observable.setNewValue_(undefined);\n _this3.data_[\"delete\"](key);\n });\n if (notify) {\n notifyListeners(this, _change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n return true;\n }\n return false;\n };\n _proto.updateValue_ = function updateValue_(key, newValue) {\n var observable = this.data_.get(key);\n newValue = observable.prepareNewValue_(newValue);\n if (newValue !== globalState.UNCHANGED) {\n var notifySpy = isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"map\",\n debugObjectName: this.name_,\n type: UPDATE,\n object: this,\n oldValue: observable.value_,\n name: key,\n newValue: newValue\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n } // TODO fix type\n observable.setNewValue_(newValue);\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n };\n _proto.addValue_ = function addValue_(key, newValue) {\n var _this4 = this;\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n transaction(function () {\n var _this4$hasMap_$get;\n var observable = new ObservableValue(newValue, _this4.enhancer_, true ? _this4.name_ + \".\" + stringifyKey(key) : 0, false);\n _this4.data_.set(key, observable);\n newValue = observable.value_; // value might have been changed\n (_this4$hasMap_$get = _this4.hasMap_.get(key)) == null || _this4$hasMap_$get.setNewValue_(true);\n _this4.keysAtom_.reportChanged();\n });\n var notifySpy = isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"map\",\n debugObjectName: this.name_,\n type: ADD,\n object: this,\n name: key,\n newValue: newValue\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n } // TODO fix type\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n };\n _proto.get = function get(key) {\n if (this.has(key)) {\n return this.dehanceValue_(this.data_.get(key).get());\n }\n return this.dehanceValue_(undefined);\n };\n _proto.dehanceValue_ = function dehanceValue_(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.keys = function keys() {\n this.keysAtom_.reportObserved();\n return this.data_.keys();\n };\n _proto.values = function values() {\n var self = this;\n var keys = this.keys();\n return makeIterableForMap({\n next: function next() {\n var _keys$next = keys.next(),\n done = _keys$next.done,\n value = _keys$next.value;\n return {\n done: done,\n value: done ? undefined : self.get(value)\n };\n }\n });\n };\n _proto.entries = function entries() {\n var self = this;\n var keys = this.keys();\n return makeIterableForMap({\n next: function next() {\n var _keys$next2 = keys.next(),\n done = _keys$next2.done,\n value = _keys$next2.value;\n return {\n done: done,\n value: done ? undefined : [value, self.get(value)]\n };\n }\n });\n };\n _proto[Symbol.iterator] = function () {\n return this.entries();\n };\n _proto.forEach = function forEach(callback, thisArg) {\n for (var _iterator = _createForOfIteratorHelperLoose(this), _step; !(_step = _iterator()).done;) {\n var _step$value = _step.value,\n key = _step$value[0],\n value = _step$value[1];\n callback.call(thisArg, value, key, this);\n }\n }\n /** Merge another object into this object, returns this. */;\n _proto.merge = function merge(other) {\n var _this5 = this;\n if (isObservableMap(other)) {\n other = new Map(other);\n }\n transaction(function () {\n if (isPlainObject(other)) {\n getPlainObjectKeys(other).forEach(function (key) {\n return _this5.set(key, other[key]);\n });\n } else if (Array.isArray(other)) {\n other.forEach(function (_ref) {\n var key = _ref[0],\n value = _ref[1];\n return _this5.set(key, value);\n });\n } else if (isES6Map(other)) {\n if (!isPlainES6Map(other)) {\n die(19, other);\n }\n other.forEach(function (value, key) {\n return _this5.set(key, value);\n });\n } else if (other !== null && other !== undefined) {\n die(20, other);\n }\n });\n return this;\n };\n _proto.clear = function clear() {\n var _this6 = this;\n transaction(function () {\n untracked(function () {\n for (var _iterator2 = _createForOfIteratorHelperLoose(_this6.keys()), _step2; !(_step2 = _iterator2()).done;) {\n var key = _step2.value;\n _this6[\"delete\"](key);\n }\n });\n });\n };\n _proto.replace = function replace(values) {\n var _this7 = this;\n // Implementation requirements:\n // - respect ordering of replacement map\n // - allow interceptors to run and potentially prevent individual operations\n // - don't recreate observables that already exist in original map (so we don't destroy existing subscriptions)\n // - don't _keysAtom.reportChanged if the keys of resulting map are indentical (order matters!)\n // - note that result map may differ from replacement map due to the interceptors\n transaction(function () {\n // Convert to map so we can do quick key lookups\n var replacementMap = convertToMap(values);\n var orderedData = new Map();\n // Used for optimization\n var keysReportChangedCalled = false;\n // Delete keys that don't exist in replacement map\n // if the key deletion is prevented by interceptor\n // add entry at the beginning of the result map\n for (var _iterator3 = _createForOfIteratorHelperLoose(_this7.data_.keys()), _step3; !(_step3 = _iterator3()).done;) {\n var key = _step3.value;\n // Concurrently iterating/deleting keys\n // iterator should handle this correctly\n if (!replacementMap.has(key)) {\n var deleted = _this7[\"delete\"](key);\n // Was the key removed?\n if (deleted) {\n // _keysAtom.reportChanged() was already called\n keysReportChangedCalled = true;\n } else {\n // Delete prevented by interceptor\n var value = _this7.data_.get(key);\n orderedData.set(key, value);\n }\n }\n }\n // Merge entries\n for (var _iterator4 = _createForOfIteratorHelperLoose(replacementMap.entries()), _step4; !(_step4 = _iterator4()).done;) {\n var _step4$value = _step4.value,\n _key = _step4$value[0],\n _value = _step4$value[1];\n // We will want to know whether a new key is added\n var keyExisted = _this7.data_.has(_key);\n // Add or update value\n _this7.set(_key, _value);\n // The addition could have been prevent by interceptor\n if (_this7.data_.has(_key)) {\n // The update could have been prevented by interceptor\n // and also we want to preserve existing values\n // so use value from _data map (instead of replacement map)\n var _value2 = _this7.data_.get(_key);\n orderedData.set(_key, _value2);\n // Was a new key added?\n if (!keyExisted) {\n // _keysAtom.reportChanged() was already called\n keysReportChangedCalled = true;\n }\n }\n }\n // Check for possible key order change\n if (!keysReportChangedCalled) {\n if (_this7.data_.size !== orderedData.size) {\n // If size differs, keys are definitely modified\n _this7.keysAtom_.reportChanged();\n } else {\n var iter1 = _this7.data_.keys();\n var iter2 = orderedData.keys();\n var next1 = iter1.next();\n var next2 = iter2.next();\n while (!next1.done) {\n if (next1.value !== next2.value) {\n _this7.keysAtom_.reportChanged();\n break;\n }\n next1 = iter1.next();\n next2 = iter2.next();\n }\n }\n }\n // Use correctly ordered map\n _this7.data_ = orderedData;\n });\n return this;\n };\n _proto.toString = function toString() {\n return \"[object ObservableMap]\";\n };\n _proto.toJSON = function toJSON() {\n return Array.from(this);\n };\n /**\n * Observes this object. Triggers for the events 'add', 'update' and 'delete'.\n * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe\n * for callback details\n */\n _proto.observe_ = function observe_(listener, fireImmediately) {\n if ( true && fireImmediately === true) {\n die(\"`observe` doesn't support fireImmediately=true in combination with maps.\");\n }\n return registerListener(this, listener);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n return _createClass(ObservableMap, [{\n key: \"size\",\n get: function get() {\n this.keysAtom_.reportObserved();\n return this.data_.size;\n }\n }, {\n key: Symbol.toStringTag,\n get: function get() {\n return \"Map\";\n }\n }]);\n}();\n// eslint-disable-next-line\nvar isObservableMap = /*#__PURE__*/createInstanceofPredicate(\"ObservableMap\", ObservableMap);\nfunction makeIterableForMap(iterator) {\n iterator[Symbol.toStringTag] = \"MapIterator\";\n return makeIterable(iterator);\n}\nfunction convertToMap(dataStructure) {\n if (isES6Map(dataStructure) || isObservableMap(dataStructure)) {\n return dataStructure;\n } else if (Array.isArray(dataStructure)) {\n return new Map(dataStructure);\n } else if (isPlainObject(dataStructure)) {\n var map = new Map();\n for (var key in dataStructure) {\n map.set(key, dataStructure[key]);\n }\n return map;\n } else {\n return die(21, dataStructure);\n }\n}\n\nvar ObservableSetMarker = {};\nvar ObservableSet = /*#__PURE__*/function () {\n function ObservableSet(initialData, enhancer, name_) {\n var _this = this;\n if (enhancer === void 0) {\n enhancer = deepEnhancer;\n }\n if (name_ === void 0) {\n name_ = true ? \"ObservableSet@\" + getNextId() : 0;\n }\n this.name_ = void 0;\n this[$mobx] = ObservableSetMarker;\n this.data_ = new Set();\n this.atom_ = void 0;\n this.changeListeners_ = void 0;\n this.interceptors_ = void 0;\n this.dehancer = void 0;\n this.enhancer_ = void 0;\n this.name_ = name_;\n if (!isFunction(Set)) {\n die(22);\n }\n this.enhancer_ = function (newV, oldV) {\n return enhancer(newV, oldV, name_);\n };\n initObservable(function () {\n _this.atom_ = createAtom(_this.name_);\n if (initialData) {\n _this.replace(initialData);\n }\n });\n }\n var _proto = ObservableSet.prototype;\n _proto.dehanceValue_ = function dehanceValue_(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.clear = function clear() {\n var _this2 = this;\n transaction(function () {\n untracked(function () {\n for (var _iterator = _createForOfIteratorHelperLoose(_this2.data_.values()), _step; !(_step = _iterator()).done;) {\n var value = _step.value;\n _this2[\"delete\"](value);\n }\n });\n });\n };\n _proto.forEach = function forEach(callbackFn, thisArg) {\n for (var _iterator2 = _createForOfIteratorHelperLoose(this), _step2; !(_step2 = _iterator2()).done;) {\n var value = _step2.value;\n callbackFn.call(thisArg, value, value, this);\n }\n };\n _proto.add = function add(value) {\n var _this3 = this;\n checkIfStateModificationsAreAllowed(this.atom_);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: ADD,\n object: this,\n newValue: value\n });\n if (!change) {\n return this;\n }\n // ideally, value = change.value would be done here, so that values can be\n // changed by interceptor. Same applies for other Set and Map api's.\n }\n if (!this.has(value)) {\n transaction(function () {\n _this3.data_.add(_this3.enhancer_(value, undefined));\n _this3.atom_.reportChanged();\n });\n var notifySpy = true && isSpyEnabled();\n var notify = hasListeners(this);\n var _change = notify || notifySpy ? {\n observableKind: \"set\",\n debugObjectName: this.name_,\n type: ADD,\n object: this,\n newValue: value\n } : null;\n if (notifySpy && \"development\" !== \"production\") {\n spyReportStart(_change);\n }\n if (notify) {\n notifyListeners(this, _change);\n }\n if (notifySpy && \"development\" !== \"production\") {\n spyReportEnd();\n }\n }\n return this;\n };\n _proto[\"delete\"] = function _delete(value) {\n var _this4 = this;\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: DELETE,\n object: this,\n oldValue: value\n });\n if (!change) {\n return false;\n }\n }\n if (this.has(value)) {\n var notifySpy = true && isSpyEnabled();\n var notify = hasListeners(this);\n var _change2 = notify || notifySpy ? {\n observableKind: \"set\",\n debugObjectName: this.name_,\n type: DELETE,\n object: this,\n oldValue: value\n } : null;\n if (notifySpy && \"development\" !== \"production\") {\n spyReportStart(_change2);\n }\n transaction(function () {\n _this4.atom_.reportChanged();\n _this4.data_[\"delete\"](value);\n });\n if (notify) {\n notifyListeners(this, _change2);\n }\n if (notifySpy && \"development\" !== \"production\") {\n spyReportEnd();\n }\n return true;\n }\n return false;\n };\n _proto.has = function has(value) {\n this.atom_.reportObserved();\n return this.data_.has(this.dehanceValue_(value));\n };\n _proto.entries = function entries() {\n var nextIndex = 0;\n var keys = Array.from(this.keys());\n var values = Array.from(this.values());\n return makeIterableForSet({\n next: function next() {\n var index = nextIndex;\n nextIndex += 1;\n return index < values.length ? {\n value: [keys[index], values[index]],\n done: false\n } : {\n value: undefined,\n done: true\n };\n }\n });\n };\n _proto.keys = function keys() {\n return this.values();\n };\n _proto.values = function values() {\n this.atom_.reportObserved();\n var self = this;\n var nextIndex = 0;\n var observableValues = Array.from(this.data_.values());\n return makeIterableForSet({\n next: function next() {\n return nextIndex < observableValues.length ? {\n value: self.dehanceValue_(observableValues[nextIndex++]),\n done: false\n } : {\n value: undefined,\n done: true\n };\n }\n });\n };\n _proto.intersection = function intersection(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.intersection(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.intersection(otherSet);\n }\n };\n _proto.union = function union(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.union(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.union(otherSet);\n }\n };\n _proto.difference = function difference(otherSet) {\n return new Set(this).difference(otherSet);\n };\n _proto.symmetricDifference = function symmetricDifference(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.symmetricDifference(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.symmetricDifference(otherSet);\n }\n };\n _proto.isSubsetOf = function isSubsetOf(otherSet) {\n return new Set(this).isSubsetOf(otherSet);\n };\n _proto.isSupersetOf = function isSupersetOf(otherSet) {\n return new Set(this).isSupersetOf(otherSet);\n };\n _proto.isDisjointFrom = function isDisjointFrom(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.isDisjointFrom(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.isDisjointFrom(otherSet);\n }\n };\n _proto.replace = function replace(other) {\n var _this5 = this;\n if (isObservableSet(other)) {\n other = new Set(other);\n }\n transaction(function () {\n if (Array.isArray(other)) {\n _this5.clear();\n other.forEach(function (value) {\n return _this5.add(value);\n });\n } else if (isES6Set(other)) {\n _this5.clear();\n other.forEach(function (value) {\n return _this5.add(value);\n });\n } else if (other !== null && other !== undefined) {\n die(\"Cannot initialize set from \" + other);\n }\n });\n return this;\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n // ... 'fireImmediately' could also be true?\n if ( true && fireImmediately === true) {\n die(\"`observe` doesn't support fireImmediately=true in combination with sets.\");\n }\n return registerListener(this, listener);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.toJSON = function toJSON() {\n return Array.from(this);\n };\n _proto.toString = function toString() {\n return \"[object ObservableSet]\";\n };\n _proto[Symbol.iterator] = function () {\n return this.values();\n };\n return _createClass(ObservableSet, [{\n key: \"size\",\n get: function get() {\n this.atom_.reportObserved();\n return this.data_.size;\n }\n }, {\n key: Symbol.toStringTag,\n get: function get() {\n return \"Set\";\n }\n }]);\n}();\n// eslint-disable-next-line\nvar isObservableSet = /*#__PURE__*/createInstanceofPredicate(\"ObservableSet\", ObservableSet);\nfunction makeIterableForSet(iterator) {\n iterator[Symbol.toStringTag] = \"SetIterator\";\n return makeIterable(iterator);\n}\n\nvar descriptorCache = /*#__PURE__*/Object.create(null);\nvar REMOVE = \"remove\";\nvar ObservableObjectAdministration = /*#__PURE__*/function () {\n function ObservableObjectAdministration(target_, values_, name_,\n // Used anytime annotation is not explicitely provided\n defaultAnnotation_) {\n if (values_ === void 0) {\n values_ = new Map();\n }\n if (defaultAnnotation_ === void 0) {\n defaultAnnotation_ = autoAnnotation;\n }\n this.target_ = void 0;\n this.values_ = void 0;\n this.name_ = void 0;\n this.defaultAnnotation_ = void 0;\n this.keysAtom_ = void 0;\n this.changeListeners_ = void 0;\n this.interceptors_ = void 0;\n this.proxy_ = void 0;\n this.isPlainObject_ = void 0;\n this.appliedAnnotations_ = void 0;\n this.pendingKeys_ = void 0;\n this.target_ = target_;\n this.values_ = values_;\n this.name_ = name_;\n this.defaultAnnotation_ = defaultAnnotation_;\n this.keysAtom_ = new Atom( true ? this.name_ + \".keys\" : 0);\n // Optimization: we use this frequently\n this.isPlainObject_ = isPlainObject(this.target_);\n if ( true && !isAnnotation(this.defaultAnnotation_)) {\n die(\"defaultAnnotation must be valid annotation\");\n }\n if (true) {\n // Prepare structure for tracking which fields were already annotated\n this.appliedAnnotations_ = {};\n }\n }\n var _proto = ObservableObjectAdministration.prototype;\n _proto.getObservablePropValue_ = function getObservablePropValue_(key) {\n return this.values_.get(key).get();\n };\n _proto.setObservablePropValue_ = function setObservablePropValue_(key, newValue) {\n var observable = this.values_.get(key);\n if (observable instanceof ComputedValue) {\n observable.set(newValue);\n return true;\n }\n // intercept\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: UPDATE,\n object: this.proxy_ || this.target_,\n name: key,\n newValue: newValue\n });\n if (!change) {\n return null;\n }\n newValue = change.newValue;\n }\n newValue = observable.prepareNewValue_(newValue);\n // notify spy & observers\n if (newValue !== globalState.UNCHANGED) {\n var notify = hasListeners(this);\n var notifySpy = true && isSpyEnabled();\n var _change = notify || notifySpy ? {\n type: UPDATE,\n observableKind: \"object\",\n debugObjectName: this.name_,\n object: this.proxy_ || this.target_,\n oldValue: observable.value_,\n name: key,\n newValue: newValue\n } : null;\n if ( true && notifySpy) {\n spyReportStart(_change);\n }\n observable.setNewValue_(newValue);\n if (notify) {\n notifyListeners(this, _change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n return true;\n };\n _proto.get_ = function get_(key) {\n if (globalState.trackingDerivation && !hasProp(this.target_, key)) {\n // Key doesn't exist yet, subscribe for it in case it's added later\n this.has_(key);\n }\n return this.target_[key];\n }\n /**\n * @param {PropertyKey} key\n * @param {any} value\n * @param {Annotation|boolean} annotation true - use default annotation, false - copy as is\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.set_ = function set_(key, value, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n // Don't use .has(key) - we care about own\n if (hasProp(this.target_, key)) {\n // Existing prop\n if (this.values_.has(key)) {\n // Observable (can be intercepted)\n return this.setObservablePropValue_(key, value);\n } else if (proxyTrap) {\n // Non-observable - proxy\n return Reflect.set(this.target_, key, value);\n } else {\n // Non-observable\n this.target_[key] = value;\n return true;\n }\n } else {\n // New prop\n return this.extend_(key, {\n value: value,\n enumerable: true,\n writable: true,\n configurable: true\n }, this.defaultAnnotation_, proxyTrap);\n }\n }\n // Trap for \"in\"\n ;\n _proto.has_ = function has_(key) {\n if (!globalState.trackingDerivation) {\n // Skip key subscription outside derivation\n return key in this.target_;\n }\n this.pendingKeys_ || (this.pendingKeys_ = new Map());\n var entry = this.pendingKeys_.get(key);\n if (!entry) {\n entry = new ObservableValue(key in this.target_, referenceEnhancer, true ? this.name_ + \".\" + stringifyKey(key) + \"?\" : 0, false);\n this.pendingKeys_.set(key, entry);\n }\n return entry.get();\n }\n /**\n * @param {PropertyKey} key\n * @param {Annotation|boolean} annotation true - use default annotation, false - ignore prop\n */;\n _proto.make_ = function make_(key, annotation) {\n if (annotation === true) {\n annotation = this.defaultAnnotation_;\n }\n if (annotation === false) {\n return;\n }\n assertAnnotable(this, annotation, key);\n if (!(key in this.target_)) {\n var _this$target_$storedA;\n // Throw on missing key, except for decorators:\n // Decorator annotations are collected from whole prototype chain.\n // When called from super() some props may not exist yet.\n // However we don't have to worry about missing prop,\n // because the decorator must have been applied to something.\n if ((_this$target_$storedA = this.target_[storedAnnotationsSymbol]) != null && _this$target_$storedA[key]) {\n return; // will be annotated by subclass constructor\n } else {\n die(1, annotation.annotationType_, this.name_ + \".\" + key.toString());\n }\n }\n var source = this.target_;\n while (source && source !== objectPrototype) {\n var descriptor = getDescriptor(source, key);\n if (descriptor) {\n var outcome = annotation.make_(this, key, descriptor, source);\n if (outcome === 0 /* MakeResult.Cancel */) {\n return;\n }\n if (outcome === 1 /* MakeResult.Break */) {\n break;\n }\n }\n source = Object.getPrototypeOf(source);\n }\n recordAnnotationApplied(this, annotation, key);\n }\n /**\n * @param {PropertyKey} key\n * @param {PropertyDescriptor} descriptor\n * @param {Annotation|boolean} annotation true - use default annotation, false - copy as is\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.extend_ = function extend_(key, descriptor, annotation, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n if (annotation === true) {\n annotation = this.defaultAnnotation_;\n }\n if (annotation === false) {\n return this.defineProperty_(key, descriptor, proxyTrap);\n }\n assertAnnotable(this, annotation, key);\n var outcome = annotation.extend_(this, key, descriptor, proxyTrap);\n if (outcome) {\n recordAnnotationApplied(this, annotation, key);\n }\n return outcome;\n }\n /**\n * @param {PropertyKey} key\n * @param {PropertyDescriptor} descriptor\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.defineProperty_ = function defineProperty_(key, descriptor, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n try {\n startBatch();\n // Delete\n var deleteOutcome = this.delete_(key);\n if (!deleteOutcome) {\n // Failure or intercepted\n return deleteOutcome;\n }\n // ADD interceptor\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: ADD,\n newValue: descriptor.value\n });\n if (!change) {\n return null;\n }\n var newValue = change.newValue;\n if (descriptor.value !== newValue) {\n descriptor = _extends({}, descriptor, {\n value: newValue\n });\n }\n }\n // Define\n if (proxyTrap) {\n if (!Reflect.defineProperty(this.target_, key, descriptor)) {\n return false;\n }\n } else {\n defineProperty(this.target_, key, descriptor);\n }\n // Notify\n this.notifyPropertyAddition_(key, descriptor.value);\n } finally {\n endBatch();\n }\n return true;\n }\n // If original descriptor becomes relevant, move this to annotation directly\n ;\n _proto.defineObservableProperty_ = function defineObservableProperty_(key, value, enhancer, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n try {\n startBatch();\n // Delete\n var deleteOutcome = this.delete_(key);\n if (!deleteOutcome) {\n // Failure or intercepted\n return deleteOutcome;\n }\n // ADD interceptor\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: ADD,\n newValue: value\n });\n if (!change) {\n return null;\n }\n value = change.newValue;\n }\n var cachedDescriptor = getCachedObservablePropDescriptor(key);\n var descriptor = {\n configurable: globalState.safeDescriptors ? this.isPlainObject_ : true,\n enumerable: true,\n get: cachedDescriptor.get,\n set: cachedDescriptor.set\n };\n // Define\n if (proxyTrap) {\n if (!Reflect.defineProperty(this.target_, key, descriptor)) {\n return false;\n }\n } else {\n defineProperty(this.target_, key, descriptor);\n }\n var observable = new ObservableValue(value, enhancer, true ? this.name_ + \".\" + key.toString() : 0, false);\n this.values_.set(key, observable);\n // Notify (value possibly changed by ObservableValue)\n this.notifyPropertyAddition_(key, observable.value_);\n } finally {\n endBatch();\n }\n return true;\n }\n // If original descriptor becomes relevant, move this to annotation directly\n ;\n _proto.defineComputedProperty_ = function defineComputedProperty_(key, options, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n try {\n startBatch();\n // Delete\n var deleteOutcome = this.delete_(key);\n if (!deleteOutcome) {\n // Failure or intercepted\n return deleteOutcome;\n }\n // ADD interceptor\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: ADD,\n newValue: undefined\n });\n if (!change) {\n return null;\n }\n }\n options.name || (options.name = true ? this.name_ + \".\" + key.toString() : 0);\n options.context = this.proxy_ || this.target_;\n var cachedDescriptor = getCachedObservablePropDescriptor(key);\n var descriptor = {\n configurable: globalState.safeDescriptors ? this.isPlainObject_ : true,\n enumerable: false,\n get: cachedDescriptor.get,\n set: cachedDescriptor.set\n };\n // Define\n if (proxyTrap) {\n if (!Reflect.defineProperty(this.target_, key, descriptor)) {\n return false;\n }\n } else {\n defineProperty(this.target_, key, descriptor);\n }\n this.values_.set(key, new ComputedValue(options));\n // Notify\n this.notifyPropertyAddition_(key, undefined);\n } finally {\n endBatch();\n }\n return true;\n }\n /**\n * @param {PropertyKey} key\n * @param {PropertyDescriptor} descriptor\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.delete_ = function delete_(key, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n // No such prop\n if (!hasProp(this.target_, key)) {\n return true;\n }\n // Intercept\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: REMOVE\n });\n // Cancelled\n if (!change) {\n return null;\n }\n }\n // Delete\n try {\n var _this$pendingKeys_;\n startBatch();\n var notify = hasListeners(this);\n var notifySpy = true && isSpyEnabled();\n var observable = this.values_.get(key);\n // Value needed for spies/listeners\n var value = undefined;\n // Optimization: don't pull the value unless we will need it\n if (!observable && (notify || notifySpy)) {\n var _getDescriptor;\n value = (_getDescriptor = getDescriptor(this.target_, key)) == null ? void 0 : _getDescriptor.value;\n }\n // delete prop (do first, may fail)\n if (proxyTrap) {\n if (!Reflect.deleteProperty(this.target_, key)) {\n return false;\n }\n } else {\n delete this.target_[key];\n }\n // Allow re-annotating this field\n if (true) {\n delete this.appliedAnnotations_[key];\n }\n // Clear observable\n if (observable) {\n this.values_[\"delete\"](key);\n // for computed, value is undefined\n if (observable instanceof ObservableValue) {\n value = observable.value_;\n }\n // Notify: autorun(() => obj[key]), see #1796\n propagateChanged(observable);\n }\n // Notify \"keys/entries/values\" observers\n this.keysAtom_.reportChanged();\n // Notify \"has\" observers\n // \"in\" as it may still exist in proto\n (_this$pendingKeys_ = this.pendingKeys_) == null || (_this$pendingKeys_ = _this$pendingKeys_.get(key)) == null || _this$pendingKeys_.set(key in this.target_);\n // Notify spies/listeners\n if (notify || notifySpy) {\n var _change2 = {\n type: REMOVE,\n observableKind: \"object\",\n object: this.proxy_ || this.target_,\n debugObjectName: this.name_,\n oldValue: value,\n name: key\n };\n if ( true && notifySpy) {\n spyReportStart(_change2);\n }\n if (notify) {\n notifyListeners(this, _change2);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n } finally {\n endBatch();\n }\n return true;\n }\n /**\n * Observes this object. Triggers for the events 'add', 'update' and 'delete'.\n * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe\n * for callback details\n */;\n _proto.observe_ = function observe_(callback, fireImmediately) {\n if ( true && fireImmediately === true) {\n die(\"`observe` doesn't support the fire immediately property for observable objects.\");\n }\n return registerListener(this, callback);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.notifyPropertyAddition_ = function notifyPropertyAddition_(key, value) {\n var _this$pendingKeys_2;\n var notify = hasListeners(this);\n var notifySpy = true && isSpyEnabled();\n if (notify || notifySpy) {\n var change = notify || notifySpy ? {\n type: ADD,\n observableKind: \"object\",\n debugObjectName: this.name_,\n object: this.proxy_ || this.target_,\n name: key,\n newValue: value\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n }\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n (_this$pendingKeys_2 = this.pendingKeys_) == null || (_this$pendingKeys_2 = _this$pendingKeys_2.get(key)) == null || _this$pendingKeys_2.set(true);\n // Notify \"keys/entries/values\" observers\n this.keysAtom_.reportChanged();\n };\n _proto.ownKeys_ = function ownKeys_() {\n this.keysAtom_.reportObserved();\n return ownKeys(this.target_);\n };\n _proto.keys_ = function keys_() {\n // Returns enumerable && own, but unfortunately keysAtom will report on ANY key change.\n // There is no way to distinguish between Object.keys(object) and Reflect.ownKeys(object) - both are handled by ownKeys trap.\n // We can either over-report in Object.keys(object) or under-report in Reflect.ownKeys(object)\n // We choose to over-report in Object.keys(object), because:\n // - typically it's used with simple data objects\n // - when symbolic/non-enumerable keys are relevant Reflect.ownKeys works as expected\n this.keysAtom_.reportObserved();\n return Object.keys(this.target_);\n };\n return ObservableObjectAdministration;\n}();\nfunction asObservableObject(target, options) {\n var _options$name;\n if ( true && options && isObservableObject(target)) {\n die(\"Options can't be provided for already observable objects.\");\n }\n if (hasProp(target, $mobx)) {\n if ( true && !(getAdministration(target) instanceof ObservableObjectAdministration)) {\n die(\"Cannot convert '\" + getDebugName(target) + \"' into observable object:\" + \"\\nThe target is already observable of different type.\" + \"\\nExtending builtins is not supported.\");\n }\n return target;\n }\n if ( true && !Object.isExtensible(target)) {\n die(\"Cannot make the designated object observable; it is not extensible\");\n }\n var name = (_options$name = options == null ? void 0 : options.name) != null ? _options$name : true ? (isPlainObject(target) ? \"ObservableObject\" : target.constructor.name) + \"@\" + getNextId() : 0;\n var adm = new ObservableObjectAdministration(target, new Map(), String(name), getAnnotationFromOptions(options));\n addHiddenProp(target, $mobx, adm);\n return target;\n}\nvar isObservableObjectAdministration = /*#__PURE__*/createInstanceofPredicate(\"ObservableObjectAdministration\", ObservableObjectAdministration);\nfunction getCachedObservablePropDescriptor(key) {\n return descriptorCache[key] || (descriptorCache[key] = {\n get: function get() {\n return this[$mobx].getObservablePropValue_(key);\n },\n set: function set(value) {\n return this[$mobx].setObservablePropValue_(key, value);\n }\n });\n}\nfunction isObservableObject(thing) {\n if (isObject(thing)) {\n return isObservableObjectAdministration(thing[$mobx]);\n }\n return false;\n}\nfunction recordAnnotationApplied(adm, annotation, key) {\n var _adm$target_$storedAn;\n if (true) {\n adm.appliedAnnotations_[key] = annotation;\n }\n // Remove applied decorator annotation so we don't try to apply it again in subclass constructor\n (_adm$target_$storedAn = adm.target_[storedAnnotationsSymbol]) == null || delete _adm$target_$storedAn[key];\n}\nfunction assertAnnotable(adm, annotation, key) {\n // Valid annotation\n if ( true && !isAnnotation(annotation)) {\n die(\"Cannot annotate '\" + adm.name_ + \".\" + key.toString() + \"': Invalid annotation.\");\n }\n /*\n // Configurable, not sealed, not frozen\n // Possibly not needed, just a little better error then the one thrown by engine.\n // Cases where this would be useful the most (subclass field initializer) are not interceptable by this.\n if (__DEV__) {\n const configurable = getDescriptor(adm.target_, key)?.configurable\n const frozen = Object.isFrozen(adm.target_)\n const sealed = Object.isSealed(adm.target_)\n if (!configurable || frozen || sealed) {\n const fieldName = `${adm.name_}.${key.toString()}`\n const requestedAnnotationType = annotation.annotationType_\n let error = `Cannot apply '${requestedAnnotationType}' to '${fieldName}':`\n if (frozen) {\n error += `\\nObject is frozen.`\n }\n if (sealed) {\n error += `\\nObject is sealed.`\n }\n if (!configurable) {\n error += `\\nproperty is not configurable.`\n // Mention only if caused by us to avoid confusion\n if (hasProp(adm.appliedAnnotations!, key)) {\n error += `\\nTo prevent accidental re-definition of a field by a subclass, `\n error += `all annotated fields of non-plain objects (classes) are not configurable.`\n }\n }\n die(error)\n }\n }\n */\n // Not annotated\n if ( true && !isOverride(annotation) && hasProp(adm.appliedAnnotations_, key)) {\n var fieldName = adm.name_ + \".\" + key.toString();\n var currentAnnotationType = adm.appliedAnnotations_[key].annotationType_;\n var requestedAnnotationType = annotation.annotationType_;\n die(\"Cannot apply '\" + requestedAnnotationType + \"' to '\" + fieldName + \"':\" + (\"\\nThe field is already annotated with '\" + currentAnnotationType + \"'.\") + \"\\nRe-annotating fields is not allowed.\" + \"\\nUse 'override' annotation for methods overridden by subclass.\");\n }\n}\n\n// Bug in safari 9.* (or iOS 9 safari mobile). See #364\nvar ENTRY_0 = /*#__PURE__*/createArrayEntryDescriptor(0);\nvar safariPrototypeSetterInheritanceBug = /*#__PURE__*/function () {\n var v = false;\n var p = {};\n Object.defineProperty(p, \"0\", {\n set: function set() {\n v = true;\n }\n });\n /*#__PURE__*/Object.create(p)[\"0\"] = 1;\n return v === false;\n}();\n/**\n * This array buffer contains two lists of properties, so that all arrays\n * can recycle their property definitions, which significantly improves performance of creating\n * properties on the fly.\n */\nvar OBSERVABLE_ARRAY_BUFFER_SIZE = 0;\n// Typescript workaround to make sure ObservableArray extends Array\nvar StubArray = function StubArray() {};\nfunction inherit(ctor, proto) {\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(ctor.prototype, proto);\n } else if (ctor.prototype.__proto__ !== undefined) {\n ctor.prototype.__proto__ = proto;\n } else {\n ctor.prototype = proto;\n }\n}\ninherit(StubArray, Array.prototype);\n// Weex proto freeze protection was here,\n// but it is unclear why the hack is need as MobX never changed the prototype\n// anyway, so removed it in V6\nvar LegacyObservableArray = /*#__PURE__*/function (_StubArray) {\n function LegacyObservableArray(initialValues, enhancer, name, owned) {\n var _this;\n if (name === void 0) {\n name = true ? \"ObservableArray@\" + getNextId() : 0;\n }\n if (owned === void 0) {\n owned = false;\n }\n _this = _StubArray.call(this) || this;\n initObservable(function () {\n var adm = new ObservableArrayAdministration(name, enhancer, owned, true);\n adm.proxy_ = _this;\n addHiddenFinalProp(_this, $mobx, adm);\n if (initialValues && initialValues.length) {\n // @ts-ignore\n _this.spliceWithArray(0, 0, initialValues);\n }\n if (safariPrototypeSetterInheritanceBug) {\n // Seems that Safari won't use numeric prototype setter until any * numeric property is\n // defined on the instance. After that it works fine, even if this property is deleted.\n Object.defineProperty(_this, \"0\", ENTRY_0);\n }\n });\n return _this;\n }\n _inheritsLoose(LegacyObservableArray, _StubArray);\n var _proto = LegacyObservableArray.prototype;\n _proto.concat = function concat() {\n this[$mobx].atom_.reportObserved();\n for (var _len = arguments.length, arrays = new Array(_len), _key = 0; _key < _len; _key++) {\n arrays[_key] = arguments[_key];\n }\n return Array.prototype.concat.apply(this.slice(),\n //@ts-ignore\n arrays.map(function (a) {\n return isObservableArray(a) ? a.slice() : a;\n }));\n };\n _proto[Symbol.iterator] = function () {\n var self = this;\n var nextIndex = 0;\n return makeIterable({\n next: function next() {\n return nextIndex < self.length ? {\n value: self[nextIndex++],\n done: false\n } : {\n done: true,\n value: undefined\n };\n }\n });\n };\n return _createClass(LegacyObservableArray, [{\n key: \"length\",\n get: function get() {\n return this[$mobx].getArrayLength_();\n },\n set: function set(newLength) {\n this[$mobx].setArrayLength_(newLength);\n }\n }, {\n key: Symbol.toStringTag,\n get: function get() {\n return \"Array\";\n }\n }]);\n}(StubArray);\nObject.entries(arrayExtensions).forEach(function (_ref) {\n var prop = _ref[0],\n fn = _ref[1];\n if (prop !== \"concat\") {\n addHiddenProp(LegacyObservableArray.prototype, prop, fn);\n }\n});\nfunction createArrayEntryDescriptor(index) {\n return {\n enumerable: false,\n configurable: true,\n get: function get() {\n return this[$mobx].get_(index);\n },\n set: function set(value) {\n this[$mobx].set_(index, value);\n }\n };\n}\nfunction createArrayBufferItem(index) {\n defineProperty(LegacyObservableArray.prototype, \"\" + index, createArrayEntryDescriptor(index));\n}\nfunction reserveArrayBuffer(max) {\n if (max > OBSERVABLE_ARRAY_BUFFER_SIZE) {\n for (var index = OBSERVABLE_ARRAY_BUFFER_SIZE; index < max + 100; index++) {\n createArrayBufferItem(index);\n }\n OBSERVABLE_ARRAY_BUFFER_SIZE = max;\n }\n}\nreserveArrayBuffer(1000);\nfunction createLegacyArray(initialValues, enhancer, name) {\n return new LegacyObservableArray(initialValues, enhancer, name);\n}\n\nfunction getAtom(thing, property) {\n if (typeof thing === \"object\" && thing !== null) {\n if (isObservableArray(thing)) {\n if (property !== undefined) {\n die(23);\n }\n return thing[$mobx].atom_;\n }\n if (isObservableSet(thing)) {\n return thing.atom_;\n }\n if (isObservableMap(thing)) {\n if (property === undefined) {\n return thing.keysAtom_;\n }\n var observable = thing.data_.get(property) || thing.hasMap_.get(property);\n if (!observable) {\n die(25, property, getDebugName(thing));\n }\n return observable;\n }\n if (isObservableObject(thing)) {\n if (!property) {\n return die(26);\n }\n var _observable = thing[$mobx].values_.get(property);\n if (!_observable) {\n die(27, property, getDebugName(thing));\n }\n return _observable;\n }\n if (isAtom(thing) || isComputedValue(thing) || isReaction(thing)) {\n return thing;\n }\n } else if (isFunction(thing)) {\n if (isReaction(thing[$mobx])) {\n // disposer function\n return thing[$mobx];\n }\n }\n die(28);\n}\nfunction getAdministration(thing, property) {\n if (!thing) {\n die(29);\n }\n if (property !== undefined) {\n return getAdministration(getAtom(thing, property));\n }\n if (isAtom(thing) || isComputedValue(thing) || isReaction(thing)) {\n return thing;\n }\n if (isObservableMap(thing) || isObservableSet(thing)) {\n return thing;\n }\n if (thing[$mobx]) {\n return thing[$mobx];\n }\n die(24, thing);\n}\nfunction getDebugName(thing, property) {\n var named;\n if (property !== undefined) {\n named = getAtom(thing, property);\n } else if (isAction(thing)) {\n return thing.name;\n } else if (isObservableObject(thing) || isObservableMap(thing) || isObservableSet(thing)) {\n named = getAdministration(thing);\n } else {\n // valid for arrays as well\n named = getAtom(thing);\n }\n return named.name_;\n}\n/**\n * Helper function for initializing observable structures, it applies:\n * 1. allowStateChanges so we don't violate enforceActions.\n * 2. untracked so we don't accidentaly subscribe to anything observable accessed during init in case the observable is created inside derivation.\n * 3. batch to avoid state version updates\n */\nfunction initObservable(cb) {\n var derivation = untrackedStart();\n var allowStateChanges = allowStateChangesStart(true);\n startBatch();\n try {\n return cb();\n } finally {\n endBatch();\n allowStateChangesEnd(allowStateChanges);\n untrackedEnd(derivation);\n }\n}\n\nvar toString = objectPrototype.toString;\nfunction deepEqual(a, b, depth) {\n if (depth === void 0) {\n depth = -1;\n }\n return eq(a, b, depth);\n}\n// Copied from https://github.com/jashkenas/underscore/blob/5c237a7c682fb68fd5378203f0bf22dce1624854/underscore.js#L1186-L1289\n// Internal recursive comparison function for `isEqual`.\nfunction eq(a, b, depth, aStack, bStack) {\n // Identical objects are equal. `0 === -0`, but they aren't identical.\n // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).\n if (a === b) {\n return a !== 0 || 1 / a === 1 / b;\n }\n // `null` or `undefined` only equal to itself (strict comparison).\n if (a == null || b == null) {\n return false;\n }\n // `NaN`s are equivalent, but non-reflexive.\n if (a !== a) {\n return b !== b;\n }\n // Exhaust primitive checks\n var type = typeof a;\n if (type !== \"function\" && type !== \"object\" && typeof b != \"object\") {\n return false;\n }\n // Compare `[[Class]]` names.\n var className = toString.call(a);\n if (className !== toString.call(b)) {\n return false;\n }\n switch (className) {\n // Strings, numbers, regular expressions, dates, and booleans are compared by value.\n case \"[object RegExp]\":\n // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i')\n case \"[object String]\":\n // Primitives and their corresponding object wrappers are equivalent; thus, `\"5\"` is\n // equivalent to `new String(\"5\")`.\n return \"\" + a === \"\" + b;\n case \"[object Number]\":\n // `NaN`s are equivalent, but non-reflexive.\n // Object(NaN) is equivalent to NaN.\n if (+a !== +a) {\n return +b !== +b;\n }\n // An `egal` comparison is performed for other numeric values.\n return +a === 0 ? 1 / +a === 1 / b : +a === +b;\n case \"[object Date]\":\n case \"[object Boolean]\":\n // Coerce dates and booleans to numeric primitive values. Dates are compared by their\n // millisecond representations. Note that invalid dates with millisecond representations\n // of `NaN` are not equivalent.\n return +a === +b;\n case \"[object Symbol]\":\n return typeof Symbol !== \"undefined\" && Symbol.valueOf.call(a) === Symbol.valueOf.call(b);\n case \"[object Map]\":\n case \"[object Set]\":\n // Maps and Sets are unwrapped to arrays of entry-pairs, adding an incidental level.\n // Hide this extra level by increasing the depth.\n if (depth >= 0) {\n depth++;\n }\n break;\n }\n // Unwrap any wrapped objects.\n a = unwrap(a);\n b = unwrap(b);\n var areArrays = className === \"[object Array]\";\n if (!areArrays) {\n if (typeof a != \"object\" || typeof b != \"object\") {\n return false;\n }\n // Objects with different constructors are not equivalent, but `Object`s or `Array`s\n // from different frames are.\n var aCtor = a.constructor,\n bCtor = b.constructor;\n if (aCtor !== bCtor && !(isFunction(aCtor) && aCtor instanceof aCtor && isFunction(bCtor) && bCtor instanceof bCtor) && \"constructor\" in a && \"constructor\" in b) {\n return false;\n }\n }\n if (depth === 0) {\n return false;\n } else if (depth < 0) {\n depth = -1;\n }\n // Assume equality for cyclic structures. The algorithm for detecting cyclic\n // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.\n // Initializing stack of traversed objects.\n // It's done here since we only need them for objects and arrays comparison.\n aStack = aStack || [];\n bStack = bStack || [];\n var length = aStack.length;\n while (length--) {\n // Linear search. Performance is inversely proportional to the number of\n // unique nested structures.\n if (aStack[length] === a) {\n return bStack[length] === b;\n }\n }\n // Add the first object to the stack of traversed objects.\n aStack.push(a);\n bStack.push(b);\n // Recursively compare objects and arrays.\n if (areArrays) {\n // Compare array lengths to determine if a deep comparison is necessary.\n length = a.length;\n if (length !== b.length) {\n return false;\n }\n // Deep compare the contents, ignoring non-numeric properties.\n while (length--) {\n if (!eq(a[length], b[length], depth - 1, aStack, bStack)) {\n return false;\n }\n }\n } else {\n // Deep compare objects.\n var keys = Object.keys(a);\n var key;\n length = keys.length;\n // Ensure that both objects contain the same number of properties before comparing deep equality.\n if (Object.keys(b).length !== length) {\n return false;\n }\n while (length--) {\n // Deep compare each member\n key = keys[length];\n if (!(hasProp(b, key) && eq(a[key], b[key], depth - 1, aStack, bStack))) {\n return false;\n }\n }\n }\n // Remove the first object from the stack of traversed objects.\n aStack.pop();\n bStack.pop();\n return true;\n}\nfunction unwrap(a) {\n if (isObservableArray(a)) {\n return a.slice();\n }\n if (isES6Map(a) || isObservableMap(a)) {\n return Array.from(a.entries());\n }\n if (isES6Set(a) || isObservableSet(a)) {\n return Array.from(a.entries());\n }\n return a;\n}\n\nvar _getGlobal$Iterator;\n// safely get iterator prototype if available\nvar maybeIteratorPrototype = ((_getGlobal$Iterator = /*#__PURE__*/getGlobal().Iterator) == null ? void 0 : _getGlobal$Iterator.prototype) || {};\nfunction makeIterable(iterator) {\n iterator[Symbol.iterator] = getSelf;\n return Object.assign(Object.create(maybeIteratorPrototype), iterator);\n}\nfunction getSelf() {\n return this;\n}\n\nfunction isAnnotation(thing) {\n return (\n // Can be function\n thing instanceof Object && typeof thing.annotationType_ === \"string\" && isFunction(thing.make_) && isFunction(thing.extend_)\n );\n}\n\n/**\n * (c) Michel Weststrate 2015 - 2020\n * MIT Licensed\n *\n * Welcome to the mobx sources! To get a global overview of how MobX internally works,\n * this is a good place to start:\n * https://medium.com/@mweststrate/becoming-fully-reactive-an-in-depth-explanation-of-mobservable-55995262a254#.xvbh6qd74\n *\n * Source folders:\n * ===============\n *\n * - api/ Most of the public static methods exposed by the module can be found here.\n * - core/ Implementation of the MobX algorithm; atoms, derivations, reactions, dependency trees, optimizations. Cool stuff can be found here.\n * - types/ All the magic that is need to have observable objects, arrays and values is in this folder. Including the modifiers like `asFlat`.\n * - utils/ Utility stuff.\n *\n */\n[\"Symbol\", \"Map\", \"Set\"].forEach(function (m) {\n var g = getGlobal();\n if (typeof g[m] === \"undefined\") {\n die(\"MobX requires global '\" + m + \"' to be available or polyfilled\");\n }\n});\nif (typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__ === \"object\") {\n // See: https://github.com/andykog/mobx-devtools/\n __MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({\n spy: spy,\n extras: {\n getDebugName: getDebugName\n },\n $mobx: $mobx\n });\n}\n\n\n//# sourceMappingURL=mobx.esm.js.map\n\n\n//# sourceURL=webpack://app_adyen_SFRA/./node_modules/mobx/dist/mobx.esm.js?"); /***/ }) diff --git a/cartridges/app_adyen_SFRA/cartridge/static/default/js/amazonPayCheckout.js b/cartridges/app_adyen_SFRA/cartridge/static/default/js/amazonPayCheckout.js index fd6029fe1..e29e9a7b4 100644 --- a/cartridges/app_adyen_SFRA/cartridge/static/default/js/amazonPayCheckout.js +++ b/cartridges/app_adyen_SFRA/cartridge/static/default/js/amazonPayCheckout.js @@ -36,7 +36,7 @@ eval("\n\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runti \****************************************************************************/ /***/ ((module) => { -eval("\n\n// Adyen constants\n\nmodule.exports = {\n METHOD_ADYEN: 'Adyen',\n METHOD_ADYEN_POS: 'AdyenPOS',\n METHOD_ADYEN_COMPONENT: 'AdyenComponent',\n RECEIVED: 'Received',\n NOTENOUGHBALANCE: 'NotEnoughBalance',\n SUCCESS: 'Success',\n GIFTCARD: 'giftcard',\n SCHEME: 'scheme',\n GIROPAY: 'giropay',\n APPLE_PAY: 'applepay',\n PAYPAL: 'paypal',\n AMAZON_PAY: 'amazonpay',\n ACTIONTYPE: {\n QRCODE: 'qrCode'\n },\n DISABLED_SUBMIT_BUTTON_METHODS: ['paypal', 'paywithgoogle', 'googlepay', 'amazonpay', 'applepay', 'cashapp'],\n MULTIPLE_TX_VARIANTS_COMPONENTS: ['upi']\n};\n\n//# sourceURL=webpack://app_adyen_SFRA/./cartridges/app_adyen_SFRA/cartridge/client/default/js/constants.js?"); +eval("\n\n// Adyen constants\n\nmodule.exports = {\n METHOD_ADYEN: 'Adyen',\n METHOD_ADYEN_POS: 'AdyenPOS',\n METHOD_ADYEN_COMPONENT: 'AdyenComponent',\n RECEIVED: 'Received',\n NOTENOUGHBALANCE: 'NotEnoughBalance',\n SUCCESS: 'Success',\n GIFTCARD: 'giftcard',\n SCHEME: 'scheme',\n GIROPAY: 'giropay',\n APPLE_PAY: 'applepay',\n PAYPAL: 'paypal',\n AMAZON_PAY: 'amazonpay',\n ACTIONTYPE: {\n QRCODE: 'qrCode'\n },\n DISABLED_SUBMIT_BUTTON_METHODS: ['paypal', 'paywithgoogle', 'googlepay', 'amazonpay', 'applepay', 'cashapp', 'upi']\n};\n\n//# sourceURL=webpack://app_adyen_SFRA/./cartridges/app_adyen_SFRA/cartridge/client/default/js/constants.js?"); /***/ }), @@ -56,7 +56,7 @@ eval("\n\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \" \********************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ $mobx: () => (/* binding */ $mobx),\n/* harmony export */ FlowCancellationError: () => (/* binding */ FlowCancellationError),\n/* harmony export */ ObservableMap: () => (/* binding */ ObservableMap),\n/* harmony export */ ObservableSet: () => (/* binding */ ObservableSet),\n/* harmony export */ Reaction: () => (/* binding */ Reaction),\n/* harmony export */ _allowStateChanges: () => (/* binding */ allowStateChanges),\n/* harmony export */ _allowStateChangesInsideComputed: () => (/* binding */ runInAction),\n/* harmony export */ _allowStateReadsEnd: () => (/* binding */ allowStateReadsEnd),\n/* harmony export */ _allowStateReadsStart: () => (/* binding */ allowStateReadsStart),\n/* harmony export */ _autoAction: () => (/* binding */ autoAction),\n/* harmony export */ _endAction: () => (/* binding */ _endAction),\n/* harmony export */ _getAdministration: () => (/* binding */ getAdministration),\n/* harmony export */ _getGlobalState: () => (/* binding */ getGlobalState),\n/* harmony export */ _interceptReads: () => (/* binding */ interceptReads),\n/* harmony export */ _isComputingDerivation: () => (/* binding */ isComputingDerivation),\n/* harmony export */ _resetGlobalState: () => (/* binding */ resetGlobalState),\n/* harmony export */ _startAction: () => (/* binding */ _startAction),\n/* harmony export */ action: () => (/* binding */ action),\n/* harmony export */ autorun: () => (/* binding */ autorun),\n/* harmony export */ comparer: () => (/* binding */ comparer),\n/* harmony export */ computed: () => (/* binding */ computed),\n/* harmony export */ configure: () => (/* binding */ configure),\n/* harmony export */ createAtom: () => (/* binding */ createAtom),\n/* harmony export */ defineProperty: () => (/* binding */ apiDefineProperty),\n/* harmony export */ entries: () => (/* binding */ entries),\n/* harmony export */ extendObservable: () => (/* binding */ extendObservable),\n/* harmony export */ flow: () => (/* binding */ flow),\n/* harmony export */ flowResult: () => (/* binding */ flowResult),\n/* harmony export */ get: () => (/* binding */ get),\n/* harmony export */ getAtom: () => (/* binding */ getAtom),\n/* harmony export */ getDebugName: () => (/* binding */ getDebugName),\n/* harmony export */ getDependencyTree: () => (/* binding */ getDependencyTree),\n/* harmony export */ getObserverTree: () => (/* binding */ getObserverTree),\n/* harmony export */ has: () => (/* binding */ has),\n/* harmony export */ intercept: () => (/* binding */ intercept),\n/* harmony export */ isAction: () => (/* binding */ isAction),\n/* harmony export */ isBoxedObservable: () => (/* binding */ isObservableValue),\n/* harmony export */ isComputed: () => (/* binding */ isComputed),\n/* harmony export */ isComputedProp: () => (/* binding */ isComputedProp),\n/* harmony export */ isFlow: () => (/* binding */ isFlow),\n/* harmony export */ isFlowCancellationError: () => (/* binding */ isFlowCancellationError),\n/* harmony export */ isObservable: () => (/* binding */ isObservable),\n/* harmony export */ isObservableArray: () => (/* binding */ isObservableArray),\n/* harmony export */ isObservableMap: () => (/* binding */ isObservableMap),\n/* harmony export */ isObservableObject: () => (/* binding */ isObservableObject),\n/* harmony export */ isObservableProp: () => (/* binding */ isObservableProp),\n/* harmony export */ isObservableSet: () => (/* binding */ isObservableSet),\n/* harmony export */ keys: () => (/* binding */ keys),\n/* harmony export */ makeAutoObservable: () => (/* binding */ makeAutoObservable),\n/* harmony export */ makeObservable: () => (/* binding */ makeObservable),\n/* harmony export */ observable: () => (/* binding */ observable),\n/* harmony export */ observe: () => (/* binding */ observe),\n/* harmony export */ onBecomeObserved: () => (/* binding */ onBecomeObserved),\n/* harmony export */ onBecomeUnobserved: () => (/* binding */ onBecomeUnobserved),\n/* harmony export */ onReactionError: () => (/* binding */ onReactionError),\n/* harmony export */ override: () => (/* binding */ override),\n/* harmony export */ ownKeys: () => (/* binding */ apiOwnKeys),\n/* harmony export */ reaction: () => (/* binding */ reaction),\n/* harmony export */ remove: () => (/* binding */ remove),\n/* harmony export */ runInAction: () => (/* binding */ runInAction),\n/* harmony export */ set: () => (/* binding */ set),\n/* harmony export */ spy: () => (/* binding */ spy),\n/* harmony export */ toJS: () => (/* binding */ toJS),\n/* harmony export */ trace: () => (/* binding */ trace),\n/* harmony export */ transaction: () => (/* binding */ transaction),\n/* harmony export */ untracked: () => (/* binding */ untracked),\n/* harmony export */ values: () => (/* binding */ values),\n/* harmony export */ when: () => (/* binding */ when)\n/* harmony export */ });\nvar niceErrors = {\n 0: \"Invalid value for configuration 'enforceActions', expected 'never', 'always' or 'observed'\",\n 1: function _(annotationType, key) {\n return \"Cannot apply '\" + annotationType + \"' to '\" + key.toString() + \"': Field not found.\";\n },\n /*\n 2(prop) {\n return `invalid decorator for '${prop.toString()}'`\n },\n 3(prop) {\n return `Cannot decorate '${prop.toString()}': action can only be used on properties with a function value.`\n },\n 4(prop) {\n return `Cannot decorate '${prop.toString()}': computed can only be used on getter properties.`\n },\n */\n 5: \"'keys()' can only be used on observable objects, arrays, sets and maps\",\n 6: \"'values()' can only be used on observable objects, arrays, sets and maps\",\n 7: \"'entries()' can only be used on observable objects, arrays and maps\",\n 8: \"'set()' can only be used on observable objects, arrays and maps\",\n 9: \"'remove()' can only be used on observable objects, arrays and maps\",\n 10: \"'has()' can only be used on observable objects, arrays and maps\",\n 11: \"'get()' can only be used on observable objects, arrays and maps\",\n 12: \"Invalid annotation\",\n 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)\",\n 14: \"Intercept handlers should return nothing or a change object\",\n 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)\",\n 16: \"Modification exception: the internal structure of an observable array was changed.\",\n 17: function _(index, length) {\n return \"[mobx.array] Index out of bounds, \" + index + \" is larger than \" + length;\n },\n 18: \"mobx.map requires Map polyfill for the current browser. Check babel-polyfill or core-js/es6/map.js\",\n 19: function _(other) {\n return \"Cannot initialize from classes that inherit from Map: \" + other.constructor.name;\n },\n 20: function _(other) {\n return \"Cannot initialize map from \" + other;\n },\n 21: function _(dataStructure) {\n return \"Cannot convert to map from '\" + dataStructure + \"'\";\n },\n 22: \"mobx.set requires Set polyfill for the current browser. Check babel-polyfill or core-js/es6/set.js\",\n 23: \"It is not possible to get index atoms from arrays\",\n 24: function _(thing) {\n return \"Cannot obtain administration from \" + thing;\n },\n 25: function _(property, name) {\n return \"the entry '\" + property + \"' does not exist in the observable map '\" + name + \"'\";\n },\n 26: \"please specify a property\",\n 27: function _(property, name) {\n return \"no observable property '\" + property.toString() + \"' found on the observable object '\" + name + \"'\";\n },\n 28: function _(thing) {\n return \"Cannot obtain atom from \" + thing;\n },\n 29: \"Expecting some object\",\n 30: \"invalid action stack. did you forget to finish an action?\",\n 31: \"missing option for computed: get\",\n 32: function _(name, derivation) {\n return \"Cycle detected in computation \" + name + \": \" + derivation;\n },\n 33: function _(name) {\n return \"The setter of computed value '\" + name + \"' is trying to update itself. Did you intend to update an _observable_ value, instead of the computed property?\";\n },\n 34: function _(name) {\n return \"[ComputedValue '\" + name + \"'] It is not possible to assign a new value to a computed value.\";\n },\n 35: \"There are multiple, different versions of MobX active. Make sure MobX is loaded only once or use `configure({ isolateGlobalState: true })`\",\n 36: \"isolateGlobalState should be called before MobX is running any reactions\",\n 37: function _(method) {\n return \"[mobx] `observableArray.\" + method + \"()` mutates the array in-place, which is not allowed inside a derivation. Use `array.slice().\" + method + \"()` instead\";\n },\n 38: \"'ownKeys()' can only be used on observable objects\",\n 39: \"'defineProperty()' can only be used on observable objects\"\n};\nvar errors = true ? niceErrors : 0;\nfunction die(error) {\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n if (true) {\n var e = typeof error === \"string\" ? error : errors[error];\n if (typeof e === \"function\") e = e.apply(null, args);\n throw new Error(\"[MobX] \" + e);\n }\n throw new Error(typeof error === \"number\" ? \"[MobX] minified error nr: \" + error + (args.length ? \" \" + args.map(String).join(\",\") : \"\") + \". Find the full error at: https://github.com/mobxjs/mobx/blob/main/packages/mobx/src/errors.ts\" : \"[MobX] \" + error);\n}\n\nvar mockGlobal = {};\nfunction getGlobal() {\n if (typeof globalThis !== \"undefined\") {\n return globalThis;\n }\n if (typeof window !== \"undefined\") {\n return window;\n }\n if (typeof __webpack_require__.g !== \"undefined\") {\n return __webpack_require__.g;\n }\n if (typeof self !== \"undefined\") {\n return self;\n }\n return mockGlobal;\n}\n\n// We shorten anything used > 5 times\nvar assign = Object.assign;\nvar getDescriptor = Object.getOwnPropertyDescriptor;\nvar defineProperty = Object.defineProperty;\nvar objectPrototype = Object.prototype;\nvar EMPTY_ARRAY = [];\nObject.freeze(EMPTY_ARRAY);\nvar EMPTY_OBJECT = {};\nObject.freeze(EMPTY_OBJECT);\nvar hasProxy = typeof Proxy !== \"undefined\";\nvar plainObjectString = /*#__PURE__*/Object.toString();\nfunction assertProxies() {\n if (!hasProxy) {\n die( true ? \"`Proxy` objects are not available in the current environment. Please configure MobX to enable a fallback implementation.`\" : 0);\n }\n}\nfunction warnAboutProxyRequirement(msg) {\n if ( true && globalState.verifyProxies) {\n die(\"MobX is currently configured to be able to run in ES5 mode, but in ES5 MobX won't be able to \" + msg);\n }\n}\nfunction getNextId() {\n return ++globalState.mobxGuid;\n}\n/**\n * Makes sure that the provided function is invoked at most once.\n */\nfunction once(func) {\n var invoked = false;\n return function () {\n if (invoked) {\n return;\n }\n invoked = true;\n return func.apply(this, arguments);\n };\n}\nvar noop = function noop() {};\nfunction isFunction(fn) {\n return typeof fn === \"function\";\n}\nfunction isStringish(value) {\n var t = typeof value;\n switch (t) {\n case \"string\":\n case \"symbol\":\n case \"number\":\n return true;\n }\n return false;\n}\nfunction isObject(value) {\n return value !== null && typeof value === \"object\";\n}\nfunction isPlainObject(value) {\n if (!isObject(value)) {\n return false;\n }\n var proto = Object.getPrototypeOf(value);\n if (proto == null) {\n return true;\n }\n var protoConstructor = Object.hasOwnProperty.call(proto, \"constructor\") && proto.constructor;\n return typeof protoConstructor === \"function\" && protoConstructor.toString() === plainObjectString;\n}\n// https://stackoverflow.com/a/37865170\nfunction isGenerator(obj) {\n var constructor = obj == null ? void 0 : obj.constructor;\n if (!constructor) {\n return false;\n }\n if (\"GeneratorFunction\" === constructor.name || \"GeneratorFunction\" === constructor.displayName) {\n return true;\n }\n return false;\n}\nfunction addHiddenProp(object, propName, value) {\n defineProperty(object, propName, {\n enumerable: false,\n writable: true,\n configurable: true,\n value: value\n });\n}\nfunction addHiddenFinalProp(object, propName, value) {\n defineProperty(object, propName, {\n enumerable: false,\n writable: false,\n configurable: true,\n value: value\n });\n}\nfunction createInstanceofPredicate(name, theClass) {\n var propName = \"isMobX\" + name;\n theClass.prototype[propName] = true;\n return function (x) {\n return isObject(x) && x[propName] === true;\n };\n}\n/**\n * Yields true for both native and observable Map, even across different windows.\n */\nfunction isES6Map(thing) {\n return thing != null && Object.prototype.toString.call(thing) === \"[object Map]\";\n}\n/**\n * Makes sure a Map is an instance of non-inherited native or observable Map.\n */\nfunction isPlainES6Map(thing) {\n var mapProto = Object.getPrototypeOf(thing);\n var objectProto = Object.getPrototypeOf(mapProto);\n var nullProto = Object.getPrototypeOf(objectProto);\n return nullProto === null;\n}\n/**\n * Yields true for both native and observable Set, even across different windows.\n */\nfunction isES6Set(thing) {\n return thing != null && Object.prototype.toString.call(thing) === \"[object Set]\";\n}\nvar hasGetOwnPropertySymbols = typeof Object.getOwnPropertySymbols !== \"undefined\";\n/**\n * Returns the following: own enumerable keys and symbols.\n */\nfunction getPlainObjectKeys(object) {\n var keys = Object.keys(object);\n // Not supported in IE, so there are not going to be symbol props anyway...\n if (!hasGetOwnPropertySymbols) {\n return keys;\n }\n var symbols = Object.getOwnPropertySymbols(object);\n if (!symbols.length) {\n return keys;\n }\n return [].concat(keys, symbols.filter(function (s) {\n return objectPrototype.propertyIsEnumerable.call(object, s);\n }));\n}\n// From Immer utils\n// Returns all own keys, including non-enumerable and symbolic\nvar ownKeys = typeof Reflect !== \"undefined\" && Reflect.ownKeys ? Reflect.ownKeys : hasGetOwnPropertySymbols ? function (obj) {\n return Object.getOwnPropertyNames(obj).concat(Object.getOwnPropertySymbols(obj));\n} : /* istanbul ignore next */Object.getOwnPropertyNames;\nfunction stringifyKey(key) {\n if (typeof key === \"string\") {\n return key;\n }\n if (typeof key === \"symbol\") {\n return key.toString();\n }\n return new String(key).toString();\n}\nfunction toPrimitive(value) {\n return value === null ? null : typeof value === \"object\" ? \"\" + value : value;\n}\nfunction hasProp(target, prop) {\n return objectPrototype.hasOwnProperty.call(target, prop);\n}\n// From Immer utils\nvar getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors || function getOwnPropertyDescriptors(target) {\n // Polyfill needed for Hermes and IE, see https://github.com/facebook/hermes/issues/274\n var res = {};\n // Note: without polyfill for ownKeys, symbols won't be picked up\n ownKeys(target).forEach(function (key) {\n res[key] = getDescriptor(target, key);\n });\n return res;\n};\nfunction getFlag(flags, mask) {\n return !!(flags & mask);\n}\nfunction setFlag(flags, mask, newValue) {\n if (newValue) {\n flags |= mask;\n } else {\n flags &= ~mask;\n }\n return flags;\n}\n\nfunction _arrayLikeToArray(r, a) {\n (null == a || a > r.length) && (a = r.length);\n for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];\n return n;\n}\nfunction _defineProperties(e, r) {\n for (var t = 0; t < r.length; t++) {\n var o = r[t];\n o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);\n }\n}\nfunction _createClass(e, r, t) {\n return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", {\n writable: !1\n }), e;\n}\nfunction _createForOfIteratorHelperLoose(r, e) {\n var t = \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"];\n if (t) return (t = t.call(r)).next.bind(t);\n if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && \"number\" == typeof r.length) {\n t && (r = t);\n var o = 0;\n return function () {\n return o >= r.length ? {\n done: !0\n } : {\n done: !1,\n value: r[o++]\n };\n };\n }\n throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\nfunction _extends() {\n return _extends = Object.assign ? Object.assign.bind() : function (n) {\n for (var e = 1; e < arguments.length; e++) {\n var t = arguments[e];\n for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);\n }\n return n;\n }, _extends.apply(null, arguments);\n}\nfunction _inheritsLoose(t, o) {\n t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);\n}\nfunction _setPrototypeOf(t, e) {\n return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {\n return t.__proto__ = e, t;\n }, _setPrototypeOf(t, e);\n}\nfunction _toPrimitive(t, r) {\n if (\"object\" != typeof t || !t) return t;\n var e = t[Symbol.toPrimitive];\n if (void 0 !== e) {\n var i = e.call(t, r || \"default\");\n if (\"object\" != typeof i) return i;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (\"string\" === r ? String : Number)(t);\n}\nfunction _toPropertyKey(t) {\n var i = _toPrimitive(t, \"string\");\n return \"symbol\" == typeof i ? i : i + \"\";\n}\nfunction _unsupportedIterableToArray(r, a) {\n if (r) {\n if (\"string\" == typeof r) return _arrayLikeToArray(r, a);\n var t = {}.toString.call(r).slice(8, -1);\n return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;\n }\n}\n\nvar storedAnnotationsSymbol = /*#__PURE__*/Symbol(\"mobx-stored-annotations\");\n/**\n * Creates a function that acts as\n * - decorator\n * - annotation object\n */\nfunction createDecoratorAnnotation(annotation) {\n function decorator(target, property) {\n if (is20223Decorator(property)) {\n return annotation.decorate_20223_(target, property);\n } else {\n storeAnnotation(target, property, annotation);\n }\n }\n return Object.assign(decorator, annotation);\n}\n/**\n * Stores annotation to prototype,\n * so it can be inspected later by `makeObservable` called from constructor\n */\nfunction storeAnnotation(prototype, key, annotation) {\n if (!hasProp(prototype, storedAnnotationsSymbol)) {\n addHiddenProp(prototype, storedAnnotationsSymbol, _extends({}, prototype[storedAnnotationsSymbol]));\n }\n // @override must override something\n if ( true && isOverride(annotation) && !hasProp(prototype[storedAnnotationsSymbol], key)) {\n var fieldName = prototype.constructor.name + \".prototype.\" + key.toString();\n die(\"'\" + fieldName + \"' is decorated with 'override', \" + \"but no such decorated member was found on prototype.\");\n }\n // Cannot re-decorate\n assertNotDecorated(prototype, annotation, key);\n // Ignore override\n if (!isOverride(annotation)) {\n prototype[storedAnnotationsSymbol][key] = annotation;\n }\n}\nfunction assertNotDecorated(prototype, annotation, key) {\n if ( true && !isOverride(annotation) && hasProp(prototype[storedAnnotationsSymbol], key)) {\n var fieldName = prototype.constructor.name + \".prototype.\" + key.toString();\n var currentAnnotationType = prototype[storedAnnotationsSymbol][key].annotationType_;\n var requestedAnnotationType = annotation.annotationType_;\n die(\"Cannot apply '@\" + requestedAnnotationType + \"' to '\" + fieldName + \"':\" + (\"\\nThe field is already decorated with '@\" + currentAnnotationType + \"'.\") + \"\\nRe-decorating fields is not allowed.\" + \"\\nUse '@override' decorator for methods overridden by subclass.\");\n }\n}\n/**\n * Collects annotations from prototypes and stores them on target (instance)\n */\nfunction collectStoredAnnotations(target) {\n if (!hasProp(target, storedAnnotationsSymbol)) {\n // if (__DEV__ && !target[storedAnnotationsSymbol]) {\n // die(\n // `No annotations were passed to makeObservable, but no decorated members have been found either`\n // )\n // }\n // We need a copy as we will remove annotation from the list once it's applied.\n addHiddenProp(target, storedAnnotationsSymbol, _extends({}, target[storedAnnotationsSymbol]));\n }\n return target[storedAnnotationsSymbol];\n}\nfunction is20223Decorator(context) {\n return typeof context == \"object\" && typeof context[\"kind\"] == \"string\";\n}\nfunction assert20223DecoratorType(context, types) {\n if ( true && !types.includes(context.kind)) {\n die(\"The decorator applied to '\" + String(context.name) + \"' cannot be used on a \" + context.kind + \" element\");\n }\n}\n\nvar $mobx = /*#__PURE__*/Symbol(\"mobx administration\");\nvar Atom = /*#__PURE__*/function () {\n /**\n * Create a new atom. For debugging purposes it is recommended to give it a name.\n * The onBecomeObserved and onBecomeUnobserved callbacks can be used for resource management.\n */\n function Atom(name_) {\n if (name_ === void 0) {\n name_ = true ? \"Atom@\" + getNextId() : 0;\n }\n this.name_ = void 0;\n this.flags_ = 0;\n this.observers_ = new Set();\n this.lastAccessedBy_ = 0;\n this.lowestObserverState_ = IDerivationState_.NOT_TRACKING_;\n // onBecomeObservedListeners\n this.onBOL = void 0;\n // onBecomeUnobservedListeners\n this.onBUOL = void 0;\n this.name_ = name_;\n }\n // for effective unobserving. BaseAtom has true, for extra optimization, so its onBecomeUnobserved never gets called, because it's not needed\n var _proto = Atom.prototype;\n _proto.onBO = function onBO() {\n if (this.onBOL) {\n this.onBOL.forEach(function (listener) {\n return listener();\n });\n }\n };\n _proto.onBUO = function onBUO() {\n if (this.onBUOL) {\n this.onBUOL.forEach(function (listener) {\n return listener();\n });\n }\n }\n /**\n * Invoke this method to notify mobx that your atom has been used somehow.\n * Returns true if there is currently a reactive context.\n */;\n _proto.reportObserved = function reportObserved$1() {\n return reportObserved(this);\n }\n /**\n * Invoke this method _after_ this method has changed to signal mobx that all its observers should invalidate.\n */;\n _proto.reportChanged = function reportChanged() {\n startBatch();\n propagateChanged(this);\n endBatch();\n };\n _proto.toString = function toString() {\n return this.name_;\n };\n return _createClass(Atom, [{\n key: \"isBeingObserved\",\n get: function get() {\n return getFlag(this.flags_, Atom.isBeingObservedMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Atom.isBeingObservedMask_, newValue);\n }\n }, {\n key: \"isPendingUnobservation\",\n get: function get() {\n return getFlag(this.flags_, Atom.isPendingUnobservationMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Atom.isPendingUnobservationMask_, newValue);\n }\n }, {\n key: \"diffValue\",\n get: function get() {\n return getFlag(this.flags_, Atom.diffValueMask_) ? 1 : 0;\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Atom.diffValueMask_, newValue === 1 ? true : false);\n }\n }]);\n}();\nAtom.isBeingObservedMask_ = 1;\nAtom.isPendingUnobservationMask_ = 2;\nAtom.diffValueMask_ = 4;\nvar isAtom = /*#__PURE__*/createInstanceofPredicate(\"Atom\", Atom);\nfunction createAtom(name, onBecomeObservedHandler, onBecomeUnobservedHandler) {\n if (onBecomeObservedHandler === void 0) {\n onBecomeObservedHandler = noop;\n }\n if (onBecomeUnobservedHandler === void 0) {\n onBecomeUnobservedHandler = noop;\n }\n var atom = new Atom(name);\n // default `noop` listener will not initialize the hook Set\n if (onBecomeObservedHandler !== noop) {\n onBecomeObserved(atom, onBecomeObservedHandler);\n }\n if (onBecomeUnobservedHandler !== noop) {\n onBecomeUnobserved(atom, onBecomeUnobservedHandler);\n }\n return atom;\n}\n\nfunction identityComparer(a, b) {\n return a === b;\n}\nfunction structuralComparer(a, b) {\n return deepEqual(a, b);\n}\nfunction shallowComparer(a, b) {\n return deepEqual(a, b, 1);\n}\nfunction defaultComparer(a, b) {\n if (Object.is) {\n return Object.is(a, b);\n }\n return a === b ? a !== 0 || 1 / a === 1 / b : a !== a && b !== b;\n}\nvar comparer = {\n identity: identityComparer,\n structural: structuralComparer,\n \"default\": defaultComparer,\n shallow: shallowComparer\n};\n\nfunction deepEnhancer(v, _, name) {\n // it is an observable already, done\n if (isObservable(v)) {\n return v;\n }\n // something that can be converted and mutated?\n if (Array.isArray(v)) {\n return observable.array(v, {\n name: name\n });\n }\n if (isPlainObject(v)) {\n return observable.object(v, undefined, {\n name: name\n });\n }\n if (isES6Map(v)) {\n return observable.map(v, {\n name: name\n });\n }\n if (isES6Set(v)) {\n return observable.set(v, {\n name: name\n });\n }\n if (typeof v === \"function\" && !isAction(v) && !isFlow(v)) {\n if (isGenerator(v)) {\n return flow(v);\n } else {\n return autoAction(name, v);\n }\n }\n return v;\n}\nfunction shallowEnhancer(v, _, name) {\n if (v === undefined || v === null) {\n return v;\n }\n if (isObservableObject(v) || isObservableArray(v) || isObservableMap(v) || isObservableSet(v)) {\n return v;\n }\n if (Array.isArray(v)) {\n return observable.array(v, {\n name: name,\n deep: false\n });\n }\n if (isPlainObject(v)) {\n return observable.object(v, undefined, {\n name: name,\n deep: false\n });\n }\n if (isES6Map(v)) {\n return observable.map(v, {\n name: name,\n deep: false\n });\n }\n if (isES6Set(v)) {\n return observable.set(v, {\n name: name,\n deep: false\n });\n }\n if (true) {\n die(\"The shallow modifier / decorator can only used in combination with arrays, objects, maps and sets\");\n }\n}\nfunction referenceEnhancer(newValue) {\n // never turn into an observable\n return newValue;\n}\nfunction refStructEnhancer(v, oldValue) {\n if ( true && isObservable(v)) {\n die(\"observable.struct should not be used with observable values\");\n }\n if (deepEqual(v, oldValue)) {\n return oldValue;\n }\n return v;\n}\n\nvar OVERRIDE = \"override\";\nvar override = /*#__PURE__*/createDecoratorAnnotation({\n annotationType_: OVERRIDE,\n make_: make_,\n extend_: extend_,\n decorate_20223_: decorate_20223_\n});\nfunction isOverride(annotation) {\n return annotation.annotationType_ === OVERRIDE;\n}\nfunction make_(adm, key) {\n // Must not be plain object\n if ( true && adm.isPlainObject_) {\n die(\"Cannot apply '\" + this.annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + this.annotationType_ + \"' cannot be used on plain objects.\"));\n }\n // Must override something\n if ( true && !hasProp(adm.appliedAnnotations_, key)) {\n die(\"'\" + adm.name_ + \".\" + key.toString() + \"' is annotated with '\" + this.annotationType_ + \"', \" + \"but no such annotated member was found on prototype.\");\n }\n return 0 /* MakeResult.Cancel */;\n}\nfunction extend_(adm, key, descriptor, proxyTrap) {\n die(\"'\" + this.annotationType_ + \"' can only be used with 'makeObservable'\");\n}\nfunction decorate_20223_(desc, context) {\n console.warn(\"'\" + this.annotationType_ + \"' cannot be used with decorators - this is a no-op\");\n}\n\nfunction createActionAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$1,\n extend_: extend_$1,\n decorate_20223_: decorate_20223_$1\n };\n}\nfunction make_$1(adm, key, descriptor, source) {\n var _this$options_;\n // bound\n if ((_this$options_ = this.options_) != null && _this$options_.bound) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;\n }\n // own\n if (source === adm.target_) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 2 /* MakeResult.Continue */;\n }\n // prototype\n if (isAction(descriptor.value)) {\n // A prototype could have been annotated already by other constructor,\n // rest of the proto chain must be annotated already\n return 1 /* MakeResult.Break */;\n }\n var actionDescriptor = createActionDescriptor(adm, this, key, descriptor, false);\n defineProperty(source, key, actionDescriptor);\n return 2 /* MakeResult.Continue */;\n}\nfunction extend_$1(adm, key, descriptor, proxyTrap) {\n var actionDescriptor = createActionDescriptor(adm, this, key, descriptor);\n return adm.defineProperty_(key, actionDescriptor, proxyTrap);\n}\nfunction decorate_20223_$1(mthd, context) {\n if (true) {\n assert20223DecoratorType(context, [\"method\", \"field\"]);\n }\n var kind = context.kind,\n name = context.name,\n addInitializer = context.addInitializer;\n var ann = this;\n var _createAction = function _createAction(m) {\n var _ann$options_$name, _ann$options_, _ann$options_$autoAct, _ann$options_2;\n return createAction((_ann$options_$name = (_ann$options_ = ann.options_) == null ? void 0 : _ann$options_.name) != null ? _ann$options_$name : name.toString(), m, (_ann$options_$autoAct = (_ann$options_2 = ann.options_) == null ? void 0 : _ann$options_2.autoAction) != null ? _ann$options_$autoAct : false);\n };\n // Backwards/Legacy behavior, expects makeObservable(this)\n if (kind == \"field\") {\n addInitializer(function () {\n storeAnnotation(this, name, ann);\n });\n return;\n }\n if (kind == \"method\") {\n var _this$options_2;\n if (!isAction(mthd)) {\n mthd = _createAction(mthd);\n }\n if ((_this$options_2 = this.options_) != null && _this$options_2.bound) {\n addInitializer(function () {\n var self = this;\n var bound = self[name].bind(self);\n bound.isMobxAction = true;\n self[name] = bound;\n });\n }\n return mthd;\n }\n die(\"Cannot apply '\" + ann.annotationType_ + \"' to '\" + String(name) + \"' (kind: \" + kind + \"):\" + (\"\\n'\" + ann.annotationType_ + \"' can only be used on properties with a function value.\"));\n}\nfunction assertActionDescriptor(adm, _ref, key, _ref2) {\n var annotationType_ = _ref.annotationType_;\n var value = _ref2.value;\n if ( true && !isFunction(value)) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' can only be used on properties with a function value.\"));\n }\n}\nfunction createActionDescriptor(adm, annotation, key, descriptor,\n// provides ability to disable safeDescriptors for prototypes\nsafeDescriptors) {\n var _annotation$options_, _annotation$options_$, _annotation$options_2, _annotation$options_$2, _annotation$options_3, _annotation$options_4, _adm$proxy_2;\n if (safeDescriptors === void 0) {\n safeDescriptors = globalState.safeDescriptors;\n }\n assertActionDescriptor(adm, annotation, key, descriptor);\n var value = descriptor.value;\n if ((_annotation$options_ = annotation.options_) != null && _annotation$options_.bound) {\n var _adm$proxy_;\n value = value.bind((_adm$proxy_ = adm.proxy_) != null ? _adm$proxy_ : adm.target_);\n }\n return {\n value: createAction((_annotation$options_$ = (_annotation$options_2 = annotation.options_) == null ? void 0 : _annotation$options_2.name) != null ? _annotation$options_$ : key.toString(), value, (_annotation$options_$2 = (_annotation$options_3 = annotation.options_) == null ? void 0 : _annotation$options_3.autoAction) != null ? _annotation$options_$2 : false,\n // https://github.com/mobxjs/mobx/discussions/3140\n (_annotation$options_4 = annotation.options_) != null && _annotation$options_4.bound ? (_adm$proxy_2 = adm.proxy_) != null ? _adm$proxy_2 : adm.target_ : undefined),\n // Non-configurable for classes\n // prevents accidental field redefinition in subclass\n configurable: safeDescriptors ? adm.isPlainObject_ : true,\n // https://github.com/mobxjs/mobx/pull/2641#issuecomment-737292058\n enumerable: false,\n // Non-obsevable, therefore non-writable\n // Also prevents rewriting in subclass constructor\n writable: safeDescriptors ? false : true\n };\n}\n\nfunction createFlowAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$2,\n extend_: extend_$2,\n decorate_20223_: decorate_20223_$2\n };\n}\nfunction make_$2(adm, key, descriptor, source) {\n var _this$options_;\n // own\n if (source === adm.target_) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 2 /* MakeResult.Continue */;\n }\n // prototype\n // bound - must annotate protos to support super.flow()\n if ((_this$options_ = this.options_) != null && _this$options_.bound && (!hasProp(adm.target_, key) || !isFlow(adm.target_[key]))) {\n if (this.extend_(adm, key, descriptor, false) === null) {\n return 0 /* MakeResult.Cancel */;\n }\n }\n if (isFlow(descriptor.value)) {\n // A prototype could have been annotated already by other constructor,\n // rest of the proto chain must be annotated already\n return 1 /* MakeResult.Break */;\n }\n var flowDescriptor = createFlowDescriptor(adm, this, key, descriptor, false, false);\n defineProperty(source, key, flowDescriptor);\n return 2 /* MakeResult.Continue */;\n}\nfunction extend_$2(adm, key, descriptor, proxyTrap) {\n var _this$options_2;\n var flowDescriptor = createFlowDescriptor(adm, this, key, descriptor, (_this$options_2 = this.options_) == null ? void 0 : _this$options_2.bound);\n return adm.defineProperty_(key, flowDescriptor, proxyTrap);\n}\nfunction decorate_20223_$2(mthd, context) {\n var _this$options_3;\n if (true) {\n assert20223DecoratorType(context, [\"method\"]);\n }\n var name = context.name,\n addInitializer = context.addInitializer;\n if (!isFlow(mthd)) {\n mthd = flow(mthd);\n }\n if ((_this$options_3 = this.options_) != null && _this$options_3.bound) {\n addInitializer(function () {\n var self = this;\n var bound = self[name].bind(self);\n bound.isMobXFlow = true;\n self[name] = bound;\n });\n }\n return mthd;\n}\nfunction assertFlowDescriptor(adm, _ref, key, _ref2) {\n var annotationType_ = _ref.annotationType_;\n var value = _ref2.value;\n if ( true && !isFunction(value)) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' can only be used on properties with a generator function value.\"));\n }\n}\nfunction createFlowDescriptor(adm, annotation, key, descriptor, bound,\n// provides ability to disable safeDescriptors for prototypes\nsafeDescriptors) {\n if (safeDescriptors === void 0) {\n safeDescriptors = globalState.safeDescriptors;\n }\n assertFlowDescriptor(adm, annotation, key, descriptor);\n var value = descriptor.value;\n // In case of flow.bound, the descriptor can be from already annotated prototype\n if (!isFlow(value)) {\n value = flow(value);\n }\n if (bound) {\n var _adm$proxy_;\n // We do not keep original function around, so we bind the existing flow\n value = value.bind((_adm$proxy_ = adm.proxy_) != null ? _adm$proxy_ : adm.target_);\n // This is normally set by `flow`, but `bind` returns new function...\n value.isMobXFlow = true;\n }\n return {\n value: value,\n // Non-configurable for classes\n // prevents accidental field redefinition in subclass\n configurable: safeDescriptors ? adm.isPlainObject_ : true,\n // https://github.com/mobxjs/mobx/pull/2641#issuecomment-737292058\n enumerable: false,\n // Non-obsevable, therefore non-writable\n // Also prevents rewriting in subclass constructor\n writable: safeDescriptors ? false : true\n };\n}\n\nfunction createComputedAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$3,\n extend_: extend_$3,\n decorate_20223_: decorate_20223_$3\n };\n}\nfunction make_$3(adm, key, descriptor) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;\n}\nfunction extend_$3(adm, key, descriptor, proxyTrap) {\n assertComputedDescriptor(adm, this, key, descriptor);\n return adm.defineComputedProperty_(key, _extends({}, this.options_, {\n get: descriptor.get,\n set: descriptor.set\n }), proxyTrap);\n}\nfunction decorate_20223_$3(get, context) {\n if (true) {\n assert20223DecoratorType(context, [\"getter\"]);\n }\n var ann = this;\n var key = context.name,\n addInitializer = context.addInitializer;\n addInitializer(function () {\n var adm = asObservableObject(this)[$mobx];\n var options = _extends({}, ann.options_, {\n get: get,\n context: this\n });\n options.name || (options.name = true ? adm.name_ + \".\" + key.toString() : 0);\n adm.values_.set(key, new ComputedValue(options));\n });\n return function () {\n return this[$mobx].getObservablePropValue_(key);\n };\n}\nfunction assertComputedDescriptor(adm, _ref, key, _ref2) {\n var annotationType_ = _ref.annotationType_;\n var get = _ref2.get;\n if ( true && !get) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' can only be used on getter(+setter) properties.\"));\n }\n}\n\nfunction createObservableAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$4,\n extend_: extend_$4,\n decorate_20223_: decorate_20223_$4\n };\n}\nfunction make_$4(adm, key, descriptor) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;\n}\nfunction extend_$4(adm, key, descriptor, proxyTrap) {\n var _this$options_$enhanc, _this$options_;\n assertObservableDescriptor(adm, this, key, descriptor);\n return adm.defineObservableProperty_(key, descriptor.value, (_this$options_$enhanc = (_this$options_ = this.options_) == null ? void 0 : _this$options_.enhancer) != null ? _this$options_$enhanc : deepEnhancer, proxyTrap);\n}\nfunction decorate_20223_$4(desc, context) {\n if (true) {\n if (context.kind === \"field\") {\n throw die(\"Please use `@observable accessor \" + String(context.name) + \"` instead of `@observable \" + String(context.name) + \"`\");\n }\n assert20223DecoratorType(context, [\"accessor\"]);\n }\n var ann = this;\n var kind = context.kind,\n name = context.name;\n // The laziness here is not ideal... It's a workaround to how 2022.3 Decorators are implemented:\n // `addInitializer` callbacks are executed _before_ any accessors are defined (instead of the ideal-for-us right after each).\n // This means that, if we were to do our stuff in an `addInitializer`, we'd attempt to read a private slot\n // before it has been initialized. The runtime doesn't like that and throws a `Cannot read private member\n // from an object whose class did not declare it` error.\n // TODO: it seems that this will not be required anymore in the final version of the spec\n // See TODO: link\n var initializedObjects = new WeakSet();\n function initializeObservable(target, value) {\n var _ann$options_$enhance, _ann$options_;\n var adm = asObservableObject(target)[$mobx];\n var observable = new ObservableValue(value, (_ann$options_$enhance = (_ann$options_ = ann.options_) == null ? void 0 : _ann$options_.enhancer) != null ? _ann$options_$enhance : deepEnhancer, true ? adm.name_ + \".\" + name.toString() : 0, false);\n adm.values_.set(name, observable);\n initializedObjects.add(target);\n }\n if (kind == \"accessor\") {\n return {\n get: function get() {\n if (!initializedObjects.has(this)) {\n initializeObservable(this, desc.get.call(this));\n }\n return this[$mobx].getObservablePropValue_(name);\n },\n set: function set(value) {\n if (!initializedObjects.has(this)) {\n initializeObservable(this, value);\n }\n return this[$mobx].setObservablePropValue_(name, value);\n },\n init: function init(value) {\n if (!initializedObjects.has(this)) {\n initializeObservable(this, value);\n }\n return value;\n }\n };\n }\n return;\n}\nfunction assertObservableDescriptor(adm, _ref, key, descriptor) {\n var annotationType_ = _ref.annotationType_;\n if ( true && !(\"value\" in descriptor)) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' cannot be used on getter/setter properties\"));\n }\n}\n\nvar AUTO = \"true\";\nvar autoAnnotation = /*#__PURE__*/createAutoAnnotation();\nfunction createAutoAnnotation(options) {\n return {\n annotationType_: AUTO,\n options_: options,\n make_: make_$5,\n extend_: extend_$5,\n decorate_20223_: decorate_20223_$5\n };\n}\nfunction make_$5(adm, key, descriptor, source) {\n var _this$options_3, _this$options_4;\n // getter -> computed\n if (descriptor.get) {\n return computed.make_(adm, key, descriptor, source);\n }\n // lone setter -> action setter\n if (descriptor.set) {\n // TODO make action applicable to setter and delegate to action.make_\n var set = createAction(key.toString(), descriptor.set);\n // own\n if (source === adm.target_) {\n return adm.defineProperty_(key, {\n configurable: globalState.safeDescriptors ? adm.isPlainObject_ : true,\n set: set\n }) === null ? 0 /* MakeResult.Cancel */ : 2 /* MakeResult.Continue */;\n }\n // proto\n defineProperty(source, key, {\n configurable: true,\n set: set\n });\n return 2 /* MakeResult.Continue */;\n }\n // function on proto -> autoAction/flow\n if (source !== adm.target_ && typeof descriptor.value === \"function\") {\n var _this$options_2;\n if (isGenerator(descriptor.value)) {\n var _this$options_;\n var flowAnnotation = (_this$options_ = this.options_) != null && _this$options_.autoBind ? flow.bound : flow;\n return flowAnnotation.make_(adm, key, descriptor, source);\n }\n var actionAnnotation = (_this$options_2 = this.options_) != null && _this$options_2.autoBind ? autoAction.bound : autoAction;\n return actionAnnotation.make_(adm, key, descriptor, source);\n }\n // other -> observable\n // Copy props from proto as well, see test:\n // \"decorate should work with Object.create\"\n var observableAnnotation = ((_this$options_3 = this.options_) == null ? void 0 : _this$options_3.deep) === false ? observable.ref : observable;\n // if function respect autoBind option\n if (typeof descriptor.value === \"function\" && (_this$options_4 = this.options_) != null && _this$options_4.autoBind) {\n var _adm$proxy_;\n descriptor.value = descriptor.value.bind((_adm$proxy_ = adm.proxy_) != null ? _adm$proxy_ : adm.target_);\n }\n return observableAnnotation.make_(adm, key, descriptor, source);\n}\nfunction extend_$5(adm, key, descriptor, proxyTrap) {\n var _this$options_5, _this$options_6;\n // getter -> computed\n if (descriptor.get) {\n return computed.extend_(adm, key, descriptor, proxyTrap);\n }\n // lone setter -> action setter\n if (descriptor.set) {\n // TODO make action applicable to setter and delegate to action.extend_\n return adm.defineProperty_(key, {\n configurable: globalState.safeDescriptors ? adm.isPlainObject_ : true,\n set: createAction(key.toString(), descriptor.set)\n }, proxyTrap);\n }\n // other -> observable\n // if function respect autoBind option\n if (typeof descriptor.value === \"function\" && (_this$options_5 = this.options_) != null && _this$options_5.autoBind) {\n var _adm$proxy_2;\n descriptor.value = descriptor.value.bind((_adm$proxy_2 = adm.proxy_) != null ? _adm$proxy_2 : adm.target_);\n }\n var observableAnnotation = ((_this$options_6 = this.options_) == null ? void 0 : _this$options_6.deep) === false ? observable.ref : observable;\n return observableAnnotation.extend_(adm, key, descriptor, proxyTrap);\n}\nfunction decorate_20223_$5(desc, context) {\n die(\"'\" + this.annotationType_ + \"' cannot be used as a decorator\");\n}\n\nvar OBSERVABLE = \"observable\";\nvar OBSERVABLE_REF = \"observable.ref\";\nvar OBSERVABLE_SHALLOW = \"observable.shallow\";\nvar OBSERVABLE_STRUCT = \"observable.struct\";\n// Predefined bags of create observable options, to avoid allocating temporarily option objects\n// in the majority of cases\nvar defaultCreateObservableOptions = {\n deep: true,\n name: undefined,\n defaultDecorator: undefined,\n proxy: true\n};\nObject.freeze(defaultCreateObservableOptions);\nfunction asCreateObservableOptions(thing) {\n return thing || defaultCreateObservableOptions;\n}\nvar observableAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE);\nvar observableRefAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE_REF, {\n enhancer: referenceEnhancer\n});\nvar observableShallowAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE_SHALLOW, {\n enhancer: shallowEnhancer\n});\nvar observableStructAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE_STRUCT, {\n enhancer: refStructEnhancer\n});\nvar observableDecoratorAnnotation = /*#__PURE__*/createDecoratorAnnotation(observableAnnotation);\nfunction getEnhancerFromOptions(options) {\n return options.deep === true ? deepEnhancer : options.deep === false ? referenceEnhancer : getEnhancerFromAnnotation(options.defaultDecorator);\n}\nfunction getAnnotationFromOptions(options) {\n var _options$defaultDecor;\n return options ? (_options$defaultDecor = options.defaultDecorator) != null ? _options$defaultDecor : createAutoAnnotation(options) : undefined;\n}\nfunction getEnhancerFromAnnotation(annotation) {\n var _annotation$options_$, _annotation$options_;\n return !annotation ? deepEnhancer : (_annotation$options_$ = (_annotation$options_ = annotation.options_) == null ? void 0 : _annotation$options_.enhancer) != null ? _annotation$options_$ : deepEnhancer;\n}\n/**\n * Turns an object, array or function into a reactive structure.\n * @param v the value which should become observable.\n */\nfunction createObservable(v, arg2, arg3) {\n // @observable someProp; (2022.3 Decorators)\n if (is20223Decorator(arg2)) {\n return observableAnnotation.decorate_20223_(v, arg2);\n }\n // @observable someProp;\n if (isStringish(arg2)) {\n storeAnnotation(v, arg2, observableAnnotation);\n return;\n }\n // already observable - ignore\n if (isObservable(v)) {\n return v;\n }\n // plain object\n if (isPlainObject(v)) {\n return observable.object(v, arg2, arg3);\n }\n // Array\n if (Array.isArray(v)) {\n return observable.array(v, arg2);\n }\n // Map\n if (isES6Map(v)) {\n return observable.map(v, arg2);\n }\n // Set\n if (isES6Set(v)) {\n return observable.set(v, arg2);\n }\n // other object - ignore\n if (typeof v === \"object\" && v !== null) {\n return v;\n }\n // anything else\n return observable.box(v, arg2);\n}\nassign(createObservable, observableDecoratorAnnotation);\nvar observableFactories = {\n box: function box(value, options) {\n var o = asCreateObservableOptions(options);\n return new ObservableValue(value, getEnhancerFromOptions(o), o.name, true, o.equals);\n },\n array: function array(initialValues, options) {\n var o = asCreateObservableOptions(options);\n return (globalState.useProxies === false || o.proxy === false ? createLegacyArray : createObservableArray)(initialValues, getEnhancerFromOptions(o), o.name);\n },\n map: function map(initialValues, options) {\n var o = asCreateObservableOptions(options);\n return new ObservableMap(initialValues, getEnhancerFromOptions(o), o.name);\n },\n set: function set(initialValues, options) {\n var o = asCreateObservableOptions(options);\n return new ObservableSet(initialValues, getEnhancerFromOptions(o), o.name);\n },\n object: function object(props, decorators, options) {\n return initObservable(function () {\n return extendObservable(globalState.useProxies === false || (options == null ? void 0 : options.proxy) === false ? asObservableObject({}, options) : asDynamicObservableObject({}, options), props, decorators);\n });\n },\n ref: /*#__PURE__*/createDecoratorAnnotation(observableRefAnnotation),\n shallow: /*#__PURE__*/createDecoratorAnnotation(observableShallowAnnotation),\n deep: observableDecoratorAnnotation,\n struct: /*#__PURE__*/createDecoratorAnnotation(observableStructAnnotation)\n};\n// eslint-disable-next-line\nvar observable = /*#__PURE__*/assign(createObservable, observableFactories);\n\nvar COMPUTED = \"computed\";\nvar COMPUTED_STRUCT = \"computed.struct\";\nvar computedAnnotation = /*#__PURE__*/createComputedAnnotation(COMPUTED);\nvar computedStructAnnotation = /*#__PURE__*/createComputedAnnotation(COMPUTED_STRUCT, {\n equals: comparer.structural\n});\n/**\n * Decorator for class properties: @computed get value() { return expr; }.\n * For legacy purposes also invokable as ES5 observable created: `computed(() => expr)`;\n */\nvar computed = function computed(arg1, arg2) {\n if (is20223Decorator(arg2)) {\n // @computed (2022.3 Decorators)\n return computedAnnotation.decorate_20223_(arg1, arg2);\n }\n if (isStringish(arg2)) {\n // @computed\n return storeAnnotation(arg1, arg2, computedAnnotation);\n }\n if (isPlainObject(arg1)) {\n // @computed({ options })\n return createDecoratorAnnotation(createComputedAnnotation(COMPUTED, arg1));\n }\n // computed(expr, options?)\n if (true) {\n if (!isFunction(arg1)) {\n die(\"First argument to `computed` should be an expression.\");\n }\n if (isFunction(arg2)) {\n die(\"A setter as second argument is no longer supported, use `{ set: fn }` option instead\");\n }\n }\n var opts = isPlainObject(arg2) ? arg2 : {};\n opts.get = arg1;\n opts.name || (opts.name = arg1.name || \"\"); /* for generated name */\n return new ComputedValue(opts);\n};\nObject.assign(computed, computedAnnotation);\ncomputed.struct = /*#__PURE__*/createDecoratorAnnotation(computedStructAnnotation);\n\nvar _getDescriptor$config, _getDescriptor;\n// we don't use globalState for these in order to avoid possible issues with multiple\n// mobx versions\nvar currentActionId = 0;\nvar nextActionId = 1;\nvar isFunctionNameConfigurable = (_getDescriptor$config = (_getDescriptor = /*#__PURE__*/getDescriptor(function () {}, \"name\")) == null ? void 0 : _getDescriptor.configurable) != null ? _getDescriptor$config : false;\n// we can safely recycle this object\nvar tmpNameDescriptor = {\n value: \"action\",\n configurable: true,\n writable: false,\n enumerable: false\n};\nfunction createAction(actionName, fn, autoAction, ref) {\n if (autoAction === void 0) {\n autoAction = false;\n }\n if (true) {\n if (!isFunction(fn)) {\n die(\"`action` can only be invoked on functions\");\n }\n if (typeof actionName !== \"string\" || !actionName) {\n die(\"actions should have valid names, got: '\" + actionName + \"'\");\n }\n }\n function res() {\n return executeAction(actionName, autoAction, fn, ref || this, arguments);\n }\n res.isMobxAction = true;\n res.toString = function () {\n return fn.toString();\n };\n if (isFunctionNameConfigurable) {\n tmpNameDescriptor.value = actionName;\n defineProperty(res, \"name\", tmpNameDescriptor);\n }\n return res;\n}\nfunction executeAction(actionName, canRunAsDerivation, fn, scope, args) {\n var runInfo = _startAction(actionName, canRunAsDerivation, scope, args);\n try {\n return fn.apply(scope, args);\n } catch (err) {\n runInfo.error_ = err;\n throw err;\n } finally {\n _endAction(runInfo);\n }\n}\nfunction _startAction(actionName, canRunAsDerivation,\n// true for autoAction\nscope, args) {\n var notifySpy_ = true && isSpyEnabled() && !!actionName;\n var startTime_ = 0;\n if ( true && notifySpy_) {\n startTime_ = Date.now();\n var flattenedArgs = args ? Array.from(args) : EMPTY_ARRAY;\n spyReportStart({\n type: ACTION,\n name: actionName,\n object: scope,\n arguments: flattenedArgs\n });\n }\n var prevDerivation_ = globalState.trackingDerivation;\n var runAsAction = !canRunAsDerivation || !prevDerivation_;\n startBatch();\n var prevAllowStateChanges_ = globalState.allowStateChanges; // by default preserve previous allow\n if (runAsAction) {\n untrackedStart();\n prevAllowStateChanges_ = allowStateChangesStart(true);\n }\n var prevAllowStateReads_ = allowStateReadsStart(true);\n var runInfo = {\n runAsAction_: runAsAction,\n prevDerivation_: prevDerivation_,\n prevAllowStateChanges_: prevAllowStateChanges_,\n prevAllowStateReads_: prevAllowStateReads_,\n notifySpy_: notifySpy_,\n startTime_: startTime_,\n actionId_: nextActionId++,\n parentActionId_: currentActionId\n };\n currentActionId = runInfo.actionId_;\n return runInfo;\n}\nfunction _endAction(runInfo) {\n if (currentActionId !== runInfo.actionId_) {\n die(30);\n }\n currentActionId = runInfo.parentActionId_;\n if (runInfo.error_ !== undefined) {\n globalState.suppressReactionErrors = true;\n }\n allowStateChangesEnd(runInfo.prevAllowStateChanges_);\n allowStateReadsEnd(runInfo.prevAllowStateReads_);\n endBatch();\n if (runInfo.runAsAction_) {\n untrackedEnd(runInfo.prevDerivation_);\n }\n if ( true && runInfo.notifySpy_) {\n spyReportEnd({\n time: Date.now() - runInfo.startTime_\n });\n }\n globalState.suppressReactionErrors = false;\n}\nfunction allowStateChanges(allowStateChanges, func) {\n var prev = allowStateChangesStart(allowStateChanges);\n try {\n return func();\n } finally {\n allowStateChangesEnd(prev);\n }\n}\nfunction allowStateChangesStart(allowStateChanges) {\n var prev = globalState.allowStateChanges;\n globalState.allowStateChanges = allowStateChanges;\n return prev;\n}\nfunction allowStateChangesEnd(prev) {\n globalState.allowStateChanges = prev;\n}\n\nvar CREATE = \"create\";\nvar ObservableValue = /*#__PURE__*/function (_Atom) {\n function ObservableValue(value, enhancer, name_, notifySpy, equals) {\n var _this;\n if (name_ === void 0) {\n name_ = true ? \"ObservableValue@\" + getNextId() : 0;\n }\n if (notifySpy === void 0) {\n notifySpy = true;\n }\n if (equals === void 0) {\n equals = comparer[\"default\"];\n }\n _this = _Atom.call(this, name_) || this;\n _this.enhancer = void 0;\n _this.name_ = void 0;\n _this.equals = void 0;\n _this.hasUnreportedChange_ = false;\n _this.interceptors_ = void 0;\n _this.changeListeners_ = void 0;\n _this.value_ = void 0;\n _this.dehancer = void 0;\n _this.enhancer = enhancer;\n _this.name_ = name_;\n _this.equals = equals;\n _this.value_ = enhancer(value, undefined, name_);\n if ( true && notifySpy && isSpyEnabled()) {\n // only notify spy if this is a stand-alone observable\n spyReport({\n type: CREATE,\n object: _this,\n observableKind: \"value\",\n debugObjectName: _this.name_,\n newValue: \"\" + _this.value_\n });\n }\n return _this;\n }\n _inheritsLoose(ObservableValue, _Atom);\n var _proto = ObservableValue.prototype;\n _proto.dehanceValue = function dehanceValue(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.set = function set(newValue) {\n var oldValue = this.value_;\n newValue = this.prepareNewValue_(newValue);\n if (newValue !== globalState.UNCHANGED) {\n var notifySpy = isSpyEnabled();\n if ( true && notifySpy) {\n spyReportStart({\n type: UPDATE,\n object: this,\n observableKind: \"value\",\n debugObjectName: this.name_,\n newValue: newValue,\n oldValue: oldValue\n });\n }\n this.setNewValue_(newValue);\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n };\n _proto.prepareNewValue_ = function prepareNewValue_(newValue) {\n checkIfStateModificationsAreAllowed(this);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this,\n type: UPDATE,\n newValue: newValue\n });\n if (!change) {\n return globalState.UNCHANGED;\n }\n newValue = change.newValue;\n }\n // apply modifier\n newValue = this.enhancer(newValue, this.value_, this.name_);\n return this.equals(this.value_, newValue) ? globalState.UNCHANGED : newValue;\n };\n _proto.setNewValue_ = function setNewValue_(newValue) {\n var oldValue = this.value_;\n this.value_ = newValue;\n this.reportChanged();\n if (hasListeners(this)) {\n notifyListeners(this, {\n type: UPDATE,\n object: this,\n newValue: newValue,\n oldValue: oldValue\n });\n }\n };\n _proto.get = function get() {\n this.reportObserved();\n return this.dehanceValue(this.value_);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n if (fireImmediately) {\n listener({\n observableKind: \"value\",\n debugObjectName: this.name_,\n object: this,\n type: UPDATE,\n newValue: this.value_,\n oldValue: undefined\n });\n }\n return registerListener(this, listener);\n };\n _proto.raw = function raw() {\n // used by MST ot get undehanced value\n return this.value_;\n };\n _proto.toJSON = function toJSON() {\n return this.get();\n };\n _proto.toString = function toString() {\n return this.name_ + \"[\" + this.value_ + \"]\";\n };\n _proto.valueOf = function valueOf() {\n return toPrimitive(this.get());\n };\n _proto[Symbol.toPrimitive] = function () {\n return this.valueOf();\n };\n return ObservableValue;\n}(Atom);\nvar isObservableValue = /*#__PURE__*/createInstanceofPredicate(\"ObservableValue\", ObservableValue);\n\n/**\n * A node in the state dependency root that observes other nodes, and can be observed itself.\n *\n * ComputedValue will remember the result of the computation for the duration of the batch, or\n * while being observed.\n *\n * During this time it will recompute only when one of its direct dependencies changed,\n * but only when it is being accessed with `ComputedValue.get()`.\n *\n * Implementation description:\n * 1. First time it's being accessed it will compute and remember result\n * give back remembered result until 2. happens\n * 2. First time any deep dependency change, propagate POSSIBLY_STALE to all observers, wait for 3.\n * 3. When it's being accessed, recompute if any shallow dependency changed.\n * if result changed: propagate STALE to all observers, that were POSSIBLY_STALE from the last step.\n * go to step 2. either way\n *\n * If at any point it's outside batch and it isn't observed: reset everything and go to 1.\n */\nvar ComputedValue = /*#__PURE__*/function () {\n /**\n * Create a new computed value based on a function expression.\n *\n * The `name` property is for debug purposes only.\n *\n * The `equals` property specifies the comparer function to use to determine if a newly produced\n * value differs from the previous value. Two comparers are provided in the library; `defaultComparer`\n * compares based on identity comparison (===), and `structuralComparer` deeply compares the structure.\n * Structural comparison can be convenient if you always produce a new aggregated object and\n * don't want to notify observers if it is structurally the same.\n * This is useful for working with vectors, mouse coordinates etc.\n */\n function ComputedValue(options) {\n this.dependenciesState_ = IDerivationState_.NOT_TRACKING_;\n this.observing_ = [];\n // nodes we are looking at. Our value depends on these nodes\n this.newObserving_ = null;\n // during tracking it's an array with new observed observers\n this.observers_ = new Set();\n this.runId_ = 0;\n this.lastAccessedBy_ = 0;\n this.lowestObserverState_ = IDerivationState_.UP_TO_DATE_;\n this.unboundDepsCount_ = 0;\n this.value_ = new CaughtException(null);\n this.name_ = void 0;\n this.triggeredBy_ = void 0;\n this.flags_ = 0;\n this.derivation = void 0;\n // N.B: unminified as it is used by MST\n this.setter_ = void 0;\n this.isTracing_ = TraceMode.NONE;\n this.scope_ = void 0;\n this.equals_ = void 0;\n this.requiresReaction_ = void 0;\n this.keepAlive_ = void 0;\n this.onBOL = void 0;\n this.onBUOL = void 0;\n if (!options.get) {\n die(31);\n }\n this.derivation = options.get;\n this.name_ = options.name || ( true ? \"ComputedValue@\" + getNextId() : 0);\n if (options.set) {\n this.setter_ = createAction( true ? this.name_ + \"-setter\" : 0, options.set);\n }\n this.equals_ = options.equals || (options.compareStructural || options.struct ? comparer.structural : comparer[\"default\"]);\n this.scope_ = options.context;\n this.requiresReaction_ = options.requiresReaction;\n this.keepAlive_ = !!options.keepAlive;\n }\n var _proto = ComputedValue.prototype;\n _proto.onBecomeStale_ = function onBecomeStale_() {\n propagateMaybeChanged(this);\n };\n _proto.onBO = function onBO() {\n if (this.onBOL) {\n this.onBOL.forEach(function (listener) {\n return listener();\n });\n }\n };\n _proto.onBUO = function onBUO() {\n if (this.onBUOL) {\n this.onBUOL.forEach(function (listener) {\n return listener();\n });\n }\n }\n // to check for cycles\n ;\n /**\n * Returns the current value of this computed value.\n * Will evaluate its computation first if needed.\n */\n _proto.get = function get() {\n if (this.isComputing) {\n die(32, this.name_, this.derivation);\n }\n if (globalState.inBatch === 0 &&\n // !globalState.trackingDerivatpion &&\n this.observers_.size === 0 && !this.keepAlive_) {\n if (shouldCompute(this)) {\n this.warnAboutUntrackedRead_();\n startBatch(); // See perf test 'computed memoization'\n this.value_ = this.computeValue_(false);\n endBatch();\n }\n } else {\n reportObserved(this);\n if (shouldCompute(this)) {\n var prevTrackingContext = globalState.trackingContext;\n if (this.keepAlive_ && !prevTrackingContext) {\n globalState.trackingContext = this;\n }\n if (this.trackAndCompute()) {\n propagateChangeConfirmed(this);\n }\n globalState.trackingContext = prevTrackingContext;\n }\n }\n var result = this.value_;\n if (isCaughtException(result)) {\n throw result.cause;\n }\n return result;\n };\n _proto.set = function set(value) {\n if (this.setter_) {\n if (this.isRunningSetter) {\n die(33, this.name_);\n }\n this.isRunningSetter = true;\n try {\n this.setter_.call(this.scope_, value);\n } finally {\n this.isRunningSetter = false;\n }\n } else {\n die(34, this.name_);\n }\n };\n _proto.trackAndCompute = function trackAndCompute() {\n // N.B: unminified as it is used by MST\n var oldValue = this.value_;\n var wasSuspended = /* see #1208 */this.dependenciesState_ === IDerivationState_.NOT_TRACKING_;\n var newValue = this.computeValue_(true);\n var changed = wasSuspended || isCaughtException(oldValue) || isCaughtException(newValue) || !this.equals_(oldValue, newValue);\n if (changed) {\n this.value_ = newValue;\n if ( true && isSpyEnabled()) {\n spyReport({\n observableKind: \"computed\",\n debugObjectName: this.name_,\n object: this.scope_,\n type: \"update\",\n oldValue: oldValue,\n newValue: newValue\n });\n }\n }\n return changed;\n };\n _proto.computeValue_ = function computeValue_(track) {\n this.isComputing = true;\n // don't allow state changes during computation\n var prev = allowStateChangesStart(false);\n var res;\n if (track) {\n res = trackDerivedFunction(this, this.derivation, this.scope_);\n } else {\n if (globalState.disableErrorBoundaries === true) {\n res = this.derivation.call(this.scope_);\n } else {\n try {\n res = this.derivation.call(this.scope_);\n } catch (e) {\n res = new CaughtException(e);\n }\n }\n }\n allowStateChangesEnd(prev);\n this.isComputing = false;\n return res;\n };\n _proto.suspend_ = function suspend_() {\n if (!this.keepAlive_) {\n clearObserving(this);\n this.value_ = undefined; // don't hold on to computed value!\n if ( true && this.isTracing_ !== TraceMode.NONE) {\n console.log(\"[mobx.trace] Computed value '\" + this.name_ + \"' was suspended and it will recompute on the next access.\");\n }\n }\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n var _this = this;\n var firstTime = true;\n var prevValue = undefined;\n return autorun(function () {\n // TODO: why is this in a different place than the spyReport() function? in all other observables it's called in the same place\n var newValue = _this.get();\n if (!firstTime || fireImmediately) {\n var prevU = untrackedStart();\n listener({\n observableKind: \"computed\",\n debugObjectName: _this.name_,\n type: UPDATE,\n object: _this,\n newValue: newValue,\n oldValue: prevValue\n });\n untrackedEnd(prevU);\n }\n firstTime = false;\n prevValue = newValue;\n });\n };\n _proto.warnAboutUntrackedRead_ = function warnAboutUntrackedRead_() {\n if (false) {}\n if (this.isTracing_ !== TraceMode.NONE) {\n console.log(\"[mobx.trace] Computed value '\" + this.name_ + \"' is being read outside a reactive context. Doing a full recompute.\");\n }\n if (typeof this.requiresReaction_ === \"boolean\" ? this.requiresReaction_ : globalState.computedRequiresReaction) {\n console.warn(\"[mobx] Computed value '\" + this.name_ + \"' is being read outside a reactive context. Doing a full recompute.\");\n }\n };\n _proto.toString = function toString() {\n return this.name_ + \"[\" + this.derivation.toString() + \"]\";\n };\n _proto.valueOf = function valueOf() {\n return toPrimitive(this.get());\n };\n _proto[Symbol.toPrimitive] = function () {\n return this.valueOf();\n };\n return _createClass(ComputedValue, [{\n key: \"isComputing\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isComputingMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isComputingMask_, newValue);\n }\n }, {\n key: \"isRunningSetter\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isRunningSetterMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isRunningSetterMask_, newValue);\n }\n }, {\n key: \"isBeingObserved\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isBeingObservedMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isBeingObservedMask_, newValue);\n }\n }, {\n key: \"isPendingUnobservation\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isPendingUnobservationMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isPendingUnobservationMask_, newValue);\n }\n }, {\n key: \"diffValue\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.diffValueMask_) ? 1 : 0;\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.diffValueMask_, newValue === 1 ? true : false);\n }\n }]);\n}();\nComputedValue.isComputingMask_ = 1;\nComputedValue.isRunningSetterMask_ = 2;\nComputedValue.isBeingObservedMask_ = 4;\nComputedValue.isPendingUnobservationMask_ = 8;\nComputedValue.diffValueMask_ = 16;\nvar isComputedValue = /*#__PURE__*/createInstanceofPredicate(\"ComputedValue\", ComputedValue);\n\nvar IDerivationState_;\n(function (IDerivationState_) {\n // before being run or (outside batch and not being observed)\n // at this point derivation is not holding any data about dependency tree\n IDerivationState_[IDerivationState_[\"NOT_TRACKING_\"] = -1] = \"NOT_TRACKING_\";\n // no shallow dependency changed since last computation\n // won't recalculate derivation\n // this is what makes mobx fast\n IDerivationState_[IDerivationState_[\"UP_TO_DATE_\"] = 0] = \"UP_TO_DATE_\";\n // some deep dependency changed, but don't know if shallow dependency changed\n // will require to check first if UP_TO_DATE or POSSIBLY_STALE\n // currently only ComputedValue will propagate POSSIBLY_STALE\n //\n // having this state is second big optimization:\n // don't have to recompute on every dependency change, but only when it's needed\n IDerivationState_[IDerivationState_[\"POSSIBLY_STALE_\"] = 1] = \"POSSIBLY_STALE_\";\n // A shallow dependency has changed since last computation and the derivation\n // will need to recompute when it's needed next.\n IDerivationState_[IDerivationState_[\"STALE_\"] = 2] = \"STALE_\";\n})(IDerivationState_ || (IDerivationState_ = {}));\nvar TraceMode;\n(function (TraceMode) {\n TraceMode[TraceMode[\"NONE\"] = 0] = \"NONE\";\n TraceMode[TraceMode[\"LOG\"] = 1] = \"LOG\";\n TraceMode[TraceMode[\"BREAK\"] = 2] = \"BREAK\";\n})(TraceMode || (TraceMode = {}));\nvar CaughtException = function CaughtException(cause) {\n this.cause = void 0;\n this.cause = cause;\n // Empty\n};\nfunction isCaughtException(e) {\n return e instanceof CaughtException;\n}\n/**\n * Finds out whether any dependency of the derivation has actually changed.\n * If dependenciesState is 1 then it will recalculate dependencies,\n * if any dependency changed it will propagate it by changing dependenciesState to 2.\n *\n * By iterating over the dependencies in the same order that they were reported and\n * stopping on the first change, all the recalculations are only called for ComputedValues\n * that will be tracked by derivation. That is because we assume that if the first x\n * dependencies of the derivation doesn't change then the derivation should run the same way\n * up until accessing x-th dependency.\n */\nfunction shouldCompute(derivation) {\n switch (derivation.dependenciesState_) {\n case IDerivationState_.UP_TO_DATE_:\n return false;\n case IDerivationState_.NOT_TRACKING_:\n case IDerivationState_.STALE_:\n return true;\n case IDerivationState_.POSSIBLY_STALE_:\n {\n // state propagation can occur outside of action/reactive context #2195\n var prevAllowStateReads = allowStateReadsStart(true);\n var prevUntracked = untrackedStart(); // no need for those computeds to be reported, they will be picked up in trackDerivedFunction.\n var obs = derivation.observing_,\n l = obs.length;\n for (var i = 0; i < l; i++) {\n var obj = obs[i];\n if (isComputedValue(obj)) {\n if (globalState.disableErrorBoundaries) {\n obj.get();\n } else {\n try {\n obj.get();\n } catch (e) {\n // we are not interested in the value *or* exception at this moment, but if there is one, notify all\n untrackedEnd(prevUntracked);\n allowStateReadsEnd(prevAllowStateReads);\n return true;\n }\n }\n // if ComputedValue `obj` actually changed it will be computed and propagated to its observers.\n // and `derivation` is an observer of `obj`\n // invariantShouldCompute(derivation)\n if (derivation.dependenciesState_ === IDerivationState_.STALE_) {\n untrackedEnd(prevUntracked);\n allowStateReadsEnd(prevAllowStateReads);\n return true;\n }\n }\n }\n changeDependenciesStateTo0(derivation);\n untrackedEnd(prevUntracked);\n allowStateReadsEnd(prevAllowStateReads);\n return false;\n }\n }\n}\nfunction isComputingDerivation() {\n return globalState.trackingDerivation !== null; // filter out actions inside computations\n}\nfunction checkIfStateModificationsAreAllowed(atom) {\n if (false) {}\n var hasObservers = atom.observers_.size > 0;\n // Should not be possible to change observed state outside strict mode, except during initialization, see #563\n if (!globalState.allowStateChanges && (hasObservers || globalState.enforceActions === \"always\")) {\n console.warn(\"[MobX] \" + (globalState.enforceActions ? \"Since strict-mode is enabled, changing (observed) observable values without using an action is not allowed. Tried to modify: \" : \"Side effects like changing state are not allowed at this point. Are you trying to modify state from, for example, a computed value or the render function of a React component? You can wrap side effects in 'runInAction' (or decorate functions with 'action') if needed. Tried to modify: \") + atom.name_);\n }\n}\nfunction checkIfStateReadsAreAllowed(observable) {\n if ( true && !globalState.allowStateReads && globalState.observableRequiresReaction) {\n console.warn(\"[mobx] Observable '\" + observable.name_ + \"' being read outside a reactive context.\");\n }\n}\n/**\n * Executes the provided function `f` and tracks which observables are being accessed.\n * The tracking information is stored on the `derivation` object and the derivation is registered\n * as observer of any of the accessed observables.\n */\nfunction trackDerivedFunction(derivation, f, context) {\n var prevAllowStateReads = allowStateReadsStart(true);\n changeDependenciesStateTo0(derivation);\n // Preallocate array; will be trimmed by bindDependencies.\n derivation.newObserving_ = new Array(\n // Reserve constant space for initial dependencies, dynamic space otherwise.\n // See https://github.com/mobxjs/mobx/pull/3833\n derivation.runId_ === 0 ? 100 : derivation.observing_.length);\n derivation.unboundDepsCount_ = 0;\n derivation.runId_ = ++globalState.runId;\n var prevTracking = globalState.trackingDerivation;\n globalState.trackingDerivation = derivation;\n globalState.inBatch++;\n var result;\n if (globalState.disableErrorBoundaries === true) {\n result = f.call(context);\n } else {\n try {\n result = f.call(context);\n } catch (e) {\n result = new CaughtException(e);\n }\n }\n globalState.inBatch--;\n globalState.trackingDerivation = prevTracking;\n bindDependencies(derivation);\n warnAboutDerivationWithoutDependencies(derivation);\n allowStateReadsEnd(prevAllowStateReads);\n return result;\n}\nfunction warnAboutDerivationWithoutDependencies(derivation) {\n if (false) {}\n if (derivation.observing_.length !== 0) {\n return;\n }\n if (typeof derivation.requiresObservable_ === \"boolean\" ? derivation.requiresObservable_ : globalState.reactionRequiresObservable) {\n console.warn(\"[mobx] Derivation '\" + derivation.name_ + \"' is created/updated without reading any observable value.\");\n }\n}\n/**\n * diffs newObserving with observing.\n * update observing to be newObserving with unique observables\n * notify observers that become observed/unobserved\n */\nfunction bindDependencies(derivation) {\n // invariant(derivation.dependenciesState !== IDerivationState.NOT_TRACKING, \"INTERNAL ERROR bindDependencies expects derivation.dependenciesState !== -1\");\n var prevObserving = derivation.observing_;\n var observing = derivation.observing_ = derivation.newObserving_;\n var lowestNewObservingDerivationState = IDerivationState_.UP_TO_DATE_;\n // Go through all new observables and check diffValue: (this list can contain duplicates):\n // 0: first occurrence, change to 1 and keep it\n // 1: extra occurrence, drop it\n var i0 = 0,\n l = derivation.unboundDepsCount_;\n for (var i = 0; i < l; i++) {\n var dep = observing[i];\n if (dep.diffValue === 0) {\n dep.diffValue = 1;\n if (i0 !== i) {\n observing[i0] = dep;\n }\n i0++;\n }\n // Upcast is 'safe' here, because if dep is IObservable, `dependenciesState` will be undefined,\n // not hitting the condition\n if (dep.dependenciesState_ > lowestNewObservingDerivationState) {\n lowestNewObservingDerivationState = dep.dependenciesState_;\n }\n }\n observing.length = i0;\n derivation.newObserving_ = null; // newObserving shouldn't be needed outside tracking (statement moved down to work around FF bug, see #614)\n // Go through all old observables and check diffValue: (it is unique after last bindDependencies)\n // 0: it's not in new observables, unobserve it\n // 1: it keeps being observed, don't want to notify it. change to 0\n l = prevObserving.length;\n while (l--) {\n var _dep = prevObserving[l];\n if (_dep.diffValue === 0) {\n removeObserver(_dep, derivation);\n }\n _dep.diffValue = 0;\n }\n // Go through all new observables and check diffValue: (now it should be unique)\n // 0: it was set to 0 in last loop. don't need to do anything.\n // 1: it wasn't observed, let's observe it. set back to 0\n while (i0--) {\n var _dep2 = observing[i0];\n if (_dep2.diffValue === 1) {\n _dep2.diffValue = 0;\n addObserver(_dep2, derivation);\n }\n }\n // Some new observed derivations may become stale during this derivation computation\n // so they have had no chance to propagate staleness (#916)\n if (lowestNewObservingDerivationState !== IDerivationState_.UP_TO_DATE_) {\n derivation.dependenciesState_ = lowestNewObservingDerivationState;\n derivation.onBecomeStale_();\n }\n}\nfunction clearObserving(derivation) {\n // invariant(globalState.inBatch > 0, \"INTERNAL ERROR clearObserving should be called only inside batch\");\n var obs = derivation.observing_;\n derivation.observing_ = [];\n var i = obs.length;\n while (i--) {\n removeObserver(obs[i], derivation);\n }\n derivation.dependenciesState_ = IDerivationState_.NOT_TRACKING_;\n}\nfunction untracked(action) {\n var prev = untrackedStart();\n try {\n return action();\n } finally {\n untrackedEnd(prev);\n }\n}\nfunction untrackedStart() {\n var prev = globalState.trackingDerivation;\n globalState.trackingDerivation = null;\n return prev;\n}\nfunction untrackedEnd(prev) {\n globalState.trackingDerivation = prev;\n}\nfunction allowStateReadsStart(allowStateReads) {\n var prev = globalState.allowStateReads;\n globalState.allowStateReads = allowStateReads;\n return prev;\n}\nfunction allowStateReadsEnd(prev) {\n globalState.allowStateReads = prev;\n}\n/**\n * needed to keep `lowestObserverState` correct. when changing from (2 or 1) to 0\n *\n */\nfunction changeDependenciesStateTo0(derivation) {\n if (derivation.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {\n return;\n }\n derivation.dependenciesState_ = IDerivationState_.UP_TO_DATE_;\n var obs = derivation.observing_;\n var i = obs.length;\n while (i--) {\n obs[i].lowestObserverState_ = IDerivationState_.UP_TO_DATE_;\n }\n}\n\n/**\n * These values will persist if global state is reset\n */\nvar persistentKeys = [\"mobxGuid\", \"spyListeners\", \"enforceActions\", \"computedRequiresReaction\", \"reactionRequiresObservable\", \"observableRequiresReaction\", \"allowStateReads\", \"disableErrorBoundaries\", \"runId\", \"UNCHANGED\", \"useProxies\"];\nvar MobXGlobals = function MobXGlobals() {\n /**\n * MobXGlobals version.\n * MobX compatiblity with other versions loaded in memory as long as this version matches.\n * It indicates that the global state still stores similar information\n *\n * N.B: this version is unrelated to the package version of MobX, and is only the version of the\n * internal state storage of MobX, and can be the same across many different package versions\n */\n this.version = 6;\n /**\n * globally unique token to signal unchanged\n */\n this.UNCHANGED = {};\n /**\n * Currently running derivation\n */\n this.trackingDerivation = null;\n /**\n * Currently running reaction. This determines if we currently have a reactive context.\n * (Tracking derivation is also set for temporal tracking of computed values inside actions,\n * but trackingReaction can only be set by a form of Reaction)\n */\n this.trackingContext = null;\n /**\n * Each time a derivation is tracked, it is assigned a unique run-id\n */\n this.runId = 0;\n /**\n * 'guid' for general purpose. Will be persisted amongst resets.\n */\n this.mobxGuid = 0;\n /**\n * Are we in a batch block? (and how many of them)\n */\n this.inBatch = 0;\n /**\n * Observables that don't have observers anymore, and are about to be\n * suspended, unless somebody else accesses it in the same batch\n *\n * @type {IObservable[]}\n */\n this.pendingUnobservations = [];\n /**\n * List of scheduled, not yet executed, reactions.\n */\n this.pendingReactions = [];\n /**\n * Are we currently processing reactions?\n */\n this.isRunningReactions = false;\n /**\n * Is it allowed to change observables at this point?\n * In general, MobX doesn't allow that when running computations and React.render.\n * To ensure that those functions stay pure.\n */\n this.allowStateChanges = false;\n /**\n * Is it allowed to read observables at this point?\n * Used to hold the state needed for `observableRequiresReaction`\n */\n this.allowStateReads = true;\n /**\n * If strict mode is enabled, state changes are by default not allowed\n */\n this.enforceActions = true;\n /**\n * Spy callbacks\n */\n this.spyListeners = [];\n /**\n * Globally attached error handlers that react specifically to errors in reactions\n */\n this.globalReactionErrorHandlers = [];\n /**\n * Warn if computed values are accessed outside a reactive context\n */\n this.computedRequiresReaction = false;\n /**\n * (Experimental)\n * Warn if you try to create to derivation / reactive context without accessing any observable.\n */\n this.reactionRequiresObservable = false;\n /**\n * (Experimental)\n * Warn if observables are accessed outside a reactive context\n */\n this.observableRequiresReaction = false;\n /*\n * Don't catch and rethrow exceptions. This is useful for inspecting the state of\n * the stack when an exception occurs while debugging.\n */\n this.disableErrorBoundaries = false;\n /*\n * If true, we are already handling an exception in an action. Any errors in reactions should be suppressed, as\n * they are not the cause, see: https://github.com/mobxjs/mobx/issues/1836\n */\n this.suppressReactionErrors = false;\n this.useProxies = true;\n /*\n * print warnings about code that would fail if proxies weren't available\n */\n this.verifyProxies = false;\n /**\n * False forces all object's descriptors to\n * writable: true\n * configurable: true\n */\n this.safeDescriptors = true;\n};\nvar canMergeGlobalState = true;\nvar isolateCalled = false;\nvar globalState = /*#__PURE__*/function () {\n var global = /*#__PURE__*/getGlobal();\n if (global.__mobxInstanceCount > 0 && !global.__mobxGlobals) {\n canMergeGlobalState = false;\n }\n if (global.__mobxGlobals && global.__mobxGlobals.version !== new MobXGlobals().version) {\n canMergeGlobalState = false;\n }\n if (!canMergeGlobalState) {\n // Because this is a IIFE we need to let isolateCalled a chance to change\n // so we run it after the event loop completed at least 1 iteration\n setTimeout(function () {\n if (!isolateCalled) {\n die(35);\n }\n }, 1);\n return new MobXGlobals();\n } else if (global.__mobxGlobals) {\n global.__mobxInstanceCount += 1;\n if (!global.__mobxGlobals.UNCHANGED) {\n global.__mobxGlobals.UNCHANGED = {};\n } // make merge backward compatible\n return global.__mobxGlobals;\n } else {\n global.__mobxInstanceCount = 1;\n return global.__mobxGlobals = /*#__PURE__*/new MobXGlobals();\n }\n}();\nfunction isolateGlobalState() {\n if (globalState.pendingReactions.length || globalState.inBatch || globalState.isRunningReactions) {\n die(36);\n }\n isolateCalled = true;\n if (canMergeGlobalState) {\n var global = getGlobal();\n if (--global.__mobxInstanceCount === 0) {\n global.__mobxGlobals = undefined;\n }\n globalState = new MobXGlobals();\n }\n}\nfunction getGlobalState() {\n return globalState;\n}\n/**\n * For testing purposes only; this will break the internal state of existing observables,\n * but can be used to get back at a stable state after throwing errors\n */\nfunction resetGlobalState() {\n var defaultGlobals = new MobXGlobals();\n for (var key in defaultGlobals) {\n if (persistentKeys.indexOf(key) === -1) {\n globalState[key] = defaultGlobals[key];\n }\n }\n globalState.allowStateChanges = !globalState.enforceActions;\n}\n\nfunction hasObservers(observable) {\n return observable.observers_ && observable.observers_.size > 0;\n}\nfunction getObservers(observable) {\n return observable.observers_;\n}\n// function invariantObservers(observable: IObservable) {\n// const list = observable.observers\n// const map = observable.observersIndexes\n// const l = list.length\n// for (let i = 0; i < l; i++) {\n// const id = list[i].__mapid\n// if (i) {\n// invariant(map[id] === i, \"INTERNAL ERROR maps derivation.__mapid to index in list\") // for performance\n// } else {\n// invariant(!(id in map), \"INTERNAL ERROR observer on index 0 shouldn't be held in map.\") // for performance\n// }\n// }\n// invariant(\n// list.length === 0 || Object.keys(map).length === list.length - 1,\n// \"INTERNAL ERROR there is no junk in map\"\n// )\n// }\nfunction addObserver(observable, node) {\n // invariant(node.dependenciesState !== -1, \"INTERNAL ERROR, can add only dependenciesState !== -1\");\n // invariant(observable._observers.indexOf(node) === -1, \"INTERNAL ERROR add already added node\");\n // invariantObservers(observable);\n observable.observers_.add(node);\n if (observable.lowestObserverState_ > node.dependenciesState_) {\n observable.lowestObserverState_ = node.dependenciesState_;\n }\n // invariantObservers(observable);\n // invariant(observable._observers.indexOf(node) !== -1, \"INTERNAL ERROR didn't add node\");\n}\nfunction removeObserver(observable, node) {\n // invariant(globalState.inBatch > 0, \"INTERNAL ERROR, remove should be called only inside batch\");\n // invariant(observable._observers.indexOf(node) !== -1, \"INTERNAL ERROR remove already removed node\");\n // invariantObservers(observable);\n observable.observers_[\"delete\"](node);\n if (observable.observers_.size === 0) {\n // deleting last observer\n queueForUnobservation(observable);\n }\n // invariantObservers(observable);\n // invariant(observable._observers.indexOf(node) === -1, \"INTERNAL ERROR remove already removed node2\");\n}\nfunction queueForUnobservation(observable) {\n if (observable.isPendingUnobservation === false) {\n // invariant(observable._observers.length === 0, \"INTERNAL ERROR, should only queue for unobservation unobserved observables\");\n observable.isPendingUnobservation = true;\n globalState.pendingUnobservations.push(observable);\n }\n}\n/**\n * Batch starts a transaction, at least for purposes of memoizing ComputedValues when nothing else does.\n * During a batch `onBecomeUnobserved` will be called at most once per observable.\n * Avoids unnecessary recalculations.\n */\nfunction startBatch() {\n globalState.inBatch++;\n}\nfunction endBatch() {\n if (--globalState.inBatch === 0) {\n runReactions();\n // the batch is actually about to finish, all unobserving should happen here.\n var list = globalState.pendingUnobservations;\n for (var i = 0; i < list.length; i++) {\n var observable = list[i];\n observable.isPendingUnobservation = false;\n if (observable.observers_.size === 0) {\n if (observable.isBeingObserved) {\n // if this observable had reactive observers, trigger the hooks\n observable.isBeingObserved = false;\n observable.onBUO();\n }\n if (observable instanceof ComputedValue) {\n // computed values are automatically teared down when the last observer leaves\n // this process happens recursively, this computed might be the last observabe of another, etc..\n observable.suspend_();\n }\n }\n }\n globalState.pendingUnobservations = [];\n }\n}\nfunction reportObserved(observable) {\n checkIfStateReadsAreAllowed(observable);\n var derivation = globalState.trackingDerivation;\n if (derivation !== null) {\n /**\n * Simple optimization, give each derivation run an unique id (runId)\n * Check if last time this observable was accessed the same runId is used\n * if this is the case, the relation is already known\n */\n if (derivation.runId_ !== observable.lastAccessedBy_) {\n observable.lastAccessedBy_ = derivation.runId_;\n // Tried storing newObserving, or observing, or both as Set, but performance didn't come close...\n derivation.newObserving_[derivation.unboundDepsCount_++] = observable;\n if (!observable.isBeingObserved && globalState.trackingContext) {\n observable.isBeingObserved = true;\n observable.onBO();\n }\n }\n return observable.isBeingObserved;\n } else if (observable.observers_.size === 0 && globalState.inBatch > 0) {\n queueForUnobservation(observable);\n }\n return false;\n}\n// function invariantLOS(observable: IObservable, msg: string) {\n// // it's expensive so better not run it in produciton. but temporarily helpful for testing\n// const min = getObservers(observable).reduce((a, b) => Math.min(a, b.dependenciesState), 2)\n// if (min >= observable.lowestObserverState) return // <- the only assumption about `lowestObserverState`\n// throw new Error(\n// \"lowestObserverState is wrong for \" +\n// msg +\n// \" because \" +\n// min +\n// \" < \" +\n// observable.lowestObserverState\n// )\n// }\n/**\n * NOTE: current propagation mechanism will in case of self reruning autoruns behave unexpectedly\n * It will propagate changes to observers from previous run\n * It's hard or maybe impossible (with reasonable perf) to get it right with current approach\n * Hopefully self reruning autoruns aren't a feature people should depend on\n * Also most basic use cases should be ok\n */\n// Called by Atom when its value changes\nfunction propagateChanged(observable) {\n // invariantLOS(observable, \"changed start\");\n if (observable.lowestObserverState_ === IDerivationState_.STALE_) {\n return;\n }\n observable.lowestObserverState_ = IDerivationState_.STALE_;\n // Ideally we use for..of here, but the downcompiled version is really slow...\n observable.observers_.forEach(function (d) {\n if (d.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {\n if ( true && d.isTracing_ !== TraceMode.NONE) {\n logTraceInfo(d, observable);\n }\n d.onBecomeStale_();\n }\n d.dependenciesState_ = IDerivationState_.STALE_;\n });\n // invariantLOS(observable, \"changed end\");\n}\n// Called by ComputedValue when it recalculate and its value changed\nfunction propagateChangeConfirmed(observable) {\n // invariantLOS(observable, \"confirmed start\");\n if (observable.lowestObserverState_ === IDerivationState_.STALE_) {\n return;\n }\n observable.lowestObserverState_ = IDerivationState_.STALE_;\n observable.observers_.forEach(function (d) {\n if (d.dependenciesState_ === IDerivationState_.POSSIBLY_STALE_) {\n d.dependenciesState_ = IDerivationState_.STALE_;\n if ( true && d.isTracing_ !== TraceMode.NONE) {\n logTraceInfo(d, observable);\n }\n } else if (d.dependenciesState_ === IDerivationState_.UP_TO_DATE_ // this happens during computing of `d`, just keep lowestObserverState up to date.\n ) {\n observable.lowestObserverState_ = IDerivationState_.UP_TO_DATE_;\n }\n });\n // invariantLOS(observable, \"confirmed end\");\n}\n// Used by computed when its dependency changed, but we don't wan't to immediately recompute.\nfunction propagateMaybeChanged(observable) {\n // invariantLOS(observable, \"maybe start\");\n if (observable.lowestObserverState_ !== IDerivationState_.UP_TO_DATE_) {\n return;\n }\n observable.lowestObserverState_ = IDerivationState_.POSSIBLY_STALE_;\n observable.observers_.forEach(function (d) {\n if (d.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {\n d.dependenciesState_ = IDerivationState_.POSSIBLY_STALE_;\n d.onBecomeStale_();\n }\n });\n // invariantLOS(observable, \"maybe end\");\n}\nfunction logTraceInfo(derivation, observable) {\n console.log(\"[mobx.trace] '\" + derivation.name_ + \"' is invalidated due to a change in: '\" + observable.name_ + \"'\");\n if (derivation.isTracing_ === TraceMode.BREAK) {\n var lines = [];\n printDepTree(getDependencyTree(derivation), lines, 1);\n // prettier-ignore\n new Function(\"debugger;\\n/*\\nTracing '\" + derivation.name_ + \"'\\n\\nYou are entering this break point because derivation '\" + derivation.name_ + \"' is being traced and '\" + observable.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\" + (derivation instanceof ComputedValue ? derivation.derivation.toString().replace(/[*]\\//g, \"/\") : \"\") + \"\\n\\nThe dependencies for this derivation are:\\n\\n\" + lines.join(\"\\n\") + \"\\n*/\\n \")();\n }\n}\nfunction printDepTree(tree, lines, depth) {\n if (lines.length >= 1000) {\n lines.push(\"(and many more)\");\n return;\n }\n lines.push(\"\" + \"\\t\".repeat(depth - 1) + tree.name);\n if (tree.dependencies) {\n tree.dependencies.forEach(function (child) {\n return printDepTree(child, lines, depth + 1);\n });\n }\n}\n\nvar Reaction = /*#__PURE__*/function () {\n function Reaction(name_, onInvalidate_, errorHandler_, requiresObservable_) {\n if (name_ === void 0) {\n name_ = true ? \"Reaction@\" + getNextId() : 0;\n }\n this.name_ = void 0;\n this.onInvalidate_ = void 0;\n this.errorHandler_ = void 0;\n this.requiresObservable_ = void 0;\n this.observing_ = [];\n // nodes we are looking at. Our value depends on these nodes\n this.newObserving_ = [];\n this.dependenciesState_ = IDerivationState_.NOT_TRACKING_;\n this.runId_ = 0;\n this.unboundDepsCount_ = 0;\n this.flags_ = 0;\n this.isTracing_ = TraceMode.NONE;\n this.name_ = name_;\n this.onInvalidate_ = onInvalidate_;\n this.errorHandler_ = errorHandler_;\n this.requiresObservable_ = requiresObservable_;\n }\n var _proto = Reaction.prototype;\n _proto.onBecomeStale_ = function onBecomeStale_() {\n this.schedule_();\n };\n _proto.schedule_ = function schedule_() {\n if (!this.isScheduled) {\n this.isScheduled = true;\n globalState.pendingReactions.push(this);\n runReactions();\n }\n }\n /**\n * internal, use schedule() if you intend to kick off a reaction\n */;\n _proto.runReaction_ = function runReaction_() {\n if (!this.isDisposed) {\n startBatch();\n this.isScheduled = false;\n var prev = globalState.trackingContext;\n globalState.trackingContext = this;\n if (shouldCompute(this)) {\n this.isTrackPending = true;\n try {\n this.onInvalidate_();\n if ( true && this.isTrackPending && isSpyEnabled()) {\n // onInvalidate didn't trigger track right away..\n spyReport({\n name: this.name_,\n type: \"scheduled-reaction\"\n });\n }\n } catch (e) {\n this.reportExceptionInDerivation_(e);\n }\n }\n globalState.trackingContext = prev;\n endBatch();\n }\n };\n _proto.track = function track(fn) {\n if (this.isDisposed) {\n return;\n // console.warn(\"Reaction already disposed\") // Note: Not a warning / error in mobx 4 either\n }\n startBatch();\n var notify = isSpyEnabled();\n var startTime;\n if ( true && notify) {\n startTime = Date.now();\n spyReportStart({\n name: this.name_,\n type: \"reaction\"\n });\n }\n this.isRunning = true;\n var prevReaction = globalState.trackingContext; // reactions could create reactions...\n globalState.trackingContext = this;\n var result = trackDerivedFunction(this, fn, undefined);\n globalState.trackingContext = prevReaction;\n this.isRunning = false;\n this.isTrackPending = false;\n if (this.isDisposed) {\n // disposed during last run. Clean up everything that was bound after the dispose call.\n clearObserving(this);\n }\n if (isCaughtException(result)) {\n this.reportExceptionInDerivation_(result.cause);\n }\n if ( true && notify) {\n spyReportEnd({\n time: Date.now() - startTime\n });\n }\n endBatch();\n };\n _proto.reportExceptionInDerivation_ = function reportExceptionInDerivation_(error) {\n var _this = this;\n if (this.errorHandler_) {\n this.errorHandler_(error, this);\n return;\n }\n if (globalState.disableErrorBoundaries) {\n throw error;\n }\n var message = true ? \"[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '\" + this + \"'\" : 0;\n if (!globalState.suppressReactionErrors) {\n console.error(message, error);\n /** If debugging brought you here, please, read the above message :-). Tnx! */\n } else if (true) {\n console.warn(\"[mobx] (error in reaction '\" + this.name_ + \"' suppressed, fix error of causing action below)\");\n } // prettier-ignore\n if ( true && isSpyEnabled()) {\n spyReport({\n type: \"error\",\n name: this.name_,\n message: message,\n error: \"\" + error\n });\n }\n globalState.globalReactionErrorHandlers.forEach(function (f) {\n return f(error, _this);\n });\n };\n _proto.dispose = function dispose() {\n if (!this.isDisposed) {\n this.isDisposed = true;\n if (!this.isRunning) {\n // if disposed while running, clean up later. Maybe not optimal, but rare case\n startBatch();\n clearObserving(this);\n endBatch();\n }\n }\n };\n _proto.getDisposer_ = function getDisposer_(abortSignal) {\n var _this2 = this;\n var dispose = function dispose() {\n _this2.dispose();\n abortSignal == null || abortSignal.removeEventListener == null || abortSignal.removeEventListener(\"abort\", dispose);\n };\n abortSignal == null || abortSignal.addEventListener == null || abortSignal.addEventListener(\"abort\", dispose);\n dispose[$mobx] = this;\n return dispose;\n };\n _proto.toString = function toString() {\n return \"Reaction[\" + this.name_ + \"]\";\n };\n _proto.trace = function trace$1(enterBreakPoint) {\n if (enterBreakPoint === void 0) {\n enterBreakPoint = false;\n }\n trace(this, enterBreakPoint);\n };\n return _createClass(Reaction, [{\n key: \"isDisposed\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isDisposedMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isDisposedMask_, newValue);\n }\n }, {\n key: \"isScheduled\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isScheduledMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isScheduledMask_, newValue);\n }\n }, {\n key: \"isTrackPending\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isTrackPendingMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isTrackPendingMask_, newValue);\n }\n }, {\n key: \"isRunning\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isRunningMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isRunningMask_, newValue);\n }\n }, {\n key: \"diffValue\",\n get: function get() {\n return getFlag(this.flags_, Reaction.diffValueMask_) ? 1 : 0;\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.diffValueMask_, newValue === 1 ? true : false);\n }\n }]);\n}();\nReaction.isDisposedMask_ = 1;\nReaction.isScheduledMask_ = 2;\nReaction.isTrackPendingMask_ = 4;\nReaction.isRunningMask_ = 8;\nReaction.diffValueMask_ = 16;\nfunction onReactionError(handler) {\n globalState.globalReactionErrorHandlers.push(handler);\n return function () {\n var idx = globalState.globalReactionErrorHandlers.indexOf(handler);\n if (idx >= 0) {\n globalState.globalReactionErrorHandlers.splice(idx, 1);\n }\n };\n}\n/**\n * Magic number alert!\n * Defines within how many times a reaction is allowed to re-trigger itself\n * until it is assumed that this is gonna be a never ending loop...\n */\nvar MAX_REACTION_ITERATIONS = 100;\nvar reactionScheduler = function reactionScheduler(f) {\n return f();\n};\nfunction runReactions() {\n // Trampolining, if runReactions are already running, new reactions will be picked up\n if (globalState.inBatch > 0 || globalState.isRunningReactions) {\n return;\n }\n reactionScheduler(runReactionsHelper);\n}\nfunction runReactionsHelper() {\n globalState.isRunningReactions = true;\n var allReactions = globalState.pendingReactions;\n var iterations = 0;\n // While running reactions, new reactions might be triggered.\n // Hence we work with two variables and check whether\n // we converge to no remaining reactions after a while.\n while (allReactions.length > 0) {\n if (++iterations === MAX_REACTION_ITERATIONS) {\n console.error( true ? \"Reaction doesn't converge to a stable state after \" + MAX_REACTION_ITERATIONS + \" iterations.\" + (\" Probably there is a cycle in the reactive function: \" + allReactions[0]) : 0);\n allReactions.splice(0); // clear reactions\n }\n var remainingReactions = allReactions.splice(0);\n for (var i = 0, l = remainingReactions.length; i < l; i++) {\n remainingReactions[i].runReaction_();\n }\n }\n globalState.isRunningReactions = false;\n}\nvar isReaction = /*#__PURE__*/createInstanceofPredicate(\"Reaction\", Reaction);\nfunction setReactionScheduler(fn) {\n var baseScheduler = reactionScheduler;\n reactionScheduler = function reactionScheduler(f) {\n return fn(function () {\n return baseScheduler(f);\n });\n };\n}\n\nfunction isSpyEnabled() {\n return true && !!globalState.spyListeners.length;\n}\nfunction spyReport(event) {\n if (false) {} // dead code elimination can do the rest\n if (!globalState.spyListeners.length) {\n return;\n }\n var listeners = globalState.spyListeners;\n for (var i = 0, l = listeners.length; i < l; i++) {\n listeners[i](event);\n }\n}\nfunction spyReportStart(event) {\n if (false) {}\n var change = _extends({}, event, {\n spyReportStart: true\n });\n spyReport(change);\n}\nvar END_EVENT = {\n type: \"report-end\",\n spyReportEnd: true\n};\nfunction spyReportEnd(change) {\n if (false) {}\n if (change) {\n spyReport(_extends({}, change, {\n type: \"report-end\",\n spyReportEnd: true\n }));\n } else {\n spyReport(END_EVENT);\n }\n}\nfunction spy(listener) {\n if (false) {} else {\n globalState.spyListeners.push(listener);\n return once(function () {\n globalState.spyListeners = globalState.spyListeners.filter(function (l) {\n return l !== listener;\n });\n });\n }\n}\n\nvar ACTION = \"action\";\nvar ACTION_BOUND = \"action.bound\";\nvar AUTOACTION = \"autoAction\";\nvar AUTOACTION_BOUND = \"autoAction.bound\";\nvar DEFAULT_ACTION_NAME = \"\";\nvar actionAnnotation = /*#__PURE__*/createActionAnnotation(ACTION);\nvar actionBoundAnnotation = /*#__PURE__*/createActionAnnotation(ACTION_BOUND, {\n bound: true\n});\nvar autoActionAnnotation = /*#__PURE__*/createActionAnnotation(AUTOACTION, {\n autoAction: true\n});\nvar autoActionBoundAnnotation = /*#__PURE__*/createActionAnnotation(AUTOACTION_BOUND, {\n autoAction: true,\n bound: true\n});\nfunction createActionFactory(autoAction) {\n var res = function action(arg1, arg2) {\n // action(fn() {})\n if (isFunction(arg1)) {\n return createAction(arg1.name || DEFAULT_ACTION_NAME, arg1, autoAction);\n }\n // action(\"name\", fn() {})\n if (isFunction(arg2)) {\n return createAction(arg1, arg2, autoAction);\n }\n // @action (2022.3 Decorators)\n if (is20223Decorator(arg2)) {\n return (autoAction ? autoActionAnnotation : actionAnnotation).decorate_20223_(arg1, arg2);\n }\n // @action\n if (isStringish(arg2)) {\n return storeAnnotation(arg1, arg2, autoAction ? autoActionAnnotation : actionAnnotation);\n }\n // action(\"name\") & @action(\"name\")\n if (isStringish(arg1)) {\n return createDecoratorAnnotation(createActionAnnotation(autoAction ? AUTOACTION : ACTION, {\n name: arg1,\n autoAction: autoAction\n }));\n }\n if (true) {\n die(\"Invalid arguments for `action`\");\n }\n };\n return res;\n}\nvar action = /*#__PURE__*/createActionFactory(false);\nObject.assign(action, actionAnnotation);\nvar autoAction = /*#__PURE__*/createActionFactory(true);\nObject.assign(autoAction, autoActionAnnotation);\naction.bound = /*#__PURE__*/createDecoratorAnnotation(actionBoundAnnotation);\nautoAction.bound = /*#__PURE__*/createDecoratorAnnotation(autoActionBoundAnnotation);\nfunction runInAction(fn) {\n return executeAction(fn.name || DEFAULT_ACTION_NAME, false, fn, this, undefined);\n}\nfunction isAction(thing) {\n return isFunction(thing) && thing.isMobxAction === true;\n}\n\n/**\n * Creates a named reactive view and keeps it alive, so that the view is always\n * updated if one of the dependencies changes, even when the view is not further used by something else.\n * @param view The reactive view\n * @returns disposer function, which can be used to stop the view from being updated in the future.\n */\nfunction autorun(view, opts) {\n var _opts$name, _opts, _opts2, _opts3;\n if (opts === void 0) {\n opts = EMPTY_OBJECT;\n }\n if (true) {\n if (!isFunction(view)) {\n die(\"Autorun expects a function as first argument\");\n }\n if (isAction(view)) {\n die(\"Autorun does not accept actions since actions are untrackable\");\n }\n }\n var name = (_opts$name = (_opts = opts) == null ? void 0 : _opts.name) != null ? _opts$name : true ? view.name || \"Autorun@\" + getNextId() : 0;\n var runSync = !opts.scheduler && !opts.delay;\n var reaction;\n if (runSync) {\n // normal autorun\n reaction = new Reaction(name, function () {\n this.track(reactionRunner);\n }, opts.onError, opts.requiresObservable);\n } else {\n var scheduler = createSchedulerFromOptions(opts);\n // debounced autorun\n var isScheduled = false;\n reaction = new Reaction(name, function () {\n if (!isScheduled) {\n isScheduled = true;\n scheduler(function () {\n isScheduled = false;\n if (!reaction.isDisposed) {\n reaction.track(reactionRunner);\n }\n });\n }\n }, opts.onError, opts.requiresObservable);\n }\n function reactionRunner() {\n view(reaction);\n }\n if (!((_opts2 = opts) != null && (_opts2 = _opts2.signal) != null && _opts2.aborted)) {\n reaction.schedule_();\n }\n return reaction.getDisposer_((_opts3 = opts) == null ? void 0 : _opts3.signal);\n}\nvar run = function run(f) {\n return f();\n};\nfunction createSchedulerFromOptions(opts) {\n return opts.scheduler ? opts.scheduler : opts.delay ? function (f) {\n return setTimeout(f, opts.delay);\n } : run;\n}\nfunction reaction(expression, effect, opts) {\n var _opts$name2, _opts4, _opts5;\n if (opts === void 0) {\n opts = EMPTY_OBJECT;\n }\n if (true) {\n if (!isFunction(expression) || !isFunction(effect)) {\n die(\"First and second argument to reaction should be functions\");\n }\n if (!isPlainObject(opts)) {\n die(\"Third argument of reactions should be an object\");\n }\n }\n var name = (_opts$name2 = opts.name) != null ? _opts$name2 : true ? \"Reaction@\" + getNextId() : 0;\n var effectAction = action(name, opts.onError ? wrapErrorHandler(opts.onError, effect) : effect);\n var runSync = !opts.scheduler && !opts.delay;\n var scheduler = createSchedulerFromOptions(opts);\n var firstTime = true;\n var isScheduled = false;\n var value;\n var equals = opts.compareStructural ? comparer.structural : opts.equals || comparer[\"default\"];\n var r = new Reaction(name, function () {\n if (firstTime || runSync) {\n reactionRunner();\n } else if (!isScheduled) {\n isScheduled = true;\n scheduler(reactionRunner);\n }\n }, opts.onError, opts.requiresObservable);\n function reactionRunner() {\n isScheduled = false;\n if (r.isDisposed) {\n return;\n }\n var changed = false;\n var oldValue = value;\n r.track(function () {\n var nextValue = allowStateChanges(false, function () {\n return expression(r);\n });\n changed = firstTime || !equals(value, nextValue);\n value = nextValue;\n });\n if (firstTime && opts.fireImmediately) {\n effectAction(value, oldValue, r);\n } else if (!firstTime && changed) {\n effectAction(value, oldValue, r);\n }\n firstTime = false;\n }\n if (!((_opts4 = opts) != null && (_opts4 = _opts4.signal) != null && _opts4.aborted)) {\n r.schedule_();\n }\n return r.getDisposer_((_opts5 = opts) == null ? void 0 : _opts5.signal);\n}\nfunction wrapErrorHandler(errorHandler, baseFn) {\n return function () {\n try {\n return baseFn.apply(this, arguments);\n } catch (e) {\n errorHandler.call(this, e);\n }\n };\n}\n\nvar ON_BECOME_OBSERVED = \"onBO\";\nvar ON_BECOME_UNOBSERVED = \"onBUO\";\nfunction onBecomeObserved(thing, arg2, arg3) {\n return interceptHook(ON_BECOME_OBSERVED, thing, arg2, arg3);\n}\nfunction onBecomeUnobserved(thing, arg2, arg3) {\n return interceptHook(ON_BECOME_UNOBSERVED, thing, arg2, arg3);\n}\nfunction interceptHook(hook, thing, arg2, arg3) {\n var atom = typeof arg3 === \"function\" ? getAtom(thing, arg2) : getAtom(thing);\n var cb = isFunction(arg3) ? arg3 : arg2;\n var listenersKey = hook + \"L\";\n if (atom[listenersKey]) {\n atom[listenersKey].add(cb);\n } else {\n atom[listenersKey] = new Set([cb]);\n }\n return function () {\n var hookListeners = atom[listenersKey];\n if (hookListeners) {\n hookListeners[\"delete\"](cb);\n if (hookListeners.size === 0) {\n delete atom[listenersKey];\n }\n }\n };\n}\n\nvar NEVER = \"never\";\nvar ALWAYS = \"always\";\nvar OBSERVED = \"observed\";\n// const IF_AVAILABLE = \"ifavailable\"\nfunction configure(options) {\n if (options.isolateGlobalState === true) {\n isolateGlobalState();\n }\n var useProxies = options.useProxies,\n enforceActions = options.enforceActions;\n if (useProxies !== undefined) {\n globalState.useProxies = useProxies === ALWAYS ? true : useProxies === NEVER ? false : typeof Proxy !== \"undefined\";\n }\n if (useProxies === \"ifavailable\") {\n globalState.verifyProxies = true;\n }\n if (enforceActions !== undefined) {\n var ea = enforceActions === ALWAYS ? ALWAYS : enforceActions === OBSERVED;\n globalState.enforceActions = ea;\n globalState.allowStateChanges = ea === true || ea === ALWAYS ? false : true;\n }\n [\"computedRequiresReaction\", \"reactionRequiresObservable\", \"observableRequiresReaction\", \"disableErrorBoundaries\", \"safeDescriptors\"].forEach(function (key) {\n if (key in options) {\n globalState[key] = !!options[key];\n }\n });\n globalState.allowStateReads = !globalState.observableRequiresReaction;\n if ( true && globalState.disableErrorBoundaries === true) {\n console.warn(\"WARNING: Debug feature only. MobX will NOT recover from errors when `disableErrorBoundaries` is enabled.\");\n }\n if (options.reactionScheduler) {\n setReactionScheduler(options.reactionScheduler);\n }\n}\n\nfunction extendObservable(target, properties, annotations, options) {\n if (true) {\n if (arguments.length > 4) {\n die(\"'extendObservable' expected 2-4 arguments\");\n }\n if (typeof target !== \"object\") {\n die(\"'extendObservable' expects an object as first argument\");\n }\n if (isObservableMap(target)) {\n die(\"'extendObservable' should not be used on maps, use map.merge instead\");\n }\n if (!isPlainObject(properties)) {\n die(\"'extendObservable' only accepts plain objects as second argument\");\n }\n if (isObservable(properties) || isObservable(annotations)) {\n die(\"Extending an object with another observable (object) is not supported\");\n }\n }\n // Pull descriptors first, so we don't have to deal with props added by administration ($mobx)\n var descriptors = getOwnPropertyDescriptors(properties);\n initObservable(function () {\n var adm = asObservableObject(target, options)[$mobx];\n ownKeys(descriptors).forEach(function (key) {\n adm.extend_(key, descriptors[key],\n // must pass \"undefined\" for { key: undefined }\n !annotations ? true : key in annotations ? annotations[key] : true);\n });\n });\n return target;\n}\n\nfunction getDependencyTree(thing, property) {\n return nodeToDependencyTree(getAtom(thing, property));\n}\nfunction nodeToDependencyTree(node) {\n var result = {\n name: node.name_\n };\n if (node.observing_ && node.observing_.length > 0) {\n result.dependencies = unique(node.observing_).map(nodeToDependencyTree);\n }\n return result;\n}\nfunction getObserverTree(thing, property) {\n return nodeToObserverTree(getAtom(thing, property));\n}\nfunction nodeToObserverTree(node) {\n var result = {\n name: node.name_\n };\n if (hasObservers(node)) {\n result.observers = Array.from(getObservers(node)).map(nodeToObserverTree);\n }\n return result;\n}\nfunction unique(list) {\n return Array.from(new Set(list));\n}\n\nvar generatorId = 0;\nfunction FlowCancellationError() {\n this.message = \"FLOW_CANCELLED\";\n}\nFlowCancellationError.prototype = /*#__PURE__*/Object.create(Error.prototype);\nfunction isFlowCancellationError(error) {\n return error instanceof FlowCancellationError;\n}\nvar flowAnnotation = /*#__PURE__*/createFlowAnnotation(\"flow\");\nvar flowBoundAnnotation = /*#__PURE__*/createFlowAnnotation(\"flow.bound\", {\n bound: true\n});\nvar flow = /*#__PURE__*/Object.assign(function flow(arg1, arg2) {\n // @flow (2022.3 Decorators)\n if (is20223Decorator(arg2)) {\n return flowAnnotation.decorate_20223_(arg1, arg2);\n }\n // @flow\n if (isStringish(arg2)) {\n return storeAnnotation(arg1, arg2, flowAnnotation);\n }\n // flow(fn)\n if ( true && arguments.length !== 1) {\n die(\"Flow expects single argument with generator function\");\n }\n var generator = arg1;\n var name = generator.name || \"\";\n // Implementation based on https://github.com/tj/co/blob/master/index.js\n var res = function res() {\n var ctx = this;\n var args = arguments;\n var runId = ++generatorId;\n var gen = action(name + \" - runid: \" + runId + \" - init\", generator).apply(ctx, args);\n var rejector;\n var pendingPromise = undefined;\n var promise = new Promise(function (resolve, reject) {\n var stepId = 0;\n rejector = reject;\n function onFulfilled(res) {\n pendingPromise = undefined;\n var ret;\n try {\n ret = action(name + \" - runid: \" + runId + \" - yield \" + stepId++, gen.next).call(gen, res);\n } catch (e) {\n return reject(e);\n }\n next(ret);\n }\n function onRejected(err) {\n pendingPromise = undefined;\n var ret;\n try {\n ret = action(name + \" - runid: \" + runId + \" - yield \" + stepId++, gen[\"throw\"]).call(gen, err);\n } catch (e) {\n return reject(e);\n }\n next(ret);\n }\n function next(ret) {\n if (isFunction(ret == null ? void 0 : ret.then)) {\n // an async iterator\n ret.then(next, reject);\n return;\n }\n if (ret.done) {\n return resolve(ret.value);\n }\n pendingPromise = Promise.resolve(ret.value);\n return pendingPromise.then(onFulfilled, onRejected);\n }\n onFulfilled(undefined); // kick off the process\n });\n promise.cancel = action(name + \" - runid: \" + runId + \" - cancel\", function () {\n try {\n if (pendingPromise) {\n cancelPromise(pendingPromise);\n }\n // Finally block can return (or yield) stuff..\n var _res = gen[\"return\"](undefined);\n // eat anything that promise would do, it's cancelled!\n var yieldedPromise = Promise.resolve(_res.value);\n yieldedPromise.then(noop, noop);\n cancelPromise(yieldedPromise); // maybe it can be cancelled :)\n // reject our original promise\n rejector(new FlowCancellationError());\n } catch (e) {\n rejector(e); // there could be a throwing finally block\n }\n });\n return promise;\n };\n res.isMobXFlow = true;\n return res;\n}, flowAnnotation);\nflow.bound = /*#__PURE__*/createDecoratorAnnotation(flowBoundAnnotation);\nfunction cancelPromise(promise) {\n if (isFunction(promise.cancel)) {\n promise.cancel();\n }\n}\nfunction flowResult(result) {\n return result; // just tricking TypeScript :)\n}\nfunction isFlow(fn) {\n return (fn == null ? void 0 : fn.isMobXFlow) === true;\n}\n\nfunction interceptReads(thing, propOrHandler, handler) {\n var target;\n if (isObservableMap(thing) || isObservableArray(thing) || isObservableValue(thing)) {\n target = getAdministration(thing);\n } else if (isObservableObject(thing)) {\n if ( true && !isStringish(propOrHandler)) {\n return die(\"InterceptReads can only be used with a specific property, not with an object in general\");\n }\n target = getAdministration(thing, propOrHandler);\n } else if (true) {\n return die(\"Expected observable map, object or array as first array\");\n }\n if ( true && target.dehancer !== undefined) {\n return die(\"An intercept reader was already established\");\n }\n target.dehancer = typeof propOrHandler === \"function\" ? propOrHandler : handler;\n return function () {\n target.dehancer = undefined;\n };\n}\n\nfunction intercept(thing, propOrHandler, handler) {\n if (isFunction(handler)) {\n return interceptProperty(thing, propOrHandler, handler);\n } else {\n return interceptInterceptable(thing, propOrHandler);\n }\n}\nfunction interceptInterceptable(thing, handler) {\n return getAdministration(thing).intercept_(handler);\n}\nfunction interceptProperty(thing, property, handler) {\n return getAdministration(thing, property).intercept_(handler);\n}\n\nfunction _isComputed(value, property) {\n if (property === undefined) {\n return isComputedValue(value);\n }\n if (isObservableObject(value) === false) {\n return false;\n }\n if (!value[$mobx].values_.has(property)) {\n return false;\n }\n var atom = getAtom(value, property);\n return isComputedValue(atom);\n}\nfunction isComputed(value) {\n if ( true && arguments.length > 1) {\n return die(\"isComputed expects only 1 argument. Use isComputedProp to inspect the observability of a property\");\n }\n return _isComputed(value);\n}\nfunction isComputedProp(value, propName) {\n if ( true && !isStringish(propName)) {\n return die(\"isComputed expected a property name as second argument\");\n }\n return _isComputed(value, propName);\n}\n\nfunction _isObservable(value, property) {\n if (!value) {\n return false;\n }\n if (property !== undefined) {\n if ( true && (isObservableMap(value) || isObservableArray(value))) {\n return die(\"isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead.\");\n }\n if (isObservableObject(value)) {\n return value[$mobx].values_.has(property);\n }\n return false;\n }\n // For first check, see #701\n return isObservableObject(value) || !!value[$mobx] || isAtom(value) || isReaction(value) || isComputedValue(value);\n}\nfunction isObservable(value) {\n if ( true && arguments.length !== 1) {\n die(\"isObservable expects only 1 argument. Use isObservableProp to inspect the observability of a property\");\n }\n return _isObservable(value);\n}\nfunction isObservableProp(value, propName) {\n if ( true && !isStringish(propName)) {\n return die(\"expected a property name as second argument\");\n }\n return _isObservable(value, propName);\n}\n\nfunction keys(obj) {\n if (isObservableObject(obj)) {\n return obj[$mobx].keys_();\n }\n if (isObservableMap(obj) || isObservableSet(obj)) {\n return Array.from(obj.keys());\n }\n if (isObservableArray(obj)) {\n return obj.map(function (_, index) {\n return index;\n });\n }\n die(5);\n}\nfunction values(obj) {\n if (isObservableObject(obj)) {\n return keys(obj).map(function (key) {\n return obj[key];\n });\n }\n if (isObservableMap(obj)) {\n return keys(obj).map(function (key) {\n return obj.get(key);\n });\n }\n if (isObservableSet(obj)) {\n return Array.from(obj.values());\n }\n if (isObservableArray(obj)) {\n return obj.slice();\n }\n die(6);\n}\nfunction entries(obj) {\n if (isObservableObject(obj)) {\n return keys(obj).map(function (key) {\n return [key, obj[key]];\n });\n }\n if (isObservableMap(obj)) {\n return keys(obj).map(function (key) {\n return [key, obj.get(key)];\n });\n }\n if (isObservableSet(obj)) {\n return Array.from(obj.entries());\n }\n if (isObservableArray(obj)) {\n return obj.map(function (key, index) {\n return [index, key];\n });\n }\n die(7);\n}\nfunction set(obj, key, value) {\n if (arguments.length === 2 && !isObservableSet(obj)) {\n startBatch();\n var _values = key;\n try {\n for (var _key in _values) {\n set(obj, _key, _values[_key]);\n }\n } finally {\n endBatch();\n }\n return;\n }\n if (isObservableObject(obj)) {\n obj[$mobx].set_(key, value);\n } else if (isObservableMap(obj)) {\n obj.set(key, value);\n } else if (isObservableSet(obj)) {\n obj.add(key);\n } else if (isObservableArray(obj)) {\n if (typeof key !== \"number\") {\n key = parseInt(key, 10);\n }\n if (key < 0) {\n die(\"Invalid index: '\" + key + \"'\");\n }\n startBatch();\n if (key >= obj.length) {\n obj.length = key + 1;\n }\n obj[key] = value;\n endBatch();\n } else {\n die(8);\n }\n}\nfunction remove(obj, key) {\n if (isObservableObject(obj)) {\n obj[$mobx].delete_(key);\n } else if (isObservableMap(obj)) {\n obj[\"delete\"](key);\n } else if (isObservableSet(obj)) {\n obj[\"delete\"](key);\n } else if (isObservableArray(obj)) {\n if (typeof key !== \"number\") {\n key = parseInt(key, 10);\n }\n obj.splice(key, 1);\n } else {\n die(9);\n }\n}\nfunction has(obj, key) {\n if (isObservableObject(obj)) {\n return obj[$mobx].has_(key);\n } else if (isObservableMap(obj)) {\n return obj.has(key);\n } else if (isObservableSet(obj)) {\n return obj.has(key);\n } else if (isObservableArray(obj)) {\n return key >= 0 && key < obj.length;\n }\n die(10);\n}\nfunction get(obj, key) {\n if (!has(obj, key)) {\n return undefined;\n }\n if (isObservableObject(obj)) {\n return obj[$mobx].get_(key);\n } else if (isObservableMap(obj)) {\n return obj.get(key);\n } else if (isObservableArray(obj)) {\n return obj[key];\n }\n die(11);\n}\nfunction apiDefineProperty(obj, key, descriptor) {\n if (isObservableObject(obj)) {\n return obj[$mobx].defineProperty_(key, descriptor);\n }\n die(39);\n}\nfunction apiOwnKeys(obj) {\n if (isObservableObject(obj)) {\n return obj[$mobx].ownKeys_();\n }\n die(38);\n}\n\nfunction observe(thing, propOrCb, cbOrFire, fireImmediately) {\n if (isFunction(cbOrFire)) {\n return observeObservableProperty(thing, propOrCb, cbOrFire, fireImmediately);\n } else {\n return observeObservable(thing, propOrCb, cbOrFire);\n }\n}\nfunction observeObservable(thing, listener, fireImmediately) {\n return getAdministration(thing).observe_(listener, fireImmediately);\n}\nfunction observeObservableProperty(thing, property, listener, fireImmediately) {\n return getAdministration(thing, property).observe_(listener, fireImmediately);\n}\n\nfunction cache(map, key, value) {\n map.set(key, value);\n return value;\n}\nfunction toJSHelper(source, __alreadySeen) {\n if (source == null || typeof source !== \"object\" || source instanceof Date || !isObservable(source)) {\n return source;\n }\n if (isObservableValue(source) || isComputedValue(source)) {\n return toJSHelper(source.get(), __alreadySeen);\n }\n if (__alreadySeen.has(source)) {\n return __alreadySeen.get(source);\n }\n if (isObservableArray(source)) {\n var res = cache(__alreadySeen, source, new Array(source.length));\n source.forEach(function (value, idx) {\n res[idx] = toJSHelper(value, __alreadySeen);\n });\n return res;\n }\n if (isObservableSet(source)) {\n var _res = cache(__alreadySeen, source, new Set());\n source.forEach(function (value) {\n _res.add(toJSHelper(value, __alreadySeen));\n });\n return _res;\n }\n if (isObservableMap(source)) {\n var _res2 = cache(__alreadySeen, source, new Map());\n source.forEach(function (value, key) {\n _res2.set(key, toJSHelper(value, __alreadySeen));\n });\n return _res2;\n } else {\n // must be observable object\n var _res3 = cache(__alreadySeen, source, {});\n apiOwnKeys(source).forEach(function (key) {\n if (objectPrototype.propertyIsEnumerable.call(source, key)) {\n _res3[key] = toJSHelper(source[key], __alreadySeen);\n }\n });\n return _res3;\n }\n}\n/**\n * Recursively converts an observable to it's non-observable native counterpart.\n * It does NOT recurse into non-observables, these are left as they are, even if they contain observables.\n * Computed and other non-enumerable properties are completely ignored.\n * Complex scenarios require custom solution, eg implementing `toJSON` or using `serializr` lib.\n */\nfunction toJS(source, options) {\n if ( true && options) {\n die(\"toJS no longer supports options\");\n }\n return toJSHelper(source, new Map());\n}\n\nfunction trace() {\n if (false) {}\n var enterBreakPoint = false;\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n if (typeof args[args.length - 1] === \"boolean\") {\n enterBreakPoint = args.pop();\n }\n var derivation = getAtomFromArgs(args);\n if (!derivation) {\n return die(\"'trace(break?)' can only be used inside a tracked computed value or a Reaction. Consider passing in the computed value or reaction explicitly\");\n }\n if (derivation.isTracing_ === TraceMode.NONE) {\n console.log(\"[mobx.trace] '\" + derivation.name_ + \"' tracing enabled\");\n }\n derivation.isTracing_ = enterBreakPoint ? TraceMode.BREAK : TraceMode.LOG;\n}\nfunction getAtomFromArgs(args) {\n switch (args.length) {\n case 0:\n return globalState.trackingDerivation;\n case 1:\n return getAtom(args[0]);\n case 2:\n return getAtom(args[0], args[1]);\n }\n}\n\n/**\n * During a transaction no views are updated until the end of the transaction.\n * The transaction will be run synchronously nonetheless.\n *\n * @param action a function that updates some reactive state\n * @returns any value that was returned by the 'action' parameter.\n */\nfunction transaction(action, thisArg) {\n if (thisArg === void 0) {\n thisArg = undefined;\n }\n startBatch();\n try {\n return action.apply(thisArg);\n } finally {\n endBatch();\n }\n}\n\nfunction when(predicate, arg1, arg2) {\n if (arguments.length === 1 || arg1 && typeof arg1 === \"object\") {\n return whenPromise(predicate, arg1);\n }\n return _when(predicate, arg1, arg2 || {});\n}\nfunction _when(predicate, effect, opts) {\n var timeoutHandle;\n if (typeof opts.timeout === \"number\") {\n var error = new Error(\"WHEN_TIMEOUT\");\n timeoutHandle = setTimeout(function () {\n if (!disposer[$mobx].isDisposed) {\n disposer();\n if (opts.onError) {\n opts.onError(error);\n } else {\n throw error;\n }\n }\n }, opts.timeout);\n }\n opts.name = true ? opts.name || \"When@\" + getNextId() : 0;\n var effectAction = createAction( true ? opts.name + \"-effect\" : 0, effect);\n // eslint-disable-next-line\n var disposer = autorun(function (r) {\n // predicate should not change state\n var cond = allowStateChanges(false, predicate);\n if (cond) {\n r.dispose();\n if (timeoutHandle) {\n clearTimeout(timeoutHandle);\n }\n effectAction();\n }\n }, opts);\n return disposer;\n}\nfunction whenPromise(predicate, opts) {\n var _opts$signal;\n if ( true && opts && opts.onError) {\n return die(\"the options 'onError' and 'promise' cannot be combined\");\n }\n if (opts != null && (_opts$signal = opts.signal) != null && _opts$signal.aborted) {\n return Object.assign(Promise.reject(new Error(\"WHEN_ABORTED\")), {\n cancel: function cancel() {\n return null;\n }\n });\n }\n var cancel;\n var abort;\n var res = new Promise(function (resolve, reject) {\n var _opts$signal2;\n var disposer = _when(predicate, resolve, _extends({}, opts, {\n onError: reject\n }));\n cancel = function cancel() {\n disposer();\n reject(new Error(\"WHEN_CANCELLED\"));\n };\n abort = function abort() {\n disposer();\n reject(new Error(\"WHEN_ABORTED\"));\n };\n opts == null || (_opts$signal2 = opts.signal) == null || _opts$signal2.addEventListener == null || _opts$signal2.addEventListener(\"abort\", abort);\n })[\"finally\"](function () {\n var _opts$signal3;\n return opts == null || (_opts$signal3 = opts.signal) == null || _opts$signal3.removeEventListener == null ? void 0 : _opts$signal3.removeEventListener(\"abort\", abort);\n });\n res.cancel = cancel;\n return res;\n}\n\nfunction getAdm(target) {\n return target[$mobx];\n}\n// Optimization: we don't need the intermediate objects and could have a completely custom administration for DynamicObjects,\n// and skip either the internal values map, or the base object with its property descriptors!\nvar objectProxyTraps = {\n has: function has(target, name) {\n if ( true && globalState.trackingDerivation) {\n warnAboutProxyRequirement(\"detect new properties using the 'in' operator. Use 'has' from 'mobx' instead.\");\n }\n return getAdm(target).has_(name);\n },\n get: function get(target, name) {\n return getAdm(target).get_(name);\n },\n set: function set(target, name, value) {\n var _getAdm$set_;\n if (!isStringish(name)) {\n return false;\n }\n if ( true && !getAdm(target).values_.has(name)) {\n warnAboutProxyRequirement(\"add a new observable property through direct assignment. Use 'set' from 'mobx' instead.\");\n }\n // null (intercepted) -> true (success)\n return (_getAdm$set_ = getAdm(target).set_(name, value, true)) != null ? _getAdm$set_ : true;\n },\n deleteProperty: function deleteProperty(target, name) {\n var _getAdm$delete_;\n if (true) {\n warnAboutProxyRequirement(\"delete properties from an observable object. Use 'remove' from 'mobx' instead.\");\n }\n if (!isStringish(name)) {\n return false;\n }\n // null (intercepted) -> true (success)\n return (_getAdm$delete_ = getAdm(target).delete_(name, true)) != null ? _getAdm$delete_ : true;\n },\n defineProperty: function defineProperty(target, name, descriptor) {\n var _getAdm$definePropert;\n if (true) {\n warnAboutProxyRequirement(\"define property on an observable object. Use 'defineProperty' from 'mobx' instead.\");\n }\n // null (intercepted) -> true (success)\n return (_getAdm$definePropert = getAdm(target).defineProperty_(name, descriptor)) != null ? _getAdm$definePropert : true;\n },\n ownKeys: function ownKeys(target) {\n if ( true && globalState.trackingDerivation) {\n warnAboutProxyRequirement(\"iterate keys to detect added / removed properties. Use 'keys' from 'mobx' instead.\");\n }\n return getAdm(target).ownKeys_();\n },\n preventExtensions: function preventExtensions(target) {\n die(13);\n }\n};\nfunction asDynamicObservableObject(target, options) {\n var _target$$mobx, _target$$mobx$proxy_;\n assertProxies();\n target = asObservableObject(target, options);\n return (_target$$mobx$proxy_ = (_target$$mobx = target[$mobx]).proxy_) != null ? _target$$mobx$proxy_ : _target$$mobx.proxy_ = new Proxy(target, objectProxyTraps);\n}\n\nfunction hasInterceptors(interceptable) {\n return interceptable.interceptors_ !== undefined && interceptable.interceptors_.length > 0;\n}\nfunction registerInterceptor(interceptable, handler) {\n var interceptors = interceptable.interceptors_ || (interceptable.interceptors_ = []);\n interceptors.push(handler);\n return once(function () {\n var idx = interceptors.indexOf(handler);\n if (idx !== -1) {\n interceptors.splice(idx, 1);\n }\n });\n}\nfunction interceptChange(interceptable, change) {\n var prevU = untrackedStart();\n try {\n // Interceptor can modify the array, copy it to avoid concurrent modification, see #1950\n var interceptors = [].concat(interceptable.interceptors_ || []);\n for (var i = 0, l = interceptors.length; i < l; i++) {\n change = interceptors[i](change);\n if (change && !change.type) {\n die(14);\n }\n if (!change) {\n break;\n }\n }\n return change;\n } finally {\n untrackedEnd(prevU);\n }\n}\n\nfunction hasListeners(listenable) {\n return listenable.changeListeners_ !== undefined && listenable.changeListeners_.length > 0;\n}\nfunction registerListener(listenable, handler) {\n var listeners = listenable.changeListeners_ || (listenable.changeListeners_ = []);\n listeners.push(handler);\n return once(function () {\n var idx = listeners.indexOf(handler);\n if (idx !== -1) {\n listeners.splice(idx, 1);\n }\n });\n}\nfunction notifyListeners(listenable, change) {\n var prevU = untrackedStart();\n var listeners = listenable.changeListeners_;\n if (!listeners) {\n return;\n }\n listeners = listeners.slice();\n for (var i = 0, l = listeners.length; i < l; i++) {\n listeners[i](change);\n }\n untrackedEnd(prevU);\n}\n\nfunction makeObservable(target, annotations, options) {\n initObservable(function () {\n var _annotations;\n var adm = asObservableObject(target, options)[$mobx];\n if ( true && annotations && target[storedAnnotationsSymbol]) {\n die(\"makeObservable second arg must be nullish when using decorators. Mixing @decorator syntax with annotations is not supported.\");\n }\n // Default to decorators\n (_annotations = annotations) != null ? _annotations : annotations = collectStoredAnnotations(target);\n // Annotate\n ownKeys(annotations).forEach(function (key) {\n return adm.make_(key, annotations[key]);\n });\n });\n return target;\n}\n// proto[keysSymbol] = new Set()\nvar keysSymbol = /*#__PURE__*/Symbol(\"mobx-keys\");\nfunction makeAutoObservable(target, overrides, options) {\n if (true) {\n if (!isPlainObject(target) && !isPlainObject(Object.getPrototypeOf(target))) {\n die(\"'makeAutoObservable' can only be used for classes that don't have a superclass\");\n }\n if (isObservableObject(target)) {\n die(\"makeAutoObservable can only be used on objects not already made observable\");\n }\n }\n // Optimization: avoid visiting protos\n // Assumes that annotation.make_/.extend_ works the same for plain objects\n if (isPlainObject(target)) {\n return extendObservable(target, target, overrides, options);\n }\n initObservable(function () {\n var adm = asObservableObject(target, options)[$mobx];\n // Optimization: cache keys on proto\n // Assumes makeAutoObservable can be called only once per object and can't be used in subclass\n if (!target[keysSymbol]) {\n var proto = Object.getPrototypeOf(target);\n var keys = new Set([].concat(ownKeys(target), ownKeys(proto)));\n keys[\"delete\"](\"constructor\");\n keys[\"delete\"]($mobx);\n addHiddenProp(proto, keysSymbol, keys);\n }\n target[keysSymbol].forEach(function (key) {\n return adm.make_(key,\n // must pass \"undefined\" for { key: undefined }\n !overrides ? true : key in overrides ? overrides[key] : true);\n });\n });\n return target;\n}\n\nvar SPLICE = \"splice\";\nvar UPDATE = \"update\";\nvar MAX_SPLICE_SIZE = 10000; // See e.g. https://github.com/mobxjs/mobx/issues/859\nvar arrayTraps = {\n get: function get(target, name) {\n var adm = target[$mobx];\n if (name === $mobx) {\n return adm;\n }\n if (name === \"length\") {\n return adm.getArrayLength_();\n }\n if (typeof name === \"string\" && !isNaN(name)) {\n return adm.get_(parseInt(name));\n }\n if (hasProp(arrayExtensions, name)) {\n return arrayExtensions[name];\n }\n return target[name];\n },\n set: function set(target, name, value) {\n var adm = target[$mobx];\n if (name === \"length\") {\n adm.setArrayLength_(value);\n }\n if (typeof name === \"symbol\" || isNaN(name)) {\n target[name] = value;\n } else {\n // numeric string\n adm.set_(parseInt(name), value);\n }\n return true;\n },\n preventExtensions: function preventExtensions() {\n die(15);\n }\n};\nvar ObservableArrayAdministration = /*#__PURE__*/function () {\n function ObservableArrayAdministration(name, enhancer, owned_, legacyMode_) {\n if (name === void 0) {\n name = true ? \"ObservableArray@\" + getNextId() : 0;\n }\n this.owned_ = void 0;\n this.legacyMode_ = void 0;\n this.atom_ = void 0;\n this.values_ = [];\n // this is the prop that gets proxied, so can't replace it!\n this.interceptors_ = void 0;\n this.changeListeners_ = void 0;\n this.enhancer_ = void 0;\n this.dehancer = void 0;\n this.proxy_ = void 0;\n this.lastKnownLength_ = 0;\n this.owned_ = owned_;\n this.legacyMode_ = legacyMode_;\n this.atom_ = new Atom(name);\n this.enhancer_ = function (newV, oldV) {\n return enhancer(newV, oldV, true ? name + \"[..]\" : 0);\n };\n }\n var _proto = ObservableArrayAdministration.prototype;\n _proto.dehanceValue_ = function dehanceValue_(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.dehanceValues_ = function dehanceValues_(values) {\n if (this.dehancer !== undefined && values.length > 0) {\n return values.map(this.dehancer);\n }\n return values;\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n if (fireImmediately === void 0) {\n fireImmediately = false;\n }\n if (fireImmediately) {\n listener({\n observableKind: \"array\",\n object: this.proxy_,\n debugObjectName: this.atom_.name_,\n type: \"splice\",\n index: 0,\n added: this.values_.slice(),\n addedCount: this.values_.length,\n removed: [],\n removedCount: 0\n });\n }\n return registerListener(this, listener);\n };\n _proto.getArrayLength_ = function getArrayLength_() {\n this.atom_.reportObserved();\n return this.values_.length;\n };\n _proto.setArrayLength_ = function setArrayLength_(newLength) {\n if (typeof newLength !== \"number\" || isNaN(newLength) || newLength < 0) {\n die(\"Out of range: \" + newLength);\n }\n var currentLength = this.values_.length;\n if (newLength === currentLength) {\n return;\n } else if (newLength > currentLength) {\n var newItems = new Array(newLength - currentLength);\n for (var i = 0; i < newLength - currentLength; i++) {\n newItems[i] = undefined;\n } // No Array.fill everywhere...\n this.spliceWithArray_(currentLength, 0, newItems);\n } else {\n this.spliceWithArray_(newLength, currentLength - newLength);\n }\n };\n _proto.updateArrayLength_ = function updateArrayLength_(oldLength, delta) {\n if (oldLength !== this.lastKnownLength_) {\n die(16);\n }\n this.lastKnownLength_ += delta;\n if (this.legacyMode_ && delta > 0) {\n reserveArrayBuffer(oldLength + delta + 1);\n }\n };\n _proto.spliceWithArray_ = function spliceWithArray_(index, deleteCount, newItems) {\n var _this = this;\n checkIfStateModificationsAreAllowed(this.atom_);\n var length = this.values_.length;\n if (index === undefined) {\n index = 0;\n } else if (index > length) {\n index = length;\n } else if (index < 0) {\n index = Math.max(0, length + index);\n }\n if (arguments.length === 1) {\n deleteCount = length - index;\n } else if (deleteCount === undefined || deleteCount === null) {\n deleteCount = 0;\n } else {\n deleteCount = Math.max(0, Math.min(deleteCount, length - index));\n }\n if (newItems === undefined) {\n newItems = EMPTY_ARRAY;\n }\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_,\n type: SPLICE,\n index: index,\n removedCount: deleteCount,\n added: newItems\n });\n if (!change) {\n return EMPTY_ARRAY;\n }\n deleteCount = change.removedCount;\n newItems = change.added;\n }\n newItems = newItems.length === 0 ? newItems : newItems.map(function (v) {\n return _this.enhancer_(v, undefined);\n });\n if (this.legacyMode_ || \"development\" !== \"production\") {\n var lengthDelta = newItems.length - deleteCount;\n this.updateArrayLength_(length, lengthDelta); // checks if internal array wasn't modified\n }\n var res = this.spliceItemsIntoValues_(index, deleteCount, newItems);\n if (deleteCount !== 0 || newItems.length !== 0) {\n this.notifyArraySplice_(index, newItems, res);\n }\n return this.dehanceValues_(res);\n };\n _proto.spliceItemsIntoValues_ = function spliceItemsIntoValues_(index, deleteCount, newItems) {\n if (newItems.length < MAX_SPLICE_SIZE) {\n var _this$values_;\n return (_this$values_ = this.values_).splice.apply(_this$values_, [index, deleteCount].concat(newItems));\n } else {\n // The items removed by the splice\n var res = this.values_.slice(index, index + deleteCount);\n // The items that that should remain at the end of the array\n var oldItems = this.values_.slice(index + deleteCount);\n // New length is the previous length + addition count - deletion count\n this.values_.length += newItems.length - deleteCount;\n for (var i = 0; i < newItems.length; i++) {\n this.values_[index + i] = newItems[i];\n }\n for (var _i = 0; _i < oldItems.length; _i++) {\n this.values_[index + newItems.length + _i] = oldItems[_i];\n }\n return res;\n }\n };\n _proto.notifyArrayChildUpdate_ = function notifyArrayChildUpdate_(index, newValue, oldValue) {\n var notifySpy = !this.owned_ && isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"array\",\n object: this.proxy_,\n type: UPDATE,\n debugObjectName: this.atom_.name_,\n index: index,\n newValue: newValue,\n oldValue: oldValue\n } : null;\n // The reason why this is on right hand side here (and not above), is this way the uglifier will drop it, but it won't\n // cause any runtime overhead in development mode without NODE_ENV set, unless spying is enabled\n if ( true && notifySpy) {\n spyReportStart(change);\n }\n this.atom_.reportChanged();\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n };\n _proto.notifyArraySplice_ = function notifyArraySplice_(index, added, removed) {\n var notifySpy = !this.owned_ && isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"array\",\n object: this.proxy_,\n debugObjectName: this.atom_.name_,\n type: SPLICE,\n index: index,\n removed: removed,\n added: added,\n removedCount: removed.length,\n addedCount: added.length\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n }\n this.atom_.reportChanged();\n // conform: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/observe\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n };\n _proto.get_ = function get_(index) {\n if (this.legacyMode_ && index >= this.values_.length) {\n console.warn( true ? \"[mobx.array] Attempt to read an array index (\" + index + \") that is out of bounds (\" + this.values_.length + \"). Please check length first. Out of bound indices will not be tracked by MobX\" : 0);\n return undefined;\n }\n this.atom_.reportObserved();\n return this.dehanceValue_(this.values_[index]);\n };\n _proto.set_ = function set_(index, newValue) {\n var values = this.values_;\n if (this.legacyMode_ && index > values.length) {\n // out of bounds\n die(17, index, values.length);\n }\n if (index < values.length) {\n // update at index in range\n checkIfStateModificationsAreAllowed(this.atom_);\n var oldValue = values[index];\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: UPDATE,\n object: this.proxy_,\n // since \"this\" is the real array we need to pass its proxy\n index: index,\n newValue: newValue\n });\n if (!change) {\n return;\n }\n newValue = change.newValue;\n }\n newValue = this.enhancer_(newValue, oldValue);\n var changed = newValue !== oldValue;\n if (changed) {\n values[index] = newValue;\n this.notifyArrayChildUpdate_(index, newValue, oldValue);\n }\n } else {\n // For out of bound index, we don't create an actual sparse array,\n // but rather fill the holes with undefined (same as setArrayLength_).\n // This could be considered a bug.\n var newItems = new Array(index + 1 - values.length);\n for (var i = 0; i < newItems.length - 1; i++) {\n newItems[i] = undefined;\n } // No Array.fill everywhere...\n newItems[newItems.length - 1] = newValue;\n this.spliceWithArray_(values.length, 0, newItems);\n }\n };\n return ObservableArrayAdministration;\n}();\nfunction createObservableArray(initialValues, enhancer, name, owned) {\n if (name === void 0) {\n name = true ? \"ObservableArray@\" + getNextId() : 0;\n }\n if (owned === void 0) {\n owned = false;\n }\n assertProxies();\n return initObservable(function () {\n var adm = new ObservableArrayAdministration(name, enhancer, owned, false);\n addHiddenFinalProp(adm.values_, $mobx, adm);\n var proxy = new Proxy(adm.values_, arrayTraps);\n adm.proxy_ = proxy;\n if (initialValues && initialValues.length) {\n adm.spliceWithArray_(0, 0, initialValues);\n }\n return proxy;\n });\n}\n// eslint-disable-next-line\nvar arrayExtensions = {\n clear: function clear() {\n return this.splice(0);\n },\n replace: function replace(newItems) {\n var adm = this[$mobx];\n return adm.spliceWithArray_(0, adm.values_.length, newItems);\n },\n // Used by JSON.stringify\n toJSON: function toJSON() {\n return this.slice();\n },\n /*\n * functions that do alter the internal structure of the array, (based on lib.es6.d.ts)\n * since these functions alter the inner structure of the array, the have side effects.\n * Because the have side effects, they should not be used in computed function,\n * and for that reason the do not call dependencyState.notifyObserved\n */\n splice: function splice(index, deleteCount) {\n for (var _len = arguments.length, newItems = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {\n newItems[_key - 2] = arguments[_key];\n }\n var adm = this[$mobx];\n switch (arguments.length) {\n case 0:\n return [];\n case 1:\n return adm.spliceWithArray_(index);\n case 2:\n return adm.spliceWithArray_(index, deleteCount);\n }\n return adm.spliceWithArray_(index, deleteCount, newItems);\n },\n spliceWithArray: function spliceWithArray(index, deleteCount, newItems) {\n return this[$mobx].spliceWithArray_(index, deleteCount, newItems);\n },\n push: function push() {\n var adm = this[$mobx];\n for (var _len2 = arguments.length, items = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n items[_key2] = arguments[_key2];\n }\n adm.spliceWithArray_(adm.values_.length, 0, items);\n return adm.values_.length;\n },\n pop: function pop() {\n return this.splice(Math.max(this[$mobx].values_.length - 1, 0), 1)[0];\n },\n shift: function shift() {\n return this.splice(0, 1)[0];\n },\n unshift: function unshift() {\n var adm = this[$mobx];\n for (var _len3 = arguments.length, items = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n items[_key3] = arguments[_key3];\n }\n adm.spliceWithArray_(0, 0, items);\n return adm.values_.length;\n },\n reverse: function reverse() {\n // reverse by default mutates in place before returning the result\n // which makes it both a 'derivation' and a 'mutation'.\n if (globalState.trackingDerivation) {\n die(37, \"reverse\");\n }\n this.replace(this.slice().reverse());\n return this;\n },\n sort: function sort() {\n // sort by default mutates in place before returning the result\n // which goes against all good practices. Let's not change the array in place!\n if (globalState.trackingDerivation) {\n die(37, \"sort\");\n }\n var copy = this.slice();\n copy.sort.apply(copy, arguments);\n this.replace(copy);\n return this;\n },\n remove: function remove(value) {\n var adm = this[$mobx];\n var idx = adm.dehanceValues_(adm.values_).indexOf(value);\n if (idx > -1) {\n this.splice(idx, 1);\n return true;\n }\n return false;\n }\n};\n/**\n * Wrap function from prototype\n * Without this, everything works as well, but this works\n * faster as everything works on unproxied values\n */\naddArrayExtension(\"at\", simpleFunc);\naddArrayExtension(\"concat\", simpleFunc);\naddArrayExtension(\"flat\", simpleFunc);\naddArrayExtension(\"includes\", simpleFunc);\naddArrayExtension(\"indexOf\", simpleFunc);\naddArrayExtension(\"join\", simpleFunc);\naddArrayExtension(\"lastIndexOf\", simpleFunc);\naddArrayExtension(\"slice\", simpleFunc);\naddArrayExtension(\"toString\", simpleFunc);\naddArrayExtension(\"toLocaleString\", simpleFunc);\naddArrayExtension(\"toSorted\", simpleFunc);\naddArrayExtension(\"toSpliced\", simpleFunc);\naddArrayExtension(\"with\", simpleFunc);\n// map\naddArrayExtension(\"every\", mapLikeFunc);\naddArrayExtension(\"filter\", mapLikeFunc);\naddArrayExtension(\"find\", mapLikeFunc);\naddArrayExtension(\"findIndex\", mapLikeFunc);\naddArrayExtension(\"findLast\", mapLikeFunc);\naddArrayExtension(\"findLastIndex\", mapLikeFunc);\naddArrayExtension(\"flatMap\", mapLikeFunc);\naddArrayExtension(\"forEach\", mapLikeFunc);\naddArrayExtension(\"map\", mapLikeFunc);\naddArrayExtension(\"some\", mapLikeFunc);\naddArrayExtension(\"toReversed\", mapLikeFunc);\n// reduce\naddArrayExtension(\"reduce\", reduceLikeFunc);\naddArrayExtension(\"reduceRight\", reduceLikeFunc);\nfunction addArrayExtension(funcName, funcFactory) {\n if (typeof Array.prototype[funcName] === \"function\") {\n arrayExtensions[funcName] = funcFactory(funcName);\n }\n}\n// Report and delegate to dehanced array\nfunction simpleFunc(funcName) {\n return function () {\n var adm = this[$mobx];\n adm.atom_.reportObserved();\n var dehancedValues = adm.dehanceValues_(adm.values_);\n return dehancedValues[funcName].apply(dehancedValues, arguments);\n };\n}\n// Make sure callbacks receive correct array arg #2326\nfunction mapLikeFunc(funcName) {\n return function (callback, thisArg) {\n var _this2 = this;\n var adm = this[$mobx];\n adm.atom_.reportObserved();\n var dehancedValues = adm.dehanceValues_(adm.values_);\n return dehancedValues[funcName](function (element, index) {\n return callback.call(thisArg, element, index, _this2);\n });\n };\n}\n// Make sure callbacks receive correct array arg #2326\nfunction reduceLikeFunc(funcName) {\n return function () {\n var _this3 = this;\n var adm = this[$mobx];\n adm.atom_.reportObserved();\n var dehancedValues = adm.dehanceValues_(adm.values_);\n // #2432 - reduce behavior depends on arguments.length\n var callback = arguments[0];\n arguments[0] = function (accumulator, currentValue, index) {\n return callback(accumulator, currentValue, index, _this3);\n };\n return dehancedValues[funcName].apply(dehancedValues, arguments);\n };\n}\nvar isObservableArrayAdministration = /*#__PURE__*/createInstanceofPredicate(\"ObservableArrayAdministration\", ObservableArrayAdministration);\nfunction isObservableArray(thing) {\n return isObject(thing) && isObservableArrayAdministration(thing[$mobx]);\n}\n\nvar ObservableMapMarker = {};\nvar ADD = \"add\";\nvar DELETE = \"delete\";\n// just extend Map? See also https://gist.github.com/nestharus/13b4d74f2ef4a2f4357dbd3fc23c1e54\n// But: https://github.com/mobxjs/mobx/issues/1556\nvar ObservableMap = /*#__PURE__*/function () {\n function ObservableMap(initialData, enhancer_, name_) {\n var _this = this;\n if (enhancer_ === void 0) {\n enhancer_ = deepEnhancer;\n }\n if (name_ === void 0) {\n name_ = true ? \"ObservableMap@\" + getNextId() : 0;\n }\n this.enhancer_ = void 0;\n this.name_ = void 0;\n this[$mobx] = ObservableMapMarker;\n this.data_ = void 0;\n this.hasMap_ = void 0;\n // hasMap, not hashMap >-).\n this.keysAtom_ = void 0;\n this.interceptors_ = void 0;\n this.changeListeners_ = void 0;\n this.dehancer = void 0;\n this.enhancer_ = enhancer_;\n this.name_ = name_;\n if (!isFunction(Map)) {\n die(18);\n }\n initObservable(function () {\n _this.keysAtom_ = createAtom( true ? _this.name_ + \".keys()\" : 0);\n _this.data_ = new Map();\n _this.hasMap_ = new Map();\n if (initialData) {\n _this.merge(initialData);\n }\n });\n }\n var _proto = ObservableMap.prototype;\n _proto.has_ = function has_(key) {\n return this.data_.has(key);\n };\n _proto.has = function has(key) {\n var _this2 = this;\n if (!globalState.trackingDerivation) {\n return this.has_(key);\n }\n var entry = this.hasMap_.get(key);\n if (!entry) {\n var newEntry = entry = new ObservableValue(this.has_(key), referenceEnhancer, true ? this.name_ + \".\" + stringifyKey(key) + \"?\" : 0, false);\n this.hasMap_.set(key, newEntry);\n onBecomeUnobserved(newEntry, function () {\n return _this2.hasMap_[\"delete\"](key);\n });\n }\n return entry.get();\n };\n _proto.set = function set(key, value) {\n var hasKey = this.has_(key);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: hasKey ? UPDATE : ADD,\n object: this,\n newValue: value,\n name: key\n });\n if (!change) {\n return this;\n }\n value = change.newValue;\n }\n if (hasKey) {\n this.updateValue_(key, value);\n } else {\n this.addValue_(key, value);\n }\n return this;\n };\n _proto[\"delete\"] = function _delete(key) {\n var _this3 = this;\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: DELETE,\n object: this,\n name: key\n });\n if (!change) {\n return false;\n }\n }\n if (this.has_(key)) {\n var notifySpy = isSpyEnabled();\n var notify = hasListeners(this);\n var _change = notify || notifySpy ? {\n observableKind: \"map\",\n debugObjectName: this.name_,\n type: DELETE,\n object: this,\n oldValue: this.data_.get(key).value_,\n name: key\n } : null;\n if ( true && notifySpy) {\n spyReportStart(_change);\n } // TODO fix type\n transaction(function () {\n var _this3$hasMap_$get;\n _this3.keysAtom_.reportChanged();\n (_this3$hasMap_$get = _this3.hasMap_.get(key)) == null || _this3$hasMap_$get.setNewValue_(false);\n var observable = _this3.data_.get(key);\n observable.setNewValue_(undefined);\n _this3.data_[\"delete\"](key);\n });\n if (notify) {\n notifyListeners(this, _change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n return true;\n }\n return false;\n };\n _proto.updateValue_ = function updateValue_(key, newValue) {\n var observable = this.data_.get(key);\n newValue = observable.prepareNewValue_(newValue);\n if (newValue !== globalState.UNCHANGED) {\n var notifySpy = isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"map\",\n debugObjectName: this.name_,\n type: UPDATE,\n object: this,\n oldValue: observable.value_,\n name: key,\n newValue: newValue\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n } // TODO fix type\n observable.setNewValue_(newValue);\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n };\n _proto.addValue_ = function addValue_(key, newValue) {\n var _this4 = this;\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n transaction(function () {\n var _this4$hasMap_$get;\n var observable = new ObservableValue(newValue, _this4.enhancer_, true ? _this4.name_ + \".\" + stringifyKey(key) : 0, false);\n _this4.data_.set(key, observable);\n newValue = observable.value_; // value might have been changed\n (_this4$hasMap_$get = _this4.hasMap_.get(key)) == null || _this4$hasMap_$get.setNewValue_(true);\n _this4.keysAtom_.reportChanged();\n });\n var notifySpy = isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"map\",\n debugObjectName: this.name_,\n type: ADD,\n object: this,\n name: key,\n newValue: newValue\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n } // TODO fix type\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n };\n _proto.get = function get(key) {\n if (this.has(key)) {\n return this.dehanceValue_(this.data_.get(key).get());\n }\n return this.dehanceValue_(undefined);\n };\n _proto.dehanceValue_ = function dehanceValue_(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.keys = function keys() {\n this.keysAtom_.reportObserved();\n return this.data_.keys();\n };\n _proto.values = function values() {\n var self = this;\n var keys = this.keys();\n return makeIterable({\n next: function next() {\n var _keys$next = keys.next(),\n done = _keys$next.done,\n value = _keys$next.value;\n return {\n done: done,\n value: done ? undefined : self.get(value)\n };\n }\n });\n };\n _proto.entries = function entries() {\n var self = this;\n var keys = this.keys();\n return makeIterable({\n next: function next() {\n var _keys$next2 = keys.next(),\n done = _keys$next2.done,\n value = _keys$next2.value;\n return {\n done: done,\n value: done ? undefined : [value, self.get(value)]\n };\n }\n });\n };\n _proto[Symbol.iterator] = function () {\n return this.entries();\n };\n _proto.forEach = function forEach(callback, thisArg) {\n for (var _iterator = _createForOfIteratorHelperLoose(this), _step; !(_step = _iterator()).done;) {\n var _step$value = _step.value,\n key = _step$value[0],\n value = _step$value[1];\n callback.call(thisArg, value, key, this);\n }\n }\n /** Merge another object into this object, returns this. */;\n _proto.merge = function merge(other) {\n var _this5 = this;\n if (isObservableMap(other)) {\n other = new Map(other);\n }\n transaction(function () {\n if (isPlainObject(other)) {\n getPlainObjectKeys(other).forEach(function (key) {\n return _this5.set(key, other[key]);\n });\n } else if (Array.isArray(other)) {\n other.forEach(function (_ref) {\n var key = _ref[0],\n value = _ref[1];\n return _this5.set(key, value);\n });\n } else if (isES6Map(other)) {\n if (!isPlainES6Map(other)) {\n die(19, other);\n }\n other.forEach(function (value, key) {\n return _this5.set(key, value);\n });\n } else if (other !== null && other !== undefined) {\n die(20, other);\n }\n });\n return this;\n };\n _proto.clear = function clear() {\n var _this6 = this;\n transaction(function () {\n untracked(function () {\n for (var _iterator2 = _createForOfIteratorHelperLoose(_this6.keys()), _step2; !(_step2 = _iterator2()).done;) {\n var key = _step2.value;\n _this6[\"delete\"](key);\n }\n });\n });\n };\n _proto.replace = function replace(values) {\n var _this7 = this;\n // Implementation requirements:\n // - respect ordering of replacement map\n // - allow interceptors to run and potentially prevent individual operations\n // - don't recreate observables that already exist in original map (so we don't destroy existing subscriptions)\n // - don't _keysAtom.reportChanged if the keys of resulting map are indentical (order matters!)\n // - note that result map may differ from replacement map due to the interceptors\n transaction(function () {\n // Convert to map so we can do quick key lookups\n var replacementMap = convertToMap(values);\n var orderedData = new Map();\n // Used for optimization\n var keysReportChangedCalled = false;\n // Delete keys that don't exist in replacement map\n // if the key deletion is prevented by interceptor\n // add entry at the beginning of the result map\n for (var _iterator3 = _createForOfIteratorHelperLoose(_this7.data_.keys()), _step3; !(_step3 = _iterator3()).done;) {\n var key = _step3.value;\n // Concurrently iterating/deleting keys\n // iterator should handle this correctly\n if (!replacementMap.has(key)) {\n var deleted = _this7[\"delete\"](key);\n // Was the key removed?\n if (deleted) {\n // _keysAtom.reportChanged() was already called\n keysReportChangedCalled = true;\n } else {\n // Delete prevented by interceptor\n var value = _this7.data_.get(key);\n orderedData.set(key, value);\n }\n }\n }\n // Merge entries\n for (var _iterator4 = _createForOfIteratorHelperLoose(replacementMap.entries()), _step4; !(_step4 = _iterator4()).done;) {\n var _step4$value = _step4.value,\n _key = _step4$value[0],\n _value = _step4$value[1];\n // We will want to know whether a new key is added\n var keyExisted = _this7.data_.has(_key);\n // Add or update value\n _this7.set(_key, _value);\n // The addition could have been prevent by interceptor\n if (_this7.data_.has(_key)) {\n // The update could have been prevented by interceptor\n // and also we want to preserve existing values\n // so use value from _data map (instead of replacement map)\n var _value2 = _this7.data_.get(_key);\n orderedData.set(_key, _value2);\n // Was a new key added?\n if (!keyExisted) {\n // _keysAtom.reportChanged() was already called\n keysReportChangedCalled = true;\n }\n }\n }\n // Check for possible key order change\n if (!keysReportChangedCalled) {\n if (_this7.data_.size !== orderedData.size) {\n // If size differs, keys are definitely modified\n _this7.keysAtom_.reportChanged();\n } else {\n var iter1 = _this7.data_.keys();\n var iter2 = orderedData.keys();\n var next1 = iter1.next();\n var next2 = iter2.next();\n while (!next1.done) {\n if (next1.value !== next2.value) {\n _this7.keysAtom_.reportChanged();\n break;\n }\n next1 = iter1.next();\n next2 = iter2.next();\n }\n }\n }\n // Use correctly ordered map\n _this7.data_ = orderedData;\n });\n return this;\n };\n _proto.toString = function toString() {\n return \"[object ObservableMap]\";\n };\n _proto.toJSON = function toJSON() {\n return Array.from(this);\n };\n /**\n * Observes this object. Triggers for the events 'add', 'update' and 'delete'.\n * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe\n * for callback details\n */\n _proto.observe_ = function observe_(listener, fireImmediately) {\n if ( true && fireImmediately === true) {\n die(\"`observe` doesn't support fireImmediately=true in combination with maps.\");\n }\n return registerListener(this, listener);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n return _createClass(ObservableMap, [{\n key: \"size\",\n get: function get() {\n this.keysAtom_.reportObserved();\n return this.data_.size;\n }\n }, {\n key: Symbol.toStringTag,\n get: function get() {\n return \"Map\";\n }\n }]);\n}();\n// eslint-disable-next-line\nvar isObservableMap = /*#__PURE__*/createInstanceofPredicate(\"ObservableMap\", ObservableMap);\nfunction convertToMap(dataStructure) {\n if (isES6Map(dataStructure) || isObservableMap(dataStructure)) {\n return dataStructure;\n } else if (Array.isArray(dataStructure)) {\n return new Map(dataStructure);\n } else if (isPlainObject(dataStructure)) {\n var map = new Map();\n for (var key in dataStructure) {\n map.set(key, dataStructure[key]);\n }\n return map;\n } else {\n return die(21, dataStructure);\n }\n}\n\nvar ObservableSetMarker = {};\nvar ObservableSet = /*#__PURE__*/function () {\n function ObservableSet(initialData, enhancer, name_) {\n var _this = this;\n if (enhancer === void 0) {\n enhancer = deepEnhancer;\n }\n if (name_ === void 0) {\n name_ = true ? \"ObservableSet@\" + getNextId() : 0;\n }\n this.name_ = void 0;\n this[$mobx] = ObservableSetMarker;\n this.data_ = new Set();\n this.atom_ = void 0;\n this.changeListeners_ = void 0;\n this.interceptors_ = void 0;\n this.dehancer = void 0;\n this.enhancer_ = void 0;\n this.name_ = name_;\n if (!isFunction(Set)) {\n die(22);\n }\n this.enhancer_ = function (newV, oldV) {\n return enhancer(newV, oldV, name_);\n };\n initObservable(function () {\n _this.atom_ = createAtom(_this.name_);\n if (initialData) {\n _this.replace(initialData);\n }\n });\n }\n var _proto = ObservableSet.prototype;\n _proto.dehanceValue_ = function dehanceValue_(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.clear = function clear() {\n var _this2 = this;\n transaction(function () {\n untracked(function () {\n for (var _iterator = _createForOfIteratorHelperLoose(_this2.data_.values()), _step; !(_step = _iterator()).done;) {\n var value = _step.value;\n _this2[\"delete\"](value);\n }\n });\n });\n };\n _proto.forEach = function forEach(callbackFn, thisArg) {\n for (var _iterator2 = _createForOfIteratorHelperLoose(this), _step2; !(_step2 = _iterator2()).done;) {\n var value = _step2.value;\n callbackFn.call(thisArg, value, value, this);\n }\n };\n _proto.add = function add(value) {\n var _this3 = this;\n checkIfStateModificationsAreAllowed(this.atom_);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: ADD,\n object: this,\n newValue: value\n });\n if (!change) {\n return this;\n }\n // ideally, value = change.value would be done here, so that values can be\n // changed by interceptor. Same applies for other Set and Map api's.\n }\n if (!this.has(value)) {\n transaction(function () {\n _this3.data_.add(_this3.enhancer_(value, undefined));\n _this3.atom_.reportChanged();\n });\n var notifySpy = true && isSpyEnabled();\n var notify = hasListeners(this);\n var _change = notify || notifySpy ? {\n observableKind: \"set\",\n debugObjectName: this.name_,\n type: ADD,\n object: this,\n newValue: value\n } : null;\n if (notifySpy && \"development\" !== \"production\") {\n spyReportStart(_change);\n }\n if (notify) {\n notifyListeners(this, _change);\n }\n if (notifySpy && \"development\" !== \"production\") {\n spyReportEnd();\n }\n }\n return this;\n };\n _proto[\"delete\"] = function _delete(value) {\n var _this4 = this;\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: DELETE,\n object: this,\n oldValue: value\n });\n if (!change) {\n return false;\n }\n }\n if (this.has(value)) {\n var notifySpy = true && isSpyEnabled();\n var notify = hasListeners(this);\n var _change2 = notify || notifySpy ? {\n observableKind: \"set\",\n debugObjectName: this.name_,\n type: DELETE,\n object: this,\n oldValue: value\n } : null;\n if (notifySpy && \"development\" !== \"production\") {\n spyReportStart(_change2);\n }\n transaction(function () {\n _this4.atom_.reportChanged();\n _this4.data_[\"delete\"](value);\n });\n if (notify) {\n notifyListeners(this, _change2);\n }\n if (notifySpy && \"development\" !== \"production\") {\n spyReportEnd();\n }\n return true;\n }\n return false;\n };\n _proto.has = function has(value) {\n this.atom_.reportObserved();\n return this.data_.has(this.dehanceValue_(value));\n };\n _proto.entries = function entries() {\n var nextIndex = 0;\n var keys = Array.from(this.keys());\n var values = Array.from(this.values());\n return makeIterable({\n next: function next() {\n var index = nextIndex;\n nextIndex += 1;\n return index < values.length ? {\n value: [keys[index], values[index]],\n done: false\n } : {\n done: true\n };\n }\n });\n };\n _proto.keys = function keys() {\n return this.values();\n };\n _proto.values = function values() {\n this.atom_.reportObserved();\n var self = this;\n var nextIndex = 0;\n var observableValues = Array.from(this.data_.values());\n return makeIterable({\n next: function next() {\n return nextIndex < observableValues.length ? {\n value: self.dehanceValue_(observableValues[nextIndex++]),\n done: false\n } : {\n done: true\n };\n }\n });\n };\n _proto.intersection = function intersection(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.intersection(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.intersection(otherSet);\n }\n };\n _proto.union = function union(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.union(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.union(otherSet);\n }\n };\n _proto.difference = function difference(otherSet) {\n return new Set(this).difference(otherSet);\n };\n _proto.symmetricDifference = function symmetricDifference(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.symmetricDifference(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.symmetricDifference(otherSet);\n }\n };\n _proto.isSubsetOf = function isSubsetOf(otherSet) {\n return new Set(this).isSubsetOf(otherSet);\n };\n _proto.isSupersetOf = function isSupersetOf(otherSet) {\n return new Set(this).isSupersetOf(otherSet);\n };\n _proto.isDisjointFrom = function isDisjointFrom(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.isDisjointFrom(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.isDisjointFrom(otherSet);\n }\n };\n _proto.replace = function replace(other) {\n var _this5 = this;\n if (isObservableSet(other)) {\n other = new Set(other);\n }\n transaction(function () {\n if (Array.isArray(other)) {\n _this5.clear();\n other.forEach(function (value) {\n return _this5.add(value);\n });\n } else if (isES6Set(other)) {\n _this5.clear();\n other.forEach(function (value) {\n return _this5.add(value);\n });\n } else if (other !== null && other !== undefined) {\n die(\"Cannot initialize set from \" + other);\n }\n });\n return this;\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n // ... 'fireImmediately' could also be true?\n if ( true && fireImmediately === true) {\n die(\"`observe` doesn't support fireImmediately=true in combination with sets.\");\n }\n return registerListener(this, listener);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.toJSON = function toJSON() {\n return Array.from(this);\n };\n _proto.toString = function toString() {\n return \"[object ObservableSet]\";\n };\n _proto[Symbol.iterator] = function () {\n return this.values();\n };\n return _createClass(ObservableSet, [{\n key: \"size\",\n get: function get() {\n this.atom_.reportObserved();\n return this.data_.size;\n }\n }, {\n key: Symbol.toStringTag,\n get: function get() {\n return \"Set\";\n }\n }]);\n}();\n// eslint-disable-next-line\nvar isObservableSet = /*#__PURE__*/createInstanceofPredicate(\"ObservableSet\", ObservableSet);\n\nvar descriptorCache = /*#__PURE__*/Object.create(null);\nvar REMOVE = \"remove\";\nvar ObservableObjectAdministration = /*#__PURE__*/function () {\n function ObservableObjectAdministration(target_, values_, name_,\n // Used anytime annotation is not explicitely provided\n defaultAnnotation_) {\n if (values_ === void 0) {\n values_ = new Map();\n }\n if (defaultAnnotation_ === void 0) {\n defaultAnnotation_ = autoAnnotation;\n }\n this.target_ = void 0;\n this.values_ = void 0;\n this.name_ = void 0;\n this.defaultAnnotation_ = void 0;\n this.keysAtom_ = void 0;\n this.changeListeners_ = void 0;\n this.interceptors_ = void 0;\n this.proxy_ = void 0;\n this.isPlainObject_ = void 0;\n this.appliedAnnotations_ = void 0;\n this.pendingKeys_ = void 0;\n this.target_ = target_;\n this.values_ = values_;\n this.name_ = name_;\n this.defaultAnnotation_ = defaultAnnotation_;\n this.keysAtom_ = new Atom( true ? this.name_ + \".keys\" : 0);\n // Optimization: we use this frequently\n this.isPlainObject_ = isPlainObject(this.target_);\n if ( true && !isAnnotation(this.defaultAnnotation_)) {\n die(\"defaultAnnotation must be valid annotation\");\n }\n if (true) {\n // Prepare structure for tracking which fields were already annotated\n this.appliedAnnotations_ = {};\n }\n }\n var _proto = ObservableObjectAdministration.prototype;\n _proto.getObservablePropValue_ = function getObservablePropValue_(key) {\n return this.values_.get(key).get();\n };\n _proto.setObservablePropValue_ = function setObservablePropValue_(key, newValue) {\n var observable = this.values_.get(key);\n if (observable instanceof ComputedValue) {\n observable.set(newValue);\n return true;\n }\n // intercept\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: UPDATE,\n object: this.proxy_ || this.target_,\n name: key,\n newValue: newValue\n });\n if (!change) {\n return null;\n }\n newValue = change.newValue;\n }\n newValue = observable.prepareNewValue_(newValue);\n // notify spy & observers\n if (newValue !== globalState.UNCHANGED) {\n var notify = hasListeners(this);\n var notifySpy = true && isSpyEnabled();\n var _change = notify || notifySpy ? {\n type: UPDATE,\n observableKind: \"object\",\n debugObjectName: this.name_,\n object: this.proxy_ || this.target_,\n oldValue: observable.value_,\n name: key,\n newValue: newValue\n } : null;\n if ( true && notifySpy) {\n spyReportStart(_change);\n }\n observable.setNewValue_(newValue);\n if (notify) {\n notifyListeners(this, _change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n return true;\n };\n _proto.get_ = function get_(key) {\n if (globalState.trackingDerivation && !hasProp(this.target_, key)) {\n // Key doesn't exist yet, subscribe for it in case it's added later\n this.has_(key);\n }\n return this.target_[key];\n }\n /**\n * @param {PropertyKey} key\n * @param {any} value\n * @param {Annotation|boolean} annotation true - use default annotation, false - copy as is\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.set_ = function set_(key, value, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n // Don't use .has(key) - we care about own\n if (hasProp(this.target_, key)) {\n // Existing prop\n if (this.values_.has(key)) {\n // Observable (can be intercepted)\n return this.setObservablePropValue_(key, value);\n } else if (proxyTrap) {\n // Non-observable - proxy\n return Reflect.set(this.target_, key, value);\n } else {\n // Non-observable\n this.target_[key] = value;\n return true;\n }\n } else {\n // New prop\n return this.extend_(key, {\n value: value,\n enumerable: true,\n writable: true,\n configurable: true\n }, this.defaultAnnotation_, proxyTrap);\n }\n }\n // Trap for \"in\"\n ;\n _proto.has_ = function has_(key) {\n if (!globalState.trackingDerivation) {\n // Skip key subscription outside derivation\n return key in this.target_;\n }\n this.pendingKeys_ || (this.pendingKeys_ = new Map());\n var entry = this.pendingKeys_.get(key);\n if (!entry) {\n entry = new ObservableValue(key in this.target_, referenceEnhancer, true ? this.name_ + \".\" + stringifyKey(key) + \"?\" : 0, false);\n this.pendingKeys_.set(key, entry);\n }\n return entry.get();\n }\n /**\n * @param {PropertyKey} key\n * @param {Annotation|boolean} annotation true - use default annotation, false - ignore prop\n */;\n _proto.make_ = function make_(key, annotation) {\n if (annotation === true) {\n annotation = this.defaultAnnotation_;\n }\n if (annotation === false) {\n return;\n }\n assertAnnotable(this, annotation, key);\n if (!(key in this.target_)) {\n var _this$target_$storedA;\n // Throw on missing key, except for decorators:\n // Decorator annotations are collected from whole prototype chain.\n // When called from super() some props may not exist yet.\n // However we don't have to worry about missing prop,\n // because the decorator must have been applied to something.\n if ((_this$target_$storedA = this.target_[storedAnnotationsSymbol]) != null && _this$target_$storedA[key]) {\n return; // will be annotated by subclass constructor\n } else {\n die(1, annotation.annotationType_, this.name_ + \".\" + key.toString());\n }\n }\n var source = this.target_;\n while (source && source !== objectPrototype) {\n var descriptor = getDescriptor(source, key);\n if (descriptor) {\n var outcome = annotation.make_(this, key, descriptor, source);\n if (outcome === 0 /* MakeResult.Cancel */) {\n return;\n }\n if (outcome === 1 /* MakeResult.Break */) {\n break;\n }\n }\n source = Object.getPrototypeOf(source);\n }\n recordAnnotationApplied(this, annotation, key);\n }\n /**\n * @param {PropertyKey} key\n * @param {PropertyDescriptor} descriptor\n * @param {Annotation|boolean} annotation true - use default annotation, false - copy as is\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.extend_ = function extend_(key, descriptor, annotation, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n if (annotation === true) {\n annotation = this.defaultAnnotation_;\n }\n if (annotation === false) {\n return this.defineProperty_(key, descriptor, proxyTrap);\n }\n assertAnnotable(this, annotation, key);\n var outcome = annotation.extend_(this, key, descriptor, proxyTrap);\n if (outcome) {\n recordAnnotationApplied(this, annotation, key);\n }\n return outcome;\n }\n /**\n * @param {PropertyKey} key\n * @param {PropertyDescriptor} descriptor\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.defineProperty_ = function defineProperty_(key, descriptor, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n try {\n startBatch();\n // Delete\n var deleteOutcome = this.delete_(key);\n if (!deleteOutcome) {\n // Failure or intercepted\n return deleteOutcome;\n }\n // ADD interceptor\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: ADD,\n newValue: descriptor.value\n });\n if (!change) {\n return null;\n }\n var newValue = change.newValue;\n if (descriptor.value !== newValue) {\n descriptor = _extends({}, descriptor, {\n value: newValue\n });\n }\n }\n // Define\n if (proxyTrap) {\n if (!Reflect.defineProperty(this.target_, key, descriptor)) {\n return false;\n }\n } else {\n defineProperty(this.target_, key, descriptor);\n }\n // Notify\n this.notifyPropertyAddition_(key, descriptor.value);\n } finally {\n endBatch();\n }\n return true;\n }\n // If original descriptor becomes relevant, move this to annotation directly\n ;\n _proto.defineObservableProperty_ = function defineObservableProperty_(key, value, enhancer, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n try {\n startBatch();\n // Delete\n var deleteOutcome = this.delete_(key);\n if (!deleteOutcome) {\n // Failure or intercepted\n return deleteOutcome;\n }\n // ADD interceptor\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: ADD,\n newValue: value\n });\n if (!change) {\n return null;\n }\n value = change.newValue;\n }\n var cachedDescriptor = getCachedObservablePropDescriptor(key);\n var descriptor = {\n configurable: globalState.safeDescriptors ? this.isPlainObject_ : true,\n enumerable: true,\n get: cachedDescriptor.get,\n set: cachedDescriptor.set\n };\n // Define\n if (proxyTrap) {\n if (!Reflect.defineProperty(this.target_, key, descriptor)) {\n return false;\n }\n } else {\n defineProperty(this.target_, key, descriptor);\n }\n var observable = new ObservableValue(value, enhancer, true ? this.name_ + \".\" + key.toString() : 0, false);\n this.values_.set(key, observable);\n // Notify (value possibly changed by ObservableValue)\n this.notifyPropertyAddition_(key, observable.value_);\n } finally {\n endBatch();\n }\n return true;\n }\n // If original descriptor becomes relevant, move this to annotation directly\n ;\n _proto.defineComputedProperty_ = function defineComputedProperty_(key, options, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n try {\n startBatch();\n // Delete\n var deleteOutcome = this.delete_(key);\n if (!deleteOutcome) {\n // Failure or intercepted\n return deleteOutcome;\n }\n // ADD interceptor\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: ADD,\n newValue: undefined\n });\n if (!change) {\n return null;\n }\n }\n options.name || (options.name = true ? this.name_ + \".\" + key.toString() : 0);\n options.context = this.proxy_ || this.target_;\n var cachedDescriptor = getCachedObservablePropDescriptor(key);\n var descriptor = {\n configurable: globalState.safeDescriptors ? this.isPlainObject_ : true,\n enumerable: false,\n get: cachedDescriptor.get,\n set: cachedDescriptor.set\n };\n // Define\n if (proxyTrap) {\n if (!Reflect.defineProperty(this.target_, key, descriptor)) {\n return false;\n }\n } else {\n defineProperty(this.target_, key, descriptor);\n }\n this.values_.set(key, new ComputedValue(options));\n // Notify\n this.notifyPropertyAddition_(key, undefined);\n } finally {\n endBatch();\n }\n return true;\n }\n /**\n * @param {PropertyKey} key\n * @param {PropertyDescriptor} descriptor\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.delete_ = function delete_(key, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n // No such prop\n if (!hasProp(this.target_, key)) {\n return true;\n }\n // Intercept\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: REMOVE\n });\n // Cancelled\n if (!change) {\n return null;\n }\n }\n // Delete\n try {\n var _this$pendingKeys_;\n startBatch();\n var notify = hasListeners(this);\n var notifySpy = true && isSpyEnabled();\n var observable = this.values_.get(key);\n // Value needed for spies/listeners\n var value = undefined;\n // Optimization: don't pull the value unless we will need it\n if (!observable && (notify || notifySpy)) {\n var _getDescriptor;\n value = (_getDescriptor = getDescriptor(this.target_, key)) == null ? void 0 : _getDescriptor.value;\n }\n // delete prop (do first, may fail)\n if (proxyTrap) {\n if (!Reflect.deleteProperty(this.target_, key)) {\n return false;\n }\n } else {\n delete this.target_[key];\n }\n // Allow re-annotating this field\n if (true) {\n delete this.appliedAnnotations_[key];\n }\n // Clear observable\n if (observable) {\n this.values_[\"delete\"](key);\n // for computed, value is undefined\n if (observable instanceof ObservableValue) {\n value = observable.value_;\n }\n // Notify: autorun(() => obj[key]), see #1796\n propagateChanged(observable);\n }\n // Notify \"keys/entries/values\" observers\n this.keysAtom_.reportChanged();\n // Notify \"has\" observers\n // \"in\" as it may still exist in proto\n (_this$pendingKeys_ = this.pendingKeys_) == null || (_this$pendingKeys_ = _this$pendingKeys_.get(key)) == null || _this$pendingKeys_.set(key in this.target_);\n // Notify spies/listeners\n if (notify || notifySpy) {\n var _change2 = {\n type: REMOVE,\n observableKind: \"object\",\n object: this.proxy_ || this.target_,\n debugObjectName: this.name_,\n oldValue: value,\n name: key\n };\n if ( true && notifySpy) {\n spyReportStart(_change2);\n }\n if (notify) {\n notifyListeners(this, _change2);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n } finally {\n endBatch();\n }\n return true;\n }\n /**\n * Observes this object. Triggers for the events 'add', 'update' and 'delete'.\n * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe\n * for callback details\n */;\n _proto.observe_ = function observe_(callback, fireImmediately) {\n if ( true && fireImmediately === true) {\n die(\"`observe` doesn't support the fire immediately property for observable objects.\");\n }\n return registerListener(this, callback);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.notifyPropertyAddition_ = function notifyPropertyAddition_(key, value) {\n var _this$pendingKeys_2;\n var notify = hasListeners(this);\n var notifySpy = true && isSpyEnabled();\n if (notify || notifySpy) {\n var change = notify || notifySpy ? {\n type: ADD,\n observableKind: \"object\",\n debugObjectName: this.name_,\n object: this.proxy_ || this.target_,\n name: key,\n newValue: value\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n }\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n (_this$pendingKeys_2 = this.pendingKeys_) == null || (_this$pendingKeys_2 = _this$pendingKeys_2.get(key)) == null || _this$pendingKeys_2.set(true);\n // Notify \"keys/entries/values\" observers\n this.keysAtom_.reportChanged();\n };\n _proto.ownKeys_ = function ownKeys_() {\n this.keysAtom_.reportObserved();\n return ownKeys(this.target_);\n };\n _proto.keys_ = function keys_() {\n // Returns enumerable && own, but unfortunately keysAtom will report on ANY key change.\n // There is no way to distinguish between Object.keys(object) and Reflect.ownKeys(object) - both are handled by ownKeys trap.\n // We can either over-report in Object.keys(object) or under-report in Reflect.ownKeys(object)\n // We choose to over-report in Object.keys(object), because:\n // - typically it's used with simple data objects\n // - when symbolic/non-enumerable keys are relevant Reflect.ownKeys works as expected\n this.keysAtom_.reportObserved();\n return Object.keys(this.target_);\n };\n return ObservableObjectAdministration;\n}();\nfunction asObservableObject(target, options) {\n var _options$name;\n if ( true && options && isObservableObject(target)) {\n die(\"Options can't be provided for already observable objects.\");\n }\n if (hasProp(target, $mobx)) {\n if ( true && !(getAdministration(target) instanceof ObservableObjectAdministration)) {\n die(\"Cannot convert '\" + getDebugName(target) + \"' into observable object:\" + \"\\nThe target is already observable of different type.\" + \"\\nExtending builtins is not supported.\");\n }\n return target;\n }\n if ( true && !Object.isExtensible(target)) {\n die(\"Cannot make the designated object observable; it is not extensible\");\n }\n var name = (_options$name = options == null ? void 0 : options.name) != null ? _options$name : true ? (isPlainObject(target) ? \"ObservableObject\" : target.constructor.name) + \"@\" + getNextId() : 0;\n var adm = new ObservableObjectAdministration(target, new Map(), String(name), getAnnotationFromOptions(options));\n addHiddenProp(target, $mobx, adm);\n return target;\n}\nvar isObservableObjectAdministration = /*#__PURE__*/createInstanceofPredicate(\"ObservableObjectAdministration\", ObservableObjectAdministration);\nfunction getCachedObservablePropDescriptor(key) {\n return descriptorCache[key] || (descriptorCache[key] = {\n get: function get() {\n return this[$mobx].getObservablePropValue_(key);\n },\n set: function set(value) {\n return this[$mobx].setObservablePropValue_(key, value);\n }\n });\n}\nfunction isObservableObject(thing) {\n if (isObject(thing)) {\n return isObservableObjectAdministration(thing[$mobx]);\n }\n return false;\n}\nfunction recordAnnotationApplied(adm, annotation, key) {\n var _adm$target_$storedAn;\n if (true) {\n adm.appliedAnnotations_[key] = annotation;\n }\n // Remove applied decorator annotation so we don't try to apply it again in subclass constructor\n (_adm$target_$storedAn = adm.target_[storedAnnotationsSymbol]) == null || delete _adm$target_$storedAn[key];\n}\nfunction assertAnnotable(adm, annotation, key) {\n // Valid annotation\n if ( true && !isAnnotation(annotation)) {\n die(\"Cannot annotate '\" + adm.name_ + \".\" + key.toString() + \"': Invalid annotation.\");\n }\n /*\n // Configurable, not sealed, not frozen\n // Possibly not needed, just a little better error then the one thrown by engine.\n // Cases where this would be useful the most (subclass field initializer) are not interceptable by this.\n if (__DEV__) {\n const configurable = getDescriptor(adm.target_, key)?.configurable\n const frozen = Object.isFrozen(adm.target_)\n const sealed = Object.isSealed(adm.target_)\n if (!configurable || frozen || sealed) {\n const fieldName = `${adm.name_}.${key.toString()}`\n const requestedAnnotationType = annotation.annotationType_\n let error = `Cannot apply '${requestedAnnotationType}' to '${fieldName}':`\n if (frozen) {\n error += `\\nObject is frozen.`\n }\n if (sealed) {\n error += `\\nObject is sealed.`\n }\n if (!configurable) {\n error += `\\nproperty is not configurable.`\n // Mention only if caused by us to avoid confusion\n if (hasProp(adm.appliedAnnotations!, key)) {\n error += `\\nTo prevent accidental re-definition of a field by a subclass, `\n error += `all annotated fields of non-plain objects (classes) are not configurable.`\n }\n }\n die(error)\n }\n }\n */\n // Not annotated\n if ( true && !isOverride(annotation) && hasProp(adm.appliedAnnotations_, key)) {\n var fieldName = adm.name_ + \".\" + key.toString();\n var currentAnnotationType = adm.appliedAnnotations_[key].annotationType_;\n var requestedAnnotationType = annotation.annotationType_;\n die(\"Cannot apply '\" + requestedAnnotationType + \"' to '\" + fieldName + \"':\" + (\"\\nThe field is already annotated with '\" + currentAnnotationType + \"'.\") + \"\\nRe-annotating fields is not allowed.\" + \"\\nUse 'override' annotation for methods overridden by subclass.\");\n }\n}\n\n// Bug in safari 9.* (or iOS 9 safari mobile). See #364\nvar ENTRY_0 = /*#__PURE__*/createArrayEntryDescriptor(0);\nvar safariPrototypeSetterInheritanceBug = /*#__PURE__*/function () {\n var v = false;\n var p = {};\n Object.defineProperty(p, \"0\", {\n set: function set() {\n v = true;\n }\n });\n /*#__PURE__*/Object.create(p)[\"0\"] = 1;\n return v === false;\n}();\n/**\n * This array buffer contains two lists of properties, so that all arrays\n * can recycle their property definitions, which significantly improves performance of creating\n * properties on the fly.\n */\nvar OBSERVABLE_ARRAY_BUFFER_SIZE = 0;\n// Typescript workaround to make sure ObservableArray extends Array\nvar StubArray = function StubArray() {};\nfunction inherit(ctor, proto) {\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(ctor.prototype, proto);\n } else if (ctor.prototype.__proto__ !== undefined) {\n ctor.prototype.__proto__ = proto;\n } else {\n ctor.prototype = proto;\n }\n}\ninherit(StubArray, Array.prototype);\n// Weex proto freeze protection was here,\n// but it is unclear why the hack is need as MobX never changed the prototype\n// anyway, so removed it in V6\nvar LegacyObservableArray = /*#__PURE__*/function (_StubArray) {\n function LegacyObservableArray(initialValues, enhancer, name, owned) {\n var _this;\n if (name === void 0) {\n name = true ? \"ObservableArray@\" + getNextId() : 0;\n }\n if (owned === void 0) {\n owned = false;\n }\n _this = _StubArray.call(this) || this;\n initObservable(function () {\n var adm = new ObservableArrayAdministration(name, enhancer, owned, true);\n adm.proxy_ = _this;\n addHiddenFinalProp(_this, $mobx, adm);\n if (initialValues && initialValues.length) {\n // @ts-ignore\n _this.spliceWithArray(0, 0, initialValues);\n }\n if (safariPrototypeSetterInheritanceBug) {\n // Seems that Safari won't use numeric prototype setter until any * numeric property is\n // defined on the instance. After that it works fine, even if this property is deleted.\n Object.defineProperty(_this, \"0\", ENTRY_0);\n }\n });\n return _this;\n }\n _inheritsLoose(LegacyObservableArray, _StubArray);\n var _proto = LegacyObservableArray.prototype;\n _proto.concat = function concat() {\n this[$mobx].atom_.reportObserved();\n for (var _len = arguments.length, arrays = new Array(_len), _key = 0; _key < _len; _key++) {\n arrays[_key] = arguments[_key];\n }\n return Array.prototype.concat.apply(this.slice(),\n //@ts-ignore\n arrays.map(function (a) {\n return isObservableArray(a) ? a.slice() : a;\n }));\n };\n _proto[Symbol.iterator] = function () {\n var self = this;\n var nextIndex = 0;\n return makeIterable({\n next: function next() {\n return nextIndex < self.length ? {\n value: self[nextIndex++],\n done: false\n } : {\n done: true,\n value: undefined\n };\n }\n });\n };\n return _createClass(LegacyObservableArray, [{\n key: \"length\",\n get: function get() {\n return this[$mobx].getArrayLength_();\n },\n set: function set(newLength) {\n this[$mobx].setArrayLength_(newLength);\n }\n }, {\n key: Symbol.toStringTag,\n get: function get() {\n return \"Array\";\n }\n }]);\n}(StubArray);\nObject.entries(arrayExtensions).forEach(function (_ref) {\n var prop = _ref[0],\n fn = _ref[1];\n if (prop !== \"concat\") {\n addHiddenProp(LegacyObservableArray.prototype, prop, fn);\n }\n});\nfunction createArrayEntryDescriptor(index) {\n return {\n enumerable: false,\n configurable: true,\n get: function get() {\n return this[$mobx].get_(index);\n },\n set: function set(value) {\n this[$mobx].set_(index, value);\n }\n };\n}\nfunction createArrayBufferItem(index) {\n defineProperty(LegacyObservableArray.prototype, \"\" + index, createArrayEntryDescriptor(index));\n}\nfunction reserveArrayBuffer(max) {\n if (max > OBSERVABLE_ARRAY_BUFFER_SIZE) {\n for (var index = OBSERVABLE_ARRAY_BUFFER_SIZE; index < max + 100; index++) {\n createArrayBufferItem(index);\n }\n OBSERVABLE_ARRAY_BUFFER_SIZE = max;\n }\n}\nreserveArrayBuffer(1000);\nfunction createLegacyArray(initialValues, enhancer, name) {\n return new LegacyObservableArray(initialValues, enhancer, name);\n}\n\nfunction getAtom(thing, property) {\n if (typeof thing === \"object\" && thing !== null) {\n if (isObservableArray(thing)) {\n if (property !== undefined) {\n die(23);\n }\n return thing[$mobx].atom_;\n }\n if (isObservableSet(thing)) {\n return thing.atom_;\n }\n if (isObservableMap(thing)) {\n if (property === undefined) {\n return thing.keysAtom_;\n }\n var observable = thing.data_.get(property) || thing.hasMap_.get(property);\n if (!observable) {\n die(25, property, getDebugName(thing));\n }\n return observable;\n }\n if (isObservableObject(thing)) {\n if (!property) {\n return die(26);\n }\n var _observable = thing[$mobx].values_.get(property);\n if (!_observable) {\n die(27, property, getDebugName(thing));\n }\n return _observable;\n }\n if (isAtom(thing) || isComputedValue(thing) || isReaction(thing)) {\n return thing;\n }\n } else if (isFunction(thing)) {\n if (isReaction(thing[$mobx])) {\n // disposer function\n return thing[$mobx];\n }\n }\n die(28);\n}\nfunction getAdministration(thing, property) {\n if (!thing) {\n die(29);\n }\n if (property !== undefined) {\n return getAdministration(getAtom(thing, property));\n }\n if (isAtom(thing) || isComputedValue(thing) || isReaction(thing)) {\n return thing;\n }\n if (isObservableMap(thing) || isObservableSet(thing)) {\n return thing;\n }\n if (thing[$mobx]) {\n return thing[$mobx];\n }\n die(24, thing);\n}\nfunction getDebugName(thing, property) {\n var named;\n if (property !== undefined) {\n named = getAtom(thing, property);\n } else if (isAction(thing)) {\n return thing.name;\n } else if (isObservableObject(thing) || isObservableMap(thing) || isObservableSet(thing)) {\n named = getAdministration(thing);\n } else {\n // valid for arrays as well\n named = getAtom(thing);\n }\n return named.name_;\n}\n/**\n * Helper function for initializing observable structures, it applies:\n * 1. allowStateChanges so we don't violate enforceActions.\n * 2. untracked so we don't accidentaly subscribe to anything observable accessed during init in case the observable is created inside derivation.\n * 3. batch to avoid state version updates\n */\nfunction initObservable(cb) {\n var derivation = untrackedStart();\n var allowStateChanges = allowStateChangesStart(true);\n startBatch();\n try {\n return cb();\n } finally {\n endBatch();\n allowStateChangesEnd(allowStateChanges);\n untrackedEnd(derivation);\n }\n}\n\nvar toString = objectPrototype.toString;\nfunction deepEqual(a, b, depth) {\n if (depth === void 0) {\n depth = -1;\n }\n return eq(a, b, depth);\n}\n// Copied from https://github.com/jashkenas/underscore/blob/5c237a7c682fb68fd5378203f0bf22dce1624854/underscore.js#L1186-L1289\n// Internal recursive comparison function for `isEqual`.\nfunction eq(a, b, depth, aStack, bStack) {\n // Identical objects are equal. `0 === -0`, but they aren't identical.\n // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).\n if (a === b) {\n return a !== 0 || 1 / a === 1 / b;\n }\n // `null` or `undefined` only equal to itself (strict comparison).\n if (a == null || b == null) {\n return false;\n }\n // `NaN`s are equivalent, but non-reflexive.\n if (a !== a) {\n return b !== b;\n }\n // Exhaust primitive checks\n var type = typeof a;\n if (type !== \"function\" && type !== \"object\" && typeof b != \"object\") {\n return false;\n }\n // Compare `[[Class]]` names.\n var className = toString.call(a);\n if (className !== toString.call(b)) {\n return false;\n }\n switch (className) {\n // Strings, numbers, regular expressions, dates, and booleans are compared by value.\n case \"[object RegExp]\":\n // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i')\n case \"[object String]\":\n // Primitives and their corresponding object wrappers are equivalent; thus, `\"5\"` is\n // equivalent to `new String(\"5\")`.\n return \"\" + a === \"\" + b;\n case \"[object Number]\":\n // `NaN`s are equivalent, but non-reflexive.\n // Object(NaN) is equivalent to NaN.\n if (+a !== +a) {\n return +b !== +b;\n }\n // An `egal` comparison is performed for other numeric values.\n return +a === 0 ? 1 / +a === 1 / b : +a === +b;\n case \"[object Date]\":\n case \"[object Boolean]\":\n // Coerce dates and booleans to numeric primitive values. Dates are compared by their\n // millisecond representations. Note that invalid dates with millisecond representations\n // of `NaN` are not equivalent.\n return +a === +b;\n case \"[object Symbol]\":\n return typeof Symbol !== \"undefined\" && Symbol.valueOf.call(a) === Symbol.valueOf.call(b);\n case \"[object Map]\":\n case \"[object Set]\":\n // Maps and Sets are unwrapped to arrays of entry-pairs, adding an incidental level.\n // Hide this extra level by increasing the depth.\n if (depth >= 0) {\n depth++;\n }\n break;\n }\n // Unwrap any wrapped objects.\n a = unwrap(a);\n b = unwrap(b);\n var areArrays = className === \"[object Array]\";\n if (!areArrays) {\n if (typeof a != \"object\" || typeof b != \"object\") {\n return false;\n }\n // Objects with different constructors are not equivalent, but `Object`s or `Array`s\n // from different frames are.\n var aCtor = a.constructor,\n bCtor = b.constructor;\n if (aCtor !== bCtor && !(isFunction(aCtor) && aCtor instanceof aCtor && isFunction(bCtor) && bCtor instanceof bCtor) && \"constructor\" in a && \"constructor\" in b) {\n return false;\n }\n }\n if (depth === 0) {\n return false;\n } else if (depth < 0) {\n depth = -1;\n }\n // Assume equality for cyclic structures. The algorithm for detecting cyclic\n // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.\n // Initializing stack of traversed objects.\n // It's done here since we only need them for objects and arrays comparison.\n aStack = aStack || [];\n bStack = bStack || [];\n var length = aStack.length;\n while (length--) {\n // Linear search. Performance is inversely proportional to the number of\n // unique nested structures.\n if (aStack[length] === a) {\n return bStack[length] === b;\n }\n }\n // Add the first object to the stack of traversed objects.\n aStack.push(a);\n bStack.push(b);\n // Recursively compare objects and arrays.\n if (areArrays) {\n // Compare array lengths to determine if a deep comparison is necessary.\n length = a.length;\n if (length !== b.length) {\n return false;\n }\n // Deep compare the contents, ignoring non-numeric properties.\n while (length--) {\n if (!eq(a[length], b[length], depth - 1, aStack, bStack)) {\n return false;\n }\n }\n } else {\n // Deep compare objects.\n var keys = Object.keys(a);\n var key;\n length = keys.length;\n // Ensure that both objects contain the same number of properties before comparing deep equality.\n if (Object.keys(b).length !== length) {\n return false;\n }\n while (length--) {\n // Deep compare each member\n key = keys[length];\n if (!(hasProp(b, key) && eq(a[key], b[key], depth - 1, aStack, bStack))) {\n return false;\n }\n }\n }\n // Remove the first object from the stack of traversed objects.\n aStack.pop();\n bStack.pop();\n return true;\n}\nfunction unwrap(a) {\n if (isObservableArray(a)) {\n return a.slice();\n }\n if (isES6Map(a) || isObservableMap(a)) {\n return Array.from(a.entries());\n }\n if (isES6Set(a) || isObservableSet(a)) {\n return Array.from(a.entries());\n }\n return a;\n}\n\nfunction makeIterable(iterator) {\n iterator[Symbol.iterator] = getSelf;\n return iterator;\n}\nfunction getSelf() {\n return this;\n}\n\nfunction isAnnotation(thing) {\n return (\n // Can be function\n thing instanceof Object && typeof thing.annotationType_ === \"string\" && isFunction(thing.make_) && isFunction(thing.extend_)\n );\n}\n\n/**\n * (c) Michel Weststrate 2015 - 2020\n * MIT Licensed\n *\n * Welcome to the mobx sources! To get a global overview of how MobX internally works,\n * this is a good place to start:\n * https://medium.com/@mweststrate/becoming-fully-reactive-an-in-depth-explanation-of-mobservable-55995262a254#.xvbh6qd74\n *\n * Source folders:\n * ===============\n *\n * - api/ Most of the public static methods exposed by the module can be found here.\n * - core/ Implementation of the MobX algorithm; atoms, derivations, reactions, dependency trees, optimizations. Cool stuff can be found here.\n * - types/ All the magic that is need to have observable objects, arrays and values is in this folder. Including the modifiers like `asFlat`.\n * - utils/ Utility stuff.\n *\n */\n[\"Symbol\", \"Map\", \"Set\"].forEach(function (m) {\n var g = getGlobal();\n if (typeof g[m] === \"undefined\") {\n die(\"MobX requires global '\" + m + \"' to be available or polyfilled\");\n }\n});\nif (typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__ === \"object\") {\n // See: https://github.com/andykog/mobx-devtools/\n __MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({\n spy: spy,\n extras: {\n getDebugName: getDebugName\n },\n $mobx: $mobx\n });\n}\n\n\n//# sourceMappingURL=mobx.esm.js.map\n\n\n//# sourceURL=webpack://app_adyen_SFRA/./node_modules/mobx/dist/mobx.esm.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ $mobx: () => (/* binding */ $mobx),\n/* harmony export */ FlowCancellationError: () => (/* binding */ FlowCancellationError),\n/* harmony export */ ObservableMap: () => (/* binding */ ObservableMap),\n/* harmony export */ ObservableSet: () => (/* binding */ ObservableSet),\n/* harmony export */ Reaction: () => (/* binding */ Reaction),\n/* harmony export */ _allowStateChanges: () => (/* binding */ allowStateChanges),\n/* harmony export */ _allowStateChangesInsideComputed: () => (/* binding */ runInAction),\n/* harmony export */ _allowStateReadsEnd: () => (/* binding */ allowStateReadsEnd),\n/* harmony export */ _allowStateReadsStart: () => (/* binding */ allowStateReadsStart),\n/* harmony export */ _autoAction: () => (/* binding */ autoAction),\n/* harmony export */ _endAction: () => (/* binding */ _endAction),\n/* harmony export */ _getAdministration: () => (/* binding */ getAdministration),\n/* harmony export */ _getGlobalState: () => (/* binding */ getGlobalState),\n/* harmony export */ _interceptReads: () => (/* binding */ interceptReads),\n/* harmony export */ _isComputingDerivation: () => (/* binding */ isComputingDerivation),\n/* harmony export */ _resetGlobalState: () => (/* binding */ resetGlobalState),\n/* harmony export */ _startAction: () => (/* binding */ _startAction),\n/* harmony export */ action: () => (/* binding */ action),\n/* harmony export */ autorun: () => (/* binding */ autorun),\n/* harmony export */ comparer: () => (/* binding */ comparer),\n/* harmony export */ computed: () => (/* binding */ computed),\n/* harmony export */ configure: () => (/* binding */ configure),\n/* harmony export */ createAtom: () => (/* binding */ createAtom),\n/* harmony export */ defineProperty: () => (/* binding */ apiDefineProperty),\n/* harmony export */ entries: () => (/* binding */ entries),\n/* harmony export */ extendObservable: () => (/* binding */ extendObservable),\n/* harmony export */ flow: () => (/* binding */ flow),\n/* harmony export */ flowResult: () => (/* binding */ flowResult),\n/* harmony export */ get: () => (/* binding */ get),\n/* harmony export */ getAtom: () => (/* binding */ getAtom),\n/* harmony export */ getDebugName: () => (/* binding */ getDebugName),\n/* harmony export */ getDependencyTree: () => (/* binding */ getDependencyTree),\n/* harmony export */ getObserverTree: () => (/* binding */ getObserverTree),\n/* harmony export */ has: () => (/* binding */ has),\n/* harmony export */ intercept: () => (/* binding */ intercept),\n/* harmony export */ isAction: () => (/* binding */ isAction),\n/* harmony export */ isBoxedObservable: () => (/* binding */ isObservableValue),\n/* harmony export */ isComputed: () => (/* binding */ isComputed),\n/* harmony export */ isComputedProp: () => (/* binding */ isComputedProp),\n/* harmony export */ isFlow: () => (/* binding */ isFlow),\n/* harmony export */ isFlowCancellationError: () => (/* binding */ isFlowCancellationError),\n/* harmony export */ isObservable: () => (/* binding */ isObservable),\n/* harmony export */ isObservableArray: () => (/* binding */ isObservableArray),\n/* harmony export */ isObservableMap: () => (/* binding */ isObservableMap),\n/* harmony export */ isObservableObject: () => (/* binding */ isObservableObject),\n/* harmony export */ isObservableProp: () => (/* binding */ isObservableProp),\n/* harmony export */ isObservableSet: () => (/* binding */ isObservableSet),\n/* harmony export */ keys: () => (/* binding */ keys),\n/* harmony export */ makeAutoObservable: () => (/* binding */ makeAutoObservable),\n/* harmony export */ makeObservable: () => (/* binding */ makeObservable),\n/* harmony export */ observable: () => (/* binding */ observable),\n/* harmony export */ observe: () => (/* binding */ observe),\n/* harmony export */ onBecomeObserved: () => (/* binding */ onBecomeObserved),\n/* harmony export */ onBecomeUnobserved: () => (/* binding */ onBecomeUnobserved),\n/* harmony export */ onReactionError: () => (/* binding */ onReactionError),\n/* harmony export */ override: () => (/* binding */ override),\n/* harmony export */ ownKeys: () => (/* binding */ apiOwnKeys),\n/* harmony export */ reaction: () => (/* binding */ reaction),\n/* harmony export */ remove: () => (/* binding */ remove),\n/* harmony export */ runInAction: () => (/* binding */ runInAction),\n/* harmony export */ set: () => (/* binding */ set),\n/* harmony export */ spy: () => (/* binding */ spy),\n/* harmony export */ toJS: () => (/* binding */ toJS),\n/* harmony export */ trace: () => (/* binding */ trace),\n/* harmony export */ transaction: () => (/* binding */ transaction),\n/* harmony export */ untracked: () => (/* binding */ untracked),\n/* harmony export */ values: () => (/* binding */ values),\n/* harmony export */ when: () => (/* binding */ when)\n/* harmony export */ });\nvar niceErrors = {\n 0: \"Invalid value for configuration 'enforceActions', expected 'never', 'always' or 'observed'\",\n 1: function _(annotationType, key) {\n return \"Cannot apply '\" + annotationType + \"' to '\" + key.toString() + \"': Field not found.\";\n },\n /*\n 2(prop) {\n return `invalid decorator for '${prop.toString()}'`\n },\n 3(prop) {\n return `Cannot decorate '${prop.toString()}': action can only be used on properties with a function value.`\n },\n 4(prop) {\n return `Cannot decorate '${prop.toString()}': computed can only be used on getter properties.`\n },\n */\n 5: \"'keys()' can only be used on observable objects, arrays, sets and maps\",\n 6: \"'values()' can only be used on observable objects, arrays, sets and maps\",\n 7: \"'entries()' can only be used on observable objects, arrays and maps\",\n 8: \"'set()' can only be used on observable objects, arrays and maps\",\n 9: \"'remove()' can only be used on observable objects, arrays and maps\",\n 10: \"'has()' can only be used on observable objects, arrays and maps\",\n 11: \"'get()' can only be used on observable objects, arrays and maps\",\n 12: \"Invalid annotation\",\n 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)\",\n 14: \"Intercept handlers should return nothing or a change object\",\n 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)\",\n 16: \"Modification exception: the internal structure of an observable array was changed.\",\n 17: function _(index, length) {\n return \"[mobx.array] Index out of bounds, \" + index + \" is larger than \" + length;\n },\n 18: \"mobx.map requires Map polyfill for the current browser. Check babel-polyfill or core-js/es6/map.js\",\n 19: function _(other) {\n return \"Cannot initialize from classes that inherit from Map: \" + other.constructor.name;\n },\n 20: function _(other) {\n return \"Cannot initialize map from \" + other;\n },\n 21: function _(dataStructure) {\n return \"Cannot convert to map from '\" + dataStructure + \"'\";\n },\n 22: \"mobx.set requires Set polyfill for the current browser. Check babel-polyfill or core-js/es6/set.js\",\n 23: \"It is not possible to get index atoms from arrays\",\n 24: function _(thing) {\n return \"Cannot obtain administration from \" + thing;\n },\n 25: function _(property, name) {\n return \"the entry '\" + property + \"' does not exist in the observable map '\" + name + \"'\";\n },\n 26: \"please specify a property\",\n 27: function _(property, name) {\n return \"no observable property '\" + property.toString() + \"' found on the observable object '\" + name + \"'\";\n },\n 28: function _(thing) {\n return \"Cannot obtain atom from \" + thing;\n },\n 29: \"Expecting some object\",\n 30: \"invalid action stack. did you forget to finish an action?\",\n 31: \"missing option for computed: get\",\n 32: function _(name, derivation) {\n return \"Cycle detected in computation \" + name + \": \" + derivation;\n },\n 33: function _(name) {\n return \"The setter of computed value '\" + name + \"' is trying to update itself. Did you intend to update an _observable_ value, instead of the computed property?\";\n },\n 34: function _(name) {\n return \"[ComputedValue '\" + name + \"'] It is not possible to assign a new value to a computed value.\";\n },\n 35: \"There are multiple, different versions of MobX active. Make sure MobX is loaded only once or use `configure({ isolateGlobalState: true })`\",\n 36: \"isolateGlobalState should be called before MobX is running any reactions\",\n 37: function _(method) {\n return \"[mobx] `observableArray.\" + method + \"()` mutates the array in-place, which is not allowed inside a derivation. Use `array.slice().\" + method + \"()` instead\";\n },\n 38: \"'ownKeys()' can only be used on observable objects\",\n 39: \"'defineProperty()' can only be used on observable objects\"\n};\nvar errors = true ? niceErrors : 0;\nfunction die(error) {\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n if (true) {\n var e = typeof error === \"string\" ? error : errors[error];\n if (typeof e === \"function\") e = e.apply(null, args);\n throw new Error(\"[MobX] \" + e);\n }\n throw new Error(typeof error === \"number\" ? \"[MobX] minified error nr: \" + error + (args.length ? \" \" + args.map(String).join(\",\") : \"\") + \". Find the full error at: https://github.com/mobxjs/mobx/blob/main/packages/mobx/src/errors.ts\" : \"[MobX] \" + error);\n}\n\nvar mockGlobal = {};\nfunction getGlobal() {\n if (typeof globalThis !== \"undefined\") {\n return globalThis;\n }\n if (typeof window !== \"undefined\") {\n return window;\n }\n if (typeof __webpack_require__.g !== \"undefined\") {\n return __webpack_require__.g;\n }\n if (typeof self !== \"undefined\") {\n return self;\n }\n return mockGlobal;\n}\n\n// We shorten anything used > 5 times\nvar assign = Object.assign;\nvar getDescriptor = Object.getOwnPropertyDescriptor;\nvar defineProperty = Object.defineProperty;\nvar objectPrototype = Object.prototype;\nvar EMPTY_ARRAY = [];\nObject.freeze(EMPTY_ARRAY);\nvar EMPTY_OBJECT = {};\nObject.freeze(EMPTY_OBJECT);\nvar hasProxy = typeof Proxy !== \"undefined\";\nvar plainObjectString = /*#__PURE__*/Object.toString();\nfunction assertProxies() {\n if (!hasProxy) {\n die( true ? \"`Proxy` objects are not available in the current environment. Please configure MobX to enable a fallback implementation.`\" : 0);\n }\n}\nfunction warnAboutProxyRequirement(msg) {\n if ( true && globalState.verifyProxies) {\n die(\"MobX is currently configured to be able to run in ES5 mode, but in ES5 MobX won't be able to \" + msg);\n }\n}\nfunction getNextId() {\n return ++globalState.mobxGuid;\n}\n/**\n * Makes sure that the provided function is invoked at most once.\n */\nfunction once(func) {\n var invoked = false;\n return function () {\n if (invoked) {\n return;\n }\n invoked = true;\n return func.apply(this, arguments);\n };\n}\nvar noop = function noop() {};\nfunction isFunction(fn) {\n return typeof fn === \"function\";\n}\nfunction isStringish(value) {\n var t = typeof value;\n switch (t) {\n case \"string\":\n case \"symbol\":\n case \"number\":\n return true;\n }\n return false;\n}\nfunction isObject(value) {\n return value !== null && typeof value === \"object\";\n}\nfunction isPlainObject(value) {\n if (!isObject(value)) {\n return false;\n }\n var proto = Object.getPrototypeOf(value);\n if (proto == null) {\n return true;\n }\n var protoConstructor = Object.hasOwnProperty.call(proto, \"constructor\") && proto.constructor;\n return typeof protoConstructor === \"function\" && protoConstructor.toString() === plainObjectString;\n}\n// https://stackoverflow.com/a/37865170\nfunction isGenerator(obj) {\n var constructor = obj == null ? void 0 : obj.constructor;\n if (!constructor) {\n return false;\n }\n if (\"GeneratorFunction\" === constructor.name || \"GeneratorFunction\" === constructor.displayName) {\n return true;\n }\n return false;\n}\nfunction addHiddenProp(object, propName, value) {\n defineProperty(object, propName, {\n enumerable: false,\n writable: true,\n configurable: true,\n value: value\n });\n}\nfunction addHiddenFinalProp(object, propName, value) {\n defineProperty(object, propName, {\n enumerable: false,\n writable: false,\n configurable: true,\n value: value\n });\n}\nfunction createInstanceofPredicate(name, theClass) {\n var propName = \"isMobX\" + name;\n theClass.prototype[propName] = true;\n return function (x) {\n return isObject(x) && x[propName] === true;\n };\n}\n/**\n * Yields true for both native and observable Map, even across different windows.\n */\nfunction isES6Map(thing) {\n return thing != null && Object.prototype.toString.call(thing) === \"[object Map]\";\n}\n/**\n * Makes sure a Map is an instance of non-inherited native or observable Map.\n */\nfunction isPlainES6Map(thing) {\n var mapProto = Object.getPrototypeOf(thing);\n var objectProto = Object.getPrototypeOf(mapProto);\n var nullProto = Object.getPrototypeOf(objectProto);\n return nullProto === null;\n}\n/**\n * Yields true for both native and observable Set, even across different windows.\n */\nfunction isES6Set(thing) {\n return thing != null && Object.prototype.toString.call(thing) === \"[object Set]\";\n}\nvar hasGetOwnPropertySymbols = typeof Object.getOwnPropertySymbols !== \"undefined\";\n/**\n * Returns the following: own enumerable keys and symbols.\n */\nfunction getPlainObjectKeys(object) {\n var keys = Object.keys(object);\n // Not supported in IE, so there are not going to be symbol props anyway...\n if (!hasGetOwnPropertySymbols) {\n return keys;\n }\n var symbols = Object.getOwnPropertySymbols(object);\n if (!symbols.length) {\n return keys;\n }\n return [].concat(keys, symbols.filter(function (s) {\n return objectPrototype.propertyIsEnumerable.call(object, s);\n }));\n}\n// From Immer utils\n// Returns all own keys, including non-enumerable and symbolic\nvar ownKeys = typeof Reflect !== \"undefined\" && Reflect.ownKeys ? Reflect.ownKeys : hasGetOwnPropertySymbols ? function (obj) {\n return Object.getOwnPropertyNames(obj).concat(Object.getOwnPropertySymbols(obj));\n} : /* istanbul ignore next */Object.getOwnPropertyNames;\nfunction stringifyKey(key) {\n if (typeof key === \"string\") {\n return key;\n }\n if (typeof key === \"symbol\") {\n return key.toString();\n }\n return new String(key).toString();\n}\nfunction toPrimitive(value) {\n return value === null ? null : typeof value === \"object\" ? \"\" + value : value;\n}\nfunction hasProp(target, prop) {\n return objectPrototype.hasOwnProperty.call(target, prop);\n}\n// From Immer utils\nvar getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors || function getOwnPropertyDescriptors(target) {\n // Polyfill needed for Hermes and IE, see https://github.com/facebook/hermes/issues/274\n var res = {};\n // Note: without polyfill for ownKeys, symbols won't be picked up\n ownKeys(target).forEach(function (key) {\n res[key] = getDescriptor(target, key);\n });\n return res;\n};\nfunction getFlag(flags, mask) {\n return !!(flags & mask);\n}\nfunction setFlag(flags, mask, newValue) {\n if (newValue) {\n flags |= mask;\n } else {\n flags &= ~mask;\n }\n return flags;\n}\n\nfunction _arrayLikeToArray(r, a) {\n (null == a || a > r.length) && (a = r.length);\n for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];\n return n;\n}\nfunction _defineProperties(e, r) {\n for (var t = 0; t < r.length; t++) {\n var o = r[t];\n o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);\n }\n}\nfunction _createClass(e, r, t) {\n return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", {\n writable: !1\n }), e;\n}\nfunction _createForOfIteratorHelperLoose(r, e) {\n var t = \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"];\n if (t) return (t = t.call(r)).next.bind(t);\n if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && \"number\" == typeof r.length) {\n t && (r = t);\n var o = 0;\n return function () {\n return o >= r.length ? {\n done: !0\n } : {\n done: !1,\n value: r[o++]\n };\n };\n }\n throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\nfunction _extends() {\n return _extends = Object.assign ? Object.assign.bind() : function (n) {\n for (var e = 1; e < arguments.length; e++) {\n var t = arguments[e];\n for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);\n }\n return n;\n }, _extends.apply(null, arguments);\n}\nfunction _inheritsLoose(t, o) {\n t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);\n}\nfunction _setPrototypeOf(t, e) {\n return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {\n return t.__proto__ = e, t;\n }, _setPrototypeOf(t, e);\n}\nfunction _toPrimitive(t, r) {\n if (\"object\" != typeof t || !t) return t;\n var e = t[Symbol.toPrimitive];\n if (void 0 !== e) {\n var i = e.call(t, r || \"default\");\n if (\"object\" != typeof i) return i;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (\"string\" === r ? String : Number)(t);\n}\nfunction _toPropertyKey(t) {\n var i = _toPrimitive(t, \"string\");\n return \"symbol\" == typeof i ? i : i + \"\";\n}\nfunction _unsupportedIterableToArray(r, a) {\n if (r) {\n if (\"string\" == typeof r) return _arrayLikeToArray(r, a);\n var t = {}.toString.call(r).slice(8, -1);\n return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;\n }\n}\n\nvar storedAnnotationsSymbol = /*#__PURE__*/Symbol(\"mobx-stored-annotations\");\n/**\n * Creates a function that acts as\n * - decorator\n * - annotation object\n */\nfunction createDecoratorAnnotation(annotation) {\n function decorator(target, property) {\n if (is20223Decorator(property)) {\n return annotation.decorate_20223_(target, property);\n } else {\n storeAnnotation(target, property, annotation);\n }\n }\n return Object.assign(decorator, annotation);\n}\n/**\n * Stores annotation to prototype,\n * so it can be inspected later by `makeObservable` called from constructor\n */\nfunction storeAnnotation(prototype, key, annotation) {\n if (!hasProp(prototype, storedAnnotationsSymbol)) {\n addHiddenProp(prototype, storedAnnotationsSymbol, _extends({}, prototype[storedAnnotationsSymbol]));\n }\n // @override must override something\n if ( true && isOverride(annotation) && !hasProp(prototype[storedAnnotationsSymbol], key)) {\n var fieldName = prototype.constructor.name + \".prototype.\" + key.toString();\n die(\"'\" + fieldName + \"' is decorated with 'override', \" + \"but no such decorated member was found on prototype.\");\n }\n // Cannot re-decorate\n assertNotDecorated(prototype, annotation, key);\n // Ignore override\n if (!isOverride(annotation)) {\n prototype[storedAnnotationsSymbol][key] = annotation;\n }\n}\nfunction assertNotDecorated(prototype, annotation, key) {\n if ( true && !isOverride(annotation) && hasProp(prototype[storedAnnotationsSymbol], key)) {\n var fieldName = prototype.constructor.name + \".prototype.\" + key.toString();\n var currentAnnotationType = prototype[storedAnnotationsSymbol][key].annotationType_;\n var requestedAnnotationType = annotation.annotationType_;\n die(\"Cannot apply '@\" + requestedAnnotationType + \"' to '\" + fieldName + \"':\" + (\"\\nThe field is already decorated with '@\" + currentAnnotationType + \"'.\") + \"\\nRe-decorating fields is not allowed.\" + \"\\nUse '@override' decorator for methods overridden by subclass.\");\n }\n}\n/**\n * Collects annotations from prototypes and stores them on target (instance)\n */\nfunction collectStoredAnnotations(target) {\n if (!hasProp(target, storedAnnotationsSymbol)) {\n // if (__DEV__ && !target[storedAnnotationsSymbol]) {\n // die(\n // `No annotations were passed to makeObservable, but no decorated members have been found either`\n // )\n // }\n // We need a copy as we will remove annotation from the list once it's applied.\n addHiddenProp(target, storedAnnotationsSymbol, _extends({}, target[storedAnnotationsSymbol]));\n }\n return target[storedAnnotationsSymbol];\n}\nfunction is20223Decorator(context) {\n return typeof context == \"object\" && typeof context[\"kind\"] == \"string\";\n}\nfunction assert20223DecoratorType(context, types) {\n if ( true && !types.includes(context.kind)) {\n die(\"The decorator applied to '\" + String(context.name) + \"' cannot be used on a \" + context.kind + \" element\");\n }\n}\n\nvar $mobx = /*#__PURE__*/Symbol(\"mobx administration\");\nvar Atom = /*#__PURE__*/function () {\n /**\n * Create a new atom. For debugging purposes it is recommended to give it a name.\n * The onBecomeObserved and onBecomeUnobserved callbacks can be used for resource management.\n */\n function Atom(name_) {\n if (name_ === void 0) {\n name_ = true ? \"Atom@\" + getNextId() : 0;\n }\n this.name_ = void 0;\n this.flags_ = 0;\n this.observers_ = new Set();\n this.lastAccessedBy_ = 0;\n this.lowestObserverState_ = IDerivationState_.NOT_TRACKING_;\n // onBecomeObservedListeners\n this.onBOL = void 0;\n // onBecomeUnobservedListeners\n this.onBUOL = void 0;\n this.name_ = name_;\n }\n // for effective unobserving. BaseAtom has true, for extra optimization, so its onBecomeUnobserved never gets called, because it's not needed\n var _proto = Atom.prototype;\n _proto.onBO = function onBO() {\n if (this.onBOL) {\n this.onBOL.forEach(function (listener) {\n return listener();\n });\n }\n };\n _proto.onBUO = function onBUO() {\n if (this.onBUOL) {\n this.onBUOL.forEach(function (listener) {\n return listener();\n });\n }\n }\n /**\n * Invoke this method to notify mobx that your atom has been used somehow.\n * Returns true if there is currently a reactive context.\n */;\n _proto.reportObserved = function reportObserved$1() {\n return reportObserved(this);\n }\n /**\n * Invoke this method _after_ this method has changed to signal mobx that all its observers should invalidate.\n */;\n _proto.reportChanged = function reportChanged() {\n startBatch();\n propagateChanged(this);\n endBatch();\n };\n _proto.toString = function toString() {\n return this.name_;\n };\n return _createClass(Atom, [{\n key: \"isBeingObserved\",\n get: function get() {\n return getFlag(this.flags_, Atom.isBeingObservedMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Atom.isBeingObservedMask_, newValue);\n }\n }, {\n key: \"isPendingUnobservation\",\n get: function get() {\n return getFlag(this.flags_, Atom.isPendingUnobservationMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Atom.isPendingUnobservationMask_, newValue);\n }\n }, {\n key: \"diffValue\",\n get: function get() {\n return getFlag(this.flags_, Atom.diffValueMask_) ? 1 : 0;\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Atom.diffValueMask_, newValue === 1 ? true : false);\n }\n }]);\n}();\nAtom.isBeingObservedMask_ = 1;\nAtom.isPendingUnobservationMask_ = 2;\nAtom.diffValueMask_ = 4;\nvar isAtom = /*#__PURE__*/createInstanceofPredicate(\"Atom\", Atom);\nfunction createAtom(name, onBecomeObservedHandler, onBecomeUnobservedHandler) {\n if (onBecomeObservedHandler === void 0) {\n onBecomeObservedHandler = noop;\n }\n if (onBecomeUnobservedHandler === void 0) {\n onBecomeUnobservedHandler = noop;\n }\n var atom = new Atom(name);\n // default `noop` listener will not initialize the hook Set\n if (onBecomeObservedHandler !== noop) {\n onBecomeObserved(atom, onBecomeObservedHandler);\n }\n if (onBecomeUnobservedHandler !== noop) {\n onBecomeUnobserved(atom, onBecomeUnobservedHandler);\n }\n return atom;\n}\n\nfunction identityComparer(a, b) {\n return a === b;\n}\nfunction structuralComparer(a, b) {\n return deepEqual(a, b);\n}\nfunction shallowComparer(a, b) {\n return deepEqual(a, b, 1);\n}\nfunction defaultComparer(a, b) {\n if (Object.is) {\n return Object.is(a, b);\n }\n return a === b ? a !== 0 || 1 / a === 1 / b : a !== a && b !== b;\n}\nvar comparer = {\n identity: identityComparer,\n structural: structuralComparer,\n \"default\": defaultComparer,\n shallow: shallowComparer\n};\n\nfunction deepEnhancer(v, _, name) {\n // it is an observable already, done\n if (isObservable(v)) {\n return v;\n }\n // something that can be converted and mutated?\n if (Array.isArray(v)) {\n return observable.array(v, {\n name: name\n });\n }\n if (isPlainObject(v)) {\n return observable.object(v, undefined, {\n name: name\n });\n }\n if (isES6Map(v)) {\n return observable.map(v, {\n name: name\n });\n }\n if (isES6Set(v)) {\n return observable.set(v, {\n name: name\n });\n }\n if (typeof v === \"function\" && !isAction(v) && !isFlow(v)) {\n if (isGenerator(v)) {\n return flow(v);\n } else {\n return autoAction(name, v);\n }\n }\n return v;\n}\nfunction shallowEnhancer(v, _, name) {\n if (v === undefined || v === null) {\n return v;\n }\n if (isObservableObject(v) || isObservableArray(v) || isObservableMap(v) || isObservableSet(v)) {\n return v;\n }\n if (Array.isArray(v)) {\n return observable.array(v, {\n name: name,\n deep: false\n });\n }\n if (isPlainObject(v)) {\n return observable.object(v, undefined, {\n name: name,\n deep: false\n });\n }\n if (isES6Map(v)) {\n return observable.map(v, {\n name: name,\n deep: false\n });\n }\n if (isES6Set(v)) {\n return observable.set(v, {\n name: name,\n deep: false\n });\n }\n if (true) {\n die(\"The shallow modifier / decorator can only used in combination with arrays, objects, maps and sets\");\n }\n}\nfunction referenceEnhancer(newValue) {\n // never turn into an observable\n return newValue;\n}\nfunction refStructEnhancer(v, oldValue) {\n if ( true && isObservable(v)) {\n die(\"observable.struct should not be used with observable values\");\n }\n if (deepEqual(v, oldValue)) {\n return oldValue;\n }\n return v;\n}\n\nvar OVERRIDE = \"override\";\nvar override = /*#__PURE__*/createDecoratorAnnotation({\n annotationType_: OVERRIDE,\n make_: make_,\n extend_: extend_,\n decorate_20223_: decorate_20223_\n});\nfunction isOverride(annotation) {\n return annotation.annotationType_ === OVERRIDE;\n}\nfunction make_(adm, key) {\n // Must not be plain object\n if ( true && adm.isPlainObject_) {\n die(\"Cannot apply '\" + this.annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + this.annotationType_ + \"' cannot be used on plain objects.\"));\n }\n // Must override something\n if ( true && !hasProp(adm.appliedAnnotations_, key)) {\n die(\"'\" + adm.name_ + \".\" + key.toString() + \"' is annotated with '\" + this.annotationType_ + \"', \" + \"but no such annotated member was found on prototype.\");\n }\n return 0 /* MakeResult.Cancel */;\n}\nfunction extend_(adm, key, descriptor, proxyTrap) {\n die(\"'\" + this.annotationType_ + \"' can only be used with 'makeObservable'\");\n}\nfunction decorate_20223_(desc, context) {\n console.warn(\"'\" + this.annotationType_ + \"' cannot be used with decorators - this is a no-op\");\n}\n\nfunction createActionAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$1,\n extend_: extend_$1,\n decorate_20223_: decorate_20223_$1\n };\n}\nfunction make_$1(adm, key, descriptor, source) {\n var _this$options_;\n // bound\n if ((_this$options_ = this.options_) != null && _this$options_.bound) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;\n }\n // own\n if (source === adm.target_) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 2 /* MakeResult.Continue */;\n }\n // prototype\n if (isAction(descriptor.value)) {\n // A prototype could have been annotated already by other constructor,\n // rest of the proto chain must be annotated already\n return 1 /* MakeResult.Break */;\n }\n var actionDescriptor = createActionDescriptor(adm, this, key, descriptor, false);\n defineProperty(source, key, actionDescriptor);\n return 2 /* MakeResult.Continue */;\n}\nfunction extend_$1(adm, key, descriptor, proxyTrap) {\n var actionDescriptor = createActionDescriptor(adm, this, key, descriptor);\n return adm.defineProperty_(key, actionDescriptor, proxyTrap);\n}\nfunction decorate_20223_$1(mthd, context) {\n if (true) {\n assert20223DecoratorType(context, [\"method\", \"field\"]);\n }\n var kind = context.kind,\n name = context.name,\n addInitializer = context.addInitializer;\n var ann = this;\n var _createAction = function _createAction(m) {\n var _ann$options_$name, _ann$options_, _ann$options_$autoAct, _ann$options_2;\n return createAction((_ann$options_$name = (_ann$options_ = ann.options_) == null ? void 0 : _ann$options_.name) != null ? _ann$options_$name : name.toString(), m, (_ann$options_$autoAct = (_ann$options_2 = ann.options_) == null ? void 0 : _ann$options_2.autoAction) != null ? _ann$options_$autoAct : false);\n };\n if (kind == \"field\") {\n return function (initMthd) {\n var _ann$options_3;\n var mthd = initMthd;\n if (!isAction(mthd)) {\n mthd = _createAction(mthd);\n }\n if ((_ann$options_3 = ann.options_) != null && _ann$options_3.bound) {\n mthd = mthd.bind(this);\n mthd.isMobxAction = true;\n }\n return mthd;\n };\n }\n if (kind == \"method\") {\n var _this$options_2;\n if (!isAction(mthd)) {\n mthd = _createAction(mthd);\n }\n if ((_this$options_2 = this.options_) != null && _this$options_2.bound) {\n addInitializer(function () {\n var self = this;\n var bound = self[name].bind(self);\n bound.isMobxAction = true;\n self[name] = bound;\n });\n }\n return mthd;\n }\n die(\"Cannot apply '\" + ann.annotationType_ + \"' to '\" + String(name) + \"' (kind: \" + kind + \"):\" + (\"\\n'\" + ann.annotationType_ + \"' can only be used on properties with a function value.\"));\n}\nfunction assertActionDescriptor(adm, _ref, key, _ref2) {\n var annotationType_ = _ref.annotationType_;\n var value = _ref2.value;\n if ( true && !isFunction(value)) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' can only be used on properties with a function value.\"));\n }\n}\nfunction createActionDescriptor(adm, annotation, key, descriptor,\n// provides ability to disable safeDescriptors for prototypes\nsafeDescriptors) {\n var _annotation$options_, _annotation$options_$, _annotation$options_2, _annotation$options_$2, _annotation$options_3, _annotation$options_4, _adm$proxy_2;\n if (safeDescriptors === void 0) {\n safeDescriptors = globalState.safeDescriptors;\n }\n assertActionDescriptor(adm, annotation, key, descriptor);\n var value = descriptor.value;\n if ((_annotation$options_ = annotation.options_) != null && _annotation$options_.bound) {\n var _adm$proxy_;\n value = value.bind((_adm$proxy_ = adm.proxy_) != null ? _adm$proxy_ : adm.target_);\n }\n return {\n value: createAction((_annotation$options_$ = (_annotation$options_2 = annotation.options_) == null ? void 0 : _annotation$options_2.name) != null ? _annotation$options_$ : key.toString(), value, (_annotation$options_$2 = (_annotation$options_3 = annotation.options_) == null ? void 0 : _annotation$options_3.autoAction) != null ? _annotation$options_$2 : false,\n // https://github.com/mobxjs/mobx/discussions/3140\n (_annotation$options_4 = annotation.options_) != null && _annotation$options_4.bound ? (_adm$proxy_2 = adm.proxy_) != null ? _adm$proxy_2 : adm.target_ : undefined),\n // Non-configurable for classes\n // prevents accidental field redefinition in subclass\n configurable: safeDescriptors ? adm.isPlainObject_ : true,\n // https://github.com/mobxjs/mobx/pull/2641#issuecomment-737292058\n enumerable: false,\n // Non-obsevable, therefore non-writable\n // Also prevents rewriting in subclass constructor\n writable: safeDescriptors ? false : true\n };\n}\n\nfunction createFlowAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$2,\n extend_: extend_$2,\n decorate_20223_: decorate_20223_$2\n };\n}\nfunction make_$2(adm, key, descriptor, source) {\n var _this$options_;\n // own\n if (source === adm.target_) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 2 /* MakeResult.Continue */;\n }\n // prototype\n // bound - must annotate protos to support super.flow()\n if ((_this$options_ = this.options_) != null && _this$options_.bound && (!hasProp(adm.target_, key) || !isFlow(adm.target_[key]))) {\n if (this.extend_(adm, key, descriptor, false) === null) {\n return 0 /* MakeResult.Cancel */;\n }\n }\n if (isFlow(descriptor.value)) {\n // A prototype could have been annotated already by other constructor,\n // rest of the proto chain must be annotated already\n return 1 /* MakeResult.Break */;\n }\n var flowDescriptor = createFlowDescriptor(adm, this, key, descriptor, false, false);\n defineProperty(source, key, flowDescriptor);\n return 2 /* MakeResult.Continue */;\n}\nfunction extend_$2(adm, key, descriptor, proxyTrap) {\n var _this$options_2;\n var flowDescriptor = createFlowDescriptor(adm, this, key, descriptor, (_this$options_2 = this.options_) == null ? void 0 : _this$options_2.bound);\n return adm.defineProperty_(key, flowDescriptor, proxyTrap);\n}\nfunction decorate_20223_$2(mthd, context) {\n var _this$options_3;\n if (true) {\n assert20223DecoratorType(context, [\"method\"]);\n }\n var name = context.name,\n addInitializer = context.addInitializer;\n if (!isFlow(mthd)) {\n mthd = flow(mthd);\n }\n if ((_this$options_3 = this.options_) != null && _this$options_3.bound) {\n addInitializer(function () {\n var self = this;\n var bound = self[name].bind(self);\n bound.isMobXFlow = true;\n self[name] = bound;\n });\n }\n return mthd;\n}\nfunction assertFlowDescriptor(adm, _ref, key, _ref2) {\n var annotationType_ = _ref.annotationType_;\n var value = _ref2.value;\n if ( true && !isFunction(value)) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' can only be used on properties with a generator function value.\"));\n }\n}\nfunction createFlowDescriptor(adm, annotation, key, descriptor, bound,\n// provides ability to disable safeDescriptors for prototypes\nsafeDescriptors) {\n if (safeDescriptors === void 0) {\n safeDescriptors = globalState.safeDescriptors;\n }\n assertFlowDescriptor(adm, annotation, key, descriptor);\n var value = descriptor.value;\n // In case of flow.bound, the descriptor can be from already annotated prototype\n if (!isFlow(value)) {\n value = flow(value);\n }\n if (bound) {\n var _adm$proxy_;\n // We do not keep original function around, so we bind the existing flow\n value = value.bind((_adm$proxy_ = adm.proxy_) != null ? _adm$proxy_ : adm.target_);\n // This is normally set by `flow`, but `bind` returns new function...\n value.isMobXFlow = true;\n }\n return {\n value: value,\n // Non-configurable for classes\n // prevents accidental field redefinition in subclass\n configurable: safeDescriptors ? adm.isPlainObject_ : true,\n // https://github.com/mobxjs/mobx/pull/2641#issuecomment-737292058\n enumerable: false,\n // Non-obsevable, therefore non-writable\n // Also prevents rewriting in subclass constructor\n writable: safeDescriptors ? false : true\n };\n}\n\nfunction createComputedAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$3,\n extend_: extend_$3,\n decorate_20223_: decorate_20223_$3\n };\n}\nfunction make_$3(adm, key, descriptor) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;\n}\nfunction extend_$3(adm, key, descriptor, proxyTrap) {\n assertComputedDescriptor(adm, this, key, descriptor);\n return adm.defineComputedProperty_(key, _extends({}, this.options_, {\n get: descriptor.get,\n set: descriptor.set\n }), proxyTrap);\n}\nfunction decorate_20223_$3(get, context) {\n if (true) {\n assert20223DecoratorType(context, [\"getter\"]);\n }\n var ann = this;\n var key = context.name,\n addInitializer = context.addInitializer;\n addInitializer(function () {\n var adm = asObservableObject(this)[$mobx];\n var options = _extends({}, ann.options_, {\n get: get,\n context: this\n });\n options.name || (options.name = true ? adm.name_ + \".\" + key.toString() : 0);\n adm.values_.set(key, new ComputedValue(options));\n });\n return function () {\n return this[$mobx].getObservablePropValue_(key);\n };\n}\nfunction assertComputedDescriptor(adm, _ref, key, _ref2) {\n var annotationType_ = _ref.annotationType_;\n var get = _ref2.get;\n if ( true && !get) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' can only be used on getter(+setter) properties.\"));\n }\n}\n\nfunction createObservableAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$4,\n extend_: extend_$4,\n decorate_20223_: decorate_20223_$4\n };\n}\nfunction make_$4(adm, key, descriptor) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;\n}\nfunction extend_$4(adm, key, descriptor, proxyTrap) {\n var _this$options_$enhanc, _this$options_;\n assertObservableDescriptor(adm, this, key, descriptor);\n return adm.defineObservableProperty_(key, descriptor.value, (_this$options_$enhanc = (_this$options_ = this.options_) == null ? void 0 : _this$options_.enhancer) != null ? _this$options_$enhanc : deepEnhancer, proxyTrap);\n}\nfunction decorate_20223_$4(desc, context) {\n if (true) {\n if (context.kind === \"field\") {\n throw die(\"Please use `@observable accessor \" + String(context.name) + \"` instead of `@observable \" + String(context.name) + \"`\");\n }\n assert20223DecoratorType(context, [\"accessor\"]);\n }\n var ann = this;\n var kind = context.kind,\n name = context.name;\n // The laziness here is not ideal... It's a workaround to how 2022.3 Decorators are implemented:\n // `addInitializer` callbacks are executed _before_ any accessors are defined (instead of the ideal-for-us right after each).\n // This means that, if we were to do our stuff in an `addInitializer`, we'd attempt to read a private slot\n // before it has been initialized. The runtime doesn't like that and throws a `Cannot read private member\n // from an object whose class did not declare it` error.\n // TODO: it seems that this will not be required anymore in the final version of the spec\n // See TODO: link\n var initializedObjects = new WeakSet();\n function initializeObservable(target, value) {\n var _ann$options_$enhance, _ann$options_;\n var adm = asObservableObject(target)[$mobx];\n var observable = new ObservableValue(value, (_ann$options_$enhance = (_ann$options_ = ann.options_) == null ? void 0 : _ann$options_.enhancer) != null ? _ann$options_$enhance : deepEnhancer, true ? adm.name_ + \".\" + name.toString() : 0, false);\n adm.values_.set(name, observable);\n initializedObjects.add(target);\n }\n if (kind == \"accessor\") {\n return {\n get: function get() {\n if (!initializedObjects.has(this)) {\n initializeObservable(this, desc.get.call(this));\n }\n return this[$mobx].getObservablePropValue_(name);\n },\n set: function set(value) {\n if (!initializedObjects.has(this)) {\n initializeObservable(this, value);\n }\n return this[$mobx].setObservablePropValue_(name, value);\n },\n init: function init(value) {\n if (!initializedObjects.has(this)) {\n initializeObservable(this, value);\n }\n return value;\n }\n };\n }\n return;\n}\nfunction assertObservableDescriptor(adm, _ref, key, descriptor) {\n var annotationType_ = _ref.annotationType_;\n if ( true && !(\"value\" in descriptor)) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' cannot be used on getter/setter properties\"));\n }\n}\n\nvar AUTO = \"true\";\nvar autoAnnotation = /*#__PURE__*/createAutoAnnotation();\nfunction createAutoAnnotation(options) {\n return {\n annotationType_: AUTO,\n options_: options,\n make_: make_$5,\n extend_: extend_$5,\n decorate_20223_: decorate_20223_$5\n };\n}\nfunction make_$5(adm, key, descriptor, source) {\n var _this$options_3, _this$options_4;\n // getter -> computed\n if (descriptor.get) {\n return computed.make_(adm, key, descriptor, source);\n }\n // lone setter -> action setter\n if (descriptor.set) {\n // TODO make action applicable to setter and delegate to action.make_\n var set = createAction(key.toString(), descriptor.set);\n // own\n if (source === adm.target_) {\n return adm.defineProperty_(key, {\n configurable: globalState.safeDescriptors ? adm.isPlainObject_ : true,\n set: set\n }) === null ? 0 /* MakeResult.Cancel */ : 2 /* MakeResult.Continue */;\n }\n // proto\n defineProperty(source, key, {\n configurable: true,\n set: set\n });\n return 2 /* MakeResult.Continue */;\n }\n // function on proto -> autoAction/flow\n if (source !== adm.target_ && typeof descriptor.value === \"function\") {\n var _this$options_2;\n if (isGenerator(descriptor.value)) {\n var _this$options_;\n var flowAnnotation = (_this$options_ = this.options_) != null && _this$options_.autoBind ? flow.bound : flow;\n return flowAnnotation.make_(adm, key, descriptor, source);\n }\n var actionAnnotation = (_this$options_2 = this.options_) != null && _this$options_2.autoBind ? autoAction.bound : autoAction;\n return actionAnnotation.make_(adm, key, descriptor, source);\n }\n // other -> observable\n // Copy props from proto as well, see test:\n // \"decorate should work with Object.create\"\n var observableAnnotation = ((_this$options_3 = this.options_) == null ? void 0 : _this$options_3.deep) === false ? observable.ref : observable;\n // if function respect autoBind option\n if (typeof descriptor.value === \"function\" && (_this$options_4 = this.options_) != null && _this$options_4.autoBind) {\n var _adm$proxy_;\n descriptor.value = descriptor.value.bind((_adm$proxy_ = adm.proxy_) != null ? _adm$proxy_ : adm.target_);\n }\n return observableAnnotation.make_(adm, key, descriptor, source);\n}\nfunction extend_$5(adm, key, descriptor, proxyTrap) {\n var _this$options_5, _this$options_6;\n // getter -> computed\n if (descriptor.get) {\n return computed.extend_(adm, key, descriptor, proxyTrap);\n }\n // lone setter -> action setter\n if (descriptor.set) {\n // TODO make action applicable to setter and delegate to action.extend_\n return adm.defineProperty_(key, {\n configurable: globalState.safeDescriptors ? adm.isPlainObject_ : true,\n set: createAction(key.toString(), descriptor.set)\n }, proxyTrap);\n }\n // other -> observable\n // if function respect autoBind option\n if (typeof descriptor.value === \"function\" && (_this$options_5 = this.options_) != null && _this$options_5.autoBind) {\n var _adm$proxy_2;\n descriptor.value = descriptor.value.bind((_adm$proxy_2 = adm.proxy_) != null ? _adm$proxy_2 : adm.target_);\n }\n var observableAnnotation = ((_this$options_6 = this.options_) == null ? void 0 : _this$options_6.deep) === false ? observable.ref : observable;\n return observableAnnotation.extend_(adm, key, descriptor, proxyTrap);\n}\nfunction decorate_20223_$5(desc, context) {\n die(\"'\" + this.annotationType_ + \"' cannot be used as a decorator\");\n}\n\nvar OBSERVABLE = \"observable\";\nvar OBSERVABLE_REF = \"observable.ref\";\nvar OBSERVABLE_SHALLOW = \"observable.shallow\";\nvar OBSERVABLE_STRUCT = \"observable.struct\";\n// Predefined bags of create observable options, to avoid allocating temporarily option objects\n// in the majority of cases\nvar defaultCreateObservableOptions = {\n deep: true,\n name: undefined,\n defaultDecorator: undefined,\n proxy: true\n};\nObject.freeze(defaultCreateObservableOptions);\nfunction asCreateObservableOptions(thing) {\n return thing || defaultCreateObservableOptions;\n}\nvar observableAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE);\nvar observableRefAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE_REF, {\n enhancer: referenceEnhancer\n});\nvar observableShallowAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE_SHALLOW, {\n enhancer: shallowEnhancer\n});\nvar observableStructAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE_STRUCT, {\n enhancer: refStructEnhancer\n});\nvar observableDecoratorAnnotation = /*#__PURE__*/createDecoratorAnnotation(observableAnnotation);\nfunction getEnhancerFromOptions(options) {\n return options.deep === true ? deepEnhancer : options.deep === false ? referenceEnhancer : getEnhancerFromAnnotation(options.defaultDecorator);\n}\nfunction getAnnotationFromOptions(options) {\n var _options$defaultDecor;\n return options ? (_options$defaultDecor = options.defaultDecorator) != null ? _options$defaultDecor : createAutoAnnotation(options) : undefined;\n}\nfunction getEnhancerFromAnnotation(annotation) {\n var _annotation$options_$, _annotation$options_;\n return !annotation ? deepEnhancer : (_annotation$options_$ = (_annotation$options_ = annotation.options_) == null ? void 0 : _annotation$options_.enhancer) != null ? _annotation$options_$ : deepEnhancer;\n}\n/**\n * Turns an object, array or function into a reactive structure.\n * @param v the value which should become observable.\n */\nfunction createObservable(v, arg2, arg3) {\n // @observable someProp; (2022.3 Decorators)\n if (is20223Decorator(arg2)) {\n return observableAnnotation.decorate_20223_(v, arg2);\n }\n // @observable someProp;\n if (isStringish(arg2)) {\n storeAnnotation(v, arg2, observableAnnotation);\n return;\n }\n // already observable - ignore\n if (isObservable(v)) {\n return v;\n }\n // plain object\n if (isPlainObject(v)) {\n return observable.object(v, arg2, arg3);\n }\n // Array\n if (Array.isArray(v)) {\n return observable.array(v, arg2);\n }\n // Map\n if (isES6Map(v)) {\n return observable.map(v, arg2);\n }\n // Set\n if (isES6Set(v)) {\n return observable.set(v, arg2);\n }\n // other object - ignore\n if (typeof v === \"object\" && v !== null) {\n return v;\n }\n // anything else\n return observable.box(v, arg2);\n}\nassign(createObservable, observableDecoratorAnnotation);\nvar observableFactories = {\n box: function box(value, options) {\n var o = asCreateObservableOptions(options);\n return new ObservableValue(value, getEnhancerFromOptions(o), o.name, true, o.equals);\n },\n array: function array(initialValues, options) {\n var o = asCreateObservableOptions(options);\n return (globalState.useProxies === false || o.proxy === false ? createLegacyArray : createObservableArray)(initialValues, getEnhancerFromOptions(o), o.name);\n },\n map: function map(initialValues, options) {\n var o = asCreateObservableOptions(options);\n return new ObservableMap(initialValues, getEnhancerFromOptions(o), o.name);\n },\n set: function set(initialValues, options) {\n var o = asCreateObservableOptions(options);\n return new ObservableSet(initialValues, getEnhancerFromOptions(o), o.name);\n },\n object: function object(props, decorators, options) {\n return initObservable(function () {\n return extendObservable(globalState.useProxies === false || (options == null ? void 0 : options.proxy) === false ? asObservableObject({}, options) : asDynamicObservableObject({}, options), props, decorators);\n });\n },\n ref: /*#__PURE__*/createDecoratorAnnotation(observableRefAnnotation),\n shallow: /*#__PURE__*/createDecoratorAnnotation(observableShallowAnnotation),\n deep: observableDecoratorAnnotation,\n struct: /*#__PURE__*/createDecoratorAnnotation(observableStructAnnotation)\n};\n// eslint-disable-next-line\nvar observable = /*#__PURE__*/assign(createObservable, observableFactories);\n\nvar COMPUTED = \"computed\";\nvar COMPUTED_STRUCT = \"computed.struct\";\nvar computedAnnotation = /*#__PURE__*/createComputedAnnotation(COMPUTED);\nvar computedStructAnnotation = /*#__PURE__*/createComputedAnnotation(COMPUTED_STRUCT, {\n equals: comparer.structural\n});\n/**\n * Decorator for class properties: @computed get value() { return expr; }.\n * For legacy purposes also invokable as ES5 observable created: `computed(() => expr)`;\n */\nvar computed = function computed(arg1, arg2) {\n if (is20223Decorator(arg2)) {\n // @computed (2022.3 Decorators)\n return computedAnnotation.decorate_20223_(arg1, arg2);\n }\n if (isStringish(arg2)) {\n // @computed\n return storeAnnotation(arg1, arg2, computedAnnotation);\n }\n if (isPlainObject(arg1)) {\n // @computed({ options })\n return createDecoratorAnnotation(createComputedAnnotation(COMPUTED, arg1));\n }\n // computed(expr, options?)\n if (true) {\n if (!isFunction(arg1)) {\n die(\"First argument to `computed` should be an expression.\");\n }\n if (isFunction(arg2)) {\n die(\"A setter as second argument is no longer supported, use `{ set: fn }` option instead\");\n }\n }\n var opts = isPlainObject(arg2) ? arg2 : {};\n opts.get = arg1;\n opts.name || (opts.name = arg1.name || \"\"); /* for generated name */\n return new ComputedValue(opts);\n};\nObject.assign(computed, computedAnnotation);\ncomputed.struct = /*#__PURE__*/createDecoratorAnnotation(computedStructAnnotation);\n\nvar _getDescriptor$config, _getDescriptor;\n// we don't use globalState for these in order to avoid possible issues with multiple\n// mobx versions\nvar currentActionId = 0;\nvar nextActionId = 1;\nvar isFunctionNameConfigurable = (_getDescriptor$config = (_getDescriptor = /*#__PURE__*/getDescriptor(function () {}, \"name\")) == null ? void 0 : _getDescriptor.configurable) != null ? _getDescriptor$config : false;\n// we can safely recycle this object\nvar tmpNameDescriptor = {\n value: \"action\",\n configurable: true,\n writable: false,\n enumerable: false\n};\nfunction createAction(actionName, fn, autoAction, ref) {\n if (autoAction === void 0) {\n autoAction = false;\n }\n if (true) {\n if (!isFunction(fn)) {\n die(\"`action` can only be invoked on functions\");\n }\n if (typeof actionName !== \"string\" || !actionName) {\n die(\"actions should have valid names, got: '\" + actionName + \"'\");\n }\n }\n function res() {\n return executeAction(actionName, autoAction, fn, ref || this, arguments);\n }\n res.isMobxAction = true;\n res.toString = function () {\n return fn.toString();\n };\n if (isFunctionNameConfigurable) {\n tmpNameDescriptor.value = actionName;\n defineProperty(res, \"name\", tmpNameDescriptor);\n }\n return res;\n}\nfunction executeAction(actionName, canRunAsDerivation, fn, scope, args) {\n var runInfo = _startAction(actionName, canRunAsDerivation, scope, args);\n try {\n return fn.apply(scope, args);\n } catch (err) {\n runInfo.error_ = err;\n throw err;\n } finally {\n _endAction(runInfo);\n }\n}\nfunction _startAction(actionName, canRunAsDerivation,\n// true for autoAction\nscope, args) {\n var notifySpy_ = true && isSpyEnabled() && !!actionName;\n var startTime_ = 0;\n if ( true && notifySpy_) {\n startTime_ = Date.now();\n var flattenedArgs = args ? Array.from(args) : EMPTY_ARRAY;\n spyReportStart({\n type: ACTION,\n name: actionName,\n object: scope,\n arguments: flattenedArgs\n });\n }\n var prevDerivation_ = globalState.trackingDerivation;\n var runAsAction = !canRunAsDerivation || !prevDerivation_;\n startBatch();\n var prevAllowStateChanges_ = globalState.allowStateChanges; // by default preserve previous allow\n if (runAsAction) {\n untrackedStart();\n prevAllowStateChanges_ = allowStateChangesStart(true);\n }\n var prevAllowStateReads_ = allowStateReadsStart(true);\n var runInfo = {\n runAsAction_: runAsAction,\n prevDerivation_: prevDerivation_,\n prevAllowStateChanges_: prevAllowStateChanges_,\n prevAllowStateReads_: prevAllowStateReads_,\n notifySpy_: notifySpy_,\n startTime_: startTime_,\n actionId_: nextActionId++,\n parentActionId_: currentActionId\n };\n currentActionId = runInfo.actionId_;\n return runInfo;\n}\nfunction _endAction(runInfo) {\n if (currentActionId !== runInfo.actionId_) {\n die(30);\n }\n currentActionId = runInfo.parentActionId_;\n if (runInfo.error_ !== undefined) {\n globalState.suppressReactionErrors = true;\n }\n allowStateChangesEnd(runInfo.prevAllowStateChanges_);\n allowStateReadsEnd(runInfo.prevAllowStateReads_);\n endBatch();\n if (runInfo.runAsAction_) {\n untrackedEnd(runInfo.prevDerivation_);\n }\n if ( true && runInfo.notifySpy_) {\n spyReportEnd({\n time: Date.now() - runInfo.startTime_\n });\n }\n globalState.suppressReactionErrors = false;\n}\nfunction allowStateChanges(allowStateChanges, func) {\n var prev = allowStateChangesStart(allowStateChanges);\n try {\n return func();\n } finally {\n allowStateChangesEnd(prev);\n }\n}\nfunction allowStateChangesStart(allowStateChanges) {\n var prev = globalState.allowStateChanges;\n globalState.allowStateChanges = allowStateChanges;\n return prev;\n}\nfunction allowStateChangesEnd(prev) {\n globalState.allowStateChanges = prev;\n}\n\nvar CREATE = \"create\";\nvar ObservableValue = /*#__PURE__*/function (_Atom) {\n function ObservableValue(value, enhancer, name_, notifySpy, equals) {\n var _this;\n if (name_ === void 0) {\n name_ = true ? \"ObservableValue@\" + getNextId() : 0;\n }\n if (notifySpy === void 0) {\n notifySpy = true;\n }\n if (equals === void 0) {\n equals = comparer[\"default\"];\n }\n _this = _Atom.call(this, name_) || this;\n _this.enhancer = void 0;\n _this.name_ = void 0;\n _this.equals = void 0;\n _this.hasUnreportedChange_ = false;\n _this.interceptors_ = void 0;\n _this.changeListeners_ = void 0;\n _this.value_ = void 0;\n _this.dehancer = void 0;\n _this.enhancer = enhancer;\n _this.name_ = name_;\n _this.equals = equals;\n _this.value_ = enhancer(value, undefined, name_);\n if ( true && notifySpy && isSpyEnabled()) {\n // only notify spy if this is a stand-alone observable\n spyReport({\n type: CREATE,\n object: _this,\n observableKind: \"value\",\n debugObjectName: _this.name_,\n newValue: \"\" + _this.value_\n });\n }\n return _this;\n }\n _inheritsLoose(ObservableValue, _Atom);\n var _proto = ObservableValue.prototype;\n _proto.dehanceValue = function dehanceValue(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.set = function set(newValue) {\n var oldValue = this.value_;\n newValue = this.prepareNewValue_(newValue);\n if (newValue !== globalState.UNCHANGED) {\n var notifySpy = isSpyEnabled();\n if ( true && notifySpy) {\n spyReportStart({\n type: UPDATE,\n object: this,\n observableKind: \"value\",\n debugObjectName: this.name_,\n newValue: newValue,\n oldValue: oldValue\n });\n }\n this.setNewValue_(newValue);\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n };\n _proto.prepareNewValue_ = function prepareNewValue_(newValue) {\n checkIfStateModificationsAreAllowed(this);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this,\n type: UPDATE,\n newValue: newValue\n });\n if (!change) {\n return globalState.UNCHANGED;\n }\n newValue = change.newValue;\n }\n // apply modifier\n newValue = this.enhancer(newValue, this.value_, this.name_);\n return this.equals(this.value_, newValue) ? globalState.UNCHANGED : newValue;\n };\n _proto.setNewValue_ = function setNewValue_(newValue) {\n var oldValue = this.value_;\n this.value_ = newValue;\n this.reportChanged();\n if (hasListeners(this)) {\n notifyListeners(this, {\n type: UPDATE,\n object: this,\n newValue: newValue,\n oldValue: oldValue\n });\n }\n };\n _proto.get = function get() {\n this.reportObserved();\n return this.dehanceValue(this.value_);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n if (fireImmediately) {\n listener({\n observableKind: \"value\",\n debugObjectName: this.name_,\n object: this,\n type: UPDATE,\n newValue: this.value_,\n oldValue: undefined\n });\n }\n return registerListener(this, listener);\n };\n _proto.raw = function raw() {\n // used by MST ot get undehanced value\n return this.value_;\n };\n _proto.toJSON = function toJSON() {\n return this.get();\n };\n _proto.toString = function toString() {\n return this.name_ + \"[\" + this.value_ + \"]\";\n };\n _proto.valueOf = function valueOf() {\n return toPrimitive(this.get());\n };\n _proto[Symbol.toPrimitive] = function () {\n return this.valueOf();\n };\n return ObservableValue;\n}(Atom);\nvar isObservableValue = /*#__PURE__*/createInstanceofPredicate(\"ObservableValue\", ObservableValue);\n\n/**\n * A node in the state dependency root that observes other nodes, and can be observed itself.\n *\n * ComputedValue will remember the result of the computation for the duration of the batch, or\n * while being observed.\n *\n * During this time it will recompute only when one of its direct dependencies changed,\n * but only when it is being accessed with `ComputedValue.get()`.\n *\n * Implementation description:\n * 1. First time it's being accessed it will compute and remember result\n * give back remembered result until 2. happens\n * 2. First time any deep dependency change, propagate POSSIBLY_STALE to all observers, wait for 3.\n * 3. When it's being accessed, recompute if any shallow dependency changed.\n * if result changed: propagate STALE to all observers, that were POSSIBLY_STALE from the last step.\n * go to step 2. either way\n *\n * If at any point it's outside batch and it isn't observed: reset everything and go to 1.\n */\nvar ComputedValue = /*#__PURE__*/function () {\n /**\n * Create a new computed value based on a function expression.\n *\n * The `name` property is for debug purposes only.\n *\n * The `equals` property specifies the comparer function to use to determine if a newly produced\n * value differs from the previous value. Two comparers are provided in the library; `defaultComparer`\n * compares based on identity comparison (===), and `structuralComparer` deeply compares the structure.\n * Structural comparison can be convenient if you always produce a new aggregated object and\n * don't want to notify observers if it is structurally the same.\n * This is useful for working with vectors, mouse coordinates etc.\n */\n function ComputedValue(options) {\n this.dependenciesState_ = IDerivationState_.NOT_TRACKING_;\n this.observing_ = [];\n // nodes we are looking at. Our value depends on these nodes\n this.newObserving_ = null;\n // during tracking it's an array with new observed observers\n this.observers_ = new Set();\n this.runId_ = 0;\n this.lastAccessedBy_ = 0;\n this.lowestObserverState_ = IDerivationState_.UP_TO_DATE_;\n this.unboundDepsCount_ = 0;\n this.value_ = new CaughtException(null);\n this.name_ = void 0;\n this.triggeredBy_ = void 0;\n this.flags_ = 0;\n this.derivation = void 0;\n // N.B: unminified as it is used by MST\n this.setter_ = void 0;\n this.isTracing_ = TraceMode.NONE;\n this.scope_ = void 0;\n this.equals_ = void 0;\n this.requiresReaction_ = void 0;\n this.keepAlive_ = void 0;\n this.onBOL = void 0;\n this.onBUOL = void 0;\n if (!options.get) {\n die(31);\n }\n this.derivation = options.get;\n this.name_ = options.name || ( true ? \"ComputedValue@\" + getNextId() : 0);\n if (options.set) {\n this.setter_ = createAction( true ? this.name_ + \"-setter\" : 0, options.set);\n }\n this.equals_ = options.equals || (options.compareStructural || options.struct ? comparer.structural : comparer[\"default\"]);\n this.scope_ = options.context;\n this.requiresReaction_ = options.requiresReaction;\n this.keepAlive_ = !!options.keepAlive;\n }\n var _proto = ComputedValue.prototype;\n _proto.onBecomeStale_ = function onBecomeStale_() {\n propagateMaybeChanged(this);\n };\n _proto.onBO = function onBO() {\n if (this.onBOL) {\n this.onBOL.forEach(function (listener) {\n return listener();\n });\n }\n };\n _proto.onBUO = function onBUO() {\n if (this.onBUOL) {\n this.onBUOL.forEach(function (listener) {\n return listener();\n });\n }\n }\n // to check for cycles\n ;\n /**\n * Returns the current value of this computed value.\n * Will evaluate its computation first if needed.\n */\n _proto.get = function get() {\n if (this.isComputing) {\n die(32, this.name_, this.derivation);\n }\n if (globalState.inBatch === 0 &&\n // !globalState.trackingDerivatpion &&\n this.observers_.size === 0 && !this.keepAlive_) {\n if (shouldCompute(this)) {\n this.warnAboutUntrackedRead_();\n startBatch(); // See perf test 'computed memoization'\n this.value_ = this.computeValue_(false);\n endBatch();\n }\n } else {\n reportObserved(this);\n if (shouldCompute(this)) {\n var prevTrackingContext = globalState.trackingContext;\n if (this.keepAlive_ && !prevTrackingContext) {\n globalState.trackingContext = this;\n }\n if (this.trackAndCompute()) {\n propagateChangeConfirmed(this);\n }\n globalState.trackingContext = prevTrackingContext;\n }\n }\n var result = this.value_;\n if (isCaughtException(result)) {\n throw result.cause;\n }\n return result;\n };\n _proto.set = function set(value) {\n if (this.setter_) {\n if (this.isRunningSetter) {\n die(33, this.name_);\n }\n this.isRunningSetter = true;\n try {\n this.setter_.call(this.scope_, value);\n } finally {\n this.isRunningSetter = false;\n }\n } else {\n die(34, this.name_);\n }\n };\n _proto.trackAndCompute = function trackAndCompute() {\n // N.B: unminified as it is used by MST\n var oldValue = this.value_;\n var wasSuspended = /* see #1208 */this.dependenciesState_ === IDerivationState_.NOT_TRACKING_;\n var newValue = this.computeValue_(true);\n var changed = wasSuspended || isCaughtException(oldValue) || isCaughtException(newValue) || !this.equals_(oldValue, newValue);\n if (changed) {\n this.value_ = newValue;\n if ( true && isSpyEnabled()) {\n spyReport({\n observableKind: \"computed\",\n debugObjectName: this.name_,\n object: this.scope_,\n type: \"update\",\n oldValue: oldValue,\n newValue: newValue\n });\n }\n }\n return changed;\n };\n _proto.computeValue_ = function computeValue_(track) {\n this.isComputing = true;\n // don't allow state changes during computation\n var prev = allowStateChangesStart(false);\n var res;\n if (track) {\n res = trackDerivedFunction(this, this.derivation, this.scope_);\n } else {\n if (globalState.disableErrorBoundaries === true) {\n res = this.derivation.call(this.scope_);\n } else {\n try {\n res = this.derivation.call(this.scope_);\n } catch (e) {\n res = new CaughtException(e);\n }\n }\n }\n allowStateChangesEnd(prev);\n this.isComputing = false;\n return res;\n };\n _proto.suspend_ = function suspend_() {\n if (!this.keepAlive_) {\n clearObserving(this);\n this.value_ = undefined; // don't hold on to computed value!\n if ( true && this.isTracing_ !== TraceMode.NONE) {\n console.log(\"[mobx.trace] Computed value '\" + this.name_ + \"' was suspended and it will recompute on the next access.\");\n }\n }\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n var _this = this;\n var firstTime = true;\n var prevValue = undefined;\n return autorun(function () {\n // TODO: why is this in a different place than the spyReport() function? in all other observables it's called in the same place\n var newValue = _this.get();\n if (!firstTime || fireImmediately) {\n var prevU = untrackedStart();\n listener({\n observableKind: \"computed\",\n debugObjectName: _this.name_,\n type: UPDATE,\n object: _this,\n newValue: newValue,\n oldValue: prevValue\n });\n untrackedEnd(prevU);\n }\n firstTime = false;\n prevValue = newValue;\n });\n };\n _proto.warnAboutUntrackedRead_ = function warnAboutUntrackedRead_() {\n if (false) {}\n if (this.isTracing_ !== TraceMode.NONE) {\n console.log(\"[mobx.trace] Computed value '\" + this.name_ + \"' is being read outside a reactive context. Doing a full recompute.\");\n }\n if (typeof this.requiresReaction_ === \"boolean\" ? this.requiresReaction_ : globalState.computedRequiresReaction) {\n console.warn(\"[mobx] Computed value '\" + this.name_ + \"' is being read outside a reactive context. Doing a full recompute.\");\n }\n };\n _proto.toString = function toString() {\n return this.name_ + \"[\" + this.derivation.toString() + \"]\";\n };\n _proto.valueOf = function valueOf() {\n return toPrimitive(this.get());\n };\n _proto[Symbol.toPrimitive] = function () {\n return this.valueOf();\n };\n return _createClass(ComputedValue, [{\n key: \"isComputing\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isComputingMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isComputingMask_, newValue);\n }\n }, {\n key: \"isRunningSetter\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isRunningSetterMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isRunningSetterMask_, newValue);\n }\n }, {\n key: \"isBeingObserved\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isBeingObservedMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isBeingObservedMask_, newValue);\n }\n }, {\n key: \"isPendingUnobservation\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isPendingUnobservationMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isPendingUnobservationMask_, newValue);\n }\n }, {\n key: \"diffValue\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.diffValueMask_) ? 1 : 0;\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.diffValueMask_, newValue === 1 ? true : false);\n }\n }]);\n}();\nComputedValue.isComputingMask_ = 1;\nComputedValue.isRunningSetterMask_ = 2;\nComputedValue.isBeingObservedMask_ = 4;\nComputedValue.isPendingUnobservationMask_ = 8;\nComputedValue.diffValueMask_ = 16;\nvar isComputedValue = /*#__PURE__*/createInstanceofPredicate(\"ComputedValue\", ComputedValue);\n\nvar IDerivationState_;\n(function (IDerivationState_) {\n // before being run or (outside batch and not being observed)\n // at this point derivation is not holding any data about dependency tree\n IDerivationState_[IDerivationState_[\"NOT_TRACKING_\"] = -1] = \"NOT_TRACKING_\";\n // no shallow dependency changed since last computation\n // won't recalculate derivation\n // this is what makes mobx fast\n IDerivationState_[IDerivationState_[\"UP_TO_DATE_\"] = 0] = \"UP_TO_DATE_\";\n // some deep dependency changed, but don't know if shallow dependency changed\n // will require to check first if UP_TO_DATE or POSSIBLY_STALE\n // currently only ComputedValue will propagate POSSIBLY_STALE\n //\n // having this state is second big optimization:\n // don't have to recompute on every dependency change, but only when it's needed\n IDerivationState_[IDerivationState_[\"POSSIBLY_STALE_\"] = 1] = \"POSSIBLY_STALE_\";\n // A shallow dependency has changed since last computation and the derivation\n // will need to recompute when it's needed next.\n IDerivationState_[IDerivationState_[\"STALE_\"] = 2] = \"STALE_\";\n})(IDerivationState_ || (IDerivationState_ = {}));\nvar TraceMode;\n(function (TraceMode) {\n TraceMode[TraceMode[\"NONE\"] = 0] = \"NONE\";\n TraceMode[TraceMode[\"LOG\"] = 1] = \"LOG\";\n TraceMode[TraceMode[\"BREAK\"] = 2] = \"BREAK\";\n})(TraceMode || (TraceMode = {}));\nvar CaughtException = function CaughtException(cause) {\n this.cause = void 0;\n this.cause = cause;\n // Empty\n};\nfunction isCaughtException(e) {\n return e instanceof CaughtException;\n}\n/**\n * Finds out whether any dependency of the derivation has actually changed.\n * If dependenciesState is 1 then it will recalculate dependencies,\n * if any dependency changed it will propagate it by changing dependenciesState to 2.\n *\n * By iterating over the dependencies in the same order that they were reported and\n * stopping on the first change, all the recalculations are only called for ComputedValues\n * that will be tracked by derivation. That is because we assume that if the first x\n * dependencies of the derivation doesn't change then the derivation should run the same way\n * up until accessing x-th dependency.\n */\nfunction shouldCompute(derivation) {\n switch (derivation.dependenciesState_) {\n case IDerivationState_.UP_TO_DATE_:\n return false;\n case IDerivationState_.NOT_TRACKING_:\n case IDerivationState_.STALE_:\n return true;\n case IDerivationState_.POSSIBLY_STALE_:\n {\n // state propagation can occur outside of action/reactive context #2195\n var prevAllowStateReads = allowStateReadsStart(true);\n var prevUntracked = untrackedStart(); // no need for those computeds to be reported, they will be picked up in trackDerivedFunction.\n var obs = derivation.observing_,\n l = obs.length;\n for (var i = 0; i < l; i++) {\n var obj = obs[i];\n if (isComputedValue(obj)) {\n if (globalState.disableErrorBoundaries) {\n obj.get();\n } else {\n try {\n obj.get();\n } catch (e) {\n // we are not interested in the value *or* exception at this moment, but if there is one, notify all\n untrackedEnd(prevUntracked);\n allowStateReadsEnd(prevAllowStateReads);\n return true;\n }\n }\n // if ComputedValue `obj` actually changed it will be computed and propagated to its observers.\n // and `derivation` is an observer of `obj`\n // invariantShouldCompute(derivation)\n if (derivation.dependenciesState_ === IDerivationState_.STALE_) {\n untrackedEnd(prevUntracked);\n allowStateReadsEnd(prevAllowStateReads);\n return true;\n }\n }\n }\n changeDependenciesStateTo0(derivation);\n untrackedEnd(prevUntracked);\n allowStateReadsEnd(prevAllowStateReads);\n return false;\n }\n }\n}\nfunction isComputingDerivation() {\n return globalState.trackingDerivation !== null; // filter out actions inside computations\n}\nfunction checkIfStateModificationsAreAllowed(atom) {\n if (false) {}\n var hasObservers = atom.observers_.size > 0;\n // Should not be possible to change observed state outside strict mode, except during initialization, see #563\n if (!globalState.allowStateChanges && (hasObservers || globalState.enforceActions === \"always\")) {\n console.warn(\"[MobX] \" + (globalState.enforceActions ? \"Since strict-mode is enabled, changing (observed) observable values without using an action is not allowed. Tried to modify: \" : \"Side effects like changing state are not allowed at this point. Are you trying to modify state from, for example, a computed value or the render function of a React component? You can wrap side effects in 'runInAction' (or decorate functions with 'action') if needed. Tried to modify: \") + atom.name_);\n }\n}\nfunction checkIfStateReadsAreAllowed(observable) {\n if ( true && !globalState.allowStateReads && globalState.observableRequiresReaction) {\n console.warn(\"[mobx] Observable '\" + observable.name_ + \"' being read outside a reactive context.\");\n }\n}\n/**\n * Executes the provided function `f` and tracks which observables are being accessed.\n * The tracking information is stored on the `derivation` object and the derivation is registered\n * as observer of any of the accessed observables.\n */\nfunction trackDerivedFunction(derivation, f, context) {\n var prevAllowStateReads = allowStateReadsStart(true);\n changeDependenciesStateTo0(derivation);\n // Preallocate array; will be trimmed by bindDependencies.\n derivation.newObserving_ = new Array(\n // Reserve constant space for initial dependencies, dynamic space otherwise.\n // See https://github.com/mobxjs/mobx/pull/3833\n derivation.runId_ === 0 ? 100 : derivation.observing_.length);\n derivation.unboundDepsCount_ = 0;\n derivation.runId_ = ++globalState.runId;\n var prevTracking = globalState.trackingDerivation;\n globalState.trackingDerivation = derivation;\n globalState.inBatch++;\n var result;\n if (globalState.disableErrorBoundaries === true) {\n result = f.call(context);\n } else {\n try {\n result = f.call(context);\n } catch (e) {\n result = new CaughtException(e);\n }\n }\n globalState.inBatch--;\n globalState.trackingDerivation = prevTracking;\n bindDependencies(derivation);\n warnAboutDerivationWithoutDependencies(derivation);\n allowStateReadsEnd(prevAllowStateReads);\n return result;\n}\nfunction warnAboutDerivationWithoutDependencies(derivation) {\n if (false) {}\n if (derivation.observing_.length !== 0) {\n return;\n }\n if (typeof derivation.requiresObservable_ === \"boolean\" ? derivation.requiresObservable_ : globalState.reactionRequiresObservable) {\n console.warn(\"[mobx] Derivation '\" + derivation.name_ + \"' is created/updated without reading any observable value.\");\n }\n}\n/**\n * diffs newObserving with observing.\n * update observing to be newObserving with unique observables\n * notify observers that become observed/unobserved\n */\nfunction bindDependencies(derivation) {\n // invariant(derivation.dependenciesState !== IDerivationState.NOT_TRACKING, \"INTERNAL ERROR bindDependencies expects derivation.dependenciesState !== -1\");\n var prevObserving = derivation.observing_;\n var observing = derivation.observing_ = derivation.newObserving_;\n var lowestNewObservingDerivationState = IDerivationState_.UP_TO_DATE_;\n // Go through all new observables and check diffValue: (this list can contain duplicates):\n // 0: first occurrence, change to 1 and keep it\n // 1: extra occurrence, drop it\n var i0 = 0,\n l = derivation.unboundDepsCount_;\n for (var i = 0; i < l; i++) {\n var dep = observing[i];\n if (dep.diffValue === 0) {\n dep.diffValue = 1;\n if (i0 !== i) {\n observing[i0] = dep;\n }\n i0++;\n }\n // Upcast is 'safe' here, because if dep is IObservable, `dependenciesState` will be undefined,\n // not hitting the condition\n if (dep.dependenciesState_ > lowestNewObservingDerivationState) {\n lowestNewObservingDerivationState = dep.dependenciesState_;\n }\n }\n observing.length = i0;\n derivation.newObserving_ = null; // newObserving shouldn't be needed outside tracking (statement moved down to work around FF bug, see #614)\n // Go through all old observables and check diffValue: (it is unique after last bindDependencies)\n // 0: it's not in new observables, unobserve it\n // 1: it keeps being observed, don't want to notify it. change to 0\n l = prevObserving.length;\n while (l--) {\n var _dep = prevObserving[l];\n if (_dep.diffValue === 0) {\n removeObserver(_dep, derivation);\n }\n _dep.diffValue = 0;\n }\n // Go through all new observables and check diffValue: (now it should be unique)\n // 0: it was set to 0 in last loop. don't need to do anything.\n // 1: it wasn't observed, let's observe it. set back to 0\n while (i0--) {\n var _dep2 = observing[i0];\n if (_dep2.diffValue === 1) {\n _dep2.diffValue = 0;\n addObserver(_dep2, derivation);\n }\n }\n // Some new observed derivations may become stale during this derivation computation\n // so they have had no chance to propagate staleness (#916)\n if (lowestNewObservingDerivationState !== IDerivationState_.UP_TO_DATE_) {\n derivation.dependenciesState_ = lowestNewObservingDerivationState;\n derivation.onBecomeStale_();\n }\n}\nfunction clearObserving(derivation) {\n // invariant(globalState.inBatch > 0, \"INTERNAL ERROR clearObserving should be called only inside batch\");\n var obs = derivation.observing_;\n derivation.observing_ = [];\n var i = obs.length;\n while (i--) {\n removeObserver(obs[i], derivation);\n }\n derivation.dependenciesState_ = IDerivationState_.NOT_TRACKING_;\n}\nfunction untracked(action) {\n var prev = untrackedStart();\n try {\n return action();\n } finally {\n untrackedEnd(prev);\n }\n}\nfunction untrackedStart() {\n var prev = globalState.trackingDerivation;\n globalState.trackingDerivation = null;\n return prev;\n}\nfunction untrackedEnd(prev) {\n globalState.trackingDerivation = prev;\n}\nfunction allowStateReadsStart(allowStateReads) {\n var prev = globalState.allowStateReads;\n globalState.allowStateReads = allowStateReads;\n return prev;\n}\nfunction allowStateReadsEnd(prev) {\n globalState.allowStateReads = prev;\n}\n/**\n * needed to keep `lowestObserverState` correct. when changing from (2 or 1) to 0\n *\n */\nfunction changeDependenciesStateTo0(derivation) {\n if (derivation.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {\n return;\n }\n derivation.dependenciesState_ = IDerivationState_.UP_TO_DATE_;\n var obs = derivation.observing_;\n var i = obs.length;\n while (i--) {\n obs[i].lowestObserverState_ = IDerivationState_.UP_TO_DATE_;\n }\n}\n\n/**\n * These values will persist if global state is reset\n */\nvar persistentKeys = [\"mobxGuid\", \"spyListeners\", \"enforceActions\", \"computedRequiresReaction\", \"reactionRequiresObservable\", \"observableRequiresReaction\", \"allowStateReads\", \"disableErrorBoundaries\", \"runId\", \"UNCHANGED\", \"useProxies\"];\nvar MobXGlobals = function MobXGlobals() {\n /**\n * MobXGlobals version.\n * MobX compatiblity with other versions loaded in memory as long as this version matches.\n * It indicates that the global state still stores similar information\n *\n * N.B: this version is unrelated to the package version of MobX, and is only the version of the\n * internal state storage of MobX, and can be the same across many different package versions\n */\n this.version = 6;\n /**\n * globally unique token to signal unchanged\n */\n this.UNCHANGED = {};\n /**\n * Currently running derivation\n */\n this.trackingDerivation = null;\n /**\n * Currently running reaction. This determines if we currently have a reactive context.\n * (Tracking derivation is also set for temporal tracking of computed values inside actions,\n * but trackingReaction can only be set by a form of Reaction)\n */\n this.trackingContext = null;\n /**\n * Each time a derivation is tracked, it is assigned a unique run-id\n */\n this.runId = 0;\n /**\n * 'guid' for general purpose. Will be persisted amongst resets.\n */\n this.mobxGuid = 0;\n /**\n * Are we in a batch block? (and how many of them)\n */\n this.inBatch = 0;\n /**\n * Observables that don't have observers anymore, and are about to be\n * suspended, unless somebody else accesses it in the same batch\n *\n * @type {IObservable[]}\n */\n this.pendingUnobservations = [];\n /**\n * List of scheduled, not yet executed, reactions.\n */\n this.pendingReactions = [];\n /**\n * Are we currently processing reactions?\n */\n this.isRunningReactions = false;\n /**\n * Is it allowed to change observables at this point?\n * In general, MobX doesn't allow that when running computations and React.render.\n * To ensure that those functions stay pure.\n */\n this.allowStateChanges = false;\n /**\n * Is it allowed to read observables at this point?\n * Used to hold the state needed for `observableRequiresReaction`\n */\n this.allowStateReads = true;\n /**\n * If strict mode is enabled, state changes are by default not allowed\n */\n this.enforceActions = true;\n /**\n * Spy callbacks\n */\n this.spyListeners = [];\n /**\n * Globally attached error handlers that react specifically to errors in reactions\n */\n this.globalReactionErrorHandlers = [];\n /**\n * Warn if computed values are accessed outside a reactive context\n */\n this.computedRequiresReaction = false;\n /**\n * (Experimental)\n * Warn if you try to create to derivation / reactive context without accessing any observable.\n */\n this.reactionRequiresObservable = false;\n /**\n * (Experimental)\n * Warn if observables are accessed outside a reactive context\n */\n this.observableRequiresReaction = false;\n /*\n * Don't catch and rethrow exceptions. This is useful for inspecting the state of\n * the stack when an exception occurs while debugging.\n */\n this.disableErrorBoundaries = false;\n /*\n * If true, we are already handling an exception in an action. Any errors in reactions should be suppressed, as\n * they are not the cause, see: https://github.com/mobxjs/mobx/issues/1836\n */\n this.suppressReactionErrors = false;\n this.useProxies = true;\n /*\n * print warnings about code that would fail if proxies weren't available\n */\n this.verifyProxies = false;\n /**\n * False forces all object's descriptors to\n * writable: true\n * configurable: true\n */\n this.safeDescriptors = true;\n};\nvar canMergeGlobalState = true;\nvar isolateCalled = false;\nvar globalState = /*#__PURE__*/function () {\n var global = /*#__PURE__*/getGlobal();\n if (global.__mobxInstanceCount > 0 && !global.__mobxGlobals) {\n canMergeGlobalState = false;\n }\n if (global.__mobxGlobals && global.__mobxGlobals.version !== new MobXGlobals().version) {\n canMergeGlobalState = false;\n }\n if (!canMergeGlobalState) {\n // Because this is a IIFE we need to let isolateCalled a chance to change\n // so we run it after the event loop completed at least 1 iteration\n setTimeout(function () {\n if (!isolateCalled) {\n die(35);\n }\n }, 1);\n return new MobXGlobals();\n } else if (global.__mobxGlobals) {\n global.__mobxInstanceCount += 1;\n if (!global.__mobxGlobals.UNCHANGED) {\n global.__mobxGlobals.UNCHANGED = {};\n } // make merge backward compatible\n return global.__mobxGlobals;\n } else {\n global.__mobxInstanceCount = 1;\n return global.__mobxGlobals = /*#__PURE__*/new MobXGlobals();\n }\n}();\nfunction isolateGlobalState() {\n if (globalState.pendingReactions.length || globalState.inBatch || globalState.isRunningReactions) {\n die(36);\n }\n isolateCalled = true;\n if (canMergeGlobalState) {\n var global = getGlobal();\n if (--global.__mobxInstanceCount === 0) {\n global.__mobxGlobals = undefined;\n }\n globalState = new MobXGlobals();\n }\n}\nfunction getGlobalState() {\n return globalState;\n}\n/**\n * For testing purposes only; this will break the internal state of existing observables,\n * but can be used to get back at a stable state after throwing errors\n */\nfunction resetGlobalState() {\n var defaultGlobals = new MobXGlobals();\n for (var key in defaultGlobals) {\n if (persistentKeys.indexOf(key) === -1) {\n globalState[key] = defaultGlobals[key];\n }\n }\n globalState.allowStateChanges = !globalState.enforceActions;\n}\n\nfunction hasObservers(observable) {\n return observable.observers_ && observable.observers_.size > 0;\n}\nfunction getObservers(observable) {\n return observable.observers_;\n}\n// function invariantObservers(observable: IObservable) {\n// const list = observable.observers\n// const map = observable.observersIndexes\n// const l = list.length\n// for (let i = 0; i < l; i++) {\n// const id = list[i].__mapid\n// if (i) {\n// invariant(map[id] === i, \"INTERNAL ERROR maps derivation.__mapid to index in list\") // for performance\n// } else {\n// invariant(!(id in map), \"INTERNAL ERROR observer on index 0 shouldn't be held in map.\") // for performance\n// }\n// }\n// invariant(\n// list.length === 0 || Object.keys(map).length === list.length - 1,\n// \"INTERNAL ERROR there is no junk in map\"\n// )\n// }\nfunction addObserver(observable, node) {\n // invariant(node.dependenciesState !== -1, \"INTERNAL ERROR, can add only dependenciesState !== -1\");\n // invariant(observable._observers.indexOf(node) === -1, \"INTERNAL ERROR add already added node\");\n // invariantObservers(observable);\n observable.observers_.add(node);\n if (observable.lowestObserverState_ > node.dependenciesState_) {\n observable.lowestObserverState_ = node.dependenciesState_;\n }\n // invariantObservers(observable);\n // invariant(observable._observers.indexOf(node) !== -1, \"INTERNAL ERROR didn't add node\");\n}\nfunction removeObserver(observable, node) {\n // invariant(globalState.inBatch > 0, \"INTERNAL ERROR, remove should be called only inside batch\");\n // invariant(observable._observers.indexOf(node) !== -1, \"INTERNAL ERROR remove already removed node\");\n // invariantObservers(observable);\n observable.observers_[\"delete\"](node);\n if (observable.observers_.size === 0) {\n // deleting last observer\n queueForUnobservation(observable);\n }\n // invariantObservers(observable);\n // invariant(observable._observers.indexOf(node) === -1, \"INTERNAL ERROR remove already removed node2\");\n}\nfunction queueForUnobservation(observable) {\n if (observable.isPendingUnobservation === false) {\n // invariant(observable._observers.length === 0, \"INTERNAL ERROR, should only queue for unobservation unobserved observables\");\n observable.isPendingUnobservation = true;\n globalState.pendingUnobservations.push(observable);\n }\n}\n/**\n * Batch starts a transaction, at least for purposes of memoizing ComputedValues when nothing else does.\n * During a batch `onBecomeUnobserved` will be called at most once per observable.\n * Avoids unnecessary recalculations.\n */\nfunction startBatch() {\n globalState.inBatch++;\n}\nfunction endBatch() {\n if (--globalState.inBatch === 0) {\n runReactions();\n // the batch is actually about to finish, all unobserving should happen here.\n var list = globalState.pendingUnobservations;\n for (var i = 0; i < list.length; i++) {\n var observable = list[i];\n observable.isPendingUnobservation = false;\n if (observable.observers_.size === 0) {\n if (observable.isBeingObserved) {\n // if this observable had reactive observers, trigger the hooks\n observable.isBeingObserved = false;\n observable.onBUO();\n }\n if (observable instanceof ComputedValue) {\n // computed values are automatically teared down when the last observer leaves\n // this process happens recursively, this computed might be the last observabe of another, etc..\n observable.suspend_();\n }\n }\n }\n globalState.pendingUnobservations = [];\n }\n}\nfunction reportObserved(observable) {\n checkIfStateReadsAreAllowed(observable);\n var derivation = globalState.trackingDerivation;\n if (derivation !== null) {\n /**\n * Simple optimization, give each derivation run an unique id (runId)\n * Check if last time this observable was accessed the same runId is used\n * if this is the case, the relation is already known\n */\n if (derivation.runId_ !== observable.lastAccessedBy_) {\n observable.lastAccessedBy_ = derivation.runId_;\n // Tried storing newObserving, or observing, or both as Set, but performance didn't come close...\n derivation.newObserving_[derivation.unboundDepsCount_++] = observable;\n if (!observable.isBeingObserved && globalState.trackingContext) {\n observable.isBeingObserved = true;\n observable.onBO();\n }\n }\n return observable.isBeingObserved;\n } else if (observable.observers_.size === 0 && globalState.inBatch > 0) {\n queueForUnobservation(observable);\n }\n return false;\n}\n// function invariantLOS(observable: IObservable, msg: string) {\n// // it's expensive so better not run it in produciton. but temporarily helpful for testing\n// const min = getObservers(observable).reduce((a, b) => Math.min(a, b.dependenciesState), 2)\n// if (min >= observable.lowestObserverState) return // <- the only assumption about `lowestObserverState`\n// throw new Error(\n// \"lowestObserverState is wrong for \" +\n// msg +\n// \" because \" +\n// min +\n// \" < \" +\n// observable.lowestObserverState\n// )\n// }\n/**\n * NOTE: current propagation mechanism will in case of self reruning autoruns behave unexpectedly\n * It will propagate changes to observers from previous run\n * It's hard or maybe impossible (with reasonable perf) to get it right with current approach\n * Hopefully self reruning autoruns aren't a feature people should depend on\n * Also most basic use cases should be ok\n */\n// Called by Atom when its value changes\nfunction propagateChanged(observable) {\n // invariantLOS(observable, \"changed start\");\n if (observable.lowestObserverState_ === IDerivationState_.STALE_) {\n return;\n }\n observable.lowestObserverState_ = IDerivationState_.STALE_;\n // Ideally we use for..of here, but the downcompiled version is really slow...\n observable.observers_.forEach(function (d) {\n if (d.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {\n if ( true && d.isTracing_ !== TraceMode.NONE) {\n logTraceInfo(d, observable);\n }\n d.onBecomeStale_();\n }\n d.dependenciesState_ = IDerivationState_.STALE_;\n });\n // invariantLOS(observable, \"changed end\");\n}\n// Called by ComputedValue when it recalculate and its value changed\nfunction propagateChangeConfirmed(observable) {\n // invariantLOS(observable, \"confirmed start\");\n if (observable.lowestObserverState_ === IDerivationState_.STALE_) {\n return;\n }\n observable.lowestObserverState_ = IDerivationState_.STALE_;\n observable.observers_.forEach(function (d) {\n if (d.dependenciesState_ === IDerivationState_.POSSIBLY_STALE_) {\n d.dependenciesState_ = IDerivationState_.STALE_;\n if ( true && d.isTracing_ !== TraceMode.NONE) {\n logTraceInfo(d, observable);\n }\n } else if (d.dependenciesState_ === IDerivationState_.UP_TO_DATE_ // this happens during computing of `d`, just keep lowestObserverState up to date.\n ) {\n observable.lowestObserverState_ = IDerivationState_.UP_TO_DATE_;\n }\n });\n // invariantLOS(observable, \"confirmed end\");\n}\n// Used by computed when its dependency changed, but we don't wan't to immediately recompute.\nfunction propagateMaybeChanged(observable) {\n // invariantLOS(observable, \"maybe start\");\n if (observable.lowestObserverState_ !== IDerivationState_.UP_TO_DATE_) {\n return;\n }\n observable.lowestObserverState_ = IDerivationState_.POSSIBLY_STALE_;\n observable.observers_.forEach(function (d) {\n if (d.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {\n d.dependenciesState_ = IDerivationState_.POSSIBLY_STALE_;\n d.onBecomeStale_();\n }\n });\n // invariantLOS(observable, \"maybe end\");\n}\nfunction logTraceInfo(derivation, observable) {\n console.log(\"[mobx.trace] '\" + derivation.name_ + \"' is invalidated due to a change in: '\" + observable.name_ + \"'\");\n if (derivation.isTracing_ === TraceMode.BREAK) {\n var lines = [];\n printDepTree(getDependencyTree(derivation), lines, 1);\n // prettier-ignore\n new Function(\"debugger;\\n/*\\nTracing '\" + derivation.name_ + \"'\\n\\nYou are entering this break point because derivation '\" + derivation.name_ + \"' is being traced and '\" + observable.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\" + (derivation instanceof ComputedValue ? derivation.derivation.toString().replace(/[*]\\//g, \"/\") : \"\") + \"\\n\\nThe dependencies for this derivation are:\\n\\n\" + lines.join(\"\\n\") + \"\\n*/\\n \")();\n }\n}\nfunction printDepTree(tree, lines, depth) {\n if (lines.length >= 1000) {\n lines.push(\"(and many more)\");\n return;\n }\n lines.push(\"\" + \"\\t\".repeat(depth - 1) + tree.name);\n if (tree.dependencies) {\n tree.dependencies.forEach(function (child) {\n return printDepTree(child, lines, depth + 1);\n });\n }\n}\n\nvar Reaction = /*#__PURE__*/function () {\n function Reaction(name_, onInvalidate_, errorHandler_, requiresObservable_) {\n if (name_ === void 0) {\n name_ = true ? \"Reaction@\" + getNextId() : 0;\n }\n this.name_ = void 0;\n this.onInvalidate_ = void 0;\n this.errorHandler_ = void 0;\n this.requiresObservable_ = void 0;\n this.observing_ = [];\n // nodes we are looking at. Our value depends on these nodes\n this.newObserving_ = [];\n this.dependenciesState_ = IDerivationState_.NOT_TRACKING_;\n this.runId_ = 0;\n this.unboundDepsCount_ = 0;\n this.flags_ = 0;\n this.isTracing_ = TraceMode.NONE;\n this.name_ = name_;\n this.onInvalidate_ = onInvalidate_;\n this.errorHandler_ = errorHandler_;\n this.requiresObservable_ = requiresObservable_;\n }\n var _proto = Reaction.prototype;\n _proto.onBecomeStale_ = function onBecomeStale_() {\n this.schedule_();\n };\n _proto.schedule_ = function schedule_() {\n if (!this.isScheduled) {\n this.isScheduled = true;\n globalState.pendingReactions.push(this);\n runReactions();\n }\n }\n /**\n * internal, use schedule() if you intend to kick off a reaction\n */;\n _proto.runReaction_ = function runReaction_() {\n if (!this.isDisposed) {\n startBatch();\n this.isScheduled = false;\n var prev = globalState.trackingContext;\n globalState.trackingContext = this;\n if (shouldCompute(this)) {\n this.isTrackPending = true;\n try {\n this.onInvalidate_();\n if ( true && this.isTrackPending && isSpyEnabled()) {\n // onInvalidate didn't trigger track right away..\n spyReport({\n name: this.name_,\n type: \"scheduled-reaction\"\n });\n }\n } catch (e) {\n this.reportExceptionInDerivation_(e);\n }\n }\n globalState.trackingContext = prev;\n endBatch();\n }\n };\n _proto.track = function track(fn) {\n if (this.isDisposed) {\n return;\n // console.warn(\"Reaction already disposed\") // Note: Not a warning / error in mobx 4 either\n }\n startBatch();\n var notify = isSpyEnabled();\n var startTime;\n if ( true && notify) {\n startTime = Date.now();\n spyReportStart({\n name: this.name_,\n type: \"reaction\"\n });\n }\n this.isRunning = true;\n var prevReaction = globalState.trackingContext; // reactions could create reactions...\n globalState.trackingContext = this;\n var result = trackDerivedFunction(this, fn, undefined);\n globalState.trackingContext = prevReaction;\n this.isRunning = false;\n this.isTrackPending = false;\n if (this.isDisposed) {\n // disposed during last run. Clean up everything that was bound after the dispose call.\n clearObserving(this);\n }\n if (isCaughtException(result)) {\n this.reportExceptionInDerivation_(result.cause);\n }\n if ( true && notify) {\n spyReportEnd({\n time: Date.now() - startTime\n });\n }\n endBatch();\n };\n _proto.reportExceptionInDerivation_ = function reportExceptionInDerivation_(error) {\n var _this = this;\n if (this.errorHandler_) {\n this.errorHandler_(error, this);\n return;\n }\n if (globalState.disableErrorBoundaries) {\n throw error;\n }\n var message = true ? \"[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '\" + this + \"'\" : 0;\n if (!globalState.suppressReactionErrors) {\n console.error(message, error);\n /** If debugging brought you here, please, read the above message :-). Tnx! */\n } else if (true) {\n console.warn(\"[mobx] (error in reaction '\" + this.name_ + \"' suppressed, fix error of causing action below)\");\n } // prettier-ignore\n if ( true && isSpyEnabled()) {\n spyReport({\n type: \"error\",\n name: this.name_,\n message: message,\n error: \"\" + error\n });\n }\n globalState.globalReactionErrorHandlers.forEach(function (f) {\n return f(error, _this);\n });\n };\n _proto.dispose = function dispose() {\n if (!this.isDisposed) {\n this.isDisposed = true;\n if (!this.isRunning) {\n // if disposed while running, clean up later. Maybe not optimal, but rare case\n startBatch();\n clearObserving(this);\n endBatch();\n }\n }\n };\n _proto.getDisposer_ = function getDisposer_(abortSignal) {\n var _this2 = this;\n var dispose = function dispose() {\n _this2.dispose();\n abortSignal == null || abortSignal.removeEventListener == null || abortSignal.removeEventListener(\"abort\", dispose);\n };\n abortSignal == null || abortSignal.addEventListener == null || abortSignal.addEventListener(\"abort\", dispose);\n dispose[$mobx] = this;\n return dispose;\n };\n _proto.toString = function toString() {\n return \"Reaction[\" + this.name_ + \"]\";\n };\n _proto.trace = function trace$1(enterBreakPoint) {\n if (enterBreakPoint === void 0) {\n enterBreakPoint = false;\n }\n trace(this, enterBreakPoint);\n };\n return _createClass(Reaction, [{\n key: \"isDisposed\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isDisposedMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isDisposedMask_, newValue);\n }\n }, {\n key: \"isScheduled\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isScheduledMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isScheduledMask_, newValue);\n }\n }, {\n key: \"isTrackPending\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isTrackPendingMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isTrackPendingMask_, newValue);\n }\n }, {\n key: \"isRunning\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isRunningMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isRunningMask_, newValue);\n }\n }, {\n key: \"diffValue\",\n get: function get() {\n return getFlag(this.flags_, Reaction.diffValueMask_) ? 1 : 0;\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.diffValueMask_, newValue === 1 ? true : false);\n }\n }]);\n}();\nReaction.isDisposedMask_ = 1;\nReaction.isScheduledMask_ = 2;\nReaction.isTrackPendingMask_ = 4;\nReaction.isRunningMask_ = 8;\nReaction.diffValueMask_ = 16;\nfunction onReactionError(handler) {\n globalState.globalReactionErrorHandlers.push(handler);\n return function () {\n var idx = globalState.globalReactionErrorHandlers.indexOf(handler);\n if (idx >= 0) {\n globalState.globalReactionErrorHandlers.splice(idx, 1);\n }\n };\n}\n/**\n * Magic number alert!\n * Defines within how many times a reaction is allowed to re-trigger itself\n * until it is assumed that this is gonna be a never ending loop...\n */\nvar MAX_REACTION_ITERATIONS = 100;\nvar reactionScheduler = function reactionScheduler(f) {\n return f();\n};\nfunction runReactions() {\n // Trampolining, if runReactions are already running, new reactions will be picked up\n if (globalState.inBatch > 0 || globalState.isRunningReactions) {\n return;\n }\n reactionScheduler(runReactionsHelper);\n}\nfunction runReactionsHelper() {\n globalState.isRunningReactions = true;\n var allReactions = globalState.pendingReactions;\n var iterations = 0;\n // While running reactions, new reactions might be triggered.\n // Hence we work with two variables and check whether\n // we converge to no remaining reactions after a while.\n while (allReactions.length > 0) {\n if (++iterations === MAX_REACTION_ITERATIONS) {\n console.error( true ? \"Reaction doesn't converge to a stable state after \" + MAX_REACTION_ITERATIONS + \" iterations.\" + (\" Probably there is a cycle in the reactive function: \" + allReactions[0]) : 0);\n allReactions.splice(0); // clear reactions\n }\n var remainingReactions = allReactions.splice(0);\n for (var i = 0, l = remainingReactions.length; i < l; i++) {\n remainingReactions[i].runReaction_();\n }\n }\n globalState.isRunningReactions = false;\n}\nvar isReaction = /*#__PURE__*/createInstanceofPredicate(\"Reaction\", Reaction);\nfunction setReactionScheduler(fn) {\n var baseScheduler = reactionScheduler;\n reactionScheduler = function reactionScheduler(f) {\n return fn(function () {\n return baseScheduler(f);\n });\n };\n}\n\nfunction isSpyEnabled() {\n return true && !!globalState.spyListeners.length;\n}\nfunction spyReport(event) {\n if (false) {} // dead code elimination can do the rest\n if (!globalState.spyListeners.length) {\n return;\n }\n var listeners = globalState.spyListeners;\n for (var i = 0, l = listeners.length; i < l; i++) {\n listeners[i](event);\n }\n}\nfunction spyReportStart(event) {\n if (false) {}\n var change = _extends({}, event, {\n spyReportStart: true\n });\n spyReport(change);\n}\nvar END_EVENT = {\n type: \"report-end\",\n spyReportEnd: true\n};\nfunction spyReportEnd(change) {\n if (false) {}\n if (change) {\n spyReport(_extends({}, change, {\n type: \"report-end\",\n spyReportEnd: true\n }));\n } else {\n spyReport(END_EVENT);\n }\n}\nfunction spy(listener) {\n if (false) {} else {\n globalState.spyListeners.push(listener);\n return once(function () {\n globalState.spyListeners = globalState.spyListeners.filter(function (l) {\n return l !== listener;\n });\n });\n }\n}\n\nvar ACTION = \"action\";\nvar ACTION_BOUND = \"action.bound\";\nvar AUTOACTION = \"autoAction\";\nvar AUTOACTION_BOUND = \"autoAction.bound\";\nvar DEFAULT_ACTION_NAME = \"\";\nvar actionAnnotation = /*#__PURE__*/createActionAnnotation(ACTION);\nvar actionBoundAnnotation = /*#__PURE__*/createActionAnnotation(ACTION_BOUND, {\n bound: true\n});\nvar autoActionAnnotation = /*#__PURE__*/createActionAnnotation(AUTOACTION, {\n autoAction: true\n});\nvar autoActionBoundAnnotation = /*#__PURE__*/createActionAnnotation(AUTOACTION_BOUND, {\n autoAction: true,\n bound: true\n});\nfunction createActionFactory(autoAction) {\n var res = function action(arg1, arg2) {\n // action(fn() {})\n if (isFunction(arg1)) {\n return createAction(arg1.name || DEFAULT_ACTION_NAME, arg1, autoAction);\n }\n // action(\"name\", fn() {})\n if (isFunction(arg2)) {\n return createAction(arg1, arg2, autoAction);\n }\n // @action (2022.3 Decorators)\n if (is20223Decorator(arg2)) {\n return (autoAction ? autoActionAnnotation : actionAnnotation).decorate_20223_(arg1, arg2);\n }\n // @action\n if (isStringish(arg2)) {\n return storeAnnotation(arg1, arg2, autoAction ? autoActionAnnotation : actionAnnotation);\n }\n // action(\"name\") & @action(\"name\")\n if (isStringish(arg1)) {\n return createDecoratorAnnotation(createActionAnnotation(autoAction ? AUTOACTION : ACTION, {\n name: arg1,\n autoAction: autoAction\n }));\n }\n if (true) {\n die(\"Invalid arguments for `action`\");\n }\n };\n return res;\n}\nvar action = /*#__PURE__*/createActionFactory(false);\nObject.assign(action, actionAnnotation);\nvar autoAction = /*#__PURE__*/createActionFactory(true);\nObject.assign(autoAction, autoActionAnnotation);\naction.bound = /*#__PURE__*/createDecoratorAnnotation(actionBoundAnnotation);\nautoAction.bound = /*#__PURE__*/createDecoratorAnnotation(autoActionBoundAnnotation);\nfunction runInAction(fn) {\n return executeAction(fn.name || DEFAULT_ACTION_NAME, false, fn, this, undefined);\n}\nfunction isAction(thing) {\n return isFunction(thing) && thing.isMobxAction === true;\n}\n\n/**\n * Creates a named reactive view and keeps it alive, so that the view is always\n * updated if one of the dependencies changes, even when the view is not further used by something else.\n * @param view The reactive view\n * @returns disposer function, which can be used to stop the view from being updated in the future.\n */\nfunction autorun(view, opts) {\n var _opts$name, _opts, _opts2, _opts3;\n if (opts === void 0) {\n opts = EMPTY_OBJECT;\n }\n if (true) {\n if (!isFunction(view)) {\n die(\"Autorun expects a function as first argument\");\n }\n if (isAction(view)) {\n die(\"Autorun does not accept actions since actions are untrackable\");\n }\n }\n var name = (_opts$name = (_opts = opts) == null ? void 0 : _opts.name) != null ? _opts$name : true ? view.name || \"Autorun@\" + getNextId() : 0;\n var runSync = !opts.scheduler && !opts.delay;\n var reaction;\n if (runSync) {\n // normal autorun\n reaction = new Reaction(name, function () {\n this.track(reactionRunner);\n }, opts.onError, opts.requiresObservable);\n } else {\n var scheduler = createSchedulerFromOptions(opts);\n // debounced autorun\n var isScheduled = false;\n reaction = new Reaction(name, function () {\n if (!isScheduled) {\n isScheduled = true;\n scheduler(function () {\n isScheduled = false;\n if (!reaction.isDisposed) {\n reaction.track(reactionRunner);\n }\n });\n }\n }, opts.onError, opts.requiresObservable);\n }\n function reactionRunner() {\n view(reaction);\n }\n if (!((_opts2 = opts) != null && (_opts2 = _opts2.signal) != null && _opts2.aborted)) {\n reaction.schedule_();\n }\n return reaction.getDisposer_((_opts3 = opts) == null ? void 0 : _opts3.signal);\n}\nvar run = function run(f) {\n return f();\n};\nfunction createSchedulerFromOptions(opts) {\n return opts.scheduler ? opts.scheduler : opts.delay ? function (f) {\n return setTimeout(f, opts.delay);\n } : run;\n}\nfunction reaction(expression, effect, opts) {\n var _opts$name2, _opts4, _opts5;\n if (opts === void 0) {\n opts = EMPTY_OBJECT;\n }\n if (true) {\n if (!isFunction(expression) || !isFunction(effect)) {\n die(\"First and second argument to reaction should be functions\");\n }\n if (!isPlainObject(opts)) {\n die(\"Third argument of reactions should be an object\");\n }\n }\n var name = (_opts$name2 = opts.name) != null ? _opts$name2 : true ? \"Reaction@\" + getNextId() : 0;\n var effectAction = action(name, opts.onError ? wrapErrorHandler(opts.onError, effect) : effect);\n var runSync = !opts.scheduler && !opts.delay;\n var scheduler = createSchedulerFromOptions(opts);\n var firstTime = true;\n var isScheduled = false;\n var value;\n var equals = opts.compareStructural ? comparer.structural : opts.equals || comparer[\"default\"];\n var r = new Reaction(name, function () {\n if (firstTime || runSync) {\n reactionRunner();\n } else if (!isScheduled) {\n isScheduled = true;\n scheduler(reactionRunner);\n }\n }, opts.onError, opts.requiresObservable);\n function reactionRunner() {\n isScheduled = false;\n if (r.isDisposed) {\n return;\n }\n var changed = false;\n var oldValue = value;\n r.track(function () {\n var nextValue = allowStateChanges(false, function () {\n return expression(r);\n });\n changed = firstTime || !equals(value, nextValue);\n value = nextValue;\n });\n if (firstTime && opts.fireImmediately) {\n effectAction(value, oldValue, r);\n } else if (!firstTime && changed) {\n effectAction(value, oldValue, r);\n }\n firstTime = false;\n }\n if (!((_opts4 = opts) != null && (_opts4 = _opts4.signal) != null && _opts4.aborted)) {\n r.schedule_();\n }\n return r.getDisposer_((_opts5 = opts) == null ? void 0 : _opts5.signal);\n}\nfunction wrapErrorHandler(errorHandler, baseFn) {\n return function () {\n try {\n return baseFn.apply(this, arguments);\n } catch (e) {\n errorHandler.call(this, e);\n }\n };\n}\n\nvar ON_BECOME_OBSERVED = \"onBO\";\nvar ON_BECOME_UNOBSERVED = \"onBUO\";\nfunction onBecomeObserved(thing, arg2, arg3) {\n return interceptHook(ON_BECOME_OBSERVED, thing, arg2, arg3);\n}\nfunction onBecomeUnobserved(thing, arg2, arg3) {\n return interceptHook(ON_BECOME_UNOBSERVED, thing, arg2, arg3);\n}\nfunction interceptHook(hook, thing, arg2, arg3) {\n var atom = typeof arg3 === \"function\" ? getAtom(thing, arg2) : getAtom(thing);\n var cb = isFunction(arg3) ? arg3 : arg2;\n var listenersKey = hook + \"L\";\n if (atom[listenersKey]) {\n atom[listenersKey].add(cb);\n } else {\n atom[listenersKey] = new Set([cb]);\n }\n return function () {\n var hookListeners = atom[listenersKey];\n if (hookListeners) {\n hookListeners[\"delete\"](cb);\n if (hookListeners.size === 0) {\n delete atom[listenersKey];\n }\n }\n };\n}\n\nvar NEVER = \"never\";\nvar ALWAYS = \"always\";\nvar OBSERVED = \"observed\";\n// const IF_AVAILABLE = \"ifavailable\"\nfunction configure(options) {\n if (options.isolateGlobalState === true) {\n isolateGlobalState();\n }\n var useProxies = options.useProxies,\n enforceActions = options.enforceActions;\n if (useProxies !== undefined) {\n globalState.useProxies = useProxies === ALWAYS ? true : useProxies === NEVER ? false : typeof Proxy !== \"undefined\";\n }\n if (useProxies === \"ifavailable\") {\n globalState.verifyProxies = true;\n }\n if (enforceActions !== undefined) {\n var ea = enforceActions === ALWAYS ? ALWAYS : enforceActions === OBSERVED;\n globalState.enforceActions = ea;\n globalState.allowStateChanges = ea === true || ea === ALWAYS ? false : true;\n }\n [\"computedRequiresReaction\", \"reactionRequiresObservable\", \"observableRequiresReaction\", \"disableErrorBoundaries\", \"safeDescriptors\"].forEach(function (key) {\n if (key in options) {\n globalState[key] = !!options[key];\n }\n });\n globalState.allowStateReads = !globalState.observableRequiresReaction;\n if ( true && globalState.disableErrorBoundaries === true) {\n console.warn(\"WARNING: Debug feature only. MobX will NOT recover from errors when `disableErrorBoundaries` is enabled.\");\n }\n if (options.reactionScheduler) {\n setReactionScheduler(options.reactionScheduler);\n }\n}\n\nfunction extendObservable(target, properties, annotations, options) {\n if (true) {\n if (arguments.length > 4) {\n die(\"'extendObservable' expected 2-4 arguments\");\n }\n if (typeof target !== \"object\") {\n die(\"'extendObservable' expects an object as first argument\");\n }\n if (isObservableMap(target)) {\n die(\"'extendObservable' should not be used on maps, use map.merge instead\");\n }\n if (!isPlainObject(properties)) {\n die(\"'extendObservable' only accepts plain objects as second argument\");\n }\n if (isObservable(properties) || isObservable(annotations)) {\n die(\"Extending an object with another observable (object) is not supported\");\n }\n }\n // Pull descriptors first, so we don't have to deal with props added by administration ($mobx)\n var descriptors = getOwnPropertyDescriptors(properties);\n initObservable(function () {\n var adm = asObservableObject(target, options)[$mobx];\n ownKeys(descriptors).forEach(function (key) {\n adm.extend_(key, descriptors[key],\n // must pass \"undefined\" for { key: undefined }\n !annotations ? true : key in annotations ? annotations[key] : true);\n });\n });\n return target;\n}\n\nfunction getDependencyTree(thing, property) {\n return nodeToDependencyTree(getAtom(thing, property));\n}\nfunction nodeToDependencyTree(node) {\n var result = {\n name: node.name_\n };\n if (node.observing_ && node.observing_.length > 0) {\n result.dependencies = unique(node.observing_).map(nodeToDependencyTree);\n }\n return result;\n}\nfunction getObserverTree(thing, property) {\n return nodeToObserverTree(getAtom(thing, property));\n}\nfunction nodeToObserverTree(node) {\n var result = {\n name: node.name_\n };\n if (hasObservers(node)) {\n result.observers = Array.from(getObservers(node)).map(nodeToObserverTree);\n }\n return result;\n}\nfunction unique(list) {\n return Array.from(new Set(list));\n}\n\nvar generatorId = 0;\nfunction FlowCancellationError() {\n this.message = \"FLOW_CANCELLED\";\n}\nFlowCancellationError.prototype = /*#__PURE__*/Object.create(Error.prototype);\nfunction isFlowCancellationError(error) {\n return error instanceof FlowCancellationError;\n}\nvar flowAnnotation = /*#__PURE__*/createFlowAnnotation(\"flow\");\nvar flowBoundAnnotation = /*#__PURE__*/createFlowAnnotation(\"flow.bound\", {\n bound: true\n});\nvar flow = /*#__PURE__*/Object.assign(function flow(arg1, arg2) {\n // @flow (2022.3 Decorators)\n if (is20223Decorator(arg2)) {\n return flowAnnotation.decorate_20223_(arg1, arg2);\n }\n // @flow\n if (isStringish(arg2)) {\n return storeAnnotation(arg1, arg2, flowAnnotation);\n }\n // flow(fn)\n if ( true && arguments.length !== 1) {\n die(\"Flow expects single argument with generator function\");\n }\n var generator = arg1;\n var name = generator.name || \"\";\n // Implementation based on https://github.com/tj/co/blob/master/index.js\n var res = function res() {\n var ctx = this;\n var args = arguments;\n var runId = ++generatorId;\n var gen = action(name + \" - runid: \" + runId + \" - init\", generator).apply(ctx, args);\n var rejector;\n var pendingPromise = undefined;\n var promise = new Promise(function (resolve, reject) {\n var stepId = 0;\n rejector = reject;\n function onFulfilled(res) {\n pendingPromise = undefined;\n var ret;\n try {\n ret = action(name + \" - runid: \" + runId + \" - yield \" + stepId++, gen.next).call(gen, res);\n } catch (e) {\n return reject(e);\n }\n next(ret);\n }\n function onRejected(err) {\n pendingPromise = undefined;\n var ret;\n try {\n ret = action(name + \" - runid: \" + runId + \" - yield \" + stepId++, gen[\"throw\"]).call(gen, err);\n } catch (e) {\n return reject(e);\n }\n next(ret);\n }\n function next(ret) {\n if (isFunction(ret == null ? void 0 : ret.then)) {\n // an async iterator\n ret.then(next, reject);\n return;\n }\n if (ret.done) {\n return resolve(ret.value);\n }\n pendingPromise = Promise.resolve(ret.value);\n return pendingPromise.then(onFulfilled, onRejected);\n }\n onFulfilled(undefined); // kick off the process\n });\n promise.cancel = action(name + \" - runid: \" + runId + \" - cancel\", function () {\n try {\n if (pendingPromise) {\n cancelPromise(pendingPromise);\n }\n // Finally block can return (or yield) stuff..\n var _res = gen[\"return\"](undefined);\n // eat anything that promise would do, it's cancelled!\n var yieldedPromise = Promise.resolve(_res.value);\n yieldedPromise.then(noop, noop);\n cancelPromise(yieldedPromise); // maybe it can be cancelled :)\n // reject our original promise\n rejector(new FlowCancellationError());\n } catch (e) {\n rejector(e); // there could be a throwing finally block\n }\n });\n return promise;\n };\n res.isMobXFlow = true;\n return res;\n}, flowAnnotation);\nflow.bound = /*#__PURE__*/createDecoratorAnnotation(flowBoundAnnotation);\nfunction cancelPromise(promise) {\n if (isFunction(promise.cancel)) {\n promise.cancel();\n }\n}\nfunction flowResult(result) {\n return result; // just tricking TypeScript :)\n}\nfunction isFlow(fn) {\n return (fn == null ? void 0 : fn.isMobXFlow) === true;\n}\n\nfunction interceptReads(thing, propOrHandler, handler) {\n var target;\n if (isObservableMap(thing) || isObservableArray(thing) || isObservableValue(thing)) {\n target = getAdministration(thing);\n } else if (isObservableObject(thing)) {\n if ( true && !isStringish(propOrHandler)) {\n return die(\"InterceptReads can only be used with a specific property, not with an object in general\");\n }\n target = getAdministration(thing, propOrHandler);\n } else if (true) {\n return die(\"Expected observable map, object or array as first array\");\n }\n if ( true && target.dehancer !== undefined) {\n return die(\"An intercept reader was already established\");\n }\n target.dehancer = typeof propOrHandler === \"function\" ? propOrHandler : handler;\n return function () {\n target.dehancer = undefined;\n };\n}\n\nfunction intercept(thing, propOrHandler, handler) {\n if (isFunction(handler)) {\n return interceptProperty(thing, propOrHandler, handler);\n } else {\n return interceptInterceptable(thing, propOrHandler);\n }\n}\nfunction interceptInterceptable(thing, handler) {\n return getAdministration(thing).intercept_(handler);\n}\nfunction interceptProperty(thing, property, handler) {\n return getAdministration(thing, property).intercept_(handler);\n}\n\nfunction _isComputed(value, property) {\n if (property === undefined) {\n return isComputedValue(value);\n }\n if (isObservableObject(value) === false) {\n return false;\n }\n if (!value[$mobx].values_.has(property)) {\n return false;\n }\n var atom = getAtom(value, property);\n return isComputedValue(atom);\n}\nfunction isComputed(value) {\n if ( true && arguments.length > 1) {\n return die(\"isComputed expects only 1 argument. Use isComputedProp to inspect the observability of a property\");\n }\n return _isComputed(value);\n}\nfunction isComputedProp(value, propName) {\n if ( true && !isStringish(propName)) {\n return die(\"isComputed expected a property name as second argument\");\n }\n return _isComputed(value, propName);\n}\n\nfunction _isObservable(value, property) {\n if (!value) {\n return false;\n }\n if (property !== undefined) {\n if ( true && (isObservableMap(value) || isObservableArray(value))) {\n return die(\"isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead.\");\n }\n if (isObservableObject(value)) {\n return value[$mobx].values_.has(property);\n }\n return false;\n }\n // For first check, see #701\n return isObservableObject(value) || !!value[$mobx] || isAtom(value) || isReaction(value) || isComputedValue(value);\n}\nfunction isObservable(value) {\n if ( true && arguments.length !== 1) {\n die(\"isObservable expects only 1 argument. Use isObservableProp to inspect the observability of a property\");\n }\n return _isObservable(value);\n}\nfunction isObservableProp(value, propName) {\n if ( true && !isStringish(propName)) {\n return die(\"expected a property name as second argument\");\n }\n return _isObservable(value, propName);\n}\n\nfunction keys(obj) {\n if (isObservableObject(obj)) {\n return obj[$mobx].keys_();\n }\n if (isObservableMap(obj) || isObservableSet(obj)) {\n return Array.from(obj.keys());\n }\n if (isObservableArray(obj)) {\n return obj.map(function (_, index) {\n return index;\n });\n }\n die(5);\n}\nfunction values(obj) {\n if (isObservableObject(obj)) {\n return keys(obj).map(function (key) {\n return obj[key];\n });\n }\n if (isObservableMap(obj)) {\n return keys(obj).map(function (key) {\n return obj.get(key);\n });\n }\n if (isObservableSet(obj)) {\n return Array.from(obj.values());\n }\n if (isObservableArray(obj)) {\n return obj.slice();\n }\n die(6);\n}\nfunction entries(obj) {\n if (isObservableObject(obj)) {\n return keys(obj).map(function (key) {\n return [key, obj[key]];\n });\n }\n if (isObservableMap(obj)) {\n return keys(obj).map(function (key) {\n return [key, obj.get(key)];\n });\n }\n if (isObservableSet(obj)) {\n return Array.from(obj.entries());\n }\n if (isObservableArray(obj)) {\n return obj.map(function (key, index) {\n return [index, key];\n });\n }\n die(7);\n}\nfunction set(obj, key, value) {\n if (arguments.length === 2 && !isObservableSet(obj)) {\n startBatch();\n var _values = key;\n try {\n for (var _key in _values) {\n set(obj, _key, _values[_key]);\n }\n } finally {\n endBatch();\n }\n return;\n }\n if (isObservableObject(obj)) {\n obj[$mobx].set_(key, value);\n } else if (isObservableMap(obj)) {\n obj.set(key, value);\n } else if (isObservableSet(obj)) {\n obj.add(key);\n } else if (isObservableArray(obj)) {\n if (typeof key !== \"number\") {\n key = parseInt(key, 10);\n }\n if (key < 0) {\n die(\"Invalid index: '\" + key + \"'\");\n }\n startBatch();\n if (key >= obj.length) {\n obj.length = key + 1;\n }\n obj[key] = value;\n endBatch();\n } else {\n die(8);\n }\n}\nfunction remove(obj, key) {\n if (isObservableObject(obj)) {\n obj[$mobx].delete_(key);\n } else if (isObservableMap(obj)) {\n obj[\"delete\"](key);\n } else if (isObservableSet(obj)) {\n obj[\"delete\"](key);\n } else if (isObservableArray(obj)) {\n if (typeof key !== \"number\") {\n key = parseInt(key, 10);\n }\n obj.splice(key, 1);\n } else {\n die(9);\n }\n}\nfunction has(obj, key) {\n if (isObservableObject(obj)) {\n return obj[$mobx].has_(key);\n } else if (isObservableMap(obj)) {\n return obj.has(key);\n } else if (isObservableSet(obj)) {\n return obj.has(key);\n } else if (isObservableArray(obj)) {\n return key >= 0 && key < obj.length;\n }\n die(10);\n}\nfunction get(obj, key) {\n if (!has(obj, key)) {\n return undefined;\n }\n if (isObservableObject(obj)) {\n return obj[$mobx].get_(key);\n } else if (isObservableMap(obj)) {\n return obj.get(key);\n } else if (isObservableArray(obj)) {\n return obj[key];\n }\n die(11);\n}\nfunction apiDefineProperty(obj, key, descriptor) {\n if (isObservableObject(obj)) {\n return obj[$mobx].defineProperty_(key, descriptor);\n }\n die(39);\n}\nfunction apiOwnKeys(obj) {\n if (isObservableObject(obj)) {\n return obj[$mobx].ownKeys_();\n }\n die(38);\n}\n\nfunction observe(thing, propOrCb, cbOrFire, fireImmediately) {\n if (isFunction(cbOrFire)) {\n return observeObservableProperty(thing, propOrCb, cbOrFire, fireImmediately);\n } else {\n return observeObservable(thing, propOrCb, cbOrFire);\n }\n}\nfunction observeObservable(thing, listener, fireImmediately) {\n return getAdministration(thing).observe_(listener, fireImmediately);\n}\nfunction observeObservableProperty(thing, property, listener, fireImmediately) {\n return getAdministration(thing, property).observe_(listener, fireImmediately);\n}\n\nfunction cache(map, key, value) {\n map.set(key, value);\n return value;\n}\nfunction toJSHelper(source, __alreadySeen) {\n if (source == null || typeof source !== \"object\" || source instanceof Date || !isObservable(source)) {\n return source;\n }\n if (isObservableValue(source) || isComputedValue(source)) {\n return toJSHelper(source.get(), __alreadySeen);\n }\n if (__alreadySeen.has(source)) {\n return __alreadySeen.get(source);\n }\n if (isObservableArray(source)) {\n var res = cache(__alreadySeen, source, new Array(source.length));\n source.forEach(function (value, idx) {\n res[idx] = toJSHelper(value, __alreadySeen);\n });\n return res;\n }\n if (isObservableSet(source)) {\n var _res = cache(__alreadySeen, source, new Set());\n source.forEach(function (value) {\n _res.add(toJSHelper(value, __alreadySeen));\n });\n return _res;\n }\n if (isObservableMap(source)) {\n var _res2 = cache(__alreadySeen, source, new Map());\n source.forEach(function (value, key) {\n _res2.set(key, toJSHelper(value, __alreadySeen));\n });\n return _res2;\n } else {\n // must be observable object\n var _res3 = cache(__alreadySeen, source, {});\n apiOwnKeys(source).forEach(function (key) {\n if (objectPrototype.propertyIsEnumerable.call(source, key)) {\n _res3[key] = toJSHelper(source[key], __alreadySeen);\n }\n });\n return _res3;\n }\n}\n/**\n * Recursively converts an observable to it's non-observable native counterpart.\n * It does NOT recurse into non-observables, these are left as they are, even if they contain observables.\n * Computed and other non-enumerable properties are completely ignored.\n * Complex scenarios require custom solution, eg implementing `toJSON` or using `serializr` lib.\n */\nfunction toJS(source, options) {\n if ( true && options) {\n die(\"toJS no longer supports options\");\n }\n return toJSHelper(source, new Map());\n}\n\nfunction trace() {\n if (false) {}\n var enterBreakPoint = false;\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n if (typeof args[args.length - 1] === \"boolean\") {\n enterBreakPoint = args.pop();\n }\n var derivation = getAtomFromArgs(args);\n if (!derivation) {\n return die(\"'trace(break?)' can only be used inside a tracked computed value or a Reaction. Consider passing in the computed value or reaction explicitly\");\n }\n if (derivation.isTracing_ === TraceMode.NONE) {\n console.log(\"[mobx.trace] '\" + derivation.name_ + \"' tracing enabled\");\n }\n derivation.isTracing_ = enterBreakPoint ? TraceMode.BREAK : TraceMode.LOG;\n}\nfunction getAtomFromArgs(args) {\n switch (args.length) {\n case 0:\n return globalState.trackingDerivation;\n case 1:\n return getAtom(args[0]);\n case 2:\n return getAtom(args[0], args[1]);\n }\n}\n\n/**\n * During a transaction no views are updated until the end of the transaction.\n * The transaction will be run synchronously nonetheless.\n *\n * @param action a function that updates some reactive state\n * @returns any value that was returned by the 'action' parameter.\n */\nfunction transaction(action, thisArg) {\n if (thisArg === void 0) {\n thisArg = undefined;\n }\n startBatch();\n try {\n return action.apply(thisArg);\n } finally {\n endBatch();\n }\n}\n\nfunction when(predicate, arg1, arg2) {\n if (arguments.length === 1 || arg1 && typeof arg1 === \"object\") {\n return whenPromise(predicate, arg1);\n }\n return _when(predicate, arg1, arg2 || {});\n}\nfunction _when(predicate, effect, opts) {\n var timeoutHandle;\n if (typeof opts.timeout === \"number\") {\n var error = new Error(\"WHEN_TIMEOUT\");\n timeoutHandle = setTimeout(function () {\n if (!disposer[$mobx].isDisposed) {\n disposer();\n if (opts.onError) {\n opts.onError(error);\n } else {\n throw error;\n }\n }\n }, opts.timeout);\n }\n opts.name = true ? opts.name || \"When@\" + getNextId() : 0;\n var effectAction = createAction( true ? opts.name + \"-effect\" : 0, effect);\n // eslint-disable-next-line\n var disposer = autorun(function (r) {\n // predicate should not change state\n var cond = allowStateChanges(false, predicate);\n if (cond) {\n r.dispose();\n if (timeoutHandle) {\n clearTimeout(timeoutHandle);\n }\n effectAction();\n }\n }, opts);\n return disposer;\n}\nfunction whenPromise(predicate, opts) {\n var _opts$signal;\n if ( true && opts && opts.onError) {\n return die(\"the options 'onError' and 'promise' cannot be combined\");\n }\n if (opts != null && (_opts$signal = opts.signal) != null && _opts$signal.aborted) {\n return Object.assign(Promise.reject(new Error(\"WHEN_ABORTED\")), {\n cancel: function cancel() {\n return null;\n }\n });\n }\n var cancel;\n var abort;\n var res = new Promise(function (resolve, reject) {\n var _opts$signal2;\n var disposer = _when(predicate, resolve, _extends({}, opts, {\n onError: reject\n }));\n cancel = function cancel() {\n disposer();\n reject(new Error(\"WHEN_CANCELLED\"));\n };\n abort = function abort() {\n disposer();\n reject(new Error(\"WHEN_ABORTED\"));\n };\n opts == null || (_opts$signal2 = opts.signal) == null || _opts$signal2.addEventListener == null || _opts$signal2.addEventListener(\"abort\", abort);\n })[\"finally\"](function () {\n var _opts$signal3;\n return opts == null || (_opts$signal3 = opts.signal) == null || _opts$signal3.removeEventListener == null ? void 0 : _opts$signal3.removeEventListener(\"abort\", abort);\n });\n res.cancel = cancel;\n return res;\n}\n\nfunction getAdm(target) {\n return target[$mobx];\n}\n// Optimization: we don't need the intermediate objects and could have a completely custom administration for DynamicObjects,\n// and skip either the internal values map, or the base object with its property descriptors!\nvar objectProxyTraps = {\n has: function has(target, name) {\n if ( true && globalState.trackingDerivation) {\n warnAboutProxyRequirement(\"detect new properties using the 'in' operator. Use 'has' from 'mobx' instead.\");\n }\n return getAdm(target).has_(name);\n },\n get: function get(target, name) {\n return getAdm(target).get_(name);\n },\n set: function set(target, name, value) {\n var _getAdm$set_;\n if (!isStringish(name)) {\n return false;\n }\n if ( true && !getAdm(target).values_.has(name)) {\n warnAboutProxyRequirement(\"add a new observable property through direct assignment. Use 'set' from 'mobx' instead.\");\n }\n // null (intercepted) -> true (success)\n return (_getAdm$set_ = getAdm(target).set_(name, value, true)) != null ? _getAdm$set_ : true;\n },\n deleteProperty: function deleteProperty(target, name) {\n var _getAdm$delete_;\n if (true) {\n warnAboutProxyRequirement(\"delete properties from an observable object. Use 'remove' from 'mobx' instead.\");\n }\n if (!isStringish(name)) {\n return false;\n }\n // null (intercepted) -> true (success)\n return (_getAdm$delete_ = getAdm(target).delete_(name, true)) != null ? _getAdm$delete_ : true;\n },\n defineProperty: function defineProperty(target, name, descriptor) {\n var _getAdm$definePropert;\n if (true) {\n warnAboutProxyRequirement(\"define property on an observable object. Use 'defineProperty' from 'mobx' instead.\");\n }\n // null (intercepted) -> true (success)\n return (_getAdm$definePropert = getAdm(target).defineProperty_(name, descriptor)) != null ? _getAdm$definePropert : true;\n },\n ownKeys: function ownKeys(target) {\n if ( true && globalState.trackingDerivation) {\n warnAboutProxyRequirement(\"iterate keys to detect added / removed properties. Use 'keys' from 'mobx' instead.\");\n }\n return getAdm(target).ownKeys_();\n },\n preventExtensions: function preventExtensions(target) {\n die(13);\n }\n};\nfunction asDynamicObservableObject(target, options) {\n var _target$$mobx, _target$$mobx$proxy_;\n assertProxies();\n target = asObservableObject(target, options);\n return (_target$$mobx$proxy_ = (_target$$mobx = target[$mobx]).proxy_) != null ? _target$$mobx$proxy_ : _target$$mobx.proxy_ = new Proxy(target, objectProxyTraps);\n}\n\nfunction hasInterceptors(interceptable) {\n return interceptable.interceptors_ !== undefined && interceptable.interceptors_.length > 0;\n}\nfunction registerInterceptor(interceptable, handler) {\n var interceptors = interceptable.interceptors_ || (interceptable.interceptors_ = []);\n interceptors.push(handler);\n return once(function () {\n var idx = interceptors.indexOf(handler);\n if (idx !== -1) {\n interceptors.splice(idx, 1);\n }\n });\n}\nfunction interceptChange(interceptable, change) {\n var prevU = untrackedStart();\n try {\n // Interceptor can modify the array, copy it to avoid concurrent modification, see #1950\n var interceptors = [].concat(interceptable.interceptors_ || []);\n for (var i = 0, l = interceptors.length; i < l; i++) {\n change = interceptors[i](change);\n if (change && !change.type) {\n die(14);\n }\n if (!change) {\n break;\n }\n }\n return change;\n } finally {\n untrackedEnd(prevU);\n }\n}\n\nfunction hasListeners(listenable) {\n return listenable.changeListeners_ !== undefined && listenable.changeListeners_.length > 0;\n}\nfunction registerListener(listenable, handler) {\n var listeners = listenable.changeListeners_ || (listenable.changeListeners_ = []);\n listeners.push(handler);\n return once(function () {\n var idx = listeners.indexOf(handler);\n if (idx !== -1) {\n listeners.splice(idx, 1);\n }\n });\n}\nfunction notifyListeners(listenable, change) {\n var prevU = untrackedStart();\n var listeners = listenable.changeListeners_;\n if (!listeners) {\n return;\n }\n listeners = listeners.slice();\n for (var i = 0, l = listeners.length; i < l; i++) {\n listeners[i](change);\n }\n untrackedEnd(prevU);\n}\n\nfunction makeObservable(target, annotations, options) {\n initObservable(function () {\n var _annotations;\n var adm = asObservableObject(target, options)[$mobx];\n if ( true && annotations && target[storedAnnotationsSymbol]) {\n die(\"makeObservable second arg must be nullish when using decorators. Mixing @decorator syntax with annotations is not supported.\");\n }\n // Default to decorators\n (_annotations = annotations) != null ? _annotations : annotations = collectStoredAnnotations(target);\n // Annotate\n ownKeys(annotations).forEach(function (key) {\n return adm.make_(key, annotations[key]);\n });\n });\n return target;\n}\n// proto[keysSymbol] = new Set()\nvar keysSymbol = /*#__PURE__*/Symbol(\"mobx-keys\");\nfunction makeAutoObservable(target, overrides, options) {\n if (true) {\n if (!isPlainObject(target) && !isPlainObject(Object.getPrototypeOf(target))) {\n die(\"'makeAutoObservable' can only be used for classes that don't have a superclass\");\n }\n if (isObservableObject(target)) {\n die(\"makeAutoObservable can only be used on objects not already made observable\");\n }\n }\n // Optimization: avoid visiting protos\n // Assumes that annotation.make_/.extend_ works the same for plain objects\n if (isPlainObject(target)) {\n return extendObservable(target, target, overrides, options);\n }\n initObservable(function () {\n var adm = asObservableObject(target, options)[$mobx];\n // Optimization: cache keys on proto\n // Assumes makeAutoObservable can be called only once per object and can't be used in subclass\n if (!target[keysSymbol]) {\n var proto = Object.getPrototypeOf(target);\n var keys = new Set([].concat(ownKeys(target), ownKeys(proto)));\n keys[\"delete\"](\"constructor\");\n keys[\"delete\"]($mobx);\n addHiddenProp(proto, keysSymbol, keys);\n }\n target[keysSymbol].forEach(function (key) {\n return adm.make_(key,\n // must pass \"undefined\" for { key: undefined }\n !overrides ? true : key in overrides ? overrides[key] : true);\n });\n });\n return target;\n}\n\nvar SPLICE = \"splice\";\nvar UPDATE = \"update\";\nvar MAX_SPLICE_SIZE = 10000; // See e.g. https://github.com/mobxjs/mobx/issues/859\nvar arrayTraps = {\n get: function get(target, name) {\n var adm = target[$mobx];\n if (name === $mobx) {\n return adm;\n }\n if (name === \"length\") {\n return adm.getArrayLength_();\n }\n if (typeof name === \"string\" && !isNaN(name)) {\n return adm.get_(parseInt(name));\n }\n if (hasProp(arrayExtensions, name)) {\n return arrayExtensions[name];\n }\n return target[name];\n },\n set: function set(target, name, value) {\n var adm = target[$mobx];\n if (name === \"length\") {\n adm.setArrayLength_(value);\n }\n if (typeof name === \"symbol\" || isNaN(name)) {\n target[name] = value;\n } else {\n // numeric string\n adm.set_(parseInt(name), value);\n }\n return true;\n },\n preventExtensions: function preventExtensions() {\n die(15);\n }\n};\nvar ObservableArrayAdministration = /*#__PURE__*/function () {\n function ObservableArrayAdministration(name, enhancer, owned_, legacyMode_) {\n if (name === void 0) {\n name = true ? \"ObservableArray@\" + getNextId() : 0;\n }\n this.owned_ = void 0;\n this.legacyMode_ = void 0;\n this.atom_ = void 0;\n this.values_ = [];\n // this is the prop that gets proxied, so can't replace it!\n this.interceptors_ = void 0;\n this.changeListeners_ = void 0;\n this.enhancer_ = void 0;\n this.dehancer = void 0;\n this.proxy_ = void 0;\n this.lastKnownLength_ = 0;\n this.owned_ = owned_;\n this.legacyMode_ = legacyMode_;\n this.atom_ = new Atom(name);\n this.enhancer_ = function (newV, oldV) {\n return enhancer(newV, oldV, true ? name + \"[..]\" : 0);\n };\n }\n var _proto = ObservableArrayAdministration.prototype;\n _proto.dehanceValue_ = function dehanceValue_(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.dehanceValues_ = function dehanceValues_(values) {\n if (this.dehancer !== undefined && values.length > 0) {\n return values.map(this.dehancer);\n }\n return values;\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n if (fireImmediately === void 0) {\n fireImmediately = false;\n }\n if (fireImmediately) {\n listener({\n observableKind: \"array\",\n object: this.proxy_,\n debugObjectName: this.atom_.name_,\n type: \"splice\",\n index: 0,\n added: this.values_.slice(),\n addedCount: this.values_.length,\n removed: [],\n removedCount: 0\n });\n }\n return registerListener(this, listener);\n };\n _proto.getArrayLength_ = function getArrayLength_() {\n this.atom_.reportObserved();\n return this.values_.length;\n };\n _proto.setArrayLength_ = function setArrayLength_(newLength) {\n if (typeof newLength !== \"number\" || isNaN(newLength) || newLength < 0) {\n die(\"Out of range: \" + newLength);\n }\n var currentLength = this.values_.length;\n if (newLength === currentLength) {\n return;\n } else if (newLength > currentLength) {\n var newItems = new Array(newLength - currentLength);\n for (var i = 0; i < newLength - currentLength; i++) {\n newItems[i] = undefined;\n } // No Array.fill everywhere...\n this.spliceWithArray_(currentLength, 0, newItems);\n } else {\n this.spliceWithArray_(newLength, currentLength - newLength);\n }\n };\n _proto.updateArrayLength_ = function updateArrayLength_(oldLength, delta) {\n if (oldLength !== this.lastKnownLength_) {\n die(16);\n }\n this.lastKnownLength_ += delta;\n if (this.legacyMode_ && delta > 0) {\n reserveArrayBuffer(oldLength + delta + 1);\n }\n };\n _proto.spliceWithArray_ = function spliceWithArray_(index, deleteCount, newItems) {\n var _this = this;\n checkIfStateModificationsAreAllowed(this.atom_);\n var length = this.values_.length;\n if (index === undefined) {\n index = 0;\n } else if (index > length) {\n index = length;\n } else if (index < 0) {\n index = Math.max(0, length + index);\n }\n if (arguments.length === 1) {\n deleteCount = length - index;\n } else if (deleteCount === undefined || deleteCount === null) {\n deleteCount = 0;\n } else {\n deleteCount = Math.max(0, Math.min(deleteCount, length - index));\n }\n if (newItems === undefined) {\n newItems = EMPTY_ARRAY;\n }\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_,\n type: SPLICE,\n index: index,\n removedCount: deleteCount,\n added: newItems\n });\n if (!change) {\n return EMPTY_ARRAY;\n }\n deleteCount = change.removedCount;\n newItems = change.added;\n }\n newItems = newItems.length === 0 ? newItems : newItems.map(function (v) {\n return _this.enhancer_(v, undefined);\n });\n if (this.legacyMode_ || \"development\" !== \"production\") {\n var lengthDelta = newItems.length - deleteCount;\n this.updateArrayLength_(length, lengthDelta); // checks if internal array wasn't modified\n }\n var res = this.spliceItemsIntoValues_(index, deleteCount, newItems);\n if (deleteCount !== 0 || newItems.length !== 0) {\n this.notifyArraySplice_(index, newItems, res);\n }\n return this.dehanceValues_(res);\n };\n _proto.spliceItemsIntoValues_ = function spliceItemsIntoValues_(index, deleteCount, newItems) {\n if (newItems.length < MAX_SPLICE_SIZE) {\n var _this$values_;\n return (_this$values_ = this.values_).splice.apply(_this$values_, [index, deleteCount].concat(newItems));\n } else {\n // The items removed by the splice\n var res = this.values_.slice(index, index + deleteCount);\n // The items that that should remain at the end of the array\n var oldItems = this.values_.slice(index + deleteCount);\n // New length is the previous length + addition count - deletion count\n this.values_.length += newItems.length - deleteCount;\n for (var i = 0; i < newItems.length; i++) {\n this.values_[index + i] = newItems[i];\n }\n for (var _i = 0; _i < oldItems.length; _i++) {\n this.values_[index + newItems.length + _i] = oldItems[_i];\n }\n return res;\n }\n };\n _proto.notifyArrayChildUpdate_ = function notifyArrayChildUpdate_(index, newValue, oldValue) {\n var notifySpy = !this.owned_ && isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"array\",\n object: this.proxy_,\n type: UPDATE,\n debugObjectName: this.atom_.name_,\n index: index,\n newValue: newValue,\n oldValue: oldValue\n } : null;\n // The reason why this is on right hand side here (and not above), is this way the uglifier will drop it, but it won't\n // cause any runtime overhead in development mode without NODE_ENV set, unless spying is enabled\n if ( true && notifySpy) {\n spyReportStart(change);\n }\n this.atom_.reportChanged();\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n };\n _proto.notifyArraySplice_ = function notifyArraySplice_(index, added, removed) {\n var notifySpy = !this.owned_ && isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"array\",\n object: this.proxy_,\n debugObjectName: this.atom_.name_,\n type: SPLICE,\n index: index,\n removed: removed,\n added: added,\n removedCount: removed.length,\n addedCount: added.length\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n }\n this.atom_.reportChanged();\n // conform: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/observe\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n };\n _proto.get_ = function get_(index) {\n if (this.legacyMode_ && index >= this.values_.length) {\n console.warn( true ? \"[mobx.array] Attempt to read an array index (\" + index + \") that is out of bounds (\" + this.values_.length + \"). Please check length first. Out of bound indices will not be tracked by MobX\" : 0);\n return undefined;\n }\n this.atom_.reportObserved();\n return this.dehanceValue_(this.values_[index]);\n };\n _proto.set_ = function set_(index, newValue) {\n var values = this.values_;\n if (this.legacyMode_ && index > values.length) {\n // out of bounds\n die(17, index, values.length);\n }\n if (index < values.length) {\n // update at index in range\n checkIfStateModificationsAreAllowed(this.atom_);\n var oldValue = values[index];\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: UPDATE,\n object: this.proxy_,\n // since \"this\" is the real array we need to pass its proxy\n index: index,\n newValue: newValue\n });\n if (!change) {\n return;\n }\n newValue = change.newValue;\n }\n newValue = this.enhancer_(newValue, oldValue);\n var changed = newValue !== oldValue;\n if (changed) {\n values[index] = newValue;\n this.notifyArrayChildUpdate_(index, newValue, oldValue);\n }\n } else {\n // For out of bound index, we don't create an actual sparse array,\n // but rather fill the holes with undefined (same as setArrayLength_).\n // This could be considered a bug.\n var newItems = new Array(index + 1 - values.length);\n for (var i = 0; i < newItems.length - 1; i++) {\n newItems[i] = undefined;\n } // No Array.fill everywhere...\n newItems[newItems.length - 1] = newValue;\n this.spliceWithArray_(values.length, 0, newItems);\n }\n };\n return ObservableArrayAdministration;\n}();\nfunction createObservableArray(initialValues, enhancer, name, owned) {\n if (name === void 0) {\n name = true ? \"ObservableArray@\" + getNextId() : 0;\n }\n if (owned === void 0) {\n owned = false;\n }\n assertProxies();\n return initObservable(function () {\n var adm = new ObservableArrayAdministration(name, enhancer, owned, false);\n addHiddenFinalProp(adm.values_, $mobx, adm);\n var proxy = new Proxy(adm.values_, arrayTraps);\n adm.proxy_ = proxy;\n if (initialValues && initialValues.length) {\n adm.spliceWithArray_(0, 0, initialValues);\n }\n return proxy;\n });\n}\n// eslint-disable-next-line\nvar arrayExtensions = {\n clear: function clear() {\n return this.splice(0);\n },\n replace: function replace(newItems) {\n var adm = this[$mobx];\n return adm.spliceWithArray_(0, adm.values_.length, newItems);\n },\n // Used by JSON.stringify\n toJSON: function toJSON() {\n return this.slice();\n },\n /*\n * functions that do alter the internal structure of the array, (based on lib.es6.d.ts)\n * since these functions alter the inner structure of the array, the have side effects.\n * Because the have side effects, they should not be used in computed function,\n * and for that reason the do not call dependencyState.notifyObserved\n */\n splice: function splice(index, deleteCount) {\n for (var _len = arguments.length, newItems = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {\n newItems[_key - 2] = arguments[_key];\n }\n var adm = this[$mobx];\n switch (arguments.length) {\n case 0:\n return [];\n case 1:\n return adm.spliceWithArray_(index);\n case 2:\n return adm.spliceWithArray_(index, deleteCount);\n }\n return adm.spliceWithArray_(index, deleteCount, newItems);\n },\n spliceWithArray: function spliceWithArray(index, deleteCount, newItems) {\n return this[$mobx].spliceWithArray_(index, deleteCount, newItems);\n },\n push: function push() {\n var adm = this[$mobx];\n for (var _len2 = arguments.length, items = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n items[_key2] = arguments[_key2];\n }\n adm.spliceWithArray_(adm.values_.length, 0, items);\n return adm.values_.length;\n },\n pop: function pop() {\n return this.splice(Math.max(this[$mobx].values_.length - 1, 0), 1)[0];\n },\n shift: function shift() {\n return this.splice(0, 1)[0];\n },\n unshift: function unshift() {\n var adm = this[$mobx];\n for (var _len3 = arguments.length, items = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n items[_key3] = arguments[_key3];\n }\n adm.spliceWithArray_(0, 0, items);\n return adm.values_.length;\n },\n reverse: function reverse() {\n // reverse by default mutates in place before returning the result\n // which makes it both a 'derivation' and a 'mutation'.\n if (globalState.trackingDerivation) {\n die(37, \"reverse\");\n }\n this.replace(this.slice().reverse());\n return this;\n },\n sort: function sort() {\n // sort by default mutates in place before returning the result\n // which goes against all good practices. Let's not change the array in place!\n if (globalState.trackingDerivation) {\n die(37, \"sort\");\n }\n var copy = this.slice();\n copy.sort.apply(copy, arguments);\n this.replace(copy);\n return this;\n },\n remove: function remove(value) {\n var adm = this[$mobx];\n var idx = adm.dehanceValues_(adm.values_).indexOf(value);\n if (idx > -1) {\n this.splice(idx, 1);\n return true;\n }\n return false;\n }\n};\n/**\n * Wrap function from prototype\n * Without this, everything works as well, but this works\n * faster as everything works on unproxied values\n */\naddArrayExtension(\"at\", simpleFunc);\naddArrayExtension(\"concat\", simpleFunc);\naddArrayExtension(\"flat\", simpleFunc);\naddArrayExtension(\"includes\", simpleFunc);\naddArrayExtension(\"indexOf\", simpleFunc);\naddArrayExtension(\"join\", simpleFunc);\naddArrayExtension(\"lastIndexOf\", simpleFunc);\naddArrayExtension(\"slice\", simpleFunc);\naddArrayExtension(\"toString\", simpleFunc);\naddArrayExtension(\"toLocaleString\", simpleFunc);\naddArrayExtension(\"toSorted\", simpleFunc);\naddArrayExtension(\"toSpliced\", simpleFunc);\naddArrayExtension(\"with\", simpleFunc);\n// map\naddArrayExtension(\"every\", mapLikeFunc);\naddArrayExtension(\"filter\", mapLikeFunc);\naddArrayExtension(\"find\", mapLikeFunc);\naddArrayExtension(\"findIndex\", mapLikeFunc);\naddArrayExtension(\"findLast\", mapLikeFunc);\naddArrayExtension(\"findLastIndex\", mapLikeFunc);\naddArrayExtension(\"flatMap\", mapLikeFunc);\naddArrayExtension(\"forEach\", mapLikeFunc);\naddArrayExtension(\"map\", mapLikeFunc);\naddArrayExtension(\"some\", mapLikeFunc);\naddArrayExtension(\"toReversed\", mapLikeFunc);\n// reduce\naddArrayExtension(\"reduce\", reduceLikeFunc);\naddArrayExtension(\"reduceRight\", reduceLikeFunc);\nfunction addArrayExtension(funcName, funcFactory) {\n if (typeof Array.prototype[funcName] === \"function\") {\n arrayExtensions[funcName] = funcFactory(funcName);\n }\n}\n// Report and delegate to dehanced array\nfunction simpleFunc(funcName) {\n return function () {\n var adm = this[$mobx];\n adm.atom_.reportObserved();\n var dehancedValues = adm.dehanceValues_(adm.values_);\n return dehancedValues[funcName].apply(dehancedValues, arguments);\n };\n}\n// Make sure callbacks receive correct array arg #2326\nfunction mapLikeFunc(funcName) {\n return function (callback, thisArg) {\n var _this2 = this;\n var adm = this[$mobx];\n adm.atom_.reportObserved();\n var dehancedValues = adm.dehanceValues_(adm.values_);\n return dehancedValues[funcName](function (element, index) {\n return callback.call(thisArg, element, index, _this2);\n });\n };\n}\n// Make sure callbacks receive correct array arg #2326\nfunction reduceLikeFunc(funcName) {\n return function () {\n var _this3 = this;\n var adm = this[$mobx];\n adm.atom_.reportObserved();\n var dehancedValues = adm.dehanceValues_(adm.values_);\n // #2432 - reduce behavior depends on arguments.length\n var callback = arguments[0];\n arguments[0] = function (accumulator, currentValue, index) {\n return callback(accumulator, currentValue, index, _this3);\n };\n return dehancedValues[funcName].apply(dehancedValues, arguments);\n };\n}\nvar isObservableArrayAdministration = /*#__PURE__*/createInstanceofPredicate(\"ObservableArrayAdministration\", ObservableArrayAdministration);\nfunction isObservableArray(thing) {\n return isObject(thing) && isObservableArrayAdministration(thing[$mobx]);\n}\n\nvar ObservableMapMarker = {};\nvar ADD = \"add\";\nvar DELETE = \"delete\";\n// just extend Map? See also https://gist.github.com/nestharus/13b4d74f2ef4a2f4357dbd3fc23c1e54\n// But: https://github.com/mobxjs/mobx/issues/1556\nvar ObservableMap = /*#__PURE__*/function () {\n function ObservableMap(initialData, enhancer_, name_) {\n var _this = this;\n if (enhancer_ === void 0) {\n enhancer_ = deepEnhancer;\n }\n if (name_ === void 0) {\n name_ = true ? \"ObservableMap@\" + getNextId() : 0;\n }\n this.enhancer_ = void 0;\n this.name_ = void 0;\n this[$mobx] = ObservableMapMarker;\n this.data_ = void 0;\n this.hasMap_ = void 0;\n // hasMap, not hashMap >-).\n this.keysAtom_ = void 0;\n this.interceptors_ = void 0;\n this.changeListeners_ = void 0;\n this.dehancer = void 0;\n this.enhancer_ = enhancer_;\n this.name_ = name_;\n if (!isFunction(Map)) {\n die(18);\n }\n initObservable(function () {\n _this.keysAtom_ = createAtom( true ? _this.name_ + \".keys()\" : 0);\n _this.data_ = new Map();\n _this.hasMap_ = new Map();\n if (initialData) {\n _this.merge(initialData);\n }\n });\n }\n var _proto = ObservableMap.prototype;\n _proto.has_ = function has_(key) {\n return this.data_.has(key);\n };\n _proto.has = function has(key) {\n var _this2 = this;\n if (!globalState.trackingDerivation) {\n return this.has_(key);\n }\n var entry = this.hasMap_.get(key);\n if (!entry) {\n var newEntry = entry = new ObservableValue(this.has_(key), referenceEnhancer, true ? this.name_ + \".\" + stringifyKey(key) + \"?\" : 0, false);\n this.hasMap_.set(key, newEntry);\n onBecomeUnobserved(newEntry, function () {\n return _this2.hasMap_[\"delete\"](key);\n });\n }\n return entry.get();\n };\n _proto.set = function set(key, value) {\n var hasKey = this.has_(key);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: hasKey ? UPDATE : ADD,\n object: this,\n newValue: value,\n name: key\n });\n if (!change) {\n return this;\n }\n value = change.newValue;\n }\n if (hasKey) {\n this.updateValue_(key, value);\n } else {\n this.addValue_(key, value);\n }\n return this;\n };\n _proto[\"delete\"] = function _delete(key) {\n var _this3 = this;\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: DELETE,\n object: this,\n name: key\n });\n if (!change) {\n return false;\n }\n }\n if (this.has_(key)) {\n var notifySpy = isSpyEnabled();\n var notify = hasListeners(this);\n var _change = notify || notifySpy ? {\n observableKind: \"map\",\n debugObjectName: this.name_,\n type: DELETE,\n object: this,\n oldValue: this.data_.get(key).value_,\n name: key\n } : null;\n if ( true && notifySpy) {\n spyReportStart(_change);\n } // TODO fix type\n transaction(function () {\n var _this3$hasMap_$get;\n _this3.keysAtom_.reportChanged();\n (_this3$hasMap_$get = _this3.hasMap_.get(key)) == null || _this3$hasMap_$get.setNewValue_(false);\n var observable = _this3.data_.get(key);\n observable.setNewValue_(undefined);\n _this3.data_[\"delete\"](key);\n });\n if (notify) {\n notifyListeners(this, _change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n return true;\n }\n return false;\n };\n _proto.updateValue_ = function updateValue_(key, newValue) {\n var observable = this.data_.get(key);\n newValue = observable.prepareNewValue_(newValue);\n if (newValue !== globalState.UNCHANGED) {\n var notifySpy = isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"map\",\n debugObjectName: this.name_,\n type: UPDATE,\n object: this,\n oldValue: observable.value_,\n name: key,\n newValue: newValue\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n } // TODO fix type\n observable.setNewValue_(newValue);\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n };\n _proto.addValue_ = function addValue_(key, newValue) {\n var _this4 = this;\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n transaction(function () {\n var _this4$hasMap_$get;\n var observable = new ObservableValue(newValue, _this4.enhancer_, true ? _this4.name_ + \".\" + stringifyKey(key) : 0, false);\n _this4.data_.set(key, observable);\n newValue = observable.value_; // value might have been changed\n (_this4$hasMap_$get = _this4.hasMap_.get(key)) == null || _this4$hasMap_$get.setNewValue_(true);\n _this4.keysAtom_.reportChanged();\n });\n var notifySpy = isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"map\",\n debugObjectName: this.name_,\n type: ADD,\n object: this,\n name: key,\n newValue: newValue\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n } // TODO fix type\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n };\n _proto.get = function get(key) {\n if (this.has(key)) {\n return this.dehanceValue_(this.data_.get(key).get());\n }\n return this.dehanceValue_(undefined);\n };\n _proto.dehanceValue_ = function dehanceValue_(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.keys = function keys() {\n this.keysAtom_.reportObserved();\n return this.data_.keys();\n };\n _proto.values = function values() {\n var self = this;\n var keys = this.keys();\n return makeIterableForMap({\n next: function next() {\n var _keys$next = keys.next(),\n done = _keys$next.done,\n value = _keys$next.value;\n return {\n done: done,\n value: done ? undefined : self.get(value)\n };\n }\n });\n };\n _proto.entries = function entries() {\n var self = this;\n var keys = this.keys();\n return makeIterableForMap({\n next: function next() {\n var _keys$next2 = keys.next(),\n done = _keys$next2.done,\n value = _keys$next2.value;\n return {\n done: done,\n value: done ? undefined : [value, self.get(value)]\n };\n }\n });\n };\n _proto[Symbol.iterator] = function () {\n return this.entries();\n };\n _proto.forEach = function forEach(callback, thisArg) {\n for (var _iterator = _createForOfIteratorHelperLoose(this), _step; !(_step = _iterator()).done;) {\n var _step$value = _step.value,\n key = _step$value[0],\n value = _step$value[1];\n callback.call(thisArg, value, key, this);\n }\n }\n /** Merge another object into this object, returns this. */;\n _proto.merge = function merge(other) {\n var _this5 = this;\n if (isObservableMap(other)) {\n other = new Map(other);\n }\n transaction(function () {\n if (isPlainObject(other)) {\n getPlainObjectKeys(other).forEach(function (key) {\n return _this5.set(key, other[key]);\n });\n } else if (Array.isArray(other)) {\n other.forEach(function (_ref) {\n var key = _ref[0],\n value = _ref[1];\n return _this5.set(key, value);\n });\n } else if (isES6Map(other)) {\n if (!isPlainES6Map(other)) {\n die(19, other);\n }\n other.forEach(function (value, key) {\n return _this5.set(key, value);\n });\n } else if (other !== null && other !== undefined) {\n die(20, other);\n }\n });\n return this;\n };\n _proto.clear = function clear() {\n var _this6 = this;\n transaction(function () {\n untracked(function () {\n for (var _iterator2 = _createForOfIteratorHelperLoose(_this6.keys()), _step2; !(_step2 = _iterator2()).done;) {\n var key = _step2.value;\n _this6[\"delete\"](key);\n }\n });\n });\n };\n _proto.replace = function replace(values) {\n var _this7 = this;\n // Implementation requirements:\n // - respect ordering of replacement map\n // - allow interceptors to run and potentially prevent individual operations\n // - don't recreate observables that already exist in original map (so we don't destroy existing subscriptions)\n // - don't _keysAtom.reportChanged if the keys of resulting map are indentical (order matters!)\n // - note that result map may differ from replacement map due to the interceptors\n transaction(function () {\n // Convert to map so we can do quick key lookups\n var replacementMap = convertToMap(values);\n var orderedData = new Map();\n // Used for optimization\n var keysReportChangedCalled = false;\n // Delete keys that don't exist in replacement map\n // if the key deletion is prevented by interceptor\n // add entry at the beginning of the result map\n for (var _iterator3 = _createForOfIteratorHelperLoose(_this7.data_.keys()), _step3; !(_step3 = _iterator3()).done;) {\n var key = _step3.value;\n // Concurrently iterating/deleting keys\n // iterator should handle this correctly\n if (!replacementMap.has(key)) {\n var deleted = _this7[\"delete\"](key);\n // Was the key removed?\n if (deleted) {\n // _keysAtom.reportChanged() was already called\n keysReportChangedCalled = true;\n } else {\n // Delete prevented by interceptor\n var value = _this7.data_.get(key);\n orderedData.set(key, value);\n }\n }\n }\n // Merge entries\n for (var _iterator4 = _createForOfIteratorHelperLoose(replacementMap.entries()), _step4; !(_step4 = _iterator4()).done;) {\n var _step4$value = _step4.value,\n _key = _step4$value[0],\n _value = _step4$value[1];\n // We will want to know whether a new key is added\n var keyExisted = _this7.data_.has(_key);\n // Add or update value\n _this7.set(_key, _value);\n // The addition could have been prevent by interceptor\n if (_this7.data_.has(_key)) {\n // The update could have been prevented by interceptor\n // and also we want to preserve existing values\n // so use value from _data map (instead of replacement map)\n var _value2 = _this7.data_.get(_key);\n orderedData.set(_key, _value2);\n // Was a new key added?\n if (!keyExisted) {\n // _keysAtom.reportChanged() was already called\n keysReportChangedCalled = true;\n }\n }\n }\n // Check for possible key order change\n if (!keysReportChangedCalled) {\n if (_this7.data_.size !== orderedData.size) {\n // If size differs, keys are definitely modified\n _this7.keysAtom_.reportChanged();\n } else {\n var iter1 = _this7.data_.keys();\n var iter2 = orderedData.keys();\n var next1 = iter1.next();\n var next2 = iter2.next();\n while (!next1.done) {\n if (next1.value !== next2.value) {\n _this7.keysAtom_.reportChanged();\n break;\n }\n next1 = iter1.next();\n next2 = iter2.next();\n }\n }\n }\n // Use correctly ordered map\n _this7.data_ = orderedData;\n });\n return this;\n };\n _proto.toString = function toString() {\n return \"[object ObservableMap]\";\n };\n _proto.toJSON = function toJSON() {\n return Array.from(this);\n };\n /**\n * Observes this object. Triggers for the events 'add', 'update' and 'delete'.\n * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe\n * for callback details\n */\n _proto.observe_ = function observe_(listener, fireImmediately) {\n if ( true && fireImmediately === true) {\n die(\"`observe` doesn't support fireImmediately=true in combination with maps.\");\n }\n return registerListener(this, listener);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n return _createClass(ObservableMap, [{\n key: \"size\",\n get: function get() {\n this.keysAtom_.reportObserved();\n return this.data_.size;\n }\n }, {\n key: Symbol.toStringTag,\n get: function get() {\n return \"Map\";\n }\n }]);\n}();\n// eslint-disable-next-line\nvar isObservableMap = /*#__PURE__*/createInstanceofPredicate(\"ObservableMap\", ObservableMap);\nfunction makeIterableForMap(iterator) {\n iterator[Symbol.toStringTag] = \"MapIterator\";\n return makeIterable(iterator);\n}\nfunction convertToMap(dataStructure) {\n if (isES6Map(dataStructure) || isObservableMap(dataStructure)) {\n return dataStructure;\n } else if (Array.isArray(dataStructure)) {\n return new Map(dataStructure);\n } else if (isPlainObject(dataStructure)) {\n var map = new Map();\n for (var key in dataStructure) {\n map.set(key, dataStructure[key]);\n }\n return map;\n } else {\n return die(21, dataStructure);\n }\n}\n\nvar ObservableSetMarker = {};\nvar ObservableSet = /*#__PURE__*/function () {\n function ObservableSet(initialData, enhancer, name_) {\n var _this = this;\n if (enhancer === void 0) {\n enhancer = deepEnhancer;\n }\n if (name_ === void 0) {\n name_ = true ? \"ObservableSet@\" + getNextId() : 0;\n }\n this.name_ = void 0;\n this[$mobx] = ObservableSetMarker;\n this.data_ = new Set();\n this.atom_ = void 0;\n this.changeListeners_ = void 0;\n this.interceptors_ = void 0;\n this.dehancer = void 0;\n this.enhancer_ = void 0;\n this.name_ = name_;\n if (!isFunction(Set)) {\n die(22);\n }\n this.enhancer_ = function (newV, oldV) {\n return enhancer(newV, oldV, name_);\n };\n initObservable(function () {\n _this.atom_ = createAtom(_this.name_);\n if (initialData) {\n _this.replace(initialData);\n }\n });\n }\n var _proto = ObservableSet.prototype;\n _proto.dehanceValue_ = function dehanceValue_(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.clear = function clear() {\n var _this2 = this;\n transaction(function () {\n untracked(function () {\n for (var _iterator = _createForOfIteratorHelperLoose(_this2.data_.values()), _step; !(_step = _iterator()).done;) {\n var value = _step.value;\n _this2[\"delete\"](value);\n }\n });\n });\n };\n _proto.forEach = function forEach(callbackFn, thisArg) {\n for (var _iterator2 = _createForOfIteratorHelperLoose(this), _step2; !(_step2 = _iterator2()).done;) {\n var value = _step2.value;\n callbackFn.call(thisArg, value, value, this);\n }\n };\n _proto.add = function add(value) {\n var _this3 = this;\n checkIfStateModificationsAreAllowed(this.atom_);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: ADD,\n object: this,\n newValue: value\n });\n if (!change) {\n return this;\n }\n // ideally, value = change.value would be done here, so that values can be\n // changed by interceptor. Same applies for other Set and Map api's.\n }\n if (!this.has(value)) {\n transaction(function () {\n _this3.data_.add(_this3.enhancer_(value, undefined));\n _this3.atom_.reportChanged();\n });\n var notifySpy = true && isSpyEnabled();\n var notify = hasListeners(this);\n var _change = notify || notifySpy ? {\n observableKind: \"set\",\n debugObjectName: this.name_,\n type: ADD,\n object: this,\n newValue: value\n } : null;\n if (notifySpy && \"development\" !== \"production\") {\n spyReportStart(_change);\n }\n if (notify) {\n notifyListeners(this, _change);\n }\n if (notifySpy && \"development\" !== \"production\") {\n spyReportEnd();\n }\n }\n return this;\n };\n _proto[\"delete\"] = function _delete(value) {\n var _this4 = this;\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: DELETE,\n object: this,\n oldValue: value\n });\n if (!change) {\n return false;\n }\n }\n if (this.has(value)) {\n var notifySpy = true && isSpyEnabled();\n var notify = hasListeners(this);\n var _change2 = notify || notifySpy ? {\n observableKind: \"set\",\n debugObjectName: this.name_,\n type: DELETE,\n object: this,\n oldValue: value\n } : null;\n if (notifySpy && \"development\" !== \"production\") {\n spyReportStart(_change2);\n }\n transaction(function () {\n _this4.atom_.reportChanged();\n _this4.data_[\"delete\"](value);\n });\n if (notify) {\n notifyListeners(this, _change2);\n }\n if (notifySpy && \"development\" !== \"production\") {\n spyReportEnd();\n }\n return true;\n }\n return false;\n };\n _proto.has = function has(value) {\n this.atom_.reportObserved();\n return this.data_.has(this.dehanceValue_(value));\n };\n _proto.entries = function entries() {\n var nextIndex = 0;\n var keys = Array.from(this.keys());\n var values = Array.from(this.values());\n return makeIterableForSet({\n next: function next() {\n var index = nextIndex;\n nextIndex += 1;\n return index < values.length ? {\n value: [keys[index], values[index]],\n done: false\n } : {\n value: undefined,\n done: true\n };\n }\n });\n };\n _proto.keys = function keys() {\n return this.values();\n };\n _proto.values = function values() {\n this.atom_.reportObserved();\n var self = this;\n var nextIndex = 0;\n var observableValues = Array.from(this.data_.values());\n return makeIterableForSet({\n next: function next() {\n return nextIndex < observableValues.length ? {\n value: self.dehanceValue_(observableValues[nextIndex++]),\n done: false\n } : {\n value: undefined,\n done: true\n };\n }\n });\n };\n _proto.intersection = function intersection(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.intersection(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.intersection(otherSet);\n }\n };\n _proto.union = function union(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.union(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.union(otherSet);\n }\n };\n _proto.difference = function difference(otherSet) {\n return new Set(this).difference(otherSet);\n };\n _proto.symmetricDifference = function symmetricDifference(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.symmetricDifference(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.symmetricDifference(otherSet);\n }\n };\n _proto.isSubsetOf = function isSubsetOf(otherSet) {\n return new Set(this).isSubsetOf(otherSet);\n };\n _proto.isSupersetOf = function isSupersetOf(otherSet) {\n return new Set(this).isSupersetOf(otherSet);\n };\n _proto.isDisjointFrom = function isDisjointFrom(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.isDisjointFrom(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.isDisjointFrom(otherSet);\n }\n };\n _proto.replace = function replace(other) {\n var _this5 = this;\n if (isObservableSet(other)) {\n other = new Set(other);\n }\n transaction(function () {\n if (Array.isArray(other)) {\n _this5.clear();\n other.forEach(function (value) {\n return _this5.add(value);\n });\n } else if (isES6Set(other)) {\n _this5.clear();\n other.forEach(function (value) {\n return _this5.add(value);\n });\n } else if (other !== null && other !== undefined) {\n die(\"Cannot initialize set from \" + other);\n }\n });\n return this;\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n // ... 'fireImmediately' could also be true?\n if ( true && fireImmediately === true) {\n die(\"`observe` doesn't support fireImmediately=true in combination with sets.\");\n }\n return registerListener(this, listener);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.toJSON = function toJSON() {\n return Array.from(this);\n };\n _proto.toString = function toString() {\n return \"[object ObservableSet]\";\n };\n _proto[Symbol.iterator] = function () {\n return this.values();\n };\n return _createClass(ObservableSet, [{\n key: \"size\",\n get: function get() {\n this.atom_.reportObserved();\n return this.data_.size;\n }\n }, {\n key: Symbol.toStringTag,\n get: function get() {\n return \"Set\";\n }\n }]);\n}();\n// eslint-disable-next-line\nvar isObservableSet = /*#__PURE__*/createInstanceofPredicate(\"ObservableSet\", ObservableSet);\nfunction makeIterableForSet(iterator) {\n iterator[Symbol.toStringTag] = \"SetIterator\";\n return makeIterable(iterator);\n}\n\nvar descriptorCache = /*#__PURE__*/Object.create(null);\nvar REMOVE = \"remove\";\nvar ObservableObjectAdministration = /*#__PURE__*/function () {\n function ObservableObjectAdministration(target_, values_, name_,\n // Used anytime annotation is not explicitely provided\n defaultAnnotation_) {\n if (values_ === void 0) {\n values_ = new Map();\n }\n if (defaultAnnotation_ === void 0) {\n defaultAnnotation_ = autoAnnotation;\n }\n this.target_ = void 0;\n this.values_ = void 0;\n this.name_ = void 0;\n this.defaultAnnotation_ = void 0;\n this.keysAtom_ = void 0;\n this.changeListeners_ = void 0;\n this.interceptors_ = void 0;\n this.proxy_ = void 0;\n this.isPlainObject_ = void 0;\n this.appliedAnnotations_ = void 0;\n this.pendingKeys_ = void 0;\n this.target_ = target_;\n this.values_ = values_;\n this.name_ = name_;\n this.defaultAnnotation_ = defaultAnnotation_;\n this.keysAtom_ = new Atom( true ? this.name_ + \".keys\" : 0);\n // Optimization: we use this frequently\n this.isPlainObject_ = isPlainObject(this.target_);\n if ( true && !isAnnotation(this.defaultAnnotation_)) {\n die(\"defaultAnnotation must be valid annotation\");\n }\n if (true) {\n // Prepare structure for tracking which fields were already annotated\n this.appliedAnnotations_ = {};\n }\n }\n var _proto = ObservableObjectAdministration.prototype;\n _proto.getObservablePropValue_ = function getObservablePropValue_(key) {\n return this.values_.get(key).get();\n };\n _proto.setObservablePropValue_ = function setObservablePropValue_(key, newValue) {\n var observable = this.values_.get(key);\n if (observable instanceof ComputedValue) {\n observable.set(newValue);\n return true;\n }\n // intercept\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: UPDATE,\n object: this.proxy_ || this.target_,\n name: key,\n newValue: newValue\n });\n if (!change) {\n return null;\n }\n newValue = change.newValue;\n }\n newValue = observable.prepareNewValue_(newValue);\n // notify spy & observers\n if (newValue !== globalState.UNCHANGED) {\n var notify = hasListeners(this);\n var notifySpy = true && isSpyEnabled();\n var _change = notify || notifySpy ? {\n type: UPDATE,\n observableKind: \"object\",\n debugObjectName: this.name_,\n object: this.proxy_ || this.target_,\n oldValue: observable.value_,\n name: key,\n newValue: newValue\n } : null;\n if ( true && notifySpy) {\n spyReportStart(_change);\n }\n observable.setNewValue_(newValue);\n if (notify) {\n notifyListeners(this, _change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n return true;\n };\n _proto.get_ = function get_(key) {\n if (globalState.trackingDerivation && !hasProp(this.target_, key)) {\n // Key doesn't exist yet, subscribe for it in case it's added later\n this.has_(key);\n }\n return this.target_[key];\n }\n /**\n * @param {PropertyKey} key\n * @param {any} value\n * @param {Annotation|boolean} annotation true - use default annotation, false - copy as is\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.set_ = function set_(key, value, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n // Don't use .has(key) - we care about own\n if (hasProp(this.target_, key)) {\n // Existing prop\n if (this.values_.has(key)) {\n // Observable (can be intercepted)\n return this.setObservablePropValue_(key, value);\n } else if (proxyTrap) {\n // Non-observable - proxy\n return Reflect.set(this.target_, key, value);\n } else {\n // Non-observable\n this.target_[key] = value;\n return true;\n }\n } else {\n // New prop\n return this.extend_(key, {\n value: value,\n enumerable: true,\n writable: true,\n configurable: true\n }, this.defaultAnnotation_, proxyTrap);\n }\n }\n // Trap for \"in\"\n ;\n _proto.has_ = function has_(key) {\n if (!globalState.trackingDerivation) {\n // Skip key subscription outside derivation\n return key in this.target_;\n }\n this.pendingKeys_ || (this.pendingKeys_ = new Map());\n var entry = this.pendingKeys_.get(key);\n if (!entry) {\n entry = new ObservableValue(key in this.target_, referenceEnhancer, true ? this.name_ + \".\" + stringifyKey(key) + \"?\" : 0, false);\n this.pendingKeys_.set(key, entry);\n }\n return entry.get();\n }\n /**\n * @param {PropertyKey} key\n * @param {Annotation|boolean} annotation true - use default annotation, false - ignore prop\n */;\n _proto.make_ = function make_(key, annotation) {\n if (annotation === true) {\n annotation = this.defaultAnnotation_;\n }\n if (annotation === false) {\n return;\n }\n assertAnnotable(this, annotation, key);\n if (!(key in this.target_)) {\n var _this$target_$storedA;\n // Throw on missing key, except for decorators:\n // Decorator annotations are collected from whole prototype chain.\n // When called from super() some props may not exist yet.\n // However we don't have to worry about missing prop,\n // because the decorator must have been applied to something.\n if ((_this$target_$storedA = this.target_[storedAnnotationsSymbol]) != null && _this$target_$storedA[key]) {\n return; // will be annotated by subclass constructor\n } else {\n die(1, annotation.annotationType_, this.name_ + \".\" + key.toString());\n }\n }\n var source = this.target_;\n while (source && source !== objectPrototype) {\n var descriptor = getDescriptor(source, key);\n if (descriptor) {\n var outcome = annotation.make_(this, key, descriptor, source);\n if (outcome === 0 /* MakeResult.Cancel */) {\n return;\n }\n if (outcome === 1 /* MakeResult.Break */) {\n break;\n }\n }\n source = Object.getPrototypeOf(source);\n }\n recordAnnotationApplied(this, annotation, key);\n }\n /**\n * @param {PropertyKey} key\n * @param {PropertyDescriptor} descriptor\n * @param {Annotation|boolean} annotation true - use default annotation, false - copy as is\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.extend_ = function extend_(key, descriptor, annotation, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n if (annotation === true) {\n annotation = this.defaultAnnotation_;\n }\n if (annotation === false) {\n return this.defineProperty_(key, descriptor, proxyTrap);\n }\n assertAnnotable(this, annotation, key);\n var outcome = annotation.extend_(this, key, descriptor, proxyTrap);\n if (outcome) {\n recordAnnotationApplied(this, annotation, key);\n }\n return outcome;\n }\n /**\n * @param {PropertyKey} key\n * @param {PropertyDescriptor} descriptor\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.defineProperty_ = function defineProperty_(key, descriptor, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n try {\n startBatch();\n // Delete\n var deleteOutcome = this.delete_(key);\n if (!deleteOutcome) {\n // Failure or intercepted\n return deleteOutcome;\n }\n // ADD interceptor\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: ADD,\n newValue: descriptor.value\n });\n if (!change) {\n return null;\n }\n var newValue = change.newValue;\n if (descriptor.value !== newValue) {\n descriptor = _extends({}, descriptor, {\n value: newValue\n });\n }\n }\n // Define\n if (proxyTrap) {\n if (!Reflect.defineProperty(this.target_, key, descriptor)) {\n return false;\n }\n } else {\n defineProperty(this.target_, key, descriptor);\n }\n // Notify\n this.notifyPropertyAddition_(key, descriptor.value);\n } finally {\n endBatch();\n }\n return true;\n }\n // If original descriptor becomes relevant, move this to annotation directly\n ;\n _proto.defineObservableProperty_ = function defineObservableProperty_(key, value, enhancer, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n try {\n startBatch();\n // Delete\n var deleteOutcome = this.delete_(key);\n if (!deleteOutcome) {\n // Failure or intercepted\n return deleteOutcome;\n }\n // ADD interceptor\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: ADD,\n newValue: value\n });\n if (!change) {\n return null;\n }\n value = change.newValue;\n }\n var cachedDescriptor = getCachedObservablePropDescriptor(key);\n var descriptor = {\n configurable: globalState.safeDescriptors ? this.isPlainObject_ : true,\n enumerable: true,\n get: cachedDescriptor.get,\n set: cachedDescriptor.set\n };\n // Define\n if (proxyTrap) {\n if (!Reflect.defineProperty(this.target_, key, descriptor)) {\n return false;\n }\n } else {\n defineProperty(this.target_, key, descriptor);\n }\n var observable = new ObservableValue(value, enhancer, true ? this.name_ + \".\" + key.toString() : 0, false);\n this.values_.set(key, observable);\n // Notify (value possibly changed by ObservableValue)\n this.notifyPropertyAddition_(key, observable.value_);\n } finally {\n endBatch();\n }\n return true;\n }\n // If original descriptor becomes relevant, move this to annotation directly\n ;\n _proto.defineComputedProperty_ = function defineComputedProperty_(key, options, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n try {\n startBatch();\n // Delete\n var deleteOutcome = this.delete_(key);\n if (!deleteOutcome) {\n // Failure or intercepted\n return deleteOutcome;\n }\n // ADD interceptor\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: ADD,\n newValue: undefined\n });\n if (!change) {\n return null;\n }\n }\n options.name || (options.name = true ? this.name_ + \".\" + key.toString() : 0);\n options.context = this.proxy_ || this.target_;\n var cachedDescriptor = getCachedObservablePropDescriptor(key);\n var descriptor = {\n configurable: globalState.safeDescriptors ? this.isPlainObject_ : true,\n enumerable: false,\n get: cachedDescriptor.get,\n set: cachedDescriptor.set\n };\n // Define\n if (proxyTrap) {\n if (!Reflect.defineProperty(this.target_, key, descriptor)) {\n return false;\n }\n } else {\n defineProperty(this.target_, key, descriptor);\n }\n this.values_.set(key, new ComputedValue(options));\n // Notify\n this.notifyPropertyAddition_(key, undefined);\n } finally {\n endBatch();\n }\n return true;\n }\n /**\n * @param {PropertyKey} key\n * @param {PropertyDescriptor} descriptor\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.delete_ = function delete_(key, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n // No such prop\n if (!hasProp(this.target_, key)) {\n return true;\n }\n // Intercept\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: REMOVE\n });\n // Cancelled\n if (!change) {\n return null;\n }\n }\n // Delete\n try {\n var _this$pendingKeys_;\n startBatch();\n var notify = hasListeners(this);\n var notifySpy = true && isSpyEnabled();\n var observable = this.values_.get(key);\n // Value needed for spies/listeners\n var value = undefined;\n // Optimization: don't pull the value unless we will need it\n if (!observable && (notify || notifySpy)) {\n var _getDescriptor;\n value = (_getDescriptor = getDescriptor(this.target_, key)) == null ? void 0 : _getDescriptor.value;\n }\n // delete prop (do first, may fail)\n if (proxyTrap) {\n if (!Reflect.deleteProperty(this.target_, key)) {\n return false;\n }\n } else {\n delete this.target_[key];\n }\n // Allow re-annotating this field\n if (true) {\n delete this.appliedAnnotations_[key];\n }\n // Clear observable\n if (observable) {\n this.values_[\"delete\"](key);\n // for computed, value is undefined\n if (observable instanceof ObservableValue) {\n value = observable.value_;\n }\n // Notify: autorun(() => obj[key]), see #1796\n propagateChanged(observable);\n }\n // Notify \"keys/entries/values\" observers\n this.keysAtom_.reportChanged();\n // Notify \"has\" observers\n // \"in\" as it may still exist in proto\n (_this$pendingKeys_ = this.pendingKeys_) == null || (_this$pendingKeys_ = _this$pendingKeys_.get(key)) == null || _this$pendingKeys_.set(key in this.target_);\n // Notify spies/listeners\n if (notify || notifySpy) {\n var _change2 = {\n type: REMOVE,\n observableKind: \"object\",\n object: this.proxy_ || this.target_,\n debugObjectName: this.name_,\n oldValue: value,\n name: key\n };\n if ( true && notifySpy) {\n spyReportStart(_change2);\n }\n if (notify) {\n notifyListeners(this, _change2);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n } finally {\n endBatch();\n }\n return true;\n }\n /**\n * Observes this object. Triggers for the events 'add', 'update' and 'delete'.\n * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe\n * for callback details\n */;\n _proto.observe_ = function observe_(callback, fireImmediately) {\n if ( true && fireImmediately === true) {\n die(\"`observe` doesn't support the fire immediately property for observable objects.\");\n }\n return registerListener(this, callback);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.notifyPropertyAddition_ = function notifyPropertyAddition_(key, value) {\n var _this$pendingKeys_2;\n var notify = hasListeners(this);\n var notifySpy = true && isSpyEnabled();\n if (notify || notifySpy) {\n var change = notify || notifySpy ? {\n type: ADD,\n observableKind: \"object\",\n debugObjectName: this.name_,\n object: this.proxy_ || this.target_,\n name: key,\n newValue: value\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n }\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n (_this$pendingKeys_2 = this.pendingKeys_) == null || (_this$pendingKeys_2 = _this$pendingKeys_2.get(key)) == null || _this$pendingKeys_2.set(true);\n // Notify \"keys/entries/values\" observers\n this.keysAtom_.reportChanged();\n };\n _proto.ownKeys_ = function ownKeys_() {\n this.keysAtom_.reportObserved();\n return ownKeys(this.target_);\n };\n _proto.keys_ = function keys_() {\n // Returns enumerable && own, but unfortunately keysAtom will report on ANY key change.\n // There is no way to distinguish between Object.keys(object) and Reflect.ownKeys(object) - both are handled by ownKeys trap.\n // We can either over-report in Object.keys(object) or under-report in Reflect.ownKeys(object)\n // We choose to over-report in Object.keys(object), because:\n // - typically it's used with simple data objects\n // - when symbolic/non-enumerable keys are relevant Reflect.ownKeys works as expected\n this.keysAtom_.reportObserved();\n return Object.keys(this.target_);\n };\n return ObservableObjectAdministration;\n}();\nfunction asObservableObject(target, options) {\n var _options$name;\n if ( true && options && isObservableObject(target)) {\n die(\"Options can't be provided for already observable objects.\");\n }\n if (hasProp(target, $mobx)) {\n if ( true && !(getAdministration(target) instanceof ObservableObjectAdministration)) {\n die(\"Cannot convert '\" + getDebugName(target) + \"' into observable object:\" + \"\\nThe target is already observable of different type.\" + \"\\nExtending builtins is not supported.\");\n }\n return target;\n }\n if ( true && !Object.isExtensible(target)) {\n die(\"Cannot make the designated object observable; it is not extensible\");\n }\n var name = (_options$name = options == null ? void 0 : options.name) != null ? _options$name : true ? (isPlainObject(target) ? \"ObservableObject\" : target.constructor.name) + \"@\" + getNextId() : 0;\n var adm = new ObservableObjectAdministration(target, new Map(), String(name), getAnnotationFromOptions(options));\n addHiddenProp(target, $mobx, adm);\n return target;\n}\nvar isObservableObjectAdministration = /*#__PURE__*/createInstanceofPredicate(\"ObservableObjectAdministration\", ObservableObjectAdministration);\nfunction getCachedObservablePropDescriptor(key) {\n return descriptorCache[key] || (descriptorCache[key] = {\n get: function get() {\n return this[$mobx].getObservablePropValue_(key);\n },\n set: function set(value) {\n return this[$mobx].setObservablePropValue_(key, value);\n }\n });\n}\nfunction isObservableObject(thing) {\n if (isObject(thing)) {\n return isObservableObjectAdministration(thing[$mobx]);\n }\n return false;\n}\nfunction recordAnnotationApplied(adm, annotation, key) {\n var _adm$target_$storedAn;\n if (true) {\n adm.appliedAnnotations_[key] = annotation;\n }\n // Remove applied decorator annotation so we don't try to apply it again in subclass constructor\n (_adm$target_$storedAn = adm.target_[storedAnnotationsSymbol]) == null || delete _adm$target_$storedAn[key];\n}\nfunction assertAnnotable(adm, annotation, key) {\n // Valid annotation\n if ( true && !isAnnotation(annotation)) {\n die(\"Cannot annotate '\" + adm.name_ + \".\" + key.toString() + \"': Invalid annotation.\");\n }\n /*\n // Configurable, not sealed, not frozen\n // Possibly not needed, just a little better error then the one thrown by engine.\n // Cases where this would be useful the most (subclass field initializer) are not interceptable by this.\n if (__DEV__) {\n const configurable = getDescriptor(adm.target_, key)?.configurable\n const frozen = Object.isFrozen(adm.target_)\n const sealed = Object.isSealed(adm.target_)\n if (!configurable || frozen || sealed) {\n const fieldName = `${adm.name_}.${key.toString()}`\n const requestedAnnotationType = annotation.annotationType_\n let error = `Cannot apply '${requestedAnnotationType}' to '${fieldName}':`\n if (frozen) {\n error += `\\nObject is frozen.`\n }\n if (sealed) {\n error += `\\nObject is sealed.`\n }\n if (!configurable) {\n error += `\\nproperty is not configurable.`\n // Mention only if caused by us to avoid confusion\n if (hasProp(adm.appliedAnnotations!, key)) {\n error += `\\nTo prevent accidental re-definition of a field by a subclass, `\n error += `all annotated fields of non-plain objects (classes) are not configurable.`\n }\n }\n die(error)\n }\n }\n */\n // Not annotated\n if ( true && !isOverride(annotation) && hasProp(adm.appliedAnnotations_, key)) {\n var fieldName = adm.name_ + \".\" + key.toString();\n var currentAnnotationType = adm.appliedAnnotations_[key].annotationType_;\n var requestedAnnotationType = annotation.annotationType_;\n die(\"Cannot apply '\" + requestedAnnotationType + \"' to '\" + fieldName + \"':\" + (\"\\nThe field is already annotated with '\" + currentAnnotationType + \"'.\") + \"\\nRe-annotating fields is not allowed.\" + \"\\nUse 'override' annotation for methods overridden by subclass.\");\n }\n}\n\n// Bug in safari 9.* (or iOS 9 safari mobile). See #364\nvar ENTRY_0 = /*#__PURE__*/createArrayEntryDescriptor(0);\nvar safariPrototypeSetterInheritanceBug = /*#__PURE__*/function () {\n var v = false;\n var p = {};\n Object.defineProperty(p, \"0\", {\n set: function set() {\n v = true;\n }\n });\n /*#__PURE__*/Object.create(p)[\"0\"] = 1;\n return v === false;\n}();\n/**\n * This array buffer contains two lists of properties, so that all arrays\n * can recycle their property definitions, which significantly improves performance of creating\n * properties on the fly.\n */\nvar OBSERVABLE_ARRAY_BUFFER_SIZE = 0;\n// Typescript workaround to make sure ObservableArray extends Array\nvar StubArray = function StubArray() {};\nfunction inherit(ctor, proto) {\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(ctor.prototype, proto);\n } else if (ctor.prototype.__proto__ !== undefined) {\n ctor.prototype.__proto__ = proto;\n } else {\n ctor.prototype = proto;\n }\n}\ninherit(StubArray, Array.prototype);\n// Weex proto freeze protection was here,\n// but it is unclear why the hack is need as MobX never changed the prototype\n// anyway, so removed it in V6\nvar LegacyObservableArray = /*#__PURE__*/function (_StubArray) {\n function LegacyObservableArray(initialValues, enhancer, name, owned) {\n var _this;\n if (name === void 0) {\n name = true ? \"ObservableArray@\" + getNextId() : 0;\n }\n if (owned === void 0) {\n owned = false;\n }\n _this = _StubArray.call(this) || this;\n initObservable(function () {\n var adm = new ObservableArrayAdministration(name, enhancer, owned, true);\n adm.proxy_ = _this;\n addHiddenFinalProp(_this, $mobx, adm);\n if (initialValues && initialValues.length) {\n // @ts-ignore\n _this.spliceWithArray(0, 0, initialValues);\n }\n if (safariPrototypeSetterInheritanceBug) {\n // Seems that Safari won't use numeric prototype setter until any * numeric property is\n // defined on the instance. After that it works fine, even if this property is deleted.\n Object.defineProperty(_this, \"0\", ENTRY_0);\n }\n });\n return _this;\n }\n _inheritsLoose(LegacyObservableArray, _StubArray);\n var _proto = LegacyObservableArray.prototype;\n _proto.concat = function concat() {\n this[$mobx].atom_.reportObserved();\n for (var _len = arguments.length, arrays = new Array(_len), _key = 0; _key < _len; _key++) {\n arrays[_key] = arguments[_key];\n }\n return Array.prototype.concat.apply(this.slice(),\n //@ts-ignore\n arrays.map(function (a) {\n return isObservableArray(a) ? a.slice() : a;\n }));\n };\n _proto[Symbol.iterator] = function () {\n var self = this;\n var nextIndex = 0;\n return makeIterable({\n next: function next() {\n return nextIndex < self.length ? {\n value: self[nextIndex++],\n done: false\n } : {\n done: true,\n value: undefined\n };\n }\n });\n };\n return _createClass(LegacyObservableArray, [{\n key: \"length\",\n get: function get() {\n return this[$mobx].getArrayLength_();\n },\n set: function set(newLength) {\n this[$mobx].setArrayLength_(newLength);\n }\n }, {\n key: Symbol.toStringTag,\n get: function get() {\n return \"Array\";\n }\n }]);\n}(StubArray);\nObject.entries(arrayExtensions).forEach(function (_ref) {\n var prop = _ref[0],\n fn = _ref[1];\n if (prop !== \"concat\") {\n addHiddenProp(LegacyObservableArray.prototype, prop, fn);\n }\n});\nfunction createArrayEntryDescriptor(index) {\n return {\n enumerable: false,\n configurable: true,\n get: function get() {\n return this[$mobx].get_(index);\n },\n set: function set(value) {\n this[$mobx].set_(index, value);\n }\n };\n}\nfunction createArrayBufferItem(index) {\n defineProperty(LegacyObservableArray.prototype, \"\" + index, createArrayEntryDescriptor(index));\n}\nfunction reserveArrayBuffer(max) {\n if (max > OBSERVABLE_ARRAY_BUFFER_SIZE) {\n for (var index = OBSERVABLE_ARRAY_BUFFER_SIZE; index < max + 100; index++) {\n createArrayBufferItem(index);\n }\n OBSERVABLE_ARRAY_BUFFER_SIZE = max;\n }\n}\nreserveArrayBuffer(1000);\nfunction createLegacyArray(initialValues, enhancer, name) {\n return new LegacyObservableArray(initialValues, enhancer, name);\n}\n\nfunction getAtom(thing, property) {\n if (typeof thing === \"object\" && thing !== null) {\n if (isObservableArray(thing)) {\n if (property !== undefined) {\n die(23);\n }\n return thing[$mobx].atom_;\n }\n if (isObservableSet(thing)) {\n return thing.atom_;\n }\n if (isObservableMap(thing)) {\n if (property === undefined) {\n return thing.keysAtom_;\n }\n var observable = thing.data_.get(property) || thing.hasMap_.get(property);\n if (!observable) {\n die(25, property, getDebugName(thing));\n }\n return observable;\n }\n if (isObservableObject(thing)) {\n if (!property) {\n return die(26);\n }\n var _observable = thing[$mobx].values_.get(property);\n if (!_observable) {\n die(27, property, getDebugName(thing));\n }\n return _observable;\n }\n if (isAtom(thing) || isComputedValue(thing) || isReaction(thing)) {\n return thing;\n }\n } else if (isFunction(thing)) {\n if (isReaction(thing[$mobx])) {\n // disposer function\n return thing[$mobx];\n }\n }\n die(28);\n}\nfunction getAdministration(thing, property) {\n if (!thing) {\n die(29);\n }\n if (property !== undefined) {\n return getAdministration(getAtom(thing, property));\n }\n if (isAtom(thing) || isComputedValue(thing) || isReaction(thing)) {\n return thing;\n }\n if (isObservableMap(thing) || isObservableSet(thing)) {\n return thing;\n }\n if (thing[$mobx]) {\n return thing[$mobx];\n }\n die(24, thing);\n}\nfunction getDebugName(thing, property) {\n var named;\n if (property !== undefined) {\n named = getAtom(thing, property);\n } else if (isAction(thing)) {\n return thing.name;\n } else if (isObservableObject(thing) || isObservableMap(thing) || isObservableSet(thing)) {\n named = getAdministration(thing);\n } else {\n // valid for arrays as well\n named = getAtom(thing);\n }\n return named.name_;\n}\n/**\n * Helper function for initializing observable structures, it applies:\n * 1. allowStateChanges so we don't violate enforceActions.\n * 2. untracked so we don't accidentaly subscribe to anything observable accessed during init in case the observable is created inside derivation.\n * 3. batch to avoid state version updates\n */\nfunction initObservable(cb) {\n var derivation = untrackedStart();\n var allowStateChanges = allowStateChangesStart(true);\n startBatch();\n try {\n return cb();\n } finally {\n endBatch();\n allowStateChangesEnd(allowStateChanges);\n untrackedEnd(derivation);\n }\n}\n\nvar toString = objectPrototype.toString;\nfunction deepEqual(a, b, depth) {\n if (depth === void 0) {\n depth = -1;\n }\n return eq(a, b, depth);\n}\n// Copied from https://github.com/jashkenas/underscore/blob/5c237a7c682fb68fd5378203f0bf22dce1624854/underscore.js#L1186-L1289\n// Internal recursive comparison function for `isEqual`.\nfunction eq(a, b, depth, aStack, bStack) {\n // Identical objects are equal. `0 === -0`, but they aren't identical.\n // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).\n if (a === b) {\n return a !== 0 || 1 / a === 1 / b;\n }\n // `null` or `undefined` only equal to itself (strict comparison).\n if (a == null || b == null) {\n return false;\n }\n // `NaN`s are equivalent, but non-reflexive.\n if (a !== a) {\n return b !== b;\n }\n // Exhaust primitive checks\n var type = typeof a;\n if (type !== \"function\" && type !== \"object\" && typeof b != \"object\") {\n return false;\n }\n // Compare `[[Class]]` names.\n var className = toString.call(a);\n if (className !== toString.call(b)) {\n return false;\n }\n switch (className) {\n // Strings, numbers, regular expressions, dates, and booleans are compared by value.\n case \"[object RegExp]\":\n // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i')\n case \"[object String]\":\n // Primitives and their corresponding object wrappers are equivalent; thus, `\"5\"` is\n // equivalent to `new String(\"5\")`.\n return \"\" + a === \"\" + b;\n case \"[object Number]\":\n // `NaN`s are equivalent, but non-reflexive.\n // Object(NaN) is equivalent to NaN.\n if (+a !== +a) {\n return +b !== +b;\n }\n // An `egal` comparison is performed for other numeric values.\n return +a === 0 ? 1 / +a === 1 / b : +a === +b;\n case \"[object Date]\":\n case \"[object Boolean]\":\n // Coerce dates and booleans to numeric primitive values. Dates are compared by their\n // millisecond representations. Note that invalid dates with millisecond representations\n // of `NaN` are not equivalent.\n return +a === +b;\n case \"[object Symbol]\":\n return typeof Symbol !== \"undefined\" && Symbol.valueOf.call(a) === Symbol.valueOf.call(b);\n case \"[object Map]\":\n case \"[object Set]\":\n // Maps and Sets are unwrapped to arrays of entry-pairs, adding an incidental level.\n // Hide this extra level by increasing the depth.\n if (depth >= 0) {\n depth++;\n }\n break;\n }\n // Unwrap any wrapped objects.\n a = unwrap(a);\n b = unwrap(b);\n var areArrays = className === \"[object Array]\";\n if (!areArrays) {\n if (typeof a != \"object\" || typeof b != \"object\") {\n return false;\n }\n // Objects with different constructors are not equivalent, but `Object`s or `Array`s\n // from different frames are.\n var aCtor = a.constructor,\n bCtor = b.constructor;\n if (aCtor !== bCtor && !(isFunction(aCtor) && aCtor instanceof aCtor && isFunction(bCtor) && bCtor instanceof bCtor) && \"constructor\" in a && \"constructor\" in b) {\n return false;\n }\n }\n if (depth === 0) {\n return false;\n } else if (depth < 0) {\n depth = -1;\n }\n // Assume equality for cyclic structures. The algorithm for detecting cyclic\n // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.\n // Initializing stack of traversed objects.\n // It's done here since we only need them for objects and arrays comparison.\n aStack = aStack || [];\n bStack = bStack || [];\n var length = aStack.length;\n while (length--) {\n // Linear search. Performance is inversely proportional to the number of\n // unique nested structures.\n if (aStack[length] === a) {\n return bStack[length] === b;\n }\n }\n // Add the first object to the stack of traversed objects.\n aStack.push(a);\n bStack.push(b);\n // Recursively compare objects and arrays.\n if (areArrays) {\n // Compare array lengths to determine if a deep comparison is necessary.\n length = a.length;\n if (length !== b.length) {\n return false;\n }\n // Deep compare the contents, ignoring non-numeric properties.\n while (length--) {\n if (!eq(a[length], b[length], depth - 1, aStack, bStack)) {\n return false;\n }\n }\n } else {\n // Deep compare objects.\n var keys = Object.keys(a);\n var key;\n length = keys.length;\n // Ensure that both objects contain the same number of properties before comparing deep equality.\n if (Object.keys(b).length !== length) {\n return false;\n }\n while (length--) {\n // Deep compare each member\n key = keys[length];\n if (!(hasProp(b, key) && eq(a[key], b[key], depth - 1, aStack, bStack))) {\n return false;\n }\n }\n }\n // Remove the first object from the stack of traversed objects.\n aStack.pop();\n bStack.pop();\n return true;\n}\nfunction unwrap(a) {\n if (isObservableArray(a)) {\n return a.slice();\n }\n if (isES6Map(a) || isObservableMap(a)) {\n return Array.from(a.entries());\n }\n if (isES6Set(a) || isObservableSet(a)) {\n return Array.from(a.entries());\n }\n return a;\n}\n\nvar _getGlobal$Iterator;\n// safely get iterator prototype if available\nvar maybeIteratorPrototype = ((_getGlobal$Iterator = /*#__PURE__*/getGlobal().Iterator) == null ? void 0 : _getGlobal$Iterator.prototype) || {};\nfunction makeIterable(iterator) {\n iterator[Symbol.iterator] = getSelf;\n return Object.assign(Object.create(maybeIteratorPrototype), iterator);\n}\nfunction getSelf() {\n return this;\n}\n\nfunction isAnnotation(thing) {\n return (\n // Can be function\n thing instanceof Object && typeof thing.annotationType_ === \"string\" && isFunction(thing.make_) && isFunction(thing.extend_)\n );\n}\n\n/**\n * (c) Michel Weststrate 2015 - 2020\n * MIT Licensed\n *\n * Welcome to the mobx sources! To get a global overview of how MobX internally works,\n * this is a good place to start:\n * https://medium.com/@mweststrate/becoming-fully-reactive-an-in-depth-explanation-of-mobservable-55995262a254#.xvbh6qd74\n *\n * Source folders:\n * ===============\n *\n * - api/ Most of the public static methods exposed by the module can be found here.\n * - core/ Implementation of the MobX algorithm; atoms, derivations, reactions, dependency trees, optimizations. Cool stuff can be found here.\n * - types/ All the magic that is need to have observable objects, arrays and values is in this folder. Including the modifiers like `asFlat`.\n * - utils/ Utility stuff.\n *\n */\n[\"Symbol\", \"Map\", \"Set\"].forEach(function (m) {\n var g = getGlobal();\n if (typeof g[m] === \"undefined\") {\n die(\"MobX requires global '\" + m + \"' to be available or polyfilled\");\n }\n});\nif (typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__ === \"object\") {\n // See: https://github.com/andykog/mobx-devtools/\n __MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({\n spy: spy,\n extras: {\n getDebugName: getDebugName\n },\n $mobx: $mobx\n });\n}\n\n\n//# sourceMappingURL=mobx.esm.js.map\n\n\n//# sourceURL=webpack://app_adyen_SFRA/./node_modules/mobx/dist/mobx.esm.js?"); /***/ }) diff --git a/cartridges/app_adyen_SFRA/cartridge/static/default/js/amazonPayExpressPart1.js b/cartridges/app_adyen_SFRA/cartridge/static/default/js/amazonPayExpressPart1.js index e863fd144..f17fb4ee0 100644 --- a/cartridges/app_adyen_SFRA/cartridge/static/default/js/amazonPayExpressPart1.js +++ b/cartridges/app_adyen_SFRA/cartridge/static/default/js/amazonPayExpressPart1.js @@ -36,7 +36,7 @@ eval("\n\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \" \****************************************************************************/ /***/ ((module) => { -eval("\n\n// Adyen constants\n\nmodule.exports = {\n METHOD_ADYEN: 'Adyen',\n METHOD_ADYEN_POS: 'AdyenPOS',\n METHOD_ADYEN_COMPONENT: 'AdyenComponent',\n RECEIVED: 'Received',\n NOTENOUGHBALANCE: 'NotEnoughBalance',\n SUCCESS: 'Success',\n GIFTCARD: 'giftcard',\n SCHEME: 'scheme',\n GIROPAY: 'giropay',\n APPLE_PAY: 'applepay',\n PAYPAL: 'paypal',\n AMAZON_PAY: 'amazonpay',\n ACTIONTYPE: {\n QRCODE: 'qrCode'\n },\n DISABLED_SUBMIT_BUTTON_METHODS: ['paypal', 'paywithgoogle', 'googlepay', 'amazonpay', 'applepay', 'cashapp'],\n MULTIPLE_TX_VARIANTS_COMPONENTS: ['upi']\n};\n\n//# sourceURL=webpack://app_adyen_SFRA/./cartridges/app_adyen_SFRA/cartridge/client/default/js/constants.js?"); +eval("\n\n// Adyen constants\n\nmodule.exports = {\n METHOD_ADYEN: 'Adyen',\n METHOD_ADYEN_POS: 'AdyenPOS',\n METHOD_ADYEN_COMPONENT: 'AdyenComponent',\n RECEIVED: 'Received',\n NOTENOUGHBALANCE: 'NotEnoughBalance',\n SUCCESS: 'Success',\n GIFTCARD: 'giftcard',\n SCHEME: 'scheme',\n GIROPAY: 'giropay',\n APPLE_PAY: 'applepay',\n PAYPAL: 'paypal',\n AMAZON_PAY: 'amazonpay',\n ACTIONTYPE: {\n QRCODE: 'qrCode'\n },\n DISABLED_SUBMIT_BUTTON_METHODS: ['paypal', 'paywithgoogle', 'googlepay', 'amazonpay', 'applepay', 'cashapp', 'upi']\n};\n\n//# sourceURL=webpack://app_adyen_SFRA/./cartridges/app_adyen_SFRA/cartridge/client/default/js/constants.js?"); /***/ }), @@ -56,7 +56,7 @@ eval("\n\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \" \********************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ $mobx: () => (/* binding */ $mobx),\n/* harmony export */ FlowCancellationError: () => (/* binding */ FlowCancellationError),\n/* harmony export */ ObservableMap: () => (/* binding */ ObservableMap),\n/* harmony export */ ObservableSet: () => (/* binding */ ObservableSet),\n/* harmony export */ Reaction: () => (/* binding */ Reaction),\n/* harmony export */ _allowStateChanges: () => (/* binding */ allowStateChanges),\n/* harmony export */ _allowStateChangesInsideComputed: () => (/* binding */ runInAction),\n/* harmony export */ _allowStateReadsEnd: () => (/* binding */ allowStateReadsEnd),\n/* harmony export */ _allowStateReadsStart: () => (/* binding */ allowStateReadsStart),\n/* harmony export */ _autoAction: () => (/* binding */ autoAction),\n/* harmony export */ _endAction: () => (/* binding */ _endAction),\n/* harmony export */ _getAdministration: () => (/* binding */ getAdministration),\n/* harmony export */ _getGlobalState: () => (/* binding */ getGlobalState),\n/* harmony export */ _interceptReads: () => (/* binding */ interceptReads),\n/* harmony export */ _isComputingDerivation: () => (/* binding */ isComputingDerivation),\n/* harmony export */ _resetGlobalState: () => (/* binding */ resetGlobalState),\n/* harmony export */ _startAction: () => (/* binding */ _startAction),\n/* harmony export */ action: () => (/* binding */ action),\n/* harmony export */ autorun: () => (/* binding */ autorun),\n/* harmony export */ comparer: () => (/* binding */ comparer),\n/* harmony export */ computed: () => (/* binding */ computed),\n/* harmony export */ configure: () => (/* binding */ configure),\n/* harmony export */ createAtom: () => (/* binding */ createAtom),\n/* harmony export */ defineProperty: () => (/* binding */ apiDefineProperty),\n/* harmony export */ entries: () => (/* binding */ entries),\n/* harmony export */ extendObservable: () => (/* binding */ extendObservable),\n/* harmony export */ flow: () => (/* binding */ flow),\n/* harmony export */ flowResult: () => (/* binding */ flowResult),\n/* harmony export */ get: () => (/* binding */ get),\n/* harmony export */ getAtom: () => (/* binding */ getAtom),\n/* harmony export */ getDebugName: () => (/* binding */ getDebugName),\n/* harmony export */ getDependencyTree: () => (/* binding */ getDependencyTree),\n/* harmony export */ getObserverTree: () => (/* binding */ getObserverTree),\n/* harmony export */ has: () => (/* binding */ has),\n/* harmony export */ intercept: () => (/* binding */ intercept),\n/* harmony export */ isAction: () => (/* binding */ isAction),\n/* harmony export */ isBoxedObservable: () => (/* binding */ isObservableValue),\n/* harmony export */ isComputed: () => (/* binding */ isComputed),\n/* harmony export */ isComputedProp: () => (/* binding */ isComputedProp),\n/* harmony export */ isFlow: () => (/* binding */ isFlow),\n/* harmony export */ isFlowCancellationError: () => (/* binding */ isFlowCancellationError),\n/* harmony export */ isObservable: () => (/* binding */ isObservable),\n/* harmony export */ isObservableArray: () => (/* binding */ isObservableArray),\n/* harmony export */ isObservableMap: () => (/* binding */ isObservableMap),\n/* harmony export */ isObservableObject: () => (/* binding */ isObservableObject),\n/* harmony export */ isObservableProp: () => (/* binding */ isObservableProp),\n/* harmony export */ isObservableSet: () => (/* binding */ isObservableSet),\n/* harmony export */ keys: () => (/* binding */ keys),\n/* harmony export */ makeAutoObservable: () => (/* binding */ makeAutoObservable),\n/* harmony export */ makeObservable: () => (/* binding */ makeObservable),\n/* harmony export */ observable: () => (/* binding */ observable),\n/* harmony export */ observe: () => (/* binding */ observe),\n/* harmony export */ onBecomeObserved: () => (/* binding */ onBecomeObserved),\n/* harmony export */ onBecomeUnobserved: () => (/* binding */ onBecomeUnobserved),\n/* harmony export */ onReactionError: () => (/* binding */ onReactionError),\n/* harmony export */ override: () => (/* binding */ override),\n/* harmony export */ ownKeys: () => (/* binding */ apiOwnKeys),\n/* harmony export */ reaction: () => (/* binding */ reaction),\n/* harmony export */ remove: () => (/* binding */ remove),\n/* harmony export */ runInAction: () => (/* binding */ runInAction),\n/* harmony export */ set: () => (/* binding */ set),\n/* harmony export */ spy: () => (/* binding */ spy),\n/* harmony export */ toJS: () => (/* binding */ toJS),\n/* harmony export */ trace: () => (/* binding */ trace),\n/* harmony export */ transaction: () => (/* binding */ transaction),\n/* harmony export */ untracked: () => (/* binding */ untracked),\n/* harmony export */ values: () => (/* binding */ values),\n/* harmony export */ when: () => (/* binding */ when)\n/* harmony export */ });\nvar niceErrors = {\n 0: \"Invalid value for configuration 'enforceActions', expected 'never', 'always' or 'observed'\",\n 1: function _(annotationType, key) {\n return \"Cannot apply '\" + annotationType + \"' to '\" + key.toString() + \"': Field not found.\";\n },\n /*\n 2(prop) {\n return `invalid decorator for '${prop.toString()}'`\n },\n 3(prop) {\n return `Cannot decorate '${prop.toString()}': action can only be used on properties with a function value.`\n },\n 4(prop) {\n return `Cannot decorate '${prop.toString()}': computed can only be used on getter properties.`\n },\n */\n 5: \"'keys()' can only be used on observable objects, arrays, sets and maps\",\n 6: \"'values()' can only be used on observable objects, arrays, sets and maps\",\n 7: \"'entries()' can only be used on observable objects, arrays and maps\",\n 8: \"'set()' can only be used on observable objects, arrays and maps\",\n 9: \"'remove()' can only be used on observable objects, arrays and maps\",\n 10: \"'has()' can only be used on observable objects, arrays and maps\",\n 11: \"'get()' can only be used on observable objects, arrays and maps\",\n 12: \"Invalid annotation\",\n 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)\",\n 14: \"Intercept handlers should return nothing or a change object\",\n 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)\",\n 16: \"Modification exception: the internal structure of an observable array was changed.\",\n 17: function _(index, length) {\n return \"[mobx.array] Index out of bounds, \" + index + \" is larger than \" + length;\n },\n 18: \"mobx.map requires Map polyfill for the current browser. Check babel-polyfill or core-js/es6/map.js\",\n 19: function _(other) {\n return \"Cannot initialize from classes that inherit from Map: \" + other.constructor.name;\n },\n 20: function _(other) {\n return \"Cannot initialize map from \" + other;\n },\n 21: function _(dataStructure) {\n return \"Cannot convert to map from '\" + dataStructure + \"'\";\n },\n 22: \"mobx.set requires Set polyfill for the current browser. Check babel-polyfill or core-js/es6/set.js\",\n 23: \"It is not possible to get index atoms from arrays\",\n 24: function _(thing) {\n return \"Cannot obtain administration from \" + thing;\n },\n 25: function _(property, name) {\n return \"the entry '\" + property + \"' does not exist in the observable map '\" + name + \"'\";\n },\n 26: \"please specify a property\",\n 27: function _(property, name) {\n return \"no observable property '\" + property.toString() + \"' found on the observable object '\" + name + \"'\";\n },\n 28: function _(thing) {\n return \"Cannot obtain atom from \" + thing;\n },\n 29: \"Expecting some object\",\n 30: \"invalid action stack. did you forget to finish an action?\",\n 31: \"missing option for computed: get\",\n 32: function _(name, derivation) {\n return \"Cycle detected in computation \" + name + \": \" + derivation;\n },\n 33: function _(name) {\n return \"The setter of computed value '\" + name + \"' is trying to update itself. Did you intend to update an _observable_ value, instead of the computed property?\";\n },\n 34: function _(name) {\n return \"[ComputedValue '\" + name + \"'] It is not possible to assign a new value to a computed value.\";\n },\n 35: \"There are multiple, different versions of MobX active. Make sure MobX is loaded only once or use `configure({ isolateGlobalState: true })`\",\n 36: \"isolateGlobalState should be called before MobX is running any reactions\",\n 37: function _(method) {\n return \"[mobx] `observableArray.\" + method + \"()` mutates the array in-place, which is not allowed inside a derivation. Use `array.slice().\" + method + \"()` instead\";\n },\n 38: \"'ownKeys()' can only be used on observable objects\",\n 39: \"'defineProperty()' can only be used on observable objects\"\n};\nvar errors = true ? niceErrors : 0;\nfunction die(error) {\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n if (true) {\n var e = typeof error === \"string\" ? error : errors[error];\n if (typeof e === \"function\") e = e.apply(null, args);\n throw new Error(\"[MobX] \" + e);\n }\n throw new Error(typeof error === \"number\" ? \"[MobX] minified error nr: \" + error + (args.length ? \" \" + args.map(String).join(\",\") : \"\") + \". Find the full error at: https://github.com/mobxjs/mobx/blob/main/packages/mobx/src/errors.ts\" : \"[MobX] \" + error);\n}\n\nvar mockGlobal = {};\nfunction getGlobal() {\n if (typeof globalThis !== \"undefined\") {\n return globalThis;\n }\n if (typeof window !== \"undefined\") {\n return window;\n }\n if (typeof __webpack_require__.g !== \"undefined\") {\n return __webpack_require__.g;\n }\n if (typeof self !== \"undefined\") {\n return self;\n }\n return mockGlobal;\n}\n\n// We shorten anything used > 5 times\nvar assign = Object.assign;\nvar getDescriptor = Object.getOwnPropertyDescriptor;\nvar defineProperty = Object.defineProperty;\nvar objectPrototype = Object.prototype;\nvar EMPTY_ARRAY = [];\nObject.freeze(EMPTY_ARRAY);\nvar EMPTY_OBJECT = {};\nObject.freeze(EMPTY_OBJECT);\nvar hasProxy = typeof Proxy !== \"undefined\";\nvar plainObjectString = /*#__PURE__*/Object.toString();\nfunction assertProxies() {\n if (!hasProxy) {\n die( true ? \"`Proxy` objects are not available in the current environment. Please configure MobX to enable a fallback implementation.`\" : 0);\n }\n}\nfunction warnAboutProxyRequirement(msg) {\n if ( true && globalState.verifyProxies) {\n die(\"MobX is currently configured to be able to run in ES5 mode, but in ES5 MobX won't be able to \" + msg);\n }\n}\nfunction getNextId() {\n return ++globalState.mobxGuid;\n}\n/**\n * Makes sure that the provided function is invoked at most once.\n */\nfunction once(func) {\n var invoked = false;\n return function () {\n if (invoked) {\n return;\n }\n invoked = true;\n return func.apply(this, arguments);\n };\n}\nvar noop = function noop() {};\nfunction isFunction(fn) {\n return typeof fn === \"function\";\n}\nfunction isStringish(value) {\n var t = typeof value;\n switch (t) {\n case \"string\":\n case \"symbol\":\n case \"number\":\n return true;\n }\n return false;\n}\nfunction isObject(value) {\n return value !== null && typeof value === \"object\";\n}\nfunction isPlainObject(value) {\n if (!isObject(value)) {\n return false;\n }\n var proto = Object.getPrototypeOf(value);\n if (proto == null) {\n return true;\n }\n var protoConstructor = Object.hasOwnProperty.call(proto, \"constructor\") && proto.constructor;\n return typeof protoConstructor === \"function\" && protoConstructor.toString() === plainObjectString;\n}\n// https://stackoverflow.com/a/37865170\nfunction isGenerator(obj) {\n var constructor = obj == null ? void 0 : obj.constructor;\n if (!constructor) {\n return false;\n }\n if (\"GeneratorFunction\" === constructor.name || \"GeneratorFunction\" === constructor.displayName) {\n return true;\n }\n return false;\n}\nfunction addHiddenProp(object, propName, value) {\n defineProperty(object, propName, {\n enumerable: false,\n writable: true,\n configurable: true,\n value: value\n });\n}\nfunction addHiddenFinalProp(object, propName, value) {\n defineProperty(object, propName, {\n enumerable: false,\n writable: false,\n configurable: true,\n value: value\n });\n}\nfunction createInstanceofPredicate(name, theClass) {\n var propName = \"isMobX\" + name;\n theClass.prototype[propName] = true;\n return function (x) {\n return isObject(x) && x[propName] === true;\n };\n}\n/**\n * Yields true for both native and observable Map, even across different windows.\n */\nfunction isES6Map(thing) {\n return thing != null && Object.prototype.toString.call(thing) === \"[object Map]\";\n}\n/**\n * Makes sure a Map is an instance of non-inherited native or observable Map.\n */\nfunction isPlainES6Map(thing) {\n var mapProto = Object.getPrototypeOf(thing);\n var objectProto = Object.getPrototypeOf(mapProto);\n var nullProto = Object.getPrototypeOf(objectProto);\n return nullProto === null;\n}\n/**\n * Yields true for both native and observable Set, even across different windows.\n */\nfunction isES6Set(thing) {\n return thing != null && Object.prototype.toString.call(thing) === \"[object Set]\";\n}\nvar hasGetOwnPropertySymbols = typeof Object.getOwnPropertySymbols !== \"undefined\";\n/**\n * Returns the following: own enumerable keys and symbols.\n */\nfunction getPlainObjectKeys(object) {\n var keys = Object.keys(object);\n // Not supported in IE, so there are not going to be symbol props anyway...\n if (!hasGetOwnPropertySymbols) {\n return keys;\n }\n var symbols = Object.getOwnPropertySymbols(object);\n if (!symbols.length) {\n return keys;\n }\n return [].concat(keys, symbols.filter(function (s) {\n return objectPrototype.propertyIsEnumerable.call(object, s);\n }));\n}\n// From Immer utils\n// Returns all own keys, including non-enumerable and symbolic\nvar ownKeys = typeof Reflect !== \"undefined\" && Reflect.ownKeys ? Reflect.ownKeys : hasGetOwnPropertySymbols ? function (obj) {\n return Object.getOwnPropertyNames(obj).concat(Object.getOwnPropertySymbols(obj));\n} : /* istanbul ignore next */Object.getOwnPropertyNames;\nfunction stringifyKey(key) {\n if (typeof key === \"string\") {\n return key;\n }\n if (typeof key === \"symbol\") {\n return key.toString();\n }\n return new String(key).toString();\n}\nfunction toPrimitive(value) {\n return value === null ? null : typeof value === \"object\" ? \"\" + value : value;\n}\nfunction hasProp(target, prop) {\n return objectPrototype.hasOwnProperty.call(target, prop);\n}\n// From Immer utils\nvar getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors || function getOwnPropertyDescriptors(target) {\n // Polyfill needed for Hermes and IE, see https://github.com/facebook/hermes/issues/274\n var res = {};\n // Note: without polyfill for ownKeys, symbols won't be picked up\n ownKeys(target).forEach(function (key) {\n res[key] = getDescriptor(target, key);\n });\n return res;\n};\nfunction getFlag(flags, mask) {\n return !!(flags & mask);\n}\nfunction setFlag(flags, mask, newValue) {\n if (newValue) {\n flags |= mask;\n } else {\n flags &= ~mask;\n }\n return flags;\n}\n\nfunction _arrayLikeToArray(r, a) {\n (null == a || a > r.length) && (a = r.length);\n for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];\n return n;\n}\nfunction _defineProperties(e, r) {\n for (var t = 0; t < r.length; t++) {\n var o = r[t];\n o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);\n }\n}\nfunction _createClass(e, r, t) {\n return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", {\n writable: !1\n }), e;\n}\nfunction _createForOfIteratorHelperLoose(r, e) {\n var t = \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"];\n if (t) return (t = t.call(r)).next.bind(t);\n if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && \"number\" == typeof r.length) {\n t && (r = t);\n var o = 0;\n return function () {\n return o >= r.length ? {\n done: !0\n } : {\n done: !1,\n value: r[o++]\n };\n };\n }\n throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\nfunction _extends() {\n return _extends = Object.assign ? Object.assign.bind() : function (n) {\n for (var e = 1; e < arguments.length; e++) {\n var t = arguments[e];\n for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);\n }\n return n;\n }, _extends.apply(null, arguments);\n}\nfunction _inheritsLoose(t, o) {\n t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);\n}\nfunction _setPrototypeOf(t, e) {\n return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {\n return t.__proto__ = e, t;\n }, _setPrototypeOf(t, e);\n}\nfunction _toPrimitive(t, r) {\n if (\"object\" != typeof t || !t) return t;\n var e = t[Symbol.toPrimitive];\n if (void 0 !== e) {\n var i = e.call(t, r || \"default\");\n if (\"object\" != typeof i) return i;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (\"string\" === r ? String : Number)(t);\n}\nfunction _toPropertyKey(t) {\n var i = _toPrimitive(t, \"string\");\n return \"symbol\" == typeof i ? i : i + \"\";\n}\nfunction _unsupportedIterableToArray(r, a) {\n if (r) {\n if (\"string\" == typeof r) return _arrayLikeToArray(r, a);\n var t = {}.toString.call(r).slice(8, -1);\n return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;\n }\n}\n\nvar storedAnnotationsSymbol = /*#__PURE__*/Symbol(\"mobx-stored-annotations\");\n/**\n * Creates a function that acts as\n * - decorator\n * - annotation object\n */\nfunction createDecoratorAnnotation(annotation) {\n function decorator(target, property) {\n if (is20223Decorator(property)) {\n return annotation.decorate_20223_(target, property);\n } else {\n storeAnnotation(target, property, annotation);\n }\n }\n return Object.assign(decorator, annotation);\n}\n/**\n * Stores annotation to prototype,\n * so it can be inspected later by `makeObservable` called from constructor\n */\nfunction storeAnnotation(prototype, key, annotation) {\n if (!hasProp(prototype, storedAnnotationsSymbol)) {\n addHiddenProp(prototype, storedAnnotationsSymbol, _extends({}, prototype[storedAnnotationsSymbol]));\n }\n // @override must override something\n if ( true && isOverride(annotation) && !hasProp(prototype[storedAnnotationsSymbol], key)) {\n var fieldName = prototype.constructor.name + \".prototype.\" + key.toString();\n die(\"'\" + fieldName + \"' is decorated with 'override', \" + \"but no such decorated member was found on prototype.\");\n }\n // Cannot re-decorate\n assertNotDecorated(prototype, annotation, key);\n // Ignore override\n if (!isOverride(annotation)) {\n prototype[storedAnnotationsSymbol][key] = annotation;\n }\n}\nfunction assertNotDecorated(prototype, annotation, key) {\n if ( true && !isOverride(annotation) && hasProp(prototype[storedAnnotationsSymbol], key)) {\n var fieldName = prototype.constructor.name + \".prototype.\" + key.toString();\n var currentAnnotationType = prototype[storedAnnotationsSymbol][key].annotationType_;\n var requestedAnnotationType = annotation.annotationType_;\n die(\"Cannot apply '@\" + requestedAnnotationType + \"' to '\" + fieldName + \"':\" + (\"\\nThe field is already decorated with '@\" + currentAnnotationType + \"'.\") + \"\\nRe-decorating fields is not allowed.\" + \"\\nUse '@override' decorator for methods overridden by subclass.\");\n }\n}\n/**\n * Collects annotations from prototypes and stores them on target (instance)\n */\nfunction collectStoredAnnotations(target) {\n if (!hasProp(target, storedAnnotationsSymbol)) {\n // if (__DEV__ && !target[storedAnnotationsSymbol]) {\n // die(\n // `No annotations were passed to makeObservable, but no decorated members have been found either`\n // )\n // }\n // We need a copy as we will remove annotation from the list once it's applied.\n addHiddenProp(target, storedAnnotationsSymbol, _extends({}, target[storedAnnotationsSymbol]));\n }\n return target[storedAnnotationsSymbol];\n}\nfunction is20223Decorator(context) {\n return typeof context == \"object\" && typeof context[\"kind\"] == \"string\";\n}\nfunction assert20223DecoratorType(context, types) {\n if ( true && !types.includes(context.kind)) {\n die(\"The decorator applied to '\" + String(context.name) + \"' cannot be used on a \" + context.kind + \" element\");\n }\n}\n\nvar $mobx = /*#__PURE__*/Symbol(\"mobx administration\");\nvar Atom = /*#__PURE__*/function () {\n /**\n * Create a new atom. For debugging purposes it is recommended to give it a name.\n * The onBecomeObserved and onBecomeUnobserved callbacks can be used for resource management.\n */\n function Atom(name_) {\n if (name_ === void 0) {\n name_ = true ? \"Atom@\" + getNextId() : 0;\n }\n this.name_ = void 0;\n this.flags_ = 0;\n this.observers_ = new Set();\n this.lastAccessedBy_ = 0;\n this.lowestObserverState_ = IDerivationState_.NOT_TRACKING_;\n // onBecomeObservedListeners\n this.onBOL = void 0;\n // onBecomeUnobservedListeners\n this.onBUOL = void 0;\n this.name_ = name_;\n }\n // for effective unobserving. BaseAtom has true, for extra optimization, so its onBecomeUnobserved never gets called, because it's not needed\n var _proto = Atom.prototype;\n _proto.onBO = function onBO() {\n if (this.onBOL) {\n this.onBOL.forEach(function (listener) {\n return listener();\n });\n }\n };\n _proto.onBUO = function onBUO() {\n if (this.onBUOL) {\n this.onBUOL.forEach(function (listener) {\n return listener();\n });\n }\n }\n /**\n * Invoke this method to notify mobx that your atom has been used somehow.\n * Returns true if there is currently a reactive context.\n */;\n _proto.reportObserved = function reportObserved$1() {\n return reportObserved(this);\n }\n /**\n * Invoke this method _after_ this method has changed to signal mobx that all its observers should invalidate.\n */;\n _proto.reportChanged = function reportChanged() {\n startBatch();\n propagateChanged(this);\n endBatch();\n };\n _proto.toString = function toString() {\n return this.name_;\n };\n return _createClass(Atom, [{\n key: \"isBeingObserved\",\n get: function get() {\n return getFlag(this.flags_, Atom.isBeingObservedMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Atom.isBeingObservedMask_, newValue);\n }\n }, {\n key: \"isPendingUnobservation\",\n get: function get() {\n return getFlag(this.flags_, Atom.isPendingUnobservationMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Atom.isPendingUnobservationMask_, newValue);\n }\n }, {\n key: \"diffValue\",\n get: function get() {\n return getFlag(this.flags_, Atom.diffValueMask_) ? 1 : 0;\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Atom.diffValueMask_, newValue === 1 ? true : false);\n }\n }]);\n}();\nAtom.isBeingObservedMask_ = 1;\nAtom.isPendingUnobservationMask_ = 2;\nAtom.diffValueMask_ = 4;\nvar isAtom = /*#__PURE__*/createInstanceofPredicate(\"Atom\", Atom);\nfunction createAtom(name, onBecomeObservedHandler, onBecomeUnobservedHandler) {\n if (onBecomeObservedHandler === void 0) {\n onBecomeObservedHandler = noop;\n }\n if (onBecomeUnobservedHandler === void 0) {\n onBecomeUnobservedHandler = noop;\n }\n var atom = new Atom(name);\n // default `noop` listener will not initialize the hook Set\n if (onBecomeObservedHandler !== noop) {\n onBecomeObserved(atom, onBecomeObservedHandler);\n }\n if (onBecomeUnobservedHandler !== noop) {\n onBecomeUnobserved(atom, onBecomeUnobservedHandler);\n }\n return atom;\n}\n\nfunction identityComparer(a, b) {\n return a === b;\n}\nfunction structuralComparer(a, b) {\n return deepEqual(a, b);\n}\nfunction shallowComparer(a, b) {\n return deepEqual(a, b, 1);\n}\nfunction defaultComparer(a, b) {\n if (Object.is) {\n return Object.is(a, b);\n }\n return a === b ? a !== 0 || 1 / a === 1 / b : a !== a && b !== b;\n}\nvar comparer = {\n identity: identityComparer,\n structural: structuralComparer,\n \"default\": defaultComparer,\n shallow: shallowComparer\n};\n\nfunction deepEnhancer(v, _, name) {\n // it is an observable already, done\n if (isObservable(v)) {\n return v;\n }\n // something that can be converted and mutated?\n if (Array.isArray(v)) {\n return observable.array(v, {\n name: name\n });\n }\n if (isPlainObject(v)) {\n return observable.object(v, undefined, {\n name: name\n });\n }\n if (isES6Map(v)) {\n return observable.map(v, {\n name: name\n });\n }\n if (isES6Set(v)) {\n return observable.set(v, {\n name: name\n });\n }\n if (typeof v === \"function\" && !isAction(v) && !isFlow(v)) {\n if (isGenerator(v)) {\n return flow(v);\n } else {\n return autoAction(name, v);\n }\n }\n return v;\n}\nfunction shallowEnhancer(v, _, name) {\n if (v === undefined || v === null) {\n return v;\n }\n if (isObservableObject(v) || isObservableArray(v) || isObservableMap(v) || isObservableSet(v)) {\n return v;\n }\n if (Array.isArray(v)) {\n return observable.array(v, {\n name: name,\n deep: false\n });\n }\n if (isPlainObject(v)) {\n return observable.object(v, undefined, {\n name: name,\n deep: false\n });\n }\n if (isES6Map(v)) {\n return observable.map(v, {\n name: name,\n deep: false\n });\n }\n if (isES6Set(v)) {\n return observable.set(v, {\n name: name,\n deep: false\n });\n }\n if (true) {\n die(\"The shallow modifier / decorator can only used in combination with arrays, objects, maps and sets\");\n }\n}\nfunction referenceEnhancer(newValue) {\n // never turn into an observable\n return newValue;\n}\nfunction refStructEnhancer(v, oldValue) {\n if ( true && isObservable(v)) {\n die(\"observable.struct should not be used with observable values\");\n }\n if (deepEqual(v, oldValue)) {\n return oldValue;\n }\n return v;\n}\n\nvar OVERRIDE = \"override\";\nvar override = /*#__PURE__*/createDecoratorAnnotation({\n annotationType_: OVERRIDE,\n make_: make_,\n extend_: extend_,\n decorate_20223_: decorate_20223_\n});\nfunction isOverride(annotation) {\n return annotation.annotationType_ === OVERRIDE;\n}\nfunction make_(adm, key) {\n // Must not be plain object\n if ( true && adm.isPlainObject_) {\n die(\"Cannot apply '\" + this.annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + this.annotationType_ + \"' cannot be used on plain objects.\"));\n }\n // Must override something\n if ( true && !hasProp(adm.appliedAnnotations_, key)) {\n die(\"'\" + adm.name_ + \".\" + key.toString() + \"' is annotated with '\" + this.annotationType_ + \"', \" + \"but no such annotated member was found on prototype.\");\n }\n return 0 /* MakeResult.Cancel */;\n}\nfunction extend_(adm, key, descriptor, proxyTrap) {\n die(\"'\" + this.annotationType_ + \"' can only be used with 'makeObservable'\");\n}\nfunction decorate_20223_(desc, context) {\n console.warn(\"'\" + this.annotationType_ + \"' cannot be used with decorators - this is a no-op\");\n}\n\nfunction createActionAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$1,\n extend_: extend_$1,\n decorate_20223_: decorate_20223_$1\n };\n}\nfunction make_$1(adm, key, descriptor, source) {\n var _this$options_;\n // bound\n if ((_this$options_ = this.options_) != null && _this$options_.bound) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;\n }\n // own\n if (source === adm.target_) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 2 /* MakeResult.Continue */;\n }\n // prototype\n if (isAction(descriptor.value)) {\n // A prototype could have been annotated already by other constructor,\n // rest of the proto chain must be annotated already\n return 1 /* MakeResult.Break */;\n }\n var actionDescriptor = createActionDescriptor(adm, this, key, descriptor, false);\n defineProperty(source, key, actionDescriptor);\n return 2 /* MakeResult.Continue */;\n}\nfunction extend_$1(adm, key, descriptor, proxyTrap) {\n var actionDescriptor = createActionDescriptor(adm, this, key, descriptor);\n return adm.defineProperty_(key, actionDescriptor, proxyTrap);\n}\nfunction decorate_20223_$1(mthd, context) {\n if (true) {\n assert20223DecoratorType(context, [\"method\", \"field\"]);\n }\n var kind = context.kind,\n name = context.name,\n addInitializer = context.addInitializer;\n var ann = this;\n var _createAction = function _createAction(m) {\n var _ann$options_$name, _ann$options_, _ann$options_$autoAct, _ann$options_2;\n return createAction((_ann$options_$name = (_ann$options_ = ann.options_) == null ? void 0 : _ann$options_.name) != null ? _ann$options_$name : name.toString(), m, (_ann$options_$autoAct = (_ann$options_2 = ann.options_) == null ? void 0 : _ann$options_2.autoAction) != null ? _ann$options_$autoAct : false);\n };\n // Backwards/Legacy behavior, expects makeObservable(this)\n if (kind == \"field\") {\n addInitializer(function () {\n storeAnnotation(this, name, ann);\n });\n return;\n }\n if (kind == \"method\") {\n var _this$options_2;\n if (!isAction(mthd)) {\n mthd = _createAction(mthd);\n }\n if ((_this$options_2 = this.options_) != null && _this$options_2.bound) {\n addInitializer(function () {\n var self = this;\n var bound = self[name].bind(self);\n bound.isMobxAction = true;\n self[name] = bound;\n });\n }\n return mthd;\n }\n die(\"Cannot apply '\" + ann.annotationType_ + \"' to '\" + String(name) + \"' (kind: \" + kind + \"):\" + (\"\\n'\" + ann.annotationType_ + \"' can only be used on properties with a function value.\"));\n}\nfunction assertActionDescriptor(adm, _ref, key, _ref2) {\n var annotationType_ = _ref.annotationType_;\n var value = _ref2.value;\n if ( true && !isFunction(value)) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' can only be used on properties with a function value.\"));\n }\n}\nfunction createActionDescriptor(adm, annotation, key, descriptor,\n// provides ability to disable safeDescriptors for prototypes\nsafeDescriptors) {\n var _annotation$options_, _annotation$options_$, _annotation$options_2, _annotation$options_$2, _annotation$options_3, _annotation$options_4, _adm$proxy_2;\n if (safeDescriptors === void 0) {\n safeDescriptors = globalState.safeDescriptors;\n }\n assertActionDescriptor(adm, annotation, key, descriptor);\n var value = descriptor.value;\n if ((_annotation$options_ = annotation.options_) != null && _annotation$options_.bound) {\n var _adm$proxy_;\n value = value.bind((_adm$proxy_ = adm.proxy_) != null ? _adm$proxy_ : adm.target_);\n }\n return {\n value: createAction((_annotation$options_$ = (_annotation$options_2 = annotation.options_) == null ? void 0 : _annotation$options_2.name) != null ? _annotation$options_$ : key.toString(), value, (_annotation$options_$2 = (_annotation$options_3 = annotation.options_) == null ? void 0 : _annotation$options_3.autoAction) != null ? _annotation$options_$2 : false,\n // https://github.com/mobxjs/mobx/discussions/3140\n (_annotation$options_4 = annotation.options_) != null && _annotation$options_4.bound ? (_adm$proxy_2 = adm.proxy_) != null ? _adm$proxy_2 : adm.target_ : undefined),\n // Non-configurable for classes\n // prevents accidental field redefinition in subclass\n configurable: safeDescriptors ? adm.isPlainObject_ : true,\n // https://github.com/mobxjs/mobx/pull/2641#issuecomment-737292058\n enumerable: false,\n // Non-obsevable, therefore non-writable\n // Also prevents rewriting in subclass constructor\n writable: safeDescriptors ? false : true\n };\n}\n\nfunction createFlowAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$2,\n extend_: extend_$2,\n decorate_20223_: decorate_20223_$2\n };\n}\nfunction make_$2(adm, key, descriptor, source) {\n var _this$options_;\n // own\n if (source === adm.target_) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 2 /* MakeResult.Continue */;\n }\n // prototype\n // bound - must annotate protos to support super.flow()\n if ((_this$options_ = this.options_) != null && _this$options_.bound && (!hasProp(adm.target_, key) || !isFlow(adm.target_[key]))) {\n if (this.extend_(adm, key, descriptor, false) === null) {\n return 0 /* MakeResult.Cancel */;\n }\n }\n if (isFlow(descriptor.value)) {\n // A prototype could have been annotated already by other constructor,\n // rest of the proto chain must be annotated already\n return 1 /* MakeResult.Break */;\n }\n var flowDescriptor = createFlowDescriptor(adm, this, key, descriptor, false, false);\n defineProperty(source, key, flowDescriptor);\n return 2 /* MakeResult.Continue */;\n}\nfunction extend_$2(adm, key, descriptor, proxyTrap) {\n var _this$options_2;\n var flowDescriptor = createFlowDescriptor(adm, this, key, descriptor, (_this$options_2 = this.options_) == null ? void 0 : _this$options_2.bound);\n return adm.defineProperty_(key, flowDescriptor, proxyTrap);\n}\nfunction decorate_20223_$2(mthd, context) {\n var _this$options_3;\n if (true) {\n assert20223DecoratorType(context, [\"method\"]);\n }\n var name = context.name,\n addInitializer = context.addInitializer;\n if (!isFlow(mthd)) {\n mthd = flow(mthd);\n }\n if ((_this$options_3 = this.options_) != null && _this$options_3.bound) {\n addInitializer(function () {\n var self = this;\n var bound = self[name].bind(self);\n bound.isMobXFlow = true;\n self[name] = bound;\n });\n }\n return mthd;\n}\nfunction assertFlowDescriptor(adm, _ref, key, _ref2) {\n var annotationType_ = _ref.annotationType_;\n var value = _ref2.value;\n if ( true && !isFunction(value)) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' can only be used on properties with a generator function value.\"));\n }\n}\nfunction createFlowDescriptor(adm, annotation, key, descriptor, bound,\n// provides ability to disable safeDescriptors for prototypes\nsafeDescriptors) {\n if (safeDescriptors === void 0) {\n safeDescriptors = globalState.safeDescriptors;\n }\n assertFlowDescriptor(adm, annotation, key, descriptor);\n var value = descriptor.value;\n // In case of flow.bound, the descriptor can be from already annotated prototype\n if (!isFlow(value)) {\n value = flow(value);\n }\n if (bound) {\n var _adm$proxy_;\n // We do not keep original function around, so we bind the existing flow\n value = value.bind((_adm$proxy_ = adm.proxy_) != null ? _adm$proxy_ : adm.target_);\n // This is normally set by `flow`, but `bind` returns new function...\n value.isMobXFlow = true;\n }\n return {\n value: value,\n // Non-configurable for classes\n // prevents accidental field redefinition in subclass\n configurable: safeDescriptors ? adm.isPlainObject_ : true,\n // https://github.com/mobxjs/mobx/pull/2641#issuecomment-737292058\n enumerable: false,\n // Non-obsevable, therefore non-writable\n // Also prevents rewriting in subclass constructor\n writable: safeDescriptors ? false : true\n };\n}\n\nfunction createComputedAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$3,\n extend_: extend_$3,\n decorate_20223_: decorate_20223_$3\n };\n}\nfunction make_$3(adm, key, descriptor) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;\n}\nfunction extend_$3(adm, key, descriptor, proxyTrap) {\n assertComputedDescriptor(adm, this, key, descriptor);\n return adm.defineComputedProperty_(key, _extends({}, this.options_, {\n get: descriptor.get,\n set: descriptor.set\n }), proxyTrap);\n}\nfunction decorate_20223_$3(get, context) {\n if (true) {\n assert20223DecoratorType(context, [\"getter\"]);\n }\n var ann = this;\n var key = context.name,\n addInitializer = context.addInitializer;\n addInitializer(function () {\n var adm = asObservableObject(this)[$mobx];\n var options = _extends({}, ann.options_, {\n get: get,\n context: this\n });\n options.name || (options.name = true ? adm.name_ + \".\" + key.toString() : 0);\n adm.values_.set(key, new ComputedValue(options));\n });\n return function () {\n return this[$mobx].getObservablePropValue_(key);\n };\n}\nfunction assertComputedDescriptor(adm, _ref, key, _ref2) {\n var annotationType_ = _ref.annotationType_;\n var get = _ref2.get;\n if ( true && !get) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' can only be used on getter(+setter) properties.\"));\n }\n}\n\nfunction createObservableAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$4,\n extend_: extend_$4,\n decorate_20223_: decorate_20223_$4\n };\n}\nfunction make_$4(adm, key, descriptor) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;\n}\nfunction extend_$4(adm, key, descriptor, proxyTrap) {\n var _this$options_$enhanc, _this$options_;\n assertObservableDescriptor(adm, this, key, descriptor);\n return adm.defineObservableProperty_(key, descriptor.value, (_this$options_$enhanc = (_this$options_ = this.options_) == null ? void 0 : _this$options_.enhancer) != null ? _this$options_$enhanc : deepEnhancer, proxyTrap);\n}\nfunction decorate_20223_$4(desc, context) {\n if (true) {\n if (context.kind === \"field\") {\n throw die(\"Please use `@observable accessor \" + String(context.name) + \"` instead of `@observable \" + String(context.name) + \"`\");\n }\n assert20223DecoratorType(context, [\"accessor\"]);\n }\n var ann = this;\n var kind = context.kind,\n name = context.name;\n // The laziness here is not ideal... It's a workaround to how 2022.3 Decorators are implemented:\n // `addInitializer` callbacks are executed _before_ any accessors are defined (instead of the ideal-for-us right after each).\n // This means that, if we were to do our stuff in an `addInitializer`, we'd attempt to read a private slot\n // before it has been initialized. The runtime doesn't like that and throws a `Cannot read private member\n // from an object whose class did not declare it` error.\n // TODO: it seems that this will not be required anymore in the final version of the spec\n // See TODO: link\n var initializedObjects = new WeakSet();\n function initializeObservable(target, value) {\n var _ann$options_$enhance, _ann$options_;\n var adm = asObservableObject(target)[$mobx];\n var observable = new ObservableValue(value, (_ann$options_$enhance = (_ann$options_ = ann.options_) == null ? void 0 : _ann$options_.enhancer) != null ? _ann$options_$enhance : deepEnhancer, true ? adm.name_ + \".\" + name.toString() : 0, false);\n adm.values_.set(name, observable);\n initializedObjects.add(target);\n }\n if (kind == \"accessor\") {\n return {\n get: function get() {\n if (!initializedObjects.has(this)) {\n initializeObservable(this, desc.get.call(this));\n }\n return this[$mobx].getObservablePropValue_(name);\n },\n set: function set(value) {\n if (!initializedObjects.has(this)) {\n initializeObservable(this, value);\n }\n return this[$mobx].setObservablePropValue_(name, value);\n },\n init: function init(value) {\n if (!initializedObjects.has(this)) {\n initializeObservable(this, value);\n }\n return value;\n }\n };\n }\n return;\n}\nfunction assertObservableDescriptor(adm, _ref, key, descriptor) {\n var annotationType_ = _ref.annotationType_;\n if ( true && !(\"value\" in descriptor)) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' cannot be used on getter/setter properties\"));\n }\n}\n\nvar AUTO = \"true\";\nvar autoAnnotation = /*#__PURE__*/createAutoAnnotation();\nfunction createAutoAnnotation(options) {\n return {\n annotationType_: AUTO,\n options_: options,\n make_: make_$5,\n extend_: extend_$5,\n decorate_20223_: decorate_20223_$5\n };\n}\nfunction make_$5(adm, key, descriptor, source) {\n var _this$options_3, _this$options_4;\n // getter -> computed\n if (descriptor.get) {\n return computed.make_(adm, key, descriptor, source);\n }\n // lone setter -> action setter\n if (descriptor.set) {\n // TODO make action applicable to setter and delegate to action.make_\n var set = createAction(key.toString(), descriptor.set);\n // own\n if (source === adm.target_) {\n return adm.defineProperty_(key, {\n configurable: globalState.safeDescriptors ? adm.isPlainObject_ : true,\n set: set\n }) === null ? 0 /* MakeResult.Cancel */ : 2 /* MakeResult.Continue */;\n }\n // proto\n defineProperty(source, key, {\n configurable: true,\n set: set\n });\n return 2 /* MakeResult.Continue */;\n }\n // function on proto -> autoAction/flow\n if (source !== adm.target_ && typeof descriptor.value === \"function\") {\n var _this$options_2;\n if (isGenerator(descriptor.value)) {\n var _this$options_;\n var flowAnnotation = (_this$options_ = this.options_) != null && _this$options_.autoBind ? flow.bound : flow;\n return flowAnnotation.make_(adm, key, descriptor, source);\n }\n var actionAnnotation = (_this$options_2 = this.options_) != null && _this$options_2.autoBind ? autoAction.bound : autoAction;\n return actionAnnotation.make_(adm, key, descriptor, source);\n }\n // other -> observable\n // Copy props from proto as well, see test:\n // \"decorate should work with Object.create\"\n var observableAnnotation = ((_this$options_3 = this.options_) == null ? void 0 : _this$options_3.deep) === false ? observable.ref : observable;\n // if function respect autoBind option\n if (typeof descriptor.value === \"function\" && (_this$options_4 = this.options_) != null && _this$options_4.autoBind) {\n var _adm$proxy_;\n descriptor.value = descriptor.value.bind((_adm$proxy_ = adm.proxy_) != null ? _adm$proxy_ : adm.target_);\n }\n return observableAnnotation.make_(adm, key, descriptor, source);\n}\nfunction extend_$5(adm, key, descriptor, proxyTrap) {\n var _this$options_5, _this$options_6;\n // getter -> computed\n if (descriptor.get) {\n return computed.extend_(adm, key, descriptor, proxyTrap);\n }\n // lone setter -> action setter\n if (descriptor.set) {\n // TODO make action applicable to setter and delegate to action.extend_\n return adm.defineProperty_(key, {\n configurable: globalState.safeDescriptors ? adm.isPlainObject_ : true,\n set: createAction(key.toString(), descriptor.set)\n }, proxyTrap);\n }\n // other -> observable\n // if function respect autoBind option\n if (typeof descriptor.value === \"function\" && (_this$options_5 = this.options_) != null && _this$options_5.autoBind) {\n var _adm$proxy_2;\n descriptor.value = descriptor.value.bind((_adm$proxy_2 = adm.proxy_) != null ? _adm$proxy_2 : adm.target_);\n }\n var observableAnnotation = ((_this$options_6 = this.options_) == null ? void 0 : _this$options_6.deep) === false ? observable.ref : observable;\n return observableAnnotation.extend_(adm, key, descriptor, proxyTrap);\n}\nfunction decorate_20223_$5(desc, context) {\n die(\"'\" + this.annotationType_ + \"' cannot be used as a decorator\");\n}\n\nvar OBSERVABLE = \"observable\";\nvar OBSERVABLE_REF = \"observable.ref\";\nvar OBSERVABLE_SHALLOW = \"observable.shallow\";\nvar OBSERVABLE_STRUCT = \"observable.struct\";\n// Predefined bags of create observable options, to avoid allocating temporarily option objects\n// in the majority of cases\nvar defaultCreateObservableOptions = {\n deep: true,\n name: undefined,\n defaultDecorator: undefined,\n proxy: true\n};\nObject.freeze(defaultCreateObservableOptions);\nfunction asCreateObservableOptions(thing) {\n return thing || defaultCreateObservableOptions;\n}\nvar observableAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE);\nvar observableRefAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE_REF, {\n enhancer: referenceEnhancer\n});\nvar observableShallowAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE_SHALLOW, {\n enhancer: shallowEnhancer\n});\nvar observableStructAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE_STRUCT, {\n enhancer: refStructEnhancer\n});\nvar observableDecoratorAnnotation = /*#__PURE__*/createDecoratorAnnotation(observableAnnotation);\nfunction getEnhancerFromOptions(options) {\n return options.deep === true ? deepEnhancer : options.deep === false ? referenceEnhancer : getEnhancerFromAnnotation(options.defaultDecorator);\n}\nfunction getAnnotationFromOptions(options) {\n var _options$defaultDecor;\n return options ? (_options$defaultDecor = options.defaultDecorator) != null ? _options$defaultDecor : createAutoAnnotation(options) : undefined;\n}\nfunction getEnhancerFromAnnotation(annotation) {\n var _annotation$options_$, _annotation$options_;\n return !annotation ? deepEnhancer : (_annotation$options_$ = (_annotation$options_ = annotation.options_) == null ? void 0 : _annotation$options_.enhancer) != null ? _annotation$options_$ : deepEnhancer;\n}\n/**\n * Turns an object, array or function into a reactive structure.\n * @param v the value which should become observable.\n */\nfunction createObservable(v, arg2, arg3) {\n // @observable someProp; (2022.3 Decorators)\n if (is20223Decorator(arg2)) {\n return observableAnnotation.decorate_20223_(v, arg2);\n }\n // @observable someProp;\n if (isStringish(arg2)) {\n storeAnnotation(v, arg2, observableAnnotation);\n return;\n }\n // already observable - ignore\n if (isObservable(v)) {\n return v;\n }\n // plain object\n if (isPlainObject(v)) {\n return observable.object(v, arg2, arg3);\n }\n // Array\n if (Array.isArray(v)) {\n return observable.array(v, arg2);\n }\n // Map\n if (isES6Map(v)) {\n return observable.map(v, arg2);\n }\n // Set\n if (isES6Set(v)) {\n return observable.set(v, arg2);\n }\n // other object - ignore\n if (typeof v === \"object\" && v !== null) {\n return v;\n }\n // anything else\n return observable.box(v, arg2);\n}\nassign(createObservable, observableDecoratorAnnotation);\nvar observableFactories = {\n box: function box(value, options) {\n var o = asCreateObservableOptions(options);\n return new ObservableValue(value, getEnhancerFromOptions(o), o.name, true, o.equals);\n },\n array: function array(initialValues, options) {\n var o = asCreateObservableOptions(options);\n return (globalState.useProxies === false || o.proxy === false ? createLegacyArray : createObservableArray)(initialValues, getEnhancerFromOptions(o), o.name);\n },\n map: function map(initialValues, options) {\n var o = asCreateObservableOptions(options);\n return new ObservableMap(initialValues, getEnhancerFromOptions(o), o.name);\n },\n set: function set(initialValues, options) {\n var o = asCreateObservableOptions(options);\n return new ObservableSet(initialValues, getEnhancerFromOptions(o), o.name);\n },\n object: function object(props, decorators, options) {\n return initObservable(function () {\n return extendObservable(globalState.useProxies === false || (options == null ? void 0 : options.proxy) === false ? asObservableObject({}, options) : asDynamicObservableObject({}, options), props, decorators);\n });\n },\n ref: /*#__PURE__*/createDecoratorAnnotation(observableRefAnnotation),\n shallow: /*#__PURE__*/createDecoratorAnnotation(observableShallowAnnotation),\n deep: observableDecoratorAnnotation,\n struct: /*#__PURE__*/createDecoratorAnnotation(observableStructAnnotation)\n};\n// eslint-disable-next-line\nvar observable = /*#__PURE__*/assign(createObservable, observableFactories);\n\nvar COMPUTED = \"computed\";\nvar COMPUTED_STRUCT = \"computed.struct\";\nvar computedAnnotation = /*#__PURE__*/createComputedAnnotation(COMPUTED);\nvar computedStructAnnotation = /*#__PURE__*/createComputedAnnotation(COMPUTED_STRUCT, {\n equals: comparer.structural\n});\n/**\n * Decorator for class properties: @computed get value() { return expr; }.\n * For legacy purposes also invokable as ES5 observable created: `computed(() => expr)`;\n */\nvar computed = function computed(arg1, arg2) {\n if (is20223Decorator(arg2)) {\n // @computed (2022.3 Decorators)\n return computedAnnotation.decorate_20223_(arg1, arg2);\n }\n if (isStringish(arg2)) {\n // @computed\n return storeAnnotation(arg1, arg2, computedAnnotation);\n }\n if (isPlainObject(arg1)) {\n // @computed({ options })\n return createDecoratorAnnotation(createComputedAnnotation(COMPUTED, arg1));\n }\n // computed(expr, options?)\n if (true) {\n if (!isFunction(arg1)) {\n die(\"First argument to `computed` should be an expression.\");\n }\n if (isFunction(arg2)) {\n die(\"A setter as second argument is no longer supported, use `{ set: fn }` option instead\");\n }\n }\n var opts = isPlainObject(arg2) ? arg2 : {};\n opts.get = arg1;\n opts.name || (opts.name = arg1.name || \"\"); /* for generated name */\n return new ComputedValue(opts);\n};\nObject.assign(computed, computedAnnotation);\ncomputed.struct = /*#__PURE__*/createDecoratorAnnotation(computedStructAnnotation);\n\nvar _getDescriptor$config, _getDescriptor;\n// we don't use globalState for these in order to avoid possible issues with multiple\n// mobx versions\nvar currentActionId = 0;\nvar nextActionId = 1;\nvar isFunctionNameConfigurable = (_getDescriptor$config = (_getDescriptor = /*#__PURE__*/getDescriptor(function () {}, \"name\")) == null ? void 0 : _getDescriptor.configurable) != null ? _getDescriptor$config : false;\n// we can safely recycle this object\nvar tmpNameDescriptor = {\n value: \"action\",\n configurable: true,\n writable: false,\n enumerable: false\n};\nfunction createAction(actionName, fn, autoAction, ref) {\n if (autoAction === void 0) {\n autoAction = false;\n }\n if (true) {\n if (!isFunction(fn)) {\n die(\"`action` can only be invoked on functions\");\n }\n if (typeof actionName !== \"string\" || !actionName) {\n die(\"actions should have valid names, got: '\" + actionName + \"'\");\n }\n }\n function res() {\n return executeAction(actionName, autoAction, fn, ref || this, arguments);\n }\n res.isMobxAction = true;\n res.toString = function () {\n return fn.toString();\n };\n if (isFunctionNameConfigurable) {\n tmpNameDescriptor.value = actionName;\n defineProperty(res, \"name\", tmpNameDescriptor);\n }\n return res;\n}\nfunction executeAction(actionName, canRunAsDerivation, fn, scope, args) {\n var runInfo = _startAction(actionName, canRunAsDerivation, scope, args);\n try {\n return fn.apply(scope, args);\n } catch (err) {\n runInfo.error_ = err;\n throw err;\n } finally {\n _endAction(runInfo);\n }\n}\nfunction _startAction(actionName, canRunAsDerivation,\n// true for autoAction\nscope, args) {\n var notifySpy_ = true && isSpyEnabled() && !!actionName;\n var startTime_ = 0;\n if ( true && notifySpy_) {\n startTime_ = Date.now();\n var flattenedArgs = args ? Array.from(args) : EMPTY_ARRAY;\n spyReportStart({\n type: ACTION,\n name: actionName,\n object: scope,\n arguments: flattenedArgs\n });\n }\n var prevDerivation_ = globalState.trackingDerivation;\n var runAsAction = !canRunAsDerivation || !prevDerivation_;\n startBatch();\n var prevAllowStateChanges_ = globalState.allowStateChanges; // by default preserve previous allow\n if (runAsAction) {\n untrackedStart();\n prevAllowStateChanges_ = allowStateChangesStart(true);\n }\n var prevAllowStateReads_ = allowStateReadsStart(true);\n var runInfo = {\n runAsAction_: runAsAction,\n prevDerivation_: prevDerivation_,\n prevAllowStateChanges_: prevAllowStateChanges_,\n prevAllowStateReads_: prevAllowStateReads_,\n notifySpy_: notifySpy_,\n startTime_: startTime_,\n actionId_: nextActionId++,\n parentActionId_: currentActionId\n };\n currentActionId = runInfo.actionId_;\n return runInfo;\n}\nfunction _endAction(runInfo) {\n if (currentActionId !== runInfo.actionId_) {\n die(30);\n }\n currentActionId = runInfo.parentActionId_;\n if (runInfo.error_ !== undefined) {\n globalState.suppressReactionErrors = true;\n }\n allowStateChangesEnd(runInfo.prevAllowStateChanges_);\n allowStateReadsEnd(runInfo.prevAllowStateReads_);\n endBatch();\n if (runInfo.runAsAction_) {\n untrackedEnd(runInfo.prevDerivation_);\n }\n if ( true && runInfo.notifySpy_) {\n spyReportEnd({\n time: Date.now() - runInfo.startTime_\n });\n }\n globalState.suppressReactionErrors = false;\n}\nfunction allowStateChanges(allowStateChanges, func) {\n var prev = allowStateChangesStart(allowStateChanges);\n try {\n return func();\n } finally {\n allowStateChangesEnd(prev);\n }\n}\nfunction allowStateChangesStart(allowStateChanges) {\n var prev = globalState.allowStateChanges;\n globalState.allowStateChanges = allowStateChanges;\n return prev;\n}\nfunction allowStateChangesEnd(prev) {\n globalState.allowStateChanges = prev;\n}\n\nvar CREATE = \"create\";\nvar ObservableValue = /*#__PURE__*/function (_Atom) {\n function ObservableValue(value, enhancer, name_, notifySpy, equals) {\n var _this;\n if (name_ === void 0) {\n name_ = true ? \"ObservableValue@\" + getNextId() : 0;\n }\n if (notifySpy === void 0) {\n notifySpy = true;\n }\n if (equals === void 0) {\n equals = comparer[\"default\"];\n }\n _this = _Atom.call(this, name_) || this;\n _this.enhancer = void 0;\n _this.name_ = void 0;\n _this.equals = void 0;\n _this.hasUnreportedChange_ = false;\n _this.interceptors_ = void 0;\n _this.changeListeners_ = void 0;\n _this.value_ = void 0;\n _this.dehancer = void 0;\n _this.enhancer = enhancer;\n _this.name_ = name_;\n _this.equals = equals;\n _this.value_ = enhancer(value, undefined, name_);\n if ( true && notifySpy && isSpyEnabled()) {\n // only notify spy if this is a stand-alone observable\n spyReport({\n type: CREATE,\n object: _this,\n observableKind: \"value\",\n debugObjectName: _this.name_,\n newValue: \"\" + _this.value_\n });\n }\n return _this;\n }\n _inheritsLoose(ObservableValue, _Atom);\n var _proto = ObservableValue.prototype;\n _proto.dehanceValue = function dehanceValue(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.set = function set(newValue) {\n var oldValue = this.value_;\n newValue = this.prepareNewValue_(newValue);\n if (newValue !== globalState.UNCHANGED) {\n var notifySpy = isSpyEnabled();\n if ( true && notifySpy) {\n spyReportStart({\n type: UPDATE,\n object: this,\n observableKind: \"value\",\n debugObjectName: this.name_,\n newValue: newValue,\n oldValue: oldValue\n });\n }\n this.setNewValue_(newValue);\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n };\n _proto.prepareNewValue_ = function prepareNewValue_(newValue) {\n checkIfStateModificationsAreAllowed(this);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this,\n type: UPDATE,\n newValue: newValue\n });\n if (!change) {\n return globalState.UNCHANGED;\n }\n newValue = change.newValue;\n }\n // apply modifier\n newValue = this.enhancer(newValue, this.value_, this.name_);\n return this.equals(this.value_, newValue) ? globalState.UNCHANGED : newValue;\n };\n _proto.setNewValue_ = function setNewValue_(newValue) {\n var oldValue = this.value_;\n this.value_ = newValue;\n this.reportChanged();\n if (hasListeners(this)) {\n notifyListeners(this, {\n type: UPDATE,\n object: this,\n newValue: newValue,\n oldValue: oldValue\n });\n }\n };\n _proto.get = function get() {\n this.reportObserved();\n return this.dehanceValue(this.value_);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n if (fireImmediately) {\n listener({\n observableKind: \"value\",\n debugObjectName: this.name_,\n object: this,\n type: UPDATE,\n newValue: this.value_,\n oldValue: undefined\n });\n }\n return registerListener(this, listener);\n };\n _proto.raw = function raw() {\n // used by MST ot get undehanced value\n return this.value_;\n };\n _proto.toJSON = function toJSON() {\n return this.get();\n };\n _proto.toString = function toString() {\n return this.name_ + \"[\" + this.value_ + \"]\";\n };\n _proto.valueOf = function valueOf() {\n return toPrimitive(this.get());\n };\n _proto[Symbol.toPrimitive] = function () {\n return this.valueOf();\n };\n return ObservableValue;\n}(Atom);\nvar isObservableValue = /*#__PURE__*/createInstanceofPredicate(\"ObservableValue\", ObservableValue);\n\n/**\n * A node in the state dependency root that observes other nodes, and can be observed itself.\n *\n * ComputedValue will remember the result of the computation for the duration of the batch, or\n * while being observed.\n *\n * During this time it will recompute only when one of its direct dependencies changed,\n * but only when it is being accessed with `ComputedValue.get()`.\n *\n * Implementation description:\n * 1. First time it's being accessed it will compute and remember result\n * give back remembered result until 2. happens\n * 2. First time any deep dependency change, propagate POSSIBLY_STALE to all observers, wait for 3.\n * 3. When it's being accessed, recompute if any shallow dependency changed.\n * if result changed: propagate STALE to all observers, that were POSSIBLY_STALE from the last step.\n * go to step 2. either way\n *\n * If at any point it's outside batch and it isn't observed: reset everything and go to 1.\n */\nvar ComputedValue = /*#__PURE__*/function () {\n /**\n * Create a new computed value based on a function expression.\n *\n * The `name` property is for debug purposes only.\n *\n * The `equals` property specifies the comparer function to use to determine if a newly produced\n * value differs from the previous value. Two comparers are provided in the library; `defaultComparer`\n * compares based on identity comparison (===), and `structuralComparer` deeply compares the structure.\n * Structural comparison can be convenient if you always produce a new aggregated object and\n * don't want to notify observers if it is structurally the same.\n * This is useful for working with vectors, mouse coordinates etc.\n */\n function ComputedValue(options) {\n this.dependenciesState_ = IDerivationState_.NOT_TRACKING_;\n this.observing_ = [];\n // nodes we are looking at. Our value depends on these nodes\n this.newObserving_ = null;\n // during tracking it's an array with new observed observers\n this.observers_ = new Set();\n this.runId_ = 0;\n this.lastAccessedBy_ = 0;\n this.lowestObserverState_ = IDerivationState_.UP_TO_DATE_;\n this.unboundDepsCount_ = 0;\n this.value_ = new CaughtException(null);\n this.name_ = void 0;\n this.triggeredBy_ = void 0;\n this.flags_ = 0;\n this.derivation = void 0;\n // N.B: unminified as it is used by MST\n this.setter_ = void 0;\n this.isTracing_ = TraceMode.NONE;\n this.scope_ = void 0;\n this.equals_ = void 0;\n this.requiresReaction_ = void 0;\n this.keepAlive_ = void 0;\n this.onBOL = void 0;\n this.onBUOL = void 0;\n if (!options.get) {\n die(31);\n }\n this.derivation = options.get;\n this.name_ = options.name || ( true ? \"ComputedValue@\" + getNextId() : 0);\n if (options.set) {\n this.setter_ = createAction( true ? this.name_ + \"-setter\" : 0, options.set);\n }\n this.equals_ = options.equals || (options.compareStructural || options.struct ? comparer.structural : comparer[\"default\"]);\n this.scope_ = options.context;\n this.requiresReaction_ = options.requiresReaction;\n this.keepAlive_ = !!options.keepAlive;\n }\n var _proto = ComputedValue.prototype;\n _proto.onBecomeStale_ = function onBecomeStale_() {\n propagateMaybeChanged(this);\n };\n _proto.onBO = function onBO() {\n if (this.onBOL) {\n this.onBOL.forEach(function (listener) {\n return listener();\n });\n }\n };\n _proto.onBUO = function onBUO() {\n if (this.onBUOL) {\n this.onBUOL.forEach(function (listener) {\n return listener();\n });\n }\n }\n // to check for cycles\n ;\n /**\n * Returns the current value of this computed value.\n * Will evaluate its computation first if needed.\n */\n _proto.get = function get() {\n if (this.isComputing) {\n die(32, this.name_, this.derivation);\n }\n if (globalState.inBatch === 0 &&\n // !globalState.trackingDerivatpion &&\n this.observers_.size === 0 && !this.keepAlive_) {\n if (shouldCompute(this)) {\n this.warnAboutUntrackedRead_();\n startBatch(); // See perf test 'computed memoization'\n this.value_ = this.computeValue_(false);\n endBatch();\n }\n } else {\n reportObserved(this);\n if (shouldCompute(this)) {\n var prevTrackingContext = globalState.trackingContext;\n if (this.keepAlive_ && !prevTrackingContext) {\n globalState.trackingContext = this;\n }\n if (this.trackAndCompute()) {\n propagateChangeConfirmed(this);\n }\n globalState.trackingContext = prevTrackingContext;\n }\n }\n var result = this.value_;\n if (isCaughtException(result)) {\n throw result.cause;\n }\n return result;\n };\n _proto.set = function set(value) {\n if (this.setter_) {\n if (this.isRunningSetter) {\n die(33, this.name_);\n }\n this.isRunningSetter = true;\n try {\n this.setter_.call(this.scope_, value);\n } finally {\n this.isRunningSetter = false;\n }\n } else {\n die(34, this.name_);\n }\n };\n _proto.trackAndCompute = function trackAndCompute() {\n // N.B: unminified as it is used by MST\n var oldValue = this.value_;\n var wasSuspended = /* see #1208 */this.dependenciesState_ === IDerivationState_.NOT_TRACKING_;\n var newValue = this.computeValue_(true);\n var changed = wasSuspended || isCaughtException(oldValue) || isCaughtException(newValue) || !this.equals_(oldValue, newValue);\n if (changed) {\n this.value_ = newValue;\n if ( true && isSpyEnabled()) {\n spyReport({\n observableKind: \"computed\",\n debugObjectName: this.name_,\n object: this.scope_,\n type: \"update\",\n oldValue: oldValue,\n newValue: newValue\n });\n }\n }\n return changed;\n };\n _proto.computeValue_ = function computeValue_(track) {\n this.isComputing = true;\n // don't allow state changes during computation\n var prev = allowStateChangesStart(false);\n var res;\n if (track) {\n res = trackDerivedFunction(this, this.derivation, this.scope_);\n } else {\n if (globalState.disableErrorBoundaries === true) {\n res = this.derivation.call(this.scope_);\n } else {\n try {\n res = this.derivation.call(this.scope_);\n } catch (e) {\n res = new CaughtException(e);\n }\n }\n }\n allowStateChangesEnd(prev);\n this.isComputing = false;\n return res;\n };\n _proto.suspend_ = function suspend_() {\n if (!this.keepAlive_) {\n clearObserving(this);\n this.value_ = undefined; // don't hold on to computed value!\n if ( true && this.isTracing_ !== TraceMode.NONE) {\n console.log(\"[mobx.trace] Computed value '\" + this.name_ + \"' was suspended and it will recompute on the next access.\");\n }\n }\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n var _this = this;\n var firstTime = true;\n var prevValue = undefined;\n return autorun(function () {\n // TODO: why is this in a different place than the spyReport() function? in all other observables it's called in the same place\n var newValue = _this.get();\n if (!firstTime || fireImmediately) {\n var prevU = untrackedStart();\n listener({\n observableKind: \"computed\",\n debugObjectName: _this.name_,\n type: UPDATE,\n object: _this,\n newValue: newValue,\n oldValue: prevValue\n });\n untrackedEnd(prevU);\n }\n firstTime = false;\n prevValue = newValue;\n });\n };\n _proto.warnAboutUntrackedRead_ = function warnAboutUntrackedRead_() {\n if (false) {}\n if (this.isTracing_ !== TraceMode.NONE) {\n console.log(\"[mobx.trace] Computed value '\" + this.name_ + \"' is being read outside a reactive context. Doing a full recompute.\");\n }\n if (typeof this.requiresReaction_ === \"boolean\" ? this.requiresReaction_ : globalState.computedRequiresReaction) {\n console.warn(\"[mobx] Computed value '\" + this.name_ + \"' is being read outside a reactive context. Doing a full recompute.\");\n }\n };\n _proto.toString = function toString() {\n return this.name_ + \"[\" + this.derivation.toString() + \"]\";\n };\n _proto.valueOf = function valueOf() {\n return toPrimitive(this.get());\n };\n _proto[Symbol.toPrimitive] = function () {\n return this.valueOf();\n };\n return _createClass(ComputedValue, [{\n key: \"isComputing\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isComputingMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isComputingMask_, newValue);\n }\n }, {\n key: \"isRunningSetter\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isRunningSetterMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isRunningSetterMask_, newValue);\n }\n }, {\n key: \"isBeingObserved\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isBeingObservedMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isBeingObservedMask_, newValue);\n }\n }, {\n key: \"isPendingUnobservation\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isPendingUnobservationMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isPendingUnobservationMask_, newValue);\n }\n }, {\n key: \"diffValue\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.diffValueMask_) ? 1 : 0;\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.diffValueMask_, newValue === 1 ? true : false);\n }\n }]);\n}();\nComputedValue.isComputingMask_ = 1;\nComputedValue.isRunningSetterMask_ = 2;\nComputedValue.isBeingObservedMask_ = 4;\nComputedValue.isPendingUnobservationMask_ = 8;\nComputedValue.diffValueMask_ = 16;\nvar isComputedValue = /*#__PURE__*/createInstanceofPredicate(\"ComputedValue\", ComputedValue);\n\nvar IDerivationState_;\n(function (IDerivationState_) {\n // before being run or (outside batch and not being observed)\n // at this point derivation is not holding any data about dependency tree\n IDerivationState_[IDerivationState_[\"NOT_TRACKING_\"] = -1] = \"NOT_TRACKING_\";\n // no shallow dependency changed since last computation\n // won't recalculate derivation\n // this is what makes mobx fast\n IDerivationState_[IDerivationState_[\"UP_TO_DATE_\"] = 0] = \"UP_TO_DATE_\";\n // some deep dependency changed, but don't know if shallow dependency changed\n // will require to check first if UP_TO_DATE or POSSIBLY_STALE\n // currently only ComputedValue will propagate POSSIBLY_STALE\n //\n // having this state is second big optimization:\n // don't have to recompute on every dependency change, but only when it's needed\n IDerivationState_[IDerivationState_[\"POSSIBLY_STALE_\"] = 1] = \"POSSIBLY_STALE_\";\n // A shallow dependency has changed since last computation and the derivation\n // will need to recompute when it's needed next.\n IDerivationState_[IDerivationState_[\"STALE_\"] = 2] = \"STALE_\";\n})(IDerivationState_ || (IDerivationState_ = {}));\nvar TraceMode;\n(function (TraceMode) {\n TraceMode[TraceMode[\"NONE\"] = 0] = \"NONE\";\n TraceMode[TraceMode[\"LOG\"] = 1] = \"LOG\";\n TraceMode[TraceMode[\"BREAK\"] = 2] = \"BREAK\";\n})(TraceMode || (TraceMode = {}));\nvar CaughtException = function CaughtException(cause) {\n this.cause = void 0;\n this.cause = cause;\n // Empty\n};\nfunction isCaughtException(e) {\n return e instanceof CaughtException;\n}\n/**\n * Finds out whether any dependency of the derivation has actually changed.\n * If dependenciesState is 1 then it will recalculate dependencies,\n * if any dependency changed it will propagate it by changing dependenciesState to 2.\n *\n * By iterating over the dependencies in the same order that they were reported and\n * stopping on the first change, all the recalculations are only called for ComputedValues\n * that will be tracked by derivation. That is because we assume that if the first x\n * dependencies of the derivation doesn't change then the derivation should run the same way\n * up until accessing x-th dependency.\n */\nfunction shouldCompute(derivation) {\n switch (derivation.dependenciesState_) {\n case IDerivationState_.UP_TO_DATE_:\n return false;\n case IDerivationState_.NOT_TRACKING_:\n case IDerivationState_.STALE_:\n return true;\n case IDerivationState_.POSSIBLY_STALE_:\n {\n // state propagation can occur outside of action/reactive context #2195\n var prevAllowStateReads = allowStateReadsStart(true);\n var prevUntracked = untrackedStart(); // no need for those computeds to be reported, they will be picked up in trackDerivedFunction.\n var obs = derivation.observing_,\n l = obs.length;\n for (var i = 0; i < l; i++) {\n var obj = obs[i];\n if (isComputedValue(obj)) {\n if (globalState.disableErrorBoundaries) {\n obj.get();\n } else {\n try {\n obj.get();\n } catch (e) {\n // we are not interested in the value *or* exception at this moment, but if there is one, notify all\n untrackedEnd(prevUntracked);\n allowStateReadsEnd(prevAllowStateReads);\n return true;\n }\n }\n // if ComputedValue `obj` actually changed it will be computed and propagated to its observers.\n // and `derivation` is an observer of `obj`\n // invariantShouldCompute(derivation)\n if (derivation.dependenciesState_ === IDerivationState_.STALE_) {\n untrackedEnd(prevUntracked);\n allowStateReadsEnd(prevAllowStateReads);\n return true;\n }\n }\n }\n changeDependenciesStateTo0(derivation);\n untrackedEnd(prevUntracked);\n allowStateReadsEnd(prevAllowStateReads);\n return false;\n }\n }\n}\nfunction isComputingDerivation() {\n return globalState.trackingDerivation !== null; // filter out actions inside computations\n}\nfunction checkIfStateModificationsAreAllowed(atom) {\n if (false) {}\n var hasObservers = atom.observers_.size > 0;\n // Should not be possible to change observed state outside strict mode, except during initialization, see #563\n if (!globalState.allowStateChanges && (hasObservers || globalState.enforceActions === \"always\")) {\n console.warn(\"[MobX] \" + (globalState.enforceActions ? \"Since strict-mode is enabled, changing (observed) observable values without using an action is not allowed. Tried to modify: \" : \"Side effects like changing state are not allowed at this point. Are you trying to modify state from, for example, a computed value or the render function of a React component? You can wrap side effects in 'runInAction' (or decorate functions with 'action') if needed. Tried to modify: \") + atom.name_);\n }\n}\nfunction checkIfStateReadsAreAllowed(observable) {\n if ( true && !globalState.allowStateReads && globalState.observableRequiresReaction) {\n console.warn(\"[mobx] Observable '\" + observable.name_ + \"' being read outside a reactive context.\");\n }\n}\n/**\n * Executes the provided function `f` and tracks which observables are being accessed.\n * The tracking information is stored on the `derivation` object and the derivation is registered\n * as observer of any of the accessed observables.\n */\nfunction trackDerivedFunction(derivation, f, context) {\n var prevAllowStateReads = allowStateReadsStart(true);\n changeDependenciesStateTo0(derivation);\n // Preallocate array; will be trimmed by bindDependencies.\n derivation.newObserving_ = new Array(\n // Reserve constant space for initial dependencies, dynamic space otherwise.\n // See https://github.com/mobxjs/mobx/pull/3833\n derivation.runId_ === 0 ? 100 : derivation.observing_.length);\n derivation.unboundDepsCount_ = 0;\n derivation.runId_ = ++globalState.runId;\n var prevTracking = globalState.trackingDerivation;\n globalState.trackingDerivation = derivation;\n globalState.inBatch++;\n var result;\n if (globalState.disableErrorBoundaries === true) {\n result = f.call(context);\n } else {\n try {\n result = f.call(context);\n } catch (e) {\n result = new CaughtException(e);\n }\n }\n globalState.inBatch--;\n globalState.trackingDerivation = prevTracking;\n bindDependencies(derivation);\n warnAboutDerivationWithoutDependencies(derivation);\n allowStateReadsEnd(prevAllowStateReads);\n return result;\n}\nfunction warnAboutDerivationWithoutDependencies(derivation) {\n if (false) {}\n if (derivation.observing_.length !== 0) {\n return;\n }\n if (typeof derivation.requiresObservable_ === \"boolean\" ? derivation.requiresObservable_ : globalState.reactionRequiresObservable) {\n console.warn(\"[mobx] Derivation '\" + derivation.name_ + \"' is created/updated without reading any observable value.\");\n }\n}\n/**\n * diffs newObserving with observing.\n * update observing to be newObserving with unique observables\n * notify observers that become observed/unobserved\n */\nfunction bindDependencies(derivation) {\n // invariant(derivation.dependenciesState !== IDerivationState.NOT_TRACKING, \"INTERNAL ERROR bindDependencies expects derivation.dependenciesState !== -1\");\n var prevObserving = derivation.observing_;\n var observing = derivation.observing_ = derivation.newObserving_;\n var lowestNewObservingDerivationState = IDerivationState_.UP_TO_DATE_;\n // Go through all new observables and check diffValue: (this list can contain duplicates):\n // 0: first occurrence, change to 1 and keep it\n // 1: extra occurrence, drop it\n var i0 = 0,\n l = derivation.unboundDepsCount_;\n for (var i = 0; i < l; i++) {\n var dep = observing[i];\n if (dep.diffValue === 0) {\n dep.diffValue = 1;\n if (i0 !== i) {\n observing[i0] = dep;\n }\n i0++;\n }\n // Upcast is 'safe' here, because if dep is IObservable, `dependenciesState` will be undefined,\n // not hitting the condition\n if (dep.dependenciesState_ > lowestNewObservingDerivationState) {\n lowestNewObservingDerivationState = dep.dependenciesState_;\n }\n }\n observing.length = i0;\n derivation.newObserving_ = null; // newObserving shouldn't be needed outside tracking (statement moved down to work around FF bug, see #614)\n // Go through all old observables and check diffValue: (it is unique after last bindDependencies)\n // 0: it's not in new observables, unobserve it\n // 1: it keeps being observed, don't want to notify it. change to 0\n l = prevObserving.length;\n while (l--) {\n var _dep = prevObserving[l];\n if (_dep.diffValue === 0) {\n removeObserver(_dep, derivation);\n }\n _dep.diffValue = 0;\n }\n // Go through all new observables and check diffValue: (now it should be unique)\n // 0: it was set to 0 in last loop. don't need to do anything.\n // 1: it wasn't observed, let's observe it. set back to 0\n while (i0--) {\n var _dep2 = observing[i0];\n if (_dep2.diffValue === 1) {\n _dep2.diffValue = 0;\n addObserver(_dep2, derivation);\n }\n }\n // Some new observed derivations may become stale during this derivation computation\n // so they have had no chance to propagate staleness (#916)\n if (lowestNewObservingDerivationState !== IDerivationState_.UP_TO_DATE_) {\n derivation.dependenciesState_ = lowestNewObservingDerivationState;\n derivation.onBecomeStale_();\n }\n}\nfunction clearObserving(derivation) {\n // invariant(globalState.inBatch > 0, \"INTERNAL ERROR clearObserving should be called only inside batch\");\n var obs = derivation.observing_;\n derivation.observing_ = [];\n var i = obs.length;\n while (i--) {\n removeObserver(obs[i], derivation);\n }\n derivation.dependenciesState_ = IDerivationState_.NOT_TRACKING_;\n}\nfunction untracked(action) {\n var prev = untrackedStart();\n try {\n return action();\n } finally {\n untrackedEnd(prev);\n }\n}\nfunction untrackedStart() {\n var prev = globalState.trackingDerivation;\n globalState.trackingDerivation = null;\n return prev;\n}\nfunction untrackedEnd(prev) {\n globalState.trackingDerivation = prev;\n}\nfunction allowStateReadsStart(allowStateReads) {\n var prev = globalState.allowStateReads;\n globalState.allowStateReads = allowStateReads;\n return prev;\n}\nfunction allowStateReadsEnd(prev) {\n globalState.allowStateReads = prev;\n}\n/**\n * needed to keep `lowestObserverState` correct. when changing from (2 or 1) to 0\n *\n */\nfunction changeDependenciesStateTo0(derivation) {\n if (derivation.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {\n return;\n }\n derivation.dependenciesState_ = IDerivationState_.UP_TO_DATE_;\n var obs = derivation.observing_;\n var i = obs.length;\n while (i--) {\n obs[i].lowestObserverState_ = IDerivationState_.UP_TO_DATE_;\n }\n}\n\n/**\n * These values will persist if global state is reset\n */\nvar persistentKeys = [\"mobxGuid\", \"spyListeners\", \"enforceActions\", \"computedRequiresReaction\", \"reactionRequiresObservable\", \"observableRequiresReaction\", \"allowStateReads\", \"disableErrorBoundaries\", \"runId\", \"UNCHANGED\", \"useProxies\"];\nvar MobXGlobals = function MobXGlobals() {\n /**\n * MobXGlobals version.\n * MobX compatiblity with other versions loaded in memory as long as this version matches.\n * It indicates that the global state still stores similar information\n *\n * N.B: this version is unrelated to the package version of MobX, and is only the version of the\n * internal state storage of MobX, and can be the same across many different package versions\n */\n this.version = 6;\n /**\n * globally unique token to signal unchanged\n */\n this.UNCHANGED = {};\n /**\n * Currently running derivation\n */\n this.trackingDerivation = null;\n /**\n * Currently running reaction. This determines if we currently have a reactive context.\n * (Tracking derivation is also set for temporal tracking of computed values inside actions,\n * but trackingReaction can only be set by a form of Reaction)\n */\n this.trackingContext = null;\n /**\n * Each time a derivation is tracked, it is assigned a unique run-id\n */\n this.runId = 0;\n /**\n * 'guid' for general purpose. Will be persisted amongst resets.\n */\n this.mobxGuid = 0;\n /**\n * Are we in a batch block? (and how many of them)\n */\n this.inBatch = 0;\n /**\n * Observables that don't have observers anymore, and are about to be\n * suspended, unless somebody else accesses it in the same batch\n *\n * @type {IObservable[]}\n */\n this.pendingUnobservations = [];\n /**\n * List of scheduled, not yet executed, reactions.\n */\n this.pendingReactions = [];\n /**\n * Are we currently processing reactions?\n */\n this.isRunningReactions = false;\n /**\n * Is it allowed to change observables at this point?\n * In general, MobX doesn't allow that when running computations and React.render.\n * To ensure that those functions stay pure.\n */\n this.allowStateChanges = false;\n /**\n * Is it allowed to read observables at this point?\n * Used to hold the state needed for `observableRequiresReaction`\n */\n this.allowStateReads = true;\n /**\n * If strict mode is enabled, state changes are by default not allowed\n */\n this.enforceActions = true;\n /**\n * Spy callbacks\n */\n this.spyListeners = [];\n /**\n * Globally attached error handlers that react specifically to errors in reactions\n */\n this.globalReactionErrorHandlers = [];\n /**\n * Warn if computed values are accessed outside a reactive context\n */\n this.computedRequiresReaction = false;\n /**\n * (Experimental)\n * Warn if you try to create to derivation / reactive context without accessing any observable.\n */\n this.reactionRequiresObservable = false;\n /**\n * (Experimental)\n * Warn if observables are accessed outside a reactive context\n */\n this.observableRequiresReaction = false;\n /*\n * Don't catch and rethrow exceptions. This is useful for inspecting the state of\n * the stack when an exception occurs while debugging.\n */\n this.disableErrorBoundaries = false;\n /*\n * If true, we are already handling an exception in an action. Any errors in reactions should be suppressed, as\n * they are not the cause, see: https://github.com/mobxjs/mobx/issues/1836\n */\n this.suppressReactionErrors = false;\n this.useProxies = true;\n /*\n * print warnings about code that would fail if proxies weren't available\n */\n this.verifyProxies = false;\n /**\n * False forces all object's descriptors to\n * writable: true\n * configurable: true\n */\n this.safeDescriptors = true;\n};\nvar canMergeGlobalState = true;\nvar isolateCalled = false;\nvar globalState = /*#__PURE__*/function () {\n var global = /*#__PURE__*/getGlobal();\n if (global.__mobxInstanceCount > 0 && !global.__mobxGlobals) {\n canMergeGlobalState = false;\n }\n if (global.__mobxGlobals && global.__mobxGlobals.version !== new MobXGlobals().version) {\n canMergeGlobalState = false;\n }\n if (!canMergeGlobalState) {\n // Because this is a IIFE we need to let isolateCalled a chance to change\n // so we run it after the event loop completed at least 1 iteration\n setTimeout(function () {\n if (!isolateCalled) {\n die(35);\n }\n }, 1);\n return new MobXGlobals();\n } else if (global.__mobxGlobals) {\n global.__mobxInstanceCount += 1;\n if (!global.__mobxGlobals.UNCHANGED) {\n global.__mobxGlobals.UNCHANGED = {};\n } // make merge backward compatible\n return global.__mobxGlobals;\n } else {\n global.__mobxInstanceCount = 1;\n return global.__mobxGlobals = /*#__PURE__*/new MobXGlobals();\n }\n}();\nfunction isolateGlobalState() {\n if (globalState.pendingReactions.length || globalState.inBatch || globalState.isRunningReactions) {\n die(36);\n }\n isolateCalled = true;\n if (canMergeGlobalState) {\n var global = getGlobal();\n if (--global.__mobxInstanceCount === 0) {\n global.__mobxGlobals = undefined;\n }\n globalState = new MobXGlobals();\n }\n}\nfunction getGlobalState() {\n return globalState;\n}\n/**\n * For testing purposes only; this will break the internal state of existing observables,\n * but can be used to get back at a stable state after throwing errors\n */\nfunction resetGlobalState() {\n var defaultGlobals = new MobXGlobals();\n for (var key in defaultGlobals) {\n if (persistentKeys.indexOf(key) === -1) {\n globalState[key] = defaultGlobals[key];\n }\n }\n globalState.allowStateChanges = !globalState.enforceActions;\n}\n\nfunction hasObservers(observable) {\n return observable.observers_ && observable.observers_.size > 0;\n}\nfunction getObservers(observable) {\n return observable.observers_;\n}\n// function invariantObservers(observable: IObservable) {\n// const list = observable.observers\n// const map = observable.observersIndexes\n// const l = list.length\n// for (let i = 0; i < l; i++) {\n// const id = list[i].__mapid\n// if (i) {\n// invariant(map[id] === i, \"INTERNAL ERROR maps derivation.__mapid to index in list\") // for performance\n// } else {\n// invariant(!(id in map), \"INTERNAL ERROR observer on index 0 shouldn't be held in map.\") // for performance\n// }\n// }\n// invariant(\n// list.length === 0 || Object.keys(map).length === list.length - 1,\n// \"INTERNAL ERROR there is no junk in map\"\n// )\n// }\nfunction addObserver(observable, node) {\n // invariant(node.dependenciesState !== -1, \"INTERNAL ERROR, can add only dependenciesState !== -1\");\n // invariant(observable._observers.indexOf(node) === -1, \"INTERNAL ERROR add already added node\");\n // invariantObservers(observable);\n observable.observers_.add(node);\n if (observable.lowestObserverState_ > node.dependenciesState_) {\n observable.lowestObserverState_ = node.dependenciesState_;\n }\n // invariantObservers(observable);\n // invariant(observable._observers.indexOf(node) !== -1, \"INTERNAL ERROR didn't add node\");\n}\nfunction removeObserver(observable, node) {\n // invariant(globalState.inBatch > 0, \"INTERNAL ERROR, remove should be called only inside batch\");\n // invariant(observable._observers.indexOf(node) !== -1, \"INTERNAL ERROR remove already removed node\");\n // invariantObservers(observable);\n observable.observers_[\"delete\"](node);\n if (observable.observers_.size === 0) {\n // deleting last observer\n queueForUnobservation(observable);\n }\n // invariantObservers(observable);\n // invariant(observable._observers.indexOf(node) === -1, \"INTERNAL ERROR remove already removed node2\");\n}\nfunction queueForUnobservation(observable) {\n if (observable.isPendingUnobservation === false) {\n // invariant(observable._observers.length === 0, \"INTERNAL ERROR, should only queue for unobservation unobserved observables\");\n observable.isPendingUnobservation = true;\n globalState.pendingUnobservations.push(observable);\n }\n}\n/**\n * Batch starts a transaction, at least for purposes of memoizing ComputedValues when nothing else does.\n * During a batch `onBecomeUnobserved` will be called at most once per observable.\n * Avoids unnecessary recalculations.\n */\nfunction startBatch() {\n globalState.inBatch++;\n}\nfunction endBatch() {\n if (--globalState.inBatch === 0) {\n runReactions();\n // the batch is actually about to finish, all unobserving should happen here.\n var list = globalState.pendingUnobservations;\n for (var i = 0; i < list.length; i++) {\n var observable = list[i];\n observable.isPendingUnobservation = false;\n if (observable.observers_.size === 0) {\n if (observable.isBeingObserved) {\n // if this observable had reactive observers, trigger the hooks\n observable.isBeingObserved = false;\n observable.onBUO();\n }\n if (observable instanceof ComputedValue) {\n // computed values are automatically teared down when the last observer leaves\n // this process happens recursively, this computed might be the last observabe of another, etc..\n observable.suspend_();\n }\n }\n }\n globalState.pendingUnobservations = [];\n }\n}\nfunction reportObserved(observable) {\n checkIfStateReadsAreAllowed(observable);\n var derivation = globalState.trackingDerivation;\n if (derivation !== null) {\n /**\n * Simple optimization, give each derivation run an unique id (runId)\n * Check if last time this observable was accessed the same runId is used\n * if this is the case, the relation is already known\n */\n if (derivation.runId_ !== observable.lastAccessedBy_) {\n observable.lastAccessedBy_ = derivation.runId_;\n // Tried storing newObserving, or observing, or both as Set, but performance didn't come close...\n derivation.newObserving_[derivation.unboundDepsCount_++] = observable;\n if (!observable.isBeingObserved && globalState.trackingContext) {\n observable.isBeingObserved = true;\n observable.onBO();\n }\n }\n return observable.isBeingObserved;\n } else if (observable.observers_.size === 0 && globalState.inBatch > 0) {\n queueForUnobservation(observable);\n }\n return false;\n}\n// function invariantLOS(observable: IObservable, msg: string) {\n// // it's expensive so better not run it in produciton. but temporarily helpful for testing\n// const min = getObservers(observable).reduce((a, b) => Math.min(a, b.dependenciesState), 2)\n// if (min >= observable.lowestObserverState) return // <- the only assumption about `lowestObserverState`\n// throw new Error(\n// \"lowestObserverState is wrong for \" +\n// msg +\n// \" because \" +\n// min +\n// \" < \" +\n// observable.lowestObserverState\n// )\n// }\n/**\n * NOTE: current propagation mechanism will in case of self reruning autoruns behave unexpectedly\n * It will propagate changes to observers from previous run\n * It's hard or maybe impossible (with reasonable perf) to get it right with current approach\n * Hopefully self reruning autoruns aren't a feature people should depend on\n * Also most basic use cases should be ok\n */\n// Called by Atom when its value changes\nfunction propagateChanged(observable) {\n // invariantLOS(observable, \"changed start\");\n if (observable.lowestObserverState_ === IDerivationState_.STALE_) {\n return;\n }\n observable.lowestObserverState_ = IDerivationState_.STALE_;\n // Ideally we use for..of here, but the downcompiled version is really slow...\n observable.observers_.forEach(function (d) {\n if (d.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {\n if ( true && d.isTracing_ !== TraceMode.NONE) {\n logTraceInfo(d, observable);\n }\n d.onBecomeStale_();\n }\n d.dependenciesState_ = IDerivationState_.STALE_;\n });\n // invariantLOS(observable, \"changed end\");\n}\n// Called by ComputedValue when it recalculate and its value changed\nfunction propagateChangeConfirmed(observable) {\n // invariantLOS(observable, \"confirmed start\");\n if (observable.lowestObserverState_ === IDerivationState_.STALE_) {\n return;\n }\n observable.lowestObserverState_ = IDerivationState_.STALE_;\n observable.observers_.forEach(function (d) {\n if (d.dependenciesState_ === IDerivationState_.POSSIBLY_STALE_) {\n d.dependenciesState_ = IDerivationState_.STALE_;\n if ( true && d.isTracing_ !== TraceMode.NONE) {\n logTraceInfo(d, observable);\n }\n } else if (d.dependenciesState_ === IDerivationState_.UP_TO_DATE_ // this happens during computing of `d`, just keep lowestObserverState up to date.\n ) {\n observable.lowestObserverState_ = IDerivationState_.UP_TO_DATE_;\n }\n });\n // invariantLOS(observable, \"confirmed end\");\n}\n// Used by computed when its dependency changed, but we don't wan't to immediately recompute.\nfunction propagateMaybeChanged(observable) {\n // invariantLOS(observable, \"maybe start\");\n if (observable.lowestObserverState_ !== IDerivationState_.UP_TO_DATE_) {\n return;\n }\n observable.lowestObserverState_ = IDerivationState_.POSSIBLY_STALE_;\n observable.observers_.forEach(function (d) {\n if (d.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {\n d.dependenciesState_ = IDerivationState_.POSSIBLY_STALE_;\n d.onBecomeStale_();\n }\n });\n // invariantLOS(observable, \"maybe end\");\n}\nfunction logTraceInfo(derivation, observable) {\n console.log(\"[mobx.trace] '\" + derivation.name_ + \"' is invalidated due to a change in: '\" + observable.name_ + \"'\");\n if (derivation.isTracing_ === TraceMode.BREAK) {\n var lines = [];\n printDepTree(getDependencyTree(derivation), lines, 1);\n // prettier-ignore\n new Function(\"debugger;\\n/*\\nTracing '\" + derivation.name_ + \"'\\n\\nYou are entering this break point because derivation '\" + derivation.name_ + \"' is being traced and '\" + observable.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\" + (derivation instanceof ComputedValue ? derivation.derivation.toString().replace(/[*]\\//g, \"/\") : \"\") + \"\\n\\nThe dependencies for this derivation are:\\n\\n\" + lines.join(\"\\n\") + \"\\n*/\\n \")();\n }\n}\nfunction printDepTree(tree, lines, depth) {\n if (lines.length >= 1000) {\n lines.push(\"(and many more)\");\n return;\n }\n lines.push(\"\" + \"\\t\".repeat(depth - 1) + tree.name);\n if (tree.dependencies) {\n tree.dependencies.forEach(function (child) {\n return printDepTree(child, lines, depth + 1);\n });\n }\n}\n\nvar Reaction = /*#__PURE__*/function () {\n function Reaction(name_, onInvalidate_, errorHandler_, requiresObservable_) {\n if (name_ === void 0) {\n name_ = true ? \"Reaction@\" + getNextId() : 0;\n }\n this.name_ = void 0;\n this.onInvalidate_ = void 0;\n this.errorHandler_ = void 0;\n this.requiresObservable_ = void 0;\n this.observing_ = [];\n // nodes we are looking at. Our value depends on these nodes\n this.newObserving_ = [];\n this.dependenciesState_ = IDerivationState_.NOT_TRACKING_;\n this.runId_ = 0;\n this.unboundDepsCount_ = 0;\n this.flags_ = 0;\n this.isTracing_ = TraceMode.NONE;\n this.name_ = name_;\n this.onInvalidate_ = onInvalidate_;\n this.errorHandler_ = errorHandler_;\n this.requiresObservable_ = requiresObservable_;\n }\n var _proto = Reaction.prototype;\n _proto.onBecomeStale_ = function onBecomeStale_() {\n this.schedule_();\n };\n _proto.schedule_ = function schedule_() {\n if (!this.isScheduled) {\n this.isScheduled = true;\n globalState.pendingReactions.push(this);\n runReactions();\n }\n }\n /**\n * internal, use schedule() if you intend to kick off a reaction\n */;\n _proto.runReaction_ = function runReaction_() {\n if (!this.isDisposed) {\n startBatch();\n this.isScheduled = false;\n var prev = globalState.trackingContext;\n globalState.trackingContext = this;\n if (shouldCompute(this)) {\n this.isTrackPending = true;\n try {\n this.onInvalidate_();\n if ( true && this.isTrackPending && isSpyEnabled()) {\n // onInvalidate didn't trigger track right away..\n spyReport({\n name: this.name_,\n type: \"scheduled-reaction\"\n });\n }\n } catch (e) {\n this.reportExceptionInDerivation_(e);\n }\n }\n globalState.trackingContext = prev;\n endBatch();\n }\n };\n _proto.track = function track(fn) {\n if (this.isDisposed) {\n return;\n // console.warn(\"Reaction already disposed\") // Note: Not a warning / error in mobx 4 either\n }\n startBatch();\n var notify = isSpyEnabled();\n var startTime;\n if ( true && notify) {\n startTime = Date.now();\n spyReportStart({\n name: this.name_,\n type: \"reaction\"\n });\n }\n this.isRunning = true;\n var prevReaction = globalState.trackingContext; // reactions could create reactions...\n globalState.trackingContext = this;\n var result = trackDerivedFunction(this, fn, undefined);\n globalState.trackingContext = prevReaction;\n this.isRunning = false;\n this.isTrackPending = false;\n if (this.isDisposed) {\n // disposed during last run. Clean up everything that was bound after the dispose call.\n clearObserving(this);\n }\n if (isCaughtException(result)) {\n this.reportExceptionInDerivation_(result.cause);\n }\n if ( true && notify) {\n spyReportEnd({\n time: Date.now() - startTime\n });\n }\n endBatch();\n };\n _proto.reportExceptionInDerivation_ = function reportExceptionInDerivation_(error) {\n var _this = this;\n if (this.errorHandler_) {\n this.errorHandler_(error, this);\n return;\n }\n if (globalState.disableErrorBoundaries) {\n throw error;\n }\n var message = true ? \"[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '\" + this + \"'\" : 0;\n if (!globalState.suppressReactionErrors) {\n console.error(message, error);\n /** If debugging brought you here, please, read the above message :-). Tnx! */\n } else if (true) {\n console.warn(\"[mobx] (error in reaction '\" + this.name_ + \"' suppressed, fix error of causing action below)\");\n } // prettier-ignore\n if ( true && isSpyEnabled()) {\n spyReport({\n type: \"error\",\n name: this.name_,\n message: message,\n error: \"\" + error\n });\n }\n globalState.globalReactionErrorHandlers.forEach(function (f) {\n return f(error, _this);\n });\n };\n _proto.dispose = function dispose() {\n if (!this.isDisposed) {\n this.isDisposed = true;\n if (!this.isRunning) {\n // if disposed while running, clean up later. Maybe not optimal, but rare case\n startBatch();\n clearObserving(this);\n endBatch();\n }\n }\n };\n _proto.getDisposer_ = function getDisposer_(abortSignal) {\n var _this2 = this;\n var dispose = function dispose() {\n _this2.dispose();\n abortSignal == null || abortSignal.removeEventListener == null || abortSignal.removeEventListener(\"abort\", dispose);\n };\n abortSignal == null || abortSignal.addEventListener == null || abortSignal.addEventListener(\"abort\", dispose);\n dispose[$mobx] = this;\n return dispose;\n };\n _proto.toString = function toString() {\n return \"Reaction[\" + this.name_ + \"]\";\n };\n _proto.trace = function trace$1(enterBreakPoint) {\n if (enterBreakPoint === void 0) {\n enterBreakPoint = false;\n }\n trace(this, enterBreakPoint);\n };\n return _createClass(Reaction, [{\n key: \"isDisposed\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isDisposedMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isDisposedMask_, newValue);\n }\n }, {\n key: \"isScheduled\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isScheduledMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isScheduledMask_, newValue);\n }\n }, {\n key: \"isTrackPending\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isTrackPendingMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isTrackPendingMask_, newValue);\n }\n }, {\n key: \"isRunning\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isRunningMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isRunningMask_, newValue);\n }\n }, {\n key: \"diffValue\",\n get: function get() {\n return getFlag(this.flags_, Reaction.diffValueMask_) ? 1 : 0;\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.diffValueMask_, newValue === 1 ? true : false);\n }\n }]);\n}();\nReaction.isDisposedMask_ = 1;\nReaction.isScheduledMask_ = 2;\nReaction.isTrackPendingMask_ = 4;\nReaction.isRunningMask_ = 8;\nReaction.diffValueMask_ = 16;\nfunction onReactionError(handler) {\n globalState.globalReactionErrorHandlers.push(handler);\n return function () {\n var idx = globalState.globalReactionErrorHandlers.indexOf(handler);\n if (idx >= 0) {\n globalState.globalReactionErrorHandlers.splice(idx, 1);\n }\n };\n}\n/**\n * Magic number alert!\n * Defines within how many times a reaction is allowed to re-trigger itself\n * until it is assumed that this is gonna be a never ending loop...\n */\nvar MAX_REACTION_ITERATIONS = 100;\nvar reactionScheduler = function reactionScheduler(f) {\n return f();\n};\nfunction runReactions() {\n // Trampolining, if runReactions are already running, new reactions will be picked up\n if (globalState.inBatch > 0 || globalState.isRunningReactions) {\n return;\n }\n reactionScheduler(runReactionsHelper);\n}\nfunction runReactionsHelper() {\n globalState.isRunningReactions = true;\n var allReactions = globalState.pendingReactions;\n var iterations = 0;\n // While running reactions, new reactions might be triggered.\n // Hence we work with two variables and check whether\n // we converge to no remaining reactions after a while.\n while (allReactions.length > 0) {\n if (++iterations === MAX_REACTION_ITERATIONS) {\n console.error( true ? \"Reaction doesn't converge to a stable state after \" + MAX_REACTION_ITERATIONS + \" iterations.\" + (\" Probably there is a cycle in the reactive function: \" + allReactions[0]) : 0);\n allReactions.splice(0); // clear reactions\n }\n var remainingReactions = allReactions.splice(0);\n for (var i = 0, l = remainingReactions.length; i < l; i++) {\n remainingReactions[i].runReaction_();\n }\n }\n globalState.isRunningReactions = false;\n}\nvar isReaction = /*#__PURE__*/createInstanceofPredicate(\"Reaction\", Reaction);\nfunction setReactionScheduler(fn) {\n var baseScheduler = reactionScheduler;\n reactionScheduler = function reactionScheduler(f) {\n return fn(function () {\n return baseScheduler(f);\n });\n };\n}\n\nfunction isSpyEnabled() {\n return true && !!globalState.spyListeners.length;\n}\nfunction spyReport(event) {\n if (false) {} // dead code elimination can do the rest\n if (!globalState.spyListeners.length) {\n return;\n }\n var listeners = globalState.spyListeners;\n for (var i = 0, l = listeners.length; i < l; i++) {\n listeners[i](event);\n }\n}\nfunction spyReportStart(event) {\n if (false) {}\n var change = _extends({}, event, {\n spyReportStart: true\n });\n spyReport(change);\n}\nvar END_EVENT = {\n type: \"report-end\",\n spyReportEnd: true\n};\nfunction spyReportEnd(change) {\n if (false) {}\n if (change) {\n spyReport(_extends({}, change, {\n type: \"report-end\",\n spyReportEnd: true\n }));\n } else {\n spyReport(END_EVENT);\n }\n}\nfunction spy(listener) {\n if (false) {} else {\n globalState.spyListeners.push(listener);\n return once(function () {\n globalState.spyListeners = globalState.spyListeners.filter(function (l) {\n return l !== listener;\n });\n });\n }\n}\n\nvar ACTION = \"action\";\nvar ACTION_BOUND = \"action.bound\";\nvar AUTOACTION = \"autoAction\";\nvar AUTOACTION_BOUND = \"autoAction.bound\";\nvar DEFAULT_ACTION_NAME = \"\";\nvar actionAnnotation = /*#__PURE__*/createActionAnnotation(ACTION);\nvar actionBoundAnnotation = /*#__PURE__*/createActionAnnotation(ACTION_BOUND, {\n bound: true\n});\nvar autoActionAnnotation = /*#__PURE__*/createActionAnnotation(AUTOACTION, {\n autoAction: true\n});\nvar autoActionBoundAnnotation = /*#__PURE__*/createActionAnnotation(AUTOACTION_BOUND, {\n autoAction: true,\n bound: true\n});\nfunction createActionFactory(autoAction) {\n var res = function action(arg1, arg2) {\n // action(fn() {})\n if (isFunction(arg1)) {\n return createAction(arg1.name || DEFAULT_ACTION_NAME, arg1, autoAction);\n }\n // action(\"name\", fn() {})\n if (isFunction(arg2)) {\n return createAction(arg1, arg2, autoAction);\n }\n // @action (2022.3 Decorators)\n if (is20223Decorator(arg2)) {\n return (autoAction ? autoActionAnnotation : actionAnnotation).decorate_20223_(arg1, arg2);\n }\n // @action\n if (isStringish(arg2)) {\n return storeAnnotation(arg1, arg2, autoAction ? autoActionAnnotation : actionAnnotation);\n }\n // action(\"name\") & @action(\"name\")\n if (isStringish(arg1)) {\n return createDecoratorAnnotation(createActionAnnotation(autoAction ? AUTOACTION : ACTION, {\n name: arg1,\n autoAction: autoAction\n }));\n }\n if (true) {\n die(\"Invalid arguments for `action`\");\n }\n };\n return res;\n}\nvar action = /*#__PURE__*/createActionFactory(false);\nObject.assign(action, actionAnnotation);\nvar autoAction = /*#__PURE__*/createActionFactory(true);\nObject.assign(autoAction, autoActionAnnotation);\naction.bound = /*#__PURE__*/createDecoratorAnnotation(actionBoundAnnotation);\nautoAction.bound = /*#__PURE__*/createDecoratorAnnotation(autoActionBoundAnnotation);\nfunction runInAction(fn) {\n return executeAction(fn.name || DEFAULT_ACTION_NAME, false, fn, this, undefined);\n}\nfunction isAction(thing) {\n return isFunction(thing) && thing.isMobxAction === true;\n}\n\n/**\n * Creates a named reactive view and keeps it alive, so that the view is always\n * updated if one of the dependencies changes, even when the view is not further used by something else.\n * @param view The reactive view\n * @returns disposer function, which can be used to stop the view from being updated in the future.\n */\nfunction autorun(view, opts) {\n var _opts$name, _opts, _opts2, _opts3;\n if (opts === void 0) {\n opts = EMPTY_OBJECT;\n }\n if (true) {\n if (!isFunction(view)) {\n die(\"Autorun expects a function as first argument\");\n }\n if (isAction(view)) {\n die(\"Autorun does not accept actions since actions are untrackable\");\n }\n }\n var name = (_opts$name = (_opts = opts) == null ? void 0 : _opts.name) != null ? _opts$name : true ? view.name || \"Autorun@\" + getNextId() : 0;\n var runSync = !opts.scheduler && !opts.delay;\n var reaction;\n if (runSync) {\n // normal autorun\n reaction = new Reaction(name, function () {\n this.track(reactionRunner);\n }, opts.onError, opts.requiresObservable);\n } else {\n var scheduler = createSchedulerFromOptions(opts);\n // debounced autorun\n var isScheduled = false;\n reaction = new Reaction(name, function () {\n if (!isScheduled) {\n isScheduled = true;\n scheduler(function () {\n isScheduled = false;\n if (!reaction.isDisposed) {\n reaction.track(reactionRunner);\n }\n });\n }\n }, opts.onError, opts.requiresObservable);\n }\n function reactionRunner() {\n view(reaction);\n }\n if (!((_opts2 = opts) != null && (_opts2 = _opts2.signal) != null && _opts2.aborted)) {\n reaction.schedule_();\n }\n return reaction.getDisposer_((_opts3 = opts) == null ? void 0 : _opts3.signal);\n}\nvar run = function run(f) {\n return f();\n};\nfunction createSchedulerFromOptions(opts) {\n return opts.scheduler ? opts.scheduler : opts.delay ? function (f) {\n return setTimeout(f, opts.delay);\n } : run;\n}\nfunction reaction(expression, effect, opts) {\n var _opts$name2, _opts4, _opts5;\n if (opts === void 0) {\n opts = EMPTY_OBJECT;\n }\n if (true) {\n if (!isFunction(expression) || !isFunction(effect)) {\n die(\"First and second argument to reaction should be functions\");\n }\n if (!isPlainObject(opts)) {\n die(\"Third argument of reactions should be an object\");\n }\n }\n var name = (_opts$name2 = opts.name) != null ? _opts$name2 : true ? \"Reaction@\" + getNextId() : 0;\n var effectAction = action(name, opts.onError ? wrapErrorHandler(opts.onError, effect) : effect);\n var runSync = !opts.scheduler && !opts.delay;\n var scheduler = createSchedulerFromOptions(opts);\n var firstTime = true;\n var isScheduled = false;\n var value;\n var equals = opts.compareStructural ? comparer.structural : opts.equals || comparer[\"default\"];\n var r = new Reaction(name, function () {\n if (firstTime || runSync) {\n reactionRunner();\n } else if (!isScheduled) {\n isScheduled = true;\n scheduler(reactionRunner);\n }\n }, opts.onError, opts.requiresObservable);\n function reactionRunner() {\n isScheduled = false;\n if (r.isDisposed) {\n return;\n }\n var changed = false;\n var oldValue = value;\n r.track(function () {\n var nextValue = allowStateChanges(false, function () {\n return expression(r);\n });\n changed = firstTime || !equals(value, nextValue);\n value = nextValue;\n });\n if (firstTime && opts.fireImmediately) {\n effectAction(value, oldValue, r);\n } else if (!firstTime && changed) {\n effectAction(value, oldValue, r);\n }\n firstTime = false;\n }\n if (!((_opts4 = opts) != null && (_opts4 = _opts4.signal) != null && _opts4.aborted)) {\n r.schedule_();\n }\n return r.getDisposer_((_opts5 = opts) == null ? void 0 : _opts5.signal);\n}\nfunction wrapErrorHandler(errorHandler, baseFn) {\n return function () {\n try {\n return baseFn.apply(this, arguments);\n } catch (e) {\n errorHandler.call(this, e);\n }\n };\n}\n\nvar ON_BECOME_OBSERVED = \"onBO\";\nvar ON_BECOME_UNOBSERVED = \"onBUO\";\nfunction onBecomeObserved(thing, arg2, arg3) {\n return interceptHook(ON_BECOME_OBSERVED, thing, arg2, arg3);\n}\nfunction onBecomeUnobserved(thing, arg2, arg3) {\n return interceptHook(ON_BECOME_UNOBSERVED, thing, arg2, arg3);\n}\nfunction interceptHook(hook, thing, arg2, arg3) {\n var atom = typeof arg3 === \"function\" ? getAtom(thing, arg2) : getAtom(thing);\n var cb = isFunction(arg3) ? arg3 : arg2;\n var listenersKey = hook + \"L\";\n if (atom[listenersKey]) {\n atom[listenersKey].add(cb);\n } else {\n atom[listenersKey] = new Set([cb]);\n }\n return function () {\n var hookListeners = atom[listenersKey];\n if (hookListeners) {\n hookListeners[\"delete\"](cb);\n if (hookListeners.size === 0) {\n delete atom[listenersKey];\n }\n }\n };\n}\n\nvar NEVER = \"never\";\nvar ALWAYS = \"always\";\nvar OBSERVED = \"observed\";\n// const IF_AVAILABLE = \"ifavailable\"\nfunction configure(options) {\n if (options.isolateGlobalState === true) {\n isolateGlobalState();\n }\n var useProxies = options.useProxies,\n enforceActions = options.enforceActions;\n if (useProxies !== undefined) {\n globalState.useProxies = useProxies === ALWAYS ? true : useProxies === NEVER ? false : typeof Proxy !== \"undefined\";\n }\n if (useProxies === \"ifavailable\") {\n globalState.verifyProxies = true;\n }\n if (enforceActions !== undefined) {\n var ea = enforceActions === ALWAYS ? ALWAYS : enforceActions === OBSERVED;\n globalState.enforceActions = ea;\n globalState.allowStateChanges = ea === true || ea === ALWAYS ? false : true;\n }\n [\"computedRequiresReaction\", \"reactionRequiresObservable\", \"observableRequiresReaction\", \"disableErrorBoundaries\", \"safeDescriptors\"].forEach(function (key) {\n if (key in options) {\n globalState[key] = !!options[key];\n }\n });\n globalState.allowStateReads = !globalState.observableRequiresReaction;\n if ( true && globalState.disableErrorBoundaries === true) {\n console.warn(\"WARNING: Debug feature only. MobX will NOT recover from errors when `disableErrorBoundaries` is enabled.\");\n }\n if (options.reactionScheduler) {\n setReactionScheduler(options.reactionScheduler);\n }\n}\n\nfunction extendObservable(target, properties, annotations, options) {\n if (true) {\n if (arguments.length > 4) {\n die(\"'extendObservable' expected 2-4 arguments\");\n }\n if (typeof target !== \"object\") {\n die(\"'extendObservable' expects an object as first argument\");\n }\n if (isObservableMap(target)) {\n die(\"'extendObservable' should not be used on maps, use map.merge instead\");\n }\n if (!isPlainObject(properties)) {\n die(\"'extendObservable' only accepts plain objects as second argument\");\n }\n if (isObservable(properties) || isObservable(annotations)) {\n die(\"Extending an object with another observable (object) is not supported\");\n }\n }\n // Pull descriptors first, so we don't have to deal with props added by administration ($mobx)\n var descriptors = getOwnPropertyDescriptors(properties);\n initObservable(function () {\n var adm = asObservableObject(target, options)[$mobx];\n ownKeys(descriptors).forEach(function (key) {\n adm.extend_(key, descriptors[key],\n // must pass \"undefined\" for { key: undefined }\n !annotations ? true : key in annotations ? annotations[key] : true);\n });\n });\n return target;\n}\n\nfunction getDependencyTree(thing, property) {\n return nodeToDependencyTree(getAtom(thing, property));\n}\nfunction nodeToDependencyTree(node) {\n var result = {\n name: node.name_\n };\n if (node.observing_ && node.observing_.length > 0) {\n result.dependencies = unique(node.observing_).map(nodeToDependencyTree);\n }\n return result;\n}\nfunction getObserverTree(thing, property) {\n return nodeToObserverTree(getAtom(thing, property));\n}\nfunction nodeToObserverTree(node) {\n var result = {\n name: node.name_\n };\n if (hasObservers(node)) {\n result.observers = Array.from(getObservers(node)).map(nodeToObserverTree);\n }\n return result;\n}\nfunction unique(list) {\n return Array.from(new Set(list));\n}\n\nvar generatorId = 0;\nfunction FlowCancellationError() {\n this.message = \"FLOW_CANCELLED\";\n}\nFlowCancellationError.prototype = /*#__PURE__*/Object.create(Error.prototype);\nfunction isFlowCancellationError(error) {\n return error instanceof FlowCancellationError;\n}\nvar flowAnnotation = /*#__PURE__*/createFlowAnnotation(\"flow\");\nvar flowBoundAnnotation = /*#__PURE__*/createFlowAnnotation(\"flow.bound\", {\n bound: true\n});\nvar flow = /*#__PURE__*/Object.assign(function flow(arg1, arg2) {\n // @flow (2022.3 Decorators)\n if (is20223Decorator(arg2)) {\n return flowAnnotation.decorate_20223_(arg1, arg2);\n }\n // @flow\n if (isStringish(arg2)) {\n return storeAnnotation(arg1, arg2, flowAnnotation);\n }\n // flow(fn)\n if ( true && arguments.length !== 1) {\n die(\"Flow expects single argument with generator function\");\n }\n var generator = arg1;\n var name = generator.name || \"\";\n // Implementation based on https://github.com/tj/co/blob/master/index.js\n var res = function res() {\n var ctx = this;\n var args = arguments;\n var runId = ++generatorId;\n var gen = action(name + \" - runid: \" + runId + \" - init\", generator).apply(ctx, args);\n var rejector;\n var pendingPromise = undefined;\n var promise = new Promise(function (resolve, reject) {\n var stepId = 0;\n rejector = reject;\n function onFulfilled(res) {\n pendingPromise = undefined;\n var ret;\n try {\n ret = action(name + \" - runid: \" + runId + \" - yield \" + stepId++, gen.next).call(gen, res);\n } catch (e) {\n return reject(e);\n }\n next(ret);\n }\n function onRejected(err) {\n pendingPromise = undefined;\n var ret;\n try {\n ret = action(name + \" - runid: \" + runId + \" - yield \" + stepId++, gen[\"throw\"]).call(gen, err);\n } catch (e) {\n return reject(e);\n }\n next(ret);\n }\n function next(ret) {\n if (isFunction(ret == null ? void 0 : ret.then)) {\n // an async iterator\n ret.then(next, reject);\n return;\n }\n if (ret.done) {\n return resolve(ret.value);\n }\n pendingPromise = Promise.resolve(ret.value);\n return pendingPromise.then(onFulfilled, onRejected);\n }\n onFulfilled(undefined); // kick off the process\n });\n promise.cancel = action(name + \" - runid: \" + runId + \" - cancel\", function () {\n try {\n if (pendingPromise) {\n cancelPromise(pendingPromise);\n }\n // Finally block can return (or yield) stuff..\n var _res = gen[\"return\"](undefined);\n // eat anything that promise would do, it's cancelled!\n var yieldedPromise = Promise.resolve(_res.value);\n yieldedPromise.then(noop, noop);\n cancelPromise(yieldedPromise); // maybe it can be cancelled :)\n // reject our original promise\n rejector(new FlowCancellationError());\n } catch (e) {\n rejector(e); // there could be a throwing finally block\n }\n });\n return promise;\n };\n res.isMobXFlow = true;\n return res;\n}, flowAnnotation);\nflow.bound = /*#__PURE__*/createDecoratorAnnotation(flowBoundAnnotation);\nfunction cancelPromise(promise) {\n if (isFunction(promise.cancel)) {\n promise.cancel();\n }\n}\nfunction flowResult(result) {\n return result; // just tricking TypeScript :)\n}\nfunction isFlow(fn) {\n return (fn == null ? void 0 : fn.isMobXFlow) === true;\n}\n\nfunction interceptReads(thing, propOrHandler, handler) {\n var target;\n if (isObservableMap(thing) || isObservableArray(thing) || isObservableValue(thing)) {\n target = getAdministration(thing);\n } else if (isObservableObject(thing)) {\n if ( true && !isStringish(propOrHandler)) {\n return die(\"InterceptReads can only be used with a specific property, not with an object in general\");\n }\n target = getAdministration(thing, propOrHandler);\n } else if (true) {\n return die(\"Expected observable map, object or array as first array\");\n }\n if ( true && target.dehancer !== undefined) {\n return die(\"An intercept reader was already established\");\n }\n target.dehancer = typeof propOrHandler === \"function\" ? propOrHandler : handler;\n return function () {\n target.dehancer = undefined;\n };\n}\n\nfunction intercept(thing, propOrHandler, handler) {\n if (isFunction(handler)) {\n return interceptProperty(thing, propOrHandler, handler);\n } else {\n return interceptInterceptable(thing, propOrHandler);\n }\n}\nfunction interceptInterceptable(thing, handler) {\n return getAdministration(thing).intercept_(handler);\n}\nfunction interceptProperty(thing, property, handler) {\n return getAdministration(thing, property).intercept_(handler);\n}\n\nfunction _isComputed(value, property) {\n if (property === undefined) {\n return isComputedValue(value);\n }\n if (isObservableObject(value) === false) {\n return false;\n }\n if (!value[$mobx].values_.has(property)) {\n return false;\n }\n var atom = getAtom(value, property);\n return isComputedValue(atom);\n}\nfunction isComputed(value) {\n if ( true && arguments.length > 1) {\n return die(\"isComputed expects only 1 argument. Use isComputedProp to inspect the observability of a property\");\n }\n return _isComputed(value);\n}\nfunction isComputedProp(value, propName) {\n if ( true && !isStringish(propName)) {\n return die(\"isComputed expected a property name as second argument\");\n }\n return _isComputed(value, propName);\n}\n\nfunction _isObservable(value, property) {\n if (!value) {\n return false;\n }\n if (property !== undefined) {\n if ( true && (isObservableMap(value) || isObservableArray(value))) {\n return die(\"isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead.\");\n }\n if (isObservableObject(value)) {\n return value[$mobx].values_.has(property);\n }\n return false;\n }\n // For first check, see #701\n return isObservableObject(value) || !!value[$mobx] || isAtom(value) || isReaction(value) || isComputedValue(value);\n}\nfunction isObservable(value) {\n if ( true && arguments.length !== 1) {\n die(\"isObservable expects only 1 argument. Use isObservableProp to inspect the observability of a property\");\n }\n return _isObservable(value);\n}\nfunction isObservableProp(value, propName) {\n if ( true && !isStringish(propName)) {\n return die(\"expected a property name as second argument\");\n }\n return _isObservable(value, propName);\n}\n\nfunction keys(obj) {\n if (isObservableObject(obj)) {\n return obj[$mobx].keys_();\n }\n if (isObservableMap(obj) || isObservableSet(obj)) {\n return Array.from(obj.keys());\n }\n if (isObservableArray(obj)) {\n return obj.map(function (_, index) {\n return index;\n });\n }\n die(5);\n}\nfunction values(obj) {\n if (isObservableObject(obj)) {\n return keys(obj).map(function (key) {\n return obj[key];\n });\n }\n if (isObservableMap(obj)) {\n return keys(obj).map(function (key) {\n return obj.get(key);\n });\n }\n if (isObservableSet(obj)) {\n return Array.from(obj.values());\n }\n if (isObservableArray(obj)) {\n return obj.slice();\n }\n die(6);\n}\nfunction entries(obj) {\n if (isObservableObject(obj)) {\n return keys(obj).map(function (key) {\n return [key, obj[key]];\n });\n }\n if (isObservableMap(obj)) {\n return keys(obj).map(function (key) {\n return [key, obj.get(key)];\n });\n }\n if (isObservableSet(obj)) {\n return Array.from(obj.entries());\n }\n if (isObservableArray(obj)) {\n return obj.map(function (key, index) {\n return [index, key];\n });\n }\n die(7);\n}\nfunction set(obj, key, value) {\n if (arguments.length === 2 && !isObservableSet(obj)) {\n startBatch();\n var _values = key;\n try {\n for (var _key in _values) {\n set(obj, _key, _values[_key]);\n }\n } finally {\n endBatch();\n }\n return;\n }\n if (isObservableObject(obj)) {\n obj[$mobx].set_(key, value);\n } else if (isObservableMap(obj)) {\n obj.set(key, value);\n } else if (isObservableSet(obj)) {\n obj.add(key);\n } else if (isObservableArray(obj)) {\n if (typeof key !== \"number\") {\n key = parseInt(key, 10);\n }\n if (key < 0) {\n die(\"Invalid index: '\" + key + \"'\");\n }\n startBatch();\n if (key >= obj.length) {\n obj.length = key + 1;\n }\n obj[key] = value;\n endBatch();\n } else {\n die(8);\n }\n}\nfunction remove(obj, key) {\n if (isObservableObject(obj)) {\n obj[$mobx].delete_(key);\n } else if (isObservableMap(obj)) {\n obj[\"delete\"](key);\n } else if (isObservableSet(obj)) {\n obj[\"delete\"](key);\n } else if (isObservableArray(obj)) {\n if (typeof key !== \"number\") {\n key = parseInt(key, 10);\n }\n obj.splice(key, 1);\n } else {\n die(9);\n }\n}\nfunction has(obj, key) {\n if (isObservableObject(obj)) {\n return obj[$mobx].has_(key);\n } else if (isObservableMap(obj)) {\n return obj.has(key);\n } else if (isObservableSet(obj)) {\n return obj.has(key);\n } else if (isObservableArray(obj)) {\n return key >= 0 && key < obj.length;\n }\n die(10);\n}\nfunction get(obj, key) {\n if (!has(obj, key)) {\n return undefined;\n }\n if (isObservableObject(obj)) {\n return obj[$mobx].get_(key);\n } else if (isObservableMap(obj)) {\n return obj.get(key);\n } else if (isObservableArray(obj)) {\n return obj[key];\n }\n die(11);\n}\nfunction apiDefineProperty(obj, key, descriptor) {\n if (isObservableObject(obj)) {\n return obj[$mobx].defineProperty_(key, descriptor);\n }\n die(39);\n}\nfunction apiOwnKeys(obj) {\n if (isObservableObject(obj)) {\n return obj[$mobx].ownKeys_();\n }\n die(38);\n}\n\nfunction observe(thing, propOrCb, cbOrFire, fireImmediately) {\n if (isFunction(cbOrFire)) {\n return observeObservableProperty(thing, propOrCb, cbOrFire, fireImmediately);\n } else {\n return observeObservable(thing, propOrCb, cbOrFire);\n }\n}\nfunction observeObservable(thing, listener, fireImmediately) {\n return getAdministration(thing).observe_(listener, fireImmediately);\n}\nfunction observeObservableProperty(thing, property, listener, fireImmediately) {\n return getAdministration(thing, property).observe_(listener, fireImmediately);\n}\n\nfunction cache(map, key, value) {\n map.set(key, value);\n return value;\n}\nfunction toJSHelper(source, __alreadySeen) {\n if (source == null || typeof source !== \"object\" || source instanceof Date || !isObservable(source)) {\n return source;\n }\n if (isObservableValue(source) || isComputedValue(source)) {\n return toJSHelper(source.get(), __alreadySeen);\n }\n if (__alreadySeen.has(source)) {\n return __alreadySeen.get(source);\n }\n if (isObservableArray(source)) {\n var res = cache(__alreadySeen, source, new Array(source.length));\n source.forEach(function (value, idx) {\n res[idx] = toJSHelper(value, __alreadySeen);\n });\n return res;\n }\n if (isObservableSet(source)) {\n var _res = cache(__alreadySeen, source, new Set());\n source.forEach(function (value) {\n _res.add(toJSHelper(value, __alreadySeen));\n });\n return _res;\n }\n if (isObservableMap(source)) {\n var _res2 = cache(__alreadySeen, source, new Map());\n source.forEach(function (value, key) {\n _res2.set(key, toJSHelper(value, __alreadySeen));\n });\n return _res2;\n } else {\n // must be observable object\n var _res3 = cache(__alreadySeen, source, {});\n apiOwnKeys(source).forEach(function (key) {\n if (objectPrototype.propertyIsEnumerable.call(source, key)) {\n _res3[key] = toJSHelper(source[key], __alreadySeen);\n }\n });\n return _res3;\n }\n}\n/**\n * Recursively converts an observable to it's non-observable native counterpart.\n * It does NOT recurse into non-observables, these are left as they are, even if they contain observables.\n * Computed and other non-enumerable properties are completely ignored.\n * Complex scenarios require custom solution, eg implementing `toJSON` or using `serializr` lib.\n */\nfunction toJS(source, options) {\n if ( true && options) {\n die(\"toJS no longer supports options\");\n }\n return toJSHelper(source, new Map());\n}\n\nfunction trace() {\n if (false) {}\n var enterBreakPoint = false;\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n if (typeof args[args.length - 1] === \"boolean\") {\n enterBreakPoint = args.pop();\n }\n var derivation = getAtomFromArgs(args);\n if (!derivation) {\n return die(\"'trace(break?)' can only be used inside a tracked computed value or a Reaction. Consider passing in the computed value or reaction explicitly\");\n }\n if (derivation.isTracing_ === TraceMode.NONE) {\n console.log(\"[mobx.trace] '\" + derivation.name_ + \"' tracing enabled\");\n }\n derivation.isTracing_ = enterBreakPoint ? TraceMode.BREAK : TraceMode.LOG;\n}\nfunction getAtomFromArgs(args) {\n switch (args.length) {\n case 0:\n return globalState.trackingDerivation;\n case 1:\n return getAtom(args[0]);\n case 2:\n return getAtom(args[0], args[1]);\n }\n}\n\n/**\n * During a transaction no views are updated until the end of the transaction.\n * The transaction will be run synchronously nonetheless.\n *\n * @param action a function that updates some reactive state\n * @returns any value that was returned by the 'action' parameter.\n */\nfunction transaction(action, thisArg) {\n if (thisArg === void 0) {\n thisArg = undefined;\n }\n startBatch();\n try {\n return action.apply(thisArg);\n } finally {\n endBatch();\n }\n}\n\nfunction when(predicate, arg1, arg2) {\n if (arguments.length === 1 || arg1 && typeof arg1 === \"object\") {\n return whenPromise(predicate, arg1);\n }\n return _when(predicate, arg1, arg2 || {});\n}\nfunction _when(predicate, effect, opts) {\n var timeoutHandle;\n if (typeof opts.timeout === \"number\") {\n var error = new Error(\"WHEN_TIMEOUT\");\n timeoutHandle = setTimeout(function () {\n if (!disposer[$mobx].isDisposed) {\n disposer();\n if (opts.onError) {\n opts.onError(error);\n } else {\n throw error;\n }\n }\n }, opts.timeout);\n }\n opts.name = true ? opts.name || \"When@\" + getNextId() : 0;\n var effectAction = createAction( true ? opts.name + \"-effect\" : 0, effect);\n // eslint-disable-next-line\n var disposer = autorun(function (r) {\n // predicate should not change state\n var cond = allowStateChanges(false, predicate);\n if (cond) {\n r.dispose();\n if (timeoutHandle) {\n clearTimeout(timeoutHandle);\n }\n effectAction();\n }\n }, opts);\n return disposer;\n}\nfunction whenPromise(predicate, opts) {\n var _opts$signal;\n if ( true && opts && opts.onError) {\n return die(\"the options 'onError' and 'promise' cannot be combined\");\n }\n if (opts != null && (_opts$signal = opts.signal) != null && _opts$signal.aborted) {\n return Object.assign(Promise.reject(new Error(\"WHEN_ABORTED\")), {\n cancel: function cancel() {\n return null;\n }\n });\n }\n var cancel;\n var abort;\n var res = new Promise(function (resolve, reject) {\n var _opts$signal2;\n var disposer = _when(predicate, resolve, _extends({}, opts, {\n onError: reject\n }));\n cancel = function cancel() {\n disposer();\n reject(new Error(\"WHEN_CANCELLED\"));\n };\n abort = function abort() {\n disposer();\n reject(new Error(\"WHEN_ABORTED\"));\n };\n opts == null || (_opts$signal2 = opts.signal) == null || _opts$signal2.addEventListener == null || _opts$signal2.addEventListener(\"abort\", abort);\n })[\"finally\"](function () {\n var _opts$signal3;\n return opts == null || (_opts$signal3 = opts.signal) == null || _opts$signal3.removeEventListener == null ? void 0 : _opts$signal3.removeEventListener(\"abort\", abort);\n });\n res.cancel = cancel;\n return res;\n}\n\nfunction getAdm(target) {\n return target[$mobx];\n}\n// Optimization: we don't need the intermediate objects and could have a completely custom administration for DynamicObjects,\n// and skip either the internal values map, or the base object with its property descriptors!\nvar objectProxyTraps = {\n has: function has(target, name) {\n if ( true && globalState.trackingDerivation) {\n warnAboutProxyRequirement(\"detect new properties using the 'in' operator. Use 'has' from 'mobx' instead.\");\n }\n return getAdm(target).has_(name);\n },\n get: function get(target, name) {\n return getAdm(target).get_(name);\n },\n set: function set(target, name, value) {\n var _getAdm$set_;\n if (!isStringish(name)) {\n return false;\n }\n if ( true && !getAdm(target).values_.has(name)) {\n warnAboutProxyRequirement(\"add a new observable property through direct assignment. Use 'set' from 'mobx' instead.\");\n }\n // null (intercepted) -> true (success)\n return (_getAdm$set_ = getAdm(target).set_(name, value, true)) != null ? _getAdm$set_ : true;\n },\n deleteProperty: function deleteProperty(target, name) {\n var _getAdm$delete_;\n if (true) {\n warnAboutProxyRequirement(\"delete properties from an observable object. Use 'remove' from 'mobx' instead.\");\n }\n if (!isStringish(name)) {\n return false;\n }\n // null (intercepted) -> true (success)\n return (_getAdm$delete_ = getAdm(target).delete_(name, true)) != null ? _getAdm$delete_ : true;\n },\n defineProperty: function defineProperty(target, name, descriptor) {\n var _getAdm$definePropert;\n if (true) {\n warnAboutProxyRequirement(\"define property on an observable object. Use 'defineProperty' from 'mobx' instead.\");\n }\n // null (intercepted) -> true (success)\n return (_getAdm$definePropert = getAdm(target).defineProperty_(name, descriptor)) != null ? _getAdm$definePropert : true;\n },\n ownKeys: function ownKeys(target) {\n if ( true && globalState.trackingDerivation) {\n warnAboutProxyRequirement(\"iterate keys to detect added / removed properties. Use 'keys' from 'mobx' instead.\");\n }\n return getAdm(target).ownKeys_();\n },\n preventExtensions: function preventExtensions(target) {\n die(13);\n }\n};\nfunction asDynamicObservableObject(target, options) {\n var _target$$mobx, _target$$mobx$proxy_;\n assertProxies();\n target = asObservableObject(target, options);\n return (_target$$mobx$proxy_ = (_target$$mobx = target[$mobx]).proxy_) != null ? _target$$mobx$proxy_ : _target$$mobx.proxy_ = new Proxy(target, objectProxyTraps);\n}\n\nfunction hasInterceptors(interceptable) {\n return interceptable.interceptors_ !== undefined && interceptable.interceptors_.length > 0;\n}\nfunction registerInterceptor(interceptable, handler) {\n var interceptors = interceptable.interceptors_ || (interceptable.interceptors_ = []);\n interceptors.push(handler);\n return once(function () {\n var idx = interceptors.indexOf(handler);\n if (idx !== -1) {\n interceptors.splice(idx, 1);\n }\n });\n}\nfunction interceptChange(interceptable, change) {\n var prevU = untrackedStart();\n try {\n // Interceptor can modify the array, copy it to avoid concurrent modification, see #1950\n var interceptors = [].concat(interceptable.interceptors_ || []);\n for (var i = 0, l = interceptors.length; i < l; i++) {\n change = interceptors[i](change);\n if (change && !change.type) {\n die(14);\n }\n if (!change) {\n break;\n }\n }\n return change;\n } finally {\n untrackedEnd(prevU);\n }\n}\n\nfunction hasListeners(listenable) {\n return listenable.changeListeners_ !== undefined && listenable.changeListeners_.length > 0;\n}\nfunction registerListener(listenable, handler) {\n var listeners = listenable.changeListeners_ || (listenable.changeListeners_ = []);\n listeners.push(handler);\n return once(function () {\n var idx = listeners.indexOf(handler);\n if (idx !== -1) {\n listeners.splice(idx, 1);\n }\n });\n}\nfunction notifyListeners(listenable, change) {\n var prevU = untrackedStart();\n var listeners = listenable.changeListeners_;\n if (!listeners) {\n return;\n }\n listeners = listeners.slice();\n for (var i = 0, l = listeners.length; i < l; i++) {\n listeners[i](change);\n }\n untrackedEnd(prevU);\n}\n\nfunction makeObservable(target, annotations, options) {\n initObservable(function () {\n var _annotations;\n var adm = asObservableObject(target, options)[$mobx];\n if ( true && annotations && target[storedAnnotationsSymbol]) {\n die(\"makeObservable second arg must be nullish when using decorators. Mixing @decorator syntax with annotations is not supported.\");\n }\n // Default to decorators\n (_annotations = annotations) != null ? _annotations : annotations = collectStoredAnnotations(target);\n // Annotate\n ownKeys(annotations).forEach(function (key) {\n return adm.make_(key, annotations[key]);\n });\n });\n return target;\n}\n// proto[keysSymbol] = new Set()\nvar keysSymbol = /*#__PURE__*/Symbol(\"mobx-keys\");\nfunction makeAutoObservable(target, overrides, options) {\n if (true) {\n if (!isPlainObject(target) && !isPlainObject(Object.getPrototypeOf(target))) {\n die(\"'makeAutoObservable' can only be used for classes that don't have a superclass\");\n }\n if (isObservableObject(target)) {\n die(\"makeAutoObservable can only be used on objects not already made observable\");\n }\n }\n // Optimization: avoid visiting protos\n // Assumes that annotation.make_/.extend_ works the same for plain objects\n if (isPlainObject(target)) {\n return extendObservable(target, target, overrides, options);\n }\n initObservable(function () {\n var adm = asObservableObject(target, options)[$mobx];\n // Optimization: cache keys on proto\n // Assumes makeAutoObservable can be called only once per object and can't be used in subclass\n if (!target[keysSymbol]) {\n var proto = Object.getPrototypeOf(target);\n var keys = new Set([].concat(ownKeys(target), ownKeys(proto)));\n keys[\"delete\"](\"constructor\");\n keys[\"delete\"]($mobx);\n addHiddenProp(proto, keysSymbol, keys);\n }\n target[keysSymbol].forEach(function (key) {\n return adm.make_(key,\n // must pass \"undefined\" for { key: undefined }\n !overrides ? true : key in overrides ? overrides[key] : true);\n });\n });\n return target;\n}\n\nvar SPLICE = \"splice\";\nvar UPDATE = \"update\";\nvar MAX_SPLICE_SIZE = 10000; // See e.g. https://github.com/mobxjs/mobx/issues/859\nvar arrayTraps = {\n get: function get(target, name) {\n var adm = target[$mobx];\n if (name === $mobx) {\n return adm;\n }\n if (name === \"length\") {\n return adm.getArrayLength_();\n }\n if (typeof name === \"string\" && !isNaN(name)) {\n return adm.get_(parseInt(name));\n }\n if (hasProp(arrayExtensions, name)) {\n return arrayExtensions[name];\n }\n return target[name];\n },\n set: function set(target, name, value) {\n var adm = target[$mobx];\n if (name === \"length\") {\n adm.setArrayLength_(value);\n }\n if (typeof name === \"symbol\" || isNaN(name)) {\n target[name] = value;\n } else {\n // numeric string\n adm.set_(parseInt(name), value);\n }\n return true;\n },\n preventExtensions: function preventExtensions() {\n die(15);\n }\n};\nvar ObservableArrayAdministration = /*#__PURE__*/function () {\n function ObservableArrayAdministration(name, enhancer, owned_, legacyMode_) {\n if (name === void 0) {\n name = true ? \"ObservableArray@\" + getNextId() : 0;\n }\n this.owned_ = void 0;\n this.legacyMode_ = void 0;\n this.atom_ = void 0;\n this.values_ = [];\n // this is the prop that gets proxied, so can't replace it!\n this.interceptors_ = void 0;\n this.changeListeners_ = void 0;\n this.enhancer_ = void 0;\n this.dehancer = void 0;\n this.proxy_ = void 0;\n this.lastKnownLength_ = 0;\n this.owned_ = owned_;\n this.legacyMode_ = legacyMode_;\n this.atom_ = new Atom(name);\n this.enhancer_ = function (newV, oldV) {\n return enhancer(newV, oldV, true ? name + \"[..]\" : 0);\n };\n }\n var _proto = ObservableArrayAdministration.prototype;\n _proto.dehanceValue_ = function dehanceValue_(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.dehanceValues_ = function dehanceValues_(values) {\n if (this.dehancer !== undefined && values.length > 0) {\n return values.map(this.dehancer);\n }\n return values;\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n if (fireImmediately === void 0) {\n fireImmediately = false;\n }\n if (fireImmediately) {\n listener({\n observableKind: \"array\",\n object: this.proxy_,\n debugObjectName: this.atom_.name_,\n type: \"splice\",\n index: 0,\n added: this.values_.slice(),\n addedCount: this.values_.length,\n removed: [],\n removedCount: 0\n });\n }\n return registerListener(this, listener);\n };\n _proto.getArrayLength_ = function getArrayLength_() {\n this.atom_.reportObserved();\n return this.values_.length;\n };\n _proto.setArrayLength_ = function setArrayLength_(newLength) {\n if (typeof newLength !== \"number\" || isNaN(newLength) || newLength < 0) {\n die(\"Out of range: \" + newLength);\n }\n var currentLength = this.values_.length;\n if (newLength === currentLength) {\n return;\n } else if (newLength > currentLength) {\n var newItems = new Array(newLength - currentLength);\n for (var i = 0; i < newLength - currentLength; i++) {\n newItems[i] = undefined;\n } // No Array.fill everywhere...\n this.spliceWithArray_(currentLength, 0, newItems);\n } else {\n this.spliceWithArray_(newLength, currentLength - newLength);\n }\n };\n _proto.updateArrayLength_ = function updateArrayLength_(oldLength, delta) {\n if (oldLength !== this.lastKnownLength_) {\n die(16);\n }\n this.lastKnownLength_ += delta;\n if (this.legacyMode_ && delta > 0) {\n reserveArrayBuffer(oldLength + delta + 1);\n }\n };\n _proto.spliceWithArray_ = function spliceWithArray_(index, deleteCount, newItems) {\n var _this = this;\n checkIfStateModificationsAreAllowed(this.atom_);\n var length = this.values_.length;\n if (index === undefined) {\n index = 0;\n } else if (index > length) {\n index = length;\n } else if (index < 0) {\n index = Math.max(0, length + index);\n }\n if (arguments.length === 1) {\n deleteCount = length - index;\n } else if (deleteCount === undefined || deleteCount === null) {\n deleteCount = 0;\n } else {\n deleteCount = Math.max(0, Math.min(deleteCount, length - index));\n }\n if (newItems === undefined) {\n newItems = EMPTY_ARRAY;\n }\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_,\n type: SPLICE,\n index: index,\n removedCount: deleteCount,\n added: newItems\n });\n if (!change) {\n return EMPTY_ARRAY;\n }\n deleteCount = change.removedCount;\n newItems = change.added;\n }\n newItems = newItems.length === 0 ? newItems : newItems.map(function (v) {\n return _this.enhancer_(v, undefined);\n });\n if (this.legacyMode_ || \"development\" !== \"production\") {\n var lengthDelta = newItems.length - deleteCount;\n this.updateArrayLength_(length, lengthDelta); // checks if internal array wasn't modified\n }\n var res = this.spliceItemsIntoValues_(index, deleteCount, newItems);\n if (deleteCount !== 0 || newItems.length !== 0) {\n this.notifyArraySplice_(index, newItems, res);\n }\n return this.dehanceValues_(res);\n };\n _proto.spliceItemsIntoValues_ = function spliceItemsIntoValues_(index, deleteCount, newItems) {\n if (newItems.length < MAX_SPLICE_SIZE) {\n var _this$values_;\n return (_this$values_ = this.values_).splice.apply(_this$values_, [index, deleteCount].concat(newItems));\n } else {\n // The items removed by the splice\n var res = this.values_.slice(index, index + deleteCount);\n // The items that that should remain at the end of the array\n var oldItems = this.values_.slice(index + deleteCount);\n // New length is the previous length + addition count - deletion count\n this.values_.length += newItems.length - deleteCount;\n for (var i = 0; i < newItems.length; i++) {\n this.values_[index + i] = newItems[i];\n }\n for (var _i = 0; _i < oldItems.length; _i++) {\n this.values_[index + newItems.length + _i] = oldItems[_i];\n }\n return res;\n }\n };\n _proto.notifyArrayChildUpdate_ = function notifyArrayChildUpdate_(index, newValue, oldValue) {\n var notifySpy = !this.owned_ && isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"array\",\n object: this.proxy_,\n type: UPDATE,\n debugObjectName: this.atom_.name_,\n index: index,\n newValue: newValue,\n oldValue: oldValue\n } : null;\n // The reason why this is on right hand side here (and not above), is this way the uglifier will drop it, but it won't\n // cause any runtime overhead in development mode without NODE_ENV set, unless spying is enabled\n if ( true && notifySpy) {\n spyReportStart(change);\n }\n this.atom_.reportChanged();\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n };\n _proto.notifyArraySplice_ = function notifyArraySplice_(index, added, removed) {\n var notifySpy = !this.owned_ && isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"array\",\n object: this.proxy_,\n debugObjectName: this.atom_.name_,\n type: SPLICE,\n index: index,\n removed: removed,\n added: added,\n removedCount: removed.length,\n addedCount: added.length\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n }\n this.atom_.reportChanged();\n // conform: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/observe\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n };\n _proto.get_ = function get_(index) {\n if (this.legacyMode_ && index >= this.values_.length) {\n console.warn( true ? \"[mobx.array] Attempt to read an array index (\" + index + \") that is out of bounds (\" + this.values_.length + \"). Please check length first. Out of bound indices will not be tracked by MobX\" : 0);\n return undefined;\n }\n this.atom_.reportObserved();\n return this.dehanceValue_(this.values_[index]);\n };\n _proto.set_ = function set_(index, newValue) {\n var values = this.values_;\n if (this.legacyMode_ && index > values.length) {\n // out of bounds\n die(17, index, values.length);\n }\n if (index < values.length) {\n // update at index in range\n checkIfStateModificationsAreAllowed(this.atom_);\n var oldValue = values[index];\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: UPDATE,\n object: this.proxy_,\n // since \"this\" is the real array we need to pass its proxy\n index: index,\n newValue: newValue\n });\n if (!change) {\n return;\n }\n newValue = change.newValue;\n }\n newValue = this.enhancer_(newValue, oldValue);\n var changed = newValue !== oldValue;\n if (changed) {\n values[index] = newValue;\n this.notifyArrayChildUpdate_(index, newValue, oldValue);\n }\n } else {\n // For out of bound index, we don't create an actual sparse array,\n // but rather fill the holes with undefined (same as setArrayLength_).\n // This could be considered a bug.\n var newItems = new Array(index + 1 - values.length);\n for (var i = 0; i < newItems.length - 1; i++) {\n newItems[i] = undefined;\n } // No Array.fill everywhere...\n newItems[newItems.length - 1] = newValue;\n this.spliceWithArray_(values.length, 0, newItems);\n }\n };\n return ObservableArrayAdministration;\n}();\nfunction createObservableArray(initialValues, enhancer, name, owned) {\n if (name === void 0) {\n name = true ? \"ObservableArray@\" + getNextId() : 0;\n }\n if (owned === void 0) {\n owned = false;\n }\n assertProxies();\n return initObservable(function () {\n var adm = new ObservableArrayAdministration(name, enhancer, owned, false);\n addHiddenFinalProp(adm.values_, $mobx, adm);\n var proxy = new Proxy(adm.values_, arrayTraps);\n adm.proxy_ = proxy;\n if (initialValues && initialValues.length) {\n adm.spliceWithArray_(0, 0, initialValues);\n }\n return proxy;\n });\n}\n// eslint-disable-next-line\nvar arrayExtensions = {\n clear: function clear() {\n return this.splice(0);\n },\n replace: function replace(newItems) {\n var adm = this[$mobx];\n return adm.spliceWithArray_(0, adm.values_.length, newItems);\n },\n // Used by JSON.stringify\n toJSON: function toJSON() {\n return this.slice();\n },\n /*\n * functions that do alter the internal structure of the array, (based on lib.es6.d.ts)\n * since these functions alter the inner structure of the array, the have side effects.\n * Because the have side effects, they should not be used in computed function,\n * and for that reason the do not call dependencyState.notifyObserved\n */\n splice: function splice(index, deleteCount) {\n for (var _len = arguments.length, newItems = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {\n newItems[_key - 2] = arguments[_key];\n }\n var adm = this[$mobx];\n switch (arguments.length) {\n case 0:\n return [];\n case 1:\n return adm.spliceWithArray_(index);\n case 2:\n return adm.spliceWithArray_(index, deleteCount);\n }\n return adm.spliceWithArray_(index, deleteCount, newItems);\n },\n spliceWithArray: function spliceWithArray(index, deleteCount, newItems) {\n return this[$mobx].spliceWithArray_(index, deleteCount, newItems);\n },\n push: function push() {\n var adm = this[$mobx];\n for (var _len2 = arguments.length, items = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n items[_key2] = arguments[_key2];\n }\n adm.spliceWithArray_(adm.values_.length, 0, items);\n return adm.values_.length;\n },\n pop: function pop() {\n return this.splice(Math.max(this[$mobx].values_.length - 1, 0), 1)[0];\n },\n shift: function shift() {\n return this.splice(0, 1)[0];\n },\n unshift: function unshift() {\n var adm = this[$mobx];\n for (var _len3 = arguments.length, items = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n items[_key3] = arguments[_key3];\n }\n adm.spliceWithArray_(0, 0, items);\n return adm.values_.length;\n },\n reverse: function reverse() {\n // reverse by default mutates in place before returning the result\n // which makes it both a 'derivation' and a 'mutation'.\n if (globalState.trackingDerivation) {\n die(37, \"reverse\");\n }\n this.replace(this.slice().reverse());\n return this;\n },\n sort: function sort() {\n // sort by default mutates in place before returning the result\n // which goes against all good practices. Let's not change the array in place!\n if (globalState.trackingDerivation) {\n die(37, \"sort\");\n }\n var copy = this.slice();\n copy.sort.apply(copy, arguments);\n this.replace(copy);\n return this;\n },\n remove: function remove(value) {\n var adm = this[$mobx];\n var idx = adm.dehanceValues_(adm.values_).indexOf(value);\n if (idx > -1) {\n this.splice(idx, 1);\n return true;\n }\n return false;\n }\n};\n/**\n * Wrap function from prototype\n * Without this, everything works as well, but this works\n * faster as everything works on unproxied values\n */\naddArrayExtension(\"at\", simpleFunc);\naddArrayExtension(\"concat\", simpleFunc);\naddArrayExtension(\"flat\", simpleFunc);\naddArrayExtension(\"includes\", simpleFunc);\naddArrayExtension(\"indexOf\", simpleFunc);\naddArrayExtension(\"join\", simpleFunc);\naddArrayExtension(\"lastIndexOf\", simpleFunc);\naddArrayExtension(\"slice\", simpleFunc);\naddArrayExtension(\"toString\", simpleFunc);\naddArrayExtension(\"toLocaleString\", simpleFunc);\naddArrayExtension(\"toSorted\", simpleFunc);\naddArrayExtension(\"toSpliced\", simpleFunc);\naddArrayExtension(\"with\", simpleFunc);\n// map\naddArrayExtension(\"every\", mapLikeFunc);\naddArrayExtension(\"filter\", mapLikeFunc);\naddArrayExtension(\"find\", mapLikeFunc);\naddArrayExtension(\"findIndex\", mapLikeFunc);\naddArrayExtension(\"findLast\", mapLikeFunc);\naddArrayExtension(\"findLastIndex\", mapLikeFunc);\naddArrayExtension(\"flatMap\", mapLikeFunc);\naddArrayExtension(\"forEach\", mapLikeFunc);\naddArrayExtension(\"map\", mapLikeFunc);\naddArrayExtension(\"some\", mapLikeFunc);\naddArrayExtension(\"toReversed\", mapLikeFunc);\n// reduce\naddArrayExtension(\"reduce\", reduceLikeFunc);\naddArrayExtension(\"reduceRight\", reduceLikeFunc);\nfunction addArrayExtension(funcName, funcFactory) {\n if (typeof Array.prototype[funcName] === \"function\") {\n arrayExtensions[funcName] = funcFactory(funcName);\n }\n}\n// Report and delegate to dehanced array\nfunction simpleFunc(funcName) {\n return function () {\n var adm = this[$mobx];\n adm.atom_.reportObserved();\n var dehancedValues = adm.dehanceValues_(adm.values_);\n return dehancedValues[funcName].apply(dehancedValues, arguments);\n };\n}\n// Make sure callbacks receive correct array arg #2326\nfunction mapLikeFunc(funcName) {\n return function (callback, thisArg) {\n var _this2 = this;\n var adm = this[$mobx];\n adm.atom_.reportObserved();\n var dehancedValues = adm.dehanceValues_(adm.values_);\n return dehancedValues[funcName](function (element, index) {\n return callback.call(thisArg, element, index, _this2);\n });\n };\n}\n// Make sure callbacks receive correct array arg #2326\nfunction reduceLikeFunc(funcName) {\n return function () {\n var _this3 = this;\n var adm = this[$mobx];\n adm.atom_.reportObserved();\n var dehancedValues = adm.dehanceValues_(adm.values_);\n // #2432 - reduce behavior depends on arguments.length\n var callback = arguments[0];\n arguments[0] = function (accumulator, currentValue, index) {\n return callback(accumulator, currentValue, index, _this3);\n };\n return dehancedValues[funcName].apply(dehancedValues, arguments);\n };\n}\nvar isObservableArrayAdministration = /*#__PURE__*/createInstanceofPredicate(\"ObservableArrayAdministration\", ObservableArrayAdministration);\nfunction isObservableArray(thing) {\n return isObject(thing) && isObservableArrayAdministration(thing[$mobx]);\n}\n\nvar ObservableMapMarker = {};\nvar ADD = \"add\";\nvar DELETE = \"delete\";\n// just extend Map? See also https://gist.github.com/nestharus/13b4d74f2ef4a2f4357dbd3fc23c1e54\n// But: https://github.com/mobxjs/mobx/issues/1556\nvar ObservableMap = /*#__PURE__*/function () {\n function ObservableMap(initialData, enhancer_, name_) {\n var _this = this;\n if (enhancer_ === void 0) {\n enhancer_ = deepEnhancer;\n }\n if (name_ === void 0) {\n name_ = true ? \"ObservableMap@\" + getNextId() : 0;\n }\n this.enhancer_ = void 0;\n this.name_ = void 0;\n this[$mobx] = ObservableMapMarker;\n this.data_ = void 0;\n this.hasMap_ = void 0;\n // hasMap, not hashMap >-).\n this.keysAtom_ = void 0;\n this.interceptors_ = void 0;\n this.changeListeners_ = void 0;\n this.dehancer = void 0;\n this.enhancer_ = enhancer_;\n this.name_ = name_;\n if (!isFunction(Map)) {\n die(18);\n }\n initObservable(function () {\n _this.keysAtom_ = createAtom( true ? _this.name_ + \".keys()\" : 0);\n _this.data_ = new Map();\n _this.hasMap_ = new Map();\n if (initialData) {\n _this.merge(initialData);\n }\n });\n }\n var _proto = ObservableMap.prototype;\n _proto.has_ = function has_(key) {\n return this.data_.has(key);\n };\n _proto.has = function has(key) {\n var _this2 = this;\n if (!globalState.trackingDerivation) {\n return this.has_(key);\n }\n var entry = this.hasMap_.get(key);\n if (!entry) {\n var newEntry = entry = new ObservableValue(this.has_(key), referenceEnhancer, true ? this.name_ + \".\" + stringifyKey(key) + \"?\" : 0, false);\n this.hasMap_.set(key, newEntry);\n onBecomeUnobserved(newEntry, function () {\n return _this2.hasMap_[\"delete\"](key);\n });\n }\n return entry.get();\n };\n _proto.set = function set(key, value) {\n var hasKey = this.has_(key);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: hasKey ? UPDATE : ADD,\n object: this,\n newValue: value,\n name: key\n });\n if (!change) {\n return this;\n }\n value = change.newValue;\n }\n if (hasKey) {\n this.updateValue_(key, value);\n } else {\n this.addValue_(key, value);\n }\n return this;\n };\n _proto[\"delete\"] = function _delete(key) {\n var _this3 = this;\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: DELETE,\n object: this,\n name: key\n });\n if (!change) {\n return false;\n }\n }\n if (this.has_(key)) {\n var notifySpy = isSpyEnabled();\n var notify = hasListeners(this);\n var _change = notify || notifySpy ? {\n observableKind: \"map\",\n debugObjectName: this.name_,\n type: DELETE,\n object: this,\n oldValue: this.data_.get(key).value_,\n name: key\n } : null;\n if ( true && notifySpy) {\n spyReportStart(_change);\n } // TODO fix type\n transaction(function () {\n var _this3$hasMap_$get;\n _this3.keysAtom_.reportChanged();\n (_this3$hasMap_$get = _this3.hasMap_.get(key)) == null || _this3$hasMap_$get.setNewValue_(false);\n var observable = _this3.data_.get(key);\n observable.setNewValue_(undefined);\n _this3.data_[\"delete\"](key);\n });\n if (notify) {\n notifyListeners(this, _change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n return true;\n }\n return false;\n };\n _proto.updateValue_ = function updateValue_(key, newValue) {\n var observable = this.data_.get(key);\n newValue = observable.prepareNewValue_(newValue);\n if (newValue !== globalState.UNCHANGED) {\n var notifySpy = isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"map\",\n debugObjectName: this.name_,\n type: UPDATE,\n object: this,\n oldValue: observable.value_,\n name: key,\n newValue: newValue\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n } // TODO fix type\n observable.setNewValue_(newValue);\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n };\n _proto.addValue_ = function addValue_(key, newValue) {\n var _this4 = this;\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n transaction(function () {\n var _this4$hasMap_$get;\n var observable = new ObservableValue(newValue, _this4.enhancer_, true ? _this4.name_ + \".\" + stringifyKey(key) : 0, false);\n _this4.data_.set(key, observable);\n newValue = observable.value_; // value might have been changed\n (_this4$hasMap_$get = _this4.hasMap_.get(key)) == null || _this4$hasMap_$get.setNewValue_(true);\n _this4.keysAtom_.reportChanged();\n });\n var notifySpy = isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"map\",\n debugObjectName: this.name_,\n type: ADD,\n object: this,\n name: key,\n newValue: newValue\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n } // TODO fix type\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n };\n _proto.get = function get(key) {\n if (this.has(key)) {\n return this.dehanceValue_(this.data_.get(key).get());\n }\n return this.dehanceValue_(undefined);\n };\n _proto.dehanceValue_ = function dehanceValue_(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.keys = function keys() {\n this.keysAtom_.reportObserved();\n return this.data_.keys();\n };\n _proto.values = function values() {\n var self = this;\n var keys = this.keys();\n return makeIterable({\n next: function next() {\n var _keys$next = keys.next(),\n done = _keys$next.done,\n value = _keys$next.value;\n return {\n done: done,\n value: done ? undefined : self.get(value)\n };\n }\n });\n };\n _proto.entries = function entries() {\n var self = this;\n var keys = this.keys();\n return makeIterable({\n next: function next() {\n var _keys$next2 = keys.next(),\n done = _keys$next2.done,\n value = _keys$next2.value;\n return {\n done: done,\n value: done ? undefined : [value, self.get(value)]\n };\n }\n });\n };\n _proto[Symbol.iterator] = function () {\n return this.entries();\n };\n _proto.forEach = function forEach(callback, thisArg) {\n for (var _iterator = _createForOfIteratorHelperLoose(this), _step; !(_step = _iterator()).done;) {\n var _step$value = _step.value,\n key = _step$value[0],\n value = _step$value[1];\n callback.call(thisArg, value, key, this);\n }\n }\n /** Merge another object into this object, returns this. */;\n _proto.merge = function merge(other) {\n var _this5 = this;\n if (isObservableMap(other)) {\n other = new Map(other);\n }\n transaction(function () {\n if (isPlainObject(other)) {\n getPlainObjectKeys(other).forEach(function (key) {\n return _this5.set(key, other[key]);\n });\n } else if (Array.isArray(other)) {\n other.forEach(function (_ref) {\n var key = _ref[0],\n value = _ref[1];\n return _this5.set(key, value);\n });\n } else if (isES6Map(other)) {\n if (!isPlainES6Map(other)) {\n die(19, other);\n }\n other.forEach(function (value, key) {\n return _this5.set(key, value);\n });\n } else if (other !== null && other !== undefined) {\n die(20, other);\n }\n });\n return this;\n };\n _proto.clear = function clear() {\n var _this6 = this;\n transaction(function () {\n untracked(function () {\n for (var _iterator2 = _createForOfIteratorHelperLoose(_this6.keys()), _step2; !(_step2 = _iterator2()).done;) {\n var key = _step2.value;\n _this6[\"delete\"](key);\n }\n });\n });\n };\n _proto.replace = function replace(values) {\n var _this7 = this;\n // Implementation requirements:\n // - respect ordering of replacement map\n // - allow interceptors to run and potentially prevent individual operations\n // - don't recreate observables that already exist in original map (so we don't destroy existing subscriptions)\n // - don't _keysAtom.reportChanged if the keys of resulting map are indentical (order matters!)\n // - note that result map may differ from replacement map due to the interceptors\n transaction(function () {\n // Convert to map so we can do quick key lookups\n var replacementMap = convertToMap(values);\n var orderedData = new Map();\n // Used for optimization\n var keysReportChangedCalled = false;\n // Delete keys that don't exist in replacement map\n // if the key deletion is prevented by interceptor\n // add entry at the beginning of the result map\n for (var _iterator3 = _createForOfIteratorHelperLoose(_this7.data_.keys()), _step3; !(_step3 = _iterator3()).done;) {\n var key = _step3.value;\n // Concurrently iterating/deleting keys\n // iterator should handle this correctly\n if (!replacementMap.has(key)) {\n var deleted = _this7[\"delete\"](key);\n // Was the key removed?\n if (deleted) {\n // _keysAtom.reportChanged() was already called\n keysReportChangedCalled = true;\n } else {\n // Delete prevented by interceptor\n var value = _this7.data_.get(key);\n orderedData.set(key, value);\n }\n }\n }\n // Merge entries\n for (var _iterator4 = _createForOfIteratorHelperLoose(replacementMap.entries()), _step4; !(_step4 = _iterator4()).done;) {\n var _step4$value = _step4.value,\n _key = _step4$value[0],\n _value = _step4$value[1];\n // We will want to know whether a new key is added\n var keyExisted = _this7.data_.has(_key);\n // Add or update value\n _this7.set(_key, _value);\n // The addition could have been prevent by interceptor\n if (_this7.data_.has(_key)) {\n // The update could have been prevented by interceptor\n // and also we want to preserve existing values\n // so use value from _data map (instead of replacement map)\n var _value2 = _this7.data_.get(_key);\n orderedData.set(_key, _value2);\n // Was a new key added?\n if (!keyExisted) {\n // _keysAtom.reportChanged() was already called\n keysReportChangedCalled = true;\n }\n }\n }\n // Check for possible key order change\n if (!keysReportChangedCalled) {\n if (_this7.data_.size !== orderedData.size) {\n // If size differs, keys are definitely modified\n _this7.keysAtom_.reportChanged();\n } else {\n var iter1 = _this7.data_.keys();\n var iter2 = orderedData.keys();\n var next1 = iter1.next();\n var next2 = iter2.next();\n while (!next1.done) {\n if (next1.value !== next2.value) {\n _this7.keysAtom_.reportChanged();\n break;\n }\n next1 = iter1.next();\n next2 = iter2.next();\n }\n }\n }\n // Use correctly ordered map\n _this7.data_ = orderedData;\n });\n return this;\n };\n _proto.toString = function toString() {\n return \"[object ObservableMap]\";\n };\n _proto.toJSON = function toJSON() {\n return Array.from(this);\n };\n /**\n * Observes this object. Triggers for the events 'add', 'update' and 'delete'.\n * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe\n * for callback details\n */\n _proto.observe_ = function observe_(listener, fireImmediately) {\n if ( true && fireImmediately === true) {\n die(\"`observe` doesn't support fireImmediately=true in combination with maps.\");\n }\n return registerListener(this, listener);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n return _createClass(ObservableMap, [{\n key: \"size\",\n get: function get() {\n this.keysAtom_.reportObserved();\n return this.data_.size;\n }\n }, {\n key: Symbol.toStringTag,\n get: function get() {\n return \"Map\";\n }\n }]);\n}();\n// eslint-disable-next-line\nvar isObservableMap = /*#__PURE__*/createInstanceofPredicate(\"ObservableMap\", ObservableMap);\nfunction convertToMap(dataStructure) {\n if (isES6Map(dataStructure) || isObservableMap(dataStructure)) {\n return dataStructure;\n } else if (Array.isArray(dataStructure)) {\n return new Map(dataStructure);\n } else if (isPlainObject(dataStructure)) {\n var map = new Map();\n for (var key in dataStructure) {\n map.set(key, dataStructure[key]);\n }\n return map;\n } else {\n return die(21, dataStructure);\n }\n}\n\nvar ObservableSetMarker = {};\nvar ObservableSet = /*#__PURE__*/function () {\n function ObservableSet(initialData, enhancer, name_) {\n var _this = this;\n if (enhancer === void 0) {\n enhancer = deepEnhancer;\n }\n if (name_ === void 0) {\n name_ = true ? \"ObservableSet@\" + getNextId() : 0;\n }\n this.name_ = void 0;\n this[$mobx] = ObservableSetMarker;\n this.data_ = new Set();\n this.atom_ = void 0;\n this.changeListeners_ = void 0;\n this.interceptors_ = void 0;\n this.dehancer = void 0;\n this.enhancer_ = void 0;\n this.name_ = name_;\n if (!isFunction(Set)) {\n die(22);\n }\n this.enhancer_ = function (newV, oldV) {\n return enhancer(newV, oldV, name_);\n };\n initObservable(function () {\n _this.atom_ = createAtom(_this.name_);\n if (initialData) {\n _this.replace(initialData);\n }\n });\n }\n var _proto = ObservableSet.prototype;\n _proto.dehanceValue_ = function dehanceValue_(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.clear = function clear() {\n var _this2 = this;\n transaction(function () {\n untracked(function () {\n for (var _iterator = _createForOfIteratorHelperLoose(_this2.data_.values()), _step; !(_step = _iterator()).done;) {\n var value = _step.value;\n _this2[\"delete\"](value);\n }\n });\n });\n };\n _proto.forEach = function forEach(callbackFn, thisArg) {\n for (var _iterator2 = _createForOfIteratorHelperLoose(this), _step2; !(_step2 = _iterator2()).done;) {\n var value = _step2.value;\n callbackFn.call(thisArg, value, value, this);\n }\n };\n _proto.add = function add(value) {\n var _this3 = this;\n checkIfStateModificationsAreAllowed(this.atom_);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: ADD,\n object: this,\n newValue: value\n });\n if (!change) {\n return this;\n }\n // ideally, value = change.value would be done here, so that values can be\n // changed by interceptor. Same applies for other Set and Map api's.\n }\n if (!this.has(value)) {\n transaction(function () {\n _this3.data_.add(_this3.enhancer_(value, undefined));\n _this3.atom_.reportChanged();\n });\n var notifySpy = true && isSpyEnabled();\n var notify = hasListeners(this);\n var _change = notify || notifySpy ? {\n observableKind: \"set\",\n debugObjectName: this.name_,\n type: ADD,\n object: this,\n newValue: value\n } : null;\n if (notifySpy && \"development\" !== \"production\") {\n spyReportStart(_change);\n }\n if (notify) {\n notifyListeners(this, _change);\n }\n if (notifySpy && \"development\" !== \"production\") {\n spyReportEnd();\n }\n }\n return this;\n };\n _proto[\"delete\"] = function _delete(value) {\n var _this4 = this;\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: DELETE,\n object: this,\n oldValue: value\n });\n if (!change) {\n return false;\n }\n }\n if (this.has(value)) {\n var notifySpy = true && isSpyEnabled();\n var notify = hasListeners(this);\n var _change2 = notify || notifySpy ? {\n observableKind: \"set\",\n debugObjectName: this.name_,\n type: DELETE,\n object: this,\n oldValue: value\n } : null;\n if (notifySpy && \"development\" !== \"production\") {\n spyReportStart(_change2);\n }\n transaction(function () {\n _this4.atom_.reportChanged();\n _this4.data_[\"delete\"](value);\n });\n if (notify) {\n notifyListeners(this, _change2);\n }\n if (notifySpy && \"development\" !== \"production\") {\n spyReportEnd();\n }\n return true;\n }\n return false;\n };\n _proto.has = function has(value) {\n this.atom_.reportObserved();\n return this.data_.has(this.dehanceValue_(value));\n };\n _proto.entries = function entries() {\n var nextIndex = 0;\n var keys = Array.from(this.keys());\n var values = Array.from(this.values());\n return makeIterable({\n next: function next() {\n var index = nextIndex;\n nextIndex += 1;\n return index < values.length ? {\n value: [keys[index], values[index]],\n done: false\n } : {\n done: true\n };\n }\n });\n };\n _proto.keys = function keys() {\n return this.values();\n };\n _proto.values = function values() {\n this.atom_.reportObserved();\n var self = this;\n var nextIndex = 0;\n var observableValues = Array.from(this.data_.values());\n return makeIterable({\n next: function next() {\n return nextIndex < observableValues.length ? {\n value: self.dehanceValue_(observableValues[nextIndex++]),\n done: false\n } : {\n done: true\n };\n }\n });\n };\n _proto.intersection = function intersection(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.intersection(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.intersection(otherSet);\n }\n };\n _proto.union = function union(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.union(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.union(otherSet);\n }\n };\n _proto.difference = function difference(otherSet) {\n return new Set(this).difference(otherSet);\n };\n _proto.symmetricDifference = function symmetricDifference(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.symmetricDifference(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.symmetricDifference(otherSet);\n }\n };\n _proto.isSubsetOf = function isSubsetOf(otherSet) {\n return new Set(this).isSubsetOf(otherSet);\n };\n _proto.isSupersetOf = function isSupersetOf(otherSet) {\n return new Set(this).isSupersetOf(otherSet);\n };\n _proto.isDisjointFrom = function isDisjointFrom(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.isDisjointFrom(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.isDisjointFrom(otherSet);\n }\n };\n _proto.replace = function replace(other) {\n var _this5 = this;\n if (isObservableSet(other)) {\n other = new Set(other);\n }\n transaction(function () {\n if (Array.isArray(other)) {\n _this5.clear();\n other.forEach(function (value) {\n return _this5.add(value);\n });\n } else if (isES6Set(other)) {\n _this5.clear();\n other.forEach(function (value) {\n return _this5.add(value);\n });\n } else if (other !== null && other !== undefined) {\n die(\"Cannot initialize set from \" + other);\n }\n });\n return this;\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n // ... 'fireImmediately' could also be true?\n if ( true && fireImmediately === true) {\n die(\"`observe` doesn't support fireImmediately=true in combination with sets.\");\n }\n return registerListener(this, listener);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.toJSON = function toJSON() {\n return Array.from(this);\n };\n _proto.toString = function toString() {\n return \"[object ObservableSet]\";\n };\n _proto[Symbol.iterator] = function () {\n return this.values();\n };\n return _createClass(ObservableSet, [{\n key: \"size\",\n get: function get() {\n this.atom_.reportObserved();\n return this.data_.size;\n }\n }, {\n key: Symbol.toStringTag,\n get: function get() {\n return \"Set\";\n }\n }]);\n}();\n// eslint-disable-next-line\nvar isObservableSet = /*#__PURE__*/createInstanceofPredicate(\"ObservableSet\", ObservableSet);\n\nvar descriptorCache = /*#__PURE__*/Object.create(null);\nvar REMOVE = \"remove\";\nvar ObservableObjectAdministration = /*#__PURE__*/function () {\n function ObservableObjectAdministration(target_, values_, name_,\n // Used anytime annotation is not explicitely provided\n defaultAnnotation_) {\n if (values_ === void 0) {\n values_ = new Map();\n }\n if (defaultAnnotation_ === void 0) {\n defaultAnnotation_ = autoAnnotation;\n }\n this.target_ = void 0;\n this.values_ = void 0;\n this.name_ = void 0;\n this.defaultAnnotation_ = void 0;\n this.keysAtom_ = void 0;\n this.changeListeners_ = void 0;\n this.interceptors_ = void 0;\n this.proxy_ = void 0;\n this.isPlainObject_ = void 0;\n this.appliedAnnotations_ = void 0;\n this.pendingKeys_ = void 0;\n this.target_ = target_;\n this.values_ = values_;\n this.name_ = name_;\n this.defaultAnnotation_ = defaultAnnotation_;\n this.keysAtom_ = new Atom( true ? this.name_ + \".keys\" : 0);\n // Optimization: we use this frequently\n this.isPlainObject_ = isPlainObject(this.target_);\n if ( true && !isAnnotation(this.defaultAnnotation_)) {\n die(\"defaultAnnotation must be valid annotation\");\n }\n if (true) {\n // Prepare structure for tracking which fields were already annotated\n this.appliedAnnotations_ = {};\n }\n }\n var _proto = ObservableObjectAdministration.prototype;\n _proto.getObservablePropValue_ = function getObservablePropValue_(key) {\n return this.values_.get(key).get();\n };\n _proto.setObservablePropValue_ = function setObservablePropValue_(key, newValue) {\n var observable = this.values_.get(key);\n if (observable instanceof ComputedValue) {\n observable.set(newValue);\n return true;\n }\n // intercept\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: UPDATE,\n object: this.proxy_ || this.target_,\n name: key,\n newValue: newValue\n });\n if (!change) {\n return null;\n }\n newValue = change.newValue;\n }\n newValue = observable.prepareNewValue_(newValue);\n // notify spy & observers\n if (newValue !== globalState.UNCHANGED) {\n var notify = hasListeners(this);\n var notifySpy = true && isSpyEnabled();\n var _change = notify || notifySpy ? {\n type: UPDATE,\n observableKind: \"object\",\n debugObjectName: this.name_,\n object: this.proxy_ || this.target_,\n oldValue: observable.value_,\n name: key,\n newValue: newValue\n } : null;\n if ( true && notifySpy) {\n spyReportStart(_change);\n }\n observable.setNewValue_(newValue);\n if (notify) {\n notifyListeners(this, _change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n return true;\n };\n _proto.get_ = function get_(key) {\n if (globalState.trackingDerivation && !hasProp(this.target_, key)) {\n // Key doesn't exist yet, subscribe for it in case it's added later\n this.has_(key);\n }\n return this.target_[key];\n }\n /**\n * @param {PropertyKey} key\n * @param {any} value\n * @param {Annotation|boolean} annotation true - use default annotation, false - copy as is\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.set_ = function set_(key, value, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n // Don't use .has(key) - we care about own\n if (hasProp(this.target_, key)) {\n // Existing prop\n if (this.values_.has(key)) {\n // Observable (can be intercepted)\n return this.setObservablePropValue_(key, value);\n } else if (proxyTrap) {\n // Non-observable - proxy\n return Reflect.set(this.target_, key, value);\n } else {\n // Non-observable\n this.target_[key] = value;\n return true;\n }\n } else {\n // New prop\n return this.extend_(key, {\n value: value,\n enumerable: true,\n writable: true,\n configurable: true\n }, this.defaultAnnotation_, proxyTrap);\n }\n }\n // Trap for \"in\"\n ;\n _proto.has_ = function has_(key) {\n if (!globalState.trackingDerivation) {\n // Skip key subscription outside derivation\n return key in this.target_;\n }\n this.pendingKeys_ || (this.pendingKeys_ = new Map());\n var entry = this.pendingKeys_.get(key);\n if (!entry) {\n entry = new ObservableValue(key in this.target_, referenceEnhancer, true ? this.name_ + \".\" + stringifyKey(key) + \"?\" : 0, false);\n this.pendingKeys_.set(key, entry);\n }\n return entry.get();\n }\n /**\n * @param {PropertyKey} key\n * @param {Annotation|boolean} annotation true - use default annotation, false - ignore prop\n */;\n _proto.make_ = function make_(key, annotation) {\n if (annotation === true) {\n annotation = this.defaultAnnotation_;\n }\n if (annotation === false) {\n return;\n }\n assertAnnotable(this, annotation, key);\n if (!(key in this.target_)) {\n var _this$target_$storedA;\n // Throw on missing key, except for decorators:\n // Decorator annotations are collected from whole prototype chain.\n // When called from super() some props may not exist yet.\n // However we don't have to worry about missing prop,\n // because the decorator must have been applied to something.\n if ((_this$target_$storedA = this.target_[storedAnnotationsSymbol]) != null && _this$target_$storedA[key]) {\n return; // will be annotated by subclass constructor\n } else {\n die(1, annotation.annotationType_, this.name_ + \".\" + key.toString());\n }\n }\n var source = this.target_;\n while (source && source !== objectPrototype) {\n var descriptor = getDescriptor(source, key);\n if (descriptor) {\n var outcome = annotation.make_(this, key, descriptor, source);\n if (outcome === 0 /* MakeResult.Cancel */) {\n return;\n }\n if (outcome === 1 /* MakeResult.Break */) {\n break;\n }\n }\n source = Object.getPrototypeOf(source);\n }\n recordAnnotationApplied(this, annotation, key);\n }\n /**\n * @param {PropertyKey} key\n * @param {PropertyDescriptor} descriptor\n * @param {Annotation|boolean} annotation true - use default annotation, false - copy as is\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.extend_ = function extend_(key, descriptor, annotation, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n if (annotation === true) {\n annotation = this.defaultAnnotation_;\n }\n if (annotation === false) {\n return this.defineProperty_(key, descriptor, proxyTrap);\n }\n assertAnnotable(this, annotation, key);\n var outcome = annotation.extend_(this, key, descriptor, proxyTrap);\n if (outcome) {\n recordAnnotationApplied(this, annotation, key);\n }\n return outcome;\n }\n /**\n * @param {PropertyKey} key\n * @param {PropertyDescriptor} descriptor\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.defineProperty_ = function defineProperty_(key, descriptor, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n try {\n startBatch();\n // Delete\n var deleteOutcome = this.delete_(key);\n if (!deleteOutcome) {\n // Failure or intercepted\n return deleteOutcome;\n }\n // ADD interceptor\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: ADD,\n newValue: descriptor.value\n });\n if (!change) {\n return null;\n }\n var newValue = change.newValue;\n if (descriptor.value !== newValue) {\n descriptor = _extends({}, descriptor, {\n value: newValue\n });\n }\n }\n // Define\n if (proxyTrap) {\n if (!Reflect.defineProperty(this.target_, key, descriptor)) {\n return false;\n }\n } else {\n defineProperty(this.target_, key, descriptor);\n }\n // Notify\n this.notifyPropertyAddition_(key, descriptor.value);\n } finally {\n endBatch();\n }\n return true;\n }\n // If original descriptor becomes relevant, move this to annotation directly\n ;\n _proto.defineObservableProperty_ = function defineObservableProperty_(key, value, enhancer, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n try {\n startBatch();\n // Delete\n var deleteOutcome = this.delete_(key);\n if (!deleteOutcome) {\n // Failure or intercepted\n return deleteOutcome;\n }\n // ADD interceptor\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: ADD,\n newValue: value\n });\n if (!change) {\n return null;\n }\n value = change.newValue;\n }\n var cachedDescriptor = getCachedObservablePropDescriptor(key);\n var descriptor = {\n configurable: globalState.safeDescriptors ? this.isPlainObject_ : true,\n enumerable: true,\n get: cachedDescriptor.get,\n set: cachedDescriptor.set\n };\n // Define\n if (proxyTrap) {\n if (!Reflect.defineProperty(this.target_, key, descriptor)) {\n return false;\n }\n } else {\n defineProperty(this.target_, key, descriptor);\n }\n var observable = new ObservableValue(value, enhancer, true ? this.name_ + \".\" + key.toString() : 0, false);\n this.values_.set(key, observable);\n // Notify (value possibly changed by ObservableValue)\n this.notifyPropertyAddition_(key, observable.value_);\n } finally {\n endBatch();\n }\n return true;\n }\n // If original descriptor becomes relevant, move this to annotation directly\n ;\n _proto.defineComputedProperty_ = function defineComputedProperty_(key, options, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n try {\n startBatch();\n // Delete\n var deleteOutcome = this.delete_(key);\n if (!deleteOutcome) {\n // Failure or intercepted\n return deleteOutcome;\n }\n // ADD interceptor\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: ADD,\n newValue: undefined\n });\n if (!change) {\n return null;\n }\n }\n options.name || (options.name = true ? this.name_ + \".\" + key.toString() : 0);\n options.context = this.proxy_ || this.target_;\n var cachedDescriptor = getCachedObservablePropDescriptor(key);\n var descriptor = {\n configurable: globalState.safeDescriptors ? this.isPlainObject_ : true,\n enumerable: false,\n get: cachedDescriptor.get,\n set: cachedDescriptor.set\n };\n // Define\n if (proxyTrap) {\n if (!Reflect.defineProperty(this.target_, key, descriptor)) {\n return false;\n }\n } else {\n defineProperty(this.target_, key, descriptor);\n }\n this.values_.set(key, new ComputedValue(options));\n // Notify\n this.notifyPropertyAddition_(key, undefined);\n } finally {\n endBatch();\n }\n return true;\n }\n /**\n * @param {PropertyKey} key\n * @param {PropertyDescriptor} descriptor\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.delete_ = function delete_(key, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n // No such prop\n if (!hasProp(this.target_, key)) {\n return true;\n }\n // Intercept\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: REMOVE\n });\n // Cancelled\n if (!change) {\n return null;\n }\n }\n // Delete\n try {\n var _this$pendingKeys_;\n startBatch();\n var notify = hasListeners(this);\n var notifySpy = true && isSpyEnabled();\n var observable = this.values_.get(key);\n // Value needed for spies/listeners\n var value = undefined;\n // Optimization: don't pull the value unless we will need it\n if (!observable && (notify || notifySpy)) {\n var _getDescriptor;\n value = (_getDescriptor = getDescriptor(this.target_, key)) == null ? void 0 : _getDescriptor.value;\n }\n // delete prop (do first, may fail)\n if (proxyTrap) {\n if (!Reflect.deleteProperty(this.target_, key)) {\n return false;\n }\n } else {\n delete this.target_[key];\n }\n // Allow re-annotating this field\n if (true) {\n delete this.appliedAnnotations_[key];\n }\n // Clear observable\n if (observable) {\n this.values_[\"delete\"](key);\n // for computed, value is undefined\n if (observable instanceof ObservableValue) {\n value = observable.value_;\n }\n // Notify: autorun(() => obj[key]), see #1796\n propagateChanged(observable);\n }\n // Notify \"keys/entries/values\" observers\n this.keysAtom_.reportChanged();\n // Notify \"has\" observers\n // \"in\" as it may still exist in proto\n (_this$pendingKeys_ = this.pendingKeys_) == null || (_this$pendingKeys_ = _this$pendingKeys_.get(key)) == null || _this$pendingKeys_.set(key in this.target_);\n // Notify spies/listeners\n if (notify || notifySpy) {\n var _change2 = {\n type: REMOVE,\n observableKind: \"object\",\n object: this.proxy_ || this.target_,\n debugObjectName: this.name_,\n oldValue: value,\n name: key\n };\n if ( true && notifySpy) {\n spyReportStart(_change2);\n }\n if (notify) {\n notifyListeners(this, _change2);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n } finally {\n endBatch();\n }\n return true;\n }\n /**\n * Observes this object. Triggers for the events 'add', 'update' and 'delete'.\n * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe\n * for callback details\n */;\n _proto.observe_ = function observe_(callback, fireImmediately) {\n if ( true && fireImmediately === true) {\n die(\"`observe` doesn't support the fire immediately property for observable objects.\");\n }\n return registerListener(this, callback);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.notifyPropertyAddition_ = function notifyPropertyAddition_(key, value) {\n var _this$pendingKeys_2;\n var notify = hasListeners(this);\n var notifySpy = true && isSpyEnabled();\n if (notify || notifySpy) {\n var change = notify || notifySpy ? {\n type: ADD,\n observableKind: \"object\",\n debugObjectName: this.name_,\n object: this.proxy_ || this.target_,\n name: key,\n newValue: value\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n }\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n (_this$pendingKeys_2 = this.pendingKeys_) == null || (_this$pendingKeys_2 = _this$pendingKeys_2.get(key)) == null || _this$pendingKeys_2.set(true);\n // Notify \"keys/entries/values\" observers\n this.keysAtom_.reportChanged();\n };\n _proto.ownKeys_ = function ownKeys_() {\n this.keysAtom_.reportObserved();\n return ownKeys(this.target_);\n };\n _proto.keys_ = function keys_() {\n // Returns enumerable && own, but unfortunately keysAtom will report on ANY key change.\n // There is no way to distinguish between Object.keys(object) and Reflect.ownKeys(object) - both are handled by ownKeys trap.\n // We can either over-report in Object.keys(object) or under-report in Reflect.ownKeys(object)\n // We choose to over-report in Object.keys(object), because:\n // - typically it's used with simple data objects\n // - when symbolic/non-enumerable keys are relevant Reflect.ownKeys works as expected\n this.keysAtom_.reportObserved();\n return Object.keys(this.target_);\n };\n return ObservableObjectAdministration;\n}();\nfunction asObservableObject(target, options) {\n var _options$name;\n if ( true && options && isObservableObject(target)) {\n die(\"Options can't be provided for already observable objects.\");\n }\n if (hasProp(target, $mobx)) {\n if ( true && !(getAdministration(target) instanceof ObservableObjectAdministration)) {\n die(\"Cannot convert '\" + getDebugName(target) + \"' into observable object:\" + \"\\nThe target is already observable of different type.\" + \"\\nExtending builtins is not supported.\");\n }\n return target;\n }\n if ( true && !Object.isExtensible(target)) {\n die(\"Cannot make the designated object observable; it is not extensible\");\n }\n var name = (_options$name = options == null ? void 0 : options.name) != null ? _options$name : true ? (isPlainObject(target) ? \"ObservableObject\" : target.constructor.name) + \"@\" + getNextId() : 0;\n var adm = new ObservableObjectAdministration(target, new Map(), String(name), getAnnotationFromOptions(options));\n addHiddenProp(target, $mobx, adm);\n return target;\n}\nvar isObservableObjectAdministration = /*#__PURE__*/createInstanceofPredicate(\"ObservableObjectAdministration\", ObservableObjectAdministration);\nfunction getCachedObservablePropDescriptor(key) {\n return descriptorCache[key] || (descriptorCache[key] = {\n get: function get() {\n return this[$mobx].getObservablePropValue_(key);\n },\n set: function set(value) {\n return this[$mobx].setObservablePropValue_(key, value);\n }\n });\n}\nfunction isObservableObject(thing) {\n if (isObject(thing)) {\n return isObservableObjectAdministration(thing[$mobx]);\n }\n return false;\n}\nfunction recordAnnotationApplied(adm, annotation, key) {\n var _adm$target_$storedAn;\n if (true) {\n adm.appliedAnnotations_[key] = annotation;\n }\n // Remove applied decorator annotation so we don't try to apply it again in subclass constructor\n (_adm$target_$storedAn = adm.target_[storedAnnotationsSymbol]) == null || delete _adm$target_$storedAn[key];\n}\nfunction assertAnnotable(adm, annotation, key) {\n // Valid annotation\n if ( true && !isAnnotation(annotation)) {\n die(\"Cannot annotate '\" + adm.name_ + \".\" + key.toString() + \"': Invalid annotation.\");\n }\n /*\n // Configurable, not sealed, not frozen\n // Possibly not needed, just a little better error then the one thrown by engine.\n // Cases where this would be useful the most (subclass field initializer) are not interceptable by this.\n if (__DEV__) {\n const configurable = getDescriptor(adm.target_, key)?.configurable\n const frozen = Object.isFrozen(adm.target_)\n const sealed = Object.isSealed(adm.target_)\n if (!configurable || frozen || sealed) {\n const fieldName = `${adm.name_}.${key.toString()}`\n const requestedAnnotationType = annotation.annotationType_\n let error = `Cannot apply '${requestedAnnotationType}' to '${fieldName}':`\n if (frozen) {\n error += `\\nObject is frozen.`\n }\n if (sealed) {\n error += `\\nObject is sealed.`\n }\n if (!configurable) {\n error += `\\nproperty is not configurable.`\n // Mention only if caused by us to avoid confusion\n if (hasProp(adm.appliedAnnotations!, key)) {\n error += `\\nTo prevent accidental re-definition of a field by a subclass, `\n error += `all annotated fields of non-plain objects (classes) are not configurable.`\n }\n }\n die(error)\n }\n }\n */\n // Not annotated\n if ( true && !isOverride(annotation) && hasProp(adm.appliedAnnotations_, key)) {\n var fieldName = adm.name_ + \".\" + key.toString();\n var currentAnnotationType = adm.appliedAnnotations_[key].annotationType_;\n var requestedAnnotationType = annotation.annotationType_;\n die(\"Cannot apply '\" + requestedAnnotationType + \"' to '\" + fieldName + \"':\" + (\"\\nThe field is already annotated with '\" + currentAnnotationType + \"'.\") + \"\\nRe-annotating fields is not allowed.\" + \"\\nUse 'override' annotation for methods overridden by subclass.\");\n }\n}\n\n// Bug in safari 9.* (or iOS 9 safari mobile). See #364\nvar ENTRY_0 = /*#__PURE__*/createArrayEntryDescriptor(0);\nvar safariPrototypeSetterInheritanceBug = /*#__PURE__*/function () {\n var v = false;\n var p = {};\n Object.defineProperty(p, \"0\", {\n set: function set() {\n v = true;\n }\n });\n /*#__PURE__*/Object.create(p)[\"0\"] = 1;\n return v === false;\n}();\n/**\n * This array buffer contains two lists of properties, so that all arrays\n * can recycle their property definitions, which significantly improves performance of creating\n * properties on the fly.\n */\nvar OBSERVABLE_ARRAY_BUFFER_SIZE = 0;\n// Typescript workaround to make sure ObservableArray extends Array\nvar StubArray = function StubArray() {};\nfunction inherit(ctor, proto) {\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(ctor.prototype, proto);\n } else if (ctor.prototype.__proto__ !== undefined) {\n ctor.prototype.__proto__ = proto;\n } else {\n ctor.prototype = proto;\n }\n}\ninherit(StubArray, Array.prototype);\n// Weex proto freeze protection was here,\n// but it is unclear why the hack is need as MobX never changed the prototype\n// anyway, so removed it in V6\nvar LegacyObservableArray = /*#__PURE__*/function (_StubArray) {\n function LegacyObservableArray(initialValues, enhancer, name, owned) {\n var _this;\n if (name === void 0) {\n name = true ? \"ObservableArray@\" + getNextId() : 0;\n }\n if (owned === void 0) {\n owned = false;\n }\n _this = _StubArray.call(this) || this;\n initObservable(function () {\n var adm = new ObservableArrayAdministration(name, enhancer, owned, true);\n adm.proxy_ = _this;\n addHiddenFinalProp(_this, $mobx, adm);\n if (initialValues && initialValues.length) {\n // @ts-ignore\n _this.spliceWithArray(0, 0, initialValues);\n }\n if (safariPrototypeSetterInheritanceBug) {\n // Seems that Safari won't use numeric prototype setter until any * numeric property is\n // defined on the instance. After that it works fine, even if this property is deleted.\n Object.defineProperty(_this, \"0\", ENTRY_0);\n }\n });\n return _this;\n }\n _inheritsLoose(LegacyObservableArray, _StubArray);\n var _proto = LegacyObservableArray.prototype;\n _proto.concat = function concat() {\n this[$mobx].atom_.reportObserved();\n for (var _len = arguments.length, arrays = new Array(_len), _key = 0; _key < _len; _key++) {\n arrays[_key] = arguments[_key];\n }\n return Array.prototype.concat.apply(this.slice(),\n //@ts-ignore\n arrays.map(function (a) {\n return isObservableArray(a) ? a.slice() : a;\n }));\n };\n _proto[Symbol.iterator] = function () {\n var self = this;\n var nextIndex = 0;\n return makeIterable({\n next: function next() {\n return nextIndex < self.length ? {\n value: self[nextIndex++],\n done: false\n } : {\n done: true,\n value: undefined\n };\n }\n });\n };\n return _createClass(LegacyObservableArray, [{\n key: \"length\",\n get: function get() {\n return this[$mobx].getArrayLength_();\n },\n set: function set(newLength) {\n this[$mobx].setArrayLength_(newLength);\n }\n }, {\n key: Symbol.toStringTag,\n get: function get() {\n return \"Array\";\n }\n }]);\n}(StubArray);\nObject.entries(arrayExtensions).forEach(function (_ref) {\n var prop = _ref[0],\n fn = _ref[1];\n if (prop !== \"concat\") {\n addHiddenProp(LegacyObservableArray.prototype, prop, fn);\n }\n});\nfunction createArrayEntryDescriptor(index) {\n return {\n enumerable: false,\n configurable: true,\n get: function get() {\n return this[$mobx].get_(index);\n },\n set: function set(value) {\n this[$mobx].set_(index, value);\n }\n };\n}\nfunction createArrayBufferItem(index) {\n defineProperty(LegacyObservableArray.prototype, \"\" + index, createArrayEntryDescriptor(index));\n}\nfunction reserveArrayBuffer(max) {\n if (max > OBSERVABLE_ARRAY_BUFFER_SIZE) {\n for (var index = OBSERVABLE_ARRAY_BUFFER_SIZE; index < max + 100; index++) {\n createArrayBufferItem(index);\n }\n OBSERVABLE_ARRAY_BUFFER_SIZE = max;\n }\n}\nreserveArrayBuffer(1000);\nfunction createLegacyArray(initialValues, enhancer, name) {\n return new LegacyObservableArray(initialValues, enhancer, name);\n}\n\nfunction getAtom(thing, property) {\n if (typeof thing === \"object\" && thing !== null) {\n if (isObservableArray(thing)) {\n if (property !== undefined) {\n die(23);\n }\n return thing[$mobx].atom_;\n }\n if (isObservableSet(thing)) {\n return thing.atom_;\n }\n if (isObservableMap(thing)) {\n if (property === undefined) {\n return thing.keysAtom_;\n }\n var observable = thing.data_.get(property) || thing.hasMap_.get(property);\n if (!observable) {\n die(25, property, getDebugName(thing));\n }\n return observable;\n }\n if (isObservableObject(thing)) {\n if (!property) {\n return die(26);\n }\n var _observable = thing[$mobx].values_.get(property);\n if (!_observable) {\n die(27, property, getDebugName(thing));\n }\n return _observable;\n }\n if (isAtom(thing) || isComputedValue(thing) || isReaction(thing)) {\n return thing;\n }\n } else if (isFunction(thing)) {\n if (isReaction(thing[$mobx])) {\n // disposer function\n return thing[$mobx];\n }\n }\n die(28);\n}\nfunction getAdministration(thing, property) {\n if (!thing) {\n die(29);\n }\n if (property !== undefined) {\n return getAdministration(getAtom(thing, property));\n }\n if (isAtom(thing) || isComputedValue(thing) || isReaction(thing)) {\n return thing;\n }\n if (isObservableMap(thing) || isObservableSet(thing)) {\n return thing;\n }\n if (thing[$mobx]) {\n return thing[$mobx];\n }\n die(24, thing);\n}\nfunction getDebugName(thing, property) {\n var named;\n if (property !== undefined) {\n named = getAtom(thing, property);\n } else if (isAction(thing)) {\n return thing.name;\n } else if (isObservableObject(thing) || isObservableMap(thing) || isObservableSet(thing)) {\n named = getAdministration(thing);\n } else {\n // valid for arrays as well\n named = getAtom(thing);\n }\n return named.name_;\n}\n/**\n * Helper function for initializing observable structures, it applies:\n * 1. allowStateChanges so we don't violate enforceActions.\n * 2. untracked so we don't accidentaly subscribe to anything observable accessed during init in case the observable is created inside derivation.\n * 3. batch to avoid state version updates\n */\nfunction initObservable(cb) {\n var derivation = untrackedStart();\n var allowStateChanges = allowStateChangesStart(true);\n startBatch();\n try {\n return cb();\n } finally {\n endBatch();\n allowStateChangesEnd(allowStateChanges);\n untrackedEnd(derivation);\n }\n}\n\nvar toString = objectPrototype.toString;\nfunction deepEqual(a, b, depth) {\n if (depth === void 0) {\n depth = -1;\n }\n return eq(a, b, depth);\n}\n// Copied from https://github.com/jashkenas/underscore/blob/5c237a7c682fb68fd5378203f0bf22dce1624854/underscore.js#L1186-L1289\n// Internal recursive comparison function for `isEqual`.\nfunction eq(a, b, depth, aStack, bStack) {\n // Identical objects are equal. `0 === -0`, but they aren't identical.\n // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).\n if (a === b) {\n return a !== 0 || 1 / a === 1 / b;\n }\n // `null` or `undefined` only equal to itself (strict comparison).\n if (a == null || b == null) {\n return false;\n }\n // `NaN`s are equivalent, but non-reflexive.\n if (a !== a) {\n return b !== b;\n }\n // Exhaust primitive checks\n var type = typeof a;\n if (type !== \"function\" && type !== \"object\" && typeof b != \"object\") {\n return false;\n }\n // Compare `[[Class]]` names.\n var className = toString.call(a);\n if (className !== toString.call(b)) {\n return false;\n }\n switch (className) {\n // Strings, numbers, regular expressions, dates, and booleans are compared by value.\n case \"[object RegExp]\":\n // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i')\n case \"[object String]\":\n // Primitives and their corresponding object wrappers are equivalent; thus, `\"5\"` is\n // equivalent to `new String(\"5\")`.\n return \"\" + a === \"\" + b;\n case \"[object Number]\":\n // `NaN`s are equivalent, but non-reflexive.\n // Object(NaN) is equivalent to NaN.\n if (+a !== +a) {\n return +b !== +b;\n }\n // An `egal` comparison is performed for other numeric values.\n return +a === 0 ? 1 / +a === 1 / b : +a === +b;\n case \"[object Date]\":\n case \"[object Boolean]\":\n // Coerce dates and booleans to numeric primitive values. Dates are compared by their\n // millisecond representations. Note that invalid dates with millisecond representations\n // of `NaN` are not equivalent.\n return +a === +b;\n case \"[object Symbol]\":\n return typeof Symbol !== \"undefined\" && Symbol.valueOf.call(a) === Symbol.valueOf.call(b);\n case \"[object Map]\":\n case \"[object Set]\":\n // Maps and Sets are unwrapped to arrays of entry-pairs, adding an incidental level.\n // Hide this extra level by increasing the depth.\n if (depth >= 0) {\n depth++;\n }\n break;\n }\n // Unwrap any wrapped objects.\n a = unwrap(a);\n b = unwrap(b);\n var areArrays = className === \"[object Array]\";\n if (!areArrays) {\n if (typeof a != \"object\" || typeof b != \"object\") {\n return false;\n }\n // Objects with different constructors are not equivalent, but `Object`s or `Array`s\n // from different frames are.\n var aCtor = a.constructor,\n bCtor = b.constructor;\n if (aCtor !== bCtor && !(isFunction(aCtor) && aCtor instanceof aCtor && isFunction(bCtor) && bCtor instanceof bCtor) && \"constructor\" in a && \"constructor\" in b) {\n return false;\n }\n }\n if (depth === 0) {\n return false;\n } else if (depth < 0) {\n depth = -1;\n }\n // Assume equality for cyclic structures. The algorithm for detecting cyclic\n // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.\n // Initializing stack of traversed objects.\n // It's done here since we only need them for objects and arrays comparison.\n aStack = aStack || [];\n bStack = bStack || [];\n var length = aStack.length;\n while (length--) {\n // Linear search. Performance is inversely proportional to the number of\n // unique nested structures.\n if (aStack[length] === a) {\n return bStack[length] === b;\n }\n }\n // Add the first object to the stack of traversed objects.\n aStack.push(a);\n bStack.push(b);\n // Recursively compare objects and arrays.\n if (areArrays) {\n // Compare array lengths to determine if a deep comparison is necessary.\n length = a.length;\n if (length !== b.length) {\n return false;\n }\n // Deep compare the contents, ignoring non-numeric properties.\n while (length--) {\n if (!eq(a[length], b[length], depth - 1, aStack, bStack)) {\n return false;\n }\n }\n } else {\n // Deep compare objects.\n var keys = Object.keys(a);\n var key;\n length = keys.length;\n // Ensure that both objects contain the same number of properties before comparing deep equality.\n if (Object.keys(b).length !== length) {\n return false;\n }\n while (length--) {\n // Deep compare each member\n key = keys[length];\n if (!(hasProp(b, key) && eq(a[key], b[key], depth - 1, aStack, bStack))) {\n return false;\n }\n }\n }\n // Remove the first object from the stack of traversed objects.\n aStack.pop();\n bStack.pop();\n return true;\n}\nfunction unwrap(a) {\n if (isObservableArray(a)) {\n return a.slice();\n }\n if (isES6Map(a) || isObservableMap(a)) {\n return Array.from(a.entries());\n }\n if (isES6Set(a) || isObservableSet(a)) {\n return Array.from(a.entries());\n }\n return a;\n}\n\nfunction makeIterable(iterator) {\n iterator[Symbol.iterator] = getSelf;\n return iterator;\n}\nfunction getSelf() {\n return this;\n}\n\nfunction isAnnotation(thing) {\n return (\n // Can be function\n thing instanceof Object && typeof thing.annotationType_ === \"string\" && isFunction(thing.make_) && isFunction(thing.extend_)\n );\n}\n\n/**\n * (c) Michel Weststrate 2015 - 2020\n * MIT Licensed\n *\n * Welcome to the mobx sources! To get a global overview of how MobX internally works,\n * this is a good place to start:\n * https://medium.com/@mweststrate/becoming-fully-reactive-an-in-depth-explanation-of-mobservable-55995262a254#.xvbh6qd74\n *\n * Source folders:\n * ===============\n *\n * - api/ Most of the public static methods exposed by the module can be found here.\n * - core/ Implementation of the MobX algorithm; atoms, derivations, reactions, dependency trees, optimizations. Cool stuff can be found here.\n * - types/ All the magic that is need to have observable objects, arrays and values is in this folder. Including the modifiers like `asFlat`.\n * - utils/ Utility stuff.\n *\n */\n[\"Symbol\", \"Map\", \"Set\"].forEach(function (m) {\n var g = getGlobal();\n if (typeof g[m] === \"undefined\") {\n die(\"MobX requires global '\" + m + \"' to be available or polyfilled\");\n }\n});\nif (typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__ === \"object\") {\n // See: https://github.com/andykog/mobx-devtools/\n __MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({\n spy: spy,\n extras: {\n getDebugName: getDebugName\n },\n $mobx: $mobx\n });\n}\n\n\n//# sourceMappingURL=mobx.esm.js.map\n\n\n//# sourceURL=webpack://app_adyen_SFRA/./node_modules/mobx/dist/mobx.esm.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ $mobx: () => (/* binding */ $mobx),\n/* harmony export */ FlowCancellationError: () => (/* binding */ FlowCancellationError),\n/* harmony export */ ObservableMap: () => (/* binding */ ObservableMap),\n/* harmony export */ ObservableSet: () => (/* binding */ ObservableSet),\n/* harmony export */ Reaction: () => (/* binding */ Reaction),\n/* harmony export */ _allowStateChanges: () => (/* binding */ allowStateChanges),\n/* harmony export */ _allowStateChangesInsideComputed: () => (/* binding */ runInAction),\n/* harmony export */ _allowStateReadsEnd: () => (/* binding */ allowStateReadsEnd),\n/* harmony export */ _allowStateReadsStart: () => (/* binding */ allowStateReadsStart),\n/* harmony export */ _autoAction: () => (/* binding */ autoAction),\n/* harmony export */ _endAction: () => (/* binding */ _endAction),\n/* harmony export */ _getAdministration: () => (/* binding */ getAdministration),\n/* harmony export */ _getGlobalState: () => (/* binding */ getGlobalState),\n/* harmony export */ _interceptReads: () => (/* binding */ interceptReads),\n/* harmony export */ _isComputingDerivation: () => (/* binding */ isComputingDerivation),\n/* harmony export */ _resetGlobalState: () => (/* binding */ resetGlobalState),\n/* harmony export */ _startAction: () => (/* binding */ _startAction),\n/* harmony export */ action: () => (/* binding */ action),\n/* harmony export */ autorun: () => (/* binding */ autorun),\n/* harmony export */ comparer: () => (/* binding */ comparer),\n/* harmony export */ computed: () => (/* binding */ computed),\n/* harmony export */ configure: () => (/* binding */ configure),\n/* harmony export */ createAtom: () => (/* binding */ createAtom),\n/* harmony export */ defineProperty: () => (/* binding */ apiDefineProperty),\n/* harmony export */ entries: () => (/* binding */ entries),\n/* harmony export */ extendObservable: () => (/* binding */ extendObservable),\n/* harmony export */ flow: () => (/* binding */ flow),\n/* harmony export */ flowResult: () => (/* binding */ flowResult),\n/* harmony export */ get: () => (/* binding */ get),\n/* harmony export */ getAtom: () => (/* binding */ getAtom),\n/* harmony export */ getDebugName: () => (/* binding */ getDebugName),\n/* harmony export */ getDependencyTree: () => (/* binding */ getDependencyTree),\n/* harmony export */ getObserverTree: () => (/* binding */ getObserverTree),\n/* harmony export */ has: () => (/* binding */ has),\n/* harmony export */ intercept: () => (/* binding */ intercept),\n/* harmony export */ isAction: () => (/* binding */ isAction),\n/* harmony export */ isBoxedObservable: () => (/* binding */ isObservableValue),\n/* harmony export */ isComputed: () => (/* binding */ isComputed),\n/* harmony export */ isComputedProp: () => (/* binding */ isComputedProp),\n/* harmony export */ isFlow: () => (/* binding */ isFlow),\n/* harmony export */ isFlowCancellationError: () => (/* binding */ isFlowCancellationError),\n/* harmony export */ isObservable: () => (/* binding */ isObservable),\n/* harmony export */ isObservableArray: () => (/* binding */ isObservableArray),\n/* harmony export */ isObservableMap: () => (/* binding */ isObservableMap),\n/* harmony export */ isObservableObject: () => (/* binding */ isObservableObject),\n/* harmony export */ isObservableProp: () => (/* binding */ isObservableProp),\n/* harmony export */ isObservableSet: () => (/* binding */ isObservableSet),\n/* harmony export */ keys: () => (/* binding */ keys),\n/* harmony export */ makeAutoObservable: () => (/* binding */ makeAutoObservable),\n/* harmony export */ makeObservable: () => (/* binding */ makeObservable),\n/* harmony export */ observable: () => (/* binding */ observable),\n/* harmony export */ observe: () => (/* binding */ observe),\n/* harmony export */ onBecomeObserved: () => (/* binding */ onBecomeObserved),\n/* harmony export */ onBecomeUnobserved: () => (/* binding */ onBecomeUnobserved),\n/* harmony export */ onReactionError: () => (/* binding */ onReactionError),\n/* harmony export */ override: () => (/* binding */ override),\n/* harmony export */ ownKeys: () => (/* binding */ apiOwnKeys),\n/* harmony export */ reaction: () => (/* binding */ reaction),\n/* harmony export */ remove: () => (/* binding */ remove),\n/* harmony export */ runInAction: () => (/* binding */ runInAction),\n/* harmony export */ set: () => (/* binding */ set),\n/* harmony export */ spy: () => (/* binding */ spy),\n/* harmony export */ toJS: () => (/* binding */ toJS),\n/* harmony export */ trace: () => (/* binding */ trace),\n/* harmony export */ transaction: () => (/* binding */ transaction),\n/* harmony export */ untracked: () => (/* binding */ untracked),\n/* harmony export */ values: () => (/* binding */ values),\n/* harmony export */ when: () => (/* binding */ when)\n/* harmony export */ });\nvar niceErrors = {\n 0: \"Invalid value for configuration 'enforceActions', expected 'never', 'always' or 'observed'\",\n 1: function _(annotationType, key) {\n return \"Cannot apply '\" + annotationType + \"' to '\" + key.toString() + \"': Field not found.\";\n },\n /*\n 2(prop) {\n return `invalid decorator for '${prop.toString()}'`\n },\n 3(prop) {\n return `Cannot decorate '${prop.toString()}': action can only be used on properties with a function value.`\n },\n 4(prop) {\n return `Cannot decorate '${prop.toString()}': computed can only be used on getter properties.`\n },\n */\n 5: \"'keys()' can only be used on observable objects, arrays, sets and maps\",\n 6: \"'values()' can only be used on observable objects, arrays, sets and maps\",\n 7: \"'entries()' can only be used on observable objects, arrays and maps\",\n 8: \"'set()' can only be used on observable objects, arrays and maps\",\n 9: \"'remove()' can only be used on observable objects, arrays and maps\",\n 10: \"'has()' can only be used on observable objects, arrays and maps\",\n 11: \"'get()' can only be used on observable objects, arrays and maps\",\n 12: \"Invalid annotation\",\n 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)\",\n 14: \"Intercept handlers should return nothing or a change object\",\n 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)\",\n 16: \"Modification exception: the internal structure of an observable array was changed.\",\n 17: function _(index, length) {\n return \"[mobx.array] Index out of bounds, \" + index + \" is larger than \" + length;\n },\n 18: \"mobx.map requires Map polyfill for the current browser. Check babel-polyfill or core-js/es6/map.js\",\n 19: function _(other) {\n return \"Cannot initialize from classes that inherit from Map: \" + other.constructor.name;\n },\n 20: function _(other) {\n return \"Cannot initialize map from \" + other;\n },\n 21: function _(dataStructure) {\n return \"Cannot convert to map from '\" + dataStructure + \"'\";\n },\n 22: \"mobx.set requires Set polyfill for the current browser. Check babel-polyfill or core-js/es6/set.js\",\n 23: \"It is not possible to get index atoms from arrays\",\n 24: function _(thing) {\n return \"Cannot obtain administration from \" + thing;\n },\n 25: function _(property, name) {\n return \"the entry '\" + property + \"' does not exist in the observable map '\" + name + \"'\";\n },\n 26: \"please specify a property\",\n 27: function _(property, name) {\n return \"no observable property '\" + property.toString() + \"' found on the observable object '\" + name + \"'\";\n },\n 28: function _(thing) {\n return \"Cannot obtain atom from \" + thing;\n },\n 29: \"Expecting some object\",\n 30: \"invalid action stack. did you forget to finish an action?\",\n 31: \"missing option for computed: get\",\n 32: function _(name, derivation) {\n return \"Cycle detected in computation \" + name + \": \" + derivation;\n },\n 33: function _(name) {\n return \"The setter of computed value '\" + name + \"' is trying to update itself. Did you intend to update an _observable_ value, instead of the computed property?\";\n },\n 34: function _(name) {\n return \"[ComputedValue '\" + name + \"'] It is not possible to assign a new value to a computed value.\";\n },\n 35: \"There are multiple, different versions of MobX active. Make sure MobX is loaded only once or use `configure({ isolateGlobalState: true })`\",\n 36: \"isolateGlobalState should be called before MobX is running any reactions\",\n 37: function _(method) {\n return \"[mobx] `observableArray.\" + method + \"()` mutates the array in-place, which is not allowed inside a derivation. Use `array.slice().\" + method + \"()` instead\";\n },\n 38: \"'ownKeys()' can only be used on observable objects\",\n 39: \"'defineProperty()' can only be used on observable objects\"\n};\nvar errors = true ? niceErrors : 0;\nfunction die(error) {\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n if (true) {\n var e = typeof error === \"string\" ? error : errors[error];\n if (typeof e === \"function\") e = e.apply(null, args);\n throw new Error(\"[MobX] \" + e);\n }\n throw new Error(typeof error === \"number\" ? \"[MobX] minified error nr: \" + error + (args.length ? \" \" + args.map(String).join(\",\") : \"\") + \". Find the full error at: https://github.com/mobxjs/mobx/blob/main/packages/mobx/src/errors.ts\" : \"[MobX] \" + error);\n}\n\nvar mockGlobal = {};\nfunction getGlobal() {\n if (typeof globalThis !== \"undefined\") {\n return globalThis;\n }\n if (typeof window !== \"undefined\") {\n return window;\n }\n if (typeof __webpack_require__.g !== \"undefined\") {\n return __webpack_require__.g;\n }\n if (typeof self !== \"undefined\") {\n return self;\n }\n return mockGlobal;\n}\n\n// We shorten anything used > 5 times\nvar assign = Object.assign;\nvar getDescriptor = Object.getOwnPropertyDescriptor;\nvar defineProperty = Object.defineProperty;\nvar objectPrototype = Object.prototype;\nvar EMPTY_ARRAY = [];\nObject.freeze(EMPTY_ARRAY);\nvar EMPTY_OBJECT = {};\nObject.freeze(EMPTY_OBJECT);\nvar hasProxy = typeof Proxy !== \"undefined\";\nvar plainObjectString = /*#__PURE__*/Object.toString();\nfunction assertProxies() {\n if (!hasProxy) {\n die( true ? \"`Proxy` objects are not available in the current environment. Please configure MobX to enable a fallback implementation.`\" : 0);\n }\n}\nfunction warnAboutProxyRequirement(msg) {\n if ( true && globalState.verifyProxies) {\n die(\"MobX is currently configured to be able to run in ES5 mode, but in ES5 MobX won't be able to \" + msg);\n }\n}\nfunction getNextId() {\n return ++globalState.mobxGuid;\n}\n/**\n * Makes sure that the provided function is invoked at most once.\n */\nfunction once(func) {\n var invoked = false;\n return function () {\n if (invoked) {\n return;\n }\n invoked = true;\n return func.apply(this, arguments);\n };\n}\nvar noop = function noop() {};\nfunction isFunction(fn) {\n return typeof fn === \"function\";\n}\nfunction isStringish(value) {\n var t = typeof value;\n switch (t) {\n case \"string\":\n case \"symbol\":\n case \"number\":\n return true;\n }\n return false;\n}\nfunction isObject(value) {\n return value !== null && typeof value === \"object\";\n}\nfunction isPlainObject(value) {\n if (!isObject(value)) {\n return false;\n }\n var proto = Object.getPrototypeOf(value);\n if (proto == null) {\n return true;\n }\n var protoConstructor = Object.hasOwnProperty.call(proto, \"constructor\") && proto.constructor;\n return typeof protoConstructor === \"function\" && protoConstructor.toString() === plainObjectString;\n}\n// https://stackoverflow.com/a/37865170\nfunction isGenerator(obj) {\n var constructor = obj == null ? void 0 : obj.constructor;\n if (!constructor) {\n return false;\n }\n if (\"GeneratorFunction\" === constructor.name || \"GeneratorFunction\" === constructor.displayName) {\n return true;\n }\n return false;\n}\nfunction addHiddenProp(object, propName, value) {\n defineProperty(object, propName, {\n enumerable: false,\n writable: true,\n configurable: true,\n value: value\n });\n}\nfunction addHiddenFinalProp(object, propName, value) {\n defineProperty(object, propName, {\n enumerable: false,\n writable: false,\n configurable: true,\n value: value\n });\n}\nfunction createInstanceofPredicate(name, theClass) {\n var propName = \"isMobX\" + name;\n theClass.prototype[propName] = true;\n return function (x) {\n return isObject(x) && x[propName] === true;\n };\n}\n/**\n * Yields true for both native and observable Map, even across different windows.\n */\nfunction isES6Map(thing) {\n return thing != null && Object.prototype.toString.call(thing) === \"[object Map]\";\n}\n/**\n * Makes sure a Map is an instance of non-inherited native or observable Map.\n */\nfunction isPlainES6Map(thing) {\n var mapProto = Object.getPrototypeOf(thing);\n var objectProto = Object.getPrototypeOf(mapProto);\n var nullProto = Object.getPrototypeOf(objectProto);\n return nullProto === null;\n}\n/**\n * Yields true for both native and observable Set, even across different windows.\n */\nfunction isES6Set(thing) {\n return thing != null && Object.prototype.toString.call(thing) === \"[object Set]\";\n}\nvar hasGetOwnPropertySymbols = typeof Object.getOwnPropertySymbols !== \"undefined\";\n/**\n * Returns the following: own enumerable keys and symbols.\n */\nfunction getPlainObjectKeys(object) {\n var keys = Object.keys(object);\n // Not supported in IE, so there are not going to be symbol props anyway...\n if (!hasGetOwnPropertySymbols) {\n return keys;\n }\n var symbols = Object.getOwnPropertySymbols(object);\n if (!symbols.length) {\n return keys;\n }\n return [].concat(keys, symbols.filter(function (s) {\n return objectPrototype.propertyIsEnumerable.call(object, s);\n }));\n}\n// From Immer utils\n// Returns all own keys, including non-enumerable and symbolic\nvar ownKeys = typeof Reflect !== \"undefined\" && Reflect.ownKeys ? Reflect.ownKeys : hasGetOwnPropertySymbols ? function (obj) {\n return Object.getOwnPropertyNames(obj).concat(Object.getOwnPropertySymbols(obj));\n} : /* istanbul ignore next */Object.getOwnPropertyNames;\nfunction stringifyKey(key) {\n if (typeof key === \"string\") {\n return key;\n }\n if (typeof key === \"symbol\") {\n return key.toString();\n }\n return new String(key).toString();\n}\nfunction toPrimitive(value) {\n return value === null ? null : typeof value === \"object\" ? \"\" + value : value;\n}\nfunction hasProp(target, prop) {\n return objectPrototype.hasOwnProperty.call(target, prop);\n}\n// From Immer utils\nvar getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors || function getOwnPropertyDescriptors(target) {\n // Polyfill needed for Hermes and IE, see https://github.com/facebook/hermes/issues/274\n var res = {};\n // Note: without polyfill for ownKeys, symbols won't be picked up\n ownKeys(target).forEach(function (key) {\n res[key] = getDescriptor(target, key);\n });\n return res;\n};\nfunction getFlag(flags, mask) {\n return !!(flags & mask);\n}\nfunction setFlag(flags, mask, newValue) {\n if (newValue) {\n flags |= mask;\n } else {\n flags &= ~mask;\n }\n return flags;\n}\n\nfunction _arrayLikeToArray(r, a) {\n (null == a || a > r.length) && (a = r.length);\n for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];\n return n;\n}\nfunction _defineProperties(e, r) {\n for (var t = 0; t < r.length; t++) {\n var o = r[t];\n o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);\n }\n}\nfunction _createClass(e, r, t) {\n return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", {\n writable: !1\n }), e;\n}\nfunction _createForOfIteratorHelperLoose(r, e) {\n var t = \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"];\n if (t) return (t = t.call(r)).next.bind(t);\n if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && \"number\" == typeof r.length) {\n t && (r = t);\n var o = 0;\n return function () {\n return o >= r.length ? {\n done: !0\n } : {\n done: !1,\n value: r[o++]\n };\n };\n }\n throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\nfunction _extends() {\n return _extends = Object.assign ? Object.assign.bind() : function (n) {\n for (var e = 1; e < arguments.length; e++) {\n var t = arguments[e];\n for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);\n }\n return n;\n }, _extends.apply(null, arguments);\n}\nfunction _inheritsLoose(t, o) {\n t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);\n}\nfunction _setPrototypeOf(t, e) {\n return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {\n return t.__proto__ = e, t;\n }, _setPrototypeOf(t, e);\n}\nfunction _toPrimitive(t, r) {\n if (\"object\" != typeof t || !t) return t;\n var e = t[Symbol.toPrimitive];\n if (void 0 !== e) {\n var i = e.call(t, r || \"default\");\n if (\"object\" != typeof i) return i;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (\"string\" === r ? String : Number)(t);\n}\nfunction _toPropertyKey(t) {\n var i = _toPrimitive(t, \"string\");\n return \"symbol\" == typeof i ? i : i + \"\";\n}\nfunction _unsupportedIterableToArray(r, a) {\n if (r) {\n if (\"string\" == typeof r) return _arrayLikeToArray(r, a);\n var t = {}.toString.call(r).slice(8, -1);\n return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;\n }\n}\n\nvar storedAnnotationsSymbol = /*#__PURE__*/Symbol(\"mobx-stored-annotations\");\n/**\n * Creates a function that acts as\n * - decorator\n * - annotation object\n */\nfunction createDecoratorAnnotation(annotation) {\n function decorator(target, property) {\n if (is20223Decorator(property)) {\n return annotation.decorate_20223_(target, property);\n } else {\n storeAnnotation(target, property, annotation);\n }\n }\n return Object.assign(decorator, annotation);\n}\n/**\n * Stores annotation to prototype,\n * so it can be inspected later by `makeObservable` called from constructor\n */\nfunction storeAnnotation(prototype, key, annotation) {\n if (!hasProp(prototype, storedAnnotationsSymbol)) {\n addHiddenProp(prototype, storedAnnotationsSymbol, _extends({}, prototype[storedAnnotationsSymbol]));\n }\n // @override must override something\n if ( true && isOverride(annotation) && !hasProp(prototype[storedAnnotationsSymbol], key)) {\n var fieldName = prototype.constructor.name + \".prototype.\" + key.toString();\n die(\"'\" + fieldName + \"' is decorated with 'override', \" + \"but no such decorated member was found on prototype.\");\n }\n // Cannot re-decorate\n assertNotDecorated(prototype, annotation, key);\n // Ignore override\n if (!isOverride(annotation)) {\n prototype[storedAnnotationsSymbol][key] = annotation;\n }\n}\nfunction assertNotDecorated(prototype, annotation, key) {\n if ( true && !isOverride(annotation) && hasProp(prototype[storedAnnotationsSymbol], key)) {\n var fieldName = prototype.constructor.name + \".prototype.\" + key.toString();\n var currentAnnotationType = prototype[storedAnnotationsSymbol][key].annotationType_;\n var requestedAnnotationType = annotation.annotationType_;\n die(\"Cannot apply '@\" + requestedAnnotationType + \"' to '\" + fieldName + \"':\" + (\"\\nThe field is already decorated with '@\" + currentAnnotationType + \"'.\") + \"\\nRe-decorating fields is not allowed.\" + \"\\nUse '@override' decorator for methods overridden by subclass.\");\n }\n}\n/**\n * Collects annotations from prototypes and stores them on target (instance)\n */\nfunction collectStoredAnnotations(target) {\n if (!hasProp(target, storedAnnotationsSymbol)) {\n // if (__DEV__ && !target[storedAnnotationsSymbol]) {\n // die(\n // `No annotations were passed to makeObservable, but no decorated members have been found either`\n // )\n // }\n // We need a copy as we will remove annotation from the list once it's applied.\n addHiddenProp(target, storedAnnotationsSymbol, _extends({}, target[storedAnnotationsSymbol]));\n }\n return target[storedAnnotationsSymbol];\n}\nfunction is20223Decorator(context) {\n return typeof context == \"object\" && typeof context[\"kind\"] == \"string\";\n}\nfunction assert20223DecoratorType(context, types) {\n if ( true && !types.includes(context.kind)) {\n die(\"The decorator applied to '\" + String(context.name) + \"' cannot be used on a \" + context.kind + \" element\");\n }\n}\n\nvar $mobx = /*#__PURE__*/Symbol(\"mobx administration\");\nvar Atom = /*#__PURE__*/function () {\n /**\n * Create a new atom. For debugging purposes it is recommended to give it a name.\n * The onBecomeObserved and onBecomeUnobserved callbacks can be used for resource management.\n */\n function Atom(name_) {\n if (name_ === void 0) {\n name_ = true ? \"Atom@\" + getNextId() : 0;\n }\n this.name_ = void 0;\n this.flags_ = 0;\n this.observers_ = new Set();\n this.lastAccessedBy_ = 0;\n this.lowestObserverState_ = IDerivationState_.NOT_TRACKING_;\n // onBecomeObservedListeners\n this.onBOL = void 0;\n // onBecomeUnobservedListeners\n this.onBUOL = void 0;\n this.name_ = name_;\n }\n // for effective unobserving. BaseAtom has true, for extra optimization, so its onBecomeUnobserved never gets called, because it's not needed\n var _proto = Atom.prototype;\n _proto.onBO = function onBO() {\n if (this.onBOL) {\n this.onBOL.forEach(function (listener) {\n return listener();\n });\n }\n };\n _proto.onBUO = function onBUO() {\n if (this.onBUOL) {\n this.onBUOL.forEach(function (listener) {\n return listener();\n });\n }\n }\n /**\n * Invoke this method to notify mobx that your atom has been used somehow.\n * Returns true if there is currently a reactive context.\n */;\n _proto.reportObserved = function reportObserved$1() {\n return reportObserved(this);\n }\n /**\n * Invoke this method _after_ this method has changed to signal mobx that all its observers should invalidate.\n */;\n _proto.reportChanged = function reportChanged() {\n startBatch();\n propagateChanged(this);\n endBatch();\n };\n _proto.toString = function toString() {\n return this.name_;\n };\n return _createClass(Atom, [{\n key: \"isBeingObserved\",\n get: function get() {\n return getFlag(this.flags_, Atom.isBeingObservedMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Atom.isBeingObservedMask_, newValue);\n }\n }, {\n key: \"isPendingUnobservation\",\n get: function get() {\n return getFlag(this.flags_, Atom.isPendingUnobservationMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Atom.isPendingUnobservationMask_, newValue);\n }\n }, {\n key: \"diffValue\",\n get: function get() {\n return getFlag(this.flags_, Atom.diffValueMask_) ? 1 : 0;\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Atom.diffValueMask_, newValue === 1 ? true : false);\n }\n }]);\n}();\nAtom.isBeingObservedMask_ = 1;\nAtom.isPendingUnobservationMask_ = 2;\nAtom.diffValueMask_ = 4;\nvar isAtom = /*#__PURE__*/createInstanceofPredicate(\"Atom\", Atom);\nfunction createAtom(name, onBecomeObservedHandler, onBecomeUnobservedHandler) {\n if (onBecomeObservedHandler === void 0) {\n onBecomeObservedHandler = noop;\n }\n if (onBecomeUnobservedHandler === void 0) {\n onBecomeUnobservedHandler = noop;\n }\n var atom = new Atom(name);\n // default `noop` listener will not initialize the hook Set\n if (onBecomeObservedHandler !== noop) {\n onBecomeObserved(atom, onBecomeObservedHandler);\n }\n if (onBecomeUnobservedHandler !== noop) {\n onBecomeUnobserved(atom, onBecomeUnobservedHandler);\n }\n return atom;\n}\n\nfunction identityComparer(a, b) {\n return a === b;\n}\nfunction structuralComparer(a, b) {\n return deepEqual(a, b);\n}\nfunction shallowComparer(a, b) {\n return deepEqual(a, b, 1);\n}\nfunction defaultComparer(a, b) {\n if (Object.is) {\n return Object.is(a, b);\n }\n return a === b ? a !== 0 || 1 / a === 1 / b : a !== a && b !== b;\n}\nvar comparer = {\n identity: identityComparer,\n structural: structuralComparer,\n \"default\": defaultComparer,\n shallow: shallowComparer\n};\n\nfunction deepEnhancer(v, _, name) {\n // it is an observable already, done\n if (isObservable(v)) {\n return v;\n }\n // something that can be converted and mutated?\n if (Array.isArray(v)) {\n return observable.array(v, {\n name: name\n });\n }\n if (isPlainObject(v)) {\n return observable.object(v, undefined, {\n name: name\n });\n }\n if (isES6Map(v)) {\n return observable.map(v, {\n name: name\n });\n }\n if (isES6Set(v)) {\n return observable.set(v, {\n name: name\n });\n }\n if (typeof v === \"function\" && !isAction(v) && !isFlow(v)) {\n if (isGenerator(v)) {\n return flow(v);\n } else {\n return autoAction(name, v);\n }\n }\n return v;\n}\nfunction shallowEnhancer(v, _, name) {\n if (v === undefined || v === null) {\n return v;\n }\n if (isObservableObject(v) || isObservableArray(v) || isObservableMap(v) || isObservableSet(v)) {\n return v;\n }\n if (Array.isArray(v)) {\n return observable.array(v, {\n name: name,\n deep: false\n });\n }\n if (isPlainObject(v)) {\n return observable.object(v, undefined, {\n name: name,\n deep: false\n });\n }\n if (isES6Map(v)) {\n return observable.map(v, {\n name: name,\n deep: false\n });\n }\n if (isES6Set(v)) {\n return observable.set(v, {\n name: name,\n deep: false\n });\n }\n if (true) {\n die(\"The shallow modifier / decorator can only used in combination with arrays, objects, maps and sets\");\n }\n}\nfunction referenceEnhancer(newValue) {\n // never turn into an observable\n return newValue;\n}\nfunction refStructEnhancer(v, oldValue) {\n if ( true && isObservable(v)) {\n die(\"observable.struct should not be used with observable values\");\n }\n if (deepEqual(v, oldValue)) {\n return oldValue;\n }\n return v;\n}\n\nvar OVERRIDE = \"override\";\nvar override = /*#__PURE__*/createDecoratorAnnotation({\n annotationType_: OVERRIDE,\n make_: make_,\n extend_: extend_,\n decorate_20223_: decorate_20223_\n});\nfunction isOverride(annotation) {\n return annotation.annotationType_ === OVERRIDE;\n}\nfunction make_(adm, key) {\n // Must not be plain object\n if ( true && adm.isPlainObject_) {\n die(\"Cannot apply '\" + this.annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + this.annotationType_ + \"' cannot be used on plain objects.\"));\n }\n // Must override something\n if ( true && !hasProp(adm.appliedAnnotations_, key)) {\n die(\"'\" + adm.name_ + \".\" + key.toString() + \"' is annotated with '\" + this.annotationType_ + \"', \" + \"but no such annotated member was found on prototype.\");\n }\n return 0 /* MakeResult.Cancel */;\n}\nfunction extend_(adm, key, descriptor, proxyTrap) {\n die(\"'\" + this.annotationType_ + \"' can only be used with 'makeObservable'\");\n}\nfunction decorate_20223_(desc, context) {\n console.warn(\"'\" + this.annotationType_ + \"' cannot be used with decorators - this is a no-op\");\n}\n\nfunction createActionAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$1,\n extend_: extend_$1,\n decorate_20223_: decorate_20223_$1\n };\n}\nfunction make_$1(adm, key, descriptor, source) {\n var _this$options_;\n // bound\n if ((_this$options_ = this.options_) != null && _this$options_.bound) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;\n }\n // own\n if (source === adm.target_) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 2 /* MakeResult.Continue */;\n }\n // prototype\n if (isAction(descriptor.value)) {\n // A prototype could have been annotated already by other constructor,\n // rest of the proto chain must be annotated already\n return 1 /* MakeResult.Break */;\n }\n var actionDescriptor = createActionDescriptor(adm, this, key, descriptor, false);\n defineProperty(source, key, actionDescriptor);\n return 2 /* MakeResult.Continue */;\n}\nfunction extend_$1(adm, key, descriptor, proxyTrap) {\n var actionDescriptor = createActionDescriptor(adm, this, key, descriptor);\n return adm.defineProperty_(key, actionDescriptor, proxyTrap);\n}\nfunction decorate_20223_$1(mthd, context) {\n if (true) {\n assert20223DecoratorType(context, [\"method\", \"field\"]);\n }\n var kind = context.kind,\n name = context.name,\n addInitializer = context.addInitializer;\n var ann = this;\n var _createAction = function _createAction(m) {\n var _ann$options_$name, _ann$options_, _ann$options_$autoAct, _ann$options_2;\n return createAction((_ann$options_$name = (_ann$options_ = ann.options_) == null ? void 0 : _ann$options_.name) != null ? _ann$options_$name : name.toString(), m, (_ann$options_$autoAct = (_ann$options_2 = ann.options_) == null ? void 0 : _ann$options_2.autoAction) != null ? _ann$options_$autoAct : false);\n };\n if (kind == \"field\") {\n return function (initMthd) {\n var _ann$options_3;\n var mthd = initMthd;\n if (!isAction(mthd)) {\n mthd = _createAction(mthd);\n }\n if ((_ann$options_3 = ann.options_) != null && _ann$options_3.bound) {\n mthd = mthd.bind(this);\n mthd.isMobxAction = true;\n }\n return mthd;\n };\n }\n if (kind == \"method\") {\n var _this$options_2;\n if (!isAction(mthd)) {\n mthd = _createAction(mthd);\n }\n if ((_this$options_2 = this.options_) != null && _this$options_2.bound) {\n addInitializer(function () {\n var self = this;\n var bound = self[name].bind(self);\n bound.isMobxAction = true;\n self[name] = bound;\n });\n }\n return mthd;\n }\n die(\"Cannot apply '\" + ann.annotationType_ + \"' to '\" + String(name) + \"' (kind: \" + kind + \"):\" + (\"\\n'\" + ann.annotationType_ + \"' can only be used on properties with a function value.\"));\n}\nfunction assertActionDescriptor(adm, _ref, key, _ref2) {\n var annotationType_ = _ref.annotationType_;\n var value = _ref2.value;\n if ( true && !isFunction(value)) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' can only be used on properties with a function value.\"));\n }\n}\nfunction createActionDescriptor(adm, annotation, key, descriptor,\n// provides ability to disable safeDescriptors for prototypes\nsafeDescriptors) {\n var _annotation$options_, _annotation$options_$, _annotation$options_2, _annotation$options_$2, _annotation$options_3, _annotation$options_4, _adm$proxy_2;\n if (safeDescriptors === void 0) {\n safeDescriptors = globalState.safeDescriptors;\n }\n assertActionDescriptor(adm, annotation, key, descriptor);\n var value = descriptor.value;\n if ((_annotation$options_ = annotation.options_) != null && _annotation$options_.bound) {\n var _adm$proxy_;\n value = value.bind((_adm$proxy_ = adm.proxy_) != null ? _adm$proxy_ : adm.target_);\n }\n return {\n value: createAction((_annotation$options_$ = (_annotation$options_2 = annotation.options_) == null ? void 0 : _annotation$options_2.name) != null ? _annotation$options_$ : key.toString(), value, (_annotation$options_$2 = (_annotation$options_3 = annotation.options_) == null ? void 0 : _annotation$options_3.autoAction) != null ? _annotation$options_$2 : false,\n // https://github.com/mobxjs/mobx/discussions/3140\n (_annotation$options_4 = annotation.options_) != null && _annotation$options_4.bound ? (_adm$proxy_2 = adm.proxy_) != null ? _adm$proxy_2 : adm.target_ : undefined),\n // Non-configurable for classes\n // prevents accidental field redefinition in subclass\n configurable: safeDescriptors ? adm.isPlainObject_ : true,\n // https://github.com/mobxjs/mobx/pull/2641#issuecomment-737292058\n enumerable: false,\n // Non-obsevable, therefore non-writable\n // Also prevents rewriting in subclass constructor\n writable: safeDescriptors ? false : true\n };\n}\n\nfunction createFlowAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$2,\n extend_: extend_$2,\n decorate_20223_: decorate_20223_$2\n };\n}\nfunction make_$2(adm, key, descriptor, source) {\n var _this$options_;\n // own\n if (source === adm.target_) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 2 /* MakeResult.Continue */;\n }\n // prototype\n // bound - must annotate protos to support super.flow()\n if ((_this$options_ = this.options_) != null && _this$options_.bound && (!hasProp(adm.target_, key) || !isFlow(adm.target_[key]))) {\n if (this.extend_(adm, key, descriptor, false) === null) {\n return 0 /* MakeResult.Cancel */;\n }\n }\n if (isFlow(descriptor.value)) {\n // A prototype could have been annotated already by other constructor,\n // rest of the proto chain must be annotated already\n return 1 /* MakeResult.Break */;\n }\n var flowDescriptor = createFlowDescriptor(adm, this, key, descriptor, false, false);\n defineProperty(source, key, flowDescriptor);\n return 2 /* MakeResult.Continue */;\n}\nfunction extend_$2(adm, key, descriptor, proxyTrap) {\n var _this$options_2;\n var flowDescriptor = createFlowDescriptor(adm, this, key, descriptor, (_this$options_2 = this.options_) == null ? void 0 : _this$options_2.bound);\n return adm.defineProperty_(key, flowDescriptor, proxyTrap);\n}\nfunction decorate_20223_$2(mthd, context) {\n var _this$options_3;\n if (true) {\n assert20223DecoratorType(context, [\"method\"]);\n }\n var name = context.name,\n addInitializer = context.addInitializer;\n if (!isFlow(mthd)) {\n mthd = flow(mthd);\n }\n if ((_this$options_3 = this.options_) != null && _this$options_3.bound) {\n addInitializer(function () {\n var self = this;\n var bound = self[name].bind(self);\n bound.isMobXFlow = true;\n self[name] = bound;\n });\n }\n return mthd;\n}\nfunction assertFlowDescriptor(adm, _ref, key, _ref2) {\n var annotationType_ = _ref.annotationType_;\n var value = _ref2.value;\n if ( true && !isFunction(value)) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' can only be used on properties with a generator function value.\"));\n }\n}\nfunction createFlowDescriptor(adm, annotation, key, descriptor, bound,\n// provides ability to disable safeDescriptors for prototypes\nsafeDescriptors) {\n if (safeDescriptors === void 0) {\n safeDescriptors = globalState.safeDescriptors;\n }\n assertFlowDescriptor(adm, annotation, key, descriptor);\n var value = descriptor.value;\n // In case of flow.bound, the descriptor can be from already annotated prototype\n if (!isFlow(value)) {\n value = flow(value);\n }\n if (bound) {\n var _adm$proxy_;\n // We do not keep original function around, so we bind the existing flow\n value = value.bind((_adm$proxy_ = adm.proxy_) != null ? _adm$proxy_ : adm.target_);\n // This is normally set by `flow`, but `bind` returns new function...\n value.isMobXFlow = true;\n }\n return {\n value: value,\n // Non-configurable for classes\n // prevents accidental field redefinition in subclass\n configurable: safeDescriptors ? adm.isPlainObject_ : true,\n // https://github.com/mobxjs/mobx/pull/2641#issuecomment-737292058\n enumerable: false,\n // Non-obsevable, therefore non-writable\n // Also prevents rewriting in subclass constructor\n writable: safeDescriptors ? false : true\n };\n}\n\nfunction createComputedAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$3,\n extend_: extend_$3,\n decorate_20223_: decorate_20223_$3\n };\n}\nfunction make_$3(adm, key, descriptor) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;\n}\nfunction extend_$3(adm, key, descriptor, proxyTrap) {\n assertComputedDescriptor(adm, this, key, descriptor);\n return adm.defineComputedProperty_(key, _extends({}, this.options_, {\n get: descriptor.get,\n set: descriptor.set\n }), proxyTrap);\n}\nfunction decorate_20223_$3(get, context) {\n if (true) {\n assert20223DecoratorType(context, [\"getter\"]);\n }\n var ann = this;\n var key = context.name,\n addInitializer = context.addInitializer;\n addInitializer(function () {\n var adm = asObservableObject(this)[$mobx];\n var options = _extends({}, ann.options_, {\n get: get,\n context: this\n });\n options.name || (options.name = true ? adm.name_ + \".\" + key.toString() : 0);\n adm.values_.set(key, new ComputedValue(options));\n });\n return function () {\n return this[$mobx].getObservablePropValue_(key);\n };\n}\nfunction assertComputedDescriptor(adm, _ref, key, _ref2) {\n var annotationType_ = _ref.annotationType_;\n var get = _ref2.get;\n if ( true && !get) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' can only be used on getter(+setter) properties.\"));\n }\n}\n\nfunction createObservableAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$4,\n extend_: extend_$4,\n decorate_20223_: decorate_20223_$4\n };\n}\nfunction make_$4(adm, key, descriptor) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;\n}\nfunction extend_$4(adm, key, descriptor, proxyTrap) {\n var _this$options_$enhanc, _this$options_;\n assertObservableDescriptor(adm, this, key, descriptor);\n return adm.defineObservableProperty_(key, descriptor.value, (_this$options_$enhanc = (_this$options_ = this.options_) == null ? void 0 : _this$options_.enhancer) != null ? _this$options_$enhanc : deepEnhancer, proxyTrap);\n}\nfunction decorate_20223_$4(desc, context) {\n if (true) {\n if (context.kind === \"field\") {\n throw die(\"Please use `@observable accessor \" + String(context.name) + \"` instead of `@observable \" + String(context.name) + \"`\");\n }\n assert20223DecoratorType(context, [\"accessor\"]);\n }\n var ann = this;\n var kind = context.kind,\n name = context.name;\n // The laziness here is not ideal... It's a workaround to how 2022.3 Decorators are implemented:\n // `addInitializer` callbacks are executed _before_ any accessors are defined (instead of the ideal-for-us right after each).\n // This means that, if we were to do our stuff in an `addInitializer`, we'd attempt to read a private slot\n // before it has been initialized. The runtime doesn't like that and throws a `Cannot read private member\n // from an object whose class did not declare it` error.\n // TODO: it seems that this will not be required anymore in the final version of the spec\n // See TODO: link\n var initializedObjects = new WeakSet();\n function initializeObservable(target, value) {\n var _ann$options_$enhance, _ann$options_;\n var adm = asObservableObject(target)[$mobx];\n var observable = new ObservableValue(value, (_ann$options_$enhance = (_ann$options_ = ann.options_) == null ? void 0 : _ann$options_.enhancer) != null ? _ann$options_$enhance : deepEnhancer, true ? adm.name_ + \".\" + name.toString() : 0, false);\n adm.values_.set(name, observable);\n initializedObjects.add(target);\n }\n if (kind == \"accessor\") {\n return {\n get: function get() {\n if (!initializedObjects.has(this)) {\n initializeObservable(this, desc.get.call(this));\n }\n return this[$mobx].getObservablePropValue_(name);\n },\n set: function set(value) {\n if (!initializedObjects.has(this)) {\n initializeObservable(this, value);\n }\n return this[$mobx].setObservablePropValue_(name, value);\n },\n init: function init(value) {\n if (!initializedObjects.has(this)) {\n initializeObservable(this, value);\n }\n return value;\n }\n };\n }\n return;\n}\nfunction assertObservableDescriptor(adm, _ref, key, descriptor) {\n var annotationType_ = _ref.annotationType_;\n if ( true && !(\"value\" in descriptor)) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' cannot be used on getter/setter properties\"));\n }\n}\n\nvar AUTO = \"true\";\nvar autoAnnotation = /*#__PURE__*/createAutoAnnotation();\nfunction createAutoAnnotation(options) {\n return {\n annotationType_: AUTO,\n options_: options,\n make_: make_$5,\n extend_: extend_$5,\n decorate_20223_: decorate_20223_$5\n };\n}\nfunction make_$5(adm, key, descriptor, source) {\n var _this$options_3, _this$options_4;\n // getter -> computed\n if (descriptor.get) {\n return computed.make_(adm, key, descriptor, source);\n }\n // lone setter -> action setter\n if (descriptor.set) {\n // TODO make action applicable to setter and delegate to action.make_\n var set = createAction(key.toString(), descriptor.set);\n // own\n if (source === adm.target_) {\n return adm.defineProperty_(key, {\n configurable: globalState.safeDescriptors ? adm.isPlainObject_ : true,\n set: set\n }) === null ? 0 /* MakeResult.Cancel */ : 2 /* MakeResult.Continue */;\n }\n // proto\n defineProperty(source, key, {\n configurable: true,\n set: set\n });\n return 2 /* MakeResult.Continue */;\n }\n // function on proto -> autoAction/flow\n if (source !== adm.target_ && typeof descriptor.value === \"function\") {\n var _this$options_2;\n if (isGenerator(descriptor.value)) {\n var _this$options_;\n var flowAnnotation = (_this$options_ = this.options_) != null && _this$options_.autoBind ? flow.bound : flow;\n return flowAnnotation.make_(adm, key, descriptor, source);\n }\n var actionAnnotation = (_this$options_2 = this.options_) != null && _this$options_2.autoBind ? autoAction.bound : autoAction;\n return actionAnnotation.make_(adm, key, descriptor, source);\n }\n // other -> observable\n // Copy props from proto as well, see test:\n // \"decorate should work with Object.create\"\n var observableAnnotation = ((_this$options_3 = this.options_) == null ? void 0 : _this$options_3.deep) === false ? observable.ref : observable;\n // if function respect autoBind option\n if (typeof descriptor.value === \"function\" && (_this$options_4 = this.options_) != null && _this$options_4.autoBind) {\n var _adm$proxy_;\n descriptor.value = descriptor.value.bind((_adm$proxy_ = adm.proxy_) != null ? _adm$proxy_ : adm.target_);\n }\n return observableAnnotation.make_(adm, key, descriptor, source);\n}\nfunction extend_$5(adm, key, descriptor, proxyTrap) {\n var _this$options_5, _this$options_6;\n // getter -> computed\n if (descriptor.get) {\n return computed.extend_(adm, key, descriptor, proxyTrap);\n }\n // lone setter -> action setter\n if (descriptor.set) {\n // TODO make action applicable to setter and delegate to action.extend_\n return adm.defineProperty_(key, {\n configurable: globalState.safeDescriptors ? adm.isPlainObject_ : true,\n set: createAction(key.toString(), descriptor.set)\n }, proxyTrap);\n }\n // other -> observable\n // if function respect autoBind option\n if (typeof descriptor.value === \"function\" && (_this$options_5 = this.options_) != null && _this$options_5.autoBind) {\n var _adm$proxy_2;\n descriptor.value = descriptor.value.bind((_adm$proxy_2 = adm.proxy_) != null ? _adm$proxy_2 : adm.target_);\n }\n var observableAnnotation = ((_this$options_6 = this.options_) == null ? void 0 : _this$options_6.deep) === false ? observable.ref : observable;\n return observableAnnotation.extend_(adm, key, descriptor, proxyTrap);\n}\nfunction decorate_20223_$5(desc, context) {\n die(\"'\" + this.annotationType_ + \"' cannot be used as a decorator\");\n}\n\nvar OBSERVABLE = \"observable\";\nvar OBSERVABLE_REF = \"observable.ref\";\nvar OBSERVABLE_SHALLOW = \"observable.shallow\";\nvar OBSERVABLE_STRUCT = \"observable.struct\";\n// Predefined bags of create observable options, to avoid allocating temporarily option objects\n// in the majority of cases\nvar defaultCreateObservableOptions = {\n deep: true,\n name: undefined,\n defaultDecorator: undefined,\n proxy: true\n};\nObject.freeze(defaultCreateObservableOptions);\nfunction asCreateObservableOptions(thing) {\n return thing || defaultCreateObservableOptions;\n}\nvar observableAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE);\nvar observableRefAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE_REF, {\n enhancer: referenceEnhancer\n});\nvar observableShallowAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE_SHALLOW, {\n enhancer: shallowEnhancer\n});\nvar observableStructAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE_STRUCT, {\n enhancer: refStructEnhancer\n});\nvar observableDecoratorAnnotation = /*#__PURE__*/createDecoratorAnnotation(observableAnnotation);\nfunction getEnhancerFromOptions(options) {\n return options.deep === true ? deepEnhancer : options.deep === false ? referenceEnhancer : getEnhancerFromAnnotation(options.defaultDecorator);\n}\nfunction getAnnotationFromOptions(options) {\n var _options$defaultDecor;\n return options ? (_options$defaultDecor = options.defaultDecorator) != null ? _options$defaultDecor : createAutoAnnotation(options) : undefined;\n}\nfunction getEnhancerFromAnnotation(annotation) {\n var _annotation$options_$, _annotation$options_;\n return !annotation ? deepEnhancer : (_annotation$options_$ = (_annotation$options_ = annotation.options_) == null ? void 0 : _annotation$options_.enhancer) != null ? _annotation$options_$ : deepEnhancer;\n}\n/**\n * Turns an object, array or function into a reactive structure.\n * @param v the value which should become observable.\n */\nfunction createObservable(v, arg2, arg3) {\n // @observable someProp; (2022.3 Decorators)\n if (is20223Decorator(arg2)) {\n return observableAnnotation.decorate_20223_(v, arg2);\n }\n // @observable someProp;\n if (isStringish(arg2)) {\n storeAnnotation(v, arg2, observableAnnotation);\n return;\n }\n // already observable - ignore\n if (isObservable(v)) {\n return v;\n }\n // plain object\n if (isPlainObject(v)) {\n return observable.object(v, arg2, arg3);\n }\n // Array\n if (Array.isArray(v)) {\n return observable.array(v, arg2);\n }\n // Map\n if (isES6Map(v)) {\n return observable.map(v, arg2);\n }\n // Set\n if (isES6Set(v)) {\n return observable.set(v, arg2);\n }\n // other object - ignore\n if (typeof v === \"object\" && v !== null) {\n return v;\n }\n // anything else\n return observable.box(v, arg2);\n}\nassign(createObservable, observableDecoratorAnnotation);\nvar observableFactories = {\n box: function box(value, options) {\n var o = asCreateObservableOptions(options);\n return new ObservableValue(value, getEnhancerFromOptions(o), o.name, true, o.equals);\n },\n array: function array(initialValues, options) {\n var o = asCreateObservableOptions(options);\n return (globalState.useProxies === false || o.proxy === false ? createLegacyArray : createObservableArray)(initialValues, getEnhancerFromOptions(o), o.name);\n },\n map: function map(initialValues, options) {\n var o = asCreateObservableOptions(options);\n return new ObservableMap(initialValues, getEnhancerFromOptions(o), o.name);\n },\n set: function set(initialValues, options) {\n var o = asCreateObservableOptions(options);\n return new ObservableSet(initialValues, getEnhancerFromOptions(o), o.name);\n },\n object: function object(props, decorators, options) {\n return initObservable(function () {\n return extendObservable(globalState.useProxies === false || (options == null ? void 0 : options.proxy) === false ? asObservableObject({}, options) : asDynamicObservableObject({}, options), props, decorators);\n });\n },\n ref: /*#__PURE__*/createDecoratorAnnotation(observableRefAnnotation),\n shallow: /*#__PURE__*/createDecoratorAnnotation(observableShallowAnnotation),\n deep: observableDecoratorAnnotation,\n struct: /*#__PURE__*/createDecoratorAnnotation(observableStructAnnotation)\n};\n// eslint-disable-next-line\nvar observable = /*#__PURE__*/assign(createObservable, observableFactories);\n\nvar COMPUTED = \"computed\";\nvar COMPUTED_STRUCT = \"computed.struct\";\nvar computedAnnotation = /*#__PURE__*/createComputedAnnotation(COMPUTED);\nvar computedStructAnnotation = /*#__PURE__*/createComputedAnnotation(COMPUTED_STRUCT, {\n equals: comparer.structural\n});\n/**\n * Decorator for class properties: @computed get value() { return expr; }.\n * For legacy purposes also invokable as ES5 observable created: `computed(() => expr)`;\n */\nvar computed = function computed(arg1, arg2) {\n if (is20223Decorator(arg2)) {\n // @computed (2022.3 Decorators)\n return computedAnnotation.decorate_20223_(arg1, arg2);\n }\n if (isStringish(arg2)) {\n // @computed\n return storeAnnotation(arg1, arg2, computedAnnotation);\n }\n if (isPlainObject(arg1)) {\n // @computed({ options })\n return createDecoratorAnnotation(createComputedAnnotation(COMPUTED, arg1));\n }\n // computed(expr, options?)\n if (true) {\n if (!isFunction(arg1)) {\n die(\"First argument to `computed` should be an expression.\");\n }\n if (isFunction(arg2)) {\n die(\"A setter as second argument is no longer supported, use `{ set: fn }` option instead\");\n }\n }\n var opts = isPlainObject(arg2) ? arg2 : {};\n opts.get = arg1;\n opts.name || (opts.name = arg1.name || \"\"); /* for generated name */\n return new ComputedValue(opts);\n};\nObject.assign(computed, computedAnnotation);\ncomputed.struct = /*#__PURE__*/createDecoratorAnnotation(computedStructAnnotation);\n\nvar _getDescriptor$config, _getDescriptor;\n// we don't use globalState for these in order to avoid possible issues with multiple\n// mobx versions\nvar currentActionId = 0;\nvar nextActionId = 1;\nvar isFunctionNameConfigurable = (_getDescriptor$config = (_getDescriptor = /*#__PURE__*/getDescriptor(function () {}, \"name\")) == null ? void 0 : _getDescriptor.configurable) != null ? _getDescriptor$config : false;\n// we can safely recycle this object\nvar tmpNameDescriptor = {\n value: \"action\",\n configurable: true,\n writable: false,\n enumerable: false\n};\nfunction createAction(actionName, fn, autoAction, ref) {\n if (autoAction === void 0) {\n autoAction = false;\n }\n if (true) {\n if (!isFunction(fn)) {\n die(\"`action` can only be invoked on functions\");\n }\n if (typeof actionName !== \"string\" || !actionName) {\n die(\"actions should have valid names, got: '\" + actionName + \"'\");\n }\n }\n function res() {\n return executeAction(actionName, autoAction, fn, ref || this, arguments);\n }\n res.isMobxAction = true;\n res.toString = function () {\n return fn.toString();\n };\n if (isFunctionNameConfigurable) {\n tmpNameDescriptor.value = actionName;\n defineProperty(res, \"name\", tmpNameDescriptor);\n }\n return res;\n}\nfunction executeAction(actionName, canRunAsDerivation, fn, scope, args) {\n var runInfo = _startAction(actionName, canRunAsDerivation, scope, args);\n try {\n return fn.apply(scope, args);\n } catch (err) {\n runInfo.error_ = err;\n throw err;\n } finally {\n _endAction(runInfo);\n }\n}\nfunction _startAction(actionName, canRunAsDerivation,\n// true for autoAction\nscope, args) {\n var notifySpy_ = true && isSpyEnabled() && !!actionName;\n var startTime_ = 0;\n if ( true && notifySpy_) {\n startTime_ = Date.now();\n var flattenedArgs = args ? Array.from(args) : EMPTY_ARRAY;\n spyReportStart({\n type: ACTION,\n name: actionName,\n object: scope,\n arguments: flattenedArgs\n });\n }\n var prevDerivation_ = globalState.trackingDerivation;\n var runAsAction = !canRunAsDerivation || !prevDerivation_;\n startBatch();\n var prevAllowStateChanges_ = globalState.allowStateChanges; // by default preserve previous allow\n if (runAsAction) {\n untrackedStart();\n prevAllowStateChanges_ = allowStateChangesStart(true);\n }\n var prevAllowStateReads_ = allowStateReadsStart(true);\n var runInfo = {\n runAsAction_: runAsAction,\n prevDerivation_: prevDerivation_,\n prevAllowStateChanges_: prevAllowStateChanges_,\n prevAllowStateReads_: prevAllowStateReads_,\n notifySpy_: notifySpy_,\n startTime_: startTime_,\n actionId_: nextActionId++,\n parentActionId_: currentActionId\n };\n currentActionId = runInfo.actionId_;\n return runInfo;\n}\nfunction _endAction(runInfo) {\n if (currentActionId !== runInfo.actionId_) {\n die(30);\n }\n currentActionId = runInfo.parentActionId_;\n if (runInfo.error_ !== undefined) {\n globalState.suppressReactionErrors = true;\n }\n allowStateChangesEnd(runInfo.prevAllowStateChanges_);\n allowStateReadsEnd(runInfo.prevAllowStateReads_);\n endBatch();\n if (runInfo.runAsAction_) {\n untrackedEnd(runInfo.prevDerivation_);\n }\n if ( true && runInfo.notifySpy_) {\n spyReportEnd({\n time: Date.now() - runInfo.startTime_\n });\n }\n globalState.suppressReactionErrors = false;\n}\nfunction allowStateChanges(allowStateChanges, func) {\n var prev = allowStateChangesStart(allowStateChanges);\n try {\n return func();\n } finally {\n allowStateChangesEnd(prev);\n }\n}\nfunction allowStateChangesStart(allowStateChanges) {\n var prev = globalState.allowStateChanges;\n globalState.allowStateChanges = allowStateChanges;\n return prev;\n}\nfunction allowStateChangesEnd(prev) {\n globalState.allowStateChanges = prev;\n}\n\nvar CREATE = \"create\";\nvar ObservableValue = /*#__PURE__*/function (_Atom) {\n function ObservableValue(value, enhancer, name_, notifySpy, equals) {\n var _this;\n if (name_ === void 0) {\n name_ = true ? \"ObservableValue@\" + getNextId() : 0;\n }\n if (notifySpy === void 0) {\n notifySpy = true;\n }\n if (equals === void 0) {\n equals = comparer[\"default\"];\n }\n _this = _Atom.call(this, name_) || this;\n _this.enhancer = void 0;\n _this.name_ = void 0;\n _this.equals = void 0;\n _this.hasUnreportedChange_ = false;\n _this.interceptors_ = void 0;\n _this.changeListeners_ = void 0;\n _this.value_ = void 0;\n _this.dehancer = void 0;\n _this.enhancer = enhancer;\n _this.name_ = name_;\n _this.equals = equals;\n _this.value_ = enhancer(value, undefined, name_);\n if ( true && notifySpy && isSpyEnabled()) {\n // only notify spy if this is a stand-alone observable\n spyReport({\n type: CREATE,\n object: _this,\n observableKind: \"value\",\n debugObjectName: _this.name_,\n newValue: \"\" + _this.value_\n });\n }\n return _this;\n }\n _inheritsLoose(ObservableValue, _Atom);\n var _proto = ObservableValue.prototype;\n _proto.dehanceValue = function dehanceValue(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.set = function set(newValue) {\n var oldValue = this.value_;\n newValue = this.prepareNewValue_(newValue);\n if (newValue !== globalState.UNCHANGED) {\n var notifySpy = isSpyEnabled();\n if ( true && notifySpy) {\n spyReportStart({\n type: UPDATE,\n object: this,\n observableKind: \"value\",\n debugObjectName: this.name_,\n newValue: newValue,\n oldValue: oldValue\n });\n }\n this.setNewValue_(newValue);\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n };\n _proto.prepareNewValue_ = function prepareNewValue_(newValue) {\n checkIfStateModificationsAreAllowed(this);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this,\n type: UPDATE,\n newValue: newValue\n });\n if (!change) {\n return globalState.UNCHANGED;\n }\n newValue = change.newValue;\n }\n // apply modifier\n newValue = this.enhancer(newValue, this.value_, this.name_);\n return this.equals(this.value_, newValue) ? globalState.UNCHANGED : newValue;\n };\n _proto.setNewValue_ = function setNewValue_(newValue) {\n var oldValue = this.value_;\n this.value_ = newValue;\n this.reportChanged();\n if (hasListeners(this)) {\n notifyListeners(this, {\n type: UPDATE,\n object: this,\n newValue: newValue,\n oldValue: oldValue\n });\n }\n };\n _proto.get = function get() {\n this.reportObserved();\n return this.dehanceValue(this.value_);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n if (fireImmediately) {\n listener({\n observableKind: \"value\",\n debugObjectName: this.name_,\n object: this,\n type: UPDATE,\n newValue: this.value_,\n oldValue: undefined\n });\n }\n return registerListener(this, listener);\n };\n _proto.raw = function raw() {\n // used by MST ot get undehanced value\n return this.value_;\n };\n _proto.toJSON = function toJSON() {\n return this.get();\n };\n _proto.toString = function toString() {\n return this.name_ + \"[\" + this.value_ + \"]\";\n };\n _proto.valueOf = function valueOf() {\n return toPrimitive(this.get());\n };\n _proto[Symbol.toPrimitive] = function () {\n return this.valueOf();\n };\n return ObservableValue;\n}(Atom);\nvar isObservableValue = /*#__PURE__*/createInstanceofPredicate(\"ObservableValue\", ObservableValue);\n\n/**\n * A node in the state dependency root that observes other nodes, and can be observed itself.\n *\n * ComputedValue will remember the result of the computation for the duration of the batch, or\n * while being observed.\n *\n * During this time it will recompute only when one of its direct dependencies changed,\n * but only when it is being accessed with `ComputedValue.get()`.\n *\n * Implementation description:\n * 1. First time it's being accessed it will compute and remember result\n * give back remembered result until 2. happens\n * 2. First time any deep dependency change, propagate POSSIBLY_STALE to all observers, wait for 3.\n * 3. When it's being accessed, recompute if any shallow dependency changed.\n * if result changed: propagate STALE to all observers, that were POSSIBLY_STALE from the last step.\n * go to step 2. either way\n *\n * If at any point it's outside batch and it isn't observed: reset everything and go to 1.\n */\nvar ComputedValue = /*#__PURE__*/function () {\n /**\n * Create a new computed value based on a function expression.\n *\n * The `name` property is for debug purposes only.\n *\n * The `equals` property specifies the comparer function to use to determine if a newly produced\n * value differs from the previous value. Two comparers are provided in the library; `defaultComparer`\n * compares based on identity comparison (===), and `structuralComparer` deeply compares the structure.\n * Structural comparison can be convenient if you always produce a new aggregated object and\n * don't want to notify observers if it is structurally the same.\n * This is useful for working with vectors, mouse coordinates etc.\n */\n function ComputedValue(options) {\n this.dependenciesState_ = IDerivationState_.NOT_TRACKING_;\n this.observing_ = [];\n // nodes we are looking at. Our value depends on these nodes\n this.newObserving_ = null;\n // during tracking it's an array with new observed observers\n this.observers_ = new Set();\n this.runId_ = 0;\n this.lastAccessedBy_ = 0;\n this.lowestObserverState_ = IDerivationState_.UP_TO_DATE_;\n this.unboundDepsCount_ = 0;\n this.value_ = new CaughtException(null);\n this.name_ = void 0;\n this.triggeredBy_ = void 0;\n this.flags_ = 0;\n this.derivation = void 0;\n // N.B: unminified as it is used by MST\n this.setter_ = void 0;\n this.isTracing_ = TraceMode.NONE;\n this.scope_ = void 0;\n this.equals_ = void 0;\n this.requiresReaction_ = void 0;\n this.keepAlive_ = void 0;\n this.onBOL = void 0;\n this.onBUOL = void 0;\n if (!options.get) {\n die(31);\n }\n this.derivation = options.get;\n this.name_ = options.name || ( true ? \"ComputedValue@\" + getNextId() : 0);\n if (options.set) {\n this.setter_ = createAction( true ? this.name_ + \"-setter\" : 0, options.set);\n }\n this.equals_ = options.equals || (options.compareStructural || options.struct ? comparer.structural : comparer[\"default\"]);\n this.scope_ = options.context;\n this.requiresReaction_ = options.requiresReaction;\n this.keepAlive_ = !!options.keepAlive;\n }\n var _proto = ComputedValue.prototype;\n _proto.onBecomeStale_ = function onBecomeStale_() {\n propagateMaybeChanged(this);\n };\n _proto.onBO = function onBO() {\n if (this.onBOL) {\n this.onBOL.forEach(function (listener) {\n return listener();\n });\n }\n };\n _proto.onBUO = function onBUO() {\n if (this.onBUOL) {\n this.onBUOL.forEach(function (listener) {\n return listener();\n });\n }\n }\n // to check for cycles\n ;\n /**\n * Returns the current value of this computed value.\n * Will evaluate its computation first if needed.\n */\n _proto.get = function get() {\n if (this.isComputing) {\n die(32, this.name_, this.derivation);\n }\n if (globalState.inBatch === 0 &&\n // !globalState.trackingDerivatpion &&\n this.observers_.size === 0 && !this.keepAlive_) {\n if (shouldCompute(this)) {\n this.warnAboutUntrackedRead_();\n startBatch(); // See perf test 'computed memoization'\n this.value_ = this.computeValue_(false);\n endBatch();\n }\n } else {\n reportObserved(this);\n if (shouldCompute(this)) {\n var prevTrackingContext = globalState.trackingContext;\n if (this.keepAlive_ && !prevTrackingContext) {\n globalState.trackingContext = this;\n }\n if (this.trackAndCompute()) {\n propagateChangeConfirmed(this);\n }\n globalState.trackingContext = prevTrackingContext;\n }\n }\n var result = this.value_;\n if (isCaughtException(result)) {\n throw result.cause;\n }\n return result;\n };\n _proto.set = function set(value) {\n if (this.setter_) {\n if (this.isRunningSetter) {\n die(33, this.name_);\n }\n this.isRunningSetter = true;\n try {\n this.setter_.call(this.scope_, value);\n } finally {\n this.isRunningSetter = false;\n }\n } else {\n die(34, this.name_);\n }\n };\n _proto.trackAndCompute = function trackAndCompute() {\n // N.B: unminified as it is used by MST\n var oldValue = this.value_;\n var wasSuspended = /* see #1208 */this.dependenciesState_ === IDerivationState_.NOT_TRACKING_;\n var newValue = this.computeValue_(true);\n var changed = wasSuspended || isCaughtException(oldValue) || isCaughtException(newValue) || !this.equals_(oldValue, newValue);\n if (changed) {\n this.value_ = newValue;\n if ( true && isSpyEnabled()) {\n spyReport({\n observableKind: \"computed\",\n debugObjectName: this.name_,\n object: this.scope_,\n type: \"update\",\n oldValue: oldValue,\n newValue: newValue\n });\n }\n }\n return changed;\n };\n _proto.computeValue_ = function computeValue_(track) {\n this.isComputing = true;\n // don't allow state changes during computation\n var prev = allowStateChangesStart(false);\n var res;\n if (track) {\n res = trackDerivedFunction(this, this.derivation, this.scope_);\n } else {\n if (globalState.disableErrorBoundaries === true) {\n res = this.derivation.call(this.scope_);\n } else {\n try {\n res = this.derivation.call(this.scope_);\n } catch (e) {\n res = new CaughtException(e);\n }\n }\n }\n allowStateChangesEnd(prev);\n this.isComputing = false;\n return res;\n };\n _proto.suspend_ = function suspend_() {\n if (!this.keepAlive_) {\n clearObserving(this);\n this.value_ = undefined; // don't hold on to computed value!\n if ( true && this.isTracing_ !== TraceMode.NONE) {\n console.log(\"[mobx.trace] Computed value '\" + this.name_ + \"' was suspended and it will recompute on the next access.\");\n }\n }\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n var _this = this;\n var firstTime = true;\n var prevValue = undefined;\n return autorun(function () {\n // TODO: why is this in a different place than the spyReport() function? in all other observables it's called in the same place\n var newValue = _this.get();\n if (!firstTime || fireImmediately) {\n var prevU = untrackedStart();\n listener({\n observableKind: \"computed\",\n debugObjectName: _this.name_,\n type: UPDATE,\n object: _this,\n newValue: newValue,\n oldValue: prevValue\n });\n untrackedEnd(prevU);\n }\n firstTime = false;\n prevValue = newValue;\n });\n };\n _proto.warnAboutUntrackedRead_ = function warnAboutUntrackedRead_() {\n if (false) {}\n if (this.isTracing_ !== TraceMode.NONE) {\n console.log(\"[mobx.trace] Computed value '\" + this.name_ + \"' is being read outside a reactive context. Doing a full recompute.\");\n }\n if (typeof this.requiresReaction_ === \"boolean\" ? this.requiresReaction_ : globalState.computedRequiresReaction) {\n console.warn(\"[mobx] Computed value '\" + this.name_ + \"' is being read outside a reactive context. Doing a full recompute.\");\n }\n };\n _proto.toString = function toString() {\n return this.name_ + \"[\" + this.derivation.toString() + \"]\";\n };\n _proto.valueOf = function valueOf() {\n return toPrimitive(this.get());\n };\n _proto[Symbol.toPrimitive] = function () {\n return this.valueOf();\n };\n return _createClass(ComputedValue, [{\n key: \"isComputing\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isComputingMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isComputingMask_, newValue);\n }\n }, {\n key: \"isRunningSetter\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isRunningSetterMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isRunningSetterMask_, newValue);\n }\n }, {\n key: \"isBeingObserved\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isBeingObservedMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isBeingObservedMask_, newValue);\n }\n }, {\n key: \"isPendingUnobservation\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isPendingUnobservationMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isPendingUnobservationMask_, newValue);\n }\n }, {\n key: \"diffValue\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.diffValueMask_) ? 1 : 0;\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.diffValueMask_, newValue === 1 ? true : false);\n }\n }]);\n}();\nComputedValue.isComputingMask_ = 1;\nComputedValue.isRunningSetterMask_ = 2;\nComputedValue.isBeingObservedMask_ = 4;\nComputedValue.isPendingUnobservationMask_ = 8;\nComputedValue.diffValueMask_ = 16;\nvar isComputedValue = /*#__PURE__*/createInstanceofPredicate(\"ComputedValue\", ComputedValue);\n\nvar IDerivationState_;\n(function (IDerivationState_) {\n // before being run or (outside batch and not being observed)\n // at this point derivation is not holding any data about dependency tree\n IDerivationState_[IDerivationState_[\"NOT_TRACKING_\"] = -1] = \"NOT_TRACKING_\";\n // no shallow dependency changed since last computation\n // won't recalculate derivation\n // this is what makes mobx fast\n IDerivationState_[IDerivationState_[\"UP_TO_DATE_\"] = 0] = \"UP_TO_DATE_\";\n // some deep dependency changed, but don't know if shallow dependency changed\n // will require to check first if UP_TO_DATE or POSSIBLY_STALE\n // currently only ComputedValue will propagate POSSIBLY_STALE\n //\n // having this state is second big optimization:\n // don't have to recompute on every dependency change, but only when it's needed\n IDerivationState_[IDerivationState_[\"POSSIBLY_STALE_\"] = 1] = \"POSSIBLY_STALE_\";\n // A shallow dependency has changed since last computation and the derivation\n // will need to recompute when it's needed next.\n IDerivationState_[IDerivationState_[\"STALE_\"] = 2] = \"STALE_\";\n})(IDerivationState_ || (IDerivationState_ = {}));\nvar TraceMode;\n(function (TraceMode) {\n TraceMode[TraceMode[\"NONE\"] = 0] = \"NONE\";\n TraceMode[TraceMode[\"LOG\"] = 1] = \"LOG\";\n TraceMode[TraceMode[\"BREAK\"] = 2] = \"BREAK\";\n})(TraceMode || (TraceMode = {}));\nvar CaughtException = function CaughtException(cause) {\n this.cause = void 0;\n this.cause = cause;\n // Empty\n};\nfunction isCaughtException(e) {\n return e instanceof CaughtException;\n}\n/**\n * Finds out whether any dependency of the derivation has actually changed.\n * If dependenciesState is 1 then it will recalculate dependencies,\n * if any dependency changed it will propagate it by changing dependenciesState to 2.\n *\n * By iterating over the dependencies in the same order that they were reported and\n * stopping on the first change, all the recalculations are only called for ComputedValues\n * that will be tracked by derivation. That is because we assume that if the first x\n * dependencies of the derivation doesn't change then the derivation should run the same way\n * up until accessing x-th dependency.\n */\nfunction shouldCompute(derivation) {\n switch (derivation.dependenciesState_) {\n case IDerivationState_.UP_TO_DATE_:\n return false;\n case IDerivationState_.NOT_TRACKING_:\n case IDerivationState_.STALE_:\n return true;\n case IDerivationState_.POSSIBLY_STALE_:\n {\n // state propagation can occur outside of action/reactive context #2195\n var prevAllowStateReads = allowStateReadsStart(true);\n var prevUntracked = untrackedStart(); // no need for those computeds to be reported, they will be picked up in trackDerivedFunction.\n var obs = derivation.observing_,\n l = obs.length;\n for (var i = 0; i < l; i++) {\n var obj = obs[i];\n if (isComputedValue(obj)) {\n if (globalState.disableErrorBoundaries) {\n obj.get();\n } else {\n try {\n obj.get();\n } catch (e) {\n // we are not interested in the value *or* exception at this moment, but if there is one, notify all\n untrackedEnd(prevUntracked);\n allowStateReadsEnd(prevAllowStateReads);\n return true;\n }\n }\n // if ComputedValue `obj` actually changed it will be computed and propagated to its observers.\n // and `derivation` is an observer of `obj`\n // invariantShouldCompute(derivation)\n if (derivation.dependenciesState_ === IDerivationState_.STALE_) {\n untrackedEnd(prevUntracked);\n allowStateReadsEnd(prevAllowStateReads);\n return true;\n }\n }\n }\n changeDependenciesStateTo0(derivation);\n untrackedEnd(prevUntracked);\n allowStateReadsEnd(prevAllowStateReads);\n return false;\n }\n }\n}\nfunction isComputingDerivation() {\n return globalState.trackingDerivation !== null; // filter out actions inside computations\n}\nfunction checkIfStateModificationsAreAllowed(atom) {\n if (false) {}\n var hasObservers = atom.observers_.size > 0;\n // Should not be possible to change observed state outside strict mode, except during initialization, see #563\n if (!globalState.allowStateChanges && (hasObservers || globalState.enforceActions === \"always\")) {\n console.warn(\"[MobX] \" + (globalState.enforceActions ? \"Since strict-mode is enabled, changing (observed) observable values without using an action is not allowed. Tried to modify: \" : \"Side effects like changing state are not allowed at this point. Are you trying to modify state from, for example, a computed value or the render function of a React component? You can wrap side effects in 'runInAction' (or decorate functions with 'action') if needed. Tried to modify: \") + atom.name_);\n }\n}\nfunction checkIfStateReadsAreAllowed(observable) {\n if ( true && !globalState.allowStateReads && globalState.observableRequiresReaction) {\n console.warn(\"[mobx] Observable '\" + observable.name_ + \"' being read outside a reactive context.\");\n }\n}\n/**\n * Executes the provided function `f` and tracks which observables are being accessed.\n * The tracking information is stored on the `derivation` object and the derivation is registered\n * as observer of any of the accessed observables.\n */\nfunction trackDerivedFunction(derivation, f, context) {\n var prevAllowStateReads = allowStateReadsStart(true);\n changeDependenciesStateTo0(derivation);\n // Preallocate array; will be trimmed by bindDependencies.\n derivation.newObserving_ = new Array(\n // Reserve constant space for initial dependencies, dynamic space otherwise.\n // See https://github.com/mobxjs/mobx/pull/3833\n derivation.runId_ === 0 ? 100 : derivation.observing_.length);\n derivation.unboundDepsCount_ = 0;\n derivation.runId_ = ++globalState.runId;\n var prevTracking = globalState.trackingDerivation;\n globalState.trackingDerivation = derivation;\n globalState.inBatch++;\n var result;\n if (globalState.disableErrorBoundaries === true) {\n result = f.call(context);\n } else {\n try {\n result = f.call(context);\n } catch (e) {\n result = new CaughtException(e);\n }\n }\n globalState.inBatch--;\n globalState.trackingDerivation = prevTracking;\n bindDependencies(derivation);\n warnAboutDerivationWithoutDependencies(derivation);\n allowStateReadsEnd(prevAllowStateReads);\n return result;\n}\nfunction warnAboutDerivationWithoutDependencies(derivation) {\n if (false) {}\n if (derivation.observing_.length !== 0) {\n return;\n }\n if (typeof derivation.requiresObservable_ === \"boolean\" ? derivation.requiresObservable_ : globalState.reactionRequiresObservable) {\n console.warn(\"[mobx] Derivation '\" + derivation.name_ + \"' is created/updated without reading any observable value.\");\n }\n}\n/**\n * diffs newObserving with observing.\n * update observing to be newObserving with unique observables\n * notify observers that become observed/unobserved\n */\nfunction bindDependencies(derivation) {\n // invariant(derivation.dependenciesState !== IDerivationState.NOT_TRACKING, \"INTERNAL ERROR bindDependencies expects derivation.dependenciesState !== -1\");\n var prevObserving = derivation.observing_;\n var observing = derivation.observing_ = derivation.newObserving_;\n var lowestNewObservingDerivationState = IDerivationState_.UP_TO_DATE_;\n // Go through all new observables and check diffValue: (this list can contain duplicates):\n // 0: first occurrence, change to 1 and keep it\n // 1: extra occurrence, drop it\n var i0 = 0,\n l = derivation.unboundDepsCount_;\n for (var i = 0; i < l; i++) {\n var dep = observing[i];\n if (dep.diffValue === 0) {\n dep.diffValue = 1;\n if (i0 !== i) {\n observing[i0] = dep;\n }\n i0++;\n }\n // Upcast is 'safe' here, because if dep is IObservable, `dependenciesState` will be undefined,\n // not hitting the condition\n if (dep.dependenciesState_ > lowestNewObservingDerivationState) {\n lowestNewObservingDerivationState = dep.dependenciesState_;\n }\n }\n observing.length = i0;\n derivation.newObserving_ = null; // newObserving shouldn't be needed outside tracking (statement moved down to work around FF bug, see #614)\n // Go through all old observables and check diffValue: (it is unique after last bindDependencies)\n // 0: it's not in new observables, unobserve it\n // 1: it keeps being observed, don't want to notify it. change to 0\n l = prevObserving.length;\n while (l--) {\n var _dep = prevObserving[l];\n if (_dep.diffValue === 0) {\n removeObserver(_dep, derivation);\n }\n _dep.diffValue = 0;\n }\n // Go through all new observables and check diffValue: (now it should be unique)\n // 0: it was set to 0 in last loop. don't need to do anything.\n // 1: it wasn't observed, let's observe it. set back to 0\n while (i0--) {\n var _dep2 = observing[i0];\n if (_dep2.diffValue === 1) {\n _dep2.diffValue = 0;\n addObserver(_dep2, derivation);\n }\n }\n // Some new observed derivations may become stale during this derivation computation\n // so they have had no chance to propagate staleness (#916)\n if (lowestNewObservingDerivationState !== IDerivationState_.UP_TO_DATE_) {\n derivation.dependenciesState_ = lowestNewObservingDerivationState;\n derivation.onBecomeStale_();\n }\n}\nfunction clearObserving(derivation) {\n // invariant(globalState.inBatch > 0, \"INTERNAL ERROR clearObserving should be called only inside batch\");\n var obs = derivation.observing_;\n derivation.observing_ = [];\n var i = obs.length;\n while (i--) {\n removeObserver(obs[i], derivation);\n }\n derivation.dependenciesState_ = IDerivationState_.NOT_TRACKING_;\n}\nfunction untracked(action) {\n var prev = untrackedStart();\n try {\n return action();\n } finally {\n untrackedEnd(prev);\n }\n}\nfunction untrackedStart() {\n var prev = globalState.trackingDerivation;\n globalState.trackingDerivation = null;\n return prev;\n}\nfunction untrackedEnd(prev) {\n globalState.trackingDerivation = prev;\n}\nfunction allowStateReadsStart(allowStateReads) {\n var prev = globalState.allowStateReads;\n globalState.allowStateReads = allowStateReads;\n return prev;\n}\nfunction allowStateReadsEnd(prev) {\n globalState.allowStateReads = prev;\n}\n/**\n * needed to keep `lowestObserverState` correct. when changing from (2 or 1) to 0\n *\n */\nfunction changeDependenciesStateTo0(derivation) {\n if (derivation.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {\n return;\n }\n derivation.dependenciesState_ = IDerivationState_.UP_TO_DATE_;\n var obs = derivation.observing_;\n var i = obs.length;\n while (i--) {\n obs[i].lowestObserverState_ = IDerivationState_.UP_TO_DATE_;\n }\n}\n\n/**\n * These values will persist if global state is reset\n */\nvar persistentKeys = [\"mobxGuid\", \"spyListeners\", \"enforceActions\", \"computedRequiresReaction\", \"reactionRequiresObservable\", \"observableRequiresReaction\", \"allowStateReads\", \"disableErrorBoundaries\", \"runId\", \"UNCHANGED\", \"useProxies\"];\nvar MobXGlobals = function MobXGlobals() {\n /**\n * MobXGlobals version.\n * MobX compatiblity with other versions loaded in memory as long as this version matches.\n * It indicates that the global state still stores similar information\n *\n * N.B: this version is unrelated to the package version of MobX, and is only the version of the\n * internal state storage of MobX, and can be the same across many different package versions\n */\n this.version = 6;\n /**\n * globally unique token to signal unchanged\n */\n this.UNCHANGED = {};\n /**\n * Currently running derivation\n */\n this.trackingDerivation = null;\n /**\n * Currently running reaction. This determines if we currently have a reactive context.\n * (Tracking derivation is also set for temporal tracking of computed values inside actions,\n * but trackingReaction can only be set by a form of Reaction)\n */\n this.trackingContext = null;\n /**\n * Each time a derivation is tracked, it is assigned a unique run-id\n */\n this.runId = 0;\n /**\n * 'guid' for general purpose. Will be persisted amongst resets.\n */\n this.mobxGuid = 0;\n /**\n * Are we in a batch block? (and how many of them)\n */\n this.inBatch = 0;\n /**\n * Observables that don't have observers anymore, and are about to be\n * suspended, unless somebody else accesses it in the same batch\n *\n * @type {IObservable[]}\n */\n this.pendingUnobservations = [];\n /**\n * List of scheduled, not yet executed, reactions.\n */\n this.pendingReactions = [];\n /**\n * Are we currently processing reactions?\n */\n this.isRunningReactions = false;\n /**\n * Is it allowed to change observables at this point?\n * In general, MobX doesn't allow that when running computations and React.render.\n * To ensure that those functions stay pure.\n */\n this.allowStateChanges = false;\n /**\n * Is it allowed to read observables at this point?\n * Used to hold the state needed for `observableRequiresReaction`\n */\n this.allowStateReads = true;\n /**\n * If strict mode is enabled, state changes are by default not allowed\n */\n this.enforceActions = true;\n /**\n * Spy callbacks\n */\n this.spyListeners = [];\n /**\n * Globally attached error handlers that react specifically to errors in reactions\n */\n this.globalReactionErrorHandlers = [];\n /**\n * Warn if computed values are accessed outside a reactive context\n */\n this.computedRequiresReaction = false;\n /**\n * (Experimental)\n * Warn if you try to create to derivation / reactive context without accessing any observable.\n */\n this.reactionRequiresObservable = false;\n /**\n * (Experimental)\n * Warn if observables are accessed outside a reactive context\n */\n this.observableRequiresReaction = false;\n /*\n * Don't catch and rethrow exceptions. This is useful for inspecting the state of\n * the stack when an exception occurs while debugging.\n */\n this.disableErrorBoundaries = false;\n /*\n * If true, we are already handling an exception in an action. Any errors in reactions should be suppressed, as\n * they are not the cause, see: https://github.com/mobxjs/mobx/issues/1836\n */\n this.suppressReactionErrors = false;\n this.useProxies = true;\n /*\n * print warnings about code that would fail if proxies weren't available\n */\n this.verifyProxies = false;\n /**\n * False forces all object's descriptors to\n * writable: true\n * configurable: true\n */\n this.safeDescriptors = true;\n};\nvar canMergeGlobalState = true;\nvar isolateCalled = false;\nvar globalState = /*#__PURE__*/function () {\n var global = /*#__PURE__*/getGlobal();\n if (global.__mobxInstanceCount > 0 && !global.__mobxGlobals) {\n canMergeGlobalState = false;\n }\n if (global.__mobxGlobals && global.__mobxGlobals.version !== new MobXGlobals().version) {\n canMergeGlobalState = false;\n }\n if (!canMergeGlobalState) {\n // Because this is a IIFE we need to let isolateCalled a chance to change\n // so we run it after the event loop completed at least 1 iteration\n setTimeout(function () {\n if (!isolateCalled) {\n die(35);\n }\n }, 1);\n return new MobXGlobals();\n } else if (global.__mobxGlobals) {\n global.__mobxInstanceCount += 1;\n if (!global.__mobxGlobals.UNCHANGED) {\n global.__mobxGlobals.UNCHANGED = {};\n } // make merge backward compatible\n return global.__mobxGlobals;\n } else {\n global.__mobxInstanceCount = 1;\n return global.__mobxGlobals = /*#__PURE__*/new MobXGlobals();\n }\n}();\nfunction isolateGlobalState() {\n if (globalState.pendingReactions.length || globalState.inBatch || globalState.isRunningReactions) {\n die(36);\n }\n isolateCalled = true;\n if (canMergeGlobalState) {\n var global = getGlobal();\n if (--global.__mobxInstanceCount === 0) {\n global.__mobxGlobals = undefined;\n }\n globalState = new MobXGlobals();\n }\n}\nfunction getGlobalState() {\n return globalState;\n}\n/**\n * For testing purposes only; this will break the internal state of existing observables,\n * but can be used to get back at a stable state after throwing errors\n */\nfunction resetGlobalState() {\n var defaultGlobals = new MobXGlobals();\n for (var key in defaultGlobals) {\n if (persistentKeys.indexOf(key) === -1) {\n globalState[key] = defaultGlobals[key];\n }\n }\n globalState.allowStateChanges = !globalState.enforceActions;\n}\n\nfunction hasObservers(observable) {\n return observable.observers_ && observable.observers_.size > 0;\n}\nfunction getObservers(observable) {\n return observable.observers_;\n}\n// function invariantObservers(observable: IObservable) {\n// const list = observable.observers\n// const map = observable.observersIndexes\n// const l = list.length\n// for (let i = 0; i < l; i++) {\n// const id = list[i].__mapid\n// if (i) {\n// invariant(map[id] === i, \"INTERNAL ERROR maps derivation.__mapid to index in list\") // for performance\n// } else {\n// invariant(!(id in map), \"INTERNAL ERROR observer on index 0 shouldn't be held in map.\") // for performance\n// }\n// }\n// invariant(\n// list.length === 0 || Object.keys(map).length === list.length - 1,\n// \"INTERNAL ERROR there is no junk in map\"\n// )\n// }\nfunction addObserver(observable, node) {\n // invariant(node.dependenciesState !== -1, \"INTERNAL ERROR, can add only dependenciesState !== -1\");\n // invariant(observable._observers.indexOf(node) === -1, \"INTERNAL ERROR add already added node\");\n // invariantObservers(observable);\n observable.observers_.add(node);\n if (observable.lowestObserverState_ > node.dependenciesState_) {\n observable.lowestObserverState_ = node.dependenciesState_;\n }\n // invariantObservers(observable);\n // invariant(observable._observers.indexOf(node) !== -1, \"INTERNAL ERROR didn't add node\");\n}\nfunction removeObserver(observable, node) {\n // invariant(globalState.inBatch > 0, \"INTERNAL ERROR, remove should be called only inside batch\");\n // invariant(observable._observers.indexOf(node) !== -1, \"INTERNAL ERROR remove already removed node\");\n // invariantObservers(observable);\n observable.observers_[\"delete\"](node);\n if (observable.observers_.size === 0) {\n // deleting last observer\n queueForUnobservation(observable);\n }\n // invariantObservers(observable);\n // invariant(observable._observers.indexOf(node) === -1, \"INTERNAL ERROR remove already removed node2\");\n}\nfunction queueForUnobservation(observable) {\n if (observable.isPendingUnobservation === false) {\n // invariant(observable._observers.length === 0, \"INTERNAL ERROR, should only queue for unobservation unobserved observables\");\n observable.isPendingUnobservation = true;\n globalState.pendingUnobservations.push(observable);\n }\n}\n/**\n * Batch starts a transaction, at least for purposes of memoizing ComputedValues when nothing else does.\n * During a batch `onBecomeUnobserved` will be called at most once per observable.\n * Avoids unnecessary recalculations.\n */\nfunction startBatch() {\n globalState.inBatch++;\n}\nfunction endBatch() {\n if (--globalState.inBatch === 0) {\n runReactions();\n // the batch is actually about to finish, all unobserving should happen here.\n var list = globalState.pendingUnobservations;\n for (var i = 0; i < list.length; i++) {\n var observable = list[i];\n observable.isPendingUnobservation = false;\n if (observable.observers_.size === 0) {\n if (observable.isBeingObserved) {\n // if this observable had reactive observers, trigger the hooks\n observable.isBeingObserved = false;\n observable.onBUO();\n }\n if (observable instanceof ComputedValue) {\n // computed values are automatically teared down when the last observer leaves\n // this process happens recursively, this computed might be the last observabe of another, etc..\n observable.suspend_();\n }\n }\n }\n globalState.pendingUnobservations = [];\n }\n}\nfunction reportObserved(observable) {\n checkIfStateReadsAreAllowed(observable);\n var derivation = globalState.trackingDerivation;\n if (derivation !== null) {\n /**\n * Simple optimization, give each derivation run an unique id (runId)\n * Check if last time this observable was accessed the same runId is used\n * if this is the case, the relation is already known\n */\n if (derivation.runId_ !== observable.lastAccessedBy_) {\n observable.lastAccessedBy_ = derivation.runId_;\n // Tried storing newObserving, or observing, or both as Set, but performance didn't come close...\n derivation.newObserving_[derivation.unboundDepsCount_++] = observable;\n if (!observable.isBeingObserved && globalState.trackingContext) {\n observable.isBeingObserved = true;\n observable.onBO();\n }\n }\n return observable.isBeingObserved;\n } else if (observable.observers_.size === 0 && globalState.inBatch > 0) {\n queueForUnobservation(observable);\n }\n return false;\n}\n// function invariantLOS(observable: IObservable, msg: string) {\n// // it's expensive so better not run it in produciton. but temporarily helpful for testing\n// const min = getObservers(observable).reduce((a, b) => Math.min(a, b.dependenciesState), 2)\n// if (min >= observable.lowestObserverState) return // <- the only assumption about `lowestObserverState`\n// throw new Error(\n// \"lowestObserverState is wrong for \" +\n// msg +\n// \" because \" +\n// min +\n// \" < \" +\n// observable.lowestObserverState\n// )\n// }\n/**\n * NOTE: current propagation mechanism will in case of self reruning autoruns behave unexpectedly\n * It will propagate changes to observers from previous run\n * It's hard or maybe impossible (with reasonable perf) to get it right with current approach\n * Hopefully self reruning autoruns aren't a feature people should depend on\n * Also most basic use cases should be ok\n */\n// Called by Atom when its value changes\nfunction propagateChanged(observable) {\n // invariantLOS(observable, \"changed start\");\n if (observable.lowestObserverState_ === IDerivationState_.STALE_) {\n return;\n }\n observable.lowestObserverState_ = IDerivationState_.STALE_;\n // Ideally we use for..of here, but the downcompiled version is really slow...\n observable.observers_.forEach(function (d) {\n if (d.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {\n if ( true && d.isTracing_ !== TraceMode.NONE) {\n logTraceInfo(d, observable);\n }\n d.onBecomeStale_();\n }\n d.dependenciesState_ = IDerivationState_.STALE_;\n });\n // invariantLOS(observable, \"changed end\");\n}\n// Called by ComputedValue when it recalculate and its value changed\nfunction propagateChangeConfirmed(observable) {\n // invariantLOS(observable, \"confirmed start\");\n if (observable.lowestObserverState_ === IDerivationState_.STALE_) {\n return;\n }\n observable.lowestObserverState_ = IDerivationState_.STALE_;\n observable.observers_.forEach(function (d) {\n if (d.dependenciesState_ === IDerivationState_.POSSIBLY_STALE_) {\n d.dependenciesState_ = IDerivationState_.STALE_;\n if ( true && d.isTracing_ !== TraceMode.NONE) {\n logTraceInfo(d, observable);\n }\n } else if (d.dependenciesState_ === IDerivationState_.UP_TO_DATE_ // this happens during computing of `d`, just keep lowestObserverState up to date.\n ) {\n observable.lowestObserverState_ = IDerivationState_.UP_TO_DATE_;\n }\n });\n // invariantLOS(observable, \"confirmed end\");\n}\n// Used by computed when its dependency changed, but we don't wan't to immediately recompute.\nfunction propagateMaybeChanged(observable) {\n // invariantLOS(observable, \"maybe start\");\n if (observable.lowestObserverState_ !== IDerivationState_.UP_TO_DATE_) {\n return;\n }\n observable.lowestObserverState_ = IDerivationState_.POSSIBLY_STALE_;\n observable.observers_.forEach(function (d) {\n if (d.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {\n d.dependenciesState_ = IDerivationState_.POSSIBLY_STALE_;\n d.onBecomeStale_();\n }\n });\n // invariantLOS(observable, \"maybe end\");\n}\nfunction logTraceInfo(derivation, observable) {\n console.log(\"[mobx.trace] '\" + derivation.name_ + \"' is invalidated due to a change in: '\" + observable.name_ + \"'\");\n if (derivation.isTracing_ === TraceMode.BREAK) {\n var lines = [];\n printDepTree(getDependencyTree(derivation), lines, 1);\n // prettier-ignore\n new Function(\"debugger;\\n/*\\nTracing '\" + derivation.name_ + \"'\\n\\nYou are entering this break point because derivation '\" + derivation.name_ + \"' is being traced and '\" + observable.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\" + (derivation instanceof ComputedValue ? derivation.derivation.toString().replace(/[*]\\//g, \"/\") : \"\") + \"\\n\\nThe dependencies for this derivation are:\\n\\n\" + lines.join(\"\\n\") + \"\\n*/\\n \")();\n }\n}\nfunction printDepTree(tree, lines, depth) {\n if (lines.length >= 1000) {\n lines.push(\"(and many more)\");\n return;\n }\n lines.push(\"\" + \"\\t\".repeat(depth - 1) + tree.name);\n if (tree.dependencies) {\n tree.dependencies.forEach(function (child) {\n return printDepTree(child, lines, depth + 1);\n });\n }\n}\n\nvar Reaction = /*#__PURE__*/function () {\n function Reaction(name_, onInvalidate_, errorHandler_, requiresObservable_) {\n if (name_ === void 0) {\n name_ = true ? \"Reaction@\" + getNextId() : 0;\n }\n this.name_ = void 0;\n this.onInvalidate_ = void 0;\n this.errorHandler_ = void 0;\n this.requiresObservable_ = void 0;\n this.observing_ = [];\n // nodes we are looking at. Our value depends on these nodes\n this.newObserving_ = [];\n this.dependenciesState_ = IDerivationState_.NOT_TRACKING_;\n this.runId_ = 0;\n this.unboundDepsCount_ = 0;\n this.flags_ = 0;\n this.isTracing_ = TraceMode.NONE;\n this.name_ = name_;\n this.onInvalidate_ = onInvalidate_;\n this.errorHandler_ = errorHandler_;\n this.requiresObservable_ = requiresObservable_;\n }\n var _proto = Reaction.prototype;\n _proto.onBecomeStale_ = function onBecomeStale_() {\n this.schedule_();\n };\n _proto.schedule_ = function schedule_() {\n if (!this.isScheduled) {\n this.isScheduled = true;\n globalState.pendingReactions.push(this);\n runReactions();\n }\n }\n /**\n * internal, use schedule() if you intend to kick off a reaction\n */;\n _proto.runReaction_ = function runReaction_() {\n if (!this.isDisposed) {\n startBatch();\n this.isScheduled = false;\n var prev = globalState.trackingContext;\n globalState.trackingContext = this;\n if (shouldCompute(this)) {\n this.isTrackPending = true;\n try {\n this.onInvalidate_();\n if ( true && this.isTrackPending && isSpyEnabled()) {\n // onInvalidate didn't trigger track right away..\n spyReport({\n name: this.name_,\n type: \"scheduled-reaction\"\n });\n }\n } catch (e) {\n this.reportExceptionInDerivation_(e);\n }\n }\n globalState.trackingContext = prev;\n endBatch();\n }\n };\n _proto.track = function track(fn) {\n if (this.isDisposed) {\n return;\n // console.warn(\"Reaction already disposed\") // Note: Not a warning / error in mobx 4 either\n }\n startBatch();\n var notify = isSpyEnabled();\n var startTime;\n if ( true && notify) {\n startTime = Date.now();\n spyReportStart({\n name: this.name_,\n type: \"reaction\"\n });\n }\n this.isRunning = true;\n var prevReaction = globalState.trackingContext; // reactions could create reactions...\n globalState.trackingContext = this;\n var result = trackDerivedFunction(this, fn, undefined);\n globalState.trackingContext = prevReaction;\n this.isRunning = false;\n this.isTrackPending = false;\n if (this.isDisposed) {\n // disposed during last run. Clean up everything that was bound after the dispose call.\n clearObserving(this);\n }\n if (isCaughtException(result)) {\n this.reportExceptionInDerivation_(result.cause);\n }\n if ( true && notify) {\n spyReportEnd({\n time: Date.now() - startTime\n });\n }\n endBatch();\n };\n _proto.reportExceptionInDerivation_ = function reportExceptionInDerivation_(error) {\n var _this = this;\n if (this.errorHandler_) {\n this.errorHandler_(error, this);\n return;\n }\n if (globalState.disableErrorBoundaries) {\n throw error;\n }\n var message = true ? \"[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '\" + this + \"'\" : 0;\n if (!globalState.suppressReactionErrors) {\n console.error(message, error);\n /** If debugging brought you here, please, read the above message :-). Tnx! */\n } else if (true) {\n console.warn(\"[mobx] (error in reaction '\" + this.name_ + \"' suppressed, fix error of causing action below)\");\n } // prettier-ignore\n if ( true && isSpyEnabled()) {\n spyReport({\n type: \"error\",\n name: this.name_,\n message: message,\n error: \"\" + error\n });\n }\n globalState.globalReactionErrorHandlers.forEach(function (f) {\n return f(error, _this);\n });\n };\n _proto.dispose = function dispose() {\n if (!this.isDisposed) {\n this.isDisposed = true;\n if (!this.isRunning) {\n // if disposed while running, clean up later. Maybe not optimal, but rare case\n startBatch();\n clearObserving(this);\n endBatch();\n }\n }\n };\n _proto.getDisposer_ = function getDisposer_(abortSignal) {\n var _this2 = this;\n var dispose = function dispose() {\n _this2.dispose();\n abortSignal == null || abortSignal.removeEventListener == null || abortSignal.removeEventListener(\"abort\", dispose);\n };\n abortSignal == null || abortSignal.addEventListener == null || abortSignal.addEventListener(\"abort\", dispose);\n dispose[$mobx] = this;\n return dispose;\n };\n _proto.toString = function toString() {\n return \"Reaction[\" + this.name_ + \"]\";\n };\n _proto.trace = function trace$1(enterBreakPoint) {\n if (enterBreakPoint === void 0) {\n enterBreakPoint = false;\n }\n trace(this, enterBreakPoint);\n };\n return _createClass(Reaction, [{\n key: \"isDisposed\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isDisposedMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isDisposedMask_, newValue);\n }\n }, {\n key: \"isScheduled\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isScheduledMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isScheduledMask_, newValue);\n }\n }, {\n key: \"isTrackPending\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isTrackPendingMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isTrackPendingMask_, newValue);\n }\n }, {\n key: \"isRunning\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isRunningMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isRunningMask_, newValue);\n }\n }, {\n key: \"diffValue\",\n get: function get() {\n return getFlag(this.flags_, Reaction.diffValueMask_) ? 1 : 0;\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.diffValueMask_, newValue === 1 ? true : false);\n }\n }]);\n}();\nReaction.isDisposedMask_ = 1;\nReaction.isScheduledMask_ = 2;\nReaction.isTrackPendingMask_ = 4;\nReaction.isRunningMask_ = 8;\nReaction.diffValueMask_ = 16;\nfunction onReactionError(handler) {\n globalState.globalReactionErrorHandlers.push(handler);\n return function () {\n var idx = globalState.globalReactionErrorHandlers.indexOf(handler);\n if (idx >= 0) {\n globalState.globalReactionErrorHandlers.splice(idx, 1);\n }\n };\n}\n/**\n * Magic number alert!\n * Defines within how many times a reaction is allowed to re-trigger itself\n * until it is assumed that this is gonna be a never ending loop...\n */\nvar MAX_REACTION_ITERATIONS = 100;\nvar reactionScheduler = function reactionScheduler(f) {\n return f();\n};\nfunction runReactions() {\n // Trampolining, if runReactions are already running, new reactions will be picked up\n if (globalState.inBatch > 0 || globalState.isRunningReactions) {\n return;\n }\n reactionScheduler(runReactionsHelper);\n}\nfunction runReactionsHelper() {\n globalState.isRunningReactions = true;\n var allReactions = globalState.pendingReactions;\n var iterations = 0;\n // While running reactions, new reactions might be triggered.\n // Hence we work with two variables and check whether\n // we converge to no remaining reactions after a while.\n while (allReactions.length > 0) {\n if (++iterations === MAX_REACTION_ITERATIONS) {\n console.error( true ? \"Reaction doesn't converge to a stable state after \" + MAX_REACTION_ITERATIONS + \" iterations.\" + (\" Probably there is a cycle in the reactive function: \" + allReactions[0]) : 0);\n allReactions.splice(0); // clear reactions\n }\n var remainingReactions = allReactions.splice(0);\n for (var i = 0, l = remainingReactions.length; i < l; i++) {\n remainingReactions[i].runReaction_();\n }\n }\n globalState.isRunningReactions = false;\n}\nvar isReaction = /*#__PURE__*/createInstanceofPredicate(\"Reaction\", Reaction);\nfunction setReactionScheduler(fn) {\n var baseScheduler = reactionScheduler;\n reactionScheduler = function reactionScheduler(f) {\n return fn(function () {\n return baseScheduler(f);\n });\n };\n}\n\nfunction isSpyEnabled() {\n return true && !!globalState.spyListeners.length;\n}\nfunction spyReport(event) {\n if (false) {} // dead code elimination can do the rest\n if (!globalState.spyListeners.length) {\n return;\n }\n var listeners = globalState.spyListeners;\n for (var i = 0, l = listeners.length; i < l; i++) {\n listeners[i](event);\n }\n}\nfunction spyReportStart(event) {\n if (false) {}\n var change = _extends({}, event, {\n spyReportStart: true\n });\n spyReport(change);\n}\nvar END_EVENT = {\n type: \"report-end\",\n spyReportEnd: true\n};\nfunction spyReportEnd(change) {\n if (false) {}\n if (change) {\n spyReport(_extends({}, change, {\n type: \"report-end\",\n spyReportEnd: true\n }));\n } else {\n spyReport(END_EVENT);\n }\n}\nfunction spy(listener) {\n if (false) {} else {\n globalState.spyListeners.push(listener);\n return once(function () {\n globalState.spyListeners = globalState.spyListeners.filter(function (l) {\n return l !== listener;\n });\n });\n }\n}\n\nvar ACTION = \"action\";\nvar ACTION_BOUND = \"action.bound\";\nvar AUTOACTION = \"autoAction\";\nvar AUTOACTION_BOUND = \"autoAction.bound\";\nvar DEFAULT_ACTION_NAME = \"\";\nvar actionAnnotation = /*#__PURE__*/createActionAnnotation(ACTION);\nvar actionBoundAnnotation = /*#__PURE__*/createActionAnnotation(ACTION_BOUND, {\n bound: true\n});\nvar autoActionAnnotation = /*#__PURE__*/createActionAnnotation(AUTOACTION, {\n autoAction: true\n});\nvar autoActionBoundAnnotation = /*#__PURE__*/createActionAnnotation(AUTOACTION_BOUND, {\n autoAction: true,\n bound: true\n});\nfunction createActionFactory(autoAction) {\n var res = function action(arg1, arg2) {\n // action(fn() {})\n if (isFunction(arg1)) {\n return createAction(arg1.name || DEFAULT_ACTION_NAME, arg1, autoAction);\n }\n // action(\"name\", fn() {})\n if (isFunction(arg2)) {\n return createAction(arg1, arg2, autoAction);\n }\n // @action (2022.3 Decorators)\n if (is20223Decorator(arg2)) {\n return (autoAction ? autoActionAnnotation : actionAnnotation).decorate_20223_(arg1, arg2);\n }\n // @action\n if (isStringish(arg2)) {\n return storeAnnotation(arg1, arg2, autoAction ? autoActionAnnotation : actionAnnotation);\n }\n // action(\"name\") & @action(\"name\")\n if (isStringish(arg1)) {\n return createDecoratorAnnotation(createActionAnnotation(autoAction ? AUTOACTION : ACTION, {\n name: arg1,\n autoAction: autoAction\n }));\n }\n if (true) {\n die(\"Invalid arguments for `action`\");\n }\n };\n return res;\n}\nvar action = /*#__PURE__*/createActionFactory(false);\nObject.assign(action, actionAnnotation);\nvar autoAction = /*#__PURE__*/createActionFactory(true);\nObject.assign(autoAction, autoActionAnnotation);\naction.bound = /*#__PURE__*/createDecoratorAnnotation(actionBoundAnnotation);\nautoAction.bound = /*#__PURE__*/createDecoratorAnnotation(autoActionBoundAnnotation);\nfunction runInAction(fn) {\n return executeAction(fn.name || DEFAULT_ACTION_NAME, false, fn, this, undefined);\n}\nfunction isAction(thing) {\n return isFunction(thing) && thing.isMobxAction === true;\n}\n\n/**\n * Creates a named reactive view and keeps it alive, so that the view is always\n * updated if one of the dependencies changes, even when the view is not further used by something else.\n * @param view The reactive view\n * @returns disposer function, which can be used to stop the view from being updated in the future.\n */\nfunction autorun(view, opts) {\n var _opts$name, _opts, _opts2, _opts3;\n if (opts === void 0) {\n opts = EMPTY_OBJECT;\n }\n if (true) {\n if (!isFunction(view)) {\n die(\"Autorun expects a function as first argument\");\n }\n if (isAction(view)) {\n die(\"Autorun does not accept actions since actions are untrackable\");\n }\n }\n var name = (_opts$name = (_opts = opts) == null ? void 0 : _opts.name) != null ? _opts$name : true ? view.name || \"Autorun@\" + getNextId() : 0;\n var runSync = !opts.scheduler && !opts.delay;\n var reaction;\n if (runSync) {\n // normal autorun\n reaction = new Reaction(name, function () {\n this.track(reactionRunner);\n }, opts.onError, opts.requiresObservable);\n } else {\n var scheduler = createSchedulerFromOptions(opts);\n // debounced autorun\n var isScheduled = false;\n reaction = new Reaction(name, function () {\n if (!isScheduled) {\n isScheduled = true;\n scheduler(function () {\n isScheduled = false;\n if (!reaction.isDisposed) {\n reaction.track(reactionRunner);\n }\n });\n }\n }, opts.onError, opts.requiresObservable);\n }\n function reactionRunner() {\n view(reaction);\n }\n if (!((_opts2 = opts) != null && (_opts2 = _opts2.signal) != null && _opts2.aborted)) {\n reaction.schedule_();\n }\n return reaction.getDisposer_((_opts3 = opts) == null ? void 0 : _opts3.signal);\n}\nvar run = function run(f) {\n return f();\n};\nfunction createSchedulerFromOptions(opts) {\n return opts.scheduler ? opts.scheduler : opts.delay ? function (f) {\n return setTimeout(f, opts.delay);\n } : run;\n}\nfunction reaction(expression, effect, opts) {\n var _opts$name2, _opts4, _opts5;\n if (opts === void 0) {\n opts = EMPTY_OBJECT;\n }\n if (true) {\n if (!isFunction(expression) || !isFunction(effect)) {\n die(\"First and second argument to reaction should be functions\");\n }\n if (!isPlainObject(opts)) {\n die(\"Third argument of reactions should be an object\");\n }\n }\n var name = (_opts$name2 = opts.name) != null ? _opts$name2 : true ? \"Reaction@\" + getNextId() : 0;\n var effectAction = action(name, opts.onError ? wrapErrorHandler(opts.onError, effect) : effect);\n var runSync = !opts.scheduler && !opts.delay;\n var scheduler = createSchedulerFromOptions(opts);\n var firstTime = true;\n var isScheduled = false;\n var value;\n var equals = opts.compareStructural ? comparer.structural : opts.equals || comparer[\"default\"];\n var r = new Reaction(name, function () {\n if (firstTime || runSync) {\n reactionRunner();\n } else if (!isScheduled) {\n isScheduled = true;\n scheduler(reactionRunner);\n }\n }, opts.onError, opts.requiresObservable);\n function reactionRunner() {\n isScheduled = false;\n if (r.isDisposed) {\n return;\n }\n var changed = false;\n var oldValue = value;\n r.track(function () {\n var nextValue = allowStateChanges(false, function () {\n return expression(r);\n });\n changed = firstTime || !equals(value, nextValue);\n value = nextValue;\n });\n if (firstTime && opts.fireImmediately) {\n effectAction(value, oldValue, r);\n } else if (!firstTime && changed) {\n effectAction(value, oldValue, r);\n }\n firstTime = false;\n }\n if (!((_opts4 = opts) != null && (_opts4 = _opts4.signal) != null && _opts4.aborted)) {\n r.schedule_();\n }\n return r.getDisposer_((_opts5 = opts) == null ? void 0 : _opts5.signal);\n}\nfunction wrapErrorHandler(errorHandler, baseFn) {\n return function () {\n try {\n return baseFn.apply(this, arguments);\n } catch (e) {\n errorHandler.call(this, e);\n }\n };\n}\n\nvar ON_BECOME_OBSERVED = \"onBO\";\nvar ON_BECOME_UNOBSERVED = \"onBUO\";\nfunction onBecomeObserved(thing, arg2, arg3) {\n return interceptHook(ON_BECOME_OBSERVED, thing, arg2, arg3);\n}\nfunction onBecomeUnobserved(thing, arg2, arg3) {\n return interceptHook(ON_BECOME_UNOBSERVED, thing, arg2, arg3);\n}\nfunction interceptHook(hook, thing, arg2, arg3) {\n var atom = typeof arg3 === \"function\" ? getAtom(thing, arg2) : getAtom(thing);\n var cb = isFunction(arg3) ? arg3 : arg2;\n var listenersKey = hook + \"L\";\n if (atom[listenersKey]) {\n atom[listenersKey].add(cb);\n } else {\n atom[listenersKey] = new Set([cb]);\n }\n return function () {\n var hookListeners = atom[listenersKey];\n if (hookListeners) {\n hookListeners[\"delete\"](cb);\n if (hookListeners.size === 0) {\n delete atom[listenersKey];\n }\n }\n };\n}\n\nvar NEVER = \"never\";\nvar ALWAYS = \"always\";\nvar OBSERVED = \"observed\";\n// const IF_AVAILABLE = \"ifavailable\"\nfunction configure(options) {\n if (options.isolateGlobalState === true) {\n isolateGlobalState();\n }\n var useProxies = options.useProxies,\n enforceActions = options.enforceActions;\n if (useProxies !== undefined) {\n globalState.useProxies = useProxies === ALWAYS ? true : useProxies === NEVER ? false : typeof Proxy !== \"undefined\";\n }\n if (useProxies === \"ifavailable\") {\n globalState.verifyProxies = true;\n }\n if (enforceActions !== undefined) {\n var ea = enforceActions === ALWAYS ? ALWAYS : enforceActions === OBSERVED;\n globalState.enforceActions = ea;\n globalState.allowStateChanges = ea === true || ea === ALWAYS ? false : true;\n }\n [\"computedRequiresReaction\", \"reactionRequiresObservable\", \"observableRequiresReaction\", \"disableErrorBoundaries\", \"safeDescriptors\"].forEach(function (key) {\n if (key in options) {\n globalState[key] = !!options[key];\n }\n });\n globalState.allowStateReads = !globalState.observableRequiresReaction;\n if ( true && globalState.disableErrorBoundaries === true) {\n console.warn(\"WARNING: Debug feature only. MobX will NOT recover from errors when `disableErrorBoundaries` is enabled.\");\n }\n if (options.reactionScheduler) {\n setReactionScheduler(options.reactionScheduler);\n }\n}\n\nfunction extendObservable(target, properties, annotations, options) {\n if (true) {\n if (arguments.length > 4) {\n die(\"'extendObservable' expected 2-4 arguments\");\n }\n if (typeof target !== \"object\") {\n die(\"'extendObservable' expects an object as first argument\");\n }\n if (isObservableMap(target)) {\n die(\"'extendObservable' should not be used on maps, use map.merge instead\");\n }\n if (!isPlainObject(properties)) {\n die(\"'extendObservable' only accepts plain objects as second argument\");\n }\n if (isObservable(properties) || isObservable(annotations)) {\n die(\"Extending an object with another observable (object) is not supported\");\n }\n }\n // Pull descriptors first, so we don't have to deal with props added by administration ($mobx)\n var descriptors = getOwnPropertyDescriptors(properties);\n initObservable(function () {\n var adm = asObservableObject(target, options)[$mobx];\n ownKeys(descriptors).forEach(function (key) {\n adm.extend_(key, descriptors[key],\n // must pass \"undefined\" for { key: undefined }\n !annotations ? true : key in annotations ? annotations[key] : true);\n });\n });\n return target;\n}\n\nfunction getDependencyTree(thing, property) {\n return nodeToDependencyTree(getAtom(thing, property));\n}\nfunction nodeToDependencyTree(node) {\n var result = {\n name: node.name_\n };\n if (node.observing_ && node.observing_.length > 0) {\n result.dependencies = unique(node.observing_).map(nodeToDependencyTree);\n }\n return result;\n}\nfunction getObserverTree(thing, property) {\n return nodeToObserverTree(getAtom(thing, property));\n}\nfunction nodeToObserverTree(node) {\n var result = {\n name: node.name_\n };\n if (hasObservers(node)) {\n result.observers = Array.from(getObservers(node)).map(nodeToObserverTree);\n }\n return result;\n}\nfunction unique(list) {\n return Array.from(new Set(list));\n}\n\nvar generatorId = 0;\nfunction FlowCancellationError() {\n this.message = \"FLOW_CANCELLED\";\n}\nFlowCancellationError.prototype = /*#__PURE__*/Object.create(Error.prototype);\nfunction isFlowCancellationError(error) {\n return error instanceof FlowCancellationError;\n}\nvar flowAnnotation = /*#__PURE__*/createFlowAnnotation(\"flow\");\nvar flowBoundAnnotation = /*#__PURE__*/createFlowAnnotation(\"flow.bound\", {\n bound: true\n});\nvar flow = /*#__PURE__*/Object.assign(function flow(arg1, arg2) {\n // @flow (2022.3 Decorators)\n if (is20223Decorator(arg2)) {\n return flowAnnotation.decorate_20223_(arg1, arg2);\n }\n // @flow\n if (isStringish(arg2)) {\n return storeAnnotation(arg1, arg2, flowAnnotation);\n }\n // flow(fn)\n if ( true && arguments.length !== 1) {\n die(\"Flow expects single argument with generator function\");\n }\n var generator = arg1;\n var name = generator.name || \"\";\n // Implementation based on https://github.com/tj/co/blob/master/index.js\n var res = function res() {\n var ctx = this;\n var args = arguments;\n var runId = ++generatorId;\n var gen = action(name + \" - runid: \" + runId + \" - init\", generator).apply(ctx, args);\n var rejector;\n var pendingPromise = undefined;\n var promise = new Promise(function (resolve, reject) {\n var stepId = 0;\n rejector = reject;\n function onFulfilled(res) {\n pendingPromise = undefined;\n var ret;\n try {\n ret = action(name + \" - runid: \" + runId + \" - yield \" + stepId++, gen.next).call(gen, res);\n } catch (e) {\n return reject(e);\n }\n next(ret);\n }\n function onRejected(err) {\n pendingPromise = undefined;\n var ret;\n try {\n ret = action(name + \" - runid: \" + runId + \" - yield \" + stepId++, gen[\"throw\"]).call(gen, err);\n } catch (e) {\n return reject(e);\n }\n next(ret);\n }\n function next(ret) {\n if (isFunction(ret == null ? void 0 : ret.then)) {\n // an async iterator\n ret.then(next, reject);\n return;\n }\n if (ret.done) {\n return resolve(ret.value);\n }\n pendingPromise = Promise.resolve(ret.value);\n return pendingPromise.then(onFulfilled, onRejected);\n }\n onFulfilled(undefined); // kick off the process\n });\n promise.cancel = action(name + \" - runid: \" + runId + \" - cancel\", function () {\n try {\n if (pendingPromise) {\n cancelPromise(pendingPromise);\n }\n // Finally block can return (or yield) stuff..\n var _res = gen[\"return\"](undefined);\n // eat anything that promise would do, it's cancelled!\n var yieldedPromise = Promise.resolve(_res.value);\n yieldedPromise.then(noop, noop);\n cancelPromise(yieldedPromise); // maybe it can be cancelled :)\n // reject our original promise\n rejector(new FlowCancellationError());\n } catch (e) {\n rejector(e); // there could be a throwing finally block\n }\n });\n return promise;\n };\n res.isMobXFlow = true;\n return res;\n}, flowAnnotation);\nflow.bound = /*#__PURE__*/createDecoratorAnnotation(flowBoundAnnotation);\nfunction cancelPromise(promise) {\n if (isFunction(promise.cancel)) {\n promise.cancel();\n }\n}\nfunction flowResult(result) {\n return result; // just tricking TypeScript :)\n}\nfunction isFlow(fn) {\n return (fn == null ? void 0 : fn.isMobXFlow) === true;\n}\n\nfunction interceptReads(thing, propOrHandler, handler) {\n var target;\n if (isObservableMap(thing) || isObservableArray(thing) || isObservableValue(thing)) {\n target = getAdministration(thing);\n } else if (isObservableObject(thing)) {\n if ( true && !isStringish(propOrHandler)) {\n return die(\"InterceptReads can only be used with a specific property, not with an object in general\");\n }\n target = getAdministration(thing, propOrHandler);\n } else if (true) {\n return die(\"Expected observable map, object or array as first array\");\n }\n if ( true && target.dehancer !== undefined) {\n return die(\"An intercept reader was already established\");\n }\n target.dehancer = typeof propOrHandler === \"function\" ? propOrHandler : handler;\n return function () {\n target.dehancer = undefined;\n };\n}\n\nfunction intercept(thing, propOrHandler, handler) {\n if (isFunction(handler)) {\n return interceptProperty(thing, propOrHandler, handler);\n } else {\n return interceptInterceptable(thing, propOrHandler);\n }\n}\nfunction interceptInterceptable(thing, handler) {\n return getAdministration(thing).intercept_(handler);\n}\nfunction interceptProperty(thing, property, handler) {\n return getAdministration(thing, property).intercept_(handler);\n}\n\nfunction _isComputed(value, property) {\n if (property === undefined) {\n return isComputedValue(value);\n }\n if (isObservableObject(value) === false) {\n return false;\n }\n if (!value[$mobx].values_.has(property)) {\n return false;\n }\n var atom = getAtom(value, property);\n return isComputedValue(atom);\n}\nfunction isComputed(value) {\n if ( true && arguments.length > 1) {\n return die(\"isComputed expects only 1 argument. Use isComputedProp to inspect the observability of a property\");\n }\n return _isComputed(value);\n}\nfunction isComputedProp(value, propName) {\n if ( true && !isStringish(propName)) {\n return die(\"isComputed expected a property name as second argument\");\n }\n return _isComputed(value, propName);\n}\n\nfunction _isObservable(value, property) {\n if (!value) {\n return false;\n }\n if (property !== undefined) {\n if ( true && (isObservableMap(value) || isObservableArray(value))) {\n return die(\"isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead.\");\n }\n if (isObservableObject(value)) {\n return value[$mobx].values_.has(property);\n }\n return false;\n }\n // For first check, see #701\n return isObservableObject(value) || !!value[$mobx] || isAtom(value) || isReaction(value) || isComputedValue(value);\n}\nfunction isObservable(value) {\n if ( true && arguments.length !== 1) {\n die(\"isObservable expects only 1 argument. Use isObservableProp to inspect the observability of a property\");\n }\n return _isObservable(value);\n}\nfunction isObservableProp(value, propName) {\n if ( true && !isStringish(propName)) {\n return die(\"expected a property name as second argument\");\n }\n return _isObservable(value, propName);\n}\n\nfunction keys(obj) {\n if (isObservableObject(obj)) {\n return obj[$mobx].keys_();\n }\n if (isObservableMap(obj) || isObservableSet(obj)) {\n return Array.from(obj.keys());\n }\n if (isObservableArray(obj)) {\n return obj.map(function (_, index) {\n return index;\n });\n }\n die(5);\n}\nfunction values(obj) {\n if (isObservableObject(obj)) {\n return keys(obj).map(function (key) {\n return obj[key];\n });\n }\n if (isObservableMap(obj)) {\n return keys(obj).map(function (key) {\n return obj.get(key);\n });\n }\n if (isObservableSet(obj)) {\n return Array.from(obj.values());\n }\n if (isObservableArray(obj)) {\n return obj.slice();\n }\n die(6);\n}\nfunction entries(obj) {\n if (isObservableObject(obj)) {\n return keys(obj).map(function (key) {\n return [key, obj[key]];\n });\n }\n if (isObservableMap(obj)) {\n return keys(obj).map(function (key) {\n return [key, obj.get(key)];\n });\n }\n if (isObservableSet(obj)) {\n return Array.from(obj.entries());\n }\n if (isObservableArray(obj)) {\n return obj.map(function (key, index) {\n return [index, key];\n });\n }\n die(7);\n}\nfunction set(obj, key, value) {\n if (arguments.length === 2 && !isObservableSet(obj)) {\n startBatch();\n var _values = key;\n try {\n for (var _key in _values) {\n set(obj, _key, _values[_key]);\n }\n } finally {\n endBatch();\n }\n return;\n }\n if (isObservableObject(obj)) {\n obj[$mobx].set_(key, value);\n } else if (isObservableMap(obj)) {\n obj.set(key, value);\n } else if (isObservableSet(obj)) {\n obj.add(key);\n } else if (isObservableArray(obj)) {\n if (typeof key !== \"number\") {\n key = parseInt(key, 10);\n }\n if (key < 0) {\n die(\"Invalid index: '\" + key + \"'\");\n }\n startBatch();\n if (key >= obj.length) {\n obj.length = key + 1;\n }\n obj[key] = value;\n endBatch();\n } else {\n die(8);\n }\n}\nfunction remove(obj, key) {\n if (isObservableObject(obj)) {\n obj[$mobx].delete_(key);\n } else if (isObservableMap(obj)) {\n obj[\"delete\"](key);\n } else if (isObservableSet(obj)) {\n obj[\"delete\"](key);\n } else if (isObservableArray(obj)) {\n if (typeof key !== \"number\") {\n key = parseInt(key, 10);\n }\n obj.splice(key, 1);\n } else {\n die(9);\n }\n}\nfunction has(obj, key) {\n if (isObservableObject(obj)) {\n return obj[$mobx].has_(key);\n } else if (isObservableMap(obj)) {\n return obj.has(key);\n } else if (isObservableSet(obj)) {\n return obj.has(key);\n } else if (isObservableArray(obj)) {\n return key >= 0 && key < obj.length;\n }\n die(10);\n}\nfunction get(obj, key) {\n if (!has(obj, key)) {\n return undefined;\n }\n if (isObservableObject(obj)) {\n return obj[$mobx].get_(key);\n } else if (isObservableMap(obj)) {\n return obj.get(key);\n } else if (isObservableArray(obj)) {\n return obj[key];\n }\n die(11);\n}\nfunction apiDefineProperty(obj, key, descriptor) {\n if (isObservableObject(obj)) {\n return obj[$mobx].defineProperty_(key, descriptor);\n }\n die(39);\n}\nfunction apiOwnKeys(obj) {\n if (isObservableObject(obj)) {\n return obj[$mobx].ownKeys_();\n }\n die(38);\n}\n\nfunction observe(thing, propOrCb, cbOrFire, fireImmediately) {\n if (isFunction(cbOrFire)) {\n return observeObservableProperty(thing, propOrCb, cbOrFire, fireImmediately);\n } else {\n return observeObservable(thing, propOrCb, cbOrFire);\n }\n}\nfunction observeObservable(thing, listener, fireImmediately) {\n return getAdministration(thing).observe_(listener, fireImmediately);\n}\nfunction observeObservableProperty(thing, property, listener, fireImmediately) {\n return getAdministration(thing, property).observe_(listener, fireImmediately);\n}\n\nfunction cache(map, key, value) {\n map.set(key, value);\n return value;\n}\nfunction toJSHelper(source, __alreadySeen) {\n if (source == null || typeof source !== \"object\" || source instanceof Date || !isObservable(source)) {\n return source;\n }\n if (isObservableValue(source) || isComputedValue(source)) {\n return toJSHelper(source.get(), __alreadySeen);\n }\n if (__alreadySeen.has(source)) {\n return __alreadySeen.get(source);\n }\n if (isObservableArray(source)) {\n var res = cache(__alreadySeen, source, new Array(source.length));\n source.forEach(function (value, idx) {\n res[idx] = toJSHelper(value, __alreadySeen);\n });\n return res;\n }\n if (isObservableSet(source)) {\n var _res = cache(__alreadySeen, source, new Set());\n source.forEach(function (value) {\n _res.add(toJSHelper(value, __alreadySeen));\n });\n return _res;\n }\n if (isObservableMap(source)) {\n var _res2 = cache(__alreadySeen, source, new Map());\n source.forEach(function (value, key) {\n _res2.set(key, toJSHelper(value, __alreadySeen));\n });\n return _res2;\n } else {\n // must be observable object\n var _res3 = cache(__alreadySeen, source, {});\n apiOwnKeys(source).forEach(function (key) {\n if (objectPrototype.propertyIsEnumerable.call(source, key)) {\n _res3[key] = toJSHelper(source[key], __alreadySeen);\n }\n });\n return _res3;\n }\n}\n/**\n * Recursively converts an observable to it's non-observable native counterpart.\n * It does NOT recurse into non-observables, these are left as they are, even if they contain observables.\n * Computed and other non-enumerable properties are completely ignored.\n * Complex scenarios require custom solution, eg implementing `toJSON` or using `serializr` lib.\n */\nfunction toJS(source, options) {\n if ( true && options) {\n die(\"toJS no longer supports options\");\n }\n return toJSHelper(source, new Map());\n}\n\nfunction trace() {\n if (false) {}\n var enterBreakPoint = false;\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n if (typeof args[args.length - 1] === \"boolean\") {\n enterBreakPoint = args.pop();\n }\n var derivation = getAtomFromArgs(args);\n if (!derivation) {\n return die(\"'trace(break?)' can only be used inside a tracked computed value or a Reaction. Consider passing in the computed value or reaction explicitly\");\n }\n if (derivation.isTracing_ === TraceMode.NONE) {\n console.log(\"[mobx.trace] '\" + derivation.name_ + \"' tracing enabled\");\n }\n derivation.isTracing_ = enterBreakPoint ? TraceMode.BREAK : TraceMode.LOG;\n}\nfunction getAtomFromArgs(args) {\n switch (args.length) {\n case 0:\n return globalState.trackingDerivation;\n case 1:\n return getAtom(args[0]);\n case 2:\n return getAtom(args[0], args[1]);\n }\n}\n\n/**\n * During a transaction no views are updated until the end of the transaction.\n * The transaction will be run synchronously nonetheless.\n *\n * @param action a function that updates some reactive state\n * @returns any value that was returned by the 'action' parameter.\n */\nfunction transaction(action, thisArg) {\n if (thisArg === void 0) {\n thisArg = undefined;\n }\n startBatch();\n try {\n return action.apply(thisArg);\n } finally {\n endBatch();\n }\n}\n\nfunction when(predicate, arg1, arg2) {\n if (arguments.length === 1 || arg1 && typeof arg1 === \"object\") {\n return whenPromise(predicate, arg1);\n }\n return _when(predicate, arg1, arg2 || {});\n}\nfunction _when(predicate, effect, opts) {\n var timeoutHandle;\n if (typeof opts.timeout === \"number\") {\n var error = new Error(\"WHEN_TIMEOUT\");\n timeoutHandle = setTimeout(function () {\n if (!disposer[$mobx].isDisposed) {\n disposer();\n if (opts.onError) {\n opts.onError(error);\n } else {\n throw error;\n }\n }\n }, opts.timeout);\n }\n opts.name = true ? opts.name || \"When@\" + getNextId() : 0;\n var effectAction = createAction( true ? opts.name + \"-effect\" : 0, effect);\n // eslint-disable-next-line\n var disposer = autorun(function (r) {\n // predicate should not change state\n var cond = allowStateChanges(false, predicate);\n if (cond) {\n r.dispose();\n if (timeoutHandle) {\n clearTimeout(timeoutHandle);\n }\n effectAction();\n }\n }, opts);\n return disposer;\n}\nfunction whenPromise(predicate, opts) {\n var _opts$signal;\n if ( true && opts && opts.onError) {\n return die(\"the options 'onError' and 'promise' cannot be combined\");\n }\n if (opts != null && (_opts$signal = opts.signal) != null && _opts$signal.aborted) {\n return Object.assign(Promise.reject(new Error(\"WHEN_ABORTED\")), {\n cancel: function cancel() {\n return null;\n }\n });\n }\n var cancel;\n var abort;\n var res = new Promise(function (resolve, reject) {\n var _opts$signal2;\n var disposer = _when(predicate, resolve, _extends({}, opts, {\n onError: reject\n }));\n cancel = function cancel() {\n disposer();\n reject(new Error(\"WHEN_CANCELLED\"));\n };\n abort = function abort() {\n disposer();\n reject(new Error(\"WHEN_ABORTED\"));\n };\n opts == null || (_opts$signal2 = opts.signal) == null || _opts$signal2.addEventListener == null || _opts$signal2.addEventListener(\"abort\", abort);\n })[\"finally\"](function () {\n var _opts$signal3;\n return opts == null || (_opts$signal3 = opts.signal) == null || _opts$signal3.removeEventListener == null ? void 0 : _opts$signal3.removeEventListener(\"abort\", abort);\n });\n res.cancel = cancel;\n return res;\n}\n\nfunction getAdm(target) {\n return target[$mobx];\n}\n// Optimization: we don't need the intermediate objects and could have a completely custom administration for DynamicObjects,\n// and skip either the internal values map, or the base object with its property descriptors!\nvar objectProxyTraps = {\n has: function has(target, name) {\n if ( true && globalState.trackingDerivation) {\n warnAboutProxyRequirement(\"detect new properties using the 'in' operator. Use 'has' from 'mobx' instead.\");\n }\n return getAdm(target).has_(name);\n },\n get: function get(target, name) {\n return getAdm(target).get_(name);\n },\n set: function set(target, name, value) {\n var _getAdm$set_;\n if (!isStringish(name)) {\n return false;\n }\n if ( true && !getAdm(target).values_.has(name)) {\n warnAboutProxyRequirement(\"add a new observable property through direct assignment. Use 'set' from 'mobx' instead.\");\n }\n // null (intercepted) -> true (success)\n return (_getAdm$set_ = getAdm(target).set_(name, value, true)) != null ? _getAdm$set_ : true;\n },\n deleteProperty: function deleteProperty(target, name) {\n var _getAdm$delete_;\n if (true) {\n warnAboutProxyRequirement(\"delete properties from an observable object. Use 'remove' from 'mobx' instead.\");\n }\n if (!isStringish(name)) {\n return false;\n }\n // null (intercepted) -> true (success)\n return (_getAdm$delete_ = getAdm(target).delete_(name, true)) != null ? _getAdm$delete_ : true;\n },\n defineProperty: function defineProperty(target, name, descriptor) {\n var _getAdm$definePropert;\n if (true) {\n warnAboutProxyRequirement(\"define property on an observable object. Use 'defineProperty' from 'mobx' instead.\");\n }\n // null (intercepted) -> true (success)\n return (_getAdm$definePropert = getAdm(target).defineProperty_(name, descriptor)) != null ? _getAdm$definePropert : true;\n },\n ownKeys: function ownKeys(target) {\n if ( true && globalState.trackingDerivation) {\n warnAboutProxyRequirement(\"iterate keys to detect added / removed properties. Use 'keys' from 'mobx' instead.\");\n }\n return getAdm(target).ownKeys_();\n },\n preventExtensions: function preventExtensions(target) {\n die(13);\n }\n};\nfunction asDynamicObservableObject(target, options) {\n var _target$$mobx, _target$$mobx$proxy_;\n assertProxies();\n target = asObservableObject(target, options);\n return (_target$$mobx$proxy_ = (_target$$mobx = target[$mobx]).proxy_) != null ? _target$$mobx$proxy_ : _target$$mobx.proxy_ = new Proxy(target, objectProxyTraps);\n}\n\nfunction hasInterceptors(interceptable) {\n return interceptable.interceptors_ !== undefined && interceptable.interceptors_.length > 0;\n}\nfunction registerInterceptor(interceptable, handler) {\n var interceptors = interceptable.interceptors_ || (interceptable.interceptors_ = []);\n interceptors.push(handler);\n return once(function () {\n var idx = interceptors.indexOf(handler);\n if (idx !== -1) {\n interceptors.splice(idx, 1);\n }\n });\n}\nfunction interceptChange(interceptable, change) {\n var prevU = untrackedStart();\n try {\n // Interceptor can modify the array, copy it to avoid concurrent modification, see #1950\n var interceptors = [].concat(interceptable.interceptors_ || []);\n for (var i = 0, l = interceptors.length; i < l; i++) {\n change = interceptors[i](change);\n if (change && !change.type) {\n die(14);\n }\n if (!change) {\n break;\n }\n }\n return change;\n } finally {\n untrackedEnd(prevU);\n }\n}\n\nfunction hasListeners(listenable) {\n return listenable.changeListeners_ !== undefined && listenable.changeListeners_.length > 0;\n}\nfunction registerListener(listenable, handler) {\n var listeners = listenable.changeListeners_ || (listenable.changeListeners_ = []);\n listeners.push(handler);\n return once(function () {\n var idx = listeners.indexOf(handler);\n if (idx !== -1) {\n listeners.splice(idx, 1);\n }\n });\n}\nfunction notifyListeners(listenable, change) {\n var prevU = untrackedStart();\n var listeners = listenable.changeListeners_;\n if (!listeners) {\n return;\n }\n listeners = listeners.slice();\n for (var i = 0, l = listeners.length; i < l; i++) {\n listeners[i](change);\n }\n untrackedEnd(prevU);\n}\n\nfunction makeObservable(target, annotations, options) {\n initObservable(function () {\n var _annotations;\n var adm = asObservableObject(target, options)[$mobx];\n if ( true && annotations && target[storedAnnotationsSymbol]) {\n die(\"makeObservable second arg must be nullish when using decorators. Mixing @decorator syntax with annotations is not supported.\");\n }\n // Default to decorators\n (_annotations = annotations) != null ? _annotations : annotations = collectStoredAnnotations(target);\n // Annotate\n ownKeys(annotations).forEach(function (key) {\n return adm.make_(key, annotations[key]);\n });\n });\n return target;\n}\n// proto[keysSymbol] = new Set()\nvar keysSymbol = /*#__PURE__*/Symbol(\"mobx-keys\");\nfunction makeAutoObservable(target, overrides, options) {\n if (true) {\n if (!isPlainObject(target) && !isPlainObject(Object.getPrototypeOf(target))) {\n die(\"'makeAutoObservable' can only be used for classes that don't have a superclass\");\n }\n if (isObservableObject(target)) {\n die(\"makeAutoObservable can only be used on objects not already made observable\");\n }\n }\n // Optimization: avoid visiting protos\n // Assumes that annotation.make_/.extend_ works the same for plain objects\n if (isPlainObject(target)) {\n return extendObservable(target, target, overrides, options);\n }\n initObservable(function () {\n var adm = asObservableObject(target, options)[$mobx];\n // Optimization: cache keys on proto\n // Assumes makeAutoObservable can be called only once per object and can't be used in subclass\n if (!target[keysSymbol]) {\n var proto = Object.getPrototypeOf(target);\n var keys = new Set([].concat(ownKeys(target), ownKeys(proto)));\n keys[\"delete\"](\"constructor\");\n keys[\"delete\"]($mobx);\n addHiddenProp(proto, keysSymbol, keys);\n }\n target[keysSymbol].forEach(function (key) {\n return adm.make_(key,\n // must pass \"undefined\" for { key: undefined }\n !overrides ? true : key in overrides ? overrides[key] : true);\n });\n });\n return target;\n}\n\nvar SPLICE = \"splice\";\nvar UPDATE = \"update\";\nvar MAX_SPLICE_SIZE = 10000; // See e.g. https://github.com/mobxjs/mobx/issues/859\nvar arrayTraps = {\n get: function get(target, name) {\n var adm = target[$mobx];\n if (name === $mobx) {\n return adm;\n }\n if (name === \"length\") {\n return adm.getArrayLength_();\n }\n if (typeof name === \"string\" && !isNaN(name)) {\n return adm.get_(parseInt(name));\n }\n if (hasProp(arrayExtensions, name)) {\n return arrayExtensions[name];\n }\n return target[name];\n },\n set: function set(target, name, value) {\n var adm = target[$mobx];\n if (name === \"length\") {\n adm.setArrayLength_(value);\n }\n if (typeof name === \"symbol\" || isNaN(name)) {\n target[name] = value;\n } else {\n // numeric string\n adm.set_(parseInt(name), value);\n }\n return true;\n },\n preventExtensions: function preventExtensions() {\n die(15);\n }\n};\nvar ObservableArrayAdministration = /*#__PURE__*/function () {\n function ObservableArrayAdministration(name, enhancer, owned_, legacyMode_) {\n if (name === void 0) {\n name = true ? \"ObservableArray@\" + getNextId() : 0;\n }\n this.owned_ = void 0;\n this.legacyMode_ = void 0;\n this.atom_ = void 0;\n this.values_ = [];\n // this is the prop that gets proxied, so can't replace it!\n this.interceptors_ = void 0;\n this.changeListeners_ = void 0;\n this.enhancer_ = void 0;\n this.dehancer = void 0;\n this.proxy_ = void 0;\n this.lastKnownLength_ = 0;\n this.owned_ = owned_;\n this.legacyMode_ = legacyMode_;\n this.atom_ = new Atom(name);\n this.enhancer_ = function (newV, oldV) {\n return enhancer(newV, oldV, true ? name + \"[..]\" : 0);\n };\n }\n var _proto = ObservableArrayAdministration.prototype;\n _proto.dehanceValue_ = function dehanceValue_(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.dehanceValues_ = function dehanceValues_(values) {\n if (this.dehancer !== undefined && values.length > 0) {\n return values.map(this.dehancer);\n }\n return values;\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n if (fireImmediately === void 0) {\n fireImmediately = false;\n }\n if (fireImmediately) {\n listener({\n observableKind: \"array\",\n object: this.proxy_,\n debugObjectName: this.atom_.name_,\n type: \"splice\",\n index: 0,\n added: this.values_.slice(),\n addedCount: this.values_.length,\n removed: [],\n removedCount: 0\n });\n }\n return registerListener(this, listener);\n };\n _proto.getArrayLength_ = function getArrayLength_() {\n this.atom_.reportObserved();\n return this.values_.length;\n };\n _proto.setArrayLength_ = function setArrayLength_(newLength) {\n if (typeof newLength !== \"number\" || isNaN(newLength) || newLength < 0) {\n die(\"Out of range: \" + newLength);\n }\n var currentLength = this.values_.length;\n if (newLength === currentLength) {\n return;\n } else if (newLength > currentLength) {\n var newItems = new Array(newLength - currentLength);\n for (var i = 0; i < newLength - currentLength; i++) {\n newItems[i] = undefined;\n } // No Array.fill everywhere...\n this.spliceWithArray_(currentLength, 0, newItems);\n } else {\n this.spliceWithArray_(newLength, currentLength - newLength);\n }\n };\n _proto.updateArrayLength_ = function updateArrayLength_(oldLength, delta) {\n if (oldLength !== this.lastKnownLength_) {\n die(16);\n }\n this.lastKnownLength_ += delta;\n if (this.legacyMode_ && delta > 0) {\n reserveArrayBuffer(oldLength + delta + 1);\n }\n };\n _proto.spliceWithArray_ = function spliceWithArray_(index, deleteCount, newItems) {\n var _this = this;\n checkIfStateModificationsAreAllowed(this.atom_);\n var length = this.values_.length;\n if (index === undefined) {\n index = 0;\n } else if (index > length) {\n index = length;\n } else if (index < 0) {\n index = Math.max(0, length + index);\n }\n if (arguments.length === 1) {\n deleteCount = length - index;\n } else if (deleteCount === undefined || deleteCount === null) {\n deleteCount = 0;\n } else {\n deleteCount = Math.max(0, Math.min(deleteCount, length - index));\n }\n if (newItems === undefined) {\n newItems = EMPTY_ARRAY;\n }\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_,\n type: SPLICE,\n index: index,\n removedCount: deleteCount,\n added: newItems\n });\n if (!change) {\n return EMPTY_ARRAY;\n }\n deleteCount = change.removedCount;\n newItems = change.added;\n }\n newItems = newItems.length === 0 ? newItems : newItems.map(function (v) {\n return _this.enhancer_(v, undefined);\n });\n if (this.legacyMode_ || \"development\" !== \"production\") {\n var lengthDelta = newItems.length - deleteCount;\n this.updateArrayLength_(length, lengthDelta); // checks if internal array wasn't modified\n }\n var res = this.spliceItemsIntoValues_(index, deleteCount, newItems);\n if (deleteCount !== 0 || newItems.length !== 0) {\n this.notifyArraySplice_(index, newItems, res);\n }\n return this.dehanceValues_(res);\n };\n _proto.spliceItemsIntoValues_ = function spliceItemsIntoValues_(index, deleteCount, newItems) {\n if (newItems.length < MAX_SPLICE_SIZE) {\n var _this$values_;\n return (_this$values_ = this.values_).splice.apply(_this$values_, [index, deleteCount].concat(newItems));\n } else {\n // The items removed by the splice\n var res = this.values_.slice(index, index + deleteCount);\n // The items that that should remain at the end of the array\n var oldItems = this.values_.slice(index + deleteCount);\n // New length is the previous length + addition count - deletion count\n this.values_.length += newItems.length - deleteCount;\n for (var i = 0; i < newItems.length; i++) {\n this.values_[index + i] = newItems[i];\n }\n for (var _i = 0; _i < oldItems.length; _i++) {\n this.values_[index + newItems.length + _i] = oldItems[_i];\n }\n return res;\n }\n };\n _proto.notifyArrayChildUpdate_ = function notifyArrayChildUpdate_(index, newValue, oldValue) {\n var notifySpy = !this.owned_ && isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"array\",\n object: this.proxy_,\n type: UPDATE,\n debugObjectName: this.atom_.name_,\n index: index,\n newValue: newValue,\n oldValue: oldValue\n } : null;\n // The reason why this is on right hand side here (and not above), is this way the uglifier will drop it, but it won't\n // cause any runtime overhead in development mode without NODE_ENV set, unless spying is enabled\n if ( true && notifySpy) {\n spyReportStart(change);\n }\n this.atom_.reportChanged();\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n };\n _proto.notifyArraySplice_ = function notifyArraySplice_(index, added, removed) {\n var notifySpy = !this.owned_ && isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"array\",\n object: this.proxy_,\n debugObjectName: this.atom_.name_,\n type: SPLICE,\n index: index,\n removed: removed,\n added: added,\n removedCount: removed.length,\n addedCount: added.length\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n }\n this.atom_.reportChanged();\n // conform: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/observe\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n };\n _proto.get_ = function get_(index) {\n if (this.legacyMode_ && index >= this.values_.length) {\n console.warn( true ? \"[mobx.array] Attempt to read an array index (\" + index + \") that is out of bounds (\" + this.values_.length + \"). Please check length first. Out of bound indices will not be tracked by MobX\" : 0);\n return undefined;\n }\n this.atom_.reportObserved();\n return this.dehanceValue_(this.values_[index]);\n };\n _proto.set_ = function set_(index, newValue) {\n var values = this.values_;\n if (this.legacyMode_ && index > values.length) {\n // out of bounds\n die(17, index, values.length);\n }\n if (index < values.length) {\n // update at index in range\n checkIfStateModificationsAreAllowed(this.atom_);\n var oldValue = values[index];\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: UPDATE,\n object: this.proxy_,\n // since \"this\" is the real array we need to pass its proxy\n index: index,\n newValue: newValue\n });\n if (!change) {\n return;\n }\n newValue = change.newValue;\n }\n newValue = this.enhancer_(newValue, oldValue);\n var changed = newValue !== oldValue;\n if (changed) {\n values[index] = newValue;\n this.notifyArrayChildUpdate_(index, newValue, oldValue);\n }\n } else {\n // For out of bound index, we don't create an actual sparse array,\n // but rather fill the holes with undefined (same as setArrayLength_).\n // This could be considered a bug.\n var newItems = new Array(index + 1 - values.length);\n for (var i = 0; i < newItems.length - 1; i++) {\n newItems[i] = undefined;\n } // No Array.fill everywhere...\n newItems[newItems.length - 1] = newValue;\n this.spliceWithArray_(values.length, 0, newItems);\n }\n };\n return ObservableArrayAdministration;\n}();\nfunction createObservableArray(initialValues, enhancer, name, owned) {\n if (name === void 0) {\n name = true ? \"ObservableArray@\" + getNextId() : 0;\n }\n if (owned === void 0) {\n owned = false;\n }\n assertProxies();\n return initObservable(function () {\n var adm = new ObservableArrayAdministration(name, enhancer, owned, false);\n addHiddenFinalProp(adm.values_, $mobx, adm);\n var proxy = new Proxy(adm.values_, arrayTraps);\n adm.proxy_ = proxy;\n if (initialValues && initialValues.length) {\n adm.spliceWithArray_(0, 0, initialValues);\n }\n return proxy;\n });\n}\n// eslint-disable-next-line\nvar arrayExtensions = {\n clear: function clear() {\n return this.splice(0);\n },\n replace: function replace(newItems) {\n var adm = this[$mobx];\n return adm.spliceWithArray_(0, adm.values_.length, newItems);\n },\n // Used by JSON.stringify\n toJSON: function toJSON() {\n return this.slice();\n },\n /*\n * functions that do alter the internal structure of the array, (based on lib.es6.d.ts)\n * since these functions alter the inner structure of the array, the have side effects.\n * Because the have side effects, they should not be used in computed function,\n * and for that reason the do not call dependencyState.notifyObserved\n */\n splice: function splice(index, deleteCount) {\n for (var _len = arguments.length, newItems = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {\n newItems[_key - 2] = arguments[_key];\n }\n var adm = this[$mobx];\n switch (arguments.length) {\n case 0:\n return [];\n case 1:\n return adm.spliceWithArray_(index);\n case 2:\n return adm.spliceWithArray_(index, deleteCount);\n }\n return adm.spliceWithArray_(index, deleteCount, newItems);\n },\n spliceWithArray: function spliceWithArray(index, deleteCount, newItems) {\n return this[$mobx].spliceWithArray_(index, deleteCount, newItems);\n },\n push: function push() {\n var adm = this[$mobx];\n for (var _len2 = arguments.length, items = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n items[_key2] = arguments[_key2];\n }\n adm.spliceWithArray_(adm.values_.length, 0, items);\n return adm.values_.length;\n },\n pop: function pop() {\n return this.splice(Math.max(this[$mobx].values_.length - 1, 0), 1)[0];\n },\n shift: function shift() {\n return this.splice(0, 1)[0];\n },\n unshift: function unshift() {\n var adm = this[$mobx];\n for (var _len3 = arguments.length, items = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n items[_key3] = arguments[_key3];\n }\n adm.spliceWithArray_(0, 0, items);\n return adm.values_.length;\n },\n reverse: function reverse() {\n // reverse by default mutates in place before returning the result\n // which makes it both a 'derivation' and a 'mutation'.\n if (globalState.trackingDerivation) {\n die(37, \"reverse\");\n }\n this.replace(this.slice().reverse());\n return this;\n },\n sort: function sort() {\n // sort by default mutates in place before returning the result\n // which goes against all good practices. Let's not change the array in place!\n if (globalState.trackingDerivation) {\n die(37, \"sort\");\n }\n var copy = this.slice();\n copy.sort.apply(copy, arguments);\n this.replace(copy);\n return this;\n },\n remove: function remove(value) {\n var adm = this[$mobx];\n var idx = adm.dehanceValues_(adm.values_).indexOf(value);\n if (idx > -1) {\n this.splice(idx, 1);\n return true;\n }\n return false;\n }\n};\n/**\n * Wrap function from prototype\n * Without this, everything works as well, but this works\n * faster as everything works on unproxied values\n */\naddArrayExtension(\"at\", simpleFunc);\naddArrayExtension(\"concat\", simpleFunc);\naddArrayExtension(\"flat\", simpleFunc);\naddArrayExtension(\"includes\", simpleFunc);\naddArrayExtension(\"indexOf\", simpleFunc);\naddArrayExtension(\"join\", simpleFunc);\naddArrayExtension(\"lastIndexOf\", simpleFunc);\naddArrayExtension(\"slice\", simpleFunc);\naddArrayExtension(\"toString\", simpleFunc);\naddArrayExtension(\"toLocaleString\", simpleFunc);\naddArrayExtension(\"toSorted\", simpleFunc);\naddArrayExtension(\"toSpliced\", simpleFunc);\naddArrayExtension(\"with\", simpleFunc);\n// map\naddArrayExtension(\"every\", mapLikeFunc);\naddArrayExtension(\"filter\", mapLikeFunc);\naddArrayExtension(\"find\", mapLikeFunc);\naddArrayExtension(\"findIndex\", mapLikeFunc);\naddArrayExtension(\"findLast\", mapLikeFunc);\naddArrayExtension(\"findLastIndex\", mapLikeFunc);\naddArrayExtension(\"flatMap\", mapLikeFunc);\naddArrayExtension(\"forEach\", mapLikeFunc);\naddArrayExtension(\"map\", mapLikeFunc);\naddArrayExtension(\"some\", mapLikeFunc);\naddArrayExtension(\"toReversed\", mapLikeFunc);\n// reduce\naddArrayExtension(\"reduce\", reduceLikeFunc);\naddArrayExtension(\"reduceRight\", reduceLikeFunc);\nfunction addArrayExtension(funcName, funcFactory) {\n if (typeof Array.prototype[funcName] === \"function\") {\n arrayExtensions[funcName] = funcFactory(funcName);\n }\n}\n// Report and delegate to dehanced array\nfunction simpleFunc(funcName) {\n return function () {\n var adm = this[$mobx];\n adm.atom_.reportObserved();\n var dehancedValues = adm.dehanceValues_(adm.values_);\n return dehancedValues[funcName].apply(dehancedValues, arguments);\n };\n}\n// Make sure callbacks receive correct array arg #2326\nfunction mapLikeFunc(funcName) {\n return function (callback, thisArg) {\n var _this2 = this;\n var adm = this[$mobx];\n adm.atom_.reportObserved();\n var dehancedValues = adm.dehanceValues_(adm.values_);\n return dehancedValues[funcName](function (element, index) {\n return callback.call(thisArg, element, index, _this2);\n });\n };\n}\n// Make sure callbacks receive correct array arg #2326\nfunction reduceLikeFunc(funcName) {\n return function () {\n var _this3 = this;\n var adm = this[$mobx];\n adm.atom_.reportObserved();\n var dehancedValues = adm.dehanceValues_(adm.values_);\n // #2432 - reduce behavior depends on arguments.length\n var callback = arguments[0];\n arguments[0] = function (accumulator, currentValue, index) {\n return callback(accumulator, currentValue, index, _this3);\n };\n return dehancedValues[funcName].apply(dehancedValues, arguments);\n };\n}\nvar isObservableArrayAdministration = /*#__PURE__*/createInstanceofPredicate(\"ObservableArrayAdministration\", ObservableArrayAdministration);\nfunction isObservableArray(thing) {\n return isObject(thing) && isObservableArrayAdministration(thing[$mobx]);\n}\n\nvar ObservableMapMarker = {};\nvar ADD = \"add\";\nvar DELETE = \"delete\";\n// just extend Map? See also https://gist.github.com/nestharus/13b4d74f2ef4a2f4357dbd3fc23c1e54\n// But: https://github.com/mobxjs/mobx/issues/1556\nvar ObservableMap = /*#__PURE__*/function () {\n function ObservableMap(initialData, enhancer_, name_) {\n var _this = this;\n if (enhancer_ === void 0) {\n enhancer_ = deepEnhancer;\n }\n if (name_ === void 0) {\n name_ = true ? \"ObservableMap@\" + getNextId() : 0;\n }\n this.enhancer_ = void 0;\n this.name_ = void 0;\n this[$mobx] = ObservableMapMarker;\n this.data_ = void 0;\n this.hasMap_ = void 0;\n // hasMap, not hashMap >-).\n this.keysAtom_ = void 0;\n this.interceptors_ = void 0;\n this.changeListeners_ = void 0;\n this.dehancer = void 0;\n this.enhancer_ = enhancer_;\n this.name_ = name_;\n if (!isFunction(Map)) {\n die(18);\n }\n initObservable(function () {\n _this.keysAtom_ = createAtom( true ? _this.name_ + \".keys()\" : 0);\n _this.data_ = new Map();\n _this.hasMap_ = new Map();\n if (initialData) {\n _this.merge(initialData);\n }\n });\n }\n var _proto = ObservableMap.prototype;\n _proto.has_ = function has_(key) {\n return this.data_.has(key);\n };\n _proto.has = function has(key) {\n var _this2 = this;\n if (!globalState.trackingDerivation) {\n return this.has_(key);\n }\n var entry = this.hasMap_.get(key);\n if (!entry) {\n var newEntry = entry = new ObservableValue(this.has_(key), referenceEnhancer, true ? this.name_ + \".\" + stringifyKey(key) + \"?\" : 0, false);\n this.hasMap_.set(key, newEntry);\n onBecomeUnobserved(newEntry, function () {\n return _this2.hasMap_[\"delete\"](key);\n });\n }\n return entry.get();\n };\n _proto.set = function set(key, value) {\n var hasKey = this.has_(key);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: hasKey ? UPDATE : ADD,\n object: this,\n newValue: value,\n name: key\n });\n if (!change) {\n return this;\n }\n value = change.newValue;\n }\n if (hasKey) {\n this.updateValue_(key, value);\n } else {\n this.addValue_(key, value);\n }\n return this;\n };\n _proto[\"delete\"] = function _delete(key) {\n var _this3 = this;\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: DELETE,\n object: this,\n name: key\n });\n if (!change) {\n return false;\n }\n }\n if (this.has_(key)) {\n var notifySpy = isSpyEnabled();\n var notify = hasListeners(this);\n var _change = notify || notifySpy ? {\n observableKind: \"map\",\n debugObjectName: this.name_,\n type: DELETE,\n object: this,\n oldValue: this.data_.get(key).value_,\n name: key\n } : null;\n if ( true && notifySpy) {\n spyReportStart(_change);\n } // TODO fix type\n transaction(function () {\n var _this3$hasMap_$get;\n _this3.keysAtom_.reportChanged();\n (_this3$hasMap_$get = _this3.hasMap_.get(key)) == null || _this3$hasMap_$get.setNewValue_(false);\n var observable = _this3.data_.get(key);\n observable.setNewValue_(undefined);\n _this3.data_[\"delete\"](key);\n });\n if (notify) {\n notifyListeners(this, _change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n return true;\n }\n return false;\n };\n _proto.updateValue_ = function updateValue_(key, newValue) {\n var observable = this.data_.get(key);\n newValue = observable.prepareNewValue_(newValue);\n if (newValue !== globalState.UNCHANGED) {\n var notifySpy = isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"map\",\n debugObjectName: this.name_,\n type: UPDATE,\n object: this,\n oldValue: observable.value_,\n name: key,\n newValue: newValue\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n } // TODO fix type\n observable.setNewValue_(newValue);\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n };\n _proto.addValue_ = function addValue_(key, newValue) {\n var _this4 = this;\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n transaction(function () {\n var _this4$hasMap_$get;\n var observable = new ObservableValue(newValue, _this4.enhancer_, true ? _this4.name_ + \".\" + stringifyKey(key) : 0, false);\n _this4.data_.set(key, observable);\n newValue = observable.value_; // value might have been changed\n (_this4$hasMap_$get = _this4.hasMap_.get(key)) == null || _this4$hasMap_$get.setNewValue_(true);\n _this4.keysAtom_.reportChanged();\n });\n var notifySpy = isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"map\",\n debugObjectName: this.name_,\n type: ADD,\n object: this,\n name: key,\n newValue: newValue\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n } // TODO fix type\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n };\n _proto.get = function get(key) {\n if (this.has(key)) {\n return this.dehanceValue_(this.data_.get(key).get());\n }\n return this.dehanceValue_(undefined);\n };\n _proto.dehanceValue_ = function dehanceValue_(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.keys = function keys() {\n this.keysAtom_.reportObserved();\n return this.data_.keys();\n };\n _proto.values = function values() {\n var self = this;\n var keys = this.keys();\n return makeIterableForMap({\n next: function next() {\n var _keys$next = keys.next(),\n done = _keys$next.done,\n value = _keys$next.value;\n return {\n done: done,\n value: done ? undefined : self.get(value)\n };\n }\n });\n };\n _proto.entries = function entries() {\n var self = this;\n var keys = this.keys();\n return makeIterableForMap({\n next: function next() {\n var _keys$next2 = keys.next(),\n done = _keys$next2.done,\n value = _keys$next2.value;\n return {\n done: done,\n value: done ? undefined : [value, self.get(value)]\n };\n }\n });\n };\n _proto[Symbol.iterator] = function () {\n return this.entries();\n };\n _proto.forEach = function forEach(callback, thisArg) {\n for (var _iterator = _createForOfIteratorHelperLoose(this), _step; !(_step = _iterator()).done;) {\n var _step$value = _step.value,\n key = _step$value[0],\n value = _step$value[1];\n callback.call(thisArg, value, key, this);\n }\n }\n /** Merge another object into this object, returns this. */;\n _proto.merge = function merge(other) {\n var _this5 = this;\n if (isObservableMap(other)) {\n other = new Map(other);\n }\n transaction(function () {\n if (isPlainObject(other)) {\n getPlainObjectKeys(other).forEach(function (key) {\n return _this5.set(key, other[key]);\n });\n } else if (Array.isArray(other)) {\n other.forEach(function (_ref) {\n var key = _ref[0],\n value = _ref[1];\n return _this5.set(key, value);\n });\n } else if (isES6Map(other)) {\n if (!isPlainES6Map(other)) {\n die(19, other);\n }\n other.forEach(function (value, key) {\n return _this5.set(key, value);\n });\n } else if (other !== null && other !== undefined) {\n die(20, other);\n }\n });\n return this;\n };\n _proto.clear = function clear() {\n var _this6 = this;\n transaction(function () {\n untracked(function () {\n for (var _iterator2 = _createForOfIteratorHelperLoose(_this6.keys()), _step2; !(_step2 = _iterator2()).done;) {\n var key = _step2.value;\n _this6[\"delete\"](key);\n }\n });\n });\n };\n _proto.replace = function replace(values) {\n var _this7 = this;\n // Implementation requirements:\n // - respect ordering of replacement map\n // - allow interceptors to run and potentially prevent individual operations\n // - don't recreate observables that already exist in original map (so we don't destroy existing subscriptions)\n // - don't _keysAtom.reportChanged if the keys of resulting map are indentical (order matters!)\n // - note that result map may differ from replacement map due to the interceptors\n transaction(function () {\n // Convert to map so we can do quick key lookups\n var replacementMap = convertToMap(values);\n var orderedData = new Map();\n // Used for optimization\n var keysReportChangedCalled = false;\n // Delete keys that don't exist in replacement map\n // if the key deletion is prevented by interceptor\n // add entry at the beginning of the result map\n for (var _iterator3 = _createForOfIteratorHelperLoose(_this7.data_.keys()), _step3; !(_step3 = _iterator3()).done;) {\n var key = _step3.value;\n // Concurrently iterating/deleting keys\n // iterator should handle this correctly\n if (!replacementMap.has(key)) {\n var deleted = _this7[\"delete\"](key);\n // Was the key removed?\n if (deleted) {\n // _keysAtom.reportChanged() was already called\n keysReportChangedCalled = true;\n } else {\n // Delete prevented by interceptor\n var value = _this7.data_.get(key);\n orderedData.set(key, value);\n }\n }\n }\n // Merge entries\n for (var _iterator4 = _createForOfIteratorHelperLoose(replacementMap.entries()), _step4; !(_step4 = _iterator4()).done;) {\n var _step4$value = _step4.value,\n _key = _step4$value[0],\n _value = _step4$value[1];\n // We will want to know whether a new key is added\n var keyExisted = _this7.data_.has(_key);\n // Add or update value\n _this7.set(_key, _value);\n // The addition could have been prevent by interceptor\n if (_this7.data_.has(_key)) {\n // The update could have been prevented by interceptor\n // and also we want to preserve existing values\n // so use value from _data map (instead of replacement map)\n var _value2 = _this7.data_.get(_key);\n orderedData.set(_key, _value2);\n // Was a new key added?\n if (!keyExisted) {\n // _keysAtom.reportChanged() was already called\n keysReportChangedCalled = true;\n }\n }\n }\n // Check for possible key order change\n if (!keysReportChangedCalled) {\n if (_this7.data_.size !== orderedData.size) {\n // If size differs, keys are definitely modified\n _this7.keysAtom_.reportChanged();\n } else {\n var iter1 = _this7.data_.keys();\n var iter2 = orderedData.keys();\n var next1 = iter1.next();\n var next2 = iter2.next();\n while (!next1.done) {\n if (next1.value !== next2.value) {\n _this7.keysAtom_.reportChanged();\n break;\n }\n next1 = iter1.next();\n next2 = iter2.next();\n }\n }\n }\n // Use correctly ordered map\n _this7.data_ = orderedData;\n });\n return this;\n };\n _proto.toString = function toString() {\n return \"[object ObservableMap]\";\n };\n _proto.toJSON = function toJSON() {\n return Array.from(this);\n };\n /**\n * Observes this object. Triggers for the events 'add', 'update' and 'delete'.\n * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe\n * for callback details\n */\n _proto.observe_ = function observe_(listener, fireImmediately) {\n if ( true && fireImmediately === true) {\n die(\"`observe` doesn't support fireImmediately=true in combination with maps.\");\n }\n return registerListener(this, listener);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n return _createClass(ObservableMap, [{\n key: \"size\",\n get: function get() {\n this.keysAtom_.reportObserved();\n return this.data_.size;\n }\n }, {\n key: Symbol.toStringTag,\n get: function get() {\n return \"Map\";\n }\n }]);\n}();\n// eslint-disable-next-line\nvar isObservableMap = /*#__PURE__*/createInstanceofPredicate(\"ObservableMap\", ObservableMap);\nfunction makeIterableForMap(iterator) {\n iterator[Symbol.toStringTag] = \"MapIterator\";\n return makeIterable(iterator);\n}\nfunction convertToMap(dataStructure) {\n if (isES6Map(dataStructure) || isObservableMap(dataStructure)) {\n return dataStructure;\n } else if (Array.isArray(dataStructure)) {\n return new Map(dataStructure);\n } else if (isPlainObject(dataStructure)) {\n var map = new Map();\n for (var key in dataStructure) {\n map.set(key, dataStructure[key]);\n }\n return map;\n } else {\n return die(21, dataStructure);\n }\n}\n\nvar ObservableSetMarker = {};\nvar ObservableSet = /*#__PURE__*/function () {\n function ObservableSet(initialData, enhancer, name_) {\n var _this = this;\n if (enhancer === void 0) {\n enhancer = deepEnhancer;\n }\n if (name_ === void 0) {\n name_ = true ? \"ObservableSet@\" + getNextId() : 0;\n }\n this.name_ = void 0;\n this[$mobx] = ObservableSetMarker;\n this.data_ = new Set();\n this.atom_ = void 0;\n this.changeListeners_ = void 0;\n this.interceptors_ = void 0;\n this.dehancer = void 0;\n this.enhancer_ = void 0;\n this.name_ = name_;\n if (!isFunction(Set)) {\n die(22);\n }\n this.enhancer_ = function (newV, oldV) {\n return enhancer(newV, oldV, name_);\n };\n initObservable(function () {\n _this.atom_ = createAtom(_this.name_);\n if (initialData) {\n _this.replace(initialData);\n }\n });\n }\n var _proto = ObservableSet.prototype;\n _proto.dehanceValue_ = function dehanceValue_(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.clear = function clear() {\n var _this2 = this;\n transaction(function () {\n untracked(function () {\n for (var _iterator = _createForOfIteratorHelperLoose(_this2.data_.values()), _step; !(_step = _iterator()).done;) {\n var value = _step.value;\n _this2[\"delete\"](value);\n }\n });\n });\n };\n _proto.forEach = function forEach(callbackFn, thisArg) {\n for (var _iterator2 = _createForOfIteratorHelperLoose(this), _step2; !(_step2 = _iterator2()).done;) {\n var value = _step2.value;\n callbackFn.call(thisArg, value, value, this);\n }\n };\n _proto.add = function add(value) {\n var _this3 = this;\n checkIfStateModificationsAreAllowed(this.atom_);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: ADD,\n object: this,\n newValue: value\n });\n if (!change) {\n return this;\n }\n // ideally, value = change.value would be done here, so that values can be\n // changed by interceptor. Same applies for other Set and Map api's.\n }\n if (!this.has(value)) {\n transaction(function () {\n _this3.data_.add(_this3.enhancer_(value, undefined));\n _this3.atom_.reportChanged();\n });\n var notifySpy = true && isSpyEnabled();\n var notify = hasListeners(this);\n var _change = notify || notifySpy ? {\n observableKind: \"set\",\n debugObjectName: this.name_,\n type: ADD,\n object: this,\n newValue: value\n } : null;\n if (notifySpy && \"development\" !== \"production\") {\n spyReportStart(_change);\n }\n if (notify) {\n notifyListeners(this, _change);\n }\n if (notifySpy && \"development\" !== \"production\") {\n spyReportEnd();\n }\n }\n return this;\n };\n _proto[\"delete\"] = function _delete(value) {\n var _this4 = this;\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: DELETE,\n object: this,\n oldValue: value\n });\n if (!change) {\n return false;\n }\n }\n if (this.has(value)) {\n var notifySpy = true && isSpyEnabled();\n var notify = hasListeners(this);\n var _change2 = notify || notifySpy ? {\n observableKind: \"set\",\n debugObjectName: this.name_,\n type: DELETE,\n object: this,\n oldValue: value\n } : null;\n if (notifySpy && \"development\" !== \"production\") {\n spyReportStart(_change2);\n }\n transaction(function () {\n _this4.atom_.reportChanged();\n _this4.data_[\"delete\"](value);\n });\n if (notify) {\n notifyListeners(this, _change2);\n }\n if (notifySpy && \"development\" !== \"production\") {\n spyReportEnd();\n }\n return true;\n }\n return false;\n };\n _proto.has = function has(value) {\n this.atom_.reportObserved();\n return this.data_.has(this.dehanceValue_(value));\n };\n _proto.entries = function entries() {\n var nextIndex = 0;\n var keys = Array.from(this.keys());\n var values = Array.from(this.values());\n return makeIterableForSet({\n next: function next() {\n var index = nextIndex;\n nextIndex += 1;\n return index < values.length ? {\n value: [keys[index], values[index]],\n done: false\n } : {\n value: undefined,\n done: true\n };\n }\n });\n };\n _proto.keys = function keys() {\n return this.values();\n };\n _proto.values = function values() {\n this.atom_.reportObserved();\n var self = this;\n var nextIndex = 0;\n var observableValues = Array.from(this.data_.values());\n return makeIterableForSet({\n next: function next() {\n return nextIndex < observableValues.length ? {\n value: self.dehanceValue_(observableValues[nextIndex++]),\n done: false\n } : {\n value: undefined,\n done: true\n };\n }\n });\n };\n _proto.intersection = function intersection(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.intersection(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.intersection(otherSet);\n }\n };\n _proto.union = function union(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.union(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.union(otherSet);\n }\n };\n _proto.difference = function difference(otherSet) {\n return new Set(this).difference(otherSet);\n };\n _proto.symmetricDifference = function symmetricDifference(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.symmetricDifference(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.symmetricDifference(otherSet);\n }\n };\n _proto.isSubsetOf = function isSubsetOf(otherSet) {\n return new Set(this).isSubsetOf(otherSet);\n };\n _proto.isSupersetOf = function isSupersetOf(otherSet) {\n return new Set(this).isSupersetOf(otherSet);\n };\n _proto.isDisjointFrom = function isDisjointFrom(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.isDisjointFrom(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.isDisjointFrom(otherSet);\n }\n };\n _proto.replace = function replace(other) {\n var _this5 = this;\n if (isObservableSet(other)) {\n other = new Set(other);\n }\n transaction(function () {\n if (Array.isArray(other)) {\n _this5.clear();\n other.forEach(function (value) {\n return _this5.add(value);\n });\n } else if (isES6Set(other)) {\n _this5.clear();\n other.forEach(function (value) {\n return _this5.add(value);\n });\n } else if (other !== null && other !== undefined) {\n die(\"Cannot initialize set from \" + other);\n }\n });\n return this;\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n // ... 'fireImmediately' could also be true?\n if ( true && fireImmediately === true) {\n die(\"`observe` doesn't support fireImmediately=true in combination with sets.\");\n }\n return registerListener(this, listener);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.toJSON = function toJSON() {\n return Array.from(this);\n };\n _proto.toString = function toString() {\n return \"[object ObservableSet]\";\n };\n _proto[Symbol.iterator] = function () {\n return this.values();\n };\n return _createClass(ObservableSet, [{\n key: \"size\",\n get: function get() {\n this.atom_.reportObserved();\n return this.data_.size;\n }\n }, {\n key: Symbol.toStringTag,\n get: function get() {\n return \"Set\";\n }\n }]);\n}();\n// eslint-disable-next-line\nvar isObservableSet = /*#__PURE__*/createInstanceofPredicate(\"ObservableSet\", ObservableSet);\nfunction makeIterableForSet(iterator) {\n iterator[Symbol.toStringTag] = \"SetIterator\";\n return makeIterable(iterator);\n}\n\nvar descriptorCache = /*#__PURE__*/Object.create(null);\nvar REMOVE = \"remove\";\nvar ObservableObjectAdministration = /*#__PURE__*/function () {\n function ObservableObjectAdministration(target_, values_, name_,\n // Used anytime annotation is not explicitely provided\n defaultAnnotation_) {\n if (values_ === void 0) {\n values_ = new Map();\n }\n if (defaultAnnotation_ === void 0) {\n defaultAnnotation_ = autoAnnotation;\n }\n this.target_ = void 0;\n this.values_ = void 0;\n this.name_ = void 0;\n this.defaultAnnotation_ = void 0;\n this.keysAtom_ = void 0;\n this.changeListeners_ = void 0;\n this.interceptors_ = void 0;\n this.proxy_ = void 0;\n this.isPlainObject_ = void 0;\n this.appliedAnnotations_ = void 0;\n this.pendingKeys_ = void 0;\n this.target_ = target_;\n this.values_ = values_;\n this.name_ = name_;\n this.defaultAnnotation_ = defaultAnnotation_;\n this.keysAtom_ = new Atom( true ? this.name_ + \".keys\" : 0);\n // Optimization: we use this frequently\n this.isPlainObject_ = isPlainObject(this.target_);\n if ( true && !isAnnotation(this.defaultAnnotation_)) {\n die(\"defaultAnnotation must be valid annotation\");\n }\n if (true) {\n // Prepare structure for tracking which fields were already annotated\n this.appliedAnnotations_ = {};\n }\n }\n var _proto = ObservableObjectAdministration.prototype;\n _proto.getObservablePropValue_ = function getObservablePropValue_(key) {\n return this.values_.get(key).get();\n };\n _proto.setObservablePropValue_ = function setObservablePropValue_(key, newValue) {\n var observable = this.values_.get(key);\n if (observable instanceof ComputedValue) {\n observable.set(newValue);\n return true;\n }\n // intercept\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: UPDATE,\n object: this.proxy_ || this.target_,\n name: key,\n newValue: newValue\n });\n if (!change) {\n return null;\n }\n newValue = change.newValue;\n }\n newValue = observable.prepareNewValue_(newValue);\n // notify spy & observers\n if (newValue !== globalState.UNCHANGED) {\n var notify = hasListeners(this);\n var notifySpy = true && isSpyEnabled();\n var _change = notify || notifySpy ? {\n type: UPDATE,\n observableKind: \"object\",\n debugObjectName: this.name_,\n object: this.proxy_ || this.target_,\n oldValue: observable.value_,\n name: key,\n newValue: newValue\n } : null;\n if ( true && notifySpy) {\n spyReportStart(_change);\n }\n observable.setNewValue_(newValue);\n if (notify) {\n notifyListeners(this, _change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n return true;\n };\n _proto.get_ = function get_(key) {\n if (globalState.trackingDerivation && !hasProp(this.target_, key)) {\n // Key doesn't exist yet, subscribe for it in case it's added later\n this.has_(key);\n }\n return this.target_[key];\n }\n /**\n * @param {PropertyKey} key\n * @param {any} value\n * @param {Annotation|boolean} annotation true - use default annotation, false - copy as is\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.set_ = function set_(key, value, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n // Don't use .has(key) - we care about own\n if (hasProp(this.target_, key)) {\n // Existing prop\n if (this.values_.has(key)) {\n // Observable (can be intercepted)\n return this.setObservablePropValue_(key, value);\n } else if (proxyTrap) {\n // Non-observable - proxy\n return Reflect.set(this.target_, key, value);\n } else {\n // Non-observable\n this.target_[key] = value;\n return true;\n }\n } else {\n // New prop\n return this.extend_(key, {\n value: value,\n enumerable: true,\n writable: true,\n configurable: true\n }, this.defaultAnnotation_, proxyTrap);\n }\n }\n // Trap for \"in\"\n ;\n _proto.has_ = function has_(key) {\n if (!globalState.trackingDerivation) {\n // Skip key subscription outside derivation\n return key in this.target_;\n }\n this.pendingKeys_ || (this.pendingKeys_ = new Map());\n var entry = this.pendingKeys_.get(key);\n if (!entry) {\n entry = new ObservableValue(key in this.target_, referenceEnhancer, true ? this.name_ + \".\" + stringifyKey(key) + \"?\" : 0, false);\n this.pendingKeys_.set(key, entry);\n }\n return entry.get();\n }\n /**\n * @param {PropertyKey} key\n * @param {Annotation|boolean} annotation true - use default annotation, false - ignore prop\n */;\n _proto.make_ = function make_(key, annotation) {\n if (annotation === true) {\n annotation = this.defaultAnnotation_;\n }\n if (annotation === false) {\n return;\n }\n assertAnnotable(this, annotation, key);\n if (!(key in this.target_)) {\n var _this$target_$storedA;\n // Throw on missing key, except for decorators:\n // Decorator annotations are collected from whole prototype chain.\n // When called from super() some props may not exist yet.\n // However we don't have to worry about missing prop,\n // because the decorator must have been applied to something.\n if ((_this$target_$storedA = this.target_[storedAnnotationsSymbol]) != null && _this$target_$storedA[key]) {\n return; // will be annotated by subclass constructor\n } else {\n die(1, annotation.annotationType_, this.name_ + \".\" + key.toString());\n }\n }\n var source = this.target_;\n while (source && source !== objectPrototype) {\n var descriptor = getDescriptor(source, key);\n if (descriptor) {\n var outcome = annotation.make_(this, key, descriptor, source);\n if (outcome === 0 /* MakeResult.Cancel */) {\n return;\n }\n if (outcome === 1 /* MakeResult.Break */) {\n break;\n }\n }\n source = Object.getPrototypeOf(source);\n }\n recordAnnotationApplied(this, annotation, key);\n }\n /**\n * @param {PropertyKey} key\n * @param {PropertyDescriptor} descriptor\n * @param {Annotation|boolean} annotation true - use default annotation, false - copy as is\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.extend_ = function extend_(key, descriptor, annotation, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n if (annotation === true) {\n annotation = this.defaultAnnotation_;\n }\n if (annotation === false) {\n return this.defineProperty_(key, descriptor, proxyTrap);\n }\n assertAnnotable(this, annotation, key);\n var outcome = annotation.extend_(this, key, descriptor, proxyTrap);\n if (outcome) {\n recordAnnotationApplied(this, annotation, key);\n }\n return outcome;\n }\n /**\n * @param {PropertyKey} key\n * @param {PropertyDescriptor} descriptor\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.defineProperty_ = function defineProperty_(key, descriptor, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n try {\n startBatch();\n // Delete\n var deleteOutcome = this.delete_(key);\n if (!deleteOutcome) {\n // Failure or intercepted\n return deleteOutcome;\n }\n // ADD interceptor\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: ADD,\n newValue: descriptor.value\n });\n if (!change) {\n return null;\n }\n var newValue = change.newValue;\n if (descriptor.value !== newValue) {\n descriptor = _extends({}, descriptor, {\n value: newValue\n });\n }\n }\n // Define\n if (proxyTrap) {\n if (!Reflect.defineProperty(this.target_, key, descriptor)) {\n return false;\n }\n } else {\n defineProperty(this.target_, key, descriptor);\n }\n // Notify\n this.notifyPropertyAddition_(key, descriptor.value);\n } finally {\n endBatch();\n }\n return true;\n }\n // If original descriptor becomes relevant, move this to annotation directly\n ;\n _proto.defineObservableProperty_ = function defineObservableProperty_(key, value, enhancer, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n try {\n startBatch();\n // Delete\n var deleteOutcome = this.delete_(key);\n if (!deleteOutcome) {\n // Failure or intercepted\n return deleteOutcome;\n }\n // ADD interceptor\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: ADD,\n newValue: value\n });\n if (!change) {\n return null;\n }\n value = change.newValue;\n }\n var cachedDescriptor = getCachedObservablePropDescriptor(key);\n var descriptor = {\n configurable: globalState.safeDescriptors ? this.isPlainObject_ : true,\n enumerable: true,\n get: cachedDescriptor.get,\n set: cachedDescriptor.set\n };\n // Define\n if (proxyTrap) {\n if (!Reflect.defineProperty(this.target_, key, descriptor)) {\n return false;\n }\n } else {\n defineProperty(this.target_, key, descriptor);\n }\n var observable = new ObservableValue(value, enhancer, true ? this.name_ + \".\" + key.toString() : 0, false);\n this.values_.set(key, observable);\n // Notify (value possibly changed by ObservableValue)\n this.notifyPropertyAddition_(key, observable.value_);\n } finally {\n endBatch();\n }\n return true;\n }\n // If original descriptor becomes relevant, move this to annotation directly\n ;\n _proto.defineComputedProperty_ = function defineComputedProperty_(key, options, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n try {\n startBatch();\n // Delete\n var deleteOutcome = this.delete_(key);\n if (!deleteOutcome) {\n // Failure or intercepted\n return deleteOutcome;\n }\n // ADD interceptor\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: ADD,\n newValue: undefined\n });\n if (!change) {\n return null;\n }\n }\n options.name || (options.name = true ? this.name_ + \".\" + key.toString() : 0);\n options.context = this.proxy_ || this.target_;\n var cachedDescriptor = getCachedObservablePropDescriptor(key);\n var descriptor = {\n configurable: globalState.safeDescriptors ? this.isPlainObject_ : true,\n enumerable: false,\n get: cachedDescriptor.get,\n set: cachedDescriptor.set\n };\n // Define\n if (proxyTrap) {\n if (!Reflect.defineProperty(this.target_, key, descriptor)) {\n return false;\n }\n } else {\n defineProperty(this.target_, key, descriptor);\n }\n this.values_.set(key, new ComputedValue(options));\n // Notify\n this.notifyPropertyAddition_(key, undefined);\n } finally {\n endBatch();\n }\n return true;\n }\n /**\n * @param {PropertyKey} key\n * @param {PropertyDescriptor} descriptor\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.delete_ = function delete_(key, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n // No such prop\n if (!hasProp(this.target_, key)) {\n return true;\n }\n // Intercept\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: REMOVE\n });\n // Cancelled\n if (!change) {\n return null;\n }\n }\n // Delete\n try {\n var _this$pendingKeys_;\n startBatch();\n var notify = hasListeners(this);\n var notifySpy = true && isSpyEnabled();\n var observable = this.values_.get(key);\n // Value needed for spies/listeners\n var value = undefined;\n // Optimization: don't pull the value unless we will need it\n if (!observable && (notify || notifySpy)) {\n var _getDescriptor;\n value = (_getDescriptor = getDescriptor(this.target_, key)) == null ? void 0 : _getDescriptor.value;\n }\n // delete prop (do first, may fail)\n if (proxyTrap) {\n if (!Reflect.deleteProperty(this.target_, key)) {\n return false;\n }\n } else {\n delete this.target_[key];\n }\n // Allow re-annotating this field\n if (true) {\n delete this.appliedAnnotations_[key];\n }\n // Clear observable\n if (observable) {\n this.values_[\"delete\"](key);\n // for computed, value is undefined\n if (observable instanceof ObservableValue) {\n value = observable.value_;\n }\n // Notify: autorun(() => obj[key]), see #1796\n propagateChanged(observable);\n }\n // Notify \"keys/entries/values\" observers\n this.keysAtom_.reportChanged();\n // Notify \"has\" observers\n // \"in\" as it may still exist in proto\n (_this$pendingKeys_ = this.pendingKeys_) == null || (_this$pendingKeys_ = _this$pendingKeys_.get(key)) == null || _this$pendingKeys_.set(key in this.target_);\n // Notify spies/listeners\n if (notify || notifySpy) {\n var _change2 = {\n type: REMOVE,\n observableKind: \"object\",\n object: this.proxy_ || this.target_,\n debugObjectName: this.name_,\n oldValue: value,\n name: key\n };\n if ( true && notifySpy) {\n spyReportStart(_change2);\n }\n if (notify) {\n notifyListeners(this, _change2);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n } finally {\n endBatch();\n }\n return true;\n }\n /**\n * Observes this object. Triggers for the events 'add', 'update' and 'delete'.\n * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe\n * for callback details\n */;\n _proto.observe_ = function observe_(callback, fireImmediately) {\n if ( true && fireImmediately === true) {\n die(\"`observe` doesn't support the fire immediately property for observable objects.\");\n }\n return registerListener(this, callback);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.notifyPropertyAddition_ = function notifyPropertyAddition_(key, value) {\n var _this$pendingKeys_2;\n var notify = hasListeners(this);\n var notifySpy = true && isSpyEnabled();\n if (notify || notifySpy) {\n var change = notify || notifySpy ? {\n type: ADD,\n observableKind: \"object\",\n debugObjectName: this.name_,\n object: this.proxy_ || this.target_,\n name: key,\n newValue: value\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n }\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n (_this$pendingKeys_2 = this.pendingKeys_) == null || (_this$pendingKeys_2 = _this$pendingKeys_2.get(key)) == null || _this$pendingKeys_2.set(true);\n // Notify \"keys/entries/values\" observers\n this.keysAtom_.reportChanged();\n };\n _proto.ownKeys_ = function ownKeys_() {\n this.keysAtom_.reportObserved();\n return ownKeys(this.target_);\n };\n _proto.keys_ = function keys_() {\n // Returns enumerable && own, but unfortunately keysAtom will report on ANY key change.\n // There is no way to distinguish between Object.keys(object) and Reflect.ownKeys(object) - both are handled by ownKeys trap.\n // We can either over-report in Object.keys(object) or under-report in Reflect.ownKeys(object)\n // We choose to over-report in Object.keys(object), because:\n // - typically it's used with simple data objects\n // - when symbolic/non-enumerable keys are relevant Reflect.ownKeys works as expected\n this.keysAtom_.reportObserved();\n return Object.keys(this.target_);\n };\n return ObservableObjectAdministration;\n}();\nfunction asObservableObject(target, options) {\n var _options$name;\n if ( true && options && isObservableObject(target)) {\n die(\"Options can't be provided for already observable objects.\");\n }\n if (hasProp(target, $mobx)) {\n if ( true && !(getAdministration(target) instanceof ObservableObjectAdministration)) {\n die(\"Cannot convert '\" + getDebugName(target) + \"' into observable object:\" + \"\\nThe target is already observable of different type.\" + \"\\nExtending builtins is not supported.\");\n }\n return target;\n }\n if ( true && !Object.isExtensible(target)) {\n die(\"Cannot make the designated object observable; it is not extensible\");\n }\n var name = (_options$name = options == null ? void 0 : options.name) != null ? _options$name : true ? (isPlainObject(target) ? \"ObservableObject\" : target.constructor.name) + \"@\" + getNextId() : 0;\n var adm = new ObservableObjectAdministration(target, new Map(), String(name), getAnnotationFromOptions(options));\n addHiddenProp(target, $mobx, adm);\n return target;\n}\nvar isObservableObjectAdministration = /*#__PURE__*/createInstanceofPredicate(\"ObservableObjectAdministration\", ObservableObjectAdministration);\nfunction getCachedObservablePropDescriptor(key) {\n return descriptorCache[key] || (descriptorCache[key] = {\n get: function get() {\n return this[$mobx].getObservablePropValue_(key);\n },\n set: function set(value) {\n return this[$mobx].setObservablePropValue_(key, value);\n }\n });\n}\nfunction isObservableObject(thing) {\n if (isObject(thing)) {\n return isObservableObjectAdministration(thing[$mobx]);\n }\n return false;\n}\nfunction recordAnnotationApplied(adm, annotation, key) {\n var _adm$target_$storedAn;\n if (true) {\n adm.appliedAnnotations_[key] = annotation;\n }\n // Remove applied decorator annotation so we don't try to apply it again in subclass constructor\n (_adm$target_$storedAn = adm.target_[storedAnnotationsSymbol]) == null || delete _adm$target_$storedAn[key];\n}\nfunction assertAnnotable(adm, annotation, key) {\n // Valid annotation\n if ( true && !isAnnotation(annotation)) {\n die(\"Cannot annotate '\" + adm.name_ + \".\" + key.toString() + \"': Invalid annotation.\");\n }\n /*\n // Configurable, not sealed, not frozen\n // Possibly not needed, just a little better error then the one thrown by engine.\n // Cases where this would be useful the most (subclass field initializer) are not interceptable by this.\n if (__DEV__) {\n const configurable = getDescriptor(adm.target_, key)?.configurable\n const frozen = Object.isFrozen(adm.target_)\n const sealed = Object.isSealed(adm.target_)\n if (!configurable || frozen || sealed) {\n const fieldName = `${adm.name_}.${key.toString()}`\n const requestedAnnotationType = annotation.annotationType_\n let error = `Cannot apply '${requestedAnnotationType}' to '${fieldName}':`\n if (frozen) {\n error += `\\nObject is frozen.`\n }\n if (sealed) {\n error += `\\nObject is sealed.`\n }\n if (!configurable) {\n error += `\\nproperty is not configurable.`\n // Mention only if caused by us to avoid confusion\n if (hasProp(adm.appliedAnnotations!, key)) {\n error += `\\nTo prevent accidental re-definition of a field by a subclass, `\n error += `all annotated fields of non-plain objects (classes) are not configurable.`\n }\n }\n die(error)\n }\n }\n */\n // Not annotated\n if ( true && !isOverride(annotation) && hasProp(adm.appliedAnnotations_, key)) {\n var fieldName = adm.name_ + \".\" + key.toString();\n var currentAnnotationType = adm.appliedAnnotations_[key].annotationType_;\n var requestedAnnotationType = annotation.annotationType_;\n die(\"Cannot apply '\" + requestedAnnotationType + \"' to '\" + fieldName + \"':\" + (\"\\nThe field is already annotated with '\" + currentAnnotationType + \"'.\") + \"\\nRe-annotating fields is not allowed.\" + \"\\nUse 'override' annotation for methods overridden by subclass.\");\n }\n}\n\n// Bug in safari 9.* (or iOS 9 safari mobile). See #364\nvar ENTRY_0 = /*#__PURE__*/createArrayEntryDescriptor(0);\nvar safariPrototypeSetterInheritanceBug = /*#__PURE__*/function () {\n var v = false;\n var p = {};\n Object.defineProperty(p, \"0\", {\n set: function set() {\n v = true;\n }\n });\n /*#__PURE__*/Object.create(p)[\"0\"] = 1;\n return v === false;\n}();\n/**\n * This array buffer contains two lists of properties, so that all arrays\n * can recycle their property definitions, which significantly improves performance of creating\n * properties on the fly.\n */\nvar OBSERVABLE_ARRAY_BUFFER_SIZE = 0;\n// Typescript workaround to make sure ObservableArray extends Array\nvar StubArray = function StubArray() {};\nfunction inherit(ctor, proto) {\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(ctor.prototype, proto);\n } else if (ctor.prototype.__proto__ !== undefined) {\n ctor.prototype.__proto__ = proto;\n } else {\n ctor.prototype = proto;\n }\n}\ninherit(StubArray, Array.prototype);\n// Weex proto freeze protection was here,\n// but it is unclear why the hack is need as MobX never changed the prototype\n// anyway, so removed it in V6\nvar LegacyObservableArray = /*#__PURE__*/function (_StubArray) {\n function LegacyObservableArray(initialValues, enhancer, name, owned) {\n var _this;\n if (name === void 0) {\n name = true ? \"ObservableArray@\" + getNextId() : 0;\n }\n if (owned === void 0) {\n owned = false;\n }\n _this = _StubArray.call(this) || this;\n initObservable(function () {\n var adm = new ObservableArrayAdministration(name, enhancer, owned, true);\n adm.proxy_ = _this;\n addHiddenFinalProp(_this, $mobx, adm);\n if (initialValues && initialValues.length) {\n // @ts-ignore\n _this.spliceWithArray(0, 0, initialValues);\n }\n if (safariPrototypeSetterInheritanceBug) {\n // Seems that Safari won't use numeric prototype setter until any * numeric property is\n // defined on the instance. After that it works fine, even if this property is deleted.\n Object.defineProperty(_this, \"0\", ENTRY_0);\n }\n });\n return _this;\n }\n _inheritsLoose(LegacyObservableArray, _StubArray);\n var _proto = LegacyObservableArray.prototype;\n _proto.concat = function concat() {\n this[$mobx].atom_.reportObserved();\n for (var _len = arguments.length, arrays = new Array(_len), _key = 0; _key < _len; _key++) {\n arrays[_key] = arguments[_key];\n }\n return Array.prototype.concat.apply(this.slice(),\n //@ts-ignore\n arrays.map(function (a) {\n return isObservableArray(a) ? a.slice() : a;\n }));\n };\n _proto[Symbol.iterator] = function () {\n var self = this;\n var nextIndex = 0;\n return makeIterable({\n next: function next() {\n return nextIndex < self.length ? {\n value: self[nextIndex++],\n done: false\n } : {\n done: true,\n value: undefined\n };\n }\n });\n };\n return _createClass(LegacyObservableArray, [{\n key: \"length\",\n get: function get() {\n return this[$mobx].getArrayLength_();\n },\n set: function set(newLength) {\n this[$mobx].setArrayLength_(newLength);\n }\n }, {\n key: Symbol.toStringTag,\n get: function get() {\n return \"Array\";\n }\n }]);\n}(StubArray);\nObject.entries(arrayExtensions).forEach(function (_ref) {\n var prop = _ref[0],\n fn = _ref[1];\n if (prop !== \"concat\") {\n addHiddenProp(LegacyObservableArray.prototype, prop, fn);\n }\n});\nfunction createArrayEntryDescriptor(index) {\n return {\n enumerable: false,\n configurable: true,\n get: function get() {\n return this[$mobx].get_(index);\n },\n set: function set(value) {\n this[$mobx].set_(index, value);\n }\n };\n}\nfunction createArrayBufferItem(index) {\n defineProperty(LegacyObservableArray.prototype, \"\" + index, createArrayEntryDescriptor(index));\n}\nfunction reserveArrayBuffer(max) {\n if (max > OBSERVABLE_ARRAY_BUFFER_SIZE) {\n for (var index = OBSERVABLE_ARRAY_BUFFER_SIZE; index < max + 100; index++) {\n createArrayBufferItem(index);\n }\n OBSERVABLE_ARRAY_BUFFER_SIZE = max;\n }\n}\nreserveArrayBuffer(1000);\nfunction createLegacyArray(initialValues, enhancer, name) {\n return new LegacyObservableArray(initialValues, enhancer, name);\n}\n\nfunction getAtom(thing, property) {\n if (typeof thing === \"object\" && thing !== null) {\n if (isObservableArray(thing)) {\n if (property !== undefined) {\n die(23);\n }\n return thing[$mobx].atom_;\n }\n if (isObservableSet(thing)) {\n return thing.atom_;\n }\n if (isObservableMap(thing)) {\n if (property === undefined) {\n return thing.keysAtom_;\n }\n var observable = thing.data_.get(property) || thing.hasMap_.get(property);\n if (!observable) {\n die(25, property, getDebugName(thing));\n }\n return observable;\n }\n if (isObservableObject(thing)) {\n if (!property) {\n return die(26);\n }\n var _observable = thing[$mobx].values_.get(property);\n if (!_observable) {\n die(27, property, getDebugName(thing));\n }\n return _observable;\n }\n if (isAtom(thing) || isComputedValue(thing) || isReaction(thing)) {\n return thing;\n }\n } else if (isFunction(thing)) {\n if (isReaction(thing[$mobx])) {\n // disposer function\n return thing[$mobx];\n }\n }\n die(28);\n}\nfunction getAdministration(thing, property) {\n if (!thing) {\n die(29);\n }\n if (property !== undefined) {\n return getAdministration(getAtom(thing, property));\n }\n if (isAtom(thing) || isComputedValue(thing) || isReaction(thing)) {\n return thing;\n }\n if (isObservableMap(thing) || isObservableSet(thing)) {\n return thing;\n }\n if (thing[$mobx]) {\n return thing[$mobx];\n }\n die(24, thing);\n}\nfunction getDebugName(thing, property) {\n var named;\n if (property !== undefined) {\n named = getAtom(thing, property);\n } else if (isAction(thing)) {\n return thing.name;\n } else if (isObservableObject(thing) || isObservableMap(thing) || isObservableSet(thing)) {\n named = getAdministration(thing);\n } else {\n // valid for arrays as well\n named = getAtom(thing);\n }\n return named.name_;\n}\n/**\n * Helper function for initializing observable structures, it applies:\n * 1. allowStateChanges so we don't violate enforceActions.\n * 2. untracked so we don't accidentaly subscribe to anything observable accessed during init in case the observable is created inside derivation.\n * 3. batch to avoid state version updates\n */\nfunction initObservable(cb) {\n var derivation = untrackedStart();\n var allowStateChanges = allowStateChangesStart(true);\n startBatch();\n try {\n return cb();\n } finally {\n endBatch();\n allowStateChangesEnd(allowStateChanges);\n untrackedEnd(derivation);\n }\n}\n\nvar toString = objectPrototype.toString;\nfunction deepEqual(a, b, depth) {\n if (depth === void 0) {\n depth = -1;\n }\n return eq(a, b, depth);\n}\n// Copied from https://github.com/jashkenas/underscore/blob/5c237a7c682fb68fd5378203f0bf22dce1624854/underscore.js#L1186-L1289\n// Internal recursive comparison function for `isEqual`.\nfunction eq(a, b, depth, aStack, bStack) {\n // Identical objects are equal. `0 === -0`, but they aren't identical.\n // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).\n if (a === b) {\n return a !== 0 || 1 / a === 1 / b;\n }\n // `null` or `undefined` only equal to itself (strict comparison).\n if (a == null || b == null) {\n return false;\n }\n // `NaN`s are equivalent, but non-reflexive.\n if (a !== a) {\n return b !== b;\n }\n // Exhaust primitive checks\n var type = typeof a;\n if (type !== \"function\" && type !== \"object\" && typeof b != \"object\") {\n return false;\n }\n // Compare `[[Class]]` names.\n var className = toString.call(a);\n if (className !== toString.call(b)) {\n return false;\n }\n switch (className) {\n // Strings, numbers, regular expressions, dates, and booleans are compared by value.\n case \"[object RegExp]\":\n // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i')\n case \"[object String]\":\n // Primitives and their corresponding object wrappers are equivalent; thus, `\"5\"` is\n // equivalent to `new String(\"5\")`.\n return \"\" + a === \"\" + b;\n case \"[object Number]\":\n // `NaN`s are equivalent, but non-reflexive.\n // Object(NaN) is equivalent to NaN.\n if (+a !== +a) {\n return +b !== +b;\n }\n // An `egal` comparison is performed for other numeric values.\n return +a === 0 ? 1 / +a === 1 / b : +a === +b;\n case \"[object Date]\":\n case \"[object Boolean]\":\n // Coerce dates and booleans to numeric primitive values. Dates are compared by their\n // millisecond representations. Note that invalid dates with millisecond representations\n // of `NaN` are not equivalent.\n return +a === +b;\n case \"[object Symbol]\":\n return typeof Symbol !== \"undefined\" && Symbol.valueOf.call(a) === Symbol.valueOf.call(b);\n case \"[object Map]\":\n case \"[object Set]\":\n // Maps and Sets are unwrapped to arrays of entry-pairs, adding an incidental level.\n // Hide this extra level by increasing the depth.\n if (depth >= 0) {\n depth++;\n }\n break;\n }\n // Unwrap any wrapped objects.\n a = unwrap(a);\n b = unwrap(b);\n var areArrays = className === \"[object Array]\";\n if (!areArrays) {\n if (typeof a != \"object\" || typeof b != \"object\") {\n return false;\n }\n // Objects with different constructors are not equivalent, but `Object`s or `Array`s\n // from different frames are.\n var aCtor = a.constructor,\n bCtor = b.constructor;\n if (aCtor !== bCtor && !(isFunction(aCtor) && aCtor instanceof aCtor && isFunction(bCtor) && bCtor instanceof bCtor) && \"constructor\" in a && \"constructor\" in b) {\n return false;\n }\n }\n if (depth === 0) {\n return false;\n } else if (depth < 0) {\n depth = -1;\n }\n // Assume equality for cyclic structures. The algorithm for detecting cyclic\n // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.\n // Initializing stack of traversed objects.\n // It's done here since we only need them for objects and arrays comparison.\n aStack = aStack || [];\n bStack = bStack || [];\n var length = aStack.length;\n while (length--) {\n // Linear search. Performance is inversely proportional to the number of\n // unique nested structures.\n if (aStack[length] === a) {\n return bStack[length] === b;\n }\n }\n // Add the first object to the stack of traversed objects.\n aStack.push(a);\n bStack.push(b);\n // Recursively compare objects and arrays.\n if (areArrays) {\n // Compare array lengths to determine if a deep comparison is necessary.\n length = a.length;\n if (length !== b.length) {\n return false;\n }\n // Deep compare the contents, ignoring non-numeric properties.\n while (length--) {\n if (!eq(a[length], b[length], depth - 1, aStack, bStack)) {\n return false;\n }\n }\n } else {\n // Deep compare objects.\n var keys = Object.keys(a);\n var key;\n length = keys.length;\n // Ensure that both objects contain the same number of properties before comparing deep equality.\n if (Object.keys(b).length !== length) {\n return false;\n }\n while (length--) {\n // Deep compare each member\n key = keys[length];\n if (!(hasProp(b, key) && eq(a[key], b[key], depth - 1, aStack, bStack))) {\n return false;\n }\n }\n }\n // Remove the first object from the stack of traversed objects.\n aStack.pop();\n bStack.pop();\n return true;\n}\nfunction unwrap(a) {\n if (isObservableArray(a)) {\n return a.slice();\n }\n if (isES6Map(a) || isObservableMap(a)) {\n return Array.from(a.entries());\n }\n if (isES6Set(a) || isObservableSet(a)) {\n return Array.from(a.entries());\n }\n return a;\n}\n\nvar _getGlobal$Iterator;\n// safely get iterator prototype if available\nvar maybeIteratorPrototype = ((_getGlobal$Iterator = /*#__PURE__*/getGlobal().Iterator) == null ? void 0 : _getGlobal$Iterator.prototype) || {};\nfunction makeIterable(iterator) {\n iterator[Symbol.iterator] = getSelf;\n return Object.assign(Object.create(maybeIteratorPrototype), iterator);\n}\nfunction getSelf() {\n return this;\n}\n\nfunction isAnnotation(thing) {\n return (\n // Can be function\n thing instanceof Object && typeof thing.annotationType_ === \"string\" && isFunction(thing.make_) && isFunction(thing.extend_)\n );\n}\n\n/**\n * (c) Michel Weststrate 2015 - 2020\n * MIT Licensed\n *\n * Welcome to the mobx sources! To get a global overview of how MobX internally works,\n * this is a good place to start:\n * https://medium.com/@mweststrate/becoming-fully-reactive-an-in-depth-explanation-of-mobservable-55995262a254#.xvbh6qd74\n *\n * Source folders:\n * ===============\n *\n * - api/ Most of the public static methods exposed by the module can be found here.\n * - core/ Implementation of the MobX algorithm; atoms, derivations, reactions, dependency trees, optimizations. Cool stuff can be found here.\n * - types/ All the magic that is need to have observable objects, arrays and values is in this folder. Including the modifiers like `asFlat`.\n * - utils/ Utility stuff.\n *\n */\n[\"Symbol\", \"Map\", \"Set\"].forEach(function (m) {\n var g = getGlobal();\n if (typeof g[m] === \"undefined\") {\n die(\"MobX requires global '\" + m + \"' to be available or polyfilled\");\n }\n});\nif (typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__ === \"object\") {\n // See: https://github.com/andykog/mobx-devtools/\n __MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({\n spy: spy,\n extras: {\n getDebugName: getDebugName\n },\n $mobx: $mobx\n });\n}\n\n\n//# sourceMappingURL=mobx.esm.js.map\n\n\n//# sourceURL=webpack://app_adyen_SFRA/./node_modules/mobx/dist/mobx.esm.js?"); /***/ }) diff --git a/cartridges/app_adyen_SFRA/cartridge/static/default/js/amazonPayExpressPart2.js b/cartridges/app_adyen_SFRA/cartridge/static/default/js/amazonPayExpressPart2.js index bc4e06e8a..031232c36 100644 --- a/cartridges/app_adyen_SFRA/cartridge/static/default/js/amazonPayExpressPart2.js +++ b/cartridges/app_adyen_SFRA/cartridge/static/default/js/amazonPayExpressPart2.js @@ -36,7 +36,7 @@ eval("\n\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \" \****************************************************************************/ /***/ ((module) => { -eval("\n\n// Adyen constants\n\nmodule.exports = {\n METHOD_ADYEN: 'Adyen',\n METHOD_ADYEN_POS: 'AdyenPOS',\n METHOD_ADYEN_COMPONENT: 'AdyenComponent',\n RECEIVED: 'Received',\n NOTENOUGHBALANCE: 'NotEnoughBalance',\n SUCCESS: 'Success',\n GIFTCARD: 'giftcard',\n SCHEME: 'scheme',\n GIROPAY: 'giropay',\n APPLE_PAY: 'applepay',\n PAYPAL: 'paypal',\n AMAZON_PAY: 'amazonpay',\n ACTIONTYPE: {\n QRCODE: 'qrCode'\n },\n DISABLED_SUBMIT_BUTTON_METHODS: ['paypal', 'paywithgoogle', 'googlepay', 'amazonpay', 'applepay', 'cashapp'],\n MULTIPLE_TX_VARIANTS_COMPONENTS: ['upi']\n};\n\n//# sourceURL=webpack://app_adyen_SFRA/./cartridges/app_adyen_SFRA/cartridge/client/default/js/constants.js?"); +eval("\n\n// Adyen constants\n\nmodule.exports = {\n METHOD_ADYEN: 'Adyen',\n METHOD_ADYEN_POS: 'AdyenPOS',\n METHOD_ADYEN_COMPONENT: 'AdyenComponent',\n RECEIVED: 'Received',\n NOTENOUGHBALANCE: 'NotEnoughBalance',\n SUCCESS: 'Success',\n GIFTCARD: 'giftcard',\n SCHEME: 'scheme',\n GIROPAY: 'giropay',\n APPLE_PAY: 'applepay',\n PAYPAL: 'paypal',\n AMAZON_PAY: 'amazonpay',\n ACTIONTYPE: {\n QRCODE: 'qrCode'\n },\n DISABLED_SUBMIT_BUTTON_METHODS: ['paypal', 'paywithgoogle', 'googlepay', 'amazonpay', 'applepay', 'cashapp', 'upi']\n};\n\n//# sourceURL=webpack://app_adyen_SFRA/./cartridges/app_adyen_SFRA/cartridge/client/default/js/constants.js?"); /***/ }), @@ -56,7 +56,7 @@ eval("\n\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \" \********************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ $mobx: () => (/* binding */ $mobx),\n/* harmony export */ FlowCancellationError: () => (/* binding */ FlowCancellationError),\n/* harmony export */ ObservableMap: () => (/* binding */ ObservableMap),\n/* harmony export */ ObservableSet: () => (/* binding */ ObservableSet),\n/* harmony export */ Reaction: () => (/* binding */ Reaction),\n/* harmony export */ _allowStateChanges: () => (/* binding */ allowStateChanges),\n/* harmony export */ _allowStateChangesInsideComputed: () => (/* binding */ runInAction),\n/* harmony export */ _allowStateReadsEnd: () => (/* binding */ allowStateReadsEnd),\n/* harmony export */ _allowStateReadsStart: () => (/* binding */ allowStateReadsStart),\n/* harmony export */ _autoAction: () => (/* binding */ autoAction),\n/* harmony export */ _endAction: () => (/* binding */ _endAction),\n/* harmony export */ _getAdministration: () => (/* binding */ getAdministration),\n/* harmony export */ _getGlobalState: () => (/* binding */ getGlobalState),\n/* harmony export */ _interceptReads: () => (/* binding */ interceptReads),\n/* harmony export */ _isComputingDerivation: () => (/* binding */ isComputingDerivation),\n/* harmony export */ _resetGlobalState: () => (/* binding */ resetGlobalState),\n/* harmony export */ _startAction: () => (/* binding */ _startAction),\n/* harmony export */ action: () => (/* binding */ action),\n/* harmony export */ autorun: () => (/* binding */ autorun),\n/* harmony export */ comparer: () => (/* binding */ comparer),\n/* harmony export */ computed: () => (/* binding */ computed),\n/* harmony export */ configure: () => (/* binding */ configure),\n/* harmony export */ createAtom: () => (/* binding */ createAtom),\n/* harmony export */ defineProperty: () => (/* binding */ apiDefineProperty),\n/* harmony export */ entries: () => (/* binding */ entries),\n/* harmony export */ extendObservable: () => (/* binding */ extendObservable),\n/* harmony export */ flow: () => (/* binding */ flow),\n/* harmony export */ flowResult: () => (/* binding */ flowResult),\n/* harmony export */ get: () => (/* binding */ get),\n/* harmony export */ getAtom: () => (/* binding */ getAtom),\n/* harmony export */ getDebugName: () => (/* binding */ getDebugName),\n/* harmony export */ getDependencyTree: () => (/* binding */ getDependencyTree),\n/* harmony export */ getObserverTree: () => (/* binding */ getObserverTree),\n/* harmony export */ has: () => (/* binding */ has),\n/* harmony export */ intercept: () => (/* binding */ intercept),\n/* harmony export */ isAction: () => (/* binding */ isAction),\n/* harmony export */ isBoxedObservable: () => (/* binding */ isObservableValue),\n/* harmony export */ isComputed: () => (/* binding */ isComputed),\n/* harmony export */ isComputedProp: () => (/* binding */ isComputedProp),\n/* harmony export */ isFlow: () => (/* binding */ isFlow),\n/* harmony export */ isFlowCancellationError: () => (/* binding */ isFlowCancellationError),\n/* harmony export */ isObservable: () => (/* binding */ isObservable),\n/* harmony export */ isObservableArray: () => (/* binding */ isObservableArray),\n/* harmony export */ isObservableMap: () => (/* binding */ isObservableMap),\n/* harmony export */ isObservableObject: () => (/* binding */ isObservableObject),\n/* harmony export */ isObservableProp: () => (/* binding */ isObservableProp),\n/* harmony export */ isObservableSet: () => (/* binding */ isObservableSet),\n/* harmony export */ keys: () => (/* binding */ keys),\n/* harmony export */ makeAutoObservable: () => (/* binding */ makeAutoObservable),\n/* harmony export */ makeObservable: () => (/* binding */ makeObservable),\n/* harmony export */ observable: () => (/* binding */ observable),\n/* harmony export */ observe: () => (/* binding */ observe),\n/* harmony export */ onBecomeObserved: () => (/* binding */ onBecomeObserved),\n/* harmony export */ onBecomeUnobserved: () => (/* binding */ onBecomeUnobserved),\n/* harmony export */ onReactionError: () => (/* binding */ onReactionError),\n/* harmony export */ override: () => (/* binding */ override),\n/* harmony export */ ownKeys: () => (/* binding */ apiOwnKeys),\n/* harmony export */ reaction: () => (/* binding */ reaction),\n/* harmony export */ remove: () => (/* binding */ remove),\n/* harmony export */ runInAction: () => (/* binding */ runInAction),\n/* harmony export */ set: () => (/* binding */ set),\n/* harmony export */ spy: () => (/* binding */ spy),\n/* harmony export */ toJS: () => (/* binding */ toJS),\n/* harmony export */ trace: () => (/* binding */ trace),\n/* harmony export */ transaction: () => (/* binding */ transaction),\n/* harmony export */ untracked: () => (/* binding */ untracked),\n/* harmony export */ values: () => (/* binding */ values),\n/* harmony export */ when: () => (/* binding */ when)\n/* harmony export */ });\nvar niceErrors = {\n 0: \"Invalid value for configuration 'enforceActions', expected 'never', 'always' or 'observed'\",\n 1: function _(annotationType, key) {\n return \"Cannot apply '\" + annotationType + \"' to '\" + key.toString() + \"': Field not found.\";\n },\n /*\n 2(prop) {\n return `invalid decorator for '${prop.toString()}'`\n },\n 3(prop) {\n return `Cannot decorate '${prop.toString()}': action can only be used on properties with a function value.`\n },\n 4(prop) {\n return `Cannot decorate '${prop.toString()}': computed can only be used on getter properties.`\n },\n */\n 5: \"'keys()' can only be used on observable objects, arrays, sets and maps\",\n 6: \"'values()' can only be used on observable objects, arrays, sets and maps\",\n 7: \"'entries()' can only be used on observable objects, arrays and maps\",\n 8: \"'set()' can only be used on observable objects, arrays and maps\",\n 9: \"'remove()' can only be used on observable objects, arrays and maps\",\n 10: \"'has()' can only be used on observable objects, arrays and maps\",\n 11: \"'get()' can only be used on observable objects, arrays and maps\",\n 12: \"Invalid annotation\",\n 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)\",\n 14: \"Intercept handlers should return nothing or a change object\",\n 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)\",\n 16: \"Modification exception: the internal structure of an observable array was changed.\",\n 17: function _(index, length) {\n return \"[mobx.array] Index out of bounds, \" + index + \" is larger than \" + length;\n },\n 18: \"mobx.map requires Map polyfill for the current browser. Check babel-polyfill or core-js/es6/map.js\",\n 19: function _(other) {\n return \"Cannot initialize from classes that inherit from Map: \" + other.constructor.name;\n },\n 20: function _(other) {\n return \"Cannot initialize map from \" + other;\n },\n 21: function _(dataStructure) {\n return \"Cannot convert to map from '\" + dataStructure + \"'\";\n },\n 22: \"mobx.set requires Set polyfill for the current browser. Check babel-polyfill or core-js/es6/set.js\",\n 23: \"It is not possible to get index atoms from arrays\",\n 24: function _(thing) {\n return \"Cannot obtain administration from \" + thing;\n },\n 25: function _(property, name) {\n return \"the entry '\" + property + \"' does not exist in the observable map '\" + name + \"'\";\n },\n 26: \"please specify a property\",\n 27: function _(property, name) {\n return \"no observable property '\" + property.toString() + \"' found on the observable object '\" + name + \"'\";\n },\n 28: function _(thing) {\n return \"Cannot obtain atom from \" + thing;\n },\n 29: \"Expecting some object\",\n 30: \"invalid action stack. did you forget to finish an action?\",\n 31: \"missing option for computed: get\",\n 32: function _(name, derivation) {\n return \"Cycle detected in computation \" + name + \": \" + derivation;\n },\n 33: function _(name) {\n return \"The setter of computed value '\" + name + \"' is trying to update itself. Did you intend to update an _observable_ value, instead of the computed property?\";\n },\n 34: function _(name) {\n return \"[ComputedValue '\" + name + \"'] It is not possible to assign a new value to a computed value.\";\n },\n 35: \"There are multiple, different versions of MobX active. Make sure MobX is loaded only once or use `configure({ isolateGlobalState: true })`\",\n 36: \"isolateGlobalState should be called before MobX is running any reactions\",\n 37: function _(method) {\n return \"[mobx] `observableArray.\" + method + \"()` mutates the array in-place, which is not allowed inside a derivation. Use `array.slice().\" + method + \"()` instead\";\n },\n 38: \"'ownKeys()' can only be used on observable objects\",\n 39: \"'defineProperty()' can only be used on observable objects\"\n};\nvar errors = true ? niceErrors : 0;\nfunction die(error) {\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n if (true) {\n var e = typeof error === \"string\" ? error : errors[error];\n if (typeof e === \"function\") e = e.apply(null, args);\n throw new Error(\"[MobX] \" + e);\n }\n throw new Error(typeof error === \"number\" ? \"[MobX] minified error nr: \" + error + (args.length ? \" \" + args.map(String).join(\",\") : \"\") + \". Find the full error at: https://github.com/mobxjs/mobx/blob/main/packages/mobx/src/errors.ts\" : \"[MobX] \" + error);\n}\n\nvar mockGlobal = {};\nfunction getGlobal() {\n if (typeof globalThis !== \"undefined\") {\n return globalThis;\n }\n if (typeof window !== \"undefined\") {\n return window;\n }\n if (typeof __webpack_require__.g !== \"undefined\") {\n return __webpack_require__.g;\n }\n if (typeof self !== \"undefined\") {\n return self;\n }\n return mockGlobal;\n}\n\n// We shorten anything used > 5 times\nvar assign = Object.assign;\nvar getDescriptor = Object.getOwnPropertyDescriptor;\nvar defineProperty = Object.defineProperty;\nvar objectPrototype = Object.prototype;\nvar EMPTY_ARRAY = [];\nObject.freeze(EMPTY_ARRAY);\nvar EMPTY_OBJECT = {};\nObject.freeze(EMPTY_OBJECT);\nvar hasProxy = typeof Proxy !== \"undefined\";\nvar plainObjectString = /*#__PURE__*/Object.toString();\nfunction assertProxies() {\n if (!hasProxy) {\n die( true ? \"`Proxy` objects are not available in the current environment. Please configure MobX to enable a fallback implementation.`\" : 0);\n }\n}\nfunction warnAboutProxyRequirement(msg) {\n if ( true && globalState.verifyProxies) {\n die(\"MobX is currently configured to be able to run in ES5 mode, but in ES5 MobX won't be able to \" + msg);\n }\n}\nfunction getNextId() {\n return ++globalState.mobxGuid;\n}\n/**\n * Makes sure that the provided function is invoked at most once.\n */\nfunction once(func) {\n var invoked = false;\n return function () {\n if (invoked) {\n return;\n }\n invoked = true;\n return func.apply(this, arguments);\n };\n}\nvar noop = function noop() {};\nfunction isFunction(fn) {\n return typeof fn === \"function\";\n}\nfunction isStringish(value) {\n var t = typeof value;\n switch (t) {\n case \"string\":\n case \"symbol\":\n case \"number\":\n return true;\n }\n return false;\n}\nfunction isObject(value) {\n return value !== null && typeof value === \"object\";\n}\nfunction isPlainObject(value) {\n if (!isObject(value)) {\n return false;\n }\n var proto = Object.getPrototypeOf(value);\n if (proto == null) {\n return true;\n }\n var protoConstructor = Object.hasOwnProperty.call(proto, \"constructor\") && proto.constructor;\n return typeof protoConstructor === \"function\" && protoConstructor.toString() === plainObjectString;\n}\n// https://stackoverflow.com/a/37865170\nfunction isGenerator(obj) {\n var constructor = obj == null ? void 0 : obj.constructor;\n if (!constructor) {\n return false;\n }\n if (\"GeneratorFunction\" === constructor.name || \"GeneratorFunction\" === constructor.displayName) {\n return true;\n }\n return false;\n}\nfunction addHiddenProp(object, propName, value) {\n defineProperty(object, propName, {\n enumerable: false,\n writable: true,\n configurable: true,\n value: value\n });\n}\nfunction addHiddenFinalProp(object, propName, value) {\n defineProperty(object, propName, {\n enumerable: false,\n writable: false,\n configurable: true,\n value: value\n });\n}\nfunction createInstanceofPredicate(name, theClass) {\n var propName = \"isMobX\" + name;\n theClass.prototype[propName] = true;\n return function (x) {\n return isObject(x) && x[propName] === true;\n };\n}\n/**\n * Yields true for both native and observable Map, even across different windows.\n */\nfunction isES6Map(thing) {\n return thing != null && Object.prototype.toString.call(thing) === \"[object Map]\";\n}\n/**\n * Makes sure a Map is an instance of non-inherited native or observable Map.\n */\nfunction isPlainES6Map(thing) {\n var mapProto = Object.getPrototypeOf(thing);\n var objectProto = Object.getPrototypeOf(mapProto);\n var nullProto = Object.getPrototypeOf(objectProto);\n return nullProto === null;\n}\n/**\n * Yields true for both native and observable Set, even across different windows.\n */\nfunction isES6Set(thing) {\n return thing != null && Object.prototype.toString.call(thing) === \"[object Set]\";\n}\nvar hasGetOwnPropertySymbols = typeof Object.getOwnPropertySymbols !== \"undefined\";\n/**\n * Returns the following: own enumerable keys and symbols.\n */\nfunction getPlainObjectKeys(object) {\n var keys = Object.keys(object);\n // Not supported in IE, so there are not going to be symbol props anyway...\n if (!hasGetOwnPropertySymbols) {\n return keys;\n }\n var symbols = Object.getOwnPropertySymbols(object);\n if (!symbols.length) {\n return keys;\n }\n return [].concat(keys, symbols.filter(function (s) {\n return objectPrototype.propertyIsEnumerable.call(object, s);\n }));\n}\n// From Immer utils\n// Returns all own keys, including non-enumerable and symbolic\nvar ownKeys = typeof Reflect !== \"undefined\" && Reflect.ownKeys ? Reflect.ownKeys : hasGetOwnPropertySymbols ? function (obj) {\n return Object.getOwnPropertyNames(obj).concat(Object.getOwnPropertySymbols(obj));\n} : /* istanbul ignore next */Object.getOwnPropertyNames;\nfunction stringifyKey(key) {\n if (typeof key === \"string\") {\n return key;\n }\n if (typeof key === \"symbol\") {\n return key.toString();\n }\n return new String(key).toString();\n}\nfunction toPrimitive(value) {\n return value === null ? null : typeof value === \"object\" ? \"\" + value : value;\n}\nfunction hasProp(target, prop) {\n return objectPrototype.hasOwnProperty.call(target, prop);\n}\n// From Immer utils\nvar getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors || function getOwnPropertyDescriptors(target) {\n // Polyfill needed for Hermes and IE, see https://github.com/facebook/hermes/issues/274\n var res = {};\n // Note: without polyfill for ownKeys, symbols won't be picked up\n ownKeys(target).forEach(function (key) {\n res[key] = getDescriptor(target, key);\n });\n return res;\n};\nfunction getFlag(flags, mask) {\n return !!(flags & mask);\n}\nfunction setFlag(flags, mask, newValue) {\n if (newValue) {\n flags |= mask;\n } else {\n flags &= ~mask;\n }\n return flags;\n}\n\nfunction _arrayLikeToArray(r, a) {\n (null == a || a > r.length) && (a = r.length);\n for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];\n return n;\n}\nfunction _defineProperties(e, r) {\n for (var t = 0; t < r.length; t++) {\n var o = r[t];\n o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);\n }\n}\nfunction _createClass(e, r, t) {\n return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", {\n writable: !1\n }), e;\n}\nfunction _createForOfIteratorHelperLoose(r, e) {\n var t = \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"];\n if (t) return (t = t.call(r)).next.bind(t);\n if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && \"number\" == typeof r.length) {\n t && (r = t);\n var o = 0;\n return function () {\n return o >= r.length ? {\n done: !0\n } : {\n done: !1,\n value: r[o++]\n };\n };\n }\n throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\nfunction _extends() {\n return _extends = Object.assign ? Object.assign.bind() : function (n) {\n for (var e = 1; e < arguments.length; e++) {\n var t = arguments[e];\n for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);\n }\n return n;\n }, _extends.apply(null, arguments);\n}\nfunction _inheritsLoose(t, o) {\n t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);\n}\nfunction _setPrototypeOf(t, e) {\n return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {\n return t.__proto__ = e, t;\n }, _setPrototypeOf(t, e);\n}\nfunction _toPrimitive(t, r) {\n if (\"object\" != typeof t || !t) return t;\n var e = t[Symbol.toPrimitive];\n if (void 0 !== e) {\n var i = e.call(t, r || \"default\");\n if (\"object\" != typeof i) return i;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (\"string\" === r ? String : Number)(t);\n}\nfunction _toPropertyKey(t) {\n var i = _toPrimitive(t, \"string\");\n return \"symbol\" == typeof i ? i : i + \"\";\n}\nfunction _unsupportedIterableToArray(r, a) {\n if (r) {\n if (\"string\" == typeof r) return _arrayLikeToArray(r, a);\n var t = {}.toString.call(r).slice(8, -1);\n return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;\n }\n}\n\nvar storedAnnotationsSymbol = /*#__PURE__*/Symbol(\"mobx-stored-annotations\");\n/**\n * Creates a function that acts as\n * - decorator\n * - annotation object\n */\nfunction createDecoratorAnnotation(annotation) {\n function decorator(target, property) {\n if (is20223Decorator(property)) {\n return annotation.decorate_20223_(target, property);\n } else {\n storeAnnotation(target, property, annotation);\n }\n }\n return Object.assign(decorator, annotation);\n}\n/**\n * Stores annotation to prototype,\n * so it can be inspected later by `makeObservable` called from constructor\n */\nfunction storeAnnotation(prototype, key, annotation) {\n if (!hasProp(prototype, storedAnnotationsSymbol)) {\n addHiddenProp(prototype, storedAnnotationsSymbol, _extends({}, prototype[storedAnnotationsSymbol]));\n }\n // @override must override something\n if ( true && isOverride(annotation) && !hasProp(prototype[storedAnnotationsSymbol], key)) {\n var fieldName = prototype.constructor.name + \".prototype.\" + key.toString();\n die(\"'\" + fieldName + \"' is decorated with 'override', \" + \"but no such decorated member was found on prototype.\");\n }\n // Cannot re-decorate\n assertNotDecorated(prototype, annotation, key);\n // Ignore override\n if (!isOverride(annotation)) {\n prototype[storedAnnotationsSymbol][key] = annotation;\n }\n}\nfunction assertNotDecorated(prototype, annotation, key) {\n if ( true && !isOverride(annotation) && hasProp(prototype[storedAnnotationsSymbol], key)) {\n var fieldName = prototype.constructor.name + \".prototype.\" + key.toString();\n var currentAnnotationType = prototype[storedAnnotationsSymbol][key].annotationType_;\n var requestedAnnotationType = annotation.annotationType_;\n die(\"Cannot apply '@\" + requestedAnnotationType + \"' to '\" + fieldName + \"':\" + (\"\\nThe field is already decorated with '@\" + currentAnnotationType + \"'.\") + \"\\nRe-decorating fields is not allowed.\" + \"\\nUse '@override' decorator for methods overridden by subclass.\");\n }\n}\n/**\n * Collects annotations from prototypes and stores them on target (instance)\n */\nfunction collectStoredAnnotations(target) {\n if (!hasProp(target, storedAnnotationsSymbol)) {\n // if (__DEV__ && !target[storedAnnotationsSymbol]) {\n // die(\n // `No annotations were passed to makeObservable, but no decorated members have been found either`\n // )\n // }\n // We need a copy as we will remove annotation from the list once it's applied.\n addHiddenProp(target, storedAnnotationsSymbol, _extends({}, target[storedAnnotationsSymbol]));\n }\n return target[storedAnnotationsSymbol];\n}\nfunction is20223Decorator(context) {\n return typeof context == \"object\" && typeof context[\"kind\"] == \"string\";\n}\nfunction assert20223DecoratorType(context, types) {\n if ( true && !types.includes(context.kind)) {\n die(\"The decorator applied to '\" + String(context.name) + \"' cannot be used on a \" + context.kind + \" element\");\n }\n}\n\nvar $mobx = /*#__PURE__*/Symbol(\"mobx administration\");\nvar Atom = /*#__PURE__*/function () {\n /**\n * Create a new atom. For debugging purposes it is recommended to give it a name.\n * The onBecomeObserved and onBecomeUnobserved callbacks can be used for resource management.\n */\n function Atom(name_) {\n if (name_ === void 0) {\n name_ = true ? \"Atom@\" + getNextId() : 0;\n }\n this.name_ = void 0;\n this.flags_ = 0;\n this.observers_ = new Set();\n this.lastAccessedBy_ = 0;\n this.lowestObserverState_ = IDerivationState_.NOT_TRACKING_;\n // onBecomeObservedListeners\n this.onBOL = void 0;\n // onBecomeUnobservedListeners\n this.onBUOL = void 0;\n this.name_ = name_;\n }\n // for effective unobserving. BaseAtom has true, for extra optimization, so its onBecomeUnobserved never gets called, because it's not needed\n var _proto = Atom.prototype;\n _proto.onBO = function onBO() {\n if (this.onBOL) {\n this.onBOL.forEach(function (listener) {\n return listener();\n });\n }\n };\n _proto.onBUO = function onBUO() {\n if (this.onBUOL) {\n this.onBUOL.forEach(function (listener) {\n return listener();\n });\n }\n }\n /**\n * Invoke this method to notify mobx that your atom has been used somehow.\n * Returns true if there is currently a reactive context.\n */;\n _proto.reportObserved = function reportObserved$1() {\n return reportObserved(this);\n }\n /**\n * Invoke this method _after_ this method has changed to signal mobx that all its observers should invalidate.\n */;\n _proto.reportChanged = function reportChanged() {\n startBatch();\n propagateChanged(this);\n endBatch();\n };\n _proto.toString = function toString() {\n return this.name_;\n };\n return _createClass(Atom, [{\n key: \"isBeingObserved\",\n get: function get() {\n return getFlag(this.flags_, Atom.isBeingObservedMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Atom.isBeingObservedMask_, newValue);\n }\n }, {\n key: \"isPendingUnobservation\",\n get: function get() {\n return getFlag(this.flags_, Atom.isPendingUnobservationMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Atom.isPendingUnobservationMask_, newValue);\n }\n }, {\n key: \"diffValue\",\n get: function get() {\n return getFlag(this.flags_, Atom.diffValueMask_) ? 1 : 0;\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Atom.diffValueMask_, newValue === 1 ? true : false);\n }\n }]);\n}();\nAtom.isBeingObservedMask_ = 1;\nAtom.isPendingUnobservationMask_ = 2;\nAtom.diffValueMask_ = 4;\nvar isAtom = /*#__PURE__*/createInstanceofPredicate(\"Atom\", Atom);\nfunction createAtom(name, onBecomeObservedHandler, onBecomeUnobservedHandler) {\n if (onBecomeObservedHandler === void 0) {\n onBecomeObservedHandler = noop;\n }\n if (onBecomeUnobservedHandler === void 0) {\n onBecomeUnobservedHandler = noop;\n }\n var atom = new Atom(name);\n // default `noop` listener will not initialize the hook Set\n if (onBecomeObservedHandler !== noop) {\n onBecomeObserved(atom, onBecomeObservedHandler);\n }\n if (onBecomeUnobservedHandler !== noop) {\n onBecomeUnobserved(atom, onBecomeUnobservedHandler);\n }\n return atom;\n}\n\nfunction identityComparer(a, b) {\n return a === b;\n}\nfunction structuralComparer(a, b) {\n return deepEqual(a, b);\n}\nfunction shallowComparer(a, b) {\n return deepEqual(a, b, 1);\n}\nfunction defaultComparer(a, b) {\n if (Object.is) {\n return Object.is(a, b);\n }\n return a === b ? a !== 0 || 1 / a === 1 / b : a !== a && b !== b;\n}\nvar comparer = {\n identity: identityComparer,\n structural: structuralComparer,\n \"default\": defaultComparer,\n shallow: shallowComparer\n};\n\nfunction deepEnhancer(v, _, name) {\n // it is an observable already, done\n if (isObservable(v)) {\n return v;\n }\n // something that can be converted and mutated?\n if (Array.isArray(v)) {\n return observable.array(v, {\n name: name\n });\n }\n if (isPlainObject(v)) {\n return observable.object(v, undefined, {\n name: name\n });\n }\n if (isES6Map(v)) {\n return observable.map(v, {\n name: name\n });\n }\n if (isES6Set(v)) {\n return observable.set(v, {\n name: name\n });\n }\n if (typeof v === \"function\" && !isAction(v) && !isFlow(v)) {\n if (isGenerator(v)) {\n return flow(v);\n } else {\n return autoAction(name, v);\n }\n }\n return v;\n}\nfunction shallowEnhancer(v, _, name) {\n if (v === undefined || v === null) {\n return v;\n }\n if (isObservableObject(v) || isObservableArray(v) || isObservableMap(v) || isObservableSet(v)) {\n return v;\n }\n if (Array.isArray(v)) {\n return observable.array(v, {\n name: name,\n deep: false\n });\n }\n if (isPlainObject(v)) {\n return observable.object(v, undefined, {\n name: name,\n deep: false\n });\n }\n if (isES6Map(v)) {\n return observable.map(v, {\n name: name,\n deep: false\n });\n }\n if (isES6Set(v)) {\n return observable.set(v, {\n name: name,\n deep: false\n });\n }\n if (true) {\n die(\"The shallow modifier / decorator can only used in combination with arrays, objects, maps and sets\");\n }\n}\nfunction referenceEnhancer(newValue) {\n // never turn into an observable\n return newValue;\n}\nfunction refStructEnhancer(v, oldValue) {\n if ( true && isObservable(v)) {\n die(\"observable.struct should not be used with observable values\");\n }\n if (deepEqual(v, oldValue)) {\n return oldValue;\n }\n return v;\n}\n\nvar OVERRIDE = \"override\";\nvar override = /*#__PURE__*/createDecoratorAnnotation({\n annotationType_: OVERRIDE,\n make_: make_,\n extend_: extend_,\n decorate_20223_: decorate_20223_\n});\nfunction isOverride(annotation) {\n return annotation.annotationType_ === OVERRIDE;\n}\nfunction make_(adm, key) {\n // Must not be plain object\n if ( true && adm.isPlainObject_) {\n die(\"Cannot apply '\" + this.annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + this.annotationType_ + \"' cannot be used on plain objects.\"));\n }\n // Must override something\n if ( true && !hasProp(adm.appliedAnnotations_, key)) {\n die(\"'\" + adm.name_ + \".\" + key.toString() + \"' is annotated with '\" + this.annotationType_ + \"', \" + \"but no such annotated member was found on prototype.\");\n }\n return 0 /* MakeResult.Cancel */;\n}\nfunction extend_(adm, key, descriptor, proxyTrap) {\n die(\"'\" + this.annotationType_ + \"' can only be used with 'makeObservable'\");\n}\nfunction decorate_20223_(desc, context) {\n console.warn(\"'\" + this.annotationType_ + \"' cannot be used with decorators - this is a no-op\");\n}\n\nfunction createActionAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$1,\n extend_: extend_$1,\n decorate_20223_: decorate_20223_$1\n };\n}\nfunction make_$1(adm, key, descriptor, source) {\n var _this$options_;\n // bound\n if ((_this$options_ = this.options_) != null && _this$options_.bound) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;\n }\n // own\n if (source === adm.target_) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 2 /* MakeResult.Continue */;\n }\n // prototype\n if (isAction(descriptor.value)) {\n // A prototype could have been annotated already by other constructor,\n // rest of the proto chain must be annotated already\n return 1 /* MakeResult.Break */;\n }\n var actionDescriptor = createActionDescriptor(adm, this, key, descriptor, false);\n defineProperty(source, key, actionDescriptor);\n return 2 /* MakeResult.Continue */;\n}\nfunction extend_$1(adm, key, descriptor, proxyTrap) {\n var actionDescriptor = createActionDescriptor(adm, this, key, descriptor);\n return adm.defineProperty_(key, actionDescriptor, proxyTrap);\n}\nfunction decorate_20223_$1(mthd, context) {\n if (true) {\n assert20223DecoratorType(context, [\"method\", \"field\"]);\n }\n var kind = context.kind,\n name = context.name,\n addInitializer = context.addInitializer;\n var ann = this;\n var _createAction = function _createAction(m) {\n var _ann$options_$name, _ann$options_, _ann$options_$autoAct, _ann$options_2;\n return createAction((_ann$options_$name = (_ann$options_ = ann.options_) == null ? void 0 : _ann$options_.name) != null ? _ann$options_$name : name.toString(), m, (_ann$options_$autoAct = (_ann$options_2 = ann.options_) == null ? void 0 : _ann$options_2.autoAction) != null ? _ann$options_$autoAct : false);\n };\n // Backwards/Legacy behavior, expects makeObservable(this)\n if (kind == \"field\") {\n addInitializer(function () {\n storeAnnotation(this, name, ann);\n });\n return;\n }\n if (kind == \"method\") {\n var _this$options_2;\n if (!isAction(mthd)) {\n mthd = _createAction(mthd);\n }\n if ((_this$options_2 = this.options_) != null && _this$options_2.bound) {\n addInitializer(function () {\n var self = this;\n var bound = self[name].bind(self);\n bound.isMobxAction = true;\n self[name] = bound;\n });\n }\n return mthd;\n }\n die(\"Cannot apply '\" + ann.annotationType_ + \"' to '\" + String(name) + \"' (kind: \" + kind + \"):\" + (\"\\n'\" + ann.annotationType_ + \"' can only be used on properties with a function value.\"));\n}\nfunction assertActionDescriptor(adm, _ref, key, _ref2) {\n var annotationType_ = _ref.annotationType_;\n var value = _ref2.value;\n if ( true && !isFunction(value)) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' can only be used on properties with a function value.\"));\n }\n}\nfunction createActionDescriptor(adm, annotation, key, descriptor,\n// provides ability to disable safeDescriptors for prototypes\nsafeDescriptors) {\n var _annotation$options_, _annotation$options_$, _annotation$options_2, _annotation$options_$2, _annotation$options_3, _annotation$options_4, _adm$proxy_2;\n if (safeDescriptors === void 0) {\n safeDescriptors = globalState.safeDescriptors;\n }\n assertActionDescriptor(adm, annotation, key, descriptor);\n var value = descriptor.value;\n if ((_annotation$options_ = annotation.options_) != null && _annotation$options_.bound) {\n var _adm$proxy_;\n value = value.bind((_adm$proxy_ = adm.proxy_) != null ? _adm$proxy_ : adm.target_);\n }\n return {\n value: createAction((_annotation$options_$ = (_annotation$options_2 = annotation.options_) == null ? void 0 : _annotation$options_2.name) != null ? _annotation$options_$ : key.toString(), value, (_annotation$options_$2 = (_annotation$options_3 = annotation.options_) == null ? void 0 : _annotation$options_3.autoAction) != null ? _annotation$options_$2 : false,\n // https://github.com/mobxjs/mobx/discussions/3140\n (_annotation$options_4 = annotation.options_) != null && _annotation$options_4.bound ? (_adm$proxy_2 = adm.proxy_) != null ? _adm$proxy_2 : adm.target_ : undefined),\n // Non-configurable for classes\n // prevents accidental field redefinition in subclass\n configurable: safeDescriptors ? adm.isPlainObject_ : true,\n // https://github.com/mobxjs/mobx/pull/2641#issuecomment-737292058\n enumerable: false,\n // Non-obsevable, therefore non-writable\n // Also prevents rewriting in subclass constructor\n writable: safeDescriptors ? false : true\n };\n}\n\nfunction createFlowAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$2,\n extend_: extend_$2,\n decorate_20223_: decorate_20223_$2\n };\n}\nfunction make_$2(adm, key, descriptor, source) {\n var _this$options_;\n // own\n if (source === adm.target_) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 2 /* MakeResult.Continue */;\n }\n // prototype\n // bound - must annotate protos to support super.flow()\n if ((_this$options_ = this.options_) != null && _this$options_.bound && (!hasProp(adm.target_, key) || !isFlow(adm.target_[key]))) {\n if (this.extend_(adm, key, descriptor, false) === null) {\n return 0 /* MakeResult.Cancel */;\n }\n }\n if (isFlow(descriptor.value)) {\n // A prototype could have been annotated already by other constructor,\n // rest of the proto chain must be annotated already\n return 1 /* MakeResult.Break */;\n }\n var flowDescriptor = createFlowDescriptor(adm, this, key, descriptor, false, false);\n defineProperty(source, key, flowDescriptor);\n return 2 /* MakeResult.Continue */;\n}\nfunction extend_$2(adm, key, descriptor, proxyTrap) {\n var _this$options_2;\n var flowDescriptor = createFlowDescriptor(adm, this, key, descriptor, (_this$options_2 = this.options_) == null ? void 0 : _this$options_2.bound);\n return adm.defineProperty_(key, flowDescriptor, proxyTrap);\n}\nfunction decorate_20223_$2(mthd, context) {\n var _this$options_3;\n if (true) {\n assert20223DecoratorType(context, [\"method\"]);\n }\n var name = context.name,\n addInitializer = context.addInitializer;\n if (!isFlow(mthd)) {\n mthd = flow(mthd);\n }\n if ((_this$options_3 = this.options_) != null && _this$options_3.bound) {\n addInitializer(function () {\n var self = this;\n var bound = self[name].bind(self);\n bound.isMobXFlow = true;\n self[name] = bound;\n });\n }\n return mthd;\n}\nfunction assertFlowDescriptor(adm, _ref, key, _ref2) {\n var annotationType_ = _ref.annotationType_;\n var value = _ref2.value;\n if ( true && !isFunction(value)) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' can only be used on properties with a generator function value.\"));\n }\n}\nfunction createFlowDescriptor(adm, annotation, key, descriptor, bound,\n// provides ability to disable safeDescriptors for prototypes\nsafeDescriptors) {\n if (safeDescriptors === void 0) {\n safeDescriptors = globalState.safeDescriptors;\n }\n assertFlowDescriptor(adm, annotation, key, descriptor);\n var value = descriptor.value;\n // In case of flow.bound, the descriptor can be from already annotated prototype\n if (!isFlow(value)) {\n value = flow(value);\n }\n if (bound) {\n var _adm$proxy_;\n // We do not keep original function around, so we bind the existing flow\n value = value.bind((_adm$proxy_ = adm.proxy_) != null ? _adm$proxy_ : adm.target_);\n // This is normally set by `flow`, but `bind` returns new function...\n value.isMobXFlow = true;\n }\n return {\n value: value,\n // Non-configurable for classes\n // prevents accidental field redefinition in subclass\n configurable: safeDescriptors ? adm.isPlainObject_ : true,\n // https://github.com/mobxjs/mobx/pull/2641#issuecomment-737292058\n enumerable: false,\n // Non-obsevable, therefore non-writable\n // Also prevents rewriting in subclass constructor\n writable: safeDescriptors ? false : true\n };\n}\n\nfunction createComputedAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$3,\n extend_: extend_$3,\n decorate_20223_: decorate_20223_$3\n };\n}\nfunction make_$3(adm, key, descriptor) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;\n}\nfunction extend_$3(adm, key, descriptor, proxyTrap) {\n assertComputedDescriptor(adm, this, key, descriptor);\n return adm.defineComputedProperty_(key, _extends({}, this.options_, {\n get: descriptor.get,\n set: descriptor.set\n }), proxyTrap);\n}\nfunction decorate_20223_$3(get, context) {\n if (true) {\n assert20223DecoratorType(context, [\"getter\"]);\n }\n var ann = this;\n var key = context.name,\n addInitializer = context.addInitializer;\n addInitializer(function () {\n var adm = asObservableObject(this)[$mobx];\n var options = _extends({}, ann.options_, {\n get: get,\n context: this\n });\n options.name || (options.name = true ? adm.name_ + \".\" + key.toString() : 0);\n adm.values_.set(key, new ComputedValue(options));\n });\n return function () {\n return this[$mobx].getObservablePropValue_(key);\n };\n}\nfunction assertComputedDescriptor(adm, _ref, key, _ref2) {\n var annotationType_ = _ref.annotationType_;\n var get = _ref2.get;\n if ( true && !get) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' can only be used on getter(+setter) properties.\"));\n }\n}\n\nfunction createObservableAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$4,\n extend_: extend_$4,\n decorate_20223_: decorate_20223_$4\n };\n}\nfunction make_$4(adm, key, descriptor) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;\n}\nfunction extend_$4(adm, key, descriptor, proxyTrap) {\n var _this$options_$enhanc, _this$options_;\n assertObservableDescriptor(adm, this, key, descriptor);\n return adm.defineObservableProperty_(key, descriptor.value, (_this$options_$enhanc = (_this$options_ = this.options_) == null ? void 0 : _this$options_.enhancer) != null ? _this$options_$enhanc : deepEnhancer, proxyTrap);\n}\nfunction decorate_20223_$4(desc, context) {\n if (true) {\n if (context.kind === \"field\") {\n throw die(\"Please use `@observable accessor \" + String(context.name) + \"` instead of `@observable \" + String(context.name) + \"`\");\n }\n assert20223DecoratorType(context, [\"accessor\"]);\n }\n var ann = this;\n var kind = context.kind,\n name = context.name;\n // The laziness here is not ideal... It's a workaround to how 2022.3 Decorators are implemented:\n // `addInitializer` callbacks are executed _before_ any accessors are defined (instead of the ideal-for-us right after each).\n // This means that, if we were to do our stuff in an `addInitializer`, we'd attempt to read a private slot\n // before it has been initialized. The runtime doesn't like that and throws a `Cannot read private member\n // from an object whose class did not declare it` error.\n // TODO: it seems that this will not be required anymore in the final version of the spec\n // See TODO: link\n var initializedObjects = new WeakSet();\n function initializeObservable(target, value) {\n var _ann$options_$enhance, _ann$options_;\n var adm = asObservableObject(target)[$mobx];\n var observable = new ObservableValue(value, (_ann$options_$enhance = (_ann$options_ = ann.options_) == null ? void 0 : _ann$options_.enhancer) != null ? _ann$options_$enhance : deepEnhancer, true ? adm.name_ + \".\" + name.toString() : 0, false);\n adm.values_.set(name, observable);\n initializedObjects.add(target);\n }\n if (kind == \"accessor\") {\n return {\n get: function get() {\n if (!initializedObjects.has(this)) {\n initializeObservable(this, desc.get.call(this));\n }\n return this[$mobx].getObservablePropValue_(name);\n },\n set: function set(value) {\n if (!initializedObjects.has(this)) {\n initializeObservable(this, value);\n }\n return this[$mobx].setObservablePropValue_(name, value);\n },\n init: function init(value) {\n if (!initializedObjects.has(this)) {\n initializeObservable(this, value);\n }\n return value;\n }\n };\n }\n return;\n}\nfunction assertObservableDescriptor(adm, _ref, key, descriptor) {\n var annotationType_ = _ref.annotationType_;\n if ( true && !(\"value\" in descriptor)) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' cannot be used on getter/setter properties\"));\n }\n}\n\nvar AUTO = \"true\";\nvar autoAnnotation = /*#__PURE__*/createAutoAnnotation();\nfunction createAutoAnnotation(options) {\n return {\n annotationType_: AUTO,\n options_: options,\n make_: make_$5,\n extend_: extend_$5,\n decorate_20223_: decorate_20223_$5\n };\n}\nfunction make_$5(adm, key, descriptor, source) {\n var _this$options_3, _this$options_4;\n // getter -> computed\n if (descriptor.get) {\n return computed.make_(adm, key, descriptor, source);\n }\n // lone setter -> action setter\n if (descriptor.set) {\n // TODO make action applicable to setter and delegate to action.make_\n var set = createAction(key.toString(), descriptor.set);\n // own\n if (source === adm.target_) {\n return adm.defineProperty_(key, {\n configurable: globalState.safeDescriptors ? adm.isPlainObject_ : true,\n set: set\n }) === null ? 0 /* MakeResult.Cancel */ : 2 /* MakeResult.Continue */;\n }\n // proto\n defineProperty(source, key, {\n configurable: true,\n set: set\n });\n return 2 /* MakeResult.Continue */;\n }\n // function on proto -> autoAction/flow\n if (source !== adm.target_ && typeof descriptor.value === \"function\") {\n var _this$options_2;\n if (isGenerator(descriptor.value)) {\n var _this$options_;\n var flowAnnotation = (_this$options_ = this.options_) != null && _this$options_.autoBind ? flow.bound : flow;\n return flowAnnotation.make_(adm, key, descriptor, source);\n }\n var actionAnnotation = (_this$options_2 = this.options_) != null && _this$options_2.autoBind ? autoAction.bound : autoAction;\n return actionAnnotation.make_(adm, key, descriptor, source);\n }\n // other -> observable\n // Copy props from proto as well, see test:\n // \"decorate should work with Object.create\"\n var observableAnnotation = ((_this$options_3 = this.options_) == null ? void 0 : _this$options_3.deep) === false ? observable.ref : observable;\n // if function respect autoBind option\n if (typeof descriptor.value === \"function\" && (_this$options_4 = this.options_) != null && _this$options_4.autoBind) {\n var _adm$proxy_;\n descriptor.value = descriptor.value.bind((_adm$proxy_ = adm.proxy_) != null ? _adm$proxy_ : adm.target_);\n }\n return observableAnnotation.make_(adm, key, descriptor, source);\n}\nfunction extend_$5(adm, key, descriptor, proxyTrap) {\n var _this$options_5, _this$options_6;\n // getter -> computed\n if (descriptor.get) {\n return computed.extend_(adm, key, descriptor, proxyTrap);\n }\n // lone setter -> action setter\n if (descriptor.set) {\n // TODO make action applicable to setter and delegate to action.extend_\n return adm.defineProperty_(key, {\n configurable: globalState.safeDescriptors ? adm.isPlainObject_ : true,\n set: createAction(key.toString(), descriptor.set)\n }, proxyTrap);\n }\n // other -> observable\n // if function respect autoBind option\n if (typeof descriptor.value === \"function\" && (_this$options_5 = this.options_) != null && _this$options_5.autoBind) {\n var _adm$proxy_2;\n descriptor.value = descriptor.value.bind((_adm$proxy_2 = adm.proxy_) != null ? _adm$proxy_2 : adm.target_);\n }\n var observableAnnotation = ((_this$options_6 = this.options_) == null ? void 0 : _this$options_6.deep) === false ? observable.ref : observable;\n return observableAnnotation.extend_(adm, key, descriptor, proxyTrap);\n}\nfunction decorate_20223_$5(desc, context) {\n die(\"'\" + this.annotationType_ + \"' cannot be used as a decorator\");\n}\n\nvar OBSERVABLE = \"observable\";\nvar OBSERVABLE_REF = \"observable.ref\";\nvar OBSERVABLE_SHALLOW = \"observable.shallow\";\nvar OBSERVABLE_STRUCT = \"observable.struct\";\n// Predefined bags of create observable options, to avoid allocating temporarily option objects\n// in the majority of cases\nvar defaultCreateObservableOptions = {\n deep: true,\n name: undefined,\n defaultDecorator: undefined,\n proxy: true\n};\nObject.freeze(defaultCreateObservableOptions);\nfunction asCreateObservableOptions(thing) {\n return thing || defaultCreateObservableOptions;\n}\nvar observableAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE);\nvar observableRefAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE_REF, {\n enhancer: referenceEnhancer\n});\nvar observableShallowAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE_SHALLOW, {\n enhancer: shallowEnhancer\n});\nvar observableStructAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE_STRUCT, {\n enhancer: refStructEnhancer\n});\nvar observableDecoratorAnnotation = /*#__PURE__*/createDecoratorAnnotation(observableAnnotation);\nfunction getEnhancerFromOptions(options) {\n return options.deep === true ? deepEnhancer : options.deep === false ? referenceEnhancer : getEnhancerFromAnnotation(options.defaultDecorator);\n}\nfunction getAnnotationFromOptions(options) {\n var _options$defaultDecor;\n return options ? (_options$defaultDecor = options.defaultDecorator) != null ? _options$defaultDecor : createAutoAnnotation(options) : undefined;\n}\nfunction getEnhancerFromAnnotation(annotation) {\n var _annotation$options_$, _annotation$options_;\n return !annotation ? deepEnhancer : (_annotation$options_$ = (_annotation$options_ = annotation.options_) == null ? void 0 : _annotation$options_.enhancer) != null ? _annotation$options_$ : deepEnhancer;\n}\n/**\n * Turns an object, array or function into a reactive structure.\n * @param v the value which should become observable.\n */\nfunction createObservable(v, arg2, arg3) {\n // @observable someProp; (2022.3 Decorators)\n if (is20223Decorator(arg2)) {\n return observableAnnotation.decorate_20223_(v, arg2);\n }\n // @observable someProp;\n if (isStringish(arg2)) {\n storeAnnotation(v, arg2, observableAnnotation);\n return;\n }\n // already observable - ignore\n if (isObservable(v)) {\n return v;\n }\n // plain object\n if (isPlainObject(v)) {\n return observable.object(v, arg2, arg3);\n }\n // Array\n if (Array.isArray(v)) {\n return observable.array(v, arg2);\n }\n // Map\n if (isES6Map(v)) {\n return observable.map(v, arg2);\n }\n // Set\n if (isES6Set(v)) {\n return observable.set(v, arg2);\n }\n // other object - ignore\n if (typeof v === \"object\" && v !== null) {\n return v;\n }\n // anything else\n return observable.box(v, arg2);\n}\nassign(createObservable, observableDecoratorAnnotation);\nvar observableFactories = {\n box: function box(value, options) {\n var o = asCreateObservableOptions(options);\n return new ObservableValue(value, getEnhancerFromOptions(o), o.name, true, o.equals);\n },\n array: function array(initialValues, options) {\n var o = asCreateObservableOptions(options);\n return (globalState.useProxies === false || o.proxy === false ? createLegacyArray : createObservableArray)(initialValues, getEnhancerFromOptions(o), o.name);\n },\n map: function map(initialValues, options) {\n var o = asCreateObservableOptions(options);\n return new ObservableMap(initialValues, getEnhancerFromOptions(o), o.name);\n },\n set: function set(initialValues, options) {\n var o = asCreateObservableOptions(options);\n return new ObservableSet(initialValues, getEnhancerFromOptions(o), o.name);\n },\n object: function object(props, decorators, options) {\n return initObservable(function () {\n return extendObservable(globalState.useProxies === false || (options == null ? void 0 : options.proxy) === false ? asObservableObject({}, options) : asDynamicObservableObject({}, options), props, decorators);\n });\n },\n ref: /*#__PURE__*/createDecoratorAnnotation(observableRefAnnotation),\n shallow: /*#__PURE__*/createDecoratorAnnotation(observableShallowAnnotation),\n deep: observableDecoratorAnnotation,\n struct: /*#__PURE__*/createDecoratorAnnotation(observableStructAnnotation)\n};\n// eslint-disable-next-line\nvar observable = /*#__PURE__*/assign(createObservable, observableFactories);\n\nvar COMPUTED = \"computed\";\nvar COMPUTED_STRUCT = \"computed.struct\";\nvar computedAnnotation = /*#__PURE__*/createComputedAnnotation(COMPUTED);\nvar computedStructAnnotation = /*#__PURE__*/createComputedAnnotation(COMPUTED_STRUCT, {\n equals: comparer.structural\n});\n/**\n * Decorator for class properties: @computed get value() { return expr; }.\n * For legacy purposes also invokable as ES5 observable created: `computed(() => expr)`;\n */\nvar computed = function computed(arg1, arg2) {\n if (is20223Decorator(arg2)) {\n // @computed (2022.3 Decorators)\n return computedAnnotation.decorate_20223_(arg1, arg2);\n }\n if (isStringish(arg2)) {\n // @computed\n return storeAnnotation(arg1, arg2, computedAnnotation);\n }\n if (isPlainObject(arg1)) {\n // @computed({ options })\n return createDecoratorAnnotation(createComputedAnnotation(COMPUTED, arg1));\n }\n // computed(expr, options?)\n if (true) {\n if (!isFunction(arg1)) {\n die(\"First argument to `computed` should be an expression.\");\n }\n if (isFunction(arg2)) {\n die(\"A setter as second argument is no longer supported, use `{ set: fn }` option instead\");\n }\n }\n var opts = isPlainObject(arg2) ? arg2 : {};\n opts.get = arg1;\n opts.name || (opts.name = arg1.name || \"\"); /* for generated name */\n return new ComputedValue(opts);\n};\nObject.assign(computed, computedAnnotation);\ncomputed.struct = /*#__PURE__*/createDecoratorAnnotation(computedStructAnnotation);\n\nvar _getDescriptor$config, _getDescriptor;\n// we don't use globalState for these in order to avoid possible issues with multiple\n// mobx versions\nvar currentActionId = 0;\nvar nextActionId = 1;\nvar isFunctionNameConfigurable = (_getDescriptor$config = (_getDescriptor = /*#__PURE__*/getDescriptor(function () {}, \"name\")) == null ? void 0 : _getDescriptor.configurable) != null ? _getDescriptor$config : false;\n// we can safely recycle this object\nvar tmpNameDescriptor = {\n value: \"action\",\n configurable: true,\n writable: false,\n enumerable: false\n};\nfunction createAction(actionName, fn, autoAction, ref) {\n if (autoAction === void 0) {\n autoAction = false;\n }\n if (true) {\n if (!isFunction(fn)) {\n die(\"`action` can only be invoked on functions\");\n }\n if (typeof actionName !== \"string\" || !actionName) {\n die(\"actions should have valid names, got: '\" + actionName + \"'\");\n }\n }\n function res() {\n return executeAction(actionName, autoAction, fn, ref || this, arguments);\n }\n res.isMobxAction = true;\n res.toString = function () {\n return fn.toString();\n };\n if (isFunctionNameConfigurable) {\n tmpNameDescriptor.value = actionName;\n defineProperty(res, \"name\", tmpNameDescriptor);\n }\n return res;\n}\nfunction executeAction(actionName, canRunAsDerivation, fn, scope, args) {\n var runInfo = _startAction(actionName, canRunAsDerivation, scope, args);\n try {\n return fn.apply(scope, args);\n } catch (err) {\n runInfo.error_ = err;\n throw err;\n } finally {\n _endAction(runInfo);\n }\n}\nfunction _startAction(actionName, canRunAsDerivation,\n// true for autoAction\nscope, args) {\n var notifySpy_ = true && isSpyEnabled() && !!actionName;\n var startTime_ = 0;\n if ( true && notifySpy_) {\n startTime_ = Date.now();\n var flattenedArgs = args ? Array.from(args) : EMPTY_ARRAY;\n spyReportStart({\n type: ACTION,\n name: actionName,\n object: scope,\n arguments: flattenedArgs\n });\n }\n var prevDerivation_ = globalState.trackingDerivation;\n var runAsAction = !canRunAsDerivation || !prevDerivation_;\n startBatch();\n var prevAllowStateChanges_ = globalState.allowStateChanges; // by default preserve previous allow\n if (runAsAction) {\n untrackedStart();\n prevAllowStateChanges_ = allowStateChangesStart(true);\n }\n var prevAllowStateReads_ = allowStateReadsStart(true);\n var runInfo = {\n runAsAction_: runAsAction,\n prevDerivation_: prevDerivation_,\n prevAllowStateChanges_: prevAllowStateChanges_,\n prevAllowStateReads_: prevAllowStateReads_,\n notifySpy_: notifySpy_,\n startTime_: startTime_,\n actionId_: nextActionId++,\n parentActionId_: currentActionId\n };\n currentActionId = runInfo.actionId_;\n return runInfo;\n}\nfunction _endAction(runInfo) {\n if (currentActionId !== runInfo.actionId_) {\n die(30);\n }\n currentActionId = runInfo.parentActionId_;\n if (runInfo.error_ !== undefined) {\n globalState.suppressReactionErrors = true;\n }\n allowStateChangesEnd(runInfo.prevAllowStateChanges_);\n allowStateReadsEnd(runInfo.prevAllowStateReads_);\n endBatch();\n if (runInfo.runAsAction_) {\n untrackedEnd(runInfo.prevDerivation_);\n }\n if ( true && runInfo.notifySpy_) {\n spyReportEnd({\n time: Date.now() - runInfo.startTime_\n });\n }\n globalState.suppressReactionErrors = false;\n}\nfunction allowStateChanges(allowStateChanges, func) {\n var prev = allowStateChangesStart(allowStateChanges);\n try {\n return func();\n } finally {\n allowStateChangesEnd(prev);\n }\n}\nfunction allowStateChangesStart(allowStateChanges) {\n var prev = globalState.allowStateChanges;\n globalState.allowStateChanges = allowStateChanges;\n return prev;\n}\nfunction allowStateChangesEnd(prev) {\n globalState.allowStateChanges = prev;\n}\n\nvar CREATE = \"create\";\nvar ObservableValue = /*#__PURE__*/function (_Atom) {\n function ObservableValue(value, enhancer, name_, notifySpy, equals) {\n var _this;\n if (name_ === void 0) {\n name_ = true ? \"ObservableValue@\" + getNextId() : 0;\n }\n if (notifySpy === void 0) {\n notifySpy = true;\n }\n if (equals === void 0) {\n equals = comparer[\"default\"];\n }\n _this = _Atom.call(this, name_) || this;\n _this.enhancer = void 0;\n _this.name_ = void 0;\n _this.equals = void 0;\n _this.hasUnreportedChange_ = false;\n _this.interceptors_ = void 0;\n _this.changeListeners_ = void 0;\n _this.value_ = void 0;\n _this.dehancer = void 0;\n _this.enhancer = enhancer;\n _this.name_ = name_;\n _this.equals = equals;\n _this.value_ = enhancer(value, undefined, name_);\n if ( true && notifySpy && isSpyEnabled()) {\n // only notify spy if this is a stand-alone observable\n spyReport({\n type: CREATE,\n object: _this,\n observableKind: \"value\",\n debugObjectName: _this.name_,\n newValue: \"\" + _this.value_\n });\n }\n return _this;\n }\n _inheritsLoose(ObservableValue, _Atom);\n var _proto = ObservableValue.prototype;\n _proto.dehanceValue = function dehanceValue(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.set = function set(newValue) {\n var oldValue = this.value_;\n newValue = this.prepareNewValue_(newValue);\n if (newValue !== globalState.UNCHANGED) {\n var notifySpy = isSpyEnabled();\n if ( true && notifySpy) {\n spyReportStart({\n type: UPDATE,\n object: this,\n observableKind: \"value\",\n debugObjectName: this.name_,\n newValue: newValue,\n oldValue: oldValue\n });\n }\n this.setNewValue_(newValue);\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n };\n _proto.prepareNewValue_ = function prepareNewValue_(newValue) {\n checkIfStateModificationsAreAllowed(this);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this,\n type: UPDATE,\n newValue: newValue\n });\n if (!change) {\n return globalState.UNCHANGED;\n }\n newValue = change.newValue;\n }\n // apply modifier\n newValue = this.enhancer(newValue, this.value_, this.name_);\n return this.equals(this.value_, newValue) ? globalState.UNCHANGED : newValue;\n };\n _proto.setNewValue_ = function setNewValue_(newValue) {\n var oldValue = this.value_;\n this.value_ = newValue;\n this.reportChanged();\n if (hasListeners(this)) {\n notifyListeners(this, {\n type: UPDATE,\n object: this,\n newValue: newValue,\n oldValue: oldValue\n });\n }\n };\n _proto.get = function get() {\n this.reportObserved();\n return this.dehanceValue(this.value_);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n if (fireImmediately) {\n listener({\n observableKind: \"value\",\n debugObjectName: this.name_,\n object: this,\n type: UPDATE,\n newValue: this.value_,\n oldValue: undefined\n });\n }\n return registerListener(this, listener);\n };\n _proto.raw = function raw() {\n // used by MST ot get undehanced value\n return this.value_;\n };\n _proto.toJSON = function toJSON() {\n return this.get();\n };\n _proto.toString = function toString() {\n return this.name_ + \"[\" + this.value_ + \"]\";\n };\n _proto.valueOf = function valueOf() {\n return toPrimitive(this.get());\n };\n _proto[Symbol.toPrimitive] = function () {\n return this.valueOf();\n };\n return ObservableValue;\n}(Atom);\nvar isObservableValue = /*#__PURE__*/createInstanceofPredicate(\"ObservableValue\", ObservableValue);\n\n/**\n * A node in the state dependency root that observes other nodes, and can be observed itself.\n *\n * ComputedValue will remember the result of the computation for the duration of the batch, or\n * while being observed.\n *\n * During this time it will recompute only when one of its direct dependencies changed,\n * but only when it is being accessed with `ComputedValue.get()`.\n *\n * Implementation description:\n * 1. First time it's being accessed it will compute and remember result\n * give back remembered result until 2. happens\n * 2. First time any deep dependency change, propagate POSSIBLY_STALE to all observers, wait for 3.\n * 3. When it's being accessed, recompute if any shallow dependency changed.\n * if result changed: propagate STALE to all observers, that were POSSIBLY_STALE from the last step.\n * go to step 2. either way\n *\n * If at any point it's outside batch and it isn't observed: reset everything and go to 1.\n */\nvar ComputedValue = /*#__PURE__*/function () {\n /**\n * Create a new computed value based on a function expression.\n *\n * The `name` property is for debug purposes only.\n *\n * The `equals` property specifies the comparer function to use to determine if a newly produced\n * value differs from the previous value. Two comparers are provided in the library; `defaultComparer`\n * compares based on identity comparison (===), and `structuralComparer` deeply compares the structure.\n * Structural comparison can be convenient if you always produce a new aggregated object and\n * don't want to notify observers if it is structurally the same.\n * This is useful for working with vectors, mouse coordinates etc.\n */\n function ComputedValue(options) {\n this.dependenciesState_ = IDerivationState_.NOT_TRACKING_;\n this.observing_ = [];\n // nodes we are looking at. Our value depends on these nodes\n this.newObserving_ = null;\n // during tracking it's an array with new observed observers\n this.observers_ = new Set();\n this.runId_ = 0;\n this.lastAccessedBy_ = 0;\n this.lowestObserverState_ = IDerivationState_.UP_TO_DATE_;\n this.unboundDepsCount_ = 0;\n this.value_ = new CaughtException(null);\n this.name_ = void 0;\n this.triggeredBy_ = void 0;\n this.flags_ = 0;\n this.derivation = void 0;\n // N.B: unminified as it is used by MST\n this.setter_ = void 0;\n this.isTracing_ = TraceMode.NONE;\n this.scope_ = void 0;\n this.equals_ = void 0;\n this.requiresReaction_ = void 0;\n this.keepAlive_ = void 0;\n this.onBOL = void 0;\n this.onBUOL = void 0;\n if (!options.get) {\n die(31);\n }\n this.derivation = options.get;\n this.name_ = options.name || ( true ? \"ComputedValue@\" + getNextId() : 0);\n if (options.set) {\n this.setter_ = createAction( true ? this.name_ + \"-setter\" : 0, options.set);\n }\n this.equals_ = options.equals || (options.compareStructural || options.struct ? comparer.structural : comparer[\"default\"]);\n this.scope_ = options.context;\n this.requiresReaction_ = options.requiresReaction;\n this.keepAlive_ = !!options.keepAlive;\n }\n var _proto = ComputedValue.prototype;\n _proto.onBecomeStale_ = function onBecomeStale_() {\n propagateMaybeChanged(this);\n };\n _proto.onBO = function onBO() {\n if (this.onBOL) {\n this.onBOL.forEach(function (listener) {\n return listener();\n });\n }\n };\n _proto.onBUO = function onBUO() {\n if (this.onBUOL) {\n this.onBUOL.forEach(function (listener) {\n return listener();\n });\n }\n }\n // to check for cycles\n ;\n /**\n * Returns the current value of this computed value.\n * Will evaluate its computation first if needed.\n */\n _proto.get = function get() {\n if (this.isComputing) {\n die(32, this.name_, this.derivation);\n }\n if (globalState.inBatch === 0 &&\n // !globalState.trackingDerivatpion &&\n this.observers_.size === 0 && !this.keepAlive_) {\n if (shouldCompute(this)) {\n this.warnAboutUntrackedRead_();\n startBatch(); // See perf test 'computed memoization'\n this.value_ = this.computeValue_(false);\n endBatch();\n }\n } else {\n reportObserved(this);\n if (shouldCompute(this)) {\n var prevTrackingContext = globalState.trackingContext;\n if (this.keepAlive_ && !prevTrackingContext) {\n globalState.trackingContext = this;\n }\n if (this.trackAndCompute()) {\n propagateChangeConfirmed(this);\n }\n globalState.trackingContext = prevTrackingContext;\n }\n }\n var result = this.value_;\n if (isCaughtException(result)) {\n throw result.cause;\n }\n return result;\n };\n _proto.set = function set(value) {\n if (this.setter_) {\n if (this.isRunningSetter) {\n die(33, this.name_);\n }\n this.isRunningSetter = true;\n try {\n this.setter_.call(this.scope_, value);\n } finally {\n this.isRunningSetter = false;\n }\n } else {\n die(34, this.name_);\n }\n };\n _proto.trackAndCompute = function trackAndCompute() {\n // N.B: unminified as it is used by MST\n var oldValue = this.value_;\n var wasSuspended = /* see #1208 */this.dependenciesState_ === IDerivationState_.NOT_TRACKING_;\n var newValue = this.computeValue_(true);\n var changed = wasSuspended || isCaughtException(oldValue) || isCaughtException(newValue) || !this.equals_(oldValue, newValue);\n if (changed) {\n this.value_ = newValue;\n if ( true && isSpyEnabled()) {\n spyReport({\n observableKind: \"computed\",\n debugObjectName: this.name_,\n object: this.scope_,\n type: \"update\",\n oldValue: oldValue,\n newValue: newValue\n });\n }\n }\n return changed;\n };\n _proto.computeValue_ = function computeValue_(track) {\n this.isComputing = true;\n // don't allow state changes during computation\n var prev = allowStateChangesStart(false);\n var res;\n if (track) {\n res = trackDerivedFunction(this, this.derivation, this.scope_);\n } else {\n if (globalState.disableErrorBoundaries === true) {\n res = this.derivation.call(this.scope_);\n } else {\n try {\n res = this.derivation.call(this.scope_);\n } catch (e) {\n res = new CaughtException(e);\n }\n }\n }\n allowStateChangesEnd(prev);\n this.isComputing = false;\n return res;\n };\n _proto.suspend_ = function suspend_() {\n if (!this.keepAlive_) {\n clearObserving(this);\n this.value_ = undefined; // don't hold on to computed value!\n if ( true && this.isTracing_ !== TraceMode.NONE) {\n console.log(\"[mobx.trace] Computed value '\" + this.name_ + \"' was suspended and it will recompute on the next access.\");\n }\n }\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n var _this = this;\n var firstTime = true;\n var prevValue = undefined;\n return autorun(function () {\n // TODO: why is this in a different place than the spyReport() function? in all other observables it's called in the same place\n var newValue = _this.get();\n if (!firstTime || fireImmediately) {\n var prevU = untrackedStart();\n listener({\n observableKind: \"computed\",\n debugObjectName: _this.name_,\n type: UPDATE,\n object: _this,\n newValue: newValue,\n oldValue: prevValue\n });\n untrackedEnd(prevU);\n }\n firstTime = false;\n prevValue = newValue;\n });\n };\n _proto.warnAboutUntrackedRead_ = function warnAboutUntrackedRead_() {\n if (false) {}\n if (this.isTracing_ !== TraceMode.NONE) {\n console.log(\"[mobx.trace] Computed value '\" + this.name_ + \"' is being read outside a reactive context. Doing a full recompute.\");\n }\n if (typeof this.requiresReaction_ === \"boolean\" ? this.requiresReaction_ : globalState.computedRequiresReaction) {\n console.warn(\"[mobx] Computed value '\" + this.name_ + \"' is being read outside a reactive context. Doing a full recompute.\");\n }\n };\n _proto.toString = function toString() {\n return this.name_ + \"[\" + this.derivation.toString() + \"]\";\n };\n _proto.valueOf = function valueOf() {\n return toPrimitive(this.get());\n };\n _proto[Symbol.toPrimitive] = function () {\n return this.valueOf();\n };\n return _createClass(ComputedValue, [{\n key: \"isComputing\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isComputingMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isComputingMask_, newValue);\n }\n }, {\n key: \"isRunningSetter\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isRunningSetterMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isRunningSetterMask_, newValue);\n }\n }, {\n key: \"isBeingObserved\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isBeingObservedMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isBeingObservedMask_, newValue);\n }\n }, {\n key: \"isPendingUnobservation\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isPendingUnobservationMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isPendingUnobservationMask_, newValue);\n }\n }, {\n key: \"diffValue\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.diffValueMask_) ? 1 : 0;\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.diffValueMask_, newValue === 1 ? true : false);\n }\n }]);\n}();\nComputedValue.isComputingMask_ = 1;\nComputedValue.isRunningSetterMask_ = 2;\nComputedValue.isBeingObservedMask_ = 4;\nComputedValue.isPendingUnobservationMask_ = 8;\nComputedValue.diffValueMask_ = 16;\nvar isComputedValue = /*#__PURE__*/createInstanceofPredicate(\"ComputedValue\", ComputedValue);\n\nvar IDerivationState_;\n(function (IDerivationState_) {\n // before being run or (outside batch and not being observed)\n // at this point derivation is not holding any data about dependency tree\n IDerivationState_[IDerivationState_[\"NOT_TRACKING_\"] = -1] = \"NOT_TRACKING_\";\n // no shallow dependency changed since last computation\n // won't recalculate derivation\n // this is what makes mobx fast\n IDerivationState_[IDerivationState_[\"UP_TO_DATE_\"] = 0] = \"UP_TO_DATE_\";\n // some deep dependency changed, but don't know if shallow dependency changed\n // will require to check first if UP_TO_DATE or POSSIBLY_STALE\n // currently only ComputedValue will propagate POSSIBLY_STALE\n //\n // having this state is second big optimization:\n // don't have to recompute on every dependency change, but only when it's needed\n IDerivationState_[IDerivationState_[\"POSSIBLY_STALE_\"] = 1] = \"POSSIBLY_STALE_\";\n // A shallow dependency has changed since last computation and the derivation\n // will need to recompute when it's needed next.\n IDerivationState_[IDerivationState_[\"STALE_\"] = 2] = \"STALE_\";\n})(IDerivationState_ || (IDerivationState_ = {}));\nvar TraceMode;\n(function (TraceMode) {\n TraceMode[TraceMode[\"NONE\"] = 0] = \"NONE\";\n TraceMode[TraceMode[\"LOG\"] = 1] = \"LOG\";\n TraceMode[TraceMode[\"BREAK\"] = 2] = \"BREAK\";\n})(TraceMode || (TraceMode = {}));\nvar CaughtException = function CaughtException(cause) {\n this.cause = void 0;\n this.cause = cause;\n // Empty\n};\nfunction isCaughtException(e) {\n return e instanceof CaughtException;\n}\n/**\n * Finds out whether any dependency of the derivation has actually changed.\n * If dependenciesState is 1 then it will recalculate dependencies,\n * if any dependency changed it will propagate it by changing dependenciesState to 2.\n *\n * By iterating over the dependencies in the same order that they were reported and\n * stopping on the first change, all the recalculations are only called for ComputedValues\n * that will be tracked by derivation. That is because we assume that if the first x\n * dependencies of the derivation doesn't change then the derivation should run the same way\n * up until accessing x-th dependency.\n */\nfunction shouldCompute(derivation) {\n switch (derivation.dependenciesState_) {\n case IDerivationState_.UP_TO_DATE_:\n return false;\n case IDerivationState_.NOT_TRACKING_:\n case IDerivationState_.STALE_:\n return true;\n case IDerivationState_.POSSIBLY_STALE_:\n {\n // state propagation can occur outside of action/reactive context #2195\n var prevAllowStateReads = allowStateReadsStart(true);\n var prevUntracked = untrackedStart(); // no need for those computeds to be reported, they will be picked up in trackDerivedFunction.\n var obs = derivation.observing_,\n l = obs.length;\n for (var i = 0; i < l; i++) {\n var obj = obs[i];\n if (isComputedValue(obj)) {\n if (globalState.disableErrorBoundaries) {\n obj.get();\n } else {\n try {\n obj.get();\n } catch (e) {\n // we are not interested in the value *or* exception at this moment, but if there is one, notify all\n untrackedEnd(prevUntracked);\n allowStateReadsEnd(prevAllowStateReads);\n return true;\n }\n }\n // if ComputedValue `obj` actually changed it will be computed and propagated to its observers.\n // and `derivation` is an observer of `obj`\n // invariantShouldCompute(derivation)\n if (derivation.dependenciesState_ === IDerivationState_.STALE_) {\n untrackedEnd(prevUntracked);\n allowStateReadsEnd(prevAllowStateReads);\n return true;\n }\n }\n }\n changeDependenciesStateTo0(derivation);\n untrackedEnd(prevUntracked);\n allowStateReadsEnd(prevAllowStateReads);\n return false;\n }\n }\n}\nfunction isComputingDerivation() {\n return globalState.trackingDerivation !== null; // filter out actions inside computations\n}\nfunction checkIfStateModificationsAreAllowed(atom) {\n if (false) {}\n var hasObservers = atom.observers_.size > 0;\n // Should not be possible to change observed state outside strict mode, except during initialization, see #563\n if (!globalState.allowStateChanges && (hasObservers || globalState.enforceActions === \"always\")) {\n console.warn(\"[MobX] \" + (globalState.enforceActions ? \"Since strict-mode is enabled, changing (observed) observable values without using an action is not allowed. Tried to modify: \" : \"Side effects like changing state are not allowed at this point. Are you trying to modify state from, for example, a computed value or the render function of a React component? You can wrap side effects in 'runInAction' (or decorate functions with 'action') if needed. Tried to modify: \") + atom.name_);\n }\n}\nfunction checkIfStateReadsAreAllowed(observable) {\n if ( true && !globalState.allowStateReads && globalState.observableRequiresReaction) {\n console.warn(\"[mobx] Observable '\" + observable.name_ + \"' being read outside a reactive context.\");\n }\n}\n/**\n * Executes the provided function `f` and tracks which observables are being accessed.\n * The tracking information is stored on the `derivation` object and the derivation is registered\n * as observer of any of the accessed observables.\n */\nfunction trackDerivedFunction(derivation, f, context) {\n var prevAllowStateReads = allowStateReadsStart(true);\n changeDependenciesStateTo0(derivation);\n // Preallocate array; will be trimmed by bindDependencies.\n derivation.newObserving_ = new Array(\n // Reserve constant space for initial dependencies, dynamic space otherwise.\n // See https://github.com/mobxjs/mobx/pull/3833\n derivation.runId_ === 0 ? 100 : derivation.observing_.length);\n derivation.unboundDepsCount_ = 0;\n derivation.runId_ = ++globalState.runId;\n var prevTracking = globalState.trackingDerivation;\n globalState.trackingDerivation = derivation;\n globalState.inBatch++;\n var result;\n if (globalState.disableErrorBoundaries === true) {\n result = f.call(context);\n } else {\n try {\n result = f.call(context);\n } catch (e) {\n result = new CaughtException(e);\n }\n }\n globalState.inBatch--;\n globalState.trackingDerivation = prevTracking;\n bindDependencies(derivation);\n warnAboutDerivationWithoutDependencies(derivation);\n allowStateReadsEnd(prevAllowStateReads);\n return result;\n}\nfunction warnAboutDerivationWithoutDependencies(derivation) {\n if (false) {}\n if (derivation.observing_.length !== 0) {\n return;\n }\n if (typeof derivation.requiresObservable_ === \"boolean\" ? derivation.requiresObservable_ : globalState.reactionRequiresObservable) {\n console.warn(\"[mobx] Derivation '\" + derivation.name_ + \"' is created/updated without reading any observable value.\");\n }\n}\n/**\n * diffs newObserving with observing.\n * update observing to be newObserving with unique observables\n * notify observers that become observed/unobserved\n */\nfunction bindDependencies(derivation) {\n // invariant(derivation.dependenciesState !== IDerivationState.NOT_TRACKING, \"INTERNAL ERROR bindDependencies expects derivation.dependenciesState !== -1\");\n var prevObserving = derivation.observing_;\n var observing = derivation.observing_ = derivation.newObserving_;\n var lowestNewObservingDerivationState = IDerivationState_.UP_TO_DATE_;\n // Go through all new observables and check diffValue: (this list can contain duplicates):\n // 0: first occurrence, change to 1 and keep it\n // 1: extra occurrence, drop it\n var i0 = 0,\n l = derivation.unboundDepsCount_;\n for (var i = 0; i < l; i++) {\n var dep = observing[i];\n if (dep.diffValue === 0) {\n dep.diffValue = 1;\n if (i0 !== i) {\n observing[i0] = dep;\n }\n i0++;\n }\n // Upcast is 'safe' here, because if dep is IObservable, `dependenciesState` will be undefined,\n // not hitting the condition\n if (dep.dependenciesState_ > lowestNewObservingDerivationState) {\n lowestNewObservingDerivationState = dep.dependenciesState_;\n }\n }\n observing.length = i0;\n derivation.newObserving_ = null; // newObserving shouldn't be needed outside tracking (statement moved down to work around FF bug, see #614)\n // Go through all old observables and check diffValue: (it is unique after last bindDependencies)\n // 0: it's not in new observables, unobserve it\n // 1: it keeps being observed, don't want to notify it. change to 0\n l = prevObserving.length;\n while (l--) {\n var _dep = prevObserving[l];\n if (_dep.diffValue === 0) {\n removeObserver(_dep, derivation);\n }\n _dep.diffValue = 0;\n }\n // Go through all new observables and check diffValue: (now it should be unique)\n // 0: it was set to 0 in last loop. don't need to do anything.\n // 1: it wasn't observed, let's observe it. set back to 0\n while (i0--) {\n var _dep2 = observing[i0];\n if (_dep2.diffValue === 1) {\n _dep2.diffValue = 0;\n addObserver(_dep2, derivation);\n }\n }\n // Some new observed derivations may become stale during this derivation computation\n // so they have had no chance to propagate staleness (#916)\n if (lowestNewObservingDerivationState !== IDerivationState_.UP_TO_DATE_) {\n derivation.dependenciesState_ = lowestNewObservingDerivationState;\n derivation.onBecomeStale_();\n }\n}\nfunction clearObserving(derivation) {\n // invariant(globalState.inBatch > 0, \"INTERNAL ERROR clearObserving should be called only inside batch\");\n var obs = derivation.observing_;\n derivation.observing_ = [];\n var i = obs.length;\n while (i--) {\n removeObserver(obs[i], derivation);\n }\n derivation.dependenciesState_ = IDerivationState_.NOT_TRACKING_;\n}\nfunction untracked(action) {\n var prev = untrackedStart();\n try {\n return action();\n } finally {\n untrackedEnd(prev);\n }\n}\nfunction untrackedStart() {\n var prev = globalState.trackingDerivation;\n globalState.trackingDerivation = null;\n return prev;\n}\nfunction untrackedEnd(prev) {\n globalState.trackingDerivation = prev;\n}\nfunction allowStateReadsStart(allowStateReads) {\n var prev = globalState.allowStateReads;\n globalState.allowStateReads = allowStateReads;\n return prev;\n}\nfunction allowStateReadsEnd(prev) {\n globalState.allowStateReads = prev;\n}\n/**\n * needed to keep `lowestObserverState` correct. when changing from (2 or 1) to 0\n *\n */\nfunction changeDependenciesStateTo0(derivation) {\n if (derivation.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {\n return;\n }\n derivation.dependenciesState_ = IDerivationState_.UP_TO_DATE_;\n var obs = derivation.observing_;\n var i = obs.length;\n while (i--) {\n obs[i].lowestObserverState_ = IDerivationState_.UP_TO_DATE_;\n }\n}\n\n/**\n * These values will persist if global state is reset\n */\nvar persistentKeys = [\"mobxGuid\", \"spyListeners\", \"enforceActions\", \"computedRequiresReaction\", \"reactionRequiresObservable\", \"observableRequiresReaction\", \"allowStateReads\", \"disableErrorBoundaries\", \"runId\", \"UNCHANGED\", \"useProxies\"];\nvar MobXGlobals = function MobXGlobals() {\n /**\n * MobXGlobals version.\n * MobX compatiblity with other versions loaded in memory as long as this version matches.\n * It indicates that the global state still stores similar information\n *\n * N.B: this version is unrelated to the package version of MobX, and is only the version of the\n * internal state storage of MobX, and can be the same across many different package versions\n */\n this.version = 6;\n /**\n * globally unique token to signal unchanged\n */\n this.UNCHANGED = {};\n /**\n * Currently running derivation\n */\n this.trackingDerivation = null;\n /**\n * Currently running reaction. This determines if we currently have a reactive context.\n * (Tracking derivation is also set for temporal tracking of computed values inside actions,\n * but trackingReaction can only be set by a form of Reaction)\n */\n this.trackingContext = null;\n /**\n * Each time a derivation is tracked, it is assigned a unique run-id\n */\n this.runId = 0;\n /**\n * 'guid' for general purpose. Will be persisted amongst resets.\n */\n this.mobxGuid = 0;\n /**\n * Are we in a batch block? (and how many of them)\n */\n this.inBatch = 0;\n /**\n * Observables that don't have observers anymore, and are about to be\n * suspended, unless somebody else accesses it in the same batch\n *\n * @type {IObservable[]}\n */\n this.pendingUnobservations = [];\n /**\n * List of scheduled, not yet executed, reactions.\n */\n this.pendingReactions = [];\n /**\n * Are we currently processing reactions?\n */\n this.isRunningReactions = false;\n /**\n * Is it allowed to change observables at this point?\n * In general, MobX doesn't allow that when running computations and React.render.\n * To ensure that those functions stay pure.\n */\n this.allowStateChanges = false;\n /**\n * Is it allowed to read observables at this point?\n * Used to hold the state needed for `observableRequiresReaction`\n */\n this.allowStateReads = true;\n /**\n * If strict mode is enabled, state changes are by default not allowed\n */\n this.enforceActions = true;\n /**\n * Spy callbacks\n */\n this.spyListeners = [];\n /**\n * Globally attached error handlers that react specifically to errors in reactions\n */\n this.globalReactionErrorHandlers = [];\n /**\n * Warn if computed values are accessed outside a reactive context\n */\n this.computedRequiresReaction = false;\n /**\n * (Experimental)\n * Warn if you try to create to derivation / reactive context without accessing any observable.\n */\n this.reactionRequiresObservable = false;\n /**\n * (Experimental)\n * Warn if observables are accessed outside a reactive context\n */\n this.observableRequiresReaction = false;\n /*\n * Don't catch and rethrow exceptions. This is useful for inspecting the state of\n * the stack when an exception occurs while debugging.\n */\n this.disableErrorBoundaries = false;\n /*\n * If true, we are already handling an exception in an action. Any errors in reactions should be suppressed, as\n * they are not the cause, see: https://github.com/mobxjs/mobx/issues/1836\n */\n this.suppressReactionErrors = false;\n this.useProxies = true;\n /*\n * print warnings about code that would fail if proxies weren't available\n */\n this.verifyProxies = false;\n /**\n * False forces all object's descriptors to\n * writable: true\n * configurable: true\n */\n this.safeDescriptors = true;\n};\nvar canMergeGlobalState = true;\nvar isolateCalled = false;\nvar globalState = /*#__PURE__*/function () {\n var global = /*#__PURE__*/getGlobal();\n if (global.__mobxInstanceCount > 0 && !global.__mobxGlobals) {\n canMergeGlobalState = false;\n }\n if (global.__mobxGlobals && global.__mobxGlobals.version !== new MobXGlobals().version) {\n canMergeGlobalState = false;\n }\n if (!canMergeGlobalState) {\n // Because this is a IIFE we need to let isolateCalled a chance to change\n // so we run it after the event loop completed at least 1 iteration\n setTimeout(function () {\n if (!isolateCalled) {\n die(35);\n }\n }, 1);\n return new MobXGlobals();\n } else if (global.__mobxGlobals) {\n global.__mobxInstanceCount += 1;\n if (!global.__mobxGlobals.UNCHANGED) {\n global.__mobxGlobals.UNCHANGED = {};\n } // make merge backward compatible\n return global.__mobxGlobals;\n } else {\n global.__mobxInstanceCount = 1;\n return global.__mobxGlobals = /*#__PURE__*/new MobXGlobals();\n }\n}();\nfunction isolateGlobalState() {\n if (globalState.pendingReactions.length || globalState.inBatch || globalState.isRunningReactions) {\n die(36);\n }\n isolateCalled = true;\n if (canMergeGlobalState) {\n var global = getGlobal();\n if (--global.__mobxInstanceCount === 0) {\n global.__mobxGlobals = undefined;\n }\n globalState = new MobXGlobals();\n }\n}\nfunction getGlobalState() {\n return globalState;\n}\n/**\n * For testing purposes only; this will break the internal state of existing observables,\n * but can be used to get back at a stable state after throwing errors\n */\nfunction resetGlobalState() {\n var defaultGlobals = new MobXGlobals();\n for (var key in defaultGlobals) {\n if (persistentKeys.indexOf(key) === -1) {\n globalState[key] = defaultGlobals[key];\n }\n }\n globalState.allowStateChanges = !globalState.enforceActions;\n}\n\nfunction hasObservers(observable) {\n return observable.observers_ && observable.observers_.size > 0;\n}\nfunction getObservers(observable) {\n return observable.observers_;\n}\n// function invariantObservers(observable: IObservable) {\n// const list = observable.observers\n// const map = observable.observersIndexes\n// const l = list.length\n// for (let i = 0; i < l; i++) {\n// const id = list[i].__mapid\n// if (i) {\n// invariant(map[id] === i, \"INTERNAL ERROR maps derivation.__mapid to index in list\") // for performance\n// } else {\n// invariant(!(id in map), \"INTERNAL ERROR observer on index 0 shouldn't be held in map.\") // for performance\n// }\n// }\n// invariant(\n// list.length === 0 || Object.keys(map).length === list.length - 1,\n// \"INTERNAL ERROR there is no junk in map\"\n// )\n// }\nfunction addObserver(observable, node) {\n // invariant(node.dependenciesState !== -1, \"INTERNAL ERROR, can add only dependenciesState !== -1\");\n // invariant(observable._observers.indexOf(node) === -1, \"INTERNAL ERROR add already added node\");\n // invariantObservers(observable);\n observable.observers_.add(node);\n if (observable.lowestObserverState_ > node.dependenciesState_) {\n observable.lowestObserverState_ = node.dependenciesState_;\n }\n // invariantObservers(observable);\n // invariant(observable._observers.indexOf(node) !== -1, \"INTERNAL ERROR didn't add node\");\n}\nfunction removeObserver(observable, node) {\n // invariant(globalState.inBatch > 0, \"INTERNAL ERROR, remove should be called only inside batch\");\n // invariant(observable._observers.indexOf(node) !== -1, \"INTERNAL ERROR remove already removed node\");\n // invariantObservers(observable);\n observable.observers_[\"delete\"](node);\n if (observable.observers_.size === 0) {\n // deleting last observer\n queueForUnobservation(observable);\n }\n // invariantObservers(observable);\n // invariant(observable._observers.indexOf(node) === -1, \"INTERNAL ERROR remove already removed node2\");\n}\nfunction queueForUnobservation(observable) {\n if (observable.isPendingUnobservation === false) {\n // invariant(observable._observers.length === 0, \"INTERNAL ERROR, should only queue for unobservation unobserved observables\");\n observable.isPendingUnobservation = true;\n globalState.pendingUnobservations.push(observable);\n }\n}\n/**\n * Batch starts a transaction, at least for purposes of memoizing ComputedValues when nothing else does.\n * During a batch `onBecomeUnobserved` will be called at most once per observable.\n * Avoids unnecessary recalculations.\n */\nfunction startBatch() {\n globalState.inBatch++;\n}\nfunction endBatch() {\n if (--globalState.inBatch === 0) {\n runReactions();\n // the batch is actually about to finish, all unobserving should happen here.\n var list = globalState.pendingUnobservations;\n for (var i = 0; i < list.length; i++) {\n var observable = list[i];\n observable.isPendingUnobservation = false;\n if (observable.observers_.size === 0) {\n if (observable.isBeingObserved) {\n // if this observable had reactive observers, trigger the hooks\n observable.isBeingObserved = false;\n observable.onBUO();\n }\n if (observable instanceof ComputedValue) {\n // computed values are automatically teared down when the last observer leaves\n // this process happens recursively, this computed might be the last observabe of another, etc..\n observable.suspend_();\n }\n }\n }\n globalState.pendingUnobservations = [];\n }\n}\nfunction reportObserved(observable) {\n checkIfStateReadsAreAllowed(observable);\n var derivation = globalState.trackingDerivation;\n if (derivation !== null) {\n /**\n * Simple optimization, give each derivation run an unique id (runId)\n * Check if last time this observable was accessed the same runId is used\n * if this is the case, the relation is already known\n */\n if (derivation.runId_ !== observable.lastAccessedBy_) {\n observable.lastAccessedBy_ = derivation.runId_;\n // Tried storing newObserving, or observing, or both as Set, but performance didn't come close...\n derivation.newObserving_[derivation.unboundDepsCount_++] = observable;\n if (!observable.isBeingObserved && globalState.trackingContext) {\n observable.isBeingObserved = true;\n observable.onBO();\n }\n }\n return observable.isBeingObserved;\n } else if (observable.observers_.size === 0 && globalState.inBatch > 0) {\n queueForUnobservation(observable);\n }\n return false;\n}\n// function invariantLOS(observable: IObservable, msg: string) {\n// // it's expensive so better not run it in produciton. but temporarily helpful for testing\n// const min = getObservers(observable).reduce((a, b) => Math.min(a, b.dependenciesState), 2)\n// if (min >= observable.lowestObserverState) return // <- the only assumption about `lowestObserverState`\n// throw new Error(\n// \"lowestObserverState is wrong for \" +\n// msg +\n// \" because \" +\n// min +\n// \" < \" +\n// observable.lowestObserverState\n// )\n// }\n/**\n * NOTE: current propagation mechanism will in case of self reruning autoruns behave unexpectedly\n * It will propagate changes to observers from previous run\n * It's hard or maybe impossible (with reasonable perf) to get it right with current approach\n * Hopefully self reruning autoruns aren't a feature people should depend on\n * Also most basic use cases should be ok\n */\n// Called by Atom when its value changes\nfunction propagateChanged(observable) {\n // invariantLOS(observable, \"changed start\");\n if (observable.lowestObserverState_ === IDerivationState_.STALE_) {\n return;\n }\n observable.lowestObserverState_ = IDerivationState_.STALE_;\n // Ideally we use for..of here, but the downcompiled version is really slow...\n observable.observers_.forEach(function (d) {\n if (d.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {\n if ( true && d.isTracing_ !== TraceMode.NONE) {\n logTraceInfo(d, observable);\n }\n d.onBecomeStale_();\n }\n d.dependenciesState_ = IDerivationState_.STALE_;\n });\n // invariantLOS(observable, \"changed end\");\n}\n// Called by ComputedValue when it recalculate and its value changed\nfunction propagateChangeConfirmed(observable) {\n // invariantLOS(observable, \"confirmed start\");\n if (observable.lowestObserverState_ === IDerivationState_.STALE_) {\n return;\n }\n observable.lowestObserverState_ = IDerivationState_.STALE_;\n observable.observers_.forEach(function (d) {\n if (d.dependenciesState_ === IDerivationState_.POSSIBLY_STALE_) {\n d.dependenciesState_ = IDerivationState_.STALE_;\n if ( true && d.isTracing_ !== TraceMode.NONE) {\n logTraceInfo(d, observable);\n }\n } else if (d.dependenciesState_ === IDerivationState_.UP_TO_DATE_ // this happens during computing of `d`, just keep lowestObserverState up to date.\n ) {\n observable.lowestObserverState_ = IDerivationState_.UP_TO_DATE_;\n }\n });\n // invariantLOS(observable, \"confirmed end\");\n}\n// Used by computed when its dependency changed, but we don't wan't to immediately recompute.\nfunction propagateMaybeChanged(observable) {\n // invariantLOS(observable, \"maybe start\");\n if (observable.lowestObserverState_ !== IDerivationState_.UP_TO_DATE_) {\n return;\n }\n observable.lowestObserverState_ = IDerivationState_.POSSIBLY_STALE_;\n observable.observers_.forEach(function (d) {\n if (d.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {\n d.dependenciesState_ = IDerivationState_.POSSIBLY_STALE_;\n d.onBecomeStale_();\n }\n });\n // invariantLOS(observable, \"maybe end\");\n}\nfunction logTraceInfo(derivation, observable) {\n console.log(\"[mobx.trace] '\" + derivation.name_ + \"' is invalidated due to a change in: '\" + observable.name_ + \"'\");\n if (derivation.isTracing_ === TraceMode.BREAK) {\n var lines = [];\n printDepTree(getDependencyTree(derivation), lines, 1);\n // prettier-ignore\n new Function(\"debugger;\\n/*\\nTracing '\" + derivation.name_ + \"'\\n\\nYou are entering this break point because derivation '\" + derivation.name_ + \"' is being traced and '\" + observable.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\" + (derivation instanceof ComputedValue ? derivation.derivation.toString().replace(/[*]\\//g, \"/\") : \"\") + \"\\n\\nThe dependencies for this derivation are:\\n\\n\" + lines.join(\"\\n\") + \"\\n*/\\n \")();\n }\n}\nfunction printDepTree(tree, lines, depth) {\n if (lines.length >= 1000) {\n lines.push(\"(and many more)\");\n return;\n }\n lines.push(\"\" + \"\\t\".repeat(depth - 1) + tree.name);\n if (tree.dependencies) {\n tree.dependencies.forEach(function (child) {\n return printDepTree(child, lines, depth + 1);\n });\n }\n}\n\nvar Reaction = /*#__PURE__*/function () {\n function Reaction(name_, onInvalidate_, errorHandler_, requiresObservable_) {\n if (name_ === void 0) {\n name_ = true ? \"Reaction@\" + getNextId() : 0;\n }\n this.name_ = void 0;\n this.onInvalidate_ = void 0;\n this.errorHandler_ = void 0;\n this.requiresObservable_ = void 0;\n this.observing_ = [];\n // nodes we are looking at. Our value depends on these nodes\n this.newObserving_ = [];\n this.dependenciesState_ = IDerivationState_.NOT_TRACKING_;\n this.runId_ = 0;\n this.unboundDepsCount_ = 0;\n this.flags_ = 0;\n this.isTracing_ = TraceMode.NONE;\n this.name_ = name_;\n this.onInvalidate_ = onInvalidate_;\n this.errorHandler_ = errorHandler_;\n this.requiresObservable_ = requiresObservable_;\n }\n var _proto = Reaction.prototype;\n _proto.onBecomeStale_ = function onBecomeStale_() {\n this.schedule_();\n };\n _proto.schedule_ = function schedule_() {\n if (!this.isScheduled) {\n this.isScheduled = true;\n globalState.pendingReactions.push(this);\n runReactions();\n }\n }\n /**\n * internal, use schedule() if you intend to kick off a reaction\n */;\n _proto.runReaction_ = function runReaction_() {\n if (!this.isDisposed) {\n startBatch();\n this.isScheduled = false;\n var prev = globalState.trackingContext;\n globalState.trackingContext = this;\n if (shouldCompute(this)) {\n this.isTrackPending = true;\n try {\n this.onInvalidate_();\n if ( true && this.isTrackPending && isSpyEnabled()) {\n // onInvalidate didn't trigger track right away..\n spyReport({\n name: this.name_,\n type: \"scheduled-reaction\"\n });\n }\n } catch (e) {\n this.reportExceptionInDerivation_(e);\n }\n }\n globalState.trackingContext = prev;\n endBatch();\n }\n };\n _proto.track = function track(fn) {\n if (this.isDisposed) {\n return;\n // console.warn(\"Reaction already disposed\") // Note: Not a warning / error in mobx 4 either\n }\n startBatch();\n var notify = isSpyEnabled();\n var startTime;\n if ( true && notify) {\n startTime = Date.now();\n spyReportStart({\n name: this.name_,\n type: \"reaction\"\n });\n }\n this.isRunning = true;\n var prevReaction = globalState.trackingContext; // reactions could create reactions...\n globalState.trackingContext = this;\n var result = trackDerivedFunction(this, fn, undefined);\n globalState.trackingContext = prevReaction;\n this.isRunning = false;\n this.isTrackPending = false;\n if (this.isDisposed) {\n // disposed during last run. Clean up everything that was bound after the dispose call.\n clearObserving(this);\n }\n if (isCaughtException(result)) {\n this.reportExceptionInDerivation_(result.cause);\n }\n if ( true && notify) {\n spyReportEnd({\n time: Date.now() - startTime\n });\n }\n endBatch();\n };\n _proto.reportExceptionInDerivation_ = function reportExceptionInDerivation_(error) {\n var _this = this;\n if (this.errorHandler_) {\n this.errorHandler_(error, this);\n return;\n }\n if (globalState.disableErrorBoundaries) {\n throw error;\n }\n var message = true ? \"[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '\" + this + \"'\" : 0;\n if (!globalState.suppressReactionErrors) {\n console.error(message, error);\n /** If debugging brought you here, please, read the above message :-). Tnx! */\n } else if (true) {\n console.warn(\"[mobx] (error in reaction '\" + this.name_ + \"' suppressed, fix error of causing action below)\");\n } // prettier-ignore\n if ( true && isSpyEnabled()) {\n spyReport({\n type: \"error\",\n name: this.name_,\n message: message,\n error: \"\" + error\n });\n }\n globalState.globalReactionErrorHandlers.forEach(function (f) {\n return f(error, _this);\n });\n };\n _proto.dispose = function dispose() {\n if (!this.isDisposed) {\n this.isDisposed = true;\n if (!this.isRunning) {\n // if disposed while running, clean up later. Maybe not optimal, but rare case\n startBatch();\n clearObserving(this);\n endBatch();\n }\n }\n };\n _proto.getDisposer_ = function getDisposer_(abortSignal) {\n var _this2 = this;\n var dispose = function dispose() {\n _this2.dispose();\n abortSignal == null || abortSignal.removeEventListener == null || abortSignal.removeEventListener(\"abort\", dispose);\n };\n abortSignal == null || abortSignal.addEventListener == null || abortSignal.addEventListener(\"abort\", dispose);\n dispose[$mobx] = this;\n return dispose;\n };\n _proto.toString = function toString() {\n return \"Reaction[\" + this.name_ + \"]\";\n };\n _proto.trace = function trace$1(enterBreakPoint) {\n if (enterBreakPoint === void 0) {\n enterBreakPoint = false;\n }\n trace(this, enterBreakPoint);\n };\n return _createClass(Reaction, [{\n key: \"isDisposed\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isDisposedMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isDisposedMask_, newValue);\n }\n }, {\n key: \"isScheduled\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isScheduledMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isScheduledMask_, newValue);\n }\n }, {\n key: \"isTrackPending\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isTrackPendingMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isTrackPendingMask_, newValue);\n }\n }, {\n key: \"isRunning\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isRunningMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isRunningMask_, newValue);\n }\n }, {\n key: \"diffValue\",\n get: function get() {\n return getFlag(this.flags_, Reaction.diffValueMask_) ? 1 : 0;\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.diffValueMask_, newValue === 1 ? true : false);\n }\n }]);\n}();\nReaction.isDisposedMask_ = 1;\nReaction.isScheduledMask_ = 2;\nReaction.isTrackPendingMask_ = 4;\nReaction.isRunningMask_ = 8;\nReaction.diffValueMask_ = 16;\nfunction onReactionError(handler) {\n globalState.globalReactionErrorHandlers.push(handler);\n return function () {\n var idx = globalState.globalReactionErrorHandlers.indexOf(handler);\n if (idx >= 0) {\n globalState.globalReactionErrorHandlers.splice(idx, 1);\n }\n };\n}\n/**\n * Magic number alert!\n * Defines within how many times a reaction is allowed to re-trigger itself\n * until it is assumed that this is gonna be a never ending loop...\n */\nvar MAX_REACTION_ITERATIONS = 100;\nvar reactionScheduler = function reactionScheduler(f) {\n return f();\n};\nfunction runReactions() {\n // Trampolining, if runReactions are already running, new reactions will be picked up\n if (globalState.inBatch > 0 || globalState.isRunningReactions) {\n return;\n }\n reactionScheduler(runReactionsHelper);\n}\nfunction runReactionsHelper() {\n globalState.isRunningReactions = true;\n var allReactions = globalState.pendingReactions;\n var iterations = 0;\n // While running reactions, new reactions might be triggered.\n // Hence we work with two variables and check whether\n // we converge to no remaining reactions after a while.\n while (allReactions.length > 0) {\n if (++iterations === MAX_REACTION_ITERATIONS) {\n console.error( true ? \"Reaction doesn't converge to a stable state after \" + MAX_REACTION_ITERATIONS + \" iterations.\" + (\" Probably there is a cycle in the reactive function: \" + allReactions[0]) : 0);\n allReactions.splice(0); // clear reactions\n }\n var remainingReactions = allReactions.splice(0);\n for (var i = 0, l = remainingReactions.length; i < l; i++) {\n remainingReactions[i].runReaction_();\n }\n }\n globalState.isRunningReactions = false;\n}\nvar isReaction = /*#__PURE__*/createInstanceofPredicate(\"Reaction\", Reaction);\nfunction setReactionScheduler(fn) {\n var baseScheduler = reactionScheduler;\n reactionScheduler = function reactionScheduler(f) {\n return fn(function () {\n return baseScheduler(f);\n });\n };\n}\n\nfunction isSpyEnabled() {\n return true && !!globalState.spyListeners.length;\n}\nfunction spyReport(event) {\n if (false) {} // dead code elimination can do the rest\n if (!globalState.spyListeners.length) {\n return;\n }\n var listeners = globalState.spyListeners;\n for (var i = 0, l = listeners.length; i < l; i++) {\n listeners[i](event);\n }\n}\nfunction spyReportStart(event) {\n if (false) {}\n var change = _extends({}, event, {\n spyReportStart: true\n });\n spyReport(change);\n}\nvar END_EVENT = {\n type: \"report-end\",\n spyReportEnd: true\n};\nfunction spyReportEnd(change) {\n if (false) {}\n if (change) {\n spyReport(_extends({}, change, {\n type: \"report-end\",\n spyReportEnd: true\n }));\n } else {\n spyReport(END_EVENT);\n }\n}\nfunction spy(listener) {\n if (false) {} else {\n globalState.spyListeners.push(listener);\n return once(function () {\n globalState.spyListeners = globalState.spyListeners.filter(function (l) {\n return l !== listener;\n });\n });\n }\n}\n\nvar ACTION = \"action\";\nvar ACTION_BOUND = \"action.bound\";\nvar AUTOACTION = \"autoAction\";\nvar AUTOACTION_BOUND = \"autoAction.bound\";\nvar DEFAULT_ACTION_NAME = \"\";\nvar actionAnnotation = /*#__PURE__*/createActionAnnotation(ACTION);\nvar actionBoundAnnotation = /*#__PURE__*/createActionAnnotation(ACTION_BOUND, {\n bound: true\n});\nvar autoActionAnnotation = /*#__PURE__*/createActionAnnotation(AUTOACTION, {\n autoAction: true\n});\nvar autoActionBoundAnnotation = /*#__PURE__*/createActionAnnotation(AUTOACTION_BOUND, {\n autoAction: true,\n bound: true\n});\nfunction createActionFactory(autoAction) {\n var res = function action(arg1, arg2) {\n // action(fn() {})\n if (isFunction(arg1)) {\n return createAction(arg1.name || DEFAULT_ACTION_NAME, arg1, autoAction);\n }\n // action(\"name\", fn() {})\n if (isFunction(arg2)) {\n return createAction(arg1, arg2, autoAction);\n }\n // @action (2022.3 Decorators)\n if (is20223Decorator(arg2)) {\n return (autoAction ? autoActionAnnotation : actionAnnotation).decorate_20223_(arg1, arg2);\n }\n // @action\n if (isStringish(arg2)) {\n return storeAnnotation(arg1, arg2, autoAction ? autoActionAnnotation : actionAnnotation);\n }\n // action(\"name\") & @action(\"name\")\n if (isStringish(arg1)) {\n return createDecoratorAnnotation(createActionAnnotation(autoAction ? AUTOACTION : ACTION, {\n name: arg1,\n autoAction: autoAction\n }));\n }\n if (true) {\n die(\"Invalid arguments for `action`\");\n }\n };\n return res;\n}\nvar action = /*#__PURE__*/createActionFactory(false);\nObject.assign(action, actionAnnotation);\nvar autoAction = /*#__PURE__*/createActionFactory(true);\nObject.assign(autoAction, autoActionAnnotation);\naction.bound = /*#__PURE__*/createDecoratorAnnotation(actionBoundAnnotation);\nautoAction.bound = /*#__PURE__*/createDecoratorAnnotation(autoActionBoundAnnotation);\nfunction runInAction(fn) {\n return executeAction(fn.name || DEFAULT_ACTION_NAME, false, fn, this, undefined);\n}\nfunction isAction(thing) {\n return isFunction(thing) && thing.isMobxAction === true;\n}\n\n/**\n * Creates a named reactive view and keeps it alive, so that the view is always\n * updated if one of the dependencies changes, even when the view is not further used by something else.\n * @param view The reactive view\n * @returns disposer function, which can be used to stop the view from being updated in the future.\n */\nfunction autorun(view, opts) {\n var _opts$name, _opts, _opts2, _opts3;\n if (opts === void 0) {\n opts = EMPTY_OBJECT;\n }\n if (true) {\n if (!isFunction(view)) {\n die(\"Autorun expects a function as first argument\");\n }\n if (isAction(view)) {\n die(\"Autorun does not accept actions since actions are untrackable\");\n }\n }\n var name = (_opts$name = (_opts = opts) == null ? void 0 : _opts.name) != null ? _opts$name : true ? view.name || \"Autorun@\" + getNextId() : 0;\n var runSync = !opts.scheduler && !opts.delay;\n var reaction;\n if (runSync) {\n // normal autorun\n reaction = new Reaction(name, function () {\n this.track(reactionRunner);\n }, opts.onError, opts.requiresObservable);\n } else {\n var scheduler = createSchedulerFromOptions(opts);\n // debounced autorun\n var isScheduled = false;\n reaction = new Reaction(name, function () {\n if (!isScheduled) {\n isScheduled = true;\n scheduler(function () {\n isScheduled = false;\n if (!reaction.isDisposed) {\n reaction.track(reactionRunner);\n }\n });\n }\n }, opts.onError, opts.requiresObservable);\n }\n function reactionRunner() {\n view(reaction);\n }\n if (!((_opts2 = opts) != null && (_opts2 = _opts2.signal) != null && _opts2.aborted)) {\n reaction.schedule_();\n }\n return reaction.getDisposer_((_opts3 = opts) == null ? void 0 : _opts3.signal);\n}\nvar run = function run(f) {\n return f();\n};\nfunction createSchedulerFromOptions(opts) {\n return opts.scheduler ? opts.scheduler : opts.delay ? function (f) {\n return setTimeout(f, opts.delay);\n } : run;\n}\nfunction reaction(expression, effect, opts) {\n var _opts$name2, _opts4, _opts5;\n if (opts === void 0) {\n opts = EMPTY_OBJECT;\n }\n if (true) {\n if (!isFunction(expression) || !isFunction(effect)) {\n die(\"First and second argument to reaction should be functions\");\n }\n if (!isPlainObject(opts)) {\n die(\"Third argument of reactions should be an object\");\n }\n }\n var name = (_opts$name2 = opts.name) != null ? _opts$name2 : true ? \"Reaction@\" + getNextId() : 0;\n var effectAction = action(name, opts.onError ? wrapErrorHandler(opts.onError, effect) : effect);\n var runSync = !opts.scheduler && !opts.delay;\n var scheduler = createSchedulerFromOptions(opts);\n var firstTime = true;\n var isScheduled = false;\n var value;\n var equals = opts.compareStructural ? comparer.structural : opts.equals || comparer[\"default\"];\n var r = new Reaction(name, function () {\n if (firstTime || runSync) {\n reactionRunner();\n } else if (!isScheduled) {\n isScheduled = true;\n scheduler(reactionRunner);\n }\n }, opts.onError, opts.requiresObservable);\n function reactionRunner() {\n isScheduled = false;\n if (r.isDisposed) {\n return;\n }\n var changed = false;\n var oldValue = value;\n r.track(function () {\n var nextValue = allowStateChanges(false, function () {\n return expression(r);\n });\n changed = firstTime || !equals(value, nextValue);\n value = nextValue;\n });\n if (firstTime && opts.fireImmediately) {\n effectAction(value, oldValue, r);\n } else if (!firstTime && changed) {\n effectAction(value, oldValue, r);\n }\n firstTime = false;\n }\n if (!((_opts4 = opts) != null && (_opts4 = _opts4.signal) != null && _opts4.aborted)) {\n r.schedule_();\n }\n return r.getDisposer_((_opts5 = opts) == null ? void 0 : _opts5.signal);\n}\nfunction wrapErrorHandler(errorHandler, baseFn) {\n return function () {\n try {\n return baseFn.apply(this, arguments);\n } catch (e) {\n errorHandler.call(this, e);\n }\n };\n}\n\nvar ON_BECOME_OBSERVED = \"onBO\";\nvar ON_BECOME_UNOBSERVED = \"onBUO\";\nfunction onBecomeObserved(thing, arg2, arg3) {\n return interceptHook(ON_BECOME_OBSERVED, thing, arg2, arg3);\n}\nfunction onBecomeUnobserved(thing, arg2, arg3) {\n return interceptHook(ON_BECOME_UNOBSERVED, thing, arg2, arg3);\n}\nfunction interceptHook(hook, thing, arg2, arg3) {\n var atom = typeof arg3 === \"function\" ? getAtom(thing, arg2) : getAtom(thing);\n var cb = isFunction(arg3) ? arg3 : arg2;\n var listenersKey = hook + \"L\";\n if (atom[listenersKey]) {\n atom[listenersKey].add(cb);\n } else {\n atom[listenersKey] = new Set([cb]);\n }\n return function () {\n var hookListeners = atom[listenersKey];\n if (hookListeners) {\n hookListeners[\"delete\"](cb);\n if (hookListeners.size === 0) {\n delete atom[listenersKey];\n }\n }\n };\n}\n\nvar NEVER = \"never\";\nvar ALWAYS = \"always\";\nvar OBSERVED = \"observed\";\n// const IF_AVAILABLE = \"ifavailable\"\nfunction configure(options) {\n if (options.isolateGlobalState === true) {\n isolateGlobalState();\n }\n var useProxies = options.useProxies,\n enforceActions = options.enforceActions;\n if (useProxies !== undefined) {\n globalState.useProxies = useProxies === ALWAYS ? true : useProxies === NEVER ? false : typeof Proxy !== \"undefined\";\n }\n if (useProxies === \"ifavailable\") {\n globalState.verifyProxies = true;\n }\n if (enforceActions !== undefined) {\n var ea = enforceActions === ALWAYS ? ALWAYS : enforceActions === OBSERVED;\n globalState.enforceActions = ea;\n globalState.allowStateChanges = ea === true || ea === ALWAYS ? false : true;\n }\n [\"computedRequiresReaction\", \"reactionRequiresObservable\", \"observableRequiresReaction\", \"disableErrorBoundaries\", \"safeDescriptors\"].forEach(function (key) {\n if (key in options) {\n globalState[key] = !!options[key];\n }\n });\n globalState.allowStateReads = !globalState.observableRequiresReaction;\n if ( true && globalState.disableErrorBoundaries === true) {\n console.warn(\"WARNING: Debug feature only. MobX will NOT recover from errors when `disableErrorBoundaries` is enabled.\");\n }\n if (options.reactionScheduler) {\n setReactionScheduler(options.reactionScheduler);\n }\n}\n\nfunction extendObservable(target, properties, annotations, options) {\n if (true) {\n if (arguments.length > 4) {\n die(\"'extendObservable' expected 2-4 arguments\");\n }\n if (typeof target !== \"object\") {\n die(\"'extendObservable' expects an object as first argument\");\n }\n if (isObservableMap(target)) {\n die(\"'extendObservable' should not be used on maps, use map.merge instead\");\n }\n if (!isPlainObject(properties)) {\n die(\"'extendObservable' only accepts plain objects as second argument\");\n }\n if (isObservable(properties) || isObservable(annotations)) {\n die(\"Extending an object with another observable (object) is not supported\");\n }\n }\n // Pull descriptors first, so we don't have to deal with props added by administration ($mobx)\n var descriptors = getOwnPropertyDescriptors(properties);\n initObservable(function () {\n var adm = asObservableObject(target, options)[$mobx];\n ownKeys(descriptors).forEach(function (key) {\n adm.extend_(key, descriptors[key],\n // must pass \"undefined\" for { key: undefined }\n !annotations ? true : key in annotations ? annotations[key] : true);\n });\n });\n return target;\n}\n\nfunction getDependencyTree(thing, property) {\n return nodeToDependencyTree(getAtom(thing, property));\n}\nfunction nodeToDependencyTree(node) {\n var result = {\n name: node.name_\n };\n if (node.observing_ && node.observing_.length > 0) {\n result.dependencies = unique(node.observing_).map(nodeToDependencyTree);\n }\n return result;\n}\nfunction getObserverTree(thing, property) {\n return nodeToObserverTree(getAtom(thing, property));\n}\nfunction nodeToObserverTree(node) {\n var result = {\n name: node.name_\n };\n if (hasObservers(node)) {\n result.observers = Array.from(getObservers(node)).map(nodeToObserverTree);\n }\n return result;\n}\nfunction unique(list) {\n return Array.from(new Set(list));\n}\n\nvar generatorId = 0;\nfunction FlowCancellationError() {\n this.message = \"FLOW_CANCELLED\";\n}\nFlowCancellationError.prototype = /*#__PURE__*/Object.create(Error.prototype);\nfunction isFlowCancellationError(error) {\n return error instanceof FlowCancellationError;\n}\nvar flowAnnotation = /*#__PURE__*/createFlowAnnotation(\"flow\");\nvar flowBoundAnnotation = /*#__PURE__*/createFlowAnnotation(\"flow.bound\", {\n bound: true\n});\nvar flow = /*#__PURE__*/Object.assign(function flow(arg1, arg2) {\n // @flow (2022.3 Decorators)\n if (is20223Decorator(arg2)) {\n return flowAnnotation.decorate_20223_(arg1, arg2);\n }\n // @flow\n if (isStringish(arg2)) {\n return storeAnnotation(arg1, arg2, flowAnnotation);\n }\n // flow(fn)\n if ( true && arguments.length !== 1) {\n die(\"Flow expects single argument with generator function\");\n }\n var generator = arg1;\n var name = generator.name || \"\";\n // Implementation based on https://github.com/tj/co/blob/master/index.js\n var res = function res() {\n var ctx = this;\n var args = arguments;\n var runId = ++generatorId;\n var gen = action(name + \" - runid: \" + runId + \" - init\", generator).apply(ctx, args);\n var rejector;\n var pendingPromise = undefined;\n var promise = new Promise(function (resolve, reject) {\n var stepId = 0;\n rejector = reject;\n function onFulfilled(res) {\n pendingPromise = undefined;\n var ret;\n try {\n ret = action(name + \" - runid: \" + runId + \" - yield \" + stepId++, gen.next).call(gen, res);\n } catch (e) {\n return reject(e);\n }\n next(ret);\n }\n function onRejected(err) {\n pendingPromise = undefined;\n var ret;\n try {\n ret = action(name + \" - runid: \" + runId + \" - yield \" + stepId++, gen[\"throw\"]).call(gen, err);\n } catch (e) {\n return reject(e);\n }\n next(ret);\n }\n function next(ret) {\n if (isFunction(ret == null ? void 0 : ret.then)) {\n // an async iterator\n ret.then(next, reject);\n return;\n }\n if (ret.done) {\n return resolve(ret.value);\n }\n pendingPromise = Promise.resolve(ret.value);\n return pendingPromise.then(onFulfilled, onRejected);\n }\n onFulfilled(undefined); // kick off the process\n });\n promise.cancel = action(name + \" - runid: \" + runId + \" - cancel\", function () {\n try {\n if (pendingPromise) {\n cancelPromise(pendingPromise);\n }\n // Finally block can return (or yield) stuff..\n var _res = gen[\"return\"](undefined);\n // eat anything that promise would do, it's cancelled!\n var yieldedPromise = Promise.resolve(_res.value);\n yieldedPromise.then(noop, noop);\n cancelPromise(yieldedPromise); // maybe it can be cancelled :)\n // reject our original promise\n rejector(new FlowCancellationError());\n } catch (e) {\n rejector(e); // there could be a throwing finally block\n }\n });\n return promise;\n };\n res.isMobXFlow = true;\n return res;\n}, flowAnnotation);\nflow.bound = /*#__PURE__*/createDecoratorAnnotation(flowBoundAnnotation);\nfunction cancelPromise(promise) {\n if (isFunction(promise.cancel)) {\n promise.cancel();\n }\n}\nfunction flowResult(result) {\n return result; // just tricking TypeScript :)\n}\nfunction isFlow(fn) {\n return (fn == null ? void 0 : fn.isMobXFlow) === true;\n}\n\nfunction interceptReads(thing, propOrHandler, handler) {\n var target;\n if (isObservableMap(thing) || isObservableArray(thing) || isObservableValue(thing)) {\n target = getAdministration(thing);\n } else if (isObservableObject(thing)) {\n if ( true && !isStringish(propOrHandler)) {\n return die(\"InterceptReads can only be used with a specific property, not with an object in general\");\n }\n target = getAdministration(thing, propOrHandler);\n } else if (true) {\n return die(\"Expected observable map, object or array as first array\");\n }\n if ( true && target.dehancer !== undefined) {\n return die(\"An intercept reader was already established\");\n }\n target.dehancer = typeof propOrHandler === \"function\" ? propOrHandler : handler;\n return function () {\n target.dehancer = undefined;\n };\n}\n\nfunction intercept(thing, propOrHandler, handler) {\n if (isFunction(handler)) {\n return interceptProperty(thing, propOrHandler, handler);\n } else {\n return interceptInterceptable(thing, propOrHandler);\n }\n}\nfunction interceptInterceptable(thing, handler) {\n return getAdministration(thing).intercept_(handler);\n}\nfunction interceptProperty(thing, property, handler) {\n return getAdministration(thing, property).intercept_(handler);\n}\n\nfunction _isComputed(value, property) {\n if (property === undefined) {\n return isComputedValue(value);\n }\n if (isObservableObject(value) === false) {\n return false;\n }\n if (!value[$mobx].values_.has(property)) {\n return false;\n }\n var atom = getAtom(value, property);\n return isComputedValue(atom);\n}\nfunction isComputed(value) {\n if ( true && arguments.length > 1) {\n return die(\"isComputed expects only 1 argument. Use isComputedProp to inspect the observability of a property\");\n }\n return _isComputed(value);\n}\nfunction isComputedProp(value, propName) {\n if ( true && !isStringish(propName)) {\n return die(\"isComputed expected a property name as second argument\");\n }\n return _isComputed(value, propName);\n}\n\nfunction _isObservable(value, property) {\n if (!value) {\n return false;\n }\n if (property !== undefined) {\n if ( true && (isObservableMap(value) || isObservableArray(value))) {\n return die(\"isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead.\");\n }\n if (isObservableObject(value)) {\n return value[$mobx].values_.has(property);\n }\n return false;\n }\n // For first check, see #701\n return isObservableObject(value) || !!value[$mobx] || isAtom(value) || isReaction(value) || isComputedValue(value);\n}\nfunction isObservable(value) {\n if ( true && arguments.length !== 1) {\n die(\"isObservable expects only 1 argument. Use isObservableProp to inspect the observability of a property\");\n }\n return _isObservable(value);\n}\nfunction isObservableProp(value, propName) {\n if ( true && !isStringish(propName)) {\n return die(\"expected a property name as second argument\");\n }\n return _isObservable(value, propName);\n}\n\nfunction keys(obj) {\n if (isObservableObject(obj)) {\n return obj[$mobx].keys_();\n }\n if (isObservableMap(obj) || isObservableSet(obj)) {\n return Array.from(obj.keys());\n }\n if (isObservableArray(obj)) {\n return obj.map(function (_, index) {\n return index;\n });\n }\n die(5);\n}\nfunction values(obj) {\n if (isObservableObject(obj)) {\n return keys(obj).map(function (key) {\n return obj[key];\n });\n }\n if (isObservableMap(obj)) {\n return keys(obj).map(function (key) {\n return obj.get(key);\n });\n }\n if (isObservableSet(obj)) {\n return Array.from(obj.values());\n }\n if (isObservableArray(obj)) {\n return obj.slice();\n }\n die(6);\n}\nfunction entries(obj) {\n if (isObservableObject(obj)) {\n return keys(obj).map(function (key) {\n return [key, obj[key]];\n });\n }\n if (isObservableMap(obj)) {\n return keys(obj).map(function (key) {\n return [key, obj.get(key)];\n });\n }\n if (isObservableSet(obj)) {\n return Array.from(obj.entries());\n }\n if (isObservableArray(obj)) {\n return obj.map(function (key, index) {\n return [index, key];\n });\n }\n die(7);\n}\nfunction set(obj, key, value) {\n if (arguments.length === 2 && !isObservableSet(obj)) {\n startBatch();\n var _values = key;\n try {\n for (var _key in _values) {\n set(obj, _key, _values[_key]);\n }\n } finally {\n endBatch();\n }\n return;\n }\n if (isObservableObject(obj)) {\n obj[$mobx].set_(key, value);\n } else if (isObservableMap(obj)) {\n obj.set(key, value);\n } else if (isObservableSet(obj)) {\n obj.add(key);\n } else if (isObservableArray(obj)) {\n if (typeof key !== \"number\") {\n key = parseInt(key, 10);\n }\n if (key < 0) {\n die(\"Invalid index: '\" + key + \"'\");\n }\n startBatch();\n if (key >= obj.length) {\n obj.length = key + 1;\n }\n obj[key] = value;\n endBatch();\n } else {\n die(8);\n }\n}\nfunction remove(obj, key) {\n if (isObservableObject(obj)) {\n obj[$mobx].delete_(key);\n } else if (isObservableMap(obj)) {\n obj[\"delete\"](key);\n } else if (isObservableSet(obj)) {\n obj[\"delete\"](key);\n } else if (isObservableArray(obj)) {\n if (typeof key !== \"number\") {\n key = parseInt(key, 10);\n }\n obj.splice(key, 1);\n } else {\n die(9);\n }\n}\nfunction has(obj, key) {\n if (isObservableObject(obj)) {\n return obj[$mobx].has_(key);\n } else if (isObservableMap(obj)) {\n return obj.has(key);\n } else if (isObservableSet(obj)) {\n return obj.has(key);\n } else if (isObservableArray(obj)) {\n return key >= 0 && key < obj.length;\n }\n die(10);\n}\nfunction get(obj, key) {\n if (!has(obj, key)) {\n return undefined;\n }\n if (isObservableObject(obj)) {\n return obj[$mobx].get_(key);\n } else if (isObservableMap(obj)) {\n return obj.get(key);\n } else if (isObservableArray(obj)) {\n return obj[key];\n }\n die(11);\n}\nfunction apiDefineProperty(obj, key, descriptor) {\n if (isObservableObject(obj)) {\n return obj[$mobx].defineProperty_(key, descriptor);\n }\n die(39);\n}\nfunction apiOwnKeys(obj) {\n if (isObservableObject(obj)) {\n return obj[$mobx].ownKeys_();\n }\n die(38);\n}\n\nfunction observe(thing, propOrCb, cbOrFire, fireImmediately) {\n if (isFunction(cbOrFire)) {\n return observeObservableProperty(thing, propOrCb, cbOrFire, fireImmediately);\n } else {\n return observeObservable(thing, propOrCb, cbOrFire);\n }\n}\nfunction observeObservable(thing, listener, fireImmediately) {\n return getAdministration(thing).observe_(listener, fireImmediately);\n}\nfunction observeObservableProperty(thing, property, listener, fireImmediately) {\n return getAdministration(thing, property).observe_(listener, fireImmediately);\n}\n\nfunction cache(map, key, value) {\n map.set(key, value);\n return value;\n}\nfunction toJSHelper(source, __alreadySeen) {\n if (source == null || typeof source !== \"object\" || source instanceof Date || !isObservable(source)) {\n return source;\n }\n if (isObservableValue(source) || isComputedValue(source)) {\n return toJSHelper(source.get(), __alreadySeen);\n }\n if (__alreadySeen.has(source)) {\n return __alreadySeen.get(source);\n }\n if (isObservableArray(source)) {\n var res = cache(__alreadySeen, source, new Array(source.length));\n source.forEach(function (value, idx) {\n res[idx] = toJSHelper(value, __alreadySeen);\n });\n return res;\n }\n if (isObservableSet(source)) {\n var _res = cache(__alreadySeen, source, new Set());\n source.forEach(function (value) {\n _res.add(toJSHelper(value, __alreadySeen));\n });\n return _res;\n }\n if (isObservableMap(source)) {\n var _res2 = cache(__alreadySeen, source, new Map());\n source.forEach(function (value, key) {\n _res2.set(key, toJSHelper(value, __alreadySeen));\n });\n return _res2;\n } else {\n // must be observable object\n var _res3 = cache(__alreadySeen, source, {});\n apiOwnKeys(source).forEach(function (key) {\n if (objectPrototype.propertyIsEnumerable.call(source, key)) {\n _res3[key] = toJSHelper(source[key], __alreadySeen);\n }\n });\n return _res3;\n }\n}\n/**\n * Recursively converts an observable to it's non-observable native counterpart.\n * It does NOT recurse into non-observables, these are left as they are, even if they contain observables.\n * Computed and other non-enumerable properties are completely ignored.\n * Complex scenarios require custom solution, eg implementing `toJSON` or using `serializr` lib.\n */\nfunction toJS(source, options) {\n if ( true && options) {\n die(\"toJS no longer supports options\");\n }\n return toJSHelper(source, new Map());\n}\n\nfunction trace() {\n if (false) {}\n var enterBreakPoint = false;\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n if (typeof args[args.length - 1] === \"boolean\") {\n enterBreakPoint = args.pop();\n }\n var derivation = getAtomFromArgs(args);\n if (!derivation) {\n return die(\"'trace(break?)' can only be used inside a tracked computed value or a Reaction. Consider passing in the computed value or reaction explicitly\");\n }\n if (derivation.isTracing_ === TraceMode.NONE) {\n console.log(\"[mobx.trace] '\" + derivation.name_ + \"' tracing enabled\");\n }\n derivation.isTracing_ = enterBreakPoint ? TraceMode.BREAK : TraceMode.LOG;\n}\nfunction getAtomFromArgs(args) {\n switch (args.length) {\n case 0:\n return globalState.trackingDerivation;\n case 1:\n return getAtom(args[0]);\n case 2:\n return getAtom(args[0], args[1]);\n }\n}\n\n/**\n * During a transaction no views are updated until the end of the transaction.\n * The transaction will be run synchronously nonetheless.\n *\n * @param action a function that updates some reactive state\n * @returns any value that was returned by the 'action' parameter.\n */\nfunction transaction(action, thisArg) {\n if (thisArg === void 0) {\n thisArg = undefined;\n }\n startBatch();\n try {\n return action.apply(thisArg);\n } finally {\n endBatch();\n }\n}\n\nfunction when(predicate, arg1, arg2) {\n if (arguments.length === 1 || arg1 && typeof arg1 === \"object\") {\n return whenPromise(predicate, arg1);\n }\n return _when(predicate, arg1, arg2 || {});\n}\nfunction _when(predicate, effect, opts) {\n var timeoutHandle;\n if (typeof opts.timeout === \"number\") {\n var error = new Error(\"WHEN_TIMEOUT\");\n timeoutHandle = setTimeout(function () {\n if (!disposer[$mobx].isDisposed) {\n disposer();\n if (opts.onError) {\n opts.onError(error);\n } else {\n throw error;\n }\n }\n }, opts.timeout);\n }\n opts.name = true ? opts.name || \"When@\" + getNextId() : 0;\n var effectAction = createAction( true ? opts.name + \"-effect\" : 0, effect);\n // eslint-disable-next-line\n var disposer = autorun(function (r) {\n // predicate should not change state\n var cond = allowStateChanges(false, predicate);\n if (cond) {\n r.dispose();\n if (timeoutHandle) {\n clearTimeout(timeoutHandle);\n }\n effectAction();\n }\n }, opts);\n return disposer;\n}\nfunction whenPromise(predicate, opts) {\n var _opts$signal;\n if ( true && opts && opts.onError) {\n return die(\"the options 'onError' and 'promise' cannot be combined\");\n }\n if (opts != null && (_opts$signal = opts.signal) != null && _opts$signal.aborted) {\n return Object.assign(Promise.reject(new Error(\"WHEN_ABORTED\")), {\n cancel: function cancel() {\n return null;\n }\n });\n }\n var cancel;\n var abort;\n var res = new Promise(function (resolve, reject) {\n var _opts$signal2;\n var disposer = _when(predicate, resolve, _extends({}, opts, {\n onError: reject\n }));\n cancel = function cancel() {\n disposer();\n reject(new Error(\"WHEN_CANCELLED\"));\n };\n abort = function abort() {\n disposer();\n reject(new Error(\"WHEN_ABORTED\"));\n };\n opts == null || (_opts$signal2 = opts.signal) == null || _opts$signal2.addEventListener == null || _opts$signal2.addEventListener(\"abort\", abort);\n })[\"finally\"](function () {\n var _opts$signal3;\n return opts == null || (_opts$signal3 = opts.signal) == null || _opts$signal3.removeEventListener == null ? void 0 : _opts$signal3.removeEventListener(\"abort\", abort);\n });\n res.cancel = cancel;\n return res;\n}\n\nfunction getAdm(target) {\n return target[$mobx];\n}\n// Optimization: we don't need the intermediate objects and could have a completely custom administration for DynamicObjects,\n// and skip either the internal values map, or the base object with its property descriptors!\nvar objectProxyTraps = {\n has: function has(target, name) {\n if ( true && globalState.trackingDerivation) {\n warnAboutProxyRequirement(\"detect new properties using the 'in' operator. Use 'has' from 'mobx' instead.\");\n }\n return getAdm(target).has_(name);\n },\n get: function get(target, name) {\n return getAdm(target).get_(name);\n },\n set: function set(target, name, value) {\n var _getAdm$set_;\n if (!isStringish(name)) {\n return false;\n }\n if ( true && !getAdm(target).values_.has(name)) {\n warnAboutProxyRequirement(\"add a new observable property through direct assignment. Use 'set' from 'mobx' instead.\");\n }\n // null (intercepted) -> true (success)\n return (_getAdm$set_ = getAdm(target).set_(name, value, true)) != null ? _getAdm$set_ : true;\n },\n deleteProperty: function deleteProperty(target, name) {\n var _getAdm$delete_;\n if (true) {\n warnAboutProxyRequirement(\"delete properties from an observable object. Use 'remove' from 'mobx' instead.\");\n }\n if (!isStringish(name)) {\n return false;\n }\n // null (intercepted) -> true (success)\n return (_getAdm$delete_ = getAdm(target).delete_(name, true)) != null ? _getAdm$delete_ : true;\n },\n defineProperty: function defineProperty(target, name, descriptor) {\n var _getAdm$definePropert;\n if (true) {\n warnAboutProxyRequirement(\"define property on an observable object. Use 'defineProperty' from 'mobx' instead.\");\n }\n // null (intercepted) -> true (success)\n return (_getAdm$definePropert = getAdm(target).defineProperty_(name, descriptor)) != null ? _getAdm$definePropert : true;\n },\n ownKeys: function ownKeys(target) {\n if ( true && globalState.trackingDerivation) {\n warnAboutProxyRequirement(\"iterate keys to detect added / removed properties. Use 'keys' from 'mobx' instead.\");\n }\n return getAdm(target).ownKeys_();\n },\n preventExtensions: function preventExtensions(target) {\n die(13);\n }\n};\nfunction asDynamicObservableObject(target, options) {\n var _target$$mobx, _target$$mobx$proxy_;\n assertProxies();\n target = asObservableObject(target, options);\n return (_target$$mobx$proxy_ = (_target$$mobx = target[$mobx]).proxy_) != null ? _target$$mobx$proxy_ : _target$$mobx.proxy_ = new Proxy(target, objectProxyTraps);\n}\n\nfunction hasInterceptors(interceptable) {\n return interceptable.interceptors_ !== undefined && interceptable.interceptors_.length > 0;\n}\nfunction registerInterceptor(interceptable, handler) {\n var interceptors = interceptable.interceptors_ || (interceptable.interceptors_ = []);\n interceptors.push(handler);\n return once(function () {\n var idx = interceptors.indexOf(handler);\n if (idx !== -1) {\n interceptors.splice(idx, 1);\n }\n });\n}\nfunction interceptChange(interceptable, change) {\n var prevU = untrackedStart();\n try {\n // Interceptor can modify the array, copy it to avoid concurrent modification, see #1950\n var interceptors = [].concat(interceptable.interceptors_ || []);\n for (var i = 0, l = interceptors.length; i < l; i++) {\n change = interceptors[i](change);\n if (change && !change.type) {\n die(14);\n }\n if (!change) {\n break;\n }\n }\n return change;\n } finally {\n untrackedEnd(prevU);\n }\n}\n\nfunction hasListeners(listenable) {\n return listenable.changeListeners_ !== undefined && listenable.changeListeners_.length > 0;\n}\nfunction registerListener(listenable, handler) {\n var listeners = listenable.changeListeners_ || (listenable.changeListeners_ = []);\n listeners.push(handler);\n return once(function () {\n var idx = listeners.indexOf(handler);\n if (idx !== -1) {\n listeners.splice(idx, 1);\n }\n });\n}\nfunction notifyListeners(listenable, change) {\n var prevU = untrackedStart();\n var listeners = listenable.changeListeners_;\n if (!listeners) {\n return;\n }\n listeners = listeners.slice();\n for (var i = 0, l = listeners.length; i < l; i++) {\n listeners[i](change);\n }\n untrackedEnd(prevU);\n}\n\nfunction makeObservable(target, annotations, options) {\n initObservable(function () {\n var _annotations;\n var adm = asObservableObject(target, options)[$mobx];\n if ( true && annotations && target[storedAnnotationsSymbol]) {\n die(\"makeObservable second arg must be nullish when using decorators. Mixing @decorator syntax with annotations is not supported.\");\n }\n // Default to decorators\n (_annotations = annotations) != null ? _annotations : annotations = collectStoredAnnotations(target);\n // Annotate\n ownKeys(annotations).forEach(function (key) {\n return adm.make_(key, annotations[key]);\n });\n });\n return target;\n}\n// proto[keysSymbol] = new Set()\nvar keysSymbol = /*#__PURE__*/Symbol(\"mobx-keys\");\nfunction makeAutoObservable(target, overrides, options) {\n if (true) {\n if (!isPlainObject(target) && !isPlainObject(Object.getPrototypeOf(target))) {\n die(\"'makeAutoObservable' can only be used for classes that don't have a superclass\");\n }\n if (isObservableObject(target)) {\n die(\"makeAutoObservable can only be used on objects not already made observable\");\n }\n }\n // Optimization: avoid visiting protos\n // Assumes that annotation.make_/.extend_ works the same for plain objects\n if (isPlainObject(target)) {\n return extendObservable(target, target, overrides, options);\n }\n initObservable(function () {\n var adm = asObservableObject(target, options)[$mobx];\n // Optimization: cache keys on proto\n // Assumes makeAutoObservable can be called only once per object and can't be used in subclass\n if (!target[keysSymbol]) {\n var proto = Object.getPrototypeOf(target);\n var keys = new Set([].concat(ownKeys(target), ownKeys(proto)));\n keys[\"delete\"](\"constructor\");\n keys[\"delete\"]($mobx);\n addHiddenProp(proto, keysSymbol, keys);\n }\n target[keysSymbol].forEach(function (key) {\n return adm.make_(key,\n // must pass \"undefined\" for { key: undefined }\n !overrides ? true : key in overrides ? overrides[key] : true);\n });\n });\n return target;\n}\n\nvar SPLICE = \"splice\";\nvar UPDATE = \"update\";\nvar MAX_SPLICE_SIZE = 10000; // See e.g. https://github.com/mobxjs/mobx/issues/859\nvar arrayTraps = {\n get: function get(target, name) {\n var adm = target[$mobx];\n if (name === $mobx) {\n return adm;\n }\n if (name === \"length\") {\n return adm.getArrayLength_();\n }\n if (typeof name === \"string\" && !isNaN(name)) {\n return adm.get_(parseInt(name));\n }\n if (hasProp(arrayExtensions, name)) {\n return arrayExtensions[name];\n }\n return target[name];\n },\n set: function set(target, name, value) {\n var adm = target[$mobx];\n if (name === \"length\") {\n adm.setArrayLength_(value);\n }\n if (typeof name === \"symbol\" || isNaN(name)) {\n target[name] = value;\n } else {\n // numeric string\n adm.set_(parseInt(name), value);\n }\n return true;\n },\n preventExtensions: function preventExtensions() {\n die(15);\n }\n};\nvar ObservableArrayAdministration = /*#__PURE__*/function () {\n function ObservableArrayAdministration(name, enhancer, owned_, legacyMode_) {\n if (name === void 0) {\n name = true ? \"ObservableArray@\" + getNextId() : 0;\n }\n this.owned_ = void 0;\n this.legacyMode_ = void 0;\n this.atom_ = void 0;\n this.values_ = [];\n // this is the prop that gets proxied, so can't replace it!\n this.interceptors_ = void 0;\n this.changeListeners_ = void 0;\n this.enhancer_ = void 0;\n this.dehancer = void 0;\n this.proxy_ = void 0;\n this.lastKnownLength_ = 0;\n this.owned_ = owned_;\n this.legacyMode_ = legacyMode_;\n this.atom_ = new Atom(name);\n this.enhancer_ = function (newV, oldV) {\n return enhancer(newV, oldV, true ? name + \"[..]\" : 0);\n };\n }\n var _proto = ObservableArrayAdministration.prototype;\n _proto.dehanceValue_ = function dehanceValue_(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.dehanceValues_ = function dehanceValues_(values) {\n if (this.dehancer !== undefined && values.length > 0) {\n return values.map(this.dehancer);\n }\n return values;\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n if (fireImmediately === void 0) {\n fireImmediately = false;\n }\n if (fireImmediately) {\n listener({\n observableKind: \"array\",\n object: this.proxy_,\n debugObjectName: this.atom_.name_,\n type: \"splice\",\n index: 0,\n added: this.values_.slice(),\n addedCount: this.values_.length,\n removed: [],\n removedCount: 0\n });\n }\n return registerListener(this, listener);\n };\n _proto.getArrayLength_ = function getArrayLength_() {\n this.atom_.reportObserved();\n return this.values_.length;\n };\n _proto.setArrayLength_ = function setArrayLength_(newLength) {\n if (typeof newLength !== \"number\" || isNaN(newLength) || newLength < 0) {\n die(\"Out of range: \" + newLength);\n }\n var currentLength = this.values_.length;\n if (newLength === currentLength) {\n return;\n } else if (newLength > currentLength) {\n var newItems = new Array(newLength - currentLength);\n for (var i = 0; i < newLength - currentLength; i++) {\n newItems[i] = undefined;\n } // No Array.fill everywhere...\n this.spliceWithArray_(currentLength, 0, newItems);\n } else {\n this.spliceWithArray_(newLength, currentLength - newLength);\n }\n };\n _proto.updateArrayLength_ = function updateArrayLength_(oldLength, delta) {\n if (oldLength !== this.lastKnownLength_) {\n die(16);\n }\n this.lastKnownLength_ += delta;\n if (this.legacyMode_ && delta > 0) {\n reserveArrayBuffer(oldLength + delta + 1);\n }\n };\n _proto.spliceWithArray_ = function spliceWithArray_(index, deleteCount, newItems) {\n var _this = this;\n checkIfStateModificationsAreAllowed(this.atom_);\n var length = this.values_.length;\n if (index === undefined) {\n index = 0;\n } else if (index > length) {\n index = length;\n } else if (index < 0) {\n index = Math.max(0, length + index);\n }\n if (arguments.length === 1) {\n deleteCount = length - index;\n } else if (deleteCount === undefined || deleteCount === null) {\n deleteCount = 0;\n } else {\n deleteCount = Math.max(0, Math.min(deleteCount, length - index));\n }\n if (newItems === undefined) {\n newItems = EMPTY_ARRAY;\n }\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_,\n type: SPLICE,\n index: index,\n removedCount: deleteCount,\n added: newItems\n });\n if (!change) {\n return EMPTY_ARRAY;\n }\n deleteCount = change.removedCount;\n newItems = change.added;\n }\n newItems = newItems.length === 0 ? newItems : newItems.map(function (v) {\n return _this.enhancer_(v, undefined);\n });\n if (this.legacyMode_ || \"development\" !== \"production\") {\n var lengthDelta = newItems.length - deleteCount;\n this.updateArrayLength_(length, lengthDelta); // checks if internal array wasn't modified\n }\n var res = this.spliceItemsIntoValues_(index, deleteCount, newItems);\n if (deleteCount !== 0 || newItems.length !== 0) {\n this.notifyArraySplice_(index, newItems, res);\n }\n return this.dehanceValues_(res);\n };\n _proto.spliceItemsIntoValues_ = function spliceItemsIntoValues_(index, deleteCount, newItems) {\n if (newItems.length < MAX_SPLICE_SIZE) {\n var _this$values_;\n return (_this$values_ = this.values_).splice.apply(_this$values_, [index, deleteCount].concat(newItems));\n } else {\n // The items removed by the splice\n var res = this.values_.slice(index, index + deleteCount);\n // The items that that should remain at the end of the array\n var oldItems = this.values_.slice(index + deleteCount);\n // New length is the previous length + addition count - deletion count\n this.values_.length += newItems.length - deleteCount;\n for (var i = 0; i < newItems.length; i++) {\n this.values_[index + i] = newItems[i];\n }\n for (var _i = 0; _i < oldItems.length; _i++) {\n this.values_[index + newItems.length + _i] = oldItems[_i];\n }\n return res;\n }\n };\n _proto.notifyArrayChildUpdate_ = function notifyArrayChildUpdate_(index, newValue, oldValue) {\n var notifySpy = !this.owned_ && isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"array\",\n object: this.proxy_,\n type: UPDATE,\n debugObjectName: this.atom_.name_,\n index: index,\n newValue: newValue,\n oldValue: oldValue\n } : null;\n // The reason why this is on right hand side here (and not above), is this way the uglifier will drop it, but it won't\n // cause any runtime overhead in development mode without NODE_ENV set, unless spying is enabled\n if ( true && notifySpy) {\n spyReportStart(change);\n }\n this.atom_.reportChanged();\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n };\n _proto.notifyArraySplice_ = function notifyArraySplice_(index, added, removed) {\n var notifySpy = !this.owned_ && isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"array\",\n object: this.proxy_,\n debugObjectName: this.atom_.name_,\n type: SPLICE,\n index: index,\n removed: removed,\n added: added,\n removedCount: removed.length,\n addedCount: added.length\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n }\n this.atom_.reportChanged();\n // conform: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/observe\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n };\n _proto.get_ = function get_(index) {\n if (this.legacyMode_ && index >= this.values_.length) {\n console.warn( true ? \"[mobx.array] Attempt to read an array index (\" + index + \") that is out of bounds (\" + this.values_.length + \"). Please check length first. Out of bound indices will not be tracked by MobX\" : 0);\n return undefined;\n }\n this.atom_.reportObserved();\n return this.dehanceValue_(this.values_[index]);\n };\n _proto.set_ = function set_(index, newValue) {\n var values = this.values_;\n if (this.legacyMode_ && index > values.length) {\n // out of bounds\n die(17, index, values.length);\n }\n if (index < values.length) {\n // update at index in range\n checkIfStateModificationsAreAllowed(this.atom_);\n var oldValue = values[index];\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: UPDATE,\n object: this.proxy_,\n // since \"this\" is the real array we need to pass its proxy\n index: index,\n newValue: newValue\n });\n if (!change) {\n return;\n }\n newValue = change.newValue;\n }\n newValue = this.enhancer_(newValue, oldValue);\n var changed = newValue !== oldValue;\n if (changed) {\n values[index] = newValue;\n this.notifyArrayChildUpdate_(index, newValue, oldValue);\n }\n } else {\n // For out of bound index, we don't create an actual sparse array,\n // but rather fill the holes with undefined (same as setArrayLength_).\n // This could be considered a bug.\n var newItems = new Array(index + 1 - values.length);\n for (var i = 0; i < newItems.length - 1; i++) {\n newItems[i] = undefined;\n } // No Array.fill everywhere...\n newItems[newItems.length - 1] = newValue;\n this.spliceWithArray_(values.length, 0, newItems);\n }\n };\n return ObservableArrayAdministration;\n}();\nfunction createObservableArray(initialValues, enhancer, name, owned) {\n if (name === void 0) {\n name = true ? \"ObservableArray@\" + getNextId() : 0;\n }\n if (owned === void 0) {\n owned = false;\n }\n assertProxies();\n return initObservable(function () {\n var adm = new ObservableArrayAdministration(name, enhancer, owned, false);\n addHiddenFinalProp(adm.values_, $mobx, adm);\n var proxy = new Proxy(adm.values_, arrayTraps);\n adm.proxy_ = proxy;\n if (initialValues && initialValues.length) {\n adm.spliceWithArray_(0, 0, initialValues);\n }\n return proxy;\n });\n}\n// eslint-disable-next-line\nvar arrayExtensions = {\n clear: function clear() {\n return this.splice(0);\n },\n replace: function replace(newItems) {\n var adm = this[$mobx];\n return adm.spliceWithArray_(0, adm.values_.length, newItems);\n },\n // Used by JSON.stringify\n toJSON: function toJSON() {\n return this.slice();\n },\n /*\n * functions that do alter the internal structure of the array, (based on lib.es6.d.ts)\n * since these functions alter the inner structure of the array, the have side effects.\n * Because the have side effects, they should not be used in computed function,\n * and for that reason the do not call dependencyState.notifyObserved\n */\n splice: function splice(index, deleteCount) {\n for (var _len = arguments.length, newItems = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {\n newItems[_key - 2] = arguments[_key];\n }\n var adm = this[$mobx];\n switch (arguments.length) {\n case 0:\n return [];\n case 1:\n return adm.spliceWithArray_(index);\n case 2:\n return adm.spliceWithArray_(index, deleteCount);\n }\n return adm.spliceWithArray_(index, deleteCount, newItems);\n },\n spliceWithArray: function spliceWithArray(index, deleteCount, newItems) {\n return this[$mobx].spliceWithArray_(index, deleteCount, newItems);\n },\n push: function push() {\n var adm = this[$mobx];\n for (var _len2 = arguments.length, items = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n items[_key2] = arguments[_key2];\n }\n adm.spliceWithArray_(adm.values_.length, 0, items);\n return adm.values_.length;\n },\n pop: function pop() {\n return this.splice(Math.max(this[$mobx].values_.length - 1, 0), 1)[0];\n },\n shift: function shift() {\n return this.splice(0, 1)[0];\n },\n unshift: function unshift() {\n var adm = this[$mobx];\n for (var _len3 = arguments.length, items = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n items[_key3] = arguments[_key3];\n }\n adm.spliceWithArray_(0, 0, items);\n return adm.values_.length;\n },\n reverse: function reverse() {\n // reverse by default mutates in place before returning the result\n // which makes it both a 'derivation' and a 'mutation'.\n if (globalState.trackingDerivation) {\n die(37, \"reverse\");\n }\n this.replace(this.slice().reverse());\n return this;\n },\n sort: function sort() {\n // sort by default mutates in place before returning the result\n // which goes against all good practices. Let's not change the array in place!\n if (globalState.trackingDerivation) {\n die(37, \"sort\");\n }\n var copy = this.slice();\n copy.sort.apply(copy, arguments);\n this.replace(copy);\n return this;\n },\n remove: function remove(value) {\n var adm = this[$mobx];\n var idx = adm.dehanceValues_(adm.values_).indexOf(value);\n if (idx > -1) {\n this.splice(idx, 1);\n return true;\n }\n return false;\n }\n};\n/**\n * Wrap function from prototype\n * Without this, everything works as well, but this works\n * faster as everything works on unproxied values\n */\naddArrayExtension(\"at\", simpleFunc);\naddArrayExtension(\"concat\", simpleFunc);\naddArrayExtension(\"flat\", simpleFunc);\naddArrayExtension(\"includes\", simpleFunc);\naddArrayExtension(\"indexOf\", simpleFunc);\naddArrayExtension(\"join\", simpleFunc);\naddArrayExtension(\"lastIndexOf\", simpleFunc);\naddArrayExtension(\"slice\", simpleFunc);\naddArrayExtension(\"toString\", simpleFunc);\naddArrayExtension(\"toLocaleString\", simpleFunc);\naddArrayExtension(\"toSorted\", simpleFunc);\naddArrayExtension(\"toSpliced\", simpleFunc);\naddArrayExtension(\"with\", simpleFunc);\n// map\naddArrayExtension(\"every\", mapLikeFunc);\naddArrayExtension(\"filter\", mapLikeFunc);\naddArrayExtension(\"find\", mapLikeFunc);\naddArrayExtension(\"findIndex\", mapLikeFunc);\naddArrayExtension(\"findLast\", mapLikeFunc);\naddArrayExtension(\"findLastIndex\", mapLikeFunc);\naddArrayExtension(\"flatMap\", mapLikeFunc);\naddArrayExtension(\"forEach\", mapLikeFunc);\naddArrayExtension(\"map\", mapLikeFunc);\naddArrayExtension(\"some\", mapLikeFunc);\naddArrayExtension(\"toReversed\", mapLikeFunc);\n// reduce\naddArrayExtension(\"reduce\", reduceLikeFunc);\naddArrayExtension(\"reduceRight\", reduceLikeFunc);\nfunction addArrayExtension(funcName, funcFactory) {\n if (typeof Array.prototype[funcName] === \"function\") {\n arrayExtensions[funcName] = funcFactory(funcName);\n }\n}\n// Report and delegate to dehanced array\nfunction simpleFunc(funcName) {\n return function () {\n var adm = this[$mobx];\n adm.atom_.reportObserved();\n var dehancedValues = adm.dehanceValues_(adm.values_);\n return dehancedValues[funcName].apply(dehancedValues, arguments);\n };\n}\n// Make sure callbacks receive correct array arg #2326\nfunction mapLikeFunc(funcName) {\n return function (callback, thisArg) {\n var _this2 = this;\n var adm = this[$mobx];\n adm.atom_.reportObserved();\n var dehancedValues = adm.dehanceValues_(adm.values_);\n return dehancedValues[funcName](function (element, index) {\n return callback.call(thisArg, element, index, _this2);\n });\n };\n}\n// Make sure callbacks receive correct array arg #2326\nfunction reduceLikeFunc(funcName) {\n return function () {\n var _this3 = this;\n var adm = this[$mobx];\n adm.atom_.reportObserved();\n var dehancedValues = adm.dehanceValues_(adm.values_);\n // #2432 - reduce behavior depends on arguments.length\n var callback = arguments[0];\n arguments[0] = function (accumulator, currentValue, index) {\n return callback(accumulator, currentValue, index, _this3);\n };\n return dehancedValues[funcName].apply(dehancedValues, arguments);\n };\n}\nvar isObservableArrayAdministration = /*#__PURE__*/createInstanceofPredicate(\"ObservableArrayAdministration\", ObservableArrayAdministration);\nfunction isObservableArray(thing) {\n return isObject(thing) && isObservableArrayAdministration(thing[$mobx]);\n}\n\nvar ObservableMapMarker = {};\nvar ADD = \"add\";\nvar DELETE = \"delete\";\n// just extend Map? See also https://gist.github.com/nestharus/13b4d74f2ef4a2f4357dbd3fc23c1e54\n// But: https://github.com/mobxjs/mobx/issues/1556\nvar ObservableMap = /*#__PURE__*/function () {\n function ObservableMap(initialData, enhancer_, name_) {\n var _this = this;\n if (enhancer_ === void 0) {\n enhancer_ = deepEnhancer;\n }\n if (name_ === void 0) {\n name_ = true ? \"ObservableMap@\" + getNextId() : 0;\n }\n this.enhancer_ = void 0;\n this.name_ = void 0;\n this[$mobx] = ObservableMapMarker;\n this.data_ = void 0;\n this.hasMap_ = void 0;\n // hasMap, not hashMap >-).\n this.keysAtom_ = void 0;\n this.interceptors_ = void 0;\n this.changeListeners_ = void 0;\n this.dehancer = void 0;\n this.enhancer_ = enhancer_;\n this.name_ = name_;\n if (!isFunction(Map)) {\n die(18);\n }\n initObservable(function () {\n _this.keysAtom_ = createAtom( true ? _this.name_ + \".keys()\" : 0);\n _this.data_ = new Map();\n _this.hasMap_ = new Map();\n if (initialData) {\n _this.merge(initialData);\n }\n });\n }\n var _proto = ObservableMap.prototype;\n _proto.has_ = function has_(key) {\n return this.data_.has(key);\n };\n _proto.has = function has(key) {\n var _this2 = this;\n if (!globalState.trackingDerivation) {\n return this.has_(key);\n }\n var entry = this.hasMap_.get(key);\n if (!entry) {\n var newEntry = entry = new ObservableValue(this.has_(key), referenceEnhancer, true ? this.name_ + \".\" + stringifyKey(key) + \"?\" : 0, false);\n this.hasMap_.set(key, newEntry);\n onBecomeUnobserved(newEntry, function () {\n return _this2.hasMap_[\"delete\"](key);\n });\n }\n return entry.get();\n };\n _proto.set = function set(key, value) {\n var hasKey = this.has_(key);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: hasKey ? UPDATE : ADD,\n object: this,\n newValue: value,\n name: key\n });\n if (!change) {\n return this;\n }\n value = change.newValue;\n }\n if (hasKey) {\n this.updateValue_(key, value);\n } else {\n this.addValue_(key, value);\n }\n return this;\n };\n _proto[\"delete\"] = function _delete(key) {\n var _this3 = this;\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: DELETE,\n object: this,\n name: key\n });\n if (!change) {\n return false;\n }\n }\n if (this.has_(key)) {\n var notifySpy = isSpyEnabled();\n var notify = hasListeners(this);\n var _change = notify || notifySpy ? {\n observableKind: \"map\",\n debugObjectName: this.name_,\n type: DELETE,\n object: this,\n oldValue: this.data_.get(key).value_,\n name: key\n } : null;\n if ( true && notifySpy) {\n spyReportStart(_change);\n } // TODO fix type\n transaction(function () {\n var _this3$hasMap_$get;\n _this3.keysAtom_.reportChanged();\n (_this3$hasMap_$get = _this3.hasMap_.get(key)) == null || _this3$hasMap_$get.setNewValue_(false);\n var observable = _this3.data_.get(key);\n observable.setNewValue_(undefined);\n _this3.data_[\"delete\"](key);\n });\n if (notify) {\n notifyListeners(this, _change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n return true;\n }\n return false;\n };\n _proto.updateValue_ = function updateValue_(key, newValue) {\n var observable = this.data_.get(key);\n newValue = observable.prepareNewValue_(newValue);\n if (newValue !== globalState.UNCHANGED) {\n var notifySpy = isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"map\",\n debugObjectName: this.name_,\n type: UPDATE,\n object: this,\n oldValue: observable.value_,\n name: key,\n newValue: newValue\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n } // TODO fix type\n observable.setNewValue_(newValue);\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n };\n _proto.addValue_ = function addValue_(key, newValue) {\n var _this4 = this;\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n transaction(function () {\n var _this4$hasMap_$get;\n var observable = new ObservableValue(newValue, _this4.enhancer_, true ? _this4.name_ + \".\" + stringifyKey(key) : 0, false);\n _this4.data_.set(key, observable);\n newValue = observable.value_; // value might have been changed\n (_this4$hasMap_$get = _this4.hasMap_.get(key)) == null || _this4$hasMap_$get.setNewValue_(true);\n _this4.keysAtom_.reportChanged();\n });\n var notifySpy = isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"map\",\n debugObjectName: this.name_,\n type: ADD,\n object: this,\n name: key,\n newValue: newValue\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n } // TODO fix type\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n };\n _proto.get = function get(key) {\n if (this.has(key)) {\n return this.dehanceValue_(this.data_.get(key).get());\n }\n return this.dehanceValue_(undefined);\n };\n _proto.dehanceValue_ = function dehanceValue_(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.keys = function keys() {\n this.keysAtom_.reportObserved();\n return this.data_.keys();\n };\n _proto.values = function values() {\n var self = this;\n var keys = this.keys();\n return makeIterable({\n next: function next() {\n var _keys$next = keys.next(),\n done = _keys$next.done,\n value = _keys$next.value;\n return {\n done: done,\n value: done ? undefined : self.get(value)\n };\n }\n });\n };\n _proto.entries = function entries() {\n var self = this;\n var keys = this.keys();\n return makeIterable({\n next: function next() {\n var _keys$next2 = keys.next(),\n done = _keys$next2.done,\n value = _keys$next2.value;\n return {\n done: done,\n value: done ? undefined : [value, self.get(value)]\n };\n }\n });\n };\n _proto[Symbol.iterator] = function () {\n return this.entries();\n };\n _proto.forEach = function forEach(callback, thisArg) {\n for (var _iterator = _createForOfIteratorHelperLoose(this), _step; !(_step = _iterator()).done;) {\n var _step$value = _step.value,\n key = _step$value[0],\n value = _step$value[1];\n callback.call(thisArg, value, key, this);\n }\n }\n /** Merge another object into this object, returns this. */;\n _proto.merge = function merge(other) {\n var _this5 = this;\n if (isObservableMap(other)) {\n other = new Map(other);\n }\n transaction(function () {\n if (isPlainObject(other)) {\n getPlainObjectKeys(other).forEach(function (key) {\n return _this5.set(key, other[key]);\n });\n } else if (Array.isArray(other)) {\n other.forEach(function (_ref) {\n var key = _ref[0],\n value = _ref[1];\n return _this5.set(key, value);\n });\n } else if (isES6Map(other)) {\n if (!isPlainES6Map(other)) {\n die(19, other);\n }\n other.forEach(function (value, key) {\n return _this5.set(key, value);\n });\n } else if (other !== null && other !== undefined) {\n die(20, other);\n }\n });\n return this;\n };\n _proto.clear = function clear() {\n var _this6 = this;\n transaction(function () {\n untracked(function () {\n for (var _iterator2 = _createForOfIteratorHelperLoose(_this6.keys()), _step2; !(_step2 = _iterator2()).done;) {\n var key = _step2.value;\n _this6[\"delete\"](key);\n }\n });\n });\n };\n _proto.replace = function replace(values) {\n var _this7 = this;\n // Implementation requirements:\n // - respect ordering of replacement map\n // - allow interceptors to run and potentially prevent individual operations\n // - don't recreate observables that already exist in original map (so we don't destroy existing subscriptions)\n // - don't _keysAtom.reportChanged if the keys of resulting map are indentical (order matters!)\n // - note that result map may differ from replacement map due to the interceptors\n transaction(function () {\n // Convert to map so we can do quick key lookups\n var replacementMap = convertToMap(values);\n var orderedData = new Map();\n // Used for optimization\n var keysReportChangedCalled = false;\n // Delete keys that don't exist in replacement map\n // if the key deletion is prevented by interceptor\n // add entry at the beginning of the result map\n for (var _iterator3 = _createForOfIteratorHelperLoose(_this7.data_.keys()), _step3; !(_step3 = _iterator3()).done;) {\n var key = _step3.value;\n // Concurrently iterating/deleting keys\n // iterator should handle this correctly\n if (!replacementMap.has(key)) {\n var deleted = _this7[\"delete\"](key);\n // Was the key removed?\n if (deleted) {\n // _keysAtom.reportChanged() was already called\n keysReportChangedCalled = true;\n } else {\n // Delete prevented by interceptor\n var value = _this7.data_.get(key);\n orderedData.set(key, value);\n }\n }\n }\n // Merge entries\n for (var _iterator4 = _createForOfIteratorHelperLoose(replacementMap.entries()), _step4; !(_step4 = _iterator4()).done;) {\n var _step4$value = _step4.value,\n _key = _step4$value[0],\n _value = _step4$value[1];\n // We will want to know whether a new key is added\n var keyExisted = _this7.data_.has(_key);\n // Add or update value\n _this7.set(_key, _value);\n // The addition could have been prevent by interceptor\n if (_this7.data_.has(_key)) {\n // The update could have been prevented by interceptor\n // and also we want to preserve existing values\n // so use value from _data map (instead of replacement map)\n var _value2 = _this7.data_.get(_key);\n orderedData.set(_key, _value2);\n // Was a new key added?\n if (!keyExisted) {\n // _keysAtom.reportChanged() was already called\n keysReportChangedCalled = true;\n }\n }\n }\n // Check for possible key order change\n if (!keysReportChangedCalled) {\n if (_this7.data_.size !== orderedData.size) {\n // If size differs, keys are definitely modified\n _this7.keysAtom_.reportChanged();\n } else {\n var iter1 = _this7.data_.keys();\n var iter2 = orderedData.keys();\n var next1 = iter1.next();\n var next2 = iter2.next();\n while (!next1.done) {\n if (next1.value !== next2.value) {\n _this7.keysAtom_.reportChanged();\n break;\n }\n next1 = iter1.next();\n next2 = iter2.next();\n }\n }\n }\n // Use correctly ordered map\n _this7.data_ = orderedData;\n });\n return this;\n };\n _proto.toString = function toString() {\n return \"[object ObservableMap]\";\n };\n _proto.toJSON = function toJSON() {\n return Array.from(this);\n };\n /**\n * Observes this object. Triggers for the events 'add', 'update' and 'delete'.\n * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe\n * for callback details\n */\n _proto.observe_ = function observe_(listener, fireImmediately) {\n if ( true && fireImmediately === true) {\n die(\"`observe` doesn't support fireImmediately=true in combination with maps.\");\n }\n return registerListener(this, listener);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n return _createClass(ObservableMap, [{\n key: \"size\",\n get: function get() {\n this.keysAtom_.reportObserved();\n return this.data_.size;\n }\n }, {\n key: Symbol.toStringTag,\n get: function get() {\n return \"Map\";\n }\n }]);\n}();\n// eslint-disable-next-line\nvar isObservableMap = /*#__PURE__*/createInstanceofPredicate(\"ObservableMap\", ObservableMap);\nfunction convertToMap(dataStructure) {\n if (isES6Map(dataStructure) || isObservableMap(dataStructure)) {\n return dataStructure;\n } else if (Array.isArray(dataStructure)) {\n return new Map(dataStructure);\n } else if (isPlainObject(dataStructure)) {\n var map = new Map();\n for (var key in dataStructure) {\n map.set(key, dataStructure[key]);\n }\n return map;\n } else {\n return die(21, dataStructure);\n }\n}\n\nvar ObservableSetMarker = {};\nvar ObservableSet = /*#__PURE__*/function () {\n function ObservableSet(initialData, enhancer, name_) {\n var _this = this;\n if (enhancer === void 0) {\n enhancer = deepEnhancer;\n }\n if (name_ === void 0) {\n name_ = true ? \"ObservableSet@\" + getNextId() : 0;\n }\n this.name_ = void 0;\n this[$mobx] = ObservableSetMarker;\n this.data_ = new Set();\n this.atom_ = void 0;\n this.changeListeners_ = void 0;\n this.interceptors_ = void 0;\n this.dehancer = void 0;\n this.enhancer_ = void 0;\n this.name_ = name_;\n if (!isFunction(Set)) {\n die(22);\n }\n this.enhancer_ = function (newV, oldV) {\n return enhancer(newV, oldV, name_);\n };\n initObservable(function () {\n _this.atom_ = createAtom(_this.name_);\n if (initialData) {\n _this.replace(initialData);\n }\n });\n }\n var _proto = ObservableSet.prototype;\n _proto.dehanceValue_ = function dehanceValue_(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.clear = function clear() {\n var _this2 = this;\n transaction(function () {\n untracked(function () {\n for (var _iterator = _createForOfIteratorHelperLoose(_this2.data_.values()), _step; !(_step = _iterator()).done;) {\n var value = _step.value;\n _this2[\"delete\"](value);\n }\n });\n });\n };\n _proto.forEach = function forEach(callbackFn, thisArg) {\n for (var _iterator2 = _createForOfIteratorHelperLoose(this), _step2; !(_step2 = _iterator2()).done;) {\n var value = _step2.value;\n callbackFn.call(thisArg, value, value, this);\n }\n };\n _proto.add = function add(value) {\n var _this3 = this;\n checkIfStateModificationsAreAllowed(this.atom_);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: ADD,\n object: this,\n newValue: value\n });\n if (!change) {\n return this;\n }\n // ideally, value = change.value would be done here, so that values can be\n // changed by interceptor. Same applies for other Set and Map api's.\n }\n if (!this.has(value)) {\n transaction(function () {\n _this3.data_.add(_this3.enhancer_(value, undefined));\n _this3.atom_.reportChanged();\n });\n var notifySpy = true && isSpyEnabled();\n var notify = hasListeners(this);\n var _change = notify || notifySpy ? {\n observableKind: \"set\",\n debugObjectName: this.name_,\n type: ADD,\n object: this,\n newValue: value\n } : null;\n if (notifySpy && \"development\" !== \"production\") {\n spyReportStart(_change);\n }\n if (notify) {\n notifyListeners(this, _change);\n }\n if (notifySpy && \"development\" !== \"production\") {\n spyReportEnd();\n }\n }\n return this;\n };\n _proto[\"delete\"] = function _delete(value) {\n var _this4 = this;\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: DELETE,\n object: this,\n oldValue: value\n });\n if (!change) {\n return false;\n }\n }\n if (this.has(value)) {\n var notifySpy = true && isSpyEnabled();\n var notify = hasListeners(this);\n var _change2 = notify || notifySpy ? {\n observableKind: \"set\",\n debugObjectName: this.name_,\n type: DELETE,\n object: this,\n oldValue: value\n } : null;\n if (notifySpy && \"development\" !== \"production\") {\n spyReportStart(_change2);\n }\n transaction(function () {\n _this4.atom_.reportChanged();\n _this4.data_[\"delete\"](value);\n });\n if (notify) {\n notifyListeners(this, _change2);\n }\n if (notifySpy && \"development\" !== \"production\") {\n spyReportEnd();\n }\n return true;\n }\n return false;\n };\n _proto.has = function has(value) {\n this.atom_.reportObserved();\n return this.data_.has(this.dehanceValue_(value));\n };\n _proto.entries = function entries() {\n var nextIndex = 0;\n var keys = Array.from(this.keys());\n var values = Array.from(this.values());\n return makeIterable({\n next: function next() {\n var index = nextIndex;\n nextIndex += 1;\n return index < values.length ? {\n value: [keys[index], values[index]],\n done: false\n } : {\n done: true\n };\n }\n });\n };\n _proto.keys = function keys() {\n return this.values();\n };\n _proto.values = function values() {\n this.atom_.reportObserved();\n var self = this;\n var nextIndex = 0;\n var observableValues = Array.from(this.data_.values());\n return makeIterable({\n next: function next() {\n return nextIndex < observableValues.length ? {\n value: self.dehanceValue_(observableValues[nextIndex++]),\n done: false\n } : {\n done: true\n };\n }\n });\n };\n _proto.intersection = function intersection(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.intersection(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.intersection(otherSet);\n }\n };\n _proto.union = function union(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.union(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.union(otherSet);\n }\n };\n _proto.difference = function difference(otherSet) {\n return new Set(this).difference(otherSet);\n };\n _proto.symmetricDifference = function symmetricDifference(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.symmetricDifference(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.symmetricDifference(otherSet);\n }\n };\n _proto.isSubsetOf = function isSubsetOf(otherSet) {\n return new Set(this).isSubsetOf(otherSet);\n };\n _proto.isSupersetOf = function isSupersetOf(otherSet) {\n return new Set(this).isSupersetOf(otherSet);\n };\n _proto.isDisjointFrom = function isDisjointFrom(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.isDisjointFrom(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.isDisjointFrom(otherSet);\n }\n };\n _proto.replace = function replace(other) {\n var _this5 = this;\n if (isObservableSet(other)) {\n other = new Set(other);\n }\n transaction(function () {\n if (Array.isArray(other)) {\n _this5.clear();\n other.forEach(function (value) {\n return _this5.add(value);\n });\n } else if (isES6Set(other)) {\n _this5.clear();\n other.forEach(function (value) {\n return _this5.add(value);\n });\n } else if (other !== null && other !== undefined) {\n die(\"Cannot initialize set from \" + other);\n }\n });\n return this;\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n // ... 'fireImmediately' could also be true?\n if ( true && fireImmediately === true) {\n die(\"`observe` doesn't support fireImmediately=true in combination with sets.\");\n }\n return registerListener(this, listener);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.toJSON = function toJSON() {\n return Array.from(this);\n };\n _proto.toString = function toString() {\n return \"[object ObservableSet]\";\n };\n _proto[Symbol.iterator] = function () {\n return this.values();\n };\n return _createClass(ObservableSet, [{\n key: \"size\",\n get: function get() {\n this.atom_.reportObserved();\n return this.data_.size;\n }\n }, {\n key: Symbol.toStringTag,\n get: function get() {\n return \"Set\";\n }\n }]);\n}();\n// eslint-disable-next-line\nvar isObservableSet = /*#__PURE__*/createInstanceofPredicate(\"ObservableSet\", ObservableSet);\n\nvar descriptorCache = /*#__PURE__*/Object.create(null);\nvar REMOVE = \"remove\";\nvar ObservableObjectAdministration = /*#__PURE__*/function () {\n function ObservableObjectAdministration(target_, values_, name_,\n // Used anytime annotation is not explicitely provided\n defaultAnnotation_) {\n if (values_ === void 0) {\n values_ = new Map();\n }\n if (defaultAnnotation_ === void 0) {\n defaultAnnotation_ = autoAnnotation;\n }\n this.target_ = void 0;\n this.values_ = void 0;\n this.name_ = void 0;\n this.defaultAnnotation_ = void 0;\n this.keysAtom_ = void 0;\n this.changeListeners_ = void 0;\n this.interceptors_ = void 0;\n this.proxy_ = void 0;\n this.isPlainObject_ = void 0;\n this.appliedAnnotations_ = void 0;\n this.pendingKeys_ = void 0;\n this.target_ = target_;\n this.values_ = values_;\n this.name_ = name_;\n this.defaultAnnotation_ = defaultAnnotation_;\n this.keysAtom_ = new Atom( true ? this.name_ + \".keys\" : 0);\n // Optimization: we use this frequently\n this.isPlainObject_ = isPlainObject(this.target_);\n if ( true && !isAnnotation(this.defaultAnnotation_)) {\n die(\"defaultAnnotation must be valid annotation\");\n }\n if (true) {\n // Prepare structure for tracking which fields were already annotated\n this.appliedAnnotations_ = {};\n }\n }\n var _proto = ObservableObjectAdministration.prototype;\n _proto.getObservablePropValue_ = function getObservablePropValue_(key) {\n return this.values_.get(key).get();\n };\n _proto.setObservablePropValue_ = function setObservablePropValue_(key, newValue) {\n var observable = this.values_.get(key);\n if (observable instanceof ComputedValue) {\n observable.set(newValue);\n return true;\n }\n // intercept\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: UPDATE,\n object: this.proxy_ || this.target_,\n name: key,\n newValue: newValue\n });\n if (!change) {\n return null;\n }\n newValue = change.newValue;\n }\n newValue = observable.prepareNewValue_(newValue);\n // notify spy & observers\n if (newValue !== globalState.UNCHANGED) {\n var notify = hasListeners(this);\n var notifySpy = true && isSpyEnabled();\n var _change = notify || notifySpy ? {\n type: UPDATE,\n observableKind: \"object\",\n debugObjectName: this.name_,\n object: this.proxy_ || this.target_,\n oldValue: observable.value_,\n name: key,\n newValue: newValue\n } : null;\n if ( true && notifySpy) {\n spyReportStart(_change);\n }\n observable.setNewValue_(newValue);\n if (notify) {\n notifyListeners(this, _change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n return true;\n };\n _proto.get_ = function get_(key) {\n if (globalState.trackingDerivation && !hasProp(this.target_, key)) {\n // Key doesn't exist yet, subscribe for it in case it's added later\n this.has_(key);\n }\n return this.target_[key];\n }\n /**\n * @param {PropertyKey} key\n * @param {any} value\n * @param {Annotation|boolean} annotation true - use default annotation, false - copy as is\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.set_ = function set_(key, value, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n // Don't use .has(key) - we care about own\n if (hasProp(this.target_, key)) {\n // Existing prop\n if (this.values_.has(key)) {\n // Observable (can be intercepted)\n return this.setObservablePropValue_(key, value);\n } else if (proxyTrap) {\n // Non-observable - proxy\n return Reflect.set(this.target_, key, value);\n } else {\n // Non-observable\n this.target_[key] = value;\n return true;\n }\n } else {\n // New prop\n return this.extend_(key, {\n value: value,\n enumerable: true,\n writable: true,\n configurable: true\n }, this.defaultAnnotation_, proxyTrap);\n }\n }\n // Trap for \"in\"\n ;\n _proto.has_ = function has_(key) {\n if (!globalState.trackingDerivation) {\n // Skip key subscription outside derivation\n return key in this.target_;\n }\n this.pendingKeys_ || (this.pendingKeys_ = new Map());\n var entry = this.pendingKeys_.get(key);\n if (!entry) {\n entry = new ObservableValue(key in this.target_, referenceEnhancer, true ? this.name_ + \".\" + stringifyKey(key) + \"?\" : 0, false);\n this.pendingKeys_.set(key, entry);\n }\n return entry.get();\n }\n /**\n * @param {PropertyKey} key\n * @param {Annotation|boolean} annotation true - use default annotation, false - ignore prop\n */;\n _proto.make_ = function make_(key, annotation) {\n if (annotation === true) {\n annotation = this.defaultAnnotation_;\n }\n if (annotation === false) {\n return;\n }\n assertAnnotable(this, annotation, key);\n if (!(key in this.target_)) {\n var _this$target_$storedA;\n // Throw on missing key, except for decorators:\n // Decorator annotations are collected from whole prototype chain.\n // When called from super() some props may not exist yet.\n // However we don't have to worry about missing prop,\n // because the decorator must have been applied to something.\n if ((_this$target_$storedA = this.target_[storedAnnotationsSymbol]) != null && _this$target_$storedA[key]) {\n return; // will be annotated by subclass constructor\n } else {\n die(1, annotation.annotationType_, this.name_ + \".\" + key.toString());\n }\n }\n var source = this.target_;\n while (source && source !== objectPrototype) {\n var descriptor = getDescriptor(source, key);\n if (descriptor) {\n var outcome = annotation.make_(this, key, descriptor, source);\n if (outcome === 0 /* MakeResult.Cancel */) {\n return;\n }\n if (outcome === 1 /* MakeResult.Break */) {\n break;\n }\n }\n source = Object.getPrototypeOf(source);\n }\n recordAnnotationApplied(this, annotation, key);\n }\n /**\n * @param {PropertyKey} key\n * @param {PropertyDescriptor} descriptor\n * @param {Annotation|boolean} annotation true - use default annotation, false - copy as is\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.extend_ = function extend_(key, descriptor, annotation, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n if (annotation === true) {\n annotation = this.defaultAnnotation_;\n }\n if (annotation === false) {\n return this.defineProperty_(key, descriptor, proxyTrap);\n }\n assertAnnotable(this, annotation, key);\n var outcome = annotation.extend_(this, key, descriptor, proxyTrap);\n if (outcome) {\n recordAnnotationApplied(this, annotation, key);\n }\n return outcome;\n }\n /**\n * @param {PropertyKey} key\n * @param {PropertyDescriptor} descriptor\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.defineProperty_ = function defineProperty_(key, descriptor, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n try {\n startBatch();\n // Delete\n var deleteOutcome = this.delete_(key);\n if (!deleteOutcome) {\n // Failure or intercepted\n return deleteOutcome;\n }\n // ADD interceptor\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: ADD,\n newValue: descriptor.value\n });\n if (!change) {\n return null;\n }\n var newValue = change.newValue;\n if (descriptor.value !== newValue) {\n descriptor = _extends({}, descriptor, {\n value: newValue\n });\n }\n }\n // Define\n if (proxyTrap) {\n if (!Reflect.defineProperty(this.target_, key, descriptor)) {\n return false;\n }\n } else {\n defineProperty(this.target_, key, descriptor);\n }\n // Notify\n this.notifyPropertyAddition_(key, descriptor.value);\n } finally {\n endBatch();\n }\n return true;\n }\n // If original descriptor becomes relevant, move this to annotation directly\n ;\n _proto.defineObservableProperty_ = function defineObservableProperty_(key, value, enhancer, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n try {\n startBatch();\n // Delete\n var deleteOutcome = this.delete_(key);\n if (!deleteOutcome) {\n // Failure or intercepted\n return deleteOutcome;\n }\n // ADD interceptor\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: ADD,\n newValue: value\n });\n if (!change) {\n return null;\n }\n value = change.newValue;\n }\n var cachedDescriptor = getCachedObservablePropDescriptor(key);\n var descriptor = {\n configurable: globalState.safeDescriptors ? this.isPlainObject_ : true,\n enumerable: true,\n get: cachedDescriptor.get,\n set: cachedDescriptor.set\n };\n // Define\n if (proxyTrap) {\n if (!Reflect.defineProperty(this.target_, key, descriptor)) {\n return false;\n }\n } else {\n defineProperty(this.target_, key, descriptor);\n }\n var observable = new ObservableValue(value, enhancer, true ? this.name_ + \".\" + key.toString() : 0, false);\n this.values_.set(key, observable);\n // Notify (value possibly changed by ObservableValue)\n this.notifyPropertyAddition_(key, observable.value_);\n } finally {\n endBatch();\n }\n return true;\n }\n // If original descriptor becomes relevant, move this to annotation directly\n ;\n _proto.defineComputedProperty_ = function defineComputedProperty_(key, options, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n try {\n startBatch();\n // Delete\n var deleteOutcome = this.delete_(key);\n if (!deleteOutcome) {\n // Failure or intercepted\n return deleteOutcome;\n }\n // ADD interceptor\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: ADD,\n newValue: undefined\n });\n if (!change) {\n return null;\n }\n }\n options.name || (options.name = true ? this.name_ + \".\" + key.toString() : 0);\n options.context = this.proxy_ || this.target_;\n var cachedDescriptor = getCachedObservablePropDescriptor(key);\n var descriptor = {\n configurable: globalState.safeDescriptors ? this.isPlainObject_ : true,\n enumerable: false,\n get: cachedDescriptor.get,\n set: cachedDescriptor.set\n };\n // Define\n if (proxyTrap) {\n if (!Reflect.defineProperty(this.target_, key, descriptor)) {\n return false;\n }\n } else {\n defineProperty(this.target_, key, descriptor);\n }\n this.values_.set(key, new ComputedValue(options));\n // Notify\n this.notifyPropertyAddition_(key, undefined);\n } finally {\n endBatch();\n }\n return true;\n }\n /**\n * @param {PropertyKey} key\n * @param {PropertyDescriptor} descriptor\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.delete_ = function delete_(key, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n // No such prop\n if (!hasProp(this.target_, key)) {\n return true;\n }\n // Intercept\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: REMOVE\n });\n // Cancelled\n if (!change) {\n return null;\n }\n }\n // Delete\n try {\n var _this$pendingKeys_;\n startBatch();\n var notify = hasListeners(this);\n var notifySpy = true && isSpyEnabled();\n var observable = this.values_.get(key);\n // Value needed for spies/listeners\n var value = undefined;\n // Optimization: don't pull the value unless we will need it\n if (!observable && (notify || notifySpy)) {\n var _getDescriptor;\n value = (_getDescriptor = getDescriptor(this.target_, key)) == null ? void 0 : _getDescriptor.value;\n }\n // delete prop (do first, may fail)\n if (proxyTrap) {\n if (!Reflect.deleteProperty(this.target_, key)) {\n return false;\n }\n } else {\n delete this.target_[key];\n }\n // Allow re-annotating this field\n if (true) {\n delete this.appliedAnnotations_[key];\n }\n // Clear observable\n if (observable) {\n this.values_[\"delete\"](key);\n // for computed, value is undefined\n if (observable instanceof ObservableValue) {\n value = observable.value_;\n }\n // Notify: autorun(() => obj[key]), see #1796\n propagateChanged(observable);\n }\n // Notify \"keys/entries/values\" observers\n this.keysAtom_.reportChanged();\n // Notify \"has\" observers\n // \"in\" as it may still exist in proto\n (_this$pendingKeys_ = this.pendingKeys_) == null || (_this$pendingKeys_ = _this$pendingKeys_.get(key)) == null || _this$pendingKeys_.set(key in this.target_);\n // Notify spies/listeners\n if (notify || notifySpy) {\n var _change2 = {\n type: REMOVE,\n observableKind: \"object\",\n object: this.proxy_ || this.target_,\n debugObjectName: this.name_,\n oldValue: value,\n name: key\n };\n if ( true && notifySpy) {\n spyReportStart(_change2);\n }\n if (notify) {\n notifyListeners(this, _change2);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n } finally {\n endBatch();\n }\n return true;\n }\n /**\n * Observes this object. Triggers for the events 'add', 'update' and 'delete'.\n * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe\n * for callback details\n */;\n _proto.observe_ = function observe_(callback, fireImmediately) {\n if ( true && fireImmediately === true) {\n die(\"`observe` doesn't support the fire immediately property for observable objects.\");\n }\n return registerListener(this, callback);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.notifyPropertyAddition_ = function notifyPropertyAddition_(key, value) {\n var _this$pendingKeys_2;\n var notify = hasListeners(this);\n var notifySpy = true && isSpyEnabled();\n if (notify || notifySpy) {\n var change = notify || notifySpy ? {\n type: ADD,\n observableKind: \"object\",\n debugObjectName: this.name_,\n object: this.proxy_ || this.target_,\n name: key,\n newValue: value\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n }\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n (_this$pendingKeys_2 = this.pendingKeys_) == null || (_this$pendingKeys_2 = _this$pendingKeys_2.get(key)) == null || _this$pendingKeys_2.set(true);\n // Notify \"keys/entries/values\" observers\n this.keysAtom_.reportChanged();\n };\n _proto.ownKeys_ = function ownKeys_() {\n this.keysAtom_.reportObserved();\n return ownKeys(this.target_);\n };\n _proto.keys_ = function keys_() {\n // Returns enumerable && own, but unfortunately keysAtom will report on ANY key change.\n // There is no way to distinguish between Object.keys(object) and Reflect.ownKeys(object) - both are handled by ownKeys trap.\n // We can either over-report in Object.keys(object) or under-report in Reflect.ownKeys(object)\n // We choose to over-report in Object.keys(object), because:\n // - typically it's used with simple data objects\n // - when symbolic/non-enumerable keys are relevant Reflect.ownKeys works as expected\n this.keysAtom_.reportObserved();\n return Object.keys(this.target_);\n };\n return ObservableObjectAdministration;\n}();\nfunction asObservableObject(target, options) {\n var _options$name;\n if ( true && options && isObservableObject(target)) {\n die(\"Options can't be provided for already observable objects.\");\n }\n if (hasProp(target, $mobx)) {\n if ( true && !(getAdministration(target) instanceof ObservableObjectAdministration)) {\n die(\"Cannot convert '\" + getDebugName(target) + \"' into observable object:\" + \"\\nThe target is already observable of different type.\" + \"\\nExtending builtins is not supported.\");\n }\n return target;\n }\n if ( true && !Object.isExtensible(target)) {\n die(\"Cannot make the designated object observable; it is not extensible\");\n }\n var name = (_options$name = options == null ? void 0 : options.name) != null ? _options$name : true ? (isPlainObject(target) ? \"ObservableObject\" : target.constructor.name) + \"@\" + getNextId() : 0;\n var adm = new ObservableObjectAdministration(target, new Map(), String(name), getAnnotationFromOptions(options));\n addHiddenProp(target, $mobx, adm);\n return target;\n}\nvar isObservableObjectAdministration = /*#__PURE__*/createInstanceofPredicate(\"ObservableObjectAdministration\", ObservableObjectAdministration);\nfunction getCachedObservablePropDescriptor(key) {\n return descriptorCache[key] || (descriptorCache[key] = {\n get: function get() {\n return this[$mobx].getObservablePropValue_(key);\n },\n set: function set(value) {\n return this[$mobx].setObservablePropValue_(key, value);\n }\n });\n}\nfunction isObservableObject(thing) {\n if (isObject(thing)) {\n return isObservableObjectAdministration(thing[$mobx]);\n }\n return false;\n}\nfunction recordAnnotationApplied(adm, annotation, key) {\n var _adm$target_$storedAn;\n if (true) {\n adm.appliedAnnotations_[key] = annotation;\n }\n // Remove applied decorator annotation so we don't try to apply it again in subclass constructor\n (_adm$target_$storedAn = adm.target_[storedAnnotationsSymbol]) == null || delete _adm$target_$storedAn[key];\n}\nfunction assertAnnotable(adm, annotation, key) {\n // Valid annotation\n if ( true && !isAnnotation(annotation)) {\n die(\"Cannot annotate '\" + adm.name_ + \".\" + key.toString() + \"': Invalid annotation.\");\n }\n /*\n // Configurable, not sealed, not frozen\n // Possibly not needed, just a little better error then the one thrown by engine.\n // Cases where this would be useful the most (subclass field initializer) are not interceptable by this.\n if (__DEV__) {\n const configurable = getDescriptor(adm.target_, key)?.configurable\n const frozen = Object.isFrozen(adm.target_)\n const sealed = Object.isSealed(adm.target_)\n if (!configurable || frozen || sealed) {\n const fieldName = `${adm.name_}.${key.toString()}`\n const requestedAnnotationType = annotation.annotationType_\n let error = `Cannot apply '${requestedAnnotationType}' to '${fieldName}':`\n if (frozen) {\n error += `\\nObject is frozen.`\n }\n if (sealed) {\n error += `\\nObject is sealed.`\n }\n if (!configurable) {\n error += `\\nproperty is not configurable.`\n // Mention only if caused by us to avoid confusion\n if (hasProp(adm.appliedAnnotations!, key)) {\n error += `\\nTo prevent accidental re-definition of a field by a subclass, `\n error += `all annotated fields of non-plain objects (classes) are not configurable.`\n }\n }\n die(error)\n }\n }\n */\n // Not annotated\n if ( true && !isOverride(annotation) && hasProp(adm.appliedAnnotations_, key)) {\n var fieldName = adm.name_ + \".\" + key.toString();\n var currentAnnotationType = adm.appliedAnnotations_[key].annotationType_;\n var requestedAnnotationType = annotation.annotationType_;\n die(\"Cannot apply '\" + requestedAnnotationType + \"' to '\" + fieldName + \"':\" + (\"\\nThe field is already annotated with '\" + currentAnnotationType + \"'.\") + \"\\nRe-annotating fields is not allowed.\" + \"\\nUse 'override' annotation for methods overridden by subclass.\");\n }\n}\n\n// Bug in safari 9.* (or iOS 9 safari mobile). See #364\nvar ENTRY_0 = /*#__PURE__*/createArrayEntryDescriptor(0);\nvar safariPrototypeSetterInheritanceBug = /*#__PURE__*/function () {\n var v = false;\n var p = {};\n Object.defineProperty(p, \"0\", {\n set: function set() {\n v = true;\n }\n });\n /*#__PURE__*/Object.create(p)[\"0\"] = 1;\n return v === false;\n}();\n/**\n * This array buffer contains two lists of properties, so that all arrays\n * can recycle their property definitions, which significantly improves performance of creating\n * properties on the fly.\n */\nvar OBSERVABLE_ARRAY_BUFFER_SIZE = 0;\n// Typescript workaround to make sure ObservableArray extends Array\nvar StubArray = function StubArray() {};\nfunction inherit(ctor, proto) {\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(ctor.prototype, proto);\n } else if (ctor.prototype.__proto__ !== undefined) {\n ctor.prototype.__proto__ = proto;\n } else {\n ctor.prototype = proto;\n }\n}\ninherit(StubArray, Array.prototype);\n// Weex proto freeze protection was here,\n// but it is unclear why the hack is need as MobX never changed the prototype\n// anyway, so removed it in V6\nvar LegacyObservableArray = /*#__PURE__*/function (_StubArray) {\n function LegacyObservableArray(initialValues, enhancer, name, owned) {\n var _this;\n if (name === void 0) {\n name = true ? \"ObservableArray@\" + getNextId() : 0;\n }\n if (owned === void 0) {\n owned = false;\n }\n _this = _StubArray.call(this) || this;\n initObservable(function () {\n var adm = new ObservableArrayAdministration(name, enhancer, owned, true);\n adm.proxy_ = _this;\n addHiddenFinalProp(_this, $mobx, adm);\n if (initialValues && initialValues.length) {\n // @ts-ignore\n _this.spliceWithArray(0, 0, initialValues);\n }\n if (safariPrototypeSetterInheritanceBug) {\n // Seems that Safari won't use numeric prototype setter until any * numeric property is\n // defined on the instance. After that it works fine, even if this property is deleted.\n Object.defineProperty(_this, \"0\", ENTRY_0);\n }\n });\n return _this;\n }\n _inheritsLoose(LegacyObservableArray, _StubArray);\n var _proto = LegacyObservableArray.prototype;\n _proto.concat = function concat() {\n this[$mobx].atom_.reportObserved();\n for (var _len = arguments.length, arrays = new Array(_len), _key = 0; _key < _len; _key++) {\n arrays[_key] = arguments[_key];\n }\n return Array.prototype.concat.apply(this.slice(),\n //@ts-ignore\n arrays.map(function (a) {\n return isObservableArray(a) ? a.slice() : a;\n }));\n };\n _proto[Symbol.iterator] = function () {\n var self = this;\n var nextIndex = 0;\n return makeIterable({\n next: function next() {\n return nextIndex < self.length ? {\n value: self[nextIndex++],\n done: false\n } : {\n done: true,\n value: undefined\n };\n }\n });\n };\n return _createClass(LegacyObservableArray, [{\n key: \"length\",\n get: function get() {\n return this[$mobx].getArrayLength_();\n },\n set: function set(newLength) {\n this[$mobx].setArrayLength_(newLength);\n }\n }, {\n key: Symbol.toStringTag,\n get: function get() {\n return \"Array\";\n }\n }]);\n}(StubArray);\nObject.entries(arrayExtensions).forEach(function (_ref) {\n var prop = _ref[0],\n fn = _ref[1];\n if (prop !== \"concat\") {\n addHiddenProp(LegacyObservableArray.prototype, prop, fn);\n }\n});\nfunction createArrayEntryDescriptor(index) {\n return {\n enumerable: false,\n configurable: true,\n get: function get() {\n return this[$mobx].get_(index);\n },\n set: function set(value) {\n this[$mobx].set_(index, value);\n }\n };\n}\nfunction createArrayBufferItem(index) {\n defineProperty(LegacyObservableArray.prototype, \"\" + index, createArrayEntryDescriptor(index));\n}\nfunction reserveArrayBuffer(max) {\n if (max > OBSERVABLE_ARRAY_BUFFER_SIZE) {\n for (var index = OBSERVABLE_ARRAY_BUFFER_SIZE; index < max + 100; index++) {\n createArrayBufferItem(index);\n }\n OBSERVABLE_ARRAY_BUFFER_SIZE = max;\n }\n}\nreserveArrayBuffer(1000);\nfunction createLegacyArray(initialValues, enhancer, name) {\n return new LegacyObservableArray(initialValues, enhancer, name);\n}\n\nfunction getAtom(thing, property) {\n if (typeof thing === \"object\" && thing !== null) {\n if (isObservableArray(thing)) {\n if (property !== undefined) {\n die(23);\n }\n return thing[$mobx].atom_;\n }\n if (isObservableSet(thing)) {\n return thing.atom_;\n }\n if (isObservableMap(thing)) {\n if (property === undefined) {\n return thing.keysAtom_;\n }\n var observable = thing.data_.get(property) || thing.hasMap_.get(property);\n if (!observable) {\n die(25, property, getDebugName(thing));\n }\n return observable;\n }\n if (isObservableObject(thing)) {\n if (!property) {\n return die(26);\n }\n var _observable = thing[$mobx].values_.get(property);\n if (!_observable) {\n die(27, property, getDebugName(thing));\n }\n return _observable;\n }\n if (isAtom(thing) || isComputedValue(thing) || isReaction(thing)) {\n return thing;\n }\n } else if (isFunction(thing)) {\n if (isReaction(thing[$mobx])) {\n // disposer function\n return thing[$mobx];\n }\n }\n die(28);\n}\nfunction getAdministration(thing, property) {\n if (!thing) {\n die(29);\n }\n if (property !== undefined) {\n return getAdministration(getAtom(thing, property));\n }\n if (isAtom(thing) || isComputedValue(thing) || isReaction(thing)) {\n return thing;\n }\n if (isObservableMap(thing) || isObservableSet(thing)) {\n return thing;\n }\n if (thing[$mobx]) {\n return thing[$mobx];\n }\n die(24, thing);\n}\nfunction getDebugName(thing, property) {\n var named;\n if (property !== undefined) {\n named = getAtom(thing, property);\n } else if (isAction(thing)) {\n return thing.name;\n } else if (isObservableObject(thing) || isObservableMap(thing) || isObservableSet(thing)) {\n named = getAdministration(thing);\n } else {\n // valid for arrays as well\n named = getAtom(thing);\n }\n return named.name_;\n}\n/**\n * Helper function for initializing observable structures, it applies:\n * 1. allowStateChanges so we don't violate enforceActions.\n * 2. untracked so we don't accidentaly subscribe to anything observable accessed during init in case the observable is created inside derivation.\n * 3. batch to avoid state version updates\n */\nfunction initObservable(cb) {\n var derivation = untrackedStart();\n var allowStateChanges = allowStateChangesStart(true);\n startBatch();\n try {\n return cb();\n } finally {\n endBatch();\n allowStateChangesEnd(allowStateChanges);\n untrackedEnd(derivation);\n }\n}\n\nvar toString = objectPrototype.toString;\nfunction deepEqual(a, b, depth) {\n if (depth === void 0) {\n depth = -1;\n }\n return eq(a, b, depth);\n}\n// Copied from https://github.com/jashkenas/underscore/blob/5c237a7c682fb68fd5378203f0bf22dce1624854/underscore.js#L1186-L1289\n// Internal recursive comparison function for `isEqual`.\nfunction eq(a, b, depth, aStack, bStack) {\n // Identical objects are equal. `0 === -0`, but they aren't identical.\n // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).\n if (a === b) {\n return a !== 0 || 1 / a === 1 / b;\n }\n // `null` or `undefined` only equal to itself (strict comparison).\n if (a == null || b == null) {\n return false;\n }\n // `NaN`s are equivalent, but non-reflexive.\n if (a !== a) {\n return b !== b;\n }\n // Exhaust primitive checks\n var type = typeof a;\n if (type !== \"function\" && type !== \"object\" && typeof b != \"object\") {\n return false;\n }\n // Compare `[[Class]]` names.\n var className = toString.call(a);\n if (className !== toString.call(b)) {\n return false;\n }\n switch (className) {\n // Strings, numbers, regular expressions, dates, and booleans are compared by value.\n case \"[object RegExp]\":\n // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i')\n case \"[object String]\":\n // Primitives and their corresponding object wrappers are equivalent; thus, `\"5\"` is\n // equivalent to `new String(\"5\")`.\n return \"\" + a === \"\" + b;\n case \"[object Number]\":\n // `NaN`s are equivalent, but non-reflexive.\n // Object(NaN) is equivalent to NaN.\n if (+a !== +a) {\n return +b !== +b;\n }\n // An `egal` comparison is performed for other numeric values.\n return +a === 0 ? 1 / +a === 1 / b : +a === +b;\n case \"[object Date]\":\n case \"[object Boolean]\":\n // Coerce dates and booleans to numeric primitive values. Dates are compared by their\n // millisecond representations. Note that invalid dates with millisecond representations\n // of `NaN` are not equivalent.\n return +a === +b;\n case \"[object Symbol]\":\n return typeof Symbol !== \"undefined\" && Symbol.valueOf.call(a) === Symbol.valueOf.call(b);\n case \"[object Map]\":\n case \"[object Set]\":\n // Maps and Sets are unwrapped to arrays of entry-pairs, adding an incidental level.\n // Hide this extra level by increasing the depth.\n if (depth >= 0) {\n depth++;\n }\n break;\n }\n // Unwrap any wrapped objects.\n a = unwrap(a);\n b = unwrap(b);\n var areArrays = className === \"[object Array]\";\n if (!areArrays) {\n if (typeof a != \"object\" || typeof b != \"object\") {\n return false;\n }\n // Objects with different constructors are not equivalent, but `Object`s or `Array`s\n // from different frames are.\n var aCtor = a.constructor,\n bCtor = b.constructor;\n if (aCtor !== bCtor && !(isFunction(aCtor) && aCtor instanceof aCtor && isFunction(bCtor) && bCtor instanceof bCtor) && \"constructor\" in a && \"constructor\" in b) {\n return false;\n }\n }\n if (depth === 0) {\n return false;\n } else if (depth < 0) {\n depth = -1;\n }\n // Assume equality for cyclic structures. The algorithm for detecting cyclic\n // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.\n // Initializing stack of traversed objects.\n // It's done here since we only need them for objects and arrays comparison.\n aStack = aStack || [];\n bStack = bStack || [];\n var length = aStack.length;\n while (length--) {\n // Linear search. Performance is inversely proportional to the number of\n // unique nested structures.\n if (aStack[length] === a) {\n return bStack[length] === b;\n }\n }\n // Add the first object to the stack of traversed objects.\n aStack.push(a);\n bStack.push(b);\n // Recursively compare objects and arrays.\n if (areArrays) {\n // Compare array lengths to determine if a deep comparison is necessary.\n length = a.length;\n if (length !== b.length) {\n return false;\n }\n // Deep compare the contents, ignoring non-numeric properties.\n while (length--) {\n if (!eq(a[length], b[length], depth - 1, aStack, bStack)) {\n return false;\n }\n }\n } else {\n // Deep compare objects.\n var keys = Object.keys(a);\n var key;\n length = keys.length;\n // Ensure that both objects contain the same number of properties before comparing deep equality.\n if (Object.keys(b).length !== length) {\n return false;\n }\n while (length--) {\n // Deep compare each member\n key = keys[length];\n if (!(hasProp(b, key) && eq(a[key], b[key], depth - 1, aStack, bStack))) {\n return false;\n }\n }\n }\n // Remove the first object from the stack of traversed objects.\n aStack.pop();\n bStack.pop();\n return true;\n}\nfunction unwrap(a) {\n if (isObservableArray(a)) {\n return a.slice();\n }\n if (isES6Map(a) || isObservableMap(a)) {\n return Array.from(a.entries());\n }\n if (isES6Set(a) || isObservableSet(a)) {\n return Array.from(a.entries());\n }\n return a;\n}\n\nfunction makeIterable(iterator) {\n iterator[Symbol.iterator] = getSelf;\n return iterator;\n}\nfunction getSelf() {\n return this;\n}\n\nfunction isAnnotation(thing) {\n return (\n // Can be function\n thing instanceof Object && typeof thing.annotationType_ === \"string\" && isFunction(thing.make_) && isFunction(thing.extend_)\n );\n}\n\n/**\n * (c) Michel Weststrate 2015 - 2020\n * MIT Licensed\n *\n * Welcome to the mobx sources! To get a global overview of how MobX internally works,\n * this is a good place to start:\n * https://medium.com/@mweststrate/becoming-fully-reactive-an-in-depth-explanation-of-mobservable-55995262a254#.xvbh6qd74\n *\n * Source folders:\n * ===============\n *\n * - api/ Most of the public static methods exposed by the module can be found here.\n * - core/ Implementation of the MobX algorithm; atoms, derivations, reactions, dependency trees, optimizations. Cool stuff can be found here.\n * - types/ All the magic that is need to have observable objects, arrays and values is in this folder. Including the modifiers like `asFlat`.\n * - utils/ Utility stuff.\n *\n */\n[\"Symbol\", \"Map\", \"Set\"].forEach(function (m) {\n var g = getGlobal();\n if (typeof g[m] === \"undefined\") {\n die(\"MobX requires global '\" + m + \"' to be available or polyfilled\");\n }\n});\nif (typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__ === \"object\") {\n // See: https://github.com/andykog/mobx-devtools/\n __MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({\n spy: spy,\n extras: {\n getDebugName: getDebugName\n },\n $mobx: $mobx\n });\n}\n\n\n//# sourceMappingURL=mobx.esm.js.map\n\n\n//# sourceURL=webpack://app_adyen_SFRA/./node_modules/mobx/dist/mobx.esm.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ $mobx: () => (/* binding */ $mobx),\n/* harmony export */ FlowCancellationError: () => (/* binding */ FlowCancellationError),\n/* harmony export */ ObservableMap: () => (/* binding */ ObservableMap),\n/* harmony export */ ObservableSet: () => (/* binding */ ObservableSet),\n/* harmony export */ Reaction: () => (/* binding */ Reaction),\n/* harmony export */ _allowStateChanges: () => (/* binding */ allowStateChanges),\n/* harmony export */ _allowStateChangesInsideComputed: () => (/* binding */ runInAction),\n/* harmony export */ _allowStateReadsEnd: () => (/* binding */ allowStateReadsEnd),\n/* harmony export */ _allowStateReadsStart: () => (/* binding */ allowStateReadsStart),\n/* harmony export */ _autoAction: () => (/* binding */ autoAction),\n/* harmony export */ _endAction: () => (/* binding */ _endAction),\n/* harmony export */ _getAdministration: () => (/* binding */ getAdministration),\n/* harmony export */ _getGlobalState: () => (/* binding */ getGlobalState),\n/* harmony export */ _interceptReads: () => (/* binding */ interceptReads),\n/* harmony export */ _isComputingDerivation: () => (/* binding */ isComputingDerivation),\n/* harmony export */ _resetGlobalState: () => (/* binding */ resetGlobalState),\n/* harmony export */ _startAction: () => (/* binding */ _startAction),\n/* harmony export */ action: () => (/* binding */ action),\n/* harmony export */ autorun: () => (/* binding */ autorun),\n/* harmony export */ comparer: () => (/* binding */ comparer),\n/* harmony export */ computed: () => (/* binding */ computed),\n/* harmony export */ configure: () => (/* binding */ configure),\n/* harmony export */ createAtom: () => (/* binding */ createAtom),\n/* harmony export */ defineProperty: () => (/* binding */ apiDefineProperty),\n/* harmony export */ entries: () => (/* binding */ entries),\n/* harmony export */ extendObservable: () => (/* binding */ extendObservable),\n/* harmony export */ flow: () => (/* binding */ flow),\n/* harmony export */ flowResult: () => (/* binding */ flowResult),\n/* harmony export */ get: () => (/* binding */ get),\n/* harmony export */ getAtom: () => (/* binding */ getAtom),\n/* harmony export */ getDebugName: () => (/* binding */ getDebugName),\n/* harmony export */ getDependencyTree: () => (/* binding */ getDependencyTree),\n/* harmony export */ getObserverTree: () => (/* binding */ getObserverTree),\n/* harmony export */ has: () => (/* binding */ has),\n/* harmony export */ intercept: () => (/* binding */ intercept),\n/* harmony export */ isAction: () => (/* binding */ isAction),\n/* harmony export */ isBoxedObservable: () => (/* binding */ isObservableValue),\n/* harmony export */ isComputed: () => (/* binding */ isComputed),\n/* harmony export */ isComputedProp: () => (/* binding */ isComputedProp),\n/* harmony export */ isFlow: () => (/* binding */ isFlow),\n/* harmony export */ isFlowCancellationError: () => (/* binding */ isFlowCancellationError),\n/* harmony export */ isObservable: () => (/* binding */ isObservable),\n/* harmony export */ isObservableArray: () => (/* binding */ isObservableArray),\n/* harmony export */ isObservableMap: () => (/* binding */ isObservableMap),\n/* harmony export */ isObservableObject: () => (/* binding */ isObservableObject),\n/* harmony export */ isObservableProp: () => (/* binding */ isObservableProp),\n/* harmony export */ isObservableSet: () => (/* binding */ isObservableSet),\n/* harmony export */ keys: () => (/* binding */ keys),\n/* harmony export */ makeAutoObservable: () => (/* binding */ makeAutoObservable),\n/* harmony export */ makeObservable: () => (/* binding */ makeObservable),\n/* harmony export */ observable: () => (/* binding */ observable),\n/* harmony export */ observe: () => (/* binding */ observe),\n/* harmony export */ onBecomeObserved: () => (/* binding */ onBecomeObserved),\n/* harmony export */ onBecomeUnobserved: () => (/* binding */ onBecomeUnobserved),\n/* harmony export */ onReactionError: () => (/* binding */ onReactionError),\n/* harmony export */ override: () => (/* binding */ override),\n/* harmony export */ ownKeys: () => (/* binding */ apiOwnKeys),\n/* harmony export */ reaction: () => (/* binding */ reaction),\n/* harmony export */ remove: () => (/* binding */ remove),\n/* harmony export */ runInAction: () => (/* binding */ runInAction),\n/* harmony export */ set: () => (/* binding */ set),\n/* harmony export */ spy: () => (/* binding */ spy),\n/* harmony export */ toJS: () => (/* binding */ toJS),\n/* harmony export */ trace: () => (/* binding */ trace),\n/* harmony export */ transaction: () => (/* binding */ transaction),\n/* harmony export */ untracked: () => (/* binding */ untracked),\n/* harmony export */ values: () => (/* binding */ values),\n/* harmony export */ when: () => (/* binding */ when)\n/* harmony export */ });\nvar niceErrors = {\n 0: \"Invalid value for configuration 'enforceActions', expected 'never', 'always' or 'observed'\",\n 1: function _(annotationType, key) {\n return \"Cannot apply '\" + annotationType + \"' to '\" + key.toString() + \"': Field not found.\";\n },\n /*\n 2(prop) {\n return `invalid decorator for '${prop.toString()}'`\n },\n 3(prop) {\n return `Cannot decorate '${prop.toString()}': action can only be used on properties with a function value.`\n },\n 4(prop) {\n return `Cannot decorate '${prop.toString()}': computed can only be used on getter properties.`\n },\n */\n 5: \"'keys()' can only be used on observable objects, arrays, sets and maps\",\n 6: \"'values()' can only be used on observable objects, arrays, sets and maps\",\n 7: \"'entries()' can only be used on observable objects, arrays and maps\",\n 8: \"'set()' can only be used on observable objects, arrays and maps\",\n 9: \"'remove()' can only be used on observable objects, arrays and maps\",\n 10: \"'has()' can only be used on observable objects, arrays and maps\",\n 11: \"'get()' can only be used on observable objects, arrays and maps\",\n 12: \"Invalid annotation\",\n 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)\",\n 14: \"Intercept handlers should return nothing or a change object\",\n 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)\",\n 16: \"Modification exception: the internal structure of an observable array was changed.\",\n 17: function _(index, length) {\n return \"[mobx.array] Index out of bounds, \" + index + \" is larger than \" + length;\n },\n 18: \"mobx.map requires Map polyfill for the current browser. Check babel-polyfill or core-js/es6/map.js\",\n 19: function _(other) {\n return \"Cannot initialize from classes that inherit from Map: \" + other.constructor.name;\n },\n 20: function _(other) {\n return \"Cannot initialize map from \" + other;\n },\n 21: function _(dataStructure) {\n return \"Cannot convert to map from '\" + dataStructure + \"'\";\n },\n 22: \"mobx.set requires Set polyfill for the current browser. Check babel-polyfill or core-js/es6/set.js\",\n 23: \"It is not possible to get index atoms from arrays\",\n 24: function _(thing) {\n return \"Cannot obtain administration from \" + thing;\n },\n 25: function _(property, name) {\n return \"the entry '\" + property + \"' does not exist in the observable map '\" + name + \"'\";\n },\n 26: \"please specify a property\",\n 27: function _(property, name) {\n return \"no observable property '\" + property.toString() + \"' found on the observable object '\" + name + \"'\";\n },\n 28: function _(thing) {\n return \"Cannot obtain atom from \" + thing;\n },\n 29: \"Expecting some object\",\n 30: \"invalid action stack. did you forget to finish an action?\",\n 31: \"missing option for computed: get\",\n 32: function _(name, derivation) {\n return \"Cycle detected in computation \" + name + \": \" + derivation;\n },\n 33: function _(name) {\n return \"The setter of computed value '\" + name + \"' is trying to update itself. Did you intend to update an _observable_ value, instead of the computed property?\";\n },\n 34: function _(name) {\n return \"[ComputedValue '\" + name + \"'] It is not possible to assign a new value to a computed value.\";\n },\n 35: \"There are multiple, different versions of MobX active. Make sure MobX is loaded only once or use `configure({ isolateGlobalState: true })`\",\n 36: \"isolateGlobalState should be called before MobX is running any reactions\",\n 37: function _(method) {\n return \"[mobx] `observableArray.\" + method + \"()` mutates the array in-place, which is not allowed inside a derivation. Use `array.slice().\" + method + \"()` instead\";\n },\n 38: \"'ownKeys()' can only be used on observable objects\",\n 39: \"'defineProperty()' can only be used on observable objects\"\n};\nvar errors = true ? niceErrors : 0;\nfunction die(error) {\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n if (true) {\n var e = typeof error === \"string\" ? error : errors[error];\n if (typeof e === \"function\") e = e.apply(null, args);\n throw new Error(\"[MobX] \" + e);\n }\n throw new Error(typeof error === \"number\" ? \"[MobX] minified error nr: \" + error + (args.length ? \" \" + args.map(String).join(\",\") : \"\") + \". Find the full error at: https://github.com/mobxjs/mobx/blob/main/packages/mobx/src/errors.ts\" : \"[MobX] \" + error);\n}\n\nvar mockGlobal = {};\nfunction getGlobal() {\n if (typeof globalThis !== \"undefined\") {\n return globalThis;\n }\n if (typeof window !== \"undefined\") {\n return window;\n }\n if (typeof __webpack_require__.g !== \"undefined\") {\n return __webpack_require__.g;\n }\n if (typeof self !== \"undefined\") {\n return self;\n }\n return mockGlobal;\n}\n\n// We shorten anything used > 5 times\nvar assign = Object.assign;\nvar getDescriptor = Object.getOwnPropertyDescriptor;\nvar defineProperty = Object.defineProperty;\nvar objectPrototype = Object.prototype;\nvar EMPTY_ARRAY = [];\nObject.freeze(EMPTY_ARRAY);\nvar EMPTY_OBJECT = {};\nObject.freeze(EMPTY_OBJECT);\nvar hasProxy = typeof Proxy !== \"undefined\";\nvar plainObjectString = /*#__PURE__*/Object.toString();\nfunction assertProxies() {\n if (!hasProxy) {\n die( true ? \"`Proxy` objects are not available in the current environment. Please configure MobX to enable a fallback implementation.`\" : 0);\n }\n}\nfunction warnAboutProxyRequirement(msg) {\n if ( true && globalState.verifyProxies) {\n die(\"MobX is currently configured to be able to run in ES5 mode, but in ES5 MobX won't be able to \" + msg);\n }\n}\nfunction getNextId() {\n return ++globalState.mobxGuid;\n}\n/**\n * Makes sure that the provided function is invoked at most once.\n */\nfunction once(func) {\n var invoked = false;\n return function () {\n if (invoked) {\n return;\n }\n invoked = true;\n return func.apply(this, arguments);\n };\n}\nvar noop = function noop() {};\nfunction isFunction(fn) {\n return typeof fn === \"function\";\n}\nfunction isStringish(value) {\n var t = typeof value;\n switch (t) {\n case \"string\":\n case \"symbol\":\n case \"number\":\n return true;\n }\n return false;\n}\nfunction isObject(value) {\n return value !== null && typeof value === \"object\";\n}\nfunction isPlainObject(value) {\n if (!isObject(value)) {\n return false;\n }\n var proto = Object.getPrototypeOf(value);\n if (proto == null) {\n return true;\n }\n var protoConstructor = Object.hasOwnProperty.call(proto, \"constructor\") && proto.constructor;\n return typeof protoConstructor === \"function\" && protoConstructor.toString() === plainObjectString;\n}\n// https://stackoverflow.com/a/37865170\nfunction isGenerator(obj) {\n var constructor = obj == null ? void 0 : obj.constructor;\n if (!constructor) {\n return false;\n }\n if (\"GeneratorFunction\" === constructor.name || \"GeneratorFunction\" === constructor.displayName) {\n return true;\n }\n return false;\n}\nfunction addHiddenProp(object, propName, value) {\n defineProperty(object, propName, {\n enumerable: false,\n writable: true,\n configurable: true,\n value: value\n });\n}\nfunction addHiddenFinalProp(object, propName, value) {\n defineProperty(object, propName, {\n enumerable: false,\n writable: false,\n configurable: true,\n value: value\n });\n}\nfunction createInstanceofPredicate(name, theClass) {\n var propName = \"isMobX\" + name;\n theClass.prototype[propName] = true;\n return function (x) {\n return isObject(x) && x[propName] === true;\n };\n}\n/**\n * Yields true for both native and observable Map, even across different windows.\n */\nfunction isES6Map(thing) {\n return thing != null && Object.prototype.toString.call(thing) === \"[object Map]\";\n}\n/**\n * Makes sure a Map is an instance of non-inherited native or observable Map.\n */\nfunction isPlainES6Map(thing) {\n var mapProto = Object.getPrototypeOf(thing);\n var objectProto = Object.getPrototypeOf(mapProto);\n var nullProto = Object.getPrototypeOf(objectProto);\n return nullProto === null;\n}\n/**\n * Yields true for both native and observable Set, even across different windows.\n */\nfunction isES6Set(thing) {\n return thing != null && Object.prototype.toString.call(thing) === \"[object Set]\";\n}\nvar hasGetOwnPropertySymbols = typeof Object.getOwnPropertySymbols !== \"undefined\";\n/**\n * Returns the following: own enumerable keys and symbols.\n */\nfunction getPlainObjectKeys(object) {\n var keys = Object.keys(object);\n // Not supported in IE, so there are not going to be symbol props anyway...\n if (!hasGetOwnPropertySymbols) {\n return keys;\n }\n var symbols = Object.getOwnPropertySymbols(object);\n if (!symbols.length) {\n return keys;\n }\n return [].concat(keys, symbols.filter(function (s) {\n return objectPrototype.propertyIsEnumerable.call(object, s);\n }));\n}\n// From Immer utils\n// Returns all own keys, including non-enumerable and symbolic\nvar ownKeys = typeof Reflect !== \"undefined\" && Reflect.ownKeys ? Reflect.ownKeys : hasGetOwnPropertySymbols ? function (obj) {\n return Object.getOwnPropertyNames(obj).concat(Object.getOwnPropertySymbols(obj));\n} : /* istanbul ignore next */Object.getOwnPropertyNames;\nfunction stringifyKey(key) {\n if (typeof key === \"string\") {\n return key;\n }\n if (typeof key === \"symbol\") {\n return key.toString();\n }\n return new String(key).toString();\n}\nfunction toPrimitive(value) {\n return value === null ? null : typeof value === \"object\" ? \"\" + value : value;\n}\nfunction hasProp(target, prop) {\n return objectPrototype.hasOwnProperty.call(target, prop);\n}\n// From Immer utils\nvar getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors || function getOwnPropertyDescriptors(target) {\n // Polyfill needed for Hermes and IE, see https://github.com/facebook/hermes/issues/274\n var res = {};\n // Note: without polyfill for ownKeys, symbols won't be picked up\n ownKeys(target).forEach(function (key) {\n res[key] = getDescriptor(target, key);\n });\n return res;\n};\nfunction getFlag(flags, mask) {\n return !!(flags & mask);\n}\nfunction setFlag(flags, mask, newValue) {\n if (newValue) {\n flags |= mask;\n } else {\n flags &= ~mask;\n }\n return flags;\n}\n\nfunction _arrayLikeToArray(r, a) {\n (null == a || a > r.length) && (a = r.length);\n for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];\n return n;\n}\nfunction _defineProperties(e, r) {\n for (var t = 0; t < r.length; t++) {\n var o = r[t];\n o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);\n }\n}\nfunction _createClass(e, r, t) {\n return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", {\n writable: !1\n }), e;\n}\nfunction _createForOfIteratorHelperLoose(r, e) {\n var t = \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"];\n if (t) return (t = t.call(r)).next.bind(t);\n if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && \"number\" == typeof r.length) {\n t && (r = t);\n var o = 0;\n return function () {\n return o >= r.length ? {\n done: !0\n } : {\n done: !1,\n value: r[o++]\n };\n };\n }\n throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\nfunction _extends() {\n return _extends = Object.assign ? Object.assign.bind() : function (n) {\n for (var e = 1; e < arguments.length; e++) {\n var t = arguments[e];\n for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);\n }\n return n;\n }, _extends.apply(null, arguments);\n}\nfunction _inheritsLoose(t, o) {\n t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);\n}\nfunction _setPrototypeOf(t, e) {\n return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {\n return t.__proto__ = e, t;\n }, _setPrototypeOf(t, e);\n}\nfunction _toPrimitive(t, r) {\n if (\"object\" != typeof t || !t) return t;\n var e = t[Symbol.toPrimitive];\n if (void 0 !== e) {\n var i = e.call(t, r || \"default\");\n if (\"object\" != typeof i) return i;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (\"string\" === r ? String : Number)(t);\n}\nfunction _toPropertyKey(t) {\n var i = _toPrimitive(t, \"string\");\n return \"symbol\" == typeof i ? i : i + \"\";\n}\nfunction _unsupportedIterableToArray(r, a) {\n if (r) {\n if (\"string\" == typeof r) return _arrayLikeToArray(r, a);\n var t = {}.toString.call(r).slice(8, -1);\n return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;\n }\n}\n\nvar storedAnnotationsSymbol = /*#__PURE__*/Symbol(\"mobx-stored-annotations\");\n/**\n * Creates a function that acts as\n * - decorator\n * - annotation object\n */\nfunction createDecoratorAnnotation(annotation) {\n function decorator(target, property) {\n if (is20223Decorator(property)) {\n return annotation.decorate_20223_(target, property);\n } else {\n storeAnnotation(target, property, annotation);\n }\n }\n return Object.assign(decorator, annotation);\n}\n/**\n * Stores annotation to prototype,\n * so it can be inspected later by `makeObservable` called from constructor\n */\nfunction storeAnnotation(prototype, key, annotation) {\n if (!hasProp(prototype, storedAnnotationsSymbol)) {\n addHiddenProp(prototype, storedAnnotationsSymbol, _extends({}, prototype[storedAnnotationsSymbol]));\n }\n // @override must override something\n if ( true && isOverride(annotation) && !hasProp(prototype[storedAnnotationsSymbol], key)) {\n var fieldName = prototype.constructor.name + \".prototype.\" + key.toString();\n die(\"'\" + fieldName + \"' is decorated with 'override', \" + \"but no such decorated member was found on prototype.\");\n }\n // Cannot re-decorate\n assertNotDecorated(prototype, annotation, key);\n // Ignore override\n if (!isOverride(annotation)) {\n prototype[storedAnnotationsSymbol][key] = annotation;\n }\n}\nfunction assertNotDecorated(prototype, annotation, key) {\n if ( true && !isOverride(annotation) && hasProp(prototype[storedAnnotationsSymbol], key)) {\n var fieldName = prototype.constructor.name + \".prototype.\" + key.toString();\n var currentAnnotationType = prototype[storedAnnotationsSymbol][key].annotationType_;\n var requestedAnnotationType = annotation.annotationType_;\n die(\"Cannot apply '@\" + requestedAnnotationType + \"' to '\" + fieldName + \"':\" + (\"\\nThe field is already decorated with '@\" + currentAnnotationType + \"'.\") + \"\\nRe-decorating fields is not allowed.\" + \"\\nUse '@override' decorator for methods overridden by subclass.\");\n }\n}\n/**\n * Collects annotations from prototypes and stores them on target (instance)\n */\nfunction collectStoredAnnotations(target) {\n if (!hasProp(target, storedAnnotationsSymbol)) {\n // if (__DEV__ && !target[storedAnnotationsSymbol]) {\n // die(\n // `No annotations were passed to makeObservable, but no decorated members have been found either`\n // )\n // }\n // We need a copy as we will remove annotation from the list once it's applied.\n addHiddenProp(target, storedAnnotationsSymbol, _extends({}, target[storedAnnotationsSymbol]));\n }\n return target[storedAnnotationsSymbol];\n}\nfunction is20223Decorator(context) {\n return typeof context == \"object\" && typeof context[\"kind\"] == \"string\";\n}\nfunction assert20223DecoratorType(context, types) {\n if ( true && !types.includes(context.kind)) {\n die(\"The decorator applied to '\" + String(context.name) + \"' cannot be used on a \" + context.kind + \" element\");\n }\n}\n\nvar $mobx = /*#__PURE__*/Symbol(\"mobx administration\");\nvar Atom = /*#__PURE__*/function () {\n /**\n * Create a new atom. For debugging purposes it is recommended to give it a name.\n * The onBecomeObserved and onBecomeUnobserved callbacks can be used for resource management.\n */\n function Atom(name_) {\n if (name_ === void 0) {\n name_ = true ? \"Atom@\" + getNextId() : 0;\n }\n this.name_ = void 0;\n this.flags_ = 0;\n this.observers_ = new Set();\n this.lastAccessedBy_ = 0;\n this.lowestObserverState_ = IDerivationState_.NOT_TRACKING_;\n // onBecomeObservedListeners\n this.onBOL = void 0;\n // onBecomeUnobservedListeners\n this.onBUOL = void 0;\n this.name_ = name_;\n }\n // for effective unobserving. BaseAtom has true, for extra optimization, so its onBecomeUnobserved never gets called, because it's not needed\n var _proto = Atom.prototype;\n _proto.onBO = function onBO() {\n if (this.onBOL) {\n this.onBOL.forEach(function (listener) {\n return listener();\n });\n }\n };\n _proto.onBUO = function onBUO() {\n if (this.onBUOL) {\n this.onBUOL.forEach(function (listener) {\n return listener();\n });\n }\n }\n /**\n * Invoke this method to notify mobx that your atom has been used somehow.\n * Returns true if there is currently a reactive context.\n */;\n _proto.reportObserved = function reportObserved$1() {\n return reportObserved(this);\n }\n /**\n * Invoke this method _after_ this method has changed to signal mobx that all its observers should invalidate.\n */;\n _proto.reportChanged = function reportChanged() {\n startBatch();\n propagateChanged(this);\n endBatch();\n };\n _proto.toString = function toString() {\n return this.name_;\n };\n return _createClass(Atom, [{\n key: \"isBeingObserved\",\n get: function get() {\n return getFlag(this.flags_, Atom.isBeingObservedMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Atom.isBeingObservedMask_, newValue);\n }\n }, {\n key: \"isPendingUnobservation\",\n get: function get() {\n return getFlag(this.flags_, Atom.isPendingUnobservationMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Atom.isPendingUnobservationMask_, newValue);\n }\n }, {\n key: \"diffValue\",\n get: function get() {\n return getFlag(this.flags_, Atom.diffValueMask_) ? 1 : 0;\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Atom.diffValueMask_, newValue === 1 ? true : false);\n }\n }]);\n}();\nAtom.isBeingObservedMask_ = 1;\nAtom.isPendingUnobservationMask_ = 2;\nAtom.diffValueMask_ = 4;\nvar isAtom = /*#__PURE__*/createInstanceofPredicate(\"Atom\", Atom);\nfunction createAtom(name, onBecomeObservedHandler, onBecomeUnobservedHandler) {\n if (onBecomeObservedHandler === void 0) {\n onBecomeObservedHandler = noop;\n }\n if (onBecomeUnobservedHandler === void 0) {\n onBecomeUnobservedHandler = noop;\n }\n var atom = new Atom(name);\n // default `noop` listener will not initialize the hook Set\n if (onBecomeObservedHandler !== noop) {\n onBecomeObserved(atom, onBecomeObservedHandler);\n }\n if (onBecomeUnobservedHandler !== noop) {\n onBecomeUnobserved(atom, onBecomeUnobservedHandler);\n }\n return atom;\n}\n\nfunction identityComparer(a, b) {\n return a === b;\n}\nfunction structuralComparer(a, b) {\n return deepEqual(a, b);\n}\nfunction shallowComparer(a, b) {\n return deepEqual(a, b, 1);\n}\nfunction defaultComparer(a, b) {\n if (Object.is) {\n return Object.is(a, b);\n }\n return a === b ? a !== 0 || 1 / a === 1 / b : a !== a && b !== b;\n}\nvar comparer = {\n identity: identityComparer,\n structural: structuralComparer,\n \"default\": defaultComparer,\n shallow: shallowComparer\n};\n\nfunction deepEnhancer(v, _, name) {\n // it is an observable already, done\n if (isObservable(v)) {\n return v;\n }\n // something that can be converted and mutated?\n if (Array.isArray(v)) {\n return observable.array(v, {\n name: name\n });\n }\n if (isPlainObject(v)) {\n return observable.object(v, undefined, {\n name: name\n });\n }\n if (isES6Map(v)) {\n return observable.map(v, {\n name: name\n });\n }\n if (isES6Set(v)) {\n return observable.set(v, {\n name: name\n });\n }\n if (typeof v === \"function\" && !isAction(v) && !isFlow(v)) {\n if (isGenerator(v)) {\n return flow(v);\n } else {\n return autoAction(name, v);\n }\n }\n return v;\n}\nfunction shallowEnhancer(v, _, name) {\n if (v === undefined || v === null) {\n return v;\n }\n if (isObservableObject(v) || isObservableArray(v) || isObservableMap(v) || isObservableSet(v)) {\n return v;\n }\n if (Array.isArray(v)) {\n return observable.array(v, {\n name: name,\n deep: false\n });\n }\n if (isPlainObject(v)) {\n return observable.object(v, undefined, {\n name: name,\n deep: false\n });\n }\n if (isES6Map(v)) {\n return observable.map(v, {\n name: name,\n deep: false\n });\n }\n if (isES6Set(v)) {\n return observable.set(v, {\n name: name,\n deep: false\n });\n }\n if (true) {\n die(\"The shallow modifier / decorator can only used in combination with arrays, objects, maps and sets\");\n }\n}\nfunction referenceEnhancer(newValue) {\n // never turn into an observable\n return newValue;\n}\nfunction refStructEnhancer(v, oldValue) {\n if ( true && isObservable(v)) {\n die(\"observable.struct should not be used with observable values\");\n }\n if (deepEqual(v, oldValue)) {\n return oldValue;\n }\n return v;\n}\n\nvar OVERRIDE = \"override\";\nvar override = /*#__PURE__*/createDecoratorAnnotation({\n annotationType_: OVERRIDE,\n make_: make_,\n extend_: extend_,\n decorate_20223_: decorate_20223_\n});\nfunction isOverride(annotation) {\n return annotation.annotationType_ === OVERRIDE;\n}\nfunction make_(adm, key) {\n // Must not be plain object\n if ( true && adm.isPlainObject_) {\n die(\"Cannot apply '\" + this.annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + this.annotationType_ + \"' cannot be used on plain objects.\"));\n }\n // Must override something\n if ( true && !hasProp(adm.appliedAnnotations_, key)) {\n die(\"'\" + adm.name_ + \".\" + key.toString() + \"' is annotated with '\" + this.annotationType_ + \"', \" + \"but no such annotated member was found on prototype.\");\n }\n return 0 /* MakeResult.Cancel */;\n}\nfunction extend_(adm, key, descriptor, proxyTrap) {\n die(\"'\" + this.annotationType_ + \"' can only be used with 'makeObservable'\");\n}\nfunction decorate_20223_(desc, context) {\n console.warn(\"'\" + this.annotationType_ + \"' cannot be used with decorators - this is a no-op\");\n}\n\nfunction createActionAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$1,\n extend_: extend_$1,\n decorate_20223_: decorate_20223_$1\n };\n}\nfunction make_$1(adm, key, descriptor, source) {\n var _this$options_;\n // bound\n if ((_this$options_ = this.options_) != null && _this$options_.bound) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;\n }\n // own\n if (source === adm.target_) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 2 /* MakeResult.Continue */;\n }\n // prototype\n if (isAction(descriptor.value)) {\n // A prototype could have been annotated already by other constructor,\n // rest of the proto chain must be annotated already\n return 1 /* MakeResult.Break */;\n }\n var actionDescriptor = createActionDescriptor(adm, this, key, descriptor, false);\n defineProperty(source, key, actionDescriptor);\n return 2 /* MakeResult.Continue */;\n}\nfunction extend_$1(adm, key, descriptor, proxyTrap) {\n var actionDescriptor = createActionDescriptor(adm, this, key, descriptor);\n return adm.defineProperty_(key, actionDescriptor, proxyTrap);\n}\nfunction decorate_20223_$1(mthd, context) {\n if (true) {\n assert20223DecoratorType(context, [\"method\", \"field\"]);\n }\n var kind = context.kind,\n name = context.name,\n addInitializer = context.addInitializer;\n var ann = this;\n var _createAction = function _createAction(m) {\n var _ann$options_$name, _ann$options_, _ann$options_$autoAct, _ann$options_2;\n return createAction((_ann$options_$name = (_ann$options_ = ann.options_) == null ? void 0 : _ann$options_.name) != null ? _ann$options_$name : name.toString(), m, (_ann$options_$autoAct = (_ann$options_2 = ann.options_) == null ? void 0 : _ann$options_2.autoAction) != null ? _ann$options_$autoAct : false);\n };\n if (kind == \"field\") {\n return function (initMthd) {\n var _ann$options_3;\n var mthd = initMthd;\n if (!isAction(mthd)) {\n mthd = _createAction(mthd);\n }\n if ((_ann$options_3 = ann.options_) != null && _ann$options_3.bound) {\n mthd = mthd.bind(this);\n mthd.isMobxAction = true;\n }\n return mthd;\n };\n }\n if (kind == \"method\") {\n var _this$options_2;\n if (!isAction(mthd)) {\n mthd = _createAction(mthd);\n }\n if ((_this$options_2 = this.options_) != null && _this$options_2.bound) {\n addInitializer(function () {\n var self = this;\n var bound = self[name].bind(self);\n bound.isMobxAction = true;\n self[name] = bound;\n });\n }\n return mthd;\n }\n die(\"Cannot apply '\" + ann.annotationType_ + \"' to '\" + String(name) + \"' (kind: \" + kind + \"):\" + (\"\\n'\" + ann.annotationType_ + \"' can only be used on properties with a function value.\"));\n}\nfunction assertActionDescriptor(adm, _ref, key, _ref2) {\n var annotationType_ = _ref.annotationType_;\n var value = _ref2.value;\n if ( true && !isFunction(value)) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' can only be used on properties with a function value.\"));\n }\n}\nfunction createActionDescriptor(adm, annotation, key, descriptor,\n// provides ability to disable safeDescriptors for prototypes\nsafeDescriptors) {\n var _annotation$options_, _annotation$options_$, _annotation$options_2, _annotation$options_$2, _annotation$options_3, _annotation$options_4, _adm$proxy_2;\n if (safeDescriptors === void 0) {\n safeDescriptors = globalState.safeDescriptors;\n }\n assertActionDescriptor(adm, annotation, key, descriptor);\n var value = descriptor.value;\n if ((_annotation$options_ = annotation.options_) != null && _annotation$options_.bound) {\n var _adm$proxy_;\n value = value.bind((_adm$proxy_ = adm.proxy_) != null ? _adm$proxy_ : adm.target_);\n }\n return {\n value: createAction((_annotation$options_$ = (_annotation$options_2 = annotation.options_) == null ? void 0 : _annotation$options_2.name) != null ? _annotation$options_$ : key.toString(), value, (_annotation$options_$2 = (_annotation$options_3 = annotation.options_) == null ? void 0 : _annotation$options_3.autoAction) != null ? _annotation$options_$2 : false,\n // https://github.com/mobxjs/mobx/discussions/3140\n (_annotation$options_4 = annotation.options_) != null && _annotation$options_4.bound ? (_adm$proxy_2 = adm.proxy_) != null ? _adm$proxy_2 : adm.target_ : undefined),\n // Non-configurable for classes\n // prevents accidental field redefinition in subclass\n configurable: safeDescriptors ? adm.isPlainObject_ : true,\n // https://github.com/mobxjs/mobx/pull/2641#issuecomment-737292058\n enumerable: false,\n // Non-obsevable, therefore non-writable\n // Also prevents rewriting in subclass constructor\n writable: safeDescriptors ? false : true\n };\n}\n\nfunction createFlowAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$2,\n extend_: extend_$2,\n decorate_20223_: decorate_20223_$2\n };\n}\nfunction make_$2(adm, key, descriptor, source) {\n var _this$options_;\n // own\n if (source === adm.target_) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 2 /* MakeResult.Continue */;\n }\n // prototype\n // bound - must annotate protos to support super.flow()\n if ((_this$options_ = this.options_) != null && _this$options_.bound && (!hasProp(adm.target_, key) || !isFlow(adm.target_[key]))) {\n if (this.extend_(adm, key, descriptor, false) === null) {\n return 0 /* MakeResult.Cancel */;\n }\n }\n if (isFlow(descriptor.value)) {\n // A prototype could have been annotated already by other constructor,\n // rest of the proto chain must be annotated already\n return 1 /* MakeResult.Break */;\n }\n var flowDescriptor = createFlowDescriptor(adm, this, key, descriptor, false, false);\n defineProperty(source, key, flowDescriptor);\n return 2 /* MakeResult.Continue */;\n}\nfunction extend_$2(adm, key, descriptor, proxyTrap) {\n var _this$options_2;\n var flowDescriptor = createFlowDescriptor(adm, this, key, descriptor, (_this$options_2 = this.options_) == null ? void 0 : _this$options_2.bound);\n return adm.defineProperty_(key, flowDescriptor, proxyTrap);\n}\nfunction decorate_20223_$2(mthd, context) {\n var _this$options_3;\n if (true) {\n assert20223DecoratorType(context, [\"method\"]);\n }\n var name = context.name,\n addInitializer = context.addInitializer;\n if (!isFlow(mthd)) {\n mthd = flow(mthd);\n }\n if ((_this$options_3 = this.options_) != null && _this$options_3.bound) {\n addInitializer(function () {\n var self = this;\n var bound = self[name].bind(self);\n bound.isMobXFlow = true;\n self[name] = bound;\n });\n }\n return mthd;\n}\nfunction assertFlowDescriptor(adm, _ref, key, _ref2) {\n var annotationType_ = _ref.annotationType_;\n var value = _ref2.value;\n if ( true && !isFunction(value)) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' can only be used on properties with a generator function value.\"));\n }\n}\nfunction createFlowDescriptor(adm, annotation, key, descriptor, bound,\n// provides ability to disable safeDescriptors for prototypes\nsafeDescriptors) {\n if (safeDescriptors === void 0) {\n safeDescriptors = globalState.safeDescriptors;\n }\n assertFlowDescriptor(adm, annotation, key, descriptor);\n var value = descriptor.value;\n // In case of flow.bound, the descriptor can be from already annotated prototype\n if (!isFlow(value)) {\n value = flow(value);\n }\n if (bound) {\n var _adm$proxy_;\n // We do not keep original function around, so we bind the existing flow\n value = value.bind((_adm$proxy_ = adm.proxy_) != null ? _adm$proxy_ : adm.target_);\n // This is normally set by `flow`, but `bind` returns new function...\n value.isMobXFlow = true;\n }\n return {\n value: value,\n // Non-configurable for classes\n // prevents accidental field redefinition in subclass\n configurable: safeDescriptors ? adm.isPlainObject_ : true,\n // https://github.com/mobxjs/mobx/pull/2641#issuecomment-737292058\n enumerable: false,\n // Non-obsevable, therefore non-writable\n // Also prevents rewriting in subclass constructor\n writable: safeDescriptors ? false : true\n };\n}\n\nfunction createComputedAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$3,\n extend_: extend_$3,\n decorate_20223_: decorate_20223_$3\n };\n}\nfunction make_$3(adm, key, descriptor) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;\n}\nfunction extend_$3(adm, key, descriptor, proxyTrap) {\n assertComputedDescriptor(adm, this, key, descriptor);\n return adm.defineComputedProperty_(key, _extends({}, this.options_, {\n get: descriptor.get,\n set: descriptor.set\n }), proxyTrap);\n}\nfunction decorate_20223_$3(get, context) {\n if (true) {\n assert20223DecoratorType(context, [\"getter\"]);\n }\n var ann = this;\n var key = context.name,\n addInitializer = context.addInitializer;\n addInitializer(function () {\n var adm = asObservableObject(this)[$mobx];\n var options = _extends({}, ann.options_, {\n get: get,\n context: this\n });\n options.name || (options.name = true ? adm.name_ + \".\" + key.toString() : 0);\n adm.values_.set(key, new ComputedValue(options));\n });\n return function () {\n return this[$mobx].getObservablePropValue_(key);\n };\n}\nfunction assertComputedDescriptor(adm, _ref, key, _ref2) {\n var annotationType_ = _ref.annotationType_;\n var get = _ref2.get;\n if ( true && !get) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' can only be used on getter(+setter) properties.\"));\n }\n}\n\nfunction createObservableAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$4,\n extend_: extend_$4,\n decorate_20223_: decorate_20223_$4\n };\n}\nfunction make_$4(adm, key, descriptor) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;\n}\nfunction extend_$4(adm, key, descriptor, proxyTrap) {\n var _this$options_$enhanc, _this$options_;\n assertObservableDescriptor(adm, this, key, descriptor);\n return adm.defineObservableProperty_(key, descriptor.value, (_this$options_$enhanc = (_this$options_ = this.options_) == null ? void 0 : _this$options_.enhancer) != null ? _this$options_$enhanc : deepEnhancer, proxyTrap);\n}\nfunction decorate_20223_$4(desc, context) {\n if (true) {\n if (context.kind === \"field\") {\n throw die(\"Please use `@observable accessor \" + String(context.name) + \"` instead of `@observable \" + String(context.name) + \"`\");\n }\n assert20223DecoratorType(context, [\"accessor\"]);\n }\n var ann = this;\n var kind = context.kind,\n name = context.name;\n // The laziness here is not ideal... It's a workaround to how 2022.3 Decorators are implemented:\n // `addInitializer` callbacks are executed _before_ any accessors are defined (instead of the ideal-for-us right after each).\n // This means that, if we were to do our stuff in an `addInitializer`, we'd attempt to read a private slot\n // before it has been initialized. The runtime doesn't like that and throws a `Cannot read private member\n // from an object whose class did not declare it` error.\n // TODO: it seems that this will not be required anymore in the final version of the spec\n // See TODO: link\n var initializedObjects = new WeakSet();\n function initializeObservable(target, value) {\n var _ann$options_$enhance, _ann$options_;\n var adm = asObservableObject(target)[$mobx];\n var observable = new ObservableValue(value, (_ann$options_$enhance = (_ann$options_ = ann.options_) == null ? void 0 : _ann$options_.enhancer) != null ? _ann$options_$enhance : deepEnhancer, true ? adm.name_ + \".\" + name.toString() : 0, false);\n adm.values_.set(name, observable);\n initializedObjects.add(target);\n }\n if (kind == \"accessor\") {\n return {\n get: function get() {\n if (!initializedObjects.has(this)) {\n initializeObservable(this, desc.get.call(this));\n }\n return this[$mobx].getObservablePropValue_(name);\n },\n set: function set(value) {\n if (!initializedObjects.has(this)) {\n initializeObservable(this, value);\n }\n return this[$mobx].setObservablePropValue_(name, value);\n },\n init: function init(value) {\n if (!initializedObjects.has(this)) {\n initializeObservable(this, value);\n }\n return value;\n }\n };\n }\n return;\n}\nfunction assertObservableDescriptor(adm, _ref, key, descriptor) {\n var annotationType_ = _ref.annotationType_;\n if ( true && !(\"value\" in descriptor)) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' cannot be used on getter/setter properties\"));\n }\n}\n\nvar AUTO = \"true\";\nvar autoAnnotation = /*#__PURE__*/createAutoAnnotation();\nfunction createAutoAnnotation(options) {\n return {\n annotationType_: AUTO,\n options_: options,\n make_: make_$5,\n extend_: extend_$5,\n decorate_20223_: decorate_20223_$5\n };\n}\nfunction make_$5(adm, key, descriptor, source) {\n var _this$options_3, _this$options_4;\n // getter -> computed\n if (descriptor.get) {\n return computed.make_(adm, key, descriptor, source);\n }\n // lone setter -> action setter\n if (descriptor.set) {\n // TODO make action applicable to setter and delegate to action.make_\n var set = createAction(key.toString(), descriptor.set);\n // own\n if (source === adm.target_) {\n return adm.defineProperty_(key, {\n configurable: globalState.safeDescriptors ? adm.isPlainObject_ : true,\n set: set\n }) === null ? 0 /* MakeResult.Cancel */ : 2 /* MakeResult.Continue */;\n }\n // proto\n defineProperty(source, key, {\n configurable: true,\n set: set\n });\n return 2 /* MakeResult.Continue */;\n }\n // function on proto -> autoAction/flow\n if (source !== adm.target_ && typeof descriptor.value === \"function\") {\n var _this$options_2;\n if (isGenerator(descriptor.value)) {\n var _this$options_;\n var flowAnnotation = (_this$options_ = this.options_) != null && _this$options_.autoBind ? flow.bound : flow;\n return flowAnnotation.make_(adm, key, descriptor, source);\n }\n var actionAnnotation = (_this$options_2 = this.options_) != null && _this$options_2.autoBind ? autoAction.bound : autoAction;\n return actionAnnotation.make_(adm, key, descriptor, source);\n }\n // other -> observable\n // Copy props from proto as well, see test:\n // \"decorate should work with Object.create\"\n var observableAnnotation = ((_this$options_3 = this.options_) == null ? void 0 : _this$options_3.deep) === false ? observable.ref : observable;\n // if function respect autoBind option\n if (typeof descriptor.value === \"function\" && (_this$options_4 = this.options_) != null && _this$options_4.autoBind) {\n var _adm$proxy_;\n descriptor.value = descriptor.value.bind((_adm$proxy_ = adm.proxy_) != null ? _adm$proxy_ : adm.target_);\n }\n return observableAnnotation.make_(adm, key, descriptor, source);\n}\nfunction extend_$5(adm, key, descriptor, proxyTrap) {\n var _this$options_5, _this$options_6;\n // getter -> computed\n if (descriptor.get) {\n return computed.extend_(adm, key, descriptor, proxyTrap);\n }\n // lone setter -> action setter\n if (descriptor.set) {\n // TODO make action applicable to setter and delegate to action.extend_\n return adm.defineProperty_(key, {\n configurable: globalState.safeDescriptors ? adm.isPlainObject_ : true,\n set: createAction(key.toString(), descriptor.set)\n }, proxyTrap);\n }\n // other -> observable\n // if function respect autoBind option\n if (typeof descriptor.value === \"function\" && (_this$options_5 = this.options_) != null && _this$options_5.autoBind) {\n var _adm$proxy_2;\n descriptor.value = descriptor.value.bind((_adm$proxy_2 = adm.proxy_) != null ? _adm$proxy_2 : adm.target_);\n }\n var observableAnnotation = ((_this$options_6 = this.options_) == null ? void 0 : _this$options_6.deep) === false ? observable.ref : observable;\n return observableAnnotation.extend_(adm, key, descriptor, proxyTrap);\n}\nfunction decorate_20223_$5(desc, context) {\n die(\"'\" + this.annotationType_ + \"' cannot be used as a decorator\");\n}\n\nvar OBSERVABLE = \"observable\";\nvar OBSERVABLE_REF = \"observable.ref\";\nvar OBSERVABLE_SHALLOW = \"observable.shallow\";\nvar OBSERVABLE_STRUCT = \"observable.struct\";\n// Predefined bags of create observable options, to avoid allocating temporarily option objects\n// in the majority of cases\nvar defaultCreateObservableOptions = {\n deep: true,\n name: undefined,\n defaultDecorator: undefined,\n proxy: true\n};\nObject.freeze(defaultCreateObservableOptions);\nfunction asCreateObservableOptions(thing) {\n return thing || defaultCreateObservableOptions;\n}\nvar observableAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE);\nvar observableRefAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE_REF, {\n enhancer: referenceEnhancer\n});\nvar observableShallowAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE_SHALLOW, {\n enhancer: shallowEnhancer\n});\nvar observableStructAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE_STRUCT, {\n enhancer: refStructEnhancer\n});\nvar observableDecoratorAnnotation = /*#__PURE__*/createDecoratorAnnotation(observableAnnotation);\nfunction getEnhancerFromOptions(options) {\n return options.deep === true ? deepEnhancer : options.deep === false ? referenceEnhancer : getEnhancerFromAnnotation(options.defaultDecorator);\n}\nfunction getAnnotationFromOptions(options) {\n var _options$defaultDecor;\n return options ? (_options$defaultDecor = options.defaultDecorator) != null ? _options$defaultDecor : createAutoAnnotation(options) : undefined;\n}\nfunction getEnhancerFromAnnotation(annotation) {\n var _annotation$options_$, _annotation$options_;\n return !annotation ? deepEnhancer : (_annotation$options_$ = (_annotation$options_ = annotation.options_) == null ? void 0 : _annotation$options_.enhancer) != null ? _annotation$options_$ : deepEnhancer;\n}\n/**\n * Turns an object, array or function into a reactive structure.\n * @param v the value which should become observable.\n */\nfunction createObservable(v, arg2, arg3) {\n // @observable someProp; (2022.3 Decorators)\n if (is20223Decorator(arg2)) {\n return observableAnnotation.decorate_20223_(v, arg2);\n }\n // @observable someProp;\n if (isStringish(arg2)) {\n storeAnnotation(v, arg2, observableAnnotation);\n return;\n }\n // already observable - ignore\n if (isObservable(v)) {\n return v;\n }\n // plain object\n if (isPlainObject(v)) {\n return observable.object(v, arg2, arg3);\n }\n // Array\n if (Array.isArray(v)) {\n return observable.array(v, arg2);\n }\n // Map\n if (isES6Map(v)) {\n return observable.map(v, arg2);\n }\n // Set\n if (isES6Set(v)) {\n return observable.set(v, arg2);\n }\n // other object - ignore\n if (typeof v === \"object\" && v !== null) {\n return v;\n }\n // anything else\n return observable.box(v, arg2);\n}\nassign(createObservable, observableDecoratorAnnotation);\nvar observableFactories = {\n box: function box(value, options) {\n var o = asCreateObservableOptions(options);\n return new ObservableValue(value, getEnhancerFromOptions(o), o.name, true, o.equals);\n },\n array: function array(initialValues, options) {\n var o = asCreateObservableOptions(options);\n return (globalState.useProxies === false || o.proxy === false ? createLegacyArray : createObservableArray)(initialValues, getEnhancerFromOptions(o), o.name);\n },\n map: function map(initialValues, options) {\n var o = asCreateObservableOptions(options);\n return new ObservableMap(initialValues, getEnhancerFromOptions(o), o.name);\n },\n set: function set(initialValues, options) {\n var o = asCreateObservableOptions(options);\n return new ObservableSet(initialValues, getEnhancerFromOptions(o), o.name);\n },\n object: function object(props, decorators, options) {\n return initObservable(function () {\n return extendObservable(globalState.useProxies === false || (options == null ? void 0 : options.proxy) === false ? asObservableObject({}, options) : asDynamicObservableObject({}, options), props, decorators);\n });\n },\n ref: /*#__PURE__*/createDecoratorAnnotation(observableRefAnnotation),\n shallow: /*#__PURE__*/createDecoratorAnnotation(observableShallowAnnotation),\n deep: observableDecoratorAnnotation,\n struct: /*#__PURE__*/createDecoratorAnnotation(observableStructAnnotation)\n};\n// eslint-disable-next-line\nvar observable = /*#__PURE__*/assign(createObservable, observableFactories);\n\nvar COMPUTED = \"computed\";\nvar COMPUTED_STRUCT = \"computed.struct\";\nvar computedAnnotation = /*#__PURE__*/createComputedAnnotation(COMPUTED);\nvar computedStructAnnotation = /*#__PURE__*/createComputedAnnotation(COMPUTED_STRUCT, {\n equals: comparer.structural\n});\n/**\n * Decorator for class properties: @computed get value() { return expr; }.\n * For legacy purposes also invokable as ES5 observable created: `computed(() => expr)`;\n */\nvar computed = function computed(arg1, arg2) {\n if (is20223Decorator(arg2)) {\n // @computed (2022.3 Decorators)\n return computedAnnotation.decorate_20223_(arg1, arg2);\n }\n if (isStringish(arg2)) {\n // @computed\n return storeAnnotation(arg1, arg2, computedAnnotation);\n }\n if (isPlainObject(arg1)) {\n // @computed({ options })\n return createDecoratorAnnotation(createComputedAnnotation(COMPUTED, arg1));\n }\n // computed(expr, options?)\n if (true) {\n if (!isFunction(arg1)) {\n die(\"First argument to `computed` should be an expression.\");\n }\n if (isFunction(arg2)) {\n die(\"A setter as second argument is no longer supported, use `{ set: fn }` option instead\");\n }\n }\n var opts = isPlainObject(arg2) ? arg2 : {};\n opts.get = arg1;\n opts.name || (opts.name = arg1.name || \"\"); /* for generated name */\n return new ComputedValue(opts);\n};\nObject.assign(computed, computedAnnotation);\ncomputed.struct = /*#__PURE__*/createDecoratorAnnotation(computedStructAnnotation);\n\nvar _getDescriptor$config, _getDescriptor;\n// we don't use globalState for these in order to avoid possible issues with multiple\n// mobx versions\nvar currentActionId = 0;\nvar nextActionId = 1;\nvar isFunctionNameConfigurable = (_getDescriptor$config = (_getDescriptor = /*#__PURE__*/getDescriptor(function () {}, \"name\")) == null ? void 0 : _getDescriptor.configurable) != null ? _getDescriptor$config : false;\n// we can safely recycle this object\nvar tmpNameDescriptor = {\n value: \"action\",\n configurable: true,\n writable: false,\n enumerable: false\n};\nfunction createAction(actionName, fn, autoAction, ref) {\n if (autoAction === void 0) {\n autoAction = false;\n }\n if (true) {\n if (!isFunction(fn)) {\n die(\"`action` can only be invoked on functions\");\n }\n if (typeof actionName !== \"string\" || !actionName) {\n die(\"actions should have valid names, got: '\" + actionName + \"'\");\n }\n }\n function res() {\n return executeAction(actionName, autoAction, fn, ref || this, arguments);\n }\n res.isMobxAction = true;\n res.toString = function () {\n return fn.toString();\n };\n if (isFunctionNameConfigurable) {\n tmpNameDescriptor.value = actionName;\n defineProperty(res, \"name\", tmpNameDescriptor);\n }\n return res;\n}\nfunction executeAction(actionName, canRunAsDerivation, fn, scope, args) {\n var runInfo = _startAction(actionName, canRunAsDerivation, scope, args);\n try {\n return fn.apply(scope, args);\n } catch (err) {\n runInfo.error_ = err;\n throw err;\n } finally {\n _endAction(runInfo);\n }\n}\nfunction _startAction(actionName, canRunAsDerivation,\n// true for autoAction\nscope, args) {\n var notifySpy_ = true && isSpyEnabled() && !!actionName;\n var startTime_ = 0;\n if ( true && notifySpy_) {\n startTime_ = Date.now();\n var flattenedArgs = args ? Array.from(args) : EMPTY_ARRAY;\n spyReportStart({\n type: ACTION,\n name: actionName,\n object: scope,\n arguments: flattenedArgs\n });\n }\n var prevDerivation_ = globalState.trackingDerivation;\n var runAsAction = !canRunAsDerivation || !prevDerivation_;\n startBatch();\n var prevAllowStateChanges_ = globalState.allowStateChanges; // by default preserve previous allow\n if (runAsAction) {\n untrackedStart();\n prevAllowStateChanges_ = allowStateChangesStart(true);\n }\n var prevAllowStateReads_ = allowStateReadsStart(true);\n var runInfo = {\n runAsAction_: runAsAction,\n prevDerivation_: prevDerivation_,\n prevAllowStateChanges_: prevAllowStateChanges_,\n prevAllowStateReads_: prevAllowStateReads_,\n notifySpy_: notifySpy_,\n startTime_: startTime_,\n actionId_: nextActionId++,\n parentActionId_: currentActionId\n };\n currentActionId = runInfo.actionId_;\n return runInfo;\n}\nfunction _endAction(runInfo) {\n if (currentActionId !== runInfo.actionId_) {\n die(30);\n }\n currentActionId = runInfo.parentActionId_;\n if (runInfo.error_ !== undefined) {\n globalState.suppressReactionErrors = true;\n }\n allowStateChangesEnd(runInfo.prevAllowStateChanges_);\n allowStateReadsEnd(runInfo.prevAllowStateReads_);\n endBatch();\n if (runInfo.runAsAction_) {\n untrackedEnd(runInfo.prevDerivation_);\n }\n if ( true && runInfo.notifySpy_) {\n spyReportEnd({\n time: Date.now() - runInfo.startTime_\n });\n }\n globalState.suppressReactionErrors = false;\n}\nfunction allowStateChanges(allowStateChanges, func) {\n var prev = allowStateChangesStart(allowStateChanges);\n try {\n return func();\n } finally {\n allowStateChangesEnd(prev);\n }\n}\nfunction allowStateChangesStart(allowStateChanges) {\n var prev = globalState.allowStateChanges;\n globalState.allowStateChanges = allowStateChanges;\n return prev;\n}\nfunction allowStateChangesEnd(prev) {\n globalState.allowStateChanges = prev;\n}\n\nvar CREATE = \"create\";\nvar ObservableValue = /*#__PURE__*/function (_Atom) {\n function ObservableValue(value, enhancer, name_, notifySpy, equals) {\n var _this;\n if (name_ === void 0) {\n name_ = true ? \"ObservableValue@\" + getNextId() : 0;\n }\n if (notifySpy === void 0) {\n notifySpy = true;\n }\n if (equals === void 0) {\n equals = comparer[\"default\"];\n }\n _this = _Atom.call(this, name_) || this;\n _this.enhancer = void 0;\n _this.name_ = void 0;\n _this.equals = void 0;\n _this.hasUnreportedChange_ = false;\n _this.interceptors_ = void 0;\n _this.changeListeners_ = void 0;\n _this.value_ = void 0;\n _this.dehancer = void 0;\n _this.enhancer = enhancer;\n _this.name_ = name_;\n _this.equals = equals;\n _this.value_ = enhancer(value, undefined, name_);\n if ( true && notifySpy && isSpyEnabled()) {\n // only notify spy if this is a stand-alone observable\n spyReport({\n type: CREATE,\n object: _this,\n observableKind: \"value\",\n debugObjectName: _this.name_,\n newValue: \"\" + _this.value_\n });\n }\n return _this;\n }\n _inheritsLoose(ObservableValue, _Atom);\n var _proto = ObservableValue.prototype;\n _proto.dehanceValue = function dehanceValue(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.set = function set(newValue) {\n var oldValue = this.value_;\n newValue = this.prepareNewValue_(newValue);\n if (newValue !== globalState.UNCHANGED) {\n var notifySpy = isSpyEnabled();\n if ( true && notifySpy) {\n spyReportStart({\n type: UPDATE,\n object: this,\n observableKind: \"value\",\n debugObjectName: this.name_,\n newValue: newValue,\n oldValue: oldValue\n });\n }\n this.setNewValue_(newValue);\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n };\n _proto.prepareNewValue_ = function prepareNewValue_(newValue) {\n checkIfStateModificationsAreAllowed(this);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this,\n type: UPDATE,\n newValue: newValue\n });\n if (!change) {\n return globalState.UNCHANGED;\n }\n newValue = change.newValue;\n }\n // apply modifier\n newValue = this.enhancer(newValue, this.value_, this.name_);\n return this.equals(this.value_, newValue) ? globalState.UNCHANGED : newValue;\n };\n _proto.setNewValue_ = function setNewValue_(newValue) {\n var oldValue = this.value_;\n this.value_ = newValue;\n this.reportChanged();\n if (hasListeners(this)) {\n notifyListeners(this, {\n type: UPDATE,\n object: this,\n newValue: newValue,\n oldValue: oldValue\n });\n }\n };\n _proto.get = function get() {\n this.reportObserved();\n return this.dehanceValue(this.value_);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n if (fireImmediately) {\n listener({\n observableKind: \"value\",\n debugObjectName: this.name_,\n object: this,\n type: UPDATE,\n newValue: this.value_,\n oldValue: undefined\n });\n }\n return registerListener(this, listener);\n };\n _proto.raw = function raw() {\n // used by MST ot get undehanced value\n return this.value_;\n };\n _proto.toJSON = function toJSON() {\n return this.get();\n };\n _proto.toString = function toString() {\n return this.name_ + \"[\" + this.value_ + \"]\";\n };\n _proto.valueOf = function valueOf() {\n return toPrimitive(this.get());\n };\n _proto[Symbol.toPrimitive] = function () {\n return this.valueOf();\n };\n return ObservableValue;\n}(Atom);\nvar isObservableValue = /*#__PURE__*/createInstanceofPredicate(\"ObservableValue\", ObservableValue);\n\n/**\n * A node in the state dependency root that observes other nodes, and can be observed itself.\n *\n * ComputedValue will remember the result of the computation for the duration of the batch, or\n * while being observed.\n *\n * During this time it will recompute only when one of its direct dependencies changed,\n * but only when it is being accessed with `ComputedValue.get()`.\n *\n * Implementation description:\n * 1. First time it's being accessed it will compute and remember result\n * give back remembered result until 2. happens\n * 2. First time any deep dependency change, propagate POSSIBLY_STALE to all observers, wait for 3.\n * 3. When it's being accessed, recompute if any shallow dependency changed.\n * if result changed: propagate STALE to all observers, that were POSSIBLY_STALE from the last step.\n * go to step 2. either way\n *\n * If at any point it's outside batch and it isn't observed: reset everything and go to 1.\n */\nvar ComputedValue = /*#__PURE__*/function () {\n /**\n * Create a new computed value based on a function expression.\n *\n * The `name` property is for debug purposes only.\n *\n * The `equals` property specifies the comparer function to use to determine if a newly produced\n * value differs from the previous value. Two comparers are provided in the library; `defaultComparer`\n * compares based on identity comparison (===), and `structuralComparer` deeply compares the structure.\n * Structural comparison can be convenient if you always produce a new aggregated object and\n * don't want to notify observers if it is structurally the same.\n * This is useful for working with vectors, mouse coordinates etc.\n */\n function ComputedValue(options) {\n this.dependenciesState_ = IDerivationState_.NOT_TRACKING_;\n this.observing_ = [];\n // nodes we are looking at. Our value depends on these nodes\n this.newObserving_ = null;\n // during tracking it's an array with new observed observers\n this.observers_ = new Set();\n this.runId_ = 0;\n this.lastAccessedBy_ = 0;\n this.lowestObserverState_ = IDerivationState_.UP_TO_DATE_;\n this.unboundDepsCount_ = 0;\n this.value_ = new CaughtException(null);\n this.name_ = void 0;\n this.triggeredBy_ = void 0;\n this.flags_ = 0;\n this.derivation = void 0;\n // N.B: unminified as it is used by MST\n this.setter_ = void 0;\n this.isTracing_ = TraceMode.NONE;\n this.scope_ = void 0;\n this.equals_ = void 0;\n this.requiresReaction_ = void 0;\n this.keepAlive_ = void 0;\n this.onBOL = void 0;\n this.onBUOL = void 0;\n if (!options.get) {\n die(31);\n }\n this.derivation = options.get;\n this.name_ = options.name || ( true ? \"ComputedValue@\" + getNextId() : 0);\n if (options.set) {\n this.setter_ = createAction( true ? this.name_ + \"-setter\" : 0, options.set);\n }\n this.equals_ = options.equals || (options.compareStructural || options.struct ? comparer.structural : comparer[\"default\"]);\n this.scope_ = options.context;\n this.requiresReaction_ = options.requiresReaction;\n this.keepAlive_ = !!options.keepAlive;\n }\n var _proto = ComputedValue.prototype;\n _proto.onBecomeStale_ = function onBecomeStale_() {\n propagateMaybeChanged(this);\n };\n _proto.onBO = function onBO() {\n if (this.onBOL) {\n this.onBOL.forEach(function (listener) {\n return listener();\n });\n }\n };\n _proto.onBUO = function onBUO() {\n if (this.onBUOL) {\n this.onBUOL.forEach(function (listener) {\n return listener();\n });\n }\n }\n // to check for cycles\n ;\n /**\n * Returns the current value of this computed value.\n * Will evaluate its computation first if needed.\n */\n _proto.get = function get() {\n if (this.isComputing) {\n die(32, this.name_, this.derivation);\n }\n if (globalState.inBatch === 0 &&\n // !globalState.trackingDerivatpion &&\n this.observers_.size === 0 && !this.keepAlive_) {\n if (shouldCompute(this)) {\n this.warnAboutUntrackedRead_();\n startBatch(); // See perf test 'computed memoization'\n this.value_ = this.computeValue_(false);\n endBatch();\n }\n } else {\n reportObserved(this);\n if (shouldCompute(this)) {\n var prevTrackingContext = globalState.trackingContext;\n if (this.keepAlive_ && !prevTrackingContext) {\n globalState.trackingContext = this;\n }\n if (this.trackAndCompute()) {\n propagateChangeConfirmed(this);\n }\n globalState.trackingContext = prevTrackingContext;\n }\n }\n var result = this.value_;\n if (isCaughtException(result)) {\n throw result.cause;\n }\n return result;\n };\n _proto.set = function set(value) {\n if (this.setter_) {\n if (this.isRunningSetter) {\n die(33, this.name_);\n }\n this.isRunningSetter = true;\n try {\n this.setter_.call(this.scope_, value);\n } finally {\n this.isRunningSetter = false;\n }\n } else {\n die(34, this.name_);\n }\n };\n _proto.trackAndCompute = function trackAndCompute() {\n // N.B: unminified as it is used by MST\n var oldValue = this.value_;\n var wasSuspended = /* see #1208 */this.dependenciesState_ === IDerivationState_.NOT_TRACKING_;\n var newValue = this.computeValue_(true);\n var changed = wasSuspended || isCaughtException(oldValue) || isCaughtException(newValue) || !this.equals_(oldValue, newValue);\n if (changed) {\n this.value_ = newValue;\n if ( true && isSpyEnabled()) {\n spyReport({\n observableKind: \"computed\",\n debugObjectName: this.name_,\n object: this.scope_,\n type: \"update\",\n oldValue: oldValue,\n newValue: newValue\n });\n }\n }\n return changed;\n };\n _proto.computeValue_ = function computeValue_(track) {\n this.isComputing = true;\n // don't allow state changes during computation\n var prev = allowStateChangesStart(false);\n var res;\n if (track) {\n res = trackDerivedFunction(this, this.derivation, this.scope_);\n } else {\n if (globalState.disableErrorBoundaries === true) {\n res = this.derivation.call(this.scope_);\n } else {\n try {\n res = this.derivation.call(this.scope_);\n } catch (e) {\n res = new CaughtException(e);\n }\n }\n }\n allowStateChangesEnd(prev);\n this.isComputing = false;\n return res;\n };\n _proto.suspend_ = function suspend_() {\n if (!this.keepAlive_) {\n clearObserving(this);\n this.value_ = undefined; // don't hold on to computed value!\n if ( true && this.isTracing_ !== TraceMode.NONE) {\n console.log(\"[mobx.trace] Computed value '\" + this.name_ + \"' was suspended and it will recompute on the next access.\");\n }\n }\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n var _this = this;\n var firstTime = true;\n var prevValue = undefined;\n return autorun(function () {\n // TODO: why is this in a different place than the spyReport() function? in all other observables it's called in the same place\n var newValue = _this.get();\n if (!firstTime || fireImmediately) {\n var prevU = untrackedStart();\n listener({\n observableKind: \"computed\",\n debugObjectName: _this.name_,\n type: UPDATE,\n object: _this,\n newValue: newValue,\n oldValue: prevValue\n });\n untrackedEnd(prevU);\n }\n firstTime = false;\n prevValue = newValue;\n });\n };\n _proto.warnAboutUntrackedRead_ = function warnAboutUntrackedRead_() {\n if (false) {}\n if (this.isTracing_ !== TraceMode.NONE) {\n console.log(\"[mobx.trace] Computed value '\" + this.name_ + \"' is being read outside a reactive context. Doing a full recompute.\");\n }\n if (typeof this.requiresReaction_ === \"boolean\" ? this.requiresReaction_ : globalState.computedRequiresReaction) {\n console.warn(\"[mobx] Computed value '\" + this.name_ + \"' is being read outside a reactive context. Doing a full recompute.\");\n }\n };\n _proto.toString = function toString() {\n return this.name_ + \"[\" + this.derivation.toString() + \"]\";\n };\n _proto.valueOf = function valueOf() {\n return toPrimitive(this.get());\n };\n _proto[Symbol.toPrimitive] = function () {\n return this.valueOf();\n };\n return _createClass(ComputedValue, [{\n key: \"isComputing\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isComputingMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isComputingMask_, newValue);\n }\n }, {\n key: \"isRunningSetter\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isRunningSetterMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isRunningSetterMask_, newValue);\n }\n }, {\n key: \"isBeingObserved\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isBeingObservedMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isBeingObservedMask_, newValue);\n }\n }, {\n key: \"isPendingUnobservation\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isPendingUnobservationMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isPendingUnobservationMask_, newValue);\n }\n }, {\n key: \"diffValue\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.diffValueMask_) ? 1 : 0;\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.diffValueMask_, newValue === 1 ? true : false);\n }\n }]);\n}();\nComputedValue.isComputingMask_ = 1;\nComputedValue.isRunningSetterMask_ = 2;\nComputedValue.isBeingObservedMask_ = 4;\nComputedValue.isPendingUnobservationMask_ = 8;\nComputedValue.diffValueMask_ = 16;\nvar isComputedValue = /*#__PURE__*/createInstanceofPredicate(\"ComputedValue\", ComputedValue);\n\nvar IDerivationState_;\n(function (IDerivationState_) {\n // before being run or (outside batch and not being observed)\n // at this point derivation is not holding any data about dependency tree\n IDerivationState_[IDerivationState_[\"NOT_TRACKING_\"] = -1] = \"NOT_TRACKING_\";\n // no shallow dependency changed since last computation\n // won't recalculate derivation\n // this is what makes mobx fast\n IDerivationState_[IDerivationState_[\"UP_TO_DATE_\"] = 0] = \"UP_TO_DATE_\";\n // some deep dependency changed, but don't know if shallow dependency changed\n // will require to check first if UP_TO_DATE or POSSIBLY_STALE\n // currently only ComputedValue will propagate POSSIBLY_STALE\n //\n // having this state is second big optimization:\n // don't have to recompute on every dependency change, but only when it's needed\n IDerivationState_[IDerivationState_[\"POSSIBLY_STALE_\"] = 1] = \"POSSIBLY_STALE_\";\n // A shallow dependency has changed since last computation and the derivation\n // will need to recompute when it's needed next.\n IDerivationState_[IDerivationState_[\"STALE_\"] = 2] = \"STALE_\";\n})(IDerivationState_ || (IDerivationState_ = {}));\nvar TraceMode;\n(function (TraceMode) {\n TraceMode[TraceMode[\"NONE\"] = 0] = \"NONE\";\n TraceMode[TraceMode[\"LOG\"] = 1] = \"LOG\";\n TraceMode[TraceMode[\"BREAK\"] = 2] = \"BREAK\";\n})(TraceMode || (TraceMode = {}));\nvar CaughtException = function CaughtException(cause) {\n this.cause = void 0;\n this.cause = cause;\n // Empty\n};\nfunction isCaughtException(e) {\n return e instanceof CaughtException;\n}\n/**\n * Finds out whether any dependency of the derivation has actually changed.\n * If dependenciesState is 1 then it will recalculate dependencies,\n * if any dependency changed it will propagate it by changing dependenciesState to 2.\n *\n * By iterating over the dependencies in the same order that they were reported and\n * stopping on the first change, all the recalculations are only called for ComputedValues\n * that will be tracked by derivation. That is because we assume that if the first x\n * dependencies of the derivation doesn't change then the derivation should run the same way\n * up until accessing x-th dependency.\n */\nfunction shouldCompute(derivation) {\n switch (derivation.dependenciesState_) {\n case IDerivationState_.UP_TO_DATE_:\n return false;\n case IDerivationState_.NOT_TRACKING_:\n case IDerivationState_.STALE_:\n return true;\n case IDerivationState_.POSSIBLY_STALE_:\n {\n // state propagation can occur outside of action/reactive context #2195\n var prevAllowStateReads = allowStateReadsStart(true);\n var prevUntracked = untrackedStart(); // no need for those computeds to be reported, they will be picked up in trackDerivedFunction.\n var obs = derivation.observing_,\n l = obs.length;\n for (var i = 0; i < l; i++) {\n var obj = obs[i];\n if (isComputedValue(obj)) {\n if (globalState.disableErrorBoundaries) {\n obj.get();\n } else {\n try {\n obj.get();\n } catch (e) {\n // we are not interested in the value *or* exception at this moment, but if there is one, notify all\n untrackedEnd(prevUntracked);\n allowStateReadsEnd(prevAllowStateReads);\n return true;\n }\n }\n // if ComputedValue `obj` actually changed it will be computed and propagated to its observers.\n // and `derivation` is an observer of `obj`\n // invariantShouldCompute(derivation)\n if (derivation.dependenciesState_ === IDerivationState_.STALE_) {\n untrackedEnd(prevUntracked);\n allowStateReadsEnd(prevAllowStateReads);\n return true;\n }\n }\n }\n changeDependenciesStateTo0(derivation);\n untrackedEnd(prevUntracked);\n allowStateReadsEnd(prevAllowStateReads);\n return false;\n }\n }\n}\nfunction isComputingDerivation() {\n return globalState.trackingDerivation !== null; // filter out actions inside computations\n}\nfunction checkIfStateModificationsAreAllowed(atom) {\n if (false) {}\n var hasObservers = atom.observers_.size > 0;\n // Should not be possible to change observed state outside strict mode, except during initialization, see #563\n if (!globalState.allowStateChanges && (hasObservers || globalState.enforceActions === \"always\")) {\n console.warn(\"[MobX] \" + (globalState.enforceActions ? \"Since strict-mode is enabled, changing (observed) observable values without using an action is not allowed. Tried to modify: \" : \"Side effects like changing state are not allowed at this point. Are you trying to modify state from, for example, a computed value or the render function of a React component? You can wrap side effects in 'runInAction' (or decorate functions with 'action') if needed. Tried to modify: \") + atom.name_);\n }\n}\nfunction checkIfStateReadsAreAllowed(observable) {\n if ( true && !globalState.allowStateReads && globalState.observableRequiresReaction) {\n console.warn(\"[mobx] Observable '\" + observable.name_ + \"' being read outside a reactive context.\");\n }\n}\n/**\n * Executes the provided function `f` and tracks which observables are being accessed.\n * The tracking information is stored on the `derivation` object and the derivation is registered\n * as observer of any of the accessed observables.\n */\nfunction trackDerivedFunction(derivation, f, context) {\n var prevAllowStateReads = allowStateReadsStart(true);\n changeDependenciesStateTo0(derivation);\n // Preallocate array; will be trimmed by bindDependencies.\n derivation.newObserving_ = new Array(\n // Reserve constant space for initial dependencies, dynamic space otherwise.\n // See https://github.com/mobxjs/mobx/pull/3833\n derivation.runId_ === 0 ? 100 : derivation.observing_.length);\n derivation.unboundDepsCount_ = 0;\n derivation.runId_ = ++globalState.runId;\n var prevTracking = globalState.trackingDerivation;\n globalState.trackingDerivation = derivation;\n globalState.inBatch++;\n var result;\n if (globalState.disableErrorBoundaries === true) {\n result = f.call(context);\n } else {\n try {\n result = f.call(context);\n } catch (e) {\n result = new CaughtException(e);\n }\n }\n globalState.inBatch--;\n globalState.trackingDerivation = prevTracking;\n bindDependencies(derivation);\n warnAboutDerivationWithoutDependencies(derivation);\n allowStateReadsEnd(prevAllowStateReads);\n return result;\n}\nfunction warnAboutDerivationWithoutDependencies(derivation) {\n if (false) {}\n if (derivation.observing_.length !== 0) {\n return;\n }\n if (typeof derivation.requiresObservable_ === \"boolean\" ? derivation.requiresObservable_ : globalState.reactionRequiresObservable) {\n console.warn(\"[mobx] Derivation '\" + derivation.name_ + \"' is created/updated without reading any observable value.\");\n }\n}\n/**\n * diffs newObserving with observing.\n * update observing to be newObserving with unique observables\n * notify observers that become observed/unobserved\n */\nfunction bindDependencies(derivation) {\n // invariant(derivation.dependenciesState !== IDerivationState.NOT_TRACKING, \"INTERNAL ERROR bindDependencies expects derivation.dependenciesState !== -1\");\n var prevObserving = derivation.observing_;\n var observing = derivation.observing_ = derivation.newObserving_;\n var lowestNewObservingDerivationState = IDerivationState_.UP_TO_DATE_;\n // Go through all new observables and check diffValue: (this list can contain duplicates):\n // 0: first occurrence, change to 1 and keep it\n // 1: extra occurrence, drop it\n var i0 = 0,\n l = derivation.unboundDepsCount_;\n for (var i = 0; i < l; i++) {\n var dep = observing[i];\n if (dep.diffValue === 0) {\n dep.diffValue = 1;\n if (i0 !== i) {\n observing[i0] = dep;\n }\n i0++;\n }\n // Upcast is 'safe' here, because if dep is IObservable, `dependenciesState` will be undefined,\n // not hitting the condition\n if (dep.dependenciesState_ > lowestNewObservingDerivationState) {\n lowestNewObservingDerivationState = dep.dependenciesState_;\n }\n }\n observing.length = i0;\n derivation.newObserving_ = null; // newObserving shouldn't be needed outside tracking (statement moved down to work around FF bug, see #614)\n // Go through all old observables and check diffValue: (it is unique after last bindDependencies)\n // 0: it's not in new observables, unobserve it\n // 1: it keeps being observed, don't want to notify it. change to 0\n l = prevObserving.length;\n while (l--) {\n var _dep = prevObserving[l];\n if (_dep.diffValue === 0) {\n removeObserver(_dep, derivation);\n }\n _dep.diffValue = 0;\n }\n // Go through all new observables and check diffValue: (now it should be unique)\n // 0: it was set to 0 in last loop. don't need to do anything.\n // 1: it wasn't observed, let's observe it. set back to 0\n while (i0--) {\n var _dep2 = observing[i0];\n if (_dep2.diffValue === 1) {\n _dep2.diffValue = 0;\n addObserver(_dep2, derivation);\n }\n }\n // Some new observed derivations may become stale during this derivation computation\n // so they have had no chance to propagate staleness (#916)\n if (lowestNewObservingDerivationState !== IDerivationState_.UP_TO_DATE_) {\n derivation.dependenciesState_ = lowestNewObservingDerivationState;\n derivation.onBecomeStale_();\n }\n}\nfunction clearObserving(derivation) {\n // invariant(globalState.inBatch > 0, \"INTERNAL ERROR clearObserving should be called only inside batch\");\n var obs = derivation.observing_;\n derivation.observing_ = [];\n var i = obs.length;\n while (i--) {\n removeObserver(obs[i], derivation);\n }\n derivation.dependenciesState_ = IDerivationState_.NOT_TRACKING_;\n}\nfunction untracked(action) {\n var prev = untrackedStart();\n try {\n return action();\n } finally {\n untrackedEnd(prev);\n }\n}\nfunction untrackedStart() {\n var prev = globalState.trackingDerivation;\n globalState.trackingDerivation = null;\n return prev;\n}\nfunction untrackedEnd(prev) {\n globalState.trackingDerivation = prev;\n}\nfunction allowStateReadsStart(allowStateReads) {\n var prev = globalState.allowStateReads;\n globalState.allowStateReads = allowStateReads;\n return prev;\n}\nfunction allowStateReadsEnd(prev) {\n globalState.allowStateReads = prev;\n}\n/**\n * needed to keep `lowestObserverState` correct. when changing from (2 or 1) to 0\n *\n */\nfunction changeDependenciesStateTo0(derivation) {\n if (derivation.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {\n return;\n }\n derivation.dependenciesState_ = IDerivationState_.UP_TO_DATE_;\n var obs = derivation.observing_;\n var i = obs.length;\n while (i--) {\n obs[i].lowestObserverState_ = IDerivationState_.UP_TO_DATE_;\n }\n}\n\n/**\n * These values will persist if global state is reset\n */\nvar persistentKeys = [\"mobxGuid\", \"spyListeners\", \"enforceActions\", \"computedRequiresReaction\", \"reactionRequiresObservable\", \"observableRequiresReaction\", \"allowStateReads\", \"disableErrorBoundaries\", \"runId\", \"UNCHANGED\", \"useProxies\"];\nvar MobXGlobals = function MobXGlobals() {\n /**\n * MobXGlobals version.\n * MobX compatiblity with other versions loaded in memory as long as this version matches.\n * It indicates that the global state still stores similar information\n *\n * N.B: this version is unrelated to the package version of MobX, and is only the version of the\n * internal state storage of MobX, and can be the same across many different package versions\n */\n this.version = 6;\n /**\n * globally unique token to signal unchanged\n */\n this.UNCHANGED = {};\n /**\n * Currently running derivation\n */\n this.trackingDerivation = null;\n /**\n * Currently running reaction. This determines if we currently have a reactive context.\n * (Tracking derivation is also set for temporal tracking of computed values inside actions,\n * but trackingReaction can only be set by a form of Reaction)\n */\n this.trackingContext = null;\n /**\n * Each time a derivation is tracked, it is assigned a unique run-id\n */\n this.runId = 0;\n /**\n * 'guid' for general purpose. Will be persisted amongst resets.\n */\n this.mobxGuid = 0;\n /**\n * Are we in a batch block? (and how many of them)\n */\n this.inBatch = 0;\n /**\n * Observables that don't have observers anymore, and are about to be\n * suspended, unless somebody else accesses it in the same batch\n *\n * @type {IObservable[]}\n */\n this.pendingUnobservations = [];\n /**\n * List of scheduled, not yet executed, reactions.\n */\n this.pendingReactions = [];\n /**\n * Are we currently processing reactions?\n */\n this.isRunningReactions = false;\n /**\n * Is it allowed to change observables at this point?\n * In general, MobX doesn't allow that when running computations and React.render.\n * To ensure that those functions stay pure.\n */\n this.allowStateChanges = false;\n /**\n * Is it allowed to read observables at this point?\n * Used to hold the state needed for `observableRequiresReaction`\n */\n this.allowStateReads = true;\n /**\n * If strict mode is enabled, state changes are by default not allowed\n */\n this.enforceActions = true;\n /**\n * Spy callbacks\n */\n this.spyListeners = [];\n /**\n * Globally attached error handlers that react specifically to errors in reactions\n */\n this.globalReactionErrorHandlers = [];\n /**\n * Warn if computed values are accessed outside a reactive context\n */\n this.computedRequiresReaction = false;\n /**\n * (Experimental)\n * Warn if you try to create to derivation / reactive context without accessing any observable.\n */\n this.reactionRequiresObservable = false;\n /**\n * (Experimental)\n * Warn if observables are accessed outside a reactive context\n */\n this.observableRequiresReaction = false;\n /*\n * Don't catch and rethrow exceptions. This is useful for inspecting the state of\n * the stack when an exception occurs while debugging.\n */\n this.disableErrorBoundaries = false;\n /*\n * If true, we are already handling an exception in an action. Any errors in reactions should be suppressed, as\n * they are not the cause, see: https://github.com/mobxjs/mobx/issues/1836\n */\n this.suppressReactionErrors = false;\n this.useProxies = true;\n /*\n * print warnings about code that would fail if proxies weren't available\n */\n this.verifyProxies = false;\n /**\n * False forces all object's descriptors to\n * writable: true\n * configurable: true\n */\n this.safeDescriptors = true;\n};\nvar canMergeGlobalState = true;\nvar isolateCalled = false;\nvar globalState = /*#__PURE__*/function () {\n var global = /*#__PURE__*/getGlobal();\n if (global.__mobxInstanceCount > 0 && !global.__mobxGlobals) {\n canMergeGlobalState = false;\n }\n if (global.__mobxGlobals && global.__mobxGlobals.version !== new MobXGlobals().version) {\n canMergeGlobalState = false;\n }\n if (!canMergeGlobalState) {\n // Because this is a IIFE we need to let isolateCalled a chance to change\n // so we run it after the event loop completed at least 1 iteration\n setTimeout(function () {\n if (!isolateCalled) {\n die(35);\n }\n }, 1);\n return new MobXGlobals();\n } else if (global.__mobxGlobals) {\n global.__mobxInstanceCount += 1;\n if (!global.__mobxGlobals.UNCHANGED) {\n global.__mobxGlobals.UNCHANGED = {};\n } // make merge backward compatible\n return global.__mobxGlobals;\n } else {\n global.__mobxInstanceCount = 1;\n return global.__mobxGlobals = /*#__PURE__*/new MobXGlobals();\n }\n}();\nfunction isolateGlobalState() {\n if (globalState.pendingReactions.length || globalState.inBatch || globalState.isRunningReactions) {\n die(36);\n }\n isolateCalled = true;\n if (canMergeGlobalState) {\n var global = getGlobal();\n if (--global.__mobxInstanceCount === 0) {\n global.__mobxGlobals = undefined;\n }\n globalState = new MobXGlobals();\n }\n}\nfunction getGlobalState() {\n return globalState;\n}\n/**\n * For testing purposes only; this will break the internal state of existing observables,\n * but can be used to get back at a stable state after throwing errors\n */\nfunction resetGlobalState() {\n var defaultGlobals = new MobXGlobals();\n for (var key in defaultGlobals) {\n if (persistentKeys.indexOf(key) === -1) {\n globalState[key] = defaultGlobals[key];\n }\n }\n globalState.allowStateChanges = !globalState.enforceActions;\n}\n\nfunction hasObservers(observable) {\n return observable.observers_ && observable.observers_.size > 0;\n}\nfunction getObservers(observable) {\n return observable.observers_;\n}\n// function invariantObservers(observable: IObservable) {\n// const list = observable.observers\n// const map = observable.observersIndexes\n// const l = list.length\n// for (let i = 0; i < l; i++) {\n// const id = list[i].__mapid\n// if (i) {\n// invariant(map[id] === i, \"INTERNAL ERROR maps derivation.__mapid to index in list\") // for performance\n// } else {\n// invariant(!(id in map), \"INTERNAL ERROR observer on index 0 shouldn't be held in map.\") // for performance\n// }\n// }\n// invariant(\n// list.length === 0 || Object.keys(map).length === list.length - 1,\n// \"INTERNAL ERROR there is no junk in map\"\n// )\n// }\nfunction addObserver(observable, node) {\n // invariant(node.dependenciesState !== -1, \"INTERNAL ERROR, can add only dependenciesState !== -1\");\n // invariant(observable._observers.indexOf(node) === -1, \"INTERNAL ERROR add already added node\");\n // invariantObservers(observable);\n observable.observers_.add(node);\n if (observable.lowestObserverState_ > node.dependenciesState_) {\n observable.lowestObserverState_ = node.dependenciesState_;\n }\n // invariantObservers(observable);\n // invariant(observable._observers.indexOf(node) !== -1, \"INTERNAL ERROR didn't add node\");\n}\nfunction removeObserver(observable, node) {\n // invariant(globalState.inBatch > 0, \"INTERNAL ERROR, remove should be called only inside batch\");\n // invariant(observable._observers.indexOf(node) !== -1, \"INTERNAL ERROR remove already removed node\");\n // invariantObservers(observable);\n observable.observers_[\"delete\"](node);\n if (observable.observers_.size === 0) {\n // deleting last observer\n queueForUnobservation(observable);\n }\n // invariantObservers(observable);\n // invariant(observable._observers.indexOf(node) === -1, \"INTERNAL ERROR remove already removed node2\");\n}\nfunction queueForUnobservation(observable) {\n if (observable.isPendingUnobservation === false) {\n // invariant(observable._observers.length === 0, \"INTERNAL ERROR, should only queue for unobservation unobserved observables\");\n observable.isPendingUnobservation = true;\n globalState.pendingUnobservations.push(observable);\n }\n}\n/**\n * Batch starts a transaction, at least for purposes of memoizing ComputedValues when nothing else does.\n * During a batch `onBecomeUnobserved` will be called at most once per observable.\n * Avoids unnecessary recalculations.\n */\nfunction startBatch() {\n globalState.inBatch++;\n}\nfunction endBatch() {\n if (--globalState.inBatch === 0) {\n runReactions();\n // the batch is actually about to finish, all unobserving should happen here.\n var list = globalState.pendingUnobservations;\n for (var i = 0; i < list.length; i++) {\n var observable = list[i];\n observable.isPendingUnobservation = false;\n if (observable.observers_.size === 0) {\n if (observable.isBeingObserved) {\n // if this observable had reactive observers, trigger the hooks\n observable.isBeingObserved = false;\n observable.onBUO();\n }\n if (observable instanceof ComputedValue) {\n // computed values are automatically teared down when the last observer leaves\n // this process happens recursively, this computed might be the last observabe of another, etc..\n observable.suspend_();\n }\n }\n }\n globalState.pendingUnobservations = [];\n }\n}\nfunction reportObserved(observable) {\n checkIfStateReadsAreAllowed(observable);\n var derivation = globalState.trackingDerivation;\n if (derivation !== null) {\n /**\n * Simple optimization, give each derivation run an unique id (runId)\n * Check if last time this observable was accessed the same runId is used\n * if this is the case, the relation is already known\n */\n if (derivation.runId_ !== observable.lastAccessedBy_) {\n observable.lastAccessedBy_ = derivation.runId_;\n // Tried storing newObserving, or observing, or both as Set, but performance didn't come close...\n derivation.newObserving_[derivation.unboundDepsCount_++] = observable;\n if (!observable.isBeingObserved && globalState.trackingContext) {\n observable.isBeingObserved = true;\n observable.onBO();\n }\n }\n return observable.isBeingObserved;\n } else if (observable.observers_.size === 0 && globalState.inBatch > 0) {\n queueForUnobservation(observable);\n }\n return false;\n}\n// function invariantLOS(observable: IObservable, msg: string) {\n// // it's expensive so better not run it in produciton. but temporarily helpful for testing\n// const min = getObservers(observable).reduce((a, b) => Math.min(a, b.dependenciesState), 2)\n// if (min >= observable.lowestObserverState) return // <- the only assumption about `lowestObserverState`\n// throw new Error(\n// \"lowestObserverState is wrong for \" +\n// msg +\n// \" because \" +\n// min +\n// \" < \" +\n// observable.lowestObserverState\n// )\n// }\n/**\n * NOTE: current propagation mechanism will in case of self reruning autoruns behave unexpectedly\n * It will propagate changes to observers from previous run\n * It's hard or maybe impossible (with reasonable perf) to get it right with current approach\n * Hopefully self reruning autoruns aren't a feature people should depend on\n * Also most basic use cases should be ok\n */\n// Called by Atom when its value changes\nfunction propagateChanged(observable) {\n // invariantLOS(observable, \"changed start\");\n if (observable.lowestObserverState_ === IDerivationState_.STALE_) {\n return;\n }\n observable.lowestObserverState_ = IDerivationState_.STALE_;\n // Ideally we use for..of here, but the downcompiled version is really slow...\n observable.observers_.forEach(function (d) {\n if (d.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {\n if ( true && d.isTracing_ !== TraceMode.NONE) {\n logTraceInfo(d, observable);\n }\n d.onBecomeStale_();\n }\n d.dependenciesState_ = IDerivationState_.STALE_;\n });\n // invariantLOS(observable, \"changed end\");\n}\n// Called by ComputedValue when it recalculate and its value changed\nfunction propagateChangeConfirmed(observable) {\n // invariantLOS(observable, \"confirmed start\");\n if (observable.lowestObserverState_ === IDerivationState_.STALE_) {\n return;\n }\n observable.lowestObserverState_ = IDerivationState_.STALE_;\n observable.observers_.forEach(function (d) {\n if (d.dependenciesState_ === IDerivationState_.POSSIBLY_STALE_) {\n d.dependenciesState_ = IDerivationState_.STALE_;\n if ( true && d.isTracing_ !== TraceMode.NONE) {\n logTraceInfo(d, observable);\n }\n } else if (d.dependenciesState_ === IDerivationState_.UP_TO_DATE_ // this happens during computing of `d`, just keep lowestObserverState up to date.\n ) {\n observable.lowestObserverState_ = IDerivationState_.UP_TO_DATE_;\n }\n });\n // invariantLOS(observable, \"confirmed end\");\n}\n// Used by computed when its dependency changed, but we don't wan't to immediately recompute.\nfunction propagateMaybeChanged(observable) {\n // invariantLOS(observable, \"maybe start\");\n if (observable.lowestObserverState_ !== IDerivationState_.UP_TO_DATE_) {\n return;\n }\n observable.lowestObserverState_ = IDerivationState_.POSSIBLY_STALE_;\n observable.observers_.forEach(function (d) {\n if (d.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {\n d.dependenciesState_ = IDerivationState_.POSSIBLY_STALE_;\n d.onBecomeStale_();\n }\n });\n // invariantLOS(observable, \"maybe end\");\n}\nfunction logTraceInfo(derivation, observable) {\n console.log(\"[mobx.trace] '\" + derivation.name_ + \"' is invalidated due to a change in: '\" + observable.name_ + \"'\");\n if (derivation.isTracing_ === TraceMode.BREAK) {\n var lines = [];\n printDepTree(getDependencyTree(derivation), lines, 1);\n // prettier-ignore\n new Function(\"debugger;\\n/*\\nTracing '\" + derivation.name_ + \"'\\n\\nYou are entering this break point because derivation '\" + derivation.name_ + \"' is being traced and '\" + observable.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\" + (derivation instanceof ComputedValue ? derivation.derivation.toString().replace(/[*]\\//g, \"/\") : \"\") + \"\\n\\nThe dependencies for this derivation are:\\n\\n\" + lines.join(\"\\n\") + \"\\n*/\\n \")();\n }\n}\nfunction printDepTree(tree, lines, depth) {\n if (lines.length >= 1000) {\n lines.push(\"(and many more)\");\n return;\n }\n lines.push(\"\" + \"\\t\".repeat(depth - 1) + tree.name);\n if (tree.dependencies) {\n tree.dependencies.forEach(function (child) {\n return printDepTree(child, lines, depth + 1);\n });\n }\n}\n\nvar Reaction = /*#__PURE__*/function () {\n function Reaction(name_, onInvalidate_, errorHandler_, requiresObservable_) {\n if (name_ === void 0) {\n name_ = true ? \"Reaction@\" + getNextId() : 0;\n }\n this.name_ = void 0;\n this.onInvalidate_ = void 0;\n this.errorHandler_ = void 0;\n this.requiresObservable_ = void 0;\n this.observing_ = [];\n // nodes we are looking at. Our value depends on these nodes\n this.newObserving_ = [];\n this.dependenciesState_ = IDerivationState_.NOT_TRACKING_;\n this.runId_ = 0;\n this.unboundDepsCount_ = 0;\n this.flags_ = 0;\n this.isTracing_ = TraceMode.NONE;\n this.name_ = name_;\n this.onInvalidate_ = onInvalidate_;\n this.errorHandler_ = errorHandler_;\n this.requiresObservable_ = requiresObservable_;\n }\n var _proto = Reaction.prototype;\n _proto.onBecomeStale_ = function onBecomeStale_() {\n this.schedule_();\n };\n _proto.schedule_ = function schedule_() {\n if (!this.isScheduled) {\n this.isScheduled = true;\n globalState.pendingReactions.push(this);\n runReactions();\n }\n }\n /**\n * internal, use schedule() if you intend to kick off a reaction\n */;\n _proto.runReaction_ = function runReaction_() {\n if (!this.isDisposed) {\n startBatch();\n this.isScheduled = false;\n var prev = globalState.trackingContext;\n globalState.trackingContext = this;\n if (shouldCompute(this)) {\n this.isTrackPending = true;\n try {\n this.onInvalidate_();\n if ( true && this.isTrackPending && isSpyEnabled()) {\n // onInvalidate didn't trigger track right away..\n spyReport({\n name: this.name_,\n type: \"scheduled-reaction\"\n });\n }\n } catch (e) {\n this.reportExceptionInDerivation_(e);\n }\n }\n globalState.trackingContext = prev;\n endBatch();\n }\n };\n _proto.track = function track(fn) {\n if (this.isDisposed) {\n return;\n // console.warn(\"Reaction already disposed\") // Note: Not a warning / error in mobx 4 either\n }\n startBatch();\n var notify = isSpyEnabled();\n var startTime;\n if ( true && notify) {\n startTime = Date.now();\n spyReportStart({\n name: this.name_,\n type: \"reaction\"\n });\n }\n this.isRunning = true;\n var prevReaction = globalState.trackingContext; // reactions could create reactions...\n globalState.trackingContext = this;\n var result = trackDerivedFunction(this, fn, undefined);\n globalState.trackingContext = prevReaction;\n this.isRunning = false;\n this.isTrackPending = false;\n if (this.isDisposed) {\n // disposed during last run. Clean up everything that was bound after the dispose call.\n clearObserving(this);\n }\n if (isCaughtException(result)) {\n this.reportExceptionInDerivation_(result.cause);\n }\n if ( true && notify) {\n spyReportEnd({\n time: Date.now() - startTime\n });\n }\n endBatch();\n };\n _proto.reportExceptionInDerivation_ = function reportExceptionInDerivation_(error) {\n var _this = this;\n if (this.errorHandler_) {\n this.errorHandler_(error, this);\n return;\n }\n if (globalState.disableErrorBoundaries) {\n throw error;\n }\n var message = true ? \"[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '\" + this + \"'\" : 0;\n if (!globalState.suppressReactionErrors) {\n console.error(message, error);\n /** If debugging brought you here, please, read the above message :-). Tnx! */\n } else if (true) {\n console.warn(\"[mobx] (error in reaction '\" + this.name_ + \"' suppressed, fix error of causing action below)\");\n } // prettier-ignore\n if ( true && isSpyEnabled()) {\n spyReport({\n type: \"error\",\n name: this.name_,\n message: message,\n error: \"\" + error\n });\n }\n globalState.globalReactionErrorHandlers.forEach(function (f) {\n return f(error, _this);\n });\n };\n _proto.dispose = function dispose() {\n if (!this.isDisposed) {\n this.isDisposed = true;\n if (!this.isRunning) {\n // if disposed while running, clean up later. Maybe not optimal, but rare case\n startBatch();\n clearObserving(this);\n endBatch();\n }\n }\n };\n _proto.getDisposer_ = function getDisposer_(abortSignal) {\n var _this2 = this;\n var dispose = function dispose() {\n _this2.dispose();\n abortSignal == null || abortSignal.removeEventListener == null || abortSignal.removeEventListener(\"abort\", dispose);\n };\n abortSignal == null || abortSignal.addEventListener == null || abortSignal.addEventListener(\"abort\", dispose);\n dispose[$mobx] = this;\n return dispose;\n };\n _proto.toString = function toString() {\n return \"Reaction[\" + this.name_ + \"]\";\n };\n _proto.trace = function trace$1(enterBreakPoint) {\n if (enterBreakPoint === void 0) {\n enterBreakPoint = false;\n }\n trace(this, enterBreakPoint);\n };\n return _createClass(Reaction, [{\n key: \"isDisposed\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isDisposedMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isDisposedMask_, newValue);\n }\n }, {\n key: \"isScheduled\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isScheduledMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isScheduledMask_, newValue);\n }\n }, {\n key: \"isTrackPending\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isTrackPendingMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isTrackPendingMask_, newValue);\n }\n }, {\n key: \"isRunning\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isRunningMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isRunningMask_, newValue);\n }\n }, {\n key: \"diffValue\",\n get: function get() {\n return getFlag(this.flags_, Reaction.diffValueMask_) ? 1 : 0;\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.diffValueMask_, newValue === 1 ? true : false);\n }\n }]);\n}();\nReaction.isDisposedMask_ = 1;\nReaction.isScheduledMask_ = 2;\nReaction.isTrackPendingMask_ = 4;\nReaction.isRunningMask_ = 8;\nReaction.diffValueMask_ = 16;\nfunction onReactionError(handler) {\n globalState.globalReactionErrorHandlers.push(handler);\n return function () {\n var idx = globalState.globalReactionErrorHandlers.indexOf(handler);\n if (idx >= 0) {\n globalState.globalReactionErrorHandlers.splice(idx, 1);\n }\n };\n}\n/**\n * Magic number alert!\n * Defines within how many times a reaction is allowed to re-trigger itself\n * until it is assumed that this is gonna be a never ending loop...\n */\nvar MAX_REACTION_ITERATIONS = 100;\nvar reactionScheduler = function reactionScheduler(f) {\n return f();\n};\nfunction runReactions() {\n // Trampolining, if runReactions are already running, new reactions will be picked up\n if (globalState.inBatch > 0 || globalState.isRunningReactions) {\n return;\n }\n reactionScheduler(runReactionsHelper);\n}\nfunction runReactionsHelper() {\n globalState.isRunningReactions = true;\n var allReactions = globalState.pendingReactions;\n var iterations = 0;\n // While running reactions, new reactions might be triggered.\n // Hence we work with two variables and check whether\n // we converge to no remaining reactions after a while.\n while (allReactions.length > 0) {\n if (++iterations === MAX_REACTION_ITERATIONS) {\n console.error( true ? \"Reaction doesn't converge to a stable state after \" + MAX_REACTION_ITERATIONS + \" iterations.\" + (\" Probably there is a cycle in the reactive function: \" + allReactions[0]) : 0);\n allReactions.splice(0); // clear reactions\n }\n var remainingReactions = allReactions.splice(0);\n for (var i = 0, l = remainingReactions.length; i < l; i++) {\n remainingReactions[i].runReaction_();\n }\n }\n globalState.isRunningReactions = false;\n}\nvar isReaction = /*#__PURE__*/createInstanceofPredicate(\"Reaction\", Reaction);\nfunction setReactionScheduler(fn) {\n var baseScheduler = reactionScheduler;\n reactionScheduler = function reactionScheduler(f) {\n return fn(function () {\n return baseScheduler(f);\n });\n };\n}\n\nfunction isSpyEnabled() {\n return true && !!globalState.spyListeners.length;\n}\nfunction spyReport(event) {\n if (false) {} // dead code elimination can do the rest\n if (!globalState.spyListeners.length) {\n return;\n }\n var listeners = globalState.spyListeners;\n for (var i = 0, l = listeners.length; i < l; i++) {\n listeners[i](event);\n }\n}\nfunction spyReportStart(event) {\n if (false) {}\n var change = _extends({}, event, {\n spyReportStart: true\n });\n spyReport(change);\n}\nvar END_EVENT = {\n type: \"report-end\",\n spyReportEnd: true\n};\nfunction spyReportEnd(change) {\n if (false) {}\n if (change) {\n spyReport(_extends({}, change, {\n type: \"report-end\",\n spyReportEnd: true\n }));\n } else {\n spyReport(END_EVENT);\n }\n}\nfunction spy(listener) {\n if (false) {} else {\n globalState.spyListeners.push(listener);\n return once(function () {\n globalState.spyListeners = globalState.spyListeners.filter(function (l) {\n return l !== listener;\n });\n });\n }\n}\n\nvar ACTION = \"action\";\nvar ACTION_BOUND = \"action.bound\";\nvar AUTOACTION = \"autoAction\";\nvar AUTOACTION_BOUND = \"autoAction.bound\";\nvar DEFAULT_ACTION_NAME = \"\";\nvar actionAnnotation = /*#__PURE__*/createActionAnnotation(ACTION);\nvar actionBoundAnnotation = /*#__PURE__*/createActionAnnotation(ACTION_BOUND, {\n bound: true\n});\nvar autoActionAnnotation = /*#__PURE__*/createActionAnnotation(AUTOACTION, {\n autoAction: true\n});\nvar autoActionBoundAnnotation = /*#__PURE__*/createActionAnnotation(AUTOACTION_BOUND, {\n autoAction: true,\n bound: true\n});\nfunction createActionFactory(autoAction) {\n var res = function action(arg1, arg2) {\n // action(fn() {})\n if (isFunction(arg1)) {\n return createAction(arg1.name || DEFAULT_ACTION_NAME, arg1, autoAction);\n }\n // action(\"name\", fn() {})\n if (isFunction(arg2)) {\n return createAction(arg1, arg2, autoAction);\n }\n // @action (2022.3 Decorators)\n if (is20223Decorator(arg2)) {\n return (autoAction ? autoActionAnnotation : actionAnnotation).decorate_20223_(arg1, arg2);\n }\n // @action\n if (isStringish(arg2)) {\n return storeAnnotation(arg1, arg2, autoAction ? autoActionAnnotation : actionAnnotation);\n }\n // action(\"name\") & @action(\"name\")\n if (isStringish(arg1)) {\n return createDecoratorAnnotation(createActionAnnotation(autoAction ? AUTOACTION : ACTION, {\n name: arg1,\n autoAction: autoAction\n }));\n }\n if (true) {\n die(\"Invalid arguments for `action`\");\n }\n };\n return res;\n}\nvar action = /*#__PURE__*/createActionFactory(false);\nObject.assign(action, actionAnnotation);\nvar autoAction = /*#__PURE__*/createActionFactory(true);\nObject.assign(autoAction, autoActionAnnotation);\naction.bound = /*#__PURE__*/createDecoratorAnnotation(actionBoundAnnotation);\nautoAction.bound = /*#__PURE__*/createDecoratorAnnotation(autoActionBoundAnnotation);\nfunction runInAction(fn) {\n return executeAction(fn.name || DEFAULT_ACTION_NAME, false, fn, this, undefined);\n}\nfunction isAction(thing) {\n return isFunction(thing) && thing.isMobxAction === true;\n}\n\n/**\n * Creates a named reactive view and keeps it alive, so that the view is always\n * updated if one of the dependencies changes, even when the view is not further used by something else.\n * @param view The reactive view\n * @returns disposer function, which can be used to stop the view from being updated in the future.\n */\nfunction autorun(view, opts) {\n var _opts$name, _opts, _opts2, _opts3;\n if (opts === void 0) {\n opts = EMPTY_OBJECT;\n }\n if (true) {\n if (!isFunction(view)) {\n die(\"Autorun expects a function as first argument\");\n }\n if (isAction(view)) {\n die(\"Autorun does not accept actions since actions are untrackable\");\n }\n }\n var name = (_opts$name = (_opts = opts) == null ? void 0 : _opts.name) != null ? _opts$name : true ? view.name || \"Autorun@\" + getNextId() : 0;\n var runSync = !opts.scheduler && !opts.delay;\n var reaction;\n if (runSync) {\n // normal autorun\n reaction = new Reaction(name, function () {\n this.track(reactionRunner);\n }, opts.onError, opts.requiresObservable);\n } else {\n var scheduler = createSchedulerFromOptions(opts);\n // debounced autorun\n var isScheduled = false;\n reaction = new Reaction(name, function () {\n if (!isScheduled) {\n isScheduled = true;\n scheduler(function () {\n isScheduled = false;\n if (!reaction.isDisposed) {\n reaction.track(reactionRunner);\n }\n });\n }\n }, opts.onError, opts.requiresObservable);\n }\n function reactionRunner() {\n view(reaction);\n }\n if (!((_opts2 = opts) != null && (_opts2 = _opts2.signal) != null && _opts2.aborted)) {\n reaction.schedule_();\n }\n return reaction.getDisposer_((_opts3 = opts) == null ? void 0 : _opts3.signal);\n}\nvar run = function run(f) {\n return f();\n};\nfunction createSchedulerFromOptions(opts) {\n return opts.scheduler ? opts.scheduler : opts.delay ? function (f) {\n return setTimeout(f, opts.delay);\n } : run;\n}\nfunction reaction(expression, effect, opts) {\n var _opts$name2, _opts4, _opts5;\n if (opts === void 0) {\n opts = EMPTY_OBJECT;\n }\n if (true) {\n if (!isFunction(expression) || !isFunction(effect)) {\n die(\"First and second argument to reaction should be functions\");\n }\n if (!isPlainObject(opts)) {\n die(\"Third argument of reactions should be an object\");\n }\n }\n var name = (_opts$name2 = opts.name) != null ? _opts$name2 : true ? \"Reaction@\" + getNextId() : 0;\n var effectAction = action(name, opts.onError ? wrapErrorHandler(opts.onError, effect) : effect);\n var runSync = !opts.scheduler && !opts.delay;\n var scheduler = createSchedulerFromOptions(opts);\n var firstTime = true;\n var isScheduled = false;\n var value;\n var equals = opts.compareStructural ? comparer.structural : opts.equals || comparer[\"default\"];\n var r = new Reaction(name, function () {\n if (firstTime || runSync) {\n reactionRunner();\n } else if (!isScheduled) {\n isScheduled = true;\n scheduler(reactionRunner);\n }\n }, opts.onError, opts.requiresObservable);\n function reactionRunner() {\n isScheduled = false;\n if (r.isDisposed) {\n return;\n }\n var changed = false;\n var oldValue = value;\n r.track(function () {\n var nextValue = allowStateChanges(false, function () {\n return expression(r);\n });\n changed = firstTime || !equals(value, nextValue);\n value = nextValue;\n });\n if (firstTime && opts.fireImmediately) {\n effectAction(value, oldValue, r);\n } else if (!firstTime && changed) {\n effectAction(value, oldValue, r);\n }\n firstTime = false;\n }\n if (!((_opts4 = opts) != null && (_opts4 = _opts4.signal) != null && _opts4.aborted)) {\n r.schedule_();\n }\n return r.getDisposer_((_opts5 = opts) == null ? void 0 : _opts5.signal);\n}\nfunction wrapErrorHandler(errorHandler, baseFn) {\n return function () {\n try {\n return baseFn.apply(this, arguments);\n } catch (e) {\n errorHandler.call(this, e);\n }\n };\n}\n\nvar ON_BECOME_OBSERVED = \"onBO\";\nvar ON_BECOME_UNOBSERVED = \"onBUO\";\nfunction onBecomeObserved(thing, arg2, arg3) {\n return interceptHook(ON_BECOME_OBSERVED, thing, arg2, arg3);\n}\nfunction onBecomeUnobserved(thing, arg2, arg3) {\n return interceptHook(ON_BECOME_UNOBSERVED, thing, arg2, arg3);\n}\nfunction interceptHook(hook, thing, arg2, arg3) {\n var atom = typeof arg3 === \"function\" ? getAtom(thing, arg2) : getAtom(thing);\n var cb = isFunction(arg3) ? arg3 : arg2;\n var listenersKey = hook + \"L\";\n if (atom[listenersKey]) {\n atom[listenersKey].add(cb);\n } else {\n atom[listenersKey] = new Set([cb]);\n }\n return function () {\n var hookListeners = atom[listenersKey];\n if (hookListeners) {\n hookListeners[\"delete\"](cb);\n if (hookListeners.size === 0) {\n delete atom[listenersKey];\n }\n }\n };\n}\n\nvar NEVER = \"never\";\nvar ALWAYS = \"always\";\nvar OBSERVED = \"observed\";\n// const IF_AVAILABLE = \"ifavailable\"\nfunction configure(options) {\n if (options.isolateGlobalState === true) {\n isolateGlobalState();\n }\n var useProxies = options.useProxies,\n enforceActions = options.enforceActions;\n if (useProxies !== undefined) {\n globalState.useProxies = useProxies === ALWAYS ? true : useProxies === NEVER ? false : typeof Proxy !== \"undefined\";\n }\n if (useProxies === \"ifavailable\") {\n globalState.verifyProxies = true;\n }\n if (enforceActions !== undefined) {\n var ea = enforceActions === ALWAYS ? ALWAYS : enforceActions === OBSERVED;\n globalState.enforceActions = ea;\n globalState.allowStateChanges = ea === true || ea === ALWAYS ? false : true;\n }\n [\"computedRequiresReaction\", \"reactionRequiresObservable\", \"observableRequiresReaction\", \"disableErrorBoundaries\", \"safeDescriptors\"].forEach(function (key) {\n if (key in options) {\n globalState[key] = !!options[key];\n }\n });\n globalState.allowStateReads = !globalState.observableRequiresReaction;\n if ( true && globalState.disableErrorBoundaries === true) {\n console.warn(\"WARNING: Debug feature only. MobX will NOT recover from errors when `disableErrorBoundaries` is enabled.\");\n }\n if (options.reactionScheduler) {\n setReactionScheduler(options.reactionScheduler);\n }\n}\n\nfunction extendObservable(target, properties, annotations, options) {\n if (true) {\n if (arguments.length > 4) {\n die(\"'extendObservable' expected 2-4 arguments\");\n }\n if (typeof target !== \"object\") {\n die(\"'extendObservable' expects an object as first argument\");\n }\n if (isObservableMap(target)) {\n die(\"'extendObservable' should not be used on maps, use map.merge instead\");\n }\n if (!isPlainObject(properties)) {\n die(\"'extendObservable' only accepts plain objects as second argument\");\n }\n if (isObservable(properties) || isObservable(annotations)) {\n die(\"Extending an object with another observable (object) is not supported\");\n }\n }\n // Pull descriptors first, so we don't have to deal with props added by administration ($mobx)\n var descriptors = getOwnPropertyDescriptors(properties);\n initObservable(function () {\n var adm = asObservableObject(target, options)[$mobx];\n ownKeys(descriptors).forEach(function (key) {\n adm.extend_(key, descriptors[key],\n // must pass \"undefined\" for { key: undefined }\n !annotations ? true : key in annotations ? annotations[key] : true);\n });\n });\n return target;\n}\n\nfunction getDependencyTree(thing, property) {\n return nodeToDependencyTree(getAtom(thing, property));\n}\nfunction nodeToDependencyTree(node) {\n var result = {\n name: node.name_\n };\n if (node.observing_ && node.observing_.length > 0) {\n result.dependencies = unique(node.observing_).map(nodeToDependencyTree);\n }\n return result;\n}\nfunction getObserverTree(thing, property) {\n return nodeToObserverTree(getAtom(thing, property));\n}\nfunction nodeToObserverTree(node) {\n var result = {\n name: node.name_\n };\n if (hasObservers(node)) {\n result.observers = Array.from(getObservers(node)).map(nodeToObserverTree);\n }\n return result;\n}\nfunction unique(list) {\n return Array.from(new Set(list));\n}\n\nvar generatorId = 0;\nfunction FlowCancellationError() {\n this.message = \"FLOW_CANCELLED\";\n}\nFlowCancellationError.prototype = /*#__PURE__*/Object.create(Error.prototype);\nfunction isFlowCancellationError(error) {\n return error instanceof FlowCancellationError;\n}\nvar flowAnnotation = /*#__PURE__*/createFlowAnnotation(\"flow\");\nvar flowBoundAnnotation = /*#__PURE__*/createFlowAnnotation(\"flow.bound\", {\n bound: true\n});\nvar flow = /*#__PURE__*/Object.assign(function flow(arg1, arg2) {\n // @flow (2022.3 Decorators)\n if (is20223Decorator(arg2)) {\n return flowAnnotation.decorate_20223_(arg1, arg2);\n }\n // @flow\n if (isStringish(arg2)) {\n return storeAnnotation(arg1, arg2, flowAnnotation);\n }\n // flow(fn)\n if ( true && arguments.length !== 1) {\n die(\"Flow expects single argument with generator function\");\n }\n var generator = arg1;\n var name = generator.name || \"\";\n // Implementation based on https://github.com/tj/co/blob/master/index.js\n var res = function res() {\n var ctx = this;\n var args = arguments;\n var runId = ++generatorId;\n var gen = action(name + \" - runid: \" + runId + \" - init\", generator).apply(ctx, args);\n var rejector;\n var pendingPromise = undefined;\n var promise = new Promise(function (resolve, reject) {\n var stepId = 0;\n rejector = reject;\n function onFulfilled(res) {\n pendingPromise = undefined;\n var ret;\n try {\n ret = action(name + \" - runid: \" + runId + \" - yield \" + stepId++, gen.next).call(gen, res);\n } catch (e) {\n return reject(e);\n }\n next(ret);\n }\n function onRejected(err) {\n pendingPromise = undefined;\n var ret;\n try {\n ret = action(name + \" - runid: \" + runId + \" - yield \" + stepId++, gen[\"throw\"]).call(gen, err);\n } catch (e) {\n return reject(e);\n }\n next(ret);\n }\n function next(ret) {\n if (isFunction(ret == null ? void 0 : ret.then)) {\n // an async iterator\n ret.then(next, reject);\n return;\n }\n if (ret.done) {\n return resolve(ret.value);\n }\n pendingPromise = Promise.resolve(ret.value);\n return pendingPromise.then(onFulfilled, onRejected);\n }\n onFulfilled(undefined); // kick off the process\n });\n promise.cancel = action(name + \" - runid: \" + runId + \" - cancel\", function () {\n try {\n if (pendingPromise) {\n cancelPromise(pendingPromise);\n }\n // Finally block can return (or yield) stuff..\n var _res = gen[\"return\"](undefined);\n // eat anything that promise would do, it's cancelled!\n var yieldedPromise = Promise.resolve(_res.value);\n yieldedPromise.then(noop, noop);\n cancelPromise(yieldedPromise); // maybe it can be cancelled :)\n // reject our original promise\n rejector(new FlowCancellationError());\n } catch (e) {\n rejector(e); // there could be a throwing finally block\n }\n });\n return promise;\n };\n res.isMobXFlow = true;\n return res;\n}, flowAnnotation);\nflow.bound = /*#__PURE__*/createDecoratorAnnotation(flowBoundAnnotation);\nfunction cancelPromise(promise) {\n if (isFunction(promise.cancel)) {\n promise.cancel();\n }\n}\nfunction flowResult(result) {\n return result; // just tricking TypeScript :)\n}\nfunction isFlow(fn) {\n return (fn == null ? void 0 : fn.isMobXFlow) === true;\n}\n\nfunction interceptReads(thing, propOrHandler, handler) {\n var target;\n if (isObservableMap(thing) || isObservableArray(thing) || isObservableValue(thing)) {\n target = getAdministration(thing);\n } else if (isObservableObject(thing)) {\n if ( true && !isStringish(propOrHandler)) {\n return die(\"InterceptReads can only be used with a specific property, not with an object in general\");\n }\n target = getAdministration(thing, propOrHandler);\n } else if (true) {\n return die(\"Expected observable map, object or array as first array\");\n }\n if ( true && target.dehancer !== undefined) {\n return die(\"An intercept reader was already established\");\n }\n target.dehancer = typeof propOrHandler === \"function\" ? propOrHandler : handler;\n return function () {\n target.dehancer = undefined;\n };\n}\n\nfunction intercept(thing, propOrHandler, handler) {\n if (isFunction(handler)) {\n return interceptProperty(thing, propOrHandler, handler);\n } else {\n return interceptInterceptable(thing, propOrHandler);\n }\n}\nfunction interceptInterceptable(thing, handler) {\n return getAdministration(thing).intercept_(handler);\n}\nfunction interceptProperty(thing, property, handler) {\n return getAdministration(thing, property).intercept_(handler);\n}\n\nfunction _isComputed(value, property) {\n if (property === undefined) {\n return isComputedValue(value);\n }\n if (isObservableObject(value) === false) {\n return false;\n }\n if (!value[$mobx].values_.has(property)) {\n return false;\n }\n var atom = getAtom(value, property);\n return isComputedValue(atom);\n}\nfunction isComputed(value) {\n if ( true && arguments.length > 1) {\n return die(\"isComputed expects only 1 argument. Use isComputedProp to inspect the observability of a property\");\n }\n return _isComputed(value);\n}\nfunction isComputedProp(value, propName) {\n if ( true && !isStringish(propName)) {\n return die(\"isComputed expected a property name as second argument\");\n }\n return _isComputed(value, propName);\n}\n\nfunction _isObservable(value, property) {\n if (!value) {\n return false;\n }\n if (property !== undefined) {\n if ( true && (isObservableMap(value) || isObservableArray(value))) {\n return die(\"isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead.\");\n }\n if (isObservableObject(value)) {\n return value[$mobx].values_.has(property);\n }\n return false;\n }\n // For first check, see #701\n return isObservableObject(value) || !!value[$mobx] || isAtom(value) || isReaction(value) || isComputedValue(value);\n}\nfunction isObservable(value) {\n if ( true && arguments.length !== 1) {\n die(\"isObservable expects only 1 argument. Use isObservableProp to inspect the observability of a property\");\n }\n return _isObservable(value);\n}\nfunction isObservableProp(value, propName) {\n if ( true && !isStringish(propName)) {\n return die(\"expected a property name as second argument\");\n }\n return _isObservable(value, propName);\n}\n\nfunction keys(obj) {\n if (isObservableObject(obj)) {\n return obj[$mobx].keys_();\n }\n if (isObservableMap(obj) || isObservableSet(obj)) {\n return Array.from(obj.keys());\n }\n if (isObservableArray(obj)) {\n return obj.map(function (_, index) {\n return index;\n });\n }\n die(5);\n}\nfunction values(obj) {\n if (isObservableObject(obj)) {\n return keys(obj).map(function (key) {\n return obj[key];\n });\n }\n if (isObservableMap(obj)) {\n return keys(obj).map(function (key) {\n return obj.get(key);\n });\n }\n if (isObservableSet(obj)) {\n return Array.from(obj.values());\n }\n if (isObservableArray(obj)) {\n return obj.slice();\n }\n die(6);\n}\nfunction entries(obj) {\n if (isObservableObject(obj)) {\n return keys(obj).map(function (key) {\n return [key, obj[key]];\n });\n }\n if (isObservableMap(obj)) {\n return keys(obj).map(function (key) {\n return [key, obj.get(key)];\n });\n }\n if (isObservableSet(obj)) {\n return Array.from(obj.entries());\n }\n if (isObservableArray(obj)) {\n return obj.map(function (key, index) {\n return [index, key];\n });\n }\n die(7);\n}\nfunction set(obj, key, value) {\n if (arguments.length === 2 && !isObservableSet(obj)) {\n startBatch();\n var _values = key;\n try {\n for (var _key in _values) {\n set(obj, _key, _values[_key]);\n }\n } finally {\n endBatch();\n }\n return;\n }\n if (isObservableObject(obj)) {\n obj[$mobx].set_(key, value);\n } else if (isObservableMap(obj)) {\n obj.set(key, value);\n } else if (isObservableSet(obj)) {\n obj.add(key);\n } else if (isObservableArray(obj)) {\n if (typeof key !== \"number\") {\n key = parseInt(key, 10);\n }\n if (key < 0) {\n die(\"Invalid index: '\" + key + \"'\");\n }\n startBatch();\n if (key >= obj.length) {\n obj.length = key + 1;\n }\n obj[key] = value;\n endBatch();\n } else {\n die(8);\n }\n}\nfunction remove(obj, key) {\n if (isObservableObject(obj)) {\n obj[$mobx].delete_(key);\n } else if (isObservableMap(obj)) {\n obj[\"delete\"](key);\n } else if (isObservableSet(obj)) {\n obj[\"delete\"](key);\n } else if (isObservableArray(obj)) {\n if (typeof key !== \"number\") {\n key = parseInt(key, 10);\n }\n obj.splice(key, 1);\n } else {\n die(9);\n }\n}\nfunction has(obj, key) {\n if (isObservableObject(obj)) {\n return obj[$mobx].has_(key);\n } else if (isObservableMap(obj)) {\n return obj.has(key);\n } else if (isObservableSet(obj)) {\n return obj.has(key);\n } else if (isObservableArray(obj)) {\n return key >= 0 && key < obj.length;\n }\n die(10);\n}\nfunction get(obj, key) {\n if (!has(obj, key)) {\n return undefined;\n }\n if (isObservableObject(obj)) {\n return obj[$mobx].get_(key);\n } else if (isObservableMap(obj)) {\n return obj.get(key);\n } else if (isObservableArray(obj)) {\n return obj[key];\n }\n die(11);\n}\nfunction apiDefineProperty(obj, key, descriptor) {\n if (isObservableObject(obj)) {\n return obj[$mobx].defineProperty_(key, descriptor);\n }\n die(39);\n}\nfunction apiOwnKeys(obj) {\n if (isObservableObject(obj)) {\n return obj[$mobx].ownKeys_();\n }\n die(38);\n}\n\nfunction observe(thing, propOrCb, cbOrFire, fireImmediately) {\n if (isFunction(cbOrFire)) {\n return observeObservableProperty(thing, propOrCb, cbOrFire, fireImmediately);\n } else {\n return observeObservable(thing, propOrCb, cbOrFire);\n }\n}\nfunction observeObservable(thing, listener, fireImmediately) {\n return getAdministration(thing).observe_(listener, fireImmediately);\n}\nfunction observeObservableProperty(thing, property, listener, fireImmediately) {\n return getAdministration(thing, property).observe_(listener, fireImmediately);\n}\n\nfunction cache(map, key, value) {\n map.set(key, value);\n return value;\n}\nfunction toJSHelper(source, __alreadySeen) {\n if (source == null || typeof source !== \"object\" || source instanceof Date || !isObservable(source)) {\n return source;\n }\n if (isObservableValue(source) || isComputedValue(source)) {\n return toJSHelper(source.get(), __alreadySeen);\n }\n if (__alreadySeen.has(source)) {\n return __alreadySeen.get(source);\n }\n if (isObservableArray(source)) {\n var res = cache(__alreadySeen, source, new Array(source.length));\n source.forEach(function (value, idx) {\n res[idx] = toJSHelper(value, __alreadySeen);\n });\n return res;\n }\n if (isObservableSet(source)) {\n var _res = cache(__alreadySeen, source, new Set());\n source.forEach(function (value) {\n _res.add(toJSHelper(value, __alreadySeen));\n });\n return _res;\n }\n if (isObservableMap(source)) {\n var _res2 = cache(__alreadySeen, source, new Map());\n source.forEach(function (value, key) {\n _res2.set(key, toJSHelper(value, __alreadySeen));\n });\n return _res2;\n } else {\n // must be observable object\n var _res3 = cache(__alreadySeen, source, {});\n apiOwnKeys(source).forEach(function (key) {\n if (objectPrototype.propertyIsEnumerable.call(source, key)) {\n _res3[key] = toJSHelper(source[key], __alreadySeen);\n }\n });\n return _res3;\n }\n}\n/**\n * Recursively converts an observable to it's non-observable native counterpart.\n * It does NOT recurse into non-observables, these are left as they are, even if they contain observables.\n * Computed and other non-enumerable properties are completely ignored.\n * Complex scenarios require custom solution, eg implementing `toJSON` or using `serializr` lib.\n */\nfunction toJS(source, options) {\n if ( true && options) {\n die(\"toJS no longer supports options\");\n }\n return toJSHelper(source, new Map());\n}\n\nfunction trace() {\n if (false) {}\n var enterBreakPoint = false;\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n if (typeof args[args.length - 1] === \"boolean\") {\n enterBreakPoint = args.pop();\n }\n var derivation = getAtomFromArgs(args);\n if (!derivation) {\n return die(\"'trace(break?)' can only be used inside a tracked computed value or a Reaction. Consider passing in the computed value or reaction explicitly\");\n }\n if (derivation.isTracing_ === TraceMode.NONE) {\n console.log(\"[mobx.trace] '\" + derivation.name_ + \"' tracing enabled\");\n }\n derivation.isTracing_ = enterBreakPoint ? TraceMode.BREAK : TraceMode.LOG;\n}\nfunction getAtomFromArgs(args) {\n switch (args.length) {\n case 0:\n return globalState.trackingDerivation;\n case 1:\n return getAtom(args[0]);\n case 2:\n return getAtom(args[0], args[1]);\n }\n}\n\n/**\n * During a transaction no views are updated until the end of the transaction.\n * The transaction will be run synchronously nonetheless.\n *\n * @param action a function that updates some reactive state\n * @returns any value that was returned by the 'action' parameter.\n */\nfunction transaction(action, thisArg) {\n if (thisArg === void 0) {\n thisArg = undefined;\n }\n startBatch();\n try {\n return action.apply(thisArg);\n } finally {\n endBatch();\n }\n}\n\nfunction when(predicate, arg1, arg2) {\n if (arguments.length === 1 || arg1 && typeof arg1 === \"object\") {\n return whenPromise(predicate, arg1);\n }\n return _when(predicate, arg1, arg2 || {});\n}\nfunction _when(predicate, effect, opts) {\n var timeoutHandle;\n if (typeof opts.timeout === \"number\") {\n var error = new Error(\"WHEN_TIMEOUT\");\n timeoutHandle = setTimeout(function () {\n if (!disposer[$mobx].isDisposed) {\n disposer();\n if (opts.onError) {\n opts.onError(error);\n } else {\n throw error;\n }\n }\n }, opts.timeout);\n }\n opts.name = true ? opts.name || \"When@\" + getNextId() : 0;\n var effectAction = createAction( true ? opts.name + \"-effect\" : 0, effect);\n // eslint-disable-next-line\n var disposer = autorun(function (r) {\n // predicate should not change state\n var cond = allowStateChanges(false, predicate);\n if (cond) {\n r.dispose();\n if (timeoutHandle) {\n clearTimeout(timeoutHandle);\n }\n effectAction();\n }\n }, opts);\n return disposer;\n}\nfunction whenPromise(predicate, opts) {\n var _opts$signal;\n if ( true && opts && opts.onError) {\n return die(\"the options 'onError' and 'promise' cannot be combined\");\n }\n if (opts != null && (_opts$signal = opts.signal) != null && _opts$signal.aborted) {\n return Object.assign(Promise.reject(new Error(\"WHEN_ABORTED\")), {\n cancel: function cancel() {\n return null;\n }\n });\n }\n var cancel;\n var abort;\n var res = new Promise(function (resolve, reject) {\n var _opts$signal2;\n var disposer = _when(predicate, resolve, _extends({}, opts, {\n onError: reject\n }));\n cancel = function cancel() {\n disposer();\n reject(new Error(\"WHEN_CANCELLED\"));\n };\n abort = function abort() {\n disposer();\n reject(new Error(\"WHEN_ABORTED\"));\n };\n opts == null || (_opts$signal2 = opts.signal) == null || _opts$signal2.addEventListener == null || _opts$signal2.addEventListener(\"abort\", abort);\n })[\"finally\"](function () {\n var _opts$signal3;\n return opts == null || (_opts$signal3 = opts.signal) == null || _opts$signal3.removeEventListener == null ? void 0 : _opts$signal3.removeEventListener(\"abort\", abort);\n });\n res.cancel = cancel;\n return res;\n}\n\nfunction getAdm(target) {\n return target[$mobx];\n}\n// Optimization: we don't need the intermediate objects and could have a completely custom administration for DynamicObjects,\n// and skip either the internal values map, or the base object with its property descriptors!\nvar objectProxyTraps = {\n has: function has(target, name) {\n if ( true && globalState.trackingDerivation) {\n warnAboutProxyRequirement(\"detect new properties using the 'in' operator. Use 'has' from 'mobx' instead.\");\n }\n return getAdm(target).has_(name);\n },\n get: function get(target, name) {\n return getAdm(target).get_(name);\n },\n set: function set(target, name, value) {\n var _getAdm$set_;\n if (!isStringish(name)) {\n return false;\n }\n if ( true && !getAdm(target).values_.has(name)) {\n warnAboutProxyRequirement(\"add a new observable property through direct assignment. Use 'set' from 'mobx' instead.\");\n }\n // null (intercepted) -> true (success)\n return (_getAdm$set_ = getAdm(target).set_(name, value, true)) != null ? _getAdm$set_ : true;\n },\n deleteProperty: function deleteProperty(target, name) {\n var _getAdm$delete_;\n if (true) {\n warnAboutProxyRequirement(\"delete properties from an observable object. Use 'remove' from 'mobx' instead.\");\n }\n if (!isStringish(name)) {\n return false;\n }\n // null (intercepted) -> true (success)\n return (_getAdm$delete_ = getAdm(target).delete_(name, true)) != null ? _getAdm$delete_ : true;\n },\n defineProperty: function defineProperty(target, name, descriptor) {\n var _getAdm$definePropert;\n if (true) {\n warnAboutProxyRequirement(\"define property on an observable object. Use 'defineProperty' from 'mobx' instead.\");\n }\n // null (intercepted) -> true (success)\n return (_getAdm$definePropert = getAdm(target).defineProperty_(name, descriptor)) != null ? _getAdm$definePropert : true;\n },\n ownKeys: function ownKeys(target) {\n if ( true && globalState.trackingDerivation) {\n warnAboutProxyRequirement(\"iterate keys to detect added / removed properties. Use 'keys' from 'mobx' instead.\");\n }\n return getAdm(target).ownKeys_();\n },\n preventExtensions: function preventExtensions(target) {\n die(13);\n }\n};\nfunction asDynamicObservableObject(target, options) {\n var _target$$mobx, _target$$mobx$proxy_;\n assertProxies();\n target = asObservableObject(target, options);\n return (_target$$mobx$proxy_ = (_target$$mobx = target[$mobx]).proxy_) != null ? _target$$mobx$proxy_ : _target$$mobx.proxy_ = new Proxy(target, objectProxyTraps);\n}\n\nfunction hasInterceptors(interceptable) {\n return interceptable.interceptors_ !== undefined && interceptable.interceptors_.length > 0;\n}\nfunction registerInterceptor(interceptable, handler) {\n var interceptors = interceptable.interceptors_ || (interceptable.interceptors_ = []);\n interceptors.push(handler);\n return once(function () {\n var idx = interceptors.indexOf(handler);\n if (idx !== -1) {\n interceptors.splice(idx, 1);\n }\n });\n}\nfunction interceptChange(interceptable, change) {\n var prevU = untrackedStart();\n try {\n // Interceptor can modify the array, copy it to avoid concurrent modification, see #1950\n var interceptors = [].concat(interceptable.interceptors_ || []);\n for (var i = 0, l = interceptors.length; i < l; i++) {\n change = interceptors[i](change);\n if (change && !change.type) {\n die(14);\n }\n if (!change) {\n break;\n }\n }\n return change;\n } finally {\n untrackedEnd(prevU);\n }\n}\n\nfunction hasListeners(listenable) {\n return listenable.changeListeners_ !== undefined && listenable.changeListeners_.length > 0;\n}\nfunction registerListener(listenable, handler) {\n var listeners = listenable.changeListeners_ || (listenable.changeListeners_ = []);\n listeners.push(handler);\n return once(function () {\n var idx = listeners.indexOf(handler);\n if (idx !== -1) {\n listeners.splice(idx, 1);\n }\n });\n}\nfunction notifyListeners(listenable, change) {\n var prevU = untrackedStart();\n var listeners = listenable.changeListeners_;\n if (!listeners) {\n return;\n }\n listeners = listeners.slice();\n for (var i = 0, l = listeners.length; i < l; i++) {\n listeners[i](change);\n }\n untrackedEnd(prevU);\n}\n\nfunction makeObservable(target, annotations, options) {\n initObservable(function () {\n var _annotations;\n var adm = asObservableObject(target, options)[$mobx];\n if ( true && annotations && target[storedAnnotationsSymbol]) {\n die(\"makeObservable second arg must be nullish when using decorators. Mixing @decorator syntax with annotations is not supported.\");\n }\n // Default to decorators\n (_annotations = annotations) != null ? _annotations : annotations = collectStoredAnnotations(target);\n // Annotate\n ownKeys(annotations).forEach(function (key) {\n return adm.make_(key, annotations[key]);\n });\n });\n return target;\n}\n// proto[keysSymbol] = new Set()\nvar keysSymbol = /*#__PURE__*/Symbol(\"mobx-keys\");\nfunction makeAutoObservable(target, overrides, options) {\n if (true) {\n if (!isPlainObject(target) && !isPlainObject(Object.getPrototypeOf(target))) {\n die(\"'makeAutoObservable' can only be used for classes that don't have a superclass\");\n }\n if (isObservableObject(target)) {\n die(\"makeAutoObservable can only be used on objects not already made observable\");\n }\n }\n // Optimization: avoid visiting protos\n // Assumes that annotation.make_/.extend_ works the same for plain objects\n if (isPlainObject(target)) {\n return extendObservable(target, target, overrides, options);\n }\n initObservable(function () {\n var adm = asObservableObject(target, options)[$mobx];\n // Optimization: cache keys on proto\n // Assumes makeAutoObservable can be called only once per object and can't be used in subclass\n if (!target[keysSymbol]) {\n var proto = Object.getPrototypeOf(target);\n var keys = new Set([].concat(ownKeys(target), ownKeys(proto)));\n keys[\"delete\"](\"constructor\");\n keys[\"delete\"]($mobx);\n addHiddenProp(proto, keysSymbol, keys);\n }\n target[keysSymbol].forEach(function (key) {\n return adm.make_(key,\n // must pass \"undefined\" for { key: undefined }\n !overrides ? true : key in overrides ? overrides[key] : true);\n });\n });\n return target;\n}\n\nvar SPLICE = \"splice\";\nvar UPDATE = \"update\";\nvar MAX_SPLICE_SIZE = 10000; // See e.g. https://github.com/mobxjs/mobx/issues/859\nvar arrayTraps = {\n get: function get(target, name) {\n var adm = target[$mobx];\n if (name === $mobx) {\n return adm;\n }\n if (name === \"length\") {\n return adm.getArrayLength_();\n }\n if (typeof name === \"string\" && !isNaN(name)) {\n return adm.get_(parseInt(name));\n }\n if (hasProp(arrayExtensions, name)) {\n return arrayExtensions[name];\n }\n return target[name];\n },\n set: function set(target, name, value) {\n var adm = target[$mobx];\n if (name === \"length\") {\n adm.setArrayLength_(value);\n }\n if (typeof name === \"symbol\" || isNaN(name)) {\n target[name] = value;\n } else {\n // numeric string\n adm.set_(parseInt(name), value);\n }\n return true;\n },\n preventExtensions: function preventExtensions() {\n die(15);\n }\n};\nvar ObservableArrayAdministration = /*#__PURE__*/function () {\n function ObservableArrayAdministration(name, enhancer, owned_, legacyMode_) {\n if (name === void 0) {\n name = true ? \"ObservableArray@\" + getNextId() : 0;\n }\n this.owned_ = void 0;\n this.legacyMode_ = void 0;\n this.atom_ = void 0;\n this.values_ = [];\n // this is the prop that gets proxied, so can't replace it!\n this.interceptors_ = void 0;\n this.changeListeners_ = void 0;\n this.enhancer_ = void 0;\n this.dehancer = void 0;\n this.proxy_ = void 0;\n this.lastKnownLength_ = 0;\n this.owned_ = owned_;\n this.legacyMode_ = legacyMode_;\n this.atom_ = new Atom(name);\n this.enhancer_ = function (newV, oldV) {\n return enhancer(newV, oldV, true ? name + \"[..]\" : 0);\n };\n }\n var _proto = ObservableArrayAdministration.prototype;\n _proto.dehanceValue_ = function dehanceValue_(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.dehanceValues_ = function dehanceValues_(values) {\n if (this.dehancer !== undefined && values.length > 0) {\n return values.map(this.dehancer);\n }\n return values;\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n if (fireImmediately === void 0) {\n fireImmediately = false;\n }\n if (fireImmediately) {\n listener({\n observableKind: \"array\",\n object: this.proxy_,\n debugObjectName: this.atom_.name_,\n type: \"splice\",\n index: 0,\n added: this.values_.slice(),\n addedCount: this.values_.length,\n removed: [],\n removedCount: 0\n });\n }\n return registerListener(this, listener);\n };\n _proto.getArrayLength_ = function getArrayLength_() {\n this.atom_.reportObserved();\n return this.values_.length;\n };\n _proto.setArrayLength_ = function setArrayLength_(newLength) {\n if (typeof newLength !== \"number\" || isNaN(newLength) || newLength < 0) {\n die(\"Out of range: \" + newLength);\n }\n var currentLength = this.values_.length;\n if (newLength === currentLength) {\n return;\n } else if (newLength > currentLength) {\n var newItems = new Array(newLength - currentLength);\n for (var i = 0; i < newLength - currentLength; i++) {\n newItems[i] = undefined;\n } // No Array.fill everywhere...\n this.spliceWithArray_(currentLength, 0, newItems);\n } else {\n this.spliceWithArray_(newLength, currentLength - newLength);\n }\n };\n _proto.updateArrayLength_ = function updateArrayLength_(oldLength, delta) {\n if (oldLength !== this.lastKnownLength_) {\n die(16);\n }\n this.lastKnownLength_ += delta;\n if (this.legacyMode_ && delta > 0) {\n reserveArrayBuffer(oldLength + delta + 1);\n }\n };\n _proto.spliceWithArray_ = function spliceWithArray_(index, deleteCount, newItems) {\n var _this = this;\n checkIfStateModificationsAreAllowed(this.atom_);\n var length = this.values_.length;\n if (index === undefined) {\n index = 0;\n } else if (index > length) {\n index = length;\n } else if (index < 0) {\n index = Math.max(0, length + index);\n }\n if (arguments.length === 1) {\n deleteCount = length - index;\n } else if (deleteCount === undefined || deleteCount === null) {\n deleteCount = 0;\n } else {\n deleteCount = Math.max(0, Math.min(deleteCount, length - index));\n }\n if (newItems === undefined) {\n newItems = EMPTY_ARRAY;\n }\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_,\n type: SPLICE,\n index: index,\n removedCount: deleteCount,\n added: newItems\n });\n if (!change) {\n return EMPTY_ARRAY;\n }\n deleteCount = change.removedCount;\n newItems = change.added;\n }\n newItems = newItems.length === 0 ? newItems : newItems.map(function (v) {\n return _this.enhancer_(v, undefined);\n });\n if (this.legacyMode_ || \"development\" !== \"production\") {\n var lengthDelta = newItems.length - deleteCount;\n this.updateArrayLength_(length, lengthDelta); // checks if internal array wasn't modified\n }\n var res = this.spliceItemsIntoValues_(index, deleteCount, newItems);\n if (deleteCount !== 0 || newItems.length !== 0) {\n this.notifyArraySplice_(index, newItems, res);\n }\n return this.dehanceValues_(res);\n };\n _proto.spliceItemsIntoValues_ = function spliceItemsIntoValues_(index, deleteCount, newItems) {\n if (newItems.length < MAX_SPLICE_SIZE) {\n var _this$values_;\n return (_this$values_ = this.values_).splice.apply(_this$values_, [index, deleteCount].concat(newItems));\n } else {\n // The items removed by the splice\n var res = this.values_.slice(index, index + deleteCount);\n // The items that that should remain at the end of the array\n var oldItems = this.values_.slice(index + deleteCount);\n // New length is the previous length + addition count - deletion count\n this.values_.length += newItems.length - deleteCount;\n for (var i = 0; i < newItems.length; i++) {\n this.values_[index + i] = newItems[i];\n }\n for (var _i = 0; _i < oldItems.length; _i++) {\n this.values_[index + newItems.length + _i] = oldItems[_i];\n }\n return res;\n }\n };\n _proto.notifyArrayChildUpdate_ = function notifyArrayChildUpdate_(index, newValue, oldValue) {\n var notifySpy = !this.owned_ && isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"array\",\n object: this.proxy_,\n type: UPDATE,\n debugObjectName: this.atom_.name_,\n index: index,\n newValue: newValue,\n oldValue: oldValue\n } : null;\n // The reason why this is on right hand side here (and not above), is this way the uglifier will drop it, but it won't\n // cause any runtime overhead in development mode without NODE_ENV set, unless spying is enabled\n if ( true && notifySpy) {\n spyReportStart(change);\n }\n this.atom_.reportChanged();\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n };\n _proto.notifyArraySplice_ = function notifyArraySplice_(index, added, removed) {\n var notifySpy = !this.owned_ && isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"array\",\n object: this.proxy_,\n debugObjectName: this.atom_.name_,\n type: SPLICE,\n index: index,\n removed: removed,\n added: added,\n removedCount: removed.length,\n addedCount: added.length\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n }\n this.atom_.reportChanged();\n // conform: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/observe\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n };\n _proto.get_ = function get_(index) {\n if (this.legacyMode_ && index >= this.values_.length) {\n console.warn( true ? \"[mobx.array] Attempt to read an array index (\" + index + \") that is out of bounds (\" + this.values_.length + \"). Please check length first. Out of bound indices will not be tracked by MobX\" : 0);\n return undefined;\n }\n this.atom_.reportObserved();\n return this.dehanceValue_(this.values_[index]);\n };\n _proto.set_ = function set_(index, newValue) {\n var values = this.values_;\n if (this.legacyMode_ && index > values.length) {\n // out of bounds\n die(17, index, values.length);\n }\n if (index < values.length) {\n // update at index in range\n checkIfStateModificationsAreAllowed(this.atom_);\n var oldValue = values[index];\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: UPDATE,\n object: this.proxy_,\n // since \"this\" is the real array we need to pass its proxy\n index: index,\n newValue: newValue\n });\n if (!change) {\n return;\n }\n newValue = change.newValue;\n }\n newValue = this.enhancer_(newValue, oldValue);\n var changed = newValue !== oldValue;\n if (changed) {\n values[index] = newValue;\n this.notifyArrayChildUpdate_(index, newValue, oldValue);\n }\n } else {\n // For out of bound index, we don't create an actual sparse array,\n // but rather fill the holes with undefined (same as setArrayLength_).\n // This could be considered a bug.\n var newItems = new Array(index + 1 - values.length);\n for (var i = 0; i < newItems.length - 1; i++) {\n newItems[i] = undefined;\n } // No Array.fill everywhere...\n newItems[newItems.length - 1] = newValue;\n this.spliceWithArray_(values.length, 0, newItems);\n }\n };\n return ObservableArrayAdministration;\n}();\nfunction createObservableArray(initialValues, enhancer, name, owned) {\n if (name === void 0) {\n name = true ? \"ObservableArray@\" + getNextId() : 0;\n }\n if (owned === void 0) {\n owned = false;\n }\n assertProxies();\n return initObservable(function () {\n var adm = new ObservableArrayAdministration(name, enhancer, owned, false);\n addHiddenFinalProp(adm.values_, $mobx, adm);\n var proxy = new Proxy(adm.values_, arrayTraps);\n adm.proxy_ = proxy;\n if (initialValues && initialValues.length) {\n adm.spliceWithArray_(0, 0, initialValues);\n }\n return proxy;\n });\n}\n// eslint-disable-next-line\nvar arrayExtensions = {\n clear: function clear() {\n return this.splice(0);\n },\n replace: function replace(newItems) {\n var adm = this[$mobx];\n return adm.spliceWithArray_(0, adm.values_.length, newItems);\n },\n // Used by JSON.stringify\n toJSON: function toJSON() {\n return this.slice();\n },\n /*\n * functions that do alter the internal structure of the array, (based on lib.es6.d.ts)\n * since these functions alter the inner structure of the array, the have side effects.\n * Because the have side effects, they should not be used in computed function,\n * and for that reason the do not call dependencyState.notifyObserved\n */\n splice: function splice(index, deleteCount) {\n for (var _len = arguments.length, newItems = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {\n newItems[_key - 2] = arguments[_key];\n }\n var adm = this[$mobx];\n switch (arguments.length) {\n case 0:\n return [];\n case 1:\n return adm.spliceWithArray_(index);\n case 2:\n return adm.spliceWithArray_(index, deleteCount);\n }\n return adm.spliceWithArray_(index, deleteCount, newItems);\n },\n spliceWithArray: function spliceWithArray(index, deleteCount, newItems) {\n return this[$mobx].spliceWithArray_(index, deleteCount, newItems);\n },\n push: function push() {\n var adm = this[$mobx];\n for (var _len2 = arguments.length, items = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n items[_key2] = arguments[_key2];\n }\n adm.spliceWithArray_(adm.values_.length, 0, items);\n return adm.values_.length;\n },\n pop: function pop() {\n return this.splice(Math.max(this[$mobx].values_.length - 1, 0), 1)[0];\n },\n shift: function shift() {\n return this.splice(0, 1)[0];\n },\n unshift: function unshift() {\n var adm = this[$mobx];\n for (var _len3 = arguments.length, items = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n items[_key3] = arguments[_key3];\n }\n adm.spliceWithArray_(0, 0, items);\n return adm.values_.length;\n },\n reverse: function reverse() {\n // reverse by default mutates in place before returning the result\n // which makes it both a 'derivation' and a 'mutation'.\n if (globalState.trackingDerivation) {\n die(37, \"reverse\");\n }\n this.replace(this.slice().reverse());\n return this;\n },\n sort: function sort() {\n // sort by default mutates in place before returning the result\n // which goes against all good practices. Let's not change the array in place!\n if (globalState.trackingDerivation) {\n die(37, \"sort\");\n }\n var copy = this.slice();\n copy.sort.apply(copy, arguments);\n this.replace(copy);\n return this;\n },\n remove: function remove(value) {\n var adm = this[$mobx];\n var idx = adm.dehanceValues_(adm.values_).indexOf(value);\n if (idx > -1) {\n this.splice(idx, 1);\n return true;\n }\n return false;\n }\n};\n/**\n * Wrap function from prototype\n * Without this, everything works as well, but this works\n * faster as everything works on unproxied values\n */\naddArrayExtension(\"at\", simpleFunc);\naddArrayExtension(\"concat\", simpleFunc);\naddArrayExtension(\"flat\", simpleFunc);\naddArrayExtension(\"includes\", simpleFunc);\naddArrayExtension(\"indexOf\", simpleFunc);\naddArrayExtension(\"join\", simpleFunc);\naddArrayExtension(\"lastIndexOf\", simpleFunc);\naddArrayExtension(\"slice\", simpleFunc);\naddArrayExtension(\"toString\", simpleFunc);\naddArrayExtension(\"toLocaleString\", simpleFunc);\naddArrayExtension(\"toSorted\", simpleFunc);\naddArrayExtension(\"toSpliced\", simpleFunc);\naddArrayExtension(\"with\", simpleFunc);\n// map\naddArrayExtension(\"every\", mapLikeFunc);\naddArrayExtension(\"filter\", mapLikeFunc);\naddArrayExtension(\"find\", mapLikeFunc);\naddArrayExtension(\"findIndex\", mapLikeFunc);\naddArrayExtension(\"findLast\", mapLikeFunc);\naddArrayExtension(\"findLastIndex\", mapLikeFunc);\naddArrayExtension(\"flatMap\", mapLikeFunc);\naddArrayExtension(\"forEach\", mapLikeFunc);\naddArrayExtension(\"map\", mapLikeFunc);\naddArrayExtension(\"some\", mapLikeFunc);\naddArrayExtension(\"toReversed\", mapLikeFunc);\n// reduce\naddArrayExtension(\"reduce\", reduceLikeFunc);\naddArrayExtension(\"reduceRight\", reduceLikeFunc);\nfunction addArrayExtension(funcName, funcFactory) {\n if (typeof Array.prototype[funcName] === \"function\") {\n arrayExtensions[funcName] = funcFactory(funcName);\n }\n}\n// Report and delegate to dehanced array\nfunction simpleFunc(funcName) {\n return function () {\n var adm = this[$mobx];\n adm.atom_.reportObserved();\n var dehancedValues = adm.dehanceValues_(adm.values_);\n return dehancedValues[funcName].apply(dehancedValues, arguments);\n };\n}\n// Make sure callbacks receive correct array arg #2326\nfunction mapLikeFunc(funcName) {\n return function (callback, thisArg) {\n var _this2 = this;\n var adm = this[$mobx];\n adm.atom_.reportObserved();\n var dehancedValues = adm.dehanceValues_(adm.values_);\n return dehancedValues[funcName](function (element, index) {\n return callback.call(thisArg, element, index, _this2);\n });\n };\n}\n// Make sure callbacks receive correct array arg #2326\nfunction reduceLikeFunc(funcName) {\n return function () {\n var _this3 = this;\n var adm = this[$mobx];\n adm.atom_.reportObserved();\n var dehancedValues = adm.dehanceValues_(adm.values_);\n // #2432 - reduce behavior depends on arguments.length\n var callback = arguments[0];\n arguments[0] = function (accumulator, currentValue, index) {\n return callback(accumulator, currentValue, index, _this3);\n };\n return dehancedValues[funcName].apply(dehancedValues, arguments);\n };\n}\nvar isObservableArrayAdministration = /*#__PURE__*/createInstanceofPredicate(\"ObservableArrayAdministration\", ObservableArrayAdministration);\nfunction isObservableArray(thing) {\n return isObject(thing) && isObservableArrayAdministration(thing[$mobx]);\n}\n\nvar ObservableMapMarker = {};\nvar ADD = \"add\";\nvar DELETE = \"delete\";\n// just extend Map? See also https://gist.github.com/nestharus/13b4d74f2ef4a2f4357dbd3fc23c1e54\n// But: https://github.com/mobxjs/mobx/issues/1556\nvar ObservableMap = /*#__PURE__*/function () {\n function ObservableMap(initialData, enhancer_, name_) {\n var _this = this;\n if (enhancer_ === void 0) {\n enhancer_ = deepEnhancer;\n }\n if (name_ === void 0) {\n name_ = true ? \"ObservableMap@\" + getNextId() : 0;\n }\n this.enhancer_ = void 0;\n this.name_ = void 0;\n this[$mobx] = ObservableMapMarker;\n this.data_ = void 0;\n this.hasMap_ = void 0;\n // hasMap, not hashMap >-).\n this.keysAtom_ = void 0;\n this.interceptors_ = void 0;\n this.changeListeners_ = void 0;\n this.dehancer = void 0;\n this.enhancer_ = enhancer_;\n this.name_ = name_;\n if (!isFunction(Map)) {\n die(18);\n }\n initObservable(function () {\n _this.keysAtom_ = createAtom( true ? _this.name_ + \".keys()\" : 0);\n _this.data_ = new Map();\n _this.hasMap_ = new Map();\n if (initialData) {\n _this.merge(initialData);\n }\n });\n }\n var _proto = ObservableMap.prototype;\n _proto.has_ = function has_(key) {\n return this.data_.has(key);\n };\n _proto.has = function has(key) {\n var _this2 = this;\n if (!globalState.trackingDerivation) {\n return this.has_(key);\n }\n var entry = this.hasMap_.get(key);\n if (!entry) {\n var newEntry = entry = new ObservableValue(this.has_(key), referenceEnhancer, true ? this.name_ + \".\" + stringifyKey(key) + \"?\" : 0, false);\n this.hasMap_.set(key, newEntry);\n onBecomeUnobserved(newEntry, function () {\n return _this2.hasMap_[\"delete\"](key);\n });\n }\n return entry.get();\n };\n _proto.set = function set(key, value) {\n var hasKey = this.has_(key);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: hasKey ? UPDATE : ADD,\n object: this,\n newValue: value,\n name: key\n });\n if (!change) {\n return this;\n }\n value = change.newValue;\n }\n if (hasKey) {\n this.updateValue_(key, value);\n } else {\n this.addValue_(key, value);\n }\n return this;\n };\n _proto[\"delete\"] = function _delete(key) {\n var _this3 = this;\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: DELETE,\n object: this,\n name: key\n });\n if (!change) {\n return false;\n }\n }\n if (this.has_(key)) {\n var notifySpy = isSpyEnabled();\n var notify = hasListeners(this);\n var _change = notify || notifySpy ? {\n observableKind: \"map\",\n debugObjectName: this.name_,\n type: DELETE,\n object: this,\n oldValue: this.data_.get(key).value_,\n name: key\n } : null;\n if ( true && notifySpy) {\n spyReportStart(_change);\n } // TODO fix type\n transaction(function () {\n var _this3$hasMap_$get;\n _this3.keysAtom_.reportChanged();\n (_this3$hasMap_$get = _this3.hasMap_.get(key)) == null || _this3$hasMap_$get.setNewValue_(false);\n var observable = _this3.data_.get(key);\n observable.setNewValue_(undefined);\n _this3.data_[\"delete\"](key);\n });\n if (notify) {\n notifyListeners(this, _change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n return true;\n }\n return false;\n };\n _proto.updateValue_ = function updateValue_(key, newValue) {\n var observable = this.data_.get(key);\n newValue = observable.prepareNewValue_(newValue);\n if (newValue !== globalState.UNCHANGED) {\n var notifySpy = isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"map\",\n debugObjectName: this.name_,\n type: UPDATE,\n object: this,\n oldValue: observable.value_,\n name: key,\n newValue: newValue\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n } // TODO fix type\n observable.setNewValue_(newValue);\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n };\n _proto.addValue_ = function addValue_(key, newValue) {\n var _this4 = this;\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n transaction(function () {\n var _this4$hasMap_$get;\n var observable = new ObservableValue(newValue, _this4.enhancer_, true ? _this4.name_ + \".\" + stringifyKey(key) : 0, false);\n _this4.data_.set(key, observable);\n newValue = observable.value_; // value might have been changed\n (_this4$hasMap_$get = _this4.hasMap_.get(key)) == null || _this4$hasMap_$get.setNewValue_(true);\n _this4.keysAtom_.reportChanged();\n });\n var notifySpy = isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"map\",\n debugObjectName: this.name_,\n type: ADD,\n object: this,\n name: key,\n newValue: newValue\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n } // TODO fix type\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n };\n _proto.get = function get(key) {\n if (this.has(key)) {\n return this.dehanceValue_(this.data_.get(key).get());\n }\n return this.dehanceValue_(undefined);\n };\n _proto.dehanceValue_ = function dehanceValue_(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.keys = function keys() {\n this.keysAtom_.reportObserved();\n return this.data_.keys();\n };\n _proto.values = function values() {\n var self = this;\n var keys = this.keys();\n return makeIterableForMap({\n next: function next() {\n var _keys$next = keys.next(),\n done = _keys$next.done,\n value = _keys$next.value;\n return {\n done: done,\n value: done ? undefined : self.get(value)\n };\n }\n });\n };\n _proto.entries = function entries() {\n var self = this;\n var keys = this.keys();\n return makeIterableForMap({\n next: function next() {\n var _keys$next2 = keys.next(),\n done = _keys$next2.done,\n value = _keys$next2.value;\n return {\n done: done,\n value: done ? undefined : [value, self.get(value)]\n };\n }\n });\n };\n _proto[Symbol.iterator] = function () {\n return this.entries();\n };\n _proto.forEach = function forEach(callback, thisArg) {\n for (var _iterator = _createForOfIteratorHelperLoose(this), _step; !(_step = _iterator()).done;) {\n var _step$value = _step.value,\n key = _step$value[0],\n value = _step$value[1];\n callback.call(thisArg, value, key, this);\n }\n }\n /** Merge another object into this object, returns this. */;\n _proto.merge = function merge(other) {\n var _this5 = this;\n if (isObservableMap(other)) {\n other = new Map(other);\n }\n transaction(function () {\n if (isPlainObject(other)) {\n getPlainObjectKeys(other).forEach(function (key) {\n return _this5.set(key, other[key]);\n });\n } else if (Array.isArray(other)) {\n other.forEach(function (_ref) {\n var key = _ref[0],\n value = _ref[1];\n return _this5.set(key, value);\n });\n } else if (isES6Map(other)) {\n if (!isPlainES6Map(other)) {\n die(19, other);\n }\n other.forEach(function (value, key) {\n return _this5.set(key, value);\n });\n } else if (other !== null && other !== undefined) {\n die(20, other);\n }\n });\n return this;\n };\n _proto.clear = function clear() {\n var _this6 = this;\n transaction(function () {\n untracked(function () {\n for (var _iterator2 = _createForOfIteratorHelperLoose(_this6.keys()), _step2; !(_step2 = _iterator2()).done;) {\n var key = _step2.value;\n _this6[\"delete\"](key);\n }\n });\n });\n };\n _proto.replace = function replace(values) {\n var _this7 = this;\n // Implementation requirements:\n // - respect ordering of replacement map\n // - allow interceptors to run and potentially prevent individual operations\n // - don't recreate observables that already exist in original map (so we don't destroy existing subscriptions)\n // - don't _keysAtom.reportChanged if the keys of resulting map are indentical (order matters!)\n // - note that result map may differ from replacement map due to the interceptors\n transaction(function () {\n // Convert to map so we can do quick key lookups\n var replacementMap = convertToMap(values);\n var orderedData = new Map();\n // Used for optimization\n var keysReportChangedCalled = false;\n // Delete keys that don't exist in replacement map\n // if the key deletion is prevented by interceptor\n // add entry at the beginning of the result map\n for (var _iterator3 = _createForOfIteratorHelperLoose(_this7.data_.keys()), _step3; !(_step3 = _iterator3()).done;) {\n var key = _step3.value;\n // Concurrently iterating/deleting keys\n // iterator should handle this correctly\n if (!replacementMap.has(key)) {\n var deleted = _this7[\"delete\"](key);\n // Was the key removed?\n if (deleted) {\n // _keysAtom.reportChanged() was already called\n keysReportChangedCalled = true;\n } else {\n // Delete prevented by interceptor\n var value = _this7.data_.get(key);\n orderedData.set(key, value);\n }\n }\n }\n // Merge entries\n for (var _iterator4 = _createForOfIteratorHelperLoose(replacementMap.entries()), _step4; !(_step4 = _iterator4()).done;) {\n var _step4$value = _step4.value,\n _key = _step4$value[0],\n _value = _step4$value[1];\n // We will want to know whether a new key is added\n var keyExisted = _this7.data_.has(_key);\n // Add or update value\n _this7.set(_key, _value);\n // The addition could have been prevent by interceptor\n if (_this7.data_.has(_key)) {\n // The update could have been prevented by interceptor\n // and also we want to preserve existing values\n // so use value from _data map (instead of replacement map)\n var _value2 = _this7.data_.get(_key);\n orderedData.set(_key, _value2);\n // Was a new key added?\n if (!keyExisted) {\n // _keysAtom.reportChanged() was already called\n keysReportChangedCalled = true;\n }\n }\n }\n // Check for possible key order change\n if (!keysReportChangedCalled) {\n if (_this7.data_.size !== orderedData.size) {\n // If size differs, keys are definitely modified\n _this7.keysAtom_.reportChanged();\n } else {\n var iter1 = _this7.data_.keys();\n var iter2 = orderedData.keys();\n var next1 = iter1.next();\n var next2 = iter2.next();\n while (!next1.done) {\n if (next1.value !== next2.value) {\n _this7.keysAtom_.reportChanged();\n break;\n }\n next1 = iter1.next();\n next2 = iter2.next();\n }\n }\n }\n // Use correctly ordered map\n _this7.data_ = orderedData;\n });\n return this;\n };\n _proto.toString = function toString() {\n return \"[object ObservableMap]\";\n };\n _proto.toJSON = function toJSON() {\n return Array.from(this);\n };\n /**\n * Observes this object. Triggers for the events 'add', 'update' and 'delete'.\n * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe\n * for callback details\n */\n _proto.observe_ = function observe_(listener, fireImmediately) {\n if ( true && fireImmediately === true) {\n die(\"`observe` doesn't support fireImmediately=true in combination with maps.\");\n }\n return registerListener(this, listener);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n return _createClass(ObservableMap, [{\n key: \"size\",\n get: function get() {\n this.keysAtom_.reportObserved();\n return this.data_.size;\n }\n }, {\n key: Symbol.toStringTag,\n get: function get() {\n return \"Map\";\n }\n }]);\n}();\n// eslint-disable-next-line\nvar isObservableMap = /*#__PURE__*/createInstanceofPredicate(\"ObservableMap\", ObservableMap);\nfunction makeIterableForMap(iterator) {\n iterator[Symbol.toStringTag] = \"MapIterator\";\n return makeIterable(iterator);\n}\nfunction convertToMap(dataStructure) {\n if (isES6Map(dataStructure) || isObservableMap(dataStructure)) {\n return dataStructure;\n } else if (Array.isArray(dataStructure)) {\n return new Map(dataStructure);\n } else if (isPlainObject(dataStructure)) {\n var map = new Map();\n for (var key in dataStructure) {\n map.set(key, dataStructure[key]);\n }\n return map;\n } else {\n return die(21, dataStructure);\n }\n}\n\nvar ObservableSetMarker = {};\nvar ObservableSet = /*#__PURE__*/function () {\n function ObservableSet(initialData, enhancer, name_) {\n var _this = this;\n if (enhancer === void 0) {\n enhancer = deepEnhancer;\n }\n if (name_ === void 0) {\n name_ = true ? \"ObservableSet@\" + getNextId() : 0;\n }\n this.name_ = void 0;\n this[$mobx] = ObservableSetMarker;\n this.data_ = new Set();\n this.atom_ = void 0;\n this.changeListeners_ = void 0;\n this.interceptors_ = void 0;\n this.dehancer = void 0;\n this.enhancer_ = void 0;\n this.name_ = name_;\n if (!isFunction(Set)) {\n die(22);\n }\n this.enhancer_ = function (newV, oldV) {\n return enhancer(newV, oldV, name_);\n };\n initObservable(function () {\n _this.atom_ = createAtom(_this.name_);\n if (initialData) {\n _this.replace(initialData);\n }\n });\n }\n var _proto = ObservableSet.prototype;\n _proto.dehanceValue_ = function dehanceValue_(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.clear = function clear() {\n var _this2 = this;\n transaction(function () {\n untracked(function () {\n for (var _iterator = _createForOfIteratorHelperLoose(_this2.data_.values()), _step; !(_step = _iterator()).done;) {\n var value = _step.value;\n _this2[\"delete\"](value);\n }\n });\n });\n };\n _proto.forEach = function forEach(callbackFn, thisArg) {\n for (var _iterator2 = _createForOfIteratorHelperLoose(this), _step2; !(_step2 = _iterator2()).done;) {\n var value = _step2.value;\n callbackFn.call(thisArg, value, value, this);\n }\n };\n _proto.add = function add(value) {\n var _this3 = this;\n checkIfStateModificationsAreAllowed(this.atom_);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: ADD,\n object: this,\n newValue: value\n });\n if (!change) {\n return this;\n }\n // ideally, value = change.value would be done here, so that values can be\n // changed by interceptor. Same applies for other Set and Map api's.\n }\n if (!this.has(value)) {\n transaction(function () {\n _this3.data_.add(_this3.enhancer_(value, undefined));\n _this3.atom_.reportChanged();\n });\n var notifySpy = true && isSpyEnabled();\n var notify = hasListeners(this);\n var _change = notify || notifySpy ? {\n observableKind: \"set\",\n debugObjectName: this.name_,\n type: ADD,\n object: this,\n newValue: value\n } : null;\n if (notifySpy && \"development\" !== \"production\") {\n spyReportStart(_change);\n }\n if (notify) {\n notifyListeners(this, _change);\n }\n if (notifySpy && \"development\" !== \"production\") {\n spyReportEnd();\n }\n }\n return this;\n };\n _proto[\"delete\"] = function _delete(value) {\n var _this4 = this;\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: DELETE,\n object: this,\n oldValue: value\n });\n if (!change) {\n return false;\n }\n }\n if (this.has(value)) {\n var notifySpy = true && isSpyEnabled();\n var notify = hasListeners(this);\n var _change2 = notify || notifySpy ? {\n observableKind: \"set\",\n debugObjectName: this.name_,\n type: DELETE,\n object: this,\n oldValue: value\n } : null;\n if (notifySpy && \"development\" !== \"production\") {\n spyReportStart(_change2);\n }\n transaction(function () {\n _this4.atom_.reportChanged();\n _this4.data_[\"delete\"](value);\n });\n if (notify) {\n notifyListeners(this, _change2);\n }\n if (notifySpy && \"development\" !== \"production\") {\n spyReportEnd();\n }\n return true;\n }\n return false;\n };\n _proto.has = function has(value) {\n this.atom_.reportObserved();\n return this.data_.has(this.dehanceValue_(value));\n };\n _proto.entries = function entries() {\n var nextIndex = 0;\n var keys = Array.from(this.keys());\n var values = Array.from(this.values());\n return makeIterableForSet({\n next: function next() {\n var index = nextIndex;\n nextIndex += 1;\n return index < values.length ? {\n value: [keys[index], values[index]],\n done: false\n } : {\n value: undefined,\n done: true\n };\n }\n });\n };\n _proto.keys = function keys() {\n return this.values();\n };\n _proto.values = function values() {\n this.atom_.reportObserved();\n var self = this;\n var nextIndex = 0;\n var observableValues = Array.from(this.data_.values());\n return makeIterableForSet({\n next: function next() {\n return nextIndex < observableValues.length ? {\n value: self.dehanceValue_(observableValues[nextIndex++]),\n done: false\n } : {\n value: undefined,\n done: true\n };\n }\n });\n };\n _proto.intersection = function intersection(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.intersection(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.intersection(otherSet);\n }\n };\n _proto.union = function union(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.union(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.union(otherSet);\n }\n };\n _proto.difference = function difference(otherSet) {\n return new Set(this).difference(otherSet);\n };\n _proto.symmetricDifference = function symmetricDifference(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.symmetricDifference(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.symmetricDifference(otherSet);\n }\n };\n _proto.isSubsetOf = function isSubsetOf(otherSet) {\n return new Set(this).isSubsetOf(otherSet);\n };\n _proto.isSupersetOf = function isSupersetOf(otherSet) {\n return new Set(this).isSupersetOf(otherSet);\n };\n _proto.isDisjointFrom = function isDisjointFrom(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.isDisjointFrom(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.isDisjointFrom(otherSet);\n }\n };\n _proto.replace = function replace(other) {\n var _this5 = this;\n if (isObservableSet(other)) {\n other = new Set(other);\n }\n transaction(function () {\n if (Array.isArray(other)) {\n _this5.clear();\n other.forEach(function (value) {\n return _this5.add(value);\n });\n } else if (isES6Set(other)) {\n _this5.clear();\n other.forEach(function (value) {\n return _this5.add(value);\n });\n } else if (other !== null && other !== undefined) {\n die(\"Cannot initialize set from \" + other);\n }\n });\n return this;\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n // ... 'fireImmediately' could also be true?\n if ( true && fireImmediately === true) {\n die(\"`observe` doesn't support fireImmediately=true in combination with sets.\");\n }\n return registerListener(this, listener);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.toJSON = function toJSON() {\n return Array.from(this);\n };\n _proto.toString = function toString() {\n return \"[object ObservableSet]\";\n };\n _proto[Symbol.iterator] = function () {\n return this.values();\n };\n return _createClass(ObservableSet, [{\n key: \"size\",\n get: function get() {\n this.atom_.reportObserved();\n return this.data_.size;\n }\n }, {\n key: Symbol.toStringTag,\n get: function get() {\n return \"Set\";\n }\n }]);\n}();\n// eslint-disable-next-line\nvar isObservableSet = /*#__PURE__*/createInstanceofPredicate(\"ObservableSet\", ObservableSet);\nfunction makeIterableForSet(iterator) {\n iterator[Symbol.toStringTag] = \"SetIterator\";\n return makeIterable(iterator);\n}\n\nvar descriptorCache = /*#__PURE__*/Object.create(null);\nvar REMOVE = \"remove\";\nvar ObservableObjectAdministration = /*#__PURE__*/function () {\n function ObservableObjectAdministration(target_, values_, name_,\n // Used anytime annotation is not explicitely provided\n defaultAnnotation_) {\n if (values_ === void 0) {\n values_ = new Map();\n }\n if (defaultAnnotation_ === void 0) {\n defaultAnnotation_ = autoAnnotation;\n }\n this.target_ = void 0;\n this.values_ = void 0;\n this.name_ = void 0;\n this.defaultAnnotation_ = void 0;\n this.keysAtom_ = void 0;\n this.changeListeners_ = void 0;\n this.interceptors_ = void 0;\n this.proxy_ = void 0;\n this.isPlainObject_ = void 0;\n this.appliedAnnotations_ = void 0;\n this.pendingKeys_ = void 0;\n this.target_ = target_;\n this.values_ = values_;\n this.name_ = name_;\n this.defaultAnnotation_ = defaultAnnotation_;\n this.keysAtom_ = new Atom( true ? this.name_ + \".keys\" : 0);\n // Optimization: we use this frequently\n this.isPlainObject_ = isPlainObject(this.target_);\n if ( true && !isAnnotation(this.defaultAnnotation_)) {\n die(\"defaultAnnotation must be valid annotation\");\n }\n if (true) {\n // Prepare structure for tracking which fields were already annotated\n this.appliedAnnotations_ = {};\n }\n }\n var _proto = ObservableObjectAdministration.prototype;\n _proto.getObservablePropValue_ = function getObservablePropValue_(key) {\n return this.values_.get(key).get();\n };\n _proto.setObservablePropValue_ = function setObservablePropValue_(key, newValue) {\n var observable = this.values_.get(key);\n if (observable instanceof ComputedValue) {\n observable.set(newValue);\n return true;\n }\n // intercept\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: UPDATE,\n object: this.proxy_ || this.target_,\n name: key,\n newValue: newValue\n });\n if (!change) {\n return null;\n }\n newValue = change.newValue;\n }\n newValue = observable.prepareNewValue_(newValue);\n // notify spy & observers\n if (newValue !== globalState.UNCHANGED) {\n var notify = hasListeners(this);\n var notifySpy = true && isSpyEnabled();\n var _change = notify || notifySpy ? {\n type: UPDATE,\n observableKind: \"object\",\n debugObjectName: this.name_,\n object: this.proxy_ || this.target_,\n oldValue: observable.value_,\n name: key,\n newValue: newValue\n } : null;\n if ( true && notifySpy) {\n spyReportStart(_change);\n }\n observable.setNewValue_(newValue);\n if (notify) {\n notifyListeners(this, _change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n return true;\n };\n _proto.get_ = function get_(key) {\n if (globalState.trackingDerivation && !hasProp(this.target_, key)) {\n // Key doesn't exist yet, subscribe for it in case it's added later\n this.has_(key);\n }\n return this.target_[key];\n }\n /**\n * @param {PropertyKey} key\n * @param {any} value\n * @param {Annotation|boolean} annotation true - use default annotation, false - copy as is\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.set_ = function set_(key, value, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n // Don't use .has(key) - we care about own\n if (hasProp(this.target_, key)) {\n // Existing prop\n if (this.values_.has(key)) {\n // Observable (can be intercepted)\n return this.setObservablePropValue_(key, value);\n } else if (proxyTrap) {\n // Non-observable - proxy\n return Reflect.set(this.target_, key, value);\n } else {\n // Non-observable\n this.target_[key] = value;\n return true;\n }\n } else {\n // New prop\n return this.extend_(key, {\n value: value,\n enumerable: true,\n writable: true,\n configurable: true\n }, this.defaultAnnotation_, proxyTrap);\n }\n }\n // Trap for \"in\"\n ;\n _proto.has_ = function has_(key) {\n if (!globalState.trackingDerivation) {\n // Skip key subscription outside derivation\n return key in this.target_;\n }\n this.pendingKeys_ || (this.pendingKeys_ = new Map());\n var entry = this.pendingKeys_.get(key);\n if (!entry) {\n entry = new ObservableValue(key in this.target_, referenceEnhancer, true ? this.name_ + \".\" + stringifyKey(key) + \"?\" : 0, false);\n this.pendingKeys_.set(key, entry);\n }\n return entry.get();\n }\n /**\n * @param {PropertyKey} key\n * @param {Annotation|boolean} annotation true - use default annotation, false - ignore prop\n */;\n _proto.make_ = function make_(key, annotation) {\n if (annotation === true) {\n annotation = this.defaultAnnotation_;\n }\n if (annotation === false) {\n return;\n }\n assertAnnotable(this, annotation, key);\n if (!(key in this.target_)) {\n var _this$target_$storedA;\n // Throw on missing key, except for decorators:\n // Decorator annotations are collected from whole prototype chain.\n // When called from super() some props may not exist yet.\n // However we don't have to worry about missing prop,\n // because the decorator must have been applied to something.\n if ((_this$target_$storedA = this.target_[storedAnnotationsSymbol]) != null && _this$target_$storedA[key]) {\n return; // will be annotated by subclass constructor\n } else {\n die(1, annotation.annotationType_, this.name_ + \".\" + key.toString());\n }\n }\n var source = this.target_;\n while (source && source !== objectPrototype) {\n var descriptor = getDescriptor(source, key);\n if (descriptor) {\n var outcome = annotation.make_(this, key, descriptor, source);\n if (outcome === 0 /* MakeResult.Cancel */) {\n return;\n }\n if (outcome === 1 /* MakeResult.Break */) {\n break;\n }\n }\n source = Object.getPrototypeOf(source);\n }\n recordAnnotationApplied(this, annotation, key);\n }\n /**\n * @param {PropertyKey} key\n * @param {PropertyDescriptor} descriptor\n * @param {Annotation|boolean} annotation true - use default annotation, false - copy as is\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.extend_ = function extend_(key, descriptor, annotation, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n if (annotation === true) {\n annotation = this.defaultAnnotation_;\n }\n if (annotation === false) {\n return this.defineProperty_(key, descriptor, proxyTrap);\n }\n assertAnnotable(this, annotation, key);\n var outcome = annotation.extend_(this, key, descriptor, proxyTrap);\n if (outcome) {\n recordAnnotationApplied(this, annotation, key);\n }\n return outcome;\n }\n /**\n * @param {PropertyKey} key\n * @param {PropertyDescriptor} descriptor\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.defineProperty_ = function defineProperty_(key, descriptor, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n try {\n startBatch();\n // Delete\n var deleteOutcome = this.delete_(key);\n if (!deleteOutcome) {\n // Failure or intercepted\n return deleteOutcome;\n }\n // ADD interceptor\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: ADD,\n newValue: descriptor.value\n });\n if (!change) {\n return null;\n }\n var newValue = change.newValue;\n if (descriptor.value !== newValue) {\n descriptor = _extends({}, descriptor, {\n value: newValue\n });\n }\n }\n // Define\n if (proxyTrap) {\n if (!Reflect.defineProperty(this.target_, key, descriptor)) {\n return false;\n }\n } else {\n defineProperty(this.target_, key, descriptor);\n }\n // Notify\n this.notifyPropertyAddition_(key, descriptor.value);\n } finally {\n endBatch();\n }\n return true;\n }\n // If original descriptor becomes relevant, move this to annotation directly\n ;\n _proto.defineObservableProperty_ = function defineObservableProperty_(key, value, enhancer, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n try {\n startBatch();\n // Delete\n var deleteOutcome = this.delete_(key);\n if (!deleteOutcome) {\n // Failure or intercepted\n return deleteOutcome;\n }\n // ADD interceptor\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: ADD,\n newValue: value\n });\n if (!change) {\n return null;\n }\n value = change.newValue;\n }\n var cachedDescriptor = getCachedObservablePropDescriptor(key);\n var descriptor = {\n configurable: globalState.safeDescriptors ? this.isPlainObject_ : true,\n enumerable: true,\n get: cachedDescriptor.get,\n set: cachedDescriptor.set\n };\n // Define\n if (proxyTrap) {\n if (!Reflect.defineProperty(this.target_, key, descriptor)) {\n return false;\n }\n } else {\n defineProperty(this.target_, key, descriptor);\n }\n var observable = new ObservableValue(value, enhancer, true ? this.name_ + \".\" + key.toString() : 0, false);\n this.values_.set(key, observable);\n // Notify (value possibly changed by ObservableValue)\n this.notifyPropertyAddition_(key, observable.value_);\n } finally {\n endBatch();\n }\n return true;\n }\n // If original descriptor becomes relevant, move this to annotation directly\n ;\n _proto.defineComputedProperty_ = function defineComputedProperty_(key, options, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n try {\n startBatch();\n // Delete\n var deleteOutcome = this.delete_(key);\n if (!deleteOutcome) {\n // Failure or intercepted\n return deleteOutcome;\n }\n // ADD interceptor\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: ADD,\n newValue: undefined\n });\n if (!change) {\n return null;\n }\n }\n options.name || (options.name = true ? this.name_ + \".\" + key.toString() : 0);\n options.context = this.proxy_ || this.target_;\n var cachedDescriptor = getCachedObservablePropDescriptor(key);\n var descriptor = {\n configurable: globalState.safeDescriptors ? this.isPlainObject_ : true,\n enumerable: false,\n get: cachedDescriptor.get,\n set: cachedDescriptor.set\n };\n // Define\n if (proxyTrap) {\n if (!Reflect.defineProperty(this.target_, key, descriptor)) {\n return false;\n }\n } else {\n defineProperty(this.target_, key, descriptor);\n }\n this.values_.set(key, new ComputedValue(options));\n // Notify\n this.notifyPropertyAddition_(key, undefined);\n } finally {\n endBatch();\n }\n return true;\n }\n /**\n * @param {PropertyKey} key\n * @param {PropertyDescriptor} descriptor\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.delete_ = function delete_(key, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n // No such prop\n if (!hasProp(this.target_, key)) {\n return true;\n }\n // Intercept\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: REMOVE\n });\n // Cancelled\n if (!change) {\n return null;\n }\n }\n // Delete\n try {\n var _this$pendingKeys_;\n startBatch();\n var notify = hasListeners(this);\n var notifySpy = true && isSpyEnabled();\n var observable = this.values_.get(key);\n // Value needed for spies/listeners\n var value = undefined;\n // Optimization: don't pull the value unless we will need it\n if (!observable && (notify || notifySpy)) {\n var _getDescriptor;\n value = (_getDescriptor = getDescriptor(this.target_, key)) == null ? void 0 : _getDescriptor.value;\n }\n // delete prop (do first, may fail)\n if (proxyTrap) {\n if (!Reflect.deleteProperty(this.target_, key)) {\n return false;\n }\n } else {\n delete this.target_[key];\n }\n // Allow re-annotating this field\n if (true) {\n delete this.appliedAnnotations_[key];\n }\n // Clear observable\n if (observable) {\n this.values_[\"delete\"](key);\n // for computed, value is undefined\n if (observable instanceof ObservableValue) {\n value = observable.value_;\n }\n // Notify: autorun(() => obj[key]), see #1796\n propagateChanged(observable);\n }\n // Notify \"keys/entries/values\" observers\n this.keysAtom_.reportChanged();\n // Notify \"has\" observers\n // \"in\" as it may still exist in proto\n (_this$pendingKeys_ = this.pendingKeys_) == null || (_this$pendingKeys_ = _this$pendingKeys_.get(key)) == null || _this$pendingKeys_.set(key in this.target_);\n // Notify spies/listeners\n if (notify || notifySpy) {\n var _change2 = {\n type: REMOVE,\n observableKind: \"object\",\n object: this.proxy_ || this.target_,\n debugObjectName: this.name_,\n oldValue: value,\n name: key\n };\n if ( true && notifySpy) {\n spyReportStart(_change2);\n }\n if (notify) {\n notifyListeners(this, _change2);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n } finally {\n endBatch();\n }\n return true;\n }\n /**\n * Observes this object. Triggers for the events 'add', 'update' and 'delete'.\n * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe\n * for callback details\n */;\n _proto.observe_ = function observe_(callback, fireImmediately) {\n if ( true && fireImmediately === true) {\n die(\"`observe` doesn't support the fire immediately property for observable objects.\");\n }\n return registerListener(this, callback);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.notifyPropertyAddition_ = function notifyPropertyAddition_(key, value) {\n var _this$pendingKeys_2;\n var notify = hasListeners(this);\n var notifySpy = true && isSpyEnabled();\n if (notify || notifySpy) {\n var change = notify || notifySpy ? {\n type: ADD,\n observableKind: \"object\",\n debugObjectName: this.name_,\n object: this.proxy_ || this.target_,\n name: key,\n newValue: value\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n }\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n (_this$pendingKeys_2 = this.pendingKeys_) == null || (_this$pendingKeys_2 = _this$pendingKeys_2.get(key)) == null || _this$pendingKeys_2.set(true);\n // Notify \"keys/entries/values\" observers\n this.keysAtom_.reportChanged();\n };\n _proto.ownKeys_ = function ownKeys_() {\n this.keysAtom_.reportObserved();\n return ownKeys(this.target_);\n };\n _proto.keys_ = function keys_() {\n // Returns enumerable && own, but unfortunately keysAtom will report on ANY key change.\n // There is no way to distinguish between Object.keys(object) and Reflect.ownKeys(object) - both are handled by ownKeys trap.\n // We can either over-report in Object.keys(object) or under-report in Reflect.ownKeys(object)\n // We choose to over-report in Object.keys(object), because:\n // - typically it's used with simple data objects\n // - when symbolic/non-enumerable keys are relevant Reflect.ownKeys works as expected\n this.keysAtom_.reportObserved();\n return Object.keys(this.target_);\n };\n return ObservableObjectAdministration;\n}();\nfunction asObservableObject(target, options) {\n var _options$name;\n if ( true && options && isObservableObject(target)) {\n die(\"Options can't be provided for already observable objects.\");\n }\n if (hasProp(target, $mobx)) {\n if ( true && !(getAdministration(target) instanceof ObservableObjectAdministration)) {\n die(\"Cannot convert '\" + getDebugName(target) + \"' into observable object:\" + \"\\nThe target is already observable of different type.\" + \"\\nExtending builtins is not supported.\");\n }\n return target;\n }\n if ( true && !Object.isExtensible(target)) {\n die(\"Cannot make the designated object observable; it is not extensible\");\n }\n var name = (_options$name = options == null ? void 0 : options.name) != null ? _options$name : true ? (isPlainObject(target) ? \"ObservableObject\" : target.constructor.name) + \"@\" + getNextId() : 0;\n var adm = new ObservableObjectAdministration(target, new Map(), String(name), getAnnotationFromOptions(options));\n addHiddenProp(target, $mobx, adm);\n return target;\n}\nvar isObservableObjectAdministration = /*#__PURE__*/createInstanceofPredicate(\"ObservableObjectAdministration\", ObservableObjectAdministration);\nfunction getCachedObservablePropDescriptor(key) {\n return descriptorCache[key] || (descriptorCache[key] = {\n get: function get() {\n return this[$mobx].getObservablePropValue_(key);\n },\n set: function set(value) {\n return this[$mobx].setObservablePropValue_(key, value);\n }\n });\n}\nfunction isObservableObject(thing) {\n if (isObject(thing)) {\n return isObservableObjectAdministration(thing[$mobx]);\n }\n return false;\n}\nfunction recordAnnotationApplied(adm, annotation, key) {\n var _adm$target_$storedAn;\n if (true) {\n adm.appliedAnnotations_[key] = annotation;\n }\n // Remove applied decorator annotation so we don't try to apply it again in subclass constructor\n (_adm$target_$storedAn = adm.target_[storedAnnotationsSymbol]) == null || delete _adm$target_$storedAn[key];\n}\nfunction assertAnnotable(adm, annotation, key) {\n // Valid annotation\n if ( true && !isAnnotation(annotation)) {\n die(\"Cannot annotate '\" + adm.name_ + \".\" + key.toString() + \"': Invalid annotation.\");\n }\n /*\n // Configurable, not sealed, not frozen\n // Possibly not needed, just a little better error then the one thrown by engine.\n // Cases where this would be useful the most (subclass field initializer) are not interceptable by this.\n if (__DEV__) {\n const configurable = getDescriptor(adm.target_, key)?.configurable\n const frozen = Object.isFrozen(adm.target_)\n const sealed = Object.isSealed(adm.target_)\n if (!configurable || frozen || sealed) {\n const fieldName = `${adm.name_}.${key.toString()}`\n const requestedAnnotationType = annotation.annotationType_\n let error = `Cannot apply '${requestedAnnotationType}' to '${fieldName}':`\n if (frozen) {\n error += `\\nObject is frozen.`\n }\n if (sealed) {\n error += `\\nObject is sealed.`\n }\n if (!configurable) {\n error += `\\nproperty is not configurable.`\n // Mention only if caused by us to avoid confusion\n if (hasProp(adm.appliedAnnotations!, key)) {\n error += `\\nTo prevent accidental re-definition of a field by a subclass, `\n error += `all annotated fields of non-plain objects (classes) are not configurable.`\n }\n }\n die(error)\n }\n }\n */\n // Not annotated\n if ( true && !isOverride(annotation) && hasProp(adm.appliedAnnotations_, key)) {\n var fieldName = adm.name_ + \".\" + key.toString();\n var currentAnnotationType = adm.appliedAnnotations_[key].annotationType_;\n var requestedAnnotationType = annotation.annotationType_;\n die(\"Cannot apply '\" + requestedAnnotationType + \"' to '\" + fieldName + \"':\" + (\"\\nThe field is already annotated with '\" + currentAnnotationType + \"'.\") + \"\\nRe-annotating fields is not allowed.\" + \"\\nUse 'override' annotation for methods overridden by subclass.\");\n }\n}\n\n// Bug in safari 9.* (or iOS 9 safari mobile). See #364\nvar ENTRY_0 = /*#__PURE__*/createArrayEntryDescriptor(0);\nvar safariPrototypeSetterInheritanceBug = /*#__PURE__*/function () {\n var v = false;\n var p = {};\n Object.defineProperty(p, \"0\", {\n set: function set() {\n v = true;\n }\n });\n /*#__PURE__*/Object.create(p)[\"0\"] = 1;\n return v === false;\n}();\n/**\n * This array buffer contains two lists of properties, so that all arrays\n * can recycle their property definitions, which significantly improves performance of creating\n * properties on the fly.\n */\nvar OBSERVABLE_ARRAY_BUFFER_SIZE = 0;\n// Typescript workaround to make sure ObservableArray extends Array\nvar StubArray = function StubArray() {};\nfunction inherit(ctor, proto) {\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(ctor.prototype, proto);\n } else if (ctor.prototype.__proto__ !== undefined) {\n ctor.prototype.__proto__ = proto;\n } else {\n ctor.prototype = proto;\n }\n}\ninherit(StubArray, Array.prototype);\n// Weex proto freeze protection was here,\n// but it is unclear why the hack is need as MobX never changed the prototype\n// anyway, so removed it in V6\nvar LegacyObservableArray = /*#__PURE__*/function (_StubArray) {\n function LegacyObservableArray(initialValues, enhancer, name, owned) {\n var _this;\n if (name === void 0) {\n name = true ? \"ObservableArray@\" + getNextId() : 0;\n }\n if (owned === void 0) {\n owned = false;\n }\n _this = _StubArray.call(this) || this;\n initObservable(function () {\n var adm = new ObservableArrayAdministration(name, enhancer, owned, true);\n adm.proxy_ = _this;\n addHiddenFinalProp(_this, $mobx, adm);\n if (initialValues && initialValues.length) {\n // @ts-ignore\n _this.spliceWithArray(0, 0, initialValues);\n }\n if (safariPrototypeSetterInheritanceBug) {\n // Seems that Safari won't use numeric prototype setter until any * numeric property is\n // defined on the instance. After that it works fine, even if this property is deleted.\n Object.defineProperty(_this, \"0\", ENTRY_0);\n }\n });\n return _this;\n }\n _inheritsLoose(LegacyObservableArray, _StubArray);\n var _proto = LegacyObservableArray.prototype;\n _proto.concat = function concat() {\n this[$mobx].atom_.reportObserved();\n for (var _len = arguments.length, arrays = new Array(_len), _key = 0; _key < _len; _key++) {\n arrays[_key] = arguments[_key];\n }\n return Array.prototype.concat.apply(this.slice(),\n //@ts-ignore\n arrays.map(function (a) {\n return isObservableArray(a) ? a.slice() : a;\n }));\n };\n _proto[Symbol.iterator] = function () {\n var self = this;\n var nextIndex = 0;\n return makeIterable({\n next: function next() {\n return nextIndex < self.length ? {\n value: self[nextIndex++],\n done: false\n } : {\n done: true,\n value: undefined\n };\n }\n });\n };\n return _createClass(LegacyObservableArray, [{\n key: \"length\",\n get: function get() {\n return this[$mobx].getArrayLength_();\n },\n set: function set(newLength) {\n this[$mobx].setArrayLength_(newLength);\n }\n }, {\n key: Symbol.toStringTag,\n get: function get() {\n return \"Array\";\n }\n }]);\n}(StubArray);\nObject.entries(arrayExtensions).forEach(function (_ref) {\n var prop = _ref[0],\n fn = _ref[1];\n if (prop !== \"concat\") {\n addHiddenProp(LegacyObservableArray.prototype, prop, fn);\n }\n});\nfunction createArrayEntryDescriptor(index) {\n return {\n enumerable: false,\n configurable: true,\n get: function get() {\n return this[$mobx].get_(index);\n },\n set: function set(value) {\n this[$mobx].set_(index, value);\n }\n };\n}\nfunction createArrayBufferItem(index) {\n defineProperty(LegacyObservableArray.prototype, \"\" + index, createArrayEntryDescriptor(index));\n}\nfunction reserveArrayBuffer(max) {\n if (max > OBSERVABLE_ARRAY_BUFFER_SIZE) {\n for (var index = OBSERVABLE_ARRAY_BUFFER_SIZE; index < max + 100; index++) {\n createArrayBufferItem(index);\n }\n OBSERVABLE_ARRAY_BUFFER_SIZE = max;\n }\n}\nreserveArrayBuffer(1000);\nfunction createLegacyArray(initialValues, enhancer, name) {\n return new LegacyObservableArray(initialValues, enhancer, name);\n}\n\nfunction getAtom(thing, property) {\n if (typeof thing === \"object\" && thing !== null) {\n if (isObservableArray(thing)) {\n if (property !== undefined) {\n die(23);\n }\n return thing[$mobx].atom_;\n }\n if (isObservableSet(thing)) {\n return thing.atom_;\n }\n if (isObservableMap(thing)) {\n if (property === undefined) {\n return thing.keysAtom_;\n }\n var observable = thing.data_.get(property) || thing.hasMap_.get(property);\n if (!observable) {\n die(25, property, getDebugName(thing));\n }\n return observable;\n }\n if (isObservableObject(thing)) {\n if (!property) {\n return die(26);\n }\n var _observable = thing[$mobx].values_.get(property);\n if (!_observable) {\n die(27, property, getDebugName(thing));\n }\n return _observable;\n }\n if (isAtom(thing) || isComputedValue(thing) || isReaction(thing)) {\n return thing;\n }\n } else if (isFunction(thing)) {\n if (isReaction(thing[$mobx])) {\n // disposer function\n return thing[$mobx];\n }\n }\n die(28);\n}\nfunction getAdministration(thing, property) {\n if (!thing) {\n die(29);\n }\n if (property !== undefined) {\n return getAdministration(getAtom(thing, property));\n }\n if (isAtom(thing) || isComputedValue(thing) || isReaction(thing)) {\n return thing;\n }\n if (isObservableMap(thing) || isObservableSet(thing)) {\n return thing;\n }\n if (thing[$mobx]) {\n return thing[$mobx];\n }\n die(24, thing);\n}\nfunction getDebugName(thing, property) {\n var named;\n if (property !== undefined) {\n named = getAtom(thing, property);\n } else if (isAction(thing)) {\n return thing.name;\n } else if (isObservableObject(thing) || isObservableMap(thing) || isObservableSet(thing)) {\n named = getAdministration(thing);\n } else {\n // valid for arrays as well\n named = getAtom(thing);\n }\n return named.name_;\n}\n/**\n * Helper function for initializing observable structures, it applies:\n * 1. allowStateChanges so we don't violate enforceActions.\n * 2. untracked so we don't accidentaly subscribe to anything observable accessed during init in case the observable is created inside derivation.\n * 3. batch to avoid state version updates\n */\nfunction initObservable(cb) {\n var derivation = untrackedStart();\n var allowStateChanges = allowStateChangesStart(true);\n startBatch();\n try {\n return cb();\n } finally {\n endBatch();\n allowStateChangesEnd(allowStateChanges);\n untrackedEnd(derivation);\n }\n}\n\nvar toString = objectPrototype.toString;\nfunction deepEqual(a, b, depth) {\n if (depth === void 0) {\n depth = -1;\n }\n return eq(a, b, depth);\n}\n// Copied from https://github.com/jashkenas/underscore/blob/5c237a7c682fb68fd5378203f0bf22dce1624854/underscore.js#L1186-L1289\n// Internal recursive comparison function for `isEqual`.\nfunction eq(a, b, depth, aStack, bStack) {\n // Identical objects are equal. `0 === -0`, but they aren't identical.\n // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).\n if (a === b) {\n return a !== 0 || 1 / a === 1 / b;\n }\n // `null` or `undefined` only equal to itself (strict comparison).\n if (a == null || b == null) {\n return false;\n }\n // `NaN`s are equivalent, but non-reflexive.\n if (a !== a) {\n return b !== b;\n }\n // Exhaust primitive checks\n var type = typeof a;\n if (type !== \"function\" && type !== \"object\" && typeof b != \"object\") {\n return false;\n }\n // Compare `[[Class]]` names.\n var className = toString.call(a);\n if (className !== toString.call(b)) {\n return false;\n }\n switch (className) {\n // Strings, numbers, regular expressions, dates, and booleans are compared by value.\n case \"[object RegExp]\":\n // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i')\n case \"[object String]\":\n // Primitives and their corresponding object wrappers are equivalent; thus, `\"5\"` is\n // equivalent to `new String(\"5\")`.\n return \"\" + a === \"\" + b;\n case \"[object Number]\":\n // `NaN`s are equivalent, but non-reflexive.\n // Object(NaN) is equivalent to NaN.\n if (+a !== +a) {\n return +b !== +b;\n }\n // An `egal` comparison is performed for other numeric values.\n return +a === 0 ? 1 / +a === 1 / b : +a === +b;\n case \"[object Date]\":\n case \"[object Boolean]\":\n // Coerce dates and booleans to numeric primitive values. Dates are compared by their\n // millisecond representations. Note that invalid dates with millisecond representations\n // of `NaN` are not equivalent.\n return +a === +b;\n case \"[object Symbol]\":\n return typeof Symbol !== \"undefined\" && Symbol.valueOf.call(a) === Symbol.valueOf.call(b);\n case \"[object Map]\":\n case \"[object Set]\":\n // Maps and Sets are unwrapped to arrays of entry-pairs, adding an incidental level.\n // Hide this extra level by increasing the depth.\n if (depth >= 0) {\n depth++;\n }\n break;\n }\n // Unwrap any wrapped objects.\n a = unwrap(a);\n b = unwrap(b);\n var areArrays = className === \"[object Array]\";\n if (!areArrays) {\n if (typeof a != \"object\" || typeof b != \"object\") {\n return false;\n }\n // Objects with different constructors are not equivalent, but `Object`s or `Array`s\n // from different frames are.\n var aCtor = a.constructor,\n bCtor = b.constructor;\n if (aCtor !== bCtor && !(isFunction(aCtor) && aCtor instanceof aCtor && isFunction(bCtor) && bCtor instanceof bCtor) && \"constructor\" in a && \"constructor\" in b) {\n return false;\n }\n }\n if (depth === 0) {\n return false;\n } else if (depth < 0) {\n depth = -1;\n }\n // Assume equality for cyclic structures. The algorithm for detecting cyclic\n // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.\n // Initializing stack of traversed objects.\n // It's done here since we only need them for objects and arrays comparison.\n aStack = aStack || [];\n bStack = bStack || [];\n var length = aStack.length;\n while (length--) {\n // Linear search. Performance is inversely proportional to the number of\n // unique nested structures.\n if (aStack[length] === a) {\n return bStack[length] === b;\n }\n }\n // Add the first object to the stack of traversed objects.\n aStack.push(a);\n bStack.push(b);\n // Recursively compare objects and arrays.\n if (areArrays) {\n // Compare array lengths to determine if a deep comparison is necessary.\n length = a.length;\n if (length !== b.length) {\n return false;\n }\n // Deep compare the contents, ignoring non-numeric properties.\n while (length--) {\n if (!eq(a[length], b[length], depth - 1, aStack, bStack)) {\n return false;\n }\n }\n } else {\n // Deep compare objects.\n var keys = Object.keys(a);\n var key;\n length = keys.length;\n // Ensure that both objects contain the same number of properties before comparing deep equality.\n if (Object.keys(b).length !== length) {\n return false;\n }\n while (length--) {\n // Deep compare each member\n key = keys[length];\n if (!(hasProp(b, key) && eq(a[key], b[key], depth - 1, aStack, bStack))) {\n return false;\n }\n }\n }\n // Remove the first object from the stack of traversed objects.\n aStack.pop();\n bStack.pop();\n return true;\n}\nfunction unwrap(a) {\n if (isObservableArray(a)) {\n return a.slice();\n }\n if (isES6Map(a) || isObservableMap(a)) {\n return Array.from(a.entries());\n }\n if (isES6Set(a) || isObservableSet(a)) {\n return Array.from(a.entries());\n }\n return a;\n}\n\nvar _getGlobal$Iterator;\n// safely get iterator prototype if available\nvar maybeIteratorPrototype = ((_getGlobal$Iterator = /*#__PURE__*/getGlobal().Iterator) == null ? void 0 : _getGlobal$Iterator.prototype) || {};\nfunction makeIterable(iterator) {\n iterator[Symbol.iterator] = getSelf;\n return Object.assign(Object.create(maybeIteratorPrototype), iterator);\n}\nfunction getSelf() {\n return this;\n}\n\nfunction isAnnotation(thing) {\n return (\n // Can be function\n thing instanceof Object && typeof thing.annotationType_ === \"string\" && isFunction(thing.make_) && isFunction(thing.extend_)\n );\n}\n\n/**\n * (c) Michel Weststrate 2015 - 2020\n * MIT Licensed\n *\n * Welcome to the mobx sources! To get a global overview of how MobX internally works,\n * this is a good place to start:\n * https://medium.com/@mweststrate/becoming-fully-reactive-an-in-depth-explanation-of-mobservable-55995262a254#.xvbh6qd74\n *\n * Source folders:\n * ===============\n *\n * - api/ Most of the public static methods exposed by the module can be found here.\n * - core/ Implementation of the MobX algorithm; atoms, derivations, reactions, dependency trees, optimizations. Cool stuff can be found here.\n * - types/ All the magic that is need to have observable objects, arrays and values is in this folder. Including the modifiers like `asFlat`.\n * - utils/ Utility stuff.\n *\n */\n[\"Symbol\", \"Map\", \"Set\"].forEach(function (m) {\n var g = getGlobal();\n if (typeof g[m] === \"undefined\") {\n die(\"MobX requires global '\" + m + \"' to be available or polyfilled\");\n }\n});\nif (typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__ === \"object\") {\n // See: https://github.com/andykog/mobx-devtools/\n __MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({\n spy: spy,\n extras: {\n getDebugName: getDebugName\n },\n $mobx: $mobx\n });\n}\n\n\n//# sourceMappingURL=mobx.esm.js.map\n\n\n//# sourceURL=webpack://app_adyen_SFRA/./node_modules/mobx/dist/mobx.esm.js?"); /***/ }) diff --git a/cartridges/app_adyen_SFRA/cartridge/static/default/js/applePayExpress.js b/cartridges/app_adyen_SFRA/cartridge/static/default/js/applePayExpress.js index ec48b7f85..eaf087bcf 100644 --- a/cartridges/app_adyen_SFRA/cartridge/static/default/js/applePayExpress.js +++ b/cartridges/app_adyen_SFRA/cartridge/static/default/js/applePayExpress.js @@ -46,7 +46,7 @@ eval("\n\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \" \****************************************************************************/ /***/ ((module) => { -eval("\n\n// Adyen constants\n\nmodule.exports = {\n METHOD_ADYEN: 'Adyen',\n METHOD_ADYEN_POS: 'AdyenPOS',\n METHOD_ADYEN_COMPONENT: 'AdyenComponent',\n RECEIVED: 'Received',\n NOTENOUGHBALANCE: 'NotEnoughBalance',\n SUCCESS: 'Success',\n GIFTCARD: 'giftcard',\n SCHEME: 'scheme',\n GIROPAY: 'giropay',\n APPLE_PAY: 'applepay',\n PAYPAL: 'paypal',\n AMAZON_PAY: 'amazonpay',\n ACTIONTYPE: {\n QRCODE: 'qrCode'\n },\n DISABLED_SUBMIT_BUTTON_METHODS: ['paypal', 'paywithgoogle', 'googlepay', 'amazonpay', 'applepay', 'cashapp'],\n MULTIPLE_TX_VARIANTS_COMPONENTS: ['upi']\n};\n\n//# sourceURL=webpack://app_adyen_SFRA/./cartridges/app_adyen_SFRA/cartridge/client/default/js/constants.js?"); +eval("\n\n// Adyen constants\n\nmodule.exports = {\n METHOD_ADYEN: 'Adyen',\n METHOD_ADYEN_POS: 'AdyenPOS',\n METHOD_ADYEN_COMPONENT: 'AdyenComponent',\n RECEIVED: 'Received',\n NOTENOUGHBALANCE: 'NotEnoughBalance',\n SUCCESS: 'Success',\n GIFTCARD: 'giftcard',\n SCHEME: 'scheme',\n GIROPAY: 'giropay',\n APPLE_PAY: 'applepay',\n PAYPAL: 'paypal',\n AMAZON_PAY: 'amazonpay',\n ACTIONTYPE: {\n QRCODE: 'qrCode'\n },\n DISABLED_SUBMIT_BUTTON_METHODS: ['paypal', 'paywithgoogle', 'googlepay', 'amazonpay', 'applepay', 'cashapp', 'upi']\n};\n\n//# sourceURL=webpack://app_adyen_SFRA/./cartridges/app_adyen_SFRA/cartridge/client/default/js/constants.js?"); /***/ }), @@ -66,7 +66,7 @@ eval("\n\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \" \********************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ $mobx: () => (/* binding */ $mobx),\n/* harmony export */ FlowCancellationError: () => (/* binding */ FlowCancellationError),\n/* harmony export */ ObservableMap: () => (/* binding */ ObservableMap),\n/* harmony export */ ObservableSet: () => (/* binding */ ObservableSet),\n/* harmony export */ Reaction: () => (/* binding */ Reaction),\n/* harmony export */ _allowStateChanges: () => (/* binding */ allowStateChanges),\n/* harmony export */ _allowStateChangesInsideComputed: () => (/* binding */ runInAction),\n/* harmony export */ _allowStateReadsEnd: () => (/* binding */ allowStateReadsEnd),\n/* harmony export */ _allowStateReadsStart: () => (/* binding */ allowStateReadsStart),\n/* harmony export */ _autoAction: () => (/* binding */ autoAction),\n/* harmony export */ _endAction: () => (/* binding */ _endAction),\n/* harmony export */ _getAdministration: () => (/* binding */ getAdministration),\n/* harmony export */ _getGlobalState: () => (/* binding */ getGlobalState),\n/* harmony export */ _interceptReads: () => (/* binding */ interceptReads),\n/* harmony export */ _isComputingDerivation: () => (/* binding */ isComputingDerivation),\n/* harmony export */ _resetGlobalState: () => (/* binding */ resetGlobalState),\n/* harmony export */ _startAction: () => (/* binding */ _startAction),\n/* harmony export */ action: () => (/* binding */ action),\n/* harmony export */ autorun: () => (/* binding */ autorun),\n/* harmony export */ comparer: () => (/* binding */ comparer),\n/* harmony export */ computed: () => (/* binding */ computed),\n/* harmony export */ configure: () => (/* binding */ configure),\n/* harmony export */ createAtom: () => (/* binding */ createAtom),\n/* harmony export */ defineProperty: () => (/* binding */ apiDefineProperty),\n/* harmony export */ entries: () => (/* binding */ entries),\n/* harmony export */ extendObservable: () => (/* binding */ extendObservable),\n/* harmony export */ flow: () => (/* binding */ flow),\n/* harmony export */ flowResult: () => (/* binding */ flowResult),\n/* harmony export */ get: () => (/* binding */ get),\n/* harmony export */ getAtom: () => (/* binding */ getAtom),\n/* harmony export */ getDebugName: () => (/* binding */ getDebugName),\n/* harmony export */ getDependencyTree: () => (/* binding */ getDependencyTree),\n/* harmony export */ getObserverTree: () => (/* binding */ getObserverTree),\n/* harmony export */ has: () => (/* binding */ has),\n/* harmony export */ intercept: () => (/* binding */ intercept),\n/* harmony export */ isAction: () => (/* binding */ isAction),\n/* harmony export */ isBoxedObservable: () => (/* binding */ isObservableValue),\n/* harmony export */ isComputed: () => (/* binding */ isComputed),\n/* harmony export */ isComputedProp: () => (/* binding */ isComputedProp),\n/* harmony export */ isFlow: () => (/* binding */ isFlow),\n/* harmony export */ isFlowCancellationError: () => (/* binding */ isFlowCancellationError),\n/* harmony export */ isObservable: () => (/* binding */ isObservable),\n/* harmony export */ isObservableArray: () => (/* binding */ isObservableArray),\n/* harmony export */ isObservableMap: () => (/* binding */ isObservableMap),\n/* harmony export */ isObservableObject: () => (/* binding */ isObservableObject),\n/* harmony export */ isObservableProp: () => (/* binding */ isObservableProp),\n/* harmony export */ isObservableSet: () => (/* binding */ isObservableSet),\n/* harmony export */ keys: () => (/* binding */ keys),\n/* harmony export */ makeAutoObservable: () => (/* binding */ makeAutoObservable),\n/* harmony export */ makeObservable: () => (/* binding */ makeObservable),\n/* harmony export */ observable: () => (/* binding */ observable),\n/* harmony export */ observe: () => (/* binding */ observe),\n/* harmony export */ onBecomeObserved: () => (/* binding */ onBecomeObserved),\n/* harmony export */ onBecomeUnobserved: () => (/* binding */ onBecomeUnobserved),\n/* harmony export */ onReactionError: () => (/* binding */ onReactionError),\n/* harmony export */ override: () => (/* binding */ override),\n/* harmony export */ ownKeys: () => (/* binding */ apiOwnKeys),\n/* harmony export */ reaction: () => (/* binding */ reaction),\n/* harmony export */ remove: () => (/* binding */ remove),\n/* harmony export */ runInAction: () => (/* binding */ runInAction),\n/* harmony export */ set: () => (/* binding */ set),\n/* harmony export */ spy: () => (/* binding */ spy),\n/* harmony export */ toJS: () => (/* binding */ toJS),\n/* harmony export */ trace: () => (/* binding */ trace),\n/* harmony export */ transaction: () => (/* binding */ transaction),\n/* harmony export */ untracked: () => (/* binding */ untracked),\n/* harmony export */ values: () => (/* binding */ values),\n/* harmony export */ when: () => (/* binding */ when)\n/* harmony export */ });\nvar niceErrors = {\n 0: \"Invalid value for configuration 'enforceActions', expected 'never', 'always' or 'observed'\",\n 1: function _(annotationType, key) {\n return \"Cannot apply '\" + annotationType + \"' to '\" + key.toString() + \"': Field not found.\";\n },\n /*\n 2(prop) {\n return `invalid decorator for '${prop.toString()}'`\n },\n 3(prop) {\n return `Cannot decorate '${prop.toString()}': action can only be used on properties with a function value.`\n },\n 4(prop) {\n return `Cannot decorate '${prop.toString()}': computed can only be used on getter properties.`\n },\n */\n 5: \"'keys()' can only be used on observable objects, arrays, sets and maps\",\n 6: \"'values()' can only be used on observable objects, arrays, sets and maps\",\n 7: \"'entries()' can only be used on observable objects, arrays and maps\",\n 8: \"'set()' can only be used on observable objects, arrays and maps\",\n 9: \"'remove()' can only be used on observable objects, arrays and maps\",\n 10: \"'has()' can only be used on observable objects, arrays and maps\",\n 11: \"'get()' can only be used on observable objects, arrays and maps\",\n 12: \"Invalid annotation\",\n 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)\",\n 14: \"Intercept handlers should return nothing or a change object\",\n 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)\",\n 16: \"Modification exception: the internal structure of an observable array was changed.\",\n 17: function _(index, length) {\n return \"[mobx.array] Index out of bounds, \" + index + \" is larger than \" + length;\n },\n 18: \"mobx.map requires Map polyfill for the current browser. Check babel-polyfill or core-js/es6/map.js\",\n 19: function _(other) {\n return \"Cannot initialize from classes that inherit from Map: \" + other.constructor.name;\n },\n 20: function _(other) {\n return \"Cannot initialize map from \" + other;\n },\n 21: function _(dataStructure) {\n return \"Cannot convert to map from '\" + dataStructure + \"'\";\n },\n 22: \"mobx.set requires Set polyfill for the current browser. Check babel-polyfill or core-js/es6/set.js\",\n 23: \"It is not possible to get index atoms from arrays\",\n 24: function _(thing) {\n return \"Cannot obtain administration from \" + thing;\n },\n 25: function _(property, name) {\n return \"the entry '\" + property + \"' does not exist in the observable map '\" + name + \"'\";\n },\n 26: \"please specify a property\",\n 27: function _(property, name) {\n return \"no observable property '\" + property.toString() + \"' found on the observable object '\" + name + \"'\";\n },\n 28: function _(thing) {\n return \"Cannot obtain atom from \" + thing;\n },\n 29: \"Expecting some object\",\n 30: \"invalid action stack. did you forget to finish an action?\",\n 31: \"missing option for computed: get\",\n 32: function _(name, derivation) {\n return \"Cycle detected in computation \" + name + \": \" + derivation;\n },\n 33: function _(name) {\n return \"The setter of computed value '\" + name + \"' is trying to update itself. Did you intend to update an _observable_ value, instead of the computed property?\";\n },\n 34: function _(name) {\n return \"[ComputedValue '\" + name + \"'] It is not possible to assign a new value to a computed value.\";\n },\n 35: \"There are multiple, different versions of MobX active. Make sure MobX is loaded only once or use `configure({ isolateGlobalState: true })`\",\n 36: \"isolateGlobalState should be called before MobX is running any reactions\",\n 37: function _(method) {\n return \"[mobx] `observableArray.\" + method + \"()` mutates the array in-place, which is not allowed inside a derivation. Use `array.slice().\" + method + \"()` instead\";\n },\n 38: \"'ownKeys()' can only be used on observable objects\",\n 39: \"'defineProperty()' can only be used on observable objects\"\n};\nvar errors = true ? niceErrors : 0;\nfunction die(error) {\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n if (true) {\n var e = typeof error === \"string\" ? error : errors[error];\n if (typeof e === \"function\") e = e.apply(null, args);\n throw new Error(\"[MobX] \" + e);\n }\n throw new Error(typeof error === \"number\" ? \"[MobX] minified error nr: \" + error + (args.length ? \" \" + args.map(String).join(\",\") : \"\") + \". Find the full error at: https://github.com/mobxjs/mobx/blob/main/packages/mobx/src/errors.ts\" : \"[MobX] \" + error);\n}\n\nvar mockGlobal = {};\nfunction getGlobal() {\n if (typeof globalThis !== \"undefined\") {\n return globalThis;\n }\n if (typeof window !== \"undefined\") {\n return window;\n }\n if (typeof __webpack_require__.g !== \"undefined\") {\n return __webpack_require__.g;\n }\n if (typeof self !== \"undefined\") {\n return self;\n }\n return mockGlobal;\n}\n\n// We shorten anything used > 5 times\nvar assign = Object.assign;\nvar getDescriptor = Object.getOwnPropertyDescriptor;\nvar defineProperty = Object.defineProperty;\nvar objectPrototype = Object.prototype;\nvar EMPTY_ARRAY = [];\nObject.freeze(EMPTY_ARRAY);\nvar EMPTY_OBJECT = {};\nObject.freeze(EMPTY_OBJECT);\nvar hasProxy = typeof Proxy !== \"undefined\";\nvar plainObjectString = /*#__PURE__*/Object.toString();\nfunction assertProxies() {\n if (!hasProxy) {\n die( true ? \"`Proxy` objects are not available in the current environment. Please configure MobX to enable a fallback implementation.`\" : 0);\n }\n}\nfunction warnAboutProxyRequirement(msg) {\n if ( true && globalState.verifyProxies) {\n die(\"MobX is currently configured to be able to run in ES5 mode, but in ES5 MobX won't be able to \" + msg);\n }\n}\nfunction getNextId() {\n return ++globalState.mobxGuid;\n}\n/**\n * Makes sure that the provided function is invoked at most once.\n */\nfunction once(func) {\n var invoked = false;\n return function () {\n if (invoked) {\n return;\n }\n invoked = true;\n return func.apply(this, arguments);\n };\n}\nvar noop = function noop() {};\nfunction isFunction(fn) {\n return typeof fn === \"function\";\n}\nfunction isStringish(value) {\n var t = typeof value;\n switch (t) {\n case \"string\":\n case \"symbol\":\n case \"number\":\n return true;\n }\n return false;\n}\nfunction isObject(value) {\n return value !== null && typeof value === \"object\";\n}\nfunction isPlainObject(value) {\n if (!isObject(value)) {\n return false;\n }\n var proto = Object.getPrototypeOf(value);\n if (proto == null) {\n return true;\n }\n var protoConstructor = Object.hasOwnProperty.call(proto, \"constructor\") && proto.constructor;\n return typeof protoConstructor === \"function\" && protoConstructor.toString() === plainObjectString;\n}\n// https://stackoverflow.com/a/37865170\nfunction isGenerator(obj) {\n var constructor = obj == null ? void 0 : obj.constructor;\n if (!constructor) {\n return false;\n }\n if (\"GeneratorFunction\" === constructor.name || \"GeneratorFunction\" === constructor.displayName) {\n return true;\n }\n return false;\n}\nfunction addHiddenProp(object, propName, value) {\n defineProperty(object, propName, {\n enumerable: false,\n writable: true,\n configurable: true,\n value: value\n });\n}\nfunction addHiddenFinalProp(object, propName, value) {\n defineProperty(object, propName, {\n enumerable: false,\n writable: false,\n configurable: true,\n value: value\n });\n}\nfunction createInstanceofPredicate(name, theClass) {\n var propName = \"isMobX\" + name;\n theClass.prototype[propName] = true;\n return function (x) {\n return isObject(x) && x[propName] === true;\n };\n}\n/**\n * Yields true for both native and observable Map, even across different windows.\n */\nfunction isES6Map(thing) {\n return thing != null && Object.prototype.toString.call(thing) === \"[object Map]\";\n}\n/**\n * Makes sure a Map is an instance of non-inherited native or observable Map.\n */\nfunction isPlainES6Map(thing) {\n var mapProto = Object.getPrototypeOf(thing);\n var objectProto = Object.getPrototypeOf(mapProto);\n var nullProto = Object.getPrototypeOf(objectProto);\n return nullProto === null;\n}\n/**\n * Yields true for both native and observable Set, even across different windows.\n */\nfunction isES6Set(thing) {\n return thing != null && Object.prototype.toString.call(thing) === \"[object Set]\";\n}\nvar hasGetOwnPropertySymbols = typeof Object.getOwnPropertySymbols !== \"undefined\";\n/**\n * Returns the following: own enumerable keys and symbols.\n */\nfunction getPlainObjectKeys(object) {\n var keys = Object.keys(object);\n // Not supported in IE, so there are not going to be symbol props anyway...\n if (!hasGetOwnPropertySymbols) {\n return keys;\n }\n var symbols = Object.getOwnPropertySymbols(object);\n if (!symbols.length) {\n return keys;\n }\n return [].concat(keys, symbols.filter(function (s) {\n return objectPrototype.propertyIsEnumerable.call(object, s);\n }));\n}\n// From Immer utils\n// Returns all own keys, including non-enumerable and symbolic\nvar ownKeys = typeof Reflect !== \"undefined\" && Reflect.ownKeys ? Reflect.ownKeys : hasGetOwnPropertySymbols ? function (obj) {\n return Object.getOwnPropertyNames(obj).concat(Object.getOwnPropertySymbols(obj));\n} : /* istanbul ignore next */Object.getOwnPropertyNames;\nfunction stringifyKey(key) {\n if (typeof key === \"string\") {\n return key;\n }\n if (typeof key === \"symbol\") {\n return key.toString();\n }\n return new String(key).toString();\n}\nfunction toPrimitive(value) {\n return value === null ? null : typeof value === \"object\" ? \"\" + value : value;\n}\nfunction hasProp(target, prop) {\n return objectPrototype.hasOwnProperty.call(target, prop);\n}\n// From Immer utils\nvar getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors || function getOwnPropertyDescriptors(target) {\n // Polyfill needed for Hermes and IE, see https://github.com/facebook/hermes/issues/274\n var res = {};\n // Note: without polyfill for ownKeys, symbols won't be picked up\n ownKeys(target).forEach(function (key) {\n res[key] = getDescriptor(target, key);\n });\n return res;\n};\nfunction getFlag(flags, mask) {\n return !!(flags & mask);\n}\nfunction setFlag(flags, mask, newValue) {\n if (newValue) {\n flags |= mask;\n } else {\n flags &= ~mask;\n }\n return flags;\n}\n\nfunction _arrayLikeToArray(r, a) {\n (null == a || a > r.length) && (a = r.length);\n for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];\n return n;\n}\nfunction _defineProperties(e, r) {\n for (var t = 0; t < r.length; t++) {\n var o = r[t];\n o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);\n }\n}\nfunction _createClass(e, r, t) {\n return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", {\n writable: !1\n }), e;\n}\nfunction _createForOfIteratorHelperLoose(r, e) {\n var t = \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"];\n if (t) return (t = t.call(r)).next.bind(t);\n if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && \"number\" == typeof r.length) {\n t && (r = t);\n var o = 0;\n return function () {\n return o >= r.length ? {\n done: !0\n } : {\n done: !1,\n value: r[o++]\n };\n };\n }\n throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\nfunction _extends() {\n return _extends = Object.assign ? Object.assign.bind() : function (n) {\n for (var e = 1; e < arguments.length; e++) {\n var t = arguments[e];\n for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);\n }\n return n;\n }, _extends.apply(null, arguments);\n}\nfunction _inheritsLoose(t, o) {\n t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);\n}\nfunction _setPrototypeOf(t, e) {\n return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {\n return t.__proto__ = e, t;\n }, _setPrototypeOf(t, e);\n}\nfunction _toPrimitive(t, r) {\n if (\"object\" != typeof t || !t) return t;\n var e = t[Symbol.toPrimitive];\n if (void 0 !== e) {\n var i = e.call(t, r || \"default\");\n if (\"object\" != typeof i) return i;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (\"string\" === r ? String : Number)(t);\n}\nfunction _toPropertyKey(t) {\n var i = _toPrimitive(t, \"string\");\n return \"symbol\" == typeof i ? i : i + \"\";\n}\nfunction _unsupportedIterableToArray(r, a) {\n if (r) {\n if (\"string\" == typeof r) return _arrayLikeToArray(r, a);\n var t = {}.toString.call(r).slice(8, -1);\n return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;\n }\n}\n\nvar storedAnnotationsSymbol = /*#__PURE__*/Symbol(\"mobx-stored-annotations\");\n/**\n * Creates a function that acts as\n * - decorator\n * - annotation object\n */\nfunction createDecoratorAnnotation(annotation) {\n function decorator(target, property) {\n if (is20223Decorator(property)) {\n return annotation.decorate_20223_(target, property);\n } else {\n storeAnnotation(target, property, annotation);\n }\n }\n return Object.assign(decorator, annotation);\n}\n/**\n * Stores annotation to prototype,\n * so it can be inspected later by `makeObservable` called from constructor\n */\nfunction storeAnnotation(prototype, key, annotation) {\n if (!hasProp(prototype, storedAnnotationsSymbol)) {\n addHiddenProp(prototype, storedAnnotationsSymbol, _extends({}, prototype[storedAnnotationsSymbol]));\n }\n // @override must override something\n if ( true && isOverride(annotation) && !hasProp(prototype[storedAnnotationsSymbol], key)) {\n var fieldName = prototype.constructor.name + \".prototype.\" + key.toString();\n die(\"'\" + fieldName + \"' is decorated with 'override', \" + \"but no such decorated member was found on prototype.\");\n }\n // Cannot re-decorate\n assertNotDecorated(prototype, annotation, key);\n // Ignore override\n if (!isOverride(annotation)) {\n prototype[storedAnnotationsSymbol][key] = annotation;\n }\n}\nfunction assertNotDecorated(prototype, annotation, key) {\n if ( true && !isOverride(annotation) && hasProp(prototype[storedAnnotationsSymbol], key)) {\n var fieldName = prototype.constructor.name + \".prototype.\" + key.toString();\n var currentAnnotationType = prototype[storedAnnotationsSymbol][key].annotationType_;\n var requestedAnnotationType = annotation.annotationType_;\n die(\"Cannot apply '@\" + requestedAnnotationType + \"' to '\" + fieldName + \"':\" + (\"\\nThe field is already decorated with '@\" + currentAnnotationType + \"'.\") + \"\\nRe-decorating fields is not allowed.\" + \"\\nUse '@override' decorator for methods overridden by subclass.\");\n }\n}\n/**\n * Collects annotations from prototypes and stores them on target (instance)\n */\nfunction collectStoredAnnotations(target) {\n if (!hasProp(target, storedAnnotationsSymbol)) {\n // if (__DEV__ && !target[storedAnnotationsSymbol]) {\n // die(\n // `No annotations were passed to makeObservable, but no decorated members have been found either`\n // )\n // }\n // We need a copy as we will remove annotation from the list once it's applied.\n addHiddenProp(target, storedAnnotationsSymbol, _extends({}, target[storedAnnotationsSymbol]));\n }\n return target[storedAnnotationsSymbol];\n}\nfunction is20223Decorator(context) {\n return typeof context == \"object\" && typeof context[\"kind\"] == \"string\";\n}\nfunction assert20223DecoratorType(context, types) {\n if ( true && !types.includes(context.kind)) {\n die(\"The decorator applied to '\" + String(context.name) + \"' cannot be used on a \" + context.kind + \" element\");\n }\n}\n\nvar $mobx = /*#__PURE__*/Symbol(\"mobx administration\");\nvar Atom = /*#__PURE__*/function () {\n /**\n * Create a new atom. For debugging purposes it is recommended to give it a name.\n * The onBecomeObserved and onBecomeUnobserved callbacks can be used for resource management.\n */\n function Atom(name_) {\n if (name_ === void 0) {\n name_ = true ? \"Atom@\" + getNextId() : 0;\n }\n this.name_ = void 0;\n this.flags_ = 0;\n this.observers_ = new Set();\n this.lastAccessedBy_ = 0;\n this.lowestObserverState_ = IDerivationState_.NOT_TRACKING_;\n // onBecomeObservedListeners\n this.onBOL = void 0;\n // onBecomeUnobservedListeners\n this.onBUOL = void 0;\n this.name_ = name_;\n }\n // for effective unobserving. BaseAtom has true, for extra optimization, so its onBecomeUnobserved never gets called, because it's not needed\n var _proto = Atom.prototype;\n _proto.onBO = function onBO() {\n if (this.onBOL) {\n this.onBOL.forEach(function (listener) {\n return listener();\n });\n }\n };\n _proto.onBUO = function onBUO() {\n if (this.onBUOL) {\n this.onBUOL.forEach(function (listener) {\n return listener();\n });\n }\n }\n /**\n * Invoke this method to notify mobx that your atom has been used somehow.\n * Returns true if there is currently a reactive context.\n */;\n _proto.reportObserved = function reportObserved$1() {\n return reportObserved(this);\n }\n /**\n * Invoke this method _after_ this method has changed to signal mobx that all its observers should invalidate.\n */;\n _proto.reportChanged = function reportChanged() {\n startBatch();\n propagateChanged(this);\n endBatch();\n };\n _proto.toString = function toString() {\n return this.name_;\n };\n return _createClass(Atom, [{\n key: \"isBeingObserved\",\n get: function get() {\n return getFlag(this.flags_, Atom.isBeingObservedMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Atom.isBeingObservedMask_, newValue);\n }\n }, {\n key: \"isPendingUnobservation\",\n get: function get() {\n return getFlag(this.flags_, Atom.isPendingUnobservationMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Atom.isPendingUnobservationMask_, newValue);\n }\n }, {\n key: \"diffValue\",\n get: function get() {\n return getFlag(this.flags_, Atom.diffValueMask_) ? 1 : 0;\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Atom.diffValueMask_, newValue === 1 ? true : false);\n }\n }]);\n}();\nAtom.isBeingObservedMask_ = 1;\nAtom.isPendingUnobservationMask_ = 2;\nAtom.diffValueMask_ = 4;\nvar isAtom = /*#__PURE__*/createInstanceofPredicate(\"Atom\", Atom);\nfunction createAtom(name, onBecomeObservedHandler, onBecomeUnobservedHandler) {\n if (onBecomeObservedHandler === void 0) {\n onBecomeObservedHandler = noop;\n }\n if (onBecomeUnobservedHandler === void 0) {\n onBecomeUnobservedHandler = noop;\n }\n var atom = new Atom(name);\n // default `noop` listener will not initialize the hook Set\n if (onBecomeObservedHandler !== noop) {\n onBecomeObserved(atom, onBecomeObservedHandler);\n }\n if (onBecomeUnobservedHandler !== noop) {\n onBecomeUnobserved(atom, onBecomeUnobservedHandler);\n }\n return atom;\n}\n\nfunction identityComparer(a, b) {\n return a === b;\n}\nfunction structuralComparer(a, b) {\n return deepEqual(a, b);\n}\nfunction shallowComparer(a, b) {\n return deepEqual(a, b, 1);\n}\nfunction defaultComparer(a, b) {\n if (Object.is) {\n return Object.is(a, b);\n }\n return a === b ? a !== 0 || 1 / a === 1 / b : a !== a && b !== b;\n}\nvar comparer = {\n identity: identityComparer,\n structural: structuralComparer,\n \"default\": defaultComparer,\n shallow: shallowComparer\n};\n\nfunction deepEnhancer(v, _, name) {\n // it is an observable already, done\n if (isObservable(v)) {\n return v;\n }\n // something that can be converted and mutated?\n if (Array.isArray(v)) {\n return observable.array(v, {\n name: name\n });\n }\n if (isPlainObject(v)) {\n return observable.object(v, undefined, {\n name: name\n });\n }\n if (isES6Map(v)) {\n return observable.map(v, {\n name: name\n });\n }\n if (isES6Set(v)) {\n return observable.set(v, {\n name: name\n });\n }\n if (typeof v === \"function\" && !isAction(v) && !isFlow(v)) {\n if (isGenerator(v)) {\n return flow(v);\n } else {\n return autoAction(name, v);\n }\n }\n return v;\n}\nfunction shallowEnhancer(v, _, name) {\n if (v === undefined || v === null) {\n return v;\n }\n if (isObservableObject(v) || isObservableArray(v) || isObservableMap(v) || isObservableSet(v)) {\n return v;\n }\n if (Array.isArray(v)) {\n return observable.array(v, {\n name: name,\n deep: false\n });\n }\n if (isPlainObject(v)) {\n return observable.object(v, undefined, {\n name: name,\n deep: false\n });\n }\n if (isES6Map(v)) {\n return observable.map(v, {\n name: name,\n deep: false\n });\n }\n if (isES6Set(v)) {\n return observable.set(v, {\n name: name,\n deep: false\n });\n }\n if (true) {\n die(\"The shallow modifier / decorator can only used in combination with arrays, objects, maps and sets\");\n }\n}\nfunction referenceEnhancer(newValue) {\n // never turn into an observable\n return newValue;\n}\nfunction refStructEnhancer(v, oldValue) {\n if ( true && isObservable(v)) {\n die(\"observable.struct should not be used with observable values\");\n }\n if (deepEqual(v, oldValue)) {\n return oldValue;\n }\n return v;\n}\n\nvar OVERRIDE = \"override\";\nvar override = /*#__PURE__*/createDecoratorAnnotation({\n annotationType_: OVERRIDE,\n make_: make_,\n extend_: extend_,\n decorate_20223_: decorate_20223_\n});\nfunction isOverride(annotation) {\n return annotation.annotationType_ === OVERRIDE;\n}\nfunction make_(adm, key) {\n // Must not be plain object\n if ( true && adm.isPlainObject_) {\n die(\"Cannot apply '\" + this.annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + this.annotationType_ + \"' cannot be used on plain objects.\"));\n }\n // Must override something\n if ( true && !hasProp(adm.appliedAnnotations_, key)) {\n die(\"'\" + adm.name_ + \".\" + key.toString() + \"' is annotated with '\" + this.annotationType_ + \"', \" + \"but no such annotated member was found on prototype.\");\n }\n return 0 /* MakeResult.Cancel */;\n}\nfunction extend_(adm, key, descriptor, proxyTrap) {\n die(\"'\" + this.annotationType_ + \"' can only be used with 'makeObservable'\");\n}\nfunction decorate_20223_(desc, context) {\n console.warn(\"'\" + this.annotationType_ + \"' cannot be used with decorators - this is a no-op\");\n}\n\nfunction createActionAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$1,\n extend_: extend_$1,\n decorate_20223_: decorate_20223_$1\n };\n}\nfunction make_$1(adm, key, descriptor, source) {\n var _this$options_;\n // bound\n if ((_this$options_ = this.options_) != null && _this$options_.bound) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;\n }\n // own\n if (source === adm.target_) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 2 /* MakeResult.Continue */;\n }\n // prototype\n if (isAction(descriptor.value)) {\n // A prototype could have been annotated already by other constructor,\n // rest of the proto chain must be annotated already\n return 1 /* MakeResult.Break */;\n }\n var actionDescriptor = createActionDescriptor(adm, this, key, descriptor, false);\n defineProperty(source, key, actionDescriptor);\n return 2 /* MakeResult.Continue */;\n}\nfunction extend_$1(adm, key, descriptor, proxyTrap) {\n var actionDescriptor = createActionDescriptor(adm, this, key, descriptor);\n return adm.defineProperty_(key, actionDescriptor, proxyTrap);\n}\nfunction decorate_20223_$1(mthd, context) {\n if (true) {\n assert20223DecoratorType(context, [\"method\", \"field\"]);\n }\n var kind = context.kind,\n name = context.name,\n addInitializer = context.addInitializer;\n var ann = this;\n var _createAction = function _createAction(m) {\n var _ann$options_$name, _ann$options_, _ann$options_$autoAct, _ann$options_2;\n return createAction((_ann$options_$name = (_ann$options_ = ann.options_) == null ? void 0 : _ann$options_.name) != null ? _ann$options_$name : name.toString(), m, (_ann$options_$autoAct = (_ann$options_2 = ann.options_) == null ? void 0 : _ann$options_2.autoAction) != null ? _ann$options_$autoAct : false);\n };\n // Backwards/Legacy behavior, expects makeObservable(this)\n if (kind == \"field\") {\n addInitializer(function () {\n storeAnnotation(this, name, ann);\n });\n return;\n }\n if (kind == \"method\") {\n var _this$options_2;\n if (!isAction(mthd)) {\n mthd = _createAction(mthd);\n }\n if ((_this$options_2 = this.options_) != null && _this$options_2.bound) {\n addInitializer(function () {\n var self = this;\n var bound = self[name].bind(self);\n bound.isMobxAction = true;\n self[name] = bound;\n });\n }\n return mthd;\n }\n die(\"Cannot apply '\" + ann.annotationType_ + \"' to '\" + String(name) + \"' (kind: \" + kind + \"):\" + (\"\\n'\" + ann.annotationType_ + \"' can only be used on properties with a function value.\"));\n}\nfunction assertActionDescriptor(adm, _ref, key, _ref2) {\n var annotationType_ = _ref.annotationType_;\n var value = _ref2.value;\n if ( true && !isFunction(value)) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' can only be used on properties with a function value.\"));\n }\n}\nfunction createActionDescriptor(adm, annotation, key, descriptor,\n// provides ability to disable safeDescriptors for prototypes\nsafeDescriptors) {\n var _annotation$options_, _annotation$options_$, _annotation$options_2, _annotation$options_$2, _annotation$options_3, _annotation$options_4, _adm$proxy_2;\n if (safeDescriptors === void 0) {\n safeDescriptors = globalState.safeDescriptors;\n }\n assertActionDescriptor(adm, annotation, key, descriptor);\n var value = descriptor.value;\n if ((_annotation$options_ = annotation.options_) != null && _annotation$options_.bound) {\n var _adm$proxy_;\n value = value.bind((_adm$proxy_ = adm.proxy_) != null ? _adm$proxy_ : adm.target_);\n }\n return {\n value: createAction((_annotation$options_$ = (_annotation$options_2 = annotation.options_) == null ? void 0 : _annotation$options_2.name) != null ? _annotation$options_$ : key.toString(), value, (_annotation$options_$2 = (_annotation$options_3 = annotation.options_) == null ? void 0 : _annotation$options_3.autoAction) != null ? _annotation$options_$2 : false,\n // https://github.com/mobxjs/mobx/discussions/3140\n (_annotation$options_4 = annotation.options_) != null && _annotation$options_4.bound ? (_adm$proxy_2 = adm.proxy_) != null ? _adm$proxy_2 : adm.target_ : undefined),\n // Non-configurable for classes\n // prevents accidental field redefinition in subclass\n configurable: safeDescriptors ? adm.isPlainObject_ : true,\n // https://github.com/mobxjs/mobx/pull/2641#issuecomment-737292058\n enumerable: false,\n // Non-obsevable, therefore non-writable\n // Also prevents rewriting in subclass constructor\n writable: safeDescriptors ? false : true\n };\n}\n\nfunction createFlowAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$2,\n extend_: extend_$2,\n decorate_20223_: decorate_20223_$2\n };\n}\nfunction make_$2(adm, key, descriptor, source) {\n var _this$options_;\n // own\n if (source === adm.target_) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 2 /* MakeResult.Continue */;\n }\n // prototype\n // bound - must annotate protos to support super.flow()\n if ((_this$options_ = this.options_) != null && _this$options_.bound && (!hasProp(adm.target_, key) || !isFlow(adm.target_[key]))) {\n if (this.extend_(adm, key, descriptor, false) === null) {\n return 0 /* MakeResult.Cancel */;\n }\n }\n if (isFlow(descriptor.value)) {\n // A prototype could have been annotated already by other constructor,\n // rest of the proto chain must be annotated already\n return 1 /* MakeResult.Break */;\n }\n var flowDescriptor = createFlowDescriptor(adm, this, key, descriptor, false, false);\n defineProperty(source, key, flowDescriptor);\n return 2 /* MakeResult.Continue */;\n}\nfunction extend_$2(adm, key, descriptor, proxyTrap) {\n var _this$options_2;\n var flowDescriptor = createFlowDescriptor(adm, this, key, descriptor, (_this$options_2 = this.options_) == null ? void 0 : _this$options_2.bound);\n return adm.defineProperty_(key, flowDescriptor, proxyTrap);\n}\nfunction decorate_20223_$2(mthd, context) {\n var _this$options_3;\n if (true) {\n assert20223DecoratorType(context, [\"method\"]);\n }\n var name = context.name,\n addInitializer = context.addInitializer;\n if (!isFlow(mthd)) {\n mthd = flow(mthd);\n }\n if ((_this$options_3 = this.options_) != null && _this$options_3.bound) {\n addInitializer(function () {\n var self = this;\n var bound = self[name].bind(self);\n bound.isMobXFlow = true;\n self[name] = bound;\n });\n }\n return mthd;\n}\nfunction assertFlowDescriptor(adm, _ref, key, _ref2) {\n var annotationType_ = _ref.annotationType_;\n var value = _ref2.value;\n if ( true && !isFunction(value)) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' can only be used on properties with a generator function value.\"));\n }\n}\nfunction createFlowDescriptor(adm, annotation, key, descriptor, bound,\n// provides ability to disable safeDescriptors for prototypes\nsafeDescriptors) {\n if (safeDescriptors === void 0) {\n safeDescriptors = globalState.safeDescriptors;\n }\n assertFlowDescriptor(adm, annotation, key, descriptor);\n var value = descriptor.value;\n // In case of flow.bound, the descriptor can be from already annotated prototype\n if (!isFlow(value)) {\n value = flow(value);\n }\n if (bound) {\n var _adm$proxy_;\n // We do not keep original function around, so we bind the existing flow\n value = value.bind((_adm$proxy_ = adm.proxy_) != null ? _adm$proxy_ : adm.target_);\n // This is normally set by `flow`, but `bind` returns new function...\n value.isMobXFlow = true;\n }\n return {\n value: value,\n // Non-configurable for classes\n // prevents accidental field redefinition in subclass\n configurable: safeDescriptors ? adm.isPlainObject_ : true,\n // https://github.com/mobxjs/mobx/pull/2641#issuecomment-737292058\n enumerable: false,\n // Non-obsevable, therefore non-writable\n // Also prevents rewriting in subclass constructor\n writable: safeDescriptors ? false : true\n };\n}\n\nfunction createComputedAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$3,\n extend_: extend_$3,\n decorate_20223_: decorate_20223_$3\n };\n}\nfunction make_$3(adm, key, descriptor) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;\n}\nfunction extend_$3(adm, key, descriptor, proxyTrap) {\n assertComputedDescriptor(adm, this, key, descriptor);\n return adm.defineComputedProperty_(key, _extends({}, this.options_, {\n get: descriptor.get,\n set: descriptor.set\n }), proxyTrap);\n}\nfunction decorate_20223_$3(get, context) {\n if (true) {\n assert20223DecoratorType(context, [\"getter\"]);\n }\n var ann = this;\n var key = context.name,\n addInitializer = context.addInitializer;\n addInitializer(function () {\n var adm = asObservableObject(this)[$mobx];\n var options = _extends({}, ann.options_, {\n get: get,\n context: this\n });\n options.name || (options.name = true ? adm.name_ + \".\" + key.toString() : 0);\n adm.values_.set(key, new ComputedValue(options));\n });\n return function () {\n return this[$mobx].getObservablePropValue_(key);\n };\n}\nfunction assertComputedDescriptor(adm, _ref, key, _ref2) {\n var annotationType_ = _ref.annotationType_;\n var get = _ref2.get;\n if ( true && !get) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' can only be used on getter(+setter) properties.\"));\n }\n}\n\nfunction createObservableAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$4,\n extend_: extend_$4,\n decorate_20223_: decorate_20223_$4\n };\n}\nfunction make_$4(adm, key, descriptor) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;\n}\nfunction extend_$4(adm, key, descriptor, proxyTrap) {\n var _this$options_$enhanc, _this$options_;\n assertObservableDescriptor(adm, this, key, descriptor);\n return adm.defineObservableProperty_(key, descriptor.value, (_this$options_$enhanc = (_this$options_ = this.options_) == null ? void 0 : _this$options_.enhancer) != null ? _this$options_$enhanc : deepEnhancer, proxyTrap);\n}\nfunction decorate_20223_$4(desc, context) {\n if (true) {\n if (context.kind === \"field\") {\n throw die(\"Please use `@observable accessor \" + String(context.name) + \"` instead of `@observable \" + String(context.name) + \"`\");\n }\n assert20223DecoratorType(context, [\"accessor\"]);\n }\n var ann = this;\n var kind = context.kind,\n name = context.name;\n // The laziness here is not ideal... It's a workaround to how 2022.3 Decorators are implemented:\n // `addInitializer` callbacks are executed _before_ any accessors are defined (instead of the ideal-for-us right after each).\n // This means that, if we were to do our stuff in an `addInitializer`, we'd attempt to read a private slot\n // before it has been initialized. The runtime doesn't like that and throws a `Cannot read private member\n // from an object whose class did not declare it` error.\n // TODO: it seems that this will not be required anymore in the final version of the spec\n // See TODO: link\n var initializedObjects = new WeakSet();\n function initializeObservable(target, value) {\n var _ann$options_$enhance, _ann$options_;\n var adm = asObservableObject(target)[$mobx];\n var observable = new ObservableValue(value, (_ann$options_$enhance = (_ann$options_ = ann.options_) == null ? void 0 : _ann$options_.enhancer) != null ? _ann$options_$enhance : deepEnhancer, true ? adm.name_ + \".\" + name.toString() : 0, false);\n adm.values_.set(name, observable);\n initializedObjects.add(target);\n }\n if (kind == \"accessor\") {\n return {\n get: function get() {\n if (!initializedObjects.has(this)) {\n initializeObservable(this, desc.get.call(this));\n }\n return this[$mobx].getObservablePropValue_(name);\n },\n set: function set(value) {\n if (!initializedObjects.has(this)) {\n initializeObservable(this, value);\n }\n return this[$mobx].setObservablePropValue_(name, value);\n },\n init: function init(value) {\n if (!initializedObjects.has(this)) {\n initializeObservable(this, value);\n }\n return value;\n }\n };\n }\n return;\n}\nfunction assertObservableDescriptor(adm, _ref, key, descriptor) {\n var annotationType_ = _ref.annotationType_;\n if ( true && !(\"value\" in descriptor)) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' cannot be used on getter/setter properties\"));\n }\n}\n\nvar AUTO = \"true\";\nvar autoAnnotation = /*#__PURE__*/createAutoAnnotation();\nfunction createAutoAnnotation(options) {\n return {\n annotationType_: AUTO,\n options_: options,\n make_: make_$5,\n extend_: extend_$5,\n decorate_20223_: decorate_20223_$5\n };\n}\nfunction make_$5(adm, key, descriptor, source) {\n var _this$options_3, _this$options_4;\n // getter -> computed\n if (descriptor.get) {\n return computed.make_(adm, key, descriptor, source);\n }\n // lone setter -> action setter\n if (descriptor.set) {\n // TODO make action applicable to setter and delegate to action.make_\n var set = createAction(key.toString(), descriptor.set);\n // own\n if (source === adm.target_) {\n return adm.defineProperty_(key, {\n configurable: globalState.safeDescriptors ? adm.isPlainObject_ : true,\n set: set\n }) === null ? 0 /* MakeResult.Cancel */ : 2 /* MakeResult.Continue */;\n }\n // proto\n defineProperty(source, key, {\n configurable: true,\n set: set\n });\n return 2 /* MakeResult.Continue */;\n }\n // function on proto -> autoAction/flow\n if (source !== adm.target_ && typeof descriptor.value === \"function\") {\n var _this$options_2;\n if (isGenerator(descriptor.value)) {\n var _this$options_;\n var flowAnnotation = (_this$options_ = this.options_) != null && _this$options_.autoBind ? flow.bound : flow;\n return flowAnnotation.make_(adm, key, descriptor, source);\n }\n var actionAnnotation = (_this$options_2 = this.options_) != null && _this$options_2.autoBind ? autoAction.bound : autoAction;\n return actionAnnotation.make_(adm, key, descriptor, source);\n }\n // other -> observable\n // Copy props from proto as well, see test:\n // \"decorate should work with Object.create\"\n var observableAnnotation = ((_this$options_3 = this.options_) == null ? void 0 : _this$options_3.deep) === false ? observable.ref : observable;\n // if function respect autoBind option\n if (typeof descriptor.value === \"function\" && (_this$options_4 = this.options_) != null && _this$options_4.autoBind) {\n var _adm$proxy_;\n descriptor.value = descriptor.value.bind((_adm$proxy_ = adm.proxy_) != null ? _adm$proxy_ : adm.target_);\n }\n return observableAnnotation.make_(adm, key, descriptor, source);\n}\nfunction extend_$5(adm, key, descriptor, proxyTrap) {\n var _this$options_5, _this$options_6;\n // getter -> computed\n if (descriptor.get) {\n return computed.extend_(adm, key, descriptor, proxyTrap);\n }\n // lone setter -> action setter\n if (descriptor.set) {\n // TODO make action applicable to setter and delegate to action.extend_\n return adm.defineProperty_(key, {\n configurable: globalState.safeDescriptors ? adm.isPlainObject_ : true,\n set: createAction(key.toString(), descriptor.set)\n }, proxyTrap);\n }\n // other -> observable\n // if function respect autoBind option\n if (typeof descriptor.value === \"function\" && (_this$options_5 = this.options_) != null && _this$options_5.autoBind) {\n var _adm$proxy_2;\n descriptor.value = descriptor.value.bind((_adm$proxy_2 = adm.proxy_) != null ? _adm$proxy_2 : adm.target_);\n }\n var observableAnnotation = ((_this$options_6 = this.options_) == null ? void 0 : _this$options_6.deep) === false ? observable.ref : observable;\n return observableAnnotation.extend_(adm, key, descriptor, proxyTrap);\n}\nfunction decorate_20223_$5(desc, context) {\n die(\"'\" + this.annotationType_ + \"' cannot be used as a decorator\");\n}\n\nvar OBSERVABLE = \"observable\";\nvar OBSERVABLE_REF = \"observable.ref\";\nvar OBSERVABLE_SHALLOW = \"observable.shallow\";\nvar OBSERVABLE_STRUCT = \"observable.struct\";\n// Predefined bags of create observable options, to avoid allocating temporarily option objects\n// in the majority of cases\nvar defaultCreateObservableOptions = {\n deep: true,\n name: undefined,\n defaultDecorator: undefined,\n proxy: true\n};\nObject.freeze(defaultCreateObservableOptions);\nfunction asCreateObservableOptions(thing) {\n return thing || defaultCreateObservableOptions;\n}\nvar observableAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE);\nvar observableRefAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE_REF, {\n enhancer: referenceEnhancer\n});\nvar observableShallowAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE_SHALLOW, {\n enhancer: shallowEnhancer\n});\nvar observableStructAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE_STRUCT, {\n enhancer: refStructEnhancer\n});\nvar observableDecoratorAnnotation = /*#__PURE__*/createDecoratorAnnotation(observableAnnotation);\nfunction getEnhancerFromOptions(options) {\n return options.deep === true ? deepEnhancer : options.deep === false ? referenceEnhancer : getEnhancerFromAnnotation(options.defaultDecorator);\n}\nfunction getAnnotationFromOptions(options) {\n var _options$defaultDecor;\n return options ? (_options$defaultDecor = options.defaultDecorator) != null ? _options$defaultDecor : createAutoAnnotation(options) : undefined;\n}\nfunction getEnhancerFromAnnotation(annotation) {\n var _annotation$options_$, _annotation$options_;\n return !annotation ? deepEnhancer : (_annotation$options_$ = (_annotation$options_ = annotation.options_) == null ? void 0 : _annotation$options_.enhancer) != null ? _annotation$options_$ : deepEnhancer;\n}\n/**\n * Turns an object, array or function into a reactive structure.\n * @param v the value which should become observable.\n */\nfunction createObservable(v, arg2, arg3) {\n // @observable someProp; (2022.3 Decorators)\n if (is20223Decorator(arg2)) {\n return observableAnnotation.decorate_20223_(v, arg2);\n }\n // @observable someProp;\n if (isStringish(arg2)) {\n storeAnnotation(v, arg2, observableAnnotation);\n return;\n }\n // already observable - ignore\n if (isObservable(v)) {\n return v;\n }\n // plain object\n if (isPlainObject(v)) {\n return observable.object(v, arg2, arg3);\n }\n // Array\n if (Array.isArray(v)) {\n return observable.array(v, arg2);\n }\n // Map\n if (isES6Map(v)) {\n return observable.map(v, arg2);\n }\n // Set\n if (isES6Set(v)) {\n return observable.set(v, arg2);\n }\n // other object - ignore\n if (typeof v === \"object\" && v !== null) {\n return v;\n }\n // anything else\n return observable.box(v, arg2);\n}\nassign(createObservable, observableDecoratorAnnotation);\nvar observableFactories = {\n box: function box(value, options) {\n var o = asCreateObservableOptions(options);\n return new ObservableValue(value, getEnhancerFromOptions(o), o.name, true, o.equals);\n },\n array: function array(initialValues, options) {\n var o = asCreateObservableOptions(options);\n return (globalState.useProxies === false || o.proxy === false ? createLegacyArray : createObservableArray)(initialValues, getEnhancerFromOptions(o), o.name);\n },\n map: function map(initialValues, options) {\n var o = asCreateObservableOptions(options);\n return new ObservableMap(initialValues, getEnhancerFromOptions(o), o.name);\n },\n set: function set(initialValues, options) {\n var o = asCreateObservableOptions(options);\n return new ObservableSet(initialValues, getEnhancerFromOptions(o), o.name);\n },\n object: function object(props, decorators, options) {\n return initObservable(function () {\n return extendObservable(globalState.useProxies === false || (options == null ? void 0 : options.proxy) === false ? asObservableObject({}, options) : asDynamicObservableObject({}, options), props, decorators);\n });\n },\n ref: /*#__PURE__*/createDecoratorAnnotation(observableRefAnnotation),\n shallow: /*#__PURE__*/createDecoratorAnnotation(observableShallowAnnotation),\n deep: observableDecoratorAnnotation,\n struct: /*#__PURE__*/createDecoratorAnnotation(observableStructAnnotation)\n};\n// eslint-disable-next-line\nvar observable = /*#__PURE__*/assign(createObservable, observableFactories);\n\nvar COMPUTED = \"computed\";\nvar COMPUTED_STRUCT = \"computed.struct\";\nvar computedAnnotation = /*#__PURE__*/createComputedAnnotation(COMPUTED);\nvar computedStructAnnotation = /*#__PURE__*/createComputedAnnotation(COMPUTED_STRUCT, {\n equals: comparer.structural\n});\n/**\n * Decorator for class properties: @computed get value() { return expr; }.\n * For legacy purposes also invokable as ES5 observable created: `computed(() => expr)`;\n */\nvar computed = function computed(arg1, arg2) {\n if (is20223Decorator(arg2)) {\n // @computed (2022.3 Decorators)\n return computedAnnotation.decorate_20223_(arg1, arg2);\n }\n if (isStringish(arg2)) {\n // @computed\n return storeAnnotation(arg1, arg2, computedAnnotation);\n }\n if (isPlainObject(arg1)) {\n // @computed({ options })\n return createDecoratorAnnotation(createComputedAnnotation(COMPUTED, arg1));\n }\n // computed(expr, options?)\n if (true) {\n if (!isFunction(arg1)) {\n die(\"First argument to `computed` should be an expression.\");\n }\n if (isFunction(arg2)) {\n die(\"A setter as second argument is no longer supported, use `{ set: fn }` option instead\");\n }\n }\n var opts = isPlainObject(arg2) ? arg2 : {};\n opts.get = arg1;\n opts.name || (opts.name = arg1.name || \"\"); /* for generated name */\n return new ComputedValue(opts);\n};\nObject.assign(computed, computedAnnotation);\ncomputed.struct = /*#__PURE__*/createDecoratorAnnotation(computedStructAnnotation);\n\nvar _getDescriptor$config, _getDescriptor;\n// we don't use globalState for these in order to avoid possible issues with multiple\n// mobx versions\nvar currentActionId = 0;\nvar nextActionId = 1;\nvar isFunctionNameConfigurable = (_getDescriptor$config = (_getDescriptor = /*#__PURE__*/getDescriptor(function () {}, \"name\")) == null ? void 0 : _getDescriptor.configurable) != null ? _getDescriptor$config : false;\n// we can safely recycle this object\nvar tmpNameDescriptor = {\n value: \"action\",\n configurable: true,\n writable: false,\n enumerable: false\n};\nfunction createAction(actionName, fn, autoAction, ref) {\n if (autoAction === void 0) {\n autoAction = false;\n }\n if (true) {\n if (!isFunction(fn)) {\n die(\"`action` can only be invoked on functions\");\n }\n if (typeof actionName !== \"string\" || !actionName) {\n die(\"actions should have valid names, got: '\" + actionName + \"'\");\n }\n }\n function res() {\n return executeAction(actionName, autoAction, fn, ref || this, arguments);\n }\n res.isMobxAction = true;\n res.toString = function () {\n return fn.toString();\n };\n if (isFunctionNameConfigurable) {\n tmpNameDescriptor.value = actionName;\n defineProperty(res, \"name\", tmpNameDescriptor);\n }\n return res;\n}\nfunction executeAction(actionName, canRunAsDerivation, fn, scope, args) {\n var runInfo = _startAction(actionName, canRunAsDerivation, scope, args);\n try {\n return fn.apply(scope, args);\n } catch (err) {\n runInfo.error_ = err;\n throw err;\n } finally {\n _endAction(runInfo);\n }\n}\nfunction _startAction(actionName, canRunAsDerivation,\n// true for autoAction\nscope, args) {\n var notifySpy_ = true && isSpyEnabled() && !!actionName;\n var startTime_ = 0;\n if ( true && notifySpy_) {\n startTime_ = Date.now();\n var flattenedArgs = args ? Array.from(args) : EMPTY_ARRAY;\n spyReportStart({\n type: ACTION,\n name: actionName,\n object: scope,\n arguments: flattenedArgs\n });\n }\n var prevDerivation_ = globalState.trackingDerivation;\n var runAsAction = !canRunAsDerivation || !prevDerivation_;\n startBatch();\n var prevAllowStateChanges_ = globalState.allowStateChanges; // by default preserve previous allow\n if (runAsAction) {\n untrackedStart();\n prevAllowStateChanges_ = allowStateChangesStart(true);\n }\n var prevAllowStateReads_ = allowStateReadsStart(true);\n var runInfo = {\n runAsAction_: runAsAction,\n prevDerivation_: prevDerivation_,\n prevAllowStateChanges_: prevAllowStateChanges_,\n prevAllowStateReads_: prevAllowStateReads_,\n notifySpy_: notifySpy_,\n startTime_: startTime_,\n actionId_: nextActionId++,\n parentActionId_: currentActionId\n };\n currentActionId = runInfo.actionId_;\n return runInfo;\n}\nfunction _endAction(runInfo) {\n if (currentActionId !== runInfo.actionId_) {\n die(30);\n }\n currentActionId = runInfo.parentActionId_;\n if (runInfo.error_ !== undefined) {\n globalState.suppressReactionErrors = true;\n }\n allowStateChangesEnd(runInfo.prevAllowStateChanges_);\n allowStateReadsEnd(runInfo.prevAllowStateReads_);\n endBatch();\n if (runInfo.runAsAction_) {\n untrackedEnd(runInfo.prevDerivation_);\n }\n if ( true && runInfo.notifySpy_) {\n spyReportEnd({\n time: Date.now() - runInfo.startTime_\n });\n }\n globalState.suppressReactionErrors = false;\n}\nfunction allowStateChanges(allowStateChanges, func) {\n var prev = allowStateChangesStart(allowStateChanges);\n try {\n return func();\n } finally {\n allowStateChangesEnd(prev);\n }\n}\nfunction allowStateChangesStart(allowStateChanges) {\n var prev = globalState.allowStateChanges;\n globalState.allowStateChanges = allowStateChanges;\n return prev;\n}\nfunction allowStateChangesEnd(prev) {\n globalState.allowStateChanges = prev;\n}\n\nvar CREATE = \"create\";\nvar ObservableValue = /*#__PURE__*/function (_Atom) {\n function ObservableValue(value, enhancer, name_, notifySpy, equals) {\n var _this;\n if (name_ === void 0) {\n name_ = true ? \"ObservableValue@\" + getNextId() : 0;\n }\n if (notifySpy === void 0) {\n notifySpy = true;\n }\n if (equals === void 0) {\n equals = comparer[\"default\"];\n }\n _this = _Atom.call(this, name_) || this;\n _this.enhancer = void 0;\n _this.name_ = void 0;\n _this.equals = void 0;\n _this.hasUnreportedChange_ = false;\n _this.interceptors_ = void 0;\n _this.changeListeners_ = void 0;\n _this.value_ = void 0;\n _this.dehancer = void 0;\n _this.enhancer = enhancer;\n _this.name_ = name_;\n _this.equals = equals;\n _this.value_ = enhancer(value, undefined, name_);\n if ( true && notifySpy && isSpyEnabled()) {\n // only notify spy if this is a stand-alone observable\n spyReport({\n type: CREATE,\n object: _this,\n observableKind: \"value\",\n debugObjectName: _this.name_,\n newValue: \"\" + _this.value_\n });\n }\n return _this;\n }\n _inheritsLoose(ObservableValue, _Atom);\n var _proto = ObservableValue.prototype;\n _proto.dehanceValue = function dehanceValue(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.set = function set(newValue) {\n var oldValue = this.value_;\n newValue = this.prepareNewValue_(newValue);\n if (newValue !== globalState.UNCHANGED) {\n var notifySpy = isSpyEnabled();\n if ( true && notifySpy) {\n spyReportStart({\n type: UPDATE,\n object: this,\n observableKind: \"value\",\n debugObjectName: this.name_,\n newValue: newValue,\n oldValue: oldValue\n });\n }\n this.setNewValue_(newValue);\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n };\n _proto.prepareNewValue_ = function prepareNewValue_(newValue) {\n checkIfStateModificationsAreAllowed(this);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this,\n type: UPDATE,\n newValue: newValue\n });\n if (!change) {\n return globalState.UNCHANGED;\n }\n newValue = change.newValue;\n }\n // apply modifier\n newValue = this.enhancer(newValue, this.value_, this.name_);\n return this.equals(this.value_, newValue) ? globalState.UNCHANGED : newValue;\n };\n _proto.setNewValue_ = function setNewValue_(newValue) {\n var oldValue = this.value_;\n this.value_ = newValue;\n this.reportChanged();\n if (hasListeners(this)) {\n notifyListeners(this, {\n type: UPDATE,\n object: this,\n newValue: newValue,\n oldValue: oldValue\n });\n }\n };\n _proto.get = function get() {\n this.reportObserved();\n return this.dehanceValue(this.value_);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n if (fireImmediately) {\n listener({\n observableKind: \"value\",\n debugObjectName: this.name_,\n object: this,\n type: UPDATE,\n newValue: this.value_,\n oldValue: undefined\n });\n }\n return registerListener(this, listener);\n };\n _proto.raw = function raw() {\n // used by MST ot get undehanced value\n return this.value_;\n };\n _proto.toJSON = function toJSON() {\n return this.get();\n };\n _proto.toString = function toString() {\n return this.name_ + \"[\" + this.value_ + \"]\";\n };\n _proto.valueOf = function valueOf() {\n return toPrimitive(this.get());\n };\n _proto[Symbol.toPrimitive] = function () {\n return this.valueOf();\n };\n return ObservableValue;\n}(Atom);\nvar isObservableValue = /*#__PURE__*/createInstanceofPredicate(\"ObservableValue\", ObservableValue);\n\n/**\n * A node in the state dependency root that observes other nodes, and can be observed itself.\n *\n * ComputedValue will remember the result of the computation for the duration of the batch, or\n * while being observed.\n *\n * During this time it will recompute only when one of its direct dependencies changed,\n * but only when it is being accessed with `ComputedValue.get()`.\n *\n * Implementation description:\n * 1. First time it's being accessed it will compute and remember result\n * give back remembered result until 2. happens\n * 2. First time any deep dependency change, propagate POSSIBLY_STALE to all observers, wait for 3.\n * 3. When it's being accessed, recompute if any shallow dependency changed.\n * if result changed: propagate STALE to all observers, that were POSSIBLY_STALE from the last step.\n * go to step 2. either way\n *\n * If at any point it's outside batch and it isn't observed: reset everything and go to 1.\n */\nvar ComputedValue = /*#__PURE__*/function () {\n /**\n * Create a new computed value based on a function expression.\n *\n * The `name` property is for debug purposes only.\n *\n * The `equals` property specifies the comparer function to use to determine if a newly produced\n * value differs from the previous value. Two comparers are provided in the library; `defaultComparer`\n * compares based on identity comparison (===), and `structuralComparer` deeply compares the structure.\n * Structural comparison can be convenient if you always produce a new aggregated object and\n * don't want to notify observers if it is structurally the same.\n * This is useful for working with vectors, mouse coordinates etc.\n */\n function ComputedValue(options) {\n this.dependenciesState_ = IDerivationState_.NOT_TRACKING_;\n this.observing_ = [];\n // nodes we are looking at. Our value depends on these nodes\n this.newObserving_ = null;\n // during tracking it's an array with new observed observers\n this.observers_ = new Set();\n this.runId_ = 0;\n this.lastAccessedBy_ = 0;\n this.lowestObserverState_ = IDerivationState_.UP_TO_DATE_;\n this.unboundDepsCount_ = 0;\n this.value_ = new CaughtException(null);\n this.name_ = void 0;\n this.triggeredBy_ = void 0;\n this.flags_ = 0;\n this.derivation = void 0;\n // N.B: unminified as it is used by MST\n this.setter_ = void 0;\n this.isTracing_ = TraceMode.NONE;\n this.scope_ = void 0;\n this.equals_ = void 0;\n this.requiresReaction_ = void 0;\n this.keepAlive_ = void 0;\n this.onBOL = void 0;\n this.onBUOL = void 0;\n if (!options.get) {\n die(31);\n }\n this.derivation = options.get;\n this.name_ = options.name || ( true ? \"ComputedValue@\" + getNextId() : 0);\n if (options.set) {\n this.setter_ = createAction( true ? this.name_ + \"-setter\" : 0, options.set);\n }\n this.equals_ = options.equals || (options.compareStructural || options.struct ? comparer.structural : comparer[\"default\"]);\n this.scope_ = options.context;\n this.requiresReaction_ = options.requiresReaction;\n this.keepAlive_ = !!options.keepAlive;\n }\n var _proto = ComputedValue.prototype;\n _proto.onBecomeStale_ = function onBecomeStale_() {\n propagateMaybeChanged(this);\n };\n _proto.onBO = function onBO() {\n if (this.onBOL) {\n this.onBOL.forEach(function (listener) {\n return listener();\n });\n }\n };\n _proto.onBUO = function onBUO() {\n if (this.onBUOL) {\n this.onBUOL.forEach(function (listener) {\n return listener();\n });\n }\n }\n // to check for cycles\n ;\n /**\n * Returns the current value of this computed value.\n * Will evaluate its computation first if needed.\n */\n _proto.get = function get() {\n if (this.isComputing) {\n die(32, this.name_, this.derivation);\n }\n if (globalState.inBatch === 0 &&\n // !globalState.trackingDerivatpion &&\n this.observers_.size === 0 && !this.keepAlive_) {\n if (shouldCompute(this)) {\n this.warnAboutUntrackedRead_();\n startBatch(); // See perf test 'computed memoization'\n this.value_ = this.computeValue_(false);\n endBatch();\n }\n } else {\n reportObserved(this);\n if (shouldCompute(this)) {\n var prevTrackingContext = globalState.trackingContext;\n if (this.keepAlive_ && !prevTrackingContext) {\n globalState.trackingContext = this;\n }\n if (this.trackAndCompute()) {\n propagateChangeConfirmed(this);\n }\n globalState.trackingContext = prevTrackingContext;\n }\n }\n var result = this.value_;\n if (isCaughtException(result)) {\n throw result.cause;\n }\n return result;\n };\n _proto.set = function set(value) {\n if (this.setter_) {\n if (this.isRunningSetter) {\n die(33, this.name_);\n }\n this.isRunningSetter = true;\n try {\n this.setter_.call(this.scope_, value);\n } finally {\n this.isRunningSetter = false;\n }\n } else {\n die(34, this.name_);\n }\n };\n _proto.trackAndCompute = function trackAndCompute() {\n // N.B: unminified as it is used by MST\n var oldValue = this.value_;\n var wasSuspended = /* see #1208 */this.dependenciesState_ === IDerivationState_.NOT_TRACKING_;\n var newValue = this.computeValue_(true);\n var changed = wasSuspended || isCaughtException(oldValue) || isCaughtException(newValue) || !this.equals_(oldValue, newValue);\n if (changed) {\n this.value_ = newValue;\n if ( true && isSpyEnabled()) {\n spyReport({\n observableKind: \"computed\",\n debugObjectName: this.name_,\n object: this.scope_,\n type: \"update\",\n oldValue: oldValue,\n newValue: newValue\n });\n }\n }\n return changed;\n };\n _proto.computeValue_ = function computeValue_(track) {\n this.isComputing = true;\n // don't allow state changes during computation\n var prev = allowStateChangesStart(false);\n var res;\n if (track) {\n res = trackDerivedFunction(this, this.derivation, this.scope_);\n } else {\n if (globalState.disableErrorBoundaries === true) {\n res = this.derivation.call(this.scope_);\n } else {\n try {\n res = this.derivation.call(this.scope_);\n } catch (e) {\n res = new CaughtException(e);\n }\n }\n }\n allowStateChangesEnd(prev);\n this.isComputing = false;\n return res;\n };\n _proto.suspend_ = function suspend_() {\n if (!this.keepAlive_) {\n clearObserving(this);\n this.value_ = undefined; // don't hold on to computed value!\n if ( true && this.isTracing_ !== TraceMode.NONE) {\n console.log(\"[mobx.trace] Computed value '\" + this.name_ + \"' was suspended and it will recompute on the next access.\");\n }\n }\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n var _this = this;\n var firstTime = true;\n var prevValue = undefined;\n return autorun(function () {\n // TODO: why is this in a different place than the spyReport() function? in all other observables it's called in the same place\n var newValue = _this.get();\n if (!firstTime || fireImmediately) {\n var prevU = untrackedStart();\n listener({\n observableKind: \"computed\",\n debugObjectName: _this.name_,\n type: UPDATE,\n object: _this,\n newValue: newValue,\n oldValue: prevValue\n });\n untrackedEnd(prevU);\n }\n firstTime = false;\n prevValue = newValue;\n });\n };\n _proto.warnAboutUntrackedRead_ = function warnAboutUntrackedRead_() {\n if (false) {}\n if (this.isTracing_ !== TraceMode.NONE) {\n console.log(\"[mobx.trace] Computed value '\" + this.name_ + \"' is being read outside a reactive context. Doing a full recompute.\");\n }\n if (typeof this.requiresReaction_ === \"boolean\" ? this.requiresReaction_ : globalState.computedRequiresReaction) {\n console.warn(\"[mobx] Computed value '\" + this.name_ + \"' is being read outside a reactive context. Doing a full recompute.\");\n }\n };\n _proto.toString = function toString() {\n return this.name_ + \"[\" + this.derivation.toString() + \"]\";\n };\n _proto.valueOf = function valueOf() {\n return toPrimitive(this.get());\n };\n _proto[Symbol.toPrimitive] = function () {\n return this.valueOf();\n };\n return _createClass(ComputedValue, [{\n key: \"isComputing\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isComputingMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isComputingMask_, newValue);\n }\n }, {\n key: \"isRunningSetter\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isRunningSetterMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isRunningSetterMask_, newValue);\n }\n }, {\n key: \"isBeingObserved\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isBeingObservedMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isBeingObservedMask_, newValue);\n }\n }, {\n key: \"isPendingUnobservation\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isPendingUnobservationMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isPendingUnobservationMask_, newValue);\n }\n }, {\n key: \"diffValue\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.diffValueMask_) ? 1 : 0;\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.diffValueMask_, newValue === 1 ? true : false);\n }\n }]);\n}();\nComputedValue.isComputingMask_ = 1;\nComputedValue.isRunningSetterMask_ = 2;\nComputedValue.isBeingObservedMask_ = 4;\nComputedValue.isPendingUnobservationMask_ = 8;\nComputedValue.diffValueMask_ = 16;\nvar isComputedValue = /*#__PURE__*/createInstanceofPredicate(\"ComputedValue\", ComputedValue);\n\nvar IDerivationState_;\n(function (IDerivationState_) {\n // before being run or (outside batch and not being observed)\n // at this point derivation is not holding any data about dependency tree\n IDerivationState_[IDerivationState_[\"NOT_TRACKING_\"] = -1] = \"NOT_TRACKING_\";\n // no shallow dependency changed since last computation\n // won't recalculate derivation\n // this is what makes mobx fast\n IDerivationState_[IDerivationState_[\"UP_TO_DATE_\"] = 0] = \"UP_TO_DATE_\";\n // some deep dependency changed, but don't know if shallow dependency changed\n // will require to check first if UP_TO_DATE or POSSIBLY_STALE\n // currently only ComputedValue will propagate POSSIBLY_STALE\n //\n // having this state is second big optimization:\n // don't have to recompute on every dependency change, but only when it's needed\n IDerivationState_[IDerivationState_[\"POSSIBLY_STALE_\"] = 1] = \"POSSIBLY_STALE_\";\n // A shallow dependency has changed since last computation and the derivation\n // will need to recompute when it's needed next.\n IDerivationState_[IDerivationState_[\"STALE_\"] = 2] = \"STALE_\";\n})(IDerivationState_ || (IDerivationState_ = {}));\nvar TraceMode;\n(function (TraceMode) {\n TraceMode[TraceMode[\"NONE\"] = 0] = \"NONE\";\n TraceMode[TraceMode[\"LOG\"] = 1] = \"LOG\";\n TraceMode[TraceMode[\"BREAK\"] = 2] = \"BREAK\";\n})(TraceMode || (TraceMode = {}));\nvar CaughtException = function CaughtException(cause) {\n this.cause = void 0;\n this.cause = cause;\n // Empty\n};\nfunction isCaughtException(e) {\n return e instanceof CaughtException;\n}\n/**\n * Finds out whether any dependency of the derivation has actually changed.\n * If dependenciesState is 1 then it will recalculate dependencies,\n * if any dependency changed it will propagate it by changing dependenciesState to 2.\n *\n * By iterating over the dependencies in the same order that they were reported and\n * stopping on the first change, all the recalculations are only called for ComputedValues\n * that will be tracked by derivation. That is because we assume that if the first x\n * dependencies of the derivation doesn't change then the derivation should run the same way\n * up until accessing x-th dependency.\n */\nfunction shouldCompute(derivation) {\n switch (derivation.dependenciesState_) {\n case IDerivationState_.UP_TO_DATE_:\n return false;\n case IDerivationState_.NOT_TRACKING_:\n case IDerivationState_.STALE_:\n return true;\n case IDerivationState_.POSSIBLY_STALE_:\n {\n // state propagation can occur outside of action/reactive context #2195\n var prevAllowStateReads = allowStateReadsStart(true);\n var prevUntracked = untrackedStart(); // no need for those computeds to be reported, they will be picked up in trackDerivedFunction.\n var obs = derivation.observing_,\n l = obs.length;\n for (var i = 0; i < l; i++) {\n var obj = obs[i];\n if (isComputedValue(obj)) {\n if (globalState.disableErrorBoundaries) {\n obj.get();\n } else {\n try {\n obj.get();\n } catch (e) {\n // we are not interested in the value *or* exception at this moment, but if there is one, notify all\n untrackedEnd(prevUntracked);\n allowStateReadsEnd(prevAllowStateReads);\n return true;\n }\n }\n // if ComputedValue `obj` actually changed it will be computed and propagated to its observers.\n // and `derivation` is an observer of `obj`\n // invariantShouldCompute(derivation)\n if (derivation.dependenciesState_ === IDerivationState_.STALE_) {\n untrackedEnd(prevUntracked);\n allowStateReadsEnd(prevAllowStateReads);\n return true;\n }\n }\n }\n changeDependenciesStateTo0(derivation);\n untrackedEnd(prevUntracked);\n allowStateReadsEnd(prevAllowStateReads);\n return false;\n }\n }\n}\nfunction isComputingDerivation() {\n return globalState.trackingDerivation !== null; // filter out actions inside computations\n}\nfunction checkIfStateModificationsAreAllowed(atom) {\n if (false) {}\n var hasObservers = atom.observers_.size > 0;\n // Should not be possible to change observed state outside strict mode, except during initialization, see #563\n if (!globalState.allowStateChanges && (hasObservers || globalState.enforceActions === \"always\")) {\n console.warn(\"[MobX] \" + (globalState.enforceActions ? \"Since strict-mode is enabled, changing (observed) observable values without using an action is not allowed. Tried to modify: \" : \"Side effects like changing state are not allowed at this point. Are you trying to modify state from, for example, a computed value or the render function of a React component? You can wrap side effects in 'runInAction' (or decorate functions with 'action') if needed. Tried to modify: \") + atom.name_);\n }\n}\nfunction checkIfStateReadsAreAllowed(observable) {\n if ( true && !globalState.allowStateReads && globalState.observableRequiresReaction) {\n console.warn(\"[mobx] Observable '\" + observable.name_ + \"' being read outside a reactive context.\");\n }\n}\n/**\n * Executes the provided function `f` and tracks which observables are being accessed.\n * The tracking information is stored on the `derivation` object and the derivation is registered\n * as observer of any of the accessed observables.\n */\nfunction trackDerivedFunction(derivation, f, context) {\n var prevAllowStateReads = allowStateReadsStart(true);\n changeDependenciesStateTo0(derivation);\n // Preallocate array; will be trimmed by bindDependencies.\n derivation.newObserving_ = new Array(\n // Reserve constant space for initial dependencies, dynamic space otherwise.\n // See https://github.com/mobxjs/mobx/pull/3833\n derivation.runId_ === 0 ? 100 : derivation.observing_.length);\n derivation.unboundDepsCount_ = 0;\n derivation.runId_ = ++globalState.runId;\n var prevTracking = globalState.trackingDerivation;\n globalState.trackingDerivation = derivation;\n globalState.inBatch++;\n var result;\n if (globalState.disableErrorBoundaries === true) {\n result = f.call(context);\n } else {\n try {\n result = f.call(context);\n } catch (e) {\n result = new CaughtException(e);\n }\n }\n globalState.inBatch--;\n globalState.trackingDerivation = prevTracking;\n bindDependencies(derivation);\n warnAboutDerivationWithoutDependencies(derivation);\n allowStateReadsEnd(prevAllowStateReads);\n return result;\n}\nfunction warnAboutDerivationWithoutDependencies(derivation) {\n if (false) {}\n if (derivation.observing_.length !== 0) {\n return;\n }\n if (typeof derivation.requiresObservable_ === \"boolean\" ? derivation.requiresObservable_ : globalState.reactionRequiresObservable) {\n console.warn(\"[mobx] Derivation '\" + derivation.name_ + \"' is created/updated without reading any observable value.\");\n }\n}\n/**\n * diffs newObserving with observing.\n * update observing to be newObserving with unique observables\n * notify observers that become observed/unobserved\n */\nfunction bindDependencies(derivation) {\n // invariant(derivation.dependenciesState !== IDerivationState.NOT_TRACKING, \"INTERNAL ERROR bindDependencies expects derivation.dependenciesState !== -1\");\n var prevObserving = derivation.observing_;\n var observing = derivation.observing_ = derivation.newObserving_;\n var lowestNewObservingDerivationState = IDerivationState_.UP_TO_DATE_;\n // Go through all new observables and check diffValue: (this list can contain duplicates):\n // 0: first occurrence, change to 1 and keep it\n // 1: extra occurrence, drop it\n var i0 = 0,\n l = derivation.unboundDepsCount_;\n for (var i = 0; i < l; i++) {\n var dep = observing[i];\n if (dep.diffValue === 0) {\n dep.diffValue = 1;\n if (i0 !== i) {\n observing[i0] = dep;\n }\n i0++;\n }\n // Upcast is 'safe' here, because if dep is IObservable, `dependenciesState` will be undefined,\n // not hitting the condition\n if (dep.dependenciesState_ > lowestNewObservingDerivationState) {\n lowestNewObservingDerivationState = dep.dependenciesState_;\n }\n }\n observing.length = i0;\n derivation.newObserving_ = null; // newObserving shouldn't be needed outside tracking (statement moved down to work around FF bug, see #614)\n // Go through all old observables and check diffValue: (it is unique after last bindDependencies)\n // 0: it's not in new observables, unobserve it\n // 1: it keeps being observed, don't want to notify it. change to 0\n l = prevObserving.length;\n while (l--) {\n var _dep = prevObserving[l];\n if (_dep.diffValue === 0) {\n removeObserver(_dep, derivation);\n }\n _dep.diffValue = 0;\n }\n // Go through all new observables and check diffValue: (now it should be unique)\n // 0: it was set to 0 in last loop. don't need to do anything.\n // 1: it wasn't observed, let's observe it. set back to 0\n while (i0--) {\n var _dep2 = observing[i0];\n if (_dep2.diffValue === 1) {\n _dep2.diffValue = 0;\n addObserver(_dep2, derivation);\n }\n }\n // Some new observed derivations may become stale during this derivation computation\n // so they have had no chance to propagate staleness (#916)\n if (lowestNewObservingDerivationState !== IDerivationState_.UP_TO_DATE_) {\n derivation.dependenciesState_ = lowestNewObservingDerivationState;\n derivation.onBecomeStale_();\n }\n}\nfunction clearObserving(derivation) {\n // invariant(globalState.inBatch > 0, \"INTERNAL ERROR clearObserving should be called only inside batch\");\n var obs = derivation.observing_;\n derivation.observing_ = [];\n var i = obs.length;\n while (i--) {\n removeObserver(obs[i], derivation);\n }\n derivation.dependenciesState_ = IDerivationState_.NOT_TRACKING_;\n}\nfunction untracked(action) {\n var prev = untrackedStart();\n try {\n return action();\n } finally {\n untrackedEnd(prev);\n }\n}\nfunction untrackedStart() {\n var prev = globalState.trackingDerivation;\n globalState.trackingDerivation = null;\n return prev;\n}\nfunction untrackedEnd(prev) {\n globalState.trackingDerivation = prev;\n}\nfunction allowStateReadsStart(allowStateReads) {\n var prev = globalState.allowStateReads;\n globalState.allowStateReads = allowStateReads;\n return prev;\n}\nfunction allowStateReadsEnd(prev) {\n globalState.allowStateReads = prev;\n}\n/**\n * needed to keep `lowestObserverState` correct. when changing from (2 or 1) to 0\n *\n */\nfunction changeDependenciesStateTo0(derivation) {\n if (derivation.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {\n return;\n }\n derivation.dependenciesState_ = IDerivationState_.UP_TO_DATE_;\n var obs = derivation.observing_;\n var i = obs.length;\n while (i--) {\n obs[i].lowestObserverState_ = IDerivationState_.UP_TO_DATE_;\n }\n}\n\n/**\n * These values will persist if global state is reset\n */\nvar persistentKeys = [\"mobxGuid\", \"spyListeners\", \"enforceActions\", \"computedRequiresReaction\", \"reactionRequiresObservable\", \"observableRequiresReaction\", \"allowStateReads\", \"disableErrorBoundaries\", \"runId\", \"UNCHANGED\", \"useProxies\"];\nvar MobXGlobals = function MobXGlobals() {\n /**\n * MobXGlobals version.\n * MobX compatiblity with other versions loaded in memory as long as this version matches.\n * It indicates that the global state still stores similar information\n *\n * N.B: this version is unrelated to the package version of MobX, and is only the version of the\n * internal state storage of MobX, and can be the same across many different package versions\n */\n this.version = 6;\n /**\n * globally unique token to signal unchanged\n */\n this.UNCHANGED = {};\n /**\n * Currently running derivation\n */\n this.trackingDerivation = null;\n /**\n * Currently running reaction. This determines if we currently have a reactive context.\n * (Tracking derivation is also set for temporal tracking of computed values inside actions,\n * but trackingReaction can only be set by a form of Reaction)\n */\n this.trackingContext = null;\n /**\n * Each time a derivation is tracked, it is assigned a unique run-id\n */\n this.runId = 0;\n /**\n * 'guid' for general purpose. Will be persisted amongst resets.\n */\n this.mobxGuid = 0;\n /**\n * Are we in a batch block? (and how many of them)\n */\n this.inBatch = 0;\n /**\n * Observables that don't have observers anymore, and are about to be\n * suspended, unless somebody else accesses it in the same batch\n *\n * @type {IObservable[]}\n */\n this.pendingUnobservations = [];\n /**\n * List of scheduled, not yet executed, reactions.\n */\n this.pendingReactions = [];\n /**\n * Are we currently processing reactions?\n */\n this.isRunningReactions = false;\n /**\n * Is it allowed to change observables at this point?\n * In general, MobX doesn't allow that when running computations and React.render.\n * To ensure that those functions stay pure.\n */\n this.allowStateChanges = false;\n /**\n * Is it allowed to read observables at this point?\n * Used to hold the state needed for `observableRequiresReaction`\n */\n this.allowStateReads = true;\n /**\n * If strict mode is enabled, state changes are by default not allowed\n */\n this.enforceActions = true;\n /**\n * Spy callbacks\n */\n this.spyListeners = [];\n /**\n * Globally attached error handlers that react specifically to errors in reactions\n */\n this.globalReactionErrorHandlers = [];\n /**\n * Warn if computed values are accessed outside a reactive context\n */\n this.computedRequiresReaction = false;\n /**\n * (Experimental)\n * Warn if you try to create to derivation / reactive context without accessing any observable.\n */\n this.reactionRequiresObservable = false;\n /**\n * (Experimental)\n * Warn if observables are accessed outside a reactive context\n */\n this.observableRequiresReaction = false;\n /*\n * Don't catch and rethrow exceptions. This is useful for inspecting the state of\n * the stack when an exception occurs while debugging.\n */\n this.disableErrorBoundaries = false;\n /*\n * If true, we are already handling an exception in an action. Any errors in reactions should be suppressed, as\n * they are not the cause, see: https://github.com/mobxjs/mobx/issues/1836\n */\n this.suppressReactionErrors = false;\n this.useProxies = true;\n /*\n * print warnings about code that would fail if proxies weren't available\n */\n this.verifyProxies = false;\n /**\n * False forces all object's descriptors to\n * writable: true\n * configurable: true\n */\n this.safeDescriptors = true;\n};\nvar canMergeGlobalState = true;\nvar isolateCalled = false;\nvar globalState = /*#__PURE__*/function () {\n var global = /*#__PURE__*/getGlobal();\n if (global.__mobxInstanceCount > 0 && !global.__mobxGlobals) {\n canMergeGlobalState = false;\n }\n if (global.__mobxGlobals && global.__mobxGlobals.version !== new MobXGlobals().version) {\n canMergeGlobalState = false;\n }\n if (!canMergeGlobalState) {\n // Because this is a IIFE we need to let isolateCalled a chance to change\n // so we run it after the event loop completed at least 1 iteration\n setTimeout(function () {\n if (!isolateCalled) {\n die(35);\n }\n }, 1);\n return new MobXGlobals();\n } else if (global.__mobxGlobals) {\n global.__mobxInstanceCount += 1;\n if (!global.__mobxGlobals.UNCHANGED) {\n global.__mobxGlobals.UNCHANGED = {};\n } // make merge backward compatible\n return global.__mobxGlobals;\n } else {\n global.__mobxInstanceCount = 1;\n return global.__mobxGlobals = /*#__PURE__*/new MobXGlobals();\n }\n}();\nfunction isolateGlobalState() {\n if (globalState.pendingReactions.length || globalState.inBatch || globalState.isRunningReactions) {\n die(36);\n }\n isolateCalled = true;\n if (canMergeGlobalState) {\n var global = getGlobal();\n if (--global.__mobxInstanceCount === 0) {\n global.__mobxGlobals = undefined;\n }\n globalState = new MobXGlobals();\n }\n}\nfunction getGlobalState() {\n return globalState;\n}\n/**\n * For testing purposes only; this will break the internal state of existing observables,\n * but can be used to get back at a stable state after throwing errors\n */\nfunction resetGlobalState() {\n var defaultGlobals = new MobXGlobals();\n for (var key in defaultGlobals) {\n if (persistentKeys.indexOf(key) === -1) {\n globalState[key] = defaultGlobals[key];\n }\n }\n globalState.allowStateChanges = !globalState.enforceActions;\n}\n\nfunction hasObservers(observable) {\n return observable.observers_ && observable.observers_.size > 0;\n}\nfunction getObservers(observable) {\n return observable.observers_;\n}\n// function invariantObservers(observable: IObservable) {\n// const list = observable.observers\n// const map = observable.observersIndexes\n// const l = list.length\n// for (let i = 0; i < l; i++) {\n// const id = list[i].__mapid\n// if (i) {\n// invariant(map[id] === i, \"INTERNAL ERROR maps derivation.__mapid to index in list\") // for performance\n// } else {\n// invariant(!(id in map), \"INTERNAL ERROR observer on index 0 shouldn't be held in map.\") // for performance\n// }\n// }\n// invariant(\n// list.length === 0 || Object.keys(map).length === list.length - 1,\n// \"INTERNAL ERROR there is no junk in map\"\n// )\n// }\nfunction addObserver(observable, node) {\n // invariant(node.dependenciesState !== -1, \"INTERNAL ERROR, can add only dependenciesState !== -1\");\n // invariant(observable._observers.indexOf(node) === -1, \"INTERNAL ERROR add already added node\");\n // invariantObservers(observable);\n observable.observers_.add(node);\n if (observable.lowestObserverState_ > node.dependenciesState_) {\n observable.lowestObserverState_ = node.dependenciesState_;\n }\n // invariantObservers(observable);\n // invariant(observable._observers.indexOf(node) !== -1, \"INTERNAL ERROR didn't add node\");\n}\nfunction removeObserver(observable, node) {\n // invariant(globalState.inBatch > 0, \"INTERNAL ERROR, remove should be called only inside batch\");\n // invariant(observable._observers.indexOf(node) !== -1, \"INTERNAL ERROR remove already removed node\");\n // invariantObservers(observable);\n observable.observers_[\"delete\"](node);\n if (observable.observers_.size === 0) {\n // deleting last observer\n queueForUnobservation(observable);\n }\n // invariantObservers(observable);\n // invariant(observable._observers.indexOf(node) === -1, \"INTERNAL ERROR remove already removed node2\");\n}\nfunction queueForUnobservation(observable) {\n if (observable.isPendingUnobservation === false) {\n // invariant(observable._observers.length === 0, \"INTERNAL ERROR, should only queue for unobservation unobserved observables\");\n observable.isPendingUnobservation = true;\n globalState.pendingUnobservations.push(observable);\n }\n}\n/**\n * Batch starts a transaction, at least for purposes of memoizing ComputedValues when nothing else does.\n * During a batch `onBecomeUnobserved` will be called at most once per observable.\n * Avoids unnecessary recalculations.\n */\nfunction startBatch() {\n globalState.inBatch++;\n}\nfunction endBatch() {\n if (--globalState.inBatch === 0) {\n runReactions();\n // the batch is actually about to finish, all unobserving should happen here.\n var list = globalState.pendingUnobservations;\n for (var i = 0; i < list.length; i++) {\n var observable = list[i];\n observable.isPendingUnobservation = false;\n if (observable.observers_.size === 0) {\n if (observable.isBeingObserved) {\n // if this observable had reactive observers, trigger the hooks\n observable.isBeingObserved = false;\n observable.onBUO();\n }\n if (observable instanceof ComputedValue) {\n // computed values are automatically teared down when the last observer leaves\n // this process happens recursively, this computed might be the last observabe of another, etc..\n observable.suspend_();\n }\n }\n }\n globalState.pendingUnobservations = [];\n }\n}\nfunction reportObserved(observable) {\n checkIfStateReadsAreAllowed(observable);\n var derivation = globalState.trackingDerivation;\n if (derivation !== null) {\n /**\n * Simple optimization, give each derivation run an unique id (runId)\n * Check if last time this observable was accessed the same runId is used\n * if this is the case, the relation is already known\n */\n if (derivation.runId_ !== observable.lastAccessedBy_) {\n observable.lastAccessedBy_ = derivation.runId_;\n // Tried storing newObserving, or observing, or both as Set, but performance didn't come close...\n derivation.newObserving_[derivation.unboundDepsCount_++] = observable;\n if (!observable.isBeingObserved && globalState.trackingContext) {\n observable.isBeingObserved = true;\n observable.onBO();\n }\n }\n return observable.isBeingObserved;\n } else if (observable.observers_.size === 0 && globalState.inBatch > 0) {\n queueForUnobservation(observable);\n }\n return false;\n}\n// function invariantLOS(observable: IObservable, msg: string) {\n// // it's expensive so better not run it in produciton. but temporarily helpful for testing\n// const min = getObservers(observable).reduce((a, b) => Math.min(a, b.dependenciesState), 2)\n// if (min >= observable.lowestObserverState) return // <- the only assumption about `lowestObserverState`\n// throw new Error(\n// \"lowestObserverState is wrong for \" +\n// msg +\n// \" because \" +\n// min +\n// \" < \" +\n// observable.lowestObserverState\n// )\n// }\n/**\n * NOTE: current propagation mechanism will in case of self reruning autoruns behave unexpectedly\n * It will propagate changes to observers from previous run\n * It's hard or maybe impossible (with reasonable perf) to get it right with current approach\n * Hopefully self reruning autoruns aren't a feature people should depend on\n * Also most basic use cases should be ok\n */\n// Called by Atom when its value changes\nfunction propagateChanged(observable) {\n // invariantLOS(observable, \"changed start\");\n if (observable.lowestObserverState_ === IDerivationState_.STALE_) {\n return;\n }\n observable.lowestObserverState_ = IDerivationState_.STALE_;\n // Ideally we use for..of here, but the downcompiled version is really slow...\n observable.observers_.forEach(function (d) {\n if (d.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {\n if ( true && d.isTracing_ !== TraceMode.NONE) {\n logTraceInfo(d, observable);\n }\n d.onBecomeStale_();\n }\n d.dependenciesState_ = IDerivationState_.STALE_;\n });\n // invariantLOS(observable, \"changed end\");\n}\n// Called by ComputedValue when it recalculate and its value changed\nfunction propagateChangeConfirmed(observable) {\n // invariantLOS(observable, \"confirmed start\");\n if (observable.lowestObserverState_ === IDerivationState_.STALE_) {\n return;\n }\n observable.lowestObserverState_ = IDerivationState_.STALE_;\n observable.observers_.forEach(function (d) {\n if (d.dependenciesState_ === IDerivationState_.POSSIBLY_STALE_) {\n d.dependenciesState_ = IDerivationState_.STALE_;\n if ( true && d.isTracing_ !== TraceMode.NONE) {\n logTraceInfo(d, observable);\n }\n } else if (d.dependenciesState_ === IDerivationState_.UP_TO_DATE_ // this happens during computing of `d`, just keep lowestObserverState up to date.\n ) {\n observable.lowestObserverState_ = IDerivationState_.UP_TO_DATE_;\n }\n });\n // invariantLOS(observable, \"confirmed end\");\n}\n// Used by computed when its dependency changed, but we don't wan't to immediately recompute.\nfunction propagateMaybeChanged(observable) {\n // invariantLOS(observable, \"maybe start\");\n if (observable.lowestObserverState_ !== IDerivationState_.UP_TO_DATE_) {\n return;\n }\n observable.lowestObserverState_ = IDerivationState_.POSSIBLY_STALE_;\n observable.observers_.forEach(function (d) {\n if (d.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {\n d.dependenciesState_ = IDerivationState_.POSSIBLY_STALE_;\n d.onBecomeStale_();\n }\n });\n // invariantLOS(observable, \"maybe end\");\n}\nfunction logTraceInfo(derivation, observable) {\n console.log(\"[mobx.trace] '\" + derivation.name_ + \"' is invalidated due to a change in: '\" + observable.name_ + \"'\");\n if (derivation.isTracing_ === TraceMode.BREAK) {\n var lines = [];\n printDepTree(getDependencyTree(derivation), lines, 1);\n // prettier-ignore\n new Function(\"debugger;\\n/*\\nTracing '\" + derivation.name_ + \"'\\n\\nYou are entering this break point because derivation '\" + derivation.name_ + \"' is being traced and '\" + observable.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\" + (derivation instanceof ComputedValue ? derivation.derivation.toString().replace(/[*]\\//g, \"/\") : \"\") + \"\\n\\nThe dependencies for this derivation are:\\n\\n\" + lines.join(\"\\n\") + \"\\n*/\\n \")();\n }\n}\nfunction printDepTree(tree, lines, depth) {\n if (lines.length >= 1000) {\n lines.push(\"(and many more)\");\n return;\n }\n lines.push(\"\" + \"\\t\".repeat(depth - 1) + tree.name);\n if (tree.dependencies) {\n tree.dependencies.forEach(function (child) {\n return printDepTree(child, lines, depth + 1);\n });\n }\n}\n\nvar Reaction = /*#__PURE__*/function () {\n function Reaction(name_, onInvalidate_, errorHandler_, requiresObservable_) {\n if (name_ === void 0) {\n name_ = true ? \"Reaction@\" + getNextId() : 0;\n }\n this.name_ = void 0;\n this.onInvalidate_ = void 0;\n this.errorHandler_ = void 0;\n this.requiresObservable_ = void 0;\n this.observing_ = [];\n // nodes we are looking at. Our value depends on these nodes\n this.newObserving_ = [];\n this.dependenciesState_ = IDerivationState_.NOT_TRACKING_;\n this.runId_ = 0;\n this.unboundDepsCount_ = 0;\n this.flags_ = 0;\n this.isTracing_ = TraceMode.NONE;\n this.name_ = name_;\n this.onInvalidate_ = onInvalidate_;\n this.errorHandler_ = errorHandler_;\n this.requiresObservable_ = requiresObservable_;\n }\n var _proto = Reaction.prototype;\n _proto.onBecomeStale_ = function onBecomeStale_() {\n this.schedule_();\n };\n _proto.schedule_ = function schedule_() {\n if (!this.isScheduled) {\n this.isScheduled = true;\n globalState.pendingReactions.push(this);\n runReactions();\n }\n }\n /**\n * internal, use schedule() if you intend to kick off a reaction\n */;\n _proto.runReaction_ = function runReaction_() {\n if (!this.isDisposed) {\n startBatch();\n this.isScheduled = false;\n var prev = globalState.trackingContext;\n globalState.trackingContext = this;\n if (shouldCompute(this)) {\n this.isTrackPending = true;\n try {\n this.onInvalidate_();\n if ( true && this.isTrackPending && isSpyEnabled()) {\n // onInvalidate didn't trigger track right away..\n spyReport({\n name: this.name_,\n type: \"scheduled-reaction\"\n });\n }\n } catch (e) {\n this.reportExceptionInDerivation_(e);\n }\n }\n globalState.trackingContext = prev;\n endBatch();\n }\n };\n _proto.track = function track(fn) {\n if (this.isDisposed) {\n return;\n // console.warn(\"Reaction already disposed\") // Note: Not a warning / error in mobx 4 either\n }\n startBatch();\n var notify = isSpyEnabled();\n var startTime;\n if ( true && notify) {\n startTime = Date.now();\n spyReportStart({\n name: this.name_,\n type: \"reaction\"\n });\n }\n this.isRunning = true;\n var prevReaction = globalState.trackingContext; // reactions could create reactions...\n globalState.trackingContext = this;\n var result = trackDerivedFunction(this, fn, undefined);\n globalState.trackingContext = prevReaction;\n this.isRunning = false;\n this.isTrackPending = false;\n if (this.isDisposed) {\n // disposed during last run. Clean up everything that was bound after the dispose call.\n clearObserving(this);\n }\n if (isCaughtException(result)) {\n this.reportExceptionInDerivation_(result.cause);\n }\n if ( true && notify) {\n spyReportEnd({\n time: Date.now() - startTime\n });\n }\n endBatch();\n };\n _proto.reportExceptionInDerivation_ = function reportExceptionInDerivation_(error) {\n var _this = this;\n if (this.errorHandler_) {\n this.errorHandler_(error, this);\n return;\n }\n if (globalState.disableErrorBoundaries) {\n throw error;\n }\n var message = true ? \"[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '\" + this + \"'\" : 0;\n if (!globalState.suppressReactionErrors) {\n console.error(message, error);\n /** If debugging brought you here, please, read the above message :-). Tnx! */\n } else if (true) {\n console.warn(\"[mobx] (error in reaction '\" + this.name_ + \"' suppressed, fix error of causing action below)\");\n } // prettier-ignore\n if ( true && isSpyEnabled()) {\n spyReport({\n type: \"error\",\n name: this.name_,\n message: message,\n error: \"\" + error\n });\n }\n globalState.globalReactionErrorHandlers.forEach(function (f) {\n return f(error, _this);\n });\n };\n _proto.dispose = function dispose() {\n if (!this.isDisposed) {\n this.isDisposed = true;\n if (!this.isRunning) {\n // if disposed while running, clean up later. Maybe not optimal, but rare case\n startBatch();\n clearObserving(this);\n endBatch();\n }\n }\n };\n _proto.getDisposer_ = function getDisposer_(abortSignal) {\n var _this2 = this;\n var dispose = function dispose() {\n _this2.dispose();\n abortSignal == null || abortSignal.removeEventListener == null || abortSignal.removeEventListener(\"abort\", dispose);\n };\n abortSignal == null || abortSignal.addEventListener == null || abortSignal.addEventListener(\"abort\", dispose);\n dispose[$mobx] = this;\n return dispose;\n };\n _proto.toString = function toString() {\n return \"Reaction[\" + this.name_ + \"]\";\n };\n _proto.trace = function trace$1(enterBreakPoint) {\n if (enterBreakPoint === void 0) {\n enterBreakPoint = false;\n }\n trace(this, enterBreakPoint);\n };\n return _createClass(Reaction, [{\n key: \"isDisposed\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isDisposedMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isDisposedMask_, newValue);\n }\n }, {\n key: \"isScheduled\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isScheduledMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isScheduledMask_, newValue);\n }\n }, {\n key: \"isTrackPending\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isTrackPendingMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isTrackPendingMask_, newValue);\n }\n }, {\n key: \"isRunning\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isRunningMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isRunningMask_, newValue);\n }\n }, {\n key: \"diffValue\",\n get: function get() {\n return getFlag(this.flags_, Reaction.diffValueMask_) ? 1 : 0;\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.diffValueMask_, newValue === 1 ? true : false);\n }\n }]);\n}();\nReaction.isDisposedMask_ = 1;\nReaction.isScheduledMask_ = 2;\nReaction.isTrackPendingMask_ = 4;\nReaction.isRunningMask_ = 8;\nReaction.diffValueMask_ = 16;\nfunction onReactionError(handler) {\n globalState.globalReactionErrorHandlers.push(handler);\n return function () {\n var idx = globalState.globalReactionErrorHandlers.indexOf(handler);\n if (idx >= 0) {\n globalState.globalReactionErrorHandlers.splice(idx, 1);\n }\n };\n}\n/**\n * Magic number alert!\n * Defines within how many times a reaction is allowed to re-trigger itself\n * until it is assumed that this is gonna be a never ending loop...\n */\nvar MAX_REACTION_ITERATIONS = 100;\nvar reactionScheduler = function reactionScheduler(f) {\n return f();\n};\nfunction runReactions() {\n // Trampolining, if runReactions are already running, new reactions will be picked up\n if (globalState.inBatch > 0 || globalState.isRunningReactions) {\n return;\n }\n reactionScheduler(runReactionsHelper);\n}\nfunction runReactionsHelper() {\n globalState.isRunningReactions = true;\n var allReactions = globalState.pendingReactions;\n var iterations = 0;\n // While running reactions, new reactions might be triggered.\n // Hence we work with two variables and check whether\n // we converge to no remaining reactions after a while.\n while (allReactions.length > 0) {\n if (++iterations === MAX_REACTION_ITERATIONS) {\n console.error( true ? \"Reaction doesn't converge to a stable state after \" + MAX_REACTION_ITERATIONS + \" iterations.\" + (\" Probably there is a cycle in the reactive function: \" + allReactions[0]) : 0);\n allReactions.splice(0); // clear reactions\n }\n var remainingReactions = allReactions.splice(0);\n for (var i = 0, l = remainingReactions.length; i < l; i++) {\n remainingReactions[i].runReaction_();\n }\n }\n globalState.isRunningReactions = false;\n}\nvar isReaction = /*#__PURE__*/createInstanceofPredicate(\"Reaction\", Reaction);\nfunction setReactionScheduler(fn) {\n var baseScheduler = reactionScheduler;\n reactionScheduler = function reactionScheduler(f) {\n return fn(function () {\n return baseScheduler(f);\n });\n };\n}\n\nfunction isSpyEnabled() {\n return true && !!globalState.spyListeners.length;\n}\nfunction spyReport(event) {\n if (false) {} // dead code elimination can do the rest\n if (!globalState.spyListeners.length) {\n return;\n }\n var listeners = globalState.spyListeners;\n for (var i = 0, l = listeners.length; i < l; i++) {\n listeners[i](event);\n }\n}\nfunction spyReportStart(event) {\n if (false) {}\n var change = _extends({}, event, {\n spyReportStart: true\n });\n spyReport(change);\n}\nvar END_EVENT = {\n type: \"report-end\",\n spyReportEnd: true\n};\nfunction spyReportEnd(change) {\n if (false) {}\n if (change) {\n spyReport(_extends({}, change, {\n type: \"report-end\",\n spyReportEnd: true\n }));\n } else {\n spyReport(END_EVENT);\n }\n}\nfunction spy(listener) {\n if (false) {} else {\n globalState.spyListeners.push(listener);\n return once(function () {\n globalState.spyListeners = globalState.spyListeners.filter(function (l) {\n return l !== listener;\n });\n });\n }\n}\n\nvar ACTION = \"action\";\nvar ACTION_BOUND = \"action.bound\";\nvar AUTOACTION = \"autoAction\";\nvar AUTOACTION_BOUND = \"autoAction.bound\";\nvar DEFAULT_ACTION_NAME = \"\";\nvar actionAnnotation = /*#__PURE__*/createActionAnnotation(ACTION);\nvar actionBoundAnnotation = /*#__PURE__*/createActionAnnotation(ACTION_BOUND, {\n bound: true\n});\nvar autoActionAnnotation = /*#__PURE__*/createActionAnnotation(AUTOACTION, {\n autoAction: true\n});\nvar autoActionBoundAnnotation = /*#__PURE__*/createActionAnnotation(AUTOACTION_BOUND, {\n autoAction: true,\n bound: true\n});\nfunction createActionFactory(autoAction) {\n var res = function action(arg1, arg2) {\n // action(fn() {})\n if (isFunction(arg1)) {\n return createAction(arg1.name || DEFAULT_ACTION_NAME, arg1, autoAction);\n }\n // action(\"name\", fn() {})\n if (isFunction(arg2)) {\n return createAction(arg1, arg2, autoAction);\n }\n // @action (2022.3 Decorators)\n if (is20223Decorator(arg2)) {\n return (autoAction ? autoActionAnnotation : actionAnnotation).decorate_20223_(arg1, arg2);\n }\n // @action\n if (isStringish(arg2)) {\n return storeAnnotation(arg1, arg2, autoAction ? autoActionAnnotation : actionAnnotation);\n }\n // action(\"name\") & @action(\"name\")\n if (isStringish(arg1)) {\n return createDecoratorAnnotation(createActionAnnotation(autoAction ? AUTOACTION : ACTION, {\n name: arg1,\n autoAction: autoAction\n }));\n }\n if (true) {\n die(\"Invalid arguments for `action`\");\n }\n };\n return res;\n}\nvar action = /*#__PURE__*/createActionFactory(false);\nObject.assign(action, actionAnnotation);\nvar autoAction = /*#__PURE__*/createActionFactory(true);\nObject.assign(autoAction, autoActionAnnotation);\naction.bound = /*#__PURE__*/createDecoratorAnnotation(actionBoundAnnotation);\nautoAction.bound = /*#__PURE__*/createDecoratorAnnotation(autoActionBoundAnnotation);\nfunction runInAction(fn) {\n return executeAction(fn.name || DEFAULT_ACTION_NAME, false, fn, this, undefined);\n}\nfunction isAction(thing) {\n return isFunction(thing) && thing.isMobxAction === true;\n}\n\n/**\n * Creates a named reactive view and keeps it alive, so that the view is always\n * updated if one of the dependencies changes, even when the view is not further used by something else.\n * @param view The reactive view\n * @returns disposer function, which can be used to stop the view from being updated in the future.\n */\nfunction autorun(view, opts) {\n var _opts$name, _opts, _opts2, _opts3;\n if (opts === void 0) {\n opts = EMPTY_OBJECT;\n }\n if (true) {\n if (!isFunction(view)) {\n die(\"Autorun expects a function as first argument\");\n }\n if (isAction(view)) {\n die(\"Autorun does not accept actions since actions are untrackable\");\n }\n }\n var name = (_opts$name = (_opts = opts) == null ? void 0 : _opts.name) != null ? _opts$name : true ? view.name || \"Autorun@\" + getNextId() : 0;\n var runSync = !opts.scheduler && !opts.delay;\n var reaction;\n if (runSync) {\n // normal autorun\n reaction = new Reaction(name, function () {\n this.track(reactionRunner);\n }, opts.onError, opts.requiresObservable);\n } else {\n var scheduler = createSchedulerFromOptions(opts);\n // debounced autorun\n var isScheduled = false;\n reaction = new Reaction(name, function () {\n if (!isScheduled) {\n isScheduled = true;\n scheduler(function () {\n isScheduled = false;\n if (!reaction.isDisposed) {\n reaction.track(reactionRunner);\n }\n });\n }\n }, opts.onError, opts.requiresObservable);\n }\n function reactionRunner() {\n view(reaction);\n }\n if (!((_opts2 = opts) != null && (_opts2 = _opts2.signal) != null && _opts2.aborted)) {\n reaction.schedule_();\n }\n return reaction.getDisposer_((_opts3 = opts) == null ? void 0 : _opts3.signal);\n}\nvar run = function run(f) {\n return f();\n};\nfunction createSchedulerFromOptions(opts) {\n return opts.scheduler ? opts.scheduler : opts.delay ? function (f) {\n return setTimeout(f, opts.delay);\n } : run;\n}\nfunction reaction(expression, effect, opts) {\n var _opts$name2, _opts4, _opts5;\n if (opts === void 0) {\n opts = EMPTY_OBJECT;\n }\n if (true) {\n if (!isFunction(expression) || !isFunction(effect)) {\n die(\"First and second argument to reaction should be functions\");\n }\n if (!isPlainObject(opts)) {\n die(\"Third argument of reactions should be an object\");\n }\n }\n var name = (_opts$name2 = opts.name) != null ? _opts$name2 : true ? \"Reaction@\" + getNextId() : 0;\n var effectAction = action(name, opts.onError ? wrapErrorHandler(opts.onError, effect) : effect);\n var runSync = !opts.scheduler && !opts.delay;\n var scheduler = createSchedulerFromOptions(opts);\n var firstTime = true;\n var isScheduled = false;\n var value;\n var equals = opts.compareStructural ? comparer.structural : opts.equals || comparer[\"default\"];\n var r = new Reaction(name, function () {\n if (firstTime || runSync) {\n reactionRunner();\n } else if (!isScheduled) {\n isScheduled = true;\n scheduler(reactionRunner);\n }\n }, opts.onError, opts.requiresObservable);\n function reactionRunner() {\n isScheduled = false;\n if (r.isDisposed) {\n return;\n }\n var changed = false;\n var oldValue = value;\n r.track(function () {\n var nextValue = allowStateChanges(false, function () {\n return expression(r);\n });\n changed = firstTime || !equals(value, nextValue);\n value = nextValue;\n });\n if (firstTime && opts.fireImmediately) {\n effectAction(value, oldValue, r);\n } else if (!firstTime && changed) {\n effectAction(value, oldValue, r);\n }\n firstTime = false;\n }\n if (!((_opts4 = opts) != null && (_opts4 = _opts4.signal) != null && _opts4.aborted)) {\n r.schedule_();\n }\n return r.getDisposer_((_opts5 = opts) == null ? void 0 : _opts5.signal);\n}\nfunction wrapErrorHandler(errorHandler, baseFn) {\n return function () {\n try {\n return baseFn.apply(this, arguments);\n } catch (e) {\n errorHandler.call(this, e);\n }\n };\n}\n\nvar ON_BECOME_OBSERVED = \"onBO\";\nvar ON_BECOME_UNOBSERVED = \"onBUO\";\nfunction onBecomeObserved(thing, arg2, arg3) {\n return interceptHook(ON_BECOME_OBSERVED, thing, arg2, arg3);\n}\nfunction onBecomeUnobserved(thing, arg2, arg3) {\n return interceptHook(ON_BECOME_UNOBSERVED, thing, arg2, arg3);\n}\nfunction interceptHook(hook, thing, arg2, arg3) {\n var atom = typeof arg3 === \"function\" ? getAtom(thing, arg2) : getAtom(thing);\n var cb = isFunction(arg3) ? arg3 : arg2;\n var listenersKey = hook + \"L\";\n if (atom[listenersKey]) {\n atom[listenersKey].add(cb);\n } else {\n atom[listenersKey] = new Set([cb]);\n }\n return function () {\n var hookListeners = atom[listenersKey];\n if (hookListeners) {\n hookListeners[\"delete\"](cb);\n if (hookListeners.size === 0) {\n delete atom[listenersKey];\n }\n }\n };\n}\n\nvar NEVER = \"never\";\nvar ALWAYS = \"always\";\nvar OBSERVED = \"observed\";\n// const IF_AVAILABLE = \"ifavailable\"\nfunction configure(options) {\n if (options.isolateGlobalState === true) {\n isolateGlobalState();\n }\n var useProxies = options.useProxies,\n enforceActions = options.enforceActions;\n if (useProxies !== undefined) {\n globalState.useProxies = useProxies === ALWAYS ? true : useProxies === NEVER ? false : typeof Proxy !== \"undefined\";\n }\n if (useProxies === \"ifavailable\") {\n globalState.verifyProxies = true;\n }\n if (enforceActions !== undefined) {\n var ea = enforceActions === ALWAYS ? ALWAYS : enforceActions === OBSERVED;\n globalState.enforceActions = ea;\n globalState.allowStateChanges = ea === true || ea === ALWAYS ? false : true;\n }\n [\"computedRequiresReaction\", \"reactionRequiresObservable\", \"observableRequiresReaction\", \"disableErrorBoundaries\", \"safeDescriptors\"].forEach(function (key) {\n if (key in options) {\n globalState[key] = !!options[key];\n }\n });\n globalState.allowStateReads = !globalState.observableRequiresReaction;\n if ( true && globalState.disableErrorBoundaries === true) {\n console.warn(\"WARNING: Debug feature only. MobX will NOT recover from errors when `disableErrorBoundaries` is enabled.\");\n }\n if (options.reactionScheduler) {\n setReactionScheduler(options.reactionScheduler);\n }\n}\n\nfunction extendObservable(target, properties, annotations, options) {\n if (true) {\n if (arguments.length > 4) {\n die(\"'extendObservable' expected 2-4 arguments\");\n }\n if (typeof target !== \"object\") {\n die(\"'extendObservable' expects an object as first argument\");\n }\n if (isObservableMap(target)) {\n die(\"'extendObservable' should not be used on maps, use map.merge instead\");\n }\n if (!isPlainObject(properties)) {\n die(\"'extendObservable' only accepts plain objects as second argument\");\n }\n if (isObservable(properties) || isObservable(annotations)) {\n die(\"Extending an object with another observable (object) is not supported\");\n }\n }\n // Pull descriptors first, so we don't have to deal with props added by administration ($mobx)\n var descriptors = getOwnPropertyDescriptors(properties);\n initObservable(function () {\n var adm = asObservableObject(target, options)[$mobx];\n ownKeys(descriptors).forEach(function (key) {\n adm.extend_(key, descriptors[key],\n // must pass \"undefined\" for { key: undefined }\n !annotations ? true : key in annotations ? annotations[key] : true);\n });\n });\n return target;\n}\n\nfunction getDependencyTree(thing, property) {\n return nodeToDependencyTree(getAtom(thing, property));\n}\nfunction nodeToDependencyTree(node) {\n var result = {\n name: node.name_\n };\n if (node.observing_ && node.observing_.length > 0) {\n result.dependencies = unique(node.observing_).map(nodeToDependencyTree);\n }\n return result;\n}\nfunction getObserverTree(thing, property) {\n return nodeToObserverTree(getAtom(thing, property));\n}\nfunction nodeToObserverTree(node) {\n var result = {\n name: node.name_\n };\n if (hasObservers(node)) {\n result.observers = Array.from(getObservers(node)).map(nodeToObserverTree);\n }\n return result;\n}\nfunction unique(list) {\n return Array.from(new Set(list));\n}\n\nvar generatorId = 0;\nfunction FlowCancellationError() {\n this.message = \"FLOW_CANCELLED\";\n}\nFlowCancellationError.prototype = /*#__PURE__*/Object.create(Error.prototype);\nfunction isFlowCancellationError(error) {\n return error instanceof FlowCancellationError;\n}\nvar flowAnnotation = /*#__PURE__*/createFlowAnnotation(\"flow\");\nvar flowBoundAnnotation = /*#__PURE__*/createFlowAnnotation(\"flow.bound\", {\n bound: true\n});\nvar flow = /*#__PURE__*/Object.assign(function flow(arg1, arg2) {\n // @flow (2022.3 Decorators)\n if (is20223Decorator(arg2)) {\n return flowAnnotation.decorate_20223_(arg1, arg2);\n }\n // @flow\n if (isStringish(arg2)) {\n return storeAnnotation(arg1, arg2, flowAnnotation);\n }\n // flow(fn)\n if ( true && arguments.length !== 1) {\n die(\"Flow expects single argument with generator function\");\n }\n var generator = arg1;\n var name = generator.name || \"\";\n // Implementation based on https://github.com/tj/co/blob/master/index.js\n var res = function res() {\n var ctx = this;\n var args = arguments;\n var runId = ++generatorId;\n var gen = action(name + \" - runid: \" + runId + \" - init\", generator).apply(ctx, args);\n var rejector;\n var pendingPromise = undefined;\n var promise = new Promise(function (resolve, reject) {\n var stepId = 0;\n rejector = reject;\n function onFulfilled(res) {\n pendingPromise = undefined;\n var ret;\n try {\n ret = action(name + \" - runid: \" + runId + \" - yield \" + stepId++, gen.next).call(gen, res);\n } catch (e) {\n return reject(e);\n }\n next(ret);\n }\n function onRejected(err) {\n pendingPromise = undefined;\n var ret;\n try {\n ret = action(name + \" - runid: \" + runId + \" - yield \" + stepId++, gen[\"throw\"]).call(gen, err);\n } catch (e) {\n return reject(e);\n }\n next(ret);\n }\n function next(ret) {\n if (isFunction(ret == null ? void 0 : ret.then)) {\n // an async iterator\n ret.then(next, reject);\n return;\n }\n if (ret.done) {\n return resolve(ret.value);\n }\n pendingPromise = Promise.resolve(ret.value);\n return pendingPromise.then(onFulfilled, onRejected);\n }\n onFulfilled(undefined); // kick off the process\n });\n promise.cancel = action(name + \" - runid: \" + runId + \" - cancel\", function () {\n try {\n if (pendingPromise) {\n cancelPromise(pendingPromise);\n }\n // Finally block can return (or yield) stuff..\n var _res = gen[\"return\"](undefined);\n // eat anything that promise would do, it's cancelled!\n var yieldedPromise = Promise.resolve(_res.value);\n yieldedPromise.then(noop, noop);\n cancelPromise(yieldedPromise); // maybe it can be cancelled :)\n // reject our original promise\n rejector(new FlowCancellationError());\n } catch (e) {\n rejector(e); // there could be a throwing finally block\n }\n });\n return promise;\n };\n res.isMobXFlow = true;\n return res;\n}, flowAnnotation);\nflow.bound = /*#__PURE__*/createDecoratorAnnotation(flowBoundAnnotation);\nfunction cancelPromise(promise) {\n if (isFunction(promise.cancel)) {\n promise.cancel();\n }\n}\nfunction flowResult(result) {\n return result; // just tricking TypeScript :)\n}\nfunction isFlow(fn) {\n return (fn == null ? void 0 : fn.isMobXFlow) === true;\n}\n\nfunction interceptReads(thing, propOrHandler, handler) {\n var target;\n if (isObservableMap(thing) || isObservableArray(thing) || isObservableValue(thing)) {\n target = getAdministration(thing);\n } else if (isObservableObject(thing)) {\n if ( true && !isStringish(propOrHandler)) {\n return die(\"InterceptReads can only be used with a specific property, not with an object in general\");\n }\n target = getAdministration(thing, propOrHandler);\n } else if (true) {\n return die(\"Expected observable map, object or array as first array\");\n }\n if ( true && target.dehancer !== undefined) {\n return die(\"An intercept reader was already established\");\n }\n target.dehancer = typeof propOrHandler === \"function\" ? propOrHandler : handler;\n return function () {\n target.dehancer = undefined;\n };\n}\n\nfunction intercept(thing, propOrHandler, handler) {\n if (isFunction(handler)) {\n return interceptProperty(thing, propOrHandler, handler);\n } else {\n return interceptInterceptable(thing, propOrHandler);\n }\n}\nfunction interceptInterceptable(thing, handler) {\n return getAdministration(thing).intercept_(handler);\n}\nfunction interceptProperty(thing, property, handler) {\n return getAdministration(thing, property).intercept_(handler);\n}\n\nfunction _isComputed(value, property) {\n if (property === undefined) {\n return isComputedValue(value);\n }\n if (isObservableObject(value) === false) {\n return false;\n }\n if (!value[$mobx].values_.has(property)) {\n return false;\n }\n var atom = getAtom(value, property);\n return isComputedValue(atom);\n}\nfunction isComputed(value) {\n if ( true && arguments.length > 1) {\n return die(\"isComputed expects only 1 argument. Use isComputedProp to inspect the observability of a property\");\n }\n return _isComputed(value);\n}\nfunction isComputedProp(value, propName) {\n if ( true && !isStringish(propName)) {\n return die(\"isComputed expected a property name as second argument\");\n }\n return _isComputed(value, propName);\n}\n\nfunction _isObservable(value, property) {\n if (!value) {\n return false;\n }\n if (property !== undefined) {\n if ( true && (isObservableMap(value) || isObservableArray(value))) {\n return die(\"isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead.\");\n }\n if (isObservableObject(value)) {\n return value[$mobx].values_.has(property);\n }\n return false;\n }\n // For first check, see #701\n return isObservableObject(value) || !!value[$mobx] || isAtom(value) || isReaction(value) || isComputedValue(value);\n}\nfunction isObservable(value) {\n if ( true && arguments.length !== 1) {\n die(\"isObservable expects only 1 argument. Use isObservableProp to inspect the observability of a property\");\n }\n return _isObservable(value);\n}\nfunction isObservableProp(value, propName) {\n if ( true && !isStringish(propName)) {\n return die(\"expected a property name as second argument\");\n }\n return _isObservable(value, propName);\n}\n\nfunction keys(obj) {\n if (isObservableObject(obj)) {\n return obj[$mobx].keys_();\n }\n if (isObservableMap(obj) || isObservableSet(obj)) {\n return Array.from(obj.keys());\n }\n if (isObservableArray(obj)) {\n return obj.map(function (_, index) {\n return index;\n });\n }\n die(5);\n}\nfunction values(obj) {\n if (isObservableObject(obj)) {\n return keys(obj).map(function (key) {\n return obj[key];\n });\n }\n if (isObservableMap(obj)) {\n return keys(obj).map(function (key) {\n return obj.get(key);\n });\n }\n if (isObservableSet(obj)) {\n return Array.from(obj.values());\n }\n if (isObservableArray(obj)) {\n return obj.slice();\n }\n die(6);\n}\nfunction entries(obj) {\n if (isObservableObject(obj)) {\n return keys(obj).map(function (key) {\n return [key, obj[key]];\n });\n }\n if (isObservableMap(obj)) {\n return keys(obj).map(function (key) {\n return [key, obj.get(key)];\n });\n }\n if (isObservableSet(obj)) {\n return Array.from(obj.entries());\n }\n if (isObservableArray(obj)) {\n return obj.map(function (key, index) {\n return [index, key];\n });\n }\n die(7);\n}\nfunction set(obj, key, value) {\n if (arguments.length === 2 && !isObservableSet(obj)) {\n startBatch();\n var _values = key;\n try {\n for (var _key in _values) {\n set(obj, _key, _values[_key]);\n }\n } finally {\n endBatch();\n }\n return;\n }\n if (isObservableObject(obj)) {\n obj[$mobx].set_(key, value);\n } else if (isObservableMap(obj)) {\n obj.set(key, value);\n } else if (isObservableSet(obj)) {\n obj.add(key);\n } else if (isObservableArray(obj)) {\n if (typeof key !== \"number\") {\n key = parseInt(key, 10);\n }\n if (key < 0) {\n die(\"Invalid index: '\" + key + \"'\");\n }\n startBatch();\n if (key >= obj.length) {\n obj.length = key + 1;\n }\n obj[key] = value;\n endBatch();\n } else {\n die(8);\n }\n}\nfunction remove(obj, key) {\n if (isObservableObject(obj)) {\n obj[$mobx].delete_(key);\n } else if (isObservableMap(obj)) {\n obj[\"delete\"](key);\n } else if (isObservableSet(obj)) {\n obj[\"delete\"](key);\n } else if (isObservableArray(obj)) {\n if (typeof key !== \"number\") {\n key = parseInt(key, 10);\n }\n obj.splice(key, 1);\n } else {\n die(9);\n }\n}\nfunction has(obj, key) {\n if (isObservableObject(obj)) {\n return obj[$mobx].has_(key);\n } else if (isObservableMap(obj)) {\n return obj.has(key);\n } else if (isObservableSet(obj)) {\n return obj.has(key);\n } else if (isObservableArray(obj)) {\n return key >= 0 && key < obj.length;\n }\n die(10);\n}\nfunction get(obj, key) {\n if (!has(obj, key)) {\n return undefined;\n }\n if (isObservableObject(obj)) {\n return obj[$mobx].get_(key);\n } else if (isObservableMap(obj)) {\n return obj.get(key);\n } else if (isObservableArray(obj)) {\n return obj[key];\n }\n die(11);\n}\nfunction apiDefineProperty(obj, key, descriptor) {\n if (isObservableObject(obj)) {\n return obj[$mobx].defineProperty_(key, descriptor);\n }\n die(39);\n}\nfunction apiOwnKeys(obj) {\n if (isObservableObject(obj)) {\n return obj[$mobx].ownKeys_();\n }\n die(38);\n}\n\nfunction observe(thing, propOrCb, cbOrFire, fireImmediately) {\n if (isFunction(cbOrFire)) {\n return observeObservableProperty(thing, propOrCb, cbOrFire, fireImmediately);\n } else {\n return observeObservable(thing, propOrCb, cbOrFire);\n }\n}\nfunction observeObservable(thing, listener, fireImmediately) {\n return getAdministration(thing).observe_(listener, fireImmediately);\n}\nfunction observeObservableProperty(thing, property, listener, fireImmediately) {\n return getAdministration(thing, property).observe_(listener, fireImmediately);\n}\n\nfunction cache(map, key, value) {\n map.set(key, value);\n return value;\n}\nfunction toJSHelper(source, __alreadySeen) {\n if (source == null || typeof source !== \"object\" || source instanceof Date || !isObservable(source)) {\n return source;\n }\n if (isObservableValue(source) || isComputedValue(source)) {\n return toJSHelper(source.get(), __alreadySeen);\n }\n if (__alreadySeen.has(source)) {\n return __alreadySeen.get(source);\n }\n if (isObservableArray(source)) {\n var res = cache(__alreadySeen, source, new Array(source.length));\n source.forEach(function (value, idx) {\n res[idx] = toJSHelper(value, __alreadySeen);\n });\n return res;\n }\n if (isObservableSet(source)) {\n var _res = cache(__alreadySeen, source, new Set());\n source.forEach(function (value) {\n _res.add(toJSHelper(value, __alreadySeen));\n });\n return _res;\n }\n if (isObservableMap(source)) {\n var _res2 = cache(__alreadySeen, source, new Map());\n source.forEach(function (value, key) {\n _res2.set(key, toJSHelper(value, __alreadySeen));\n });\n return _res2;\n } else {\n // must be observable object\n var _res3 = cache(__alreadySeen, source, {});\n apiOwnKeys(source).forEach(function (key) {\n if (objectPrototype.propertyIsEnumerable.call(source, key)) {\n _res3[key] = toJSHelper(source[key], __alreadySeen);\n }\n });\n return _res3;\n }\n}\n/**\n * Recursively converts an observable to it's non-observable native counterpart.\n * It does NOT recurse into non-observables, these are left as they are, even if they contain observables.\n * Computed and other non-enumerable properties are completely ignored.\n * Complex scenarios require custom solution, eg implementing `toJSON` or using `serializr` lib.\n */\nfunction toJS(source, options) {\n if ( true && options) {\n die(\"toJS no longer supports options\");\n }\n return toJSHelper(source, new Map());\n}\n\nfunction trace() {\n if (false) {}\n var enterBreakPoint = false;\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n if (typeof args[args.length - 1] === \"boolean\") {\n enterBreakPoint = args.pop();\n }\n var derivation = getAtomFromArgs(args);\n if (!derivation) {\n return die(\"'trace(break?)' can only be used inside a tracked computed value or a Reaction. Consider passing in the computed value or reaction explicitly\");\n }\n if (derivation.isTracing_ === TraceMode.NONE) {\n console.log(\"[mobx.trace] '\" + derivation.name_ + \"' tracing enabled\");\n }\n derivation.isTracing_ = enterBreakPoint ? TraceMode.BREAK : TraceMode.LOG;\n}\nfunction getAtomFromArgs(args) {\n switch (args.length) {\n case 0:\n return globalState.trackingDerivation;\n case 1:\n return getAtom(args[0]);\n case 2:\n return getAtom(args[0], args[1]);\n }\n}\n\n/**\n * During a transaction no views are updated until the end of the transaction.\n * The transaction will be run synchronously nonetheless.\n *\n * @param action a function that updates some reactive state\n * @returns any value that was returned by the 'action' parameter.\n */\nfunction transaction(action, thisArg) {\n if (thisArg === void 0) {\n thisArg = undefined;\n }\n startBatch();\n try {\n return action.apply(thisArg);\n } finally {\n endBatch();\n }\n}\n\nfunction when(predicate, arg1, arg2) {\n if (arguments.length === 1 || arg1 && typeof arg1 === \"object\") {\n return whenPromise(predicate, arg1);\n }\n return _when(predicate, arg1, arg2 || {});\n}\nfunction _when(predicate, effect, opts) {\n var timeoutHandle;\n if (typeof opts.timeout === \"number\") {\n var error = new Error(\"WHEN_TIMEOUT\");\n timeoutHandle = setTimeout(function () {\n if (!disposer[$mobx].isDisposed) {\n disposer();\n if (opts.onError) {\n opts.onError(error);\n } else {\n throw error;\n }\n }\n }, opts.timeout);\n }\n opts.name = true ? opts.name || \"When@\" + getNextId() : 0;\n var effectAction = createAction( true ? opts.name + \"-effect\" : 0, effect);\n // eslint-disable-next-line\n var disposer = autorun(function (r) {\n // predicate should not change state\n var cond = allowStateChanges(false, predicate);\n if (cond) {\n r.dispose();\n if (timeoutHandle) {\n clearTimeout(timeoutHandle);\n }\n effectAction();\n }\n }, opts);\n return disposer;\n}\nfunction whenPromise(predicate, opts) {\n var _opts$signal;\n if ( true && opts && opts.onError) {\n return die(\"the options 'onError' and 'promise' cannot be combined\");\n }\n if (opts != null && (_opts$signal = opts.signal) != null && _opts$signal.aborted) {\n return Object.assign(Promise.reject(new Error(\"WHEN_ABORTED\")), {\n cancel: function cancel() {\n return null;\n }\n });\n }\n var cancel;\n var abort;\n var res = new Promise(function (resolve, reject) {\n var _opts$signal2;\n var disposer = _when(predicate, resolve, _extends({}, opts, {\n onError: reject\n }));\n cancel = function cancel() {\n disposer();\n reject(new Error(\"WHEN_CANCELLED\"));\n };\n abort = function abort() {\n disposer();\n reject(new Error(\"WHEN_ABORTED\"));\n };\n opts == null || (_opts$signal2 = opts.signal) == null || _opts$signal2.addEventListener == null || _opts$signal2.addEventListener(\"abort\", abort);\n })[\"finally\"](function () {\n var _opts$signal3;\n return opts == null || (_opts$signal3 = opts.signal) == null || _opts$signal3.removeEventListener == null ? void 0 : _opts$signal3.removeEventListener(\"abort\", abort);\n });\n res.cancel = cancel;\n return res;\n}\n\nfunction getAdm(target) {\n return target[$mobx];\n}\n// Optimization: we don't need the intermediate objects and could have a completely custom administration for DynamicObjects,\n// and skip either the internal values map, or the base object with its property descriptors!\nvar objectProxyTraps = {\n has: function has(target, name) {\n if ( true && globalState.trackingDerivation) {\n warnAboutProxyRequirement(\"detect new properties using the 'in' operator. Use 'has' from 'mobx' instead.\");\n }\n return getAdm(target).has_(name);\n },\n get: function get(target, name) {\n return getAdm(target).get_(name);\n },\n set: function set(target, name, value) {\n var _getAdm$set_;\n if (!isStringish(name)) {\n return false;\n }\n if ( true && !getAdm(target).values_.has(name)) {\n warnAboutProxyRequirement(\"add a new observable property through direct assignment. Use 'set' from 'mobx' instead.\");\n }\n // null (intercepted) -> true (success)\n return (_getAdm$set_ = getAdm(target).set_(name, value, true)) != null ? _getAdm$set_ : true;\n },\n deleteProperty: function deleteProperty(target, name) {\n var _getAdm$delete_;\n if (true) {\n warnAboutProxyRequirement(\"delete properties from an observable object. Use 'remove' from 'mobx' instead.\");\n }\n if (!isStringish(name)) {\n return false;\n }\n // null (intercepted) -> true (success)\n return (_getAdm$delete_ = getAdm(target).delete_(name, true)) != null ? _getAdm$delete_ : true;\n },\n defineProperty: function defineProperty(target, name, descriptor) {\n var _getAdm$definePropert;\n if (true) {\n warnAboutProxyRequirement(\"define property on an observable object. Use 'defineProperty' from 'mobx' instead.\");\n }\n // null (intercepted) -> true (success)\n return (_getAdm$definePropert = getAdm(target).defineProperty_(name, descriptor)) != null ? _getAdm$definePropert : true;\n },\n ownKeys: function ownKeys(target) {\n if ( true && globalState.trackingDerivation) {\n warnAboutProxyRequirement(\"iterate keys to detect added / removed properties. Use 'keys' from 'mobx' instead.\");\n }\n return getAdm(target).ownKeys_();\n },\n preventExtensions: function preventExtensions(target) {\n die(13);\n }\n};\nfunction asDynamicObservableObject(target, options) {\n var _target$$mobx, _target$$mobx$proxy_;\n assertProxies();\n target = asObservableObject(target, options);\n return (_target$$mobx$proxy_ = (_target$$mobx = target[$mobx]).proxy_) != null ? _target$$mobx$proxy_ : _target$$mobx.proxy_ = new Proxy(target, objectProxyTraps);\n}\n\nfunction hasInterceptors(interceptable) {\n return interceptable.interceptors_ !== undefined && interceptable.interceptors_.length > 0;\n}\nfunction registerInterceptor(interceptable, handler) {\n var interceptors = interceptable.interceptors_ || (interceptable.interceptors_ = []);\n interceptors.push(handler);\n return once(function () {\n var idx = interceptors.indexOf(handler);\n if (idx !== -1) {\n interceptors.splice(idx, 1);\n }\n });\n}\nfunction interceptChange(interceptable, change) {\n var prevU = untrackedStart();\n try {\n // Interceptor can modify the array, copy it to avoid concurrent modification, see #1950\n var interceptors = [].concat(interceptable.interceptors_ || []);\n for (var i = 0, l = interceptors.length; i < l; i++) {\n change = interceptors[i](change);\n if (change && !change.type) {\n die(14);\n }\n if (!change) {\n break;\n }\n }\n return change;\n } finally {\n untrackedEnd(prevU);\n }\n}\n\nfunction hasListeners(listenable) {\n return listenable.changeListeners_ !== undefined && listenable.changeListeners_.length > 0;\n}\nfunction registerListener(listenable, handler) {\n var listeners = listenable.changeListeners_ || (listenable.changeListeners_ = []);\n listeners.push(handler);\n return once(function () {\n var idx = listeners.indexOf(handler);\n if (idx !== -1) {\n listeners.splice(idx, 1);\n }\n });\n}\nfunction notifyListeners(listenable, change) {\n var prevU = untrackedStart();\n var listeners = listenable.changeListeners_;\n if (!listeners) {\n return;\n }\n listeners = listeners.slice();\n for (var i = 0, l = listeners.length; i < l; i++) {\n listeners[i](change);\n }\n untrackedEnd(prevU);\n}\n\nfunction makeObservable(target, annotations, options) {\n initObservable(function () {\n var _annotations;\n var adm = asObservableObject(target, options)[$mobx];\n if ( true && annotations && target[storedAnnotationsSymbol]) {\n die(\"makeObservable second arg must be nullish when using decorators. Mixing @decorator syntax with annotations is not supported.\");\n }\n // Default to decorators\n (_annotations = annotations) != null ? _annotations : annotations = collectStoredAnnotations(target);\n // Annotate\n ownKeys(annotations).forEach(function (key) {\n return adm.make_(key, annotations[key]);\n });\n });\n return target;\n}\n// proto[keysSymbol] = new Set()\nvar keysSymbol = /*#__PURE__*/Symbol(\"mobx-keys\");\nfunction makeAutoObservable(target, overrides, options) {\n if (true) {\n if (!isPlainObject(target) && !isPlainObject(Object.getPrototypeOf(target))) {\n die(\"'makeAutoObservable' can only be used for classes that don't have a superclass\");\n }\n if (isObservableObject(target)) {\n die(\"makeAutoObservable can only be used on objects not already made observable\");\n }\n }\n // Optimization: avoid visiting protos\n // Assumes that annotation.make_/.extend_ works the same for plain objects\n if (isPlainObject(target)) {\n return extendObservable(target, target, overrides, options);\n }\n initObservable(function () {\n var adm = asObservableObject(target, options)[$mobx];\n // Optimization: cache keys on proto\n // Assumes makeAutoObservable can be called only once per object and can't be used in subclass\n if (!target[keysSymbol]) {\n var proto = Object.getPrototypeOf(target);\n var keys = new Set([].concat(ownKeys(target), ownKeys(proto)));\n keys[\"delete\"](\"constructor\");\n keys[\"delete\"]($mobx);\n addHiddenProp(proto, keysSymbol, keys);\n }\n target[keysSymbol].forEach(function (key) {\n return adm.make_(key,\n // must pass \"undefined\" for { key: undefined }\n !overrides ? true : key in overrides ? overrides[key] : true);\n });\n });\n return target;\n}\n\nvar SPLICE = \"splice\";\nvar UPDATE = \"update\";\nvar MAX_SPLICE_SIZE = 10000; // See e.g. https://github.com/mobxjs/mobx/issues/859\nvar arrayTraps = {\n get: function get(target, name) {\n var adm = target[$mobx];\n if (name === $mobx) {\n return adm;\n }\n if (name === \"length\") {\n return adm.getArrayLength_();\n }\n if (typeof name === \"string\" && !isNaN(name)) {\n return adm.get_(parseInt(name));\n }\n if (hasProp(arrayExtensions, name)) {\n return arrayExtensions[name];\n }\n return target[name];\n },\n set: function set(target, name, value) {\n var adm = target[$mobx];\n if (name === \"length\") {\n adm.setArrayLength_(value);\n }\n if (typeof name === \"symbol\" || isNaN(name)) {\n target[name] = value;\n } else {\n // numeric string\n adm.set_(parseInt(name), value);\n }\n return true;\n },\n preventExtensions: function preventExtensions() {\n die(15);\n }\n};\nvar ObservableArrayAdministration = /*#__PURE__*/function () {\n function ObservableArrayAdministration(name, enhancer, owned_, legacyMode_) {\n if (name === void 0) {\n name = true ? \"ObservableArray@\" + getNextId() : 0;\n }\n this.owned_ = void 0;\n this.legacyMode_ = void 0;\n this.atom_ = void 0;\n this.values_ = [];\n // this is the prop that gets proxied, so can't replace it!\n this.interceptors_ = void 0;\n this.changeListeners_ = void 0;\n this.enhancer_ = void 0;\n this.dehancer = void 0;\n this.proxy_ = void 0;\n this.lastKnownLength_ = 0;\n this.owned_ = owned_;\n this.legacyMode_ = legacyMode_;\n this.atom_ = new Atom(name);\n this.enhancer_ = function (newV, oldV) {\n return enhancer(newV, oldV, true ? name + \"[..]\" : 0);\n };\n }\n var _proto = ObservableArrayAdministration.prototype;\n _proto.dehanceValue_ = function dehanceValue_(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.dehanceValues_ = function dehanceValues_(values) {\n if (this.dehancer !== undefined && values.length > 0) {\n return values.map(this.dehancer);\n }\n return values;\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n if (fireImmediately === void 0) {\n fireImmediately = false;\n }\n if (fireImmediately) {\n listener({\n observableKind: \"array\",\n object: this.proxy_,\n debugObjectName: this.atom_.name_,\n type: \"splice\",\n index: 0,\n added: this.values_.slice(),\n addedCount: this.values_.length,\n removed: [],\n removedCount: 0\n });\n }\n return registerListener(this, listener);\n };\n _proto.getArrayLength_ = function getArrayLength_() {\n this.atom_.reportObserved();\n return this.values_.length;\n };\n _proto.setArrayLength_ = function setArrayLength_(newLength) {\n if (typeof newLength !== \"number\" || isNaN(newLength) || newLength < 0) {\n die(\"Out of range: \" + newLength);\n }\n var currentLength = this.values_.length;\n if (newLength === currentLength) {\n return;\n } else if (newLength > currentLength) {\n var newItems = new Array(newLength - currentLength);\n for (var i = 0; i < newLength - currentLength; i++) {\n newItems[i] = undefined;\n } // No Array.fill everywhere...\n this.spliceWithArray_(currentLength, 0, newItems);\n } else {\n this.spliceWithArray_(newLength, currentLength - newLength);\n }\n };\n _proto.updateArrayLength_ = function updateArrayLength_(oldLength, delta) {\n if (oldLength !== this.lastKnownLength_) {\n die(16);\n }\n this.lastKnownLength_ += delta;\n if (this.legacyMode_ && delta > 0) {\n reserveArrayBuffer(oldLength + delta + 1);\n }\n };\n _proto.spliceWithArray_ = function spliceWithArray_(index, deleteCount, newItems) {\n var _this = this;\n checkIfStateModificationsAreAllowed(this.atom_);\n var length = this.values_.length;\n if (index === undefined) {\n index = 0;\n } else if (index > length) {\n index = length;\n } else if (index < 0) {\n index = Math.max(0, length + index);\n }\n if (arguments.length === 1) {\n deleteCount = length - index;\n } else if (deleteCount === undefined || deleteCount === null) {\n deleteCount = 0;\n } else {\n deleteCount = Math.max(0, Math.min(deleteCount, length - index));\n }\n if (newItems === undefined) {\n newItems = EMPTY_ARRAY;\n }\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_,\n type: SPLICE,\n index: index,\n removedCount: deleteCount,\n added: newItems\n });\n if (!change) {\n return EMPTY_ARRAY;\n }\n deleteCount = change.removedCount;\n newItems = change.added;\n }\n newItems = newItems.length === 0 ? newItems : newItems.map(function (v) {\n return _this.enhancer_(v, undefined);\n });\n if (this.legacyMode_ || \"development\" !== \"production\") {\n var lengthDelta = newItems.length - deleteCount;\n this.updateArrayLength_(length, lengthDelta); // checks if internal array wasn't modified\n }\n var res = this.spliceItemsIntoValues_(index, deleteCount, newItems);\n if (deleteCount !== 0 || newItems.length !== 0) {\n this.notifyArraySplice_(index, newItems, res);\n }\n return this.dehanceValues_(res);\n };\n _proto.spliceItemsIntoValues_ = function spliceItemsIntoValues_(index, deleteCount, newItems) {\n if (newItems.length < MAX_SPLICE_SIZE) {\n var _this$values_;\n return (_this$values_ = this.values_).splice.apply(_this$values_, [index, deleteCount].concat(newItems));\n } else {\n // The items removed by the splice\n var res = this.values_.slice(index, index + deleteCount);\n // The items that that should remain at the end of the array\n var oldItems = this.values_.slice(index + deleteCount);\n // New length is the previous length + addition count - deletion count\n this.values_.length += newItems.length - deleteCount;\n for (var i = 0; i < newItems.length; i++) {\n this.values_[index + i] = newItems[i];\n }\n for (var _i = 0; _i < oldItems.length; _i++) {\n this.values_[index + newItems.length + _i] = oldItems[_i];\n }\n return res;\n }\n };\n _proto.notifyArrayChildUpdate_ = function notifyArrayChildUpdate_(index, newValue, oldValue) {\n var notifySpy = !this.owned_ && isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"array\",\n object: this.proxy_,\n type: UPDATE,\n debugObjectName: this.atom_.name_,\n index: index,\n newValue: newValue,\n oldValue: oldValue\n } : null;\n // The reason why this is on right hand side here (and not above), is this way the uglifier will drop it, but it won't\n // cause any runtime overhead in development mode without NODE_ENV set, unless spying is enabled\n if ( true && notifySpy) {\n spyReportStart(change);\n }\n this.atom_.reportChanged();\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n };\n _proto.notifyArraySplice_ = function notifyArraySplice_(index, added, removed) {\n var notifySpy = !this.owned_ && isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"array\",\n object: this.proxy_,\n debugObjectName: this.atom_.name_,\n type: SPLICE,\n index: index,\n removed: removed,\n added: added,\n removedCount: removed.length,\n addedCount: added.length\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n }\n this.atom_.reportChanged();\n // conform: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/observe\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n };\n _proto.get_ = function get_(index) {\n if (this.legacyMode_ && index >= this.values_.length) {\n console.warn( true ? \"[mobx.array] Attempt to read an array index (\" + index + \") that is out of bounds (\" + this.values_.length + \"). Please check length first. Out of bound indices will not be tracked by MobX\" : 0);\n return undefined;\n }\n this.atom_.reportObserved();\n return this.dehanceValue_(this.values_[index]);\n };\n _proto.set_ = function set_(index, newValue) {\n var values = this.values_;\n if (this.legacyMode_ && index > values.length) {\n // out of bounds\n die(17, index, values.length);\n }\n if (index < values.length) {\n // update at index in range\n checkIfStateModificationsAreAllowed(this.atom_);\n var oldValue = values[index];\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: UPDATE,\n object: this.proxy_,\n // since \"this\" is the real array we need to pass its proxy\n index: index,\n newValue: newValue\n });\n if (!change) {\n return;\n }\n newValue = change.newValue;\n }\n newValue = this.enhancer_(newValue, oldValue);\n var changed = newValue !== oldValue;\n if (changed) {\n values[index] = newValue;\n this.notifyArrayChildUpdate_(index, newValue, oldValue);\n }\n } else {\n // For out of bound index, we don't create an actual sparse array,\n // but rather fill the holes with undefined (same as setArrayLength_).\n // This could be considered a bug.\n var newItems = new Array(index + 1 - values.length);\n for (var i = 0; i < newItems.length - 1; i++) {\n newItems[i] = undefined;\n } // No Array.fill everywhere...\n newItems[newItems.length - 1] = newValue;\n this.spliceWithArray_(values.length, 0, newItems);\n }\n };\n return ObservableArrayAdministration;\n}();\nfunction createObservableArray(initialValues, enhancer, name, owned) {\n if (name === void 0) {\n name = true ? \"ObservableArray@\" + getNextId() : 0;\n }\n if (owned === void 0) {\n owned = false;\n }\n assertProxies();\n return initObservable(function () {\n var adm = new ObservableArrayAdministration(name, enhancer, owned, false);\n addHiddenFinalProp(adm.values_, $mobx, adm);\n var proxy = new Proxy(adm.values_, arrayTraps);\n adm.proxy_ = proxy;\n if (initialValues && initialValues.length) {\n adm.spliceWithArray_(0, 0, initialValues);\n }\n return proxy;\n });\n}\n// eslint-disable-next-line\nvar arrayExtensions = {\n clear: function clear() {\n return this.splice(0);\n },\n replace: function replace(newItems) {\n var adm = this[$mobx];\n return adm.spliceWithArray_(0, adm.values_.length, newItems);\n },\n // Used by JSON.stringify\n toJSON: function toJSON() {\n return this.slice();\n },\n /*\n * functions that do alter the internal structure of the array, (based on lib.es6.d.ts)\n * since these functions alter the inner structure of the array, the have side effects.\n * Because the have side effects, they should not be used in computed function,\n * and for that reason the do not call dependencyState.notifyObserved\n */\n splice: function splice(index, deleteCount) {\n for (var _len = arguments.length, newItems = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {\n newItems[_key - 2] = arguments[_key];\n }\n var adm = this[$mobx];\n switch (arguments.length) {\n case 0:\n return [];\n case 1:\n return adm.spliceWithArray_(index);\n case 2:\n return adm.spliceWithArray_(index, deleteCount);\n }\n return adm.spliceWithArray_(index, deleteCount, newItems);\n },\n spliceWithArray: function spliceWithArray(index, deleteCount, newItems) {\n return this[$mobx].spliceWithArray_(index, deleteCount, newItems);\n },\n push: function push() {\n var adm = this[$mobx];\n for (var _len2 = arguments.length, items = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n items[_key2] = arguments[_key2];\n }\n adm.spliceWithArray_(adm.values_.length, 0, items);\n return adm.values_.length;\n },\n pop: function pop() {\n return this.splice(Math.max(this[$mobx].values_.length - 1, 0), 1)[0];\n },\n shift: function shift() {\n return this.splice(0, 1)[0];\n },\n unshift: function unshift() {\n var adm = this[$mobx];\n for (var _len3 = arguments.length, items = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n items[_key3] = arguments[_key3];\n }\n adm.spliceWithArray_(0, 0, items);\n return adm.values_.length;\n },\n reverse: function reverse() {\n // reverse by default mutates in place before returning the result\n // which makes it both a 'derivation' and a 'mutation'.\n if (globalState.trackingDerivation) {\n die(37, \"reverse\");\n }\n this.replace(this.slice().reverse());\n return this;\n },\n sort: function sort() {\n // sort by default mutates in place before returning the result\n // which goes against all good practices. Let's not change the array in place!\n if (globalState.trackingDerivation) {\n die(37, \"sort\");\n }\n var copy = this.slice();\n copy.sort.apply(copy, arguments);\n this.replace(copy);\n return this;\n },\n remove: function remove(value) {\n var adm = this[$mobx];\n var idx = adm.dehanceValues_(adm.values_).indexOf(value);\n if (idx > -1) {\n this.splice(idx, 1);\n return true;\n }\n return false;\n }\n};\n/**\n * Wrap function from prototype\n * Without this, everything works as well, but this works\n * faster as everything works on unproxied values\n */\naddArrayExtension(\"at\", simpleFunc);\naddArrayExtension(\"concat\", simpleFunc);\naddArrayExtension(\"flat\", simpleFunc);\naddArrayExtension(\"includes\", simpleFunc);\naddArrayExtension(\"indexOf\", simpleFunc);\naddArrayExtension(\"join\", simpleFunc);\naddArrayExtension(\"lastIndexOf\", simpleFunc);\naddArrayExtension(\"slice\", simpleFunc);\naddArrayExtension(\"toString\", simpleFunc);\naddArrayExtension(\"toLocaleString\", simpleFunc);\naddArrayExtension(\"toSorted\", simpleFunc);\naddArrayExtension(\"toSpliced\", simpleFunc);\naddArrayExtension(\"with\", simpleFunc);\n// map\naddArrayExtension(\"every\", mapLikeFunc);\naddArrayExtension(\"filter\", mapLikeFunc);\naddArrayExtension(\"find\", mapLikeFunc);\naddArrayExtension(\"findIndex\", mapLikeFunc);\naddArrayExtension(\"findLast\", mapLikeFunc);\naddArrayExtension(\"findLastIndex\", mapLikeFunc);\naddArrayExtension(\"flatMap\", mapLikeFunc);\naddArrayExtension(\"forEach\", mapLikeFunc);\naddArrayExtension(\"map\", mapLikeFunc);\naddArrayExtension(\"some\", mapLikeFunc);\naddArrayExtension(\"toReversed\", mapLikeFunc);\n// reduce\naddArrayExtension(\"reduce\", reduceLikeFunc);\naddArrayExtension(\"reduceRight\", reduceLikeFunc);\nfunction addArrayExtension(funcName, funcFactory) {\n if (typeof Array.prototype[funcName] === \"function\") {\n arrayExtensions[funcName] = funcFactory(funcName);\n }\n}\n// Report and delegate to dehanced array\nfunction simpleFunc(funcName) {\n return function () {\n var adm = this[$mobx];\n adm.atom_.reportObserved();\n var dehancedValues = adm.dehanceValues_(adm.values_);\n return dehancedValues[funcName].apply(dehancedValues, arguments);\n };\n}\n// Make sure callbacks receive correct array arg #2326\nfunction mapLikeFunc(funcName) {\n return function (callback, thisArg) {\n var _this2 = this;\n var adm = this[$mobx];\n adm.atom_.reportObserved();\n var dehancedValues = adm.dehanceValues_(adm.values_);\n return dehancedValues[funcName](function (element, index) {\n return callback.call(thisArg, element, index, _this2);\n });\n };\n}\n// Make sure callbacks receive correct array arg #2326\nfunction reduceLikeFunc(funcName) {\n return function () {\n var _this3 = this;\n var adm = this[$mobx];\n adm.atom_.reportObserved();\n var dehancedValues = adm.dehanceValues_(adm.values_);\n // #2432 - reduce behavior depends on arguments.length\n var callback = arguments[0];\n arguments[0] = function (accumulator, currentValue, index) {\n return callback(accumulator, currentValue, index, _this3);\n };\n return dehancedValues[funcName].apply(dehancedValues, arguments);\n };\n}\nvar isObservableArrayAdministration = /*#__PURE__*/createInstanceofPredicate(\"ObservableArrayAdministration\", ObservableArrayAdministration);\nfunction isObservableArray(thing) {\n return isObject(thing) && isObservableArrayAdministration(thing[$mobx]);\n}\n\nvar ObservableMapMarker = {};\nvar ADD = \"add\";\nvar DELETE = \"delete\";\n// just extend Map? See also https://gist.github.com/nestharus/13b4d74f2ef4a2f4357dbd3fc23c1e54\n// But: https://github.com/mobxjs/mobx/issues/1556\nvar ObservableMap = /*#__PURE__*/function () {\n function ObservableMap(initialData, enhancer_, name_) {\n var _this = this;\n if (enhancer_ === void 0) {\n enhancer_ = deepEnhancer;\n }\n if (name_ === void 0) {\n name_ = true ? \"ObservableMap@\" + getNextId() : 0;\n }\n this.enhancer_ = void 0;\n this.name_ = void 0;\n this[$mobx] = ObservableMapMarker;\n this.data_ = void 0;\n this.hasMap_ = void 0;\n // hasMap, not hashMap >-).\n this.keysAtom_ = void 0;\n this.interceptors_ = void 0;\n this.changeListeners_ = void 0;\n this.dehancer = void 0;\n this.enhancer_ = enhancer_;\n this.name_ = name_;\n if (!isFunction(Map)) {\n die(18);\n }\n initObservable(function () {\n _this.keysAtom_ = createAtom( true ? _this.name_ + \".keys()\" : 0);\n _this.data_ = new Map();\n _this.hasMap_ = new Map();\n if (initialData) {\n _this.merge(initialData);\n }\n });\n }\n var _proto = ObservableMap.prototype;\n _proto.has_ = function has_(key) {\n return this.data_.has(key);\n };\n _proto.has = function has(key) {\n var _this2 = this;\n if (!globalState.trackingDerivation) {\n return this.has_(key);\n }\n var entry = this.hasMap_.get(key);\n if (!entry) {\n var newEntry = entry = new ObservableValue(this.has_(key), referenceEnhancer, true ? this.name_ + \".\" + stringifyKey(key) + \"?\" : 0, false);\n this.hasMap_.set(key, newEntry);\n onBecomeUnobserved(newEntry, function () {\n return _this2.hasMap_[\"delete\"](key);\n });\n }\n return entry.get();\n };\n _proto.set = function set(key, value) {\n var hasKey = this.has_(key);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: hasKey ? UPDATE : ADD,\n object: this,\n newValue: value,\n name: key\n });\n if (!change) {\n return this;\n }\n value = change.newValue;\n }\n if (hasKey) {\n this.updateValue_(key, value);\n } else {\n this.addValue_(key, value);\n }\n return this;\n };\n _proto[\"delete\"] = function _delete(key) {\n var _this3 = this;\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: DELETE,\n object: this,\n name: key\n });\n if (!change) {\n return false;\n }\n }\n if (this.has_(key)) {\n var notifySpy = isSpyEnabled();\n var notify = hasListeners(this);\n var _change = notify || notifySpy ? {\n observableKind: \"map\",\n debugObjectName: this.name_,\n type: DELETE,\n object: this,\n oldValue: this.data_.get(key).value_,\n name: key\n } : null;\n if ( true && notifySpy) {\n spyReportStart(_change);\n } // TODO fix type\n transaction(function () {\n var _this3$hasMap_$get;\n _this3.keysAtom_.reportChanged();\n (_this3$hasMap_$get = _this3.hasMap_.get(key)) == null || _this3$hasMap_$get.setNewValue_(false);\n var observable = _this3.data_.get(key);\n observable.setNewValue_(undefined);\n _this3.data_[\"delete\"](key);\n });\n if (notify) {\n notifyListeners(this, _change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n return true;\n }\n return false;\n };\n _proto.updateValue_ = function updateValue_(key, newValue) {\n var observable = this.data_.get(key);\n newValue = observable.prepareNewValue_(newValue);\n if (newValue !== globalState.UNCHANGED) {\n var notifySpy = isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"map\",\n debugObjectName: this.name_,\n type: UPDATE,\n object: this,\n oldValue: observable.value_,\n name: key,\n newValue: newValue\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n } // TODO fix type\n observable.setNewValue_(newValue);\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n };\n _proto.addValue_ = function addValue_(key, newValue) {\n var _this4 = this;\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n transaction(function () {\n var _this4$hasMap_$get;\n var observable = new ObservableValue(newValue, _this4.enhancer_, true ? _this4.name_ + \".\" + stringifyKey(key) : 0, false);\n _this4.data_.set(key, observable);\n newValue = observable.value_; // value might have been changed\n (_this4$hasMap_$get = _this4.hasMap_.get(key)) == null || _this4$hasMap_$get.setNewValue_(true);\n _this4.keysAtom_.reportChanged();\n });\n var notifySpy = isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"map\",\n debugObjectName: this.name_,\n type: ADD,\n object: this,\n name: key,\n newValue: newValue\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n } // TODO fix type\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n };\n _proto.get = function get(key) {\n if (this.has(key)) {\n return this.dehanceValue_(this.data_.get(key).get());\n }\n return this.dehanceValue_(undefined);\n };\n _proto.dehanceValue_ = function dehanceValue_(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.keys = function keys() {\n this.keysAtom_.reportObserved();\n return this.data_.keys();\n };\n _proto.values = function values() {\n var self = this;\n var keys = this.keys();\n return makeIterable({\n next: function next() {\n var _keys$next = keys.next(),\n done = _keys$next.done,\n value = _keys$next.value;\n return {\n done: done,\n value: done ? undefined : self.get(value)\n };\n }\n });\n };\n _proto.entries = function entries() {\n var self = this;\n var keys = this.keys();\n return makeIterable({\n next: function next() {\n var _keys$next2 = keys.next(),\n done = _keys$next2.done,\n value = _keys$next2.value;\n return {\n done: done,\n value: done ? undefined : [value, self.get(value)]\n };\n }\n });\n };\n _proto[Symbol.iterator] = function () {\n return this.entries();\n };\n _proto.forEach = function forEach(callback, thisArg) {\n for (var _iterator = _createForOfIteratorHelperLoose(this), _step; !(_step = _iterator()).done;) {\n var _step$value = _step.value,\n key = _step$value[0],\n value = _step$value[1];\n callback.call(thisArg, value, key, this);\n }\n }\n /** Merge another object into this object, returns this. */;\n _proto.merge = function merge(other) {\n var _this5 = this;\n if (isObservableMap(other)) {\n other = new Map(other);\n }\n transaction(function () {\n if (isPlainObject(other)) {\n getPlainObjectKeys(other).forEach(function (key) {\n return _this5.set(key, other[key]);\n });\n } else if (Array.isArray(other)) {\n other.forEach(function (_ref) {\n var key = _ref[0],\n value = _ref[1];\n return _this5.set(key, value);\n });\n } else if (isES6Map(other)) {\n if (!isPlainES6Map(other)) {\n die(19, other);\n }\n other.forEach(function (value, key) {\n return _this5.set(key, value);\n });\n } else if (other !== null && other !== undefined) {\n die(20, other);\n }\n });\n return this;\n };\n _proto.clear = function clear() {\n var _this6 = this;\n transaction(function () {\n untracked(function () {\n for (var _iterator2 = _createForOfIteratorHelperLoose(_this6.keys()), _step2; !(_step2 = _iterator2()).done;) {\n var key = _step2.value;\n _this6[\"delete\"](key);\n }\n });\n });\n };\n _proto.replace = function replace(values) {\n var _this7 = this;\n // Implementation requirements:\n // - respect ordering of replacement map\n // - allow interceptors to run and potentially prevent individual operations\n // - don't recreate observables that already exist in original map (so we don't destroy existing subscriptions)\n // - don't _keysAtom.reportChanged if the keys of resulting map are indentical (order matters!)\n // - note that result map may differ from replacement map due to the interceptors\n transaction(function () {\n // Convert to map so we can do quick key lookups\n var replacementMap = convertToMap(values);\n var orderedData = new Map();\n // Used for optimization\n var keysReportChangedCalled = false;\n // Delete keys that don't exist in replacement map\n // if the key deletion is prevented by interceptor\n // add entry at the beginning of the result map\n for (var _iterator3 = _createForOfIteratorHelperLoose(_this7.data_.keys()), _step3; !(_step3 = _iterator3()).done;) {\n var key = _step3.value;\n // Concurrently iterating/deleting keys\n // iterator should handle this correctly\n if (!replacementMap.has(key)) {\n var deleted = _this7[\"delete\"](key);\n // Was the key removed?\n if (deleted) {\n // _keysAtom.reportChanged() was already called\n keysReportChangedCalled = true;\n } else {\n // Delete prevented by interceptor\n var value = _this7.data_.get(key);\n orderedData.set(key, value);\n }\n }\n }\n // Merge entries\n for (var _iterator4 = _createForOfIteratorHelperLoose(replacementMap.entries()), _step4; !(_step4 = _iterator4()).done;) {\n var _step4$value = _step4.value,\n _key = _step4$value[0],\n _value = _step4$value[1];\n // We will want to know whether a new key is added\n var keyExisted = _this7.data_.has(_key);\n // Add or update value\n _this7.set(_key, _value);\n // The addition could have been prevent by interceptor\n if (_this7.data_.has(_key)) {\n // The update could have been prevented by interceptor\n // and also we want to preserve existing values\n // so use value from _data map (instead of replacement map)\n var _value2 = _this7.data_.get(_key);\n orderedData.set(_key, _value2);\n // Was a new key added?\n if (!keyExisted) {\n // _keysAtom.reportChanged() was already called\n keysReportChangedCalled = true;\n }\n }\n }\n // Check for possible key order change\n if (!keysReportChangedCalled) {\n if (_this7.data_.size !== orderedData.size) {\n // If size differs, keys are definitely modified\n _this7.keysAtom_.reportChanged();\n } else {\n var iter1 = _this7.data_.keys();\n var iter2 = orderedData.keys();\n var next1 = iter1.next();\n var next2 = iter2.next();\n while (!next1.done) {\n if (next1.value !== next2.value) {\n _this7.keysAtom_.reportChanged();\n break;\n }\n next1 = iter1.next();\n next2 = iter2.next();\n }\n }\n }\n // Use correctly ordered map\n _this7.data_ = orderedData;\n });\n return this;\n };\n _proto.toString = function toString() {\n return \"[object ObservableMap]\";\n };\n _proto.toJSON = function toJSON() {\n return Array.from(this);\n };\n /**\n * Observes this object. Triggers for the events 'add', 'update' and 'delete'.\n * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe\n * for callback details\n */\n _proto.observe_ = function observe_(listener, fireImmediately) {\n if ( true && fireImmediately === true) {\n die(\"`observe` doesn't support fireImmediately=true in combination with maps.\");\n }\n return registerListener(this, listener);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n return _createClass(ObservableMap, [{\n key: \"size\",\n get: function get() {\n this.keysAtom_.reportObserved();\n return this.data_.size;\n }\n }, {\n key: Symbol.toStringTag,\n get: function get() {\n return \"Map\";\n }\n }]);\n}();\n// eslint-disable-next-line\nvar isObservableMap = /*#__PURE__*/createInstanceofPredicate(\"ObservableMap\", ObservableMap);\nfunction convertToMap(dataStructure) {\n if (isES6Map(dataStructure) || isObservableMap(dataStructure)) {\n return dataStructure;\n } else if (Array.isArray(dataStructure)) {\n return new Map(dataStructure);\n } else if (isPlainObject(dataStructure)) {\n var map = new Map();\n for (var key in dataStructure) {\n map.set(key, dataStructure[key]);\n }\n return map;\n } else {\n return die(21, dataStructure);\n }\n}\n\nvar ObservableSetMarker = {};\nvar ObservableSet = /*#__PURE__*/function () {\n function ObservableSet(initialData, enhancer, name_) {\n var _this = this;\n if (enhancer === void 0) {\n enhancer = deepEnhancer;\n }\n if (name_ === void 0) {\n name_ = true ? \"ObservableSet@\" + getNextId() : 0;\n }\n this.name_ = void 0;\n this[$mobx] = ObservableSetMarker;\n this.data_ = new Set();\n this.atom_ = void 0;\n this.changeListeners_ = void 0;\n this.interceptors_ = void 0;\n this.dehancer = void 0;\n this.enhancer_ = void 0;\n this.name_ = name_;\n if (!isFunction(Set)) {\n die(22);\n }\n this.enhancer_ = function (newV, oldV) {\n return enhancer(newV, oldV, name_);\n };\n initObservable(function () {\n _this.atom_ = createAtom(_this.name_);\n if (initialData) {\n _this.replace(initialData);\n }\n });\n }\n var _proto = ObservableSet.prototype;\n _proto.dehanceValue_ = function dehanceValue_(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.clear = function clear() {\n var _this2 = this;\n transaction(function () {\n untracked(function () {\n for (var _iterator = _createForOfIteratorHelperLoose(_this2.data_.values()), _step; !(_step = _iterator()).done;) {\n var value = _step.value;\n _this2[\"delete\"](value);\n }\n });\n });\n };\n _proto.forEach = function forEach(callbackFn, thisArg) {\n for (var _iterator2 = _createForOfIteratorHelperLoose(this), _step2; !(_step2 = _iterator2()).done;) {\n var value = _step2.value;\n callbackFn.call(thisArg, value, value, this);\n }\n };\n _proto.add = function add(value) {\n var _this3 = this;\n checkIfStateModificationsAreAllowed(this.atom_);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: ADD,\n object: this,\n newValue: value\n });\n if (!change) {\n return this;\n }\n // ideally, value = change.value would be done here, so that values can be\n // changed by interceptor. Same applies for other Set and Map api's.\n }\n if (!this.has(value)) {\n transaction(function () {\n _this3.data_.add(_this3.enhancer_(value, undefined));\n _this3.atom_.reportChanged();\n });\n var notifySpy = true && isSpyEnabled();\n var notify = hasListeners(this);\n var _change = notify || notifySpy ? {\n observableKind: \"set\",\n debugObjectName: this.name_,\n type: ADD,\n object: this,\n newValue: value\n } : null;\n if (notifySpy && \"development\" !== \"production\") {\n spyReportStart(_change);\n }\n if (notify) {\n notifyListeners(this, _change);\n }\n if (notifySpy && \"development\" !== \"production\") {\n spyReportEnd();\n }\n }\n return this;\n };\n _proto[\"delete\"] = function _delete(value) {\n var _this4 = this;\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: DELETE,\n object: this,\n oldValue: value\n });\n if (!change) {\n return false;\n }\n }\n if (this.has(value)) {\n var notifySpy = true && isSpyEnabled();\n var notify = hasListeners(this);\n var _change2 = notify || notifySpy ? {\n observableKind: \"set\",\n debugObjectName: this.name_,\n type: DELETE,\n object: this,\n oldValue: value\n } : null;\n if (notifySpy && \"development\" !== \"production\") {\n spyReportStart(_change2);\n }\n transaction(function () {\n _this4.atom_.reportChanged();\n _this4.data_[\"delete\"](value);\n });\n if (notify) {\n notifyListeners(this, _change2);\n }\n if (notifySpy && \"development\" !== \"production\") {\n spyReportEnd();\n }\n return true;\n }\n return false;\n };\n _proto.has = function has(value) {\n this.atom_.reportObserved();\n return this.data_.has(this.dehanceValue_(value));\n };\n _proto.entries = function entries() {\n var nextIndex = 0;\n var keys = Array.from(this.keys());\n var values = Array.from(this.values());\n return makeIterable({\n next: function next() {\n var index = nextIndex;\n nextIndex += 1;\n return index < values.length ? {\n value: [keys[index], values[index]],\n done: false\n } : {\n done: true\n };\n }\n });\n };\n _proto.keys = function keys() {\n return this.values();\n };\n _proto.values = function values() {\n this.atom_.reportObserved();\n var self = this;\n var nextIndex = 0;\n var observableValues = Array.from(this.data_.values());\n return makeIterable({\n next: function next() {\n return nextIndex < observableValues.length ? {\n value: self.dehanceValue_(observableValues[nextIndex++]),\n done: false\n } : {\n done: true\n };\n }\n });\n };\n _proto.intersection = function intersection(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.intersection(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.intersection(otherSet);\n }\n };\n _proto.union = function union(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.union(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.union(otherSet);\n }\n };\n _proto.difference = function difference(otherSet) {\n return new Set(this).difference(otherSet);\n };\n _proto.symmetricDifference = function symmetricDifference(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.symmetricDifference(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.symmetricDifference(otherSet);\n }\n };\n _proto.isSubsetOf = function isSubsetOf(otherSet) {\n return new Set(this).isSubsetOf(otherSet);\n };\n _proto.isSupersetOf = function isSupersetOf(otherSet) {\n return new Set(this).isSupersetOf(otherSet);\n };\n _proto.isDisjointFrom = function isDisjointFrom(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.isDisjointFrom(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.isDisjointFrom(otherSet);\n }\n };\n _proto.replace = function replace(other) {\n var _this5 = this;\n if (isObservableSet(other)) {\n other = new Set(other);\n }\n transaction(function () {\n if (Array.isArray(other)) {\n _this5.clear();\n other.forEach(function (value) {\n return _this5.add(value);\n });\n } else if (isES6Set(other)) {\n _this5.clear();\n other.forEach(function (value) {\n return _this5.add(value);\n });\n } else if (other !== null && other !== undefined) {\n die(\"Cannot initialize set from \" + other);\n }\n });\n return this;\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n // ... 'fireImmediately' could also be true?\n if ( true && fireImmediately === true) {\n die(\"`observe` doesn't support fireImmediately=true in combination with sets.\");\n }\n return registerListener(this, listener);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.toJSON = function toJSON() {\n return Array.from(this);\n };\n _proto.toString = function toString() {\n return \"[object ObservableSet]\";\n };\n _proto[Symbol.iterator] = function () {\n return this.values();\n };\n return _createClass(ObservableSet, [{\n key: \"size\",\n get: function get() {\n this.atom_.reportObserved();\n return this.data_.size;\n }\n }, {\n key: Symbol.toStringTag,\n get: function get() {\n return \"Set\";\n }\n }]);\n}();\n// eslint-disable-next-line\nvar isObservableSet = /*#__PURE__*/createInstanceofPredicate(\"ObservableSet\", ObservableSet);\n\nvar descriptorCache = /*#__PURE__*/Object.create(null);\nvar REMOVE = \"remove\";\nvar ObservableObjectAdministration = /*#__PURE__*/function () {\n function ObservableObjectAdministration(target_, values_, name_,\n // Used anytime annotation is not explicitely provided\n defaultAnnotation_) {\n if (values_ === void 0) {\n values_ = new Map();\n }\n if (defaultAnnotation_ === void 0) {\n defaultAnnotation_ = autoAnnotation;\n }\n this.target_ = void 0;\n this.values_ = void 0;\n this.name_ = void 0;\n this.defaultAnnotation_ = void 0;\n this.keysAtom_ = void 0;\n this.changeListeners_ = void 0;\n this.interceptors_ = void 0;\n this.proxy_ = void 0;\n this.isPlainObject_ = void 0;\n this.appliedAnnotations_ = void 0;\n this.pendingKeys_ = void 0;\n this.target_ = target_;\n this.values_ = values_;\n this.name_ = name_;\n this.defaultAnnotation_ = defaultAnnotation_;\n this.keysAtom_ = new Atom( true ? this.name_ + \".keys\" : 0);\n // Optimization: we use this frequently\n this.isPlainObject_ = isPlainObject(this.target_);\n if ( true && !isAnnotation(this.defaultAnnotation_)) {\n die(\"defaultAnnotation must be valid annotation\");\n }\n if (true) {\n // Prepare structure for tracking which fields were already annotated\n this.appliedAnnotations_ = {};\n }\n }\n var _proto = ObservableObjectAdministration.prototype;\n _proto.getObservablePropValue_ = function getObservablePropValue_(key) {\n return this.values_.get(key).get();\n };\n _proto.setObservablePropValue_ = function setObservablePropValue_(key, newValue) {\n var observable = this.values_.get(key);\n if (observable instanceof ComputedValue) {\n observable.set(newValue);\n return true;\n }\n // intercept\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: UPDATE,\n object: this.proxy_ || this.target_,\n name: key,\n newValue: newValue\n });\n if (!change) {\n return null;\n }\n newValue = change.newValue;\n }\n newValue = observable.prepareNewValue_(newValue);\n // notify spy & observers\n if (newValue !== globalState.UNCHANGED) {\n var notify = hasListeners(this);\n var notifySpy = true && isSpyEnabled();\n var _change = notify || notifySpy ? {\n type: UPDATE,\n observableKind: \"object\",\n debugObjectName: this.name_,\n object: this.proxy_ || this.target_,\n oldValue: observable.value_,\n name: key,\n newValue: newValue\n } : null;\n if ( true && notifySpy) {\n spyReportStart(_change);\n }\n observable.setNewValue_(newValue);\n if (notify) {\n notifyListeners(this, _change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n return true;\n };\n _proto.get_ = function get_(key) {\n if (globalState.trackingDerivation && !hasProp(this.target_, key)) {\n // Key doesn't exist yet, subscribe for it in case it's added later\n this.has_(key);\n }\n return this.target_[key];\n }\n /**\n * @param {PropertyKey} key\n * @param {any} value\n * @param {Annotation|boolean} annotation true - use default annotation, false - copy as is\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.set_ = function set_(key, value, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n // Don't use .has(key) - we care about own\n if (hasProp(this.target_, key)) {\n // Existing prop\n if (this.values_.has(key)) {\n // Observable (can be intercepted)\n return this.setObservablePropValue_(key, value);\n } else if (proxyTrap) {\n // Non-observable - proxy\n return Reflect.set(this.target_, key, value);\n } else {\n // Non-observable\n this.target_[key] = value;\n return true;\n }\n } else {\n // New prop\n return this.extend_(key, {\n value: value,\n enumerable: true,\n writable: true,\n configurable: true\n }, this.defaultAnnotation_, proxyTrap);\n }\n }\n // Trap for \"in\"\n ;\n _proto.has_ = function has_(key) {\n if (!globalState.trackingDerivation) {\n // Skip key subscription outside derivation\n return key in this.target_;\n }\n this.pendingKeys_ || (this.pendingKeys_ = new Map());\n var entry = this.pendingKeys_.get(key);\n if (!entry) {\n entry = new ObservableValue(key in this.target_, referenceEnhancer, true ? this.name_ + \".\" + stringifyKey(key) + \"?\" : 0, false);\n this.pendingKeys_.set(key, entry);\n }\n return entry.get();\n }\n /**\n * @param {PropertyKey} key\n * @param {Annotation|boolean} annotation true - use default annotation, false - ignore prop\n */;\n _proto.make_ = function make_(key, annotation) {\n if (annotation === true) {\n annotation = this.defaultAnnotation_;\n }\n if (annotation === false) {\n return;\n }\n assertAnnotable(this, annotation, key);\n if (!(key in this.target_)) {\n var _this$target_$storedA;\n // Throw on missing key, except for decorators:\n // Decorator annotations are collected from whole prototype chain.\n // When called from super() some props may not exist yet.\n // However we don't have to worry about missing prop,\n // because the decorator must have been applied to something.\n if ((_this$target_$storedA = this.target_[storedAnnotationsSymbol]) != null && _this$target_$storedA[key]) {\n return; // will be annotated by subclass constructor\n } else {\n die(1, annotation.annotationType_, this.name_ + \".\" + key.toString());\n }\n }\n var source = this.target_;\n while (source && source !== objectPrototype) {\n var descriptor = getDescriptor(source, key);\n if (descriptor) {\n var outcome = annotation.make_(this, key, descriptor, source);\n if (outcome === 0 /* MakeResult.Cancel */) {\n return;\n }\n if (outcome === 1 /* MakeResult.Break */) {\n break;\n }\n }\n source = Object.getPrototypeOf(source);\n }\n recordAnnotationApplied(this, annotation, key);\n }\n /**\n * @param {PropertyKey} key\n * @param {PropertyDescriptor} descriptor\n * @param {Annotation|boolean} annotation true - use default annotation, false - copy as is\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.extend_ = function extend_(key, descriptor, annotation, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n if (annotation === true) {\n annotation = this.defaultAnnotation_;\n }\n if (annotation === false) {\n return this.defineProperty_(key, descriptor, proxyTrap);\n }\n assertAnnotable(this, annotation, key);\n var outcome = annotation.extend_(this, key, descriptor, proxyTrap);\n if (outcome) {\n recordAnnotationApplied(this, annotation, key);\n }\n return outcome;\n }\n /**\n * @param {PropertyKey} key\n * @param {PropertyDescriptor} descriptor\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.defineProperty_ = function defineProperty_(key, descriptor, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n try {\n startBatch();\n // Delete\n var deleteOutcome = this.delete_(key);\n if (!deleteOutcome) {\n // Failure or intercepted\n return deleteOutcome;\n }\n // ADD interceptor\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: ADD,\n newValue: descriptor.value\n });\n if (!change) {\n return null;\n }\n var newValue = change.newValue;\n if (descriptor.value !== newValue) {\n descriptor = _extends({}, descriptor, {\n value: newValue\n });\n }\n }\n // Define\n if (proxyTrap) {\n if (!Reflect.defineProperty(this.target_, key, descriptor)) {\n return false;\n }\n } else {\n defineProperty(this.target_, key, descriptor);\n }\n // Notify\n this.notifyPropertyAddition_(key, descriptor.value);\n } finally {\n endBatch();\n }\n return true;\n }\n // If original descriptor becomes relevant, move this to annotation directly\n ;\n _proto.defineObservableProperty_ = function defineObservableProperty_(key, value, enhancer, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n try {\n startBatch();\n // Delete\n var deleteOutcome = this.delete_(key);\n if (!deleteOutcome) {\n // Failure or intercepted\n return deleteOutcome;\n }\n // ADD interceptor\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: ADD,\n newValue: value\n });\n if (!change) {\n return null;\n }\n value = change.newValue;\n }\n var cachedDescriptor = getCachedObservablePropDescriptor(key);\n var descriptor = {\n configurable: globalState.safeDescriptors ? this.isPlainObject_ : true,\n enumerable: true,\n get: cachedDescriptor.get,\n set: cachedDescriptor.set\n };\n // Define\n if (proxyTrap) {\n if (!Reflect.defineProperty(this.target_, key, descriptor)) {\n return false;\n }\n } else {\n defineProperty(this.target_, key, descriptor);\n }\n var observable = new ObservableValue(value, enhancer, true ? this.name_ + \".\" + key.toString() : 0, false);\n this.values_.set(key, observable);\n // Notify (value possibly changed by ObservableValue)\n this.notifyPropertyAddition_(key, observable.value_);\n } finally {\n endBatch();\n }\n return true;\n }\n // If original descriptor becomes relevant, move this to annotation directly\n ;\n _proto.defineComputedProperty_ = function defineComputedProperty_(key, options, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n try {\n startBatch();\n // Delete\n var deleteOutcome = this.delete_(key);\n if (!deleteOutcome) {\n // Failure or intercepted\n return deleteOutcome;\n }\n // ADD interceptor\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: ADD,\n newValue: undefined\n });\n if (!change) {\n return null;\n }\n }\n options.name || (options.name = true ? this.name_ + \".\" + key.toString() : 0);\n options.context = this.proxy_ || this.target_;\n var cachedDescriptor = getCachedObservablePropDescriptor(key);\n var descriptor = {\n configurable: globalState.safeDescriptors ? this.isPlainObject_ : true,\n enumerable: false,\n get: cachedDescriptor.get,\n set: cachedDescriptor.set\n };\n // Define\n if (proxyTrap) {\n if (!Reflect.defineProperty(this.target_, key, descriptor)) {\n return false;\n }\n } else {\n defineProperty(this.target_, key, descriptor);\n }\n this.values_.set(key, new ComputedValue(options));\n // Notify\n this.notifyPropertyAddition_(key, undefined);\n } finally {\n endBatch();\n }\n return true;\n }\n /**\n * @param {PropertyKey} key\n * @param {PropertyDescriptor} descriptor\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.delete_ = function delete_(key, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n // No such prop\n if (!hasProp(this.target_, key)) {\n return true;\n }\n // Intercept\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: REMOVE\n });\n // Cancelled\n if (!change) {\n return null;\n }\n }\n // Delete\n try {\n var _this$pendingKeys_;\n startBatch();\n var notify = hasListeners(this);\n var notifySpy = true && isSpyEnabled();\n var observable = this.values_.get(key);\n // Value needed for spies/listeners\n var value = undefined;\n // Optimization: don't pull the value unless we will need it\n if (!observable && (notify || notifySpy)) {\n var _getDescriptor;\n value = (_getDescriptor = getDescriptor(this.target_, key)) == null ? void 0 : _getDescriptor.value;\n }\n // delete prop (do first, may fail)\n if (proxyTrap) {\n if (!Reflect.deleteProperty(this.target_, key)) {\n return false;\n }\n } else {\n delete this.target_[key];\n }\n // Allow re-annotating this field\n if (true) {\n delete this.appliedAnnotations_[key];\n }\n // Clear observable\n if (observable) {\n this.values_[\"delete\"](key);\n // for computed, value is undefined\n if (observable instanceof ObservableValue) {\n value = observable.value_;\n }\n // Notify: autorun(() => obj[key]), see #1796\n propagateChanged(observable);\n }\n // Notify \"keys/entries/values\" observers\n this.keysAtom_.reportChanged();\n // Notify \"has\" observers\n // \"in\" as it may still exist in proto\n (_this$pendingKeys_ = this.pendingKeys_) == null || (_this$pendingKeys_ = _this$pendingKeys_.get(key)) == null || _this$pendingKeys_.set(key in this.target_);\n // Notify spies/listeners\n if (notify || notifySpy) {\n var _change2 = {\n type: REMOVE,\n observableKind: \"object\",\n object: this.proxy_ || this.target_,\n debugObjectName: this.name_,\n oldValue: value,\n name: key\n };\n if ( true && notifySpy) {\n spyReportStart(_change2);\n }\n if (notify) {\n notifyListeners(this, _change2);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n } finally {\n endBatch();\n }\n return true;\n }\n /**\n * Observes this object. Triggers for the events 'add', 'update' and 'delete'.\n * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe\n * for callback details\n */;\n _proto.observe_ = function observe_(callback, fireImmediately) {\n if ( true && fireImmediately === true) {\n die(\"`observe` doesn't support the fire immediately property for observable objects.\");\n }\n return registerListener(this, callback);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.notifyPropertyAddition_ = function notifyPropertyAddition_(key, value) {\n var _this$pendingKeys_2;\n var notify = hasListeners(this);\n var notifySpy = true && isSpyEnabled();\n if (notify || notifySpy) {\n var change = notify || notifySpy ? {\n type: ADD,\n observableKind: \"object\",\n debugObjectName: this.name_,\n object: this.proxy_ || this.target_,\n name: key,\n newValue: value\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n }\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n (_this$pendingKeys_2 = this.pendingKeys_) == null || (_this$pendingKeys_2 = _this$pendingKeys_2.get(key)) == null || _this$pendingKeys_2.set(true);\n // Notify \"keys/entries/values\" observers\n this.keysAtom_.reportChanged();\n };\n _proto.ownKeys_ = function ownKeys_() {\n this.keysAtom_.reportObserved();\n return ownKeys(this.target_);\n };\n _proto.keys_ = function keys_() {\n // Returns enumerable && own, but unfortunately keysAtom will report on ANY key change.\n // There is no way to distinguish between Object.keys(object) and Reflect.ownKeys(object) - both are handled by ownKeys trap.\n // We can either over-report in Object.keys(object) or under-report in Reflect.ownKeys(object)\n // We choose to over-report in Object.keys(object), because:\n // - typically it's used with simple data objects\n // - when symbolic/non-enumerable keys are relevant Reflect.ownKeys works as expected\n this.keysAtom_.reportObserved();\n return Object.keys(this.target_);\n };\n return ObservableObjectAdministration;\n}();\nfunction asObservableObject(target, options) {\n var _options$name;\n if ( true && options && isObservableObject(target)) {\n die(\"Options can't be provided for already observable objects.\");\n }\n if (hasProp(target, $mobx)) {\n if ( true && !(getAdministration(target) instanceof ObservableObjectAdministration)) {\n die(\"Cannot convert '\" + getDebugName(target) + \"' into observable object:\" + \"\\nThe target is already observable of different type.\" + \"\\nExtending builtins is not supported.\");\n }\n return target;\n }\n if ( true && !Object.isExtensible(target)) {\n die(\"Cannot make the designated object observable; it is not extensible\");\n }\n var name = (_options$name = options == null ? void 0 : options.name) != null ? _options$name : true ? (isPlainObject(target) ? \"ObservableObject\" : target.constructor.name) + \"@\" + getNextId() : 0;\n var adm = new ObservableObjectAdministration(target, new Map(), String(name), getAnnotationFromOptions(options));\n addHiddenProp(target, $mobx, adm);\n return target;\n}\nvar isObservableObjectAdministration = /*#__PURE__*/createInstanceofPredicate(\"ObservableObjectAdministration\", ObservableObjectAdministration);\nfunction getCachedObservablePropDescriptor(key) {\n return descriptorCache[key] || (descriptorCache[key] = {\n get: function get() {\n return this[$mobx].getObservablePropValue_(key);\n },\n set: function set(value) {\n return this[$mobx].setObservablePropValue_(key, value);\n }\n });\n}\nfunction isObservableObject(thing) {\n if (isObject(thing)) {\n return isObservableObjectAdministration(thing[$mobx]);\n }\n return false;\n}\nfunction recordAnnotationApplied(adm, annotation, key) {\n var _adm$target_$storedAn;\n if (true) {\n adm.appliedAnnotations_[key] = annotation;\n }\n // Remove applied decorator annotation so we don't try to apply it again in subclass constructor\n (_adm$target_$storedAn = adm.target_[storedAnnotationsSymbol]) == null || delete _adm$target_$storedAn[key];\n}\nfunction assertAnnotable(adm, annotation, key) {\n // Valid annotation\n if ( true && !isAnnotation(annotation)) {\n die(\"Cannot annotate '\" + adm.name_ + \".\" + key.toString() + \"': Invalid annotation.\");\n }\n /*\n // Configurable, not sealed, not frozen\n // Possibly not needed, just a little better error then the one thrown by engine.\n // Cases where this would be useful the most (subclass field initializer) are not interceptable by this.\n if (__DEV__) {\n const configurable = getDescriptor(adm.target_, key)?.configurable\n const frozen = Object.isFrozen(adm.target_)\n const sealed = Object.isSealed(adm.target_)\n if (!configurable || frozen || sealed) {\n const fieldName = `${adm.name_}.${key.toString()}`\n const requestedAnnotationType = annotation.annotationType_\n let error = `Cannot apply '${requestedAnnotationType}' to '${fieldName}':`\n if (frozen) {\n error += `\\nObject is frozen.`\n }\n if (sealed) {\n error += `\\nObject is sealed.`\n }\n if (!configurable) {\n error += `\\nproperty is not configurable.`\n // Mention only if caused by us to avoid confusion\n if (hasProp(adm.appliedAnnotations!, key)) {\n error += `\\nTo prevent accidental re-definition of a field by a subclass, `\n error += `all annotated fields of non-plain objects (classes) are not configurable.`\n }\n }\n die(error)\n }\n }\n */\n // Not annotated\n if ( true && !isOverride(annotation) && hasProp(adm.appliedAnnotations_, key)) {\n var fieldName = adm.name_ + \".\" + key.toString();\n var currentAnnotationType = adm.appliedAnnotations_[key].annotationType_;\n var requestedAnnotationType = annotation.annotationType_;\n die(\"Cannot apply '\" + requestedAnnotationType + \"' to '\" + fieldName + \"':\" + (\"\\nThe field is already annotated with '\" + currentAnnotationType + \"'.\") + \"\\nRe-annotating fields is not allowed.\" + \"\\nUse 'override' annotation for methods overridden by subclass.\");\n }\n}\n\n// Bug in safari 9.* (or iOS 9 safari mobile). See #364\nvar ENTRY_0 = /*#__PURE__*/createArrayEntryDescriptor(0);\nvar safariPrototypeSetterInheritanceBug = /*#__PURE__*/function () {\n var v = false;\n var p = {};\n Object.defineProperty(p, \"0\", {\n set: function set() {\n v = true;\n }\n });\n /*#__PURE__*/Object.create(p)[\"0\"] = 1;\n return v === false;\n}();\n/**\n * This array buffer contains two lists of properties, so that all arrays\n * can recycle their property definitions, which significantly improves performance of creating\n * properties on the fly.\n */\nvar OBSERVABLE_ARRAY_BUFFER_SIZE = 0;\n// Typescript workaround to make sure ObservableArray extends Array\nvar StubArray = function StubArray() {};\nfunction inherit(ctor, proto) {\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(ctor.prototype, proto);\n } else if (ctor.prototype.__proto__ !== undefined) {\n ctor.prototype.__proto__ = proto;\n } else {\n ctor.prototype = proto;\n }\n}\ninherit(StubArray, Array.prototype);\n// Weex proto freeze protection was here,\n// but it is unclear why the hack is need as MobX never changed the prototype\n// anyway, so removed it in V6\nvar LegacyObservableArray = /*#__PURE__*/function (_StubArray) {\n function LegacyObservableArray(initialValues, enhancer, name, owned) {\n var _this;\n if (name === void 0) {\n name = true ? \"ObservableArray@\" + getNextId() : 0;\n }\n if (owned === void 0) {\n owned = false;\n }\n _this = _StubArray.call(this) || this;\n initObservable(function () {\n var adm = new ObservableArrayAdministration(name, enhancer, owned, true);\n adm.proxy_ = _this;\n addHiddenFinalProp(_this, $mobx, adm);\n if (initialValues && initialValues.length) {\n // @ts-ignore\n _this.spliceWithArray(0, 0, initialValues);\n }\n if (safariPrototypeSetterInheritanceBug) {\n // Seems that Safari won't use numeric prototype setter until any * numeric property is\n // defined on the instance. After that it works fine, even if this property is deleted.\n Object.defineProperty(_this, \"0\", ENTRY_0);\n }\n });\n return _this;\n }\n _inheritsLoose(LegacyObservableArray, _StubArray);\n var _proto = LegacyObservableArray.prototype;\n _proto.concat = function concat() {\n this[$mobx].atom_.reportObserved();\n for (var _len = arguments.length, arrays = new Array(_len), _key = 0; _key < _len; _key++) {\n arrays[_key] = arguments[_key];\n }\n return Array.prototype.concat.apply(this.slice(),\n //@ts-ignore\n arrays.map(function (a) {\n return isObservableArray(a) ? a.slice() : a;\n }));\n };\n _proto[Symbol.iterator] = function () {\n var self = this;\n var nextIndex = 0;\n return makeIterable({\n next: function next() {\n return nextIndex < self.length ? {\n value: self[nextIndex++],\n done: false\n } : {\n done: true,\n value: undefined\n };\n }\n });\n };\n return _createClass(LegacyObservableArray, [{\n key: \"length\",\n get: function get() {\n return this[$mobx].getArrayLength_();\n },\n set: function set(newLength) {\n this[$mobx].setArrayLength_(newLength);\n }\n }, {\n key: Symbol.toStringTag,\n get: function get() {\n return \"Array\";\n }\n }]);\n}(StubArray);\nObject.entries(arrayExtensions).forEach(function (_ref) {\n var prop = _ref[0],\n fn = _ref[1];\n if (prop !== \"concat\") {\n addHiddenProp(LegacyObservableArray.prototype, prop, fn);\n }\n});\nfunction createArrayEntryDescriptor(index) {\n return {\n enumerable: false,\n configurable: true,\n get: function get() {\n return this[$mobx].get_(index);\n },\n set: function set(value) {\n this[$mobx].set_(index, value);\n }\n };\n}\nfunction createArrayBufferItem(index) {\n defineProperty(LegacyObservableArray.prototype, \"\" + index, createArrayEntryDescriptor(index));\n}\nfunction reserveArrayBuffer(max) {\n if (max > OBSERVABLE_ARRAY_BUFFER_SIZE) {\n for (var index = OBSERVABLE_ARRAY_BUFFER_SIZE; index < max + 100; index++) {\n createArrayBufferItem(index);\n }\n OBSERVABLE_ARRAY_BUFFER_SIZE = max;\n }\n}\nreserveArrayBuffer(1000);\nfunction createLegacyArray(initialValues, enhancer, name) {\n return new LegacyObservableArray(initialValues, enhancer, name);\n}\n\nfunction getAtom(thing, property) {\n if (typeof thing === \"object\" && thing !== null) {\n if (isObservableArray(thing)) {\n if (property !== undefined) {\n die(23);\n }\n return thing[$mobx].atom_;\n }\n if (isObservableSet(thing)) {\n return thing.atom_;\n }\n if (isObservableMap(thing)) {\n if (property === undefined) {\n return thing.keysAtom_;\n }\n var observable = thing.data_.get(property) || thing.hasMap_.get(property);\n if (!observable) {\n die(25, property, getDebugName(thing));\n }\n return observable;\n }\n if (isObservableObject(thing)) {\n if (!property) {\n return die(26);\n }\n var _observable = thing[$mobx].values_.get(property);\n if (!_observable) {\n die(27, property, getDebugName(thing));\n }\n return _observable;\n }\n if (isAtom(thing) || isComputedValue(thing) || isReaction(thing)) {\n return thing;\n }\n } else if (isFunction(thing)) {\n if (isReaction(thing[$mobx])) {\n // disposer function\n return thing[$mobx];\n }\n }\n die(28);\n}\nfunction getAdministration(thing, property) {\n if (!thing) {\n die(29);\n }\n if (property !== undefined) {\n return getAdministration(getAtom(thing, property));\n }\n if (isAtom(thing) || isComputedValue(thing) || isReaction(thing)) {\n return thing;\n }\n if (isObservableMap(thing) || isObservableSet(thing)) {\n return thing;\n }\n if (thing[$mobx]) {\n return thing[$mobx];\n }\n die(24, thing);\n}\nfunction getDebugName(thing, property) {\n var named;\n if (property !== undefined) {\n named = getAtom(thing, property);\n } else if (isAction(thing)) {\n return thing.name;\n } else if (isObservableObject(thing) || isObservableMap(thing) || isObservableSet(thing)) {\n named = getAdministration(thing);\n } else {\n // valid for arrays as well\n named = getAtom(thing);\n }\n return named.name_;\n}\n/**\n * Helper function for initializing observable structures, it applies:\n * 1. allowStateChanges so we don't violate enforceActions.\n * 2. untracked so we don't accidentaly subscribe to anything observable accessed during init in case the observable is created inside derivation.\n * 3. batch to avoid state version updates\n */\nfunction initObservable(cb) {\n var derivation = untrackedStart();\n var allowStateChanges = allowStateChangesStart(true);\n startBatch();\n try {\n return cb();\n } finally {\n endBatch();\n allowStateChangesEnd(allowStateChanges);\n untrackedEnd(derivation);\n }\n}\n\nvar toString = objectPrototype.toString;\nfunction deepEqual(a, b, depth) {\n if (depth === void 0) {\n depth = -1;\n }\n return eq(a, b, depth);\n}\n// Copied from https://github.com/jashkenas/underscore/blob/5c237a7c682fb68fd5378203f0bf22dce1624854/underscore.js#L1186-L1289\n// Internal recursive comparison function for `isEqual`.\nfunction eq(a, b, depth, aStack, bStack) {\n // Identical objects are equal. `0 === -0`, but they aren't identical.\n // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).\n if (a === b) {\n return a !== 0 || 1 / a === 1 / b;\n }\n // `null` or `undefined` only equal to itself (strict comparison).\n if (a == null || b == null) {\n return false;\n }\n // `NaN`s are equivalent, but non-reflexive.\n if (a !== a) {\n return b !== b;\n }\n // Exhaust primitive checks\n var type = typeof a;\n if (type !== \"function\" && type !== \"object\" && typeof b != \"object\") {\n return false;\n }\n // Compare `[[Class]]` names.\n var className = toString.call(a);\n if (className !== toString.call(b)) {\n return false;\n }\n switch (className) {\n // Strings, numbers, regular expressions, dates, and booleans are compared by value.\n case \"[object RegExp]\":\n // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i')\n case \"[object String]\":\n // Primitives and their corresponding object wrappers are equivalent; thus, `\"5\"` is\n // equivalent to `new String(\"5\")`.\n return \"\" + a === \"\" + b;\n case \"[object Number]\":\n // `NaN`s are equivalent, but non-reflexive.\n // Object(NaN) is equivalent to NaN.\n if (+a !== +a) {\n return +b !== +b;\n }\n // An `egal` comparison is performed for other numeric values.\n return +a === 0 ? 1 / +a === 1 / b : +a === +b;\n case \"[object Date]\":\n case \"[object Boolean]\":\n // Coerce dates and booleans to numeric primitive values. Dates are compared by their\n // millisecond representations. Note that invalid dates with millisecond representations\n // of `NaN` are not equivalent.\n return +a === +b;\n case \"[object Symbol]\":\n return typeof Symbol !== \"undefined\" && Symbol.valueOf.call(a) === Symbol.valueOf.call(b);\n case \"[object Map]\":\n case \"[object Set]\":\n // Maps and Sets are unwrapped to arrays of entry-pairs, adding an incidental level.\n // Hide this extra level by increasing the depth.\n if (depth >= 0) {\n depth++;\n }\n break;\n }\n // Unwrap any wrapped objects.\n a = unwrap(a);\n b = unwrap(b);\n var areArrays = className === \"[object Array]\";\n if (!areArrays) {\n if (typeof a != \"object\" || typeof b != \"object\") {\n return false;\n }\n // Objects with different constructors are not equivalent, but `Object`s or `Array`s\n // from different frames are.\n var aCtor = a.constructor,\n bCtor = b.constructor;\n if (aCtor !== bCtor && !(isFunction(aCtor) && aCtor instanceof aCtor && isFunction(bCtor) && bCtor instanceof bCtor) && \"constructor\" in a && \"constructor\" in b) {\n return false;\n }\n }\n if (depth === 0) {\n return false;\n } else if (depth < 0) {\n depth = -1;\n }\n // Assume equality for cyclic structures. The algorithm for detecting cyclic\n // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.\n // Initializing stack of traversed objects.\n // It's done here since we only need them for objects and arrays comparison.\n aStack = aStack || [];\n bStack = bStack || [];\n var length = aStack.length;\n while (length--) {\n // Linear search. Performance is inversely proportional to the number of\n // unique nested structures.\n if (aStack[length] === a) {\n return bStack[length] === b;\n }\n }\n // Add the first object to the stack of traversed objects.\n aStack.push(a);\n bStack.push(b);\n // Recursively compare objects and arrays.\n if (areArrays) {\n // Compare array lengths to determine if a deep comparison is necessary.\n length = a.length;\n if (length !== b.length) {\n return false;\n }\n // Deep compare the contents, ignoring non-numeric properties.\n while (length--) {\n if (!eq(a[length], b[length], depth - 1, aStack, bStack)) {\n return false;\n }\n }\n } else {\n // Deep compare objects.\n var keys = Object.keys(a);\n var key;\n length = keys.length;\n // Ensure that both objects contain the same number of properties before comparing deep equality.\n if (Object.keys(b).length !== length) {\n return false;\n }\n while (length--) {\n // Deep compare each member\n key = keys[length];\n if (!(hasProp(b, key) && eq(a[key], b[key], depth - 1, aStack, bStack))) {\n return false;\n }\n }\n }\n // Remove the first object from the stack of traversed objects.\n aStack.pop();\n bStack.pop();\n return true;\n}\nfunction unwrap(a) {\n if (isObservableArray(a)) {\n return a.slice();\n }\n if (isES6Map(a) || isObservableMap(a)) {\n return Array.from(a.entries());\n }\n if (isES6Set(a) || isObservableSet(a)) {\n return Array.from(a.entries());\n }\n return a;\n}\n\nfunction makeIterable(iterator) {\n iterator[Symbol.iterator] = getSelf;\n return iterator;\n}\nfunction getSelf() {\n return this;\n}\n\nfunction isAnnotation(thing) {\n return (\n // Can be function\n thing instanceof Object && typeof thing.annotationType_ === \"string\" && isFunction(thing.make_) && isFunction(thing.extend_)\n );\n}\n\n/**\n * (c) Michel Weststrate 2015 - 2020\n * MIT Licensed\n *\n * Welcome to the mobx sources! To get a global overview of how MobX internally works,\n * this is a good place to start:\n * https://medium.com/@mweststrate/becoming-fully-reactive-an-in-depth-explanation-of-mobservable-55995262a254#.xvbh6qd74\n *\n * Source folders:\n * ===============\n *\n * - api/ Most of the public static methods exposed by the module can be found here.\n * - core/ Implementation of the MobX algorithm; atoms, derivations, reactions, dependency trees, optimizations. Cool stuff can be found here.\n * - types/ All the magic that is need to have observable objects, arrays and values is in this folder. Including the modifiers like `asFlat`.\n * - utils/ Utility stuff.\n *\n */\n[\"Symbol\", \"Map\", \"Set\"].forEach(function (m) {\n var g = getGlobal();\n if (typeof g[m] === \"undefined\") {\n die(\"MobX requires global '\" + m + \"' to be available or polyfilled\");\n }\n});\nif (typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__ === \"object\") {\n // See: https://github.com/andykog/mobx-devtools/\n __MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({\n spy: spy,\n extras: {\n getDebugName: getDebugName\n },\n $mobx: $mobx\n });\n}\n\n\n//# sourceMappingURL=mobx.esm.js.map\n\n\n//# sourceURL=webpack://app_adyen_SFRA/./node_modules/mobx/dist/mobx.esm.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ $mobx: () => (/* binding */ $mobx),\n/* harmony export */ FlowCancellationError: () => (/* binding */ FlowCancellationError),\n/* harmony export */ ObservableMap: () => (/* binding */ ObservableMap),\n/* harmony export */ ObservableSet: () => (/* binding */ ObservableSet),\n/* harmony export */ Reaction: () => (/* binding */ Reaction),\n/* harmony export */ _allowStateChanges: () => (/* binding */ allowStateChanges),\n/* harmony export */ _allowStateChangesInsideComputed: () => (/* binding */ runInAction),\n/* harmony export */ _allowStateReadsEnd: () => (/* binding */ allowStateReadsEnd),\n/* harmony export */ _allowStateReadsStart: () => (/* binding */ allowStateReadsStart),\n/* harmony export */ _autoAction: () => (/* binding */ autoAction),\n/* harmony export */ _endAction: () => (/* binding */ _endAction),\n/* harmony export */ _getAdministration: () => (/* binding */ getAdministration),\n/* harmony export */ _getGlobalState: () => (/* binding */ getGlobalState),\n/* harmony export */ _interceptReads: () => (/* binding */ interceptReads),\n/* harmony export */ _isComputingDerivation: () => (/* binding */ isComputingDerivation),\n/* harmony export */ _resetGlobalState: () => (/* binding */ resetGlobalState),\n/* harmony export */ _startAction: () => (/* binding */ _startAction),\n/* harmony export */ action: () => (/* binding */ action),\n/* harmony export */ autorun: () => (/* binding */ autorun),\n/* harmony export */ comparer: () => (/* binding */ comparer),\n/* harmony export */ computed: () => (/* binding */ computed),\n/* harmony export */ configure: () => (/* binding */ configure),\n/* harmony export */ createAtom: () => (/* binding */ createAtom),\n/* harmony export */ defineProperty: () => (/* binding */ apiDefineProperty),\n/* harmony export */ entries: () => (/* binding */ entries),\n/* harmony export */ extendObservable: () => (/* binding */ extendObservable),\n/* harmony export */ flow: () => (/* binding */ flow),\n/* harmony export */ flowResult: () => (/* binding */ flowResult),\n/* harmony export */ get: () => (/* binding */ get),\n/* harmony export */ getAtom: () => (/* binding */ getAtom),\n/* harmony export */ getDebugName: () => (/* binding */ getDebugName),\n/* harmony export */ getDependencyTree: () => (/* binding */ getDependencyTree),\n/* harmony export */ getObserverTree: () => (/* binding */ getObserverTree),\n/* harmony export */ has: () => (/* binding */ has),\n/* harmony export */ intercept: () => (/* binding */ intercept),\n/* harmony export */ isAction: () => (/* binding */ isAction),\n/* harmony export */ isBoxedObservable: () => (/* binding */ isObservableValue),\n/* harmony export */ isComputed: () => (/* binding */ isComputed),\n/* harmony export */ isComputedProp: () => (/* binding */ isComputedProp),\n/* harmony export */ isFlow: () => (/* binding */ isFlow),\n/* harmony export */ isFlowCancellationError: () => (/* binding */ isFlowCancellationError),\n/* harmony export */ isObservable: () => (/* binding */ isObservable),\n/* harmony export */ isObservableArray: () => (/* binding */ isObservableArray),\n/* harmony export */ isObservableMap: () => (/* binding */ isObservableMap),\n/* harmony export */ isObservableObject: () => (/* binding */ isObservableObject),\n/* harmony export */ isObservableProp: () => (/* binding */ isObservableProp),\n/* harmony export */ isObservableSet: () => (/* binding */ isObservableSet),\n/* harmony export */ keys: () => (/* binding */ keys),\n/* harmony export */ makeAutoObservable: () => (/* binding */ makeAutoObservable),\n/* harmony export */ makeObservable: () => (/* binding */ makeObservable),\n/* harmony export */ observable: () => (/* binding */ observable),\n/* harmony export */ observe: () => (/* binding */ observe),\n/* harmony export */ onBecomeObserved: () => (/* binding */ onBecomeObserved),\n/* harmony export */ onBecomeUnobserved: () => (/* binding */ onBecomeUnobserved),\n/* harmony export */ onReactionError: () => (/* binding */ onReactionError),\n/* harmony export */ override: () => (/* binding */ override),\n/* harmony export */ ownKeys: () => (/* binding */ apiOwnKeys),\n/* harmony export */ reaction: () => (/* binding */ reaction),\n/* harmony export */ remove: () => (/* binding */ remove),\n/* harmony export */ runInAction: () => (/* binding */ runInAction),\n/* harmony export */ set: () => (/* binding */ set),\n/* harmony export */ spy: () => (/* binding */ spy),\n/* harmony export */ toJS: () => (/* binding */ toJS),\n/* harmony export */ trace: () => (/* binding */ trace),\n/* harmony export */ transaction: () => (/* binding */ transaction),\n/* harmony export */ untracked: () => (/* binding */ untracked),\n/* harmony export */ values: () => (/* binding */ values),\n/* harmony export */ when: () => (/* binding */ when)\n/* harmony export */ });\nvar niceErrors = {\n 0: \"Invalid value for configuration 'enforceActions', expected 'never', 'always' or 'observed'\",\n 1: function _(annotationType, key) {\n return \"Cannot apply '\" + annotationType + \"' to '\" + key.toString() + \"': Field not found.\";\n },\n /*\n 2(prop) {\n return `invalid decorator for '${prop.toString()}'`\n },\n 3(prop) {\n return `Cannot decorate '${prop.toString()}': action can only be used on properties with a function value.`\n },\n 4(prop) {\n return `Cannot decorate '${prop.toString()}': computed can only be used on getter properties.`\n },\n */\n 5: \"'keys()' can only be used on observable objects, arrays, sets and maps\",\n 6: \"'values()' can only be used on observable objects, arrays, sets and maps\",\n 7: \"'entries()' can only be used on observable objects, arrays and maps\",\n 8: \"'set()' can only be used on observable objects, arrays and maps\",\n 9: \"'remove()' can only be used on observable objects, arrays and maps\",\n 10: \"'has()' can only be used on observable objects, arrays and maps\",\n 11: \"'get()' can only be used on observable objects, arrays and maps\",\n 12: \"Invalid annotation\",\n 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)\",\n 14: \"Intercept handlers should return nothing or a change object\",\n 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)\",\n 16: \"Modification exception: the internal structure of an observable array was changed.\",\n 17: function _(index, length) {\n return \"[mobx.array] Index out of bounds, \" + index + \" is larger than \" + length;\n },\n 18: \"mobx.map requires Map polyfill for the current browser. Check babel-polyfill or core-js/es6/map.js\",\n 19: function _(other) {\n return \"Cannot initialize from classes that inherit from Map: \" + other.constructor.name;\n },\n 20: function _(other) {\n return \"Cannot initialize map from \" + other;\n },\n 21: function _(dataStructure) {\n return \"Cannot convert to map from '\" + dataStructure + \"'\";\n },\n 22: \"mobx.set requires Set polyfill for the current browser. Check babel-polyfill or core-js/es6/set.js\",\n 23: \"It is not possible to get index atoms from arrays\",\n 24: function _(thing) {\n return \"Cannot obtain administration from \" + thing;\n },\n 25: function _(property, name) {\n return \"the entry '\" + property + \"' does not exist in the observable map '\" + name + \"'\";\n },\n 26: \"please specify a property\",\n 27: function _(property, name) {\n return \"no observable property '\" + property.toString() + \"' found on the observable object '\" + name + \"'\";\n },\n 28: function _(thing) {\n return \"Cannot obtain atom from \" + thing;\n },\n 29: \"Expecting some object\",\n 30: \"invalid action stack. did you forget to finish an action?\",\n 31: \"missing option for computed: get\",\n 32: function _(name, derivation) {\n return \"Cycle detected in computation \" + name + \": \" + derivation;\n },\n 33: function _(name) {\n return \"The setter of computed value '\" + name + \"' is trying to update itself. Did you intend to update an _observable_ value, instead of the computed property?\";\n },\n 34: function _(name) {\n return \"[ComputedValue '\" + name + \"'] It is not possible to assign a new value to a computed value.\";\n },\n 35: \"There are multiple, different versions of MobX active. Make sure MobX is loaded only once or use `configure({ isolateGlobalState: true })`\",\n 36: \"isolateGlobalState should be called before MobX is running any reactions\",\n 37: function _(method) {\n return \"[mobx] `observableArray.\" + method + \"()` mutates the array in-place, which is not allowed inside a derivation. Use `array.slice().\" + method + \"()` instead\";\n },\n 38: \"'ownKeys()' can only be used on observable objects\",\n 39: \"'defineProperty()' can only be used on observable objects\"\n};\nvar errors = true ? niceErrors : 0;\nfunction die(error) {\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n if (true) {\n var e = typeof error === \"string\" ? error : errors[error];\n if (typeof e === \"function\") e = e.apply(null, args);\n throw new Error(\"[MobX] \" + e);\n }\n throw new Error(typeof error === \"number\" ? \"[MobX] minified error nr: \" + error + (args.length ? \" \" + args.map(String).join(\",\") : \"\") + \". Find the full error at: https://github.com/mobxjs/mobx/blob/main/packages/mobx/src/errors.ts\" : \"[MobX] \" + error);\n}\n\nvar mockGlobal = {};\nfunction getGlobal() {\n if (typeof globalThis !== \"undefined\") {\n return globalThis;\n }\n if (typeof window !== \"undefined\") {\n return window;\n }\n if (typeof __webpack_require__.g !== \"undefined\") {\n return __webpack_require__.g;\n }\n if (typeof self !== \"undefined\") {\n return self;\n }\n return mockGlobal;\n}\n\n// We shorten anything used > 5 times\nvar assign = Object.assign;\nvar getDescriptor = Object.getOwnPropertyDescriptor;\nvar defineProperty = Object.defineProperty;\nvar objectPrototype = Object.prototype;\nvar EMPTY_ARRAY = [];\nObject.freeze(EMPTY_ARRAY);\nvar EMPTY_OBJECT = {};\nObject.freeze(EMPTY_OBJECT);\nvar hasProxy = typeof Proxy !== \"undefined\";\nvar plainObjectString = /*#__PURE__*/Object.toString();\nfunction assertProxies() {\n if (!hasProxy) {\n die( true ? \"`Proxy` objects are not available in the current environment. Please configure MobX to enable a fallback implementation.`\" : 0);\n }\n}\nfunction warnAboutProxyRequirement(msg) {\n if ( true && globalState.verifyProxies) {\n die(\"MobX is currently configured to be able to run in ES5 mode, but in ES5 MobX won't be able to \" + msg);\n }\n}\nfunction getNextId() {\n return ++globalState.mobxGuid;\n}\n/**\n * Makes sure that the provided function is invoked at most once.\n */\nfunction once(func) {\n var invoked = false;\n return function () {\n if (invoked) {\n return;\n }\n invoked = true;\n return func.apply(this, arguments);\n };\n}\nvar noop = function noop() {};\nfunction isFunction(fn) {\n return typeof fn === \"function\";\n}\nfunction isStringish(value) {\n var t = typeof value;\n switch (t) {\n case \"string\":\n case \"symbol\":\n case \"number\":\n return true;\n }\n return false;\n}\nfunction isObject(value) {\n return value !== null && typeof value === \"object\";\n}\nfunction isPlainObject(value) {\n if (!isObject(value)) {\n return false;\n }\n var proto = Object.getPrototypeOf(value);\n if (proto == null) {\n return true;\n }\n var protoConstructor = Object.hasOwnProperty.call(proto, \"constructor\") && proto.constructor;\n return typeof protoConstructor === \"function\" && protoConstructor.toString() === plainObjectString;\n}\n// https://stackoverflow.com/a/37865170\nfunction isGenerator(obj) {\n var constructor = obj == null ? void 0 : obj.constructor;\n if (!constructor) {\n return false;\n }\n if (\"GeneratorFunction\" === constructor.name || \"GeneratorFunction\" === constructor.displayName) {\n return true;\n }\n return false;\n}\nfunction addHiddenProp(object, propName, value) {\n defineProperty(object, propName, {\n enumerable: false,\n writable: true,\n configurable: true,\n value: value\n });\n}\nfunction addHiddenFinalProp(object, propName, value) {\n defineProperty(object, propName, {\n enumerable: false,\n writable: false,\n configurable: true,\n value: value\n });\n}\nfunction createInstanceofPredicate(name, theClass) {\n var propName = \"isMobX\" + name;\n theClass.prototype[propName] = true;\n return function (x) {\n return isObject(x) && x[propName] === true;\n };\n}\n/**\n * Yields true for both native and observable Map, even across different windows.\n */\nfunction isES6Map(thing) {\n return thing != null && Object.prototype.toString.call(thing) === \"[object Map]\";\n}\n/**\n * Makes sure a Map is an instance of non-inherited native or observable Map.\n */\nfunction isPlainES6Map(thing) {\n var mapProto = Object.getPrototypeOf(thing);\n var objectProto = Object.getPrototypeOf(mapProto);\n var nullProto = Object.getPrototypeOf(objectProto);\n return nullProto === null;\n}\n/**\n * Yields true for both native and observable Set, even across different windows.\n */\nfunction isES6Set(thing) {\n return thing != null && Object.prototype.toString.call(thing) === \"[object Set]\";\n}\nvar hasGetOwnPropertySymbols = typeof Object.getOwnPropertySymbols !== \"undefined\";\n/**\n * Returns the following: own enumerable keys and symbols.\n */\nfunction getPlainObjectKeys(object) {\n var keys = Object.keys(object);\n // Not supported in IE, so there are not going to be symbol props anyway...\n if (!hasGetOwnPropertySymbols) {\n return keys;\n }\n var symbols = Object.getOwnPropertySymbols(object);\n if (!symbols.length) {\n return keys;\n }\n return [].concat(keys, symbols.filter(function (s) {\n return objectPrototype.propertyIsEnumerable.call(object, s);\n }));\n}\n// From Immer utils\n// Returns all own keys, including non-enumerable and symbolic\nvar ownKeys = typeof Reflect !== \"undefined\" && Reflect.ownKeys ? Reflect.ownKeys : hasGetOwnPropertySymbols ? function (obj) {\n return Object.getOwnPropertyNames(obj).concat(Object.getOwnPropertySymbols(obj));\n} : /* istanbul ignore next */Object.getOwnPropertyNames;\nfunction stringifyKey(key) {\n if (typeof key === \"string\") {\n return key;\n }\n if (typeof key === \"symbol\") {\n return key.toString();\n }\n return new String(key).toString();\n}\nfunction toPrimitive(value) {\n return value === null ? null : typeof value === \"object\" ? \"\" + value : value;\n}\nfunction hasProp(target, prop) {\n return objectPrototype.hasOwnProperty.call(target, prop);\n}\n// From Immer utils\nvar getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors || function getOwnPropertyDescriptors(target) {\n // Polyfill needed for Hermes and IE, see https://github.com/facebook/hermes/issues/274\n var res = {};\n // Note: without polyfill for ownKeys, symbols won't be picked up\n ownKeys(target).forEach(function (key) {\n res[key] = getDescriptor(target, key);\n });\n return res;\n};\nfunction getFlag(flags, mask) {\n return !!(flags & mask);\n}\nfunction setFlag(flags, mask, newValue) {\n if (newValue) {\n flags |= mask;\n } else {\n flags &= ~mask;\n }\n return flags;\n}\n\nfunction _arrayLikeToArray(r, a) {\n (null == a || a > r.length) && (a = r.length);\n for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];\n return n;\n}\nfunction _defineProperties(e, r) {\n for (var t = 0; t < r.length; t++) {\n var o = r[t];\n o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);\n }\n}\nfunction _createClass(e, r, t) {\n return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", {\n writable: !1\n }), e;\n}\nfunction _createForOfIteratorHelperLoose(r, e) {\n var t = \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"];\n if (t) return (t = t.call(r)).next.bind(t);\n if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && \"number\" == typeof r.length) {\n t && (r = t);\n var o = 0;\n return function () {\n return o >= r.length ? {\n done: !0\n } : {\n done: !1,\n value: r[o++]\n };\n };\n }\n throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\nfunction _extends() {\n return _extends = Object.assign ? Object.assign.bind() : function (n) {\n for (var e = 1; e < arguments.length; e++) {\n var t = arguments[e];\n for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);\n }\n return n;\n }, _extends.apply(null, arguments);\n}\nfunction _inheritsLoose(t, o) {\n t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);\n}\nfunction _setPrototypeOf(t, e) {\n return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {\n return t.__proto__ = e, t;\n }, _setPrototypeOf(t, e);\n}\nfunction _toPrimitive(t, r) {\n if (\"object\" != typeof t || !t) return t;\n var e = t[Symbol.toPrimitive];\n if (void 0 !== e) {\n var i = e.call(t, r || \"default\");\n if (\"object\" != typeof i) return i;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (\"string\" === r ? String : Number)(t);\n}\nfunction _toPropertyKey(t) {\n var i = _toPrimitive(t, \"string\");\n return \"symbol\" == typeof i ? i : i + \"\";\n}\nfunction _unsupportedIterableToArray(r, a) {\n if (r) {\n if (\"string\" == typeof r) return _arrayLikeToArray(r, a);\n var t = {}.toString.call(r).slice(8, -1);\n return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;\n }\n}\n\nvar storedAnnotationsSymbol = /*#__PURE__*/Symbol(\"mobx-stored-annotations\");\n/**\n * Creates a function that acts as\n * - decorator\n * - annotation object\n */\nfunction createDecoratorAnnotation(annotation) {\n function decorator(target, property) {\n if (is20223Decorator(property)) {\n return annotation.decorate_20223_(target, property);\n } else {\n storeAnnotation(target, property, annotation);\n }\n }\n return Object.assign(decorator, annotation);\n}\n/**\n * Stores annotation to prototype,\n * so it can be inspected later by `makeObservable` called from constructor\n */\nfunction storeAnnotation(prototype, key, annotation) {\n if (!hasProp(prototype, storedAnnotationsSymbol)) {\n addHiddenProp(prototype, storedAnnotationsSymbol, _extends({}, prototype[storedAnnotationsSymbol]));\n }\n // @override must override something\n if ( true && isOverride(annotation) && !hasProp(prototype[storedAnnotationsSymbol], key)) {\n var fieldName = prototype.constructor.name + \".prototype.\" + key.toString();\n die(\"'\" + fieldName + \"' is decorated with 'override', \" + \"but no such decorated member was found on prototype.\");\n }\n // Cannot re-decorate\n assertNotDecorated(prototype, annotation, key);\n // Ignore override\n if (!isOverride(annotation)) {\n prototype[storedAnnotationsSymbol][key] = annotation;\n }\n}\nfunction assertNotDecorated(prototype, annotation, key) {\n if ( true && !isOverride(annotation) && hasProp(prototype[storedAnnotationsSymbol], key)) {\n var fieldName = prototype.constructor.name + \".prototype.\" + key.toString();\n var currentAnnotationType = prototype[storedAnnotationsSymbol][key].annotationType_;\n var requestedAnnotationType = annotation.annotationType_;\n die(\"Cannot apply '@\" + requestedAnnotationType + \"' to '\" + fieldName + \"':\" + (\"\\nThe field is already decorated with '@\" + currentAnnotationType + \"'.\") + \"\\nRe-decorating fields is not allowed.\" + \"\\nUse '@override' decorator for methods overridden by subclass.\");\n }\n}\n/**\n * Collects annotations from prototypes and stores them on target (instance)\n */\nfunction collectStoredAnnotations(target) {\n if (!hasProp(target, storedAnnotationsSymbol)) {\n // if (__DEV__ && !target[storedAnnotationsSymbol]) {\n // die(\n // `No annotations were passed to makeObservable, but no decorated members have been found either`\n // )\n // }\n // We need a copy as we will remove annotation from the list once it's applied.\n addHiddenProp(target, storedAnnotationsSymbol, _extends({}, target[storedAnnotationsSymbol]));\n }\n return target[storedAnnotationsSymbol];\n}\nfunction is20223Decorator(context) {\n return typeof context == \"object\" && typeof context[\"kind\"] == \"string\";\n}\nfunction assert20223DecoratorType(context, types) {\n if ( true && !types.includes(context.kind)) {\n die(\"The decorator applied to '\" + String(context.name) + \"' cannot be used on a \" + context.kind + \" element\");\n }\n}\n\nvar $mobx = /*#__PURE__*/Symbol(\"mobx administration\");\nvar Atom = /*#__PURE__*/function () {\n /**\n * Create a new atom. For debugging purposes it is recommended to give it a name.\n * The onBecomeObserved and onBecomeUnobserved callbacks can be used for resource management.\n */\n function Atom(name_) {\n if (name_ === void 0) {\n name_ = true ? \"Atom@\" + getNextId() : 0;\n }\n this.name_ = void 0;\n this.flags_ = 0;\n this.observers_ = new Set();\n this.lastAccessedBy_ = 0;\n this.lowestObserverState_ = IDerivationState_.NOT_TRACKING_;\n // onBecomeObservedListeners\n this.onBOL = void 0;\n // onBecomeUnobservedListeners\n this.onBUOL = void 0;\n this.name_ = name_;\n }\n // for effective unobserving. BaseAtom has true, for extra optimization, so its onBecomeUnobserved never gets called, because it's not needed\n var _proto = Atom.prototype;\n _proto.onBO = function onBO() {\n if (this.onBOL) {\n this.onBOL.forEach(function (listener) {\n return listener();\n });\n }\n };\n _proto.onBUO = function onBUO() {\n if (this.onBUOL) {\n this.onBUOL.forEach(function (listener) {\n return listener();\n });\n }\n }\n /**\n * Invoke this method to notify mobx that your atom has been used somehow.\n * Returns true if there is currently a reactive context.\n */;\n _proto.reportObserved = function reportObserved$1() {\n return reportObserved(this);\n }\n /**\n * Invoke this method _after_ this method has changed to signal mobx that all its observers should invalidate.\n */;\n _proto.reportChanged = function reportChanged() {\n startBatch();\n propagateChanged(this);\n endBatch();\n };\n _proto.toString = function toString() {\n return this.name_;\n };\n return _createClass(Atom, [{\n key: \"isBeingObserved\",\n get: function get() {\n return getFlag(this.flags_, Atom.isBeingObservedMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Atom.isBeingObservedMask_, newValue);\n }\n }, {\n key: \"isPendingUnobservation\",\n get: function get() {\n return getFlag(this.flags_, Atom.isPendingUnobservationMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Atom.isPendingUnobservationMask_, newValue);\n }\n }, {\n key: \"diffValue\",\n get: function get() {\n return getFlag(this.flags_, Atom.diffValueMask_) ? 1 : 0;\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Atom.diffValueMask_, newValue === 1 ? true : false);\n }\n }]);\n}();\nAtom.isBeingObservedMask_ = 1;\nAtom.isPendingUnobservationMask_ = 2;\nAtom.diffValueMask_ = 4;\nvar isAtom = /*#__PURE__*/createInstanceofPredicate(\"Atom\", Atom);\nfunction createAtom(name, onBecomeObservedHandler, onBecomeUnobservedHandler) {\n if (onBecomeObservedHandler === void 0) {\n onBecomeObservedHandler = noop;\n }\n if (onBecomeUnobservedHandler === void 0) {\n onBecomeUnobservedHandler = noop;\n }\n var atom = new Atom(name);\n // default `noop` listener will not initialize the hook Set\n if (onBecomeObservedHandler !== noop) {\n onBecomeObserved(atom, onBecomeObservedHandler);\n }\n if (onBecomeUnobservedHandler !== noop) {\n onBecomeUnobserved(atom, onBecomeUnobservedHandler);\n }\n return atom;\n}\n\nfunction identityComparer(a, b) {\n return a === b;\n}\nfunction structuralComparer(a, b) {\n return deepEqual(a, b);\n}\nfunction shallowComparer(a, b) {\n return deepEqual(a, b, 1);\n}\nfunction defaultComparer(a, b) {\n if (Object.is) {\n return Object.is(a, b);\n }\n return a === b ? a !== 0 || 1 / a === 1 / b : a !== a && b !== b;\n}\nvar comparer = {\n identity: identityComparer,\n structural: structuralComparer,\n \"default\": defaultComparer,\n shallow: shallowComparer\n};\n\nfunction deepEnhancer(v, _, name) {\n // it is an observable already, done\n if (isObservable(v)) {\n return v;\n }\n // something that can be converted and mutated?\n if (Array.isArray(v)) {\n return observable.array(v, {\n name: name\n });\n }\n if (isPlainObject(v)) {\n return observable.object(v, undefined, {\n name: name\n });\n }\n if (isES6Map(v)) {\n return observable.map(v, {\n name: name\n });\n }\n if (isES6Set(v)) {\n return observable.set(v, {\n name: name\n });\n }\n if (typeof v === \"function\" && !isAction(v) && !isFlow(v)) {\n if (isGenerator(v)) {\n return flow(v);\n } else {\n return autoAction(name, v);\n }\n }\n return v;\n}\nfunction shallowEnhancer(v, _, name) {\n if (v === undefined || v === null) {\n return v;\n }\n if (isObservableObject(v) || isObservableArray(v) || isObservableMap(v) || isObservableSet(v)) {\n return v;\n }\n if (Array.isArray(v)) {\n return observable.array(v, {\n name: name,\n deep: false\n });\n }\n if (isPlainObject(v)) {\n return observable.object(v, undefined, {\n name: name,\n deep: false\n });\n }\n if (isES6Map(v)) {\n return observable.map(v, {\n name: name,\n deep: false\n });\n }\n if (isES6Set(v)) {\n return observable.set(v, {\n name: name,\n deep: false\n });\n }\n if (true) {\n die(\"The shallow modifier / decorator can only used in combination with arrays, objects, maps and sets\");\n }\n}\nfunction referenceEnhancer(newValue) {\n // never turn into an observable\n return newValue;\n}\nfunction refStructEnhancer(v, oldValue) {\n if ( true && isObservable(v)) {\n die(\"observable.struct should not be used with observable values\");\n }\n if (deepEqual(v, oldValue)) {\n return oldValue;\n }\n return v;\n}\n\nvar OVERRIDE = \"override\";\nvar override = /*#__PURE__*/createDecoratorAnnotation({\n annotationType_: OVERRIDE,\n make_: make_,\n extend_: extend_,\n decorate_20223_: decorate_20223_\n});\nfunction isOverride(annotation) {\n return annotation.annotationType_ === OVERRIDE;\n}\nfunction make_(adm, key) {\n // Must not be plain object\n if ( true && adm.isPlainObject_) {\n die(\"Cannot apply '\" + this.annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + this.annotationType_ + \"' cannot be used on plain objects.\"));\n }\n // Must override something\n if ( true && !hasProp(adm.appliedAnnotations_, key)) {\n die(\"'\" + adm.name_ + \".\" + key.toString() + \"' is annotated with '\" + this.annotationType_ + \"', \" + \"but no such annotated member was found on prototype.\");\n }\n return 0 /* MakeResult.Cancel */;\n}\nfunction extend_(adm, key, descriptor, proxyTrap) {\n die(\"'\" + this.annotationType_ + \"' can only be used with 'makeObservable'\");\n}\nfunction decorate_20223_(desc, context) {\n console.warn(\"'\" + this.annotationType_ + \"' cannot be used with decorators - this is a no-op\");\n}\n\nfunction createActionAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$1,\n extend_: extend_$1,\n decorate_20223_: decorate_20223_$1\n };\n}\nfunction make_$1(adm, key, descriptor, source) {\n var _this$options_;\n // bound\n if ((_this$options_ = this.options_) != null && _this$options_.bound) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;\n }\n // own\n if (source === adm.target_) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 2 /* MakeResult.Continue */;\n }\n // prototype\n if (isAction(descriptor.value)) {\n // A prototype could have been annotated already by other constructor,\n // rest of the proto chain must be annotated already\n return 1 /* MakeResult.Break */;\n }\n var actionDescriptor = createActionDescriptor(adm, this, key, descriptor, false);\n defineProperty(source, key, actionDescriptor);\n return 2 /* MakeResult.Continue */;\n}\nfunction extend_$1(adm, key, descriptor, proxyTrap) {\n var actionDescriptor = createActionDescriptor(adm, this, key, descriptor);\n return adm.defineProperty_(key, actionDescriptor, proxyTrap);\n}\nfunction decorate_20223_$1(mthd, context) {\n if (true) {\n assert20223DecoratorType(context, [\"method\", \"field\"]);\n }\n var kind = context.kind,\n name = context.name,\n addInitializer = context.addInitializer;\n var ann = this;\n var _createAction = function _createAction(m) {\n var _ann$options_$name, _ann$options_, _ann$options_$autoAct, _ann$options_2;\n return createAction((_ann$options_$name = (_ann$options_ = ann.options_) == null ? void 0 : _ann$options_.name) != null ? _ann$options_$name : name.toString(), m, (_ann$options_$autoAct = (_ann$options_2 = ann.options_) == null ? void 0 : _ann$options_2.autoAction) != null ? _ann$options_$autoAct : false);\n };\n if (kind == \"field\") {\n return function (initMthd) {\n var _ann$options_3;\n var mthd = initMthd;\n if (!isAction(mthd)) {\n mthd = _createAction(mthd);\n }\n if ((_ann$options_3 = ann.options_) != null && _ann$options_3.bound) {\n mthd = mthd.bind(this);\n mthd.isMobxAction = true;\n }\n return mthd;\n };\n }\n if (kind == \"method\") {\n var _this$options_2;\n if (!isAction(mthd)) {\n mthd = _createAction(mthd);\n }\n if ((_this$options_2 = this.options_) != null && _this$options_2.bound) {\n addInitializer(function () {\n var self = this;\n var bound = self[name].bind(self);\n bound.isMobxAction = true;\n self[name] = bound;\n });\n }\n return mthd;\n }\n die(\"Cannot apply '\" + ann.annotationType_ + \"' to '\" + String(name) + \"' (kind: \" + kind + \"):\" + (\"\\n'\" + ann.annotationType_ + \"' can only be used on properties with a function value.\"));\n}\nfunction assertActionDescriptor(adm, _ref, key, _ref2) {\n var annotationType_ = _ref.annotationType_;\n var value = _ref2.value;\n if ( true && !isFunction(value)) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' can only be used on properties with a function value.\"));\n }\n}\nfunction createActionDescriptor(adm, annotation, key, descriptor,\n// provides ability to disable safeDescriptors for prototypes\nsafeDescriptors) {\n var _annotation$options_, _annotation$options_$, _annotation$options_2, _annotation$options_$2, _annotation$options_3, _annotation$options_4, _adm$proxy_2;\n if (safeDescriptors === void 0) {\n safeDescriptors = globalState.safeDescriptors;\n }\n assertActionDescriptor(adm, annotation, key, descriptor);\n var value = descriptor.value;\n if ((_annotation$options_ = annotation.options_) != null && _annotation$options_.bound) {\n var _adm$proxy_;\n value = value.bind((_adm$proxy_ = adm.proxy_) != null ? _adm$proxy_ : adm.target_);\n }\n return {\n value: createAction((_annotation$options_$ = (_annotation$options_2 = annotation.options_) == null ? void 0 : _annotation$options_2.name) != null ? _annotation$options_$ : key.toString(), value, (_annotation$options_$2 = (_annotation$options_3 = annotation.options_) == null ? void 0 : _annotation$options_3.autoAction) != null ? _annotation$options_$2 : false,\n // https://github.com/mobxjs/mobx/discussions/3140\n (_annotation$options_4 = annotation.options_) != null && _annotation$options_4.bound ? (_adm$proxy_2 = adm.proxy_) != null ? _adm$proxy_2 : adm.target_ : undefined),\n // Non-configurable for classes\n // prevents accidental field redefinition in subclass\n configurable: safeDescriptors ? adm.isPlainObject_ : true,\n // https://github.com/mobxjs/mobx/pull/2641#issuecomment-737292058\n enumerable: false,\n // Non-obsevable, therefore non-writable\n // Also prevents rewriting in subclass constructor\n writable: safeDescriptors ? false : true\n };\n}\n\nfunction createFlowAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$2,\n extend_: extend_$2,\n decorate_20223_: decorate_20223_$2\n };\n}\nfunction make_$2(adm, key, descriptor, source) {\n var _this$options_;\n // own\n if (source === adm.target_) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 2 /* MakeResult.Continue */;\n }\n // prototype\n // bound - must annotate protos to support super.flow()\n if ((_this$options_ = this.options_) != null && _this$options_.bound && (!hasProp(adm.target_, key) || !isFlow(adm.target_[key]))) {\n if (this.extend_(adm, key, descriptor, false) === null) {\n return 0 /* MakeResult.Cancel */;\n }\n }\n if (isFlow(descriptor.value)) {\n // A prototype could have been annotated already by other constructor,\n // rest of the proto chain must be annotated already\n return 1 /* MakeResult.Break */;\n }\n var flowDescriptor = createFlowDescriptor(adm, this, key, descriptor, false, false);\n defineProperty(source, key, flowDescriptor);\n return 2 /* MakeResult.Continue */;\n}\nfunction extend_$2(adm, key, descriptor, proxyTrap) {\n var _this$options_2;\n var flowDescriptor = createFlowDescriptor(adm, this, key, descriptor, (_this$options_2 = this.options_) == null ? void 0 : _this$options_2.bound);\n return adm.defineProperty_(key, flowDescriptor, proxyTrap);\n}\nfunction decorate_20223_$2(mthd, context) {\n var _this$options_3;\n if (true) {\n assert20223DecoratorType(context, [\"method\"]);\n }\n var name = context.name,\n addInitializer = context.addInitializer;\n if (!isFlow(mthd)) {\n mthd = flow(mthd);\n }\n if ((_this$options_3 = this.options_) != null && _this$options_3.bound) {\n addInitializer(function () {\n var self = this;\n var bound = self[name].bind(self);\n bound.isMobXFlow = true;\n self[name] = bound;\n });\n }\n return mthd;\n}\nfunction assertFlowDescriptor(adm, _ref, key, _ref2) {\n var annotationType_ = _ref.annotationType_;\n var value = _ref2.value;\n if ( true && !isFunction(value)) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' can only be used on properties with a generator function value.\"));\n }\n}\nfunction createFlowDescriptor(adm, annotation, key, descriptor, bound,\n// provides ability to disable safeDescriptors for prototypes\nsafeDescriptors) {\n if (safeDescriptors === void 0) {\n safeDescriptors = globalState.safeDescriptors;\n }\n assertFlowDescriptor(adm, annotation, key, descriptor);\n var value = descriptor.value;\n // In case of flow.bound, the descriptor can be from already annotated prototype\n if (!isFlow(value)) {\n value = flow(value);\n }\n if (bound) {\n var _adm$proxy_;\n // We do not keep original function around, so we bind the existing flow\n value = value.bind((_adm$proxy_ = adm.proxy_) != null ? _adm$proxy_ : adm.target_);\n // This is normally set by `flow`, but `bind` returns new function...\n value.isMobXFlow = true;\n }\n return {\n value: value,\n // Non-configurable for classes\n // prevents accidental field redefinition in subclass\n configurable: safeDescriptors ? adm.isPlainObject_ : true,\n // https://github.com/mobxjs/mobx/pull/2641#issuecomment-737292058\n enumerable: false,\n // Non-obsevable, therefore non-writable\n // Also prevents rewriting in subclass constructor\n writable: safeDescriptors ? false : true\n };\n}\n\nfunction createComputedAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$3,\n extend_: extend_$3,\n decorate_20223_: decorate_20223_$3\n };\n}\nfunction make_$3(adm, key, descriptor) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;\n}\nfunction extend_$3(adm, key, descriptor, proxyTrap) {\n assertComputedDescriptor(adm, this, key, descriptor);\n return adm.defineComputedProperty_(key, _extends({}, this.options_, {\n get: descriptor.get,\n set: descriptor.set\n }), proxyTrap);\n}\nfunction decorate_20223_$3(get, context) {\n if (true) {\n assert20223DecoratorType(context, [\"getter\"]);\n }\n var ann = this;\n var key = context.name,\n addInitializer = context.addInitializer;\n addInitializer(function () {\n var adm = asObservableObject(this)[$mobx];\n var options = _extends({}, ann.options_, {\n get: get,\n context: this\n });\n options.name || (options.name = true ? adm.name_ + \".\" + key.toString() : 0);\n adm.values_.set(key, new ComputedValue(options));\n });\n return function () {\n return this[$mobx].getObservablePropValue_(key);\n };\n}\nfunction assertComputedDescriptor(adm, _ref, key, _ref2) {\n var annotationType_ = _ref.annotationType_;\n var get = _ref2.get;\n if ( true && !get) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' can only be used on getter(+setter) properties.\"));\n }\n}\n\nfunction createObservableAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$4,\n extend_: extend_$4,\n decorate_20223_: decorate_20223_$4\n };\n}\nfunction make_$4(adm, key, descriptor) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;\n}\nfunction extend_$4(adm, key, descriptor, proxyTrap) {\n var _this$options_$enhanc, _this$options_;\n assertObservableDescriptor(adm, this, key, descriptor);\n return adm.defineObservableProperty_(key, descriptor.value, (_this$options_$enhanc = (_this$options_ = this.options_) == null ? void 0 : _this$options_.enhancer) != null ? _this$options_$enhanc : deepEnhancer, proxyTrap);\n}\nfunction decorate_20223_$4(desc, context) {\n if (true) {\n if (context.kind === \"field\") {\n throw die(\"Please use `@observable accessor \" + String(context.name) + \"` instead of `@observable \" + String(context.name) + \"`\");\n }\n assert20223DecoratorType(context, [\"accessor\"]);\n }\n var ann = this;\n var kind = context.kind,\n name = context.name;\n // The laziness here is not ideal... It's a workaround to how 2022.3 Decorators are implemented:\n // `addInitializer` callbacks are executed _before_ any accessors are defined (instead of the ideal-for-us right after each).\n // This means that, if we were to do our stuff in an `addInitializer`, we'd attempt to read a private slot\n // before it has been initialized. The runtime doesn't like that and throws a `Cannot read private member\n // from an object whose class did not declare it` error.\n // TODO: it seems that this will not be required anymore in the final version of the spec\n // See TODO: link\n var initializedObjects = new WeakSet();\n function initializeObservable(target, value) {\n var _ann$options_$enhance, _ann$options_;\n var adm = asObservableObject(target)[$mobx];\n var observable = new ObservableValue(value, (_ann$options_$enhance = (_ann$options_ = ann.options_) == null ? void 0 : _ann$options_.enhancer) != null ? _ann$options_$enhance : deepEnhancer, true ? adm.name_ + \".\" + name.toString() : 0, false);\n adm.values_.set(name, observable);\n initializedObjects.add(target);\n }\n if (kind == \"accessor\") {\n return {\n get: function get() {\n if (!initializedObjects.has(this)) {\n initializeObservable(this, desc.get.call(this));\n }\n return this[$mobx].getObservablePropValue_(name);\n },\n set: function set(value) {\n if (!initializedObjects.has(this)) {\n initializeObservable(this, value);\n }\n return this[$mobx].setObservablePropValue_(name, value);\n },\n init: function init(value) {\n if (!initializedObjects.has(this)) {\n initializeObservable(this, value);\n }\n return value;\n }\n };\n }\n return;\n}\nfunction assertObservableDescriptor(adm, _ref, key, descriptor) {\n var annotationType_ = _ref.annotationType_;\n if ( true && !(\"value\" in descriptor)) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' cannot be used on getter/setter properties\"));\n }\n}\n\nvar AUTO = \"true\";\nvar autoAnnotation = /*#__PURE__*/createAutoAnnotation();\nfunction createAutoAnnotation(options) {\n return {\n annotationType_: AUTO,\n options_: options,\n make_: make_$5,\n extend_: extend_$5,\n decorate_20223_: decorate_20223_$5\n };\n}\nfunction make_$5(adm, key, descriptor, source) {\n var _this$options_3, _this$options_4;\n // getter -> computed\n if (descriptor.get) {\n return computed.make_(adm, key, descriptor, source);\n }\n // lone setter -> action setter\n if (descriptor.set) {\n // TODO make action applicable to setter and delegate to action.make_\n var set = createAction(key.toString(), descriptor.set);\n // own\n if (source === adm.target_) {\n return adm.defineProperty_(key, {\n configurable: globalState.safeDescriptors ? adm.isPlainObject_ : true,\n set: set\n }) === null ? 0 /* MakeResult.Cancel */ : 2 /* MakeResult.Continue */;\n }\n // proto\n defineProperty(source, key, {\n configurable: true,\n set: set\n });\n return 2 /* MakeResult.Continue */;\n }\n // function on proto -> autoAction/flow\n if (source !== adm.target_ && typeof descriptor.value === \"function\") {\n var _this$options_2;\n if (isGenerator(descriptor.value)) {\n var _this$options_;\n var flowAnnotation = (_this$options_ = this.options_) != null && _this$options_.autoBind ? flow.bound : flow;\n return flowAnnotation.make_(adm, key, descriptor, source);\n }\n var actionAnnotation = (_this$options_2 = this.options_) != null && _this$options_2.autoBind ? autoAction.bound : autoAction;\n return actionAnnotation.make_(adm, key, descriptor, source);\n }\n // other -> observable\n // Copy props from proto as well, see test:\n // \"decorate should work with Object.create\"\n var observableAnnotation = ((_this$options_3 = this.options_) == null ? void 0 : _this$options_3.deep) === false ? observable.ref : observable;\n // if function respect autoBind option\n if (typeof descriptor.value === \"function\" && (_this$options_4 = this.options_) != null && _this$options_4.autoBind) {\n var _adm$proxy_;\n descriptor.value = descriptor.value.bind((_adm$proxy_ = adm.proxy_) != null ? _adm$proxy_ : adm.target_);\n }\n return observableAnnotation.make_(adm, key, descriptor, source);\n}\nfunction extend_$5(adm, key, descriptor, proxyTrap) {\n var _this$options_5, _this$options_6;\n // getter -> computed\n if (descriptor.get) {\n return computed.extend_(adm, key, descriptor, proxyTrap);\n }\n // lone setter -> action setter\n if (descriptor.set) {\n // TODO make action applicable to setter and delegate to action.extend_\n return adm.defineProperty_(key, {\n configurable: globalState.safeDescriptors ? adm.isPlainObject_ : true,\n set: createAction(key.toString(), descriptor.set)\n }, proxyTrap);\n }\n // other -> observable\n // if function respect autoBind option\n if (typeof descriptor.value === \"function\" && (_this$options_5 = this.options_) != null && _this$options_5.autoBind) {\n var _adm$proxy_2;\n descriptor.value = descriptor.value.bind((_adm$proxy_2 = adm.proxy_) != null ? _adm$proxy_2 : adm.target_);\n }\n var observableAnnotation = ((_this$options_6 = this.options_) == null ? void 0 : _this$options_6.deep) === false ? observable.ref : observable;\n return observableAnnotation.extend_(adm, key, descriptor, proxyTrap);\n}\nfunction decorate_20223_$5(desc, context) {\n die(\"'\" + this.annotationType_ + \"' cannot be used as a decorator\");\n}\n\nvar OBSERVABLE = \"observable\";\nvar OBSERVABLE_REF = \"observable.ref\";\nvar OBSERVABLE_SHALLOW = \"observable.shallow\";\nvar OBSERVABLE_STRUCT = \"observable.struct\";\n// Predefined bags of create observable options, to avoid allocating temporarily option objects\n// in the majority of cases\nvar defaultCreateObservableOptions = {\n deep: true,\n name: undefined,\n defaultDecorator: undefined,\n proxy: true\n};\nObject.freeze(defaultCreateObservableOptions);\nfunction asCreateObservableOptions(thing) {\n return thing || defaultCreateObservableOptions;\n}\nvar observableAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE);\nvar observableRefAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE_REF, {\n enhancer: referenceEnhancer\n});\nvar observableShallowAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE_SHALLOW, {\n enhancer: shallowEnhancer\n});\nvar observableStructAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE_STRUCT, {\n enhancer: refStructEnhancer\n});\nvar observableDecoratorAnnotation = /*#__PURE__*/createDecoratorAnnotation(observableAnnotation);\nfunction getEnhancerFromOptions(options) {\n return options.deep === true ? deepEnhancer : options.deep === false ? referenceEnhancer : getEnhancerFromAnnotation(options.defaultDecorator);\n}\nfunction getAnnotationFromOptions(options) {\n var _options$defaultDecor;\n return options ? (_options$defaultDecor = options.defaultDecorator) != null ? _options$defaultDecor : createAutoAnnotation(options) : undefined;\n}\nfunction getEnhancerFromAnnotation(annotation) {\n var _annotation$options_$, _annotation$options_;\n return !annotation ? deepEnhancer : (_annotation$options_$ = (_annotation$options_ = annotation.options_) == null ? void 0 : _annotation$options_.enhancer) != null ? _annotation$options_$ : deepEnhancer;\n}\n/**\n * Turns an object, array or function into a reactive structure.\n * @param v the value which should become observable.\n */\nfunction createObservable(v, arg2, arg3) {\n // @observable someProp; (2022.3 Decorators)\n if (is20223Decorator(arg2)) {\n return observableAnnotation.decorate_20223_(v, arg2);\n }\n // @observable someProp;\n if (isStringish(arg2)) {\n storeAnnotation(v, arg2, observableAnnotation);\n return;\n }\n // already observable - ignore\n if (isObservable(v)) {\n return v;\n }\n // plain object\n if (isPlainObject(v)) {\n return observable.object(v, arg2, arg3);\n }\n // Array\n if (Array.isArray(v)) {\n return observable.array(v, arg2);\n }\n // Map\n if (isES6Map(v)) {\n return observable.map(v, arg2);\n }\n // Set\n if (isES6Set(v)) {\n return observable.set(v, arg2);\n }\n // other object - ignore\n if (typeof v === \"object\" && v !== null) {\n return v;\n }\n // anything else\n return observable.box(v, arg2);\n}\nassign(createObservable, observableDecoratorAnnotation);\nvar observableFactories = {\n box: function box(value, options) {\n var o = asCreateObservableOptions(options);\n return new ObservableValue(value, getEnhancerFromOptions(o), o.name, true, o.equals);\n },\n array: function array(initialValues, options) {\n var o = asCreateObservableOptions(options);\n return (globalState.useProxies === false || o.proxy === false ? createLegacyArray : createObservableArray)(initialValues, getEnhancerFromOptions(o), o.name);\n },\n map: function map(initialValues, options) {\n var o = asCreateObservableOptions(options);\n return new ObservableMap(initialValues, getEnhancerFromOptions(o), o.name);\n },\n set: function set(initialValues, options) {\n var o = asCreateObservableOptions(options);\n return new ObservableSet(initialValues, getEnhancerFromOptions(o), o.name);\n },\n object: function object(props, decorators, options) {\n return initObservable(function () {\n return extendObservable(globalState.useProxies === false || (options == null ? void 0 : options.proxy) === false ? asObservableObject({}, options) : asDynamicObservableObject({}, options), props, decorators);\n });\n },\n ref: /*#__PURE__*/createDecoratorAnnotation(observableRefAnnotation),\n shallow: /*#__PURE__*/createDecoratorAnnotation(observableShallowAnnotation),\n deep: observableDecoratorAnnotation,\n struct: /*#__PURE__*/createDecoratorAnnotation(observableStructAnnotation)\n};\n// eslint-disable-next-line\nvar observable = /*#__PURE__*/assign(createObservable, observableFactories);\n\nvar COMPUTED = \"computed\";\nvar COMPUTED_STRUCT = \"computed.struct\";\nvar computedAnnotation = /*#__PURE__*/createComputedAnnotation(COMPUTED);\nvar computedStructAnnotation = /*#__PURE__*/createComputedAnnotation(COMPUTED_STRUCT, {\n equals: comparer.structural\n});\n/**\n * Decorator for class properties: @computed get value() { return expr; }.\n * For legacy purposes also invokable as ES5 observable created: `computed(() => expr)`;\n */\nvar computed = function computed(arg1, arg2) {\n if (is20223Decorator(arg2)) {\n // @computed (2022.3 Decorators)\n return computedAnnotation.decorate_20223_(arg1, arg2);\n }\n if (isStringish(arg2)) {\n // @computed\n return storeAnnotation(arg1, arg2, computedAnnotation);\n }\n if (isPlainObject(arg1)) {\n // @computed({ options })\n return createDecoratorAnnotation(createComputedAnnotation(COMPUTED, arg1));\n }\n // computed(expr, options?)\n if (true) {\n if (!isFunction(arg1)) {\n die(\"First argument to `computed` should be an expression.\");\n }\n if (isFunction(arg2)) {\n die(\"A setter as second argument is no longer supported, use `{ set: fn }` option instead\");\n }\n }\n var opts = isPlainObject(arg2) ? arg2 : {};\n opts.get = arg1;\n opts.name || (opts.name = arg1.name || \"\"); /* for generated name */\n return new ComputedValue(opts);\n};\nObject.assign(computed, computedAnnotation);\ncomputed.struct = /*#__PURE__*/createDecoratorAnnotation(computedStructAnnotation);\n\nvar _getDescriptor$config, _getDescriptor;\n// we don't use globalState for these in order to avoid possible issues with multiple\n// mobx versions\nvar currentActionId = 0;\nvar nextActionId = 1;\nvar isFunctionNameConfigurable = (_getDescriptor$config = (_getDescriptor = /*#__PURE__*/getDescriptor(function () {}, \"name\")) == null ? void 0 : _getDescriptor.configurable) != null ? _getDescriptor$config : false;\n// we can safely recycle this object\nvar tmpNameDescriptor = {\n value: \"action\",\n configurable: true,\n writable: false,\n enumerable: false\n};\nfunction createAction(actionName, fn, autoAction, ref) {\n if (autoAction === void 0) {\n autoAction = false;\n }\n if (true) {\n if (!isFunction(fn)) {\n die(\"`action` can only be invoked on functions\");\n }\n if (typeof actionName !== \"string\" || !actionName) {\n die(\"actions should have valid names, got: '\" + actionName + \"'\");\n }\n }\n function res() {\n return executeAction(actionName, autoAction, fn, ref || this, arguments);\n }\n res.isMobxAction = true;\n res.toString = function () {\n return fn.toString();\n };\n if (isFunctionNameConfigurable) {\n tmpNameDescriptor.value = actionName;\n defineProperty(res, \"name\", tmpNameDescriptor);\n }\n return res;\n}\nfunction executeAction(actionName, canRunAsDerivation, fn, scope, args) {\n var runInfo = _startAction(actionName, canRunAsDerivation, scope, args);\n try {\n return fn.apply(scope, args);\n } catch (err) {\n runInfo.error_ = err;\n throw err;\n } finally {\n _endAction(runInfo);\n }\n}\nfunction _startAction(actionName, canRunAsDerivation,\n// true for autoAction\nscope, args) {\n var notifySpy_ = true && isSpyEnabled() && !!actionName;\n var startTime_ = 0;\n if ( true && notifySpy_) {\n startTime_ = Date.now();\n var flattenedArgs = args ? Array.from(args) : EMPTY_ARRAY;\n spyReportStart({\n type: ACTION,\n name: actionName,\n object: scope,\n arguments: flattenedArgs\n });\n }\n var prevDerivation_ = globalState.trackingDerivation;\n var runAsAction = !canRunAsDerivation || !prevDerivation_;\n startBatch();\n var prevAllowStateChanges_ = globalState.allowStateChanges; // by default preserve previous allow\n if (runAsAction) {\n untrackedStart();\n prevAllowStateChanges_ = allowStateChangesStart(true);\n }\n var prevAllowStateReads_ = allowStateReadsStart(true);\n var runInfo = {\n runAsAction_: runAsAction,\n prevDerivation_: prevDerivation_,\n prevAllowStateChanges_: prevAllowStateChanges_,\n prevAllowStateReads_: prevAllowStateReads_,\n notifySpy_: notifySpy_,\n startTime_: startTime_,\n actionId_: nextActionId++,\n parentActionId_: currentActionId\n };\n currentActionId = runInfo.actionId_;\n return runInfo;\n}\nfunction _endAction(runInfo) {\n if (currentActionId !== runInfo.actionId_) {\n die(30);\n }\n currentActionId = runInfo.parentActionId_;\n if (runInfo.error_ !== undefined) {\n globalState.suppressReactionErrors = true;\n }\n allowStateChangesEnd(runInfo.prevAllowStateChanges_);\n allowStateReadsEnd(runInfo.prevAllowStateReads_);\n endBatch();\n if (runInfo.runAsAction_) {\n untrackedEnd(runInfo.prevDerivation_);\n }\n if ( true && runInfo.notifySpy_) {\n spyReportEnd({\n time: Date.now() - runInfo.startTime_\n });\n }\n globalState.suppressReactionErrors = false;\n}\nfunction allowStateChanges(allowStateChanges, func) {\n var prev = allowStateChangesStart(allowStateChanges);\n try {\n return func();\n } finally {\n allowStateChangesEnd(prev);\n }\n}\nfunction allowStateChangesStart(allowStateChanges) {\n var prev = globalState.allowStateChanges;\n globalState.allowStateChanges = allowStateChanges;\n return prev;\n}\nfunction allowStateChangesEnd(prev) {\n globalState.allowStateChanges = prev;\n}\n\nvar CREATE = \"create\";\nvar ObservableValue = /*#__PURE__*/function (_Atom) {\n function ObservableValue(value, enhancer, name_, notifySpy, equals) {\n var _this;\n if (name_ === void 0) {\n name_ = true ? \"ObservableValue@\" + getNextId() : 0;\n }\n if (notifySpy === void 0) {\n notifySpy = true;\n }\n if (equals === void 0) {\n equals = comparer[\"default\"];\n }\n _this = _Atom.call(this, name_) || this;\n _this.enhancer = void 0;\n _this.name_ = void 0;\n _this.equals = void 0;\n _this.hasUnreportedChange_ = false;\n _this.interceptors_ = void 0;\n _this.changeListeners_ = void 0;\n _this.value_ = void 0;\n _this.dehancer = void 0;\n _this.enhancer = enhancer;\n _this.name_ = name_;\n _this.equals = equals;\n _this.value_ = enhancer(value, undefined, name_);\n if ( true && notifySpy && isSpyEnabled()) {\n // only notify spy if this is a stand-alone observable\n spyReport({\n type: CREATE,\n object: _this,\n observableKind: \"value\",\n debugObjectName: _this.name_,\n newValue: \"\" + _this.value_\n });\n }\n return _this;\n }\n _inheritsLoose(ObservableValue, _Atom);\n var _proto = ObservableValue.prototype;\n _proto.dehanceValue = function dehanceValue(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.set = function set(newValue) {\n var oldValue = this.value_;\n newValue = this.prepareNewValue_(newValue);\n if (newValue !== globalState.UNCHANGED) {\n var notifySpy = isSpyEnabled();\n if ( true && notifySpy) {\n spyReportStart({\n type: UPDATE,\n object: this,\n observableKind: \"value\",\n debugObjectName: this.name_,\n newValue: newValue,\n oldValue: oldValue\n });\n }\n this.setNewValue_(newValue);\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n };\n _proto.prepareNewValue_ = function prepareNewValue_(newValue) {\n checkIfStateModificationsAreAllowed(this);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this,\n type: UPDATE,\n newValue: newValue\n });\n if (!change) {\n return globalState.UNCHANGED;\n }\n newValue = change.newValue;\n }\n // apply modifier\n newValue = this.enhancer(newValue, this.value_, this.name_);\n return this.equals(this.value_, newValue) ? globalState.UNCHANGED : newValue;\n };\n _proto.setNewValue_ = function setNewValue_(newValue) {\n var oldValue = this.value_;\n this.value_ = newValue;\n this.reportChanged();\n if (hasListeners(this)) {\n notifyListeners(this, {\n type: UPDATE,\n object: this,\n newValue: newValue,\n oldValue: oldValue\n });\n }\n };\n _proto.get = function get() {\n this.reportObserved();\n return this.dehanceValue(this.value_);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n if (fireImmediately) {\n listener({\n observableKind: \"value\",\n debugObjectName: this.name_,\n object: this,\n type: UPDATE,\n newValue: this.value_,\n oldValue: undefined\n });\n }\n return registerListener(this, listener);\n };\n _proto.raw = function raw() {\n // used by MST ot get undehanced value\n return this.value_;\n };\n _proto.toJSON = function toJSON() {\n return this.get();\n };\n _proto.toString = function toString() {\n return this.name_ + \"[\" + this.value_ + \"]\";\n };\n _proto.valueOf = function valueOf() {\n return toPrimitive(this.get());\n };\n _proto[Symbol.toPrimitive] = function () {\n return this.valueOf();\n };\n return ObservableValue;\n}(Atom);\nvar isObservableValue = /*#__PURE__*/createInstanceofPredicate(\"ObservableValue\", ObservableValue);\n\n/**\n * A node in the state dependency root that observes other nodes, and can be observed itself.\n *\n * ComputedValue will remember the result of the computation for the duration of the batch, or\n * while being observed.\n *\n * During this time it will recompute only when one of its direct dependencies changed,\n * but only when it is being accessed with `ComputedValue.get()`.\n *\n * Implementation description:\n * 1. First time it's being accessed it will compute and remember result\n * give back remembered result until 2. happens\n * 2. First time any deep dependency change, propagate POSSIBLY_STALE to all observers, wait for 3.\n * 3. When it's being accessed, recompute if any shallow dependency changed.\n * if result changed: propagate STALE to all observers, that were POSSIBLY_STALE from the last step.\n * go to step 2. either way\n *\n * If at any point it's outside batch and it isn't observed: reset everything and go to 1.\n */\nvar ComputedValue = /*#__PURE__*/function () {\n /**\n * Create a new computed value based on a function expression.\n *\n * The `name` property is for debug purposes only.\n *\n * The `equals` property specifies the comparer function to use to determine if a newly produced\n * value differs from the previous value. Two comparers are provided in the library; `defaultComparer`\n * compares based on identity comparison (===), and `structuralComparer` deeply compares the structure.\n * Structural comparison can be convenient if you always produce a new aggregated object and\n * don't want to notify observers if it is structurally the same.\n * This is useful for working with vectors, mouse coordinates etc.\n */\n function ComputedValue(options) {\n this.dependenciesState_ = IDerivationState_.NOT_TRACKING_;\n this.observing_ = [];\n // nodes we are looking at. Our value depends on these nodes\n this.newObserving_ = null;\n // during tracking it's an array with new observed observers\n this.observers_ = new Set();\n this.runId_ = 0;\n this.lastAccessedBy_ = 0;\n this.lowestObserverState_ = IDerivationState_.UP_TO_DATE_;\n this.unboundDepsCount_ = 0;\n this.value_ = new CaughtException(null);\n this.name_ = void 0;\n this.triggeredBy_ = void 0;\n this.flags_ = 0;\n this.derivation = void 0;\n // N.B: unminified as it is used by MST\n this.setter_ = void 0;\n this.isTracing_ = TraceMode.NONE;\n this.scope_ = void 0;\n this.equals_ = void 0;\n this.requiresReaction_ = void 0;\n this.keepAlive_ = void 0;\n this.onBOL = void 0;\n this.onBUOL = void 0;\n if (!options.get) {\n die(31);\n }\n this.derivation = options.get;\n this.name_ = options.name || ( true ? \"ComputedValue@\" + getNextId() : 0);\n if (options.set) {\n this.setter_ = createAction( true ? this.name_ + \"-setter\" : 0, options.set);\n }\n this.equals_ = options.equals || (options.compareStructural || options.struct ? comparer.structural : comparer[\"default\"]);\n this.scope_ = options.context;\n this.requiresReaction_ = options.requiresReaction;\n this.keepAlive_ = !!options.keepAlive;\n }\n var _proto = ComputedValue.prototype;\n _proto.onBecomeStale_ = function onBecomeStale_() {\n propagateMaybeChanged(this);\n };\n _proto.onBO = function onBO() {\n if (this.onBOL) {\n this.onBOL.forEach(function (listener) {\n return listener();\n });\n }\n };\n _proto.onBUO = function onBUO() {\n if (this.onBUOL) {\n this.onBUOL.forEach(function (listener) {\n return listener();\n });\n }\n }\n // to check for cycles\n ;\n /**\n * Returns the current value of this computed value.\n * Will evaluate its computation first if needed.\n */\n _proto.get = function get() {\n if (this.isComputing) {\n die(32, this.name_, this.derivation);\n }\n if (globalState.inBatch === 0 &&\n // !globalState.trackingDerivatpion &&\n this.observers_.size === 0 && !this.keepAlive_) {\n if (shouldCompute(this)) {\n this.warnAboutUntrackedRead_();\n startBatch(); // See perf test 'computed memoization'\n this.value_ = this.computeValue_(false);\n endBatch();\n }\n } else {\n reportObserved(this);\n if (shouldCompute(this)) {\n var prevTrackingContext = globalState.trackingContext;\n if (this.keepAlive_ && !prevTrackingContext) {\n globalState.trackingContext = this;\n }\n if (this.trackAndCompute()) {\n propagateChangeConfirmed(this);\n }\n globalState.trackingContext = prevTrackingContext;\n }\n }\n var result = this.value_;\n if (isCaughtException(result)) {\n throw result.cause;\n }\n return result;\n };\n _proto.set = function set(value) {\n if (this.setter_) {\n if (this.isRunningSetter) {\n die(33, this.name_);\n }\n this.isRunningSetter = true;\n try {\n this.setter_.call(this.scope_, value);\n } finally {\n this.isRunningSetter = false;\n }\n } else {\n die(34, this.name_);\n }\n };\n _proto.trackAndCompute = function trackAndCompute() {\n // N.B: unminified as it is used by MST\n var oldValue = this.value_;\n var wasSuspended = /* see #1208 */this.dependenciesState_ === IDerivationState_.NOT_TRACKING_;\n var newValue = this.computeValue_(true);\n var changed = wasSuspended || isCaughtException(oldValue) || isCaughtException(newValue) || !this.equals_(oldValue, newValue);\n if (changed) {\n this.value_ = newValue;\n if ( true && isSpyEnabled()) {\n spyReport({\n observableKind: \"computed\",\n debugObjectName: this.name_,\n object: this.scope_,\n type: \"update\",\n oldValue: oldValue,\n newValue: newValue\n });\n }\n }\n return changed;\n };\n _proto.computeValue_ = function computeValue_(track) {\n this.isComputing = true;\n // don't allow state changes during computation\n var prev = allowStateChangesStart(false);\n var res;\n if (track) {\n res = trackDerivedFunction(this, this.derivation, this.scope_);\n } else {\n if (globalState.disableErrorBoundaries === true) {\n res = this.derivation.call(this.scope_);\n } else {\n try {\n res = this.derivation.call(this.scope_);\n } catch (e) {\n res = new CaughtException(e);\n }\n }\n }\n allowStateChangesEnd(prev);\n this.isComputing = false;\n return res;\n };\n _proto.suspend_ = function suspend_() {\n if (!this.keepAlive_) {\n clearObserving(this);\n this.value_ = undefined; // don't hold on to computed value!\n if ( true && this.isTracing_ !== TraceMode.NONE) {\n console.log(\"[mobx.trace] Computed value '\" + this.name_ + \"' was suspended and it will recompute on the next access.\");\n }\n }\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n var _this = this;\n var firstTime = true;\n var prevValue = undefined;\n return autorun(function () {\n // TODO: why is this in a different place than the spyReport() function? in all other observables it's called in the same place\n var newValue = _this.get();\n if (!firstTime || fireImmediately) {\n var prevU = untrackedStart();\n listener({\n observableKind: \"computed\",\n debugObjectName: _this.name_,\n type: UPDATE,\n object: _this,\n newValue: newValue,\n oldValue: prevValue\n });\n untrackedEnd(prevU);\n }\n firstTime = false;\n prevValue = newValue;\n });\n };\n _proto.warnAboutUntrackedRead_ = function warnAboutUntrackedRead_() {\n if (false) {}\n if (this.isTracing_ !== TraceMode.NONE) {\n console.log(\"[mobx.trace] Computed value '\" + this.name_ + \"' is being read outside a reactive context. Doing a full recompute.\");\n }\n if (typeof this.requiresReaction_ === \"boolean\" ? this.requiresReaction_ : globalState.computedRequiresReaction) {\n console.warn(\"[mobx] Computed value '\" + this.name_ + \"' is being read outside a reactive context. Doing a full recompute.\");\n }\n };\n _proto.toString = function toString() {\n return this.name_ + \"[\" + this.derivation.toString() + \"]\";\n };\n _proto.valueOf = function valueOf() {\n return toPrimitive(this.get());\n };\n _proto[Symbol.toPrimitive] = function () {\n return this.valueOf();\n };\n return _createClass(ComputedValue, [{\n key: \"isComputing\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isComputingMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isComputingMask_, newValue);\n }\n }, {\n key: \"isRunningSetter\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isRunningSetterMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isRunningSetterMask_, newValue);\n }\n }, {\n key: \"isBeingObserved\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isBeingObservedMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isBeingObservedMask_, newValue);\n }\n }, {\n key: \"isPendingUnobservation\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isPendingUnobservationMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isPendingUnobservationMask_, newValue);\n }\n }, {\n key: \"diffValue\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.diffValueMask_) ? 1 : 0;\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.diffValueMask_, newValue === 1 ? true : false);\n }\n }]);\n}();\nComputedValue.isComputingMask_ = 1;\nComputedValue.isRunningSetterMask_ = 2;\nComputedValue.isBeingObservedMask_ = 4;\nComputedValue.isPendingUnobservationMask_ = 8;\nComputedValue.diffValueMask_ = 16;\nvar isComputedValue = /*#__PURE__*/createInstanceofPredicate(\"ComputedValue\", ComputedValue);\n\nvar IDerivationState_;\n(function (IDerivationState_) {\n // before being run or (outside batch and not being observed)\n // at this point derivation is not holding any data about dependency tree\n IDerivationState_[IDerivationState_[\"NOT_TRACKING_\"] = -1] = \"NOT_TRACKING_\";\n // no shallow dependency changed since last computation\n // won't recalculate derivation\n // this is what makes mobx fast\n IDerivationState_[IDerivationState_[\"UP_TO_DATE_\"] = 0] = \"UP_TO_DATE_\";\n // some deep dependency changed, but don't know if shallow dependency changed\n // will require to check first if UP_TO_DATE or POSSIBLY_STALE\n // currently only ComputedValue will propagate POSSIBLY_STALE\n //\n // having this state is second big optimization:\n // don't have to recompute on every dependency change, but only when it's needed\n IDerivationState_[IDerivationState_[\"POSSIBLY_STALE_\"] = 1] = \"POSSIBLY_STALE_\";\n // A shallow dependency has changed since last computation and the derivation\n // will need to recompute when it's needed next.\n IDerivationState_[IDerivationState_[\"STALE_\"] = 2] = \"STALE_\";\n})(IDerivationState_ || (IDerivationState_ = {}));\nvar TraceMode;\n(function (TraceMode) {\n TraceMode[TraceMode[\"NONE\"] = 0] = \"NONE\";\n TraceMode[TraceMode[\"LOG\"] = 1] = \"LOG\";\n TraceMode[TraceMode[\"BREAK\"] = 2] = \"BREAK\";\n})(TraceMode || (TraceMode = {}));\nvar CaughtException = function CaughtException(cause) {\n this.cause = void 0;\n this.cause = cause;\n // Empty\n};\nfunction isCaughtException(e) {\n return e instanceof CaughtException;\n}\n/**\n * Finds out whether any dependency of the derivation has actually changed.\n * If dependenciesState is 1 then it will recalculate dependencies,\n * if any dependency changed it will propagate it by changing dependenciesState to 2.\n *\n * By iterating over the dependencies in the same order that they were reported and\n * stopping on the first change, all the recalculations are only called for ComputedValues\n * that will be tracked by derivation. That is because we assume that if the first x\n * dependencies of the derivation doesn't change then the derivation should run the same way\n * up until accessing x-th dependency.\n */\nfunction shouldCompute(derivation) {\n switch (derivation.dependenciesState_) {\n case IDerivationState_.UP_TO_DATE_:\n return false;\n case IDerivationState_.NOT_TRACKING_:\n case IDerivationState_.STALE_:\n return true;\n case IDerivationState_.POSSIBLY_STALE_:\n {\n // state propagation can occur outside of action/reactive context #2195\n var prevAllowStateReads = allowStateReadsStart(true);\n var prevUntracked = untrackedStart(); // no need for those computeds to be reported, they will be picked up in trackDerivedFunction.\n var obs = derivation.observing_,\n l = obs.length;\n for (var i = 0; i < l; i++) {\n var obj = obs[i];\n if (isComputedValue(obj)) {\n if (globalState.disableErrorBoundaries) {\n obj.get();\n } else {\n try {\n obj.get();\n } catch (e) {\n // we are not interested in the value *or* exception at this moment, but if there is one, notify all\n untrackedEnd(prevUntracked);\n allowStateReadsEnd(prevAllowStateReads);\n return true;\n }\n }\n // if ComputedValue `obj` actually changed it will be computed and propagated to its observers.\n // and `derivation` is an observer of `obj`\n // invariantShouldCompute(derivation)\n if (derivation.dependenciesState_ === IDerivationState_.STALE_) {\n untrackedEnd(prevUntracked);\n allowStateReadsEnd(prevAllowStateReads);\n return true;\n }\n }\n }\n changeDependenciesStateTo0(derivation);\n untrackedEnd(prevUntracked);\n allowStateReadsEnd(prevAllowStateReads);\n return false;\n }\n }\n}\nfunction isComputingDerivation() {\n return globalState.trackingDerivation !== null; // filter out actions inside computations\n}\nfunction checkIfStateModificationsAreAllowed(atom) {\n if (false) {}\n var hasObservers = atom.observers_.size > 0;\n // Should not be possible to change observed state outside strict mode, except during initialization, see #563\n if (!globalState.allowStateChanges && (hasObservers || globalState.enforceActions === \"always\")) {\n console.warn(\"[MobX] \" + (globalState.enforceActions ? \"Since strict-mode is enabled, changing (observed) observable values without using an action is not allowed. Tried to modify: \" : \"Side effects like changing state are not allowed at this point. Are you trying to modify state from, for example, a computed value or the render function of a React component? You can wrap side effects in 'runInAction' (or decorate functions with 'action') if needed. Tried to modify: \") + atom.name_);\n }\n}\nfunction checkIfStateReadsAreAllowed(observable) {\n if ( true && !globalState.allowStateReads && globalState.observableRequiresReaction) {\n console.warn(\"[mobx] Observable '\" + observable.name_ + \"' being read outside a reactive context.\");\n }\n}\n/**\n * Executes the provided function `f` and tracks which observables are being accessed.\n * The tracking information is stored on the `derivation` object and the derivation is registered\n * as observer of any of the accessed observables.\n */\nfunction trackDerivedFunction(derivation, f, context) {\n var prevAllowStateReads = allowStateReadsStart(true);\n changeDependenciesStateTo0(derivation);\n // Preallocate array; will be trimmed by bindDependencies.\n derivation.newObserving_ = new Array(\n // Reserve constant space for initial dependencies, dynamic space otherwise.\n // See https://github.com/mobxjs/mobx/pull/3833\n derivation.runId_ === 0 ? 100 : derivation.observing_.length);\n derivation.unboundDepsCount_ = 0;\n derivation.runId_ = ++globalState.runId;\n var prevTracking = globalState.trackingDerivation;\n globalState.trackingDerivation = derivation;\n globalState.inBatch++;\n var result;\n if (globalState.disableErrorBoundaries === true) {\n result = f.call(context);\n } else {\n try {\n result = f.call(context);\n } catch (e) {\n result = new CaughtException(e);\n }\n }\n globalState.inBatch--;\n globalState.trackingDerivation = prevTracking;\n bindDependencies(derivation);\n warnAboutDerivationWithoutDependencies(derivation);\n allowStateReadsEnd(prevAllowStateReads);\n return result;\n}\nfunction warnAboutDerivationWithoutDependencies(derivation) {\n if (false) {}\n if (derivation.observing_.length !== 0) {\n return;\n }\n if (typeof derivation.requiresObservable_ === \"boolean\" ? derivation.requiresObservable_ : globalState.reactionRequiresObservable) {\n console.warn(\"[mobx] Derivation '\" + derivation.name_ + \"' is created/updated without reading any observable value.\");\n }\n}\n/**\n * diffs newObserving with observing.\n * update observing to be newObserving with unique observables\n * notify observers that become observed/unobserved\n */\nfunction bindDependencies(derivation) {\n // invariant(derivation.dependenciesState !== IDerivationState.NOT_TRACKING, \"INTERNAL ERROR bindDependencies expects derivation.dependenciesState !== -1\");\n var prevObserving = derivation.observing_;\n var observing = derivation.observing_ = derivation.newObserving_;\n var lowestNewObservingDerivationState = IDerivationState_.UP_TO_DATE_;\n // Go through all new observables and check diffValue: (this list can contain duplicates):\n // 0: first occurrence, change to 1 and keep it\n // 1: extra occurrence, drop it\n var i0 = 0,\n l = derivation.unboundDepsCount_;\n for (var i = 0; i < l; i++) {\n var dep = observing[i];\n if (dep.diffValue === 0) {\n dep.diffValue = 1;\n if (i0 !== i) {\n observing[i0] = dep;\n }\n i0++;\n }\n // Upcast is 'safe' here, because if dep is IObservable, `dependenciesState` will be undefined,\n // not hitting the condition\n if (dep.dependenciesState_ > lowestNewObservingDerivationState) {\n lowestNewObservingDerivationState = dep.dependenciesState_;\n }\n }\n observing.length = i0;\n derivation.newObserving_ = null; // newObserving shouldn't be needed outside tracking (statement moved down to work around FF bug, see #614)\n // Go through all old observables and check diffValue: (it is unique after last bindDependencies)\n // 0: it's not in new observables, unobserve it\n // 1: it keeps being observed, don't want to notify it. change to 0\n l = prevObserving.length;\n while (l--) {\n var _dep = prevObserving[l];\n if (_dep.diffValue === 0) {\n removeObserver(_dep, derivation);\n }\n _dep.diffValue = 0;\n }\n // Go through all new observables and check diffValue: (now it should be unique)\n // 0: it was set to 0 in last loop. don't need to do anything.\n // 1: it wasn't observed, let's observe it. set back to 0\n while (i0--) {\n var _dep2 = observing[i0];\n if (_dep2.diffValue === 1) {\n _dep2.diffValue = 0;\n addObserver(_dep2, derivation);\n }\n }\n // Some new observed derivations may become stale during this derivation computation\n // so they have had no chance to propagate staleness (#916)\n if (lowestNewObservingDerivationState !== IDerivationState_.UP_TO_DATE_) {\n derivation.dependenciesState_ = lowestNewObservingDerivationState;\n derivation.onBecomeStale_();\n }\n}\nfunction clearObserving(derivation) {\n // invariant(globalState.inBatch > 0, \"INTERNAL ERROR clearObserving should be called only inside batch\");\n var obs = derivation.observing_;\n derivation.observing_ = [];\n var i = obs.length;\n while (i--) {\n removeObserver(obs[i], derivation);\n }\n derivation.dependenciesState_ = IDerivationState_.NOT_TRACKING_;\n}\nfunction untracked(action) {\n var prev = untrackedStart();\n try {\n return action();\n } finally {\n untrackedEnd(prev);\n }\n}\nfunction untrackedStart() {\n var prev = globalState.trackingDerivation;\n globalState.trackingDerivation = null;\n return prev;\n}\nfunction untrackedEnd(prev) {\n globalState.trackingDerivation = prev;\n}\nfunction allowStateReadsStart(allowStateReads) {\n var prev = globalState.allowStateReads;\n globalState.allowStateReads = allowStateReads;\n return prev;\n}\nfunction allowStateReadsEnd(prev) {\n globalState.allowStateReads = prev;\n}\n/**\n * needed to keep `lowestObserverState` correct. when changing from (2 or 1) to 0\n *\n */\nfunction changeDependenciesStateTo0(derivation) {\n if (derivation.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {\n return;\n }\n derivation.dependenciesState_ = IDerivationState_.UP_TO_DATE_;\n var obs = derivation.observing_;\n var i = obs.length;\n while (i--) {\n obs[i].lowestObserverState_ = IDerivationState_.UP_TO_DATE_;\n }\n}\n\n/**\n * These values will persist if global state is reset\n */\nvar persistentKeys = [\"mobxGuid\", \"spyListeners\", \"enforceActions\", \"computedRequiresReaction\", \"reactionRequiresObservable\", \"observableRequiresReaction\", \"allowStateReads\", \"disableErrorBoundaries\", \"runId\", \"UNCHANGED\", \"useProxies\"];\nvar MobXGlobals = function MobXGlobals() {\n /**\n * MobXGlobals version.\n * MobX compatiblity with other versions loaded in memory as long as this version matches.\n * It indicates that the global state still stores similar information\n *\n * N.B: this version is unrelated to the package version of MobX, and is only the version of the\n * internal state storage of MobX, and can be the same across many different package versions\n */\n this.version = 6;\n /**\n * globally unique token to signal unchanged\n */\n this.UNCHANGED = {};\n /**\n * Currently running derivation\n */\n this.trackingDerivation = null;\n /**\n * Currently running reaction. This determines if we currently have a reactive context.\n * (Tracking derivation is also set for temporal tracking of computed values inside actions,\n * but trackingReaction can only be set by a form of Reaction)\n */\n this.trackingContext = null;\n /**\n * Each time a derivation is tracked, it is assigned a unique run-id\n */\n this.runId = 0;\n /**\n * 'guid' for general purpose. Will be persisted amongst resets.\n */\n this.mobxGuid = 0;\n /**\n * Are we in a batch block? (and how many of them)\n */\n this.inBatch = 0;\n /**\n * Observables that don't have observers anymore, and are about to be\n * suspended, unless somebody else accesses it in the same batch\n *\n * @type {IObservable[]}\n */\n this.pendingUnobservations = [];\n /**\n * List of scheduled, not yet executed, reactions.\n */\n this.pendingReactions = [];\n /**\n * Are we currently processing reactions?\n */\n this.isRunningReactions = false;\n /**\n * Is it allowed to change observables at this point?\n * In general, MobX doesn't allow that when running computations and React.render.\n * To ensure that those functions stay pure.\n */\n this.allowStateChanges = false;\n /**\n * Is it allowed to read observables at this point?\n * Used to hold the state needed for `observableRequiresReaction`\n */\n this.allowStateReads = true;\n /**\n * If strict mode is enabled, state changes are by default not allowed\n */\n this.enforceActions = true;\n /**\n * Spy callbacks\n */\n this.spyListeners = [];\n /**\n * Globally attached error handlers that react specifically to errors in reactions\n */\n this.globalReactionErrorHandlers = [];\n /**\n * Warn if computed values are accessed outside a reactive context\n */\n this.computedRequiresReaction = false;\n /**\n * (Experimental)\n * Warn if you try to create to derivation / reactive context without accessing any observable.\n */\n this.reactionRequiresObservable = false;\n /**\n * (Experimental)\n * Warn if observables are accessed outside a reactive context\n */\n this.observableRequiresReaction = false;\n /*\n * Don't catch and rethrow exceptions. This is useful for inspecting the state of\n * the stack when an exception occurs while debugging.\n */\n this.disableErrorBoundaries = false;\n /*\n * If true, we are already handling an exception in an action. Any errors in reactions should be suppressed, as\n * they are not the cause, see: https://github.com/mobxjs/mobx/issues/1836\n */\n this.suppressReactionErrors = false;\n this.useProxies = true;\n /*\n * print warnings about code that would fail if proxies weren't available\n */\n this.verifyProxies = false;\n /**\n * False forces all object's descriptors to\n * writable: true\n * configurable: true\n */\n this.safeDescriptors = true;\n};\nvar canMergeGlobalState = true;\nvar isolateCalled = false;\nvar globalState = /*#__PURE__*/function () {\n var global = /*#__PURE__*/getGlobal();\n if (global.__mobxInstanceCount > 0 && !global.__mobxGlobals) {\n canMergeGlobalState = false;\n }\n if (global.__mobxGlobals && global.__mobxGlobals.version !== new MobXGlobals().version) {\n canMergeGlobalState = false;\n }\n if (!canMergeGlobalState) {\n // Because this is a IIFE we need to let isolateCalled a chance to change\n // so we run it after the event loop completed at least 1 iteration\n setTimeout(function () {\n if (!isolateCalled) {\n die(35);\n }\n }, 1);\n return new MobXGlobals();\n } else if (global.__mobxGlobals) {\n global.__mobxInstanceCount += 1;\n if (!global.__mobxGlobals.UNCHANGED) {\n global.__mobxGlobals.UNCHANGED = {};\n } // make merge backward compatible\n return global.__mobxGlobals;\n } else {\n global.__mobxInstanceCount = 1;\n return global.__mobxGlobals = /*#__PURE__*/new MobXGlobals();\n }\n}();\nfunction isolateGlobalState() {\n if (globalState.pendingReactions.length || globalState.inBatch || globalState.isRunningReactions) {\n die(36);\n }\n isolateCalled = true;\n if (canMergeGlobalState) {\n var global = getGlobal();\n if (--global.__mobxInstanceCount === 0) {\n global.__mobxGlobals = undefined;\n }\n globalState = new MobXGlobals();\n }\n}\nfunction getGlobalState() {\n return globalState;\n}\n/**\n * For testing purposes only; this will break the internal state of existing observables,\n * but can be used to get back at a stable state after throwing errors\n */\nfunction resetGlobalState() {\n var defaultGlobals = new MobXGlobals();\n for (var key in defaultGlobals) {\n if (persistentKeys.indexOf(key) === -1) {\n globalState[key] = defaultGlobals[key];\n }\n }\n globalState.allowStateChanges = !globalState.enforceActions;\n}\n\nfunction hasObservers(observable) {\n return observable.observers_ && observable.observers_.size > 0;\n}\nfunction getObservers(observable) {\n return observable.observers_;\n}\n// function invariantObservers(observable: IObservable) {\n// const list = observable.observers\n// const map = observable.observersIndexes\n// const l = list.length\n// for (let i = 0; i < l; i++) {\n// const id = list[i].__mapid\n// if (i) {\n// invariant(map[id] === i, \"INTERNAL ERROR maps derivation.__mapid to index in list\") // for performance\n// } else {\n// invariant(!(id in map), \"INTERNAL ERROR observer on index 0 shouldn't be held in map.\") // for performance\n// }\n// }\n// invariant(\n// list.length === 0 || Object.keys(map).length === list.length - 1,\n// \"INTERNAL ERROR there is no junk in map\"\n// )\n// }\nfunction addObserver(observable, node) {\n // invariant(node.dependenciesState !== -1, \"INTERNAL ERROR, can add only dependenciesState !== -1\");\n // invariant(observable._observers.indexOf(node) === -1, \"INTERNAL ERROR add already added node\");\n // invariantObservers(observable);\n observable.observers_.add(node);\n if (observable.lowestObserverState_ > node.dependenciesState_) {\n observable.lowestObserverState_ = node.dependenciesState_;\n }\n // invariantObservers(observable);\n // invariant(observable._observers.indexOf(node) !== -1, \"INTERNAL ERROR didn't add node\");\n}\nfunction removeObserver(observable, node) {\n // invariant(globalState.inBatch > 0, \"INTERNAL ERROR, remove should be called only inside batch\");\n // invariant(observable._observers.indexOf(node) !== -1, \"INTERNAL ERROR remove already removed node\");\n // invariantObservers(observable);\n observable.observers_[\"delete\"](node);\n if (observable.observers_.size === 0) {\n // deleting last observer\n queueForUnobservation(observable);\n }\n // invariantObservers(observable);\n // invariant(observable._observers.indexOf(node) === -1, \"INTERNAL ERROR remove already removed node2\");\n}\nfunction queueForUnobservation(observable) {\n if (observable.isPendingUnobservation === false) {\n // invariant(observable._observers.length === 0, \"INTERNAL ERROR, should only queue for unobservation unobserved observables\");\n observable.isPendingUnobservation = true;\n globalState.pendingUnobservations.push(observable);\n }\n}\n/**\n * Batch starts a transaction, at least for purposes of memoizing ComputedValues when nothing else does.\n * During a batch `onBecomeUnobserved` will be called at most once per observable.\n * Avoids unnecessary recalculations.\n */\nfunction startBatch() {\n globalState.inBatch++;\n}\nfunction endBatch() {\n if (--globalState.inBatch === 0) {\n runReactions();\n // the batch is actually about to finish, all unobserving should happen here.\n var list = globalState.pendingUnobservations;\n for (var i = 0; i < list.length; i++) {\n var observable = list[i];\n observable.isPendingUnobservation = false;\n if (observable.observers_.size === 0) {\n if (observable.isBeingObserved) {\n // if this observable had reactive observers, trigger the hooks\n observable.isBeingObserved = false;\n observable.onBUO();\n }\n if (observable instanceof ComputedValue) {\n // computed values are automatically teared down when the last observer leaves\n // this process happens recursively, this computed might be the last observabe of another, etc..\n observable.suspend_();\n }\n }\n }\n globalState.pendingUnobservations = [];\n }\n}\nfunction reportObserved(observable) {\n checkIfStateReadsAreAllowed(observable);\n var derivation = globalState.trackingDerivation;\n if (derivation !== null) {\n /**\n * Simple optimization, give each derivation run an unique id (runId)\n * Check if last time this observable was accessed the same runId is used\n * if this is the case, the relation is already known\n */\n if (derivation.runId_ !== observable.lastAccessedBy_) {\n observable.lastAccessedBy_ = derivation.runId_;\n // Tried storing newObserving, or observing, or both as Set, but performance didn't come close...\n derivation.newObserving_[derivation.unboundDepsCount_++] = observable;\n if (!observable.isBeingObserved && globalState.trackingContext) {\n observable.isBeingObserved = true;\n observable.onBO();\n }\n }\n return observable.isBeingObserved;\n } else if (observable.observers_.size === 0 && globalState.inBatch > 0) {\n queueForUnobservation(observable);\n }\n return false;\n}\n// function invariantLOS(observable: IObservable, msg: string) {\n// // it's expensive so better not run it in produciton. but temporarily helpful for testing\n// const min = getObservers(observable).reduce((a, b) => Math.min(a, b.dependenciesState), 2)\n// if (min >= observable.lowestObserverState) return // <- the only assumption about `lowestObserverState`\n// throw new Error(\n// \"lowestObserverState is wrong for \" +\n// msg +\n// \" because \" +\n// min +\n// \" < \" +\n// observable.lowestObserverState\n// )\n// }\n/**\n * NOTE: current propagation mechanism will in case of self reruning autoruns behave unexpectedly\n * It will propagate changes to observers from previous run\n * It's hard or maybe impossible (with reasonable perf) to get it right with current approach\n * Hopefully self reruning autoruns aren't a feature people should depend on\n * Also most basic use cases should be ok\n */\n// Called by Atom when its value changes\nfunction propagateChanged(observable) {\n // invariantLOS(observable, \"changed start\");\n if (observable.lowestObserverState_ === IDerivationState_.STALE_) {\n return;\n }\n observable.lowestObserverState_ = IDerivationState_.STALE_;\n // Ideally we use for..of here, but the downcompiled version is really slow...\n observable.observers_.forEach(function (d) {\n if (d.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {\n if ( true && d.isTracing_ !== TraceMode.NONE) {\n logTraceInfo(d, observable);\n }\n d.onBecomeStale_();\n }\n d.dependenciesState_ = IDerivationState_.STALE_;\n });\n // invariantLOS(observable, \"changed end\");\n}\n// Called by ComputedValue when it recalculate and its value changed\nfunction propagateChangeConfirmed(observable) {\n // invariantLOS(observable, \"confirmed start\");\n if (observable.lowestObserverState_ === IDerivationState_.STALE_) {\n return;\n }\n observable.lowestObserverState_ = IDerivationState_.STALE_;\n observable.observers_.forEach(function (d) {\n if (d.dependenciesState_ === IDerivationState_.POSSIBLY_STALE_) {\n d.dependenciesState_ = IDerivationState_.STALE_;\n if ( true && d.isTracing_ !== TraceMode.NONE) {\n logTraceInfo(d, observable);\n }\n } else if (d.dependenciesState_ === IDerivationState_.UP_TO_DATE_ // this happens during computing of `d`, just keep lowestObserverState up to date.\n ) {\n observable.lowestObserverState_ = IDerivationState_.UP_TO_DATE_;\n }\n });\n // invariantLOS(observable, \"confirmed end\");\n}\n// Used by computed when its dependency changed, but we don't wan't to immediately recompute.\nfunction propagateMaybeChanged(observable) {\n // invariantLOS(observable, \"maybe start\");\n if (observable.lowestObserverState_ !== IDerivationState_.UP_TO_DATE_) {\n return;\n }\n observable.lowestObserverState_ = IDerivationState_.POSSIBLY_STALE_;\n observable.observers_.forEach(function (d) {\n if (d.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {\n d.dependenciesState_ = IDerivationState_.POSSIBLY_STALE_;\n d.onBecomeStale_();\n }\n });\n // invariantLOS(observable, \"maybe end\");\n}\nfunction logTraceInfo(derivation, observable) {\n console.log(\"[mobx.trace] '\" + derivation.name_ + \"' is invalidated due to a change in: '\" + observable.name_ + \"'\");\n if (derivation.isTracing_ === TraceMode.BREAK) {\n var lines = [];\n printDepTree(getDependencyTree(derivation), lines, 1);\n // prettier-ignore\n new Function(\"debugger;\\n/*\\nTracing '\" + derivation.name_ + \"'\\n\\nYou are entering this break point because derivation '\" + derivation.name_ + \"' is being traced and '\" + observable.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\" + (derivation instanceof ComputedValue ? derivation.derivation.toString().replace(/[*]\\//g, \"/\") : \"\") + \"\\n\\nThe dependencies for this derivation are:\\n\\n\" + lines.join(\"\\n\") + \"\\n*/\\n \")();\n }\n}\nfunction printDepTree(tree, lines, depth) {\n if (lines.length >= 1000) {\n lines.push(\"(and many more)\");\n return;\n }\n lines.push(\"\" + \"\\t\".repeat(depth - 1) + tree.name);\n if (tree.dependencies) {\n tree.dependencies.forEach(function (child) {\n return printDepTree(child, lines, depth + 1);\n });\n }\n}\n\nvar Reaction = /*#__PURE__*/function () {\n function Reaction(name_, onInvalidate_, errorHandler_, requiresObservable_) {\n if (name_ === void 0) {\n name_ = true ? \"Reaction@\" + getNextId() : 0;\n }\n this.name_ = void 0;\n this.onInvalidate_ = void 0;\n this.errorHandler_ = void 0;\n this.requiresObservable_ = void 0;\n this.observing_ = [];\n // nodes we are looking at. Our value depends on these nodes\n this.newObserving_ = [];\n this.dependenciesState_ = IDerivationState_.NOT_TRACKING_;\n this.runId_ = 0;\n this.unboundDepsCount_ = 0;\n this.flags_ = 0;\n this.isTracing_ = TraceMode.NONE;\n this.name_ = name_;\n this.onInvalidate_ = onInvalidate_;\n this.errorHandler_ = errorHandler_;\n this.requiresObservable_ = requiresObservable_;\n }\n var _proto = Reaction.prototype;\n _proto.onBecomeStale_ = function onBecomeStale_() {\n this.schedule_();\n };\n _proto.schedule_ = function schedule_() {\n if (!this.isScheduled) {\n this.isScheduled = true;\n globalState.pendingReactions.push(this);\n runReactions();\n }\n }\n /**\n * internal, use schedule() if you intend to kick off a reaction\n */;\n _proto.runReaction_ = function runReaction_() {\n if (!this.isDisposed) {\n startBatch();\n this.isScheduled = false;\n var prev = globalState.trackingContext;\n globalState.trackingContext = this;\n if (shouldCompute(this)) {\n this.isTrackPending = true;\n try {\n this.onInvalidate_();\n if ( true && this.isTrackPending && isSpyEnabled()) {\n // onInvalidate didn't trigger track right away..\n spyReport({\n name: this.name_,\n type: \"scheduled-reaction\"\n });\n }\n } catch (e) {\n this.reportExceptionInDerivation_(e);\n }\n }\n globalState.trackingContext = prev;\n endBatch();\n }\n };\n _proto.track = function track(fn) {\n if (this.isDisposed) {\n return;\n // console.warn(\"Reaction already disposed\") // Note: Not a warning / error in mobx 4 either\n }\n startBatch();\n var notify = isSpyEnabled();\n var startTime;\n if ( true && notify) {\n startTime = Date.now();\n spyReportStart({\n name: this.name_,\n type: \"reaction\"\n });\n }\n this.isRunning = true;\n var prevReaction = globalState.trackingContext; // reactions could create reactions...\n globalState.trackingContext = this;\n var result = trackDerivedFunction(this, fn, undefined);\n globalState.trackingContext = prevReaction;\n this.isRunning = false;\n this.isTrackPending = false;\n if (this.isDisposed) {\n // disposed during last run. Clean up everything that was bound after the dispose call.\n clearObserving(this);\n }\n if (isCaughtException(result)) {\n this.reportExceptionInDerivation_(result.cause);\n }\n if ( true && notify) {\n spyReportEnd({\n time: Date.now() - startTime\n });\n }\n endBatch();\n };\n _proto.reportExceptionInDerivation_ = function reportExceptionInDerivation_(error) {\n var _this = this;\n if (this.errorHandler_) {\n this.errorHandler_(error, this);\n return;\n }\n if (globalState.disableErrorBoundaries) {\n throw error;\n }\n var message = true ? \"[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '\" + this + \"'\" : 0;\n if (!globalState.suppressReactionErrors) {\n console.error(message, error);\n /** If debugging brought you here, please, read the above message :-). Tnx! */\n } else if (true) {\n console.warn(\"[mobx] (error in reaction '\" + this.name_ + \"' suppressed, fix error of causing action below)\");\n } // prettier-ignore\n if ( true && isSpyEnabled()) {\n spyReport({\n type: \"error\",\n name: this.name_,\n message: message,\n error: \"\" + error\n });\n }\n globalState.globalReactionErrorHandlers.forEach(function (f) {\n return f(error, _this);\n });\n };\n _proto.dispose = function dispose() {\n if (!this.isDisposed) {\n this.isDisposed = true;\n if (!this.isRunning) {\n // if disposed while running, clean up later. Maybe not optimal, but rare case\n startBatch();\n clearObserving(this);\n endBatch();\n }\n }\n };\n _proto.getDisposer_ = function getDisposer_(abortSignal) {\n var _this2 = this;\n var dispose = function dispose() {\n _this2.dispose();\n abortSignal == null || abortSignal.removeEventListener == null || abortSignal.removeEventListener(\"abort\", dispose);\n };\n abortSignal == null || abortSignal.addEventListener == null || abortSignal.addEventListener(\"abort\", dispose);\n dispose[$mobx] = this;\n return dispose;\n };\n _proto.toString = function toString() {\n return \"Reaction[\" + this.name_ + \"]\";\n };\n _proto.trace = function trace$1(enterBreakPoint) {\n if (enterBreakPoint === void 0) {\n enterBreakPoint = false;\n }\n trace(this, enterBreakPoint);\n };\n return _createClass(Reaction, [{\n key: \"isDisposed\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isDisposedMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isDisposedMask_, newValue);\n }\n }, {\n key: \"isScheduled\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isScheduledMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isScheduledMask_, newValue);\n }\n }, {\n key: \"isTrackPending\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isTrackPendingMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isTrackPendingMask_, newValue);\n }\n }, {\n key: \"isRunning\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isRunningMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isRunningMask_, newValue);\n }\n }, {\n key: \"diffValue\",\n get: function get() {\n return getFlag(this.flags_, Reaction.diffValueMask_) ? 1 : 0;\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.diffValueMask_, newValue === 1 ? true : false);\n }\n }]);\n}();\nReaction.isDisposedMask_ = 1;\nReaction.isScheduledMask_ = 2;\nReaction.isTrackPendingMask_ = 4;\nReaction.isRunningMask_ = 8;\nReaction.diffValueMask_ = 16;\nfunction onReactionError(handler) {\n globalState.globalReactionErrorHandlers.push(handler);\n return function () {\n var idx = globalState.globalReactionErrorHandlers.indexOf(handler);\n if (idx >= 0) {\n globalState.globalReactionErrorHandlers.splice(idx, 1);\n }\n };\n}\n/**\n * Magic number alert!\n * Defines within how many times a reaction is allowed to re-trigger itself\n * until it is assumed that this is gonna be a never ending loop...\n */\nvar MAX_REACTION_ITERATIONS = 100;\nvar reactionScheduler = function reactionScheduler(f) {\n return f();\n};\nfunction runReactions() {\n // Trampolining, if runReactions are already running, new reactions will be picked up\n if (globalState.inBatch > 0 || globalState.isRunningReactions) {\n return;\n }\n reactionScheduler(runReactionsHelper);\n}\nfunction runReactionsHelper() {\n globalState.isRunningReactions = true;\n var allReactions = globalState.pendingReactions;\n var iterations = 0;\n // While running reactions, new reactions might be triggered.\n // Hence we work with two variables and check whether\n // we converge to no remaining reactions after a while.\n while (allReactions.length > 0) {\n if (++iterations === MAX_REACTION_ITERATIONS) {\n console.error( true ? \"Reaction doesn't converge to a stable state after \" + MAX_REACTION_ITERATIONS + \" iterations.\" + (\" Probably there is a cycle in the reactive function: \" + allReactions[0]) : 0);\n allReactions.splice(0); // clear reactions\n }\n var remainingReactions = allReactions.splice(0);\n for (var i = 0, l = remainingReactions.length; i < l; i++) {\n remainingReactions[i].runReaction_();\n }\n }\n globalState.isRunningReactions = false;\n}\nvar isReaction = /*#__PURE__*/createInstanceofPredicate(\"Reaction\", Reaction);\nfunction setReactionScheduler(fn) {\n var baseScheduler = reactionScheduler;\n reactionScheduler = function reactionScheduler(f) {\n return fn(function () {\n return baseScheduler(f);\n });\n };\n}\n\nfunction isSpyEnabled() {\n return true && !!globalState.spyListeners.length;\n}\nfunction spyReport(event) {\n if (false) {} // dead code elimination can do the rest\n if (!globalState.spyListeners.length) {\n return;\n }\n var listeners = globalState.spyListeners;\n for (var i = 0, l = listeners.length; i < l; i++) {\n listeners[i](event);\n }\n}\nfunction spyReportStart(event) {\n if (false) {}\n var change = _extends({}, event, {\n spyReportStart: true\n });\n spyReport(change);\n}\nvar END_EVENT = {\n type: \"report-end\",\n spyReportEnd: true\n};\nfunction spyReportEnd(change) {\n if (false) {}\n if (change) {\n spyReport(_extends({}, change, {\n type: \"report-end\",\n spyReportEnd: true\n }));\n } else {\n spyReport(END_EVENT);\n }\n}\nfunction spy(listener) {\n if (false) {} else {\n globalState.spyListeners.push(listener);\n return once(function () {\n globalState.spyListeners = globalState.spyListeners.filter(function (l) {\n return l !== listener;\n });\n });\n }\n}\n\nvar ACTION = \"action\";\nvar ACTION_BOUND = \"action.bound\";\nvar AUTOACTION = \"autoAction\";\nvar AUTOACTION_BOUND = \"autoAction.bound\";\nvar DEFAULT_ACTION_NAME = \"\";\nvar actionAnnotation = /*#__PURE__*/createActionAnnotation(ACTION);\nvar actionBoundAnnotation = /*#__PURE__*/createActionAnnotation(ACTION_BOUND, {\n bound: true\n});\nvar autoActionAnnotation = /*#__PURE__*/createActionAnnotation(AUTOACTION, {\n autoAction: true\n});\nvar autoActionBoundAnnotation = /*#__PURE__*/createActionAnnotation(AUTOACTION_BOUND, {\n autoAction: true,\n bound: true\n});\nfunction createActionFactory(autoAction) {\n var res = function action(arg1, arg2) {\n // action(fn() {})\n if (isFunction(arg1)) {\n return createAction(arg1.name || DEFAULT_ACTION_NAME, arg1, autoAction);\n }\n // action(\"name\", fn() {})\n if (isFunction(arg2)) {\n return createAction(arg1, arg2, autoAction);\n }\n // @action (2022.3 Decorators)\n if (is20223Decorator(arg2)) {\n return (autoAction ? autoActionAnnotation : actionAnnotation).decorate_20223_(arg1, arg2);\n }\n // @action\n if (isStringish(arg2)) {\n return storeAnnotation(arg1, arg2, autoAction ? autoActionAnnotation : actionAnnotation);\n }\n // action(\"name\") & @action(\"name\")\n if (isStringish(arg1)) {\n return createDecoratorAnnotation(createActionAnnotation(autoAction ? AUTOACTION : ACTION, {\n name: arg1,\n autoAction: autoAction\n }));\n }\n if (true) {\n die(\"Invalid arguments for `action`\");\n }\n };\n return res;\n}\nvar action = /*#__PURE__*/createActionFactory(false);\nObject.assign(action, actionAnnotation);\nvar autoAction = /*#__PURE__*/createActionFactory(true);\nObject.assign(autoAction, autoActionAnnotation);\naction.bound = /*#__PURE__*/createDecoratorAnnotation(actionBoundAnnotation);\nautoAction.bound = /*#__PURE__*/createDecoratorAnnotation(autoActionBoundAnnotation);\nfunction runInAction(fn) {\n return executeAction(fn.name || DEFAULT_ACTION_NAME, false, fn, this, undefined);\n}\nfunction isAction(thing) {\n return isFunction(thing) && thing.isMobxAction === true;\n}\n\n/**\n * Creates a named reactive view and keeps it alive, so that the view is always\n * updated if one of the dependencies changes, even when the view is not further used by something else.\n * @param view The reactive view\n * @returns disposer function, which can be used to stop the view from being updated in the future.\n */\nfunction autorun(view, opts) {\n var _opts$name, _opts, _opts2, _opts3;\n if (opts === void 0) {\n opts = EMPTY_OBJECT;\n }\n if (true) {\n if (!isFunction(view)) {\n die(\"Autorun expects a function as first argument\");\n }\n if (isAction(view)) {\n die(\"Autorun does not accept actions since actions are untrackable\");\n }\n }\n var name = (_opts$name = (_opts = opts) == null ? void 0 : _opts.name) != null ? _opts$name : true ? view.name || \"Autorun@\" + getNextId() : 0;\n var runSync = !opts.scheduler && !opts.delay;\n var reaction;\n if (runSync) {\n // normal autorun\n reaction = new Reaction(name, function () {\n this.track(reactionRunner);\n }, opts.onError, opts.requiresObservable);\n } else {\n var scheduler = createSchedulerFromOptions(opts);\n // debounced autorun\n var isScheduled = false;\n reaction = new Reaction(name, function () {\n if (!isScheduled) {\n isScheduled = true;\n scheduler(function () {\n isScheduled = false;\n if (!reaction.isDisposed) {\n reaction.track(reactionRunner);\n }\n });\n }\n }, opts.onError, opts.requiresObservable);\n }\n function reactionRunner() {\n view(reaction);\n }\n if (!((_opts2 = opts) != null && (_opts2 = _opts2.signal) != null && _opts2.aborted)) {\n reaction.schedule_();\n }\n return reaction.getDisposer_((_opts3 = opts) == null ? void 0 : _opts3.signal);\n}\nvar run = function run(f) {\n return f();\n};\nfunction createSchedulerFromOptions(opts) {\n return opts.scheduler ? opts.scheduler : opts.delay ? function (f) {\n return setTimeout(f, opts.delay);\n } : run;\n}\nfunction reaction(expression, effect, opts) {\n var _opts$name2, _opts4, _opts5;\n if (opts === void 0) {\n opts = EMPTY_OBJECT;\n }\n if (true) {\n if (!isFunction(expression) || !isFunction(effect)) {\n die(\"First and second argument to reaction should be functions\");\n }\n if (!isPlainObject(opts)) {\n die(\"Third argument of reactions should be an object\");\n }\n }\n var name = (_opts$name2 = opts.name) != null ? _opts$name2 : true ? \"Reaction@\" + getNextId() : 0;\n var effectAction = action(name, opts.onError ? wrapErrorHandler(opts.onError, effect) : effect);\n var runSync = !opts.scheduler && !opts.delay;\n var scheduler = createSchedulerFromOptions(opts);\n var firstTime = true;\n var isScheduled = false;\n var value;\n var equals = opts.compareStructural ? comparer.structural : opts.equals || comparer[\"default\"];\n var r = new Reaction(name, function () {\n if (firstTime || runSync) {\n reactionRunner();\n } else if (!isScheduled) {\n isScheduled = true;\n scheduler(reactionRunner);\n }\n }, opts.onError, opts.requiresObservable);\n function reactionRunner() {\n isScheduled = false;\n if (r.isDisposed) {\n return;\n }\n var changed = false;\n var oldValue = value;\n r.track(function () {\n var nextValue = allowStateChanges(false, function () {\n return expression(r);\n });\n changed = firstTime || !equals(value, nextValue);\n value = nextValue;\n });\n if (firstTime && opts.fireImmediately) {\n effectAction(value, oldValue, r);\n } else if (!firstTime && changed) {\n effectAction(value, oldValue, r);\n }\n firstTime = false;\n }\n if (!((_opts4 = opts) != null && (_opts4 = _opts4.signal) != null && _opts4.aborted)) {\n r.schedule_();\n }\n return r.getDisposer_((_opts5 = opts) == null ? void 0 : _opts5.signal);\n}\nfunction wrapErrorHandler(errorHandler, baseFn) {\n return function () {\n try {\n return baseFn.apply(this, arguments);\n } catch (e) {\n errorHandler.call(this, e);\n }\n };\n}\n\nvar ON_BECOME_OBSERVED = \"onBO\";\nvar ON_BECOME_UNOBSERVED = \"onBUO\";\nfunction onBecomeObserved(thing, arg2, arg3) {\n return interceptHook(ON_BECOME_OBSERVED, thing, arg2, arg3);\n}\nfunction onBecomeUnobserved(thing, arg2, arg3) {\n return interceptHook(ON_BECOME_UNOBSERVED, thing, arg2, arg3);\n}\nfunction interceptHook(hook, thing, arg2, arg3) {\n var atom = typeof arg3 === \"function\" ? getAtom(thing, arg2) : getAtom(thing);\n var cb = isFunction(arg3) ? arg3 : arg2;\n var listenersKey = hook + \"L\";\n if (atom[listenersKey]) {\n atom[listenersKey].add(cb);\n } else {\n atom[listenersKey] = new Set([cb]);\n }\n return function () {\n var hookListeners = atom[listenersKey];\n if (hookListeners) {\n hookListeners[\"delete\"](cb);\n if (hookListeners.size === 0) {\n delete atom[listenersKey];\n }\n }\n };\n}\n\nvar NEVER = \"never\";\nvar ALWAYS = \"always\";\nvar OBSERVED = \"observed\";\n// const IF_AVAILABLE = \"ifavailable\"\nfunction configure(options) {\n if (options.isolateGlobalState === true) {\n isolateGlobalState();\n }\n var useProxies = options.useProxies,\n enforceActions = options.enforceActions;\n if (useProxies !== undefined) {\n globalState.useProxies = useProxies === ALWAYS ? true : useProxies === NEVER ? false : typeof Proxy !== \"undefined\";\n }\n if (useProxies === \"ifavailable\") {\n globalState.verifyProxies = true;\n }\n if (enforceActions !== undefined) {\n var ea = enforceActions === ALWAYS ? ALWAYS : enforceActions === OBSERVED;\n globalState.enforceActions = ea;\n globalState.allowStateChanges = ea === true || ea === ALWAYS ? false : true;\n }\n [\"computedRequiresReaction\", \"reactionRequiresObservable\", \"observableRequiresReaction\", \"disableErrorBoundaries\", \"safeDescriptors\"].forEach(function (key) {\n if (key in options) {\n globalState[key] = !!options[key];\n }\n });\n globalState.allowStateReads = !globalState.observableRequiresReaction;\n if ( true && globalState.disableErrorBoundaries === true) {\n console.warn(\"WARNING: Debug feature only. MobX will NOT recover from errors when `disableErrorBoundaries` is enabled.\");\n }\n if (options.reactionScheduler) {\n setReactionScheduler(options.reactionScheduler);\n }\n}\n\nfunction extendObservable(target, properties, annotations, options) {\n if (true) {\n if (arguments.length > 4) {\n die(\"'extendObservable' expected 2-4 arguments\");\n }\n if (typeof target !== \"object\") {\n die(\"'extendObservable' expects an object as first argument\");\n }\n if (isObservableMap(target)) {\n die(\"'extendObservable' should not be used on maps, use map.merge instead\");\n }\n if (!isPlainObject(properties)) {\n die(\"'extendObservable' only accepts plain objects as second argument\");\n }\n if (isObservable(properties) || isObservable(annotations)) {\n die(\"Extending an object with another observable (object) is not supported\");\n }\n }\n // Pull descriptors first, so we don't have to deal with props added by administration ($mobx)\n var descriptors = getOwnPropertyDescriptors(properties);\n initObservable(function () {\n var adm = asObservableObject(target, options)[$mobx];\n ownKeys(descriptors).forEach(function (key) {\n adm.extend_(key, descriptors[key],\n // must pass \"undefined\" for { key: undefined }\n !annotations ? true : key in annotations ? annotations[key] : true);\n });\n });\n return target;\n}\n\nfunction getDependencyTree(thing, property) {\n return nodeToDependencyTree(getAtom(thing, property));\n}\nfunction nodeToDependencyTree(node) {\n var result = {\n name: node.name_\n };\n if (node.observing_ && node.observing_.length > 0) {\n result.dependencies = unique(node.observing_).map(nodeToDependencyTree);\n }\n return result;\n}\nfunction getObserverTree(thing, property) {\n return nodeToObserverTree(getAtom(thing, property));\n}\nfunction nodeToObserverTree(node) {\n var result = {\n name: node.name_\n };\n if (hasObservers(node)) {\n result.observers = Array.from(getObservers(node)).map(nodeToObserverTree);\n }\n return result;\n}\nfunction unique(list) {\n return Array.from(new Set(list));\n}\n\nvar generatorId = 0;\nfunction FlowCancellationError() {\n this.message = \"FLOW_CANCELLED\";\n}\nFlowCancellationError.prototype = /*#__PURE__*/Object.create(Error.prototype);\nfunction isFlowCancellationError(error) {\n return error instanceof FlowCancellationError;\n}\nvar flowAnnotation = /*#__PURE__*/createFlowAnnotation(\"flow\");\nvar flowBoundAnnotation = /*#__PURE__*/createFlowAnnotation(\"flow.bound\", {\n bound: true\n});\nvar flow = /*#__PURE__*/Object.assign(function flow(arg1, arg2) {\n // @flow (2022.3 Decorators)\n if (is20223Decorator(arg2)) {\n return flowAnnotation.decorate_20223_(arg1, arg2);\n }\n // @flow\n if (isStringish(arg2)) {\n return storeAnnotation(arg1, arg2, flowAnnotation);\n }\n // flow(fn)\n if ( true && arguments.length !== 1) {\n die(\"Flow expects single argument with generator function\");\n }\n var generator = arg1;\n var name = generator.name || \"\";\n // Implementation based on https://github.com/tj/co/blob/master/index.js\n var res = function res() {\n var ctx = this;\n var args = arguments;\n var runId = ++generatorId;\n var gen = action(name + \" - runid: \" + runId + \" - init\", generator).apply(ctx, args);\n var rejector;\n var pendingPromise = undefined;\n var promise = new Promise(function (resolve, reject) {\n var stepId = 0;\n rejector = reject;\n function onFulfilled(res) {\n pendingPromise = undefined;\n var ret;\n try {\n ret = action(name + \" - runid: \" + runId + \" - yield \" + stepId++, gen.next).call(gen, res);\n } catch (e) {\n return reject(e);\n }\n next(ret);\n }\n function onRejected(err) {\n pendingPromise = undefined;\n var ret;\n try {\n ret = action(name + \" - runid: \" + runId + \" - yield \" + stepId++, gen[\"throw\"]).call(gen, err);\n } catch (e) {\n return reject(e);\n }\n next(ret);\n }\n function next(ret) {\n if (isFunction(ret == null ? void 0 : ret.then)) {\n // an async iterator\n ret.then(next, reject);\n return;\n }\n if (ret.done) {\n return resolve(ret.value);\n }\n pendingPromise = Promise.resolve(ret.value);\n return pendingPromise.then(onFulfilled, onRejected);\n }\n onFulfilled(undefined); // kick off the process\n });\n promise.cancel = action(name + \" - runid: \" + runId + \" - cancel\", function () {\n try {\n if (pendingPromise) {\n cancelPromise(pendingPromise);\n }\n // Finally block can return (or yield) stuff..\n var _res = gen[\"return\"](undefined);\n // eat anything that promise would do, it's cancelled!\n var yieldedPromise = Promise.resolve(_res.value);\n yieldedPromise.then(noop, noop);\n cancelPromise(yieldedPromise); // maybe it can be cancelled :)\n // reject our original promise\n rejector(new FlowCancellationError());\n } catch (e) {\n rejector(e); // there could be a throwing finally block\n }\n });\n return promise;\n };\n res.isMobXFlow = true;\n return res;\n}, flowAnnotation);\nflow.bound = /*#__PURE__*/createDecoratorAnnotation(flowBoundAnnotation);\nfunction cancelPromise(promise) {\n if (isFunction(promise.cancel)) {\n promise.cancel();\n }\n}\nfunction flowResult(result) {\n return result; // just tricking TypeScript :)\n}\nfunction isFlow(fn) {\n return (fn == null ? void 0 : fn.isMobXFlow) === true;\n}\n\nfunction interceptReads(thing, propOrHandler, handler) {\n var target;\n if (isObservableMap(thing) || isObservableArray(thing) || isObservableValue(thing)) {\n target = getAdministration(thing);\n } else if (isObservableObject(thing)) {\n if ( true && !isStringish(propOrHandler)) {\n return die(\"InterceptReads can only be used with a specific property, not with an object in general\");\n }\n target = getAdministration(thing, propOrHandler);\n } else if (true) {\n return die(\"Expected observable map, object or array as first array\");\n }\n if ( true && target.dehancer !== undefined) {\n return die(\"An intercept reader was already established\");\n }\n target.dehancer = typeof propOrHandler === \"function\" ? propOrHandler : handler;\n return function () {\n target.dehancer = undefined;\n };\n}\n\nfunction intercept(thing, propOrHandler, handler) {\n if (isFunction(handler)) {\n return interceptProperty(thing, propOrHandler, handler);\n } else {\n return interceptInterceptable(thing, propOrHandler);\n }\n}\nfunction interceptInterceptable(thing, handler) {\n return getAdministration(thing).intercept_(handler);\n}\nfunction interceptProperty(thing, property, handler) {\n return getAdministration(thing, property).intercept_(handler);\n}\n\nfunction _isComputed(value, property) {\n if (property === undefined) {\n return isComputedValue(value);\n }\n if (isObservableObject(value) === false) {\n return false;\n }\n if (!value[$mobx].values_.has(property)) {\n return false;\n }\n var atom = getAtom(value, property);\n return isComputedValue(atom);\n}\nfunction isComputed(value) {\n if ( true && arguments.length > 1) {\n return die(\"isComputed expects only 1 argument. Use isComputedProp to inspect the observability of a property\");\n }\n return _isComputed(value);\n}\nfunction isComputedProp(value, propName) {\n if ( true && !isStringish(propName)) {\n return die(\"isComputed expected a property name as second argument\");\n }\n return _isComputed(value, propName);\n}\n\nfunction _isObservable(value, property) {\n if (!value) {\n return false;\n }\n if (property !== undefined) {\n if ( true && (isObservableMap(value) || isObservableArray(value))) {\n return die(\"isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead.\");\n }\n if (isObservableObject(value)) {\n return value[$mobx].values_.has(property);\n }\n return false;\n }\n // For first check, see #701\n return isObservableObject(value) || !!value[$mobx] || isAtom(value) || isReaction(value) || isComputedValue(value);\n}\nfunction isObservable(value) {\n if ( true && arguments.length !== 1) {\n die(\"isObservable expects only 1 argument. Use isObservableProp to inspect the observability of a property\");\n }\n return _isObservable(value);\n}\nfunction isObservableProp(value, propName) {\n if ( true && !isStringish(propName)) {\n return die(\"expected a property name as second argument\");\n }\n return _isObservable(value, propName);\n}\n\nfunction keys(obj) {\n if (isObservableObject(obj)) {\n return obj[$mobx].keys_();\n }\n if (isObservableMap(obj) || isObservableSet(obj)) {\n return Array.from(obj.keys());\n }\n if (isObservableArray(obj)) {\n return obj.map(function (_, index) {\n return index;\n });\n }\n die(5);\n}\nfunction values(obj) {\n if (isObservableObject(obj)) {\n return keys(obj).map(function (key) {\n return obj[key];\n });\n }\n if (isObservableMap(obj)) {\n return keys(obj).map(function (key) {\n return obj.get(key);\n });\n }\n if (isObservableSet(obj)) {\n return Array.from(obj.values());\n }\n if (isObservableArray(obj)) {\n return obj.slice();\n }\n die(6);\n}\nfunction entries(obj) {\n if (isObservableObject(obj)) {\n return keys(obj).map(function (key) {\n return [key, obj[key]];\n });\n }\n if (isObservableMap(obj)) {\n return keys(obj).map(function (key) {\n return [key, obj.get(key)];\n });\n }\n if (isObservableSet(obj)) {\n return Array.from(obj.entries());\n }\n if (isObservableArray(obj)) {\n return obj.map(function (key, index) {\n return [index, key];\n });\n }\n die(7);\n}\nfunction set(obj, key, value) {\n if (arguments.length === 2 && !isObservableSet(obj)) {\n startBatch();\n var _values = key;\n try {\n for (var _key in _values) {\n set(obj, _key, _values[_key]);\n }\n } finally {\n endBatch();\n }\n return;\n }\n if (isObservableObject(obj)) {\n obj[$mobx].set_(key, value);\n } else if (isObservableMap(obj)) {\n obj.set(key, value);\n } else if (isObservableSet(obj)) {\n obj.add(key);\n } else if (isObservableArray(obj)) {\n if (typeof key !== \"number\") {\n key = parseInt(key, 10);\n }\n if (key < 0) {\n die(\"Invalid index: '\" + key + \"'\");\n }\n startBatch();\n if (key >= obj.length) {\n obj.length = key + 1;\n }\n obj[key] = value;\n endBatch();\n } else {\n die(8);\n }\n}\nfunction remove(obj, key) {\n if (isObservableObject(obj)) {\n obj[$mobx].delete_(key);\n } else if (isObservableMap(obj)) {\n obj[\"delete\"](key);\n } else if (isObservableSet(obj)) {\n obj[\"delete\"](key);\n } else if (isObservableArray(obj)) {\n if (typeof key !== \"number\") {\n key = parseInt(key, 10);\n }\n obj.splice(key, 1);\n } else {\n die(9);\n }\n}\nfunction has(obj, key) {\n if (isObservableObject(obj)) {\n return obj[$mobx].has_(key);\n } else if (isObservableMap(obj)) {\n return obj.has(key);\n } else if (isObservableSet(obj)) {\n return obj.has(key);\n } else if (isObservableArray(obj)) {\n return key >= 0 && key < obj.length;\n }\n die(10);\n}\nfunction get(obj, key) {\n if (!has(obj, key)) {\n return undefined;\n }\n if (isObservableObject(obj)) {\n return obj[$mobx].get_(key);\n } else if (isObservableMap(obj)) {\n return obj.get(key);\n } else if (isObservableArray(obj)) {\n return obj[key];\n }\n die(11);\n}\nfunction apiDefineProperty(obj, key, descriptor) {\n if (isObservableObject(obj)) {\n return obj[$mobx].defineProperty_(key, descriptor);\n }\n die(39);\n}\nfunction apiOwnKeys(obj) {\n if (isObservableObject(obj)) {\n return obj[$mobx].ownKeys_();\n }\n die(38);\n}\n\nfunction observe(thing, propOrCb, cbOrFire, fireImmediately) {\n if (isFunction(cbOrFire)) {\n return observeObservableProperty(thing, propOrCb, cbOrFire, fireImmediately);\n } else {\n return observeObservable(thing, propOrCb, cbOrFire);\n }\n}\nfunction observeObservable(thing, listener, fireImmediately) {\n return getAdministration(thing).observe_(listener, fireImmediately);\n}\nfunction observeObservableProperty(thing, property, listener, fireImmediately) {\n return getAdministration(thing, property).observe_(listener, fireImmediately);\n}\n\nfunction cache(map, key, value) {\n map.set(key, value);\n return value;\n}\nfunction toJSHelper(source, __alreadySeen) {\n if (source == null || typeof source !== \"object\" || source instanceof Date || !isObservable(source)) {\n return source;\n }\n if (isObservableValue(source) || isComputedValue(source)) {\n return toJSHelper(source.get(), __alreadySeen);\n }\n if (__alreadySeen.has(source)) {\n return __alreadySeen.get(source);\n }\n if (isObservableArray(source)) {\n var res = cache(__alreadySeen, source, new Array(source.length));\n source.forEach(function (value, idx) {\n res[idx] = toJSHelper(value, __alreadySeen);\n });\n return res;\n }\n if (isObservableSet(source)) {\n var _res = cache(__alreadySeen, source, new Set());\n source.forEach(function (value) {\n _res.add(toJSHelper(value, __alreadySeen));\n });\n return _res;\n }\n if (isObservableMap(source)) {\n var _res2 = cache(__alreadySeen, source, new Map());\n source.forEach(function (value, key) {\n _res2.set(key, toJSHelper(value, __alreadySeen));\n });\n return _res2;\n } else {\n // must be observable object\n var _res3 = cache(__alreadySeen, source, {});\n apiOwnKeys(source).forEach(function (key) {\n if (objectPrototype.propertyIsEnumerable.call(source, key)) {\n _res3[key] = toJSHelper(source[key], __alreadySeen);\n }\n });\n return _res3;\n }\n}\n/**\n * Recursively converts an observable to it's non-observable native counterpart.\n * It does NOT recurse into non-observables, these are left as they are, even if they contain observables.\n * Computed and other non-enumerable properties are completely ignored.\n * Complex scenarios require custom solution, eg implementing `toJSON` or using `serializr` lib.\n */\nfunction toJS(source, options) {\n if ( true && options) {\n die(\"toJS no longer supports options\");\n }\n return toJSHelper(source, new Map());\n}\n\nfunction trace() {\n if (false) {}\n var enterBreakPoint = false;\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n if (typeof args[args.length - 1] === \"boolean\") {\n enterBreakPoint = args.pop();\n }\n var derivation = getAtomFromArgs(args);\n if (!derivation) {\n return die(\"'trace(break?)' can only be used inside a tracked computed value or a Reaction. Consider passing in the computed value or reaction explicitly\");\n }\n if (derivation.isTracing_ === TraceMode.NONE) {\n console.log(\"[mobx.trace] '\" + derivation.name_ + \"' tracing enabled\");\n }\n derivation.isTracing_ = enterBreakPoint ? TraceMode.BREAK : TraceMode.LOG;\n}\nfunction getAtomFromArgs(args) {\n switch (args.length) {\n case 0:\n return globalState.trackingDerivation;\n case 1:\n return getAtom(args[0]);\n case 2:\n return getAtom(args[0], args[1]);\n }\n}\n\n/**\n * During a transaction no views are updated until the end of the transaction.\n * The transaction will be run synchronously nonetheless.\n *\n * @param action a function that updates some reactive state\n * @returns any value that was returned by the 'action' parameter.\n */\nfunction transaction(action, thisArg) {\n if (thisArg === void 0) {\n thisArg = undefined;\n }\n startBatch();\n try {\n return action.apply(thisArg);\n } finally {\n endBatch();\n }\n}\n\nfunction when(predicate, arg1, arg2) {\n if (arguments.length === 1 || arg1 && typeof arg1 === \"object\") {\n return whenPromise(predicate, arg1);\n }\n return _when(predicate, arg1, arg2 || {});\n}\nfunction _when(predicate, effect, opts) {\n var timeoutHandle;\n if (typeof opts.timeout === \"number\") {\n var error = new Error(\"WHEN_TIMEOUT\");\n timeoutHandle = setTimeout(function () {\n if (!disposer[$mobx].isDisposed) {\n disposer();\n if (opts.onError) {\n opts.onError(error);\n } else {\n throw error;\n }\n }\n }, opts.timeout);\n }\n opts.name = true ? opts.name || \"When@\" + getNextId() : 0;\n var effectAction = createAction( true ? opts.name + \"-effect\" : 0, effect);\n // eslint-disable-next-line\n var disposer = autorun(function (r) {\n // predicate should not change state\n var cond = allowStateChanges(false, predicate);\n if (cond) {\n r.dispose();\n if (timeoutHandle) {\n clearTimeout(timeoutHandle);\n }\n effectAction();\n }\n }, opts);\n return disposer;\n}\nfunction whenPromise(predicate, opts) {\n var _opts$signal;\n if ( true && opts && opts.onError) {\n return die(\"the options 'onError' and 'promise' cannot be combined\");\n }\n if (opts != null && (_opts$signal = opts.signal) != null && _opts$signal.aborted) {\n return Object.assign(Promise.reject(new Error(\"WHEN_ABORTED\")), {\n cancel: function cancel() {\n return null;\n }\n });\n }\n var cancel;\n var abort;\n var res = new Promise(function (resolve, reject) {\n var _opts$signal2;\n var disposer = _when(predicate, resolve, _extends({}, opts, {\n onError: reject\n }));\n cancel = function cancel() {\n disposer();\n reject(new Error(\"WHEN_CANCELLED\"));\n };\n abort = function abort() {\n disposer();\n reject(new Error(\"WHEN_ABORTED\"));\n };\n opts == null || (_opts$signal2 = opts.signal) == null || _opts$signal2.addEventListener == null || _opts$signal2.addEventListener(\"abort\", abort);\n })[\"finally\"](function () {\n var _opts$signal3;\n return opts == null || (_opts$signal3 = opts.signal) == null || _opts$signal3.removeEventListener == null ? void 0 : _opts$signal3.removeEventListener(\"abort\", abort);\n });\n res.cancel = cancel;\n return res;\n}\n\nfunction getAdm(target) {\n return target[$mobx];\n}\n// Optimization: we don't need the intermediate objects and could have a completely custom administration for DynamicObjects,\n// and skip either the internal values map, or the base object with its property descriptors!\nvar objectProxyTraps = {\n has: function has(target, name) {\n if ( true && globalState.trackingDerivation) {\n warnAboutProxyRequirement(\"detect new properties using the 'in' operator. Use 'has' from 'mobx' instead.\");\n }\n return getAdm(target).has_(name);\n },\n get: function get(target, name) {\n return getAdm(target).get_(name);\n },\n set: function set(target, name, value) {\n var _getAdm$set_;\n if (!isStringish(name)) {\n return false;\n }\n if ( true && !getAdm(target).values_.has(name)) {\n warnAboutProxyRequirement(\"add a new observable property through direct assignment. Use 'set' from 'mobx' instead.\");\n }\n // null (intercepted) -> true (success)\n return (_getAdm$set_ = getAdm(target).set_(name, value, true)) != null ? _getAdm$set_ : true;\n },\n deleteProperty: function deleteProperty(target, name) {\n var _getAdm$delete_;\n if (true) {\n warnAboutProxyRequirement(\"delete properties from an observable object. Use 'remove' from 'mobx' instead.\");\n }\n if (!isStringish(name)) {\n return false;\n }\n // null (intercepted) -> true (success)\n return (_getAdm$delete_ = getAdm(target).delete_(name, true)) != null ? _getAdm$delete_ : true;\n },\n defineProperty: function defineProperty(target, name, descriptor) {\n var _getAdm$definePropert;\n if (true) {\n warnAboutProxyRequirement(\"define property on an observable object. Use 'defineProperty' from 'mobx' instead.\");\n }\n // null (intercepted) -> true (success)\n return (_getAdm$definePropert = getAdm(target).defineProperty_(name, descriptor)) != null ? _getAdm$definePropert : true;\n },\n ownKeys: function ownKeys(target) {\n if ( true && globalState.trackingDerivation) {\n warnAboutProxyRequirement(\"iterate keys to detect added / removed properties. Use 'keys' from 'mobx' instead.\");\n }\n return getAdm(target).ownKeys_();\n },\n preventExtensions: function preventExtensions(target) {\n die(13);\n }\n};\nfunction asDynamicObservableObject(target, options) {\n var _target$$mobx, _target$$mobx$proxy_;\n assertProxies();\n target = asObservableObject(target, options);\n return (_target$$mobx$proxy_ = (_target$$mobx = target[$mobx]).proxy_) != null ? _target$$mobx$proxy_ : _target$$mobx.proxy_ = new Proxy(target, objectProxyTraps);\n}\n\nfunction hasInterceptors(interceptable) {\n return interceptable.interceptors_ !== undefined && interceptable.interceptors_.length > 0;\n}\nfunction registerInterceptor(interceptable, handler) {\n var interceptors = interceptable.interceptors_ || (interceptable.interceptors_ = []);\n interceptors.push(handler);\n return once(function () {\n var idx = interceptors.indexOf(handler);\n if (idx !== -1) {\n interceptors.splice(idx, 1);\n }\n });\n}\nfunction interceptChange(interceptable, change) {\n var prevU = untrackedStart();\n try {\n // Interceptor can modify the array, copy it to avoid concurrent modification, see #1950\n var interceptors = [].concat(interceptable.interceptors_ || []);\n for (var i = 0, l = interceptors.length; i < l; i++) {\n change = interceptors[i](change);\n if (change && !change.type) {\n die(14);\n }\n if (!change) {\n break;\n }\n }\n return change;\n } finally {\n untrackedEnd(prevU);\n }\n}\n\nfunction hasListeners(listenable) {\n return listenable.changeListeners_ !== undefined && listenable.changeListeners_.length > 0;\n}\nfunction registerListener(listenable, handler) {\n var listeners = listenable.changeListeners_ || (listenable.changeListeners_ = []);\n listeners.push(handler);\n return once(function () {\n var idx = listeners.indexOf(handler);\n if (idx !== -1) {\n listeners.splice(idx, 1);\n }\n });\n}\nfunction notifyListeners(listenable, change) {\n var prevU = untrackedStart();\n var listeners = listenable.changeListeners_;\n if (!listeners) {\n return;\n }\n listeners = listeners.slice();\n for (var i = 0, l = listeners.length; i < l; i++) {\n listeners[i](change);\n }\n untrackedEnd(prevU);\n}\n\nfunction makeObservable(target, annotations, options) {\n initObservable(function () {\n var _annotations;\n var adm = asObservableObject(target, options)[$mobx];\n if ( true && annotations && target[storedAnnotationsSymbol]) {\n die(\"makeObservable second arg must be nullish when using decorators. Mixing @decorator syntax with annotations is not supported.\");\n }\n // Default to decorators\n (_annotations = annotations) != null ? _annotations : annotations = collectStoredAnnotations(target);\n // Annotate\n ownKeys(annotations).forEach(function (key) {\n return adm.make_(key, annotations[key]);\n });\n });\n return target;\n}\n// proto[keysSymbol] = new Set()\nvar keysSymbol = /*#__PURE__*/Symbol(\"mobx-keys\");\nfunction makeAutoObservable(target, overrides, options) {\n if (true) {\n if (!isPlainObject(target) && !isPlainObject(Object.getPrototypeOf(target))) {\n die(\"'makeAutoObservable' can only be used for classes that don't have a superclass\");\n }\n if (isObservableObject(target)) {\n die(\"makeAutoObservable can only be used on objects not already made observable\");\n }\n }\n // Optimization: avoid visiting protos\n // Assumes that annotation.make_/.extend_ works the same for plain objects\n if (isPlainObject(target)) {\n return extendObservable(target, target, overrides, options);\n }\n initObservable(function () {\n var adm = asObservableObject(target, options)[$mobx];\n // Optimization: cache keys on proto\n // Assumes makeAutoObservable can be called only once per object and can't be used in subclass\n if (!target[keysSymbol]) {\n var proto = Object.getPrototypeOf(target);\n var keys = new Set([].concat(ownKeys(target), ownKeys(proto)));\n keys[\"delete\"](\"constructor\");\n keys[\"delete\"]($mobx);\n addHiddenProp(proto, keysSymbol, keys);\n }\n target[keysSymbol].forEach(function (key) {\n return adm.make_(key,\n // must pass \"undefined\" for { key: undefined }\n !overrides ? true : key in overrides ? overrides[key] : true);\n });\n });\n return target;\n}\n\nvar SPLICE = \"splice\";\nvar UPDATE = \"update\";\nvar MAX_SPLICE_SIZE = 10000; // See e.g. https://github.com/mobxjs/mobx/issues/859\nvar arrayTraps = {\n get: function get(target, name) {\n var adm = target[$mobx];\n if (name === $mobx) {\n return adm;\n }\n if (name === \"length\") {\n return adm.getArrayLength_();\n }\n if (typeof name === \"string\" && !isNaN(name)) {\n return adm.get_(parseInt(name));\n }\n if (hasProp(arrayExtensions, name)) {\n return arrayExtensions[name];\n }\n return target[name];\n },\n set: function set(target, name, value) {\n var adm = target[$mobx];\n if (name === \"length\") {\n adm.setArrayLength_(value);\n }\n if (typeof name === \"symbol\" || isNaN(name)) {\n target[name] = value;\n } else {\n // numeric string\n adm.set_(parseInt(name), value);\n }\n return true;\n },\n preventExtensions: function preventExtensions() {\n die(15);\n }\n};\nvar ObservableArrayAdministration = /*#__PURE__*/function () {\n function ObservableArrayAdministration(name, enhancer, owned_, legacyMode_) {\n if (name === void 0) {\n name = true ? \"ObservableArray@\" + getNextId() : 0;\n }\n this.owned_ = void 0;\n this.legacyMode_ = void 0;\n this.atom_ = void 0;\n this.values_ = [];\n // this is the prop that gets proxied, so can't replace it!\n this.interceptors_ = void 0;\n this.changeListeners_ = void 0;\n this.enhancer_ = void 0;\n this.dehancer = void 0;\n this.proxy_ = void 0;\n this.lastKnownLength_ = 0;\n this.owned_ = owned_;\n this.legacyMode_ = legacyMode_;\n this.atom_ = new Atom(name);\n this.enhancer_ = function (newV, oldV) {\n return enhancer(newV, oldV, true ? name + \"[..]\" : 0);\n };\n }\n var _proto = ObservableArrayAdministration.prototype;\n _proto.dehanceValue_ = function dehanceValue_(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.dehanceValues_ = function dehanceValues_(values) {\n if (this.dehancer !== undefined && values.length > 0) {\n return values.map(this.dehancer);\n }\n return values;\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n if (fireImmediately === void 0) {\n fireImmediately = false;\n }\n if (fireImmediately) {\n listener({\n observableKind: \"array\",\n object: this.proxy_,\n debugObjectName: this.atom_.name_,\n type: \"splice\",\n index: 0,\n added: this.values_.slice(),\n addedCount: this.values_.length,\n removed: [],\n removedCount: 0\n });\n }\n return registerListener(this, listener);\n };\n _proto.getArrayLength_ = function getArrayLength_() {\n this.atom_.reportObserved();\n return this.values_.length;\n };\n _proto.setArrayLength_ = function setArrayLength_(newLength) {\n if (typeof newLength !== \"number\" || isNaN(newLength) || newLength < 0) {\n die(\"Out of range: \" + newLength);\n }\n var currentLength = this.values_.length;\n if (newLength === currentLength) {\n return;\n } else if (newLength > currentLength) {\n var newItems = new Array(newLength - currentLength);\n for (var i = 0; i < newLength - currentLength; i++) {\n newItems[i] = undefined;\n } // No Array.fill everywhere...\n this.spliceWithArray_(currentLength, 0, newItems);\n } else {\n this.spliceWithArray_(newLength, currentLength - newLength);\n }\n };\n _proto.updateArrayLength_ = function updateArrayLength_(oldLength, delta) {\n if (oldLength !== this.lastKnownLength_) {\n die(16);\n }\n this.lastKnownLength_ += delta;\n if (this.legacyMode_ && delta > 0) {\n reserveArrayBuffer(oldLength + delta + 1);\n }\n };\n _proto.spliceWithArray_ = function spliceWithArray_(index, deleteCount, newItems) {\n var _this = this;\n checkIfStateModificationsAreAllowed(this.atom_);\n var length = this.values_.length;\n if (index === undefined) {\n index = 0;\n } else if (index > length) {\n index = length;\n } else if (index < 0) {\n index = Math.max(0, length + index);\n }\n if (arguments.length === 1) {\n deleteCount = length - index;\n } else if (deleteCount === undefined || deleteCount === null) {\n deleteCount = 0;\n } else {\n deleteCount = Math.max(0, Math.min(deleteCount, length - index));\n }\n if (newItems === undefined) {\n newItems = EMPTY_ARRAY;\n }\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_,\n type: SPLICE,\n index: index,\n removedCount: deleteCount,\n added: newItems\n });\n if (!change) {\n return EMPTY_ARRAY;\n }\n deleteCount = change.removedCount;\n newItems = change.added;\n }\n newItems = newItems.length === 0 ? newItems : newItems.map(function (v) {\n return _this.enhancer_(v, undefined);\n });\n if (this.legacyMode_ || \"development\" !== \"production\") {\n var lengthDelta = newItems.length - deleteCount;\n this.updateArrayLength_(length, lengthDelta); // checks if internal array wasn't modified\n }\n var res = this.spliceItemsIntoValues_(index, deleteCount, newItems);\n if (deleteCount !== 0 || newItems.length !== 0) {\n this.notifyArraySplice_(index, newItems, res);\n }\n return this.dehanceValues_(res);\n };\n _proto.spliceItemsIntoValues_ = function spliceItemsIntoValues_(index, deleteCount, newItems) {\n if (newItems.length < MAX_SPLICE_SIZE) {\n var _this$values_;\n return (_this$values_ = this.values_).splice.apply(_this$values_, [index, deleteCount].concat(newItems));\n } else {\n // The items removed by the splice\n var res = this.values_.slice(index, index + deleteCount);\n // The items that that should remain at the end of the array\n var oldItems = this.values_.slice(index + deleteCount);\n // New length is the previous length + addition count - deletion count\n this.values_.length += newItems.length - deleteCount;\n for (var i = 0; i < newItems.length; i++) {\n this.values_[index + i] = newItems[i];\n }\n for (var _i = 0; _i < oldItems.length; _i++) {\n this.values_[index + newItems.length + _i] = oldItems[_i];\n }\n return res;\n }\n };\n _proto.notifyArrayChildUpdate_ = function notifyArrayChildUpdate_(index, newValue, oldValue) {\n var notifySpy = !this.owned_ && isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"array\",\n object: this.proxy_,\n type: UPDATE,\n debugObjectName: this.atom_.name_,\n index: index,\n newValue: newValue,\n oldValue: oldValue\n } : null;\n // The reason why this is on right hand side here (and not above), is this way the uglifier will drop it, but it won't\n // cause any runtime overhead in development mode without NODE_ENV set, unless spying is enabled\n if ( true && notifySpy) {\n spyReportStart(change);\n }\n this.atom_.reportChanged();\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n };\n _proto.notifyArraySplice_ = function notifyArraySplice_(index, added, removed) {\n var notifySpy = !this.owned_ && isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"array\",\n object: this.proxy_,\n debugObjectName: this.atom_.name_,\n type: SPLICE,\n index: index,\n removed: removed,\n added: added,\n removedCount: removed.length,\n addedCount: added.length\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n }\n this.atom_.reportChanged();\n // conform: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/observe\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n };\n _proto.get_ = function get_(index) {\n if (this.legacyMode_ && index >= this.values_.length) {\n console.warn( true ? \"[mobx.array] Attempt to read an array index (\" + index + \") that is out of bounds (\" + this.values_.length + \"). Please check length first. Out of bound indices will not be tracked by MobX\" : 0);\n return undefined;\n }\n this.atom_.reportObserved();\n return this.dehanceValue_(this.values_[index]);\n };\n _proto.set_ = function set_(index, newValue) {\n var values = this.values_;\n if (this.legacyMode_ && index > values.length) {\n // out of bounds\n die(17, index, values.length);\n }\n if (index < values.length) {\n // update at index in range\n checkIfStateModificationsAreAllowed(this.atom_);\n var oldValue = values[index];\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: UPDATE,\n object: this.proxy_,\n // since \"this\" is the real array we need to pass its proxy\n index: index,\n newValue: newValue\n });\n if (!change) {\n return;\n }\n newValue = change.newValue;\n }\n newValue = this.enhancer_(newValue, oldValue);\n var changed = newValue !== oldValue;\n if (changed) {\n values[index] = newValue;\n this.notifyArrayChildUpdate_(index, newValue, oldValue);\n }\n } else {\n // For out of bound index, we don't create an actual sparse array,\n // but rather fill the holes with undefined (same as setArrayLength_).\n // This could be considered a bug.\n var newItems = new Array(index + 1 - values.length);\n for (var i = 0; i < newItems.length - 1; i++) {\n newItems[i] = undefined;\n } // No Array.fill everywhere...\n newItems[newItems.length - 1] = newValue;\n this.spliceWithArray_(values.length, 0, newItems);\n }\n };\n return ObservableArrayAdministration;\n}();\nfunction createObservableArray(initialValues, enhancer, name, owned) {\n if (name === void 0) {\n name = true ? \"ObservableArray@\" + getNextId() : 0;\n }\n if (owned === void 0) {\n owned = false;\n }\n assertProxies();\n return initObservable(function () {\n var adm = new ObservableArrayAdministration(name, enhancer, owned, false);\n addHiddenFinalProp(adm.values_, $mobx, adm);\n var proxy = new Proxy(adm.values_, arrayTraps);\n adm.proxy_ = proxy;\n if (initialValues && initialValues.length) {\n adm.spliceWithArray_(0, 0, initialValues);\n }\n return proxy;\n });\n}\n// eslint-disable-next-line\nvar arrayExtensions = {\n clear: function clear() {\n return this.splice(0);\n },\n replace: function replace(newItems) {\n var adm = this[$mobx];\n return adm.spliceWithArray_(0, adm.values_.length, newItems);\n },\n // Used by JSON.stringify\n toJSON: function toJSON() {\n return this.slice();\n },\n /*\n * functions that do alter the internal structure of the array, (based on lib.es6.d.ts)\n * since these functions alter the inner structure of the array, the have side effects.\n * Because the have side effects, they should not be used in computed function,\n * and for that reason the do not call dependencyState.notifyObserved\n */\n splice: function splice(index, deleteCount) {\n for (var _len = arguments.length, newItems = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {\n newItems[_key - 2] = arguments[_key];\n }\n var adm = this[$mobx];\n switch (arguments.length) {\n case 0:\n return [];\n case 1:\n return adm.spliceWithArray_(index);\n case 2:\n return adm.spliceWithArray_(index, deleteCount);\n }\n return adm.spliceWithArray_(index, deleteCount, newItems);\n },\n spliceWithArray: function spliceWithArray(index, deleteCount, newItems) {\n return this[$mobx].spliceWithArray_(index, deleteCount, newItems);\n },\n push: function push() {\n var adm = this[$mobx];\n for (var _len2 = arguments.length, items = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n items[_key2] = arguments[_key2];\n }\n adm.spliceWithArray_(adm.values_.length, 0, items);\n return adm.values_.length;\n },\n pop: function pop() {\n return this.splice(Math.max(this[$mobx].values_.length - 1, 0), 1)[0];\n },\n shift: function shift() {\n return this.splice(0, 1)[0];\n },\n unshift: function unshift() {\n var adm = this[$mobx];\n for (var _len3 = arguments.length, items = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n items[_key3] = arguments[_key3];\n }\n adm.spliceWithArray_(0, 0, items);\n return adm.values_.length;\n },\n reverse: function reverse() {\n // reverse by default mutates in place before returning the result\n // which makes it both a 'derivation' and a 'mutation'.\n if (globalState.trackingDerivation) {\n die(37, \"reverse\");\n }\n this.replace(this.slice().reverse());\n return this;\n },\n sort: function sort() {\n // sort by default mutates in place before returning the result\n // which goes against all good practices. Let's not change the array in place!\n if (globalState.trackingDerivation) {\n die(37, \"sort\");\n }\n var copy = this.slice();\n copy.sort.apply(copy, arguments);\n this.replace(copy);\n return this;\n },\n remove: function remove(value) {\n var adm = this[$mobx];\n var idx = adm.dehanceValues_(adm.values_).indexOf(value);\n if (idx > -1) {\n this.splice(idx, 1);\n return true;\n }\n return false;\n }\n};\n/**\n * Wrap function from prototype\n * Without this, everything works as well, but this works\n * faster as everything works on unproxied values\n */\naddArrayExtension(\"at\", simpleFunc);\naddArrayExtension(\"concat\", simpleFunc);\naddArrayExtension(\"flat\", simpleFunc);\naddArrayExtension(\"includes\", simpleFunc);\naddArrayExtension(\"indexOf\", simpleFunc);\naddArrayExtension(\"join\", simpleFunc);\naddArrayExtension(\"lastIndexOf\", simpleFunc);\naddArrayExtension(\"slice\", simpleFunc);\naddArrayExtension(\"toString\", simpleFunc);\naddArrayExtension(\"toLocaleString\", simpleFunc);\naddArrayExtension(\"toSorted\", simpleFunc);\naddArrayExtension(\"toSpliced\", simpleFunc);\naddArrayExtension(\"with\", simpleFunc);\n// map\naddArrayExtension(\"every\", mapLikeFunc);\naddArrayExtension(\"filter\", mapLikeFunc);\naddArrayExtension(\"find\", mapLikeFunc);\naddArrayExtension(\"findIndex\", mapLikeFunc);\naddArrayExtension(\"findLast\", mapLikeFunc);\naddArrayExtension(\"findLastIndex\", mapLikeFunc);\naddArrayExtension(\"flatMap\", mapLikeFunc);\naddArrayExtension(\"forEach\", mapLikeFunc);\naddArrayExtension(\"map\", mapLikeFunc);\naddArrayExtension(\"some\", mapLikeFunc);\naddArrayExtension(\"toReversed\", mapLikeFunc);\n// reduce\naddArrayExtension(\"reduce\", reduceLikeFunc);\naddArrayExtension(\"reduceRight\", reduceLikeFunc);\nfunction addArrayExtension(funcName, funcFactory) {\n if (typeof Array.prototype[funcName] === \"function\") {\n arrayExtensions[funcName] = funcFactory(funcName);\n }\n}\n// Report and delegate to dehanced array\nfunction simpleFunc(funcName) {\n return function () {\n var adm = this[$mobx];\n adm.atom_.reportObserved();\n var dehancedValues = adm.dehanceValues_(adm.values_);\n return dehancedValues[funcName].apply(dehancedValues, arguments);\n };\n}\n// Make sure callbacks receive correct array arg #2326\nfunction mapLikeFunc(funcName) {\n return function (callback, thisArg) {\n var _this2 = this;\n var adm = this[$mobx];\n adm.atom_.reportObserved();\n var dehancedValues = adm.dehanceValues_(adm.values_);\n return dehancedValues[funcName](function (element, index) {\n return callback.call(thisArg, element, index, _this2);\n });\n };\n}\n// Make sure callbacks receive correct array arg #2326\nfunction reduceLikeFunc(funcName) {\n return function () {\n var _this3 = this;\n var adm = this[$mobx];\n adm.atom_.reportObserved();\n var dehancedValues = adm.dehanceValues_(adm.values_);\n // #2432 - reduce behavior depends on arguments.length\n var callback = arguments[0];\n arguments[0] = function (accumulator, currentValue, index) {\n return callback(accumulator, currentValue, index, _this3);\n };\n return dehancedValues[funcName].apply(dehancedValues, arguments);\n };\n}\nvar isObservableArrayAdministration = /*#__PURE__*/createInstanceofPredicate(\"ObservableArrayAdministration\", ObservableArrayAdministration);\nfunction isObservableArray(thing) {\n return isObject(thing) && isObservableArrayAdministration(thing[$mobx]);\n}\n\nvar ObservableMapMarker = {};\nvar ADD = \"add\";\nvar DELETE = \"delete\";\n// just extend Map? See also https://gist.github.com/nestharus/13b4d74f2ef4a2f4357dbd3fc23c1e54\n// But: https://github.com/mobxjs/mobx/issues/1556\nvar ObservableMap = /*#__PURE__*/function () {\n function ObservableMap(initialData, enhancer_, name_) {\n var _this = this;\n if (enhancer_ === void 0) {\n enhancer_ = deepEnhancer;\n }\n if (name_ === void 0) {\n name_ = true ? \"ObservableMap@\" + getNextId() : 0;\n }\n this.enhancer_ = void 0;\n this.name_ = void 0;\n this[$mobx] = ObservableMapMarker;\n this.data_ = void 0;\n this.hasMap_ = void 0;\n // hasMap, not hashMap >-).\n this.keysAtom_ = void 0;\n this.interceptors_ = void 0;\n this.changeListeners_ = void 0;\n this.dehancer = void 0;\n this.enhancer_ = enhancer_;\n this.name_ = name_;\n if (!isFunction(Map)) {\n die(18);\n }\n initObservable(function () {\n _this.keysAtom_ = createAtom( true ? _this.name_ + \".keys()\" : 0);\n _this.data_ = new Map();\n _this.hasMap_ = new Map();\n if (initialData) {\n _this.merge(initialData);\n }\n });\n }\n var _proto = ObservableMap.prototype;\n _proto.has_ = function has_(key) {\n return this.data_.has(key);\n };\n _proto.has = function has(key) {\n var _this2 = this;\n if (!globalState.trackingDerivation) {\n return this.has_(key);\n }\n var entry = this.hasMap_.get(key);\n if (!entry) {\n var newEntry = entry = new ObservableValue(this.has_(key), referenceEnhancer, true ? this.name_ + \".\" + stringifyKey(key) + \"?\" : 0, false);\n this.hasMap_.set(key, newEntry);\n onBecomeUnobserved(newEntry, function () {\n return _this2.hasMap_[\"delete\"](key);\n });\n }\n return entry.get();\n };\n _proto.set = function set(key, value) {\n var hasKey = this.has_(key);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: hasKey ? UPDATE : ADD,\n object: this,\n newValue: value,\n name: key\n });\n if (!change) {\n return this;\n }\n value = change.newValue;\n }\n if (hasKey) {\n this.updateValue_(key, value);\n } else {\n this.addValue_(key, value);\n }\n return this;\n };\n _proto[\"delete\"] = function _delete(key) {\n var _this3 = this;\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: DELETE,\n object: this,\n name: key\n });\n if (!change) {\n return false;\n }\n }\n if (this.has_(key)) {\n var notifySpy = isSpyEnabled();\n var notify = hasListeners(this);\n var _change = notify || notifySpy ? {\n observableKind: \"map\",\n debugObjectName: this.name_,\n type: DELETE,\n object: this,\n oldValue: this.data_.get(key).value_,\n name: key\n } : null;\n if ( true && notifySpy) {\n spyReportStart(_change);\n } // TODO fix type\n transaction(function () {\n var _this3$hasMap_$get;\n _this3.keysAtom_.reportChanged();\n (_this3$hasMap_$get = _this3.hasMap_.get(key)) == null || _this3$hasMap_$get.setNewValue_(false);\n var observable = _this3.data_.get(key);\n observable.setNewValue_(undefined);\n _this3.data_[\"delete\"](key);\n });\n if (notify) {\n notifyListeners(this, _change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n return true;\n }\n return false;\n };\n _proto.updateValue_ = function updateValue_(key, newValue) {\n var observable = this.data_.get(key);\n newValue = observable.prepareNewValue_(newValue);\n if (newValue !== globalState.UNCHANGED) {\n var notifySpy = isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"map\",\n debugObjectName: this.name_,\n type: UPDATE,\n object: this,\n oldValue: observable.value_,\n name: key,\n newValue: newValue\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n } // TODO fix type\n observable.setNewValue_(newValue);\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n };\n _proto.addValue_ = function addValue_(key, newValue) {\n var _this4 = this;\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n transaction(function () {\n var _this4$hasMap_$get;\n var observable = new ObservableValue(newValue, _this4.enhancer_, true ? _this4.name_ + \".\" + stringifyKey(key) : 0, false);\n _this4.data_.set(key, observable);\n newValue = observable.value_; // value might have been changed\n (_this4$hasMap_$get = _this4.hasMap_.get(key)) == null || _this4$hasMap_$get.setNewValue_(true);\n _this4.keysAtom_.reportChanged();\n });\n var notifySpy = isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"map\",\n debugObjectName: this.name_,\n type: ADD,\n object: this,\n name: key,\n newValue: newValue\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n } // TODO fix type\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n };\n _proto.get = function get(key) {\n if (this.has(key)) {\n return this.dehanceValue_(this.data_.get(key).get());\n }\n return this.dehanceValue_(undefined);\n };\n _proto.dehanceValue_ = function dehanceValue_(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.keys = function keys() {\n this.keysAtom_.reportObserved();\n return this.data_.keys();\n };\n _proto.values = function values() {\n var self = this;\n var keys = this.keys();\n return makeIterableForMap({\n next: function next() {\n var _keys$next = keys.next(),\n done = _keys$next.done,\n value = _keys$next.value;\n return {\n done: done,\n value: done ? undefined : self.get(value)\n };\n }\n });\n };\n _proto.entries = function entries() {\n var self = this;\n var keys = this.keys();\n return makeIterableForMap({\n next: function next() {\n var _keys$next2 = keys.next(),\n done = _keys$next2.done,\n value = _keys$next2.value;\n return {\n done: done,\n value: done ? undefined : [value, self.get(value)]\n };\n }\n });\n };\n _proto[Symbol.iterator] = function () {\n return this.entries();\n };\n _proto.forEach = function forEach(callback, thisArg) {\n for (var _iterator = _createForOfIteratorHelperLoose(this), _step; !(_step = _iterator()).done;) {\n var _step$value = _step.value,\n key = _step$value[0],\n value = _step$value[1];\n callback.call(thisArg, value, key, this);\n }\n }\n /** Merge another object into this object, returns this. */;\n _proto.merge = function merge(other) {\n var _this5 = this;\n if (isObservableMap(other)) {\n other = new Map(other);\n }\n transaction(function () {\n if (isPlainObject(other)) {\n getPlainObjectKeys(other).forEach(function (key) {\n return _this5.set(key, other[key]);\n });\n } else if (Array.isArray(other)) {\n other.forEach(function (_ref) {\n var key = _ref[0],\n value = _ref[1];\n return _this5.set(key, value);\n });\n } else if (isES6Map(other)) {\n if (!isPlainES6Map(other)) {\n die(19, other);\n }\n other.forEach(function (value, key) {\n return _this5.set(key, value);\n });\n } else if (other !== null && other !== undefined) {\n die(20, other);\n }\n });\n return this;\n };\n _proto.clear = function clear() {\n var _this6 = this;\n transaction(function () {\n untracked(function () {\n for (var _iterator2 = _createForOfIteratorHelperLoose(_this6.keys()), _step2; !(_step2 = _iterator2()).done;) {\n var key = _step2.value;\n _this6[\"delete\"](key);\n }\n });\n });\n };\n _proto.replace = function replace(values) {\n var _this7 = this;\n // Implementation requirements:\n // - respect ordering of replacement map\n // - allow interceptors to run and potentially prevent individual operations\n // - don't recreate observables that already exist in original map (so we don't destroy existing subscriptions)\n // - don't _keysAtom.reportChanged if the keys of resulting map are indentical (order matters!)\n // - note that result map may differ from replacement map due to the interceptors\n transaction(function () {\n // Convert to map so we can do quick key lookups\n var replacementMap = convertToMap(values);\n var orderedData = new Map();\n // Used for optimization\n var keysReportChangedCalled = false;\n // Delete keys that don't exist in replacement map\n // if the key deletion is prevented by interceptor\n // add entry at the beginning of the result map\n for (var _iterator3 = _createForOfIteratorHelperLoose(_this7.data_.keys()), _step3; !(_step3 = _iterator3()).done;) {\n var key = _step3.value;\n // Concurrently iterating/deleting keys\n // iterator should handle this correctly\n if (!replacementMap.has(key)) {\n var deleted = _this7[\"delete\"](key);\n // Was the key removed?\n if (deleted) {\n // _keysAtom.reportChanged() was already called\n keysReportChangedCalled = true;\n } else {\n // Delete prevented by interceptor\n var value = _this7.data_.get(key);\n orderedData.set(key, value);\n }\n }\n }\n // Merge entries\n for (var _iterator4 = _createForOfIteratorHelperLoose(replacementMap.entries()), _step4; !(_step4 = _iterator4()).done;) {\n var _step4$value = _step4.value,\n _key = _step4$value[0],\n _value = _step4$value[1];\n // We will want to know whether a new key is added\n var keyExisted = _this7.data_.has(_key);\n // Add or update value\n _this7.set(_key, _value);\n // The addition could have been prevent by interceptor\n if (_this7.data_.has(_key)) {\n // The update could have been prevented by interceptor\n // and also we want to preserve existing values\n // so use value from _data map (instead of replacement map)\n var _value2 = _this7.data_.get(_key);\n orderedData.set(_key, _value2);\n // Was a new key added?\n if (!keyExisted) {\n // _keysAtom.reportChanged() was already called\n keysReportChangedCalled = true;\n }\n }\n }\n // Check for possible key order change\n if (!keysReportChangedCalled) {\n if (_this7.data_.size !== orderedData.size) {\n // If size differs, keys are definitely modified\n _this7.keysAtom_.reportChanged();\n } else {\n var iter1 = _this7.data_.keys();\n var iter2 = orderedData.keys();\n var next1 = iter1.next();\n var next2 = iter2.next();\n while (!next1.done) {\n if (next1.value !== next2.value) {\n _this7.keysAtom_.reportChanged();\n break;\n }\n next1 = iter1.next();\n next2 = iter2.next();\n }\n }\n }\n // Use correctly ordered map\n _this7.data_ = orderedData;\n });\n return this;\n };\n _proto.toString = function toString() {\n return \"[object ObservableMap]\";\n };\n _proto.toJSON = function toJSON() {\n return Array.from(this);\n };\n /**\n * Observes this object. Triggers for the events 'add', 'update' and 'delete'.\n * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe\n * for callback details\n */\n _proto.observe_ = function observe_(listener, fireImmediately) {\n if ( true && fireImmediately === true) {\n die(\"`observe` doesn't support fireImmediately=true in combination with maps.\");\n }\n return registerListener(this, listener);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n return _createClass(ObservableMap, [{\n key: \"size\",\n get: function get() {\n this.keysAtom_.reportObserved();\n return this.data_.size;\n }\n }, {\n key: Symbol.toStringTag,\n get: function get() {\n return \"Map\";\n }\n }]);\n}();\n// eslint-disable-next-line\nvar isObservableMap = /*#__PURE__*/createInstanceofPredicate(\"ObservableMap\", ObservableMap);\nfunction makeIterableForMap(iterator) {\n iterator[Symbol.toStringTag] = \"MapIterator\";\n return makeIterable(iterator);\n}\nfunction convertToMap(dataStructure) {\n if (isES6Map(dataStructure) || isObservableMap(dataStructure)) {\n return dataStructure;\n } else if (Array.isArray(dataStructure)) {\n return new Map(dataStructure);\n } else if (isPlainObject(dataStructure)) {\n var map = new Map();\n for (var key in dataStructure) {\n map.set(key, dataStructure[key]);\n }\n return map;\n } else {\n return die(21, dataStructure);\n }\n}\n\nvar ObservableSetMarker = {};\nvar ObservableSet = /*#__PURE__*/function () {\n function ObservableSet(initialData, enhancer, name_) {\n var _this = this;\n if (enhancer === void 0) {\n enhancer = deepEnhancer;\n }\n if (name_ === void 0) {\n name_ = true ? \"ObservableSet@\" + getNextId() : 0;\n }\n this.name_ = void 0;\n this[$mobx] = ObservableSetMarker;\n this.data_ = new Set();\n this.atom_ = void 0;\n this.changeListeners_ = void 0;\n this.interceptors_ = void 0;\n this.dehancer = void 0;\n this.enhancer_ = void 0;\n this.name_ = name_;\n if (!isFunction(Set)) {\n die(22);\n }\n this.enhancer_ = function (newV, oldV) {\n return enhancer(newV, oldV, name_);\n };\n initObservable(function () {\n _this.atom_ = createAtom(_this.name_);\n if (initialData) {\n _this.replace(initialData);\n }\n });\n }\n var _proto = ObservableSet.prototype;\n _proto.dehanceValue_ = function dehanceValue_(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.clear = function clear() {\n var _this2 = this;\n transaction(function () {\n untracked(function () {\n for (var _iterator = _createForOfIteratorHelperLoose(_this2.data_.values()), _step; !(_step = _iterator()).done;) {\n var value = _step.value;\n _this2[\"delete\"](value);\n }\n });\n });\n };\n _proto.forEach = function forEach(callbackFn, thisArg) {\n for (var _iterator2 = _createForOfIteratorHelperLoose(this), _step2; !(_step2 = _iterator2()).done;) {\n var value = _step2.value;\n callbackFn.call(thisArg, value, value, this);\n }\n };\n _proto.add = function add(value) {\n var _this3 = this;\n checkIfStateModificationsAreAllowed(this.atom_);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: ADD,\n object: this,\n newValue: value\n });\n if (!change) {\n return this;\n }\n // ideally, value = change.value would be done here, so that values can be\n // changed by interceptor. Same applies for other Set and Map api's.\n }\n if (!this.has(value)) {\n transaction(function () {\n _this3.data_.add(_this3.enhancer_(value, undefined));\n _this3.atom_.reportChanged();\n });\n var notifySpy = true && isSpyEnabled();\n var notify = hasListeners(this);\n var _change = notify || notifySpy ? {\n observableKind: \"set\",\n debugObjectName: this.name_,\n type: ADD,\n object: this,\n newValue: value\n } : null;\n if (notifySpy && \"development\" !== \"production\") {\n spyReportStart(_change);\n }\n if (notify) {\n notifyListeners(this, _change);\n }\n if (notifySpy && \"development\" !== \"production\") {\n spyReportEnd();\n }\n }\n return this;\n };\n _proto[\"delete\"] = function _delete(value) {\n var _this4 = this;\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: DELETE,\n object: this,\n oldValue: value\n });\n if (!change) {\n return false;\n }\n }\n if (this.has(value)) {\n var notifySpy = true && isSpyEnabled();\n var notify = hasListeners(this);\n var _change2 = notify || notifySpy ? {\n observableKind: \"set\",\n debugObjectName: this.name_,\n type: DELETE,\n object: this,\n oldValue: value\n } : null;\n if (notifySpy && \"development\" !== \"production\") {\n spyReportStart(_change2);\n }\n transaction(function () {\n _this4.atom_.reportChanged();\n _this4.data_[\"delete\"](value);\n });\n if (notify) {\n notifyListeners(this, _change2);\n }\n if (notifySpy && \"development\" !== \"production\") {\n spyReportEnd();\n }\n return true;\n }\n return false;\n };\n _proto.has = function has(value) {\n this.atom_.reportObserved();\n return this.data_.has(this.dehanceValue_(value));\n };\n _proto.entries = function entries() {\n var nextIndex = 0;\n var keys = Array.from(this.keys());\n var values = Array.from(this.values());\n return makeIterableForSet({\n next: function next() {\n var index = nextIndex;\n nextIndex += 1;\n return index < values.length ? {\n value: [keys[index], values[index]],\n done: false\n } : {\n value: undefined,\n done: true\n };\n }\n });\n };\n _proto.keys = function keys() {\n return this.values();\n };\n _proto.values = function values() {\n this.atom_.reportObserved();\n var self = this;\n var nextIndex = 0;\n var observableValues = Array.from(this.data_.values());\n return makeIterableForSet({\n next: function next() {\n return nextIndex < observableValues.length ? {\n value: self.dehanceValue_(observableValues[nextIndex++]),\n done: false\n } : {\n value: undefined,\n done: true\n };\n }\n });\n };\n _proto.intersection = function intersection(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.intersection(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.intersection(otherSet);\n }\n };\n _proto.union = function union(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.union(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.union(otherSet);\n }\n };\n _proto.difference = function difference(otherSet) {\n return new Set(this).difference(otherSet);\n };\n _proto.symmetricDifference = function symmetricDifference(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.symmetricDifference(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.symmetricDifference(otherSet);\n }\n };\n _proto.isSubsetOf = function isSubsetOf(otherSet) {\n return new Set(this).isSubsetOf(otherSet);\n };\n _proto.isSupersetOf = function isSupersetOf(otherSet) {\n return new Set(this).isSupersetOf(otherSet);\n };\n _proto.isDisjointFrom = function isDisjointFrom(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.isDisjointFrom(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.isDisjointFrom(otherSet);\n }\n };\n _proto.replace = function replace(other) {\n var _this5 = this;\n if (isObservableSet(other)) {\n other = new Set(other);\n }\n transaction(function () {\n if (Array.isArray(other)) {\n _this5.clear();\n other.forEach(function (value) {\n return _this5.add(value);\n });\n } else if (isES6Set(other)) {\n _this5.clear();\n other.forEach(function (value) {\n return _this5.add(value);\n });\n } else if (other !== null && other !== undefined) {\n die(\"Cannot initialize set from \" + other);\n }\n });\n return this;\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n // ... 'fireImmediately' could also be true?\n if ( true && fireImmediately === true) {\n die(\"`observe` doesn't support fireImmediately=true in combination with sets.\");\n }\n return registerListener(this, listener);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.toJSON = function toJSON() {\n return Array.from(this);\n };\n _proto.toString = function toString() {\n return \"[object ObservableSet]\";\n };\n _proto[Symbol.iterator] = function () {\n return this.values();\n };\n return _createClass(ObservableSet, [{\n key: \"size\",\n get: function get() {\n this.atom_.reportObserved();\n return this.data_.size;\n }\n }, {\n key: Symbol.toStringTag,\n get: function get() {\n return \"Set\";\n }\n }]);\n}();\n// eslint-disable-next-line\nvar isObservableSet = /*#__PURE__*/createInstanceofPredicate(\"ObservableSet\", ObservableSet);\nfunction makeIterableForSet(iterator) {\n iterator[Symbol.toStringTag] = \"SetIterator\";\n return makeIterable(iterator);\n}\n\nvar descriptorCache = /*#__PURE__*/Object.create(null);\nvar REMOVE = \"remove\";\nvar ObservableObjectAdministration = /*#__PURE__*/function () {\n function ObservableObjectAdministration(target_, values_, name_,\n // Used anytime annotation is not explicitely provided\n defaultAnnotation_) {\n if (values_ === void 0) {\n values_ = new Map();\n }\n if (defaultAnnotation_ === void 0) {\n defaultAnnotation_ = autoAnnotation;\n }\n this.target_ = void 0;\n this.values_ = void 0;\n this.name_ = void 0;\n this.defaultAnnotation_ = void 0;\n this.keysAtom_ = void 0;\n this.changeListeners_ = void 0;\n this.interceptors_ = void 0;\n this.proxy_ = void 0;\n this.isPlainObject_ = void 0;\n this.appliedAnnotations_ = void 0;\n this.pendingKeys_ = void 0;\n this.target_ = target_;\n this.values_ = values_;\n this.name_ = name_;\n this.defaultAnnotation_ = defaultAnnotation_;\n this.keysAtom_ = new Atom( true ? this.name_ + \".keys\" : 0);\n // Optimization: we use this frequently\n this.isPlainObject_ = isPlainObject(this.target_);\n if ( true && !isAnnotation(this.defaultAnnotation_)) {\n die(\"defaultAnnotation must be valid annotation\");\n }\n if (true) {\n // Prepare structure for tracking which fields were already annotated\n this.appliedAnnotations_ = {};\n }\n }\n var _proto = ObservableObjectAdministration.prototype;\n _proto.getObservablePropValue_ = function getObservablePropValue_(key) {\n return this.values_.get(key).get();\n };\n _proto.setObservablePropValue_ = function setObservablePropValue_(key, newValue) {\n var observable = this.values_.get(key);\n if (observable instanceof ComputedValue) {\n observable.set(newValue);\n return true;\n }\n // intercept\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: UPDATE,\n object: this.proxy_ || this.target_,\n name: key,\n newValue: newValue\n });\n if (!change) {\n return null;\n }\n newValue = change.newValue;\n }\n newValue = observable.prepareNewValue_(newValue);\n // notify spy & observers\n if (newValue !== globalState.UNCHANGED) {\n var notify = hasListeners(this);\n var notifySpy = true && isSpyEnabled();\n var _change = notify || notifySpy ? {\n type: UPDATE,\n observableKind: \"object\",\n debugObjectName: this.name_,\n object: this.proxy_ || this.target_,\n oldValue: observable.value_,\n name: key,\n newValue: newValue\n } : null;\n if ( true && notifySpy) {\n spyReportStart(_change);\n }\n observable.setNewValue_(newValue);\n if (notify) {\n notifyListeners(this, _change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n return true;\n };\n _proto.get_ = function get_(key) {\n if (globalState.trackingDerivation && !hasProp(this.target_, key)) {\n // Key doesn't exist yet, subscribe for it in case it's added later\n this.has_(key);\n }\n return this.target_[key];\n }\n /**\n * @param {PropertyKey} key\n * @param {any} value\n * @param {Annotation|boolean} annotation true - use default annotation, false - copy as is\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.set_ = function set_(key, value, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n // Don't use .has(key) - we care about own\n if (hasProp(this.target_, key)) {\n // Existing prop\n if (this.values_.has(key)) {\n // Observable (can be intercepted)\n return this.setObservablePropValue_(key, value);\n } else if (proxyTrap) {\n // Non-observable - proxy\n return Reflect.set(this.target_, key, value);\n } else {\n // Non-observable\n this.target_[key] = value;\n return true;\n }\n } else {\n // New prop\n return this.extend_(key, {\n value: value,\n enumerable: true,\n writable: true,\n configurable: true\n }, this.defaultAnnotation_, proxyTrap);\n }\n }\n // Trap for \"in\"\n ;\n _proto.has_ = function has_(key) {\n if (!globalState.trackingDerivation) {\n // Skip key subscription outside derivation\n return key in this.target_;\n }\n this.pendingKeys_ || (this.pendingKeys_ = new Map());\n var entry = this.pendingKeys_.get(key);\n if (!entry) {\n entry = new ObservableValue(key in this.target_, referenceEnhancer, true ? this.name_ + \".\" + stringifyKey(key) + \"?\" : 0, false);\n this.pendingKeys_.set(key, entry);\n }\n return entry.get();\n }\n /**\n * @param {PropertyKey} key\n * @param {Annotation|boolean} annotation true - use default annotation, false - ignore prop\n */;\n _proto.make_ = function make_(key, annotation) {\n if (annotation === true) {\n annotation = this.defaultAnnotation_;\n }\n if (annotation === false) {\n return;\n }\n assertAnnotable(this, annotation, key);\n if (!(key in this.target_)) {\n var _this$target_$storedA;\n // Throw on missing key, except for decorators:\n // Decorator annotations are collected from whole prototype chain.\n // When called from super() some props may not exist yet.\n // However we don't have to worry about missing prop,\n // because the decorator must have been applied to something.\n if ((_this$target_$storedA = this.target_[storedAnnotationsSymbol]) != null && _this$target_$storedA[key]) {\n return; // will be annotated by subclass constructor\n } else {\n die(1, annotation.annotationType_, this.name_ + \".\" + key.toString());\n }\n }\n var source = this.target_;\n while (source && source !== objectPrototype) {\n var descriptor = getDescriptor(source, key);\n if (descriptor) {\n var outcome = annotation.make_(this, key, descriptor, source);\n if (outcome === 0 /* MakeResult.Cancel */) {\n return;\n }\n if (outcome === 1 /* MakeResult.Break */) {\n break;\n }\n }\n source = Object.getPrototypeOf(source);\n }\n recordAnnotationApplied(this, annotation, key);\n }\n /**\n * @param {PropertyKey} key\n * @param {PropertyDescriptor} descriptor\n * @param {Annotation|boolean} annotation true - use default annotation, false - copy as is\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.extend_ = function extend_(key, descriptor, annotation, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n if (annotation === true) {\n annotation = this.defaultAnnotation_;\n }\n if (annotation === false) {\n return this.defineProperty_(key, descriptor, proxyTrap);\n }\n assertAnnotable(this, annotation, key);\n var outcome = annotation.extend_(this, key, descriptor, proxyTrap);\n if (outcome) {\n recordAnnotationApplied(this, annotation, key);\n }\n return outcome;\n }\n /**\n * @param {PropertyKey} key\n * @param {PropertyDescriptor} descriptor\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.defineProperty_ = function defineProperty_(key, descriptor, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n try {\n startBatch();\n // Delete\n var deleteOutcome = this.delete_(key);\n if (!deleteOutcome) {\n // Failure or intercepted\n return deleteOutcome;\n }\n // ADD interceptor\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: ADD,\n newValue: descriptor.value\n });\n if (!change) {\n return null;\n }\n var newValue = change.newValue;\n if (descriptor.value !== newValue) {\n descriptor = _extends({}, descriptor, {\n value: newValue\n });\n }\n }\n // Define\n if (proxyTrap) {\n if (!Reflect.defineProperty(this.target_, key, descriptor)) {\n return false;\n }\n } else {\n defineProperty(this.target_, key, descriptor);\n }\n // Notify\n this.notifyPropertyAddition_(key, descriptor.value);\n } finally {\n endBatch();\n }\n return true;\n }\n // If original descriptor becomes relevant, move this to annotation directly\n ;\n _proto.defineObservableProperty_ = function defineObservableProperty_(key, value, enhancer, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n try {\n startBatch();\n // Delete\n var deleteOutcome = this.delete_(key);\n if (!deleteOutcome) {\n // Failure or intercepted\n return deleteOutcome;\n }\n // ADD interceptor\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: ADD,\n newValue: value\n });\n if (!change) {\n return null;\n }\n value = change.newValue;\n }\n var cachedDescriptor = getCachedObservablePropDescriptor(key);\n var descriptor = {\n configurable: globalState.safeDescriptors ? this.isPlainObject_ : true,\n enumerable: true,\n get: cachedDescriptor.get,\n set: cachedDescriptor.set\n };\n // Define\n if (proxyTrap) {\n if (!Reflect.defineProperty(this.target_, key, descriptor)) {\n return false;\n }\n } else {\n defineProperty(this.target_, key, descriptor);\n }\n var observable = new ObservableValue(value, enhancer, true ? this.name_ + \".\" + key.toString() : 0, false);\n this.values_.set(key, observable);\n // Notify (value possibly changed by ObservableValue)\n this.notifyPropertyAddition_(key, observable.value_);\n } finally {\n endBatch();\n }\n return true;\n }\n // If original descriptor becomes relevant, move this to annotation directly\n ;\n _proto.defineComputedProperty_ = function defineComputedProperty_(key, options, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n try {\n startBatch();\n // Delete\n var deleteOutcome = this.delete_(key);\n if (!deleteOutcome) {\n // Failure or intercepted\n return deleteOutcome;\n }\n // ADD interceptor\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: ADD,\n newValue: undefined\n });\n if (!change) {\n return null;\n }\n }\n options.name || (options.name = true ? this.name_ + \".\" + key.toString() : 0);\n options.context = this.proxy_ || this.target_;\n var cachedDescriptor = getCachedObservablePropDescriptor(key);\n var descriptor = {\n configurable: globalState.safeDescriptors ? this.isPlainObject_ : true,\n enumerable: false,\n get: cachedDescriptor.get,\n set: cachedDescriptor.set\n };\n // Define\n if (proxyTrap) {\n if (!Reflect.defineProperty(this.target_, key, descriptor)) {\n return false;\n }\n } else {\n defineProperty(this.target_, key, descriptor);\n }\n this.values_.set(key, new ComputedValue(options));\n // Notify\n this.notifyPropertyAddition_(key, undefined);\n } finally {\n endBatch();\n }\n return true;\n }\n /**\n * @param {PropertyKey} key\n * @param {PropertyDescriptor} descriptor\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.delete_ = function delete_(key, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n // No such prop\n if (!hasProp(this.target_, key)) {\n return true;\n }\n // Intercept\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: REMOVE\n });\n // Cancelled\n if (!change) {\n return null;\n }\n }\n // Delete\n try {\n var _this$pendingKeys_;\n startBatch();\n var notify = hasListeners(this);\n var notifySpy = true && isSpyEnabled();\n var observable = this.values_.get(key);\n // Value needed for spies/listeners\n var value = undefined;\n // Optimization: don't pull the value unless we will need it\n if (!observable && (notify || notifySpy)) {\n var _getDescriptor;\n value = (_getDescriptor = getDescriptor(this.target_, key)) == null ? void 0 : _getDescriptor.value;\n }\n // delete prop (do first, may fail)\n if (proxyTrap) {\n if (!Reflect.deleteProperty(this.target_, key)) {\n return false;\n }\n } else {\n delete this.target_[key];\n }\n // Allow re-annotating this field\n if (true) {\n delete this.appliedAnnotations_[key];\n }\n // Clear observable\n if (observable) {\n this.values_[\"delete\"](key);\n // for computed, value is undefined\n if (observable instanceof ObservableValue) {\n value = observable.value_;\n }\n // Notify: autorun(() => obj[key]), see #1796\n propagateChanged(observable);\n }\n // Notify \"keys/entries/values\" observers\n this.keysAtom_.reportChanged();\n // Notify \"has\" observers\n // \"in\" as it may still exist in proto\n (_this$pendingKeys_ = this.pendingKeys_) == null || (_this$pendingKeys_ = _this$pendingKeys_.get(key)) == null || _this$pendingKeys_.set(key in this.target_);\n // Notify spies/listeners\n if (notify || notifySpy) {\n var _change2 = {\n type: REMOVE,\n observableKind: \"object\",\n object: this.proxy_ || this.target_,\n debugObjectName: this.name_,\n oldValue: value,\n name: key\n };\n if ( true && notifySpy) {\n spyReportStart(_change2);\n }\n if (notify) {\n notifyListeners(this, _change2);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n } finally {\n endBatch();\n }\n return true;\n }\n /**\n * Observes this object. Triggers for the events 'add', 'update' and 'delete'.\n * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe\n * for callback details\n */;\n _proto.observe_ = function observe_(callback, fireImmediately) {\n if ( true && fireImmediately === true) {\n die(\"`observe` doesn't support the fire immediately property for observable objects.\");\n }\n return registerListener(this, callback);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.notifyPropertyAddition_ = function notifyPropertyAddition_(key, value) {\n var _this$pendingKeys_2;\n var notify = hasListeners(this);\n var notifySpy = true && isSpyEnabled();\n if (notify || notifySpy) {\n var change = notify || notifySpy ? {\n type: ADD,\n observableKind: \"object\",\n debugObjectName: this.name_,\n object: this.proxy_ || this.target_,\n name: key,\n newValue: value\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n }\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n (_this$pendingKeys_2 = this.pendingKeys_) == null || (_this$pendingKeys_2 = _this$pendingKeys_2.get(key)) == null || _this$pendingKeys_2.set(true);\n // Notify \"keys/entries/values\" observers\n this.keysAtom_.reportChanged();\n };\n _proto.ownKeys_ = function ownKeys_() {\n this.keysAtom_.reportObserved();\n return ownKeys(this.target_);\n };\n _proto.keys_ = function keys_() {\n // Returns enumerable && own, but unfortunately keysAtom will report on ANY key change.\n // There is no way to distinguish between Object.keys(object) and Reflect.ownKeys(object) - both are handled by ownKeys trap.\n // We can either over-report in Object.keys(object) or under-report in Reflect.ownKeys(object)\n // We choose to over-report in Object.keys(object), because:\n // - typically it's used with simple data objects\n // - when symbolic/non-enumerable keys are relevant Reflect.ownKeys works as expected\n this.keysAtom_.reportObserved();\n return Object.keys(this.target_);\n };\n return ObservableObjectAdministration;\n}();\nfunction asObservableObject(target, options) {\n var _options$name;\n if ( true && options && isObservableObject(target)) {\n die(\"Options can't be provided for already observable objects.\");\n }\n if (hasProp(target, $mobx)) {\n if ( true && !(getAdministration(target) instanceof ObservableObjectAdministration)) {\n die(\"Cannot convert '\" + getDebugName(target) + \"' into observable object:\" + \"\\nThe target is already observable of different type.\" + \"\\nExtending builtins is not supported.\");\n }\n return target;\n }\n if ( true && !Object.isExtensible(target)) {\n die(\"Cannot make the designated object observable; it is not extensible\");\n }\n var name = (_options$name = options == null ? void 0 : options.name) != null ? _options$name : true ? (isPlainObject(target) ? \"ObservableObject\" : target.constructor.name) + \"@\" + getNextId() : 0;\n var adm = new ObservableObjectAdministration(target, new Map(), String(name), getAnnotationFromOptions(options));\n addHiddenProp(target, $mobx, adm);\n return target;\n}\nvar isObservableObjectAdministration = /*#__PURE__*/createInstanceofPredicate(\"ObservableObjectAdministration\", ObservableObjectAdministration);\nfunction getCachedObservablePropDescriptor(key) {\n return descriptorCache[key] || (descriptorCache[key] = {\n get: function get() {\n return this[$mobx].getObservablePropValue_(key);\n },\n set: function set(value) {\n return this[$mobx].setObservablePropValue_(key, value);\n }\n });\n}\nfunction isObservableObject(thing) {\n if (isObject(thing)) {\n return isObservableObjectAdministration(thing[$mobx]);\n }\n return false;\n}\nfunction recordAnnotationApplied(adm, annotation, key) {\n var _adm$target_$storedAn;\n if (true) {\n adm.appliedAnnotations_[key] = annotation;\n }\n // Remove applied decorator annotation so we don't try to apply it again in subclass constructor\n (_adm$target_$storedAn = adm.target_[storedAnnotationsSymbol]) == null || delete _adm$target_$storedAn[key];\n}\nfunction assertAnnotable(adm, annotation, key) {\n // Valid annotation\n if ( true && !isAnnotation(annotation)) {\n die(\"Cannot annotate '\" + adm.name_ + \".\" + key.toString() + \"': Invalid annotation.\");\n }\n /*\n // Configurable, not sealed, not frozen\n // Possibly not needed, just a little better error then the one thrown by engine.\n // Cases where this would be useful the most (subclass field initializer) are not interceptable by this.\n if (__DEV__) {\n const configurable = getDescriptor(adm.target_, key)?.configurable\n const frozen = Object.isFrozen(adm.target_)\n const sealed = Object.isSealed(adm.target_)\n if (!configurable || frozen || sealed) {\n const fieldName = `${adm.name_}.${key.toString()}`\n const requestedAnnotationType = annotation.annotationType_\n let error = `Cannot apply '${requestedAnnotationType}' to '${fieldName}':`\n if (frozen) {\n error += `\\nObject is frozen.`\n }\n if (sealed) {\n error += `\\nObject is sealed.`\n }\n if (!configurable) {\n error += `\\nproperty is not configurable.`\n // Mention only if caused by us to avoid confusion\n if (hasProp(adm.appliedAnnotations!, key)) {\n error += `\\nTo prevent accidental re-definition of a field by a subclass, `\n error += `all annotated fields of non-plain objects (classes) are not configurable.`\n }\n }\n die(error)\n }\n }\n */\n // Not annotated\n if ( true && !isOverride(annotation) && hasProp(adm.appliedAnnotations_, key)) {\n var fieldName = adm.name_ + \".\" + key.toString();\n var currentAnnotationType = adm.appliedAnnotations_[key].annotationType_;\n var requestedAnnotationType = annotation.annotationType_;\n die(\"Cannot apply '\" + requestedAnnotationType + \"' to '\" + fieldName + \"':\" + (\"\\nThe field is already annotated with '\" + currentAnnotationType + \"'.\") + \"\\nRe-annotating fields is not allowed.\" + \"\\nUse 'override' annotation for methods overridden by subclass.\");\n }\n}\n\n// Bug in safari 9.* (or iOS 9 safari mobile). See #364\nvar ENTRY_0 = /*#__PURE__*/createArrayEntryDescriptor(0);\nvar safariPrototypeSetterInheritanceBug = /*#__PURE__*/function () {\n var v = false;\n var p = {};\n Object.defineProperty(p, \"0\", {\n set: function set() {\n v = true;\n }\n });\n /*#__PURE__*/Object.create(p)[\"0\"] = 1;\n return v === false;\n}();\n/**\n * This array buffer contains two lists of properties, so that all arrays\n * can recycle their property definitions, which significantly improves performance of creating\n * properties on the fly.\n */\nvar OBSERVABLE_ARRAY_BUFFER_SIZE = 0;\n// Typescript workaround to make sure ObservableArray extends Array\nvar StubArray = function StubArray() {};\nfunction inherit(ctor, proto) {\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(ctor.prototype, proto);\n } else if (ctor.prototype.__proto__ !== undefined) {\n ctor.prototype.__proto__ = proto;\n } else {\n ctor.prototype = proto;\n }\n}\ninherit(StubArray, Array.prototype);\n// Weex proto freeze protection was here,\n// but it is unclear why the hack is need as MobX never changed the prototype\n// anyway, so removed it in V6\nvar LegacyObservableArray = /*#__PURE__*/function (_StubArray) {\n function LegacyObservableArray(initialValues, enhancer, name, owned) {\n var _this;\n if (name === void 0) {\n name = true ? \"ObservableArray@\" + getNextId() : 0;\n }\n if (owned === void 0) {\n owned = false;\n }\n _this = _StubArray.call(this) || this;\n initObservable(function () {\n var adm = new ObservableArrayAdministration(name, enhancer, owned, true);\n adm.proxy_ = _this;\n addHiddenFinalProp(_this, $mobx, adm);\n if (initialValues && initialValues.length) {\n // @ts-ignore\n _this.spliceWithArray(0, 0, initialValues);\n }\n if (safariPrototypeSetterInheritanceBug) {\n // Seems that Safari won't use numeric prototype setter until any * numeric property is\n // defined on the instance. After that it works fine, even if this property is deleted.\n Object.defineProperty(_this, \"0\", ENTRY_0);\n }\n });\n return _this;\n }\n _inheritsLoose(LegacyObservableArray, _StubArray);\n var _proto = LegacyObservableArray.prototype;\n _proto.concat = function concat() {\n this[$mobx].atom_.reportObserved();\n for (var _len = arguments.length, arrays = new Array(_len), _key = 0; _key < _len; _key++) {\n arrays[_key] = arguments[_key];\n }\n return Array.prototype.concat.apply(this.slice(),\n //@ts-ignore\n arrays.map(function (a) {\n return isObservableArray(a) ? a.slice() : a;\n }));\n };\n _proto[Symbol.iterator] = function () {\n var self = this;\n var nextIndex = 0;\n return makeIterable({\n next: function next() {\n return nextIndex < self.length ? {\n value: self[nextIndex++],\n done: false\n } : {\n done: true,\n value: undefined\n };\n }\n });\n };\n return _createClass(LegacyObservableArray, [{\n key: \"length\",\n get: function get() {\n return this[$mobx].getArrayLength_();\n },\n set: function set(newLength) {\n this[$mobx].setArrayLength_(newLength);\n }\n }, {\n key: Symbol.toStringTag,\n get: function get() {\n return \"Array\";\n }\n }]);\n}(StubArray);\nObject.entries(arrayExtensions).forEach(function (_ref) {\n var prop = _ref[0],\n fn = _ref[1];\n if (prop !== \"concat\") {\n addHiddenProp(LegacyObservableArray.prototype, prop, fn);\n }\n});\nfunction createArrayEntryDescriptor(index) {\n return {\n enumerable: false,\n configurable: true,\n get: function get() {\n return this[$mobx].get_(index);\n },\n set: function set(value) {\n this[$mobx].set_(index, value);\n }\n };\n}\nfunction createArrayBufferItem(index) {\n defineProperty(LegacyObservableArray.prototype, \"\" + index, createArrayEntryDescriptor(index));\n}\nfunction reserveArrayBuffer(max) {\n if (max > OBSERVABLE_ARRAY_BUFFER_SIZE) {\n for (var index = OBSERVABLE_ARRAY_BUFFER_SIZE; index < max + 100; index++) {\n createArrayBufferItem(index);\n }\n OBSERVABLE_ARRAY_BUFFER_SIZE = max;\n }\n}\nreserveArrayBuffer(1000);\nfunction createLegacyArray(initialValues, enhancer, name) {\n return new LegacyObservableArray(initialValues, enhancer, name);\n}\n\nfunction getAtom(thing, property) {\n if (typeof thing === \"object\" && thing !== null) {\n if (isObservableArray(thing)) {\n if (property !== undefined) {\n die(23);\n }\n return thing[$mobx].atom_;\n }\n if (isObservableSet(thing)) {\n return thing.atom_;\n }\n if (isObservableMap(thing)) {\n if (property === undefined) {\n return thing.keysAtom_;\n }\n var observable = thing.data_.get(property) || thing.hasMap_.get(property);\n if (!observable) {\n die(25, property, getDebugName(thing));\n }\n return observable;\n }\n if (isObservableObject(thing)) {\n if (!property) {\n return die(26);\n }\n var _observable = thing[$mobx].values_.get(property);\n if (!_observable) {\n die(27, property, getDebugName(thing));\n }\n return _observable;\n }\n if (isAtom(thing) || isComputedValue(thing) || isReaction(thing)) {\n return thing;\n }\n } else if (isFunction(thing)) {\n if (isReaction(thing[$mobx])) {\n // disposer function\n return thing[$mobx];\n }\n }\n die(28);\n}\nfunction getAdministration(thing, property) {\n if (!thing) {\n die(29);\n }\n if (property !== undefined) {\n return getAdministration(getAtom(thing, property));\n }\n if (isAtom(thing) || isComputedValue(thing) || isReaction(thing)) {\n return thing;\n }\n if (isObservableMap(thing) || isObservableSet(thing)) {\n return thing;\n }\n if (thing[$mobx]) {\n return thing[$mobx];\n }\n die(24, thing);\n}\nfunction getDebugName(thing, property) {\n var named;\n if (property !== undefined) {\n named = getAtom(thing, property);\n } else if (isAction(thing)) {\n return thing.name;\n } else if (isObservableObject(thing) || isObservableMap(thing) || isObservableSet(thing)) {\n named = getAdministration(thing);\n } else {\n // valid for arrays as well\n named = getAtom(thing);\n }\n return named.name_;\n}\n/**\n * Helper function for initializing observable structures, it applies:\n * 1. allowStateChanges so we don't violate enforceActions.\n * 2. untracked so we don't accidentaly subscribe to anything observable accessed during init in case the observable is created inside derivation.\n * 3. batch to avoid state version updates\n */\nfunction initObservable(cb) {\n var derivation = untrackedStart();\n var allowStateChanges = allowStateChangesStart(true);\n startBatch();\n try {\n return cb();\n } finally {\n endBatch();\n allowStateChangesEnd(allowStateChanges);\n untrackedEnd(derivation);\n }\n}\n\nvar toString = objectPrototype.toString;\nfunction deepEqual(a, b, depth) {\n if (depth === void 0) {\n depth = -1;\n }\n return eq(a, b, depth);\n}\n// Copied from https://github.com/jashkenas/underscore/blob/5c237a7c682fb68fd5378203f0bf22dce1624854/underscore.js#L1186-L1289\n// Internal recursive comparison function for `isEqual`.\nfunction eq(a, b, depth, aStack, bStack) {\n // Identical objects are equal. `0 === -0`, but they aren't identical.\n // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).\n if (a === b) {\n return a !== 0 || 1 / a === 1 / b;\n }\n // `null` or `undefined` only equal to itself (strict comparison).\n if (a == null || b == null) {\n return false;\n }\n // `NaN`s are equivalent, but non-reflexive.\n if (a !== a) {\n return b !== b;\n }\n // Exhaust primitive checks\n var type = typeof a;\n if (type !== \"function\" && type !== \"object\" && typeof b != \"object\") {\n return false;\n }\n // Compare `[[Class]]` names.\n var className = toString.call(a);\n if (className !== toString.call(b)) {\n return false;\n }\n switch (className) {\n // Strings, numbers, regular expressions, dates, and booleans are compared by value.\n case \"[object RegExp]\":\n // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i')\n case \"[object String]\":\n // Primitives and their corresponding object wrappers are equivalent; thus, `\"5\"` is\n // equivalent to `new String(\"5\")`.\n return \"\" + a === \"\" + b;\n case \"[object Number]\":\n // `NaN`s are equivalent, but non-reflexive.\n // Object(NaN) is equivalent to NaN.\n if (+a !== +a) {\n return +b !== +b;\n }\n // An `egal` comparison is performed for other numeric values.\n return +a === 0 ? 1 / +a === 1 / b : +a === +b;\n case \"[object Date]\":\n case \"[object Boolean]\":\n // Coerce dates and booleans to numeric primitive values. Dates are compared by their\n // millisecond representations. Note that invalid dates with millisecond representations\n // of `NaN` are not equivalent.\n return +a === +b;\n case \"[object Symbol]\":\n return typeof Symbol !== \"undefined\" && Symbol.valueOf.call(a) === Symbol.valueOf.call(b);\n case \"[object Map]\":\n case \"[object Set]\":\n // Maps and Sets are unwrapped to arrays of entry-pairs, adding an incidental level.\n // Hide this extra level by increasing the depth.\n if (depth >= 0) {\n depth++;\n }\n break;\n }\n // Unwrap any wrapped objects.\n a = unwrap(a);\n b = unwrap(b);\n var areArrays = className === \"[object Array]\";\n if (!areArrays) {\n if (typeof a != \"object\" || typeof b != \"object\") {\n return false;\n }\n // Objects with different constructors are not equivalent, but `Object`s or `Array`s\n // from different frames are.\n var aCtor = a.constructor,\n bCtor = b.constructor;\n if (aCtor !== bCtor && !(isFunction(aCtor) && aCtor instanceof aCtor && isFunction(bCtor) && bCtor instanceof bCtor) && \"constructor\" in a && \"constructor\" in b) {\n return false;\n }\n }\n if (depth === 0) {\n return false;\n } else if (depth < 0) {\n depth = -1;\n }\n // Assume equality for cyclic structures. The algorithm for detecting cyclic\n // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.\n // Initializing stack of traversed objects.\n // It's done here since we only need them for objects and arrays comparison.\n aStack = aStack || [];\n bStack = bStack || [];\n var length = aStack.length;\n while (length--) {\n // Linear search. Performance is inversely proportional to the number of\n // unique nested structures.\n if (aStack[length] === a) {\n return bStack[length] === b;\n }\n }\n // Add the first object to the stack of traversed objects.\n aStack.push(a);\n bStack.push(b);\n // Recursively compare objects and arrays.\n if (areArrays) {\n // Compare array lengths to determine if a deep comparison is necessary.\n length = a.length;\n if (length !== b.length) {\n return false;\n }\n // Deep compare the contents, ignoring non-numeric properties.\n while (length--) {\n if (!eq(a[length], b[length], depth - 1, aStack, bStack)) {\n return false;\n }\n }\n } else {\n // Deep compare objects.\n var keys = Object.keys(a);\n var key;\n length = keys.length;\n // Ensure that both objects contain the same number of properties before comparing deep equality.\n if (Object.keys(b).length !== length) {\n return false;\n }\n while (length--) {\n // Deep compare each member\n key = keys[length];\n if (!(hasProp(b, key) && eq(a[key], b[key], depth - 1, aStack, bStack))) {\n return false;\n }\n }\n }\n // Remove the first object from the stack of traversed objects.\n aStack.pop();\n bStack.pop();\n return true;\n}\nfunction unwrap(a) {\n if (isObservableArray(a)) {\n return a.slice();\n }\n if (isES6Map(a) || isObservableMap(a)) {\n return Array.from(a.entries());\n }\n if (isES6Set(a) || isObservableSet(a)) {\n return Array.from(a.entries());\n }\n return a;\n}\n\nvar _getGlobal$Iterator;\n// safely get iterator prototype if available\nvar maybeIteratorPrototype = ((_getGlobal$Iterator = /*#__PURE__*/getGlobal().Iterator) == null ? void 0 : _getGlobal$Iterator.prototype) || {};\nfunction makeIterable(iterator) {\n iterator[Symbol.iterator] = getSelf;\n return Object.assign(Object.create(maybeIteratorPrototype), iterator);\n}\nfunction getSelf() {\n return this;\n}\n\nfunction isAnnotation(thing) {\n return (\n // Can be function\n thing instanceof Object && typeof thing.annotationType_ === \"string\" && isFunction(thing.make_) && isFunction(thing.extend_)\n );\n}\n\n/**\n * (c) Michel Weststrate 2015 - 2020\n * MIT Licensed\n *\n * Welcome to the mobx sources! To get a global overview of how MobX internally works,\n * this is a good place to start:\n * https://medium.com/@mweststrate/becoming-fully-reactive-an-in-depth-explanation-of-mobservable-55995262a254#.xvbh6qd74\n *\n * Source folders:\n * ===============\n *\n * - api/ Most of the public static methods exposed by the module can be found here.\n * - core/ Implementation of the MobX algorithm; atoms, derivations, reactions, dependency trees, optimizations. Cool stuff can be found here.\n * - types/ All the magic that is need to have observable objects, arrays and values is in this folder. Including the modifiers like `asFlat`.\n * - utils/ Utility stuff.\n *\n */\n[\"Symbol\", \"Map\", \"Set\"].forEach(function (m) {\n var g = getGlobal();\n if (typeof g[m] === \"undefined\") {\n die(\"MobX requires global '\" + m + \"' to be available or polyfilled\");\n }\n});\nif (typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__ === \"object\") {\n // See: https://github.com/andykog/mobx-devtools/\n __MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({\n spy: spy,\n extras: {\n getDebugName: getDebugName\n },\n $mobx: $mobx\n });\n}\n\n\n//# sourceMappingURL=mobx.esm.js.map\n\n\n//# sourceURL=webpack://app_adyen_SFRA/./node_modules/mobx/dist/mobx.esm.js?"); /***/ }) diff --git a/cartridges/app_adyen_SFRA/cartridge/static/default/js/checkout.js b/cartridges/app_adyen_SFRA/cartridge/static/default/js/checkout.js index a7af89cc0..2e53ff71d 100644 --- a/cartridges/app_adyen_SFRA/cartridge/static/default/js/checkout.js +++ b/cartridges/app_adyen_SFRA/cartridge/static/default/js/checkout.js @@ -16,7 +16,7 @@ \********************************************************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -eval("\n\nvar store = __webpack_require__(/*! ../../../store */ \"./cartridges/app_adyen_SFRA/cartridge/store/index.js\");\nvar _require = __webpack_require__(/*! ./adyen_checkout/renderGenericComponent */ \"./cartridges/app_adyen_SFRA/cartridge/client/default/js/adyen_checkout/renderGenericComponent.js\"),\n renderGenericComponent = _require.renderGenericComponent;\nvar _require2 = __webpack_require__(/*! ./adyen_checkout/checkoutConfiguration */ \"./cartridges/app_adyen_SFRA/cartridge/client/default/js/adyen_checkout/checkoutConfiguration.js\"),\n setCheckoutConfiguration = _require2.setCheckoutConfiguration,\n actionHandler = _require2.actionHandler;\nvar _require3 = __webpack_require__(/*! ./adyen_checkout/helpers */ \"./cartridges/app_adyen_SFRA/cartridge/client/default/js/adyen_checkout/helpers.js\"),\n assignPaymentMethodValue = _require3.assignPaymentMethodValue,\n showValidation = _require3.showValidation,\n paymentFromComponent = _require3.paymentFromComponent;\nvar _require4 = __webpack_require__(/*! ./adyen_checkout/validateComponents */ \"./cartridges/app_adyen_SFRA/cartridge/client/default/js/adyen_checkout/validateComponents.js\"),\n validateComponents = _require4.validateComponents;\n$('#dwfrm_billing').submit(function apiRequest(e) {\n e.preventDefault();\n var form = $(this);\n var url = form.attr('action');\n $.ajax({\n type: 'POST',\n url: url,\n data: form.serialize(),\n async: false,\n success: function success(data) {\n store.formErrorsExist = 'fieldErrors' in data;\n }\n });\n});\nsetCheckoutConfiguration();\nif (window.googleMerchantID !== 'null' && window.Configuration.environment.includes('live')) {\n var id = 'merchantId';\n store.checkoutConfiguration.paymentMethodsConfiguration.paywithgoogle.configuration[id] = window.googleMerchantID;\n store.checkoutConfiguration.paymentMethodsConfiguration.googlepay.configuration[id] = window.googleMerchantID;\n}\n\n// Submit the payment\n$('button[value=\"submit-payment\"]').on('click', function () {\n if (store.paypalTerminatedEarly) {\n paymentFromComponent({\n cancelTransaction: true,\n merchantReference: document.querySelector('#merchantReference').value\n });\n store.paypalTerminatedEarly = false;\n }\n if (document.querySelector('#selectedPaymentOption').value === 'AdyenPOS') {\n document.querySelector('#terminalId').value = document.querySelector('#terminalList').value;\n }\n if (document.querySelector('#selectedPaymentOption').value === 'AdyenComponent' || document.querySelector('#selectedPaymentOption').value === 'CREDIT_CARD') {\n assignPaymentMethodValue();\n validateComponents();\n return showValidation();\n }\n return true;\n});\nmodule.exports = {\n renderGenericComponent: renderGenericComponent,\n actionHandler: actionHandler\n};\n\n//# sourceURL=webpack://app_adyen_SFRA/./cartridges/app_adyen_SFRA/cartridge/client/default/js/adyenCheckout.js?"); +eval("\n\nvar store = __webpack_require__(/*! ../../../store */ \"./cartridges/app_adyen_SFRA/cartridge/store/index.js\");\nvar _require = __webpack_require__(/*! ./adyen_checkout/renderGenericComponent */ \"./cartridges/app_adyen_SFRA/cartridge/client/default/js/adyen_checkout/renderGenericComponent.js\"),\n renderGenericComponent = _require.renderGenericComponent;\nvar _require2 = __webpack_require__(/*! ./adyen_checkout/checkoutConfiguration */ \"./cartridges/app_adyen_SFRA/cartridge/client/default/js/adyen_checkout/checkoutConfiguration.js\"),\n setCheckoutConfiguration = _require2.setCheckoutConfiguration,\n actionHandler = _require2.actionHandler;\nvar _require3 = __webpack_require__(/*! ./adyen_checkout/helpers */ \"./cartridges/app_adyen_SFRA/cartridge/client/default/js/adyen_checkout/helpers.js\"),\n assignPaymentMethodValue = _require3.assignPaymentMethodValue,\n showValidation = _require3.showValidation,\n paymentFromComponent = _require3.paymentFromComponent;\nvar _require4 = __webpack_require__(/*! ./adyen_checkout/validateComponents */ \"./cartridges/app_adyen_SFRA/cartridge/client/default/js/adyen_checkout/validateComponents.js\"),\n validateComponents = _require4.validateComponents;\n$('#dwfrm_billing').submit(function apiRequest(e) {\n e.preventDefault();\n var form = $(this);\n var url = form.attr('action');\n $.ajax({\n type: 'POST',\n url: url,\n data: form.serialize(),\n async: false,\n success: function success(data) {\n store.formErrorsExist = 'fieldErrors' in data;\n }\n });\n});\nsetCheckoutConfiguration();\nif (window.googleMerchantID !== 'null' && window.Configuration.environment.includes('live')) {\n var id = 'merchantId';\n store.checkoutConfiguration.paymentMethodsConfiguration.paywithgoogle.configuration[id] = window.googleMerchantID;\n store.checkoutConfiguration.paymentMethodsConfiguration.googlepay.configuration[id] = window.googleMerchantID;\n}\n$('body').on('checkout:updateCheckoutView', function (event, data) {\n if (data.order.orderEmail) {\n var clickToPayConfiguration = store.checkoutConfiguration.paymentMethodsConfiguration.card.clickToPayConfiguration;\n clickToPayConfiguration.shopperEmail = data.order.orderEmail;\n }\n});\n\n// Submit the payment\n$('button[value=\"submit-payment\"]').on('click', function () {\n if (store.paypalTerminatedEarly) {\n paymentFromComponent({\n cancelTransaction: true,\n merchantReference: document.querySelector('#merchantReference').value\n });\n store.paypalTerminatedEarly = false;\n }\n if (document.querySelector('#selectedPaymentOption').value === 'AdyenPOS') {\n document.querySelector('#terminalId').value = document.querySelector('#terminalList').value;\n }\n if (document.querySelector('#selectedPaymentOption').value === 'AdyenComponent' || document.querySelector('#selectedPaymentOption').value === 'CREDIT_CARD') {\n assignPaymentMethodValue();\n validateComponents();\n return showValidation();\n }\n return true;\n});\nmodule.exports = {\n renderGenericComponent: renderGenericComponent,\n actionHandler: actionHandler\n};\n\n//# sourceURL=webpack://app_adyen_SFRA/./cartridges/app_adyen_SFRA/cartridge/client/default/js/adyenCheckout.js?"); /***/ }), @@ -26,7 +26,7 @@ eval("\n\nvar store = __webpack_require__(/*! ../../../store */ \"./cartridges/a \*******************************************************************************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -eval("\n\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }\nfunction _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, \"next\", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, \"throw\", n); } _next(void 0); }); }; }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nvar helpers = __webpack_require__(/*! ./helpers */ \"./cartridges/app_adyen_SFRA/cartridge/client/default/js/adyen_checkout/helpers.js\");\nvar _require = __webpack_require__(/*! ./makePartialPayment */ \"./cartridges/app_adyen_SFRA/cartridge/client/default/js/adyen_checkout/makePartialPayment.js\"),\n makePartialPayment = _require.makePartialPayment;\nvar _require2 = __webpack_require__(/*! ../commons */ \"./cartridges/app_adyen_SFRA/cartridge/client/default/js/commons/index.js\"),\n onBrand = _require2.onBrand,\n onFieldValid = _require2.onFieldValid;\nvar store = __webpack_require__(/*! ../../../../store */ \"./cartridges/app_adyen_SFRA/cartridge/store/index.js\");\nvar constants = __webpack_require__(/*! ../constants */ \"./cartridges/app_adyen_SFRA/cartridge/client/default/js/constants.js\");\nvar _require3 = __webpack_require__(/*! ./renderGiftcardComponent */ \"./cartridges/app_adyen_SFRA/cartridge/client/default/js/adyen_checkout/renderGiftcardComponent.js\"),\n createElementsToShowRemainingGiftCardAmount = _require3.createElementsToShowRemainingGiftCardAmount,\n renderAddedGiftCard = _require3.renderAddedGiftCard,\n getGiftCardElements = _require3.getGiftCardElements,\n showGiftCardInfoMessage = _require3.showGiftCardInfoMessage,\n showGiftCardCancelButton = _require3.showGiftCardCancelButton,\n attachGiftCardCancelListener = _require3.attachGiftCardCancelListener;\nfunction getCardConfig() {\n return {\n hasHolderName: true,\n holderNameRequired: true,\n enableStoreDetails: window.showStoreDetails,\n showBrandsUnderCardNumber: false,\n clickToPayConfiguration: {\n shopperEmail: window.customerEmail,\n merchantDisplayName: window.merchantAccount\n },\n exposeExpiryDate: false,\n onChange: function onChange(state, component) {\n var _state$data, _state$data$paymentMe;\n store.isValid = state.isValid;\n var method = state.data.paymentMethod.storedPaymentMethodId ? \"storedCard\".concat(state.data.paymentMethod.storedPaymentMethodId) : store.selectedMethod;\n store.updateSelectedPayment(method, 'isValid', store.isValid);\n if ((_state$data = state.data) !== null && _state$data !== void 0 && (_state$data$paymentMe = _state$data.paymentMethod) !== null && _state$data$paymentMe !== void 0 && _state$data$paymentMe.storedPaymentMethodId) {\n var holderName = component.props.holderName;\n var paymentMethod = state.data.paymentMethod;\n paymentMethod.holderName = holderName;\n store.updateSelectedPayment(method, 'stateData', _objectSpread(_objectSpread({}, state.data), {}, {\n paymentMethod: paymentMethod\n }));\n } else {\n store.updateSelectedPayment(method, 'stateData', state.data);\n }\n },\n onSubmit: function onSubmit() {\n helpers.assignPaymentMethodValue();\n document.querySelector('button[value=\"submit-payment\"]').disabled = false;\n document.querySelector('button[value=\"submit-payment\"]').click();\n },\n onFieldValid: onFieldValid,\n onBrand: onBrand\n };\n}\nfunction getPaypalConfig() {\n store.paypalTerminatedEarly = false;\n return {\n showPayButton: true,\n environment: window.Configuration.environment,\n onSubmit: function onSubmit(state, component) {\n helpers.assignPaymentMethodValue();\n document.querySelector('#adyenStateData').value = JSON.stringify(store.selectedPayment.stateData);\n helpers.paymentFromComponent(state.data, component);\n },\n onCancel: function onCancel(data, component) {\n store.paypalTerminatedEarly = false;\n helpers.paymentFromComponent({\n cancelTransaction: true,\n merchantReference: document.querySelector('#merchantReference').value,\n orderToken: document.querySelector('#orderToken').value\n }, component);\n },\n onError: function onError(error, component) {\n store.paypalTerminatedEarly = false;\n if (component) {\n component.setStatus('ready');\n }\n document.querySelector('#showConfirmationForm').submit();\n },\n onAdditionalDetails: function onAdditionalDetails(state) {\n store.paypalTerminatedEarly = false;\n document.querySelector('#additionalDetailsHidden').value = JSON.stringify(state.data);\n document.querySelector('#showConfirmationForm').submit();\n },\n onClick: function onClick(data, actions) {\n $('#dwfrm_billing').trigger('submit');\n if (store.formErrorsExist) {\n return actions.reject();\n }\n if (store.paypalTerminatedEarly) {\n helpers.paymentFromComponent({\n cancelTransaction: true,\n merchantReference: document.querySelector('#merchantReference').value\n });\n store.paypalTerminatedEarly = false;\n return actions.resolve();\n }\n store.paypalTerminatedEarly = true;\n return null;\n }\n };\n}\nfunction getGooglePayConfig() {\n return {\n environment: window.Configuration.environment,\n onSubmit: function onSubmit() {\n helpers.assignPaymentMethodValue();\n document.querySelector('button[value=\"submit-payment\"]').disabled = false;\n document.querySelector('button[value=\"submit-payment\"]').click();\n },\n configuration: {\n gatewayMerchantId: window.merchantAccount\n },\n showPayButton: true,\n buttonColor: 'white'\n };\n}\nfunction handlePartialPaymentSuccess() {\n var _store$addedGiftCards;\n var _getGiftCardElements = getGiftCardElements(),\n giftCardSelectContainer = _getGiftCardElements.giftCardSelectContainer,\n giftCardSelect = _getGiftCardElements.giftCardSelect,\n giftCardsList = _getGiftCardElements.giftCardsList,\n cancelMainPaymentGiftCard = _getGiftCardElements.cancelMainPaymentGiftCard,\n giftCardAddButton = _getGiftCardElements.giftCardAddButton;\n giftCardSelectContainer.classList.add('invisible');\n giftCardSelect.value = null;\n giftCardsList.innerHTML = '';\n cancelMainPaymentGiftCard.addEventListener('click', function () {\n store.componentsObj.giftcard.node.unmount('component_giftcard');\n cancelMainPaymentGiftCard.classList.add('invisible');\n giftCardAddButton.style.display = 'block';\n giftCardSelect.value = 'null';\n });\n if (store.componentsObj.giftcard) {\n store.componentsObj.giftcard.node.unmount('component_giftcard');\n }\n store.addedGiftCards.forEach(function (card) {\n renderAddedGiftCard(card);\n });\n if ((_store$addedGiftCards = store.addedGiftCards) !== null && _store$addedGiftCards !== void 0 && _store$addedGiftCards.length) {\n showGiftCardInfoMessage();\n }\n showGiftCardCancelButton(true);\n attachGiftCardCancelListener();\n createElementsToShowRemainingGiftCardAmount();\n}\nfunction makeGiftcardPaymentRequest(_x, _x2, _x3) {\n return _makeGiftcardPaymentRequest.apply(this, arguments);\n}\nfunction _makeGiftcardPaymentRequest() {\n _makeGiftcardPaymentRequest = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(giftCardData, giftcardBalance, reject) {\n var brandSelect, selectedBrandIndex, giftcardBrand, partialPaymentRequest, partialPaymentResponse;\n return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n while (1) switch (_context2.prev = _context2.next) {\n case 0:\n brandSelect = document.getElementById('giftCardSelect');\n selectedBrandIndex = brandSelect.selectedIndex;\n giftcardBrand = brandSelect.options[selectedBrandIndex].text;\n partialPaymentRequest = {\n paymentMethod: giftCardData,\n amount: giftcardBalance,\n partialPaymentsOrder: {\n pspReference: store.adyenOrderData.pspReference,\n orderData: store.adyenOrderData.orderData\n },\n giftcardBrand: giftcardBrand\n };\n _context2.next = 6;\n return makePartialPayment(partialPaymentRequest);\n case 6:\n partialPaymentResponse = _context2.sent;\n if (partialPaymentResponse !== null && partialPaymentResponse !== void 0 && partialPaymentResponse.error) {\n reject();\n } else {\n handlePartialPaymentSuccess();\n }\n case 8:\n case \"end\":\n return _context2.stop();\n }\n }, _callee2);\n }));\n return _makeGiftcardPaymentRequest.apply(this, arguments);\n}\nfunction getGiftCardConfig() {\n var giftcardBalance;\n return {\n showPayButton: true,\n onChange: function onChange(state) {\n store.updateSelectedPayment(constants.GIFTCARD, 'isValid', state.isValid);\n store.updateSelectedPayment(constants.GIFTCARD, 'stateData', state.data);\n },\n onBalanceCheck: function onBalanceCheck(resolve, reject, requestData) {\n $.ajax({\n type: 'POST',\n url: window.checkBalanceUrl,\n data: JSON.stringify(requestData),\n contentType: 'application/json; charset=utf-8',\n async: false,\n success: function success(data) {\n giftcardBalance = data.balance;\n document.querySelector('button[value=\"submit-payment\"]').disabled = false;\n if (data.resultCode === constants.SUCCESS) {\n var _getGiftCardElements2 = getGiftCardElements(),\n giftCardsInfoMessageContainer = _getGiftCardElements2.giftCardsInfoMessageContainer,\n giftCardSelect = _getGiftCardElements2.giftCardSelect,\n cancelMainPaymentGiftCard = _getGiftCardElements2.cancelMainPaymentGiftCard,\n giftCardAddButton = _getGiftCardElements2.giftCardAddButton,\n giftCardSelectWrapper = _getGiftCardElements2.giftCardSelectWrapper;\n if (giftCardSelectWrapper) {\n giftCardSelectWrapper.classList.add('invisible');\n }\n var initialPartialObject = _objectSpread({}, store.partialPaymentsOrderObj);\n cancelMainPaymentGiftCard.classList.remove('invisible');\n cancelMainPaymentGiftCard.addEventListener('click', function () {\n store.componentsObj.giftcard.node.unmount('component_giftcard');\n cancelMainPaymentGiftCard.classList.add('invisible');\n giftCardAddButton.style.display = 'block';\n giftCardSelect.value = 'null';\n store.partialPaymentsOrderObj.remainingAmountFormatted = initialPartialObject.remainingAmountFormatted;\n store.partialPaymentsOrderObj.totalDiscountedAmount = initialPartialObject.totalDiscountedAmount;\n });\n document.querySelector('button[value=\"submit-payment\"]').disabled = true;\n giftCardsInfoMessageContainer.innerHTML = '';\n giftCardsInfoMessageContainer.classList.remove('gift-cards-info-message-container');\n store.partialPaymentsOrderObj.remainingAmountFormatted = data.remainingAmountFormatted;\n store.partialPaymentsOrderObj.totalDiscountedAmount = data.totalAmountFormatted;\n resolve(data);\n } else if (data.resultCode === constants.NOTENOUGHBALANCE) {\n resolve(data);\n } else {\n reject();\n }\n },\n fail: function fail() {\n reject();\n }\n });\n },\n onOrderRequest: function onOrderRequest(resolve, reject, requestData) {\n // Make a POST /orders request\n // Create an order for the total transaction amount\n var giftCardData = requestData.paymentMethod;\n if (store.adyenOrderData) {\n makeGiftcardPaymentRequest(giftCardData, giftcardBalance, reject);\n } else {\n $.ajax({\n type: 'POST',\n url: window.partialPaymentsOrderUrl,\n data: JSON.stringify(requestData),\n contentType: 'application/json; charset=utf-8',\n async: false,\n success: function success(data) {\n if (data.resultCode === 'Success') {\n store.adyenOrderData = data;\n // make payments call including giftcard data and order data\n makeGiftcardPaymentRequest(giftCardData, giftcardBalance, reject);\n }\n }\n });\n }\n },\n onSubmit: function onSubmit(state, component) {\n store.selectedMethod = state.data.paymentMethod.type;\n store.brand = component === null || component === void 0 ? void 0 : component.displayName;\n document.querySelector('input[name=\"brandCode\"]').checked = false;\n document.querySelector('button[value=\"submit-payment\"]').disabled = false;\n document.querySelector('button[value=\"submit-payment\"]').click();\n }\n };\n}\nfunction handleOnChange(state) {\n var type = state.data.paymentMethod.type;\n var multipleTxVariantComponents = constants.MULTIPLE_TX_VARIANTS_COMPONENTS;\n if (multipleTxVariantComponents.includes(store.selectedMethod)) {\n type = store.selectedMethod;\n }\n store.isValid = state.isValid;\n if (!store.componentsObj[type]) {\n store.componentsObj[type] = {};\n }\n store.componentsObj[type].isValid = store.isValid;\n store.componentsObj[type].stateData = state.data;\n}\nvar actionHandler = /*#__PURE__*/function () {\n var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(action) {\n var checkout;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n _context.next = 2;\n return AdyenCheckout(store.checkoutConfiguration);\n case 2:\n checkout = _context.sent;\n checkout.createFromAction(action).mount('#action-container');\n $('#action-modal').modal({\n backdrop: 'static',\n keyboard: false\n });\n if (action.type === constants.ACTIONTYPE.QRCODE) {\n document.getElementById('cancelQrMethodsButton').classList.remove('invisible');\n }\n case 6:\n case \"end\":\n return _context.stop();\n }\n }, _callee);\n }));\n return function actionHandler(_x4) {\n return _ref.apply(this, arguments);\n };\n}();\nfunction handleOnAdditionalDetails(state) {\n $.ajax({\n type: 'POST',\n url: window.paymentsDetailsURL,\n data: JSON.stringify({\n data: state.data,\n orderToken: window.orderToken\n }),\n contentType: 'application/json; charset=utf-8',\n async: false,\n success: function success(data) {\n if (!data.isFinal && _typeof(data.action) === 'object') {\n actionHandler(data.action);\n } else {\n window.location.href = data.redirectUrl;\n }\n }\n });\n}\nfunction getAmazonpayConfig() {\n return {\n showPayButton: true,\n productType: 'PayAndShip',\n checkoutMode: 'ProcessOrder',\n locale: window.Configuration.locale,\n returnUrl: window.returnURL,\n onClick: function onClick(resolve, reject) {\n $('#dwfrm_billing').trigger('submit');\n if (store.formErrorsExist) {\n reject();\n } else {\n helpers.assignPaymentMethodValue();\n resolve();\n }\n },\n onError: function onError() {}\n };\n}\nfunction getApplePayConfig() {\n return {\n showPayButton: true,\n buttonColor: 'black',\n onSubmit: function onSubmit(state, component) {\n $('#dwfrm_billing').trigger('submit');\n helpers.assignPaymentMethodValue();\n helpers.paymentFromComponent(state.data, component);\n }\n };\n}\nfunction getCashAppConfig() {\n return {\n showPayButton: true,\n onSubmit: function onSubmit(state, component) {\n $('#dwfrm_billing').trigger('submit');\n helpers.assignPaymentMethodValue();\n helpers.paymentFromComponent(state.data, component);\n }\n };\n}\nfunction getKlarnaConfig() {\n var _window = window,\n klarnaWidgetEnabled = _window.klarnaWidgetEnabled;\n if (klarnaWidgetEnabled) {\n return {\n showPayButton: true,\n useKlarnaWidget: true,\n onSubmit: function onSubmit(state, component) {\n helpers.assignPaymentMethodValue();\n helpers.paymentFromComponent(state.data, component);\n },\n onAdditionalDetails: function onAdditionalDetails(state) {\n document.querySelector('#additionalDetailsHidden').value = JSON.stringify(state.data);\n document.querySelector('#showConfirmationForm').submit();\n }\n };\n }\n return null;\n}\nfunction setCheckoutConfiguration() {\n store.checkoutConfiguration.onChange = handleOnChange;\n store.checkoutConfiguration.onAdditionalDetails = handleOnAdditionalDetails;\n store.checkoutConfiguration.showPayButton = false;\n store.checkoutConfiguration.clientKey = window.adyenClientKey;\n store.checkoutConfiguration.paymentMethodsConfiguration = {\n card: getCardConfig(),\n bcmc: getCardConfig(),\n storedCard: _objectSpread(_objectSpread({}, getCardConfig()), {}, {\n holderNameRequired: false\n }),\n boletobancario: {\n personalDetailsRequired: true,\n // turn personalDetails section on/off\n billingAddressRequired: false,\n // turn billingAddress section on/off\n showEmailAddress: false // allow shopper to specify their email address\n },\n paywithgoogle: getGooglePayConfig(),\n googlepay: getGooglePayConfig(),\n paypal: getPaypalConfig(),\n amazonpay: getAmazonpayConfig(),\n giftcard: getGiftCardConfig(),\n applepay: getApplePayConfig(),\n klarna: getKlarnaConfig(),\n klarna_account: getKlarnaConfig(),\n klarna_paynow: getKlarnaConfig(),\n cashapp: getCashAppConfig()\n };\n}\nmodule.exports = {\n getCardConfig: getCardConfig,\n getPaypalConfig: getPaypalConfig,\n getGooglePayConfig: getGooglePayConfig,\n getAmazonpayConfig: getAmazonpayConfig,\n getGiftCardConfig: getGiftCardConfig,\n getApplePayConfig: getApplePayConfig,\n getCashAppConfig: getCashAppConfig,\n getKlarnaConfig: getKlarnaConfig,\n setCheckoutConfiguration: setCheckoutConfiguration,\n actionHandler: actionHandler\n};\n\n//# sourceURL=webpack://app_adyen_SFRA/./cartridges/app_adyen_SFRA/cartridge/client/default/js/adyen_checkout/checkoutConfiguration.js?"); +eval("\n\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }\nfunction _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, \"next\", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, \"throw\", n); } _next(void 0); }); }; }\nvar helpers = __webpack_require__(/*! ./helpers */ \"./cartridges/app_adyen_SFRA/cartridge/client/default/js/adyen_checkout/helpers.js\");\nvar _require = __webpack_require__(/*! ./makePartialPayment */ \"./cartridges/app_adyen_SFRA/cartridge/client/default/js/adyen_checkout/makePartialPayment.js\"),\n makePartialPayment = _require.makePartialPayment;\nvar _require2 = __webpack_require__(/*! ../commons */ \"./cartridges/app_adyen_SFRA/cartridge/client/default/js/commons/index.js\"),\n onBrand = _require2.onBrand,\n onFieldValid = _require2.onFieldValid;\nvar store = __webpack_require__(/*! ../../../../store */ \"./cartridges/app_adyen_SFRA/cartridge/store/index.js\");\nvar constants = __webpack_require__(/*! ../constants */ \"./cartridges/app_adyen_SFRA/cartridge/client/default/js/constants.js\");\nvar _require3 = __webpack_require__(/*! ./renderGiftcardComponent */ \"./cartridges/app_adyen_SFRA/cartridge/client/default/js/adyen_checkout/renderGiftcardComponent.js\"),\n createElementsToShowRemainingGiftCardAmount = _require3.createElementsToShowRemainingGiftCardAmount,\n renderAddedGiftCard = _require3.renderAddedGiftCard,\n getGiftCardElements = _require3.getGiftCardElements,\n showGiftCardInfoMessage = _require3.showGiftCardInfoMessage,\n showGiftCardCancelButton = _require3.showGiftCardCancelButton,\n attachGiftCardCancelListener = _require3.attachGiftCardCancelListener;\nfunction getCardConfig() {\n return {\n hasHolderName: true,\n holderNameRequired: true,\n enableStoreDetails: window.showStoreDetails,\n showBrandsUnderCardNumber: false,\n clickToPayConfiguration: {\n shopperEmail: window.customerEmail,\n merchantDisplayName: window.merchantAccount\n },\n exposeExpiryDate: false,\n onChange: function onChange(state) {\n store.isValid = state.isValid;\n var method = state.data.paymentMethod.storedPaymentMethodId ? \"storedCard\".concat(state.data.paymentMethod.storedPaymentMethodId) : store.selectedMethod;\n store.updateSelectedPayment(method, 'isValid', store.isValid);\n store.updateSelectedPayment(method, 'stateData', state.data);\n },\n onSubmit: function onSubmit() {\n helpers.assignPaymentMethodValue();\n document.querySelector('button[value=\"submit-payment\"]').disabled = false;\n document.querySelector('button[value=\"submit-payment\"]').click();\n },\n onFieldValid: onFieldValid,\n onBrand: onBrand\n };\n}\nfunction getPaypalConfig() {\n store.paypalTerminatedEarly = false;\n return {\n showPayButton: true,\n environment: window.Configuration.environment,\n onSubmit: function onSubmit(state, component) {\n helpers.assignPaymentMethodValue();\n document.querySelector('#adyenStateData').value = JSON.stringify(store.selectedPayment.stateData);\n helpers.paymentFromComponent(state.data, component);\n },\n onCancel: function onCancel(data, component) {\n store.paypalTerminatedEarly = false;\n helpers.paymentFromComponent({\n cancelTransaction: true,\n merchantReference: document.querySelector('#merchantReference').value,\n orderToken: document.querySelector('#orderToken').value\n }, component);\n },\n onError: function onError(error, component) {\n store.paypalTerminatedEarly = false;\n if (component) {\n component.setStatus('ready');\n }\n document.querySelector('#showConfirmationForm').submit();\n },\n onAdditionalDetails: function onAdditionalDetails(state) {\n store.paypalTerminatedEarly = false;\n document.querySelector('#additionalDetailsHidden').value = JSON.stringify(state.data);\n document.querySelector('#showConfirmationForm').submit();\n },\n onClick: function onClick(data, actions) {\n $('#dwfrm_billing').trigger('submit');\n if (store.formErrorsExist) {\n return actions.reject();\n }\n if (store.paypalTerminatedEarly) {\n helpers.paymentFromComponent({\n cancelTransaction: true,\n merchantReference: document.querySelector('#merchantReference').value\n });\n store.paypalTerminatedEarly = false;\n return actions.resolve();\n }\n store.paypalTerminatedEarly = true;\n return null;\n }\n };\n}\nfunction getGooglePayConfig() {\n return {\n environment: window.Configuration.environment,\n onSubmit: function onSubmit() {\n helpers.assignPaymentMethodValue();\n document.querySelector('button[value=\"submit-payment\"]').disabled = false;\n document.querySelector('button[value=\"submit-payment\"]').click();\n },\n configuration: {\n gatewayMerchantId: window.merchantAccount\n },\n showPayButton: true,\n buttonColor: 'white'\n };\n}\nfunction handlePartialPaymentSuccess() {\n var _store$addedGiftCards;\n var _getGiftCardElements = getGiftCardElements(),\n giftCardSelectContainer = _getGiftCardElements.giftCardSelectContainer,\n giftCardSelect = _getGiftCardElements.giftCardSelect,\n giftCardsList = _getGiftCardElements.giftCardsList,\n cancelMainPaymentGiftCard = _getGiftCardElements.cancelMainPaymentGiftCard,\n giftCardAddButton = _getGiftCardElements.giftCardAddButton;\n giftCardSelectContainer.classList.add('invisible');\n giftCardSelect.value = null;\n giftCardsList.innerHTML = '';\n cancelMainPaymentGiftCard.addEventListener('click', function () {\n store.componentsObj.giftcard.node.unmount('component_giftcard');\n cancelMainPaymentGiftCard.classList.add('invisible');\n giftCardAddButton.style.display = 'block';\n giftCardSelect.value = 'null';\n });\n if (store.componentsObj.giftcard) {\n store.componentsObj.giftcard.node.unmount('component_giftcard');\n }\n store.addedGiftCards.forEach(function (card) {\n renderAddedGiftCard(card);\n });\n if ((_store$addedGiftCards = store.addedGiftCards) !== null && _store$addedGiftCards !== void 0 && _store$addedGiftCards.length) {\n showGiftCardInfoMessage();\n }\n showGiftCardCancelButton(true);\n attachGiftCardCancelListener();\n createElementsToShowRemainingGiftCardAmount();\n}\nfunction makeGiftcardPaymentRequest(_x, _x2, _x3) {\n return _makeGiftcardPaymentRequest.apply(this, arguments);\n}\nfunction _makeGiftcardPaymentRequest() {\n _makeGiftcardPaymentRequest = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(giftCardData, giftcardBalance, reject) {\n var brandSelect, selectedBrandIndex, giftcardBrand, partialPaymentRequest, partialPaymentResponse;\n return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n while (1) switch (_context2.prev = _context2.next) {\n case 0:\n brandSelect = document.getElementById('giftCardSelect');\n selectedBrandIndex = brandSelect.selectedIndex;\n giftcardBrand = brandSelect.options[selectedBrandIndex].text;\n partialPaymentRequest = {\n paymentMethod: giftCardData,\n amount: giftcardBalance,\n partialPaymentsOrder: {\n pspReference: store.adyenOrderData.pspReference,\n orderData: store.adyenOrderData.orderData\n },\n giftcardBrand: giftcardBrand\n };\n _context2.next = 6;\n return makePartialPayment(partialPaymentRequest);\n case 6:\n partialPaymentResponse = _context2.sent;\n if (partialPaymentResponse !== null && partialPaymentResponse !== void 0 && partialPaymentResponse.error) {\n reject();\n } else {\n handlePartialPaymentSuccess();\n }\n case 8:\n case \"end\":\n return _context2.stop();\n }\n }, _callee2);\n }));\n return _makeGiftcardPaymentRequest.apply(this, arguments);\n}\nfunction getGiftCardConfig() {\n var giftcardBalance;\n return {\n showPayButton: true,\n onChange: function onChange(state) {\n store.updateSelectedPayment(constants.GIFTCARD, 'isValid', state.isValid);\n store.updateSelectedPayment(constants.GIFTCARD, 'stateData', state.data);\n },\n onBalanceCheck: function onBalanceCheck(resolve, reject, requestData) {\n $.ajax({\n type: 'POST',\n url: window.checkBalanceUrl,\n data: JSON.stringify(requestData),\n contentType: 'application/json; charset=utf-8',\n async: false,\n success: function success(data) {\n giftcardBalance = data.balance;\n document.querySelector('button[value=\"submit-payment\"]').disabled = false;\n if (data.resultCode === constants.SUCCESS) {\n var _getGiftCardElements2 = getGiftCardElements(),\n giftCardsInfoMessageContainer = _getGiftCardElements2.giftCardsInfoMessageContainer,\n giftCardSelect = _getGiftCardElements2.giftCardSelect,\n cancelMainPaymentGiftCard = _getGiftCardElements2.cancelMainPaymentGiftCard,\n giftCardAddButton = _getGiftCardElements2.giftCardAddButton,\n giftCardSelectWrapper = _getGiftCardElements2.giftCardSelectWrapper;\n if (giftCardSelectWrapper) {\n giftCardSelectWrapper.classList.add('invisible');\n }\n var initialPartialObject = _objectSpread({}, store.partialPaymentsOrderObj);\n cancelMainPaymentGiftCard.classList.remove('invisible');\n cancelMainPaymentGiftCard.addEventListener('click', function () {\n store.componentsObj.giftcard.node.unmount('component_giftcard');\n cancelMainPaymentGiftCard.classList.add('invisible');\n giftCardAddButton.style.display = 'block';\n giftCardSelect.value = 'null';\n store.partialPaymentsOrderObj.remainingAmountFormatted = initialPartialObject.remainingAmountFormatted;\n store.partialPaymentsOrderObj.totalDiscountedAmount = initialPartialObject.totalDiscountedAmount;\n });\n document.querySelector('button[value=\"submit-payment\"]').disabled = true;\n giftCardsInfoMessageContainer.innerHTML = '';\n giftCardsInfoMessageContainer.classList.remove('gift-cards-info-message-container');\n store.partialPaymentsOrderObj.remainingAmountFormatted = data.remainingAmountFormatted;\n store.partialPaymentsOrderObj.totalDiscountedAmount = data.totalAmountFormatted;\n resolve(data);\n } else if (data.resultCode === constants.NOTENOUGHBALANCE) {\n resolve(data);\n } else {\n reject();\n }\n },\n fail: function fail() {\n reject();\n }\n });\n },\n onOrderRequest: function onOrderRequest(resolve, reject, requestData) {\n // Make a POST /orders request\n // Create an order for the total transaction amount\n var giftCardData = requestData.paymentMethod;\n if (store.adyenOrderData) {\n makeGiftcardPaymentRequest(giftCardData, giftcardBalance, reject);\n } else {\n $.ajax({\n type: 'POST',\n url: window.partialPaymentsOrderUrl,\n data: JSON.stringify(requestData),\n contentType: 'application/json; charset=utf-8',\n async: false,\n success: function success(data) {\n if (data.resultCode === 'Success') {\n store.adyenOrderData = data;\n // make payments call including giftcard data and order data\n makeGiftcardPaymentRequest(giftCardData, giftcardBalance, reject);\n }\n }\n });\n }\n },\n onSubmit: function onSubmit(state, component) {\n store.selectedMethod = state.data.paymentMethod.type;\n store.brand = component === null || component === void 0 ? void 0 : component.displayName;\n document.querySelector('input[name=\"brandCode\"]').checked = false;\n document.querySelector('button[value=\"submit-payment\"]').disabled = false;\n document.querySelector('button[value=\"submit-payment\"]').click();\n }\n };\n}\nfunction handleOnChange(state) {\n var type = state.data.paymentMethod.type;\n store.isValid = state.isValid;\n if (!store.componentsObj[type]) {\n store.componentsObj[type] = {};\n }\n store.componentsObj[type].isValid = store.isValid;\n store.componentsObj[type].stateData = state.data;\n}\nvar actionHandler = /*#__PURE__*/function () {\n var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(action) {\n var checkout;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n _context.next = 2;\n return AdyenCheckout(store.checkoutConfiguration);\n case 2:\n checkout = _context.sent;\n checkout.createFromAction(action).mount('#action-container');\n $('#action-modal').modal({\n backdrop: 'static',\n keyboard: false\n });\n if (action.type === constants.ACTIONTYPE.QRCODE) {\n document.getElementById('cancelQrMethodsButton').classList.remove('invisible');\n }\n case 6:\n case \"end\":\n return _context.stop();\n }\n }, _callee);\n }));\n return function actionHandler(_x4) {\n return _ref.apply(this, arguments);\n };\n}();\nfunction handleOnAdditionalDetails(state) {\n $.ajax({\n type: 'POST',\n url: window.paymentsDetailsURL,\n data: JSON.stringify({\n data: state.data,\n orderToken: window.orderToken\n }),\n contentType: 'application/json; charset=utf-8',\n async: false,\n success: function success(data) {\n if (!data.isFinal && _typeof(data.action) === 'object') {\n actionHandler(data.action);\n } else {\n window.location.href = data.redirectUrl;\n }\n }\n });\n}\nfunction getAmazonpayConfig() {\n return {\n showPayButton: true,\n productType: 'PayAndShip',\n checkoutMode: 'ProcessOrder',\n locale: window.Configuration.locale,\n returnUrl: window.returnURL,\n onClick: function onClick(resolve, reject) {\n $('#dwfrm_billing').trigger('submit');\n if (store.formErrorsExist) {\n reject();\n } else {\n helpers.assignPaymentMethodValue();\n resolve();\n }\n },\n onError: function onError() {}\n };\n}\nfunction getApplePayConfig() {\n return {\n showPayButton: true,\n buttonColor: 'black',\n onSubmit: function onSubmit(state, component) {\n $('#dwfrm_billing').trigger('submit');\n helpers.assignPaymentMethodValue();\n helpers.paymentFromComponent(state.data, component);\n }\n };\n}\nfunction getCashAppConfig() {\n return {\n showPayButton: true,\n onSubmit: function onSubmit(state, component) {\n $('#dwfrm_billing').trigger('submit');\n helpers.assignPaymentMethodValue();\n helpers.paymentFromComponent(state.data, component);\n }\n };\n}\nfunction getKlarnaConfig() {\n var _window = window,\n klarnaWidgetEnabled = _window.klarnaWidgetEnabled;\n if (klarnaWidgetEnabled) {\n return {\n showPayButton: true,\n useKlarnaWidget: true,\n onSubmit: function onSubmit(state, component) {\n helpers.assignPaymentMethodValue();\n helpers.paymentFromComponent(state.data, component);\n },\n onAdditionalDetails: function onAdditionalDetails(state) {\n document.querySelector('#additionalDetailsHidden').value = JSON.stringify(state.data);\n document.querySelector('#showConfirmationForm').submit();\n }\n };\n }\n return null;\n}\nfunction getUpiConfig() {\n return {\n showPayButton: true,\n onSubmit: function onSubmit(state, component) {\n $('#dwfrm_billing').trigger('submit');\n helpers.assignPaymentMethodValue();\n helpers.paymentFromComponent(state.data, component);\n },\n onAdditionalDetails: function onAdditionalDetails(state) {\n document.querySelector('#additionalDetailsHidden').value = JSON.stringify(state.data);\n document.querySelector('#showConfirmationForm').submit();\n },\n onError: function onError(component) {\n if (component) {\n component.setStatus('ready');\n }\n document.querySelector('#showConfirmationForm').submit();\n }\n };\n}\nfunction setCheckoutConfiguration() {\n store.checkoutConfiguration.onChange = handleOnChange;\n store.checkoutConfiguration.onAdditionalDetails = handleOnAdditionalDetails;\n store.checkoutConfiguration.showPayButton = false;\n store.checkoutConfiguration.clientKey = window.adyenClientKey;\n store.checkoutConfiguration.paymentMethodsConfiguration = {\n card: getCardConfig(),\n bcmc: getCardConfig(),\n storedCard: _objectSpread(_objectSpread({}, getCardConfig()), {}, {\n holderNameRequired: false\n }),\n boletobancario: {\n personalDetailsRequired: true,\n // turn personalDetails section on/off\n billingAddressRequired: false,\n // turn billingAddress section on/off\n showEmailAddress: false // allow shopper to specify their email address\n },\n paywithgoogle: getGooglePayConfig(),\n googlepay: getGooglePayConfig(),\n paypal: getPaypalConfig(),\n amazonpay: getAmazonpayConfig(),\n giftcard: getGiftCardConfig(),\n applepay: getApplePayConfig(),\n klarna: getKlarnaConfig(),\n klarna_account: getKlarnaConfig(),\n klarna_paynow: getKlarnaConfig(),\n cashapp: getCashAppConfig(),\n upi: getUpiConfig()\n };\n}\nmodule.exports = {\n getCardConfig: getCardConfig,\n getPaypalConfig: getPaypalConfig,\n getGooglePayConfig: getGooglePayConfig,\n getAmazonpayConfig: getAmazonpayConfig,\n getGiftCardConfig: getGiftCardConfig,\n getApplePayConfig: getApplePayConfig,\n getCashAppConfig: getCashAppConfig,\n getKlarnaConfig: getKlarnaConfig,\n setCheckoutConfiguration: setCheckoutConfiguration,\n actionHandler: actionHandler\n};\n\n//# sourceURL=webpack://app_adyen_SFRA/./cartridges/app_adyen_SFRA/cartridge/client/default/js/adyen_checkout/checkoutConfiguration.js?"); /***/ }), @@ -156,7 +156,7 @@ eval("\n\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \" \****************************************************************************/ /***/ ((module) => { -eval("\n\n// Adyen constants\n\nmodule.exports = {\n METHOD_ADYEN: 'Adyen',\n METHOD_ADYEN_POS: 'AdyenPOS',\n METHOD_ADYEN_COMPONENT: 'AdyenComponent',\n RECEIVED: 'Received',\n NOTENOUGHBALANCE: 'NotEnoughBalance',\n SUCCESS: 'Success',\n GIFTCARD: 'giftcard',\n SCHEME: 'scheme',\n GIROPAY: 'giropay',\n APPLE_PAY: 'applepay',\n PAYPAL: 'paypal',\n AMAZON_PAY: 'amazonpay',\n ACTIONTYPE: {\n QRCODE: 'qrCode'\n },\n DISABLED_SUBMIT_BUTTON_METHODS: ['paypal', 'paywithgoogle', 'googlepay', 'amazonpay', 'applepay', 'cashapp'],\n MULTIPLE_TX_VARIANTS_COMPONENTS: ['upi']\n};\n\n//# sourceURL=webpack://app_adyen_SFRA/./cartridges/app_adyen_SFRA/cartridge/client/default/js/constants.js?"); +eval("\n\n// Adyen constants\n\nmodule.exports = {\n METHOD_ADYEN: 'Adyen',\n METHOD_ADYEN_POS: 'AdyenPOS',\n METHOD_ADYEN_COMPONENT: 'AdyenComponent',\n RECEIVED: 'Received',\n NOTENOUGHBALANCE: 'NotEnoughBalance',\n SUCCESS: 'Success',\n GIFTCARD: 'giftcard',\n SCHEME: 'scheme',\n GIROPAY: 'giropay',\n APPLE_PAY: 'applepay',\n PAYPAL: 'paypal',\n AMAZON_PAY: 'amazonpay',\n ACTIONTYPE: {\n QRCODE: 'qrCode'\n },\n DISABLED_SUBMIT_BUTTON_METHODS: ['paypal', 'paywithgoogle', 'googlepay', 'amazonpay', 'applepay', 'cashapp', 'upi']\n};\n\n//# sourceURL=webpack://app_adyen_SFRA/./cartridges/app_adyen_SFRA/cartridge/client/default/js/constants.js?"); /***/ }), @@ -176,7 +176,7 @@ eval("\n\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \" \********************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ $mobx: () => (/* binding */ $mobx),\n/* harmony export */ FlowCancellationError: () => (/* binding */ FlowCancellationError),\n/* harmony export */ ObservableMap: () => (/* binding */ ObservableMap),\n/* harmony export */ ObservableSet: () => (/* binding */ ObservableSet),\n/* harmony export */ Reaction: () => (/* binding */ Reaction),\n/* harmony export */ _allowStateChanges: () => (/* binding */ allowStateChanges),\n/* harmony export */ _allowStateChangesInsideComputed: () => (/* binding */ runInAction),\n/* harmony export */ _allowStateReadsEnd: () => (/* binding */ allowStateReadsEnd),\n/* harmony export */ _allowStateReadsStart: () => (/* binding */ allowStateReadsStart),\n/* harmony export */ _autoAction: () => (/* binding */ autoAction),\n/* harmony export */ _endAction: () => (/* binding */ _endAction),\n/* harmony export */ _getAdministration: () => (/* binding */ getAdministration),\n/* harmony export */ _getGlobalState: () => (/* binding */ getGlobalState),\n/* harmony export */ _interceptReads: () => (/* binding */ interceptReads),\n/* harmony export */ _isComputingDerivation: () => (/* binding */ isComputingDerivation),\n/* harmony export */ _resetGlobalState: () => (/* binding */ resetGlobalState),\n/* harmony export */ _startAction: () => (/* binding */ _startAction),\n/* harmony export */ action: () => (/* binding */ action),\n/* harmony export */ autorun: () => (/* binding */ autorun),\n/* harmony export */ comparer: () => (/* binding */ comparer),\n/* harmony export */ computed: () => (/* binding */ computed),\n/* harmony export */ configure: () => (/* binding */ configure),\n/* harmony export */ createAtom: () => (/* binding */ createAtom),\n/* harmony export */ defineProperty: () => (/* binding */ apiDefineProperty),\n/* harmony export */ entries: () => (/* binding */ entries),\n/* harmony export */ extendObservable: () => (/* binding */ extendObservable),\n/* harmony export */ flow: () => (/* binding */ flow),\n/* harmony export */ flowResult: () => (/* binding */ flowResult),\n/* harmony export */ get: () => (/* binding */ get),\n/* harmony export */ getAtom: () => (/* binding */ getAtom),\n/* harmony export */ getDebugName: () => (/* binding */ getDebugName),\n/* harmony export */ getDependencyTree: () => (/* binding */ getDependencyTree),\n/* harmony export */ getObserverTree: () => (/* binding */ getObserverTree),\n/* harmony export */ has: () => (/* binding */ has),\n/* harmony export */ intercept: () => (/* binding */ intercept),\n/* harmony export */ isAction: () => (/* binding */ isAction),\n/* harmony export */ isBoxedObservable: () => (/* binding */ isObservableValue),\n/* harmony export */ isComputed: () => (/* binding */ isComputed),\n/* harmony export */ isComputedProp: () => (/* binding */ isComputedProp),\n/* harmony export */ isFlow: () => (/* binding */ isFlow),\n/* harmony export */ isFlowCancellationError: () => (/* binding */ isFlowCancellationError),\n/* harmony export */ isObservable: () => (/* binding */ isObservable),\n/* harmony export */ isObservableArray: () => (/* binding */ isObservableArray),\n/* harmony export */ isObservableMap: () => (/* binding */ isObservableMap),\n/* harmony export */ isObservableObject: () => (/* binding */ isObservableObject),\n/* harmony export */ isObservableProp: () => (/* binding */ isObservableProp),\n/* harmony export */ isObservableSet: () => (/* binding */ isObservableSet),\n/* harmony export */ keys: () => (/* binding */ keys),\n/* harmony export */ makeAutoObservable: () => (/* binding */ makeAutoObservable),\n/* harmony export */ makeObservable: () => (/* binding */ makeObservable),\n/* harmony export */ observable: () => (/* binding */ observable),\n/* harmony export */ observe: () => (/* binding */ observe),\n/* harmony export */ onBecomeObserved: () => (/* binding */ onBecomeObserved),\n/* harmony export */ onBecomeUnobserved: () => (/* binding */ onBecomeUnobserved),\n/* harmony export */ onReactionError: () => (/* binding */ onReactionError),\n/* harmony export */ override: () => (/* binding */ override),\n/* harmony export */ ownKeys: () => (/* binding */ apiOwnKeys),\n/* harmony export */ reaction: () => (/* binding */ reaction),\n/* harmony export */ remove: () => (/* binding */ remove),\n/* harmony export */ runInAction: () => (/* binding */ runInAction),\n/* harmony export */ set: () => (/* binding */ set),\n/* harmony export */ spy: () => (/* binding */ spy),\n/* harmony export */ toJS: () => (/* binding */ toJS),\n/* harmony export */ trace: () => (/* binding */ trace),\n/* harmony export */ transaction: () => (/* binding */ transaction),\n/* harmony export */ untracked: () => (/* binding */ untracked),\n/* harmony export */ values: () => (/* binding */ values),\n/* harmony export */ when: () => (/* binding */ when)\n/* harmony export */ });\nvar niceErrors = {\n 0: \"Invalid value for configuration 'enforceActions', expected 'never', 'always' or 'observed'\",\n 1: function _(annotationType, key) {\n return \"Cannot apply '\" + annotationType + \"' to '\" + key.toString() + \"': Field not found.\";\n },\n /*\n 2(prop) {\n return `invalid decorator for '${prop.toString()}'`\n },\n 3(prop) {\n return `Cannot decorate '${prop.toString()}': action can only be used on properties with a function value.`\n },\n 4(prop) {\n return `Cannot decorate '${prop.toString()}': computed can only be used on getter properties.`\n },\n */\n 5: \"'keys()' can only be used on observable objects, arrays, sets and maps\",\n 6: \"'values()' can only be used on observable objects, arrays, sets and maps\",\n 7: \"'entries()' can only be used on observable objects, arrays and maps\",\n 8: \"'set()' can only be used on observable objects, arrays and maps\",\n 9: \"'remove()' can only be used on observable objects, arrays and maps\",\n 10: \"'has()' can only be used on observable objects, arrays and maps\",\n 11: \"'get()' can only be used on observable objects, arrays and maps\",\n 12: \"Invalid annotation\",\n 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)\",\n 14: \"Intercept handlers should return nothing or a change object\",\n 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)\",\n 16: \"Modification exception: the internal structure of an observable array was changed.\",\n 17: function _(index, length) {\n return \"[mobx.array] Index out of bounds, \" + index + \" is larger than \" + length;\n },\n 18: \"mobx.map requires Map polyfill for the current browser. Check babel-polyfill or core-js/es6/map.js\",\n 19: function _(other) {\n return \"Cannot initialize from classes that inherit from Map: \" + other.constructor.name;\n },\n 20: function _(other) {\n return \"Cannot initialize map from \" + other;\n },\n 21: function _(dataStructure) {\n return \"Cannot convert to map from '\" + dataStructure + \"'\";\n },\n 22: \"mobx.set requires Set polyfill for the current browser. Check babel-polyfill or core-js/es6/set.js\",\n 23: \"It is not possible to get index atoms from arrays\",\n 24: function _(thing) {\n return \"Cannot obtain administration from \" + thing;\n },\n 25: function _(property, name) {\n return \"the entry '\" + property + \"' does not exist in the observable map '\" + name + \"'\";\n },\n 26: \"please specify a property\",\n 27: function _(property, name) {\n return \"no observable property '\" + property.toString() + \"' found on the observable object '\" + name + \"'\";\n },\n 28: function _(thing) {\n return \"Cannot obtain atom from \" + thing;\n },\n 29: \"Expecting some object\",\n 30: \"invalid action stack. did you forget to finish an action?\",\n 31: \"missing option for computed: get\",\n 32: function _(name, derivation) {\n return \"Cycle detected in computation \" + name + \": \" + derivation;\n },\n 33: function _(name) {\n return \"The setter of computed value '\" + name + \"' is trying to update itself. Did you intend to update an _observable_ value, instead of the computed property?\";\n },\n 34: function _(name) {\n return \"[ComputedValue '\" + name + \"'] It is not possible to assign a new value to a computed value.\";\n },\n 35: \"There are multiple, different versions of MobX active. Make sure MobX is loaded only once or use `configure({ isolateGlobalState: true })`\",\n 36: \"isolateGlobalState should be called before MobX is running any reactions\",\n 37: function _(method) {\n return \"[mobx] `observableArray.\" + method + \"()` mutates the array in-place, which is not allowed inside a derivation. Use `array.slice().\" + method + \"()` instead\";\n },\n 38: \"'ownKeys()' can only be used on observable objects\",\n 39: \"'defineProperty()' can only be used on observable objects\"\n};\nvar errors = true ? niceErrors : 0;\nfunction die(error) {\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n if (true) {\n var e = typeof error === \"string\" ? error : errors[error];\n if (typeof e === \"function\") e = e.apply(null, args);\n throw new Error(\"[MobX] \" + e);\n }\n throw new Error(typeof error === \"number\" ? \"[MobX] minified error nr: \" + error + (args.length ? \" \" + args.map(String).join(\",\") : \"\") + \". Find the full error at: https://github.com/mobxjs/mobx/blob/main/packages/mobx/src/errors.ts\" : \"[MobX] \" + error);\n}\n\nvar mockGlobal = {};\nfunction getGlobal() {\n if (typeof globalThis !== \"undefined\") {\n return globalThis;\n }\n if (typeof window !== \"undefined\") {\n return window;\n }\n if (typeof __webpack_require__.g !== \"undefined\") {\n return __webpack_require__.g;\n }\n if (typeof self !== \"undefined\") {\n return self;\n }\n return mockGlobal;\n}\n\n// We shorten anything used > 5 times\nvar assign = Object.assign;\nvar getDescriptor = Object.getOwnPropertyDescriptor;\nvar defineProperty = Object.defineProperty;\nvar objectPrototype = Object.prototype;\nvar EMPTY_ARRAY = [];\nObject.freeze(EMPTY_ARRAY);\nvar EMPTY_OBJECT = {};\nObject.freeze(EMPTY_OBJECT);\nvar hasProxy = typeof Proxy !== \"undefined\";\nvar plainObjectString = /*#__PURE__*/Object.toString();\nfunction assertProxies() {\n if (!hasProxy) {\n die( true ? \"`Proxy` objects are not available in the current environment. Please configure MobX to enable a fallback implementation.`\" : 0);\n }\n}\nfunction warnAboutProxyRequirement(msg) {\n if ( true && globalState.verifyProxies) {\n die(\"MobX is currently configured to be able to run in ES5 mode, but in ES5 MobX won't be able to \" + msg);\n }\n}\nfunction getNextId() {\n return ++globalState.mobxGuid;\n}\n/**\n * Makes sure that the provided function is invoked at most once.\n */\nfunction once(func) {\n var invoked = false;\n return function () {\n if (invoked) {\n return;\n }\n invoked = true;\n return func.apply(this, arguments);\n };\n}\nvar noop = function noop() {};\nfunction isFunction(fn) {\n return typeof fn === \"function\";\n}\nfunction isStringish(value) {\n var t = typeof value;\n switch (t) {\n case \"string\":\n case \"symbol\":\n case \"number\":\n return true;\n }\n return false;\n}\nfunction isObject(value) {\n return value !== null && typeof value === \"object\";\n}\nfunction isPlainObject(value) {\n if (!isObject(value)) {\n return false;\n }\n var proto = Object.getPrototypeOf(value);\n if (proto == null) {\n return true;\n }\n var protoConstructor = Object.hasOwnProperty.call(proto, \"constructor\") && proto.constructor;\n return typeof protoConstructor === \"function\" && protoConstructor.toString() === plainObjectString;\n}\n// https://stackoverflow.com/a/37865170\nfunction isGenerator(obj) {\n var constructor = obj == null ? void 0 : obj.constructor;\n if (!constructor) {\n return false;\n }\n if (\"GeneratorFunction\" === constructor.name || \"GeneratorFunction\" === constructor.displayName) {\n return true;\n }\n return false;\n}\nfunction addHiddenProp(object, propName, value) {\n defineProperty(object, propName, {\n enumerable: false,\n writable: true,\n configurable: true,\n value: value\n });\n}\nfunction addHiddenFinalProp(object, propName, value) {\n defineProperty(object, propName, {\n enumerable: false,\n writable: false,\n configurable: true,\n value: value\n });\n}\nfunction createInstanceofPredicate(name, theClass) {\n var propName = \"isMobX\" + name;\n theClass.prototype[propName] = true;\n return function (x) {\n return isObject(x) && x[propName] === true;\n };\n}\n/**\n * Yields true for both native and observable Map, even across different windows.\n */\nfunction isES6Map(thing) {\n return thing != null && Object.prototype.toString.call(thing) === \"[object Map]\";\n}\n/**\n * Makes sure a Map is an instance of non-inherited native or observable Map.\n */\nfunction isPlainES6Map(thing) {\n var mapProto = Object.getPrototypeOf(thing);\n var objectProto = Object.getPrototypeOf(mapProto);\n var nullProto = Object.getPrototypeOf(objectProto);\n return nullProto === null;\n}\n/**\n * Yields true for both native and observable Set, even across different windows.\n */\nfunction isES6Set(thing) {\n return thing != null && Object.prototype.toString.call(thing) === \"[object Set]\";\n}\nvar hasGetOwnPropertySymbols = typeof Object.getOwnPropertySymbols !== \"undefined\";\n/**\n * Returns the following: own enumerable keys and symbols.\n */\nfunction getPlainObjectKeys(object) {\n var keys = Object.keys(object);\n // Not supported in IE, so there are not going to be symbol props anyway...\n if (!hasGetOwnPropertySymbols) {\n return keys;\n }\n var symbols = Object.getOwnPropertySymbols(object);\n if (!symbols.length) {\n return keys;\n }\n return [].concat(keys, symbols.filter(function (s) {\n return objectPrototype.propertyIsEnumerable.call(object, s);\n }));\n}\n// From Immer utils\n// Returns all own keys, including non-enumerable and symbolic\nvar ownKeys = typeof Reflect !== \"undefined\" && Reflect.ownKeys ? Reflect.ownKeys : hasGetOwnPropertySymbols ? function (obj) {\n return Object.getOwnPropertyNames(obj).concat(Object.getOwnPropertySymbols(obj));\n} : /* istanbul ignore next */Object.getOwnPropertyNames;\nfunction stringifyKey(key) {\n if (typeof key === \"string\") {\n return key;\n }\n if (typeof key === \"symbol\") {\n return key.toString();\n }\n return new String(key).toString();\n}\nfunction toPrimitive(value) {\n return value === null ? null : typeof value === \"object\" ? \"\" + value : value;\n}\nfunction hasProp(target, prop) {\n return objectPrototype.hasOwnProperty.call(target, prop);\n}\n// From Immer utils\nvar getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors || function getOwnPropertyDescriptors(target) {\n // Polyfill needed for Hermes and IE, see https://github.com/facebook/hermes/issues/274\n var res = {};\n // Note: without polyfill for ownKeys, symbols won't be picked up\n ownKeys(target).forEach(function (key) {\n res[key] = getDescriptor(target, key);\n });\n return res;\n};\nfunction getFlag(flags, mask) {\n return !!(flags & mask);\n}\nfunction setFlag(flags, mask, newValue) {\n if (newValue) {\n flags |= mask;\n } else {\n flags &= ~mask;\n }\n return flags;\n}\n\nfunction _arrayLikeToArray(r, a) {\n (null == a || a > r.length) && (a = r.length);\n for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];\n return n;\n}\nfunction _defineProperties(e, r) {\n for (var t = 0; t < r.length; t++) {\n var o = r[t];\n o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);\n }\n}\nfunction _createClass(e, r, t) {\n return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", {\n writable: !1\n }), e;\n}\nfunction _createForOfIteratorHelperLoose(r, e) {\n var t = \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"];\n if (t) return (t = t.call(r)).next.bind(t);\n if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && \"number\" == typeof r.length) {\n t && (r = t);\n var o = 0;\n return function () {\n return o >= r.length ? {\n done: !0\n } : {\n done: !1,\n value: r[o++]\n };\n };\n }\n throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\nfunction _extends() {\n return _extends = Object.assign ? Object.assign.bind() : function (n) {\n for (var e = 1; e < arguments.length; e++) {\n var t = arguments[e];\n for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);\n }\n return n;\n }, _extends.apply(null, arguments);\n}\nfunction _inheritsLoose(t, o) {\n t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);\n}\nfunction _setPrototypeOf(t, e) {\n return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {\n return t.__proto__ = e, t;\n }, _setPrototypeOf(t, e);\n}\nfunction _toPrimitive(t, r) {\n if (\"object\" != typeof t || !t) return t;\n var e = t[Symbol.toPrimitive];\n if (void 0 !== e) {\n var i = e.call(t, r || \"default\");\n if (\"object\" != typeof i) return i;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (\"string\" === r ? String : Number)(t);\n}\nfunction _toPropertyKey(t) {\n var i = _toPrimitive(t, \"string\");\n return \"symbol\" == typeof i ? i : i + \"\";\n}\nfunction _unsupportedIterableToArray(r, a) {\n if (r) {\n if (\"string\" == typeof r) return _arrayLikeToArray(r, a);\n var t = {}.toString.call(r).slice(8, -1);\n return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;\n }\n}\n\nvar storedAnnotationsSymbol = /*#__PURE__*/Symbol(\"mobx-stored-annotations\");\n/**\n * Creates a function that acts as\n * - decorator\n * - annotation object\n */\nfunction createDecoratorAnnotation(annotation) {\n function decorator(target, property) {\n if (is20223Decorator(property)) {\n return annotation.decorate_20223_(target, property);\n } else {\n storeAnnotation(target, property, annotation);\n }\n }\n return Object.assign(decorator, annotation);\n}\n/**\n * Stores annotation to prototype,\n * so it can be inspected later by `makeObservable` called from constructor\n */\nfunction storeAnnotation(prototype, key, annotation) {\n if (!hasProp(prototype, storedAnnotationsSymbol)) {\n addHiddenProp(prototype, storedAnnotationsSymbol, _extends({}, prototype[storedAnnotationsSymbol]));\n }\n // @override must override something\n if ( true && isOverride(annotation) && !hasProp(prototype[storedAnnotationsSymbol], key)) {\n var fieldName = prototype.constructor.name + \".prototype.\" + key.toString();\n die(\"'\" + fieldName + \"' is decorated with 'override', \" + \"but no such decorated member was found on prototype.\");\n }\n // Cannot re-decorate\n assertNotDecorated(prototype, annotation, key);\n // Ignore override\n if (!isOverride(annotation)) {\n prototype[storedAnnotationsSymbol][key] = annotation;\n }\n}\nfunction assertNotDecorated(prototype, annotation, key) {\n if ( true && !isOverride(annotation) && hasProp(prototype[storedAnnotationsSymbol], key)) {\n var fieldName = prototype.constructor.name + \".prototype.\" + key.toString();\n var currentAnnotationType = prototype[storedAnnotationsSymbol][key].annotationType_;\n var requestedAnnotationType = annotation.annotationType_;\n die(\"Cannot apply '@\" + requestedAnnotationType + \"' to '\" + fieldName + \"':\" + (\"\\nThe field is already decorated with '@\" + currentAnnotationType + \"'.\") + \"\\nRe-decorating fields is not allowed.\" + \"\\nUse '@override' decorator for methods overridden by subclass.\");\n }\n}\n/**\n * Collects annotations from prototypes and stores them on target (instance)\n */\nfunction collectStoredAnnotations(target) {\n if (!hasProp(target, storedAnnotationsSymbol)) {\n // if (__DEV__ && !target[storedAnnotationsSymbol]) {\n // die(\n // `No annotations were passed to makeObservable, but no decorated members have been found either`\n // )\n // }\n // We need a copy as we will remove annotation from the list once it's applied.\n addHiddenProp(target, storedAnnotationsSymbol, _extends({}, target[storedAnnotationsSymbol]));\n }\n return target[storedAnnotationsSymbol];\n}\nfunction is20223Decorator(context) {\n return typeof context == \"object\" && typeof context[\"kind\"] == \"string\";\n}\nfunction assert20223DecoratorType(context, types) {\n if ( true && !types.includes(context.kind)) {\n die(\"The decorator applied to '\" + String(context.name) + \"' cannot be used on a \" + context.kind + \" element\");\n }\n}\n\nvar $mobx = /*#__PURE__*/Symbol(\"mobx administration\");\nvar Atom = /*#__PURE__*/function () {\n /**\n * Create a new atom. For debugging purposes it is recommended to give it a name.\n * The onBecomeObserved and onBecomeUnobserved callbacks can be used for resource management.\n */\n function Atom(name_) {\n if (name_ === void 0) {\n name_ = true ? \"Atom@\" + getNextId() : 0;\n }\n this.name_ = void 0;\n this.flags_ = 0;\n this.observers_ = new Set();\n this.lastAccessedBy_ = 0;\n this.lowestObserverState_ = IDerivationState_.NOT_TRACKING_;\n // onBecomeObservedListeners\n this.onBOL = void 0;\n // onBecomeUnobservedListeners\n this.onBUOL = void 0;\n this.name_ = name_;\n }\n // for effective unobserving. BaseAtom has true, for extra optimization, so its onBecomeUnobserved never gets called, because it's not needed\n var _proto = Atom.prototype;\n _proto.onBO = function onBO() {\n if (this.onBOL) {\n this.onBOL.forEach(function (listener) {\n return listener();\n });\n }\n };\n _proto.onBUO = function onBUO() {\n if (this.onBUOL) {\n this.onBUOL.forEach(function (listener) {\n return listener();\n });\n }\n }\n /**\n * Invoke this method to notify mobx that your atom has been used somehow.\n * Returns true if there is currently a reactive context.\n */;\n _proto.reportObserved = function reportObserved$1() {\n return reportObserved(this);\n }\n /**\n * Invoke this method _after_ this method has changed to signal mobx that all its observers should invalidate.\n */;\n _proto.reportChanged = function reportChanged() {\n startBatch();\n propagateChanged(this);\n endBatch();\n };\n _proto.toString = function toString() {\n return this.name_;\n };\n return _createClass(Atom, [{\n key: \"isBeingObserved\",\n get: function get() {\n return getFlag(this.flags_, Atom.isBeingObservedMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Atom.isBeingObservedMask_, newValue);\n }\n }, {\n key: \"isPendingUnobservation\",\n get: function get() {\n return getFlag(this.flags_, Atom.isPendingUnobservationMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Atom.isPendingUnobservationMask_, newValue);\n }\n }, {\n key: \"diffValue\",\n get: function get() {\n return getFlag(this.flags_, Atom.diffValueMask_) ? 1 : 0;\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Atom.diffValueMask_, newValue === 1 ? true : false);\n }\n }]);\n}();\nAtom.isBeingObservedMask_ = 1;\nAtom.isPendingUnobservationMask_ = 2;\nAtom.diffValueMask_ = 4;\nvar isAtom = /*#__PURE__*/createInstanceofPredicate(\"Atom\", Atom);\nfunction createAtom(name, onBecomeObservedHandler, onBecomeUnobservedHandler) {\n if (onBecomeObservedHandler === void 0) {\n onBecomeObservedHandler = noop;\n }\n if (onBecomeUnobservedHandler === void 0) {\n onBecomeUnobservedHandler = noop;\n }\n var atom = new Atom(name);\n // default `noop` listener will not initialize the hook Set\n if (onBecomeObservedHandler !== noop) {\n onBecomeObserved(atom, onBecomeObservedHandler);\n }\n if (onBecomeUnobservedHandler !== noop) {\n onBecomeUnobserved(atom, onBecomeUnobservedHandler);\n }\n return atom;\n}\n\nfunction identityComparer(a, b) {\n return a === b;\n}\nfunction structuralComparer(a, b) {\n return deepEqual(a, b);\n}\nfunction shallowComparer(a, b) {\n return deepEqual(a, b, 1);\n}\nfunction defaultComparer(a, b) {\n if (Object.is) {\n return Object.is(a, b);\n }\n return a === b ? a !== 0 || 1 / a === 1 / b : a !== a && b !== b;\n}\nvar comparer = {\n identity: identityComparer,\n structural: structuralComparer,\n \"default\": defaultComparer,\n shallow: shallowComparer\n};\n\nfunction deepEnhancer(v, _, name) {\n // it is an observable already, done\n if (isObservable(v)) {\n return v;\n }\n // something that can be converted and mutated?\n if (Array.isArray(v)) {\n return observable.array(v, {\n name: name\n });\n }\n if (isPlainObject(v)) {\n return observable.object(v, undefined, {\n name: name\n });\n }\n if (isES6Map(v)) {\n return observable.map(v, {\n name: name\n });\n }\n if (isES6Set(v)) {\n return observable.set(v, {\n name: name\n });\n }\n if (typeof v === \"function\" && !isAction(v) && !isFlow(v)) {\n if (isGenerator(v)) {\n return flow(v);\n } else {\n return autoAction(name, v);\n }\n }\n return v;\n}\nfunction shallowEnhancer(v, _, name) {\n if (v === undefined || v === null) {\n return v;\n }\n if (isObservableObject(v) || isObservableArray(v) || isObservableMap(v) || isObservableSet(v)) {\n return v;\n }\n if (Array.isArray(v)) {\n return observable.array(v, {\n name: name,\n deep: false\n });\n }\n if (isPlainObject(v)) {\n return observable.object(v, undefined, {\n name: name,\n deep: false\n });\n }\n if (isES6Map(v)) {\n return observable.map(v, {\n name: name,\n deep: false\n });\n }\n if (isES6Set(v)) {\n return observable.set(v, {\n name: name,\n deep: false\n });\n }\n if (true) {\n die(\"The shallow modifier / decorator can only used in combination with arrays, objects, maps and sets\");\n }\n}\nfunction referenceEnhancer(newValue) {\n // never turn into an observable\n return newValue;\n}\nfunction refStructEnhancer(v, oldValue) {\n if ( true && isObservable(v)) {\n die(\"observable.struct should not be used with observable values\");\n }\n if (deepEqual(v, oldValue)) {\n return oldValue;\n }\n return v;\n}\n\nvar OVERRIDE = \"override\";\nvar override = /*#__PURE__*/createDecoratorAnnotation({\n annotationType_: OVERRIDE,\n make_: make_,\n extend_: extend_,\n decorate_20223_: decorate_20223_\n});\nfunction isOverride(annotation) {\n return annotation.annotationType_ === OVERRIDE;\n}\nfunction make_(adm, key) {\n // Must not be plain object\n if ( true && adm.isPlainObject_) {\n die(\"Cannot apply '\" + this.annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + this.annotationType_ + \"' cannot be used on plain objects.\"));\n }\n // Must override something\n if ( true && !hasProp(adm.appliedAnnotations_, key)) {\n die(\"'\" + adm.name_ + \".\" + key.toString() + \"' is annotated with '\" + this.annotationType_ + \"', \" + \"but no such annotated member was found on prototype.\");\n }\n return 0 /* MakeResult.Cancel */;\n}\nfunction extend_(adm, key, descriptor, proxyTrap) {\n die(\"'\" + this.annotationType_ + \"' can only be used with 'makeObservable'\");\n}\nfunction decorate_20223_(desc, context) {\n console.warn(\"'\" + this.annotationType_ + \"' cannot be used with decorators - this is a no-op\");\n}\n\nfunction createActionAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$1,\n extend_: extend_$1,\n decorate_20223_: decorate_20223_$1\n };\n}\nfunction make_$1(adm, key, descriptor, source) {\n var _this$options_;\n // bound\n if ((_this$options_ = this.options_) != null && _this$options_.bound) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;\n }\n // own\n if (source === adm.target_) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 2 /* MakeResult.Continue */;\n }\n // prototype\n if (isAction(descriptor.value)) {\n // A prototype could have been annotated already by other constructor,\n // rest of the proto chain must be annotated already\n return 1 /* MakeResult.Break */;\n }\n var actionDescriptor = createActionDescriptor(adm, this, key, descriptor, false);\n defineProperty(source, key, actionDescriptor);\n return 2 /* MakeResult.Continue */;\n}\nfunction extend_$1(adm, key, descriptor, proxyTrap) {\n var actionDescriptor = createActionDescriptor(adm, this, key, descriptor);\n return adm.defineProperty_(key, actionDescriptor, proxyTrap);\n}\nfunction decorate_20223_$1(mthd, context) {\n if (true) {\n assert20223DecoratorType(context, [\"method\", \"field\"]);\n }\n var kind = context.kind,\n name = context.name,\n addInitializer = context.addInitializer;\n var ann = this;\n var _createAction = function _createAction(m) {\n var _ann$options_$name, _ann$options_, _ann$options_$autoAct, _ann$options_2;\n return createAction((_ann$options_$name = (_ann$options_ = ann.options_) == null ? void 0 : _ann$options_.name) != null ? _ann$options_$name : name.toString(), m, (_ann$options_$autoAct = (_ann$options_2 = ann.options_) == null ? void 0 : _ann$options_2.autoAction) != null ? _ann$options_$autoAct : false);\n };\n // Backwards/Legacy behavior, expects makeObservable(this)\n if (kind == \"field\") {\n addInitializer(function () {\n storeAnnotation(this, name, ann);\n });\n return;\n }\n if (kind == \"method\") {\n var _this$options_2;\n if (!isAction(mthd)) {\n mthd = _createAction(mthd);\n }\n if ((_this$options_2 = this.options_) != null && _this$options_2.bound) {\n addInitializer(function () {\n var self = this;\n var bound = self[name].bind(self);\n bound.isMobxAction = true;\n self[name] = bound;\n });\n }\n return mthd;\n }\n die(\"Cannot apply '\" + ann.annotationType_ + \"' to '\" + String(name) + \"' (kind: \" + kind + \"):\" + (\"\\n'\" + ann.annotationType_ + \"' can only be used on properties with a function value.\"));\n}\nfunction assertActionDescriptor(adm, _ref, key, _ref2) {\n var annotationType_ = _ref.annotationType_;\n var value = _ref2.value;\n if ( true && !isFunction(value)) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' can only be used on properties with a function value.\"));\n }\n}\nfunction createActionDescriptor(adm, annotation, key, descriptor,\n// provides ability to disable safeDescriptors for prototypes\nsafeDescriptors) {\n var _annotation$options_, _annotation$options_$, _annotation$options_2, _annotation$options_$2, _annotation$options_3, _annotation$options_4, _adm$proxy_2;\n if (safeDescriptors === void 0) {\n safeDescriptors = globalState.safeDescriptors;\n }\n assertActionDescriptor(adm, annotation, key, descriptor);\n var value = descriptor.value;\n if ((_annotation$options_ = annotation.options_) != null && _annotation$options_.bound) {\n var _adm$proxy_;\n value = value.bind((_adm$proxy_ = adm.proxy_) != null ? _adm$proxy_ : adm.target_);\n }\n return {\n value: createAction((_annotation$options_$ = (_annotation$options_2 = annotation.options_) == null ? void 0 : _annotation$options_2.name) != null ? _annotation$options_$ : key.toString(), value, (_annotation$options_$2 = (_annotation$options_3 = annotation.options_) == null ? void 0 : _annotation$options_3.autoAction) != null ? _annotation$options_$2 : false,\n // https://github.com/mobxjs/mobx/discussions/3140\n (_annotation$options_4 = annotation.options_) != null && _annotation$options_4.bound ? (_adm$proxy_2 = adm.proxy_) != null ? _adm$proxy_2 : adm.target_ : undefined),\n // Non-configurable for classes\n // prevents accidental field redefinition in subclass\n configurable: safeDescriptors ? adm.isPlainObject_ : true,\n // https://github.com/mobxjs/mobx/pull/2641#issuecomment-737292058\n enumerable: false,\n // Non-obsevable, therefore non-writable\n // Also prevents rewriting in subclass constructor\n writable: safeDescriptors ? false : true\n };\n}\n\nfunction createFlowAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$2,\n extend_: extend_$2,\n decorate_20223_: decorate_20223_$2\n };\n}\nfunction make_$2(adm, key, descriptor, source) {\n var _this$options_;\n // own\n if (source === adm.target_) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 2 /* MakeResult.Continue */;\n }\n // prototype\n // bound - must annotate protos to support super.flow()\n if ((_this$options_ = this.options_) != null && _this$options_.bound && (!hasProp(adm.target_, key) || !isFlow(adm.target_[key]))) {\n if (this.extend_(adm, key, descriptor, false) === null) {\n return 0 /* MakeResult.Cancel */;\n }\n }\n if (isFlow(descriptor.value)) {\n // A prototype could have been annotated already by other constructor,\n // rest of the proto chain must be annotated already\n return 1 /* MakeResult.Break */;\n }\n var flowDescriptor = createFlowDescriptor(adm, this, key, descriptor, false, false);\n defineProperty(source, key, flowDescriptor);\n return 2 /* MakeResult.Continue */;\n}\nfunction extend_$2(adm, key, descriptor, proxyTrap) {\n var _this$options_2;\n var flowDescriptor = createFlowDescriptor(adm, this, key, descriptor, (_this$options_2 = this.options_) == null ? void 0 : _this$options_2.bound);\n return adm.defineProperty_(key, flowDescriptor, proxyTrap);\n}\nfunction decorate_20223_$2(mthd, context) {\n var _this$options_3;\n if (true) {\n assert20223DecoratorType(context, [\"method\"]);\n }\n var name = context.name,\n addInitializer = context.addInitializer;\n if (!isFlow(mthd)) {\n mthd = flow(mthd);\n }\n if ((_this$options_3 = this.options_) != null && _this$options_3.bound) {\n addInitializer(function () {\n var self = this;\n var bound = self[name].bind(self);\n bound.isMobXFlow = true;\n self[name] = bound;\n });\n }\n return mthd;\n}\nfunction assertFlowDescriptor(adm, _ref, key, _ref2) {\n var annotationType_ = _ref.annotationType_;\n var value = _ref2.value;\n if ( true && !isFunction(value)) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' can only be used on properties with a generator function value.\"));\n }\n}\nfunction createFlowDescriptor(adm, annotation, key, descriptor, bound,\n// provides ability to disable safeDescriptors for prototypes\nsafeDescriptors) {\n if (safeDescriptors === void 0) {\n safeDescriptors = globalState.safeDescriptors;\n }\n assertFlowDescriptor(adm, annotation, key, descriptor);\n var value = descriptor.value;\n // In case of flow.bound, the descriptor can be from already annotated prototype\n if (!isFlow(value)) {\n value = flow(value);\n }\n if (bound) {\n var _adm$proxy_;\n // We do not keep original function around, so we bind the existing flow\n value = value.bind((_adm$proxy_ = adm.proxy_) != null ? _adm$proxy_ : adm.target_);\n // This is normally set by `flow`, but `bind` returns new function...\n value.isMobXFlow = true;\n }\n return {\n value: value,\n // Non-configurable for classes\n // prevents accidental field redefinition in subclass\n configurable: safeDescriptors ? adm.isPlainObject_ : true,\n // https://github.com/mobxjs/mobx/pull/2641#issuecomment-737292058\n enumerable: false,\n // Non-obsevable, therefore non-writable\n // Also prevents rewriting in subclass constructor\n writable: safeDescriptors ? false : true\n };\n}\n\nfunction createComputedAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$3,\n extend_: extend_$3,\n decorate_20223_: decorate_20223_$3\n };\n}\nfunction make_$3(adm, key, descriptor) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;\n}\nfunction extend_$3(adm, key, descriptor, proxyTrap) {\n assertComputedDescriptor(adm, this, key, descriptor);\n return adm.defineComputedProperty_(key, _extends({}, this.options_, {\n get: descriptor.get,\n set: descriptor.set\n }), proxyTrap);\n}\nfunction decorate_20223_$3(get, context) {\n if (true) {\n assert20223DecoratorType(context, [\"getter\"]);\n }\n var ann = this;\n var key = context.name,\n addInitializer = context.addInitializer;\n addInitializer(function () {\n var adm = asObservableObject(this)[$mobx];\n var options = _extends({}, ann.options_, {\n get: get,\n context: this\n });\n options.name || (options.name = true ? adm.name_ + \".\" + key.toString() : 0);\n adm.values_.set(key, new ComputedValue(options));\n });\n return function () {\n return this[$mobx].getObservablePropValue_(key);\n };\n}\nfunction assertComputedDescriptor(adm, _ref, key, _ref2) {\n var annotationType_ = _ref.annotationType_;\n var get = _ref2.get;\n if ( true && !get) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' can only be used on getter(+setter) properties.\"));\n }\n}\n\nfunction createObservableAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$4,\n extend_: extend_$4,\n decorate_20223_: decorate_20223_$4\n };\n}\nfunction make_$4(adm, key, descriptor) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;\n}\nfunction extend_$4(adm, key, descriptor, proxyTrap) {\n var _this$options_$enhanc, _this$options_;\n assertObservableDescriptor(adm, this, key, descriptor);\n return adm.defineObservableProperty_(key, descriptor.value, (_this$options_$enhanc = (_this$options_ = this.options_) == null ? void 0 : _this$options_.enhancer) != null ? _this$options_$enhanc : deepEnhancer, proxyTrap);\n}\nfunction decorate_20223_$4(desc, context) {\n if (true) {\n if (context.kind === \"field\") {\n throw die(\"Please use `@observable accessor \" + String(context.name) + \"` instead of `@observable \" + String(context.name) + \"`\");\n }\n assert20223DecoratorType(context, [\"accessor\"]);\n }\n var ann = this;\n var kind = context.kind,\n name = context.name;\n // The laziness here is not ideal... It's a workaround to how 2022.3 Decorators are implemented:\n // `addInitializer` callbacks are executed _before_ any accessors are defined (instead of the ideal-for-us right after each).\n // This means that, if we were to do our stuff in an `addInitializer`, we'd attempt to read a private slot\n // before it has been initialized. The runtime doesn't like that and throws a `Cannot read private member\n // from an object whose class did not declare it` error.\n // TODO: it seems that this will not be required anymore in the final version of the spec\n // See TODO: link\n var initializedObjects = new WeakSet();\n function initializeObservable(target, value) {\n var _ann$options_$enhance, _ann$options_;\n var adm = asObservableObject(target)[$mobx];\n var observable = new ObservableValue(value, (_ann$options_$enhance = (_ann$options_ = ann.options_) == null ? void 0 : _ann$options_.enhancer) != null ? _ann$options_$enhance : deepEnhancer, true ? adm.name_ + \".\" + name.toString() : 0, false);\n adm.values_.set(name, observable);\n initializedObjects.add(target);\n }\n if (kind == \"accessor\") {\n return {\n get: function get() {\n if (!initializedObjects.has(this)) {\n initializeObservable(this, desc.get.call(this));\n }\n return this[$mobx].getObservablePropValue_(name);\n },\n set: function set(value) {\n if (!initializedObjects.has(this)) {\n initializeObservable(this, value);\n }\n return this[$mobx].setObservablePropValue_(name, value);\n },\n init: function init(value) {\n if (!initializedObjects.has(this)) {\n initializeObservable(this, value);\n }\n return value;\n }\n };\n }\n return;\n}\nfunction assertObservableDescriptor(adm, _ref, key, descriptor) {\n var annotationType_ = _ref.annotationType_;\n if ( true && !(\"value\" in descriptor)) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' cannot be used on getter/setter properties\"));\n }\n}\n\nvar AUTO = \"true\";\nvar autoAnnotation = /*#__PURE__*/createAutoAnnotation();\nfunction createAutoAnnotation(options) {\n return {\n annotationType_: AUTO,\n options_: options,\n make_: make_$5,\n extend_: extend_$5,\n decorate_20223_: decorate_20223_$5\n };\n}\nfunction make_$5(adm, key, descriptor, source) {\n var _this$options_3, _this$options_4;\n // getter -> computed\n if (descriptor.get) {\n return computed.make_(adm, key, descriptor, source);\n }\n // lone setter -> action setter\n if (descriptor.set) {\n // TODO make action applicable to setter and delegate to action.make_\n var set = createAction(key.toString(), descriptor.set);\n // own\n if (source === adm.target_) {\n return adm.defineProperty_(key, {\n configurable: globalState.safeDescriptors ? adm.isPlainObject_ : true,\n set: set\n }) === null ? 0 /* MakeResult.Cancel */ : 2 /* MakeResult.Continue */;\n }\n // proto\n defineProperty(source, key, {\n configurable: true,\n set: set\n });\n return 2 /* MakeResult.Continue */;\n }\n // function on proto -> autoAction/flow\n if (source !== adm.target_ && typeof descriptor.value === \"function\") {\n var _this$options_2;\n if (isGenerator(descriptor.value)) {\n var _this$options_;\n var flowAnnotation = (_this$options_ = this.options_) != null && _this$options_.autoBind ? flow.bound : flow;\n return flowAnnotation.make_(adm, key, descriptor, source);\n }\n var actionAnnotation = (_this$options_2 = this.options_) != null && _this$options_2.autoBind ? autoAction.bound : autoAction;\n return actionAnnotation.make_(adm, key, descriptor, source);\n }\n // other -> observable\n // Copy props from proto as well, see test:\n // \"decorate should work with Object.create\"\n var observableAnnotation = ((_this$options_3 = this.options_) == null ? void 0 : _this$options_3.deep) === false ? observable.ref : observable;\n // if function respect autoBind option\n if (typeof descriptor.value === \"function\" && (_this$options_4 = this.options_) != null && _this$options_4.autoBind) {\n var _adm$proxy_;\n descriptor.value = descriptor.value.bind((_adm$proxy_ = adm.proxy_) != null ? _adm$proxy_ : adm.target_);\n }\n return observableAnnotation.make_(adm, key, descriptor, source);\n}\nfunction extend_$5(adm, key, descriptor, proxyTrap) {\n var _this$options_5, _this$options_6;\n // getter -> computed\n if (descriptor.get) {\n return computed.extend_(adm, key, descriptor, proxyTrap);\n }\n // lone setter -> action setter\n if (descriptor.set) {\n // TODO make action applicable to setter and delegate to action.extend_\n return adm.defineProperty_(key, {\n configurable: globalState.safeDescriptors ? adm.isPlainObject_ : true,\n set: createAction(key.toString(), descriptor.set)\n }, proxyTrap);\n }\n // other -> observable\n // if function respect autoBind option\n if (typeof descriptor.value === \"function\" && (_this$options_5 = this.options_) != null && _this$options_5.autoBind) {\n var _adm$proxy_2;\n descriptor.value = descriptor.value.bind((_adm$proxy_2 = adm.proxy_) != null ? _adm$proxy_2 : adm.target_);\n }\n var observableAnnotation = ((_this$options_6 = this.options_) == null ? void 0 : _this$options_6.deep) === false ? observable.ref : observable;\n return observableAnnotation.extend_(adm, key, descriptor, proxyTrap);\n}\nfunction decorate_20223_$5(desc, context) {\n die(\"'\" + this.annotationType_ + \"' cannot be used as a decorator\");\n}\n\nvar OBSERVABLE = \"observable\";\nvar OBSERVABLE_REF = \"observable.ref\";\nvar OBSERVABLE_SHALLOW = \"observable.shallow\";\nvar OBSERVABLE_STRUCT = \"observable.struct\";\n// Predefined bags of create observable options, to avoid allocating temporarily option objects\n// in the majority of cases\nvar defaultCreateObservableOptions = {\n deep: true,\n name: undefined,\n defaultDecorator: undefined,\n proxy: true\n};\nObject.freeze(defaultCreateObservableOptions);\nfunction asCreateObservableOptions(thing) {\n return thing || defaultCreateObservableOptions;\n}\nvar observableAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE);\nvar observableRefAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE_REF, {\n enhancer: referenceEnhancer\n});\nvar observableShallowAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE_SHALLOW, {\n enhancer: shallowEnhancer\n});\nvar observableStructAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE_STRUCT, {\n enhancer: refStructEnhancer\n});\nvar observableDecoratorAnnotation = /*#__PURE__*/createDecoratorAnnotation(observableAnnotation);\nfunction getEnhancerFromOptions(options) {\n return options.deep === true ? deepEnhancer : options.deep === false ? referenceEnhancer : getEnhancerFromAnnotation(options.defaultDecorator);\n}\nfunction getAnnotationFromOptions(options) {\n var _options$defaultDecor;\n return options ? (_options$defaultDecor = options.defaultDecorator) != null ? _options$defaultDecor : createAutoAnnotation(options) : undefined;\n}\nfunction getEnhancerFromAnnotation(annotation) {\n var _annotation$options_$, _annotation$options_;\n return !annotation ? deepEnhancer : (_annotation$options_$ = (_annotation$options_ = annotation.options_) == null ? void 0 : _annotation$options_.enhancer) != null ? _annotation$options_$ : deepEnhancer;\n}\n/**\n * Turns an object, array or function into a reactive structure.\n * @param v the value which should become observable.\n */\nfunction createObservable(v, arg2, arg3) {\n // @observable someProp; (2022.3 Decorators)\n if (is20223Decorator(arg2)) {\n return observableAnnotation.decorate_20223_(v, arg2);\n }\n // @observable someProp;\n if (isStringish(arg2)) {\n storeAnnotation(v, arg2, observableAnnotation);\n return;\n }\n // already observable - ignore\n if (isObservable(v)) {\n return v;\n }\n // plain object\n if (isPlainObject(v)) {\n return observable.object(v, arg2, arg3);\n }\n // Array\n if (Array.isArray(v)) {\n return observable.array(v, arg2);\n }\n // Map\n if (isES6Map(v)) {\n return observable.map(v, arg2);\n }\n // Set\n if (isES6Set(v)) {\n return observable.set(v, arg2);\n }\n // other object - ignore\n if (typeof v === \"object\" && v !== null) {\n return v;\n }\n // anything else\n return observable.box(v, arg2);\n}\nassign(createObservable, observableDecoratorAnnotation);\nvar observableFactories = {\n box: function box(value, options) {\n var o = asCreateObservableOptions(options);\n return new ObservableValue(value, getEnhancerFromOptions(o), o.name, true, o.equals);\n },\n array: function array(initialValues, options) {\n var o = asCreateObservableOptions(options);\n return (globalState.useProxies === false || o.proxy === false ? createLegacyArray : createObservableArray)(initialValues, getEnhancerFromOptions(o), o.name);\n },\n map: function map(initialValues, options) {\n var o = asCreateObservableOptions(options);\n return new ObservableMap(initialValues, getEnhancerFromOptions(o), o.name);\n },\n set: function set(initialValues, options) {\n var o = asCreateObservableOptions(options);\n return new ObservableSet(initialValues, getEnhancerFromOptions(o), o.name);\n },\n object: function object(props, decorators, options) {\n return initObservable(function () {\n return extendObservable(globalState.useProxies === false || (options == null ? void 0 : options.proxy) === false ? asObservableObject({}, options) : asDynamicObservableObject({}, options), props, decorators);\n });\n },\n ref: /*#__PURE__*/createDecoratorAnnotation(observableRefAnnotation),\n shallow: /*#__PURE__*/createDecoratorAnnotation(observableShallowAnnotation),\n deep: observableDecoratorAnnotation,\n struct: /*#__PURE__*/createDecoratorAnnotation(observableStructAnnotation)\n};\n// eslint-disable-next-line\nvar observable = /*#__PURE__*/assign(createObservable, observableFactories);\n\nvar COMPUTED = \"computed\";\nvar COMPUTED_STRUCT = \"computed.struct\";\nvar computedAnnotation = /*#__PURE__*/createComputedAnnotation(COMPUTED);\nvar computedStructAnnotation = /*#__PURE__*/createComputedAnnotation(COMPUTED_STRUCT, {\n equals: comparer.structural\n});\n/**\n * Decorator for class properties: @computed get value() { return expr; }.\n * For legacy purposes also invokable as ES5 observable created: `computed(() => expr)`;\n */\nvar computed = function computed(arg1, arg2) {\n if (is20223Decorator(arg2)) {\n // @computed (2022.3 Decorators)\n return computedAnnotation.decorate_20223_(arg1, arg2);\n }\n if (isStringish(arg2)) {\n // @computed\n return storeAnnotation(arg1, arg2, computedAnnotation);\n }\n if (isPlainObject(arg1)) {\n // @computed({ options })\n return createDecoratorAnnotation(createComputedAnnotation(COMPUTED, arg1));\n }\n // computed(expr, options?)\n if (true) {\n if (!isFunction(arg1)) {\n die(\"First argument to `computed` should be an expression.\");\n }\n if (isFunction(arg2)) {\n die(\"A setter as second argument is no longer supported, use `{ set: fn }` option instead\");\n }\n }\n var opts = isPlainObject(arg2) ? arg2 : {};\n opts.get = arg1;\n opts.name || (opts.name = arg1.name || \"\"); /* for generated name */\n return new ComputedValue(opts);\n};\nObject.assign(computed, computedAnnotation);\ncomputed.struct = /*#__PURE__*/createDecoratorAnnotation(computedStructAnnotation);\n\nvar _getDescriptor$config, _getDescriptor;\n// we don't use globalState for these in order to avoid possible issues with multiple\n// mobx versions\nvar currentActionId = 0;\nvar nextActionId = 1;\nvar isFunctionNameConfigurable = (_getDescriptor$config = (_getDescriptor = /*#__PURE__*/getDescriptor(function () {}, \"name\")) == null ? void 0 : _getDescriptor.configurable) != null ? _getDescriptor$config : false;\n// we can safely recycle this object\nvar tmpNameDescriptor = {\n value: \"action\",\n configurable: true,\n writable: false,\n enumerable: false\n};\nfunction createAction(actionName, fn, autoAction, ref) {\n if (autoAction === void 0) {\n autoAction = false;\n }\n if (true) {\n if (!isFunction(fn)) {\n die(\"`action` can only be invoked on functions\");\n }\n if (typeof actionName !== \"string\" || !actionName) {\n die(\"actions should have valid names, got: '\" + actionName + \"'\");\n }\n }\n function res() {\n return executeAction(actionName, autoAction, fn, ref || this, arguments);\n }\n res.isMobxAction = true;\n res.toString = function () {\n return fn.toString();\n };\n if (isFunctionNameConfigurable) {\n tmpNameDescriptor.value = actionName;\n defineProperty(res, \"name\", tmpNameDescriptor);\n }\n return res;\n}\nfunction executeAction(actionName, canRunAsDerivation, fn, scope, args) {\n var runInfo = _startAction(actionName, canRunAsDerivation, scope, args);\n try {\n return fn.apply(scope, args);\n } catch (err) {\n runInfo.error_ = err;\n throw err;\n } finally {\n _endAction(runInfo);\n }\n}\nfunction _startAction(actionName, canRunAsDerivation,\n// true for autoAction\nscope, args) {\n var notifySpy_ = true && isSpyEnabled() && !!actionName;\n var startTime_ = 0;\n if ( true && notifySpy_) {\n startTime_ = Date.now();\n var flattenedArgs = args ? Array.from(args) : EMPTY_ARRAY;\n spyReportStart({\n type: ACTION,\n name: actionName,\n object: scope,\n arguments: flattenedArgs\n });\n }\n var prevDerivation_ = globalState.trackingDerivation;\n var runAsAction = !canRunAsDerivation || !prevDerivation_;\n startBatch();\n var prevAllowStateChanges_ = globalState.allowStateChanges; // by default preserve previous allow\n if (runAsAction) {\n untrackedStart();\n prevAllowStateChanges_ = allowStateChangesStart(true);\n }\n var prevAllowStateReads_ = allowStateReadsStart(true);\n var runInfo = {\n runAsAction_: runAsAction,\n prevDerivation_: prevDerivation_,\n prevAllowStateChanges_: prevAllowStateChanges_,\n prevAllowStateReads_: prevAllowStateReads_,\n notifySpy_: notifySpy_,\n startTime_: startTime_,\n actionId_: nextActionId++,\n parentActionId_: currentActionId\n };\n currentActionId = runInfo.actionId_;\n return runInfo;\n}\nfunction _endAction(runInfo) {\n if (currentActionId !== runInfo.actionId_) {\n die(30);\n }\n currentActionId = runInfo.parentActionId_;\n if (runInfo.error_ !== undefined) {\n globalState.suppressReactionErrors = true;\n }\n allowStateChangesEnd(runInfo.prevAllowStateChanges_);\n allowStateReadsEnd(runInfo.prevAllowStateReads_);\n endBatch();\n if (runInfo.runAsAction_) {\n untrackedEnd(runInfo.prevDerivation_);\n }\n if ( true && runInfo.notifySpy_) {\n spyReportEnd({\n time: Date.now() - runInfo.startTime_\n });\n }\n globalState.suppressReactionErrors = false;\n}\nfunction allowStateChanges(allowStateChanges, func) {\n var prev = allowStateChangesStart(allowStateChanges);\n try {\n return func();\n } finally {\n allowStateChangesEnd(prev);\n }\n}\nfunction allowStateChangesStart(allowStateChanges) {\n var prev = globalState.allowStateChanges;\n globalState.allowStateChanges = allowStateChanges;\n return prev;\n}\nfunction allowStateChangesEnd(prev) {\n globalState.allowStateChanges = prev;\n}\n\nvar CREATE = \"create\";\nvar ObservableValue = /*#__PURE__*/function (_Atom) {\n function ObservableValue(value, enhancer, name_, notifySpy, equals) {\n var _this;\n if (name_ === void 0) {\n name_ = true ? \"ObservableValue@\" + getNextId() : 0;\n }\n if (notifySpy === void 0) {\n notifySpy = true;\n }\n if (equals === void 0) {\n equals = comparer[\"default\"];\n }\n _this = _Atom.call(this, name_) || this;\n _this.enhancer = void 0;\n _this.name_ = void 0;\n _this.equals = void 0;\n _this.hasUnreportedChange_ = false;\n _this.interceptors_ = void 0;\n _this.changeListeners_ = void 0;\n _this.value_ = void 0;\n _this.dehancer = void 0;\n _this.enhancer = enhancer;\n _this.name_ = name_;\n _this.equals = equals;\n _this.value_ = enhancer(value, undefined, name_);\n if ( true && notifySpy && isSpyEnabled()) {\n // only notify spy if this is a stand-alone observable\n spyReport({\n type: CREATE,\n object: _this,\n observableKind: \"value\",\n debugObjectName: _this.name_,\n newValue: \"\" + _this.value_\n });\n }\n return _this;\n }\n _inheritsLoose(ObservableValue, _Atom);\n var _proto = ObservableValue.prototype;\n _proto.dehanceValue = function dehanceValue(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.set = function set(newValue) {\n var oldValue = this.value_;\n newValue = this.prepareNewValue_(newValue);\n if (newValue !== globalState.UNCHANGED) {\n var notifySpy = isSpyEnabled();\n if ( true && notifySpy) {\n spyReportStart({\n type: UPDATE,\n object: this,\n observableKind: \"value\",\n debugObjectName: this.name_,\n newValue: newValue,\n oldValue: oldValue\n });\n }\n this.setNewValue_(newValue);\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n };\n _proto.prepareNewValue_ = function prepareNewValue_(newValue) {\n checkIfStateModificationsAreAllowed(this);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this,\n type: UPDATE,\n newValue: newValue\n });\n if (!change) {\n return globalState.UNCHANGED;\n }\n newValue = change.newValue;\n }\n // apply modifier\n newValue = this.enhancer(newValue, this.value_, this.name_);\n return this.equals(this.value_, newValue) ? globalState.UNCHANGED : newValue;\n };\n _proto.setNewValue_ = function setNewValue_(newValue) {\n var oldValue = this.value_;\n this.value_ = newValue;\n this.reportChanged();\n if (hasListeners(this)) {\n notifyListeners(this, {\n type: UPDATE,\n object: this,\n newValue: newValue,\n oldValue: oldValue\n });\n }\n };\n _proto.get = function get() {\n this.reportObserved();\n return this.dehanceValue(this.value_);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n if (fireImmediately) {\n listener({\n observableKind: \"value\",\n debugObjectName: this.name_,\n object: this,\n type: UPDATE,\n newValue: this.value_,\n oldValue: undefined\n });\n }\n return registerListener(this, listener);\n };\n _proto.raw = function raw() {\n // used by MST ot get undehanced value\n return this.value_;\n };\n _proto.toJSON = function toJSON() {\n return this.get();\n };\n _proto.toString = function toString() {\n return this.name_ + \"[\" + this.value_ + \"]\";\n };\n _proto.valueOf = function valueOf() {\n return toPrimitive(this.get());\n };\n _proto[Symbol.toPrimitive] = function () {\n return this.valueOf();\n };\n return ObservableValue;\n}(Atom);\nvar isObservableValue = /*#__PURE__*/createInstanceofPredicate(\"ObservableValue\", ObservableValue);\n\n/**\n * A node in the state dependency root that observes other nodes, and can be observed itself.\n *\n * ComputedValue will remember the result of the computation for the duration of the batch, or\n * while being observed.\n *\n * During this time it will recompute only when one of its direct dependencies changed,\n * but only when it is being accessed with `ComputedValue.get()`.\n *\n * Implementation description:\n * 1. First time it's being accessed it will compute and remember result\n * give back remembered result until 2. happens\n * 2. First time any deep dependency change, propagate POSSIBLY_STALE to all observers, wait for 3.\n * 3. When it's being accessed, recompute if any shallow dependency changed.\n * if result changed: propagate STALE to all observers, that were POSSIBLY_STALE from the last step.\n * go to step 2. either way\n *\n * If at any point it's outside batch and it isn't observed: reset everything and go to 1.\n */\nvar ComputedValue = /*#__PURE__*/function () {\n /**\n * Create a new computed value based on a function expression.\n *\n * The `name` property is for debug purposes only.\n *\n * The `equals` property specifies the comparer function to use to determine if a newly produced\n * value differs from the previous value. Two comparers are provided in the library; `defaultComparer`\n * compares based on identity comparison (===), and `structuralComparer` deeply compares the structure.\n * Structural comparison can be convenient if you always produce a new aggregated object and\n * don't want to notify observers if it is structurally the same.\n * This is useful for working with vectors, mouse coordinates etc.\n */\n function ComputedValue(options) {\n this.dependenciesState_ = IDerivationState_.NOT_TRACKING_;\n this.observing_ = [];\n // nodes we are looking at. Our value depends on these nodes\n this.newObserving_ = null;\n // during tracking it's an array with new observed observers\n this.observers_ = new Set();\n this.runId_ = 0;\n this.lastAccessedBy_ = 0;\n this.lowestObserverState_ = IDerivationState_.UP_TO_DATE_;\n this.unboundDepsCount_ = 0;\n this.value_ = new CaughtException(null);\n this.name_ = void 0;\n this.triggeredBy_ = void 0;\n this.flags_ = 0;\n this.derivation = void 0;\n // N.B: unminified as it is used by MST\n this.setter_ = void 0;\n this.isTracing_ = TraceMode.NONE;\n this.scope_ = void 0;\n this.equals_ = void 0;\n this.requiresReaction_ = void 0;\n this.keepAlive_ = void 0;\n this.onBOL = void 0;\n this.onBUOL = void 0;\n if (!options.get) {\n die(31);\n }\n this.derivation = options.get;\n this.name_ = options.name || ( true ? \"ComputedValue@\" + getNextId() : 0);\n if (options.set) {\n this.setter_ = createAction( true ? this.name_ + \"-setter\" : 0, options.set);\n }\n this.equals_ = options.equals || (options.compareStructural || options.struct ? comparer.structural : comparer[\"default\"]);\n this.scope_ = options.context;\n this.requiresReaction_ = options.requiresReaction;\n this.keepAlive_ = !!options.keepAlive;\n }\n var _proto = ComputedValue.prototype;\n _proto.onBecomeStale_ = function onBecomeStale_() {\n propagateMaybeChanged(this);\n };\n _proto.onBO = function onBO() {\n if (this.onBOL) {\n this.onBOL.forEach(function (listener) {\n return listener();\n });\n }\n };\n _proto.onBUO = function onBUO() {\n if (this.onBUOL) {\n this.onBUOL.forEach(function (listener) {\n return listener();\n });\n }\n }\n // to check for cycles\n ;\n /**\n * Returns the current value of this computed value.\n * Will evaluate its computation first if needed.\n */\n _proto.get = function get() {\n if (this.isComputing) {\n die(32, this.name_, this.derivation);\n }\n if (globalState.inBatch === 0 &&\n // !globalState.trackingDerivatpion &&\n this.observers_.size === 0 && !this.keepAlive_) {\n if (shouldCompute(this)) {\n this.warnAboutUntrackedRead_();\n startBatch(); // See perf test 'computed memoization'\n this.value_ = this.computeValue_(false);\n endBatch();\n }\n } else {\n reportObserved(this);\n if (shouldCompute(this)) {\n var prevTrackingContext = globalState.trackingContext;\n if (this.keepAlive_ && !prevTrackingContext) {\n globalState.trackingContext = this;\n }\n if (this.trackAndCompute()) {\n propagateChangeConfirmed(this);\n }\n globalState.trackingContext = prevTrackingContext;\n }\n }\n var result = this.value_;\n if (isCaughtException(result)) {\n throw result.cause;\n }\n return result;\n };\n _proto.set = function set(value) {\n if (this.setter_) {\n if (this.isRunningSetter) {\n die(33, this.name_);\n }\n this.isRunningSetter = true;\n try {\n this.setter_.call(this.scope_, value);\n } finally {\n this.isRunningSetter = false;\n }\n } else {\n die(34, this.name_);\n }\n };\n _proto.trackAndCompute = function trackAndCompute() {\n // N.B: unminified as it is used by MST\n var oldValue = this.value_;\n var wasSuspended = /* see #1208 */this.dependenciesState_ === IDerivationState_.NOT_TRACKING_;\n var newValue = this.computeValue_(true);\n var changed = wasSuspended || isCaughtException(oldValue) || isCaughtException(newValue) || !this.equals_(oldValue, newValue);\n if (changed) {\n this.value_ = newValue;\n if ( true && isSpyEnabled()) {\n spyReport({\n observableKind: \"computed\",\n debugObjectName: this.name_,\n object: this.scope_,\n type: \"update\",\n oldValue: oldValue,\n newValue: newValue\n });\n }\n }\n return changed;\n };\n _proto.computeValue_ = function computeValue_(track) {\n this.isComputing = true;\n // don't allow state changes during computation\n var prev = allowStateChangesStart(false);\n var res;\n if (track) {\n res = trackDerivedFunction(this, this.derivation, this.scope_);\n } else {\n if (globalState.disableErrorBoundaries === true) {\n res = this.derivation.call(this.scope_);\n } else {\n try {\n res = this.derivation.call(this.scope_);\n } catch (e) {\n res = new CaughtException(e);\n }\n }\n }\n allowStateChangesEnd(prev);\n this.isComputing = false;\n return res;\n };\n _proto.suspend_ = function suspend_() {\n if (!this.keepAlive_) {\n clearObserving(this);\n this.value_ = undefined; // don't hold on to computed value!\n if ( true && this.isTracing_ !== TraceMode.NONE) {\n console.log(\"[mobx.trace] Computed value '\" + this.name_ + \"' was suspended and it will recompute on the next access.\");\n }\n }\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n var _this = this;\n var firstTime = true;\n var prevValue = undefined;\n return autorun(function () {\n // TODO: why is this in a different place than the spyReport() function? in all other observables it's called in the same place\n var newValue = _this.get();\n if (!firstTime || fireImmediately) {\n var prevU = untrackedStart();\n listener({\n observableKind: \"computed\",\n debugObjectName: _this.name_,\n type: UPDATE,\n object: _this,\n newValue: newValue,\n oldValue: prevValue\n });\n untrackedEnd(prevU);\n }\n firstTime = false;\n prevValue = newValue;\n });\n };\n _proto.warnAboutUntrackedRead_ = function warnAboutUntrackedRead_() {\n if (false) {}\n if (this.isTracing_ !== TraceMode.NONE) {\n console.log(\"[mobx.trace] Computed value '\" + this.name_ + \"' is being read outside a reactive context. Doing a full recompute.\");\n }\n if (typeof this.requiresReaction_ === \"boolean\" ? this.requiresReaction_ : globalState.computedRequiresReaction) {\n console.warn(\"[mobx] Computed value '\" + this.name_ + \"' is being read outside a reactive context. Doing a full recompute.\");\n }\n };\n _proto.toString = function toString() {\n return this.name_ + \"[\" + this.derivation.toString() + \"]\";\n };\n _proto.valueOf = function valueOf() {\n return toPrimitive(this.get());\n };\n _proto[Symbol.toPrimitive] = function () {\n return this.valueOf();\n };\n return _createClass(ComputedValue, [{\n key: \"isComputing\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isComputingMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isComputingMask_, newValue);\n }\n }, {\n key: \"isRunningSetter\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isRunningSetterMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isRunningSetterMask_, newValue);\n }\n }, {\n key: \"isBeingObserved\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isBeingObservedMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isBeingObservedMask_, newValue);\n }\n }, {\n key: \"isPendingUnobservation\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isPendingUnobservationMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isPendingUnobservationMask_, newValue);\n }\n }, {\n key: \"diffValue\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.diffValueMask_) ? 1 : 0;\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.diffValueMask_, newValue === 1 ? true : false);\n }\n }]);\n}();\nComputedValue.isComputingMask_ = 1;\nComputedValue.isRunningSetterMask_ = 2;\nComputedValue.isBeingObservedMask_ = 4;\nComputedValue.isPendingUnobservationMask_ = 8;\nComputedValue.diffValueMask_ = 16;\nvar isComputedValue = /*#__PURE__*/createInstanceofPredicate(\"ComputedValue\", ComputedValue);\n\nvar IDerivationState_;\n(function (IDerivationState_) {\n // before being run or (outside batch and not being observed)\n // at this point derivation is not holding any data about dependency tree\n IDerivationState_[IDerivationState_[\"NOT_TRACKING_\"] = -1] = \"NOT_TRACKING_\";\n // no shallow dependency changed since last computation\n // won't recalculate derivation\n // this is what makes mobx fast\n IDerivationState_[IDerivationState_[\"UP_TO_DATE_\"] = 0] = \"UP_TO_DATE_\";\n // some deep dependency changed, but don't know if shallow dependency changed\n // will require to check first if UP_TO_DATE or POSSIBLY_STALE\n // currently only ComputedValue will propagate POSSIBLY_STALE\n //\n // having this state is second big optimization:\n // don't have to recompute on every dependency change, but only when it's needed\n IDerivationState_[IDerivationState_[\"POSSIBLY_STALE_\"] = 1] = \"POSSIBLY_STALE_\";\n // A shallow dependency has changed since last computation and the derivation\n // will need to recompute when it's needed next.\n IDerivationState_[IDerivationState_[\"STALE_\"] = 2] = \"STALE_\";\n})(IDerivationState_ || (IDerivationState_ = {}));\nvar TraceMode;\n(function (TraceMode) {\n TraceMode[TraceMode[\"NONE\"] = 0] = \"NONE\";\n TraceMode[TraceMode[\"LOG\"] = 1] = \"LOG\";\n TraceMode[TraceMode[\"BREAK\"] = 2] = \"BREAK\";\n})(TraceMode || (TraceMode = {}));\nvar CaughtException = function CaughtException(cause) {\n this.cause = void 0;\n this.cause = cause;\n // Empty\n};\nfunction isCaughtException(e) {\n return e instanceof CaughtException;\n}\n/**\n * Finds out whether any dependency of the derivation has actually changed.\n * If dependenciesState is 1 then it will recalculate dependencies,\n * if any dependency changed it will propagate it by changing dependenciesState to 2.\n *\n * By iterating over the dependencies in the same order that they were reported and\n * stopping on the first change, all the recalculations are only called for ComputedValues\n * that will be tracked by derivation. That is because we assume that if the first x\n * dependencies of the derivation doesn't change then the derivation should run the same way\n * up until accessing x-th dependency.\n */\nfunction shouldCompute(derivation) {\n switch (derivation.dependenciesState_) {\n case IDerivationState_.UP_TO_DATE_:\n return false;\n case IDerivationState_.NOT_TRACKING_:\n case IDerivationState_.STALE_:\n return true;\n case IDerivationState_.POSSIBLY_STALE_:\n {\n // state propagation can occur outside of action/reactive context #2195\n var prevAllowStateReads = allowStateReadsStart(true);\n var prevUntracked = untrackedStart(); // no need for those computeds to be reported, they will be picked up in trackDerivedFunction.\n var obs = derivation.observing_,\n l = obs.length;\n for (var i = 0; i < l; i++) {\n var obj = obs[i];\n if (isComputedValue(obj)) {\n if (globalState.disableErrorBoundaries) {\n obj.get();\n } else {\n try {\n obj.get();\n } catch (e) {\n // we are not interested in the value *or* exception at this moment, but if there is one, notify all\n untrackedEnd(prevUntracked);\n allowStateReadsEnd(prevAllowStateReads);\n return true;\n }\n }\n // if ComputedValue `obj` actually changed it will be computed and propagated to its observers.\n // and `derivation` is an observer of `obj`\n // invariantShouldCompute(derivation)\n if (derivation.dependenciesState_ === IDerivationState_.STALE_) {\n untrackedEnd(prevUntracked);\n allowStateReadsEnd(prevAllowStateReads);\n return true;\n }\n }\n }\n changeDependenciesStateTo0(derivation);\n untrackedEnd(prevUntracked);\n allowStateReadsEnd(prevAllowStateReads);\n return false;\n }\n }\n}\nfunction isComputingDerivation() {\n return globalState.trackingDerivation !== null; // filter out actions inside computations\n}\nfunction checkIfStateModificationsAreAllowed(atom) {\n if (false) {}\n var hasObservers = atom.observers_.size > 0;\n // Should not be possible to change observed state outside strict mode, except during initialization, see #563\n if (!globalState.allowStateChanges && (hasObservers || globalState.enforceActions === \"always\")) {\n console.warn(\"[MobX] \" + (globalState.enforceActions ? \"Since strict-mode is enabled, changing (observed) observable values without using an action is not allowed. Tried to modify: \" : \"Side effects like changing state are not allowed at this point. Are you trying to modify state from, for example, a computed value or the render function of a React component? You can wrap side effects in 'runInAction' (or decorate functions with 'action') if needed. Tried to modify: \") + atom.name_);\n }\n}\nfunction checkIfStateReadsAreAllowed(observable) {\n if ( true && !globalState.allowStateReads && globalState.observableRequiresReaction) {\n console.warn(\"[mobx] Observable '\" + observable.name_ + \"' being read outside a reactive context.\");\n }\n}\n/**\n * Executes the provided function `f` and tracks which observables are being accessed.\n * The tracking information is stored on the `derivation` object and the derivation is registered\n * as observer of any of the accessed observables.\n */\nfunction trackDerivedFunction(derivation, f, context) {\n var prevAllowStateReads = allowStateReadsStart(true);\n changeDependenciesStateTo0(derivation);\n // Preallocate array; will be trimmed by bindDependencies.\n derivation.newObserving_ = new Array(\n // Reserve constant space for initial dependencies, dynamic space otherwise.\n // See https://github.com/mobxjs/mobx/pull/3833\n derivation.runId_ === 0 ? 100 : derivation.observing_.length);\n derivation.unboundDepsCount_ = 0;\n derivation.runId_ = ++globalState.runId;\n var prevTracking = globalState.trackingDerivation;\n globalState.trackingDerivation = derivation;\n globalState.inBatch++;\n var result;\n if (globalState.disableErrorBoundaries === true) {\n result = f.call(context);\n } else {\n try {\n result = f.call(context);\n } catch (e) {\n result = new CaughtException(e);\n }\n }\n globalState.inBatch--;\n globalState.trackingDerivation = prevTracking;\n bindDependencies(derivation);\n warnAboutDerivationWithoutDependencies(derivation);\n allowStateReadsEnd(prevAllowStateReads);\n return result;\n}\nfunction warnAboutDerivationWithoutDependencies(derivation) {\n if (false) {}\n if (derivation.observing_.length !== 0) {\n return;\n }\n if (typeof derivation.requiresObservable_ === \"boolean\" ? derivation.requiresObservable_ : globalState.reactionRequiresObservable) {\n console.warn(\"[mobx] Derivation '\" + derivation.name_ + \"' is created/updated without reading any observable value.\");\n }\n}\n/**\n * diffs newObserving with observing.\n * update observing to be newObserving with unique observables\n * notify observers that become observed/unobserved\n */\nfunction bindDependencies(derivation) {\n // invariant(derivation.dependenciesState !== IDerivationState.NOT_TRACKING, \"INTERNAL ERROR bindDependencies expects derivation.dependenciesState !== -1\");\n var prevObserving = derivation.observing_;\n var observing = derivation.observing_ = derivation.newObserving_;\n var lowestNewObservingDerivationState = IDerivationState_.UP_TO_DATE_;\n // Go through all new observables and check diffValue: (this list can contain duplicates):\n // 0: first occurrence, change to 1 and keep it\n // 1: extra occurrence, drop it\n var i0 = 0,\n l = derivation.unboundDepsCount_;\n for (var i = 0; i < l; i++) {\n var dep = observing[i];\n if (dep.diffValue === 0) {\n dep.diffValue = 1;\n if (i0 !== i) {\n observing[i0] = dep;\n }\n i0++;\n }\n // Upcast is 'safe' here, because if dep is IObservable, `dependenciesState` will be undefined,\n // not hitting the condition\n if (dep.dependenciesState_ > lowestNewObservingDerivationState) {\n lowestNewObservingDerivationState = dep.dependenciesState_;\n }\n }\n observing.length = i0;\n derivation.newObserving_ = null; // newObserving shouldn't be needed outside tracking (statement moved down to work around FF bug, see #614)\n // Go through all old observables and check diffValue: (it is unique after last bindDependencies)\n // 0: it's not in new observables, unobserve it\n // 1: it keeps being observed, don't want to notify it. change to 0\n l = prevObserving.length;\n while (l--) {\n var _dep = prevObserving[l];\n if (_dep.diffValue === 0) {\n removeObserver(_dep, derivation);\n }\n _dep.diffValue = 0;\n }\n // Go through all new observables and check diffValue: (now it should be unique)\n // 0: it was set to 0 in last loop. don't need to do anything.\n // 1: it wasn't observed, let's observe it. set back to 0\n while (i0--) {\n var _dep2 = observing[i0];\n if (_dep2.diffValue === 1) {\n _dep2.diffValue = 0;\n addObserver(_dep2, derivation);\n }\n }\n // Some new observed derivations may become stale during this derivation computation\n // so they have had no chance to propagate staleness (#916)\n if (lowestNewObservingDerivationState !== IDerivationState_.UP_TO_DATE_) {\n derivation.dependenciesState_ = lowestNewObservingDerivationState;\n derivation.onBecomeStale_();\n }\n}\nfunction clearObserving(derivation) {\n // invariant(globalState.inBatch > 0, \"INTERNAL ERROR clearObserving should be called only inside batch\");\n var obs = derivation.observing_;\n derivation.observing_ = [];\n var i = obs.length;\n while (i--) {\n removeObserver(obs[i], derivation);\n }\n derivation.dependenciesState_ = IDerivationState_.NOT_TRACKING_;\n}\nfunction untracked(action) {\n var prev = untrackedStart();\n try {\n return action();\n } finally {\n untrackedEnd(prev);\n }\n}\nfunction untrackedStart() {\n var prev = globalState.trackingDerivation;\n globalState.trackingDerivation = null;\n return prev;\n}\nfunction untrackedEnd(prev) {\n globalState.trackingDerivation = prev;\n}\nfunction allowStateReadsStart(allowStateReads) {\n var prev = globalState.allowStateReads;\n globalState.allowStateReads = allowStateReads;\n return prev;\n}\nfunction allowStateReadsEnd(prev) {\n globalState.allowStateReads = prev;\n}\n/**\n * needed to keep `lowestObserverState` correct. when changing from (2 or 1) to 0\n *\n */\nfunction changeDependenciesStateTo0(derivation) {\n if (derivation.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {\n return;\n }\n derivation.dependenciesState_ = IDerivationState_.UP_TO_DATE_;\n var obs = derivation.observing_;\n var i = obs.length;\n while (i--) {\n obs[i].lowestObserverState_ = IDerivationState_.UP_TO_DATE_;\n }\n}\n\n/**\n * These values will persist if global state is reset\n */\nvar persistentKeys = [\"mobxGuid\", \"spyListeners\", \"enforceActions\", \"computedRequiresReaction\", \"reactionRequiresObservable\", \"observableRequiresReaction\", \"allowStateReads\", \"disableErrorBoundaries\", \"runId\", \"UNCHANGED\", \"useProxies\"];\nvar MobXGlobals = function MobXGlobals() {\n /**\n * MobXGlobals version.\n * MobX compatiblity with other versions loaded in memory as long as this version matches.\n * It indicates that the global state still stores similar information\n *\n * N.B: this version is unrelated to the package version of MobX, and is only the version of the\n * internal state storage of MobX, and can be the same across many different package versions\n */\n this.version = 6;\n /**\n * globally unique token to signal unchanged\n */\n this.UNCHANGED = {};\n /**\n * Currently running derivation\n */\n this.trackingDerivation = null;\n /**\n * Currently running reaction. This determines if we currently have a reactive context.\n * (Tracking derivation is also set for temporal tracking of computed values inside actions,\n * but trackingReaction can only be set by a form of Reaction)\n */\n this.trackingContext = null;\n /**\n * Each time a derivation is tracked, it is assigned a unique run-id\n */\n this.runId = 0;\n /**\n * 'guid' for general purpose. Will be persisted amongst resets.\n */\n this.mobxGuid = 0;\n /**\n * Are we in a batch block? (and how many of them)\n */\n this.inBatch = 0;\n /**\n * Observables that don't have observers anymore, and are about to be\n * suspended, unless somebody else accesses it in the same batch\n *\n * @type {IObservable[]}\n */\n this.pendingUnobservations = [];\n /**\n * List of scheduled, not yet executed, reactions.\n */\n this.pendingReactions = [];\n /**\n * Are we currently processing reactions?\n */\n this.isRunningReactions = false;\n /**\n * Is it allowed to change observables at this point?\n * In general, MobX doesn't allow that when running computations and React.render.\n * To ensure that those functions stay pure.\n */\n this.allowStateChanges = false;\n /**\n * Is it allowed to read observables at this point?\n * Used to hold the state needed for `observableRequiresReaction`\n */\n this.allowStateReads = true;\n /**\n * If strict mode is enabled, state changes are by default not allowed\n */\n this.enforceActions = true;\n /**\n * Spy callbacks\n */\n this.spyListeners = [];\n /**\n * Globally attached error handlers that react specifically to errors in reactions\n */\n this.globalReactionErrorHandlers = [];\n /**\n * Warn if computed values are accessed outside a reactive context\n */\n this.computedRequiresReaction = false;\n /**\n * (Experimental)\n * Warn if you try to create to derivation / reactive context without accessing any observable.\n */\n this.reactionRequiresObservable = false;\n /**\n * (Experimental)\n * Warn if observables are accessed outside a reactive context\n */\n this.observableRequiresReaction = false;\n /*\n * Don't catch and rethrow exceptions. This is useful for inspecting the state of\n * the stack when an exception occurs while debugging.\n */\n this.disableErrorBoundaries = false;\n /*\n * If true, we are already handling an exception in an action. Any errors in reactions should be suppressed, as\n * they are not the cause, see: https://github.com/mobxjs/mobx/issues/1836\n */\n this.suppressReactionErrors = false;\n this.useProxies = true;\n /*\n * print warnings about code that would fail if proxies weren't available\n */\n this.verifyProxies = false;\n /**\n * False forces all object's descriptors to\n * writable: true\n * configurable: true\n */\n this.safeDescriptors = true;\n};\nvar canMergeGlobalState = true;\nvar isolateCalled = false;\nvar globalState = /*#__PURE__*/function () {\n var global = /*#__PURE__*/getGlobal();\n if (global.__mobxInstanceCount > 0 && !global.__mobxGlobals) {\n canMergeGlobalState = false;\n }\n if (global.__mobxGlobals && global.__mobxGlobals.version !== new MobXGlobals().version) {\n canMergeGlobalState = false;\n }\n if (!canMergeGlobalState) {\n // Because this is a IIFE we need to let isolateCalled a chance to change\n // so we run it after the event loop completed at least 1 iteration\n setTimeout(function () {\n if (!isolateCalled) {\n die(35);\n }\n }, 1);\n return new MobXGlobals();\n } else if (global.__mobxGlobals) {\n global.__mobxInstanceCount += 1;\n if (!global.__mobxGlobals.UNCHANGED) {\n global.__mobxGlobals.UNCHANGED = {};\n } // make merge backward compatible\n return global.__mobxGlobals;\n } else {\n global.__mobxInstanceCount = 1;\n return global.__mobxGlobals = /*#__PURE__*/new MobXGlobals();\n }\n}();\nfunction isolateGlobalState() {\n if (globalState.pendingReactions.length || globalState.inBatch || globalState.isRunningReactions) {\n die(36);\n }\n isolateCalled = true;\n if (canMergeGlobalState) {\n var global = getGlobal();\n if (--global.__mobxInstanceCount === 0) {\n global.__mobxGlobals = undefined;\n }\n globalState = new MobXGlobals();\n }\n}\nfunction getGlobalState() {\n return globalState;\n}\n/**\n * For testing purposes only; this will break the internal state of existing observables,\n * but can be used to get back at a stable state after throwing errors\n */\nfunction resetGlobalState() {\n var defaultGlobals = new MobXGlobals();\n for (var key in defaultGlobals) {\n if (persistentKeys.indexOf(key) === -1) {\n globalState[key] = defaultGlobals[key];\n }\n }\n globalState.allowStateChanges = !globalState.enforceActions;\n}\n\nfunction hasObservers(observable) {\n return observable.observers_ && observable.observers_.size > 0;\n}\nfunction getObservers(observable) {\n return observable.observers_;\n}\n// function invariantObservers(observable: IObservable) {\n// const list = observable.observers\n// const map = observable.observersIndexes\n// const l = list.length\n// for (let i = 0; i < l; i++) {\n// const id = list[i].__mapid\n// if (i) {\n// invariant(map[id] === i, \"INTERNAL ERROR maps derivation.__mapid to index in list\") // for performance\n// } else {\n// invariant(!(id in map), \"INTERNAL ERROR observer on index 0 shouldn't be held in map.\") // for performance\n// }\n// }\n// invariant(\n// list.length === 0 || Object.keys(map).length === list.length - 1,\n// \"INTERNAL ERROR there is no junk in map\"\n// )\n// }\nfunction addObserver(observable, node) {\n // invariant(node.dependenciesState !== -1, \"INTERNAL ERROR, can add only dependenciesState !== -1\");\n // invariant(observable._observers.indexOf(node) === -1, \"INTERNAL ERROR add already added node\");\n // invariantObservers(observable);\n observable.observers_.add(node);\n if (observable.lowestObserverState_ > node.dependenciesState_) {\n observable.lowestObserverState_ = node.dependenciesState_;\n }\n // invariantObservers(observable);\n // invariant(observable._observers.indexOf(node) !== -1, \"INTERNAL ERROR didn't add node\");\n}\nfunction removeObserver(observable, node) {\n // invariant(globalState.inBatch > 0, \"INTERNAL ERROR, remove should be called only inside batch\");\n // invariant(observable._observers.indexOf(node) !== -1, \"INTERNAL ERROR remove already removed node\");\n // invariantObservers(observable);\n observable.observers_[\"delete\"](node);\n if (observable.observers_.size === 0) {\n // deleting last observer\n queueForUnobservation(observable);\n }\n // invariantObservers(observable);\n // invariant(observable._observers.indexOf(node) === -1, \"INTERNAL ERROR remove already removed node2\");\n}\nfunction queueForUnobservation(observable) {\n if (observable.isPendingUnobservation === false) {\n // invariant(observable._observers.length === 0, \"INTERNAL ERROR, should only queue for unobservation unobserved observables\");\n observable.isPendingUnobservation = true;\n globalState.pendingUnobservations.push(observable);\n }\n}\n/**\n * Batch starts a transaction, at least for purposes of memoizing ComputedValues when nothing else does.\n * During a batch `onBecomeUnobserved` will be called at most once per observable.\n * Avoids unnecessary recalculations.\n */\nfunction startBatch() {\n globalState.inBatch++;\n}\nfunction endBatch() {\n if (--globalState.inBatch === 0) {\n runReactions();\n // the batch is actually about to finish, all unobserving should happen here.\n var list = globalState.pendingUnobservations;\n for (var i = 0; i < list.length; i++) {\n var observable = list[i];\n observable.isPendingUnobservation = false;\n if (observable.observers_.size === 0) {\n if (observable.isBeingObserved) {\n // if this observable had reactive observers, trigger the hooks\n observable.isBeingObserved = false;\n observable.onBUO();\n }\n if (observable instanceof ComputedValue) {\n // computed values are automatically teared down when the last observer leaves\n // this process happens recursively, this computed might be the last observabe of another, etc..\n observable.suspend_();\n }\n }\n }\n globalState.pendingUnobservations = [];\n }\n}\nfunction reportObserved(observable) {\n checkIfStateReadsAreAllowed(observable);\n var derivation = globalState.trackingDerivation;\n if (derivation !== null) {\n /**\n * Simple optimization, give each derivation run an unique id (runId)\n * Check if last time this observable was accessed the same runId is used\n * if this is the case, the relation is already known\n */\n if (derivation.runId_ !== observable.lastAccessedBy_) {\n observable.lastAccessedBy_ = derivation.runId_;\n // Tried storing newObserving, or observing, or both as Set, but performance didn't come close...\n derivation.newObserving_[derivation.unboundDepsCount_++] = observable;\n if (!observable.isBeingObserved && globalState.trackingContext) {\n observable.isBeingObserved = true;\n observable.onBO();\n }\n }\n return observable.isBeingObserved;\n } else if (observable.observers_.size === 0 && globalState.inBatch > 0) {\n queueForUnobservation(observable);\n }\n return false;\n}\n// function invariantLOS(observable: IObservable, msg: string) {\n// // it's expensive so better not run it in produciton. but temporarily helpful for testing\n// const min = getObservers(observable).reduce((a, b) => Math.min(a, b.dependenciesState), 2)\n// if (min >= observable.lowestObserverState) return // <- the only assumption about `lowestObserverState`\n// throw new Error(\n// \"lowestObserverState is wrong for \" +\n// msg +\n// \" because \" +\n// min +\n// \" < \" +\n// observable.lowestObserverState\n// )\n// }\n/**\n * NOTE: current propagation mechanism will in case of self reruning autoruns behave unexpectedly\n * It will propagate changes to observers from previous run\n * It's hard or maybe impossible (with reasonable perf) to get it right with current approach\n * Hopefully self reruning autoruns aren't a feature people should depend on\n * Also most basic use cases should be ok\n */\n// Called by Atom when its value changes\nfunction propagateChanged(observable) {\n // invariantLOS(observable, \"changed start\");\n if (observable.lowestObserverState_ === IDerivationState_.STALE_) {\n return;\n }\n observable.lowestObserverState_ = IDerivationState_.STALE_;\n // Ideally we use for..of here, but the downcompiled version is really slow...\n observable.observers_.forEach(function (d) {\n if (d.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {\n if ( true && d.isTracing_ !== TraceMode.NONE) {\n logTraceInfo(d, observable);\n }\n d.onBecomeStale_();\n }\n d.dependenciesState_ = IDerivationState_.STALE_;\n });\n // invariantLOS(observable, \"changed end\");\n}\n// Called by ComputedValue when it recalculate and its value changed\nfunction propagateChangeConfirmed(observable) {\n // invariantLOS(observable, \"confirmed start\");\n if (observable.lowestObserverState_ === IDerivationState_.STALE_) {\n return;\n }\n observable.lowestObserverState_ = IDerivationState_.STALE_;\n observable.observers_.forEach(function (d) {\n if (d.dependenciesState_ === IDerivationState_.POSSIBLY_STALE_) {\n d.dependenciesState_ = IDerivationState_.STALE_;\n if ( true && d.isTracing_ !== TraceMode.NONE) {\n logTraceInfo(d, observable);\n }\n } else if (d.dependenciesState_ === IDerivationState_.UP_TO_DATE_ // this happens during computing of `d`, just keep lowestObserverState up to date.\n ) {\n observable.lowestObserverState_ = IDerivationState_.UP_TO_DATE_;\n }\n });\n // invariantLOS(observable, \"confirmed end\");\n}\n// Used by computed when its dependency changed, but we don't wan't to immediately recompute.\nfunction propagateMaybeChanged(observable) {\n // invariantLOS(observable, \"maybe start\");\n if (observable.lowestObserverState_ !== IDerivationState_.UP_TO_DATE_) {\n return;\n }\n observable.lowestObserverState_ = IDerivationState_.POSSIBLY_STALE_;\n observable.observers_.forEach(function (d) {\n if (d.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {\n d.dependenciesState_ = IDerivationState_.POSSIBLY_STALE_;\n d.onBecomeStale_();\n }\n });\n // invariantLOS(observable, \"maybe end\");\n}\nfunction logTraceInfo(derivation, observable) {\n console.log(\"[mobx.trace] '\" + derivation.name_ + \"' is invalidated due to a change in: '\" + observable.name_ + \"'\");\n if (derivation.isTracing_ === TraceMode.BREAK) {\n var lines = [];\n printDepTree(getDependencyTree(derivation), lines, 1);\n // prettier-ignore\n new Function(\"debugger;\\n/*\\nTracing '\" + derivation.name_ + \"'\\n\\nYou are entering this break point because derivation '\" + derivation.name_ + \"' is being traced and '\" + observable.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\" + (derivation instanceof ComputedValue ? derivation.derivation.toString().replace(/[*]\\//g, \"/\") : \"\") + \"\\n\\nThe dependencies for this derivation are:\\n\\n\" + lines.join(\"\\n\") + \"\\n*/\\n \")();\n }\n}\nfunction printDepTree(tree, lines, depth) {\n if (lines.length >= 1000) {\n lines.push(\"(and many more)\");\n return;\n }\n lines.push(\"\" + \"\\t\".repeat(depth - 1) + tree.name);\n if (tree.dependencies) {\n tree.dependencies.forEach(function (child) {\n return printDepTree(child, lines, depth + 1);\n });\n }\n}\n\nvar Reaction = /*#__PURE__*/function () {\n function Reaction(name_, onInvalidate_, errorHandler_, requiresObservable_) {\n if (name_ === void 0) {\n name_ = true ? \"Reaction@\" + getNextId() : 0;\n }\n this.name_ = void 0;\n this.onInvalidate_ = void 0;\n this.errorHandler_ = void 0;\n this.requiresObservable_ = void 0;\n this.observing_ = [];\n // nodes we are looking at. Our value depends on these nodes\n this.newObserving_ = [];\n this.dependenciesState_ = IDerivationState_.NOT_TRACKING_;\n this.runId_ = 0;\n this.unboundDepsCount_ = 0;\n this.flags_ = 0;\n this.isTracing_ = TraceMode.NONE;\n this.name_ = name_;\n this.onInvalidate_ = onInvalidate_;\n this.errorHandler_ = errorHandler_;\n this.requiresObservable_ = requiresObservable_;\n }\n var _proto = Reaction.prototype;\n _proto.onBecomeStale_ = function onBecomeStale_() {\n this.schedule_();\n };\n _proto.schedule_ = function schedule_() {\n if (!this.isScheduled) {\n this.isScheduled = true;\n globalState.pendingReactions.push(this);\n runReactions();\n }\n }\n /**\n * internal, use schedule() if you intend to kick off a reaction\n */;\n _proto.runReaction_ = function runReaction_() {\n if (!this.isDisposed) {\n startBatch();\n this.isScheduled = false;\n var prev = globalState.trackingContext;\n globalState.trackingContext = this;\n if (shouldCompute(this)) {\n this.isTrackPending = true;\n try {\n this.onInvalidate_();\n if ( true && this.isTrackPending && isSpyEnabled()) {\n // onInvalidate didn't trigger track right away..\n spyReport({\n name: this.name_,\n type: \"scheduled-reaction\"\n });\n }\n } catch (e) {\n this.reportExceptionInDerivation_(e);\n }\n }\n globalState.trackingContext = prev;\n endBatch();\n }\n };\n _proto.track = function track(fn) {\n if (this.isDisposed) {\n return;\n // console.warn(\"Reaction already disposed\") // Note: Not a warning / error in mobx 4 either\n }\n startBatch();\n var notify = isSpyEnabled();\n var startTime;\n if ( true && notify) {\n startTime = Date.now();\n spyReportStart({\n name: this.name_,\n type: \"reaction\"\n });\n }\n this.isRunning = true;\n var prevReaction = globalState.trackingContext; // reactions could create reactions...\n globalState.trackingContext = this;\n var result = trackDerivedFunction(this, fn, undefined);\n globalState.trackingContext = prevReaction;\n this.isRunning = false;\n this.isTrackPending = false;\n if (this.isDisposed) {\n // disposed during last run. Clean up everything that was bound after the dispose call.\n clearObserving(this);\n }\n if (isCaughtException(result)) {\n this.reportExceptionInDerivation_(result.cause);\n }\n if ( true && notify) {\n spyReportEnd({\n time: Date.now() - startTime\n });\n }\n endBatch();\n };\n _proto.reportExceptionInDerivation_ = function reportExceptionInDerivation_(error) {\n var _this = this;\n if (this.errorHandler_) {\n this.errorHandler_(error, this);\n return;\n }\n if (globalState.disableErrorBoundaries) {\n throw error;\n }\n var message = true ? \"[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '\" + this + \"'\" : 0;\n if (!globalState.suppressReactionErrors) {\n console.error(message, error);\n /** If debugging brought you here, please, read the above message :-). Tnx! */\n } else if (true) {\n console.warn(\"[mobx] (error in reaction '\" + this.name_ + \"' suppressed, fix error of causing action below)\");\n } // prettier-ignore\n if ( true && isSpyEnabled()) {\n spyReport({\n type: \"error\",\n name: this.name_,\n message: message,\n error: \"\" + error\n });\n }\n globalState.globalReactionErrorHandlers.forEach(function (f) {\n return f(error, _this);\n });\n };\n _proto.dispose = function dispose() {\n if (!this.isDisposed) {\n this.isDisposed = true;\n if (!this.isRunning) {\n // if disposed while running, clean up later. Maybe not optimal, but rare case\n startBatch();\n clearObserving(this);\n endBatch();\n }\n }\n };\n _proto.getDisposer_ = function getDisposer_(abortSignal) {\n var _this2 = this;\n var dispose = function dispose() {\n _this2.dispose();\n abortSignal == null || abortSignal.removeEventListener == null || abortSignal.removeEventListener(\"abort\", dispose);\n };\n abortSignal == null || abortSignal.addEventListener == null || abortSignal.addEventListener(\"abort\", dispose);\n dispose[$mobx] = this;\n return dispose;\n };\n _proto.toString = function toString() {\n return \"Reaction[\" + this.name_ + \"]\";\n };\n _proto.trace = function trace$1(enterBreakPoint) {\n if (enterBreakPoint === void 0) {\n enterBreakPoint = false;\n }\n trace(this, enterBreakPoint);\n };\n return _createClass(Reaction, [{\n key: \"isDisposed\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isDisposedMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isDisposedMask_, newValue);\n }\n }, {\n key: \"isScheduled\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isScheduledMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isScheduledMask_, newValue);\n }\n }, {\n key: \"isTrackPending\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isTrackPendingMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isTrackPendingMask_, newValue);\n }\n }, {\n key: \"isRunning\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isRunningMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isRunningMask_, newValue);\n }\n }, {\n key: \"diffValue\",\n get: function get() {\n return getFlag(this.flags_, Reaction.diffValueMask_) ? 1 : 0;\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.diffValueMask_, newValue === 1 ? true : false);\n }\n }]);\n}();\nReaction.isDisposedMask_ = 1;\nReaction.isScheduledMask_ = 2;\nReaction.isTrackPendingMask_ = 4;\nReaction.isRunningMask_ = 8;\nReaction.diffValueMask_ = 16;\nfunction onReactionError(handler) {\n globalState.globalReactionErrorHandlers.push(handler);\n return function () {\n var idx = globalState.globalReactionErrorHandlers.indexOf(handler);\n if (idx >= 0) {\n globalState.globalReactionErrorHandlers.splice(idx, 1);\n }\n };\n}\n/**\n * Magic number alert!\n * Defines within how many times a reaction is allowed to re-trigger itself\n * until it is assumed that this is gonna be a never ending loop...\n */\nvar MAX_REACTION_ITERATIONS = 100;\nvar reactionScheduler = function reactionScheduler(f) {\n return f();\n};\nfunction runReactions() {\n // Trampolining, if runReactions are already running, new reactions will be picked up\n if (globalState.inBatch > 0 || globalState.isRunningReactions) {\n return;\n }\n reactionScheduler(runReactionsHelper);\n}\nfunction runReactionsHelper() {\n globalState.isRunningReactions = true;\n var allReactions = globalState.pendingReactions;\n var iterations = 0;\n // While running reactions, new reactions might be triggered.\n // Hence we work with two variables and check whether\n // we converge to no remaining reactions after a while.\n while (allReactions.length > 0) {\n if (++iterations === MAX_REACTION_ITERATIONS) {\n console.error( true ? \"Reaction doesn't converge to a stable state after \" + MAX_REACTION_ITERATIONS + \" iterations.\" + (\" Probably there is a cycle in the reactive function: \" + allReactions[0]) : 0);\n allReactions.splice(0); // clear reactions\n }\n var remainingReactions = allReactions.splice(0);\n for (var i = 0, l = remainingReactions.length; i < l; i++) {\n remainingReactions[i].runReaction_();\n }\n }\n globalState.isRunningReactions = false;\n}\nvar isReaction = /*#__PURE__*/createInstanceofPredicate(\"Reaction\", Reaction);\nfunction setReactionScheduler(fn) {\n var baseScheduler = reactionScheduler;\n reactionScheduler = function reactionScheduler(f) {\n return fn(function () {\n return baseScheduler(f);\n });\n };\n}\n\nfunction isSpyEnabled() {\n return true && !!globalState.spyListeners.length;\n}\nfunction spyReport(event) {\n if (false) {} // dead code elimination can do the rest\n if (!globalState.spyListeners.length) {\n return;\n }\n var listeners = globalState.spyListeners;\n for (var i = 0, l = listeners.length; i < l; i++) {\n listeners[i](event);\n }\n}\nfunction spyReportStart(event) {\n if (false) {}\n var change = _extends({}, event, {\n spyReportStart: true\n });\n spyReport(change);\n}\nvar END_EVENT = {\n type: \"report-end\",\n spyReportEnd: true\n};\nfunction spyReportEnd(change) {\n if (false) {}\n if (change) {\n spyReport(_extends({}, change, {\n type: \"report-end\",\n spyReportEnd: true\n }));\n } else {\n spyReport(END_EVENT);\n }\n}\nfunction spy(listener) {\n if (false) {} else {\n globalState.spyListeners.push(listener);\n return once(function () {\n globalState.spyListeners = globalState.spyListeners.filter(function (l) {\n return l !== listener;\n });\n });\n }\n}\n\nvar ACTION = \"action\";\nvar ACTION_BOUND = \"action.bound\";\nvar AUTOACTION = \"autoAction\";\nvar AUTOACTION_BOUND = \"autoAction.bound\";\nvar DEFAULT_ACTION_NAME = \"\";\nvar actionAnnotation = /*#__PURE__*/createActionAnnotation(ACTION);\nvar actionBoundAnnotation = /*#__PURE__*/createActionAnnotation(ACTION_BOUND, {\n bound: true\n});\nvar autoActionAnnotation = /*#__PURE__*/createActionAnnotation(AUTOACTION, {\n autoAction: true\n});\nvar autoActionBoundAnnotation = /*#__PURE__*/createActionAnnotation(AUTOACTION_BOUND, {\n autoAction: true,\n bound: true\n});\nfunction createActionFactory(autoAction) {\n var res = function action(arg1, arg2) {\n // action(fn() {})\n if (isFunction(arg1)) {\n return createAction(arg1.name || DEFAULT_ACTION_NAME, arg1, autoAction);\n }\n // action(\"name\", fn() {})\n if (isFunction(arg2)) {\n return createAction(arg1, arg2, autoAction);\n }\n // @action (2022.3 Decorators)\n if (is20223Decorator(arg2)) {\n return (autoAction ? autoActionAnnotation : actionAnnotation).decorate_20223_(arg1, arg2);\n }\n // @action\n if (isStringish(arg2)) {\n return storeAnnotation(arg1, arg2, autoAction ? autoActionAnnotation : actionAnnotation);\n }\n // action(\"name\") & @action(\"name\")\n if (isStringish(arg1)) {\n return createDecoratorAnnotation(createActionAnnotation(autoAction ? AUTOACTION : ACTION, {\n name: arg1,\n autoAction: autoAction\n }));\n }\n if (true) {\n die(\"Invalid arguments for `action`\");\n }\n };\n return res;\n}\nvar action = /*#__PURE__*/createActionFactory(false);\nObject.assign(action, actionAnnotation);\nvar autoAction = /*#__PURE__*/createActionFactory(true);\nObject.assign(autoAction, autoActionAnnotation);\naction.bound = /*#__PURE__*/createDecoratorAnnotation(actionBoundAnnotation);\nautoAction.bound = /*#__PURE__*/createDecoratorAnnotation(autoActionBoundAnnotation);\nfunction runInAction(fn) {\n return executeAction(fn.name || DEFAULT_ACTION_NAME, false, fn, this, undefined);\n}\nfunction isAction(thing) {\n return isFunction(thing) && thing.isMobxAction === true;\n}\n\n/**\n * Creates a named reactive view and keeps it alive, so that the view is always\n * updated if one of the dependencies changes, even when the view is not further used by something else.\n * @param view The reactive view\n * @returns disposer function, which can be used to stop the view from being updated in the future.\n */\nfunction autorun(view, opts) {\n var _opts$name, _opts, _opts2, _opts3;\n if (opts === void 0) {\n opts = EMPTY_OBJECT;\n }\n if (true) {\n if (!isFunction(view)) {\n die(\"Autorun expects a function as first argument\");\n }\n if (isAction(view)) {\n die(\"Autorun does not accept actions since actions are untrackable\");\n }\n }\n var name = (_opts$name = (_opts = opts) == null ? void 0 : _opts.name) != null ? _opts$name : true ? view.name || \"Autorun@\" + getNextId() : 0;\n var runSync = !opts.scheduler && !opts.delay;\n var reaction;\n if (runSync) {\n // normal autorun\n reaction = new Reaction(name, function () {\n this.track(reactionRunner);\n }, opts.onError, opts.requiresObservable);\n } else {\n var scheduler = createSchedulerFromOptions(opts);\n // debounced autorun\n var isScheduled = false;\n reaction = new Reaction(name, function () {\n if (!isScheduled) {\n isScheduled = true;\n scheduler(function () {\n isScheduled = false;\n if (!reaction.isDisposed) {\n reaction.track(reactionRunner);\n }\n });\n }\n }, opts.onError, opts.requiresObservable);\n }\n function reactionRunner() {\n view(reaction);\n }\n if (!((_opts2 = opts) != null && (_opts2 = _opts2.signal) != null && _opts2.aborted)) {\n reaction.schedule_();\n }\n return reaction.getDisposer_((_opts3 = opts) == null ? void 0 : _opts3.signal);\n}\nvar run = function run(f) {\n return f();\n};\nfunction createSchedulerFromOptions(opts) {\n return opts.scheduler ? opts.scheduler : opts.delay ? function (f) {\n return setTimeout(f, opts.delay);\n } : run;\n}\nfunction reaction(expression, effect, opts) {\n var _opts$name2, _opts4, _opts5;\n if (opts === void 0) {\n opts = EMPTY_OBJECT;\n }\n if (true) {\n if (!isFunction(expression) || !isFunction(effect)) {\n die(\"First and second argument to reaction should be functions\");\n }\n if (!isPlainObject(opts)) {\n die(\"Third argument of reactions should be an object\");\n }\n }\n var name = (_opts$name2 = opts.name) != null ? _opts$name2 : true ? \"Reaction@\" + getNextId() : 0;\n var effectAction = action(name, opts.onError ? wrapErrorHandler(opts.onError, effect) : effect);\n var runSync = !opts.scheduler && !opts.delay;\n var scheduler = createSchedulerFromOptions(opts);\n var firstTime = true;\n var isScheduled = false;\n var value;\n var equals = opts.compareStructural ? comparer.structural : opts.equals || comparer[\"default\"];\n var r = new Reaction(name, function () {\n if (firstTime || runSync) {\n reactionRunner();\n } else if (!isScheduled) {\n isScheduled = true;\n scheduler(reactionRunner);\n }\n }, opts.onError, opts.requiresObservable);\n function reactionRunner() {\n isScheduled = false;\n if (r.isDisposed) {\n return;\n }\n var changed = false;\n var oldValue = value;\n r.track(function () {\n var nextValue = allowStateChanges(false, function () {\n return expression(r);\n });\n changed = firstTime || !equals(value, nextValue);\n value = nextValue;\n });\n if (firstTime && opts.fireImmediately) {\n effectAction(value, oldValue, r);\n } else if (!firstTime && changed) {\n effectAction(value, oldValue, r);\n }\n firstTime = false;\n }\n if (!((_opts4 = opts) != null && (_opts4 = _opts4.signal) != null && _opts4.aborted)) {\n r.schedule_();\n }\n return r.getDisposer_((_opts5 = opts) == null ? void 0 : _opts5.signal);\n}\nfunction wrapErrorHandler(errorHandler, baseFn) {\n return function () {\n try {\n return baseFn.apply(this, arguments);\n } catch (e) {\n errorHandler.call(this, e);\n }\n };\n}\n\nvar ON_BECOME_OBSERVED = \"onBO\";\nvar ON_BECOME_UNOBSERVED = \"onBUO\";\nfunction onBecomeObserved(thing, arg2, arg3) {\n return interceptHook(ON_BECOME_OBSERVED, thing, arg2, arg3);\n}\nfunction onBecomeUnobserved(thing, arg2, arg3) {\n return interceptHook(ON_BECOME_UNOBSERVED, thing, arg2, arg3);\n}\nfunction interceptHook(hook, thing, arg2, arg3) {\n var atom = typeof arg3 === \"function\" ? getAtom(thing, arg2) : getAtom(thing);\n var cb = isFunction(arg3) ? arg3 : arg2;\n var listenersKey = hook + \"L\";\n if (atom[listenersKey]) {\n atom[listenersKey].add(cb);\n } else {\n atom[listenersKey] = new Set([cb]);\n }\n return function () {\n var hookListeners = atom[listenersKey];\n if (hookListeners) {\n hookListeners[\"delete\"](cb);\n if (hookListeners.size === 0) {\n delete atom[listenersKey];\n }\n }\n };\n}\n\nvar NEVER = \"never\";\nvar ALWAYS = \"always\";\nvar OBSERVED = \"observed\";\n// const IF_AVAILABLE = \"ifavailable\"\nfunction configure(options) {\n if (options.isolateGlobalState === true) {\n isolateGlobalState();\n }\n var useProxies = options.useProxies,\n enforceActions = options.enforceActions;\n if (useProxies !== undefined) {\n globalState.useProxies = useProxies === ALWAYS ? true : useProxies === NEVER ? false : typeof Proxy !== \"undefined\";\n }\n if (useProxies === \"ifavailable\") {\n globalState.verifyProxies = true;\n }\n if (enforceActions !== undefined) {\n var ea = enforceActions === ALWAYS ? ALWAYS : enforceActions === OBSERVED;\n globalState.enforceActions = ea;\n globalState.allowStateChanges = ea === true || ea === ALWAYS ? false : true;\n }\n [\"computedRequiresReaction\", \"reactionRequiresObservable\", \"observableRequiresReaction\", \"disableErrorBoundaries\", \"safeDescriptors\"].forEach(function (key) {\n if (key in options) {\n globalState[key] = !!options[key];\n }\n });\n globalState.allowStateReads = !globalState.observableRequiresReaction;\n if ( true && globalState.disableErrorBoundaries === true) {\n console.warn(\"WARNING: Debug feature only. MobX will NOT recover from errors when `disableErrorBoundaries` is enabled.\");\n }\n if (options.reactionScheduler) {\n setReactionScheduler(options.reactionScheduler);\n }\n}\n\nfunction extendObservable(target, properties, annotations, options) {\n if (true) {\n if (arguments.length > 4) {\n die(\"'extendObservable' expected 2-4 arguments\");\n }\n if (typeof target !== \"object\") {\n die(\"'extendObservable' expects an object as first argument\");\n }\n if (isObservableMap(target)) {\n die(\"'extendObservable' should not be used on maps, use map.merge instead\");\n }\n if (!isPlainObject(properties)) {\n die(\"'extendObservable' only accepts plain objects as second argument\");\n }\n if (isObservable(properties) || isObservable(annotations)) {\n die(\"Extending an object with another observable (object) is not supported\");\n }\n }\n // Pull descriptors first, so we don't have to deal with props added by administration ($mobx)\n var descriptors = getOwnPropertyDescriptors(properties);\n initObservable(function () {\n var adm = asObservableObject(target, options)[$mobx];\n ownKeys(descriptors).forEach(function (key) {\n adm.extend_(key, descriptors[key],\n // must pass \"undefined\" for { key: undefined }\n !annotations ? true : key in annotations ? annotations[key] : true);\n });\n });\n return target;\n}\n\nfunction getDependencyTree(thing, property) {\n return nodeToDependencyTree(getAtom(thing, property));\n}\nfunction nodeToDependencyTree(node) {\n var result = {\n name: node.name_\n };\n if (node.observing_ && node.observing_.length > 0) {\n result.dependencies = unique(node.observing_).map(nodeToDependencyTree);\n }\n return result;\n}\nfunction getObserverTree(thing, property) {\n return nodeToObserverTree(getAtom(thing, property));\n}\nfunction nodeToObserverTree(node) {\n var result = {\n name: node.name_\n };\n if (hasObservers(node)) {\n result.observers = Array.from(getObservers(node)).map(nodeToObserverTree);\n }\n return result;\n}\nfunction unique(list) {\n return Array.from(new Set(list));\n}\n\nvar generatorId = 0;\nfunction FlowCancellationError() {\n this.message = \"FLOW_CANCELLED\";\n}\nFlowCancellationError.prototype = /*#__PURE__*/Object.create(Error.prototype);\nfunction isFlowCancellationError(error) {\n return error instanceof FlowCancellationError;\n}\nvar flowAnnotation = /*#__PURE__*/createFlowAnnotation(\"flow\");\nvar flowBoundAnnotation = /*#__PURE__*/createFlowAnnotation(\"flow.bound\", {\n bound: true\n});\nvar flow = /*#__PURE__*/Object.assign(function flow(arg1, arg2) {\n // @flow (2022.3 Decorators)\n if (is20223Decorator(arg2)) {\n return flowAnnotation.decorate_20223_(arg1, arg2);\n }\n // @flow\n if (isStringish(arg2)) {\n return storeAnnotation(arg1, arg2, flowAnnotation);\n }\n // flow(fn)\n if ( true && arguments.length !== 1) {\n die(\"Flow expects single argument with generator function\");\n }\n var generator = arg1;\n var name = generator.name || \"\";\n // Implementation based on https://github.com/tj/co/blob/master/index.js\n var res = function res() {\n var ctx = this;\n var args = arguments;\n var runId = ++generatorId;\n var gen = action(name + \" - runid: \" + runId + \" - init\", generator).apply(ctx, args);\n var rejector;\n var pendingPromise = undefined;\n var promise = new Promise(function (resolve, reject) {\n var stepId = 0;\n rejector = reject;\n function onFulfilled(res) {\n pendingPromise = undefined;\n var ret;\n try {\n ret = action(name + \" - runid: \" + runId + \" - yield \" + stepId++, gen.next).call(gen, res);\n } catch (e) {\n return reject(e);\n }\n next(ret);\n }\n function onRejected(err) {\n pendingPromise = undefined;\n var ret;\n try {\n ret = action(name + \" - runid: \" + runId + \" - yield \" + stepId++, gen[\"throw\"]).call(gen, err);\n } catch (e) {\n return reject(e);\n }\n next(ret);\n }\n function next(ret) {\n if (isFunction(ret == null ? void 0 : ret.then)) {\n // an async iterator\n ret.then(next, reject);\n return;\n }\n if (ret.done) {\n return resolve(ret.value);\n }\n pendingPromise = Promise.resolve(ret.value);\n return pendingPromise.then(onFulfilled, onRejected);\n }\n onFulfilled(undefined); // kick off the process\n });\n promise.cancel = action(name + \" - runid: \" + runId + \" - cancel\", function () {\n try {\n if (pendingPromise) {\n cancelPromise(pendingPromise);\n }\n // Finally block can return (or yield) stuff..\n var _res = gen[\"return\"](undefined);\n // eat anything that promise would do, it's cancelled!\n var yieldedPromise = Promise.resolve(_res.value);\n yieldedPromise.then(noop, noop);\n cancelPromise(yieldedPromise); // maybe it can be cancelled :)\n // reject our original promise\n rejector(new FlowCancellationError());\n } catch (e) {\n rejector(e); // there could be a throwing finally block\n }\n });\n return promise;\n };\n res.isMobXFlow = true;\n return res;\n}, flowAnnotation);\nflow.bound = /*#__PURE__*/createDecoratorAnnotation(flowBoundAnnotation);\nfunction cancelPromise(promise) {\n if (isFunction(promise.cancel)) {\n promise.cancel();\n }\n}\nfunction flowResult(result) {\n return result; // just tricking TypeScript :)\n}\nfunction isFlow(fn) {\n return (fn == null ? void 0 : fn.isMobXFlow) === true;\n}\n\nfunction interceptReads(thing, propOrHandler, handler) {\n var target;\n if (isObservableMap(thing) || isObservableArray(thing) || isObservableValue(thing)) {\n target = getAdministration(thing);\n } else if (isObservableObject(thing)) {\n if ( true && !isStringish(propOrHandler)) {\n return die(\"InterceptReads can only be used with a specific property, not with an object in general\");\n }\n target = getAdministration(thing, propOrHandler);\n } else if (true) {\n return die(\"Expected observable map, object or array as first array\");\n }\n if ( true && target.dehancer !== undefined) {\n return die(\"An intercept reader was already established\");\n }\n target.dehancer = typeof propOrHandler === \"function\" ? propOrHandler : handler;\n return function () {\n target.dehancer = undefined;\n };\n}\n\nfunction intercept(thing, propOrHandler, handler) {\n if (isFunction(handler)) {\n return interceptProperty(thing, propOrHandler, handler);\n } else {\n return interceptInterceptable(thing, propOrHandler);\n }\n}\nfunction interceptInterceptable(thing, handler) {\n return getAdministration(thing).intercept_(handler);\n}\nfunction interceptProperty(thing, property, handler) {\n return getAdministration(thing, property).intercept_(handler);\n}\n\nfunction _isComputed(value, property) {\n if (property === undefined) {\n return isComputedValue(value);\n }\n if (isObservableObject(value) === false) {\n return false;\n }\n if (!value[$mobx].values_.has(property)) {\n return false;\n }\n var atom = getAtom(value, property);\n return isComputedValue(atom);\n}\nfunction isComputed(value) {\n if ( true && arguments.length > 1) {\n return die(\"isComputed expects only 1 argument. Use isComputedProp to inspect the observability of a property\");\n }\n return _isComputed(value);\n}\nfunction isComputedProp(value, propName) {\n if ( true && !isStringish(propName)) {\n return die(\"isComputed expected a property name as second argument\");\n }\n return _isComputed(value, propName);\n}\n\nfunction _isObservable(value, property) {\n if (!value) {\n return false;\n }\n if (property !== undefined) {\n if ( true && (isObservableMap(value) || isObservableArray(value))) {\n return die(\"isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead.\");\n }\n if (isObservableObject(value)) {\n return value[$mobx].values_.has(property);\n }\n return false;\n }\n // For first check, see #701\n return isObservableObject(value) || !!value[$mobx] || isAtom(value) || isReaction(value) || isComputedValue(value);\n}\nfunction isObservable(value) {\n if ( true && arguments.length !== 1) {\n die(\"isObservable expects only 1 argument. Use isObservableProp to inspect the observability of a property\");\n }\n return _isObservable(value);\n}\nfunction isObservableProp(value, propName) {\n if ( true && !isStringish(propName)) {\n return die(\"expected a property name as second argument\");\n }\n return _isObservable(value, propName);\n}\n\nfunction keys(obj) {\n if (isObservableObject(obj)) {\n return obj[$mobx].keys_();\n }\n if (isObservableMap(obj) || isObservableSet(obj)) {\n return Array.from(obj.keys());\n }\n if (isObservableArray(obj)) {\n return obj.map(function (_, index) {\n return index;\n });\n }\n die(5);\n}\nfunction values(obj) {\n if (isObservableObject(obj)) {\n return keys(obj).map(function (key) {\n return obj[key];\n });\n }\n if (isObservableMap(obj)) {\n return keys(obj).map(function (key) {\n return obj.get(key);\n });\n }\n if (isObservableSet(obj)) {\n return Array.from(obj.values());\n }\n if (isObservableArray(obj)) {\n return obj.slice();\n }\n die(6);\n}\nfunction entries(obj) {\n if (isObservableObject(obj)) {\n return keys(obj).map(function (key) {\n return [key, obj[key]];\n });\n }\n if (isObservableMap(obj)) {\n return keys(obj).map(function (key) {\n return [key, obj.get(key)];\n });\n }\n if (isObservableSet(obj)) {\n return Array.from(obj.entries());\n }\n if (isObservableArray(obj)) {\n return obj.map(function (key, index) {\n return [index, key];\n });\n }\n die(7);\n}\nfunction set(obj, key, value) {\n if (arguments.length === 2 && !isObservableSet(obj)) {\n startBatch();\n var _values = key;\n try {\n for (var _key in _values) {\n set(obj, _key, _values[_key]);\n }\n } finally {\n endBatch();\n }\n return;\n }\n if (isObservableObject(obj)) {\n obj[$mobx].set_(key, value);\n } else if (isObservableMap(obj)) {\n obj.set(key, value);\n } else if (isObservableSet(obj)) {\n obj.add(key);\n } else if (isObservableArray(obj)) {\n if (typeof key !== \"number\") {\n key = parseInt(key, 10);\n }\n if (key < 0) {\n die(\"Invalid index: '\" + key + \"'\");\n }\n startBatch();\n if (key >= obj.length) {\n obj.length = key + 1;\n }\n obj[key] = value;\n endBatch();\n } else {\n die(8);\n }\n}\nfunction remove(obj, key) {\n if (isObservableObject(obj)) {\n obj[$mobx].delete_(key);\n } else if (isObservableMap(obj)) {\n obj[\"delete\"](key);\n } else if (isObservableSet(obj)) {\n obj[\"delete\"](key);\n } else if (isObservableArray(obj)) {\n if (typeof key !== \"number\") {\n key = parseInt(key, 10);\n }\n obj.splice(key, 1);\n } else {\n die(9);\n }\n}\nfunction has(obj, key) {\n if (isObservableObject(obj)) {\n return obj[$mobx].has_(key);\n } else if (isObservableMap(obj)) {\n return obj.has(key);\n } else if (isObservableSet(obj)) {\n return obj.has(key);\n } else if (isObservableArray(obj)) {\n return key >= 0 && key < obj.length;\n }\n die(10);\n}\nfunction get(obj, key) {\n if (!has(obj, key)) {\n return undefined;\n }\n if (isObservableObject(obj)) {\n return obj[$mobx].get_(key);\n } else if (isObservableMap(obj)) {\n return obj.get(key);\n } else if (isObservableArray(obj)) {\n return obj[key];\n }\n die(11);\n}\nfunction apiDefineProperty(obj, key, descriptor) {\n if (isObservableObject(obj)) {\n return obj[$mobx].defineProperty_(key, descriptor);\n }\n die(39);\n}\nfunction apiOwnKeys(obj) {\n if (isObservableObject(obj)) {\n return obj[$mobx].ownKeys_();\n }\n die(38);\n}\n\nfunction observe(thing, propOrCb, cbOrFire, fireImmediately) {\n if (isFunction(cbOrFire)) {\n return observeObservableProperty(thing, propOrCb, cbOrFire, fireImmediately);\n } else {\n return observeObservable(thing, propOrCb, cbOrFire);\n }\n}\nfunction observeObservable(thing, listener, fireImmediately) {\n return getAdministration(thing).observe_(listener, fireImmediately);\n}\nfunction observeObservableProperty(thing, property, listener, fireImmediately) {\n return getAdministration(thing, property).observe_(listener, fireImmediately);\n}\n\nfunction cache(map, key, value) {\n map.set(key, value);\n return value;\n}\nfunction toJSHelper(source, __alreadySeen) {\n if (source == null || typeof source !== \"object\" || source instanceof Date || !isObservable(source)) {\n return source;\n }\n if (isObservableValue(source) || isComputedValue(source)) {\n return toJSHelper(source.get(), __alreadySeen);\n }\n if (__alreadySeen.has(source)) {\n return __alreadySeen.get(source);\n }\n if (isObservableArray(source)) {\n var res = cache(__alreadySeen, source, new Array(source.length));\n source.forEach(function (value, idx) {\n res[idx] = toJSHelper(value, __alreadySeen);\n });\n return res;\n }\n if (isObservableSet(source)) {\n var _res = cache(__alreadySeen, source, new Set());\n source.forEach(function (value) {\n _res.add(toJSHelper(value, __alreadySeen));\n });\n return _res;\n }\n if (isObservableMap(source)) {\n var _res2 = cache(__alreadySeen, source, new Map());\n source.forEach(function (value, key) {\n _res2.set(key, toJSHelper(value, __alreadySeen));\n });\n return _res2;\n } else {\n // must be observable object\n var _res3 = cache(__alreadySeen, source, {});\n apiOwnKeys(source).forEach(function (key) {\n if (objectPrototype.propertyIsEnumerable.call(source, key)) {\n _res3[key] = toJSHelper(source[key], __alreadySeen);\n }\n });\n return _res3;\n }\n}\n/**\n * Recursively converts an observable to it's non-observable native counterpart.\n * It does NOT recurse into non-observables, these are left as they are, even if they contain observables.\n * Computed and other non-enumerable properties are completely ignored.\n * Complex scenarios require custom solution, eg implementing `toJSON` or using `serializr` lib.\n */\nfunction toJS(source, options) {\n if ( true && options) {\n die(\"toJS no longer supports options\");\n }\n return toJSHelper(source, new Map());\n}\n\nfunction trace() {\n if (false) {}\n var enterBreakPoint = false;\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n if (typeof args[args.length - 1] === \"boolean\") {\n enterBreakPoint = args.pop();\n }\n var derivation = getAtomFromArgs(args);\n if (!derivation) {\n return die(\"'trace(break?)' can only be used inside a tracked computed value or a Reaction. Consider passing in the computed value or reaction explicitly\");\n }\n if (derivation.isTracing_ === TraceMode.NONE) {\n console.log(\"[mobx.trace] '\" + derivation.name_ + \"' tracing enabled\");\n }\n derivation.isTracing_ = enterBreakPoint ? TraceMode.BREAK : TraceMode.LOG;\n}\nfunction getAtomFromArgs(args) {\n switch (args.length) {\n case 0:\n return globalState.trackingDerivation;\n case 1:\n return getAtom(args[0]);\n case 2:\n return getAtom(args[0], args[1]);\n }\n}\n\n/**\n * During a transaction no views are updated until the end of the transaction.\n * The transaction will be run synchronously nonetheless.\n *\n * @param action a function that updates some reactive state\n * @returns any value that was returned by the 'action' parameter.\n */\nfunction transaction(action, thisArg) {\n if (thisArg === void 0) {\n thisArg = undefined;\n }\n startBatch();\n try {\n return action.apply(thisArg);\n } finally {\n endBatch();\n }\n}\n\nfunction when(predicate, arg1, arg2) {\n if (arguments.length === 1 || arg1 && typeof arg1 === \"object\") {\n return whenPromise(predicate, arg1);\n }\n return _when(predicate, arg1, arg2 || {});\n}\nfunction _when(predicate, effect, opts) {\n var timeoutHandle;\n if (typeof opts.timeout === \"number\") {\n var error = new Error(\"WHEN_TIMEOUT\");\n timeoutHandle = setTimeout(function () {\n if (!disposer[$mobx].isDisposed) {\n disposer();\n if (opts.onError) {\n opts.onError(error);\n } else {\n throw error;\n }\n }\n }, opts.timeout);\n }\n opts.name = true ? opts.name || \"When@\" + getNextId() : 0;\n var effectAction = createAction( true ? opts.name + \"-effect\" : 0, effect);\n // eslint-disable-next-line\n var disposer = autorun(function (r) {\n // predicate should not change state\n var cond = allowStateChanges(false, predicate);\n if (cond) {\n r.dispose();\n if (timeoutHandle) {\n clearTimeout(timeoutHandle);\n }\n effectAction();\n }\n }, opts);\n return disposer;\n}\nfunction whenPromise(predicate, opts) {\n var _opts$signal;\n if ( true && opts && opts.onError) {\n return die(\"the options 'onError' and 'promise' cannot be combined\");\n }\n if (opts != null && (_opts$signal = opts.signal) != null && _opts$signal.aborted) {\n return Object.assign(Promise.reject(new Error(\"WHEN_ABORTED\")), {\n cancel: function cancel() {\n return null;\n }\n });\n }\n var cancel;\n var abort;\n var res = new Promise(function (resolve, reject) {\n var _opts$signal2;\n var disposer = _when(predicate, resolve, _extends({}, opts, {\n onError: reject\n }));\n cancel = function cancel() {\n disposer();\n reject(new Error(\"WHEN_CANCELLED\"));\n };\n abort = function abort() {\n disposer();\n reject(new Error(\"WHEN_ABORTED\"));\n };\n opts == null || (_opts$signal2 = opts.signal) == null || _opts$signal2.addEventListener == null || _opts$signal2.addEventListener(\"abort\", abort);\n })[\"finally\"](function () {\n var _opts$signal3;\n return opts == null || (_opts$signal3 = opts.signal) == null || _opts$signal3.removeEventListener == null ? void 0 : _opts$signal3.removeEventListener(\"abort\", abort);\n });\n res.cancel = cancel;\n return res;\n}\n\nfunction getAdm(target) {\n return target[$mobx];\n}\n// Optimization: we don't need the intermediate objects and could have a completely custom administration for DynamicObjects,\n// and skip either the internal values map, or the base object with its property descriptors!\nvar objectProxyTraps = {\n has: function has(target, name) {\n if ( true && globalState.trackingDerivation) {\n warnAboutProxyRequirement(\"detect new properties using the 'in' operator. Use 'has' from 'mobx' instead.\");\n }\n return getAdm(target).has_(name);\n },\n get: function get(target, name) {\n return getAdm(target).get_(name);\n },\n set: function set(target, name, value) {\n var _getAdm$set_;\n if (!isStringish(name)) {\n return false;\n }\n if ( true && !getAdm(target).values_.has(name)) {\n warnAboutProxyRequirement(\"add a new observable property through direct assignment. Use 'set' from 'mobx' instead.\");\n }\n // null (intercepted) -> true (success)\n return (_getAdm$set_ = getAdm(target).set_(name, value, true)) != null ? _getAdm$set_ : true;\n },\n deleteProperty: function deleteProperty(target, name) {\n var _getAdm$delete_;\n if (true) {\n warnAboutProxyRequirement(\"delete properties from an observable object. Use 'remove' from 'mobx' instead.\");\n }\n if (!isStringish(name)) {\n return false;\n }\n // null (intercepted) -> true (success)\n return (_getAdm$delete_ = getAdm(target).delete_(name, true)) != null ? _getAdm$delete_ : true;\n },\n defineProperty: function defineProperty(target, name, descriptor) {\n var _getAdm$definePropert;\n if (true) {\n warnAboutProxyRequirement(\"define property on an observable object. Use 'defineProperty' from 'mobx' instead.\");\n }\n // null (intercepted) -> true (success)\n return (_getAdm$definePropert = getAdm(target).defineProperty_(name, descriptor)) != null ? _getAdm$definePropert : true;\n },\n ownKeys: function ownKeys(target) {\n if ( true && globalState.trackingDerivation) {\n warnAboutProxyRequirement(\"iterate keys to detect added / removed properties. Use 'keys' from 'mobx' instead.\");\n }\n return getAdm(target).ownKeys_();\n },\n preventExtensions: function preventExtensions(target) {\n die(13);\n }\n};\nfunction asDynamicObservableObject(target, options) {\n var _target$$mobx, _target$$mobx$proxy_;\n assertProxies();\n target = asObservableObject(target, options);\n return (_target$$mobx$proxy_ = (_target$$mobx = target[$mobx]).proxy_) != null ? _target$$mobx$proxy_ : _target$$mobx.proxy_ = new Proxy(target, objectProxyTraps);\n}\n\nfunction hasInterceptors(interceptable) {\n return interceptable.interceptors_ !== undefined && interceptable.interceptors_.length > 0;\n}\nfunction registerInterceptor(interceptable, handler) {\n var interceptors = interceptable.interceptors_ || (interceptable.interceptors_ = []);\n interceptors.push(handler);\n return once(function () {\n var idx = interceptors.indexOf(handler);\n if (idx !== -1) {\n interceptors.splice(idx, 1);\n }\n });\n}\nfunction interceptChange(interceptable, change) {\n var prevU = untrackedStart();\n try {\n // Interceptor can modify the array, copy it to avoid concurrent modification, see #1950\n var interceptors = [].concat(interceptable.interceptors_ || []);\n for (var i = 0, l = interceptors.length; i < l; i++) {\n change = interceptors[i](change);\n if (change && !change.type) {\n die(14);\n }\n if (!change) {\n break;\n }\n }\n return change;\n } finally {\n untrackedEnd(prevU);\n }\n}\n\nfunction hasListeners(listenable) {\n return listenable.changeListeners_ !== undefined && listenable.changeListeners_.length > 0;\n}\nfunction registerListener(listenable, handler) {\n var listeners = listenable.changeListeners_ || (listenable.changeListeners_ = []);\n listeners.push(handler);\n return once(function () {\n var idx = listeners.indexOf(handler);\n if (idx !== -1) {\n listeners.splice(idx, 1);\n }\n });\n}\nfunction notifyListeners(listenable, change) {\n var prevU = untrackedStart();\n var listeners = listenable.changeListeners_;\n if (!listeners) {\n return;\n }\n listeners = listeners.slice();\n for (var i = 0, l = listeners.length; i < l; i++) {\n listeners[i](change);\n }\n untrackedEnd(prevU);\n}\n\nfunction makeObservable(target, annotations, options) {\n initObservable(function () {\n var _annotations;\n var adm = asObservableObject(target, options)[$mobx];\n if ( true && annotations && target[storedAnnotationsSymbol]) {\n die(\"makeObservable second arg must be nullish when using decorators. Mixing @decorator syntax with annotations is not supported.\");\n }\n // Default to decorators\n (_annotations = annotations) != null ? _annotations : annotations = collectStoredAnnotations(target);\n // Annotate\n ownKeys(annotations).forEach(function (key) {\n return adm.make_(key, annotations[key]);\n });\n });\n return target;\n}\n// proto[keysSymbol] = new Set()\nvar keysSymbol = /*#__PURE__*/Symbol(\"mobx-keys\");\nfunction makeAutoObservable(target, overrides, options) {\n if (true) {\n if (!isPlainObject(target) && !isPlainObject(Object.getPrototypeOf(target))) {\n die(\"'makeAutoObservable' can only be used for classes that don't have a superclass\");\n }\n if (isObservableObject(target)) {\n die(\"makeAutoObservable can only be used on objects not already made observable\");\n }\n }\n // Optimization: avoid visiting protos\n // Assumes that annotation.make_/.extend_ works the same for plain objects\n if (isPlainObject(target)) {\n return extendObservable(target, target, overrides, options);\n }\n initObservable(function () {\n var adm = asObservableObject(target, options)[$mobx];\n // Optimization: cache keys on proto\n // Assumes makeAutoObservable can be called only once per object and can't be used in subclass\n if (!target[keysSymbol]) {\n var proto = Object.getPrototypeOf(target);\n var keys = new Set([].concat(ownKeys(target), ownKeys(proto)));\n keys[\"delete\"](\"constructor\");\n keys[\"delete\"]($mobx);\n addHiddenProp(proto, keysSymbol, keys);\n }\n target[keysSymbol].forEach(function (key) {\n return adm.make_(key,\n // must pass \"undefined\" for { key: undefined }\n !overrides ? true : key in overrides ? overrides[key] : true);\n });\n });\n return target;\n}\n\nvar SPLICE = \"splice\";\nvar UPDATE = \"update\";\nvar MAX_SPLICE_SIZE = 10000; // See e.g. https://github.com/mobxjs/mobx/issues/859\nvar arrayTraps = {\n get: function get(target, name) {\n var adm = target[$mobx];\n if (name === $mobx) {\n return adm;\n }\n if (name === \"length\") {\n return adm.getArrayLength_();\n }\n if (typeof name === \"string\" && !isNaN(name)) {\n return adm.get_(parseInt(name));\n }\n if (hasProp(arrayExtensions, name)) {\n return arrayExtensions[name];\n }\n return target[name];\n },\n set: function set(target, name, value) {\n var adm = target[$mobx];\n if (name === \"length\") {\n adm.setArrayLength_(value);\n }\n if (typeof name === \"symbol\" || isNaN(name)) {\n target[name] = value;\n } else {\n // numeric string\n adm.set_(parseInt(name), value);\n }\n return true;\n },\n preventExtensions: function preventExtensions() {\n die(15);\n }\n};\nvar ObservableArrayAdministration = /*#__PURE__*/function () {\n function ObservableArrayAdministration(name, enhancer, owned_, legacyMode_) {\n if (name === void 0) {\n name = true ? \"ObservableArray@\" + getNextId() : 0;\n }\n this.owned_ = void 0;\n this.legacyMode_ = void 0;\n this.atom_ = void 0;\n this.values_ = [];\n // this is the prop that gets proxied, so can't replace it!\n this.interceptors_ = void 0;\n this.changeListeners_ = void 0;\n this.enhancer_ = void 0;\n this.dehancer = void 0;\n this.proxy_ = void 0;\n this.lastKnownLength_ = 0;\n this.owned_ = owned_;\n this.legacyMode_ = legacyMode_;\n this.atom_ = new Atom(name);\n this.enhancer_ = function (newV, oldV) {\n return enhancer(newV, oldV, true ? name + \"[..]\" : 0);\n };\n }\n var _proto = ObservableArrayAdministration.prototype;\n _proto.dehanceValue_ = function dehanceValue_(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.dehanceValues_ = function dehanceValues_(values) {\n if (this.dehancer !== undefined && values.length > 0) {\n return values.map(this.dehancer);\n }\n return values;\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n if (fireImmediately === void 0) {\n fireImmediately = false;\n }\n if (fireImmediately) {\n listener({\n observableKind: \"array\",\n object: this.proxy_,\n debugObjectName: this.atom_.name_,\n type: \"splice\",\n index: 0,\n added: this.values_.slice(),\n addedCount: this.values_.length,\n removed: [],\n removedCount: 0\n });\n }\n return registerListener(this, listener);\n };\n _proto.getArrayLength_ = function getArrayLength_() {\n this.atom_.reportObserved();\n return this.values_.length;\n };\n _proto.setArrayLength_ = function setArrayLength_(newLength) {\n if (typeof newLength !== \"number\" || isNaN(newLength) || newLength < 0) {\n die(\"Out of range: \" + newLength);\n }\n var currentLength = this.values_.length;\n if (newLength === currentLength) {\n return;\n } else if (newLength > currentLength) {\n var newItems = new Array(newLength - currentLength);\n for (var i = 0; i < newLength - currentLength; i++) {\n newItems[i] = undefined;\n } // No Array.fill everywhere...\n this.spliceWithArray_(currentLength, 0, newItems);\n } else {\n this.spliceWithArray_(newLength, currentLength - newLength);\n }\n };\n _proto.updateArrayLength_ = function updateArrayLength_(oldLength, delta) {\n if (oldLength !== this.lastKnownLength_) {\n die(16);\n }\n this.lastKnownLength_ += delta;\n if (this.legacyMode_ && delta > 0) {\n reserveArrayBuffer(oldLength + delta + 1);\n }\n };\n _proto.spliceWithArray_ = function spliceWithArray_(index, deleteCount, newItems) {\n var _this = this;\n checkIfStateModificationsAreAllowed(this.atom_);\n var length = this.values_.length;\n if (index === undefined) {\n index = 0;\n } else if (index > length) {\n index = length;\n } else if (index < 0) {\n index = Math.max(0, length + index);\n }\n if (arguments.length === 1) {\n deleteCount = length - index;\n } else if (deleteCount === undefined || deleteCount === null) {\n deleteCount = 0;\n } else {\n deleteCount = Math.max(0, Math.min(deleteCount, length - index));\n }\n if (newItems === undefined) {\n newItems = EMPTY_ARRAY;\n }\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_,\n type: SPLICE,\n index: index,\n removedCount: deleteCount,\n added: newItems\n });\n if (!change) {\n return EMPTY_ARRAY;\n }\n deleteCount = change.removedCount;\n newItems = change.added;\n }\n newItems = newItems.length === 0 ? newItems : newItems.map(function (v) {\n return _this.enhancer_(v, undefined);\n });\n if (this.legacyMode_ || \"development\" !== \"production\") {\n var lengthDelta = newItems.length - deleteCount;\n this.updateArrayLength_(length, lengthDelta); // checks if internal array wasn't modified\n }\n var res = this.spliceItemsIntoValues_(index, deleteCount, newItems);\n if (deleteCount !== 0 || newItems.length !== 0) {\n this.notifyArraySplice_(index, newItems, res);\n }\n return this.dehanceValues_(res);\n };\n _proto.spliceItemsIntoValues_ = function spliceItemsIntoValues_(index, deleteCount, newItems) {\n if (newItems.length < MAX_SPLICE_SIZE) {\n var _this$values_;\n return (_this$values_ = this.values_).splice.apply(_this$values_, [index, deleteCount].concat(newItems));\n } else {\n // The items removed by the splice\n var res = this.values_.slice(index, index + deleteCount);\n // The items that that should remain at the end of the array\n var oldItems = this.values_.slice(index + deleteCount);\n // New length is the previous length + addition count - deletion count\n this.values_.length += newItems.length - deleteCount;\n for (var i = 0; i < newItems.length; i++) {\n this.values_[index + i] = newItems[i];\n }\n for (var _i = 0; _i < oldItems.length; _i++) {\n this.values_[index + newItems.length + _i] = oldItems[_i];\n }\n return res;\n }\n };\n _proto.notifyArrayChildUpdate_ = function notifyArrayChildUpdate_(index, newValue, oldValue) {\n var notifySpy = !this.owned_ && isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"array\",\n object: this.proxy_,\n type: UPDATE,\n debugObjectName: this.atom_.name_,\n index: index,\n newValue: newValue,\n oldValue: oldValue\n } : null;\n // The reason why this is on right hand side here (and not above), is this way the uglifier will drop it, but it won't\n // cause any runtime overhead in development mode without NODE_ENV set, unless spying is enabled\n if ( true && notifySpy) {\n spyReportStart(change);\n }\n this.atom_.reportChanged();\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n };\n _proto.notifyArraySplice_ = function notifyArraySplice_(index, added, removed) {\n var notifySpy = !this.owned_ && isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"array\",\n object: this.proxy_,\n debugObjectName: this.atom_.name_,\n type: SPLICE,\n index: index,\n removed: removed,\n added: added,\n removedCount: removed.length,\n addedCount: added.length\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n }\n this.atom_.reportChanged();\n // conform: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/observe\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n };\n _proto.get_ = function get_(index) {\n if (this.legacyMode_ && index >= this.values_.length) {\n console.warn( true ? \"[mobx.array] Attempt to read an array index (\" + index + \") that is out of bounds (\" + this.values_.length + \"). Please check length first. Out of bound indices will not be tracked by MobX\" : 0);\n return undefined;\n }\n this.atom_.reportObserved();\n return this.dehanceValue_(this.values_[index]);\n };\n _proto.set_ = function set_(index, newValue) {\n var values = this.values_;\n if (this.legacyMode_ && index > values.length) {\n // out of bounds\n die(17, index, values.length);\n }\n if (index < values.length) {\n // update at index in range\n checkIfStateModificationsAreAllowed(this.atom_);\n var oldValue = values[index];\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: UPDATE,\n object: this.proxy_,\n // since \"this\" is the real array we need to pass its proxy\n index: index,\n newValue: newValue\n });\n if (!change) {\n return;\n }\n newValue = change.newValue;\n }\n newValue = this.enhancer_(newValue, oldValue);\n var changed = newValue !== oldValue;\n if (changed) {\n values[index] = newValue;\n this.notifyArrayChildUpdate_(index, newValue, oldValue);\n }\n } else {\n // For out of bound index, we don't create an actual sparse array,\n // but rather fill the holes with undefined (same as setArrayLength_).\n // This could be considered a bug.\n var newItems = new Array(index + 1 - values.length);\n for (var i = 0; i < newItems.length - 1; i++) {\n newItems[i] = undefined;\n } // No Array.fill everywhere...\n newItems[newItems.length - 1] = newValue;\n this.spliceWithArray_(values.length, 0, newItems);\n }\n };\n return ObservableArrayAdministration;\n}();\nfunction createObservableArray(initialValues, enhancer, name, owned) {\n if (name === void 0) {\n name = true ? \"ObservableArray@\" + getNextId() : 0;\n }\n if (owned === void 0) {\n owned = false;\n }\n assertProxies();\n return initObservable(function () {\n var adm = new ObservableArrayAdministration(name, enhancer, owned, false);\n addHiddenFinalProp(adm.values_, $mobx, adm);\n var proxy = new Proxy(adm.values_, arrayTraps);\n adm.proxy_ = proxy;\n if (initialValues && initialValues.length) {\n adm.spliceWithArray_(0, 0, initialValues);\n }\n return proxy;\n });\n}\n// eslint-disable-next-line\nvar arrayExtensions = {\n clear: function clear() {\n return this.splice(0);\n },\n replace: function replace(newItems) {\n var adm = this[$mobx];\n return adm.spliceWithArray_(0, adm.values_.length, newItems);\n },\n // Used by JSON.stringify\n toJSON: function toJSON() {\n return this.slice();\n },\n /*\n * functions that do alter the internal structure of the array, (based on lib.es6.d.ts)\n * since these functions alter the inner structure of the array, the have side effects.\n * Because the have side effects, they should not be used in computed function,\n * and for that reason the do not call dependencyState.notifyObserved\n */\n splice: function splice(index, deleteCount) {\n for (var _len = arguments.length, newItems = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {\n newItems[_key - 2] = arguments[_key];\n }\n var adm = this[$mobx];\n switch (arguments.length) {\n case 0:\n return [];\n case 1:\n return adm.spliceWithArray_(index);\n case 2:\n return adm.spliceWithArray_(index, deleteCount);\n }\n return adm.spliceWithArray_(index, deleteCount, newItems);\n },\n spliceWithArray: function spliceWithArray(index, deleteCount, newItems) {\n return this[$mobx].spliceWithArray_(index, deleteCount, newItems);\n },\n push: function push() {\n var adm = this[$mobx];\n for (var _len2 = arguments.length, items = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n items[_key2] = arguments[_key2];\n }\n adm.spliceWithArray_(adm.values_.length, 0, items);\n return adm.values_.length;\n },\n pop: function pop() {\n return this.splice(Math.max(this[$mobx].values_.length - 1, 0), 1)[0];\n },\n shift: function shift() {\n return this.splice(0, 1)[0];\n },\n unshift: function unshift() {\n var adm = this[$mobx];\n for (var _len3 = arguments.length, items = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n items[_key3] = arguments[_key3];\n }\n adm.spliceWithArray_(0, 0, items);\n return adm.values_.length;\n },\n reverse: function reverse() {\n // reverse by default mutates in place before returning the result\n // which makes it both a 'derivation' and a 'mutation'.\n if (globalState.trackingDerivation) {\n die(37, \"reverse\");\n }\n this.replace(this.slice().reverse());\n return this;\n },\n sort: function sort() {\n // sort by default mutates in place before returning the result\n // which goes against all good practices. Let's not change the array in place!\n if (globalState.trackingDerivation) {\n die(37, \"sort\");\n }\n var copy = this.slice();\n copy.sort.apply(copy, arguments);\n this.replace(copy);\n return this;\n },\n remove: function remove(value) {\n var adm = this[$mobx];\n var idx = adm.dehanceValues_(adm.values_).indexOf(value);\n if (idx > -1) {\n this.splice(idx, 1);\n return true;\n }\n return false;\n }\n};\n/**\n * Wrap function from prototype\n * Without this, everything works as well, but this works\n * faster as everything works on unproxied values\n */\naddArrayExtension(\"at\", simpleFunc);\naddArrayExtension(\"concat\", simpleFunc);\naddArrayExtension(\"flat\", simpleFunc);\naddArrayExtension(\"includes\", simpleFunc);\naddArrayExtension(\"indexOf\", simpleFunc);\naddArrayExtension(\"join\", simpleFunc);\naddArrayExtension(\"lastIndexOf\", simpleFunc);\naddArrayExtension(\"slice\", simpleFunc);\naddArrayExtension(\"toString\", simpleFunc);\naddArrayExtension(\"toLocaleString\", simpleFunc);\naddArrayExtension(\"toSorted\", simpleFunc);\naddArrayExtension(\"toSpliced\", simpleFunc);\naddArrayExtension(\"with\", simpleFunc);\n// map\naddArrayExtension(\"every\", mapLikeFunc);\naddArrayExtension(\"filter\", mapLikeFunc);\naddArrayExtension(\"find\", mapLikeFunc);\naddArrayExtension(\"findIndex\", mapLikeFunc);\naddArrayExtension(\"findLast\", mapLikeFunc);\naddArrayExtension(\"findLastIndex\", mapLikeFunc);\naddArrayExtension(\"flatMap\", mapLikeFunc);\naddArrayExtension(\"forEach\", mapLikeFunc);\naddArrayExtension(\"map\", mapLikeFunc);\naddArrayExtension(\"some\", mapLikeFunc);\naddArrayExtension(\"toReversed\", mapLikeFunc);\n// reduce\naddArrayExtension(\"reduce\", reduceLikeFunc);\naddArrayExtension(\"reduceRight\", reduceLikeFunc);\nfunction addArrayExtension(funcName, funcFactory) {\n if (typeof Array.prototype[funcName] === \"function\") {\n arrayExtensions[funcName] = funcFactory(funcName);\n }\n}\n// Report and delegate to dehanced array\nfunction simpleFunc(funcName) {\n return function () {\n var adm = this[$mobx];\n adm.atom_.reportObserved();\n var dehancedValues = adm.dehanceValues_(adm.values_);\n return dehancedValues[funcName].apply(dehancedValues, arguments);\n };\n}\n// Make sure callbacks receive correct array arg #2326\nfunction mapLikeFunc(funcName) {\n return function (callback, thisArg) {\n var _this2 = this;\n var adm = this[$mobx];\n adm.atom_.reportObserved();\n var dehancedValues = adm.dehanceValues_(adm.values_);\n return dehancedValues[funcName](function (element, index) {\n return callback.call(thisArg, element, index, _this2);\n });\n };\n}\n// Make sure callbacks receive correct array arg #2326\nfunction reduceLikeFunc(funcName) {\n return function () {\n var _this3 = this;\n var adm = this[$mobx];\n adm.atom_.reportObserved();\n var dehancedValues = adm.dehanceValues_(adm.values_);\n // #2432 - reduce behavior depends on arguments.length\n var callback = arguments[0];\n arguments[0] = function (accumulator, currentValue, index) {\n return callback(accumulator, currentValue, index, _this3);\n };\n return dehancedValues[funcName].apply(dehancedValues, arguments);\n };\n}\nvar isObservableArrayAdministration = /*#__PURE__*/createInstanceofPredicate(\"ObservableArrayAdministration\", ObservableArrayAdministration);\nfunction isObservableArray(thing) {\n return isObject(thing) && isObservableArrayAdministration(thing[$mobx]);\n}\n\nvar ObservableMapMarker = {};\nvar ADD = \"add\";\nvar DELETE = \"delete\";\n// just extend Map? See also https://gist.github.com/nestharus/13b4d74f2ef4a2f4357dbd3fc23c1e54\n// But: https://github.com/mobxjs/mobx/issues/1556\nvar ObservableMap = /*#__PURE__*/function () {\n function ObservableMap(initialData, enhancer_, name_) {\n var _this = this;\n if (enhancer_ === void 0) {\n enhancer_ = deepEnhancer;\n }\n if (name_ === void 0) {\n name_ = true ? \"ObservableMap@\" + getNextId() : 0;\n }\n this.enhancer_ = void 0;\n this.name_ = void 0;\n this[$mobx] = ObservableMapMarker;\n this.data_ = void 0;\n this.hasMap_ = void 0;\n // hasMap, not hashMap >-).\n this.keysAtom_ = void 0;\n this.interceptors_ = void 0;\n this.changeListeners_ = void 0;\n this.dehancer = void 0;\n this.enhancer_ = enhancer_;\n this.name_ = name_;\n if (!isFunction(Map)) {\n die(18);\n }\n initObservable(function () {\n _this.keysAtom_ = createAtom( true ? _this.name_ + \".keys()\" : 0);\n _this.data_ = new Map();\n _this.hasMap_ = new Map();\n if (initialData) {\n _this.merge(initialData);\n }\n });\n }\n var _proto = ObservableMap.prototype;\n _proto.has_ = function has_(key) {\n return this.data_.has(key);\n };\n _proto.has = function has(key) {\n var _this2 = this;\n if (!globalState.trackingDerivation) {\n return this.has_(key);\n }\n var entry = this.hasMap_.get(key);\n if (!entry) {\n var newEntry = entry = new ObservableValue(this.has_(key), referenceEnhancer, true ? this.name_ + \".\" + stringifyKey(key) + \"?\" : 0, false);\n this.hasMap_.set(key, newEntry);\n onBecomeUnobserved(newEntry, function () {\n return _this2.hasMap_[\"delete\"](key);\n });\n }\n return entry.get();\n };\n _proto.set = function set(key, value) {\n var hasKey = this.has_(key);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: hasKey ? UPDATE : ADD,\n object: this,\n newValue: value,\n name: key\n });\n if (!change) {\n return this;\n }\n value = change.newValue;\n }\n if (hasKey) {\n this.updateValue_(key, value);\n } else {\n this.addValue_(key, value);\n }\n return this;\n };\n _proto[\"delete\"] = function _delete(key) {\n var _this3 = this;\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: DELETE,\n object: this,\n name: key\n });\n if (!change) {\n return false;\n }\n }\n if (this.has_(key)) {\n var notifySpy = isSpyEnabled();\n var notify = hasListeners(this);\n var _change = notify || notifySpy ? {\n observableKind: \"map\",\n debugObjectName: this.name_,\n type: DELETE,\n object: this,\n oldValue: this.data_.get(key).value_,\n name: key\n } : null;\n if ( true && notifySpy) {\n spyReportStart(_change);\n } // TODO fix type\n transaction(function () {\n var _this3$hasMap_$get;\n _this3.keysAtom_.reportChanged();\n (_this3$hasMap_$get = _this3.hasMap_.get(key)) == null || _this3$hasMap_$get.setNewValue_(false);\n var observable = _this3.data_.get(key);\n observable.setNewValue_(undefined);\n _this3.data_[\"delete\"](key);\n });\n if (notify) {\n notifyListeners(this, _change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n return true;\n }\n return false;\n };\n _proto.updateValue_ = function updateValue_(key, newValue) {\n var observable = this.data_.get(key);\n newValue = observable.prepareNewValue_(newValue);\n if (newValue !== globalState.UNCHANGED) {\n var notifySpy = isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"map\",\n debugObjectName: this.name_,\n type: UPDATE,\n object: this,\n oldValue: observable.value_,\n name: key,\n newValue: newValue\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n } // TODO fix type\n observable.setNewValue_(newValue);\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n };\n _proto.addValue_ = function addValue_(key, newValue) {\n var _this4 = this;\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n transaction(function () {\n var _this4$hasMap_$get;\n var observable = new ObservableValue(newValue, _this4.enhancer_, true ? _this4.name_ + \".\" + stringifyKey(key) : 0, false);\n _this4.data_.set(key, observable);\n newValue = observable.value_; // value might have been changed\n (_this4$hasMap_$get = _this4.hasMap_.get(key)) == null || _this4$hasMap_$get.setNewValue_(true);\n _this4.keysAtom_.reportChanged();\n });\n var notifySpy = isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"map\",\n debugObjectName: this.name_,\n type: ADD,\n object: this,\n name: key,\n newValue: newValue\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n } // TODO fix type\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n };\n _proto.get = function get(key) {\n if (this.has(key)) {\n return this.dehanceValue_(this.data_.get(key).get());\n }\n return this.dehanceValue_(undefined);\n };\n _proto.dehanceValue_ = function dehanceValue_(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.keys = function keys() {\n this.keysAtom_.reportObserved();\n return this.data_.keys();\n };\n _proto.values = function values() {\n var self = this;\n var keys = this.keys();\n return makeIterable({\n next: function next() {\n var _keys$next = keys.next(),\n done = _keys$next.done,\n value = _keys$next.value;\n return {\n done: done,\n value: done ? undefined : self.get(value)\n };\n }\n });\n };\n _proto.entries = function entries() {\n var self = this;\n var keys = this.keys();\n return makeIterable({\n next: function next() {\n var _keys$next2 = keys.next(),\n done = _keys$next2.done,\n value = _keys$next2.value;\n return {\n done: done,\n value: done ? undefined : [value, self.get(value)]\n };\n }\n });\n };\n _proto[Symbol.iterator] = function () {\n return this.entries();\n };\n _proto.forEach = function forEach(callback, thisArg) {\n for (var _iterator = _createForOfIteratorHelperLoose(this), _step; !(_step = _iterator()).done;) {\n var _step$value = _step.value,\n key = _step$value[0],\n value = _step$value[1];\n callback.call(thisArg, value, key, this);\n }\n }\n /** Merge another object into this object, returns this. */;\n _proto.merge = function merge(other) {\n var _this5 = this;\n if (isObservableMap(other)) {\n other = new Map(other);\n }\n transaction(function () {\n if (isPlainObject(other)) {\n getPlainObjectKeys(other).forEach(function (key) {\n return _this5.set(key, other[key]);\n });\n } else if (Array.isArray(other)) {\n other.forEach(function (_ref) {\n var key = _ref[0],\n value = _ref[1];\n return _this5.set(key, value);\n });\n } else if (isES6Map(other)) {\n if (!isPlainES6Map(other)) {\n die(19, other);\n }\n other.forEach(function (value, key) {\n return _this5.set(key, value);\n });\n } else if (other !== null && other !== undefined) {\n die(20, other);\n }\n });\n return this;\n };\n _proto.clear = function clear() {\n var _this6 = this;\n transaction(function () {\n untracked(function () {\n for (var _iterator2 = _createForOfIteratorHelperLoose(_this6.keys()), _step2; !(_step2 = _iterator2()).done;) {\n var key = _step2.value;\n _this6[\"delete\"](key);\n }\n });\n });\n };\n _proto.replace = function replace(values) {\n var _this7 = this;\n // Implementation requirements:\n // - respect ordering of replacement map\n // - allow interceptors to run and potentially prevent individual operations\n // - don't recreate observables that already exist in original map (so we don't destroy existing subscriptions)\n // - don't _keysAtom.reportChanged if the keys of resulting map are indentical (order matters!)\n // - note that result map may differ from replacement map due to the interceptors\n transaction(function () {\n // Convert to map so we can do quick key lookups\n var replacementMap = convertToMap(values);\n var orderedData = new Map();\n // Used for optimization\n var keysReportChangedCalled = false;\n // Delete keys that don't exist in replacement map\n // if the key deletion is prevented by interceptor\n // add entry at the beginning of the result map\n for (var _iterator3 = _createForOfIteratorHelperLoose(_this7.data_.keys()), _step3; !(_step3 = _iterator3()).done;) {\n var key = _step3.value;\n // Concurrently iterating/deleting keys\n // iterator should handle this correctly\n if (!replacementMap.has(key)) {\n var deleted = _this7[\"delete\"](key);\n // Was the key removed?\n if (deleted) {\n // _keysAtom.reportChanged() was already called\n keysReportChangedCalled = true;\n } else {\n // Delete prevented by interceptor\n var value = _this7.data_.get(key);\n orderedData.set(key, value);\n }\n }\n }\n // Merge entries\n for (var _iterator4 = _createForOfIteratorHelperLoose(replacementMap.entries()), _step4; !(_step4 = _iterator4()).done;) {\n var _step4$value = _step4.value,\n _key = _step4$value[0],\n _value = _step4$value[1];\n // We will want to know whether a new key is added\n var keyExisted = _this7.data_.has(_key);\n // Add or update value\n _this7.set(_key, _value);\n // The addition could have been prevent by interceptor\n if (_this7.data_.has(_key)) {\n // The update could have been prevented by interceptor\n // and also we want to preserve existing values\n // so use value from _data map (instead of replacement map)\n var _value2 = _this7.data_.get(_key);\n orderedData.set(_key, _value2);\n // Was a new key added?\n if (!keyExisted) {\n // _keysAtom.reportChanged() was already called\n keysReportChangedCalled = true;\n }\n }\n }\n // Check for possible key order change\n if (!keysReportChangedCalled) {\n if (_this7.data_.size !== orderedData.size) {\n // If size differs, keys are definitely modified\n _this7.keysAtom_.reportChanged();\n } else {\n var iter1 = _this7.data_.keys();\n var iter2 = orderedData.keys();\n var next1 = iter1.next();\n var next2 = iter2.next();\n while (!next1.done) {\n if (next1.value !== next2.value) {\n _this7.keysAtom_.reportChanged();\n break;\n }\n next1 = iter1.next();\n next2 = iter2.next();\n }\n }\n }\n // Use correctly ordered map\n _this7.data_ = orderedData;\n });\n return this;\n };\n _proto.toString = function toString() {\n return \"[object ObservableMap]\";\n };\n _proto.toJSON = function toJSON() {\n return Array.from(this);\n };\n /**\n * Observes this object. Triggers for the events 'add', 'update' and 'delete'.\n * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe\n * for callback details\n */\n _proto.observe_ = function observe_(listener, fireImmediately) {\n if ( true && fireImmediately === true) {\n die(\"`observe` doesn't support fireImmediately=true in combination with maps.\");\n }\n return registerListener(this, listener);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n return _createClass(ObservableMap, [{\n key: \"size\",\n get: function get() {\n this.keysAtom_.reportObserved();\n return this.data_.size;\n }\n }, {\n key: Symbol.toStringTag,\n get: function get() {\n return \"Map\";\n }\n }]);\n}();\n// eslint-disable-next-line\nvar isObservableMap = /*#__PURE__*/createInstanceofPredicate(\"ObservableMap\", ObservableMap);\nfunction convertToMap(dataStructure) {\n if (isES6Map(dataStructure) || isObservableMap(dataStructure)) {\n return dataStructure;\n } else if (Array.isArray(dataStructure)) {\n return new Map(dataStructure);\n } else if (isPlainObject(dataStructure)) {\n var map = new Map();\n for (var key in dataStructure) {\n map.set(key, dataStructure[key]);\n }\n return map;\n } else {\n return die(21, dataStructure);\n }\n}\n\nvar ObservableSetMarker = {};\nvar ObservableSet = /*#__PURE__*/function () {\n function ObservableSet(initialData, enhancer, name_) {\n var _this = this;\n if (enhancer === void 0) {\n enhancer = deepEnhancer;\n }\n if (name_ === void 0) {\n name_ = true ? \"ObservableSet@\" + getNextId() : 0;\n }\n this.name_ = void 0;\n this[$mobx] = ObservableSetMarker;\n this.data_ = new Set();\n this.atom_ = void 0;\n this.changeListeners_ = void 0;\n this.interceptors_ = void 0;\n this.dehancer = void 0;\n this.enhancer_ = void 0;\n this.name_ = name_;\n if (!isFunction(Set)) {\n die(22);\n }\n this.enhancer_ = function (newV, oldV) {\n return enhancer(newV, oldV, name_);\n };\n initObservable(function () {\n _this.atom_ = createAtom(_this.name_);\n if (initialData) {\n _this.replace(initialData);\n }\n });\n }\n var _proto = ObservableSet.prototype;\n _proto.dehanceValue_ = function dehanceValue_(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.clear = function clear() {\n var _this2 = this;\n transaction(function () {\n untracked(function () {\n for (var _iterator = _createForOfIteratorHelperLoose(_this2.data_.values()), _step; !(_step = _iterator()).done;) {\n var value = _step.value;\n _this2[\"delete\"](value);\n }\n });\n });\n };\n _proto.forEach = function forEach(callbackFn, thisArg) {\n for (var _iterator2 = _createForOfIteratorHelperLoose(this), _step2; !(_step2 = _iterator2()).done;) {\n var value = _step2.value;\n callbackFn.call(thisArg, value, value, this);\n }\n };\n _proto.add = function add(value) {\n var _this3 = this;\n checkIfStateModificationsAreAllowed(this.atom_);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: ADD,\n object: this,\n newValue: value\n });\n if (!change) {\n return this;\n }\n // ideally, value = change.value would be done here, so that values can be\n // changed by interceptor. Same applies for other Set and Map api's.\n }\n if (!this.has(value)) {\n transaction(function () {\n _this3.data_.add(_this3.enhancer_(value, undefined));\n _this3.atom_.reportChanged();\n });\n var notifySpy = true && isSpyEnabled();\n var notify = hasListeners(this);\n var _change = notify || notifySpy ? {\n observableKind: \"set\",\n debugObjectName: this.name_,\n type: ADD,\n object: this,\n newValue: value\n } : null;\n if (notifySpy && \"development\" !== \"production\") {\n spyReportStart(_change);\n }\n if (notify) {\n notifyListeners(this, _change);\n }\n if (notifySpy && \"development\" !== \"production\") {\n spyReportEnd();\n }\n }\n return this;\n };\n _proto[\"delete\"] = function _delete(value) {\n var _this4 = this;\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: DELETE,\n object: this,\n oldValue: value\n });\n if (!change) {\n return false;\n }\n }\n if (this.has(value)) {\n var notifySpy = true && isSpyEnabled();\n var notify = hasListeners(this);\n var _change2 = notify || notifySpy ? {\n observableKind: \"set\",\n debugObjectName: this.name_,\n type: DELETE,\n object: this,\n oldValue: value\n } : null;\n if (notifySpy && \"development\" !== \"production\") {\n spyReportStart(_change2);\n }\n transaction(function () {\n _this4.atom_.reportChanged();\n _this4.data_[\"delete\"](value);\n });\n if (notify) {\n notifyListeners(this, _change2);\n }\n if (notifySpy && \"development\" !== \"production\") {\n spyReportEnd();\n }\n return true;\n }\n return false;\n };\n _proto.has = function has(value) {\n this.atom_.reportObserved();\n return this.data_.has(this.dehanceValue_(value));\n };\n _proto.entries = function entries() {\n var nextIndex = 0;\n var keys = Array.from(this.keys());\n var values = Array.from(this.values());\n return makeIterable({\n next: function next() {\n var index = nextIndex;\n nextIndex += 1;\n return index < values.length ? {\n value: [keys[index], values[index]],\n done: false\n } : {\n done: true\n };\n }\n });\n };\n _proto.keys = function keys() {\n return this.values();\n };\n _proto.values = function values() {\n this.atom_.reportObserved();\n var self = this;\n var nextIndex = 0;\n var observableValues = Array.from(this.data_.values());\n return makeIterable({\n next: function next() {\n return nextIndex < observableValues.length ? {\n value: self.dehanceValue_(observableValues[nextIndex++]),\n done: false\n } : {\n done: true\n };\n }\n });\n };\n _proto.intersection = function intersection(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.intersection(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.intersection(otherSet);\n }\n };\n _proto.union = function union(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.union(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.union(otherSet);\n }\n };\n _proto.difference = function difference(otherSet) {\n return new Set(this).difference(otherSet);\n };\n _proto.symmetricDifference = function symmetricDifference(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.symmetricDifference(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.symmetricDifference(otherSet);\n }\n };\n _proto.isSubsetOf = function isSubsetOf(otherSet) {\n return new Set(this).isSubsetOf(otherSet);\n };\n _proto.isSupersetOf = function isSupersetOf(otherSet) {\n return new Set(this).isSupersetOf(otherSet);\n };\n _proto.isDisjointFrom = function isDisjointFrom(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.isDisjointFrom(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.isDisjointFrom(otherSet);\n }\n };\n _proto.replace = function replace(other) {\n var _this5 = this;\n if (isObservableSet(other)) {\n other = new Set(other);\n }\n transaction(function () {\n if (Array.isArray(other)) {\n _this5.clear();\n other.forEach(function (value) {\n return _this5.add(value);\n });\n } else if (isES6Set(other)) {\n _this5.clear();\n other.forEach(function (value) {\n return _this5.add(value);\n });\n } else if (other !== null && other !== undefined) {\n die(\"Cannot initialize set from \" + other);\n }\n });\n return this;\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n // ... 'fireImmediately' could also be true?\n if ( true && fireImmediately === true) {\n die(\"`observe` doesn't support fireImmediately=true in combination with sets.\");\n }\n return registerListener(this, listener);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.toJSON = function toJSON() {\n return Array.from(this);\n };\n _proto.toString = function toString() {\n return \"[object ObservableSet]\";\n };\n _proto[Symbol.iterator] = function () {\n return this.values();\n };\n return _createClass(ObservableSet, [{\n key: \"size\",\n get: function get() {\n this.atom_.reportObserved();\n return this.data_.size;\n }\n }, {\n key: Symbol.toStringTag,\n get: function get() {\n return \"Set\";\n }\n }]);\n}();\n// eslint-disable-next-line\nvar isObservableSet = /*#__PURE__*/createInstanceofPredicate(\"ObservableSet\", ObservableSet);\n\nvar descriptorCache = /*#__PURE__*/Object.create(null);\nvar REMOVE = \"remove\";\nvar ObservableObjectAdministration = /*#__PURE__*/function () {\n function ObservableObjectAdministration(target_, values_, name_,\n // Used anytime annotation is not explicitely provided\n defaultAnnotation_) {\n if (values_ === void 0) {\n values_ = new Map();\n }\n if (defaultAnnotation_ === void 0) {\n defaultAnnotation_ = autoAnnotation;\n }\n this.target_ = void 0;\n this.values_ = void 0;\n this.name_ = void 0;\n this.defaultAnnotation_ = void 0;\n this.keysAtom_ = void 0;\n this.changeListeners_ = void 0;\n this.interceptors_ = void 0;\n this.proxy_ = void 0;\n this.isPlainObject_ = void 0;\n this.appliedAnnotations_ = void 0;\n this.pendingKeys_ = void 0;\n this.target_ = target_;\n this.values_ = values_;\n this.name_ = name_;\n this.defaultAnnotation_ = defaultAnnotation_;\n this.keysAtom_ = new Atom( true ? this.name_ + \".keys\" : 0);\n // Optimization: we use this frequently\n this.isPlainObject_ = isPlainObject(this.target_);\n if ( true && !isAnnotation(this.defaultAnnotation_)) {\n die(\"defaultAnnotation must be valid annotation\");\n }\n if (true) {\n // Prepare structure for tracking which fields were already annotated\n this.appliedAnnotations_ = {};\n }\n }\n var _proto = ObservableObjectAdministration.prototype;\n _proto.getObservablePropValue_ = function getObservablePropValue_(key) {\n return this.values_.get(key).get();\n };\n _proto.setObservablePropValue_ = function setObservablePropValue_(key, newValue) {\n var observable = this.values_.get(key);\n if (observable instanceof ComputedValue) {\n observable.set(newValue);\n return true;\n }\n // intercept\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: UPDATE,\n object: this.proxy_ || this.target_,\n name: key,\n newValue: newValue\n });\n if (!change) {\n return null;\n }\n newValue = change.newValue;\n }\n newValue = observable.prepareNewValue_(newValue);\n // notify spy & observers\n if (newValue !== globalState.UNCHANGED) {\n var notify = hasListeners(this);\n var notifySpy = true && isSpyEnabled();\n var _change = notify || notifySpy ? {\n type: UPDATE,\n observableKind: \"object\",\n debugObjectName: this.name_,\n object: this.proxy_ || this.target_,\n oldValue: observable.value_,\n name: key,\n newValue: newValue\n } : null;\n if ( true && notifySpy) {\n spyReportStart(_change);\n }\n observable.setNewValue_(newValue);\n if (notify) {\n notifyListeners(this, _change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n return true;\n };\n _proto.get_ = function get_(key) {\n if (globalState.trackingDerivation && !hasProp(this.target_, key)) {\n // Key doesn't exist yet, subscribe for it in case it's added later\n this.has_(key);\n }\n return this.target_[key];\n }\n /**\n * @param {PropertyKey} key\n * @param {any} value\n * @param {Annotation|boolean} annotation true - use default annotation, false - copy as is\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.set_ = function set_(key, value, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n // Don't use .has(key) - we care about own\n if (hasProp(this.target_, key)) {\n // Existing prop\n if (this.values_.has(key)) {\n // Observable (can be intercepted)\n return this.setObservablePropValue_(key, value);\n } else if (proxyTrap) {\n // Non-observable - proxy\n return Reflect.set(this.target_, key, value);\n } else {\n // Non-observable\n this.target_[key] = value;\n return true;\n }\n } else {\n // New prop\n return this.extend_(key, {\n value: value,\n enumerable: true,\n writable: true,\n configurable: true\n }, this.defaultAnnotation_, proxyTrap);\n }\n }\n // Trap for \"in\"\n ;\n _proto.has_ = function has_(key) {\n if (!globalState.trackingDerivation) {\n // Skip key subscription outside derivation\n return key in this.target_;\n }\n this.pendingKeys_ || (this.pendingKeys_ = new Map());\n var entry = this.pendingKeys_.get(key);\n if (!entry) {\n entry = new ObservableValue(key in this.target_, referenceEnhancer, true ? this.name_ + \".\" + stringifyKey(key) + \"?\" : 0, false);\n this.pendingKeys_.set(key, entry);\n }\n return entry.get();\n }\n /**\n * @param {PropertyKey} key\n * @param {Annotation|boolean} annotation true - use default annotation, false - ignore prop\n */;\n _proto.make_ = function make_(key, annotation) {\n if (annotation === true) {\n annotation = this.defaultAnnotation_;\n }\n if (annotation === false) {\n return;\n }\n assertAnnotable(this, annotation, key);\n if (!(key in this.target_)) {\n var _this$target_$storedA;\n // Throw on missing key, except for decorators:\n // Decorator annotations are collected from whole prototype chain.\n // When called from super() some props may not exist yet.\n // However we don't have to worry about missing prop,\n // because the decorator must have been applied to something.\n if ((_this$target_$storedA = this.target_[storedAnnotationsSymbol]) != null && _this$target_$storedA[key]) {\n return; // will be annotated by subclass constructor\n } else {\n die(1, annotation.annotationType_, this.name_ + \".\" + key.toString());\n }\n }\n var source = this.target_;\n while (source && source !== objectPrototype) {\n var descriptor = getDescriptor(source, key);\n if (descriptor) {\n var outcome = annotation.make_(this, key, descriptor, source);\n if (outcome === 0 /* MakeResult.Cancel */) {\n return;\n }\n if (outcome === 1 /* MakeResult.Break */) {\n break;\n }\n }\n source = Object.getPrototypeOf(source);\n }\n recordAnnotationApplied(this, annotation, key);\n }\n /**\n * @param {PropertyKey} key\n * @param {PropertyDescriptor} descriptor\n * @param {Annotation|boolean} annotation true - use default annotation, false - copy as is\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.extend_ = function extend_(key, descriptor, annotation, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n if (annotation === true) {\n annotation = this.defaultAnnotation_;\n }\n if (annotation === false) {\n return this.defineProperty_(key, descriptor, proxyTrap);\n }\n assertAnnotable(this, annotation, key);\n var outcome = annotation.extend_(this, key, descriptor, proxyTrap);\n if (outcome) {\n recordAnnotationApplied(this, annotation, key);\n }\n return outcome;\n }\n /**\n * @param {PropertyKey} key\n * @param {PropertyDescriptor} descriptor\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.defineProperty_ = function defineProperty_(key, descriptor, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n try {\n startBatch();\n // Delete\n var deleteOutcome = this.delete_(key);\n if (!deleteOutcome) {\n // Failure or intercepted\n return deleteOutcome;\n }\n // ADD interceptor\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: ADD,\n newValue: descriptor.value\n });\n if (!change) {\n return null;\n }\n var newValue = change.newValue;\n if (descriptor.value !== newValue) {\n descriptor = _extends({}, descriptor, {\n value: newValue\n });\n }\n }\n // Define\n if (proxyTrap) {\n if (!Reflect.defineProperty(this.target_, key, descriptor)) {\n return false;\n }\n } else {\n defineProperty(this.target_, key, descriptor);\n }\n // Notify\n this.notifyPropertyAddition_(key, descriptor.value);\n } finally {\n endBatch();\n }\n return true;\n }\n // If original descriptor becomes relevant, move this to annotation directly\n ;\n _proto.defineObservableProperty_ = function defineObservableProperty_(key, value, enhancer, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n try {\n startBatch();\n // Delete\n var deleteOutcome = this.delete_(key);\n if (!deleteOutcome) {\n // Failure or intercepted\n return deleteOutcome;\n }\n // ADD interceptor\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: ADD,\n newValue: value\n });\n if (!change) {\n return null;\n }\n value = change.newValue;\n }\n var cachedDescriptor = getCachedObservablePropDescriptor(key);\n var descriptor = {\n configurable: globalState.safeDescriptors ? this.isPlainObject_ : true,\n enumerable: true,\n get: cachedDescriptor.get,\n set: cachedDescriptor.set\n };\n // Define\n if (proxyTrap) {\n if (!Reflect.defineProperty(this.target_, key, descriptor)) {\n return false;\n }\n } else {\n defineProperty(this.target_, key, descriptor);\n }\n var observable = new ObservableValue(value, enhancer, true ? this.name_ + \".\" + key.toString() : 0, false);\n this.values_.set(key, observable);\n // Notify (value possibly changed by ObservableValue)\n this.notifyPropertyAddition_(key, observable.value_);\n } finally {\n endBatch();\n }\n return true;\n }\n // If original descriptor becomes relevant, move this to annotation directly\n ;\n _proto.defineComputedProperty_ = function defineComputedProperty_(key, options, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n try {\n startBatch();\n // Delete\n var deleteOutcome = this.delete_(key);\n if (!deleteOutcome) {\n // Failure or intercepted\n return deleteOutcome;\n }\n // ADD interceptor\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: ADD,\n newValue: undefined\n });\n if (!change) {\n return null;\n }\n }\n options.name || (options.name = true ? this.name_ + \".\" + key.toString() : 0);\n options.context = this.proxy_ || this.target_;\n var cachedDescriptor = getCachedObservablePropDescriptor(key);\n var descriptor = {\n configurable: globalState.safeDescriptors ? this.isPlainObject_ : true,\n enumerable: false,\n get: cachedDescriptor.get,\n set: cachedDescriptor.set\n };\n // Define\n if (proxyTrap) {\n if (!Reflect.defineProperty(this.target_, key, descriptor)) {\n return false;\n }\n } else {\n defineProperty(this.target_, key, descriptor);\n }\n this.values_.set(key, new ComputedValue(options));\n // Notify\n this.notifyPropertyAddition_(key, undefined);\n } finally {\n endBatch();\n }\n return true;\n }\n /**\n * @param {PropertyKey} key\n * @param {PropertyDescriptor} descriptor\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.delete_ = function delete_(key, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n // No such prop\n if (!hasProp(this.target_, key)) {\n return true;\n }\n // Intercept\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: REMOVE\n });\n // Cancelled\n if (!change) {\n return null;\n }\n }\n // Delete\n try {\n var _this$pendingKeys_;\n startBatch();\n var notify = hasListeners(this);\n var notifySpy = true && isSpyEnabled();\n var observable = this.values_.get(key);\n // Value needed for spies/listeners\n var value = undefined;\n // Optimization: don't pull the value unless we will need it\n if (!observable && (notify || notifySpy)) {\n var _getDescriptor;\n value = (_getDescriptor = getDescriptor(this.target_, key)) == null ? void 0 : _getDescriptor.value;\n }\n // delete prop (do first, may fail)\n if (proxyTrap) {\n if (!Reflect.deleteProperty(this.target_, key)) {\n return false;\n }\n } else {\n delete this.target_[key];\n }\n // Allow re-annotating this field\n if (true) {\n delete this.appliedAnnotations_[key];\n }\n // Clear observable\n if (observable) {\n this.values_[\"delete\"](key);\n // for computed, value is undefined\n if (observable instanceof ObservableValue) {\n value = observable.value_;\n }\n // Notify: autorun(() => obj[key]), see #1796\n propagateChanged(observable);\n }\n // Notify \"keys/entries/values\" observers\n this.keysAtom_.reportChanged();\n // Notify \"has\" observers\n // \"in\" as it may still exist in proto\n (_this$pendingKeys_ = this.pendingKeys_) == null || (_this$pendingKeys_ = _this$pendingKeys_.get(key)) == null || _this$pendingKeys_.set(key in this.target_);\n // Notify spies/listeners\n if (notify || notifySpy) {\n var _change2 = {\n type: REMOVE,\n observableKind: \"object\",\n object: this.proxy_ || this.target_,\n debugObjectName: this.name_,\n oldValue: value,\n name: key\n };\n if ( true && notifySpy) {\n spyReportStart(_change2);\n }\n if (notify) {\n notifyListeners(this, _change2);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n } finally {\n endBatch();\n }\n return true;\n }\n /**\n * Observes this object. Triggers for the events 'add', 'update' and 'delete'.\n * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe\n * for callback details\n */;\n _proto.observe_ = function observe_(callback, fireImmediately) {\n if ( true && fireImmediately === true) {\n die(\"`observe` doesn't support the fire immediately property for observable objects.\");\n }\n return registerListener(this, callback);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.notifyPropertyAddition_ = function notifyPropertyAddition_(key, value) {\n var _this$pendingKeys_2;\n var notify = hasListeners(this);\n var notifySpy = true && isSpyEnabled();\n if (notify || notifySpy) {\n var change = notify || notifySpy ? {\n type: ADD,\n observableKind: \"object\",\n debugObjectName: this.name_,\n object: this.proxy_ || this.target_,\n name: key,\n newValue: value\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n }\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n (_this$pendingKeys_2 = this.pendingKeys_) == null || (_this$pendingKeys_2 = _this$pendingKeys_2.get(key)) == null || _this$pendingKeys_2.set(true);\n // Notify \"keys/entries/values\" observers\n this.keysAtom_.reportChanged();\n };\n _proto.ownKeys_ = function ownKeys_() {\n this.keysAtom_.reportObserved();\n return ownKeys(this.target_);\n };\n _proto.keys_ = function keys_() {\n // Returns enumerable && own, but unfortunately keysAtom will report on ANY key change.\n // There is no way to distinguish between Object.keys(object) and Reflect.ownKeys(object) - both are handled by ownKeys trap.\n // We can either over-report in Object.keys(object) or under-report in Reflect.ownKeys(object)\n // We choose to over-report in Object.keys(object), because:\n // - typically it's used with simple data objects\n // - when symbolic/non-enumerable keys are relevant Reflect.ownKeys works as expected\n this.keysAtom_.reportObserved();\n return Object.keys(this.target_);\n };\n return ObservableObjectAdministration;\n}();\nfunction asObservableObject(target, options) {\n var _options$name;\n if ( true && options && isObservableObject(target)) {\n die(\"Options can't be provided for already observable objects.\");\n }\n if (hasProp(target, $mobx)) {\n if ( true && !(getAdministration(target) instanceof ObservableObjectAdministration)) {\n die(\"Cannot convert '\" + getDebugName(target) + \"' into observable object:\" + \"\\nThe target is already observable of different type.\" + \"\\nExtending builtins is not supported.\");\n }\n return target;\n }\n if ( true && !Object.isExtensible(target)) {\n die(\"Cannot make the designated object observable; it is not extensible\");\n }\n var name = (_options$name = options == null ? void 0 : options.name) != null ? _options$name : true ? (isPlainObject(target) ? \"ObservableObject\" : target.constructor.name) + \"@\" + getNextId() : 0;\n var adm = new ObservableObjectAdministration(target, new Map(), String(name), getAnnotationFromOptions(options));\n addHiddenProp(target, $mobx, adm);\n return target;\n}\nvar isObservableObjectAdministration = /*#__PURE__*/createInstanceofPredicate(\"ObservableObjectAdministration\", ObservableObjectAdministration);\nfunction getCachedObservablePropDescriptor(key) {\n return descriptorCache[key] || (descriptorCache[key] = {\n get: function get() {\n return this[$mobx].getObservablePropValue_(key);\n },\n set: function set(value) {\n return this[$mobx].setObservablePropValue_(key, value);\n }\n });\n}\nfunction isObservableObject(thing) {\n if (isObject(thing)) {\n return isObservableObjectAdministration(thing[$mobx]);\n }\n return false;\n}\nfunction recordAnnotationApplied(adm, annotation, key) {\n var _adm$target_$storedAn;\n if (true) {\n adm.appliedAnnotations_[key] = annotation;\n }\n // Remove applied decorator annotation so we don't try to apply it again in subclass constructor\n (_adm$target_$storedAn = adm.target_[storedAnnotationsSymbol]) == null || delete _adm$target_$storedAn[key];\n}\nfunction assertAnnotable(adm, annotation, key) {\n // Valid annotation\n if ( true && !isAnnotation(annotation)) {\n die(\"Cannot annotate '\" + adm.name_ + \".\" + key.toString() + \"': Invalid annotation.\");\n }\n /*\n // Configurable, not sealed, not frozen\n // Possibly not needed, just a little better error then the one thrown by engine.\n // Cases where this would be useful the most (subclass field initializer) are not interceptable by this.\n if (__DEV__) {\n const configurable = getDescriptor(adm.target_, key)?.configurable\n const frozen = Object.isFrozen(adm.target_)\n const sealed = Object.isSealed(adm.target_)\n if (!configurable || frozen || sealed) {\n const fieldName = `${adm.name_}.${key.toString()}`\n const requestedAnnotationType = annotation.annotationType_\n let error = `Cannot apply '${requestedAnnotationType}' to '${fieldName}':`\n if (frozen) {\n error += `\\nObject is frozen.`\n }\n if (sealed) {\n error += `\\nObject is sealed.`\n }\n if (!configurable) {\n error += `\\nproperty is not configurable.`\n // Mention only if caused by us to avoid confusion\n if (hasProp(adm.appliedAnnotations!, key)) {\n error += `\\nTo prevent accidental re-definition of a field by a subclass, `\n error += `all annotated fields of non-plain objects (classes) are not configurable.`\n }\n }\n die(error)\n }\n }\n */\n // Not annotated\n if ( true && !isOverride(annotation) && hasProp(adm.appliedAnnotations_, key)) {\n var fieldName = adm.name_ + \".\" + key.toString();\n var currentAnnotationType = adm.appliedAnnotations_[key].annotationType_;\n var requestedAnnotationType = annotation.annotationType_;\n die(\"Cannot apply '\" + requestedAnnotationType + \"' to '\" + fieldName + \"':\" + (\"\\nThe field is already annotated with '\" + currentAnnotationType + \"'.\") + \"\\nRe-annotating fields is not allowed.\" + \"\\nUse 'override' annotation for methods overridden by subclass.\");\n }\n}\n\n// Bug in safari 9.* (or iOS 9 safari mobile). See #364\nvar ENTRY_0 = /*#__PURE__*/createArrayEntryDescriptor(0);\nvar safariPrototypeSetterInheritanceBug = /*#__PURE__*/function () {\n var v = false;\n var p = {};\n Object.defineProperty(p, \"0\", {\n set: function set() {\n v = true;\n }\n });\n /*#__PURE__*/Object.create(p)[\"0\"] = 1;\n return v === false;\n}();\n/**\n * This array buffer contains two lists of properties, so that all arrays\n * can recycle their property definitions, which significantly improves performance of creating\n * properties on the fly.\n */\nvar OBSERVABLE_ARRAY_BUFFER_SIZE = 0;\n// Typescript workaround to make sure ObservableArray extends Array\nvar StubArray = function StubArray() {};\nfunction inherit(ctor, proto) {\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(ctor.prototype, proto);\n } else if (ctor.prototype.__proto__ !== undefined) {\n ctor.prototype.__proto__ = proto;\n } else {\n ctor.prototype = proto;\n }\n}\ninherit(StubArray, Array.prototype);\n// Weex proto freeze protection was here,\n// but it is unclear why the hack is need as MobX never changed the prototype\n// anyway, so removed it in V6\nvar LegacyObservableArray = /*#__PURE__*/function (_StubArray) {\n function LegacyObservableArray(initialValues, enhancer, name, owned) {\n var _this;\n if (name === void 0) {\n name = true ? \"ObservableArray@\" + getNextId() : 0;\n }\n if (owned === void 0) {\n owned = false;\n }\n _this = _StubArray.call(this) || this;\n initObservable(function () {\n var adm = new ObservableArrayAdministration(name, enhancer, owned, true);\n adm.proxy_ = _this;\n addHiddenFinalProp(_this, $mobx, adm);\n if (initialValues && initialValues.length) {\n // @ts-ignore\n _this.spliceWithArray(0, 0, initialValues);\n }\n if (safariPrototypeSetterInheritanceBug) {\n // Seems that Safari won't use numeric prototype setter until any * numeric property is\n // defined on the instance. After that it works fine, even if this property is deleted.\n Object.defineProperty(_this, \"0\", ENTRY_0);\n }\n });\n return _this;\n }\n _inheritsLoose(LegacyObservableArray, _StubArray);\n var _proto = LegacyObservableArray.prototype;\n _proto.concat = function concat() {\n this[$mobx].atom_.reportObserved();\n for (var _len = arguments.length, arrays = new Array(_len), _key = 0; _key < _len; _key++) {\n arrays[_key] = arguments[_key];\n }\n return Array.prototype.concat.apply(this.slice(),\n //@ts-ignore\n arrays.map(function (a) {\n return isObservableArray(a) ? a.slice() : a;\n }));\n };\n _proto[Symbol.iterator] = function () {\n var self = this;\n var nextIndex = 0;\n return makeIterable({\n next: function next() {\n return nextIndex < self.length ? {\n value: self[nextIndex++],\n done: false\n } : {\n done: true,\n value: undefined\n };\n }\n });\n };\n return _createClass(LegacyObservableArray, [{\n key: \"length\",\n get: function get() {\n return this[$mobx].getArrayLength_();\n },\n set: function set(newLength) {\n this[$mobx].setArrayLength_(newLength);\n }\n }, {\n key: Symbol.toStringTag,\n get: function get() {\n return \"Array\";\n }\n }]);\n}(StubArray);\nObject.entries(arrayExtensions).forEach(function (_ref) {\n var prop = _ref[0],\n fn = _ref[1];\n if (prop !== \"concat\") {\n addHiddenProp(LegacyObservableArray.prototype, prop, fn);\n }\n});\nfunction createArrayEntryDescriptor(index) {\n return {\n enumerable: false,\n configurable: true,\n get: function get() {\n return this[$mobx].get_(index);\n },\n set: function set(value) {\n this[$mobx].set_(index, value);\n }\n };\n}\nfunction createArrayBufferItem(index) {\n defineProperty(LegacyObservableArray.prototype, \"\" + index, createArrayEntryDescriptor(index));\n}\nfunction reserveArrayBuffer(max) {\n if (max > OBSERVABLE_ARRAY_BUFFER_SIZE) {\n for (var index = OBSERVABLE_ARRAY_BUFFER_SIZE; index < max + 100; index++) {\n createArrayBufferItem(index);\n }\n OBSERVABLE_ARRAY_BUFFER_SIZE = max;\n }\n}\nreserveArrayBuffer(1000);\nfunction createLegacyArray(initialValues, enhancer, name) {\n return new LegacyObservableArray(initialValues, enhancer, name);\n}\n\nfunction getAtom(thing, property) {\n if (typeof thing === \"object\" && thing !== null) {\n if (isObservableArray(thing)) {\n if (property !== undefined) {\n die(23);\n }\n return thing[$mobx].atom_;\n }\n if (isObservableSet(thing)) {\n return thing.atom_;\n }\n if (isObservableMap(thing)) {\n if (property === undefined) {\n return thing.keysAtom_;\n }\n var observable = thing.data_.get(property) || thing.hasMap_.get(property);\n if (!observable) {\n die(25, property, getDebugName(thing));\n }\n return observable;\n }\n if (isObservableObject(thing)) {\n if (!property) {\n return die(26);\n }\n var _observable = thing[$mobx].values_.get(property);\n if (!_observable) {\n die(27, property, getDebugName(thing));\n }\n return _observable;\n }\n if (isAtom(thing) || isComputedValue(thing) || isReaction(thing)) {\n return thing;\n }\n } else if (isFunction(thing)) {\n if (isReaction(thing[$mobx])) {\n // disposer function\n return thing[$mobx];\n }\n }\n die(28);\n}\nfunction getAdministration(thing, property) {\n if (!thing) {\n die(29);\n }\n if (property !== undefined) {\n return getAdministration(getAtom(thing, property));\n }\n if (isAtom(thing) || isComputedValue(thing) || isReaction(thing)) {\n return thing;\n }\n if (isObservableMap(thing) || isObservableSet(thing)) {\n return thing;\n }\n if (thing[$mobx]) {\n return thing[$mobx];\n }\n die(24, thing);\n}\nfunction getDebugName(thing, property) {\n var named;\n if (property !== undefined) {\n named = getAtom(thing, property);\n } else if (isAction(thing)) {\n return thing.name;\n } else if (isObservableObject(thing) || isObservableMap(thing) || isObservableSet(thing)) {\n named = getAdministration(thing);\n } else {\n // valid for arrays as well\n named = getAtom(thing);\n }\n return named.name_;\n}\n/**\n * Helper function for initializing observable structures, it applies:\n * 1. allowStateChanges so we don't violate enforceActions.\n * 2. untracked so we don't accidentaly subscribe to anything observable accessed during init in case the observable is created inside derivation.\n * 3. batch to avoid state version updates\n */\nfunction initObservable(cb) {\n var derivation = untrackedStart();\n var allowStateChanges = allowStateChangesStart(true);\n startBatch();\n try {\n return cb();\n } finally {\n endBatch();\n allowStateChangesEnd(allowStateChanges);\n untrackedEnd(derivation);\n }\n}\n\nvar toString = objectPrototype.toString;\nfunction deepEqual(a, b, depth) {\n if (depth === void 0) {\n depth = -1;\n }\n return eq(a, b, depth);\n}\n// Copied from https://github.com/jashkenas/underscore/blob/5c237a7c682fb68fd5378203f0bf22dce1624854/underscore.js#L1186-L1289\n// Internal recursive comparison function for `isEqual`.\nfunction eq(a, b, depth, aStack, bStack) {\n // Identical objects are equal. `0 === -0`, but they aren't identical.\n // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).\n if (a === b) {\n return a !== 0 || 1 / a === 1 / b;\n }\n // `null` or `undefined` only equal to itself (strict comparison).\n if (a == null || b == null) {\n return false;\n }\n // `NaN`s are equivalent, but non-reflexive.\n if (a !== a) {\n return b !== b;\n }\n // Exhaust primitive checks\n var type = typeof a;\n if (type !== \"function\" && type !== \"object\" && typeof b != \"object\") {\n return false;\n }\n // Compare `[[Class]]` names.\n var className = toString.call(a);\n if (className !== toString.call(b)) {\n return false;\n }\n switch (className) {\n // Strings, numbers, regular expressions, dates, and booleans are compared by value.\n case \"[object RegExp]\":\n // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i')\n case \"[object String]\":\n // Primitives and their corresponding object wrappers are equivalent; thus, `\"5\"` is\n // equivalent to `new String(\"5\")`.\n return \"\" + a === \"\" + b;\n case \"[object Number]\":\n // `NaN`s are equivalent, but non-reflexive.\n // Object(NaN) is equivalent to NaN.\n if (+a !== +a) {\n return +b !== +b;\n }\n // An `egal` comparison is performed for other numeric values.\n return +a === 0 ? 1 / +a === 1 / b : +a === +b;\n case \"[object Date]\":\n case \"[object Boolean]\":\n // Coerce dates and booleans to numeric primitive values. Dates are compared by their\n // millisecond representations. Note that invalid dates with millisecond representations\n // of `NaN` are not equivalent.\n return +a === +b;\n case \"[object Symbol]\":\n return typeof Symbol !== \"undefined\" && Symbol.valueOf.call(a) === Symbol.valueOf.call(b);\n case \"[object Map]\":\n case \"[object Set]\":\n // Maps and Sets are unwrapped to arrays of entry-pairs, adding an incidental level.\n // Hide this extra level by increasing the depth.\n if (depth >= 0) {\n depth++;\n }\n break;\n }\n // Unwrap any wrapped objects.\n a = unwrap(a);\n b = unwrap(b);\n var areArrays = className === \"[object Array]\";\n if (!areArrays) {\n if (typeof a != \"object\" || typeof b != \"object\") {\n return false;\n }\n // Objects with different constructors are not equivalent, but `Object`s or `Array`s\n // from different frames are.\n var aCtor = a.constructor,\n bCtor = b.constructor;\n if (aCtor !== bCtor && !(isFunction(aCtor) && aCtor instanceof aCtor && isFunction(bCtor) && bCtor instanceof bCtor) && \"constructor\" in a && \"constructor\" in b) {\n return false;\n }\n }\n if (depth === 0) {\n return false;\n } else if (depth < 0) {\n depth = -1;\n }\n // Assume equality for cyclic structures. The algorithm for detecting cyclic\n // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.\n // Initializing stack of traversed objects.\n // It's done here since we only need them for objects and arrays comparison.\n aStack = aStack || [];\n bStack = bStack || [];\n var length = aStack.length;\n while (length--) {\n // Linear search. Performance is inversely proportional to the number of\n // unique nested structures.\n if (aStack[length] === a) {\n return bStack[length] === b;\n }\n }\n // Add the first object to the stack of traversed objects.\n aStack.push(a);\n bStack.push(b);\n // Recursively compare objects and arrays.\n if (areArrays) {\n // Compare array lengths to determine if a deep comparison is necessary.\n length = a.length;\n if (length !== b.length) {\n return false;\n }\n // Deep compare the contents, ignoring non-numeric properties.\n while (length--) {\n if (!eq(a[length], b[length], depth - 1, aStack, bStack)) {\n return false;\n }\n }\n } else {\n // Deep compare objects.\n var keys = Object.keys(a);\n var key;\n length = keys.length;\n // Ensure that both objects contain the same number of properties before comparing deep equality.\n if (Object.keys(b).length !== length) {\n return false;\n }\n while (length--) {\n // Deep compare each member\n key = keys[length];\n if (!(hasProp(b, key) && eq(a[key], b[key], depth - 1, aStack, bStack))) {\n return false;\n }\n }\n }\n // Remove the first object from the stack of traversed objects.\n aStack.pop();\n bStack.pop();\n return true;\n}\nfunction unwrap(a) {\n if (isObservableArray(a)) {\n return a.slice();\n }\n if (isES6Map(a) || isObservableMap(a)) {\n return Array.from(a.entries());\n }\n if (isES6Set(a) || isObservableSet(a)) {\n return Array.from(a.entries());\n }\n return a;\n}\n\nfunction makeIterable(iterator) {\n iterator[Symbol.iterator] = getSelf;\n return iterator;\n}\nfunction getSelf() {\n return this;\n}\n\nfunction isAnnotation(thing) {\n return (\n // Can be function\n thing instanceof Object && typeof thing.annotationType_ === \"string\" && isFunction(thing.make_) && isFunction(thing.extend_)\n );\n}\n\n/**\n * (c) Michel Weststrate 2015 - 2020\n * MIT Licensed\n *\n * Welcome to the mobx sources! To get a global overview of how MobX internally works,\n * this is a good place to start:\n * https://medium.com/@mweststrate/becoming-fully-reactive-an-in-depth-explanation-of-mobservable-55995262a254#.xvbh6qd74\n *\n * Source folders:\n * ===============\n *\n * - api/ Most of the public static methods exposed by the module can be found here.\n * - core/ Implementation of the MobX algorithm; atoms, derivations, reactions, dependency trees, optimizations. Cool stuff can be found here.\n * - types/ All the magic that is need to have observable objects, arrays and values is in this folder. Including the modifiers like `asFlat`.\n * - utils/ Utility stuff.\n *\n */\n[\"Symbol\", \"Map\", \"Set\"].forEach(function (m) {\n var g = getGlobal();\n if (typeof g[m] === \"undefined\") {\n die(\"MobX requires global '\" + m + \"' to be available or polyfilled\");\n }\n});\nif (typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__ === \"object\") {\n // See: https://github.com/andykog/mobx-devtools/\n __MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({\n spy: spy,\n extras: {\n getDebugName: getDebugName\n },\n $mobx: $mobx\n });\n}\n\n\n//# sourceMappingURL=mobx.esm.js.map\n\n\n//# sourceURL=webpack://app_adyen_SFRA/./node_modules/mobx/dist/mobx.esm.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ $mobx: () => (/* binding */ $mobx),\n/* harmony export */ FlowCancellationError: () => (/* binding */ FlowCancellationError),\n/* harmony export */ ObservableMap: () => (/* binding */ ObservableMap),\n/* harmony export */ ObservableSet: () => (/* binding */ ObservableSet),\n/* harmony export */ Reaction: () => (/* binding */ Reaction),\n/* harmony export */ _allowStateChanges: () => (/* binding */ allowStateChanges),\n/* harmony export */ _allowStateChangesInsideComputed: () => (/* binding */ runInAction),\n/* harmony export */ _allowStateReadsEnd: () => (/* binding */ allowStateReadsEnd),\n/* harmony export */ _allowStateReadsStart: () => (/* binding */ allowStateReadsStart),\n/* harmony export */ _autoAction: () => (/* binding */ autoAction),\n/* harmony export */ _endAction: () => (/* binding */ _endAction),\n/* harmony export */ _getAdministration: () => (/* binding */ getAdministration),\n/* harmony export */ _getGlobalState: () => (/* binding */ getGlobalState),\n/* harmony export */ _interceptReads: () => (/* binding */ interceptReads),\n/* harmony export */ _isComputingDerivation: () => (/* binding */ isComputingDerivation),\n/* harmony export */ _resetGlobalState: () => (/* binding */ resetGlobalState),\n/* harmony export */ _startAction: () => (/* binding */ _startAction),\n/* harmony export */ action: () => (/* binding */ action),\n/* harmony export */ autorun: () => (/* binding */ autorun),\n/* harmony export */ comparer: () => (/* binding */ comparer),\n/* harmony export */ computed: () => (/* binding */ computed),\n/* harmony export */ configure: () => (/* binding */ configure),\n/* harmony export */ createAtom: () => (/* binding */ createAtom),\n/* harmony export */ defineProperty: () => (/* binding */ apiDefineProperty),\n/* harmony export */ entries: () => (/* binding */ entries),\n/* harmony export */ extendObservable: () => (/* binding */ extendObservable),\n/* harmony export */ flow: () => (/* binding */ flow),\n/* harmony export */ flowResult: () => (/* binding */ flowResult),\n/* harmony export */ get: () => (/* binding */ get),\n/* harmony export */ getAtom: () => (/* binding */ getAtom),\n/* harmony export */ getDebugName: () => (/* binding */ getDebugName),\n/* harmony export */ getDependencyTree: () => (/* binding */ getDependencyTree),\n/* harmony export */ getObserverTree: () => (/* binding */ getObserverTree),\n/* harmony export */ has: () => (/* binding */ has),\n/* harmony export */ intercept: () => (/* binding */ intercept),\n/* harmony export */ isAction: () => (/* binding */ isAction),\n/* harmony export */ isBoxedObservable: () => (/* binding */ isObservableValue),\n/* harmony export */ isComputed: () => (/* binding */ isComputed),\n/* harmony export */ isComputedProp: () => (/* binding */ isComputedProp),\n/* harmony export */ isFlow: () => (/* binding */ isFlow),\n/* harmony export */ isFlowCancellationError: () => (/* binding */ isFlowCancellationError),\n/* harmony export */ isObservable: () => (/* binding */ isObservable),\n/* harmony export */ isObservableArray: () => (/* binding */ isObservableArray),\n/* harmony export */ isObservableMap: () => (/* binding */ isObservableMap),\n/* harmony export */ isObservableObject: () => (/* binding */ isObservableObject),\n/* harmony export */ isObservableProp: () => (/* binding */ isObservableProp),\n/* harmony export */ isObservableSet: () => (/* binding */ isObservableSet),\n/* harmony export */ keys: () => (/* binding */ keys),\n/* harmony export */ makeAutoObservable: () => (/* binding */ makeAutoObservable),\n/* harmony export */ makeObservable: () => (/* binding */ makeObservable),\n/* harmony export */ observable: () => (/* binding */ observable),\n/* harmony export */ observe: () => (/* binding */ observe),\n/* harmony export */ onBecomeObserved: () => (/* binding */ onBecomeObserved),\n/* harmony export */ onBecomeUnobserved: () => (/* binding */ onBecomeUnobserved),\n/* harmony export */ onReactionError: () => (/* binding */ onReactionError),\n/* harmony export */ override: () => (/* binding */ override),\n/* harmony export */ ownKeys: () => (/* binding */ apiOwnKeys),\n/* harmony export */ reaction: () => (/* binding */ reaction),\n/* harmony export */ remove: () => (/* binding */ remove),\n/* harmony export */ runInAction: () => (/* binding */ runInAction),\n/* harmony export */ set: () => (/* binding */ set),\n/* harmony export */ spy: () => (/* binding */ spy),\n/* harmony export */ toJS: () => (/* binding */ toJS),\n/* harmony export */ trace: () => (/* binding */ trace),\n/* harmony export */ transaction: () => (/* binding */ transaction),\n/* harmony export */ untracked: () => (/* binding */ untracked),\n/* harmony export */ values: () => (/* binding */ values),\n/* harmony export */ when: () => (/* binding */ when)\n/* harmony export */ });\nvar niceErrors = {\n 0: \"Invalid value for configuration 'enforceActions', expected 'never', 'always' or 'observed'\",\n 1: function _(annotationType, key) {\n return \"Cannot apply '\" + annotationType + \"' to '\" + key.toString() + \"': Field not found.\";\n },\n /*\n 2(prop) {\n return `invalid decorator for '${prop.toString()}'`\n },\n 3(prop) {\n return `Cannot decorate '${prop.toString()}': action can only be used on properties with a function value.`\n },\n 4(prop) {\n return `Cannot decorate '${prop.toString()}': computed can only be used on getter properties.`\n },\n */\n 5: \"'keys()' can only be used on observable objects, arrays, sets and maps\",\n 6: \"'values()' can only be used on observable objects, arrays, sets and maps\",\n 7: \"'entries()' can only be used on observable objects, arrays and maps\",\n 8: \"'set()' can only be used on observable objects, arrays and maps\",\n 9: \"'remove()' can only be used on observable objects, arrays and maps\",\n 10: \"'has()' can only be used on observable objects, arrays and maps\",\n 11: \"'get()' can only be used on observable objects, arrays and maps\",\n 12: \"Invalid annotation\",\n 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)\",\n 14: \"Intercept handlers should return nothing or a change object\",\n 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)\",\n 16: \"Modification exception: the internal structure of an observable array was changed.\",\n 17: function _(index, length) {\n return \"[mobx.array] Index out of bounds, \" + index + \" is larger than \" + length;\n },\n 18: \"mobx.map requires Map polyfill for the current browser. Check babel-polyfill or core-js/es6/map.js\",\n 19: function _(other) {\n return \"Cannot initialize from classes that inherit from Map: \" + other.constructor.name;\n },\n 20: function _(other) {\n return \"Cannot initialize map from \" + other;\n },\n 21: function _(dataStructure) {\n return \"Cannot convert to map from '\" + dataStructure + \"'\";\n },\n 22: \"mobx.set requires Set polyfill for the current browser. Check babel-polyfill or core-js/es6/set.js\",\n 23: \"It is not possible to get index atoms from arrays\",\n 24: function _(thing) {\n return \"Cannot obtain administration from \" + thing;\n },\n 25: function _(property, name) {\n return \"the entry '\" + property + \"' does not exist in the observable map '\" + name + \"'\";\n },\n 26: \"please specify a property\",\n 27: function _(property, name) {\n return \"no observable property '\" + property.toString() + \"' found on the observable object '\" + name + \"'\";\n },\n 28: function _(thing) {\n return \"Cannot obtain atom from \" + thing;\n },\n 29: \"Expecting some object\",\n 30: \"invalid action stack. did you forget to finish an action?\",\n 31: \"missing option for computed: get\",\n 32: function _(name, derivation) {\n return \"Cycle detected in computation \" + name + \": \" + derivation;\n },\n 33: function _(name) {\n return \"The setter of computed value '\" + name + \"' is trying to update itself. Did you intend to update an _observable_ value, instead of the computed property?\";\n },\n 34: function _(name) {\n return \"[ComputedValue '\" + name + \"'] It is not possible to assign a new value to a computed value.\";\n },\n 35: \"There are multiple, different versions of MobX active. Make sure MobX is loaded only once or use `configure({ isolateGlobalState: true })`\",\n 36: \"isolateGlobalState should be called before MobX is running any reactions\",\n 37: function _(method) {\n return \"[mobx] `observableArray.\" + method + \"()` mutates the array in-place, which is not allowed inside a derivation. Use `array.slice().\" + method + \"()` instead\";\n },\n 38: \"'ownKeys()' can only be used on observable objects\",\n 39: \"'defineProperty()' can only be used on observable objects\"\n};\nvar errors = true ? niceErrors : 0;\nfunction die(error) {\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n if (true) {\n var e = typeof error === \"string\" ? error : errors[error];\n if (typeof e === \"function\") e = e.apply(null, args);\n throw new Error(\"[MobX] \" + e);\n }\n throw new Error(typeof error === \"number\" ? \"[MobX] minified error nr: \" + error + (args.length ? \" \" + args.map(String).join(\",\") : \"\") + \". Find the full error at: https://github.com/mobxjs/mobx/blob/main/packages/mobx/src/errors.ts\" : \"[MobX] \" + error);\n}\n\nvar mockGlobal = {};\nfunction getGlobal() {\n if (typeof globalThis !== \"undefined\") {\n return globalThis;\n }\n if (typeof window !== \"undefined\") {\n return window;\n }\n if (typeof __webpack_require__.g !== \"undefined\") {\n return __webpack_require__.g;\n }\n if (typeof self !== \"undefined\") {\n return self;\n }\n return mockGlobal;\n}\n\n// We shorten anything used > 5 times\nvar assign = Object.assign;\nvar getDescriptor = Object.getOwnPropertyDescriptor;\nvar defineProperty = Object.defineProperty;\nvar objectPrototype = Object.prototype;\nvar EMPTY_ARRAY = [];\nObject.freeze(EMPTY_ARRAY);\nvar EMPTY_OBJECT = {};\nObject.freeze(EMPTY_OBJECT);\nvar hasProxy = typeof Proxy !== \"undefined\";\nvar plainObjectString = /*#__PURE__*/Object.toString();\nfunction assertProxies() {\n if (!hasProxy) {\n die( true ? \"`Proxy` objects are not available in the current environment. Please configure MobX to enable a fallback implementation.`\" : 0);\n }\n}\nfunction warnAboutProxyRequirement(msg) {\n if ( true && globalState.verifyProxies) {\n die(\"MobX is currently configured to be able to run in ES5 mode, but in ES5 MobX won't be able to \" + msg);\n }\n}\nfunction getNextId() {\n return ++globalState.mobxGuid;\n}\n/**\n * Makes sure that the provided function is invoked at most once.\n */\nfunction once(func) {\n var invoked = false;\n return function () {\n if (invoked) {\n return;\n }\n invoked = true;\n return func.apply(this, arguments);\n };\n}\nvar noop = function noop() {};\nfunction isFunction(fn) {\n return typeof fn === \"function\";\n}\nfunction isStringish(value) {\n var t = typeof value;\n switch (t) {\n case \"string\":\n case \"symbol\":\n case \"number\":\n return true;\n }\n return false;\n}\nfunction isObject(value) {\n return value !== null && typeof value === \"object\";\n}\nfunction isPlainObject(value) {\n if (!isObject(value)) {\n return false;\n }\n var proto = Object.getPrototypeOf(value);\n if (proto == null) {\n return true;\n }\n var protoConstructor = Object.hasOwnProperty.call(proto, \"constructor\") && proto.constructor;\n return typeof protoConstructor === \"function\" && protoConstructor.toString() === plainObjectString;\n}\n// https://stackoverflow.com/a/37865170\nfunction isGenerator(obj) {\n var constructor = obj == null ? void 0 : obj.constructor;\n if (!constructor) {\n return false;\n }\n if (\"GeneratorFunction\" === constructor.name || \"GeneratorFunction\" === constructor.displayName) {\n return true;\n }\n return false;\n}\nfunction addHiddenProp(object, propName, value) {\n defineProperty(object, propName, {\n enumerable: false,\n writable: true,\n configurable: true,\n value: value\n });\n}\nfunction addHiddenFinalProp(object, propName, value) {\n defineProperty(object, propName, {\n enumerable: false,\n writable: false,\n configurable: true,\n value: value\n });\n}\nfunction createInstanceofPredicate(name, theClass) {\n var propName = \"isMobX\" + name;\n theClass.prototype[propName] = true;\n return function (x) {\n return isObject(x) && x[propName] === true;\n };\n}\n/**\n * Yields true for both native and observable Map, even across different windows.\n */\nfunction isES6Map(thing) {\n return thing != null && Object.prototype.toString.call(thing) === \"[object Map]\";\n}\n/**\n * Makes sure a Map is an instance of non-inherited native or observable Map.\n */\nfunction isPlainES6Map(thing) {\n var mapProto = Object.getPrototypeOf(thing);\n var objectProto = Object.getPrototypeOf(mapProto);\n var nullProto = Object.getPrototypeOf(objectProto);\n return nullProto === null;\n}\n/**\n * Yields true for both native and observable Set, even across different windows.\n */\nfunction isES6Set(thing) {\n return thing != null && Object.prototype.toString.call(thing) === \"[object Set]\";\n}\nvar hasGetOwnPropertySymbols = typeof Object.getOwnPropertySymbols !== \"undefined\";\n/**\n * Returns the following: own enumerable keys and symbols.\n */\nfunction getPlainObjectKeys(object) {\n var keys = Object.keys(object);\n // Not supported in IE, so there are not going to be symbol props anyway...\n if (!hasGetOwnPropertySymbols) {\n return keys;\n }\n var symbols = Object.getOwnPropertySymbols(object);\n if (!symbols.length) {\n return keys;\n }\n return [].concat(keys, symbols.filter(function (s) {\n return objectPrototype.propertyIsEnumerable.call(object, s);\n }));\n}\n// From Immer utils\n// Returns all own keys, including non-enumerable and symbolic\nvar ownKeys = typeof Reflect !== \"undefined\" && Reflect.ownKeys ? Reflect.ownKeys : hasGetOwnPropertySymbols ? function (obj) {\n return Object.getOwnPropertyNames(obj).concat(Object.getOwnPropertySymbols(obj));\n} : /* istanbul ignore next */Object.getOwnPropertyNames;\nfunction stringifyKey(key) {\n if (typeof key === \"string\") {\n return key;\n }\n if (typeof key === \"symbol\") {\n return key.toString();\n }\n return new String(key).toString();\n}\nfunction toPrimitive(value) {\n return value === null ? null : typeof value === \"object\" ? \"\" + value : value;\n}\nfunction hasProp(target, prop) {\n return objectPrototype.hasOwnProperty.call(target, prop);\n}\n// From Immer utils\nvar getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors || function getOwnPropertyDescriptors(target) {\n // Polyfill needed for Hermes and IE, see https://github.com/facebook/hermes/issues/274\n var res = {};\n // Note: without polyfill for ownKeys, symbols won't be picked up\n ownKeys(target).forEach(function (key) {\n res[key] = getDescriptor(target, key);\n });\n return res;\n};\nfunction getFlag(flags, mask) {\n return !!(flags & mask);\n}\nfunction setFlag(flags, mask, newValue) {\n if (newValue) {\n flags |= mask;\n } else {\n flags &= ~mask;\n }\n return flags;\n}\n\nfunction _arrayLikeToArray(r, a) {\n (null == a || a > r.length) && (a = r.length);\n for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];\n return n;\n}\nfunction _defineProperties(e, r) {\n for (var t = 0; t < r.length; t++) {\n var o = r[t];\n o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);\n }\n}\nfunction _createClass(e, r, t) {\n return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", {\n writable: !1\n }), e;\n}\nfunction _createForOfIteratorHelperLoose(r, e) {\n var t = \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"];\n if (t) return (t = t.call(r)).next.bind(t);\n if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && \"number\" == typeof r.length) {\n t && (r = t);\n var o = 0;\n return function () {\n return o >= r.length ? {\n done: !0\n } : {\n done: !1,\n value: r[o++]\n };\n };\n }\n throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\nfunction _extends() {\n return _extends = Object.assign ? Object.assign.bind() : function (n) {\n for (var e = 1; e < arguments.length; e++) {\n var t = arguments[e];\n for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);\n }\n return n;\n }, _extends.apply(null, arguments);\n}\nfunction _inheritsLoose(t, o) {\n t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);\n}\nfunction _setPrototypeOf(t, e) {\n return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {\n return t.__proto__ = e, t;\n }, _setPrototypeOf(t, e);\n}\nfunction _toPrimitive(t, r) {\n if (\"object\" != typeof t || !t) return t;\n var e = t[Symbol.toPrimitive];\n if (void 0 !== e) {\n var i = e.call(t, r || \"default\");\n if (\"object\" != typeof i) return i;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (\"string\" === r ? String : Number)(t);\n}\nfunction _toPropertyKey(t) {\n var i = _toPrimitive(t, \"string\");\n return \"symbol\" == typeof i ? i : i + \"\";\n}\nfunction _unsupportedIterableToArray(r, a) {\n if (r) {\n if (\"string\" == typeof r) return _arrayLikeToArray(r, a);\n var t = {}.toString.call(r).slice(8, -1);\n return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;\n }\n}\n\nvar storedAnnotationsSymbol = /*#__PURE__*/Symbol(\"mobx-stored-annotations\");\n/**\n * Creates a function that acts as\n * - decorator\n * - annotation object\n */\nfunction createDecoratorAnnotation(annotation) {\n function decorator(target, property) {\n if (is20223Decorator(property)) {\n return annotation.decorate_20223_(target, property);\n } else {\n storeAnnotation(target, property, annotation);\n }\n }\n return Object.assign(decorator, annotation);\n}\n/**\n * Stores annotation to prototype,\n * so it can be inspected later by `makeObservable` called from constructor\n */\nfunction storeAnnotation(prototype, key, annotation) {\n if (!hasProp(prototype, storedAnnotationsSymbol)) {\n addHiddenProp(prototype, storedAnnotationsSymbol, _extends({}, prototype[storedAnnotationsSymbol]));\n }\n // @override must override something\n if ( true && isOverride(annotation) && !hasProp(prototype[storedAnnotationsSymbol], key)) {\n var fieldName = prototype.constructor.name + \".prototype.\" + key.toString();\n die(\"'\" + fieldName + \"' is decorated with 'override', \" + \"but no such decorated member was found on prototype.\");\n }\n // Cannot re-decorate\n assertNotDecorated(prototype, annotation, key);\n // Ignore override\n if (!isOverride(annotation)) {\n prototype[storedAnnotationsSymbol][key] = annotation;\n }\n}\nfunction assertNotDecorated(prototype, annotation, key) {\n if ( true && !isOverride(annotation) && hasProp(prototype[storedAnnotationsSymbol], key)) {\n var fieldName = prototype.constructor.name + \".prototype.\" + key.toString();\n var currentAnnotationType = prototype[storedAnnotationsSymbol][key].annotationType_;\n var requestedAnnotationType = annotation.annotationType_;\n die(\"Cannot apply '@\" + requestedAnnotationType + \"' to '\" + fieldName + \"':\" + (\"\\nThe field is already decorated with '@\" + currentAnnotationType + \"'.\") + \"\\nRe-decorating fields is not allowed.\" + \"\\nUse '@override' decorator for methods overridden by subclass.\");\n }\n}\n/**\n * Collects annotations from prototypes and stores them on target (instance)\n */\nfunction collectStoredAnnotations(target) {\n if (!hasProp(target, storedAnnotationsSymbol)) {\n // if (__DEV__ && !target[storedAnnotationsSymbol]) {\n // die(\n // `No annotations were passed to makeObservable, but no decorated members have been found either`\n // )\n // }\n // We need a copy as we will remove annotation from the list once it's applied.\n addHiddenProp(target, storedAnnotationsSymbol, _extends({}, target[storedAnnotationsSymbol]));\n }\n return target[storedAnnotationsSymbol];\n}\nfunction is20223Decorator(context) {\n return typeof context == \"object\" && typeof context[\"kind\"] == \"string\";\n}\nfunction assert20223DecoratorType(context, types) {\n if ( true && !types.includes(context.kind)) {\n die(\"The decorator applied to '\" + String(context.name) + \"' cannot be used on a \" + context.kind + \" element\");\n }\n}\n\nvar $mobx = /*#__PURE__*/Symbol(\"mobx administration\");\nvar Atom = /*#__PURE__*/function () {\n /**\n * Create a new atom. For debugging purposes it is recommended to give it a name.\n * The onBecomeObserved and onBecomeUnobserved callbacks can be used for resource management.\n */\n function Atom(name_) {\n if (name_ === void 0) {\n name_ = true ? \"Atom@\" + getNextId() : 0;\n }\n this.name_ = void 0;\n this.flags_ = 0;\n this.observers_ = new Set();\n this.lastAccessedBy_ = 0;\n this.lowestObserverState_ = IDerivationState_.NOT_TRACKING_;\n // onBecomeObservedListeners\n this.onBOL = void 0;\n // onBecomeUnobservedListeners\n this.onBUOL = void 0;\n this.name_ = name_;\n }\n // for effective unobserving. BaseAtom has true, for extra optimization, so its onBecomeUnobserved never gets called, because it's not needed\n var _proto = Atom.prototype;\n _proto.onBO = function onBO() {\n if (this.onBOL) {\n this.onBOL.forEach(function (listener) {\n return listener();\n });\n }\n };\n _proto.onBUO = function onBUO() {\n if (this.onBUOL) {\n this.onBUOL.forEach(function (listener) {\n return listener();\n });\n }\n }\n /**\n * Invoke this method to notify mobx that your atom has been used somehow.\n * Returns true if there is currently a reactive context.\n */;\n _proto.reportObserved = function reportObserved$1() {\n return reportObserved(this);\n }\n /**\n * Invoke this method _after_ this method has changed to signal mobx that all its observers should invalidate.\n */;\n _proto.reportChanged = function reportChanged() {\n startBatch();\n propagateChanged(this);\n endBatch();\n };\n _proto.toString = function toString() {\n return this.name_;\n };\n return _createClass(Atom, [{\n key: \"isBeingObserved\",\n get: function get() {\n return getFlag(this.flags_, Atom.isBeingObservedMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Atom.isBeingObservedMask_, newValue);\n }\n }, {\n key: \"isPendingUnobservation\",\n get: function get() {\n return getFlag(this.flags_, Atom.isPendingUnobservationMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Atom.isPendingUnobservationMask_, newValue);\n }\n }, {\n key: \"diffValue\",\n get: function get() {\n return getFlag(this.flags_, Atom.diffValueMask_) ? 1 : 0;\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Atom.diffValueMask_, newValue === 1 ? true : false);\n }\n }]);\n}();\nAtom.isBeingObservedMask_ = 1;\nAtom.isPendingUnobservationMask_ = 2;\nAtom.diffValueMask_ = 4;\nvar isAtom = /*#__PURE__*/createInstanceofPredicate(\"Atom\", Atom);\nfunction createAtom(name, onBecomeObservedHandler, onBecomeUnobservedHandler) {\n if (onBecomeObservedHandler === void 0) {\n onBecomeObservedHandler = noop;\n }\n if (onBecomeUnobservedHandler === void 0) {\n onBecomeUnobservedHandler = noop;\n }\n var atom = new Atom(name);\n // default `noop` listener will not initialize the hook Set\n if (onBecomeObservedHandler !== noop) {\n onBecomeObserved(atom, onBecomeObservedHandler);\n }\n if (onBecomeUnobservedHandler !== noop) {\n onBecomeUnobserved(atom, onBecomeUnobservedHandler);\n }\n return atom;\n}\n\nfunction identityComparer(a, b) {\n return a === b;\n}\nfunction structuralComparer(a, b) {\n return deepEqual(a, b);\n}\nfunction shallowComparer(a, b) {\n return deepEqual(a, b, 1);\n}\nfunction defaultComparer(a, b) {\n if (Object.is) {\n return Object.is(a, b);\n }\n return a === b ? a !== 0 || 1 / a === 1 / b : a !== a && b !== b;\n}\nvar comparer = {\n identity: identityComparer,\n structural: structuralComparer,\n \"default\": defaultComparer,\n shallow: shallowComparer\n};\n\nfunction deepEnhancer(v, _, name) {\n // it is an observable already, done\n if (isObservable(v)) {\n return v;\n }\n // something that can be converted and mutated?\n if (Array.isArray(v)) {\n return observable.array(v, {\n name: name\n });\n }\n if (isPlainObject(v)) {\n return observable.object(v, undefined, {\n name: name\n });\n }\n if (isES6Map(v)) {\n return observable.map(v, {\n name: name\n });\n }\n if (isES6Set(v)) {\n return observable.set(v, {\n name: name\n });\n }\n if (typeof v === \"function\" && !isAction(v) && !isFlow(v)) {\n if (isGenerator(v)) {\n return flow(v);\n } else {\n return autoAction(name, v);\n }\n }\n return v;\n}\nfunction shallowEnhancer(v, _, name) {\n if (v === undefined || v === null) {\n return v;\n }\n if (isObservableObject(v) || isObservableArray(v) || isObservableMap(v) || isObservableSet(v)) {\n return v;\n }\n if (Array.isArray(v)) {\n return observable.array(v, {\n name: name,\n deep: false\n });\n }\n if (isPlainObject(v)) {\n return observable.object(v, undefined, {\n name: name,\n deep: false\n });\n }\n if (isES6Map(v)) {\n return observable.map(v, {\n name: name,\n deep: false\n });\n }\n if (isES6Set(v)) {\n return observable.set(v, {\n name: name,\n deep: false\n });\n }\n if (true) {\n die(\"The shallow modifier / decorator can only used in combination with arrays, objects, maps and sets\");\n }\n}\nfunction referenceEnhancer(newValue) {\n // never turn into an observable\n return newValue;\n}\nfunction refStructEnhancer(v, oldValue) {\n if ( true && isObservable(v)) {\n die(\"observable.struct should not be used with observable values\");\n }\n if (deepEqual(v, oldValue)) {\n return oldValue;\n }\n return v;\n}\n\nvar OVERRIDE = \"override\";\nvar override = /*#__PURE__*/createDecoratorAnnotation({\n annotationType_: OVERRIDE,\n make_: make_,\n extend_: extend_,\n decorate_20223_: decorate_20223_\n});\nfunction isOverride(annotation) {\n return annotation.annotationType_ === OVERRIDE;\n}\nfunction make_(adm, key) {\n // Must not be plain object\n if ( true && adm.isPlainObject_) {\n die(\"Cannot apply '\" + this.annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + this.annotationType_ + \"' cannot be used on plain objects.\"));\n }\n // Must override something\n if ( true && !hasProp(adm.appliedAnnotations_, key)) {\n die(\"'\" + adm.name_ + \".\" + key.toString() + \"' is annotated with '\" + this.annotationType_ + \"', \" + \"but no such annotated member was found on prototype.\");\n }\n return 0 /* MakeResult.Cancel */;\n}\nfunction extend_(adm, key, descriptor, proxyTrap) {\n die(\"'\" + this.annotationType_ + \"' can only be used with 'makeObservable'\");\n}\nfunction decorate_20223_(desc, context) {\n console.warn(\"'\" + this.annotationType_ + \"' cannot be used with decorators - this is a no-op\");\n}\n\nfunction createActionAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$1,\n extend_: extend_$1,\n decorate_20223_: decorate_20223_$1\n };\n}\nfunction make_$1(adm, key, descriptor, source) {\n var _this$options_;\n // bound\n if ((_this$options_ = this.options_) != null && _this$options_.bound) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;\n }\n // own\n if (source === adm.target_) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 2 /* MakeResult.Continue */;\n }\n // prototype\n if (isAction(descriptor.value)) {\n // A prototype could have been annotated already by other constructor,\n // rest of the proto chain must be annotated already\n return 1 /* MakeResult.Break */;\n }\n var actionDescriptor = createActionDescriptor(adm, this, key, descriptor, false);\n defineProperty(source, key, actionDescriptor);\n return 2 /* MakeResult.Continue */;\n}\nfunction extend_$1(adm, key, descriptor, proxyTrap) {\n var actionDescriptor = createActionDescriptor(adm, this, key, descriptor);\n return adm.defineProperty_(key, actionDescriptor, proxyTrap);\n}\nfunction decorate_20223_$1(mthd, context) {\n if (true) {\n assert20223DecoratorType(context, [\"method\", \"field\"]);\n }\n var kind = context.kind,\n name = context.name,\n addInitializer = context.addInitializer;\n var ann = this;\n var _createAction = function _createAction(m) {\n var _ann$options_$name, _ann$options_, _ann$options_$autoAct, _ann$options_2;\n return createAction((_ann$options_$name = (_ann$options_ = ann.options_) == null ? void 0 : _ann$options_.name) != null ? _ann$options_$name : name.toString(), m, (_ann$options_$autoAct = (_ann$options_2 = ann.options_) == null ? void 0 : _ann$options_2.autoAction) != null ? _ann$options_$autoAct : false);\n };\n if (kind == \"field\") {\n return function (initMthd) {\n var _ann$options_3;\n var mthd = initMthd;\n if (!isAction(mthd)) {\n mthd = _createAction(mthd);\n }\n if ((_ann$options_3 = ann.options_) != null && _ann$options_3.bound) {\n mthd = mthd.bind(this);\n mthd.isMobxAction = true;\n }\n return mthd;\n };\n }\n if (kind == \"method\") {\n var _this$options_2;\n if (!isAction(mthd)) {\n mthd = _createAction(mthd);\n }\n if ((_this$options_2 = this.options_) != null && _this$options_2.bound) {\n addInitializer(function () {\n var self = this;\n var bound = self[name].bind(self);\n bound.isMobxAction = true;\n self[name] = bound;\n });\n }\n return mthd;\n }\n die(\"Cannot apply '\" + ann.annotationType_ + \"' to '\" + String(name) + \"' (kind: \" + kind + \"):\" + (\"\\n'\" + ann.annotationType_ + \"' can only be used on properties with a function value.\"));\n}\nfunction assertActionDescriptor(adm, _ref, key, _ref2) {\n var annotationType_ = _ref.annotationType_;\n var value = _ref2.value;\n if ( true && !isFunction(value)) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' can only be used on properties with a function value.\"));\n }\n}\nfunction createActionDescriptor(adm, annotation, key, descriptor,\n// provides ability to disable safeDescriptors for prototypes\nsafeDescriptors) {\n var _annotation$options_, _annotation$options_$, _annotation$options_2, _annotation$options_$2, _annotation$options_3, _annotation$options_4, _adm$proxy_2;\n if (safeDescriptors === void 0) {\n safeDescriptors = globalState.safeDescriptors;\n }\n assertActionDescriptor(adm, annotation, key, descriptor);\n var value = descriptor.value;\n if ((_annotation$options_ = annotation.options_) != null && _annotation$options_.bound) {\n var _adm$proxy_;\n value = value.bind((_adm$proxy_ = adm.proxy_) != null ? _adm$proxy_ : adm.target_);\n }\n return {\n value: createAction((_annotation$options_$ = (_annotation$options_2 = annotation.options_) == null ? void 0 : _annotation$options_2.name) != null ? _annotation$options_$ : key.toString(), value, (_annotation$options_$2 = (_annotation$options_3 = annotation.options_) == null ? void 0 : _annotation$options_3.autoAction) != null ? _annotation$options_$2 : false,\n // https://github.com/mobxjs/mobx/discussions/3140\n (_annotation$options_4 = annotation.options_) != null && _annotation$options_4.bound ? (_adm$proxy_2 = adm.proxy_) != null ? _adm$proxy_2 : adm.target_ : undefined),\n // Non-configurable for classes\n // prevents accidental field redefinition in subclass\n configurable: safeDescriptors ? adm.isPlainObject_ : true,\n // https://github.com/mobxjs/mobx/pull/2641#issuecomment-737292058\n enumerable: false,\n // Non-obsevable, therefore non-writable\n // Also prevents rewriting in subclass constructor\n writable: safeDescriptors ? false : true\n };\n}\n\nfunction createFlowAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$2,\n extend_: extend_$2,\n decorate_20223_: decorate_20223_$2\n };\n}\nfunction make_$2(adm, key, descriptor, source) {\n var _this$options_;\n // own\n if (source === adm.target_) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 2 /* MakeResult.Continue */;\n }\n // prototype\n // bound - must annotate protos to support super.flow()\n if ((_this$options_ = this.options_) != null && _this$options_.bound && (!hasProp(adm.target_, key) || !isFlow(adm.target_[key]))) {\n if (this.extend_(adm, key, descriptor, false) === null) {\n return 0 /* MakeResult.Cancel */;\n }\n }\n if (isFlow(descriptor.value)) {\n // A prototype could have been annotated already by other constructor,\n // rest of the proto chain must be annotated already\n return 1 /* MakeResult.Break */;\n }\n var flowDescriptor = createFlowDescriptor(adm, this, key, descriptor, false, false);\n defineProperty(source, key, flowDescriptor);\n return 2 /* MakeResult.Continue */;\n}\nfunction extend_$2(adm, key, descriptor, proxyTrap) {\n var _this$options_2;\n var flowDescriptor = createFlowDescriptor(adm, this, key, descriptor, (_this$options_2 = this.options_) == null ? void 0 : _this$options_2.bound);\n return adm.defineProperty_(key, flowDescriptor, proxyTrap);\n}\nfunction decorate_20223_$2(mthd, context) {\n var _this$options_3;\n if (true) {\n assert20223DecoratorType(context, [\"method\"]);\n }\n var name = context.name,\n addInitializer = context.addInitializer;\n if (!isFlow(mthd)) {\n mthd = flow(mthd);\n }\n if ((_this$options_3 = this.options_) != null && _this$options_3.bound) {\n addInitializer(function () {\n var self = this;\n var bound = self[name].bind(self);\n bound.isMobXFlow = true;\n self[name] = bound;\n });\n }\n return mthd;\n}\nfunction assertFlowDescriptor(adm, _ref, key, _ref2) {\n var annotationType_ = _ref.annotationType_;\n var value = _ref2.value;\n if ( true && !isFunction(value)) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' can only be used on properties with a generator function value.\"));\n }\n}\nfunction createFlowDescriptor(adm, annotation, key, descriptor, bound,\n// provides ability to disable safeDescriptors for prototypes\nsafeDescriptors) {\n if (safeDescriptors === void 0) {\n safeDescriptors = globalState.safeDescriptors;\n }\n assertFlowDescriptor(adm, annotation, key, descriptor);\n var value = descriptor.value;\n // In case of flow.bound, the descriptor can be from already annotated prototype\n if (!isFlow(value)) {\n value = flow(value);\n }\n if (bound) {\n var _adm$proxy_;\n // We do not keep original function around, so we bind the existing flow\n value = value.bind((_adm$proxy_ = adm.proxy_) != null ? _adm$proxy_ : adm.target_);\n // This is normally set by `flow`, but `bind` returns new function...\n value.isMobXFlow = true;\n }\n return {\n value: value,\n // Non-configurable for classes\n // prevents accidental field redefinition in subclass\n configurable: safeDescriptors ? adm.isPlainObject_ : true,\n // https://github.com/mobxjs/mobx/pull/2641#issuecomment-737292058\n enumerable: false,\n // Non-obsevable, therefore non-writable\n // Also prevents rewriting in subclass constructor\n writable: safeDescriptors ? false : true\n };\n}\n\nfunction createComputedAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$3,\n extend_: extend_$3,\n decorate_20223_: decorate_20223_$3\n };\n}\nfunction make_$3(adm, key, descriptor) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;\n}\nfunction extend_$3(adm, key, descriptor, proxyTrap) {\n assertComputedDescriptor(adm, this, key, descriptor);\n return adm.defineComputedProperty_(key, _extends({}, this.options_, {\n get: descriptor.get,\n set: descriptor.set\n }), proxyTrap);\n}\nfunction decorate_20223_$3(get, context) {\n if (true) {\n assert20223DecoratorType(context, [\"getter\"]);\n }\n var ann = this;\n var key = context.name,\n addInitializer = context.addInitializer;\n addInitializer(function () {\n var adm = asObservableObject(this)[$mobx];\n var options = _extends({}, ann.options_, {\n get: get,\n context: this\n });\n options.name || (options.name = true ? adm.name_ + \".\" + key.toString() : 0);\n adm.values_.set(key, new ComputedValue(options));\n });\n return function () {\n return this[$mobx].getObservablePropValue_(key);\n };\n}\nfunction assertComputedDescriptor(adm, _ref, key, _ref2) {\n var annotationType_ = _ref.annotationType_;\n var get = _ref2.get;\n if ( true && !get) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' can only be used on getter(+setter) properties.\"));\n }\n}\n\nfunction createObservableAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$4,\n extend_: extend_$4,\n decorate_20223_: decorate_20223_$4\n };\n}\nfunction make_$4(adm, key, descriptor) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;\n}\nfunction extend_$4(adm, key, descriptor, proxyTrap) {\n var _this$options_$enhanc, _this$options_;\n assertObservableDescriptor(adm, this, key, descriptor);\n return adm.defineObservableProperty_(key, descriptor.value, (_this$options_$enhanc = (_this$options_ = this.options_) == null ? void 0 : _this$options_.enhancer) != null ? _this$options_$enhanc : deepEnhancer, proxyTrap);\n}\nfunction decorate_20223_$4(desc, context) {\n if (true) {\n if (context.kind === \"field\") {\n throw die(\"Please use `@observable accessor \" + String(context.name) + \"` instead of `@observable \" + String(context.name) + \"`\");\n }\n assert20223DecoratorType(context, [\"accessor\"]);\n }\n var ann = this;\n var kind = context.kind,\n name = context.name;\n // The laziness here is not ideal... It's a workaround to how 2022.3 Decorators are implemented:\n // `addInitializer` callbacks are executed _before_ any accessors are defined (instead of the ideal-for-us right after each).\n // This means that, if we were to do our stuff in an `addInitializer`, we'd attempt to read a private slot\n // before it has been initialized. The runtime doesn't like that and throws a `Cannot read private member\n // from an object whose class did not declare it` error.\n // TODO: it seems that this will not be required anymore in the final version of the spec\n // See TODO: link\n var initializedObjects = new WeakSet();\n function initializeObservable(target, value) {\n var _ann$options_$enhance, _ann$options_;\n var adm = asObservableObject(target)[$mobx];\n var observable = new ObservableValue(value, (_ann$options_$enhance = (_ann$options_ = ann.options_) == null ? void 0 : _ann$options_.enhancer) != null ? _ann$options_$enhance : deepEnhancer, true ? adm.name_ + \".\" + name.toString() : 0, false);\n adm.values_.set(name, observable);\n initializedObjects.add(target);\n }\n if (kind == \"accessor\") {\n return {\n get: function get() {\n if (!initializedObjects.has(this)) {\n initializeObservable(this, desc.get.call(this));\n }\n return this[$mobx].getObservablePropValue_(name);\n },\n set: function set(value) {\n if (!initializedObjects.has(this)) {\n initializeObservable(this, value);\n }\n return this[$mobx].setObservablePropValue_(name, value);\n },\n init: function init(value) {\n if (!initializedObjects.has(this)) {\n initializeObservable(this, value);\n }\n return value;\n }\n };\n }\n return;\n}\nfunction assertObservableDescriptor(adm, _ref, key, descriptor) {\n var annotationType_ = _ref.annotationType_;\n if ( true && !(\"value\" in descriptor)) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' cannot be used on getter/setter properties\"));\n }\n}\n\nvar AUTO = \"true\";\nvar autoAnnotation = /*#__PURE__*/createAutoAnnotation();\nfunction createAutoAnnotation(options) {\n return {\n annotationType_: AUTO,\n options_: options,\n make_: make_$5,\n extend_: extend_$5,\n decorate_20223_: decorate_20223_$5\n };\n}\nfunction make_$5(adm, key, descriptor, source) {\n var _this$options_3, _this$options_4;\n // getter -> computed\n if (descriptor.get) {\n return computed.make_(adm, key, descriptor, source);\n }\n // lone setter -> action setter\n if (descriptor.set) {\n // TODO make action applicable to setter and delegate to action.make_\n var set = createAction(key.toString(), descriptor.set);\n // own\n if (source === adm.target_) {\n return adm.defineProperty_(key, {\n configurable: globalState.safeDescriptors ? adm.isPlainObject_ : true,\n set: set\n }) === null ? 0 /* MakeResult.Cancel */ : 2 /* MakeResult.Continue */;\n }\n // proto\n defineProperty(source, key, {\n configurable: true,\n set: set\n });\n return 2 /* MakeResult.Continue */;\n }\n // function on proto -> autoAction/flow\n if (source !== adm.target_ && typeof descriptor.value === \"function\") {\n var _this$options_2;\n if (isGenerator(descriptor.value)) {\n var _this$options_;\n var flowAnnotation = (_this$options_ = this.options_) != null && _this$options_.autoBind ? flow.bound : flow;\n return flowAnnotation.make_(adm, key, descriptor, source);\n }\n var actionAnnotation = (_this$options_2 = this.options_) != null && _this$options_2.autoBind ? autoAction.bound : autoAction;\n return actionAnnotation.make_(adm, key, descriptor, source);\n }\n // other -> observable\n // Copy props from proto as well, see test:\n // \"decorate should work with Object.create\"\n var observableAnnotation = ((_this$options_3 = this.options_) == null ? void 0 : _this$options_3.deep) === false ? observable.ref : observable;\n // if function respect autoBind option\n if (typeof descriptor.value === \"function\" && (_this$options_4 = this.options_) != null && _this$options_4.autoBind) {\n var _adm$proxy_;\n descriptor.value = descriptor.value.bind((_adm$proxy_ = adm.proxy_) != null ? _adm$proxy_ : adm.target_);\n }\n return observableAnnotation.make_(adm, key, descriptor, source);\n}\nfunction extend_$5(adm, key, descriptor, proxyTrap) {\n var _this$options_5, _this$options_6;\n // getter -> computed\n if (descriptor.get) {\n return computed.extend_(adm, key, descriptor, proxyTrap);\n }\n // lone setter -> action setter\n if (descriptor.set) {\n // TODO make action applicable to setter and delegate to action.extend_\n return adm.defineProperty_(key, {\n configurable: globalState.safeDescriptors ? adm.isPlainObject_ : true,\n set: createAction(key.toString(), descriptor.set)\n }, proxyTrap);\n }\n // other -> observable\n // if function respect autoBind option\n if (typeof descriptor.value === \"function\" && (_this$options_5 = this.options_) != null && _this$options_5.autoBind) {\n var _adm$proxy_2;\n descriptor.value = descriptor.value.bind((_adm$proxy_2 = adm.proxy_) != null ? _adm$proxy_2 : adm.target_);\n }\n var observableAnnotation = ((_this$options_6 = this.options_) == null ? void 0 : _this$options_6.deep) === false ? observable.ref : observable;\n return observableAnnotation.extend_(adm, key, descriptor, proxyTrap);\n}\nfunction decorate_20223_$5(desc, context) {\n die(\"'\" + this.annotationType_ + \"' cannot be used as a decorator\");\n}\n\nvar OBSERVABLE = \"observable\";\nvar OBSERVABLE_REF = \"observable.ref\";\nvar OBSERVABLE_SHALLOW = \"observable.shallow\";\nvar OBSERVABLE_STRUCT = \"observable.struct\";\n// Predefined bags of create observable options, to avoid allocating temporarily option objects\n// in the majority of cases\nvar defaultCreateObservableOptions = {\n deep: true,\n name: undefined,\n defaultDecorator: undefined,\n proxy: true\n};\nObject.freeze(defaultCreateObservableOptions);\nfunction asCreateObservableOptions(thing) {\n return thing || defaultCreateObservableOptions;\n}\nvar observableAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE);\nvar observableRefAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE_REF, {\n enhancer: referenceEnhancer\n});\nvar observableShallowAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE_SHALLOW, {\n enhancer: shallowEnhancer\n});\nvar observableStructAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE_STRUCT, {\n enhancer: refStructEnhancer\n});\nvar observableDecoratorAnnotation = /*#__PURE__*/createDecoratorAnnotation(observableAnnotation);\nfunction getEnhancerFromOptions(options) {\n return options.deep === true ? deepEnhancer : options.deep === false ? referenceEnhancer : getEnhancerFromAnnotation(options.defaultDecorator);\n}\nfunction getAnnotationFromOptions(options) {\n var _options$defaultDecor;\n return options ? (_options$defaultDecor = options.defaultDecorator) != null ? _options$defaultDecor : createAutoAnnotation(options) : undefined;\n}\nfunction getEnhancerFromAnnotation(annotation) {\n var _annotation$options_$, _annotation$options_;\n return !annotation ? deepEnhancer : (_annotation$options_$ = (_annotation$options_ = annotation.options_) == null ? void 0 : _annotation$options_.enhancer) != null ? _annotation$options_$ : deepEnhancer;\n}\n/**\n * Turns an object, array or function into a reactive structure.\n * @param v the value which should become observable.\n */\nfunction createObservable(v, arg2, arg3) {\n // @observable someProp; (2022.3 Decorators)\n if (is20223Decorator(arg2)) {\n return observableAnnotation.decorate_20223_(v, arg2);\n }\n // @observable someProp;\n if (isStringish(arg2)) {\n storeAnnotation(v, arg2, observableAnnotation);\n return;\n }\n // already observable - ignore\n if (isObservable(v)) {\n return v;\n }\n // plain object\n if (isPlainObject(v)) {\n return observable.object(v, arg2, arg3);\n }\n // Array\n if (Array.isArray(v)) {\n return observable.array(v, arg2);\n }\n // Map\n if (isES6Map(v)) {\n return observable.map(v, arg2);\n }\n // Set\n if (isES6Set(v)) {\n return observable.set(v, arg2);\n }\n // other object - ignore\n if (typeof v === \"object\" && v !== null) {\n return v;\n }\n // anything else\n return observable.box(v, arg2);\n}\nassign(createObservable, observableDecoratorAnnotation);\nvar observableFactories = {\n box: function box(value, options) {\n var o = asCreateObservableOptions(options);\n return new ObservableValue(value, getEnhancerFromOptions(o), o.name, true, o.equals);\n },\n array: function array(initialValues, options) {\n var o = asCreateObservableOptions(options);\n return (globalState.useProxies === false || o.proxy === false ? createLegacyArray : createObservableArray)(initialValues, getEnhancerFromOptions(o), o.name);\n },\n map: function map(initialValues, options) {\n var o = asCreateObservableOptions(options);\n return new ObservableMap(initialValues, getEnhancerFromOptions(o), o.name);\n },\n set: function set(initialValues, options) {\n var o = asCreateObservableOptions(options);\n return new ObservableSet(initialValues, getEnhancerFromOptions(o), o.name);\n },\n object: function object(props, decorators, options) {\n return initObservable(function () {\n return extendObservable(globalState.useProxies === false || (options == null ? void 0 : options.proxy) === false ? asObservableObject({}, options) : asDynamicObservableObject({}, options), props, decorators);\n });\n },\n ref: /*#__PURE__*/createDecoratorAnnotation(observableRefAnnotation),\n shallow: /*#__PURE__*/createDecoratorAnnotation(observableShallowAnnotation),\n deep: observableDecoratorAnnotation,\n struct: /*#__PURE__*/createDecoratorAnnotation(observableStructAnnotation)\n};\n// eslint-disable-next-line\nvar observable = /*#__PURE__*/assign(createObservable, observableFactories);\n\nvar COMPUTED = \"computed\";\nvar COMPUTED_STRUCT = \"computed.struct\";\nvar computedAnnotation = /*#__PURE__*/createComputedAnnotation(COMPUTED);\nvar computedStructAnnotation = /*#__PURE__*/createComputedAnnotation(COMPUTED_STRUCT, {\n equals: comparer.structural\n});\n/**\n * Decorator for class properties: @computed get value() { return expr; }.\n * For legacy purposes also invokable as ES5 observable created: `computed(() => expr)`;\n */\nvar computed = function computed(arg1, arg2) {\n if (is20223Decorator(arg2)) {\n // @computed (2022.3 Decorators)\n return computedAnnotation.decorate_20223_(arg1, arg2);\n }\n if (isStringish(arg2)) {\n // @computed\n return storeAnnotation(arg1, arg2, computedAnnotation);\n }\n if (isPlainObject(arg1)) {\n // @computed({ options })\n return createDecoratorAnnotation(createComputedAnnotation(COMPUTED, arg1));\n }\n // computed(expr, options?)\n if (true) {\n if (!isFunction(arg1)) {\n die(\"First argument to `computed` should be an expression.\");\n }\n if (isFunction(arg2)) {\n die(\"A setter as second argument is no longer supported, use `{ set: fn }` option instead\");\n }\n }\n var opts = isPlainObject(arg2) ? arg2 : {};\n opts.get = arg1;\n opts.name || (opts.name = arg1.name || \"\"); /* for generated name */\n return new ComputedValue(opts);\n};\nObject.assign(computed, computedAnnotation);\ncomputed.struct = /*#__PURE__*/createDecoratorAnnotation(computedStructAnnotation);\n\nvar _getDescriptor$config, _getDescriptor;\n// we don't use globalState for these in order to avoid possible issues with multiple\n// mobx versions\nvar currentActionId = 0;\nvar nextActionId = 1;\nvar isFunctionNameConfigurable = (_getDescriptor$config = (_getDescriptor = /*#__PURE__*/getDescriptor(function () {}, \"name\")) == null ? void 0 : _getDescriptor.configurable) != null ? _getDescriptor$config : false;\n// we can safely recycle this object\nvar tmpNameDescriptor = {\n value: \"action\",\n configurable: true,\n writable: false,\n enumerable: false\n};\nfunction createAction(actionName, fn, autoAction, ref) {\n if (autoAction === void 0) {\n autoAction = false;\n }\n if (true) {\n if (!isFunction(fn)) {\n die(\"`action` can only be invoked on functions\");\n }\n if (typeof actionName !== \"string\" || !actionName) {\n die(\"actions should have valid names, got: '\" + actionName + \"'\");\n }\n }\n function res() {\n return executeAction(actionName, autoAction, fn, ref || this, arguments);\n }\n res.isMobxAction = true;\n res.toString = function () {\n return fn.toString();\n };\n if (isFunctionNameConfigurable) {\n tmpNameDescriptor.value = actionName;\n defineProperty(res, \"name\", tmpNameDescriptor);\n }\n return res;\n}\nfunction executeAction(actionName, canRunAsDerivation, fn, scope, args) {\n var runInfo = _startAction(actionName, canRunAsDerivation, scope, args);\n try {\n return fn.apply(scope, args);\n } catch (err) {\n runInfo.error_ = err;\n throw err;\n } finally {\n _endAction(runInfo);\n }\n}\nfunction _startAction(actionName, canRunAsDerivation,\n// true for autoAction\nscope, args) {\n var notifySpy_ = true && isSpyEnabled() && !!actionName;\n var startTime_ = 0;\n if ( true && notifySpy_) {\n startTime_ = Date.now();\n var flattenedArgs = args ? Array.from(args) : EMPTY_ARRAY;\n spyReportStart({\n type: ACTION,\n name: actionName,\n object: scope,\n arguments: flattenedArgs\n });\n }\n var prevDerivation_ = globalState.trackingDerivation;\n var runAsAction = !canRunAsDerivation || !prevDerivation_;\n startBatch();\n var prevAllowStateChanges_ = globalState.allowStateChanges; // by default preserve previous allow\n if (runAsAction) {\n untrackedStart();\n prevAllowStateChanges_ = allowStateChangesStart(true);\n }\n var prevAllowStateReads_ = allowStateReadsStart(true);\n var runInfo = {\n runAsAction_: runAsAction,\n prevDerivation_: prevDerivation_,\n prevAllowStateChanges_: prevAllowStateChanges_,\n prevAllowStateReads_: prevAllowStateReads_,\n notifySpy_: notifySpy_,\n startTime_: startTime_,\n actionId_: nextActionId++,\n parentActionId_: currentActionId\n };\n currentActionId = runInfo.actionId_;\n return runInfo;\n}\nfunction _endAction(runInfo) {\n if (currentActionId !== runInfo.actionId_) {\n die(30);\n }\n currentActionId = runInfo.parentActionId_;\n if (runInfo.error_ !== undefined) {\n globalState.suppressReactionErrors = true;\n }\n allowStateChangesEnd(runInfo.prevAllowStateChanges_);\n allowStateReadsEnd(runInfo.prevAllowStateReads_);\n endBatch();\n if (runInfo.runAsAction_) {\n untrackedEnd(runInfo.prevDerivation_);\n }\n if ( true && runInfo.notifySpy_) {\n spyReportEnd({\n time: Date.now() - runInfo.startTime_\n });\n }\n globalState.suppressReactionErrors = false;\n}\nfunction allowStateChanges(allowStateChanges, func) {\n var prev = allowStateChangesStart(allowStateChanges);\n try {\n return func();\n } finally {\n allowStateChangesEnd(prev);\n }\n}\nfunction allowStateChangesStart(allowStateChanges) {\n var prev = globalState.allowStateChanges;\n globalState.allowStateChanges = allowStateChanges;\n return prev;\n}\nfunction allowStateChangesEnd(prev) {\n globalState.allowStateChanges = prev;\n}\n\nvar CREATE = \"create\";\nvar ObservableValue = /*#__PURE__*/function (_Atom) {\n function ObservableValue(value, enhancer, name_, notifySpy, equals) {\n var _this;\n if (name_ === void 0) {\n name_ = true ? \"ObservableValue@\" + getNextId() : 0;\n }\n if (notifySpy === void 0) {\n notifySpy = true;\n }\n if (equals === void 0) {\n equals = comparer[\"default\"];\n }\n _this = _Atom.call(this, name_) || this;\n _this.enhancer = void 0;\n _this.name_ = void 0;\n _this.equals = void 0;\n _this.hasUnreportedChange_ = false;\n _this.interceptors_ = void 0;\n _this.changeListeners_ = void 0;\n _this.value_ = void 0;\n _this.dehancer = void 0;\n _this.enhancer = enhancer;\n _this.name_ = name_;\n _this.equals = equals;\n _this.value_ = enhancer(value, undefined, name_);\n if ( true && notifySpy && isSpyEnabled()) {\n // only notify spy if this is a stand-alone observable\n spyReport({\n type: CREATE,\n object: _this,\n observableKind: \"value\",\n debugObjectName: _this.name_,\n newValue: \"\" + _this.value_\n });\n }\n return _this;\n }\n _inheritsLoose(ObservableValue, _Atom);\n var _proto = ObservableValue.prototype;\n _proto.dehanceValue = function dehanceValue(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.set = function set(newValue) {\n var oldValue = this.value_;\n newValue = this.prepareNewValue_(newValue);\n if (newValue !== globalState.UNCHANGED) {\n var notifySpy = isSpyEnabled();\n if ( true && notifySpy) {\n spyReportStart({\n type: UPDATE,\n object: this,\n observableKind: \"value\",\n debugObjectName: this.name_,\n newValue: newValue,\n oldValue: oldValue\n });\n }\n this.setNewValue_(newValue);\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n };\n _proto.prepareNewValue_ = function prepareNewValue_(newValue) {\n checkIfStateModificationsAreAllowed(this);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this,\n type: UPDATE,\n newValue: newValue\n });\n if (!change) {\n return globalState.UNCHANGED;\n }\n newValue = change.newValue;\n }\n // apply modifier\n newValue = this.enhancer(newValue, this.value_, this.name_);\n return this.equals(this.value_, newValue) ? globalState.UNCHANGED : newValue;\n };\n _proto.setNewValue_ = function setNewValue_(newValue) {\n var oldValue = this.value_;\n this.value_ = newValue;\n this.reportChanged();\n if (hasListeners(this)) {\n notifyListeners(this, {\n type: UPDATE,\n object: this,\n newValue: newValue,\n oldValue: oldValue\n });\n }\n };\n _proto.get = function get() {\n this.reportObserved();\n return this.dehanceValue(this.value_);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n if (fireImmediately) {\n listener({\n observableKind: \"value\",\n debugObjectName: this.name_,\n object: this,\n type: UPDATE,\n newValue: this.value_,\n oldValue: undefined\n });\n }\n return registerListener(this, listener);\n };\n _proto.raw = function raw() {\n // used by MST ot get undehanced value\n return this.value_;\n };\n _proto.toJSON = function toJSON() {\n return this.get();\n };\n _proto.toString = function toString() {\n return this.name_ + \"[\" + this.value_ + \"]\";\n };\n _proto.valueOf = function valueOf() {\n return toPrimitive(this.get());\n };\n _proto[Symbol.toPrimitive] = function () {\n return this.valueOf();\n };\n return ObservableValue;\n}(Atom);\nvar isObservableValue = /*#__PURE__*/createInstanceofPredicate(\"ObservableValue\", ObservableValue);\n\n/**\n * A node in the state dependency root that observes other nodes, and can be observed itself.\n *\n * ComputedValue will remember the result of the computation for the duration of the batch, or\n * while being observed.\n *\n * During this time it will recompute only when one of its direct dependencies changed,\n * but only when it is being accessed with `ComputedValue.get()`.\n *\n * Implementation description:\n * 1. First time it's being accessed it will compute and remember result\n * give back remembered result until 2. happens\n * 2. First time any deep dependency change, propagate POSSIBLY_STALE to all observers, wait for 3.\n * 3. When it's being accessed, recompute if any shallow dependency changed.\n * if result changed: propagate STALE to all observers, that were POSSIBLY_STALE from the last step.\n * go to step 2. either way\n *\n * If at any point it's outside batch and it isn't observed: reset everything and go to 1.\n */\nvar ComputedValue = /*#__PURE__*/function () {\n /**\n * Create a new computed value based on a function expression.\n *\n * The `name` property is for debug purposes only.\n *\n * The `equals` property specifies the comparer function to use to determine if a newly produced\n * value differs from the previous value. Two comparers are provided in the library; `defaultComparer`\n * compares based on identity comparison (===), and `structuralComparer` deeply compares the structure.\n * Structural comparison can be convenient if you always produce a new aggregated object and\n * don't want to notify observers if it is structurally the same.\n * This is useful for working with vectors, mouse coordinates etc.\n */\n function ComputedValue(options) {\n this.dependenciesState_ = IDerivationState_.NOT_TRACKING_;\n this.observing_ = [];\n // nodes we are looking at. Our value depends on these nodes\n this.newObserving_ = null;\n // during tracking it's an array with new observed observers\n this.observers_ = new Set();\n this.runId_ = 0;\n this.lastAccessedBy_ = 0;\n this.lowestObserverState_ = IDerivationState_.UP_TO_DATE_;\n this.unboundDepsCount_ = 0;\n this.value_ = new CaughtException(null);\n this.name_ = void 0;\n this.triggeredBy_ = void 0;\n this.flags_ = 0;\n this.derivation = void 0;\n // N.B: unminified as it is used by MST\n this.setter_ = void 0;\n this.isTracing_ = TraceMode.NONE;\n this.scope_ = void 0;\n this.equals_ = void 0;\n this.requiresReaction_ = void 0;\n this.keepAlive_ = void 0;\n this.onBOL = void 0;\n this.onBUOL = void 0;\n if (!options.get) {\n die(31);\n }\n this.derivation = options.get;\n this.name_ = options.name || ( true ? \"ComputedValue@\" + getNextId() : 0);\n if (options.set) {\n this.setter_ = createAction( true ? this.name_ + \"-setter\" : 0, options.set);\n }\n this.equals_ = options.equals || (options.compareStructural || options.struct ? comparer.structural : comparer[\"default\"]);\n this.scope_ = options.context;\n this.requiresReaction_ = options.requiresReaction;\n this.keepAlive_ = !!options.keepAlive;\n }\n var _proto = ComputedValue.prototype;\n _proto.onBecomeStale_ = function onBecomeStale_() {\n propagateMaybeChanged(this);\n };\n _proto.onBO = function onBO() {\n if (this.onBOL) {\n this.onBOL.forEach(function (listener) {\n return listener();\n });\n }\n };\n _proto.onBUO = function onBUO() {\n if (this.onBUOL) {\n this.onBUOL.forEach(function (listener) {\n return listener();\n });\n }\n }\n // to check for cycles\n ;\n /**\n * Returns the current value of this computed value.\n * Will evaluate its computation first if needed.\n */\n _proto.get = function get() {\n if (this.isComputing) {\n die(32, this.name_, this.derivation);\n }\n if (globalState.inBatch === 0 &&\n // !globalState.trackingDerivatpion &&\n this.observers_.size === 0 && !this.keepAlive_) {\n if (shouldCompute(this)) {\n this.warnAboutUntrackedRead_();\n startBatch(); // See perf test 'computed memoization'\n this.value_ = this.computeValue_(false);\n endBatch();\n }\n } else {\n reportObserved(this);\n if (shouldCompute(this)) {\n var prevTrackingContext = globalState.trackingContext;\n if (this.keepAlive_ && !prevTrackingContext) {\n globalState.trackingContext = this;\n }\n if (this.trackAndCompute()) {\n propagateChangeConfirmed(this);\n }\n globalState.trackingContext = prevTrackingContext;\n }\n }\n var result = this.value_;\n if (isCaughtException(result)) {\n throw result.cause;\n }\n return result;\n };\n _proto.set = function set(value) {\n if (this.setter_) {\n if (this.isRunningSetter) {\n die(33, this.name_);\n }\n this.isRunningSetter = true;\n try {\n this.setter_.call(this.scope_, value);\n } finally {\n this.isRunningSetter = false;\n }\n } else {\n die(34, this.name_);\n }\n };\n _proto.trackAndCompute = function trackAndCompute() {\n // N.B: unminified as it is used by MST\n var oldValue = this.value_;\n var wasSuspended = /* see #1208 */this.dependenciesState_ === IDerivationState_.NOT_TRACKING_;\n var newValue = this.computeValue_(true);\n var changed = wasSuspended || isCaughtException(oldValue) || isCaughtException(newValue) || !this.equals_(oldValue, newValue);\n if (changed) {\n this.value_ = newValue;\n if ( true && isSpyEnabled()) {\n spyReport({\n observableKind: \"computed\",\n debugObjectName: this.name_,\n object: this.scope_,\n type: \"update\",\n oldValue: oldValue,\n newValue: newValue\n });\n }\n }\n return changed;\n };\n _proto.computeValue_ = function computeValue_(track) {\n this.isComputing = true;\n // don't allow state changes during computation\n var prev = allowStateChangesStart(false);\n var res;\n if (track) {\n res = trackDerivedFunction(this, this.derivation, this.scope_);\n } else {\n if (globalState.disableErrorBoundaries === true) {\n res = this.derivation.call(this.scope_);\n } else {\n try {\n res = this.derivation.call(this.scope_);\n } catch (e) {\n res = new CaughtException(e);\n }\n }\n }\n allowStateChangesEnd(prev);\n this.isComputing = false;\n return res;\n };\n _proto.suspend_ = function suspend_() {\n if (!this.keepAlive_) {\n clearObserving(this);\n this.value_ = undefined; // don't hold on to computed value!\n if ( true && this.isTracing_ !== TraceMode.NONE) {\n console.log(\"[mobx.trace] Computed value '\" + this.name_ + \"' was suspended and it will recompute on the next access.\");\n }\n }\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n var _this = this;\n var firstTime = true;\n var prevValue = undefined;\n return autorun(function () {\n // TODO: why is this in a different place than the spyReport() function? in all other observables it's called in the same place\n var newValue = _this.get();\n if (!firstTime || fireImmediately) {\n var prevU = untrackedStart();\n listener({\n observableKind: \"computed\",\n debugObjectName: _this.name_,\n type: UPDATE,\n object: _this,\n newValue: newValue,\n oldValue: prevValue\n });\n untrackedEnd(prevU);\n }\n firstTime = false;\n prevValue = newValue;\n });\n };\n _proto.warnAboutUntrackedRead_ = function warnAboutUntrackedRead_() {\n if (false) {}\n if (this.isTracing_ !== TraceMode.NONE) {\n console.log(\"[mobx.trace] Computed value '\" + this.name_ + \"' is being read outside a reactive context. Doing a full recompute.\");\n }\n if (typeof this.requiresReaction_ === \"boolean\" ? this.requiresReaction_ : globalState.computedRequiresReaction) {\n console.warn(\"[mobx] Computed value '\" + this.name_ + \"' is being read outside a reactive context. Doing a full recompute.\");\n }\n };\n _proto.toString = function toString() {\n return this.name_ + \"[\" + this.derivation.toString() + \"]\";\n };\n _proto.valueOf = function valueOf() {\n return toPrimitive(this.get());\n };\n _proto[Symbol.toPrimitive] = function () {\n return this.valueOf();\n };\n return _createClass(ComputedValue, [{\n key: \"isComputing\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isComputingMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isComputingMask_, newValue);\n }\n }, {\n key: \"isRunningSetter\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isRunningSetterMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isRunningSetterMask_, newValue);\n }\n }, {\n key: \"isBeingObserved\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isBeingObservedMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isBeingObservedMask_, newValue);\n }\n }, {\n key: \"isPendingUnobservation\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isPendingUnobservationMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isPendingUnobservationMask_, newValue);\n }\n }, {\n key: \"diffValue\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.diffValueMask_) ? 1 : 0;\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.diffValueMask_, newValue === 1 ? true : false);\n }\n }]);\n}();\nComputedValue.isComputingMask_ = 1;\nComputedValue.isRunningSetterMask_ = 2;\nComputedValue.isBeingObservedMask_ = 4;\nComputedValue.isPendingUnobservationMask_ = 8;\nComputedValue.diffValueMask_ = 16;\nvar isComputedValue = /*#__PURE__*/createInstanceofPredicate(\"ComputedValue\", ComputedValue);\n\nvar IDerivationState_;\n(function (IDerivationState_) {\n // before being run or (outside batch and not being observed)\n // at this point derivation is not holding any data about dependency tree\n IDerivationState_[IDerivationState_[\"NOT_TRACKING_\"] = -1] = \"NOT_TRACKING_\";\n // no shallow dependency changed since last computation\n // won't recalculate derivation\n // this is what makes mobx fast\n IDerivationState_[IDerivationState_[\"UP_TO_DATE_\"] = 0] = \"UP_TO_DATE_\";\n // some deep dependency changed, but don't know if shallow dependency changed\n // will require to check first if UP_TO_DATE or POSSIBLY_STALE\n // currently only ComputedValue will propagate POSSIBLY_STALE\n //\n // having this state is second big optimization:\n // don't have to recompute on every dependency change, but only when it's needed\n IDerivationState_[IDerivationState_[\"POSSIBLY_STALE_\"] = 1] = \"POSSIBLY_STALE_\";\n // A shallow dependency has changed since last computation and the derivation\n // will need to recompute when it's needed next.\n IDerivationState_[IDerivationState_[\"STALE_\"] = 2] = \"STALE_\";\n})(IDerivationState_ || (IDerivationState_ = {}));\nvar TraceMode;\n(function (TraceMode) {\n TraceMode[TraceMode[\"NONE\"] = 0] = \"NONE\";\n TraceMode[TraceMode[\"LOG\"] = 1] = \"LOG\";\n TraceMode[TraceMode[\"BREAK\"] = 2] = \"BREAK\";\n})(TraceMode || (TraceMode = {}));\nvar CaughtException = function CaughtException(cause) {\n this.cause = void 0;\n this.cause = cause;\n // Empty\n};\nfunction isCaughtException(e) {\n return e instanceof CaughtException;\n}\n/**\n * Finds out whether any dependency of the derivation has actually changed.\n * If dependenciesState is 1 then it will recalculate dependencies,\n * if any dependency changed it will propagate it by changing dependenciesState to 2.\n *\n * By iterating over the dependencies in the same order that they were reported and\n * stopping on the first change, all the recalculations are only called for ComputedValues\n * that will be tracked by derivation. That is because we assume that if the first x\n * dependencies of the derivation doesn't change then the derivation should run the same way\n * up until accessing x-th dependency.\n */\nfunction shouldCompute(derivation) {\n switch (derivation.dependenciesState_) {\n case IDerivationState_.UP_TO_DATE_:\n return false;\n case IDerivationState_.NOT_TRACKING_:\n case IDerivationState_.STALE_:\n return true;\n case IDerivationState_.POSSIBLY_STALE_:\n {\n // state propagation can occur outside of action/reactive context #2195\n var prevAllowStateReads = allowStateReadsStart(true);\n var prevUntracked = untrackedStart(); // no need for those computeds to be reported, they will be picked up in trackDerivedFunction.\n var obs = derivation.observing_,\n l = obs.length;\n for (var i = 0; i < l; i++) {\n var obj = obs[i];\n if (isComputedValue(obj)) {\n if (globalState.disableErrorBoundaries) {\n obj.get();\n } else {\n try {\n obj.get();\n } catch (e) {\n // we are not interested in the value *or* exception at this moment, but if there is one, notify all\n untrackedEnd(prevUntracked);\n allowStateReadsEnd(prevAllowStateReads);\n return true;\n }\n }\n // if ComputedValue `obj` actually changed it will be computed and propagated to its observers.\n // and `derivation` is an observer of `obj`\n // invariantShouldCompute(derivation)\n if (derivation.dependenciesState_ === IDerivationState_.STALE_) {\n untrackedEnd(prevUntracked);\n allowStateReadsEnd(prevAllowStateReads);\n return true;\n }\n }\n }\n changeDependenciesStateTo0(derivation);\n untrackedEnd(prevUntracked);\n allowStateReadsEnd(prevAllowStateReads);\n return false;\n }\n }\n}\nfunction isComputingDerivation() {\n return globalState.trackingDerivation !== null; // filter out actions inside computations\n}\nfunction checkIfStateModificationsAreAllowed(atom) {\n if (false) {}\n var hasObservers = atom.observers_.size > 0;\n // Should not be possible to change observed state outside strict mode, except during initialization, see #563\n if (!globalState.allowStateChanges && (hasObservers || globalState.enforceActions === \"always\")) {\n console.warn(\"[MobX] \" + (globalState.enforceActions ? \"Since strict-mode is enabled, changing (observed) observable values without using an action is not allowed. Tried to modify: \" : \"Side effects like changing state are not allowed at this point. Are you trying to modify state from, for example, a computed value or the render function of a React component? You can wrap side effects in 'runInAction' (or decorate functions with 'action') if needed. Tried to modify: \") + atom.name_);\n }\n}\nfunction checkIfStateReadsAreAllowed(observable) {\n if ( true && !globalState.allowStateReads && globalState.observableRequiresReaction) {\n console.warn(\"[mobx] Observable '\" + observable.name_ + \"' being read outside a reactive context.\");\n }\n}\n/**\n * Executes the provided function `f` and tracks which observables are being accessed.\n * The tracking information is stored on the `derivation` object and the derivation is registered\n * as observer of any of the accessed observables.\n */\nfunction trackDerivedFunction(derivation, f, context) {\n var prevAllowStateReads = allowStateReadsStart(true);\n changeDependenciesStateTo0(derivation);\n // Preallocate array; will be trimmed by bindDependencies.\n derivation.newObserving_ = new Array(\n // Reserve constant space for initial dependencies, dynamic space otherwise.\n // See https://github.com/mobxjs/mobx/pull/3833\n derivation.runId_ === 0 ? 100 : derivation.observing_.length);\n derivation.unboundDepsCount_ = 0;\n derivation.runId_ = ++globalState.runId;\n var prevTracking = globalState.trackingDerivation;\n globalState.trackingDerivation = derivation;\n globalState.inBatch++;\n var result;\n if (globalState.disableErrorBoundaries === true) {\n result = f.call(context);\n } else {\n try {\n result = f.call(context);\n } catch (e) {\n result = new CaughtException(e);\n }\n }\n globalState.inBatch--;\n globalState.trackingDerivation = prevTracking;\n bindDependencies(derivation);\n warnAboutDerivationWithoutDependencies(derivation);\n allowStateReadsEnd(prevAllowStateReads);\n return result;\n}\nfunction warnAboutDerivationWithoutDependencies(derivation) {\n if (false) {}\n if (derivation.observing_.length !== 0) {\n return;\n }\n if (typeof derivation.requiresObservable_ === \"boolean\" ? derivation.requiresObservable_ : globalState.reactionRequiresObservable) {\n console.warn(\"[mobx] Derivation '\" + derivation.name_ + \"' is created/updated without reading any observable value.\");\n }\n}\n/**\n * diffs newObserving with observing.\n * update observing to be newObserving with unique observables\n * notify observers that become observed/unobserved\n */\nfunction bindDependencies(derivation) {\n // invariant(derivation.dependenciesState !== IDerivationState.NOT_TRACKING, \"INTERNAL ERROR bindDependencies expects derivation.dependenciesState !== -1\");\n var prevObserving = derivation.observing_;\n var observing = derivation.observing_ = derivation.newObserving_;\n var lowestNewObservingDerivationState = IDerivationState_.UP_TO_DATE_;\n // Go through all new observables and check diffValue: (this list can contain duplicates):\n // 0: first occurrence, change to 1 and keep it\n // 1: extra occurrence, drop it\n var i0 = 0,\n l = derivation.unboundDepsCount_;\n for (var i = 0; i < l; i++) {\n var dep = observing[i];\n if (dep.diffValue === 0) {\n dep.diffValue = 1;\n if (i0 !== i) {\n observing[i0] = dep;\n }\n i0++;\n }\n // Upcast is 'safe' here, because if dep is IObservable, `dependenciesState` will be undefined,\n // not hitting the condition\n if (dep.dependenciesState_ > lowestNewObservingDerivationState) {\n lowestNewObservingDerivationState = dep.dependenciesState_;\n }\n }\n observing.length = i0;\n derivation.newObserving_ = null; // newObserving shouldn't be needed outside tracking (statement moved down to work around FF bug, see #614)\n // Go through all old observables and check diffValue: (it is unique after last bindDependencies)\n // 0: it's not in new observables, unobserve it\n // 1: it keeps being observed, don't want to notify it. change to 0\n l = prevObserving.length;\n while (l--) {\n var _dep = prevObserving[l];\n if (_dep.diffValue === 0) {\n removeObserver(_dep, derivation);\n }\n _dep.diffValue = 0;\n }\n // Go through all new observables and check diffValue: (now it should be unique)\n // 0: it was set to 0 in last loop. don't need to do anything.\n // 1: it wasn't observed, let's observe it. set back to 0\n while (i0--) {\n var _dep2 = observing[i0];\n if (_dep2.diffValue === 1) {\n _dep2.diffValue = 0;\n addObserver(_dep2, derivation);\n }\n }\n // Some new observed derivations may become stale during this derivation computation\n // so they have had no chance to propagate staleness (#916)\n if (lowestNewObservingDerivationState !== IDerivationState_.UP_TO_DATE_) {\n derivation.dependenciesState_ = lowestNewObservingDerivationState;\n derivation.onBecomeStale_();\n }\n}\nfunction clearObserving(derivation) {\n // invariant(globalState.inBatch > 0, \"INTERNAL ERROR clearObserving should be called only inside batch\");\n var obs = derivation.observing_;\n derivation.observing_ = [];\n var i = obs.length;\n while (i--) {\n removeObserver(obs[i], derivation);\n }\n derivation.dependenciesState_ = IDerivationState_.NOT_TRACKING_;\n}\nfunction untracked(action) {\n var prev = untrackedStart();\n try {\n return action();\n } finally {\n untrackedEnd(prev);\n }\n}\nfunction untrackedStart() {\n var prev = globalState.trackingDerivation;\n globalState.trackingDerivation = null;\n return prev;\n}\nfunction untrackedEnd(prev) {\n globalState.trackingDerivation = prev;\n}\nfunction allowStateReadsStart(allowStateReads) {\n var prev = globalState.allowStateReads;\n globalState.allowStateReads = allowStateReads;\n return prev;\n}\nfunction allowStateReadsEnd(prev) {\n globalState.allowStateReads = prev;\n}\n/**\n * needed to keep `lowestObserverState` correct. when changing from (2 or 1) to 0\n *\n */\nfunction changeDependenciesStateTo0(derivation) {\n if (derivation.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {\n return;\n }\n derivation.dependenciesState_ = IDerivationState_.UP_TO_DATE_;\n var obs = derivation.observing_;\n var i = obs.length;\n while (i--) {\n obs[i].lowestObserverState_ = IDerivationState_.UP_TO_DATE_;\n }\n}\n\n/**\n * These values will persist if global state is reset\n */\nvar persistentKeys = [\"mobxGuid\", \"spyListeners\", \"enforceActions\", \"computedRequiresReaction\", \"reactionRequiresObservable\", \"observableRequiresReaction\", \"allowStateReads\", \"disableErrorBoundaries\", \"runId\", \"UNCHANGED\", \"useProxies\"];\nvar MobXGlobals = function MobXGlobals() {\n /**\n * MobXGlobals version.\n * MobX compatiblity with other versions loaded in memory as long as this version matches.\n * It indicates that the global state still stores similar information\n *\n * N.B: this version is unrelated to the package version of MobX, and is only the version of the\n * internal state storage of MobX, and can be the same across many different package versions\n */\n this.version = 6;\n /**\n * globally unique token to signal unchanged\n */\n this.UNCHANGED = {};\n /**\n * Currently running derivation\n */\n this.trackingDerivation = null;\n /**\n * Currently running reaction. This determines if we currently have a reactive context.\n * (Tracking derivation is also set for temporal tracking of computed values inside actions,\n * but trackingReaction can only be set by a form of Reaction)\n */\n this.trackingContext = null;\n /**\n * Each time a derivation is tracked, it is assigned a unique run-id\n */\n this.runId = 0;\n /**\n * 'guid' for general purpose. Will be persisted amongst resets.\n */\n this.mobxGuid = 0;\n /**\n * Are we in a batch block? (and how many of them)\n */\n this.inBatch = 0;\n /**\n * Observables that don't have observers anymore, and are about to be\n * suspended, unless somebody else accesses it in the same batch\n *\n * @type {IObservable[]}\n */\n this.pendingUnobservations = [];\n /**\n * List of scheduled, not yet executed, reactions.\n */\n this.pendingReactions = [];\n /**\n * Are we currently processing reactions?\n */\n this.isRunningReactions = false;\n /**\n * Is it allowed to change observables at this point?\n * In general, MobX doesn't allow that when running computations and React.render.\n * To ensure that those functions stay pure.\n */\n this.allowStateChanges = false;\n /**\n * Is it allowed to read observables at this point?\n * Used to hold the state needed for `observableRequiresReaction`\n */\n this.allowStateReads = true;\n /**\n * If strict mode is enabled, state changes are by default not allowed\n */\n this.enforceActions = true;\n /**\n * Spy callbacks\n */\n this.spyListeners = [];\n /**\n * Globally attached error handlers that react specifically to errors in reactions\n */\n this.globalReactionErrorHandlers = [];\n /**\n * Warn if computed values are accessed outside a reactive context\n */\n this.computedRequiresReaction = false;\n /**\n * (Experimental)\n * Warn if you try to create to derivation / reactive context without accessing any observable.\n */\n this.reactionRequiresObservable = false;\n /**\n * (Experimental)\n * Warn if observables are accessed outside a reactive context\n */\n this.observableRequiresReaction = false;\n /*\n * Don't catch and rethrow exceptions. This is useful for inspecting the state of\n * the stack when an exception occurs while debugging.\n */\n this.disableErrorBoundaries = false;\n /*\n * If true, we are already handling an exception in an action. Any errors in reactions should be suppressed, as\n * they are not the cause, see: https://github.com/mobxjs/mobx/issues/1836\n */\n this.suppressReactionErrors = false;\n this.useProxies = true;\n /*\n * print warnings about code that would fail if proxies weren't available\n */\n this.verifyProxies = false;\n /**\n * False forces all object's descriptors to\n * writable: true\n * configurable: true\n */\n this.safeDescriptors = true;\n};\nvar canMergeGlobalState = true;\nvar isolateCalled = false;\nvar globalState = /*#__PURE__*/function () {\n var global = /*#__PURE__*/getGlobal();\n if (global.__mobxInstanceCount > 0 && !global.__mobxGlobals) {\n canMergeGlobalState = false;\n }\n if (global.__mobxGlobals && global.__mobxGlobals.version !== new MobXGlobals().version) {\n canMergeGlobalState = false;\n }\n if (!canMergeGlobalState) {\n // Because this is a IIFE we need to let isolateCalled a chance to change\n // so we run it after the event loop completed at least 1 iteration\n setTimeout(function () {\n if (!isolateCalled) {\n die(35);\n }\n }, 1);\n return new MobXGlobals();\n } else if (global.__mobxGlobals) {\n global.__mobxInstanceCount += 1;\n if (!global.__mobxGlobals.UNCHANGED) {\n global.__mobxGlobals.UNCHANGED = {};\n } // make merge backward compatible\n return global.__mobxGlobals;\n } else {\n global.__mobxInstanceCount = 1;\n return global.__mobxGlobals = /*#__PURE__*/new MobXGlobals();\n }\n}();\nfunction isolateGlobalState() {\n if (globalState.pendingReactions.length || globalState.inBatch || globalState.isRunningReactions) {\n die(36);\n }\n isolateCalled = true;\n if (canMergeGlobalState) {\n var global = getGlobal();\n if (--global.__mobxInstanceCount === 0) {\n global.__mobxGlobals = undefined;\n }\n globalState = new MobXGlobals();\n }\n}\nfunction getGlobalState() {\n return globalState;\n}\n/**\n * For testing purposes only; this will break the internal state of existing observables,\n * but can be used to get back at a stable state after throwing errors\n */\nfunction resetGlobalState() {\n var defaultGlobals = new MobXGlobals();\n for (var key in defaultGlobals) {\n if (persistentKeys.indexOf(key) === -1) {\n globalState[key] = defaultGlobals[key];\n }\n }\n globalState.allowStateChanges = !globalState.enforceActions;\n}\n\nfunction hasObservers(observable) {\n return observable.observers_ && observable.observers_.size > 0;\n}\nfunction getObservers(observable) {\n return observable.observers_;\n}\n// function invariantObservers(observable: IObservable) {\n// const list = observable.observers\n// const map = observable.observersIndexes\n// const l = list.length\n// for (let i = 0; i < l; i++) {\n// const id = list[i].__mapid\n// if (i) {\n// invariant(map[id] === i, \"INTERNAL ERROR maps derivation.__mapid to index in list\") // for performance\n// } else {\n// invariant(!(id in map), \"INTERNAL ERROR observer on index 0 shouldn't be held in map.\") // for performance\n// }\n// }\n// invariant(\n// list.length === 0 || Object.keys(map).length === list.length - 1,\n// \"INTERNAL ERROR there is no junk in map\"\n// )\n// }\nfunction addObserver(observable, node) {\n // invariant(node.dependenciesState !== -1, \"INTERNAL ERROR, can add only dependenciesState !== -1\");\n // invariant(observable._observers.indexOf(node) === -1, \"INTERNAL ERROR add already added node\");\n // invariantObservers(observable);\n observable.observers_.add(node);\n if (observable.lowestObserverState_ > node.dependenciesState_) {\n observable.lowestObserverState_ = node.dependenciesState_;\n }\n // invariantObservers(observable);\n // invariant(observable._observers.indexOf(node) !== -1, \"INTERNAL ERROR didn't add node\");\n}\nfunction removeObserver(observable, node) {\n // invariant(globalState.inBatch > 0, \"INTERNAL ERROR, remove should be called only inside batch\");\n // invariant(observable._observers.indexOf(node) !== -1, \"INTERNAL ERROR remove already removed node\");\n // invariantObservers(observable);\n observable.observers_[\"delete\"](node);\n if (observable.observers_.size === 0) {\n // deleting last observer\n queueForUnobservation(observable);\n }\n // invariantObservers(observable);\n // invariant(observable._observers.indexOf(node) === -1, \"INTERNAL ERROR remove already removed node2\");\n}\nfunction queueForUnobservation(observable) {\n if (observable.isPendingUnobservation === false) {\n // invariant(observable._observers.length === 0, \"INTERNAL ERROR, should only queue for unobservation unobserved observables\");\n observable.isPendingUnobservation = true;\n globalState.pendingUnobservations.push(observable);\n }\n}\n/**\n * Batch starts a transaction, at least for purposes of memoizing ComputedValues when nothing else does.\n * During a batch `onBecomeUnobserved` will be called at most once per observable.\n * Avoids unnecessary recalculations.\n */\nfunction startBatch() {\n globalState.inBatch++;\n}\nfunction endBatch() {\n if (--globalState.inBatch === 0) {\n runReactions();\n // the batch is actually about to finish, all unobserving should happen here.\n var list = globalState.pendingUnobservations;\n for (var i = 0; i < list.length; i++) {\n var observable = list[i];\n observable.isPendingUnobservation = false;\n if (observable.observers_.size === 0) {\n if (observable.isBeingObserved) {\n // if this observable had reactive observers, trigger the hooks\n observable.isBeingObserved = false;\n observable.onBUO();\n }\n if (observable instanceof ComputedValue) {\n // computed values are automatically teared down when the last observer leaves\n // this process happens recursively, this computed might be the last observabe of another, etc..\n observable.suspend_();\n }\n }\n }\n globalState.pendingUnobservations = [];\n }\n}\nfunction reportObserved(observable) {\n checkIfStateReadsAreAllowed(observable);\n var derivation = globalState.trackingDerivation;\n if (derivation !== null) {\n /**\n * Simple optimization, give each derivation run an unique id (runId)\n * Check if last time this observable was accessed the same runId is used\n * if this is the case, the relation is already known\n */\n if (derivation.runId_ !== observable.lastAccessedBy_) {\n observable.lastAccessedBy_ = derivation.runId_;\n // Tried storing newObserving, or observing, or both as Set, but performance didn't come close...\n derivation.newObserving_[derivation.unboundDepsCount_++] = observable;\n if (!observable.isBeingObserved && globalState.trackingContext) {\n observable.isBeingObserved = true;\n observable.onBO();\n }\n }\n return observable.isBeingObserved;\n } else if (observable.observers_.size === 0 && globalState.inBatch > 0) {\n queueForUnobservation(observable);\n }\n return false;\n}\n// function invariantLOS(observable: IObservable, msg: string) {\n// // it's expensive so better not run it in produciton. but temporarily helpful for testing\n// const min = getObservers(observable).reduce((a, b) => Math.min(a, b.dependenciesState), 2)\n// if (min >= observable.lowestObserverState) return // <- the only assumption about `lowestObserverState`\n// throw new Error(\n// \"lowestObserverState is wrong for \" +\n// msg +\n// \" because \" +\n// min +\n// \" < \" +\n// observable.lowestObserverState\n// )\n// }\n/**\n * NOTE: current propagation mechanism will in case of self reruning autoruns behave unexpectedly\n * It will propagate changes to observers from previous run\n * It's hard or maybe impossible (with reasonable perf) to get it right with current approach\n * Hopefully self reruning autoruns aren't a feature people should depend on\n * Also most basic use cases should be ok\n */\n// Called by Atom when its value changes\nfunction propagateChanged(observable) {\n // invariantLOS(observable, \"changed start\");\n if (observable.lowestObserverState_ === IDerivationState_.STALE_) {\n return;\n }\n observable.lowestObserverState_ = IDerivationState_.STALE_;\n // Ideally we use for..of here, but the downcompiled version is really slow...\n observable.observers_.forEach(function (d) {\n if (d.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {\n if ( true && d.isTracing_ !== TraceMode.NONE) {\n logTraceInfo(d, observable);\n }\n d.onBecomeStale_();\n }\n d.dependenciesState_ = IDerivationState_.STALE_;\n });\n // invariantLOS(observable, \"changed end\");\n}\n// Called by ComputedValue when it recalculate and its value changed\nfunction propagateChangeConfirmed(observable) {\n // invariantLOS(observable, \"confirmed start\");\n if (observable.lowestObserverState_ === IDerivationState_.STALE_) {\n return;\n }\n observable.lowestObserverState_ = IDerivationState_.STALE_;\n observable.observers_.forEach(function (d) {\n if (d.dependenciesState_ === IDerivationState_.POSSIBLY_STALE_) {\n d.dependenciesState_ = IDerivationState_.STALE_;\n if ( true && d.isTracing_ !== TraceMode.NONE) {\n logTraceInfo(d, observable);\n }\n } else if (d.dependenciesState_ === IDerivationState_.UP_TO_DATE_ // this happens during computing of `d`, just keep lowestObserverState up to date.\n ) {\n observable.lowestObserverState_ = IDerivationState_.UP_TO_DATE_;\n }\n });\n // invariantLOS(observable, \"confirmed end\");\n}\n// Used by computed when its dependency changed, but we don't wan't to immediately recompute.\nfunction propagateMaybeChanged(observable) {\n // invariantLOS(observable, \"maybe start\");\n if (observable.lowestObserverState_ !== IDerivationState_.UP_TO_DATE_) {\n return;\n }\n observable.lowestObserverState_ = IDerivationState_.POSSIBLY_STALE_;\n observable.observers_.forEach(function (d) {\n if (d.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {\n d.dependenciesState_ = IDerivationState_.POSSIBLY_STALE_;\n d.onBecomeStale_();\n }\n });\n // invariantLOS(observable, \"maybe end\");\n}\nfunction logTraceInfo(derivation, observable) {\n console.log(\"[mobx.trace] '\" + derivation.name_ + \"' is invalidated due to a change in: '\" + observable.name_ + \"'\");\n if (derivation.isTracing_ === TraceMode.BREAK) {\n var lines = [];\n printDepTree(getDependencyTree(derivation), lines, 1);\n // prettier-ignore\n new Function(\"debugger;\\n/*\\nTracing '\" + derivation.name_ + \"'\\n\\nYou are entering this break point because derivation '\" + derivation.name_ + \"' is being traced and '\" + observable.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\" + (derivation instanceof ComputedValue ? derivation.derivation.toString().replace(/[*]\\//g, \"/\") : \"\") + \"\\n\\nThe dependencies for this derivation are:\\n\\n\" + lines.join(\"\\n\") + \"\\n*/\\n \")();\n }\n}\nfunction printDepTree(tree, lines, depth) {\n if (lines.length >= 1000) {\n lines.push(\"(and many more)\");\n return;\n }\n lines.push(\"\" + \"\\t\".repeat(depth - 1) + tree.name);\n if (tree.dependencies) {\n tree.dependencies.forEach(function (child) {\n return printDepTree(child, lines, depth + 1);\n });\n }\n}\n\nvar Reaction = /*#__PURE__*/function () {\n function Reaction(name_, onInvalidate_, errorHandler_, requiresObservable_) {\n if (name_ === void 0) {\n name_ = true ? \"Reaction@\" + getNextId() : 0;\n }\n this.name_ = void 0;\n this.onInvalidate_ = void 0;\n this.errorHandler_ = void 0;\n this.requiresObservable_ = void 0;\n this.observing_ = [];\n // nodes we are looking at. Our value depends on these nodes\n this.newObserving_ = [];\n this.dependenciesState_ = IDerivationState_.NOT_TRACKING_;\n this.runId_ = 0;\n this.unboundDepsCount_ = 0;\n this.flags_ = 0;\n this.isTracing_ = TraceMode.NONE;\n this.name_ = name_;\n this.onInvalidate_ = onInvalidate_;\n this.errorHandler_ = errorHandler_;\n this.requiresObservable_ = requiresObservable_;\n }\n var _proto = Reaction.prototype;\n _proto.onBecomeStale_ = function onBecomeStale_() {\n this.schedule_();\n };\n _proto.schedule_ = function schedule_() {\n if (!this.isScheduled) {\n this.isScheduled = true;\n globalState.pendingReactions.push(this);\n runReactions();\n }\n }\n /**\n * internal, use schedule() if you intend to kick off a reaction\n */;\n _proto.runReaction_ = function runReaction_() {\n if (!this.isDisposed) {\n startBatch();\n this.isScheduled = false;\n var prev = globalState.trackingContext;\n globalState.trackingContext = this;\n if (shouldCompute(this)) {\n this.isTrackPending = true;\n try {\n this.onInvalidate_();\n if ( true && this.isTrackPending && isSpyEnabled()) {\n // onInvalidate didn't trigger track right away..\n spyReport({\n name: this.name_,\n type: \"scheduled-reaction\"\n });\n }\n } catch (e) {\n this.reportExceptionInDerivation_(e);\n }\n }\n globalState.trackingContext = prev;\n endBatch();\n }\n };\n _proto.track = function track(fn) {\n if (this.isDisposed) {\n return;\n // console.warn(\"Reaction already disposed\") // Note: Not a warning / error in mobx 4 either\n }\n startBatch();\n var notify = isSpyEnabled();\n var startTime;\n if ( true && notify) {\n startTime = Date.now();\n spyReportStart({\n name: this.name_,\n type: \"reaction\"\n });\n }\n this.isRunning = true;\n var prevReaction = globalState.trackingContext; // reactions could create reactions...\n globalState.trackingContext = this;\n var result = trackDerivedFunction(this, fn, undefined);\n globalState.trackingContext = prevReaction;\n this.isRunning = false;\n this.isTrackPending = false;\n if (this.isDisposed) {\n // disposed during last run. Clean up everything that was bound after the dispose call.\n clearObserving(this);\n }\n if (isCaughtException(result)) {\n this.reportExceptionInDerivation_(result.cause);\n }\n if ( true && notify) {\n spyReportEnd({\n time: Date.now() - startTime\n });\n }\n endBatch();\n };\n _proto.reportExceptionInDerivation_ = function reportExceptionInDerivation_(error) {\n var _this = this;\n if (this.errorHandler_) {\n this.errorHandler_(error, this);\n return;\n }\n if (globalState.disableErrorBoundaries) {\n throw error;\n }\n var message = true ? \"[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '\" + this + \"'\" : 0;\n if (!globalState.suppressReactionErrors) {\n console.error(message, error);\n /** If debugging brought you here, please, read the above message :-). Tnx! */\n } else if (true) {\n console.warn(\"[mobx] (error in reaction '\" + this.name_ + \"' suppressed, fix error of causing action below)\");\n } // prettier-ignore\n if ( true && isSpyEnabled()) {\n spyReport({\n type: \"error\",\n name: this.name_,\n message: message,\n error: \"\" + error\n });\n }\n globalState.globalReactionErrorHandlers.forEach(function (f) {\n return f(error, _this);\n });\n };\n _proto.dispose = function dispose() {\n if (!this.isDisposed) {\n this.isDisposed = true;\n if (!this.isRunning) {\n // if disposed while running, clean up later. Maybe not optimal, but rare case\n startBatch();\n clearObserving(this);\n endBatch();\n }\n }\n };\n _proto.getDisposer_ = function getDisposer_(abortSignal) {\n var _this2 = this;\n var dispose = function dispose() {\n _this2.dispose();\n abortSignal == null || abortSignal.removeEventListener == null || abortSignal.removeEventListener(\"abort\", dispose);\n };\n abortSignal == null || abortSignal.addEventListener == null || abortSignal.addEventListener(\"abort\", dispose);\n dispose[$mobx] = this;\n return dispose;\n };\n _proto.toString = function toString() {\n return \"Reaction[\" + this.name_ + \"]\";\n };\n _proto.trace = function trace$1(enterBreakPoint) {\n if (enterBreakPoint === void 0) {\n enterBreakPoint = false;\n }\n trace(this, enterBreakPoint);\n };\n return _createClass(Reaction, [{\n key: \"isDisposed\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isDisposedMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isDisposedMask_, newValue);\n }\n }, {\n key: \"isScheduled\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isScheduledMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isScheduledMask_, newValue);\n }\n }, {\n key: \"isTrackPending\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isTrackPendingMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isTrackPendingMask_, newValue);\n }\n }, {\n key: \"isRunning\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isRunningMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isRunningMask_, newValue);\n }\n }, {\n key: \"diffValue\",\n get: function get() {\n return getFlag(this.flags_, Reaction.diffValueMask_) ? 1 : 0;\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.diffValueMask_, newValue === 1 ? true : false);\n }\n }]);\n}();\nReaction.isDisposedMask_ = 1;\nReaction.isScheduledMask_ = 2;\nReaction.isTrackPendingMask_ = 4;\nReaction.isRunningMask_ = 8;\nReaction.diffValueMask_ = 16;\nfunction onReactionError(handler) {\n globalState.globalReactionErrorHandlers.push(handler);\n return function () {\n var idx = globalState.globalReactionErrorHandlers.indexOf(handler);\n if (idx >= 0) {\n globalState.globalReactionErrorHandlers.splice(idx, 1);\n }\n };\n}\n/**\n * Magic number alert!\n * Defines within how many times a reaction is allowed to re-trigger itself\n * until it is assumed that this is gonna be a never ending loop...\n */\nvar MAX_REACTION_ITERATIONS = 100;\nvar reactionScheduler = function reactionScheduler(f) {\n return f();\n};\nfunction runReactions() {\n // Trampolining, if runReactions are already running, new reactions will be picked up\n if (globalState.inBatch > 0 || globalState.isRunningReactions) {\n return;\n }\n reactionScheduler(runReactionsHelper);\n}\nfunction runReactionsHelper() {\n globalState.isRunningReactions = true;\n var allReactions = globalState.pendingReactions;\n var iterations = 0;\n // While running reactions, new reactions might be triggered.\n // Hence we work with two variables and check whether\n // we converge to no remaining reactions after a while.\n while (allReactions.length > 0) {\n if (++iterations === MAX_REACTION_ITERATIONS) {\n console.error( true ? \"Reaction doesn't converge to a stable state after \" + MAX_REACTION_ITERATIONS + \" iterations.\" + (\" Probably there is a cycle in the reactive function: \" + allReactions[0]) : 0);\n allReactions.splice(0); // clear reactions\n }\n var remainingReactions = allReactions.splice(0);\n for (var i = 0, l = remainingReactions.length; i < l; i++) {\n remainingReactions[i].runReaction_();\n }\n }\n globalState.isRunningReactions = false;\n}\nvar isReaction = /*#__PURE__*/createInstanceofPredicate(\"Reaction\", Reaction);\nfunction setReactionScheduler(fn) {\n var baseScheduler = reactionScheduler;\n reactionScheduler = function reactionScheduler(f) {\n return fn(function () {\n return baseScheduler(f);\n });\n };\n}\n\nfunction isSpyEnabled() {\n return true && !!globalState.spyListeners.length;\n}\nfunction spyReport(event) {\n if (false) {} // dead code elimination can do the rest\n if (!globalState.spyListeners.length) {\n return;\n }\n var listeners = globalState.spyListeners;\n for (var i = 0, l = listeners.length; i < l; i++) {\n listeners[i](event);\n }\n}\nfunction spyReportStart(event) {\n if (false) {}\n var change = _extends({}, event, {\n spyReportStart: true\n });\n spyReport(change);\n}\nvar END_EVENT = {\n type: \"report-end\",\n spyReportEnd: true\n};\nfunction spyReportEnd(change) {\n if (false) {}\n if (change) {\n spyReport(_extends({}, change, {\n type: \"report-end\",\n spyReportEnd: true\n }));\n } else {\n spyReport(END_EVENT);\n }\n}\nfunction spy(listener) {\n if (false) {} else {\n globalState.spyListeners.push(listener);\n return once(function () {\n globalState.spyListeners = globalState.spyListeners.filter(function (l) {\n return l !== listener;\n });\n });\n }\n}\n\nvar ACTION = \"action\";\nvar ACTION_BOUND = \"action.bound\";\nvar AUTOACTION = \"autoAction\";\nvar AUTOACTION_BOUND = \"autoAction.bound\";\nvar DEFAULT_ACTION_NAME = \"\";\nvar actionAnnotation = /*#__PURE__*/createActionAnnotation(ACTION);\nvar actionBoundAnnotation = /*#__PURE__*/createActionAnnotation(ACTION_BOUND, {\n bound: true\n});\nvar autoActionAnnotation = /*#__PURE__*/createActionAnnotation(AUTOACTION, {\n autoAction: true\n});\nvar autoActionBoundAnnotation = /*#__PURE__*/createActionAnnotation(AUTOACTION_BOUND, {\n autoAction: true,\n bound: true\n});\nfunction createActionFactory(autoAction) {\n var res = function action(arg1, arg2) {\n // action(fn() {})\n if (isFunction(arg1)) {\n return createAction(arg1.name || DEFAULT_ACTION_NAME, arg1, autoAction);\n }\n // action(\"name\", fn() {})\n if (isFunction(arg2)) {\n return createAction(arg1, arg2, autoAction);\n }\n // @action (2022.3 Decorators)\n if (is20223Decorator(arg2)) {\n return (autoAction ? autoActionAnnotation : actionAnnotation).decorate_20223_(arg1, arg2);\n }\n // @action\n if (isStringish(arg2)) {\n return storeAnnotation(arg1, arg2, autoAction ? autoActionAnnotation : actionAnnotation);\n }\n // action(\"name\") & @action(\"name\")\n if (isStringish(arg1)) {\n return createDecoratorAnnotation(createActionAnnotation(autoAction ? AUTOACTION : ACTION, {\n name: arg1,\n autoAction: autoAction\n }));\n }\n if (true) {\n die(\"Invalid arguments for `action`\");\n }\n };\n return res;\n}\nvar action = /*#__PURE__*/createActionFactory(false);\nObject.assign(action, actionAnnotation);\nvar autoAction = /*#__PURE__*/createActionFactory(true);\nObject.assign(autoAction, autoActionAnnotation);\naction.bound = /*#__PURE__*/createDecoratorAnnotation(actionBoundAnnotation);\nautoAction.bound = /*#__PURE__*/createDecoratorAnnotation(autoActionBoundAnnotation);\nfunction runInAction(fn) {\n return executeAction(fn.name || DEFAULT_ACTION_NAME, false, fn, this, undefined);\n}\nfunction isAction(thing) {\n return isFunction(thing) && thing.isMobxAction === true;\n}\n\n/**\n * Creates a named reactive view and keeps it alive, so that the view is always\n * updated if one of the dependencies changes, even when the view is not further used by something else.\n * @param view The reactive view\n * @returns disposer function, which can be used to stop the view from being updated in the future.\n */\nfunction autorun(view, opts) {\n var _opts$name, _opts, _opts2, _opts3;\n if (opts === void 0) {\n opts = EMPTY_OBJECT;\n }\n if (true) {\n if (!isFunction(view)) {\n die(\"Autorun expects a function as first argument\");\n }\n if (isAction(view)) {\n die(\"Autorun does not accept actions since actions are untrackable\");\n }\n }\n var name = (_opts$name = (_opts = opts) == null ? void 0 : _opts.name) != null ? _opts$name : true ? view.name || \"Autorun@\" + getNextId() : 0;\n var runSync = !opts.scheduler && !opts.delay;\n var reaction;\n if (runSync) {\n // normal autorun\n reaction = new Reaction(name, function () {\n this.track(reactionRunner);\n }, opts.onError, opts.requiresObservable);\n } else {\n var scheduler = createSchedulerFromOptions(opts);\n // debounced autorun\n var isScheduled = false;\n reaction = new Reaction(name, function () {\n if (!isScheduled) {\n isScheduled = true;\n scheduler(function () {\n isScheduled = false;\n if (!reaction.isDisposed) {\n reaction.track(reactionRunner);\n }\n });\n }\n }, opts.onError, opts.requiresObservable);\n }\n function reactionRunner() {\n view(reaction);\n }\n if (!((_opts2 = opts) != null && (_opts2 = _opts2.signal) != null && _opts2.aborted)) {\n reaction.schedule_();\n }\n return reaction.getDisposer_((_opts3 = opts) == null ? void 0 : _opts3.signal);\n}\nvar run = function run(f) {\n return f();\n};\nfunction createSchedulerFromOptions(opts) {\n return opts.scheduler ? opts.scheduler : opts.delay ? function (f) {\n return setTimeout(f, opts.delay);\n } : run;\n}\nfunction reaction(expression, effect, opts) {\n var _opts$name2, _opts4, _opts5;\n if (opts === void 0) {\n opts = EMPTY_OBJECT;\n }\n if (true) {\n if (!isFunction(expression) || !isFunction(effect)) {\n die(\"First and second argument to reaction should be functions\");\n }\n if (!isPlainObject(opts)) {\n die(\"Third argument of reactions should be an object\");\n }\n }\n var name = (_opts$name2 = opts.name) != null ? _opts$name2 : true ? \"Reaction@\" + getNextId() : 0;\n var effectAction = action(name, opts.onError ? wrapErrorHandler(opts.onError, effect) : effect);\n var runSync = !opts.scheduler && !opts.delay;\n var scheduler = createSchedulerFromOptions(opts);\n var firstTime = true;\n var isScheduled = false;\n var value;\n var equals = opts.compareStructural ? comparer.structural : opts.equals || comparer[\"default\"];\n var r = new Reaction(name, function () {\n if (firstTime || runSync) {\n reactionRunner();\n } else if (!isScheduled) {\n isScheduled = true;\n scheduler(reactionRunner);\n }\n }, opts.onError, opts.requiresObservable);\n function reactionRunner() {\n isScheduled = false;\n if (r.isDisposed) {\n return;\n }\n var changed = false;\n var oldValue = value;\n r.track(function () {\n var nextValue = allowStateChanges(false, function () {\n return expression(r);\n });\n changed = firstTime || !equals(value, nextValue);\n value = nextValue;\n });\n if (firstTime && opts.fireImmediately) {\n effectAction(value, oldValue, r);\n } else if (!firstTime && changed) {\n effectAction(value, oldValue, r);\n }\n firstTime = false;\n }\n if (!((_opts4 = opts) != null && (_opts4 = _opts4.signal) != null && _opts4.aborted)) {\n r.schedule_();\n }\n return r.getDisposer_((_opts5 = opts) == null ? void 0 : _opts5.signal);\n}\nfunction wrapErrorHandler(errorHandler, baseFn) {\n return function () {\n try {\n return baseFn.apply(this, arguments);\n } catch (e) {\n errorHandler.call(this, e);\n }\n };\n}\n\nvar ON_BECOME_OBSERVED = \"onBO\";\nvar ON_BECOME_UNOBSERVED = \"onBUO\";\nfunction onBecomeObserved(thing, arg2, arg3) {\n return interceptHook(ON_BECOME_OBSERVED, thing, arg2, arg3);\n}\nfunction onBecomeUnobserved(thing, arg2, arg3) {\n return interceptHook(ON_BECOME_UNOBSERVED, thing, arg2, arg3);\n}\nfunction interceptHook(hook, thing, arg2, arg3) {\n var atom = typeof arg3 === \"function\" ? getAtom(thing, arg2) : getAtom(thing);\n var cb = isFunction(arg3) ? arg3 : arg2;\n var listenersKey = hook + \"L\";\n if (atom[listenersKey]) {\n atom[listenersKey].add(cb);\n } else {\n atom[listenersKey] = new Set([cb]);\n }\n return function () {\n var hookListeners = atom[listenersKey];\n if (hookListeners) {\n hookListeners[\"delete\"](cb);\n if (hookListeners.size === 0) {\n delete atom[listenersKey];\n }\n }\n };\n}\n\nvar NEVER = \"never\";\nvar ALWAYS = \"always\";\nvar OBSERVED = \"observed\";\n// const IF_AVAILABLE = \"ifavailable\"\nfunction configure(options) {\n if (options.isolateGlobalState === true) {\n isolateGlobalState();\n }\n var useProxies = options.useProxies,\n enforceActions = options.enforceActions;\n if (useProxies !== undefined) {\n globalState.useProxies = useProxies === ALWAYS ? true : useProxies === NEVER ? false : typeof Proxy !== \"undefined\";\n }\n if (useProxies === \"ifavailable\") {\n globalState.verifyProxies = true;\n }\n if (enforceActions !== undefined) {\n var ea = enforceActions === ALWAYS ? ALWAYS : enforceActions === OBSERVED;\n globalState.enforceActions = ea;\n globalState.allowStateChanges = ea === true || ea === ALWAYS ? false : true;\n }\n [\"computedRequiresReaction\", \"reactionRequiresObservable\", \"observableRequiresReaction\", \"disableErrorBoundaries\", \"safeDescriptors\"].forEach(function (key) {\n if (key in options) {\n globalState[key] = !!options[key];\n }\n });\n globalState.allowStateReads = !globalState.observableRequiresReaction;\n if ( true && globalState.disableErrorBoundaries === true) {\n console.warn(\"WARNING: Debug feature only. MobX will NOT recover from errors when `disableErrorBoundaries` is enabled.\");\n }\n if (options.reactionScheduler) {\n setReactionScheduler(options.reactionScheduler);\n }\n}\n\nfunction extendObservable(target, properties, annotations, options) {\n if (true) {\n if (arguments.length > 4) {\n die(\"'extendObservable' expected 2-4 arguments\");\n }\n if (typeof target !== \"object\") {\n die(\"'extendObservable' expects an object as first argument\");\n }\n if (isObservableMap(target)) {\n die(\"'extendObservable' should not be used on maps, use map.merge instead\");\n }\n if (!isPlainObject(properties)) {\n die(\"'extendObservable' only accepts plain objects as second argument\");\n }\n if (isObservable(properties) || isObservable(annotations)) {\n die(\"Extending an object with another observable (object) is not supported\");\n }\n }\n // Pull descriptors first, so we don't have to deal with props added by administration ($mobx)\n var descriptors = getOwnPropertyDescriptors(properties);\n initObservable(function () {\n var adm = asObservableObject(target, options)[$mobx];\n ownKeys(descriptors).forEach(function (key) {\n adm.extend_(key, descriptors[key],\n // must pass \"undefined\" for { key: undefined }\n !annotations ? true : key in annotations ? annotations[key] : true);\n });\n });\n return target;\n}\n\nfunction getDependencyTree(thing, property) {\n return nodeToDependencyTree(getAtom(thing, property));\n}\nfunction nodeToDependencyTree(node) {\n var result = {\n name: node.name_\n };\n if (node.observing_ && node.observing_.length > 0) {\n result.dependencies = unique(node.observing_).map(nodeToDependencyTree);\n }\n return result;\n}\nfunction getObserverTree(thing, property) {\n return nodeToObserverTree(getAtom(thing, property));\n}\nfunction nodeToObserverTree(node) {\n var result = {\n name: node.name_\n };\n if (hasObservers(node)) {\n result.observers = Array.from(getObservers(node)).map(nodeToObserverTree);\n }\n return result;\n}\nfunction unique(list) {\n return Array.from(new Set(list));\n}\n\nvar generatorId = 0;\nfunction FlowCancellationError() {\n this.message = \"FLOW_CANCELLED\";\n}\nFlowCancellationError.prototype = /*#__PURE__*/Object.create(Error.prototype);\nfunction isFlowCancellationError(error) {\n return error instanceof FlowCancellationError;\n}\nvar flowAnnotation = /*#__PURE__*/createFlowAnnotation(\"flow\");\nvar flowBoundAnnotation = /*#__PURE__*/createFlowAnnotation(\"flow.bound\", {\n bound: true\n});\nvar flow = /*#__PURE__*/Object.assign(function flow(arg1, arg2) {\n // @flow (2022.3 Decorators)\n if (is20223Decorator(arg2)) {\n return flowAnnotation.decorate_20223_(arg1, arg2);\n }\n // @flow\n if (isStringish(arg2)) {\n return storeAnnotation(arg1, arg2, flowAnnotation);\n }\n // flow(fn)\n if ( true && arguments.length !== 1) {\n die(\"Flow expects single argument with generator function\");\n }\n var generator = arg1;\n var name = generator.name || \"\";\n // Implementation based on https://github.com/tj/co/blob/master/index.js\n var res = function res() {\n var ctx = this;\n var args = arguments;\n var runId = ++generatorId;\n var gen = action(name + \" - runid: \" + runId + \" - init\", generator).apply(ctx, args);\n var rejector;\n var pendingPromise = undefined;\n var promise = new Promise(function (resolve, reject) {\n var stepId = 0;\n rejector = reject;\n function onFulfilled(res) {\n pendingPromise = undefined;\n var ret;\n try {\n ret = action(name + \" - runid: \" + runId + \" - yield \" + stepId++, gen.next).call(gen, res);\n } catch (e) {\n return reject(e);\n }\n next(ret);\n }\n function onRejected(err) {\n pendingPromise = undefined;\n var ret;\n try {\n ret = action(name + \" - runid: \" + runId + \" - yield \" + stepId++, gen[\"throw\"]).call(gen, err);\n } catch (e) {\n return reject(e);\n }\n next(ret);\n }\n function next(ret) {\n if (isFunction(ret == null ? void 0 : ret.then)) {\n // an async iterator\n ret.then(next, reject);\n return;\n }\n if (ret.done) {\n return resolve(ret.value);\n }\n pendingPromise = Promise.resolve(ret.value);\n return pendingPromise.then(onFulfilled, onRejected);\n }\n onFulfilled(undefined); // kick off the process\n });\n promise.cancel = action(name + \" - runid: \" + runId + \" - cancel\", function () {\n try {\n if (pendingPromise) {\n cancelPromise(pendingPromise);\n }\n // Finally block can return (or yield) stuff..\n var _res = gen[\"return\"](undefined);\n // eat anything that promise would do, it's cancelled!\n var yieldedPromise = Promise.resolve(_res.value);\n yieldedPromise.then(noop, noop);\n cancelPromise(yieldedPromise); // maybe it can be cancelled :)\n // reject our original promise\n rejector(new FlowCancellationError());\n } catch (e) {\n rejector(e); // there could be a throwing finally block\n }\n });\n return promise;\n };\n res.isMobXFlow = true;\n return res;\n}, flowAnnotation);\nflow.bound = /*#__PURE__*/createDecoratorAnnotation(flowBoundAnnotation);\nfunction cancelPromise(promise) {\n if (isFunction(promise.cancel)) {\n promise.cancel();\n }\n}\nfunction flowResult(result) {\n return result; // just tricking TypeScript :)\n}\nfunction isFlow(fn) {\n return (fn == null ? void 0 : fn.isMobXFlow) === true;\n}\n\nfunction interceptReads(thing, propOrHandler, handler) {\n var target;\n if (isObservableMap(thing) || isObservableArray(thing) || isObservableValue(thing)) {\n target = getAdministration(thing);\n } else if (isObservableObject(thing)) {\n if ( true && !isStringish(propOrHandler)) {\n return die(\"InterceptReads can only be used with a specific property, not with an object in general\");\n }\n target = getAdministration(thing, propOrHandler);\n } else if (true) {\n return die(\"Expected observable map, object or array as first array\");\n }\n if ( true && target.dehancer !== undefined) {\n return die(\"An intercept reader was already established\");\n }\n target.dehancer = typeof propOrHandler === \"function\" ? propOrHandler : handler;\n return function () {\n target.dehancer = undefined;\n };\n}\n\nfunction intercept(thing, propOrHandler, handler) {\n if (isFunction(handler)) {\n return interceptProperty(thing, propOrHandler, handler);\n } else {\n return interceptInterceptable(thing, propOrHandler);\n }\n}\nfunction interceptInterceptable(thing, handler) {\n return getAdministration(thing).intercept_(handler);\n}\nfunction interceptProperty(thing, property, handler) {\n return getAdministration(thing, property).intercept_(handler);\n}\n\nfunction _isComputed(value, property) {\n if (property === undefined) {\n return isComputedValue(value);\n }\n if (isObservableObject(value) === false) {\n return false;\n }\n if (!value[$mobx].values_.has(property)) {\n return false;\n }\n var atom = getAtom(value, property);\n return isComputedValue(atom);\n}\nfunction isComputed(value) {\n if ( true && arguments.length > 1) {\n return die(\"isComputed expects only 1 argument. Use isComputedProp to inspect the observability of a property\");\n }\n return _isComputed(value);\n}\nfunction isComputedProp(value, propName) {\n if ( true && !isStringish(propName)) {\n return die(\"isComputed expected a property name as second argument\");\n }\n return _isComputed(value, propName);\n}\n\nfunction _isObservable(value, property) {\n if (!value) {\n return false;\n }\n if (property !== undefined) {\n if ( true && (isObservableMap(value) || isObservableArray(value))) {\n return die(\"isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead.\");\n }\n if (isObservableObject(value)) {\n return value[$mobx].values_.has(property);\n }\n return false;\n }\n // For first check, see #701\n return isObservableObject(value) || !!value[$mobx] || isAtom(value) || isReaction(value) || isComputedValue(value);\n}\nfunction isObservable(value) {\n if ( true && arguments.length !== 1) {\n die(\"isObservable expects only 1 argument. Use isObservableProp to inspect the observability of a property\");\n }\n return _isObservable(value);\n}\nfunction isObservableProp(value, propName) {\n if ( true && !isStringish(propName)) {\n return die(\"expected a property name as second argument\");\n }\n return _isObservable(value, propName);\n}\n\nfunction keys(obj) {\n if (isObservableObject(obj)) {\n return obj[$mobx].keys_();\n }\n if (isObservableMap(obj) || isObservableSet(obj)) {\n return Array.from(obj.keys());\n }\n if (isObservableArray(obj)) {\n return obj.map(function (_, index) {\n return index;\n });\n }\n die(5);\n}\nfunction values(obj) {\n if (isObservableObject(obj)) {\n return keys(obj).map(function (key) {\n return obj[key];\n });\n }\n if (isObservableMap(obj)) {\n return keys(obj).map(function (key) {\n return obj.get(key);\n });\n }\n if (isObservableSet(obj)) {\n return Array.from(obj.values());\n }\n if (isObservableArray(obj)) {\n return obj.slice();\n }\n die(6);\n}\nfunction entries(obj) {\n if (isObservableObject(obj)) {\n return keys(obj).map(function (key) {\n return [key, obj[key]];\n });\n }\n if (isObservableMap(obj)) {\n return keys(obj).map(function (key) {\n return [key, obj.get(key)];\n });\n }\n if (isObservableSet(obj)) {\n return Array.from(obj.entries());\n }\n if (isObservableArray(obj)) {\n return obj.map(function (key, index) {\n return [index, key];\n });\n }\n die(7);\n}\nfunction set(obj, key, value) {\n if (arguments.length === 2 && !isObservableSet(obj)) {\n startBatch();\n var _values = key;\n try {\n for (var _key in _values) {\n set(obj, _key, _values[_key]);\n }\n } finally {\n endBatch();\n }\n return;\n }\n if (isObservableObject(obj)) {\n obj[$mobx].set_(key, value);\n } else if (isObservableMap(obj)) {\n obj.set(key, value);\n } else if (isObservableSet(obj)) {\n obj.add(key);\n } else if (isObservableArray(obj)) {\n if (typeof key !== \"number\") {\n key = parseInt(key, 10);\n }\n if (key < 0) {\n die(\"Invalid index: '\" + key + \"'\");\n }\n startBatch();\n if (key >= obj.length) {\n obj.length = key + 1;\n }\n obj[key] = value;\n endBatch();\n } else {\n die(8);\n }\n}\nfunction remove(obj, key) {\n if (isObservableObject(obj)) {\n obj[$mobx].delete_(key);\n } else if (isObservableMap(obj)) {\n obj[\"delete\"](key);\n } else if (isObservableSet(obj)) {\n obj[\"delete\"](key);\n } else if (isObservableArray(obj)) {\n if (typeof key !== \"number\") {\n key = parseInt(key, 10);\n }\n obj.splice(key, 1);\n } else {\n die(9);\n }\n}\nfunction has(obj, key) {\n if (isObservableObject(obj)) {\n return obj[$mobx].has_(key);\n } else if (isObservableMap(obj)) {\n return obj.has(key);\n } else if (isObservableSet(obj)) {\n return obj.has(key);\n } else if (isObservableArray(obj)) {\n return key >= 0 && key < obj.length;\n }\n die(10);\n}\nfunction get(obj, key) {\n if (!has(obj, key)) {\n return undefined;\n }\n if (isObservableObject(obj)) {\n return obj[$mobx].get_(key);\n } else if (isObservableMap(obj)) {\n return obj.get(key);\n } else if (isObservableArray(obj)) {\n return obj[key];\n }\n die(11);\n}\nfunction apiDefineProperty(obj, key, descriptor) {\n if (isObservableObject(obj)) {\n return obj[$mobx].defineProperty_(key, descriptor);\n }\n die(39);\n}\nfunction apiOwnKeys(obj) {\n if (isObservableObject(obj)) {\n return obj[$mobx].ownKeys_();\n }\n die(38);\n}\n\nfunction observe(thing, propOrCb, cbOrFire, fireImmediately) {\n if (isFunction(cbOrFire)) {\n return observeObservableProperty(thing, propOrCb, cbOrFire, fireImmediately);\n } else {\n return observeObservable(thing, propOrCb, cbOrFire);\n }\n}\nfunction observeObservable(thing, listener, fireImmediately) {\n return getAdministration(thing).observe_(listener, fireImmediately);\n}\nfunction observeObservableProperty(thing, property, listener, fireImmediately) {\n return getAdministration(thing, property).observe_(listener, fireImmediately);\n}\n\nfunction cache(map, key, value) {\n map.set(key, value);\n return value;\n}\nfunction toJSHelper(source, __alreadySeen) {\n if (source == null || typeof source !== \"object\" || source instanceof Date || !isObservable(source)) {\n return source;\n }\n if (isObservableValue(source) || isComputedValue(source)) {\n return toJSHelper(source.get(), __alreadySeen);\n }\n if (__alreadySeen.has(source)) {\n return __alreadySeen.get(source);\n }\n if (isObservableArray(source)) {\n var res = cache(__alreadySeen, source, new Array(source.length));\n source.forEach(function (value, idx) {\n res[idx] = toJSHelper(value, __alreadySeen);\n });\n return res;\n }\n if (isObservableSet(source)) {\n var _res = cache(__alreadySeen, source, new Set());\n source.forEach(function (value) {\n _res.add(toJSHelper(value, __alreadySeen));\n });\n return _res;\n }\n if (isObservableMap(source)) {\n var _res2 = cache(__alreadySeen, source, new Map());\n source.forEach(function (value, key) {\n _res2.set(key, toJSHelper(value, __alreadySeen));\n });\n return _res2;\n } else {\n // must be observable object\n var _res3 = cache(__alreadySeen, source, {});\n apiOwnKeys(source).forEach(function (key) {\n if (objectPrototype.propertyIsEnumerable.call(source, key)) {\n _res3[key] = toJSHelper(source[key], __alreadySeen);\n }\n });\n return _res3;\n }\n}\n/**\n * Recursively converts an observable to it's non-observable native counterpart.\n * It does NOT recurse into non-observables, these are left as they are, even if they contain observables.\n * Computed and other non-enumerable properties are completely ignored.\n * Complex scenarios require custom solution, eg implementing `toJSON` or using `serializr` lib.\n */\nfunction toJS(source, options) {\n if ( true && options) {\n die(\"toJS no longer supports options\");\n }\n return toJSHelper(source, new Map());\n}\n\nfunction trace() {\n if (false) {}\n var enterBreakPoint = false;\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n if (typeof args[args.length - 1] === \"boolean\") {\n enterBreakPoint = args.pop();\n }\n var derivation = getAtomFromArgs(args);\n if (!derivation) {\n return die(\"'trace(break?)' can only be used inside a tracked computed value or a Reaction. Consider passing in the computed value or reaction explicitly\");\n }\n if (derivation.isTracing_ === TraceMode.NONE) {\n console.log(\"[mobx.trace] '\" + derivation.name_ + \"' tracing enabled\");\n }\n derivation.isTracing_ = enterBreakPoint ? TraceMode.BREAK : TraceMode.LOG;\n}\nfunction getAtomFromArgs(args) {\n switch (args.length) {\n case 0:\n return globalState.trackingDerivation;\n case 1:\n return getAtom(args[0]);\n case 2:\n return getAtom(args[0], args[1]);\n }\n}\n\n/**\n * During a transaction no views are updated until the end of the transaction.\n * The transaction will be run synchronously nonetheless.\n *\n * @param action a function that updates some reactive state\n * @returns any value that was returned by the 'action' parameter.\n */\nfunction transaction(action, thisArg) {\n if (thisArg === void 0) {\n thisArg = undefined;\n }\n startBatch();\n try {\n return action.apply(thisArg);\n } finally {\n endBatch();\n }\n}\n\nfunction when(predicate, arg1, arg2) {\n if (arguments.length === 1 || arg1 && typeof arg1 === \"object\") {\n return whenPromise(predicate, arg1);\n }\n return _when(predicate, arg1, arg2 || {});\n}\nfunction _when(predicate, effect, opts) {\n var timeoutHandle;\n if (typeof opts.timeout === \"number\") {\n var error = new Error(\"WHEN_TIMEOUT\");\n timeoutHandle = setTimeout(function () {\n if (!disposer[$mobx].isDisposed) {\n disposer();\n if (opts.onError) {\n opts.onError(error);\n } else {\n throw error;\n }\n }\n }, opts.timeout);\n }\n opts.name = true ? opts.name || \"When@\" + getNextId() : 0;\n var effectAction = createAction( true ? opts.name + \"-effect\" : 0, effect);\n // eslint-disable-next-line\n var disposer = autorun(function (r) {\n // predicate should not change state\n var cond = allowStateChanges(false, predicate);\n if (cond) {\n r.dispose();\n if (timeoutHandle) {\n clearTimeout(timeoutHandle);\n }\n effectAction();\n }\n }, opts);\n return disposer;\n}\nfunction whenPromise(predicate, opts) {\n var _opts$signal;\n if ( true && opts && opts.onError) {\n return die(\"the options 'onError' and 'promise' cannot be combined\");\n }\n if (opts != null && (_opts$signal = opts.signal) != null && _opts$signal.aborted) {\n return Object.assign(Promise.reject(new Error(\"WHEN_ABORTED\")), {\n cancel: function cancel() {\n return null;\n }\n });\n }\n var cancel;\n var abort;\n var res = new Promise(function (resolve, reject) {\n var _opts$signal2;\n var disposer = _when(predicate, resolve, _extends({}, opts, {\n onError: reject\n }));\n cancel = function cancel() {\n disposer();\n reject(new Error(\"WHEN_CANCELLED\"));\n };\n abort = function abort() {\n disposer();\n reject(new Error(\"WHEN_ABORTED\"));\n };\n opts == null || (_opts$signal2 = opts.signal) == null || _opts$signal2.addEventListener == null || _opts$signal2.addEventListener(\"abort\", abort);\n })[\"finally\"](function () {\n var _opts$signal3;\n return opts == null || (_opts$signal3 = opts.signal) == null || _opts$signal3.removeEventListener == null ? void 0 : _opts$signal3.removeEventListener(\"abort\", abort);\n });\n res.cancel = cancel;\n return res;\n}\n\nfunction getAdm(target) {\n return target[$mobx];\n}\n// Optimization: we don't need the intermediate objects and could have a completely custom administration for DynamicObjects,\n// and skip either the internal values map, or the base object with its property descriptors!\nvar objectProxyTraps = {\n has: function has(target, name) {\n if ( true && globalState.trackingDerivation) {\n warnAboutProxyRequirement(\"detect new properties using the 'in' operator. Use 'has' from 'mobx' instead.\");\n }\n return getAdm(target).has_(name);\n },\n get: function get(target, name) {\n return getAdm(target).get_(name);\n },\n set: function set(target, name, value) {\n var _getAdm$set_;\n if (!isStringish(name)) {\n return false;\n }\n if ( true && !getAdm(target).values_.has(name)) {\n warnAboutProxyRequirement(\"add a new observable property through direct assignment. Use 'set' from 'mobx' instead.\");\n }\n // null (intercepted) -> true (success)\n return (_getAdm$set_ = getAdm(target).set_(name, value, true)) != null ? _getAdm$set_ : true;\n },\n deleteProperty: function deleteProperty(target, name) {\n var _getAdm$delete_;\n if (true) {\n warnAboutProxyRequirement(\"delete properties from an observable object. Use 'remove' from 'mobx' instead.\");\n }\n if (!isStringish(name)) {\n return false;\n }\n // null (intercepted) -> true (success)\n return (_getAdm$delete_ = getAdm(target).delete_(name, true)) != null ? _getAdm$delete_ : true;\n },\n defineProperty: function defineProperty(target, name, descriptor) {\n var _getAdm$definePropert;\n if (true) {\n warnAboutProxyRequirement(\"define property on an observable object. Use 'defineProperty' from 'mobx' instead.\");\n }\n // null (intercepted) -> true (success)\n return (_getAdm$definePropert = getAdm(target).defineProperty_(name, descriptor)) != null ? _getAdm$definePropert : true;\n },\n ownKeys: function ownKeys(target) {\n if ( true && globalState.trackingDerivation) {\n warnAboutProxyRequirement(\"iterate keys to detect added / removed properties. Use 'keys' from 'mobx' instead.\");\n }\n return getAdm(target).ownKeys_();\n },\n preventExtensions: function preventExtensions(target) {\n die(13);\n }\n};\nfunction asDynamicObservableObject(target, options) {\n var _target$$mobx, _target$$mobx$proxy_;\n assertProxies();\n target = asObservableObject(target, options);\n return (_target$$mobx$proxy_ = (_target$$mobx = target[$mobx]).proxy_) != null ? _target$$mobx$proxy_ : _target$$mobx.proxy_ = new Proxy(target, objectProxyTraps);\n}\n\nfunction hasInterceptors(interceptable) {\n return interceptable.interceptors_ !== undefined && interceptable.interceptors_.length > 0;\n}\nfunction registerInterceptor(interceptable, handler) {\n var interceptors = interceptable.interceptors_ || (interceptable.interceptors_ = []);\n interceptors.push(handler);\n return once(function () {\n var idx = interceptors.indexOf(handler);\n if (idx !== -1) {\n interceptors.splice(idx, 1);\n }\n });\n}\nfunction interceptChange(interceptable, change) {\n var prevU = untrackedStart();\n try {\n // Interceptor can modify the array, copy it to avoid concurrent modification, see #1950\n var interceptors = [].concat(interceptable.interceptors_ || []);\n for (var i = 0, l = interceptors.length; i < l; i++) {\n change = interceptors[i](change);\n if (change && !change.type) {\n die(14);\n }\n if (!change) {\n break;\n }\n }\n return change;\n } finally {\n untrackedEnd(prevU);\n }\n}\n\nfunction hasListeners(listenable) {\n return listenable.changeListeners_ !== undefined && listenable.changeListeners_.length > 0;\n}\nfunction registerListener(listenable, handler) {\n var listeners = listenable.changeListeners_ || (listenable.changeListeners_ = []);\n listeners.push(handler);\n return once(function () {\n var idx = listeners.indexOf(handler);\n if (idx !== -1) {\n listeners.splice(idx, 1);\n }\n });\n}\nfunction notifyListeners(listenable, change) {\n var prevU = untrackedStart();\n var listeners = listenable.changeListeners_;\n if (!listeners) {\n return;\n }\n listeners = listeners.slice();\n for (var i = 0, l = listeners.length; i < l; i++) {\n listeners[i](change);\n }\n untrackedEnd(prevU);\n}\n\nfunction makeObservable(target, annotations, options) {\n initObservable(function () {\n var _annotations;\n var adm = asObservableObject(target, options)[$mobx];\n if ( true && annotations && target[storedAnnotationsSymbol]) {\n die(\"makeObservable second arg must be nullish when using decorators. Mixing @decorator syntax with annotations is not supported.\");\n }\n // Default to decorators\n (_annotations = annotations) != null ? _annotations : annotations = collectStoredAnnotations(target);\n // Annotate\n ownKeys(annotations).forEach(function (key) {\n return adm.make_(key, annotations[key]);\n });\n });\n return target;\n}\n// proto[keysSymbol] = new Set()\nvar keysSymbol = /*#__PURE__*/Symbol(\"mobx-keys\");\nfunction makeAutoObservable(target, overrides, options) {\n if (true) {\n if (!isPlainObject(target) && !isPlainObject(Object.getPrototypeOf(target))) {\n die(\"'makeAutoObservable' can only be used for classes that don't have a superclass\");\n }\n if (isObservableObject(target)) {\n die(\"makeAutoObservable can only be used on objects not already made observable\");\n }\n }\n // Optimization: avoid visiting protos\n // Assumes that annotation.make_/.extend_ works the same for plain objects\n if (isPlainObject(target)) {\n return extendObservable(target, target, overrides, options);\n }\n initObservable(function () {\n var adm = asObservableObject(target, options)[$mobx];\n // Optimization: cache keys on proto\n // Assumes makeAutoObservable can be called only once per object and can't be used in subclass\n if (!target[keysSymbol]) {\n var proto = Object.getPrototypeOf(target);\n var keys = new Set([].concat(ownKeys(target), ownKeys(proto)));\n keys[\"delete\"](\"constructor\");\n keys[\"delete\"]($mobx);\n addHiddenProp(proto, keysSymbol, keys);\n }\n target[keysSymbol].forEach(function (key) {\n return adm.make_(key,\n // must pass \"undefined\" for { key: undefined }\n !overrides ? true : key in overrides ? overrides[key] : true);\n });\n });\n return target;\n}\n\nvar SPLICE = \"splice\";\nvar UPDATE = \"update\";\nvar MAX_SPLICE_SIZE = 10000; // See e.g. https://github.com/mobxjs/mobx/issues/859\nvar arrayTraps = {\n get: function get(target, name) {\n var adm = target[$mobx];\n if (name === $mobx) {\n return adm;\n }\n if (name === \"length\") {\n return adm.getArrayLength_();\n }\n if (typeof name === \"string\" && !isNaN(name)) {\n return adm.get_(parseInt(name));\n }\n if (hasProp(arrayExtensions, name)) {\n return arrayExtensions[name];\n }\n return target[name];\n },\n set: function set(target, name, value) {\n var adm = target[$mobx];\n if (name === \"length\") {\n adm.setArrayLength_(value);\n }\n if (typeof name === \"symbol\" || isNaN(name)) {\n target[name] = value;\n } else {\n // numeric string\n adm.set_(parseInt(name), value);\n }\n return true;\n },\n preventExtensions: function preventExtensions() {\n die(15);\n }\n};\nvar ObservableArrayAdministration = /*#__PURE__*/function () {\n function ObservableArrayAdministration(name, enhancer, owned_, legacyMode_) {\n if (name === void 0) {\n name = true ? \"ObservableArray@\" + getNextId() : 0;\n }\n this.owned_ = void 0;\n this.legacyMode_ = void 0;\n this.atom_ = void 0;\n this.values_ = [];\n // this is the prop that gets proxied, so can't replace it!\n this.interceptors_ = void 0;\n this.changeListeners_ = void 0;\n this.enhancer_ = void 0;\n this.dehancer = void 0;\n this.proxy_ = void 0;\n this.lastKnownLength_ = 0;\n this.owned_ = owned_;\n this.legacyMode_ = legacyMode_;\n this.atom_ = new Atom(name);\n this.enhancer_ = function (newV, oldV) {\n return enhancer(newV, oldV, true ? name + \"[..]\" : 0);\n };\n }\n var _proto = ObservableArrayAdministration.prototype;\n _proto.dehanceValue_ = function dehanceValue_(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.dehanceValues_ = function dehanceValues_(values) {\n if (this.dehancer !== undefined && values.length > 0) {\n return values.map(this.dehancer);\n }\n return values;\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n if (fireImmediately === void 0) {\n fireImmediately = false;\n }\n if (fireImmediately) {\n listener({\n observableKind: \"array\",\n object: this.proxy_,\n debugObjectName: this.atom_.name_,\n type: \"splice\",\n index: 0,\n added: this.values_.slice(),\n addedCount: this.values_.length,\n removed: [],\n removedCount: 0\n });\n }\n return registerListener(this, listener);\n };\n _proto.getArrayLength_ = function getArrayLength_() {\n this.atom_.reportObserved();\n return this.values_.length;\n };\n _proto.setArrayLength_ = function setArrayLength_(newLength) {\n if (typeof newLength !== \"number\" || isNaN(newLength) || newLength < 0) {\n die(\"Out of range: \" + newLength);\n }\n var currentLength = this.values_.length;\n if (newLength === currentLength) {\n return;\n } else if (newLength > currentLength) {\n var newItems = new Array(newLength - currentLength);\n for (var i = 0; i < newLength - currentLength; i++) {\n newItems[i] = undefined;\n } // No Array.fill everywhere...\n this.spliceWithArray_(currentLength, 0, newItems);\n } else {\n this.spliceWithArray_(newLength, currentLength - newLength);\n }\n };\n _proto.updateArrayLength_ = function updateArrayLength_(oldLength, delta) {\n if (oldLength !== this.lastKnownLength_) {\n die(16);\n }\n this.lastKnownLength_ += delta;\n if (this.legacyMode_ && delta > 0) {\n reserveArrayBuffer(oldLength + delta + 1);\n }\n };\n _proto.spliceWithArray_ = function spliceWithArray_(index, deleteCount, newItems) {\n var _this = this;\n checkIfStateModificationsAreAllowed(this.atom_);\n var length = this.values_.length;\n if (index === undefined) {\n index = 0;\n } else if (index > length) {\n index = length;\n } else if (index < 0) {\n index = Math.max(0, length + index);\n }\n if (arguments.length === 1) {\n deleteCount = length - index;\n } else if (deleteCount === undefined || deleteCount === null) {\n deleteCount = 0;\n } else {\n deleteCount = Math.max(0, Math.min(deleteCount, length - index));\n }\n if (newItems === undefined) {\n newItems = EMPTY_ARRAY;\n }\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_,\n type: SPLICE,\n index: index,\n removedCount: deleteCount,\n added: newItems\n });\n if (!change) {\n return EMPTY_ARRAY;\n }\n deleteCount = change.removedCount;\n newItems = change.added;\n }\n newItems = newItems.length === 0 ? newItems : newItems.map(function (v) {\n return _this.enhancer_(v, undefined);\n });\n if (this.legacyMode_ || \"development\" !== \"production\") {\n var lengthDelta = newItems.length - deleteCount;\n this.updateArrayLength_(length, lengthDelta); // checks if internal array wasn't modified\n }\n var res = this.spliceItemsIntoValues_(index, deleteCount, newItems);\n if (deleteCount !== 0 || newItems.length !== 0) {\n this.notifyArraySplice_(index, newItems, res);\n }\n return this.dehanceValues_(res);\n };\n _proto.spliceItemsIntoValues_ = function spliceItemsIntoValues_(index, deleteCount, newItems) {\n if (newItems.length < MAX_SPLICE_SIZE) {\n var _this$values_;\n return (_this$values_ = this.values_).splice.apply(_this$values_, [index, deleteCount].concat(newItems));\n } else {\n // The items removed by the splice\n var res = this.values_.slice(index, index + deleteCount);\n // The items that that should remain at the end of the array\n var oldItems = this.values_.slice(index + deleteCount);\n // New length is the previous length + addition count - deletion count\n this.values_.length += newItems.length - deleteCount;\n for (var i = 0; i < newItems.length; i++) {\n this.values_[index + i] = newItems[i];\n }\n for (var _i = 0; _i < oldItems.length; _i++) {\n this.values_[index + newItems.length + _i] = oldItems[_i];\n }\n return res;\n }\n };\n _proto.notifyArrayChildUpdate_ = function notifyArrayChildUpdate_(index, newValue, oldValue) {\n var notifySpy = !this.owned_ && isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"array\",\n object: this.proxy_,\n type: UPDATE,\n debugObjectName: this.atom_.name_,\n index: index,\n newValue: newValue,\n oldValue: oldValue\n } : null;\n // The reason why this is on right hand side here (and not above), is this way the uglifier will drop it, but it won't\n // cause any runtime overhead in development mode without NODE_ENV set, unless spying is enabled\n if ( true && notifySpy) {\n spyReportStart(change);\n }\n this.atom_.reportChanged();\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n };\n _proto.notifyArraySplice_ = function notifyArraySplice_(index, added, removed) {\n var notifySpy = !this.owned_ && isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"array\",\n object: this.proxy_,\n debugObjectName: this.atom_.name_,\n type: SPLICE,\n index: index,\n removed: removed,\n added: added,\n removedCount: removed.length,\n addedCount: added.length\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n }\n this.atom_.reportChanged();\n // conform: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/observe\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n };\n _proto.get_ = function get_(index) {\n if (this.legacyMode_ && index >= this.values_.length) {\n console.warn( true ? \"[mobx.array] Attempt to read an array index (\" + index + \") that is out of bounds (\" + this.values_.length + \"). Please check length first. Out of bound indices will not be tracked by MobX\" : 0);\n return undefined;\n }\n this.atom_.reportObserved();\n return this.dehanceValue_(this.values_[index]);\n };\n _proto.set_ = function set_(index, newValue) {\n var values = this.values_;\n if (this.legacyMode_ && index > values.length) {\n // out of bounds\n die(17, index, values.length);\n }\n if (index < values.length) {\n // update at index in range\n checkIfStateModificationsAreAllowed(this.atom_);\n var oldValue = values[index];\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: UPDATE,\n object: this.proxy_,\n // since \"this\" is the real array we need to pass its proxy\n index: index,\n newValue: newValue\n });\n if (!change) {\n return;\n }\n newValue = change.newValue;\n }\n newValue = this.enhancer_(newValue, oldValue);\n var changed = newValue !== oldValue;\n if (changed) {\n values[index] = newValue;\n this.notifyArrayChildUpdate_(index, newValue, oldValue);\n }\n } else {\n // For out of bound index, we don't create an actual sparse array,\n // but rather fill the holes with undefined (same as setArrayLength_).\n // This could be considered a bug.\n var newItems = new Array(index + 1 - values.length);\n for (var i = 0; i < newItems.length - 1; i++) {\n newItems[i] = undefined;\n } // No Array.fill everywhere...\n newItems[newItems.length - 1] = newValue;\n this.spliceWithArray_(values.length, 0, newItems);\n }\n };\n return ObservableArrayAdministration;\n}();\nfunction createObservableArray(initialValues, enhancer, name, owned) {\n if (name === void 0) {\n name = true ? \"ObservableArray@\" + getNextId() : 0;\n }\n if (owned === void 0) {\n owned = false;\n }\n assertProxies();\n return initObservable(function () {\n var adm = new ObservableArrayAdministration(name, enhancer, owned, false);\n addHiddenFinalProp(adm.values_, $mobx, adm);\n var proxy = new Proxy(adm.values_, arrayTraps);\n adm.proxy_ = proxy;\n if (initialValues && initialValues.length) {\n adm.spliceWithArray_(0, 0, initialValues);\n }\n return proxy;\n });\n}\n// eslint-disable-next-line\nvar arrayExtensions = {\n clear: function clear() {\n return this.splice(0);\n },\n replace: function replace(newItems) {\n var adm = this[$mobx];\n return adm.spliceWithArray_(0, adm.values_.length, newItems);\n },\n // Used by JSON.stringify\n toJSON: function toJSON() {\n return this.slice();\n },\n /*\n * functions that do alter the internal structure of the array, (based on lib.es6.d.ts)\n * since these functions alter the inner structure of the array, the have side effects.\n * Because the have side effects, they should not be used in computed function,\n * and for that reason the do not call dependencyState.notifyObserved\n */\n splice: function splice(index, deleteCount) {\n for (var _len = arguments.length, newItems = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {\n newItems[_key - 2] = arguments[_key];\n }\n var adm = this[$mobx];\n switch (arguments.length) {\n case 0:\n return [];\n case 1:\n return adm.spliceWithArray_(index);\n case 2:\n return adm.spliceWithArray_(index, deleteCount);\n }\n return adm.spliceWithArray_(index, deleteCount, newItems);\n },\n spliceWithArray: function spliceWithArray(index, deleteCount, newItems) {\n return this[$mobx].spliceWithArray_(index, deleteCount, newItems);\n },\n push: function push() {\n var adm = this[$mobx];\n for (var _len2 = arguments.length, items = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n items[_key2] = arguments[_key2];\n }\n adm.spliceWithArray_(adm.values_.length, 0, items);\n return adm.values_.length;\n },\n pop: function pop() {\n return this.splice(Math.max(this[$mobx].values_.length - 1, 0), 1)[0];\n },\n shift: function shift() {\n return this.splice(0, 1)[0];\n },\n unshift: function unshift() {\n var adm = this[$mobx];\n for (var _len3 = arguments.length, items = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n items[_key3] = arguments[_key3];\n }\n adm.spliceWithArray_(0, 0, items);\n return adm.values_.length;\n },\n reverse: function reverse() {\n // reverse by default mutates in place before returning the result\n // which makes it both a 'derivation' and a 'mutation'.\n if (globalState.trackingDerivation) {\n die(37, \"reverse\");\n }\n this.replace(this.slice().reverse());\n return this;\n },\n sort: function sort() {\n // sort by default mutates in place before returning the result\n // which goes against all good practices. Let's not change the array in place!\n if (globalState.trackingDerivation) {\n die(37, \"sort\");\n }\n var copy = this.slice();\n copy.sort.apply(copy, arguments);\n this.replace(copy);\n return this;\n },\n remove: function remove(value) {\n var adm = this[$mobx];\n var idx = adm.dehanceValues_(adm.values_).indexOf(value);\n if (idx > -1) {\n this.splice(idx, 1);\n return true;\n }\n return false;\n }\n};\n/**\n * Wrap function from prototype\n * Without this, everything works as well, but this works\n * faster as everything works on unproxied values\n */\naddArrayExtension(\"at\", simpleFunc);\naddArrayExtension(\"concat\", simpleFunc);\naddArrayExtension(\"flat\", simpleFunc);\naddArrayExtension(\"includes\", simpleFunc);\naddArrayExtension(\"indexOf\", simpleFunc);\naddArrayExtension(\"join\", simpleFunc);\naddArrayExtension(\"lastIndexOf\", simpleFunc);\naddArrayExtension(\"slice\", simpleFunc);\naddArrayExtension(\"toString\", simpleFunc);\naddArrayExtension(\"toLocaleString\", simpleFunc);\naddArrayExtension(\"toSorted\", simpleFunc);\naddArrayExtension(\"toSpliced\", simpleFunc);\naddArrayExtension(\"with\", simpleFunc);\n// map\naddArrayExtension(\"every\", mapLikeFunc);\naddArrayExtension(\"filter\", mapLikeFunc);\naddArrayExtension(\"find\", mapLikeFunc);\naddArrayExtension(\"findIndex\", mapLikeFunc);\naddArrayExtension(\"findLast\", mapLikeFunc);\naddArrayExtension(\"findLastIndex\", mapLikeFunc);\naddArrayExtension(\"flatMap\", mapLikeFunc);\naddArrayExtension(\"forEach\", mapLikeFunc);\naddArrayExtension(\"map\", mapLikeFunc);\naddArrayExtension(\"some\", mapLikeFunc);\naddArrayExtension(\"toReversed\", mapLikeFunc);\n// reduce\naddArrayExtension(\"reduce\", reduceLikeFunc);\naddArrayExtension(\"reduceRight\", reduceLikeFunc);\nfunction addArrayExtension(funcName, funcFactory) {\n if (typeof Array.prototype[funcName] === \"function\") {\n arrayExtensions[funcName] = funcFactory(funcName);\n }\n}\n// Report and delegate to dehanced array\nfunction simpleFunc(funcName) {\n return function () {\n var adm = this[$mobx];\n adm.atom_.reportObserved();\n var dehancedValues = adm.dehanceValues_(adm.values_);\n return dehancedValues[funcName].apply(dehancedValues, arguments);\n };\n}\n// Make sure callbacks receive correct array arg #2326\nfunction mapLikeFunc(funcName) {\n return function (callback, thisArg) {\n var _this2 = this;\n var adm = this[$mobx];\n adm.atom_.reportObserved();\n var dehancedValues = adm.dehanceValues_(adm.values_);\n return dehancedValues[funcName](function (element, index) {\n return callback.call(thisArg, element, index, _this2);\n });\n };\n}\n// Make sure callbacks receive correct array arg #2326\nfunction reduceLikeFunc(funcName) {\n return function () {\n var _this3 = this;\n var adm = this[$mobx];\n adm.atom_.reportObserved();\n var dehancedValues = adm.dehanceValues_(adm.values_);\n // #2432 - reduce behavior depends on arguments.length\n var callback = arguments[0];\n arguments[0] = function (accumulator, currentValue, index) {\n return callback(accumulator, currentValue, index, _this3);\n };\n return dehancedValues[funcName].apply(dehancedValues, arguments);\n };\n}\nvar isObservableArrayAdministration = /*#__PURE__*/createInstanceofPredicate(\"ObservableArrayAdministration\", ObservableArrayAdministration);\nfunction isObservableArray(thing) {\n return isObject(thing) && isObservableArrayAdministration(thing[$mobx]);\n}\n\nvar ObservableMapMarker = {};\nvar ADD = \"add\";\nvar DELETE = \"delete\";\n// just extend Map? See also https://gist.github.com/nestharus/13b4d74f2ef4a2f4357dbd3fc23c1e54\n// But: https://github.com/mobxjs/mobx/issues/1556\nvar ObservableMap = /*#__PURE__*/function () {\n function ObservableMap(initialData, enhancer_, name_) {\n var _this = this;\n if (enhancer_ === void 0) {\n enhancer_ = deepEnhancer;\n }\n if (name_ === void 0) {\n name_ = true ? \"ObservableMap@\" + getNextId() : 0;\n }\n this.enhancer_ = void 0;\n this.name_ = void 0;\n this[$mobx] = ObservableMapMarker;\n this.data_ = void 0;\n this.hasMap_ = void 0;\n // hasMap, not hashMap >-).\n this.keysAtom_ = void 0;\n this.interceptors_ = void 0;\n this.changeListeners_ = void 0;\n this.dehancer = void 0;\n this.enhancer_ = enhancer_;\n this.name_ = name_;\n if (!isFunction(Map)) {\n die(18);\n }\n initObservable(function () {\n _this.keysAtom_ = createAtom( true ? _this.name_ + \".keys()\" : 0);\n _this.data_ = new Map();\n _this.hasMap_ = new Map();\n if (initialData) {\n _this.merge(initialData);\n }\n });\n }\n var _proto = ObservableMap.prototype;\n _proto.has_ = function has_(key) {\n return this.data_.has(key);\n };\n _proto.has = function has(key) {\n var _this2 = this;\n if (!globalState.trackingDerivation) {\n return this.has_(key);\n }\n var entry = this.hasMap_.get(key);\n if (!entry) {\n var newEntry = entry = new ObservableValue(this.has_(key), referenceEnhancer, true ? this.name_ + \".\" + stringifyKey(key) + \"?\" : 0, false);\n this.hasMap_.set(key, newEntry);\n onBecomeUnobserved(newEntry, function () {\n return _this2.hasMap_[\"delete\"](key);\n });\n }\n return entry.get();\n };\n _proto.set = function set(key, value) {\n var hasKey = this.has_(key);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: hasKey ? UPDATE : ADD,\n object: this,\n newValue: value,\n name: key\n });\n if (!change) {\n return this;\n }\n value = change.newValue;\n }\n if (hasKey) {\n this.updateValue_(key, value);\n } else {\n this.addValue_(key, value);\n }\n return this;\n };\n _proto[\"delete\"] = function _delete(key) {\n var _this3 = this;\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: DELETE,\n object: this,\n name: key\n });\n if (!change) {\n return false;\n }\n }\n if (this.has_(key)) {\n var notifySpy = isSpyEnabled();\n var notify = hasListeners(this);\n var _change = notify || notifySpy ? {\n observableKind: \"map\",\n debugObjectName: this.name_,\n type: DELETE,\n object: this,\n oldValue: this.data_.get(key).value_,\n name: key\n } : null;\n if ( true && notifySpy) {\n spyReportStart(_change);\n } // TODO fix type\n transaction(function () {\n var _this3$hasMap_$get;\n _this3.keysAtom_.reportChanged();\n (_this3$hasMap_$get = _this3.hasMap_.get(key)) == null || _this3$hasMap_$get.setNewValue_(false);\n var observable = _this3.data_.get(key);\n observable.setNewValue_(undefined);\n _this3.data_[\"delete\"](key);\n });\n if (notify) {\n notifyListeners(this, _change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n return true;\n }\n return false;\n };\n _proto.updateValue_ = function updateValue_(key, newValue) {\n var observable = this.data_.get(key);\n newValue = observable.prepareNewValue_(newValue);\n if (newValue !== globalState.UNCHANGED) {\n var notifySpy = isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"map\",\n debugObjectName: this.name_,\n type: UPDATE,\n object: this,\n oldValue: observable.value_,\n name: key,\n newValue: newValue\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n } // TODO fix type\n observable.setNewValue_(newValue);\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n };\n _proto.addValue_ = function addValue_(key, newValue) {\n var _this4 = this;\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n transaction(function () {\n var _this4$hasMap_$get;\n var observable = new ObservableValue(newValue, _this4.enhancer_, true ? _this4.name_ + \".\" + stringifyKey(key) : 0, false);\n _this4.data_.set(key, observable);\n newValue = observable.value_; // value might have been changed\n (_this4$hasMap_$get = _this4.hasMap_.get(key)) == null || _this4$hasMap_$get.setNewValue_(true);\n _this4.keysAtom_.reportChanged();\n });\n var notifySpy = isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"map\",\n debugObjectName: this.name_,\n type: ADD,\n object: this,\n name: key,\n newValue: newValue\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n } // TODO fix type\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n };\n _proto.get = function get(key) {\n if (this.has(key)) {\n return this.dehanceValue_(this.data_.get(key).get());\n }\n return this.dehanceValue_(undefined);\n };\n _proto.dehanceValue_ = function dehanceValue_(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.keys = function keys() {\n this.keysAtom_.reportObserved();\n return this.data_.keys();\n };\n _proto.values = function values() {\n var self = this;\n var keys = this.keys();\n return makeIterableForMap({\n next: function next() {\n var _keys$next = keys.next(),\n done = _keys$next.done,\n value = _keys$next.value;\n return {\n done: done,\n value: done ? undefined : self.get(value)\n };\n }\n });\n };\n _proto.entries = function entries() {\n var self = this;\n var keys = this.keys();\n return makeIterableForMap({\n next: function next() {\n var _keys$next2 = keys.next(),\n done = _keys$next2.done,\n value = _keys$next2.value;\n return {\n done: done,\n value: done ? undefined : [value, self.get(value)]\n };\n }\n });\n };\n _proto[Symbol.iterator] = function () {\n return this.entries();\n };\n _proto.forEach = function forEach(callback, thisArg) {\n for (var _iterator = _createForOfIteratorHelperLoose(this), _step; !(_step = _iterator()).done;) {\n var _step$value = _step.value,\n key = _step$value[0],\n value = _step$value[1];\n callback.call(thisArg, value, key, this);\n }\n }\n /** Merge another object into this object, returns this. */;\n _proto.merge = function merge(other) {\n var _this5 = this;\n if (isObservableMap(other)) {\n other = new Map(other);\n }\n transaction(function () {\n if (isPlainObject(other)) {\n getPlainObjectKeys(other).forEach(function (key) {\n return _this5.set(key, other[key]);\n });\n } else if (Array.isArray(other)) {\n other.forEach(function (_ref) {\n var key = _ref[0],\n value = _ref[1];\n return _this5.set(key, value);\n });\n } else if (isES6Map(other)) {\n if (!isPlainES6Map(other)) {\n die(19, other);\n }\n other.forEach(function (value, key) {\n return _this5.set(key, value);\n });\n } else if (other !== null && other !== undefined) {\n die(20, other);\n }\n });\n return this;\n };\n _proto.clear = function clear() {\n var _this6 = this;\n transaction(function () {\n untracked(function () {\n for (var _iterator2 = _createForOfIteratorHelperLoose(_this6.keys()), _step2; !(_step2 = _iterator2()).done;) {\n var key = _step2.value;\n _this6[\"delete\"](key);\n }\n });\n });\n };\n _proto.replace = function replace(values) {\n var _this7 = this;\n // Implementation requirements:\n // - respect ordering of replacement map\n // - allow interceptors to run and potentially prevent individual operations\n // - don't recreate observables that already exist in original map (so we don't destroy existing subscriptions)\n // - don't _keysAtom.reportChanged if the keys of resulting map are indentical (order matters!)\n // - note that result map may differ from replacement map due to the interceptors\n transaction(function () {\n // Convert to map so we can do quick key lookups\n var replacementMap = convertToMap(values);\n var orderedData = new Map();\n // Used for optimization\n var keysReportChangedCalled = false;\n // Delete keys that don't exist in replacement map\n // if the key deletion is prevented by interceptor\n // add entry at the beginning of the result map\n for (var _iterator3 = _createForOfIteratorHelperLoose(_this7.data_.keys()), _step3; !(_step3 = _iterator3()).done;) {\n var key = _step3.value;\n // Concurrently iterating/deleting keys\n // iterator should handle this correctly\n if (!replacementMap.has(key)) {\n var deleted = _this7[\"delete\"](key);\n // Was the key removed?\n if (deleted) {\n // _keysAtom.reportChanged() was already called\n keysReportChangedCalled = true;\n } else {\n // Delete prevented by interceptor\n var value = _this7.data_.get(key);\n orderedData.set(key, value);\n }\n }\n }\n // Merge entries\n for (var _iterator4 = _createForOfIteratorHelperLoose(replacementMap.entries()), _step4; !(_step4 = _iterator4()).done;) {\n var _step4$value = _step4.value,\n _key = _step4$value[0],\n _value = _step4$value[1];\n // We will want to know whether a new key is added\n var keyExisted = _this7.data_.has(_key);\n // Add or update value\n _this7.set(_key, _value);\n // The addition could have been prevent by interceptor\n if (_this7.data_.has(_key)) {\n // The update could have been prevented by interceptor\n // and also we want to preserve existing values\n // so use value from _data map (instead of replacement map)\n var _value2 = _this7.data_.get(_key);\n orderedData.set(_key, _value2);\n // Was a new key added?\n if (!keyExisted) {\n // _keysAtom.reportChanged() was already called\n keysReportChangedCalled = true;\n }\n }\n }\n // Check for possible key order change\n if (!keysReportChangedCalled) {\n if (_this7.data_.size !== orderedData.size) {\n // If size differs, keys are definitely modified\n _this7.keysAtom_.reportChanged();\n } else {\n var iter1 = _this7.data_.keys();\n var iter2 = orderedData.keys();\n var next1 = iter1.next();\n var next2 = iter2.next();\n while (!next1.done) {\n if (next1.value !== next2.value) {\n _this7.keysAtom_.reportChanged();\n break;\n }\n next1 = iter1.next();\n next2 = iter2.next();\n }\n }\n }\n // Use correctly ordered map\n _this7.data_ = orderedData;\n });\n return this;\n };\n _proto.toString = function toString() {\n return \"[object ObservableMap]\";\n };\n _proto.toJSON = function toJSON() {\n return Array.from(this);\n };\n /**\n * Observes this object. Triggers for the events 'add', 'update' and 'delete'.\n * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe\n * for callback details\n */\n _proto.observe_ = function observe_(listener, fireImmediately) {\n if ( true && fireImmediately === true) {\n die(\"`observe` doesn't support fireImmediately=true in combination with maps.\");\n }\n return registerListener(this, listener);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n return _createClass(ObservableMap, [{\n key: \"size\",\n get: function get() {\n this.keysAtom_.reportObserved();\n return this.data_.size;\n }\n }, {\n key: Symbol.toStringTag,\n get: function get() {\n return \"Map\";\n }\n }]);\n}();\n// eslint-disable-next-line\nvar isObservableMap = /*#__PURE__*/createInstanceofPredicate(\"ObservableMap\", ObservableMap);\nfunction makeIterableForMap(iterator) {\n iterator[Symbol.toStringTag] = \"MapIterator\";\n return makeIterable(iterator);\n}\nfunction convertToMap(dataStructure) {\n if (isES6Map(dataStructure) || isObservableMap(dataStructure)) {\n return dataStructure;\n } else if (Array.isArray(dataStructure)) {\n return new Map(dataStructure);\n } else if (isPlainObject(dataStructure)) {\n var map = new Map();\n for (var key in dataStructure) {\n map.set(key, dataStructure[key]);\n }\n return map;\n } else {\n return die(21, dataStructure);\n }\n}\n\nvar ObservableSetMarker = {};\nvar ObservableSet = /*#__PURE__*/function () {\n function ObservableSet(initialData, enhancer, name_) {\n var _this = this;\n if (enhancer === void 0) {\n enhancer = deepEnhancer;\n }\n if (name_ === void 0) {\n name_ = true ? \"ObservableSet@\" + getNextId() : 0;\n }\n this.name_ = void 0;\n this[$mobx] = ObservableSetMarker;\n this.data_ = new Set();\n this.atom_ = void 0;\n this.changeListeners_ = void 0;\n this.interceptors_ = void 0;\n this.dehancer = void 0;\n this.enhancer_ = void 0;\n this.name_ = name_;\n if (!isFunction(Set)) {\n die(22);\n }\n this.enhancer_ = function (newV, oldV) {\n return enhancer(newV, oldV, name_);\n };\n initObservable(function () {\n _this.atom_ = createAtom(_this.name_);\n if (initialData) {\n _this.replace(initialData);\n }\n });\n }\n var _proto = ObservableSet.prototype;\n _proto.dehanceValue_ = function dehanceValue_(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.clear = function clear() {\n var _this2 = this;\n transaction(function () {\n untracked(function () {\n for (var _iterator = _createForOfIteratorHelperLoose(_this2.data_.values()), _step; !(_step = _iterator()).done;) {\n var value = _step.value;\n _this2[\"delete\"](value);\n }\n });\n });\n };\n _proto.forEach = function forEach(callbackFn, thisArg) {\n for (var _iterator2 = _createForOfIteratorHelperLoose(this), _step2; !(_step2 = _iterator2()).done;) {\n var value = _step2.value;\n callbackFn.call(thisArg, value, value, this);\n }\n };\n _proto.add = function add(value) {\n var _this3 = this;\n checkIfStateModificationsAreAllowed(this.atom_);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: ADD,\n object: this,\n newValue: value\n });\n if (!change) {\n return this;\n }\n // ideally, value = change.value would be done here, so that values can be\n // changed by interceptor. Same applies for other Set and Map api's.\n }\n if (!this.has(value)) {\n transaction(function () {\n _this3.data_.add(_this3.enhancer_(value, undefined));\n _this3.atom_.reportChanged();\n });\n var notifySpy = true && isSpyEnabled();\n var notify = hasListeners(this);\n var _change = notify || notifySpy ? {\n observableKind: \"set\",\n debugObjectName: this.name_,\n type: ADD,\n object: this,\n newValue: value\n } : null;\n if (notifySpy && \"development\" !== \"production\") {\n spyReportStart(_change);\n }\n if (notify) {\n notifyListeners(this, _change);\n }\n if (notifySpy && \"development\" !== \"production\") {\n spyReportEnd();\n }\n }\n return this;\n };\n _proto[\"delete\"] = function _delete(value) {\n var _this4 = this;\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: DELETE,\n object: this,\n oldValue: value\n });\n if (!change) {\n return false;\n }\n }\n if (this.has(value)) {\n var notifySpy = true && isSpyEnabled();\n var notify = hasListeners(this);\n var _change2 = notify || notifySpy ? {\n observableKind: \"set\",\n debugObjectName: this.name_,\n type: DELETE,\n object: this,\n oldValue: value\n } : null;\n if (notifySpy && \"development\" !== \"production\") {\n spyReportStart(_change2);\n }\n transaction(function () {\n _this4.atom_.reportChanged();\n _this4.data_[\"delete\"](value);\n });\n if (notify) {\n notifyListeners(this, _change2);\n }\n if (notifySpy && \"development\" !== \"production\") {\n spyReportEnd();\n }\n return true;\n }\n return false;\n };\n _proto.has = function has(value) {\n this.atom_.reportObserved();\n return this.data_.has(this.dehanceValue_(value));\n };\n _proto.entries = function entries() {\n var nextIndex = 0;\n var keys = Array.from(this.keys());\n var values = Array.from(this.values());\n return makeIterableForSet({\n next: function next() {\n var index = nextIndex;\n nextIndex += 1;\n return index < values.length ? {\n value: [keys[index], values[index]],\n done: false\n } : {\n value: undefined,\n done: true\n };\n }\n });\n };\n _proto.keys = function keys() {\n return this.values();\n };\n _proto.values = function values() {\n this.atom_.reportObserved();\n var self = this;\n var nextIndex = 0;\n var observableValues = Array.from(this.data_.values());\n return makeIterableForSet({\n next: function next() {\n return nextIndex < observableValues.length ? {\n value: self.dehanceValue_(observableValues[nextIndex++]),\n done: false\n } : {\n value: undefined,\n done: true\n };\n }\n });\n };\n _proto.intersection = function intersection(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.intersection(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.intersection(otherSet);\n }\n };\n _proto.union = function union(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.union(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.union(otherSet);\n }\n };\n _proto.difference = function difference(otherSet) {\n return new Set(this).difference(otherSet);\n };\n _proto.symmetricDifference = function symmetricDifference(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.symmetricDifference(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.symmetricDifference(otherSet);\n }\n };\n _proto.isSubsetOf = function isSubsetOf(otherSet) {\n return new Set(this).isSubsetOf(otherSet);\n };\n _proto.isSupersetOf = function isSupersetOf(otherSet) {\n return new Set(this).isSupersetOf(otherSet);\n };\n _proto.isDisjointFrom = function isDisjointFrom(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.isDisjointFrom(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.isDisjointFrom(otherSet);\n }\n };\n _proto.replace = function replace(other) {\n var _this5 = this;\n if (isObservableSet(other)) {\n other = new Set(other);\n }\n transaction(function () {\n if (Array.isArray(other)) {\n _this5.clear();\n other.forEach(function (value) {\n return _this5.add(value);\n });\n } else if (isES6Set(other)) {\n _this5.clear();\n other.forEach(function (value) {\n return _this5.add(value);\n });\n } else if (other !== null && other !== undefined) {\n die(\"Cannot initialize set from \" + other);\n }\n });\n return this;\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n // ... 'fireImmediately' could also be true?\n if ( true && fireImmediately === true) {\n die(\"`observe` doesn't support fireImmediately=true in combination with sets.\");\n }\n return registerListener(this, listener);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.toJSON = function toJSON() {\n return Array.from(this);\n };\n _proto.toString = function toString() {\n return \"[object ObservableSet]\";\n };\n _proto[Symbol.iterator] = function () {\n return this.values();\n };\n return _createClass(ObservableSet, [{\n key: \"size\",\n get: function get() {\n this.atom_.reportObserved();\n return this.data_.size;\n }\n }, {\n key: Symbol.toStringTag,\n get: function get() {\n return \"Set\";\n }\n }]);\n}();\n// eslint-disable-next-line\nvar isObservableSet = /*#__PURE__*/createInstanceofPredicate(\"ObservableSet\", ObservableSet);\nfunction makeIterableForSet(iterator) {\n iterator[Symbol.toStringTag] = \"SetIterator\";\n return makeIterable(iterator);\n}\n\nvar descriptorCache = /*#__PURE__*/Object.create(null);\nvar REMOVE = \"remove\";\nvar ObservableObjectAdministration = /*#__PURE__*/function () {\n function ObservableObjectAdministration(target_, values_, name_,\n // Used anytime annotation is not explicitely provided\n defaultAnnotation_) {\n if (values_ === void 0) {\n values_ = new Map();\n }\n if (defaultAnnotation_ === void 0) {\n defaultAnnotation_ = autoAnnotation;\n }\n this.target_ = void 0;\n this.values_ = void 0;\n this.name_ = void 0;\n this.defaultAnnotation_ = void 0;\n this.keysAtom_ = void 0;\n this.changeListeners_ = void 0;\n this.interceptors_ = void 0;\n this.proxy_ = void 0;\n this.isPlainObject_ = void 0;\n this.appliedAnnotations_ = void 0;\n this.pendingKeys_ = void 0;\n this.target_ = target_;\n this.values_ = values_;\n this.name_ = name_;\n this.defaultAnnotation_ = defaultAnnotation_;\n this.keysAtom_ = new Atom( true ? this.name_ + \".keys\" : 0);\n // Optimization: we use this frequently\n this.isPlainObject_ = isPlainObject(this.target_);\n if ( true && !isAnnotation(this.defaultAnnotation_)) {\n die(\"defaultAnnotation must be valid annotation\");\n }\n if (true) {\n // Prepare structure for tracking which fields were already annotated\n this.appliedAnnotations_ = {};\n }\n }\n var _proto = ObservableObjectAdministration.prototype;\n _proto.getObservablePropValue_ = function getObservablePropValue_(key) {\n return this.values_.get(key).get();\n };\n _proto.setObservablePropValue_ = function setObservablePropValue_(key, newValue) {\n var observable = this.values_.get(key);\n if (observable instanceof ComputedValue) {\n observable.set(newValue);\n return true;\n }\n // intercept\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: UPDATE,\n object: this.proxy_ || this.target_,\n name: key,\n newValue: newValue\n });\n if (!change) {\n return null;\n }\n newValue = change.newValue;\n }\n newValue = observable.prepareNewValue_(newValue);\n // notify spy & observers\n if (newValue !== globalState.UNCHANGED) {\n var notify = hasListeners(this);\n var notifySpy = true && isSpyEnabled();\n var _change = notify || notifySpy ? {\n type: UPDATE,\n observableKind: \"object\",\n debugObjectName: this.name_,\n object: this.proxy_ || this.target_,\n oldValue: observable.value_,\n name: key,\n newValue: newValue\n } : null;\n if ( true && notifySpy) {\n spyReportStart(_change);\n }\n observable.setNewValue_(newValue);\n if (notify) {\n notifyListeners(this, _change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n return true;\n };\n _proto.get_ = function get_(key) {\n if (globalState.trackingDerivation && !hasProp(this.target_, key)) {\n // Key doesn't exist yet, subscribe for it in case it's added later\n this.has_(key);\n }\n return this.target_[key];\n }\n /**\n * @param {PropertyKey} key\n * @param {any} value\n * @param {Annotation|boolean} annotation true - use default annotation, false - copy as is\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.set_ = function set_(key, value, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n // Don't use .has(key) - we care about own\n if (hasProp(this.target_, key)) {\n // Existing prop\n if (this.values_.has(key)) {\n // Observable (can be intercepted)\n return this.setObservablePropValue_(key, value);\n } else if (proxyTrap) {\n // Non-observable - proxy\n return Reflect.set(this.target_, key, value);\n } else {\n // Non-observable\n this.target_[key] = value;\n return true;\n }\n } else {\n // New prop\n return this.extend_(key, {\n value: value,\n enumerable: true,\n writable: true,\n configurable: true\n }, this.defaultAnnotation_, proxyTrap);\n }\n }\n // Trap for \"in\"\n ;\n _proto.has_ = function has_(key) {\n if (!globalState.trackingDerivation) {\n // Skip key subscription outside derivation\n return key in this.target_;\n }\n this.pendingKeys_ || (this.pendingKeys_ = new Map());\n var entry = this.pendingKeys_.get(key);\n if (!entry) {\n entry = new ObservableValue(key in this.target_, referenceEnhancer, true ? this.name_ + \".\" + stringifyKey(key) + \"?\" : 0, false);\n this.pendingKeys_.set(key, entry);\n }\n return entry.get();\n }\n /**\n * @param {PropertyKey} key\n * @param {Annotation|boolean} annotation true - use default annotation, false - ignore prop\n */;\n _proto.make_ = function make_(key, annotation) {\n if (annotation === true) {\n annotation = this.defaultAnnotation_;\n }\n if (annotation === false) {\n return;\n }\n assertAnnotable(this, annotation, key);\n if (!(key in this.target_)) {\n var _this$target_$storedA;\n // Throw on missing key, except for decorators:\n // Decorator annotations are collected from whole prototype chain.\n // When called from super() some props may not exist yet.\n // However we don't have to worry about missing prop,\n // because the decorator must have been applied to something.\n if ((_this$target_$storedA = this.target_[storedAnnotationsSymbol]) != null && _this$target_$storedA[key]) {\n return; // will be annotated by subclass constructor\n } else {\n die(1, annotation.annotationType_, this.name_ + \".\" + key.toString());\n }\n }\n var source = this.target_;\n while (source && source !== objectPrototype) {\n var descriptor = getDescriptor(source, key);\n if (descriptor) {\n var outcome = annotation.make_(this, key, descriptor, source);\n if (outcome === 0 /* MakeResult.Cancel */) {\n return;\n }\n if (outcome === 1 /* MakeResult.Break */) {\n break;\n }\n }\n source = Object.getPrototypeOf(source);\n }\n recordAnnotationApplied(this, annotation, key);\n }\n /**\n * @param {PropertyKey} key\n * @param {PropertyDescriptor} descriptor\n * @param {Annotation|boolean} annotation true - use default annotation, false - copy as is\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.extend_ = function extend_(key, descriptor, annotation, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n if (annotation === true) {\n annotation = this.defaultAnnotation_;\n }\n if (annotation === false) {\n return this.defineProperty_(key, descriptor, proxyTrap);\n }\n assertAnnotable(this, annotation, key);\n var outcome = annotation.extend_(this, key, descriptor, proxyTrap);\n if (outcome) {\n recordAnnotationApplied(this, annotation, key);\n }\n return outcome;\n }\n /**\n * @param {PropertyKey} key\n * @param {PropertyDescriptor} descriptor\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.defineProperty_ = function defineProperty_(key, descriptor, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n try {\n startBatch();\n // Delete\n var deleteOutcome = this.delete_(key);\n if (!deleteOutcome) {\n // Failure or intercepted\n return deleteOutcome;\n }\n // ADD interceptor\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: ADD,\n newValue: descriptor.value\n });\n if (!change) {\n return null;\n }\n var newValue = change.newValue;\n if (descriptor.value !== newValue) {\n descriptor = _extends({}, descriptor, {\n value: newValue\n });\n }\n }\n // Define\n if (proxyTrap) {\n if (!Reflect.defineProperty(this.target_, key, descriptor)) {\n return false;\n }\n } else {\n defineProperty(this.target_, key, descriptor);\n }\n // Notify\n this.notifyPropertyAddition_(key, descriptor.value);\n } finally {\n endBatch();\n }\n return true;\n }\n // If original descriptor becomes relevant, move this to annotation directly\n ;\n _proto.defineObservableProperty_ = function defineObservableProperty_(key, value, enhancer, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n try {\n startBatch();\n // Delete\n var deleteOutcome = this.delete_(key);\n if (!deleteOutcome) {\n // Failure or intercepted\n return deleteOutcome;\n }\n // ADD interceptor\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: ADD,\n newValue: value\n });\n if (!change) {\n return null;\n }\n value = change.newValue;\n }\n var cachedDescriptor = getCachedObservablePropDescriptor(key);\n var descriptor = {\n configurable: globalState.safeDescriptors ? this.isPlainObject_ : true,\n enumerable: true,\n get: cachedDescriptor.get,\n set: cachedDescriptor.set\n };\n // Define\n if (proxyTrap) {\n if (!Reflect.defineProperty(this.target_, key, descriptor)) {\n return false;\n }\n } else {\n defineProperty(this.target_, key, descriptor);\n }\n var observable = new ObservableValue(value, enhancer, true ? this.name_ + \".\" + key.toString() : 0, false);\n this.values_.set(key, observable);\n // Notify (value possibly changed by ObservableValue)\n this.notifyPropertyAddition_(key, observable.value_);\n } finally {\n endBatch();\n }\n return true;\n }\n // If original descriptor becomes relevant, move this to annotation directly\n ;\n _proto.defineComputedProperty_ = function defineComputedProperty_(key, options, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n try {\n startBatch();\n // Delete\n var deleteOutcome = this.delete_(key);\n if (!deleteOutcome) {\n // Failure or intercepted\n return deleteOutcome;\n }\n // ADD interceptor\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: ADD,\n newValue: undefined\n });\n if (!change) {\n return null;\n }\n }\n options.name || (options.name = true ? this.name_ + \".\" + key.toString() : 0);\n options.context = this.proxy_ || this.target_;\n var cachedDescriptor = getCachedObservablePropDescriptor(key);\n var descriptor = {\n configurable: globalState.safeDescriptors ? this.isPlainObject_ : true,\n enumerable: false,\n get: cachedDescriptor.get,\n set: cachedDescriptor.set\n };\n // Define\n if (proxyTrap) {\n if (!Reflect.defineProperty(this.target_, key, descriptor)) {\n return false;\n }\n } else {\n defineProperty(this.target_, key, descriptor);\n }\n this.values_.set(key, new ComputedValue(options));\n // Notify\n this.notifyPropertyAddition_(key, undefined);\n } finally {\n endBatch();\n }\n return true;\n }\n /**\n * @param {PropertyKey} key\n * @param {PropertyDescriptor} descriptor\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.delete_ = function delete_(key, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n // No such prop\n if (!hasProp(this.target_, key)) {\n return true;\n }\n // Intercept\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: REMOVE\n });\n // Cancelled\n if (!change) {\n return null;\n }\n }\n // Delete\n try {\n var _this$pendingKeys_;\n startBatch();\n var notify = hasListeners(this);\n var notifySpy = true && isSpyEnabled();\n var observable = this.values_.get(key);\n // Value needed for spies/listeners\n var value = undefined;\n // Optimization: don't pull the value unless we will need it\n if (!observable && (notify || notifySpy)) {\n var _getDescriptor;\n value = (_getDescriptor = getDescriptor(this.target_, key)) == null ? void 0 : _getDescriptor.value;\n }\n // delete prop (do first, may fail)\n if (proxyTrap) {\n if (!Reflect.deleteProperty(this.target_, key)) {\n return false;\n }\n } else {\n delete this.target_[key];\n }\n // Allow re-annotating this field\n if (true) {\n delete this.appliedAnnotations_[key];\n }\n // Clear observable\n if (observable) {\n this.values_[\"delete\"](key);\n // for computed, value is undefined\n if (observable instanceof ObservableValue) {\n value = observable.value_;\n }\n // Notify: autorun(() => obj[key]), see #1796\n propagateChanged(observable);\n }\n // Notify \"keys/entries/values\" observers\n this.keysAtom_.reportChanged();\n // Notify \"has\" observers\n // \"in\" as it may still exist in proto\n (_this$pendingKeys_ = this.pendingKeys_) == null || (_this$pendingKeys_ = _this$pendingKeys_.get(key)) == null || _this$pendingKeys_.set(key in this.target_);\n // Notify spies/listeners\n if (notify || notifySpy) {\n var _change2 = {\n type: REMOVE,\n observableKind: \"object\",\n object: this.proxy_ || this.target_,\n debugObjectName: this.name_,\n oldValue: value,\n name: key\n };\n if ( true && notifySpy) {\n spyReportStart(_change2);\n }\n if (notify) {\n notifyListeners(this, _change2);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n } finally {\n endBatch();\n }\n return true;\n }\n /**\n * Observes this object. Triggers for the events 'add', 'update' and 'delete'.\n * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe\n * for callback details\n */;\n _proto.observe_ = function observe_(callback, fireImmediately) {\n if ( true && fireImmediately === true) {\n die(\"`observe` doesn't support the fire immediately property for observable objects.\");\n }\n return registerListener(this, callback);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.notifyPropertyAddition_ = function notifyPropertyAddition_(key, value) {\n var _this$pendingKeys_2;\n var notify = hasListeners(this);\n var notifySpy = true && isSpyEnabled();\n if (notify || notifySpy) {\n var change = notify || notifySpy ? {\n type: ADD,\n observableKind: \"object\",\n debugObjectName: this.name_,\n object: this.proxy_ || this.target_,\n name: key,\n newValue: value\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n }\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n (_this$pendingKeys_2 = this.pendingKeys_) == null || (_this$pendingKeys_2 = _this$pendingKeys_2.get(key)) == null || _this$pendingKeys_2.set(true);\n // Notify \"keys/entries/values\" observers\n this.keysAtom_.reportChanged();\n };\n _proto.ownKeys_ = function ownKeys_() {\n this.keysAtom_.reportObserved();\n return ownKeys(this.target_);\n };\n _proto.keys_ = function keys_() {\n // Returns enumerable && own, but unfortunately keysAtom will report on ANY key change.\n // There is no way to distinguish between Object.keys(object) and Reflect.ownKeys(object) - both are handled by ownKeys trap.\n // We can either over-report in Object.keys(object) or under-report in Reflect.ownKeys(object)\n // We choose to over-report in Object.keys(object), because:\n // - typically it's used with simple data objects\n // - when symbolic/non-enumerable keys are relevant Reflect.ownKeys works as expected\n this.keysAtom_.reportObserved();\n return Object.keys(this.target_);\n };\n return ObservableObjectAdministration;\n}();\nfunction asObservableObject(target, options) {\n var _options$name;\n if ( true && options && isObservableObject(target)) {\n die(\"Options can't be provided for already observable objects.\");\n }\n if (hasProp(target, $mobx)) {\n if ( true && !(getAdministration(target) instanceof ObservableObjectAdministration)) {\n die(\"Cannot convert '\" + getDebugName(target) + \"' into observable object:\" + \"\\nThe target is already observable of different type.\" + \"\\nExtending builtins is not supported.\");\n }\n return target;\n }\n if ( true && !Object.isExtensible(target)) {\n die(\"Cannot make the designated object observable; it is not extensible\");\n }\n var name = (_options$name = options == null ? void 0 : options.name) != null ? _options$name : true ? (isPlainObject(target) ? \"ObservableObject\" : target.constructor.name) + \"@\" + getNextId() : 0;\n var adm = new ObservableObjectAdministration(target, new Map(), String(name), getAnnotationFromOptions(options));\n addHiddenProp(target, $mobx, adm);\n return target;\n}\nvar isObservableObjectAdministration = /*#__PURE__*/createInstanceofPredicate(\"ObservableObjectAdministration\", ObservableObjectAdministration);\nfunction getCachedObservablePropDescriptor(key) {\n return descriptorCache[key] || (descriptorCache[key] = {\n get: function get() {\n return this[$mobx].getObservablePropValue_(key);\n },\n set: function set(value) {\n return this[$mobx].setObservablePropValue_(key, value);\n }\n });\n}\nfunction isObservableObject(thing) {\n if (isObject(thing)) {\n return isObservableObjectAdministration(thing[$mobx]);\n }\n return false;\n}\nfunction recordAnnotationApplied(adm, annotation, key) {\n var _adm$target_$storedAn;\n if (true) {\n adm.appliedAnnotations_[key] = annotation;\n }\n // Remove applied decorator annotation so we don't try to apply it again in subclass constructor\n (_adm$target_$storedAn = adm.target_[storedAnnotationsSymbol]) == null || delete _adm$target_$storedAn[key];\n}\nfunction assertAnnotable(adm, annotation, key) {\n // Valid annotation\n if ( true && !isAnnotation(annotation)) {\n die(\"Cannot annotate '\" + adm.name_ + \".\" + key.toString() + \"': Invalid annotation.\");\n }\n /*\n // Configurable, not sealed, not frozen\n // Possibly not needed, just a little better error then the one thrown by engine.\n // Cases where this would be useful the most (subclass field initializer) are not interceptable by this.\n if (__DEV__) {\n const configurable = getDescriptor(adm.target_, key)?.configurable\n const frozen = Object.isFrozen(adm.target_)\n const sealed = Object.isSealed(adm.target_)\n if (!configurable || frozen || sealed) {\n const fieldName = `${adm.name_}.${key.toString()}`\n const requestedAnnotationType = annotation.annotationType_\n let error = `Cannot apply '${requestedAnnotationType}' to '${fieldName}':`\n if (frozen) {\n error += `\\nObject is frozen.`\n }\n if (sealed) {\n error += `\\nObject is sealed.`\n }\n if (!configurable) {\n error += `\\nproperty is not configurable.`\n // Mention only if caused by us to avoid confusion\n if (hasProp(adm.appliedAnnotations!, key)) {\n error += `\\nTo prevent accidental re-definition of a field by a subclass, `\n error += `all annotated fields of non-plain objects (classes) are not configurable.`\n }\n }\n die(error)\n }\n }\n */\n // Not annotated\n if ( true && !isOverride(annotation) && hasProp(adm.appliedAnnotations_, key)) {\n var fieldName = adm.name_ + \".\" + key.toString();\n var currentAnnotationType = adm.appliedAnnotations_[key].annotationType_;\n var requestedAnnotationType = annotation.annotationType_;\n die(\"Cannot apply '\" + requestedAnnotationType + \"' to '\" + fieldName + \"':\" + (\"\\nThe field is already annotated with '\" + currentAnnotationType + \"'.\") + \"\\nRe-annotating fields is not allowed.\" + \"\\nUse 'override' annotation for methods overridden by subclass.\");\n }\n}\n\n// Bug in safari 9.* (or iOS 9 safari mobile). See #364\nvar ENTRY_0 = /*#__PURE__*/createArrayEntryDescriptor(0);\nvar safariPrototypeSetterInheritanceBug = /*#__PURE__*/function () {\n var v = false;\n var p = {};\n Object.defineProperty(p, \"0\", {\n set: function set() {\n v = true;\n }\n });\n /*#__PURE__*/Object.create(p)[\"0\"] = 1;\n return v === false;\n}();\n/**\n * This array buffer contains two lists of properties, so that all arrays\n * can recycle their property definitions, which significantly improves performance of creating\n * properties on the fly.\n */\nvar OBSERVABLE_ARRAY_BUFFER_SIZE = 0;\n// Typescript workaround to make sure ObservableArray extends Array\nvar StubArray = function StubArray() {};\nfunction inherit(ctor, proto) {\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(ctor.prototype, proto);\n } else if (ctor.prototype.__proto__ !== undefined) {\n ctor.prototype.__proto__ = proto;\n } else {\n ctor.prototype = proto;\n }\n}\ninherit(StubArray, Array.prototype);\n// Weex proto freeze protection was here,\n// but it is unclear why the hack is need as MobX never changed the prototype\n// anyway, so removed it in V6\nvar LegacyObservableArray = /*#__PURE__*/function (_StubArray) {\n function LegacyObservableArray(initialValues, enhancer, name, owned) {\n var _this;\n if (name === void 0) {\n name = true ? \"ObservableArray@\" + getNextId() : 0;\n }\n if (owned === void 0) {\n owned = false;\n }\n _this = _StubArray.call(this) || this;\n initObservable(function () {\n var adm = new ObservableArrayAdministration(name, enhancer, owned, true);\n adm.proxy_ = _this;\n addHiddenFinalProp(_this, $mobx, adm);\n if (initialValues && initialValues.length) {\n // @ts-ignore\n _this.spliceWithArray(0, 0, initialValues);\n }\n if (safariPrototypeSetterInheritanceBug) {\n // Seems that Safari won't use numeric prototype setter until any * numeric property is\n // defined on the instance. After that it works fine, even if this property is deleted.\n Object.defineProperty(_this, \"0\", ENTRY_0);\n }\n });\n return _this;\n }\n _inheritsLoose(LegacyObservableArray, _StubArray);\n var _proto = LegacyObservableArray.prototype;\n _proto.concat = function concat() {\n this[$mobx].atom_.reportObserved();\n for (var _len = arguments.length, arrays = new Array(_len), _key = 0; _key < _len; _key++) {\n arrays[_key] = arguments[_key];\n }\n return Array.prototype.concat.apply(this.slice(),\n //@ts-ignore\n arrays.map(function (a) {\n return isObservableArray(a) ? a.slice() : a;\n }));\n };\n _proto[Symbol.iterator] = function () {\n var self = this;\n var nextIndex = 0;\n return makeIterable({\n next: function next() {\n return nextIndex < self.length ? {\n value: self[nextIndex++],\n done: false\n } : {\n done: true,\n value: undefined\n };\n }\n });\n };\n return _createClass(LegacyObservableArray, [{\n key: \"length\",\n get: function get() {\n return this[$mobx].getArrayLength_();\n },\n set: function set(newLength) {\n this[$mobx].setArrayLength_(newLength);\n }\n }, {\n key: Symbol.toStringTag,\n get: function get() {\n return \"Array\";\n }\n }]);\n}(StubArray);\nObject.entries(arrayExtensions).forEach(function (_ref) {\n var prop = _ref[0],\n fn = _ref[1];\n if (prop !== \"concat\") {\n addHiddenProp(LegacyObservableArray.prototype, prop, fn);\n }\n});\nfunction createArrayEntryDescriptor(index) {\n return {\n enumerable: false,\n configurable: true,\n get: function get() {\n return this[$mobx].get_(index);\n },\n set: function set(value) {\n this[$mobx].set_(index, value);\n }\n };\n}\nfunction createArrayBufferItem(index) {\n defineProperty(LegacyObservableArray.prototype, \"\" + index, createArrayEntryDescriptor(index));\n}\nfunction reserveArrayBuffer(max) {\n if (max > OBSERVABLE_ARRAY_BUFFER_SIZE) {\n for (var index = OBSERVABLE_ARRAY_BUFFER_SIZE; index < max + 100; index++) {\n createArrayBufferItem(index);\n }\n OBSERVABLE_ARRAY_BUFFER_SIZE = max;\n }\n}\nreserveArrayBuffer(1000);\nfunction createLegacyArray(initialValues, enhancer, name) {\n return new LegacyObservableArray(initialValues, enhancer, name);\n}\n\nfunction getAtom(thing, property) {\n if (typeof thing === \"object\" && thing !== null) {\n if (isObservableArray(thing)) {\n if (property !== undefined) {\n die(23);\n }\n return thing[$mobx].atom_;\n }\n if (isObservableSet(thing)) {\n return thing.atom_;\n }\n if (isObservableMap(thing)) {\n if (property === undefined) {\n return thing.keysAtom_;\n }\n var observable = thing.data_.get(property) || thing.hasMap_.get(property);\n if (!observable) {\n die(25, property, getDebugName(thing));\n }\n return observable;\n }\n if (isObservableObject(thing)) {\n if (!property) {\n return die(26);\n }\n var _observable = thing[$mobx].values_.get(property);\n if (!_observable) {\n die(27, property, getDebugName(thing));\n }\n return _observable;\n }\n if (isAtom(thing) || isComputedValue(thing) || isReaction(thing)) {\n return thing;\n }\n } else if (isFunction(thing)) {\n if (isReaction(thing[$mobx])) {\n // disposer function\n return thing[$mobx];\n }\n }\n die(28);\n}\nfunction getAdministration(thing, property) {\n if (!thing) {\n die(29);\n }\n if (property !== undefined) {\n return getAdministration(getAtom(thing, property));\n }\n if (isAtom(thing) || isComputedValue(thing) || isReaction(thing)) {\n return thing;\n }\n if (isObservableMap(thing) || isObservableSet(thing)) {\n return thing;\n }\n if (thing[$mobx]) {\n return thing[$mobx];\n }\n die(24, thing);\n}\nfunction getDebugName(thing, property) {\n var named;\n if (property !== undefined) {\n named = getAtom(thing, property);\n } else if (isAction(thing)) {\n return thing.name;\n } else if (isObservableObject(thing) || isObservableMap(thing) || isObservableSet(thing)) {\n named = getAdministration(thing);\n } else {\n // valid for arrays as well\n named = getAtom(thing);\n }\n return named.name_;\n}\n/**\n * Helper function for initializing observable structures, it applies:\n * 1. allowStateChanges so we don't violate enforceActions.\n * 2. untracked so we don't accidentaly subscribe to anything observable accessed during init in case the observable is created inside derivation.\n * 3. batch to avoid state version updates\n */\nfunction initObservable(cb) {\n var derivation = untrackedStart();\n var allowStateChanges = allowStateChangesStart(true);\n startBatch();\n try {\n return cb();\n } finally {\n endBatch();\n allowStateChangesEnd(allowStateChanges);\n untrackedEnd(derivation);\n }\n}\n\nvar toString = objectPrototype.toString;\nfunction deepEqual(a, b, depth) {\n if (depth === void 0) {\n depth = -1;\n }\n return eq(a, b, depth);\n}\n// Copied from https://github.com/jashkenas/underscore/blob/5c237a7c682fb68fd5378203f0bf22dce1624854/underscore.js#L1186-L1289\n// Internal recursive comparison function for `isEqual`.\nfunction eq(a, b, depth, aStack, bStack) {\n // Identical objects are equal. `0 === -0`, but they aren't identical.\n // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).\n if (a === b) {\n return a !== 0 || 1 / a === 1 / b;\n }\n // `null` or `undefined` only equal to itself (strict comparison).\n if (a == null || b == null) {\n return false;\n }\n // `NaN`s are equivalent, but non-reflexive.\n if (a !== a) {\n return b !== b;\n }\n // Exhaust primitive checks\n var type = typeof a;\n if (type !== \"function\" && type !== \"object\" && typeof b != \"object\") {\n return false;\n }\n // Compare `[[Class]]` names.\n var className = toString.call(a);\n if (className !== toString.call(b)) {\n return false;\n }\n switch (className) {\n // Strings, numbers, regular expressions, dates, and booleans are compared by value.\n case \"[object RegExp]\":\n // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i')\n case \"[object String]\":\n // Primitives and their corresponding object wrappers are equivalent; thus, `\"5\"` is\n // equivalent to `new String(\"5\")`.\n return \"\" + a === \"\" + b;\n case \"[object Number]\":\n // `NaN`s are equivalent, but non-reflexive.\n // Object(NaN) is equivalent to NaN.\n if (+a !== +a) {\n return +b !== +b;\n }\n // An `egal` comparison is performed for other numeric values.\n return +a === 0 ? 1 / +a === 1 / b : +a === +b;\n case \"[object Date]\":\n case \"[object Boolean]\":\n // Coerce dates and booleans to numeric primitive values. Dates are compared by their\n // millisecond representations. Note that invalid dates with millisecond representations\n // of `NaN` are not equivalent.\n return +a === +b;\n case \"[object Symbol]\":\n return typeof Symbol !== \"undefined\" && Symbol.valueOf.call(a) === Symbol.valueOf.call(b);\n case \"[object Map]\":\n case \"[object Set]\":\n // Maps and Sets are unwrapped to arrays of entry-pairs, adding an incidental level.\n // Hide this extra level by increasing the depth.\n if (depth >= 0) {\n depth++;\n }\n break;\n }\n // Unwrap any wrapped objects.\n a = unwrap(a);\n b = unwrap(b);\n var areArrays = className === \"[object Array]\";\n if (!areArrays) {\n if (typeof a != \"object\" || typeof b != \"object\") {\n return false;\n }\n // Objects with different constructors are not equivalent, but `Object`s or `Array`s\n // from different frames are.\n var aCtor = a.constructor,\n bCtor = b.constructor;\n if (aCtor !== bCtor && !(isFunction(aCtor) && aCtor instanceof aCtor && isFunction(bCtor) && bCtor instanceof bCtor) && \"constructor\" in a && \"constructor\" in b) {\n return false;\n }\n }\n if (depth === 0) {\n return false;\n } else if (depth < 0) {\n depth = -1;\n }\n // Assume equality for cyclic structures. The algorithm for detecting cyclic\n // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.\n // Initializing stack of traversed objects.\n // It's done here since we only need them for objects and arrays comparison.\n aStack = aStack || [];\n bStack = bStack || [];\n var length = aStack.length;\n while (length--) {\n // Linear search. Performance is inversely proportional to the number of\n // unique nested structures.\n if (aStack[length] === a) {\n return bStack[length] === b;\n }\n }\n // Add the first object to the stack of traversed objects.\n aStack.push(a);\n bStack.push(b);\n // Recursively compare objects and arrays.\n if (areArrays) {\n // Compare array lengths to determine if a deep comparison is necessary.\n length = a.length;\n if (length !== b.length) {\n return false;\n }\n // Deep compare the contents, ignoring non-numeric properties.\n while (length--) {\n if (!eq(a[length], b[length], depth - 1, aStack, bStack)) {\n return false;\n }\n }\n } else {\n // Deep compare objects.\n var keys = Object.keys(a);\n var key;\n length = keys.length;\n // Ensure that both objects contain the same number of properties before comparing deep equality.\n if (Object.keys(b).length !== length) {\n return false;\n }\n while (length--) {\n // Deep compare each member\n key = keys[length];\n if (!(hasProp(b, key) && eq(a[key], b[key], depth - 1, aStack, bStack))) {\n return false;\n }\n }\n }\n // Remove the first object from the stack of traversed objects.\n aStack.pop();\n bStack.pop();\n return true;\n}\nfunction unwrap(a) {\n if (isObservableArray(a)) {\n return a.slice();\n }\n if (isES6Map(a) || isObservableMap(a)) {\n return Array.from(a.entries());\n }\n if (isES6Set(a) || isObservableSet(a)) {\n return Array.from(a.entries());\n }\n return a;\n}\n\nvar _getGlobal$Iterator;\n// safely get iterator prototype if available\nvar maybeIteratorPrototype = ((_getGlobal$Iterator = /*#__PURE__*/getGlobal().Iterator) == null ? void 0 : _getGlobal$Iterator.prototype) || {};\nfunction makeIterable(iterator) {\n iterator[Symbol.iterator] = getSelf;\n return Object.assign(Object.create(maybeIteratorPrototype), iterator);\n}\nfunction getSelf() {\n return this;\n}\n\nfunction isAnnotation(thing) {\n return (\n // Can be function\n thing instanceof Object && typeof thing.annotationType_ === \"string\" && isFunction(thing.make_) && isFunction(thing.extend_)\n );\n}\n\n/**\n * (c) Michel Weststrate 2015 - 2020\n * MIT Licensed\n *\n * Welcome to the mobx sources! To get a global overview of how MobX internally works,\n * this is a good place to start:\n * https://medium.com/@mweststrate/becoming-fully-reactive-an-in-depth-explanation-of-mobservable-55995262a254#.xvbh6qd74\n *\n * Source folders:\n * ===============\n *\n * - api/ Most of the public static methods exposed by the module can be found here.\n * - core/ Implementation of the MobX algorithm; atoms, derivations, reactions, dependency trees, optimizations. Cool stuff can be found here.\n * - types/ All the magic that is need to have observable objects, arrays and values is in this folder. Including the modifiers like `asFlat`.\n * - utils/ Utility stuff.\n *\n */\n[\"Symbol\", \"Map\", \"Set\"].forEach(function (m) {\n var g = getGlobal();\n if (typeof g[m] === \"undefined\") {\n die(\"MobX requires global '\" + m + \"' to be available or polyfilled\");\n }\n});\nif (typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__ === \"object\") {\n // See: https://github.com/andykog/mobx-devtools/\n __MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({\n spy: spy,\n extras: {\n getDebugName: getDebugName\n },\n $mobx: $mobx\n });\n}\n\n\n//# sourceMappingURL=mobx.esm.js.map\n\n\n//# sourceURL=webpack://app_adyen_SFRA/./node_modules/mobx/dist/mobx.esm.js?"); /***/ }), diff --git a/cartridges/app_adyen_SFRA/cartridge/static/default/js/checkoutReviewButtons.js b/cartridges/app_adyen_SFRA/cartridge/static/default/js/checkoutReviewButtons.js index e1ecf531f..b6f40ce25 100644 --- a/cartridges/app_adyen_SFRA/cartridge/static/default/js/checkoutReviewButtons.js +++ b/cartridges/app_adyen_SFRA/cartridge/static/default/js/checkoutReviewButtons.js @@ -36,7 +36,7 @@ eval("\n\nvar helpers = __webpack_require__(/*! ./adyen_checkout/helpers */ \"./ \****************************************************************************/ /***/ ((module) => { -eval("\n\n// Adyen constants\n\nmodule.exports = {\n METHOD_ADYEN: 'Adyen',\n METHOD_ADYEN_POS: 'AdyenPOS',\n METHOD_ADYEN_COMPONENT: 'AdyenComponent',\n RECEIVED: 'Received',\n NOTENOUGHBALANCE: 'NotEnoughBalance',\n SUCCESS: 'Success',\n GIFTCARD: 'giftcard',\n SCHEME: 'scheme',\n GIROPAY: 'giropay',\n APPLE_PAY: 'applepay',\n PAYPAL: 'paypal',\n AMAZON_PAY: 'amazonpay',\n ACTIONTYPE: {\n QRCODE: 'qrCode'\n },\n DISABLED_SUBMIT_BUTTON_METHODS: ['paypal', 'paywithgoogle', 'googlepay', 'amazonpay', 'applepay', 'cashapp'],\n MULTIPLE_TX_VARIANTS_COMPONENTS: ['upi']\n};\n\n//# sourceURL=webpack://app_adyen_SFRA/./cartridges/app_adyen_SFRA/cartridge/client/default/js/constants.js?"); +eval("\n\n// Adyen constants\n\nmodule.exports = {\n METHOD_ADYEN: 'Adyen',\n METHOD_ADYEN_POS: 'AdyenPOS',\n METHOD_ADYEN_COMPONENT: 'AdyenComponent',\n RECEIVED: 'Received',\n NOTENOUGHBALANCE: 'NotEnoughBalance',\n SUCCESS: 'Success',\n GIFTCARD: 'giftcard',\n SCHEME: 'scheme',\n GIROPAY: 'giropay',\n APPLE_PAY: 'applepay',\n PAYPAL: 'paypal',\n AMAZON_PAY: 'amazonpay',\n ACTIONTYPE: {\n QRCODE: 'qrCode'\n },\n DISABLED_SUBMIT_BUTTON_METHODS: ['paypal', 'paywithgoogle', 'googlepay', 'amazonpay', 'applepay', 'cashapp', 'upi']\n};\n\n//# sourceURL=webpack://app_adyen_SFRA/./cartridges/app_adyen_SFRA/cartridge/client/default/js/constants.js?"); /***/ }), @@ -56,7 +56,7 @@ eval("\n\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \" \********************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ $mobx: () => (/* binding */ $mobx),\n/* harmony export */ FlowCancellationError: () => (/* binding */ FlowCancellationError),\n/* harmony export */ ObservableMap: () => (/* binding */ ObservableMap),\n/* harmony export */ ObservableSet: () => (/* binding */ ObservableSet),\n/* harmony export */ Reaction: () => (/* binding */ Reaction),\n/* harmony export */ _allowStateChanges: () => (/* binding */ allowStateChanges),\n/* harmony export */ _allowStateChangesInsideComputed: () => (/* binding */ runInAction),\n/* harmony export */ _allowStateReadsEnd: () => (/* binding */ allowStateReadsEnd),\n/* harmony export */ _allowStateReadsStart: () => (/* binding */ allowStateReadsStart),\n/* harmony export */ _autoAction: () => (/* binding */ autoAction),\n/* harmony export */ _endAction: () => (/* binding */ _endAction),\n/* harmony export */ _getAdministration: () => (/* binding */ getAdministration),\n/* harmony export */ _getGlobalState: () => (/* binding */ getGlobalState),\n/* harmony export */ _interceptReads: () => (/* binding */ interceptReads),\n/* harmony export */ _isComputingDerivation: () => (/* binding */ isComputingDerivation),\n/* harmony export */ _resetGlobalState: () => (/* binding */ resetGlobalState),\n/* harmony export */ _startAction: () => (/* binding */ _startAction),\n/* harmony export */ action: () => (/* binding */ action),\n/* harmony export */ autorun: () => (/* binding */ autorun),\n/* harmony export */ comparer: () => (/* binding */ comparer),\n/* harmony export */ computed: () => (/* binding */ computed),\n/* harmony export */ configure: () => (/* binding */ configure),\n/* harmony export */ createAtom: () => (/* binding */ createAtom),\n/* harmony export */ defineProperty: () => (/* binding */ apiDefineProperty),\n/* harmony export */ entries: () => (/* binding */ entries),\n/* harmony export */ extendObservable: () => (/* binding */ extendObservable),\n/* harmony export */ flow: () => (/* binding */ flow),\n/* harmony export */ flowResult: () => (/* binding */ flowResult),\n/* harmony export */ get: () => (/* binding */ get),\n/* harmony export */ getAtom: () => (/* binding */ getAtom),\n/* harmony export */ getDebugName: () => (/* binding */ getDebugName),\n/* harmony export */ getDependencyTree: () => (/* binding */ getDependencyTree),\n/* harmony export */ getObserverTree: () => (/* binding */ getObserverTree),\n/* harmony export */ has: () => (/* binding */ has),\n/* harmony export */ intercept: () => (/* binding */ intercept),\n/* harmony export */ isAction: () => (/* binding */ isAction),\n/* harmony export */ isBoxedObservable: () => (/* binding */ isObservableValue),\n/* harmony export */ isComputed: () => (/* binding */ isComputed),\n/* harmony export */ isComputedProp: () => (/* binding */ isComputedProp),\n/* harmony export */ isFlow: () => (/* binding */ isFlow),\n/* harmony export */ isFlowCancellationError: () => (/* binding */ isFlowCancellationError),\n/* harmony export */ isObservable: () => (/* binding */ isObservable),\n/* harmony export */ isObservableArray: () => (/* binding */ isObservableArray),\n/* harmony export */ isObservableMap: () => (/* binding */ isObservableMap),\n/* harmony export */ isObservableObject: () => (/* binding */ isObservableObject),\n/* harmony export */ isObservableProp: () => (/* binding */ isObservableProp),\n/* harmony export */ isObservableSet: () => (/* binding */ isObservableSet),\n/* harmony export */ keys: () => (/* binding */ keys),\n/* harmony export */ makeAutoObservable: () => (/* binding */ makeAutoObservable),\n/* harmony export */ makeObservable: () => (/* binding */ makeObservable),\n/* harmony export */ observable: () => (/* binding */ observable),\n/* harmony export */ observe: () => (/* binding */ observe),\n/* harmony export */ onBecomeObserved: () => (/* binding */ onBecomeObserved),\n/* harmony export */ onBecomeUnobserved: () => (/* binding */ onBecomeUnobserved),\n/* harmony export */ onReactionError: () => (/* binding */ onReactionError),\n/* harmony export */ override: () => (/* binding */ override),\n/* harmony export */ ownKeys: () => (/* binding */ apiOwnKeys),\n/* harmony export */ reaction: () => (/* binding */ reaction),\n/* harmony export */ remove: () => (/* binding */ remove),\n/* harmony export */ runInAction: () => (/* binding */ runInAction),\n/* harmony export */ set: () => (/* binding */ set),\n/* harmony export */ spy: () => (/* binding */ spy),\n/* harmony export */ toJS: () => (/* binding */ toJS),\n/* harmony export */ trace: () => (/* binding */ trace),\n/* harmony export */ transaction: () => (/* binding */ transaction),\n/* harmony export */ untracked: () => (/* binding */ untracked),\n/* harmony export */ values: () => (/* binding */ values),\n/* harmony export */ when: () => (/* binding */ when)\n/* harmony export */ });\nvar niceErrors = {\n 0: \"Invalid value for configuration 'enforceActions', expected 'never', 'always' or 'observed'\",\n 1: function _(annotationType, key) {\n return \"Cannot apply '\" + annotationType + \"' to '\" + key.toString() + \"': Field not found.\";\n },\n /*\n 2(prop) {\n return `invalid decorator for '${prop.toString()}'`\n },\n 3(prop) {\n return `Cannot decorate '${prop.toString()}': action can only be used on properties with a function value.`\n },\n 4(prop) {\n return `Cannot decorate '${prop.toString()}': computed can only be used on getter properties.`\n },\n */\n 5: \"'keys()' can only be used on observable objects, arrays, sets and maps\",\n 6: \"'values()' can only be used on observable objects, arrays, sets and maps\",\n 7: \"'entries()' can only be used on observable objects, arrays and maps\",\n 8: \"'set()' can only be used on observable objects, arrays and maps\",\n 9: \"'remove()' can only be used on observable objects, arrays and maps\",\n 10: \"'has()' can only be used on observable objects, arrays and maps\",\n 11: \"'get()' can only be used on observable objects, arrays and maps\",\n 12: \"Invalid annotation\",\n 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)\",\n 14: \"Intercept handlers should return nothing or a change object\",\n 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)\",\n 16: \"Modification exception: the internal structure of an observable array was changed.\",\n 17: function _(index, length) {\n return \"[mobx.array] Index out of bounds, \" + index + \" is larger than \" + length;\n },\n 18: \"mobx.map requires Map polyfill for the current browser. Check babel-polyfill or core-js/es6/map.js\",\n 19: function _(other) {\n return \"Cannot initialize from classes that inherit from Map: \" + other.constructor.name;\n },\n 20: function _(other) {\n return \"Cannot initialize map from \" + other;\n },\n 21: function _(dataStructure) {\n return \"Cannot convert to map from '\" + dataStructure + \"'\";\n },\n 22: \"mobx.set requires Set polyfill for the current browser. Check babel-polyfill or core-js/es6/set.js\",\n 23: \"It is not possible to get index atoms from arrays\",\n 24: function _(thing) {\n return \"Cannot obtain administration from \" + thing;\n },\n 25: function _(property, name) {\n return \"the entry '\" + property + \"' does not exist in the observable map '\" + name + \"'\";\n },\n 26: \"please specify a property\",\n 27: function _(property, name) {\n return \"no observable property '\" + property.toString() + \"' found on the observable object '\" + name + \"'\";\n },\n 28: function _(thing) {\n return \"Cannot obtain atom from \" + thing;\n },\n 29: \"Expecting some object\",\n 30: \"invalid action stack. did you forget to finish an action?\",\n 31: \"missing option for computed: get\",\n 32: function _(name, derivation) {\n return \"Cycle detected in computation \" + name + \": \" + derivation;\n },\n 33: function _(name) {\n return \"The setter of computed value '\" + name + \"' is trying to update itself. Did you intend to update an _observable_ value, instead of the computed property?\";\n },\n 34: function _(name) {\n return \"[ComputedValue '\" + name + \"'] It is not possible to assign a new value to a computed value.\";\n },\n 35: \"There are multiple, different versions of MobX active. Make sure MobX is loaded only once or use `configure({ isolateGlobalState: true })`\",\n 36: \"isolateGlobalState should be called before MobX is running any reactions\",\n 37: function _(method) {\n return \"[mobx] `observableArray.\" + method + \"()` mutates the array in-place, which is not allowed inside a derivation. Use `array.slice().\" + method + \"()` instead\";\n },\n 38: \"'ownKeys()' can only be used on observable objects\",\n 39: \"'defineProperty()' can only be used on observable objects\"\n};\nvar errors = true ? niceErrors : 0;\nfunction die(error) {\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n if (true) {\n var e = typeof error === \"string\" ? error : errors[error];\n if (typeof e === \"function\") e = e.apply(null, args);\n throw new Error(\"[MobX] \" + e);\n }\n throw new Error(typeof error === \"number\" ? \"[MobX] minified error nr: \" + error + (args.length ? \" \" + args.map(String).join(\",\") : \"\") + \". Find the full error at: https://github.com/mobxjs/mobx/blob/main/packages/mobx/src/errors.ts\" : \"[MobX] \" + error);\n}\n\nvar mockGlobal = {};\nfunction getGlobal() {\n if (typeof globalThis !== \"undefined\") {\n return globalThis;\n }\n if (typeof window !== \"undefined\") {\n return window;\n }\n if (typeof __webpack_require__.g !== \"undefined\") {\n return __webpack_require__.g;\n }\n if (typeof self !== \"undefined\") {\n return self;\n }\n return mockGlobal;\n}\n\n// We shorten anything used > 5 times\nvar assign = Object.assign;\nvar getDescriptor = Object.getOwnPropertyDescriptor;\nvar defineProperty = Object.defineProperty;\nvar objectPrototype = Object.prototype;\nvar EMPTY_ARRAY = [];\nObject.freeze(EMPTY_ARRAY);\nvar EMPTY_OBJECT = {};\nObject.freeze(EMPTY_OBJECT);\nvar hasProxy = typeof Proxy !== \"undefined\";\nvar plainObjectString = /*#__PURE__*/Object.toString();\nfunction assertProxies() {\n if (!hasProxy) {\n die( true ? \"`Proxy` objects are not available in the current environment. Please configure MobX to enable a fallback implementation.`\" : 0);\n }\n}\nfunction warnAboutProxyRequirement(msg) {\n if ( true && globalState.verifyProxies) {\n die(\"MobX is currently configured to be able to run in ES5 mode, but in ES5 MobX won't be able to \" + msg);\n }\n}\nfunction getNextId() {\n return ++globalState.mobxGuid;\n}\n/**\n * Makes sure that the provided function is invoked at most once.\n */\nfunction once(func) {\n var invoked = false;\n return function () {\n if (invoked) {\n return;\n }\n invoked = true;\n return func.apply(this, arguments);\n };\n}\nvar noop = function noop() {};\nfunction isFunction(fn) {\n return typeof fn === \"function\";\n}\nfunction isStringish(value) {\n var t = typeof value;\n switch (t) {\n case \"string\":\n case \"symbol\":\n case \"number\":\n return true;\n }\n return false;\n}\nfunction isObject(value) {\n return value !== null && typeof value === \"object\";\n}\nfunction isPlainObject(value) {\n if (!isObject(value)) {\n return false;\n }\n var proto = Object.getPrototypeOf(value);\n if (proto == null) {\n return true;\n }\n var protoConstructor = Object.hasOwnProperty.call(proto, \"constructor\") && proto.constructor;\n return typeof protoConstructor === \"function\" && protoConstructor.toString() === plainObjectString;\n}\n// https://stackoverflow.com/a/37865170\nfunction isGenerator(obj) {\n var constructor = obj == null ? void 0 : obj.constructor;\n if (!constructor) {\n return false;\n }\n if (\"GeneratorFunction\" === constructor.name || \"GeneratorFunction\" === constructor.displayName) {\n return true;\n }\n return false;\n}\nfunction addHiddenProp(object, propName, value) {\n defineProperty(object, propName, {\n enumerable: false,\n writable: true,\n configurable: true,\n value: value\n });\n}\nfunction addHiddenFinalProp(object, propName, value) {\n defineProperty(object, propName, {\n enumerable: false,\n writable: false,\n configurable: true,\n value: value\n });\n}\nfunction createInstanceofPredicate(name, theClass) {\n var propName = \"isMobX\" + name;\n theClass.prototype[propName] = true;\n return function (x) {\n return isObject(x) && x[propName] === true;\n };\n}\n/**\n * Yields true for both native and observable Map, even across different windows.\n */\nfunction isES6Map(thing) {\n return thing != null && Object.prototype.toString.call(thing) === \"[object Map]\";\n}\n/**\n * Makes sure a Map is an instance of non-inherited native or observable Map.\n */\nfunction isPlainES6Map(thing) {\n var mapProto = Object.getPrototypeOf(thing);\n var objectProto = Object.getPrototypeOf(mapProto);\n var nullProto = Object.getPrototypeOf(objectProto);\n return nullProto === null;\n}\n/**\n * Yields true for both native and observable Set, even across different windows.\n */\nfunction isES6Set(thing) {\n return thing != null && Object.prototype.toString.call(thing) === \"[object Set]\";\n}\nvar hasGetOwnPropertySymbols = typeof Object.getOwnPropertySymbols !== \"undefined\";\n/**\n * Returns the following: own enumerable keys and symbols.\n */\nfunction getPlainObjectKeys(object) {\n var keys = Object.keys(object);\n // Not supported in IE, so there are not going to be symbol props anyway...\n if (!hasGetOwnPropertySymbols) {\n return keys;\n }\n var symbols = Object.getOwnPropertySymbols(object);\n if (!symbols.length) {\n return keys;\n }\n return [].concat(keys, symbols.filter(function (s) {\n return objectPrototype.propertyIsEnumerable.call(object, s);\n }));\n}\n// From Immer utils\n// Returns all own keys, including non-enumerable and symbolic\nvar ownKeys = typeof Reflect !== \"undefined\" && Reflect.ownKeys ? Reflect.ownKeys : hasGetOwnPropertySymbols ? function (obj) {\n return Object.getOwnPropertyNames(obj).concat(Object.getOwnPropertySymbols(obj));\n} : /* istanbul ignore next */Object.getOwnPropertyNames;\nfunction stringifyKey(key) {\n if (typeof key === \"string\") {\n return key;\n }\n if (typeof key === \"symbol\") {\n return key.toString();\n }\n return new String(key).toString();\n}\nfunction toPrimitive(value) {\n return value === null ? null : typeof value === \"object\" ? \"\" + value : value;\n}\nfunction hasProp(target, prop) {\n return objectPrototype.hasOwnProperty.call(target, prop);\n}\n// From Immer utils\nvar getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors || function getOwnPropertyDescriptors(target) {\n // Polyfill needed for Hermes and IE, see https://github.com/facebook/hermes/issues/274\n var res = {};\n // Note: without polyfill for ownKeys, symbols won't be picked up\n ownKeys(target).forEach(function (key) {\n res[key] = getDescriptor(target, key);\n });\n return res;\n};\nfunction getFlag(flags, mask) {\n return !!(flags & mask);\n}\nfunction setFlag(flags, mask, newValue) {\n if (newValue) {\n flags |= mask;\n } else {\n flags &= ~mask;\n }\n return flags;\n}\n\nfunction _arrayLikeToArray(r, a) {\n (null == a || a > r.length) && (a = r.length);\n for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];\n return n;\n}\nfunction _defineProperties(e, r) {\n for (var t = 0; t < r.length; t++) {\n var o = r[t];\n o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);\n }\n}\nfunction _createClass(e, r, t) {\n return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", {\n writable: !1\n }), e;\n}\nfunction _createForOfIteratorHelperLoose(r, e) {\n var t = \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"];\n if (t) return (t = t.call(r)).next.bind(t);\n if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && \"number\" == typeof r.length) {\n t && (r = t);\n var o = 0;\n return function () {\n return o >= r.length ? {\n done: !0\n } : {\n done: !1,\n value: r[o++]\n };\n };\n }\n throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\nfunction _extends() {\n return _extends = Object.assign ? Object.assign.bind() : function (n) {\n for (var e = 1; e < arguments.length; e++) {\n var t = arguments[e];\n for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);\n }\n return n;\n }, _extends.apply(null, arguments);\n}\nfunction _inheritsLoose(t, o) {\n t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);\n}\nfunction _setPrototypeOf(t, e) {\n return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {\n return t.__proto__ = e, t;\n }, _setPrototypeOf(t, e);\n}\nfunction _toPrimitive(t, r) {\n if (\"object\" != typeof t || !t) return t;\n var e = t[Symbol.toPrimitive];\n if (void 0 !== e) {\n var i = e.call(t, r || \"default\");\n if (\"object\" != typeof i) return i;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (\"string\" === r ? String : Number)(t);\n}\nfunction _toPropertyKey(t) {\n var i = _toPrimitive(t, \"string\");\n return \"symbol\" == typeof i ? i : i + \"\";\n}\nfunction _unsupportedIterableToArray(r, a) {\n if (r) {\n if (\"string\" == typeof r) return _arrayLikeToArray(r, a);\n var t = {}.toString.call(r).slice(8, -1);\n return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;\n }\n}\n\nvar storedAnnotationsSymbol = /*#__PURE__*/Symbol(\"mobx-stored-annotations\");\n/**\n * Creates a function that acts as\n * - decorator\n * - annotation object\n */\nfunction createDecoratorAnnotation(annotation) {\n function decorator(target, property) {\n if (is20223Decorator(property)) {\n return annotation.decorate_20223_(target, property);\n } else {\n storeAnnotation(target, property, annotation);\n }\n }\n return Object.assign(decorator, annotation);\n}\n/**\n * Stores annotation to prototype,\n * so it can be inspected later by `makeObservable` called from constructor\n */\nfunction storeAnnotation(prototype, key, annotation) {\n if (!hasProp(prototype, storedAnnotationsSymbol)) {\n addHiddenProp(prototype, storedAnnotationsSymbol, _extends({}, prototype[storedAnnotationsSymbol]));\n }\n // @override must override something\n if ( true && isOverride(annotation) && !hasProp(prototype[storedAnnotationsSymbol], key)) {\n var fieldName = prototype.constructor.name + \".prototype.\" + key.toString();\n die(\"'\" + fieldName + \"' is decorated with 'override', \" + \"but no such decorated member was found on prototype.\");\n }\n // Cannot re-decorate\n assertNotDecorated(prototype, annotation, key);\n // Ignore override\n if (!isOverride(annotation)) {\n prototype[storedAnnotationsSymbol][key] = annotation;\n }\n}\nfunction assertNotDecorated(prototype, annotation, key) {\n if ( true && !isOverride(annotation) && hasProp(prototype[storedAnnotationsSymbol], key)) {\n var fieldName = prototype.constructor.name + \".prototype.\" + key.toString();\n var currentAnnotationType = prototype[storedAnnotationsSymbol][key].annotationType_;\n var requestedAnnotationType = annotation.annotationType_;\n die(\"Cannot apply '@\" + requestedAnnotationType + \"' to '\" + fieldName + \"':\" + (\"\\nThe field is already decorated with '@\" + currentAnnotationType + \"'.\") + \"\\nRe-decorating fields is not allowed.\" + \"\\nUse '@override' decorator for methods overridden by subclass.\");\n }\n}\n/**\n * Collects annotations from prototypes and stores them on target (instance)\n */\nfunction collectStoredAnnotations(target) {\n if (!hasProp(target, storedAnnotationsSymbol)) {\n // if (__DEV__ && !target[storedAnnotationsSymbol]) {\n // die(\n // `No annotations were passed to makeObservable, but no decorated members have been found either`\n // )\n // }\n // We need a copy as we will remove annotation from the list once it's applied.\n addHiddenProp(target, storedAnnotationsSymbol, _extends({}, target[storedAnnotationsSymbol]));\n }\n return target[storedAnnotationsSymbol];\n}\nfunction is20223Decorator(context) {\n return typeof context == \"object\" && typeof context[\"kind\"] == \"string\";\n}\nfunction assert20223DecoratorType(context, types) {\n if ( true && !types.includes(context.kind)) {\n die(\"The decorator applied to '\" + String(context.name) + \"' cannot be used on a \" + context.kind + \" element\");\n }\n}\n\nvar $mobx = /*#__PURE__*/Symbol(\"mobx administration\");\nvar Atom = /*#__PURE__*/function () {\n /**\n * Create a new atom. For debugging purposes it is recommended to give it a name.\n * The onBecomeObserved and onBecomeUnobserved callbacks can be used for resource management.\n */\n function Atom(name_) {\n if (name_ === void 0) {\n name_ = true ? \"Atom@\" + getNextId() : 0;\n }\n this.name_ = void 0;\n this.flags_ = 0;\n this.observers_ = new Set();\n this.lastAccessedBy_ = 0;\n this.lowestObserverState_ = IDerivationState_.NOT_TRACKING_;\n // onBecomeObservedListeners\n this.onBOL = void 0;\n // onBecomeUnobservedListeners\n this.onBUOL = void 0;\n this.name_ = name_;\n }\n // for effective unobserving. BaseAtom has true, for extra optimization, so its onBecomeUnobserved never gets called, because it's not needed\n var _proto = Atom.prototype;\n _proto.onBO = function onBO() {\n if (this.onBOL) {\n this.onBOL.forEach(function (listener) {\n return listener();\n });\n }\n };\n _proto.onBUO = function onBUO() {\n if (this.onBUOL) {\n this.onBUOL.forEach(function (listener) {\n return listener();\n });\n }\n }\n /**\n * Invoke this method to notify mobx that your atom has been used somehow.\n * Returns true if there is currently a reactive context.\n */;\n _proto.reportObserved = function reportObserved$1() {\n return reportObserved(this);\n }\n /**\n * Invoke this method _after_ this method has changed to signal mobx that all its observers should invalidate.\n */;\n _proto.reportChanged = function reportChanged() {\n startBatch();\n propagateChanged(this);\n endBatch();\n };\n _proto.toString = function toString() {\n return this.name_;\n };\n return _createClass(Atom, [{\n key: \"isBeingObserved\",\n get: function get() {\n return getFlag(this.flags_, Atom.isBeingObservedMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Atom.isBeingObservedMask_, newValue);\n }\n }, {\n key: \"isPendingUnobservation\",\n get: function get() {\n return getFlag(this.flags_, Atom.isPendingUnobservationMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Atom.isPendingUnobservationMask_, newValue);\n }\n }, {\n key: \"diffValue\",\n get: function get() {\n return getFlag(this.flags_, Atom.diffValueMask_) ? 1 : 0;\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Atom.diffValueMask_, newValue === 1 ? true : false);\n }\n }]);\n}();\nAtom.isBeingObservedMask_ = 1;\nAtom.isPendingUnobservationMask_ = 2;\nAtom.diffValueMask_ = 4;\nvar isAtom = /*#__PURE__*/createInstanceofPredicate(\"Atom\", Atom);\nfunction createAtom(name, onBecomeObservedHandler, onBecomeUnobservedHandler) {\n if (onBecomeObservedHandler === void 0) {\n onBecomeObservedHandler = noop;\n }\n if (onBecomeUnobservedHandler === void 0) {\n onBecomeUnobservedHandler = noop;\n }\n var atom = new Atom(name);\n // default `noop` listener will not initialize the hook Set\n if (onBecomeObservedHandler !== noop) {\n onBecomeObserved(atom, onBecomeObservedHandler);\n }\n if (onBecomeUnobservedHandler !== noop) {\n onBecomeUnobserved(atom, onBecomeUnobservedHandler);\n }\n return atom;\n}\n\nfunction identityComparer(a, b) {\n return a === b;\n}\nfunction structuralComparer(a, b) {\n return deepEqual(a, b);\n}\nfunction shallowComparer(a, b) {\n return deepEqual(a, b, 1);\n}\nfunction defaultComparer(a, b) {\n if (Object.is) {\n return Object.is(a, b);\n }\n return a === b ? a !== 0 || 1 / a === 1 / b : a !== a && b !== b;\n}\nvar comparer = {\n identity: identityComparer,\n structural: structuralComparer,\n \"default\": defaultComparer,\n shallow: shallowComparer\n};\n\nfunction deepEnhancer(v, _, name) {\n // it is an observable already, done\n if (isObservable(v)) {\n return v;\n }\n // something that can be converted and mutated?\n if (Array.isArray(v)) {\n return observable.array(v, {\n name: name\n });\n }\n if (isPlainObject(v)) {\n return observable.object(v, undefined, {\n name: name\n });\n }\n if (isES6Map(v)) {\n return observable.map(v, {\n name: name\n });\n }\n if (isES6Set(v)) {\n return observable.set(v, {\n name: name\n });\n }\n if (typeof v === \"function\" && !isAction(v) && !isFlow(v)) {\n if (isGenerator(v)) {\n return flow(v);\n } else {\n return autoAction(name, v);\n }\n }\n return v;\n}\nfunction shallowEnhancer(v, _, name) {\n if (v === undefined || v === null) {\n return v;\n }\n if (isObservableObject(v) || isObservableArray(v) || isObservableMap(v) || isObservableSet(v)) {\n return v;\n }\n if (Array.isArray(v)) {\n return observable.array(v, {\n name: name,\n deep: false\n });\n }\n if (isPlainObject(v)) {\n return observable.object(v, undefined, {\n name: name,\n deep: false\n });\n }\n if (isES6Map(v)) {\n return observable.map(v, {\n name: name,\n deep: false\n });\n }\n if (isES6Set(v)) {\n return observable.set(v, {\n name: name,\n deep: false\n });\n }\n if (true) {\n die(\"The shallow modifier / decorator can only used in combination with arrays, objects, maps and sets\");\n }\n}\nfunction referenceEnhancer(newValue) {\n // never turn into an observable\n return newValue;\n}\nfunction refStructEnhancer(v, oldValue) {\n if ( true && isObservable(v)) {\n die(\"observable.struct should not be used with observable values\");\n }\n if (deepEqual(v, oldValue)) {\n return oldValue;\n }\n return v;\n}\n\nvar OVERRIDE = \"override\";\nvar override = /*#__PURE__*/createDecoratorAnnotation({\n annotationType_: OVERRIDE,\n make_: make_,\n extend_: extend_,\n decorate_20223_: decorate_20223_\n});\nfunction isOverride(annotation) {\n return annotation.annotationType_ === OVERRIDE;\n}\nfunction make_(adm, key) {\n // Must not be plain object\n if ( true && adm.isPlainObject_) {\n die(\"Cannot apply '\" + this.annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + this.annotationType_ + \"' cannot be used on plain objects.\"));\n }\n // Must override something\n if ( true && !hasProp(adm.appliedAnnotations_, key)) {\n die(\"'\" + adm.name_ + \".\" + key.toString() + \"' is annotated with '\" + this.annotationType_ + \"', \" + \"but no such annotated member was found on prototype.\");\n }\n return 0 /* MakeResult.Cancel */;\n}\nfunction extend_(adm, key, descriptor, proxyTrap) {\n die(\"'\" + this.annotationType_ + \"' can only be used with 'makeObservable'\");\n}\nfunction decorate_20223_(desc, context) {\n console.warn(\"'\" + this.annotationType_ + \"' cannot be used with decorators - this is a no-op\");\n}\n\nfunction createActionAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$1,\n extend_: extend_$1,\n decorate_20223_: decorate_20223_$1\n };\n}\nfunction make_$1(adm, key, descriptor, source) {\n var _this$options_;\n // bound\n if ((_this$options_ = this.options_) != null && _this$options_.bound) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;\n }\n // own\n if (source === adm.target_) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 2 /* MakeResult.Continue */;\n }\n // prototype\n if (isAction(descriptor.value)) {\n // A prototype could have been annotated already by other constructor,\n // rest of the proto chain must be annotated already\n return 1 /* MakeResult.Break */;\n }\n var actionDescriptor = createActionDescriptor(adm, this, key, descriptor, false);\n defineProperty(source, key, actionDescriptor);\n return 2 /* MakeResult.Continue */;\n}\nfunction extend_$1(adm, key, descriptor, proxyTrap) {\n var actionDescriptor = createActionDescriptor(adm, this, key, descriptor);\n return adm.defineProperty_(key, actionDescriptor, proxyTrap);\n}\nfunction decorate_20223_$1(mthd, context) {\n if (true) {\n assert20223DecoratorType(context, [\"method\", \"field\"]);\n }\n var kind = context.kind,\n name = context.name,\n addInitializer = context.addInitializer;\n var ann = this;\n var _createAction = function _createAction(m) {\n var _ann$options_$name, _ann$options_, _ann$options_$autoAct, _ann$options_2;\n return createAction((_ann$options_$name = (_ann$options_ = ann.options_) == null ? void 0 : _ann$options_.name) != null ? _ann$options_$name : name.toString(), m, (_ann$options_$autoAct = (_ann$options_2 = ann.options_) == null ? void 0 : _ann$options_2.autoAction) != null ? _ann$options_$autoAct : false);\n };\n // Backwards/Legacy behavior, expects makeObservable(this)\n if (kind == \"field\") {\n addInitializer(function () {\n storeAnnotation(this, name, ann);\n });\n return;\n }\n if (kind == \"method\") {\n var _this$options_2;\n if (!isAction(mthd)) {\n mthd = _createAction(mthd);\n }\n if ((_this$options_2 = this.options_) != null && _this$options_2.bound) {\n addInitializer(function () {\n var self = this;\n var bound = self[name].bind(self);\n bound.isMobxAction = true;\n self[name] = bound;\n });\n }\n return mthd;\n }\n die(\"Cannot apply '\" + ann.annotationType_ + \"' to '\" + String(name) + \"' (kind: \" + kind + \"):\" + (\"\\n'\" + ann.annotationType_ + \"' can only be used on properties with a function value.\"));\n}\nfunction assertActionDescriptor(adm, _ref, key, _ref2) {\n var annotationType_ = _ref.annotationType_;\n var value = _ref2.value;\n if ( true && !isFunction(value)) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' can only be used on properties with a function value.\"));\n }\n}\nfunction createActionDescriptor(adm, annotation, key, descriptor,\n// provides ability to disable safeDescriptors for prototypes\nsafeDescriptors) {\n var _annotation$options_, _annotation$options_$, _annotation$options_2, _annotation$options_$2, _annotation$options_3, _annotation$options_4, _adm$proxy_2;\n if (safeDescriptors === void 0) {\n safeDescriptors = globalState.safeDescriptors;\n }\n assertActionDescriptor(adm, annotation, key, descriptor);\n var value = descriptor.value;\n if ((_annotation$options_ = annotation.options_) != null && _annotation$options_.bound) {\n var _adm$proxy_;\n value = value.bind((_adm$proxy_ = adm.proxy_) != null ? _adm$proxy_ : adm.target_);\n }\n return {\n value: createAction((_annotation$options_$ = (_annotation$options_2 = annotation.options_) == null ? void 0 : _annotation$options_2.name) != null ? _annotation$options_$ : key.toString(), value, (_annotation$options_$2 = (_annotation$options_3 = annotation.options_) == null ? void 0 : _annotation$options_3.autoAction) != null ? _annotation$options_$2 : false,\n // https://github.com/mobxjs/mobx/discussions/3140\n (_annotation$options_4 = annotation.options_) != null && _annotation$options_4.bound ? (_adm$proxy_2 = adm.proxy_) != null ? _adm$proxy_2 : adm.target_ : undefined),\n // Non-configurable for classes\n // prevents accidental field redefinition in subclass\n configurable: safeDescriptors ? adm.isPlainObject_ : true,\n // https://github.com/mobxjs/mobx/pull/2641#issuecomment-737292058\n enumerable: false,\n // Non-obsevable, therefore non-writable\n // Also prevents rewriting in subclass constructor\n writable: safeDescriptors ? false : true\n };\n}\n\nfunction createFlowAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$2,\n extend_: extend_$2,\n decorate_20223_: decorate_20223_$2\n };\n}\nfunction make_$2(adm, key, descriptor, source) {\n var _this$options_;\n // own\n if (source === adm.target_) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 2 /* MakeResult.Continue */;\n }\n // prototype\n // bound - must annotate protos to support super.flow()\n if ((_this$options_ = this.options_) != null && _this$options_.bound && (!hasProp(adm.target_, key) || !isFlow(adm.target_[key]))) {\n if (this.extend_(adm, key, descriptor, false) === null) {\n return 0 /* MakeResult.Cancel */;\n }\n }\n if (isFlow(descriptor.value)) {\n // A prototype could have been annotated already by other constructor,\n // rest of the proto chain must be annotated already\n return 1 /* MakeResult.Break */;\n }\n var flowDescriptor = createFlowDescriptor(adm, this, key, descriptor, false, false);\n defineProperty(source, key, flowDescriptor);\n return 2 /* MakeResult.Continue */;\n}\nfunction extend_$2(adm, key, descriptor, proxyTrap) {\n var _this$options_2;\n var flowDescriptor = createFlowDescriptor(adm, this, key, descriptor, (_this$options_2 = this.options_) == null ? void 0 : _this$options_2.bound);\n return adm.defineProperty_(key, flowDescriptor, proxyTrap);\n}\nfunction decorate_20223_$2(mthd, context) {\n var _this$options_3;\n if (true) {\n assert20223DecoratorType(context, [\"method\"]);\n }\n var name = context.name,\n addInitializer = context.addInitializer;\n if (!isFlow(mthd)) {\n mthd = flow(mthd);\n }\n if ((_this$options_3 = this.options_) != null && _this$options_3.bound) {\n addInitializer(function () {\n var self = this;\n var bound = self[name].bind(self);\n bound.isMobXFlow = true;\n self[name] = bound;\n });\n }\n return mthd;\n}\nfunction assertFlowDescriptor(adm, _ref, key, _ref2) {\n var annotationType_ = _ref.annotationType_;\n var value = _ref2.value;\n if ( true && !isFunction(value)) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' can only be used on properties with a generator function value.\"));\n }\n}\nfunction createFlowDescriptor(adm, annotation, key, descriptor, bound,\n// provides ability to disable safeDescriptors for prototypes\nsafeDescriptors) {\n if (safeDescriptors === void 0) {\n safeDescriptors = globalState.safeDescriptors;\n }\n assertFlowDescriptor(adm, annotation, key, descriptor);\n var value = descriptor.value;\n // In case of flow.bound, the descriptor can be from already annotated prototype\n if (!isFlow(value)) {\n value = flow(value);\n }\n if (bound) {\n var _adm$proxy_;\n // We do not keep original function around, so we bind the existing flow\n value = value.bind((_adm$proxy_ = adm.proxy_) != null ? _adm$proxy_ : adm.target_);\n // This is normally set by `flow`, but `bind` returns new function...\n value.isMobXFlow = true;\n }\n return {\n value: value,\n // Non-configurable for classes\n // prevents accidental field redefinition in subclass\n configurable: safeDescriptors ? adm.isPlainObject_ : true,\n // https://github.com/mobxjs/mobx/pull/2641#issuecomment-737292058\n enumerable: false,\n // Non-obsevable, therefore non-writable\n // Also prevents rewriting in subclass constructor\n writable: safeDescriptors ? false : true\n };\n}\n\nfunction createComputedAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$3,\n extend_: extend_$3,\n decorate_20223_: decorate_20223_$3\n };\n}\nfunction make_$3(adm, key, descriptor) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;\n}\nfunction extend_$3(adm, key, descriptor, proxyTrap) {\n assertComputedDescriptor(adm, this, key, descriptor);\n return adm.defineComputedProperty_(key, _extends({}, this.options_, {\n get: descriptor.get,\n set: descriptor.set\n }), proxyTrap);\n}\nfunction decorate_20223_$3(get, context) {\n if (true) {\n assert20223DecoratorType(context, [\"getter\"]);\n }\n var ann = this;\n var key = context.name,\n addInitializer = context.addInitializer;\n addInitializer(function () {\n var adm = asObservableObject(this)[$mobx];\n var options = _extends({}, ann.options_, {\n get: get,\n context: this\n });\n options.name || (options.name = true ? adm.name_ + \".\" + key.toString() : 0);\n adm.values_.set(key, new ComputedValue(options));\n });\n return function () {\n return this[$mobx].getObservablePropValue_(key);\n };\n}\nfunction assertComputedDescriptor(adm, _ref, key, _ref2) {\n var annotationType_ = _ref.annotationType_;\n var get = _ref2.get;\n if ( true && !get) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' can only be used on getter(+setter) properties.\"));\n }\n}\n\nfunction createObservableAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$4,\n extend_: extend_$4,\n decorate_20223_: decorate_20223_$4\n };\n}\nfunction make_$4(adm, key, descriptor) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;\n}\nfunction extend_$4(adm, key, descriptor, proxyTrap) {\n var _this$options_$enhanc, _this$options_;\n assertObservableDescriptor(adm, this, key, descriptor);\n return adm.defineObservableProperty_(key, descriptor.value, (_this$options_$enhanc = (_this$options_ = this.options_) == null ? void 0 : _this$options_.enhancer) != null ? _this$options_$enhanc : deepEnhancer, proxyTrap);\n}\nfunction decorate_20223_$4(desc, context) {\n if (true) {\n if (context.kind === \"field\") {\n throw die(\"Please use `@observable accessor \" + String(context.name) + \"` instead of `@observable \" + String(context.name) + \"`\");\n }\n assert20223DecoratorType(context, [\"accessor\"]);\n }\n var ann = this;\n var kind = context.kind,\n name = context.name;\n // The laziness here is not ideal... It's a workaround to how 2022.3 Decorators are implemented:\n // `addInitializer` callbacks are executed _before_ any accessors are defined (instead of the ideal-for-us right after each).\n // This means that, if we were to do our stuff in an `addInitializer`, we'd attempt to read a private slot\n // before it has been initialized. The runtime doesn't like that and throws a `Cannot read private member\n // from an object whose class did not declare it` error.\n // TODO: it seems that this will not be required anymore in the final version of the spec\n // See TODO: link\n var initializedObjects = new WeakSet();\n function initializeObservable(target, value) {\n var _ann$options_$enhance, _ann$options_;\n var adm = asObservableObject(target)[$mobx];\n var observable = new ObservableValue(value, (_ann$options_$enhance = (_ann$options_ = ann.options_) == null ? void 0 : _ann$options_.enhancer) != null ? _ann$options_$enhance : deepEnhancer, true ? adm.name_ + \".\" + name.toString() : 0, false);\n adm.values_.set(name, observable);\n initializedObjects.add(target);\n }\n if (kind == \"accessor\") {\n return {\n get: function get() {\n if (!initializedObjects.has(this)) {\n initializeObservable(this, desc.get.call(this));\n }\n return this[$mobx].getObservablePropValue_(name);\n },\n set: function set(value) {\n if (!initializedObjects.has(this)) {\n initializeObservable(this, value);\n }\n return this[$mobx].setObservablePropValue_(name, value);\n },\n init: function init(value) {\n if (!initializedObjects.has(this)) {\n initializeObservable(this, value);\n }\n return value;\n }\n };\n }\n return;\n}\nfunction assertObservableDescriptor(adm, _ref, key, descriptor) {\n var annotationType_ = _ref.annotationType_;\n if ( true && !(\"value\" in descriptor)) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' cannot be used on getter/setter properties\"));\n }\n}\n\nvar AUTO = \"true\";\nvar autoAnnotation = /*#__PURE__*/createAutoAnnotation();\nfunction createAutoAnnotation(options) {\n return {\n annotationType_: AUTO,\n options_: options,\n make_: make_$5,\n extend_: extend_$5,\n decorate_20223_: decorate_20223_$5\n };\n}\nfunction make_$5(adm, key, descriptor, source) {\n var _this$options_3, _this$options_4;\n // getter -> computed\n if (descriptor.get) {\n return computed.make_(adm, key, descriptor, source);\n }\n // lone setter -> action setter\n if (descriptor.set) {\n // TODO make action applicable to setter and delegate to action.make_\n var set = createAction(key.toString(), descriptor.set);\n // own\n if (source === adm.target_) {\n return adm.defineProperty_(key, {\n configurable: globalState.safeDescriptors ? adm.isPlainObject_ : true,\n set: set\n }) === null ? 0 /* MakeResult.Cancel */ : 2 /* MakeResult.Continue */;\n }\n // proto\n defineProperty(source, key, {\n configurable: true,\n set: set\n });\n return 2 /* MakeResult.Continue */;\n }\n // function on proto -> autoAction/flow\n if (source !== adm.target_ && typeof descriptor.value === \"function\") {\n var _this$options_2;\n if (isGenerator(descriptor.value)) {\n var _this$options_;\n var flowAnnotation = (_this$options_ = this.options_) != null && _this$options_.autoBind ? flow.bound : flow;\n return flowAnnotation.make_(adm, key, descriptor, source);\n }\n var actionAnnotation = (_this$options_2 = this.options_) != null && _this$options_2.autoBind ? autoAction.bound : autoAction;\n return actionAnnotation.make_(adm, key, descriptor, source);\n }\n // other -> observable\n // Copy props from proto as well, see test:\n // \"decorate should work with Object.create\"\n var observableAnnotation = ((_this$options_3 = this.options_) == null ? void 0 : _this$options_3.deep) === false ? observable.ref : observable;\n // if function respect autoBind option\n if (typeof descriptor.value === \"function\" && (_this$options_4 = this.options_) != null && _this$options_4.autoBind) {\n var _adm$proxy_;\n descriptor.value = descriptor.value.bind((_adm$proxy_ = adm.proxy_) != null ? _adm$proxy_ : adm.target_);\n }\n return observableAnnotation.make_(adm, key, descriptor, source);\n}\nfunction extend_$5(adm, key, descriptor, proxyTrap) {\n var _this$options_5, _this$options_6;\n // getter -> computed\n if (descriptor.get) {\n return computed.extend_(adm, key, descriptor, proxyTrap);\n }\n // lone setter -> action setter\n if (descriptor.set) {\n // TODO make action applicable to setter and delegate to action.extend_\n return adm.defineProperty_(key, {\n configurable: globalState.safeDescriptors ? adm.isPlainObject_ : true,\n set: createAction(key.toString(), descriptor.set)\n }, proxyTrap);\n }\n // other -> observable\n // if function respect autoBind option\n if (typeof descriptor.value === \"function\" && (_this$options_5 = this.options_) != null && _this$options_5.autoBind) {\n var _adm$proxy_2;\n descriptor.value = descriptor.value.bind((_adm$proxy_2 = adm.proxy_) != null ? _adm$proxy_2 : adm.target_);\n }\n var observableAnnotation = ((_this$options_6 = this.options_) == null ? void 0 : _this$options_6.deep) === false ? observable.ref : observable;\n return observableAnnotation.extend_(adm, key, descriptor, proxyTrap);\n}\nfunction decorate_20223_$5(desc, context) {\n die(\"'\" + this.annotationType_ + \"' cannot be used as a decorator\");\n}\n\nvar OBSERVABLE = \"observable\";\nvar OBSERVABLE_REF = \"observable.ref\";\nvar OBSERVABLE_SHALLOW = \"observable.shallow\";\nvar OBSERVABLE_STRUCT = \"observable.struct\";\n// Predefined bags of create observable options, to avoid allocating temporarily option objects\n// in the majority of cases\nvar defaultCreateObservableOptions = {\n deep: true,\n name: undefined,\n defaultDecorator: undefined,\n proxy: true\n};\nObject.freeze(defaultCreateObservableOptions);\nfunction asCreateObservableOptions(thing) {\n return thing || defaultCreateObservableOptions;\n}\nvar observableAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE);\nvar observableRefAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE_REF, {\n enhancer: referenceEnhancer\n});\nvar observableShallowAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE_SHALLOW, {\n enhancer: shallowEnhancer\n});\nvar observableStructAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE_STRUCT, {\n enhancer: refStructEnhancer\n});\nvar observableDecoratorAnnotation = /*#__PURE__*/createDecoratorAnnotation(observableAnnotation);\nfunction getEnhancerFromOptions(options) {\n return options.deep === true ? deepEnhancer : options.deep === false ? referenceEnhancer : getEnhancerFromAnnotation(options.defaultDecorator);\n}\nfunction getAnnotationFromOptions(options) {\n var _options$defaultDecor;\n return options ? (_options$defaultDecor = options.defaultDecorator) != null ? _options$defaultDecor : createAutoAnnotation(options) : undefined;\n}\nfunction getEnhancerFromAnnotation(annotation) {\n var _annotation$options_$, _annotation$options_;\n return !annotation ? deepEnhancer : (_annotation$options_$ = (_annotation$options_ = annotation.options_) == null ? void 0 : _annotation$options_.enhancer) != null ? _annotation$options_$ : deepEnhancer;\n}\n/**\n * Turns an object, array or function into a reactive structure.\n * @param v the value which should become observable.\n */\nfunction createObservable(v, arg2, arg3) {\n // @observable someProp; (2022.3 Decorators)\n if (is20223Decorator(arg2)) {\n return observableAnnotation.decorate_20223_(v, arg2);\n }\n // @observable someProp;\n if (isStringish(arg2)) {\n storeAnnotation(v, arg2, observableAnnotation);\n return;\n }\n // already observable - ignore\n if (isObservable(v)) {\n return v;\n }\n // plain object\n if (isPlainObject(v)) {\n return observable.object(v, arg2, arg3);\n }\n // Array\n if (Array.isArray(v)) {\n return observable.array(v, arg2);\n }\n // Map\n if (isES6Map(v)) {\n return observable.map(v, arg2);\n }\n // Set\n if (isES6Set(v)) {\n return observable.set(v, arg2);\n }\n // other object - ignore\n if (typeof v === \"object\" && v !== null) {\n return v;\n }\n // anything else\n return observable.box(v, arg2);\n}\nassign(createObservable, observableDecoratorAnnotation);\nvar observableFactories = {\n box: function box(value, options) {\n var o = asCreateObservableOptions(options);\n return new ObservableValue(value, getEnhancerFromOptions(o), o.name, true, o.equals);\n },\n array: function array(initialValues, options) {\n var o = asCreateObservableOptions(options);\n return (globalState.useProxies === false || o.proxy === false ? createLegacyArray : createObservableArray)(initialValues, getEnhancerFromOptions(o), o.name);\n },\n map: function map(initialValues, options) {\n var o = asCreateObservableOptions(options);\n return new ObservableMap(initialValues, getEnhancerFromOptions(o), o.name);\n },\n set: function set(initialValues, options) {\n var o = asCreateObservableOptions(options);\n return new ObservableSet(initialValues, getEnhancerFromOptions(o), o.name);\n },\n object: function object(props, decorators, options) {\n return initObservable(function () {\n return extendObservable(globalState.useProxies === false || (options == null ? void 0 : options.proxy) === false ? asObservableObject({}, options) : asDynamicObservableObject({}, options), props, decorators);\n });\n },\n ref: /*#__PURE__*/createDecoratorAnnotation(observableRefAnnotation),\n shallow: /*#__PURE__*/createDecoratorAnnotation(observableShallowAnnotation),\n deep: observableDecoratorAnnotation,\n struct: /*#__PURE__*/createDecoratorAnnotation(observableStructAnnotation)\n};\n// eslint-disable-next-line\nvar observable = /*#__PURE__*/assign(createObservable, observableFactories);\n\nvar COMPUTED = \"computed\";\nvar COMPUTED_STRUCT = \"computed.struct\";\nvar computedAnnotation = /*#__PURE__*/createComputedAnnotation(COMPUTED);\nvar computedStructAnnotation = /*#__PURE__*/createComputedAnnotation(COMPUTED_STRUCT, {\n equals: comparer.structural\n});\n/**\n * Decorator for class properties: @computed get value() { return expr; }.\n * For legacy purposes also invokable as ES5 observable created: `computed(() => expr)`;\n */\nvar computed = function computed(arg1, arg2) {\n if (is20223Decorator(arg2)) {\n // @computed (2022.3 Decorators)\n return computedAnnotation.decorate_20223_(arg1, arg2);\n }\n if (isStringish(arg2)) {\n // @computed\n return storeAnnotation(arg1, arg2, computedAnnotation);\n }\n if (isPlainObject(arg1)) {\n // @computed({ options })\n return createDecoratorAnnotation(createComputedAnnotation(COMPUTED, arg1));\n }\n // computed(expr, options?)\n if (true) {\n if (!isFunction(arg1)) {\n die(\"First argument to `computed` should be an expression.\");\n }\n if (isFunction(arg2)) {\n die(\"A setter as second argument is no longer supported, use `{ set: fn }` option instead\");\n }\n }\n var opts = isPlainObject(arg2) ? arg2 : {};\n opts.get = arg1;\n opts.name || (opts.name = arg1.name || \"\"); /* for generated name */\n return new ComputedValue(opts);\n};\nObject.assign(computed, computedAnnotation);\ncomputed.struct = /*#__PURE__*/createDecoratorAnnotation(computedStructAnnotation);\n\nvar _getDescriptor$config, _getDescriptor;\n// we don't use globalState for these in order to avoid possible issues with multiple\n// mobx versions\nvar currentActionId = 0;\nvar nextActionId = 1;\nvar isFunctionNameConfigurable = (_getDescriptor$config = (_getDescriptor = /*#__PURE__*/getDescriptor(function () {}, \"name\")) == null ? void 0 : _getDescriptor.configurable) != null ? _getDescriptor$config : false;\n// we can safely recycle this object\nvar tmpNameDescriptor = {\n value: \"action\",\n configurable: true,\n writable: false,\n enumerable: false\n};\nfunction createAction(actionName, fn, autoAction, ref) {\n if (autoAction === void 0) {\n autoAction = false;\n }\n if (true) {\n if (!isFunction(fn)) {\n die(\"`action` can only be invoked on functions\");\n }\n if (typeof actionName !== \"string\" || !actionName) {\n die(\"actions should have valid names, got: '\" + actionName + \"'\");\n }\n }\n function res() {\n return executeAction(actionName, autoAction, fn, ref || this, arguments);\n }\n res.isMobxAction = true;\n res.toString = function () {\n return fn.toString();\n };\n if (isFunctionNameConfigurable) {\n tmpNameDescriptor.value = actionName;\n defineProperty(res, \"name\", tmpNameDescriptor);\n }\n return res;\n}\nfunction executeAction(actionName, canRunAsDerivation, fn, scope, args) {\n var runInfo = _startAction(actionName, canRunAsDerivation, scope, args);\n try {\n return fn.apply(scope, args);\n } catch (err) {\n runInfo.error_ = err;\n throw err;\n } finally {\n _endAction(runInfo);\n }\n}\nfunction _startAction(actionName, canRunAsDerivation,\n// true for autoAction\nscope, args) {\n var notifySpy_ = true && isSpyEnabled() && !!actionName;\n var startTime_ = 0;\n if ( true && notifySpy_) {\n startTime_ = Date.now();\n var flattenedArgs = args ? Array.from(args) : EMPTY_ARRAY;\n spyReportStart({\n type: ACTION,\n name: actionName,\n object: scope,\n arguments: flattenedArgs\n });\n }\n var prevDerivation_ = globalState.trackingDerivation;\n var runAsAction = !canRunAsDerivation || !prevDerivation_;\n startBatch();\n var prevAllowStateChanges_ = globalState.allowStateChanges; // by default preserve previous allow\n if (runAsAction) {\n untrackedStart();\n prevAllowStateChanges_ = allowStateChangesStart(true);\n }\n var prevAllowStateReads_ = allowStateReadsStart(true);\n var runInfo = {\n runAsAction_: runAsAction,\n prevDerivation_: prevDerivation_,\n prevAllowStateChanges_: prevAllowStateChanges_,\n prevAllowStateReads_: prevAllowStateReads_,\n notifySpy_: notifySpy_,\n startTime_: startTime_,\n actionId_: nextActionId++,\n parentActionId_: currentActionId\n };\n currentActionId = runInfo.actionId_;\n return runInfo;\n}\nfunction _endAction(runInfo) {\n if (currentActionId !== runInfo.actionId_) {\n die(30);\n }\n currentActionId = runInfo.parentActionId_;\n if (runInfo.error_ !== undefined) {\n globalState.suppressReactionErrors = true;\n }\n allowStateChangesEnd(runInfo.prevAllowStateChanges_);\n allowStateReadsEnd(runInfo.prevAllowStateReads_);\n endBatch();\n if (runInfo.runAsAction_) {\n untrackedEnd(runInfo.prevDerivation_);\n }\n if ( true && runInfo.notifySpy_) {\n spyReportEnd({\n time: Date.now() - runInfo.startTime_\n });\n }\n globalState.suppressReactionErrors = false;\n}\nfunction allowStateChanges(allowStateChanges, func) {\n var prev = allowStateChangesStart(allowStateChanges);\n try {\n return func();\n } finally {\n allowStateChangesEnd(prev);\n }\n}\nfunction allowStateChangesStart(allowStateChanges) {\n var prev = globalState.allowStateChanges;\n globalState.allowStateChanges = allowStateChanges;\n return prev;\n}\nfunction allowStateChangesEnd(prev) {\n globalState.allowStateChanges = prev;\n}\n\nvar CREATE = \"create\";\nvar ObservableValue = /*#__PURE__*/function (_Atom) {\n function ObservableValue(value, enhancer, name_, notifySpy, equals) {\n var _this;\n if (name_ === void 0) {\n name_ = true ? \"ObservableValue@\" + getNextId() : 0;\n }\n if (notifySpy === void 0) {\n notifySpy = true;\n }\n if (equals === void 0) {\n equals = comparer[\"default\"];\n }\n _this = _Atom.call(this, name_) || this;\n _this.enhancer = void 0;\n _this.name_ = void 0;\n _this.equals = void 0;\n _this.hasUnreportedChange_ = false;\n _this.interceptors_ = void 0;\n _this.changeListeners_ = void 0;\n _this.value_ = void 0;\n _this.dehancer = void 0;\n _this.enhancer = enhancer;\n _this.name_ = name_;\n _this.equals = equals;\n _this.value_ = enhancer(value, undefined, name_);\n if ( true && notifySpy && isSpyEnabled()) {\n // only notify spy if this is a stand-alone observable\n spyReport({\n type: CREATE,\n object: _this,\n observableKind: \"value\",\n debugObjectName: _this.name_,\n newValue: \"\" + _this.value_\n });\n }\n return _this;\n }\n _inheritsLoose(ObservableValue, _Atom);\n var _proto = ObservableValue.prototype;\n _proto.dehanceValue = function dehanceValue(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.set = function set(newValue) {\n var oldValue = this.value_;\n newValue = this.prepareNewValue_(newValue);\n if (newValue !== globalState.UNCHANGED) {\n var notifySpy = isSpyEnabled();\n if ( true && notifySpy) {\n spyReportStart({\n type: UPDATE,\n object: this,\n observableKind: \"value\",\n debugObjectName: this.name_,\n newValue: newValue,\n oldValue: oldValue\n });\n }\n this.setNewValue_(newValue);\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n };\n _proto.prepareNewValue_ = function prepareNewValue_(newValue) {\n checkIfStateModificationsAreAllowed(this);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this,\n type: UPDATE,\n newValue: newValue\n });\n if (!change) {\n return globalState.UNCHANGED;\n }\n newValue = change.newValue;\n }\n // apply modifier\n newValue = this.enhancer(newValue, this.value_, this.name_);\n return this.equals(this.value_, newValue) ? globalState.UNCHANGED : newValue;\n };\n _proto.setNewValue_ = function setNewValue_(newValue) {\n var oldValue = this.value_;\n this.value_ = newValue;\n this.reportChanged();\n if (hasListeners(this)) {\n notifyListeners(this, {\n type: UPDATE,\n object: this,\n newValue: newValue,\n oldValue: oldValue\n });\n }\n };\n _proto.get = function get() {\n this.reportObserved();\n return this.dehanceValue(this.value_);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n if (fireImmediately) {\n listener({\n observableKind: \"value\",\n debugObjectName: this.name_,\n object: this,\n type: UPDATE,\n newValue: this.value_,\n oldValue: undefined\n });\n }\n return registerListener(this, listener);\n };\n _proto.raw = function raw() {\n // used by MST ot get undehanced value\n return this.value_;\n };\n _proto.toJSON = function toJSON() {\n return this.get();\n };\n _proto.toString = function toString() {\n return this.name_ + \"[\" + this.value_ + \"]\";\n };\n _proto.valueOf = function valueOf() {\n return toPrimitive(this.get());\n };\n _proto[Symbol.toPrimitive] = function () {\n return this.valueOf();\n };\n return ObservableValue;\n}(Atom);\nvar isObservableValue = /*#__PURE__*/createInstanceofPredicate(\"ObservableValue\", ObservableValue);\n\n/**\n * A node in the state dependency root that observes other nodes, and can be observed itself.\n *\n * ComputedValue will remember the result of the computation for the duration of the batch, or\n * while being observed.\n *\n * During this time it will recompute only when one of its direct dependencies changed,\n * but only when it is being accessed with `ComputedValue.get()`.\n *\n * Implementation description:\n * 1. First time it's being accessed it will compute and remember result\n * give back remembered result until 2. happens\n * 2. First time any deep dependency change, propagate POSSIBLY_STALE to all observers, wait for 3.\n * 3. When it's being accessed, recompute if any shallow dependency changed.\n * if result changed: propagate STALE to all observers, that were POSSIBLY_STALE from the last step.\n * go to step 2. either way\n *\n * If at any point it's outside batch and it isn't observed: reset everything and go to 1.\n */\nvar ComputedValue = /*#__PURE__*/function () {\n /**\n * Create a new computed value based on a function expression.\n *\n * The `name` property is for debug purposes only.\n *\n * The `equals` property specifies the comparer function to use to determine if a newly produced\n * value differs from the previous value. Two comparers are provided in the library; `defaultComparer`\n * compares based on identity comparison (===), and `structuralComparer` deeply compares the structure.\n * Structural comparison can be convenient if you always produce a new aggregated object and\n * don't want to notify observers if it is structurally the same.\n * This is useful for working with vectors, mouse coordinates etc.\n */\n function ComputedValue(options) {\n this.dependenciesState_ = IDerivationState_.NOT_TRACKING_;\n this.observing_ = [];\n // nodes we are looking at. Our value depends on these nodes\n this.newObserving_ = null;\n // during tracking it's an array with new observed observers\n this.observers_ = new Set();\n this.runId_ = 0;\n this.lastAccessedBy_ = 0;\n this.lowestObserverState_ = IDerivationState_.UP_TO_DATE_;\n this.unboundDepsCount_ = 0;\n this.value_ = new CaughtException(null);\n this.name_ = void 0;\n this.triggeredBy_ = void 0;\n this.flags_ = 0;\n this.derivation = void 0;\n // N.B: unminified as it is used by MST\n this.setter_ = void 0;\n this.isTracing_ = TraceMode.NONE;\n this.scope_ = void 0;\n this.equals_ = void 0;\n this.requiresReaction_ = void 0;\n this.keepAlive_ = void 0;\n this.onBOL = void 0;\n this.onBUOL = void 0;\n if (!options.get) {\n die(31);\n }\n this.derivation = options.get;\n this.name_ = options.name || ( true ? \"ComputedValue@\" + getNextId() : 0);\n if (options.set) {\n this.setter_ = createAction( true ? this.name_ + \"-setter\" : 0, options.set);\n }\n this.equals_ = options.equals || (options.compareStructural || options.struct ? comparer.structural : comparer[\"default\"]);\n this.scope_ = options.context;\n this.requiresReaction_ = options.requiresReaction;\n this.keepAlive_ = !!options.keepAlive;\n }\n var _proto = ComputedValue.prototype;\n _proto.onBecomeStale_ = function onBecomeStale_() {\n propagateMaybeChanged(this);\n };\n _proto.onBO = function onBO() {\n if (this.onBOL) {\n this.onBOL.forEach(function (listener) {\n return listener();\n });\n }\n };\n _proto.onBUO = function onBUO() {\n if (this.onBUOL) {\n this.onBUOL.forEach(function (listener) {\n return listener();\n });\n }\n }\n // to check for cycles\n ;\n /**\n * Returns the current value of this computed value.\n * Will evaluate its computation first if needed.\n */\n _proto.get = function get() {\n if (this.isComputing) {\n die(32, this.name_, this.derivation);\n }\n if (globalState.inBatch === 0 &&\n // !globalState.trackingDerivatpion &&\n this.observers_.size === 0 && !this.keepAlive_) {\n if (shouldCompute(this)) {\n this.warnAboutUntrackedRead_();\n startBatch(); // See perf test 'computed memoization'\n this.value_ = this.computeValue_(false);\n endBatch();\n }\n } else {\n reportObserved(this);\n if (shouldCompute(this)) {\n var prevTrackingContext = globalState.trackingContext;\n if (this.keepAlive_ && !prevTrackingContext) {\n globalState.trackingContext = this;\n }\n if (this.trackAndCompute()) {\n propagateChangeConfirmed(this);\n }\n globalState.trackingContext = prevTrackingContext;\n }\n }\n var result = this.value_;\n if (isCaughtException(result)) {\n throw result.cause;\n }\n return result;\n };\n _proto.set = function set(value) {\n if (this.setter_) {\n if (this.isRunningSetter) {\n die(33, this.name_);\n }\n this.isRunningSetter = true;\n try {\n this.setter_.call(this.scope_, value);\n } finally {\n this.isRunningSetter = false;\n }\n } else {\n die(34, this.name_);\n }\n };\n _proto.trackAndCompute = function trackAndCompute() {\n // N.B: unminified as it is used by MST\n var oldValue = this.value_;\n var wasSuspended = /* see #1208 */this.dependenciesState_ === IDerivationState_.NOT_TRACKING_;\n var newValue = this.computeValue_(true);\n var changed = wasSuspended || isCaughtException(oldValue) || isCaughtException(newValue) || !this.equals_(oldValue, newValue);\n if (changed) {\n this.value_ = newValue;\n if ( true && isSpyEnabled()) {\n spyReport({\n observableKind: \"computed\",\n debugObjectName: this.name_,\n object: this.scope_,\n type: \"update\",\n oldValue: oldValue,\n newValue: newValue\n });\n }\n }\n return changed;\n };\n _proto.computeValue_ = function computeValue_(track) {\n this.isComputing = true;\n // don't allow state changes during computation\n var prev = allowStateChangesStart(false);\n var res;\n if (track) {\n res = trackDerivedFunction(this, this.derivation, this.scope_);\n } else {\n if (globalState.disableErrorBoundaries === true) {\n res = this.derivation.call(this.scope_);\n } else {\n try {\n res = this.derivation.call(this.scope_);\n } catch (e) {\n res = new CaughtException(e);\n }\n }\n }\n allowStateChangesEnd(prev);\n this.isComputing = false;\n return res;\n };\n _proto.suspend_ = function suspend_() {\n if (!this.keepAlive_) {\n clearObserving(this);\n this.value_ = undefined; // don't hold on to computed value!\n if ( true && this.isTracing_ !== TraceMode.NONE) {\n console.log(\"[mobx.trace] Computed value '\" + this.name_ + \"' was suspended and it will recompute on the next access.\");\n }\n }\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n var _this = this;\n var firstTime = true;\n var prevValue = undefined;\n return autorun(function () {\n // TODO: why is this in a different place than the spyReport() function? in all other observables it's called in the same place\n var newValue = _this.get();\n if (!firstTime || fireImmediately) {\n var prevU = untrackedStart();\n listener({\n observableKind: \"computed\",\n debugObjectName: _this.name_,\n type: UPDATE,\n object: _this,\n newValue: newValue,\n oldValue: prevValue\n });\n untrackedEnd(prevU);\n }\n firstTime = false;\n prevValue = newValue;\n });\n };\n _proto.warnAboutUntrackedRead_ = function warnAboutUntrackedRead_() {\n if (false) {}\n if (this.isTracing_ !== TraceMode.NONE) {\n console.log(\"[mobx.trace] Computed value '\" + this.name_ + \"' is being read outside a reactive context. Doing a full recompute.\");\n }\n if (typeof this.requiresReaction_ === \"boolean\" ? this.requiresReaction_ : globalState.computedRequiresReaction) {\n console.warn(\"[mobx] Computed value '\" + this.name_ + \"' is being read outside a reactive context. Doing a full recompute.\");\n }\n };\n _proto.toString = function toString() {\n return this.name_ + \"[\" + this.derivation.toString() + \"]\";\n };\n _proto.valueOf = function valueOf() {\n return toPrimitive(this.get());\n };\n _proto[Symbol.toPrimitive] = function () {\n return this.valueOf();\n };\n return _createClass(ComputedValue, [{\n key: \"isComputing\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isComputingMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isComputingMask_, newValue);\n }\n }, {\n key: \"isRunningSetter\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isRunningSetterMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isRunningSetterMask_, newValue);\n }\n }, {\n key: \"isBeingObserved\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isBeingObservedMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isBeingObservedMask_, newValue);\n }\n }, {\n key: \"isPendingUnobservation\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isPendingUnobservationMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isPendingUnobservationMask_, newValue);\n }\n }, {\n key: \"diffValue\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.diffValueMask_) ? 1 : 0;\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.diffValueMask_, newValue === 1 ? true : false);\n }\n }]);\n}();\nComputedValue.isComputingMask_ = 1;\nComputedValue.isRunningSetterMask_ = 2;\nComputedValue.isBeingObservedMask_ = 4;\nComputedValue.isPendingUnobservationMask_ = 8;\nComputedValue.diffValueMask_ = 16;\nvar isComputedValue = /*#__PURE__*/createInstanceofPredicate(\"ComputedValue\", ComputedValue);\n\nvar IDerivationState_;\n(function (IDerivationState_) {\n // before being run or (outside batch and not being observed)\n // at this point derivation is not holding any data about dependency tree\n IDerivationState_[IDerivationState_[\"NOT_TRACKING_\"] = -1] = \"NOT_TRACKING_\";\n // no shallow dependency changed since last computation\n // won't recalculate derivation\n // this is what makes mobx fast\n IDerivationState_[IDerivationState_[\"UP_TO_DATE_\"] = 0] = \"UP_TO_DATE_\";\n // some deep dependency changed, but don't know if shallow dependency changed\n // will require to check first if UP_TO_DATE or POSSIBLY_STALE\n // currently only ComputedValue will propagate POSSIBLY_STALE\n //\n // having this state is second big optimization:\n // don't have to recompute on every dependency change, but only when it's needed\n IDerivationState_[IDerivationState_[\"POSSIBLY_STALE_\"] = 1] = \"POSSIBLY_STALE_\";\n // A shallow dependency has changed since last computation and the derivation\n // will need to recompute when it's needed next.\n IDerivationState_[IDerivationState_[\"STALE_\"] = 2] = \"STALE_\";\n})(IDerivationState_ || (IDerivationState_ = {}));\nvar TraceMode;\n(function (TraceMode) {\n TraceMode[TraceMode[\"NONE\"] = 0] = \"NONE\";\n TraceMode[TraceMode[\"LOG\"] = 1] = \"LOG\";\n TraceMode[TraceMode[\"BREAK\"] = 2] = \"BREAK\";\n})(TraceMode || (TraceMode = {}));\nvar CaughtException = function CaughtException(cause) {\n this.cause = void 0;\n this.cause = cause;\n // Empty\n};\nfunction isCaughtException(e) {\n return e instanceof CaughtException;\n}\n/**\n * Finds out whether any dependency of the derivation has actually changed.\n * If dependenciesState is 1 then it will recalculate dependencies,\n * if any dependency changed it will propagate it by changing dependenciesState to 2.\n *\n * By iterating over the dependencies in the same order that they were reported and\n * stopping on the first change, all the recalculations are only called for ComputedValues\n * that will be tracked by derivation. That is because we assume that if the first x\n * dependencies of the derivation doesn't change then the derivation should run the same way\n * up until accessing x-th dependency.\n */\nfunction shouldCompute(derivation) {\n switch (derivation.dependenciesState_) {\n case IDerivationState_.UP_TO_DATE_:\n return false;\n case IDerivationState_.NOT_TRACKING_:\n case IDerivationState_.STALE_:\n return true;\n case IDerivationState_.POSSIBLY_STALE_:\n {\n // state propagation can occur outside of action/reactive context #2195\n var prevAllowStateReads = allowStateReadsStart(true);\n var prevUntracked = untrackedStart(); // no need for those computeds to be reported, they will be picked up in trackDerivedFunction.\n var obs = derivation.observing_,\n l = obs.length;\n for (var i = 0; i < l; i++) {\n var obj = obs[i];\n if (isComputedValue(obj)) {\n if (globalState.disableErrorBoundaries) {\n obj.get();\n } else {\n try {\n obj.get();\n } catch (e) {\n // we are not interested in the value *or* exception at this moment, but if there is one, notify all\n untrackedEnd(prevUntracked);\n allowStateReadsEnd(prevAllowStateReads);\n return true;\n }\n }\n // if ComputedValue `obj` actually changed it will be computed and propagated to its observers.\n // and `derivation` is an observer of `obj`\n // invariantShouldCompute(derivation)\n if (derivation.dependenciesState_ === IDerivationState_.STALE_) {\n untrackedEnd(prevUntracked);\n allowStateReadsEnd(prevAllowStateReads);\n return true;\n }\n }\n }\n changeDependenciesStateTo0(derivation);\n untrackedEnd(prevUntracked);\n allowStateReadsEnd(prevAllowStateReads);\n return false;\n }\n }\n}\nfunction isComputingDerivation() {\n return globalState.trackingDerivation !== null; // filter out actions inside computations\n}\nfunction checkIfStateModificationsAreAllowed(atom) {\n if (false) {}\n var hasObservers = atom.observers_.size > 0;\n // Should not be possible to change observed state outside strict mode, except during initialization, see #563\n if (!globalState.allowStateChanges && (hasObservers || globalState.enforceActions === \"always\")) {\n console.warn(\"[MobX] \" + (globalState.enforceActions ? \"Since strict-mode is enabled, changing (observed) observable values without using an action is not allowed. Tried to modify: \" : \"Side effects like changing state are not allowed at this point. Are you trying to modify state from, for example, a computed value or the render function of a React component? You can wrap side effects in 'runInAction' (or decorate functions with 'action') if needed. Tried to modify: \") + atom.name_);\n }\n}\nfunction checkIfStateReadsAreAllowed(observable) {\n if ( true && !globalState.allowStateReads && globalState.observableRequiresReaction) {\n console.warn(\"[mobx] Observable '\" + observable.name_ + \"' being read outside a reactive context.\");\n }\n}\n/**\n * Executes the provided function `f` and tracks which observables are being accessed.\n * The tracking information is stored on the `derivation` object and the derivation is registered\n * as observer of any of the accessed observables.\n */\nfunction trackDerivedFunction(derivation, f, context) {\n var prevAllowStateReads = allowStateReadsStart(true);\n changeDependenciesStateTo0(derivation);\n // Preallocate array; will be trimmed by bindDependencies.\n derivation.newObserving_ = new Array(\n // Reserve constant space for initial dependencies, dynamic space otherwise.\n // See https://github.com/mobxjs/mobx/pull/3833\n derivation.runId_ === 0 ? 100 : derivation.observing_.length);\n derivation.unboundDepsCount_ = 0;\n derivation.runId_ = ++globalState.runId;\n var prevTracking = globalState.trackingDerivation;\n globalState.trackingDerivation = derivation;\n globalState.inBatch++;\n var result;\n if (globalState.disableErrorBoundaries === true) {\n result = f.call(context);\n } else {\n try {\n result = f.call(context);\n } catch (e) {\n result = new CaughtException(e);\n }\n }\n globalState.inBatch--;\n globalState.trackingDerivation = prevTracking;\n bindDependencies(derivation);\n warnAboutDerivationWithoutDependencies(derivation);\n allowStateReadsEnd(prevAllowStateReads);\n return result;\n}\nfunction warnAboutDerivationWithoutDependencies(derivation) {\n if (false) {}\n if (derivation.observing_.length !== 0) {\n return;\n }\n if (typeof derivation.requiresObservable_ === \"boolean\" ? derivation.requiresObservable_ : globalState.reactionRequiresObservable) {\n console.warn(\"[mobx] Derivation '\" + derivation.name_ + \"' is created/updated without reading any observable value.\");\n }\n}\n/**\n * diffs newObserving with observing.\n * update observing to be newObserving with unique observables\n * notify observers that become observed/unobserved\n */\nfunction bindDependencies(derivation) {\n // invariant(derivation.dependenciesState !== IDerivationState.NOT_TRACKING, \"INTERNAL ERROR bindDependencies expects derivation.dependenciesState !== -1\");\n var prevObserving = derivation.observing_;\n var observing = derivation.observing_ = derivation.newObserving_;\n var lowestNewObservingDerivationState = IDerivationState_.UP_TO_DATE_;\n // Go through all new observables and check diffValue: (this list can contain duplicates):\n // 0: first occurrence, change to 1 and keep it\n // 1: extra occurrence, drop it\n var i0 = 0,\n l = derivation.unboundDepsCount_;\n for (var i = 0; i < l; i++) {\n var dep = observing[i];\n if (dep.diffValue === 0) {\n dep.diffValue = 1;\n if (i0 !== i) {\n observing[i0] = dep;\n }\n i0++;\n }\n // Upcast is 'safe' here, because if dep is IObservable, `dependenciesState` will be undefined,\n // not hitting the condition\n if (dep.dependenciesState_ > lowestNewObservingDerivationState) {\n lowestNewObservingDerivationState = dep.dependenciesState_;\n }\n }\n observing.length = i0;\n derivation.newObserving_ = null; // newObserving shouldn't be needed outside tracking (statement moved down to work around FF bug, see #614)\n // Go through all old observables and check diffValue: (it is unique after last bindDependencies)\n // 0: it's not in new observables, unobserve it\n // 1: it keeps being observed, don't want to notify it. change to 0\n l = prevObserving.length;\n while (l--) {\n var _dep = prevObserving[l];\n if (_dep.diffValue === 0) {\n removeObserver(_dep, derivation);\n }\n _dep.diffValue = 0;\n }\n // Go through all new observables and check diffValue: (now it should be unique)\n // 0: it was set to 0 in last loop. don't need to do anything.\n // 1: it wasn't observed, let's observe it. set back to 0\n while (i0--) {\n var _dep2 = observing[i0];\n if (_dep2.diffValue === 1) {\n _dep2.diffValue = 0;\n addObserver(_dep2, derivation);\n }\n }\n // Some new observed derivations may become stale during this derivation computation\n // so they have had no chance to propagate staleness (#916)\n if (lowestNewObservingDerivationState !== IDerivationState_.UP_TO_DATE_) {\n derivation.dependenciesState_ = lowestNewObservingDerivationState;\n derivation.onBecomeStale_();\n }\n}\nfunction clearObserving(derivation) {\n // invariant(globalState.inBatch > 0, \"INTERNAL ERROR clearObserving should be called only inside batch\");\n var obs = derivation.observing_;\n derivation.observing_ = [];\n var i = obs.length;\n while (i--) {\n removeObserver(obs[i], derivation);\n }\n derivation.dependenciesState_ = IDerivationState_.NOT_TRACKING_;\n}\nfunction untracked(action) {\n var prev = untrackedStart();\n try {\n return action();\n } finally {\n untrackedEnd(prev);\n }\n}\nfunction untrackedStart() {\n var prev = globalState.trackingDerivation;\n globalState.trackingDerivation = null;\n return prev;\n}\nfunction untrackedEnd(prev) {\n globalState.trackingDerivation = prev;\n}\nfunction allowStateReadsStart(allowStateReads) {\n var prev = globalState.allowStateReads;\n globalState.allowStateReads = allowStateReads;\n return prev;\n}\nfunction allowStateReadsEnd(prev) {\n globalState.allowStateReads = prev;\n}\n/**\n * needed to keep `lowestObserverState` correct. when changing from (2 or 1) to 0\n *\n */\nfunction changeDependenciesStateTo0(derivation) {\n if (derivation.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {\n return;\n }\n derivation.dependenciesState_ = IDerivationState_.UP_TO_DATE_;\n var obs = derivation.observing_;\n var i = obs.length;\n while (i--) {\n obs[i].lowestObserverState_ = IDerivationState_.UP_TO_DATE_;\n }\n}\n\n/**\n * These values will persist if global state is reset\n */\nvar persistentKeys = [\"mobxGuid\", \"spyListeners\", \"enforceActions\", \"computedRequiresReaction\", \"reactionRequiresObservable\", \"observableRequiresReaction\", \"allowStateReads\", \"disableErrorBoundaries\", \"runId\", \"UNCHANGED\", \"useProxies\"];\nvar MobXGlobals = function MobXGlobals() {\n /**\n * MobXGlobals version.\n * MobX compatiblity with other versions loaded in memory as long as this version matches.\n * It indicates that the global state still stores similar information\n *\n * N.B: this version is unrelated to the package version of MobX, and is only the version of the\n * internal state storage of MobX, and can be the same across many different package versions\n */\n this.version = 6;\n /**\n * globally unique token to signal unchanged\n */\n this.UNCHANGED = {};\n /**\n * Currently running derivation\n */\n this.trackingDerivation = null;\n /**\n * Currently running reaction. This determines if we currently have a reactive context.\n * (Tracking derivation is also set for temporal tracking of computed values inside actions,\n * but trackingReaction can only be set by a form of Reaction)\n */\n this.trackingContext = null;\n /**\n * Each time a derivation is tracked, it is assigned a unique run-id\n */\n this.runId = 0;\n /**\n * 'guid' for general purpose. Will be persisted amongst resets.\n */\n this.mobxGuid = 0;\n /**\n * Are we in a batch block? (and how many of them)\n */\n this.inBatch = 0;\n /**\n * Observables that don't have observers anymore, and are about to be\n * suspended, unless somebody else accesses it in the same batch\n *\n * @type {IObservable[]}\n */\n this.pendingUnobservations = [];\n /**\n * List of scheduled, not yet executed, reactions.\n */\n this.pendingReactions = [];\n /**\n * Are we currently processing reactions?\n */\n this.isRunningReactions = false;\n /**\n * Is it allowed to change observables at this point?\n * In general, MobX doesn't allow that when running computations and React.render.\n * To ensure that those functions stay pure.\n */\n this.allowStateChanges = false;\n /**\n * Is it allowed to read observables at this point?\n * Used to hold the state needed for `observableRequiresReaction`\n */\n this.allowStateReads = true;\n /**\n * If strict mode is enabled, state changes are by default not allowed\n */\n this.enforceActions = true;\n /**\n * Spy callbacks\n */\n this.spyListeners = [];\n /**\n * Globally attached error handlers that react specifically to errors in reactions\n */\n this.globalReactionErrorHandlers = [];\n /**\n * Warn if computed values are accessed outside a reactive context\n */\n this.computedRequiresReaction = false;\n /**\n * (Experimental)\n * Warn if you try to create to derivation / reactive context without accessing any observable.\n */\n this.reactionRequiresObservable = false;\n /**\n * (Experimental)\n * Warn if observables are accessed outside a reactive context\n */\n this.observableRequiresReaction = false;\n /*\n * Don't catch and rethrow exceptions. This is useful for inspecting the state of\n * the stack when an exception occurs while debugging.\n */\n this.disableErrorBoundaries = false;\n /*\n * If true, we are already handling an exception in an action. Any errors in reactions should be suppressed, as\n * they are not the cause, see: https://github.com/mobxjs/mobx/issues/1836\n */\n this.suppressReactionErrors = false;\n this.useProxies = true;\n /*\n * print warnings about code that would fail if proxies weren't available\n */\n this.verifyProxies = false;\n /**\n * False forces all object's descriptors to\n * writable: true\n * configurable: true\n */\n this.safeDescriptors = true;\n};\nvar canMergeGlobalState = true;\nvar isolateCalled = false;\nvar globalState = /*#__PURE__*/function () {\n var global = /*#__PURE__*/getGlobal();\n if (global.__mobxInstanceCount > 0 && !global.__mobxGlobals) {\n canMergeGlobalState = false;\n }\n if (global.__mobxGlobals && global.__mobxGlobals.version !== new MobXGlobals().version) {\n canMergeGlobalState = false;\n }\n if (!canMergeGlobalState) {\n // Because this is a IIFE we need to let isolateCalled a chance to change\n // so we run it after the event loop completed at least 1 iteration\n setTimeout(function () {\n if (!isolateCalled) {\n die(35);\n }\n }, 1);\n return new MobXGlobals();\n } else if (global.__mobxGlobals) {\n global.__mobxInstanceCount += 1;\n if (!global.__mobxGlobals.UNCHANGED) {\n global.__mobxGlobals.UNCHANGED = {};\n } // make merge backward compatible\n return global.__mobxGlobals;\n } else {\n global.__mobxInstanceCount = 1;\n return global.__mobxGlobals = /*#__PURE__*/new MobXGlobals();\n }\n}();\nfunction isolateGlobalState() {\n if (globalState.pendingReactions.length || globalState.inBatch || globalState.isRunningReactions) {\n die(36);\n }\n isolateCalled = true;\n if (canMergeGlobalState) {\n var global = getGlobal();\n if (--global.__mobxInstanceCount === 0) {\n global.__mobxGlobals = undefined;\n }\n globalState = new MobXGlobals();\n }\n}\nfunction getGlobalState() {\n return globalState;\n}\n/**\n * For testing purposes only; this will break the internal state of existing observables,\n * but can be used to get back at a stable state after throwing errors\n */\nfunction resetGlobalState() {\n var defaultGlobals = new MobXGlobals();\n for (var key in defaultGlobals) {\n if (persistentKeys.indexOf(key) === -1) {\n globalState[key] = defaultGlobals[key];\n }\n }\n globalState.allowStateChanges = !globalState.enforceActions;\n}\n\nfunction hasObservers(observable) {\n return observable.observers_ && observable.observers_.size > 0;\n}\nfunction getObservers(observable) {\n return observable.observers_;\n}\n// function invariantObservers(observable: IObservable) {\n// const list = observable.observers\n// const map = observable.observersIndexes\n// const l = list.length\n// for (let i = 0; i < l; i++) {\n// const id = list[i].__mapid\n// if (i) {\n// invariant(map[id] === i, \"INTERNAL ERROR maps derivation.__mapid to index in list\") // for performance\n// } else {\n// invariant(!(id in map), \"INTERNAL ERROR observer on index 0 shouldn't be held in map.\") // for performance\n// }\n// }\n// invariant(\n// list.length === 0 || Object.keys(map).length === list.length - 1,\n// \"INTERNAL ERROR there is no junk in map\"\n// )\n// }\nfunction addObserver(observable, node) {\n // invariant(node.dependenciesState !== -1, \"INTERNAL ERROR, can add only dependenciesState !== -1\");\n // invariant(observable._observers.indexOf(node) === -1, \"INTERNAL ERROR add already added node\");\n // invariantObservers(observable);\n observable.observers_.add(node);\n if (observable.lowestObserverState_ > node.dependenciesState_) {\n observable.lowestObserverState_ = node.dependenciesState_;\n }\n // invariantObservers(observable);\n // invariant(observable._observers.indexOf(node) !== -1, \"INTERNAL ERROR didn't add node\");\n}\nfunction removeObserver(observable, node) {\n // invariant(globalState.inBatch > 0, \"INTERNAL ERROR, remove should be called only inside batch\");\n // invariant(observable._observers.indexOf(node) !== -1, \"INTERNAL ERROR remove already removed node\");\n // invariantObservers(observable);\n observable.observers_[\"delete\"](node);\n if (observable.observers_.size === 0) {\n // deleting last observer\n queueForUnobservation(observable);\n }\n // invariantObservers(observable);\n // invariant(observable._observers.indexOf(node) === -1, \"INTERNAL ERROR remove already removed node2\");\n}\nfunction queueForUnobservation(observable) {\n if (observable.isPendingUnobservation === false) {\n // invariant(observable._observers.length === 0, \"INTERNAL ERROR, should only queue for unobservation unobserved observables\");\n observable.isPendingUnobservation = true;\n globalState.pendingUnobservations.push(observable);\n }\n}\n/**\n * Batch starts a transaction, at least for purposes of memoizing ComputedValues when nothing else does.\n * During a batch `onBecomeUnobserved` will be called at most once per observable.\n * Avoids unnecessary recalculations.\n */\nfunction startBatch() {\n globalState.inBatch++;\n}\nfunction endBatch() {\n if (--globalState.inBatch === 0) {\n runReactions();\n // the batch is actually about to finish, all unobserving should happen here.\n var list = globalState.pendingUnobservations;\n for (var i = 0; i < list.length; i++) {\n var observable = list[i];\n observable.isPendingUnobservation = false;\n if (observable.observers_.size === 0) {\n if (observable.isBeingObserved) {\n // if this observable had reactive observers, trigger the hooks\n observable.isBeingObserved = false;\n observable.onBUO();\n }\n if (observable instanceof ComputedValue) {\n // computed values are automatically teared down when the last observer leaves\n // this process happens recursively, this computed might be the last observabe of another, etc..\n observable.suspend_();\n }\n }\n }\n globalState.pendingUnobservations = [];\n }\n}\nfunction reportObserved(observable) {\n checkIfStateReadsAreAllowed(observable);\n var derivation = globalState.trackingDerivation;\n if (derivation !== null) {\n /**\n * Simple optimization, give each derivation run an unique id (runId)\n * Check if last time this observable was accessed the same runId is used\n * if this is the case, the relation is already known\n */\n if (derivation.runId_ !== observable.lastAccessedBy_) {\n observable.lastAccessedBy_ = derivation.runId_;\n // Tried storing newObserving, or observing, or both as Set, but performance didn't come close...\n derivation.newObserving_[derivation.unboundDepsCount_++] = observable;\n if (!observable.isBeingObserved && globalState.trackingContext) {\n observable.isBeingObserved = true;\n observable.onBO();\n }\n }\n return observable.isBeingObserved;\n } else if (observable.observers_.size === 0 && globalState.inBatch > 0) {\n queueForUnobservation(observable);\n }\n return false;\n}\n// function invariantLOS(observable: IObservable, msg: string) {\n// // it's expensive so better not run it in produciton. but temporarily helpful for testing\n// const min = getObservers(observable).reduce((a, b) => Math.min(a, b.dependenciesState), 2)\n// if (min >= observable.lowestObserverState) return // <- the only assumption about `lowestObserverState`\n// throw new Error(\n// \"lowestObserverState is wrong for \" +\n// msg +\n// \" because \" +\n// min +\n// \" < \" +\n// observable.lowestObserverState\n// )\n// }\n/**\n * NOTE: current propagation mechanism will in case of self reruning autoruns behave unexpectedly\n * It will propagate changes to observers from previous run\n * It's hard or maybe impossible (with reasonable perf) to get it right with current approach\n * Hopefully self reruning autoruns aren't a feature people should depend on\n * Also most basic use cases should be ok\n */\n// Called by Atom when its value changes\nfunction propagateChanged(observable) {\n // invariantLOS(observable, \"changed start\");\n if (observable.lowestObserverState_ === IDerivationState_.STALE_) {\n return;\n }\n observable.lowestObserverState_ = IDerivationState_.STALE_;\n // Ideally we use for..of here, but the downcompiled version is really slow...\n observable.observers_.forEach(function (d) {\n if (d.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {\n if ( true && d.isTracing_ !== TraceMode.NONE) {\n logTraceInfo(d, observable);\n }\n d.onBecomeStale_();\n }\n d.dependenciesState_ = IDerivationState_.STALE_;\n });\n // invariantLOS(observable, \"changed end\");\n}\n// Called by ComputedValue when it recalculate and its value changed\nfunction propagateChangeConfirmed(observable) {\n // invariantLOS(observable, \"confirmed start\");\n if (observable.lowestObserverState_ === IDerivationState_.STALE_) {\n return;\n }\n observable.lowestObserverState_ = IDerivationState_.STALE_;\n observable.observers_.forEach(function (d) {\n if (d.dependenciesState_ === IDerivationState_.POSSIBLY_STALE_) {\n d.dependenciesState_ = IDerivationState_.STALE_;\n if ( true && d.isTracing_ !== TraceMode.NONE) {\n logTraceInfo(d, observable);\n }\n } else if (d.dependenciesState_ === IDerivationState_.UP_TO_DATE_ // this happens during computing of `d`, just keep lowestObserverState up to date.\n ) {\n observable.lowestObserverState_ = IDerivationState_.UP_TO_DATE_;\n }\n });\n // invariantLOS(observable, \"confirmed end\");\n}\n// Used by computed when its dependency changed, but we don't wan't to immediately recompute.\nfunction propagateMaybeChanged(observable) {\n // invariantLOS(observable, \"maybe start\");\n if (observable.lowestObserverState_ !== IDerivationState_.UP_TO_DATE_) {\n return;\n }\n observable.lowestObserverState_ = IDerivationState_.POSSIBLY_STALE_;\n observable.observers_.forEach(function (d) {\n if (d.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {\n d.dependenciesState_ = IDerivationState_.POSSIBLY_STALE_;\n d.onBecomeStale_();\n }\n });\n // invariantLOS(observable, \"maybe end\");\n}\nfunction logTraceInfo(derivation, observable) {\n console.log(\"[mobx.trace] '\" + derivation.name_ + \"' is invalidated due to a change in: '\" + observable.name_ + \"'\");\n if (derivation.isTracing_ === TraceMode.BREAK) {\n var lines = [];\n printDepTree(getDependencyTree(derivation), lines, 1);\n // prettier-ignore\n new Function(\"debugger;\\n/*\\nTracing '\" + derivation.name_ + \"'\\n\\nYou are entering this break point because derivation '\" + derivation.name_ + \"' is being traced and '\" + observable.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\" + (derivation instanceof ComputedValue ? derivation.derivation.toString().replace(/[*]\\//g, \"/\") : \"\") + \"\\n\\nThe dependencies for this derivation are:\\n\\n\" + lines.join(\"\\n\") + \"\\n*/\\n \")();\n }\n}\nfunction printDepTree(tree, lines, depth) {\n if (lines.length >= 1000) {\n lines.push(\"(and many more)\");\n return;\n }\n lines.push(\"\" + \"\\t\".repeat(depth - 1) + tree.name);\n if (tree.dependencies) {\n tree.dependencies.forEach(function (child) {\n return printDepTree(child, lines, depth + 1);\n });\n }\n}\n\nvar Reaction = /*#__PURE__*/function () {\n function Reaction(name_, onInvalidate_, errorHandler_, requiresObservable_) {\n if (name_ === void 0) {\n name_ = true ? \"Reaction@\" + getNextId() : 0;\n }\n this.name_ = void 0;\n this.onInvalidate_ = void 0;\n this.errorHandler_ = void 0;\n this.requiresObservable_ = void 0;\n this.observing_ = [];\n // nodes we are looking at. Our value depends on these nodes\n this.newObserving_ = [];\n this.dependenciesState_ = IDerivationState_.NOT_TRACKING_;\n this.runId_ = 0;\n this.unboundDepsCount_ = 0;\n this.flags_ = 0;\n this.isTracing_ = TraceMode.NONE;\n this.name_ = name_;\n this.onInvalidate_ = onInvalidate_;\n this.errorHandler_ = errorHandler_;\n this.requiresObservable_ = requiresObservable_;\n }\n var _proto = Reaction.prototype;\n _proto.onBecomeStale_ = function onBecomeStale_() {\n this.schedule_();\n };\n _proto.schedule_ = function schedule_() {\n if (!this.isScheduled) {\n this.isScheduled = true;\n globalState.pendingReactions.push(this);\n runReactions();\n }\n }\n /**\n * internal, use schedule() if you intend to kick off a reaction\n */;\n _proto.runReaction_ = function runReaction_() {\n if (!this.isDisposed) {\n startBatch();\n this.isScheduled = false;\n var prev = globalState.trackingContext;\n globalState.trackingContext = this;\n if (shouldCompute(this)) {\n this.isTrackPending = true;\n try {\n this.onInvalidate_();\n if ( true && this.isTrackPending && isSpyEnabled()) {\n // onInvalidate didn't trigger track right away..\n spyReport({\n name: this.name_,\n type: \"scheduled-reaction\"\n });\n }\n } catch (e) {\n this.reportExceptionInDerivation_(e);\n }\n }\n globalState.trackingContext = prev;\n endBatch();\n }\n };\n _proto.track = function track(fn) {\n if (this.isDisposed) {\n return;\n // console.warn(\"Reaction already disposed\") // Note: Not a warning / error in mobx 4 either\n }\n startBatch();\n var notify = isSpyEnabled();\n var startTime;\n if ( true && notify) {\n startTime = Date.now();\n spyReportStart({\n name: this.name_,\n type: \"reaction\"\n });\n }\n this.isRunning = true;\n var prevReaction = globalState.trackingContext; // reactions could create reactions...\n globalState.trackingContext = this;\n var result = trackDerivedFunction(this, fn, undefined);\n globalState.trackingContext = prevReaction;\n this.isRunning = false;\n this.isTrackPending = false;\n if (this.isDisposed) {\n // disposed during last run. Clean up everything that was bound after the dispose call.\n clearObserving(this);\n }\n if (isCaughtException(result)) {\n this.reportExceptionInDerivation_(result.cause);\n }\n if ( true && notify) {\n spyReportEnd({\n time: Date.now() - startTime\n });\n }\n endBatch();\n };\n _proto.reportExceptionInDerivation_ = function reportExceptionInDerivation_(error) {\n var _this = this;\n if (this.errorHandler_) {\n this.errorHandler_(error, this);\n return;\n }\n if (globalState.disableErrorBoundaries) {\n throw error;\n }\n var message = true ? \"[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '\" + this + \"'\" : 0;\n if (!globalState.suppressReactionErrors) {\n console.error(message, error);\n /** If debugging brought you here, please, read the above message :-). Tnx! */\n } else if (true) {\n console.warn(\"[mobx] (error in reaction '\" + this.name_ + \"' suppressed, fix error of causing action below)\");\n } // prettier-ignore\n if ( true && isSpyEnabled()) {\n spyReport({\n type: \"error\",\n name: this.name_,\n message: message,\n error: \"\" + error\n });\n }\n globalState.globalReactionErrorHandlers.forEach(function (f) {\n return f(error, _this);\n });\n };\n _proto.dispose = function dispose() {\n if (!this.isDisposed) {\n this.isDisposed = true;\n if (!this.isRunning) {\n // if disposed while running, clean up later. Maybe not optimal, but rare case\n startBatch();\n clearObserving(this);\n endBatch();\n }\n }\n };\n _proto.getDisposer_ = function getDisposer_(abortSignal) {\n var _this2 = this;\n var dispose = function dispose() {\n _this2.dispose();\n abortSignal == null || abortSignal.removeEventListener == null || abortSignal.removeEventListener(\"abort\", dispose);\n };\n abortSignal == null || abortSignal.addEventListener == null || abortSignal.addEventListener(\"abort\", dispose);\n dispose[$mobx] = this;\n return dispose;\n };\n _proto.toString = function toString() {\n return \"Reaction[\" + this.name_ + \"]\";\n };\n _proto.trace = function trace$1(enterBreakPoint) {\n if (enterBreakPoint === void 0) {\n enterBreakPoint = false;\n }\n trace(this, enterBreakPoint);\n };\n return _createClass(Reaction, [{\n key: \"isDisposed\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isDisposedMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isDisposedMask_, newValue);\n }\n }, {\n key: \"isScheduled\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isScheduledMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isScheduledMask_, newValue);\n }\n }, {\n key: \"isTrackPending\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isTrackPendingMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isTrackPendingMask_, newValue);\n }\n }, {\n key: \"isRunning\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isRunningMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isRunningMask_, newValue);\n }\n }, {\n key: \"diffValue\",\n get: function get() {\n return getFlag(this.flags_, Reaction.diffValueMask_) ? 1 : 0;\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.diffValueMask_, newValue === 1 ? true : false);\n }\n }]);\n}();\nReaction.isDisposedMask_ = 1;\nReaction.isScheduledMask_ = 2;\nReaction.isTrackPendingMask_ = 4;\nReaction.isRunningMask_ = 8;\nReaction.diffValueMask_ = 16;\nfunction onReactionError(handler) {\n globalState.globalReactionErrorHandlers.push(handler);\n return function () {\n var idx = globalState.globalReactionErrorHandlers.indexOf(handler);\n if (idx >= 0) {\n globalState.globalReactionErrorHandlers.splice(idx, 1);\n }\n };\n}\n/**\n * Magic number alert!\n * Defines within how many times a reaction is allowed to re-trigger itself\n * until it is assumed that this is gonna be a never ending loop...\n */\nvar MAX_REACTION_ITERATIONS = 100;\nvar reactionScheduler = function reactionScheduler(f) {\n return f();\n};\nfunction runReactions() {\n // Trampolining, if runReactions are already running, new reactions will be picked up\n if (globalState.inBatch > 0 || globalState.isRunningReactions) {\n return;\n }\n reactionScheduler(runReactionsHelper);\n}\nfunction runReactionsHelper() {\n globalState.isRunningReactions = true;\n var allReactions = globalState.pendingReactions;\n var iterations = 0;\n // While running reactions, new reactions might be triggered.\n // Hence we work with two variables and check whether\n // we converge to no remaining reactions after a while.\n while (allReactions.length > 0) {\n if (++iterations === MAX_REACTION_ITERATIONS) {\n console.error( true ? \"Reaction doesn't converge to a stable state after \" + MAX_REACTION_ITERATIONS + \" iterations.\" + (\" Probably there is a cycle in the reactive function: \" + allReactions[0]) : 0);\n allReactions.splice(0); // clear reactions\n }\n var remainingReactions = allReactions.splice(0);\n for (var i = 0, l = remainingReactions.length; i < l; i++) {\n remainingReactions[i].runReaction_();\n }\n }\n globalState.isRunningReactions = false;\n}\nvar isReaction = /*#__PURE__*/createInstanceofPredicate(\"Reaction\", Reaction);\nfunction setReactionScheduler(fn) {\n var baseScheduler = reactionScheduler;\n reactionScheduler = function reactionScheduler(f) {\n return fn(function () {\n return baseScheduler(f);\n });\n };\n}\n\nfunction isSpyEnabled() {\n return true && !!globalState.spyListeners.length;\n}\nfunction spyReport(event) {\n if (false) {} // dead code elimination can do the rest\n if (!globalState.spyListeners.length) {\n return;\n }\n var listeners = globalState.spyListeners;\n for (var i = 0, l = listeners.length; i < l; i++) {\n listeners[i](event);\n }\n}\nfunction spyReportStart(event) {\n if (false) {}\n var change = _extends({}, event, {\n spyReportStart: true\n });\n spyReport(change);\n}\nvar END_EVENT = {\n type: \"report-end\",\n spyReportEnd: true\n};\nfunction spyReportEnd(change) {\n if (false) {}\n if (change) {\n spyReport(_extends({}, change, {\n type: \"report-end\",\n spyReportEnd: true\n }));\n } else {\n spyReport(END_EVENT);\n }\n}\nfunction spy(listener) {\n if (false) {} else {\n globalState.spyListeners.push(listener);\n return once(function () {\n globalState.spyListeners = globalState.spyListeners.filter(function (l) {\n return l !== listener;\n });\n });\n }\n}\n\nvar ACTION = \"action\";\nvar ACTION_BOUND = \"action.bound\";\nvar AUTOACTION = \"autoAction\";\nvar AUTOACTION_BOUND = \"autoAction.bound\";\nvar DEFAULT_ACTION_NAME = \"\";\nvar actionAnnotation = /*#__PURE__*/createActionAnnotation(ACTION);\nvar actionBoundAnnotation = /*#__PURE__*/createActionAnnotation(ACTION_BOUND, {\n bound: true\n});\nvar autoActionAnnotation = /*#__PURE__*/createActionAnnotation(AUTOACTION, {\n autoAction: true\n});\nvar autoActionBoundAnnotation = /*#__PURE__*/createActionAnnotation(AUTOACTION_BOUND, {\n autoAction: true,\n bound: true\n});\nfunction createActionFactory(autoAction) {\n var res = function action(arg1, arg2) {\n // action(fn() {})\n if (isFunction(arg1)) {\n return createAction(arg1.name || DEFAULT_ACTION_NAME, arg1, autoAction);\n }\n // action(\"name\", fn() {})\n if (isFunction(arg2)) {\n return createAction(arg1, arg2, autoAction);\n }\n // @action (2022.3 Decorators)\n if (is20223Decorator(arg2)) {\n return (autoAction ? autoActionAnnotation : actionAnnotation).decorate_20223_(arg1, arg2);\n }\n // @action\n if (isStringish(arg2)) {\n return storeAnnotation(arg1, arg2, autoAction ? autoActionAnnotation : actionAnnotation);\n }\n // action(\"name\") & @action(\"name\")\n if (isStringish(arg1)) {\n return createDecoratorAnnotation(createActionAnnotation(autoAction ? AUTOACTION : ACTION, {\n name: arg1,\n autoAction: autoAction\n }));\n }\n if (true) {\n die(\"Invalid arguments for `action`\");\n }\n };\n return res;\n}\nvar action = /*#__PURE__*/createActionFactory(false);\nObject.assign(action, actionAnnotation);\nvar autoAction = /*#__PURE__*/createActionFactory(true);\nObject.assign(autoAction, autoActionAnnotation);\naction.bound = /*#__PURE__*/createDecoratorAnnotation(actionBoundAnnotation);\nautoAction.bound = /*#__PURE__*/createDecoratorAnnotation(autoActionBoundAnnotation);\nfunction runInAction(fn) {\n return executeAction(fn.name || DEFAULT_ACTION_NAME, false, fn, this, undefined);\n}\nfunction isAction(thing) {\n return isFunction(thing) && thing.isMobxAction === true;\n}\n\n/**\n * Creates a named reactive view and keeps it alive, so that the view is always\n * updated if one of the dependencies changes, even when the view is not further used by something else.\n * @param view The reactive view\n * @returns disposer function, which can be used to stop the view from being updated in the future.\n */\nfunction autorun(view, opts) {\n var _opts$name, _opts, _opts2, _opts3;\n if (opts === void 0) {\n opts = EMPTY_OBJECT;\n }\n if (true) {\n if (!isFunction(view)) {\n die(\"Autorun expects a function as first argument\");\n }\n if (isAction(view)) {\n die(\"Autorun does not accept actions since actions are untrackable\");\n }\n }\n var name = (_opts$name = (_opts = opts) == null ? void 0 : _opts.name) != null ? _opts$name : true ? view.name || \"Autorun@\" + getNextId() : 0;\n var runSync = !opts.scheduler && !opts.delay;\n var reaction;\n if (runSync) {\n // normal autorun\n reaction = new Reaction(name, function () {\n this.track(reactionRunner);\n }, opts.onError, opts.requiresObservable);\n } else {\n var scheduler = createSchedulerFromOptions(opts);\n // debounced autorun\n var isScheduled = false;\n reaction = new Reaction(name, function () {\n if (!isScheduled) {\n isScheduled = true;\n scheduler(function () {\n isScheduled = false;\n if (!reaction.isDisposed) {\n reaction.track(reactionRunner);\n }\n });\n }\n }, opts.onError, opts.requiresObservable);\n }\n function reactionRunner() {\n view(reaction);\n }\n if (!((_opts2 = opts) != null && (_opts2 = _opts2.signal) != null && _opts2.aborted)) {\n reaction.schedule_();\n }\n return reaction.getDisposer_((_opts3 = opts) == null ? void 0 : _opts3.signal);\n}\nvar run = function run(f) {\n return f();\n};\nfunction createSchedulerFromOptions(opts) {\n return opts.scheduler ? opts.scheduler : opts.delay ? function (f) {\n return setTimeout(f, opts.delay);\n } : run;\n}\nfunction reaction(expression, effect, opts) {\n var _opts$name2, _opts4, _opts5;\n if (opts === void 0) {\n opts = EMPTY_OBJECT;\n }\n if (true) {\n if (!isFunction(expression) || !isFunction(effect)) {\n die(\"First and second argument to reaction should be functions\");\n }\n if (!isPlainObject(opts)) {\n die(\"Third argument of reactions should be an object\");\n }\n }\n var name = (_opts$name2 = opts.name) != null ? _opts$name2 : true ? \"Reaction@\" + getNextId() : 0;\n var effectAction = action(name, opts.onError ? wrapErrorHandler(opts.onError, effect) : effect);\n var runSync = !opts.scheduler && !opts.delay;\n var scheduler = createSchedulerFromOptions(opts);\n var firstTime = true;\n var isScheduled = false;\n var value;\n var equals = opts.compareStructural ? comparer.structural : opts.equals || comparer[\"default\"];\n var r = new Reaction(name, function () {\n if (firstTime || runSync) {\n reactionRunner();\n } else if (!isScheduled) {\n isScheduled = true;\n scheduler(reactionRunner);\n }\n }, opts.onError, opts.requiresObservable);\n function reactionRunner() {\n isScheduled = false;\n if (r.isDisposed) {\n return;\n }\n var changed = false;\n var oldValue = value;\n r.track(function () {\n var nextValue = allowStateChanges(false, function () {\n return expression(r);\n });\n changed = firstTime || !equals(value, nextValue);\n value = nextValue;\n });\n if (firstTime && opts.fireImmediately) {\n effectAction(value, oldValue, r);\n } else if (!firstTime && changed) {\n effectAction(value, oldValue, r);\n }\n firstTime = false;\n }\n if (!((_opts4 = opts) != null && (_opts4 = _opts4.signal) != null && _opts4.aborted)) {\n r.schedule_();\n }\n return r.getDisposer_((_opts5 = opts) == null ? void 0 : _opts5.signal);\n}\nfunction wrapErrorHandler(errorHandler, baseFn) {\n return function () {\n try {\n return baseFn.apply(this, arguments);\n } catch (e) {\n errorHandler.call(this, e);\n }\n };\n}\n\nvar ON_BECOME_OBSERVED = \"onBO\";\nvar ON_BECOME_UNOBSERVED = \"onBUO\";\nfunction onBecomeObserved(thing, arg2, arg3) {\n return interceptHook(ON_BECOME_OBSERVED, thing, arg2, arg3);\n}\nfunction onBecomeUnobserved(thing, arg2, arg3) {\n return interceptHook(ON_BECOME_UNOBSERVED, thing, arg2, arg3);\n}\nfunction interceptHook(hook, thing, arg2, arg3) {\n var atom = typeof arg3 === \"function\" ? getAtom(thing, arg2) : getAtom(thing);\n var cb = isFunction(arg3) ? arg3 : arg2;\n var listenersKey = hook + \"L\";\n if (atom[listenersKey]) {\n atom[listenersKey].add(cb);\n } else {\n atom[listenersKey] = new Set([cb]);\n }\n return function () {\n var hookListeners = atom[listenersKey];\n if (hookListeners) {\n hookListeners[\"delete\"](cb);\n if (hookListeners.size === 0) {\n delete atom[listenersKey];\n }\n }\n };\n}\n\nvar NEVER = \"never\";\nvar ALWAYS = \"always\";\nvar OBSERVED = \"observed\";\n// const IF_AVAILABLE = \"ifavailable\"\nfunction configure(options) {\n if (options.isolateGlobalState === true) {\n isolateGlobalState();\n }\n var useProxies = options.useProxies,\n enforceActions = options.enforceActions;\n if (useProxies !== undefined) {\n globalState.useProxies = useProxies === ALWAYS ? true : useProxies === NEVER ? false : typeof Proxy !== \"undefined\";\n }\n if (useProxies === \"ifavailable\") {\n globalState.verifyProxies = true;\n }\n if (enforceActions !== undefined) {\n var ea = enforceActions === ALWAYS ? ALWAYS : enforceActions === OBSERVED;\n globalState.enforceActions = ea;\n globalState.allowStateChanges = ea === true || ea === ALWAYS ? false : true;\n }\n [\"computedRequiresReaction\", \"reactionRequiresObservable\", \"observableRequiresReaction\", \"disableErrorBoundaries\", \"safeDescriptors\"].forEach(function (key) {\n if (key in options) {\n globalState[key] = !!options[key];\n }\n });\n globalState.allowStateReads = !globalState.observableRequiresReaction;\n if ( true && globalState.disableErrorBoundaries === true) {\n console.warn(\"WARNING: Debug feature only. MobX will NOT recover from errors when `disableErrorBoundaries` is enabled.\");\n }\n if (options.reactionScheduler) {\n setReactionScheduler(options.reactionScheduler);\n }\n}\n\nfunction extendObservable(target, properties, annotations, options) {\n if (true) {\n if (arguments.length > 4) {\n die(\"'extendObservable' expected 2-4 arguments\");\n }\n if (typeof target !== \"object\") {\n die(\"'extendObservable' expects an object as first argument\");\n }\n if (isObservableMap(target)) {\n die(\"'extendObservable' should not be used on maps, use map.merge instead\");\n }\n if (!isPlainObject(properties)) {\n die(\"'extendObservable' only accepts plain objects as second argument\");\n }\n if (isObservable(properties) || isObservable(annotations)) {\n die(\"Extending an object with another observable (object) is not supported\");\n }\n }\n // Pull descriptors first, so we don't have to deal with props added by administration ($mobx)\n var descriptors = getOwnPropertyDescriptors(properties);\n initObservable(function () {\n var adm = asObservableObject(target, options)[$mobx];\n ownKeys(descriptors).forEach(function (key) {\n adm.extend_(key, descriptors[key],\n // must pass \"undefined\" for { key: undefined }\n !annotations ? true : key in annotations ? annotations[key] : true);\n });\n });\n return target;\n}\n\nfunction getDependencyTree(thing, property) {\n return nodeToDependencyTree(getAtom(thing, property));\n}\nfunction nodeToDependencyTree(node) {\n var result = {\n name: node.name_\n };\n if (node.observing_ && node.observing_.length > 0) {\n result.dependencies = unique(node.observing_).map(nodeToDependencyTree);\n }\n return result;\n}\nfunction getObserverTree(thing, property) {\n return nodeToObserverTree(getAtom(thing, property));\n}\nfunction nodeToObserverTree(node) {\n var result = {\n name: node.name_\n };\n if (hasObservers(node)) {\n result.observers = Array.from(getObservers(node)).map(nodeToObserverTree);\n }\n return result;\n}\nfunction unique(list) {\n return Array.from(new Set(list));\n}\n\nvar generatorId = 0;\nfunction FlowCancellationError() {\n this.message = \"FLOW_CANCELLED\";\n}\nFlowCancellationError.prototype = /*#__PURE__*/Object.create(Error.prototype);\nfunction isFlowCancellationError(error) {\n return error instanceof FlowCancellationError;\n}\nvar flowAnnotation = /*#__PURE__*/createFlowAnnotation(\"flow\");\nvar flowBoundAnnotation = /*#__PURE__*/createFlowAnnotation(\"flow.bound\", {\n bound: true\n});\nvar flow = /*#__PURE__*/Object.assign(function flow(arg1, arg2) {\n // @flow (2022.3 Decorators)\n if (is20223Decorator(arg2)) {\n return flowAnnotation.decorate_20223_(arg1, arg2);\n }\n // @flow\n if (isStringish(arg2)) {\n return storeAnnotation(arg1, arg2, flowAnnotation);\n }\n // flow(fn)\n if ( true && arguments.length !== 1) {\n die(\"Flow expects single argument with generator function\");\n }\n var generator = arg1;\n var name = generator.name || \"\";\n // Implementation based on https://github.com/tj/co/blob/master/index.js\n var res = function res() {\n var ctx = this;\n var args = arguments;\n var runId = ++generatorId;\n var gen = action(name + \" - runid: \" + runId + \" - init\", generator).apply(ctx, args);\n var rejector;\n var pendingPromise = undefined;\n var promise = new Promise(function (resolve, reject) {\n var stepId = 0;\n rejector = reject;\n function onFulfilled(res) {\n pendingPromise = undefined;\n var ret;\n try {\n ret = action(name + \" - runid: \" + runId + \" - yield \" + stepId++, gen.next).call(gen, res);\n } catch (e) {\n return reject(e);\n }\n next(ret);\n }\n function onRejected(err) {\n pendingPromise = undefined;\n var ret;\n try {\n ret = action(name + \" - runid: \" + runId + \" - yield \" + stepId++, gen[\"throw\"]).call(gen, err);\n } catch (e) {\n return reject(e);\n }\n next(ret);\n }\n function next(ret) {\n if (isFunction(ret == null ? void 0 : ret.then)) {\n // an async iterator\n ret.then(next, reject);\n return;\n }\n if (ret.done) {\n return resolve(ret.value);\n }\n pendingPromise = Promise.resolve(ret.value);\n return pendingPromise.then(onFulfilled, onRejected);\n }\n onFulfilled(undefined); // kick off the process\n });\n promise.cancel = action(name + \" - runid: \" + runId + \" - cancel\", function () {\n try {\n if (pendingPromise) {\n cancelPromise(pendingPromise);\n }\n // Finally block can return (or yield) stuff..\n var _res = gen[\"return\"](undefined);\n // eat anything that promise would do, it's cancelled!\n var yieldedPromise = Promise.resolve(_res.value);\n yieldedPromise.then(noop, noop);\n cancelPromise(yieldedPromise); // maybe it can be cancelled :)\n // reject our original promise\n rejector(new FlowCancellationError());\n } catch (e) {\n rejector(e); // there could be a throwing finally block\n }\n });\n return promise;\n };\n res.isMobXFlow = true;\n return res;\n}, flowAnnotation);\nflow.bound = /*#__PURE__*/createDecoratorAnnotation(flowBoundAnnotation);\nfunction cancelPromise(promise) {\n if (isFunction(promise.cancel)) {\n promise.cancel();\n }\n}\nfunction flowResult(result) {\n return result; // just tricking TypeScript :)\n}\nfunction isFlow(fn) {\n return (fn == null ? void 0 : fn.isMobXFlow) === true;\n}\n\nfunction interceptReads(thing, propOrHandler, handler) {\n var target;\n if (isObservableMap(thing) || isObservableArray(thing) || isObservableValue(thing)) {\n target = getAdministration(thing);\n } else if (isObservableObject(thing)) {\n if ( true && !isStringish(propOrHandler)) {\n return die(\"InterceptReads can only be used with a specific property, not with an object in general\");\n }\n target = getAdministration(thing, propOrHandler);\n } else if (true) {\n return die(\"Expected observable map, object or array as first array\");\n }\n if ( true && target.dehancer !== undefined) {\n return die(\"An intercept reader was already established\");\n }\n target.dehancer = typeof propOrHandler === \"function\" ? propOrHandler : handler;\n return function () {\n target.dehancer = undefined;\n };\n}\n\nfunction intercept(thing, propOrHandler, handler) {\n if (isFunction(handler)) {\n return interceptProperty(thing, propOrHandler, handler);\n } else {\n return interceptInterceptable(thing, propOrHandler);\n }\n}\nfunction interceptInterceptable(thing, handler) {\n return getAdministration(thing).intercept_(handler);\n}\nfunction interceptProperty(thing, property, handler) {\n return getAdministration(thing, property).intercept_(handler);\n}\n\nfunction _isComputed(value, property) {\n if (property === undefined) {\n return isComputedValue(value);\n }\n if (isObservableObject(value) === false) {\n return false;\n }\n if (!value[$mobx].values_.has(property)) {\n return false;\n }\n var atom = getAtom(value, property);\n return isComputedValue(atom);\n}\nfunction isComputed(value) {\n if ( true && arguments.length > 1) {\n return die(\"isComputed expects only 1 argument. Use isComputedProp to inspect the observability of a property\");\n }\n return _isComputed(value);\n}\nfunction isComputedProp(value, propName) {\n if ( true && !isStringish(propName)) {\n return die(\"isComputed expected a property name as second argument\");\n }\n return _isComputed(value, propName);\n}\n\nfunction _isObservable(value, property) {\n if (!value) {\n return false;\n }\n if (property !== undefined) {\n if ( true && (isObservableMap(value) || isObservableArray(value))) {\n return die(\"isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead.\");\n }\n if (isObservableObject(value)) {\n return value[$mobx].values_.has(property);\n }\n return false;\n }\n // For first check, see #701\n return isObservableObject(value) || !!value[$mobx] || isAtom(value) || isReaction(value) || isComputedValue(value);\n}\nfunction isObservable(value) {\n if ( true && arguments.length !== 1) {\n die(\"isObservable expects only 1 argument. Use isObservableProp to inspect the observability of a property\");\n }\n return _isObservable(value);\n}\nfunction isObservableProp(value, propName) {\n if ( true && !isStringish(propName)) {\n return die(\"expected a property name as second argument\");\n }\n return _isObservable(value, propName);\n}\n\nfunction keys(obj) {\n if (isObservableObject(obj)) {\n return obj[$mobx].keys_();\n }\n if (isObservableMap(obj) || isObservableSet(obj)) {\n return Array.from(obj.keys());\n }\n if (isObservableArray(obj)) {\n return obj.map(function (_, index) {\n return index;\n });\n }\n die(5);\n}\nfunction values(obj) {\n if (isObservableObject(obj)) {\n return keys(obj).map(function (key) {\n return obj[key];\n });\n }\n if (isObservableMap(obj)) {\n return keys(obj).map(function (key) {\n return obj.get(key);\n });\n }\n if (isObservableSet(obj)) {\n return Array.from(obj.values());\n }\n if (isObservableArray(obj)) {\n return obj.slice();\n }\n die(6);\n}\nfunction entries(obj) {\n if (isObservableObject(obj)) {\n return keys(obj).map(function (key) {\n return [key, obj[key]];\n });\n }\n if (isObservableMap(obj)) {\n return keys(obj).map(function (key) {\n return [key, obj.get(key)];\n });\n }\n if (isObservableSet(obj)) {\n return Array.from(obj.entries());\n }\n if (isObservableArray(obj)) {\n return obj.map(function (key, index) {\n return [index, key];\n });\n }\n die(7);\n}\nfunction set(obj, key, value) {\n if (arguments.length === 2 && !isObservableSet(obj)) {\n startBatch();\n var _values = key;\n try {\n for (var _key in _values) {\n set(obj, _key, _values[_key]);\n }\n } finally {\n endBatch();\n }\n return;\n }\n if (isObservableObject(obj)) {\n obj[$mobx].set_(key, value);\n } else if (isObservableMap(obj)) {\n obj.set(key, value);\n } else if (isObservableSet(obj)) {\n obj.add(key);\n } else if (isObservableArray(obj)) {\n if (typeof key !== \"number\") {\n key = parseInt(key, 10);\n }\n if (key < 0) {\n die(\"Invalid index: '\" + key + \"'\");\n }\n startBatch();\n if (key >= obj.length) {\n obj.length = key + 1;\n }\n obj[key] = value;\n endBatch();\n } else {\n die(8);\n }\n}\nfunction remove(obj, key) {\n if (isObservableObject(obj)) {\n obj[$mobx].delete_(key);\n } else if (isObservableMap(obj)) {\n obj[\"delete\"](key);\n } else if (isObservableSet(obj)) {\n obj[\"delete\"](key);\n } else if (isObservableArray(obj)) {\n if (typeof key !== \"number\") {\n key = parseInt(key, 10);\n }\n obj.splice(key, 1);\n } else {\n die(9);\n }\n}\nfunction has(obj, key) {\n if (isObservableObject(obj)) {\n return obj[$mobx].has_(key);\n } else if (isObservableMap(obj)) {\n return obj.has(key);\n } else if (isObservableSet(obj)) {\n return obj.has(key);\n } else if (isObservableArray(obj)) {\n return key >= 0 && key < obj.length;\n }\n die(10);\n}\nfunction get(obj, key) {\n if (!has(obj, key)) {\n return undefined;\n }\n if (isObservableObject(obj)) {\n return obj[$mobx].get_(key);\n } else if (isObservableMap(obj)) {\n return obj.get(key);\n } else if (isObservableArray(obj)) {\n return obj[key];\n }\n die(11);\n}\nfunction apiDefineProperty(obj, key, descriptor) {\n if (isObservableObject(obj)) {\n return obj[$mobx].defineProperty_(key, descriptor);\n }\n die(39);\n}\nfunction apiOwnKeys(obj) {\n if (isObservableObject(obj)) {\n return obj[$mobx].ownKeys_();\n }\n die(38);\n}\n\nfunction observe(thing, propOrCb, cbOrFire, fireImmediately) {\n if (isFunction(cbOrFire)) {\n return observeObservableProperty(thing, propOrCb, cbOrFire, fireImmediately);\n } else {\n return observeObservable(thing, propOrCb, cbOrFire);\n }\n}\nfunction observeObservable(thing, listener, fireImmediately) {\n return getAdministration(thing).observe_(listener, fireImmediately);\n}\nfunction observeObservableProperty(thing, property, listener, fireImmediately) {\n return getAdministration(thing, property).observe_(listener, fireImmediately);\n}\n\nfunction cache(map, key, value) {\n map.set(key, value);\n return value;\n}\nfunction toJSHelper(source, __alreadySeen) {\n if (source == null || typeof source !== \"object\" || source instanceof Date || !isObservable(source)) {\n return source;\n }\n if (isObservableValue(source) || isComputedValue(source)) {\n return toJSHelper(source.get(), __alreadySeen);\n }\n if (__alreadySeen.has(source)) {\n return __alreadySeen.get(source);\n }\n if (isObservableArray(source)) {\n var res = cache(__alreadySeen, source, new Array(source.length));\n source.forEach(function (value, idx) {\n res[idx] = toJSHelper(value, __alreadySeen);\n });\n return res;\n }\n if (isObservableSet(source)) {\n var _res = cache(__alreadySeen, source, new Set());\n source.forEach(function (value) {\n _res.add(toJSHelper(value, __alreadySeen));\n });\n return _res;\n }\n if (isObservableMap(source)) {\n var _res2 = cache(__alreadySeen, source, new Map());\n source.forEach(function (value, key) {\n _res2.set(key, toJSHelper(value, __alreadySeen));\n });\n return _res2;\n } else {\n // must be observable object\n var _res3 = cache(__alreadySeen, source, {});\n apiOwnKeys(source).forEach(function (key) {\n if (objectPrototype.propertyIsEnumerable.call(source, key)) {\n _res3[key] = toJSHelper(source[key], __alreadySeen);\n }\n });\n return _res3;\n }\n}\n/**\n * Recursively converts an observable to it's non-observable native counterpart.\n * It does NOT recurse into non-observables, these are left as they are, even if they contain observables.\n * Computed and other non-enumerable properties are completely ignored.\n * Complex scenarios require custom solution, eg implementing `toJSON` or using `serializr` lib.\n */\nfunction toJS(source, options) {\n if ( true && options) {\n die(\"toJS no longer supports options\");\n }\n return toJSHelper(source, new Map());\n}\n\nfunction trace() {\n if (false) {}\n var enterBreakPoint = false;\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n if (typeof args[args.length - 1] === \"boolean\") {\n enterBreakPoint = args.pop();\n }\n var derivation = getAtomFromArgs(args);\n if (!derivation) {\n return die(\"'trace(break?)' can only be used inside a tracked computed value or a Reaction. Consider passing in the computed value or reaction explicitly\");\n }\n if (derivation.isTracing_ === TraceMode.NONE) {\n console.log(\"[mobx.trace] '\" + derivation.name_ + \"' tracing enabled\");\n }\n derivation.isTracing_ = enterBreakPoint ? TraceMode.BREAK : TraceMode.LOG;\n}\nfunction getAtomFromArgs(args) {\n switch (args.length) {\n case 0:\n return globalState.trackingDerivation;\n case 1:\n return getAtom(args[0]);\n case 2:\n return getAtom(args[0], args[1]);\n }\n}\n\n/**\n * During a transaction no views are updated until the end of the transaction.\n * The transaction will be run synchronously nonetheless.\n *\n * @param action a function that updates some reactive state\n * @returns any value that was returned by the 'action' parameter.\n */\nfunction transaction(action, thisArg) {\n if (thisArg === void 0) {\n thisArg = undefined;\n }\n startBatch();\n try {\n return action.apply(thisArg);\n } finally {\n endBatch();\n }\n}\n\nfunction when(predicate, arg1, arg2) {\n if (arguments.length === 1 || arg1 && typeof arg1 === \"object\") {\n return whenPromise(predicate, arg1);\n }\n return _when(predicate, arg1, arg2 || {});\n}\nfunction _when(predicate, effect, opts) {\n var timeoutHandle;\n if (typeof opts.timeout === \"number\") {\n var error = new Error(\"WHEN_TIMEOUT\");\n timeoutHandle = setTimeout(function () {\n if (!disposer[$mobx].isDisposed) {\n disposer();\n if (opts.onError) {\n opts.onError(error);\n } else {\n throw error;\n }\n }\n }, opts.timeout);\n }\n opts.name = true ? opts.name || \"When@\" + getNextId() : 0;\n var effectAction = createAction( true ? opts.name + \"-effect\" : 0, effect);\n // eslint-disable-next-line\n var disposer = autorun(function (r) {\n // predicate should not change state\n var cond = allowStateChanges(false, predicate);\n if (cond) {\n r.dispose();\n if (timeoutHandle) {\n clearTimeout(timeoutHandle);\n }\n effectAction();\n }\n }, opts);\n return disposer;\n}\nfunction whenPromise(predicate, opts) {\n var _opts$signal;\n if ( true && opts && opts.onError) {\n return die(\"the options 'onError' and 'promise' cannot be combined\");\n }\n if (opts != null && (_opts$signal = opts.signal) != null && _opts$signal.aborted) {\n return Object.assign(Promise.reject(new Error(\"WHEN_ABORTED\")), {\n cancel: function cancel() {\n return null;\n }\n });\n }\n var cancel;\n var abort;\n var res = new Promise(function (resolve, reject) {\n var _opts$signal2;\n var disposer = _when(predicate, resolve, _extends({}, opts, {\n onError: reject\n }));\n cancel = function cancel() {\n disposer();\n reject(new Error(\"WHEN_CANCELLED\"));\n };\n abort = function abort() {\n disposer();\n reject(new Error(\"WHEN_ABORTED\"));\n };\n opts == null || (_opts$signal2 = opts.signal) == null || _opts$signal2.addEventListener == null || _opts$signal2.addEventListener(\"abort\", abort);\n })[\"finally\"](function () {\n var _opts$signal3;\n return opts == null || (_opts$signal3 = opts.signal) == null || _opts$signal3.removeEventListener == null ? void 0 : _opts$signal3.removeEventListener(\"abort\", abort);\n });\n res.cancel = cancel;\n return res;\n}\n\nfunction getAdm(target) {\n return target[$mobx];\n}\n// Optimization: we don't need the intermediate objects and could have a completely custom administration for DynamicObjects,\n// and skip either the internal values map, or the base object with its property descriptors!\nvar objectProxyTraps = {\n has: function has(target, name) {\n if ( true && globalState.trackingDerivation) {\n warnAboutProxyRequirement(\"detect new properties using the 'in' operator. Use 'has' from 'mobx' instead.\");\n }\n return getAdm(target).has_(name);\n },\n get: function get(target, name) {\n return getAdm(target).get_(name);\n },\n set: function set(target, name, value) {\n var _getAdm$set_;\n if (!isStringish(name)) {\n return false;\n }\n if ( true && !getAdm(target).values_.has(name)) {\n warnAboutProxyRequirement(\"add a new observable property through direct assignment. Use 'set' from 'mobx' instead.\");\n }\n // null (intercepted) -> true (success)\n return (_getAdm$set_ = getAdm(target).set_(name, value, true)) != null ? _getAdm$set_ : true;\n },\n deleteProperty: function deleteProperty(target, name) {\n var _getAdm$delete_;\n if (true) {\n warnAboutProxyRequirement(\"delete properties from an observable object. Use 'remove' from 'mobx' instead.\");\n }\n if (!isStringish(name)) {\n return false;\n }\n // null (intercepted) -> true (success)\n return (_getAdm$delete_ = getAdm(target).delete_(name, true)) != null ? _getAdm$delete_ : true;\n },\n defineProperty: function defineProperty(target, name, descriptor) {\n var _getAdm$definePropert;\n if (true) {\n warnAboutProxyRequirement(\"define property on an observable object. Use 'defineProperty' from 'mobx' instead.\");\n }\n // null (intercepted) -> true (success)\n return (_getAdm$definePropert = getAdm(target).defineProperty_(name, descriptor)) != null ? _getAdm$definePropert : true;\n },\n ownKeys: function ownKeys(target) {\n if ( true && globalState.trackingDerivation) {\n warnAboutProxyRequirement(\"iterate keys to detect added / removed properties. Use 'keys' from 'mobx' instead.\");\n }\n return getAdm(target).ownKeys_();\n },\n preventExtensions: function preventExtensions(target) {\n die(13);\n }\n};\nfunction asDynamicObservableObject(target, options) {\n var _target$$mobx, _target$$mobx$proxy_;\n assertProxies();\n target = asObservableObject(target, options);\n return (_target$$mobx$proxy_ = (_target$$mobx = target[$mobx]).proxy_) != null ? _target$$mobx$proxy_ : _target$$mobx.proxy_ = new Proxy(target, objectProxyTraps);\n}\n\nfunction hasInterceptors(interceptable) {\n return interceptable.interceptors_ !== undefined && interceptable.interceptors_.length > 0;\n}\nfunction registerInterceptor(interceptable, handler) {\n var interceptors = interceptable.interceptors_ || (interceptable.interceptors_ = []);\n interceptors.push(handler);\n return once(function () {\n var idx = interceptors.indexOf(handler);\n if (idx !== -1) {\n interceptors.splice(idx, 1);\n }\n });\n}\nfunction interceptChange(interceptable, change) {\n var prevU = untrackedStart();\n try {\n // Interceptor can modify the array, copy it to avoid concurrent modification, see #1950\n var interceptors = [].concat(interceptable.interceptors_ || []);\n for (var i = 0, l = interceptors.length; i < l; i++) {\n change = interceptors[i](change);\n if (change && !change.type) {\n die(14);\n }\n if (!change) {\n break;\n }\n }\n return change;\n } finally {\n untrackedEnd(prevU);\n }\n}\n\nfunction hasListeners(listenable) {\n return listenable.changeListeners_ !== undefined && listenable.changeListeners_.length > 0;\n}\nfunction registerListener(listenable, handler) {\n var listeners = listenable.changeListeners_ || (listenable.changeListeners_ = []);\n listeners.push(handler);\n return once(function () {\n var idx = listeners.indexOf(handler);\n if (idx !== -1) {\n listeners.splice(idx, 1);\n }\n });\n}\nfunction notifyListeners(listenable, change) {\n var prevU = untrackedStart();\n var listeners = listenable.changeListeners_;\n if (!listeners) {\n return;\n }\n listeners = listeners.slice();\n for (var i = 0, l = listeners.length; i < l; i++) {\n listeners[i](change);\n }\n untrackedEnd(prevU);\n}\n\nfunction makeObservable(target, annotations, options) {\n initObservable(function () {\n var _annotations;\n var adm = asObservableObject(target, options)[$mobx];\n if ( true && annotations && target[storedAnnotationsSymbol]) {\n die(\"makeObservable second arg must be nullish when using decorators. Mixing @decorator syntax with annotations is not supported.\");\n }\n // Default to decorators\n (_annotations = annotations) != null ? _annotations : annotations = collectStoredAnnotations(target);\n // Annotate\n ownKeys(annotations).forEach(function (key) {\n return adm.make_(key, annotations[key]);\n });\n });\n return target;\n}\n// proto[keysSymbol] = new Set()\nvar keysSymbol = /*#__PURE__*/Symbol(\"mobx-keys\");\nfunction makeAutoObservable(target, overrides, options) {\n if (true) {\n if (!isPlainObject(target) && !isPlainObject(Object.getPrototypeOf(target))) {\n die(\"'makeAutoObservable' can only be used for classes that don't have a superclass\");\n }\n if (isObservableObject(target)) {\n die(\"makeAutoObservable can only be used on objects not already made observable\");\n }\n }\n // Optimization: avoid visiting protos\n // Assumes that annotation.make_/.extend_ works the same for plain objects\n if (isPlainObject(target)) {\n return extendObservable(target, target, overrides, options);\n }\n initObservable(function () {\n var adm = asObservableObject(target, options)[$mobx];\n // Optimization: cache keys on proto\n // Assumes makeAutoObservable can be called only once per object and can't be used in subclass\n if (!target[keysSymbol]) {\n var proto = Object.getPrototypeOf(target);\n var keys = new Set([].concat(ownKeys(target), ownKeys(proto)));\n keys[\"delete\"](\"constructor\");\n keys[\"delete\"]($mobx);\n addHiddenProp(proto, keysSymbol, keys);\n }\n target[keysSymbol].forEach(function (key) {\n return adm.make_(key,\n // must pass \"undefined\" for { key: undefined }\n !overrides ? true : key in overrides ? overrides[key] : true);\n });\n });\n return target;\n}\n\nvar SPLICE = \"splice\";\nvar UPDATE = \"update\";\nvar MAX_SPLICE_SIZE = 10000; // See e.g. https://github.com/mobxjs/mobx/issues/859\nvar arrayTraps = {\n get: function get(target, name) {\n var adm = target[$mobx];\n if (name === $mobx) {\n return adm;\n }\n if (name === \"length\") {\n return adm.getArrayLength_();\n }\n if (typeof name === \"string\" && !isNaN(name)) {\n return adm.get_(parseInt(name));\n }\n if (hasProp(arrayExtensions, name)) {\n return arrayExtensions[name];\n }\n return target[name];\n },\n set: function set(target, name, value) {\n var adm = target[$mobx];\n if (name === \"length\") {\n adm.setArrayLength_(value);\n }\n if (typeof name === \"symbol\" || isNaN(name)) {\n target[name] = value;\n } else {\n // numeric string\n adm.set_(parseInt(name), value);\n }\n return true;\n },\n preventExtensions: function preventExtensions() {\n die(15);\n }\n};\nvar ObservableArrayAdministration = /*#__PURE__*/function () {\n function ObservableArrayAdministration(name, enhancer, owned_, legacyMode_) {\n if (name === void 0) {\n name = true ? \"ObservableArray@\" + getNextId() : 0;\n }\n this.owned_ = void 0;\n this.legacyMode_ = void 0;\n this.atom_ = void 0;\n this.values_ = [];\n // this is the prop that gets proxied, so can't replace it!\n this.interceptors_ = void 0;\n this.changeListeners_ = void 0;\n this.enhancer_ = void 0;\n this.dehancer = void 0;\n this.proxy_ = void 0;\n this.lastKnownLength_ = 0;\n this.owned_ = owned_;\n this.legacyMode_ = legacyMode_;\n this.atom_ = new Atom(name);\n this.enhancer_ = function (newV, oldV) {\n return enhancer(newV, oldV, true ? name + \"[..]\" : 0);\n };\n }\n var _proto = ObservableArrayAdministration.prototype;\n _proto.dehanceValue_ = function dehanceValue_(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.dehanceValues_ = function dehanceValues_(values) {\n if (this.dehancer !== undefined && values.length > 0) {\n return values.map(this.dehancer);\n }\n return values;\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n if (fireImmediately === void 0) {\n fireImmediately = false;\n }\n if (fireImmediately) {\n listener({\n observableKind: \"array\",\n object: this.proxy_,\n debugObjectName: this.atom_.name_,\n type: \"splice\",\n index: 0,\n added: this.values_.slice(),\n addedCount: this.values_.length,\n removed: [],\n removedCount: 0\n });\n }\n return registerListener(this, listener);\n };\n _proto.getArrayLength_ = function getArrayLength_() {\n this.atom_.reportObserved();\n return this.values_.length;\n };\n _proto.setArrayLength_ = function setArrayLength_(newLength) {\n if (typeof newLength !== \"number\" || isNaN(newLength) || newLength < 0) {\n die(\"Out of range: \" + newLength);\n }\n var currentLength = this.values_.length;\n if (newLength === currentLength) {\n return;\n } else if (newLength > currentLength) {\n var newItems = new Array(newLength - currentLength);\n for (var i = 0; i < newLength - currentLength; i++) {\n newItems[i] = undefined;\n } // No Array.fill everywhere...\n this.spliceWithArray_(currentLength, 0, newItems);\n } else {\n this.spliceWithArray_(newLength, currentLength - newLength);\n }\n };\n _proto.updateArrayLength_ = function updateArrayLength_(oldLength, delta) {\n if (oldLength !== this.lastKnownLength_) {\n die(16);\n }\n this.lastKnownLength_ += delta;\n if (this.legacyMode_ && delta > 0) {\n reserveArrayBuffer(oldLength + delta + 1);\n }\n };\n _proto.spliceWithArray_ = function spliceWithArray_(index, deleteCount, newItems) {\n var _this = this;\n checkIfStateModificationsAreAllowed(this.atom_);\n var length = this.values_.length;\n if (index === undefined) {\n index = 0;\n } else if (index > length) {\n index = length;\n } else if (index < 0) {\n index = Math.max(0, length + index);\n }\n if (arguments.length === 1) {\n deleteCount = length - index;\n } else if (deleteCount === undefined || deleteCount === null) {\n deleteCount = 0;\n } else {\n deleteCount = Math.max(0, Math.min(deleteCount, length - index));\n }\n if (newItems === undefined) {\n newItems = EMPTY_ARRAY;\n }\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_,\n type: SPLICE,\n index: index,\n removedCount: deleteCount,\n added: newItems\n });\n if (!change) {\n return EMPTY_ARRAY;\n }\n deleteCount = change.removedCount;\n newItems = change.added;\n }\n newItems = newItems.length === 0 ? newItems : newItems.map(function (v) {\n return _this.enhancer_(v, undefined);\n });\n if (this.legacyMode_ || \"development\" !== \"production\") {\n var lengthDelta = newItems.length - deleteCount;\n this.updateArrayLength_(length, lengthDelta); // checks if internal array wasn't modified\n }\n var res = this.spliceItemsIntoValues_(index, deleteCount, newItems);\n if (deleteCount !== 0 || newItems.length !== 0) {\n this.notifyArraySplice_(index, newItems, res);\n }\n return this.dehanceValues_(res);\n };\n _proto.spliceItemsIntoValues_ = function spliceItemsIntoValues_(index, deleteCount, newItems) {\n if (newItems.length < MAX_SPLICE_SIZE) {\n var _this$values_;\n return (_this$values_ = this.values_).splice.apply(_this$values_, [index, deleteCount].concat(newItems));\n } else {\n // The items removed by the splice\n var res = this.values_.slice(index, index + deleteCount);\n // The items that that should remain at the end of the array\n var oldItems = this.values_.slice(index + deleteCount);\n // New length is the previous length + addition count - deletion count\n this.values_.length += newItems.length - deleteCount;\n for (var i = 0; i < newItems.length; i++) {\n this.values_[index + i] = newItems[i];\n }\n for (var _i = 0; _i < oldItems.length; _i++) {\n this.values_[index + newItems.length + _i] = oldItems[_i];\n }\n return res;\n }\n };\n _proto.notifyArrayChildUpdate_ = function notifyArrayChildUpdate_(index, newValue, oldValue) {\n var notifySpy = !this.owned_ && isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"array\",\n object: this.proxy_,\n type: UPDATE,\n debugObjectName: this.atom_.name_,\n index: index,\n newValue: newValue,\n oldValue: oldValue\n } : null;\n // The reason why this is on right hand side here (and not above), is this way the uglifier will drop it, but it won't\n // cause any runtime overhead in development mode without NODE_ENV set, unless spying is enabled\n if ( true && notifySpy) {\n spyReportStart(change);\n }\n this.atom_.reportChanged();\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n };\n _proto.notifyArraySplice_ = function notifyArraySplice_(index, added, removed) {\n var notifySpy = !this.owned_ && isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"array\",\n object: this.proxy_,\n debugObjectName: this.atom_.name_,\n type: SPLICE,\n index: index,\n removed: removed,\n added: added,\n removedCount: removed.length,\n addedCount: added.length\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n }\n this.atom_.reportChanged();\n // conform: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/observe\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n };\n _proto.get_ = function get_(index) {\n if (this.legacyMode_ && index >= this.values_.length) {\n console.warn( true ? \"[mobx.array] Attempt to read an array index (\" + index + \") that is out of bounds (\" + this.values_.length + \"). Please check length first. Out of bound indices will not be tracked by MobX\" : 0);\n return undefined;\n }\n this.atom_.reportObserved();\n return this.dehanceValue_(this.values_[index]);\n };\n _proto.set_ = function set_(index, newValue) {\n var values = this.values_;\n if (this.legacyMode_ && index > values.length) {\n // out of bounds\n die(17, index, values.length);\n }\n if (index < values.length) {\n // update at index in range\n checkIfStateModificationsAreAllowed(this.atom_);\n var oldValue = values[index];\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: UPDATE,\n object: this.proxy_,\n // since \"this\" is the real array we need to pass its proxy\n index: index,\n newValue: newValue\n });\n if (!change) {\n return;\n }\n newValue = change.newValue;\n }\n newValue = this.enhancer_(newValue, oldValue);\n var changed = newValue !== oldValue;\n if (changed) {\n values[index] = newValue;\n this.notifyArrayChildUpdate_(index, newValue, oldValue);\n }\n } else {\n // For out of bound index, we don't create an actual sparse array,\n // but rather fill the holes with undefined (same as setArrayLength_).\n // This could be considered a bug.\n var newItems = new Array(index + 1 - values.length);\n for (var i = 0; i < newItems.length - 1; i++) {\n newItems[i] = undefined;\n } // No Array.fill everywhere...\n newItems[newItems.length - 1] = newValue;\n this.spliceWithArray_(values.length, 0, newItems);\n }\n };\n return ObservableArrayAdministration;\n}();\nfunction createObservableArray(initialValues, enhancer, name, owned) {\n if (name === void 0) {\n name = true ? \"ObservableArray@\" + getNextId() : 0;\n }\n if (owned === void 0) {\n owned = false;\n }\n assertProxies();\n return initObservable(function () {\n var adm = new ObservableArrayAdministration(name, enhancer, owned, false);\n addHiddenFinalProp(adm.values_, $mobx, adm);\n var proxy = new Proxy(adm.values_, arrayTraps);\n adm.proxy_ = proxy;\n if (initialValues && initialValues.length) {\n adm.spliceWithArray_(0, 0, initialValues);\n }\n return proxy;\n });\n}\n// eslint-disable-next-line\nvar arrayExtensions = {\n clear: function clear() {\n return this.splice(0);\n },\n replace: function replace(newItems) {\n var adm = this[$mobx];\n return adm.spliceWithArray_(0, adm.values_.length, newItems);\n },\n // Used by JSON.stringify\n toJSON: function toJSON() {\n return this.slice();\n },\n /*\n * functions that do alter the internal structure of the array, (based on lib.es6.d.ts)\n * since these functions alter the inner structure of the array, the have side effects.\n * Because the have side effects, they should not be used in computed function,\n * and for that reason the do not call dependencyState.notifyObserved\n */\n splice: function splice(index, deleteCount) {\n for (var _len = arguments.length, newItems = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {\n newItems[_key - 2] = arguments[_key];\n }\n var adm = this[$mobx];\n switch (arguments.length) {\n case 0:\n return [];\n case 1:\n return adm.spliceWithArray_(index);\n case 2:\n return adm.spliceWithArray_(index, deleteCount);\n }\n return adm.spliceWithArray_(index, deleteCount, newItems);\n },\n spliceWithArray: function spliceWithArray(index, deleteCount, newItems) {\n return this[$mobx].spliceWithArray_(index, deleteCount, newItems);\n },\n push: function push() {\n var adm = this[$mobx];\n for (var _len2 = arguments.length, items = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n items[_key2] = arguments[_key2];\n }\n adm.spliceWithArray_(adm.values_.length, 0, items);\n return adm.values_.length;\n },\n pop: function pop() {\n return this.splice(Math.max(this[$mobx].values_.length - 1, 0), 1)[0];\n },\n shift: function shift() {\n return this.splice(0, 1)[0];\n },\n unshift: function unshift() {\n var adm = this[$mobx];\n for (var _len3 = arguments.length, items = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n items[_key3] = arguments[_key3];\n }\n adm.spliceWithArray_(0, 0, items);\n return adm.values_.length;\n },\n reverse: function reverse() {\n // reverse by default mutates in place before returning the result\n // which makes it both a 'derivation' and a 'mutation'.\n if (globalState.trackingDerivation) {\n die(37, \"reverse\");\n }\n this.replace(this.slice().reverse());\n return this;\n },\n sort: function sort() {\n // sort by default mutates in place before returning the result\n // which goes against all good practices. Let's not change the array in place!\n if (globalState.trackingDerivation) {\n die(37, \"sort\");\n }\n var copy = this.slice();\n copy.sort.apply(copy, arguments);\n this.replace(copy);\n return this;\n },\n remove: function remove(value) {\n var adm = this[$mobx];\n var idx = adm.dehanceValues_(adm.values_).indexOf(value);\n if (idx > -1) {\n this.splice(idx, 1);\n return true;\n }\n return false;\n }\n};\n/**\n * Wrap function from prototype\n * Without this, everything works as well, but this works\n * faster as everything works on unproxied values\n */\naddArrayExtension(\"at\", simpleFunc);\naddArrayExtension(\"concat\", simpleFunc);\naddArrayExtension(\"flat\", simpleFunc);\naddArrayExtension(\"includes\", simpleFunc);\naddArrayExtension(\"indexOf\", simpleFunc);\naddArrayExtension(\"join\", simpleFunc);\naddArrayExtension(\"lastIndexOf\", simpleFunc);\naddArrayExtension(\"slice\", simpleFunc);\naddArrayExtension(\"toString\", simpleFunc);\naddArrayExtension(\"toLocaleString\", simpleFunc);\naddArrayExtension(\"toSorted\", simpleFunc);\naddArrayExtension(\"toSpliced\", simpleFunc);\naddArrayExtension(\"with\", simpleFunc);\n// map\naddArrayExtension(\"every\", mapLikeFunc);\naddArrayExtension(\"filter\", mapLikeFunc);\naddArrayExtension(\"find\", mapLikeFunc);\naddArrayExtension(\"findIndex\", mapLikeFunc);\naddArrayExtension(\"findLast\", mapLikeFunc);\naddArrayExtension(\"findLastIndex\", mapLikeFunc);\naddArrayExtension(\"flatMap\", mapLikeFunc);\naddArrayExtension(\"forEach\", mapLikeFunc);\naddArrayExtension(\"map\", mapLikeFunc);\naddArrayExtension(\"some\", mapLikeFunc);\naddArrayExtension(\"toReversed\", mapLikeFunc);\n// reduce\naddArrayExtension(\"reduce\", reduceLikeFunc);\naddArrayExtension(\"reduceRight\", reduceLikeFunc);\nfunction addArrayExtension(funcName, funcFactory) {\n if (typeof Array.prototype[funcName] === \"function\") {\n arrayExtensions[funcName] = funcFactory(funcName);\n }\n}\n// Report and delegate to dehanced array\nfunction simpleFunc(funcName) {\n return function () {\n var adm = this[$mobx];\n adm.atom_.reportObserved();\n var dehancedValues = adm.dehanceValues_(adm.values_);\n return dehancedValues[funcName].apply(dehancedValues, arguments);\n };\n}\n// Make sure callbacks receive correct array arg #2326\nfunction mapLikeFunc(funcName) {\n return function (callback, thisArg) {\n var _this2 = this;\n var adm = this[$mobx];\n adm.atom_.reportObserved();\n var dehancedValues = adm.dehanceValues_(adm.values_);\n return dehancedValues[funcName](function (element, index) {\n return callback.call(thisArg, element, index, _this2);\n });\n };\n}\n// Make sure callbacks receive correct array arg #2326\nfunction reduceLikeFunc(funcName) {\n return function () {\n var _this3 = this;\n var adm = this[$mobx];\n adm.atom_.reportObserved();\n var dehancedValues = adm.dehanceValues_(adm.values_);\n // #2432 - reduce behavior depends on arguments.length\n var callback = arguments[0];\n arguments[0] = function (accumulator, currentValue, index) {\n return callback(accumulator, currentValue, index, _this3);\n };\n return dehancedValues[funcName].apply(dehancedValues, arguments);\n };\n}\nvar isObservableArrayAdministration = /*#__PURE__*/createInstanceofPredicate(\"ObservableArrayAdministration\", ObservableArrayAdministration);\nfunction isObservableArray(thing) {\n return isObject(thing) && isObservableArrayAdministration(thing[$mobx]);\n}\n\nvar ObservableMapMarker = {};\nvar ADD = \"add\";\nvar DELETE = \"delete\";\n// just extend Map? See also https://gist.github.com/nestharus/13b4d74f2ef4a2f4357dbd3fc23c1e54\n// But: https://github.com/mobxjs/mobx/issues/1556\nvar ObservableMap = /*#__PURE__*/function () {\n function ObservableMap(initialData, enhancer_, name_) {\n var _this = this;\n if (enhancer_ === void 0) {\n enhancer_ = deepEnhancer;\n }\n if (name_ === void 0) {\n name_ = true ? \"ObservableMap@\" + getNextId() : 0;\n }\n this.enhancer_ = void 0;\n this.name_ = void 0;\n this[$mobx] = ObservableMapMarker;\n this.data_ = void 0;\n this.hasMap_ = void 0;\n // hasMap, not hashMap >-).\n this.keysAtom_ = void 0;\n this.interceptors_ = void 0;\n this.changeListeners_ = void 0;\n this.dehancer = void 0;\n this.enhancer_ = enhancer_;\n this.name_ = name_;\n if (!isFunction(Map)) {\n die(18);\n }\n initObservable(function () {\n _this.keysAtom_ = createAtom( true ? _this.name_ + \".keys()\" : 0);\n _this.data_ = new Map();\n _this.hasMap_ = new Map();\n if (initialData) {\n _this.merge(initialData);\n }\n });\n }\n var _proto = ObservableMap.prototype;\n _proto.has_ = function has_(key) {\n return this.data_.has(key);\n };\n _proto.has = function has(key) {\n var _this2 = this;\n if (!globalState.trackingDerivation) {\n return this.has_(key);\n }\n var entry = this.hasMap_.get(key);\n if (!entry) {\n var newEntry = entry = new ObservableValue(this.has_(key), referenceEnhancer, true ? this.name_ + \".\" + stringifyKey(key) + \"?\" : 0, false);\n this.hasMap_.set(key, newEntry);\n onBecomeUnobserved(newEntry, function () {\n return _this2.hasMap_[\"delete\"](key);\n });\n }\n return entry.get();\n };\n _proto.set = function set(key, value) {\n var hasKey = this.has_(key);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: hasKey ? UPDATE : ADD,\n object: this,\n newValue: value,\n name: key\n });\n if (!change) {\n return this;\n }\n value = change.newValue;\n }\n if (hasKey) {\n this.updateValue_(key, value);\n } else {\n this.addValue_(key, value);\n }\n return this;\n };\n _proto[\"delete\"] = function _delete(key) {\n var _this3 = this;\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: DELETE,\n object: this,\n name: key\n });\n if (!change) {\n return false;\n }\n }\n if (this.has_(key)) {\n var notifySpy = isSpyEnabled();\n var notify = hasListeners(this);\n var _change = notify || notifySpy ? {\n observableKind: \"map\",\n debugObjectName: this.name_,\n type: DELETE,\n object: this,\n oldValue: this.data_.get(key).value_,\n name: key\n } : null;\n if ( true && notifySpy) {\n spyReportStart(_change);\n } // TODO fix type\n transaction(function () {\n var _this3$hasMap_$get;\n _this3.keysAtom_.reportChanged();\n (_this3$hasMap_$get = _this3.hasMap_.get(key)) == null || _this3$hasMap_$get.setNewValue_(false);\n var observable = _this3.data_.get(key);\n observable.setNewValue_(undefined);\n _this3.data_[\"delete\"](key);\n });\n if (notify) {\n notifyListeners(this, _change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n return true;\n }\n return false;\n };\n _proto.updateValue_ = function updateValue_(key, newValue) {\n var observable = this.data_.get(key);\n newValue = observable.prepareNewValue_(newValue);\n if (newValue !== globalState.UNCHANGED) {\n var notifySpy = isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"map\",\n debugObjectName: this.name_,\n type: UPDATE,\n object: this,\n oldValue: observable.value_,\n name: key,\n newValue: newValue\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n } // TODO fix type\n observable.setNewValue_(newValue);\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n };\n _proto.addValue_ = function addValue_(key, newValue) {\n var _this4 = this;\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n transaction(function () {\n var _this4$hasMap_$get;\n var observable = new ObservableValue(newValue, _this4.enhancer_, true ? _this4.name_ + \".\" + stringifyKey(key) : 0, false);\n _this4.data_.set(key, observable);\n newValue = observable.value_; // value might have been changed\n (_this4$hasMap_$get = _this4.hasMap_.get(key)) == null || _this4$hasMap_$get.setNewValue_(true);\n _this4.keysAtom_.reportChanged();\n });\n var notifySpy = isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"map\",\n debugObjectName: this.name_,\n type: ADD,\n object: this,\n name: key,\n newValue: newValue\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n } // TODO fix type\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n };\n _proto.get = function get(key) {\n if (this.has(key)) {\n return this.dehanceValue_(this.data_.get(key).get());\n }\n return this.dehanceValue_(undefined);\n };\n _proto.dehanceValue_ = function dehanceValue_(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.keys = function keys() {\n this.keysAtom_.reportObserved();\n return this.data_.keys();\n };\n _proto.values = function values() {\n var self = this;\n var keys = this.keys();\n return makeIterable({\n next: function next() {\n var _keys$next = keys.next(),\n done = _keys$next.done,\n value = _keys$next.value;\n return {\n done: done,\n value: done ? undefined : self.get(value)\n };\n }\n });\n };\n _proto.entries = function entries() {\n var self = this;\n var keys = this.keys();\n return makeIterable({\n next: function next() {\n var _keys$next2 = keys.next(),\n done = _keys$next2.done,\n value = _keys$next2.value;\n return {\n done: done,\n value: done ? undefined : [value, self.get(value)]\n };\n }\n });\n };\n _proto[Symbol.iterator] = function () {\n return this.entries();\n };\n _proto.forEach = function forEach(callback, thisArg) {\n for (var _iterator = _createForOfIteratorHelperLoose(this), _step; !(_step = _iterator()).done;) {\n var _step$value = _step.value,\n key = _step$value[0],\n value = _step$value[1];\n callback.call(thisArg, value, key, this);\n }\n }\n /** Merge another object into this object, returns this. */;\n _proto.merge = function merge(other) {\n var _this5 = this;\n if (isObservableMap(other)) {\n other = new Map(other);\n }\n transaction(function () {\n if (isPlainObject(other)) {\n getPlainObjectKeys(other).forEach(function (key) {\n return _this5.set(key, other[key]);\n });\n } else if (Array.isArray(other)) {\n other.forEach(function (_ref) {\n var key = _ref[0],\n value = _ref[1];\n return _this5.set(key, value);\n });\n } else if (isES6Map(other)) {\n if (!isPlainES6Map(other)) {\n die(19, other);\n }\n other.forEach(function (value, key) {\n return _this5.set(key, value);\n });\n } else if (other !== null && other !== undefined) {\n die(20, other);\n }\n });\n return this;\n };\n _proto.clear = function clear() {\n var _this6 = this;\n transaction(function () {\n untracked(function () {\n for (var _iterator2 = _createForOfIteratorHelperLoose(_this6.keys()), _step2; !(_step2 = _iterator2()).done;) {\n var key = _step2.value;\n _this6[\"delete\"](key);\n }\n });\n });\n };\n _proto.replace = function replace(values) {\n var _this7 = this;\n // Implementation requirements:\n // - respect ordering of replacement map\n // - allow interceptors to run and potentially prevent individual operations\n // - don't recreate observables that already exist in original map (so we don't destroy existing subscriptions)\n // - don't _keysAtom.reportChanged if the keys of resulting map are indentical (order matters!)\n // - note that result map may differ from replacement map due to the interceptors\n transaction(function () {\n // Convert to map so we can do quick key lookups\n var replacementMap = convertToMap(values);\n var orderedData = new Map();\n // Used for optimization\n var keysReportChangedCalled = false;\n // Delete keys that don't exist in replacement map\n // if the key deletion is prevented by interceptor\n // add entry at the beginning of the result map\n for (var _iterator3 = _createForOfIteratorHelperLoose(_this7.data_.keys()), _step3; !(_step3 = _iterator3()).done;) {\n var key = _step3.value;\n // Concurrently iterating/deleting keys\n // iterator should handle this correctly\n if (!replacementMap.has(key)) {\n var deleted = _this7[\"delete\"](key);\n // Was the key removed?\n if (deleted) {\n // _keysAtom.reportChanged() was already called\n keysReportChangedCalled = true;\n } else {\n // Delete prevented by interceptor\n var value = _this7.data_.get(key);\n orderedData.set(key, value);\n }\n }\n }\n // Merge entries\n for (var _iterator4 = _createForOfIteratorHelperLoose(replacementMap.entries()), _step4; !(_step4 = _iterator4()).done;) {\n var _step4$value = _step4.value,\n _key = _step4$value[0],\n _value = _step4$value[1];\n // We will want to know whether a new key is added\n var keyExisted = _this7.data_.has(_key);\n // Add or update value\n _this7.set(_key, _value);\n // The addition could have been prevent by interceptor\n if (_this7.data_.has(_key)) {\n // The update could have been prevented by interceptor\n // and also we want to preserve existing values\n // so use value from _data map (instead of replacement map)\n var _value2 = _this7.data_.get(_key);\n orderedData.set(_key, _value2);\n // Was a new key added?\n if (!keyExisted) {\n // _keysAtom.reportChanged() was already called\n keysReportChangedCalled = true;\n }\n }\n }\n // Check for possible key order change\n if (!keysReportChangedCalled) {\n if (_this7.data_.size !== orderedData.size) {\n // If size differs, keys are definitely modified\n _this7.keysAtom_.reportChanged();\n } else {\n var iter1 = _this7.data_.keys();\n var iter2 = orderedData.keys();\n var next1 = iter1.next();\n var next2 = iter2.next();\n while (!next1.done) {\n if (next1.value !== next2.value) {\n _this7.keysAtom_.reportChanged();\n break;\n }\n next1 = iter1.next();\n next2 = iter2.next();\n }\n }\n }\n // Use correctly ordered map\n _this7.data_ = orderedData;\n });\n return this;\n };\n _proto.toString = function toString() {\n return \"[object ObservableMap]\";\n };\n _proto.toJSON = function toJSON() {\n return Array.from(this);\n };\n /**\n * Observes this object. Triggers for the events 'add', 'update' and 'delete'.\n * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe\n * for callback details\n */\n _proto.observe_ = function observe_(listener, fireImmediately) {\n if ( true && fireImmediately === true) {\n die(\"`observe` doesn't support fireImmediately=true in combination with maps.\");\n }\n return registerListener(this, listener);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n return _createClass(ObservableMap, [{\n key: \"size\",\n get: function get() {\n this.keysAtom_.reportObserved();\n return this.data_.size;\n }\n }, {\n key: Symbol.toStringTag,\n get: function get() {\n return \"Map\";\n }\n }]);\n}();\n// eslint-disable-next-line\nvar isObservableMap = /*#__PURE__*/createInstanceofPredicate(\"ObservableMap\", ObservableMap);\nfunction convertToMap(dataStructure) {\n if (isES6Map(dataStructure) || isObservableMap(dataStructure)) {\n return dataStructure;\n } else if (Array.isArray(dataStructure)) {\n return new Map(dataStructure);\n } else if (isPlainObject(dataStructure)) {\n var map = new Map();\n for (var key in dataStructure) {\n map.set(key, dataStructure[key]);\n }\n return map;\n } else {\n return die(21, dataStructure);\n }\n}\n\nvar ObservableSetMarker = {};\nvar ObservableSet = /*#__PURE__*/function () {\n function ObservableSet(initialData, enhancer, name_) {\n var _this = this;\n if (enhancer === void 0) {\n enhancer = deepEnhancer;\n }\n if (name_ === void 0) {\n name_ = true ? \"ObservableSet@\" + getNextId() : 0;\n }\n this.name_ = void 0;\n this[$mobx] = ObservableSetMarker;\n this.data_ = new Set();\n this.atom_ = void 0;\n this.changeListeners_ = void 0;\n this.interceptors_ = void 0;\n this.dehancer = void 0;\n this.enhancer_ = void 0;\n this.name_ = name_;\n if (!isFunction(Set)) {\n die(22);\n }\n this.enhancer_ = function (newV, oldV) {\n return enhancer(newV, oldV, name_);\n };\n initObservable(function () {\n _this.atom_ = createAtom(_this.name_);\n if (initialData) {\n _this.replace(initialData);\n }\n });\n }\n var _proto = ObservableSet.prototype;\n _proto.dehanceValue_ = function dehanceValue_(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.clear = function clear() {\n var _this2 = this;\n transaction(function () {\n untracked(function () {\n for (var _iterator = _createForOfIteratorHelperLoose(_this2.data_.values()), _step; !(_step = _iterator()).done;) {\n var value = _step.value;\n _this2[\"delete\"](value);\n }\n });\n });\n };\n _proto.forEach = function forEach(callbackFn, thisArg) {\n for (var _iterator2 = _createForOfIteratorHelperLoose(this), _step2; !(_step2 = _iterator2()).done;) {\n var value = _step2.value;\n callbackFn.call(thisArg, value, value, this);\n }\n };\n _proto.add = function add(value) {\n var _this3 = this;\n checkIfStateModificationsAreAllowed(this.atom_);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: ADD,\n object: this,\n newValue: value\n });\n if (!change) {\n return this;\n }\n // ideally, value = change.value would be done here, so that values can be\n // changed by interceptor. Same applies for other Set and Map api's.\n }\n if (!this.has(value)) {\n transaction(function () {\n _this3.data_.add(_this3.enhancer_(value, undefined));\n _this3.atom_.reportChanged();\n });\n var notifySpy = true && isSpyEnabled();\n var notify = hasListeners(this);\n var _change = notify || notifySpy ? {\n observableKind: \"set\",\n debugObjectName: this.name_,\n type: ADD,\n object: this,\n newValue: value\n } : null;\n if (notifySpy && \"development\" !== \"production\") {\n spyReportStart(_change);\n }\n if (notify) {\n notifyListeners(this, _change);\n }\n if (notifySpy && \"development\" !== \"production\") {\n spyReportEnd();\n }\n }\n return this;\n };\n _proto[\"delete\"] = function _delete(value) {\n var _this4 = this;\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: DELETE,\n object: this,\n oldValue: value\n });\n if (!change) {\n return false;\n }\n }\n if (this.has(value)) {\n var notifySpy = true && isSpyEnabled();\n var notify = hasListeners(this);\n var _change2 = notify || notifySpy ? {\n observableKind: \"set\",\n debugObjectName: this.name_,\n type: DELETE,\n object: this,\n oldValue: value\n } : null;\n if (notifySpy && \"development\" !== \"production\") {\n spyReportStart(_change2);\n }\n transaction(function () {\n _this4.atom_.reportChanged();\n _this4.data_[\"delete\"](value);\n });\n if (notify) {\n notifyListeners(this, _change2);\n }\n if (notifySpy && \"development\" !== \"production\") {\n spyReportEnd();\n }\n return true;\n }\n return false;\n };\n _proto.has = function has(value) {\n this.atom_.reportObserved();\n return this.data_.has(this.dehanceValue_(value));\n };\n _proto.entries = function entries() {\n var nextIndex = 0;\n var keys = Array.from(this.keys());\n var values = Array.from(this.values());\n return makeIterable({\n next: function next() {\n var index = nextIndex;\n nextIndex += 1;\n return index < values.length ? {\n value: [keys[index], values[index]],\n done: false\n } : {\n done: true\n };\n }\n });\n };\n _proto.keys = function keys() {\n return this.values();\n };\n _proto.values = function values() {\n this.atom_.reportObserved();\n var self = this;\n var nextIndex = 0;\n var observableValues = Array.from(this.data_.values());\n return makeIterable({\n next: function next() {\n return nextIndex < observableValues.length ? {\n value: self.dehanceValue_(observableValues[nextIndex++]),\n done: false\n } : {\n done: true\n };\n }\n });\n };\n _proto.intersection = function intersection(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.intersection(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.intersection(otherSet);\n }\n };\n _proto.union = function union(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.union(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.union(otherSet);\n }\n };\n _proto.difference = function difference(otherSet) {\n return new Set(this).difference(otherSet);\n };\n _proto.symmetricDifference = function symmetricDifference(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.symmetricDifference(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.symmetricDifference(otherSet);\n }\n };\n _proto.isSubsetOf = function isSubsetOf(otherSet) {\n return new Set(this).isSubsetOf(otherSet);\n };\n _proto.isSupersetOf = function isSupersetOf(otherSet) {\n return new Set(this).isSupersetOf(otherSet);\n };\n _proto.isDisjointFrom = function isDisjointFrom(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.isDisjointFrom(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.isDisjointFrom(otherSet);\n }\n };\n _proto.replace = function replace(other) {\n var _this5 = this;\n if (isObservableSet(other)) {\n other = new Set(other);\n }\n transaction(function () {\n if (Array.isArray(other)) {\n _this5.clear();\n other.forEach(function (value) {\n return _this5.add(value);\n });\n } else if (isES6Set(other)) {\n _this5.clear();\n other.forEach(function (value) {\n return _this5.add(value);\n });\n } else if (other !== null && other !== undefined) {\n die(\"Cannot initialize set from \" + other);\n }\n });\n return this;\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n // ... 'fireImmediately' could also be true?\n if ( true && fireImmediately === true) {\n die(\"`observe` doesn't support fireImmediately=true in combination with sets.\");\n }\n return registerListener(this, listener);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.toJSON = function toJSON() {\n return Array.from(this);\n };\n _proto.toString = function toString() {\n return \"[object ObservableSet]\";\n };\n _proto[Symbol.iterator] = function () {\n return this.values();\n };\n return _createClass(ObservableSet, [{\n key: \"size\",\n get: function get() {\n this.atom_.reportObserved();\n return this.data_.size;\n }\n }, {\n key: Symbol.toStringTag,\n get: function get() {\n return \"Set\";\n }\n }]);\n}();\n// eslint-disable-next-line\nvar isObservableSet = /*#__PURE__*/createInstanceofPredicate(\"ObservableSet\", ObservableSet);\n\nvar descriptorCache = /*#__PURE__*/Object.create(null);\nvar REMOVE = \"remove\";\nvar ObservableObjectAdministration = /*#__PURE__*/function () {\n function ObservableObjectAdministration(target_, values_, name_,\n // Used anytime annotation is not explicitely provided\n defaultAnnotation_) {\n if (values_ === void 0) {\n values_ = new Map();\n }\n if (defaultAnnotation_ === void 0) {\n defaultAnnotation_ = autoAnnotation;\n }\n this.target_ = void 0;\n this.values_ = void 0;\n this.name_ = void 0;\n this.defaultAnnotation_ = void 0;\n this.keysAtom_ = void 0;\n this.changeListeners_ = void 0;\n this.interceptors_ = void 0;\n this.proxy_ = void 0;\n this.isPlainObject_ = void 0;\n this.appliedAnnotations_ = void 0;\n this.pendingKeys_ = void 0;\n this.target_ = target_;\n this.values_ = values_;\n this.name_ = name_;\n this.defaultAnnotation_ = defaultAnnotation_;\n this.keysAtom_ = new Atom( true ? this.name_ + \".keys\" : 0);\n // Optimization: we use this frequently\n this.isPlainObject_ = isPlainObject(this.target_);\n if ( true && !isAnnotation(this.defaultAnnotation_)) {\n die(\"defaultAnnotation must be valid annotation\");\n }\n if (true) {\n // Prepare structure for tracking which fields were already annotated\n this.appliedAnnotations_ = {};\n }\n }\n var _proto = ObservableObjectAdministration.prototype;\n _proto.getObservablePropValue_ = function getObservablePropValue_(key) {\n return this.values_.get(key).get();\n };\n _proto.setObservablePropValue_ = function setObservablePropValue_(key, newValue) {\n var observable = this.values_.get(key);\n if (observable instanceof ComputedValue) {\n observable.set(newValue);\n return true;\n }\n // intercept\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: UPDATE,\n object: this.proxy_ || this.target_,\n name: key,\n newValue: newValue\n });\n if (!change) {\n return null;\n }\n newValue = change.newValue;\n }\n newValue = observable.prepareNewValue_(newValue);\n // notify spy & observers\n if (newValue !== globalState.UNCHANGED) {\n var notify = hasListeners(this);\n var notifySpy = true && isSpyEnabled();\n var _change = notify || notifySpy ? {\n type: UPDATE,\n observableKind: \"object\",\n debugObjectName: this.name_,\n object: this.proxy_ || this.target_,\n oldValue: observable.value_,\n name: key,\n newValue: newValue\n } : null;\n if ( true && notifySpy) {\n spyReportStart(_change);\n }\n observable.setNewValue_(newValue);\n if (notify) {\n notifyListeners(this, _change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n return true;\n };\n _proto.get_ = function get_(key) {\n if (globalState.trackingDerivation && !hasProp(this.target_, key)) {\n // Key doesn't exist yet, subscribe for it in case it's added later\n this.has_(key);\n }\n return this.target_[key];\n }\n /**\n * @param {PropertyKey} key\n * @param {any} value\n * @param {Annotation|boolean} annotation true - use default annotation, false - copy as is\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.set_ = function set_(key, value, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n // Don't use .has(key) - we care about own\n if (hasProp(this.target_, key)) {\n // Existing prop\n if (this.values_.has(key)) {\n // Observable (can be intercepted)\n return this.setObservablePropValue_(key, value);\n } else if (proxyTrap) {\n // Non-observable - proxy\n return Reflect.set(this.target_, key, value);\n } else {\n // Non-observable\n this.target_[key] = value;\n return true;\n }\n } else {\n // New prop\n return this.extend_(key, {\n value: value,\n enumerable: true,\n writable: true,\n configurable: true\n }, this.defaultAnnotation_, proxyTrap);\n }\n }\n // Trap for \"in\"\n ;\n _proto.has_ = function has_(key) {\n if (!globalState.trackingDerivation) {\n // Skip key subscription outside derivation\n return key in this.target_;\n }\n this.pendingKeys_ || (this.pendingKeys_ = new Map());\n var entry = this.pendingKeys_.get(key);\n if (!entry) {\n entry = new ObservableValue(key in this.target_, referenceEnhancer, true ? this.name_ + \".\" + stringifyKey(key) + \"?\" : 0, false);\n this.pendingKeys_.set(key, entry);\n }\n return entry.get();\n }\n /**\n * @param {PropertyKey} key\n * @param {Annotation|boolean} annotation true - use default annotation, false - ignore prop\n */;\n _proto.make_ = function make_(key, annotation) {\n if (annotation === true) {\n annotation = this.defaultAnnotation_;\n }\n if (annotation === false) {\n return;\n }\n assertAnnotable(this, annotation, key);\n if (!(key in this.target_)) {\n var _this$target_$storedA;\n // Throw on missing key, except for decorators:\n // Decorator annotations are collected from whole prototype chain.\n // When called from super() some props may not exist yet.\n // However we don't have to worry about missing prop,\n // because the decorator must have been applied to something.\n if ((_this$target_$storedA = this.target_[storedAnnotationsSymbol]) != null && _this$target_$storedA[key]) {\n return; // will be annotated by subclass constructor\n } else {\n die(1, annotation.annotationType_, this.name_ + \".\" + key.toString());\n }\n }\n var source = this.target_;\n while (source && source !== objectPrototype) {\n var descriptor = getDescriptor(source, key);\n if (descriptor) {\n var outcome = annotation.make_(this, key, descriptor, source);\n if (outcome === 0 /* MakeResult.Cancel */) {\n return;\n }\n if (outcome === 1 /* MakeResult.Break */) {\n break;\n }\n }\n source = Object.getPrototypeOf(source);\n }\n recordAnnotationApplied(this, annotation, key);\n }\n /**\n * @param {PropertyKey} key\n * @param {PropertyDescriptor} descriptor\n * @param {Annotation|boolean} annotation true - use default annotation, false - copy as is\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.extend_ = function extend_(key, descriptor, annotation, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n if (annotation === true) {\n annotation = this.defaultAnnotation_;\n }\n if (annotation === false) {\n return this.defineProperty_(key, descriptor, proxyTrap);\n }\n assertAnnotable(this, annotation, key);\n var outcome = annotation.extend_(this, key, descriptor, proxyTrap);\n if (outcome) {\n recordAnnotationApplied(this, annotation, key);\n }\n return outcome;\n }\n /**\n * @param {PropertyKey} key\n * @param {PropertyDescriptor} descriptor\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.defineProperty_ = function defineProperty_(key, descriptor, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n try {\n startBatch();\n // Delete\n var deleteOutcome = this.delete_(key);\n if (!deleteOutcome) {\n // Failure or intercepted\n return deleteOutcome;\n }\n // ADD interceptor\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: ADD,\n newValue: descriptor.value\n });\n if (!change) {\n return null;\n }\n var newValue = change.newValue;\n if (descriptor.value !== newValue) {\n descriptor = _extends({}, descriptor, {\n value: newValue\n });\n }\n }\n // Define\n if (proxyTrap) {\n if (!Reflect.defineProperty(this.target_, key, descriptor)) {\n return false;\n }\n } else {\n defineProperty(this.target_, key, descriptor);\n }\n // Notify\n this.notifyPropertyAddition_(key, descriptor.value);\n } finally {\n endBatch();\n }\n return true;\n }\n // If original descriptor becomes relevant, move this to annotation directly\n ;\n _proto.defineObservableProperty_ = function defineObservableProperty_(key, value, enhancer, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n try {\n startBatch();\n // Delete\n var deleteOutcome = this.delete_(key);\n if (!deleteOutcome) {\n // Failure or intercepted\n return deleteOutcome;\n }\n // ADD interceptor\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: ADD,\n newValue: value\n });\n if (!change) {\n return null;\n }\n value = change.newValue;\n }\n var cachedDescriptor = getCachedObservablePropDescriptor(key);\n var descriptor = {\n configurable: globalState.safeDescriptors ? this.isPlainObject_ : true,\n enumerable: true,\n get: cachedDescriptor.get,\n set: cachedDescriptor.set\n };\n // Define\n if (proxyTrap) {\n if (!Reflect.defineProperty(this.target_, key, descriptor)) {\n return false;\n }\n } else {\n defineProperty(this.target_, key, descriptor);\n }\n var observable = new ObservableValue(value, enhancer, true ? this.name_ + \".\" + key.toString() : 0, false);\n this.values_.set(key, observable);\n // Notify (value possibly changed by ObservableValue)\n this.notifyPropertyAddition_(key, observable.value_);\n } finally {\n endBatch();\n }\n return true;\n }\n // If original descriptor becomes relevant, move this to annotation directly\n ;\n _proto.defineComputedProperty_ = function defineComputedProperty_(key, options, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n try {\n startBatch();\n // Delete\n var deleteOutcome = this.delete_(key);\n if (!deleteOutcome) {\n // Failure or intercepted\n return deleteOutcome;\n }\n // ADD interceptor\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: ADD,\n newValue: undefined\n });\n if (!change) {\n return null;\n }\n }\n options.name || (options.name = true ? this.name_ + \".\" + key.toString() : 0);\n options.context = this.proxy_ || this.target_;\n var cachedDescriptor = getCachedObservablePropDescriptor(key);\n var descriptor = {\n configurable: globalState.safeDescriptors ? this.isPlainObject_ : true,\n enumerable: false,\n get: cachedDescriptor.get,\n set: cachedDescriptor.set\n };\n // Define\n if (proxyTrap) {\n if (!Reflect.defineProperty(this.target_, key, descriptor)) {\n return false;\n }\n } else {\n defineProperty(this.target_, key, descriptor);\n }\n this.values_.set(key, new ComputedValue(options));\n // Notify\n this.notifyPropertyAddition_(key, undefined);\n } finally {\n endBatch();\n }\n return true;\n }\n /**\n * @param {PropertyKey} key\n * @param {PropertyDescriptor} descriptor\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.delete_ = function delete_(key, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n // No such prop\n if (!hasProp(this.target_, key)) {\n return true;\n }\n // Intercept\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: REMOVE\n });\n // Cancelled\n if (!change) {\n return null;\n }\n }\n // Delete\n try {\n var _this$pendingKeys_;\n startBatch();\n var notify = hasListeners(this);\n var notifySpy = true && isSpyEnabled();\n var observable = this.values_.get(key);\n // Value needed for spies/listeners\n var value = undefined;\n // Optimization: don't pull the value unless we will need it\n if (!observable && (notify || notifySpy)) {\n var _getDescriptor;\n value = (_getDescriptor = getDescriptor(this.target_, key)) == null ? void 0 : _getDescriptor.value;\n }\n // delete prop (do first, may fail)\n if (proxyTrap) {\n if (!Reflect.deleteProperty(this.target_, key)) {\n return false;\n }\n } else {\n delete this.target_[key];\n }\n // Allow re-annotating this field\n if (true) {\n delete this.appliedAnnotations_[key];\n }\n // Clear observable\n if (observable) {\n this.values_[\"delete\"](key);\n // for computed, value is undefined\n if (observable instanceof ObservableValue) {\n value = observable.value_;\n }\n // Notify: autorun(() => obj[key]), see #1796\n propagateChanged(observable);\n }\n // Notify \"keys/entries/values\" observers\n this.keysAtom_.reportChanged();\n // Notify \"has\" observers\n // \"in\" as it may still exist in proto\n (_this$pendingKeys_ = this.pendingKeys_) == null || (_this$pendingKeys_ = _this$pendingKeys_.get(key)) == null || _this$pendingKeys_.set(key in this.target_);\n // Notify spies/listeners\n if (notify || notifySpy) {\n var _change2 = {\n type: REMOVE,\n observableKind: \"object\",\n object: this.proxy_ || this.target_,\n debugObjectName: this.name_,\n oldValue: value,\n name: key\n };\n if ( true && notifySpy) {\n spyReportStart(_change2);\n }\n if (notify) {\n notifyListeners(this, _change2);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n } finally {\n endBatch();\n }\n return true;\n }\n /**\n * Observes this object. Triggers for the events 'add', 'update' and 'delete'.\n * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe\n * for callback details\n */;\n _proto.observe_ = function observe_(callback, fireImmediately) {\n if ( true && fireImmediately === true) {\n die(\"`observe` doesn't support the fire immediately property for observable objects.\");\n }\n return registerListener(this, callback);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.notifyPropertyAddition_ = function notifyPropertyAddition_(key, value) {\n var _this$pendingKeys_2;\n var notify = hasListeners(this);\n var notifySpy = true && isSpyEnabled();\n if (notify || notifySpy) {\n var change = notify || notifySpy ? {\n type: ADD,\n observableKind: \"object\",\n debugObjectName: this.name_,\n object: this.proxy_ || this.target_,\n name: key,\n newValue: value\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n }\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n (_this$pendingKeys_2 = this.pendingKeys_) == null || (_this$pendingKeys_2 = _this$pendingKeys_2.get(key)) == null || _this$pendingKeys_2.set(true);\n // Notify \"keys/entries/values\" observers\n this.keysAtom_.reportChanged();\n };\n _proto.ownKeys_ = function ownKeys_() {\n this.keysAtom_.reportObserved();\n return ownKeys(this.target_);\n };\n _proto.keys_ = function keys_() {\n // Returns enumerable && own, but unfortunately keysAtom will report on ANY key change.\n // There is no way to distinguish between Object.keys(object) and Reflect.ownKeys(object) - both are handled by ownKeys trap.\n // We can either over-report in Object.keys(object) or under-report in Reflect.ownKeys(object)\n // We choose to over-report in Object.keys(object), because:\n // - typically it's used with simple data objects\n // - when symbolic/non-enumerable keys are relevant Reflect.ownKeys works as expected\n this.keysAtom_.reportObserved();\n return Object.keys(this.target_);\n };\n return ObservableObjectAdministration;\n}();\nfunction asObservableObject(target, options) {\n var _options$name;\n if ( true && options && isObservableObject(target)) {\n die(\"Options can't be provided for already observable objects.\");\n }\n if (hasProp(target, $mobx)) {\n if ( true && !(getAdministration(target) instanceof ObservableObjectAdministration)) {\n die(\"Cannot convert '\" + getDebugName(target) + \"' into observable object:\" + \"\\nThe target is already observable of different type.\" + \"\\nExtending builtins is not supported.\");\n }\n return target;\n }\n if ( true && !Object.isExtensible(target)) {\n die(\"Cannot make the designated object observable; it is not extensible\");\n }\n var name = (_options$name = options == null ? void 0 : options.name) != null ? _options$name : true ? (isPlainObject(target) ? \"ObservableObject\" : target.constructor.name) + \"@\" + getNextId() : 0;\n var adm = new ObservableObjectAdministration(target, new Map(), String(name), getAnnotationFromOptions(options));\n addHiddenProp(target, $mobx, adm);\n return target;\n}\nvar isObservableObjectAdministration = /*#__PURE__*/createInstanceofPredicate(\"ObservableObjectAdministration\", ObservableObjectAdministration);\nfunction getCachedObservablePropDescriptor(key) {\n return descriptorCache[key] || (descriptorCache[key] = {\n get: function get() {\n return this[$mobx].getObservablePropValue_(key);\n },\n set: function set(value) {\n return this[$mobx].setObservablePropValue_(key, value);\n }\n });\n}\nfunction isObservableObject(thing) {\n if (isObject(thing)) {\n return isObservableObjectAdministration(thing[$mobx]);\n }\n return false;\n}\nfunction recordAnnotationApplied(adm, annotation, key) {\n var _adm$target_$storedAn;\n if (true) {\n adm.appliedAnnotations_[key] = annotation;\n }\n // Remove applied decorator annotation so we don't try to apply it again in subclass constructor\n (_adm$target_$storedAn = adm.target_[storedAnnotationsSymbol]) == null || delete _adm$target_$storedAn[key];\n}\nfunction assertAnnotable(adm, annotation, key) {\n // Valid annotation\n if ( true && !isAnnotation(annotation)) {\n die(\"Cannot annotate '\" + adm.name_ + \".\" + key.toString() + \"': Invalid annotation.\");\n }\n /*\n // Configurable, not sealed, not frozen\n // Possibly not needed, just a little better error then the one thrown by engine.\n // Cases where this would be useful the most (subclass field initializer) are not interceptable by this.\n if (__DEV__) {\n const configurable = getDescriptor(adm.target_, key)?.configurable\n const frozen = Object.isFrozen(adm.target_)\n const sealed = Object.isSealed(adm.target_)\n if (!configurable || frozen || sealed) {\n const fieldName = `${adm.name_}.${key.toString()}`\n const requestedAnnotationType = annotation.annotationType_\n let error = `Cannot apply '${requestedAnnotationType}' to '${fieldName}':`\n if (frozen) {\n error += `\\nObject is frozen.`\n }\n if (sealed) {\n error += `\\nObject is sealed.`\n }\n if (!configurable) {\n error += `\\nproperty is not configurable.`\n // Mention only if caused by us to avoid confusion\n if (hasProp(adm.appliedAnnotations!, key)) {\n error += `\\nTo prevent accidental re-definition of a field by a subclass, `\n error += `all annotated fields of non-plain objects (classes) are not configurable.`\n }\n }\n die(error)\n }\n }\n */\n // Not annotated\n if ( true && !isOverride(annotation) && hasProp(adm.appliedAnnotations_, key)) {\n var fieldName = adm.name_ + \".\" + key.toString();\n var currentAnnotationType = adm.appliedAnnotations_[key].annotationType_;\n var requestedAnnotationType = annotation.annotationType_;\n die(\"Cannot apply '\" + requestedAnnotationType + \"' to '\" + fieldName + \"':\" + (\"\\nThe field is already annotated with '\" + currentAnnotationType + \"'.\") + \"\\nRe-annotating fields is not allowed.\" + \"\\nUse 'override' annotation for methods overridden by subclass.\");\n }\n}\n\n// Bug in safari 9.* (or iOS 9 safari mobile). See #364\nvar ENTRY_0 = /*#__PURE__*/createArrayEntryDescriptor(0);\nvar safariPrototypeSetterInheritanceBug = /*#__PURE__*/function () {\n var v = false;\n var p = {};\n Object.defineProperty(p, \"0\", {\n set: function set() {\n v = true;\n }\n });\n /*#__PURE__*/Object.create(p)[\"0\"] = 1;\n return v === false;\n}();\n/**\n * This array buffer contains two lists of properties, so that all arrays\n * can recycle their property definitions, which significantly improves performance of creating\n * properties on the fly.\n */\nvar OBSERVABLE_ARRAY_BUFFER_SIZE = 0;\n// Typescript workaround to make sure ObservableArray extends Array\nvar StubArray = function StubArray() {};\nfunction inherit(ctor, proto) {\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(ctor.prototype, proto);\n } else if (ctor.prototype.__proto__ !== undefined) {\n ctor.prototype.__proto__ = proto;\n } else {\n ctor.prototype = proto;\n }\n}\ninherit(StubArray, Array.prototype);\n// Weex proto freeze protection was here,\n// but it is unclear why the hack is need as MobX never changed the prototype\n// anyway, so removed it in V6\nvar LegacyObservableArray = /*#__PURE__*/function (_StubArray) {\n function LegacyObservableArray(initialValues, enhancer, name, owned) {\n var _this;\n if (name === void 0) {\n name = true ? \"ObservableArray@\" + getNextId() : 0;\n }\n if (owned === void 0) {\n owned = false;\n }\n _this = _StubArray.call(this) || this;\n initObservable(function () {\n var adm = new ObservableArrayAdministration(name, enhancer, owned, true);\n adm.proxy_ = _this;\n addHiddenFinalProp(_this, $mobx, adm);\n if (initialValues && initialValues.length) {\n // @ts-ignore\n _this.spliceWithArray(0, 0, initialValues);\n }\n if (safariPrototypeSetterInheritanceBug) {\n // Seems that Safari won't use numeric prototype setter until any * numeric property is\n // defined on the instance. After that it works fine, even if this property is deleted.\n Object.defineProperty(_this, \"0\", ENTRY_0);\n }\n });\n return _this;\n }\n _inheritsLoose(LegacyObservableArray, _StubArray);\n var _proto = LegacyObservableArray.prototype;\n _proto.concat = function concat() {\n this[$mobx].atom_.reportObserved();\n for (var _len = arguments.length, arrays = new Array(_len), _key = 0; _key < _len; _key++) {\n arrays[_key] = arguments[_key];\n }\n return Array.prototype.concat.apply(this.slice(),\n //@ts-ignore\n arrays.map(function (a) {\n return isObservableArray(a) ? a.slice() : a;\n }));\n };\n _proto[Symbol.iterator] = function () {\n var self = this;\n var nextIndex = 0;\n return makeIterable({\n next: function next() {\n return nextIndex < self.length ? {\n value: self[nextIndex++],\n done: false\n } : {\n done: true,\n value: undefined\n };\n }\n });\n };\n return _createClass(LegacyObservableArray, [{\n key: \"length\",\n get: function get() {\n return this[$mobx].getArrayLength_();\n },\n set: function set(newLength) {\n this[$mobx].setArrayLength_(newLength);\n }\n }, {\n key: Symbol.toStringTag,\n get: function get() {\n return \"Array\";\n }\n }]);\n}(StubArray);\nObject.entries(arrayExtensions).forEach(function (_ref) {\n var prop = _ref[0],\n fn = _ref[1];\n if (prop !== \"concat\") {\n addHiddenProp(LegacyObservableArray.prototype, prop, fn);\n }\n});\nfunction createArrayEntryDescriptor(index) {\n return {\n enumerable: false,\n configurable: true,\n get: function get() {\n return this[$mobx].get_(index);\n },\n set: function set(value) {\n this[$mobx].set_(index, value);\n }\n };\n}\nfunction createArrayBufferItem(index) {\n defineProperty(LegacyObservableArray.prototype, \"\" + index, createArrayEntryDescriptor(index));\n}\nfunction reserveArrayBuffer(max) {\n if (max > OBSERVABLE_ARRAY_BUFFER_SIZE) {\n for (var index = OBSERVABLE_ARRAY_BUFFER_SIZE; index < max + 100; index++) {\n createArrayBufferItem(index);\n }\n OBSERVABLE_ARRAY_BUFFER_SIZE = max;\n }\n}\nreserveArrayBuffer(1000);\nfunction createLegacyArray(initialValues, enhancer, name) {\n return new LegacyObservableArray(initialValues, enhancer, name);\n}\n\nfunction getAtom(thing, property) {\n if (typeof thing === \"object\" && thing !== null) {\n if (isObservableArray(thing)) {\n if (property !== undefined) {\n die(23);\n }\n return thing[$mobx].atom_;\n }\n if (isObservableSet(thing)) {\n return thing.atom_;\n }\n if (isObservableMap(thing)) {\n if (property === undefined) {\n return thing.keysAtom_;\n }\n var observable = thing.data_.get(property) || thing.hasMap_.get(property);\n if (!observable) {\n die(25, property, getDebugName(thing));\n }\n return observable;\n }\n if (isObservableObject(thing)) {\n if (!property) {\n return die(26);\n }\n var _observable = thing[$mobx].values_.get(property);\n if (!_observable) {\n die(27, property, getDebugName(thing));\n }\n return _observable;\n }\n if (isAtom(thing) || isComputedValue(thing) || isReaction(thing)) {\n return thing;\n }\n } else if (isFunction(thing)) {\n if (isReaction(thing[$mobx])) {\n // disposer function\n return thing[$mobx];\n }\n }\n die(28);\n}\nfunction getAdministration(thing, property) {\n if (!thing) {\n die(29);\n }\n if (property !== undefined) {\n return getAdministration(getAtom(thing, property));\n }\n if (isAtom(thing) || isComputedValue(thing) || isReaction(thing)) {\n return thing;\n }\n if (isObservableMap(thing) || isObservableSet(thing)) {\n return thing;\n }\n if (thing[$mobx]) {\n return thing[$mobx];\n }\n die(24, thing);\n}\nfunction getDebugName(thing, property) {\n var named;\n if (property !== undefined) {\n named = getAtom(thing, property);\n } else if (isAction(thing)) {\n return thing.name;\n } else if (isObservableObject(thing) || isObservableMap(thing) || isObservableSet(thing)) {\n named = getAdministration(thing);\n } else {\n // valid for arrays as well\n named = getAtom(thing);\n }\n return named.name_;\n}\n/**\n * Helper function for initializing observable structures, it applies:\n * 1. allowStateChanges so we don't violate enforceActions.\n * 2. untracked so we don't accidentaly subscribe to anything observable accessed during init in case the observable is created inside derivation.\n * 3. batch to avoid state version updates\n */\nfunction initObservable(cb) {\n var derivation = untrackedStart();\n var allowStateChanges = allowStateChangesStart(true);\n startBatch();\n try {\n return cb();\n } finally {\n endBatch();\n allowStateChangesEnd(allowStateChanges);\n untrackedEnd(derivation);\n }\n}\n\nvar toString = objectPrototype.toString;\nfunction deepEqual(a, b, depth) {\n if (depth === void 0) {\n depth = -1;\n }\n return eq(a, b, depth);\n}\n// Copied from https://github.com/jashkenas/underscore/blob/5c237a7c682fb68fd5378203f0bf22dce1624854/underscore.js#L1186-L1289\n// Internal recursive comparison function for `isEqual`.\nfunction eq(a, b, depth, aStack, bStack) {\n // Identical objects are equal. `0 === -0`, but they aren't identical.\n // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).\n if (a === b) {\n return a !== 0 || 1 / a === 1 / b;\n }\n // `null` or `undefined` only equal to itself (strict comparison).\n if (a == null || b == null) {\n return false;\n }\n // `NaN`s are equivalent, but non-reflexive.\n if (a !== a) {\n return b !== b;\n }\n // Exhaust primitive checks\n var type = typeof a;\n if (type !== \"function\" && type !== \"object\" && typeof b != \"object\") {\n return false;\n }\n // Compare `[[Class]]` names.\n var className = toString.call(a);\n if (className !== toString.call(b)) {\n return false;\n }\n switch (className) {\n // Strings, numbers, regular expressions, dates, and booleans are compared by value.\n case \"[object RegExp]\":\n // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i')\n case \"[object String]\":\n // Primitives and their corresponding object wrappers are equivalent; thus, `\"5\"` is\n // equivalent to `new String(\"5\")`.\n return \"\" + a === \"\" + b;\n case \"[object Number]\":\n // `NaN`s are equivalent, but non-reflexive.\n // Object(NaN) is equivalent to NaN.\n if (+a !== +a) {\n return +b !== +b;\n }\n // An `egal` comparison is performed for other numeric values.\n return +a === 0 ? 1 / +a === 1 / b : +a === +b;\n case \"[object Date]\":\n case \"[object Boolean]\":\n // Coerce dates and booleans to numeric primitive values. Dates are compared by their\n // millisecond representations. Note that invalid dates with millisecond representations\n // of `NaN` are not equivalent.\n return +a === +b;\n case \"[object Symbol]\":\n return typeof Symbol !== \"undefined\" && Symbol.valueOf.call(a) === Symbol.valueOf.call(b);\n case \"[object Map]\":\n case \"[object Set]\":\n // Maps and Sets are unwrapped to arrays of entry-pairs, adding an incidental level.\n // Hide this extra level by increasing the depth.\n if (depth >= 0) {\n depth++;\n }\n break;\n }\n // Unwrap any wrapped objects.\n a = unwrap(a);\n b = unwrap(b);\n var areArrays = className === \"[object Array]\";\n if (!areArrays) {\n if (typeof a != \"object\" || typeof b != \"object\") {\n return false;\n }\n // Objects with different constructors are not equivalent, but `Object`s or `Array`s\n // from different frames are.\n var aCtor = a.constructor,\n bCtor = b.constructor;\n if (aCtor !== bCtor && !(isFunction(aCtor) && aCtor instanceof aCtor && isFunction(bCtor) && bCtor instanceof bCtor) && \"constructor\" in a && \"constructor\" in b) {\n return false;\n }\n }\n if (depth === 0) {\n return false;\n } else if (depth < 0) {\n depth = -1;\n }\n // Assume equality for cyclic structures. The algorithm for detecting cyclic\n // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.\n // Initializing stack of traversed objects.\n // It's done here since we only need them for objects and arrays comparison.\n aStack = aStack || [];\n bStack = bStack || [];\n var length = aStack.length;\n while (length--) {\n // Linear search. Performance is inversely proportional to the number of\n // unique nested structures.\n if (aStack[length] === a) {\n return bStack[length] === b;\n }\n }\n // Add the first object to the stack of traversed objects.\n aStack.push(a);\n bStack.push(b);\n // Recursively compare objects and arrays.\n if (areArrays) {\n // Compare array lengths to determine if a deep comparison is necessary.\n length = a.length;\n if (length !== b.length) {\n return false;\n }\n // Deep compare the contents, ignoring non-numeric properties.\n while (length--) {\n if (!eq(a[length], b[length], depth - 1, aStack, bStack)) {\n return false;\n }\n }\n } else {\n // Deep compare objects.\n var keys = Object.keys(a);\n var key;\n length = keys.length;\n // Ensure that both objects contain the same number of properties before comparing deep equality.\n if (Object.keys(b).length !== length) {\n return false;\n }\n while (length--) {\n // Deep compare each member\n key = keys[length];\n if (!(hasProp(b, key) && eq(a[key], b[key], depth - 1, aStack, bStack))) {\n return false;\n }\n }\n }\n // Remove the first object from the stack of traversed objects.\n aStack.pop();\n bStack.pop();\n return true;\n}\nfunction unwrap(a) {\n if (isObservableArray(a)) {\n return a.slice();\n }\n if (isES6Map(a) || isObservableMap(a)) {\n return Array.from(a.entries());\n }\n if (isES6Set(a) || isObservableSet(a)) {\n return Array.from(a.entries());\n }\n return a;\n}\n\nfunction makeIterable(iterator) {\n iterator[Symbol.iterator] = getSelf;\n return iterator;\n}\nfunction getSelf() {\n return this;\n}\n\nfunction isAnnotation(thing) {\n return (\n // Can be function\n thing instanceof Object && typeof thing.annotationType_ === \"string\" && isFunction(thing.make_) && isFunction(thing.extend_)\n );\n}\n\n/**\n * (c) Michel Weststrate 2015 - 2020\n * MIT Licensed\n *\n * Welcome to the mobx sources! To get a global overview of how MobX internally works,\n * this is a good place to start:\n * https://medium.com/@mweststrate/becoming-fully-reactive-an-in-depth-explanation-of-mobservable-55995262a254#.xvbh6qd74\n *\n * Source folders:\n * ===============\n *\n * - api/ Most of the public static methods exposed by the module can be found here.\n * - core/ Implementation of the MobX algorithm; atoms, derivations, reactions, dependency trees, optimizations. Cool stuff can be found here.\n * - types/ All the magic that is need to have observable objects, arrays and values is in this folder. Including the modifiers like `asFlat`.\n * - utils/ Utility stuff.\n *\n */\n[\"Symbol\", \"Map\", \"Set\"].forEach(function (m) {\n var g = getGlobal();\n if (typeof g[m] === \"undefined\") {\n die(\"MobX requires global '\" + m + \"' to be available or polyfilled\");\n }\n});\nif (typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__ === \"object\") {\n // See: https://github.com/andykog/mobx-devtools/\n __MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({\n spy: spy,\n extras: {\n getDebugName: getDebugName\n },\n $mobx: $mobx\n });\n}\n\n\n//# sourceMappingURL=mobx.esm.js.map\n\n\n//# sourceURL=webpack://app_adyen_SFRA/./node_modules/mobx/dist/mobx.esm.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ $mobx: () => (/* binding */ $mobx),\n/* harmony export */ FlowCancellationError: () => (/* binding */ FlowCancellationError),\n/* harmony export */ ObservableMap: () => (/* binding */ ObservableMap),\n/* harmony export */ ObservableSet: () => (/* binding */ ObservableSet),\n/* harmony export */ Reaction: () => (/* binding */ Reaction),\n/* harmony export */ _allowStateChanges: () => (/* binding */ allowStateChanges),\n/* harmony export */ _allowStateChangesInsideComputed: () => (/* binding */ runInAction),\n/* harmony export */ _allowStateReadsEnd: () => (/* binding */ allowStateReadsEnd),\n/* harmony export */ _allowStateReadsStart: () => (/* binding */ allowStateReadsStart),\n/* harmony export */ _autoAction: () => (/* binding */ autoAction),\n/* harmony export */ _endAction: () => (/* binding */ _endAction),\n/* harmony export */ _getAdministration: () => (/* binding */ getAdministration),\n/* harmony export */ _getGlobalState: () => (/* binding */ getGlobalState),\n/* harmony export */ _interceptReads: () => (/* binding */ interceptReads),\n/* harmony export */ _isComputingDerivation: () => (/* binding */ isComputingDerivation),\n/* harmony export */ _resetGlobalState: () => (/* binding */ resetGlobalState),\n/* harmony export */ _startAction: () => (/* binding */ _startAction),\n/* harmony export */ action: () => (/* binding */ action),\n/* harmony export */ autorun: () => (/* binding */ autorun),\n/* harmony export */ comparer: () => (/* binding */ comparer),\n/* harmony export */ computed: () => (/* binding */ computed),\n/* harmony export */ configure: () => (/* binding */ configure),\n/* harmony export */ createAtom: () => (/* binding */ createAtom),\n/* harmony export */ defineProperty: () => (/* binding */ apiDefineProperty),\n/* harmony export */ entries: () => (/* binding */ entries),\n/* harmony export */ extendObservable: () => (/* binding */ extendObservable),\n/* harmony export */ flow: () => (/* binding */ flow),\n/* harmony export */ flowResult: () => (/* binding */ flowResult),\n/* harmony export */ get: () => (/* binding */ get),\n/* harmony export */ getAtom: () => (/* binding */ getAtom),\n/* harmony export */ getDebugName: () => (/* binding */ getDebugName),\n/* harmony export */ getDependencyTree: () => (/* binding */ getDependencyTree),\n/* harmony export */ getObserverTree: () => (/* binding */ getObserverTree),\n/* harmony export */ has: () => (/* binding */ has),\n/* harmony export */ intercept: () => (/* binding */ intercept),\n/* harmony export */ isAction: () => (/* binding */ isAction),\n/* harmony export */ isBoxedObservable: () => (/* binding */ isObservableValue),\n/* harmony export */ isComputed: () => (/* binding */ isComputed),\n/* harmony export */ isComputedProp: () => (/* binding */ isComputedProp),\n/* harmony export */ isFlow: () => (/* binding */ isFlow),\n/* harmony export */ isFlowCancellationError: () => (/* binding */ isFlowCancellationError),\n/* harmony export */ isObservable: () => (/* binding */ isObservable),\n/* harmony export */ isObservableArray: () => (/* binding */ isObservableArray),\n/* harmony export */ isObservableMap: () => (/* binding */ isObservableMap),\n/* harmony export */ isObservableObject: () => (/* binding */ isObservableObject),\n/* harmony export */ isObservableProp: () => (/* binding */ isObservableProp),\n/* harmony export */ isObservableSet: () => (/* binding */ isObservableSet),\n/* harmony export */ keys: () => (/* binding */ keys),\n/* harmony export */ makeAutoObservable: () => (/* binding */ makeAutoObservable),\n/* harmony export */ makeObservable: () => (/* binding */ makeObservable),\n/* harmony export */ observable: () => (/* binding */ observable),\n/* harmony export */ observe: () => (/* binding */ observe),\n/* harmony export */ onBecomeObserved: () => (/* binding */ onBecomeObserved),\n/* harmony export */ onBecomeUnobserved: () => (/* binding */ onBecomeUnobserved),\n/* harmony export */ onReactionError: () => (/* binding */ onReactionError),\n/* harmony export */ override: () => (/* binding */ override),\n/* harmony export */ ownKeys: () => (/* binding */ apiOwnKeys),\n/* harmony export */ reaction: () => (/* binding */ reaction),\n/* harmony export */ remove: () => (/* binding */ remove),\n/* harmony export */ runInAction: () => (/* binding */ runInAction),\n/* harmony export */ set: () => (/* binding */ set),\n/* harmony export */ spy: () => (/* binding */ spy),\n/* harmony export */ toJS: () => (/* binding */ toJS),\n/* harmony export */ trace: () => (/* binding */ trace),\n/* harmony export */ transaction: () => (/* binding */ transaction),\n/* harmony export */ untracked: () => (/* binding */ untracked),\n/* harmony export */ values: () => (/* binding */ values),\n/* harmony export */ when: () => (/* binding */ when)\n/* harmony export */ });\nvar niceErrors = {\n 0: \"Invalid value for configuration 'enforceActions', expected 'never', 'always' or 'observed'\",\n 1: function _(annotationType, key) {\n return \"Cannot apply '\" + annotationType + \"' to '\" + key.toString() + \"': Field not found.\";\n },\n /*\n 2(prop) {\n return `invalid decorator for '${prop.toString()}'`\n },\n 3(prop) {\n return `Cannot decorate '${prop.toString()}': action can only be used on properties with a function value.`\n },\n 4(prop) {\n return `Cannot decorate '${prop.toString()}': computed can only be used on getter properties.`\n },\n */\n 5: \"'keys()' can only be used on observable objects, arrays, sets and maps\",\n 6: \"'values()' can only be used on observable objects, arrays, sets and maps\",\n 7: \"'entries()' can only be used on observable objects, arrays and maps\",\n 8: \"'set()' can only be used on observable objects, arrays and maps\",\n 9: \"'remove()' can only be used on observable objects, arrays and maps\",\n 10: \"'has()' can only be used on observable objects, arrays and maps\",\n 11: \"'get()' can only be used on observable objects, arrays and maps\",\n 12: \"Invalid annotation\",\n 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)\",\n 14: \"Intercept handlers should return nothing or a change object\",\n 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)\",\n 16: \"Modification exception: the internal structure of an observable array was changed.\",\n 17: function _(index, length) {\n return \"[mobx.array] Index out of bounds, \" + index + \" is larger than \" + length;\n },\n 18: \"mobx.map requires Map polyfill for the current browser. Check babel-polyfill or core-js/es6/map.js\",\n 19: function _(other) {\n return \"Cannot initialize from classes that inherit from Map: \" + other.constructor.name;\n },\n 20: function _(other) {\n return \"Cannot initialize map from \" + other;\n },\n 21: function _(dataStructure) {\n return \"Cannot convert to map from '\" + dataStructure + \"'\";\n },\n 22: \"mobx.set requires Set polyfill for the current browser. Check babel-polyfill or core-js/es6/set.js\",\n 23: \"It is not possible to get index atoms from arrays\",\n 24: function _(thing) {\n return \"Cannot obtain administration from \" + thing;\n },\n 25: function _(property, name) {\n return \"the entry '\" + property + \"' does not exist in the observable map '\" + name + \"'\";\n },\n 26: \"please specify a property\",\n 27: function _(property, name) {\n return \"no observable property '\" + property.toString() + \"' found on the observable object '\" + name + \"'\";\n },\n 28: function _(thing) {\n return \"Cannot obtain atom from \" + thing;\n },\n 29: \"Expecting some object\",\n 30: \"invalid action stack. did you forget to finish an action?\",\n 31: \"missing option for computed: get\",\n 32: function _(name, derivation) {\n return \"Cycle detected in computation \" + name + \": \" + derivation;\n },\n 33: function _(name) {\n return \"The setter of computed value '\" + name + \"' is trying to update itself. Did you intend to update an _observable_ value, instead of the computed property?\";\n },\n 34: function _(name) {\n return \"[ComputedValue '\" + name + \"'] It is not possible to assign a new value to a computed value.\";\n },\n 35: \"There are multiple, different versions of MobX active. Make sure MobX is loaded only once or use `configure({ isolateGlobalState: true })`\",\n 36: \"isolateGlobalState should be called before MobX is running any reactions\",\n 37: function _(method) {\n return \"[mobx] `observableArray.\" + method + \"()` mutates the array in-place, which is not allowed inside a derivation. Use `array.slice().\" + method + \"()` instead\";\n },\n 38: \"'ownKeys()' can only be used on observable objects\",\n 39: \"'defineProperty()' can only be used on observable objects\"\n};\nvar errors = true ? niceErrors : 0;\nfunction die(error) {\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n if (true) {\n var e = typeof error === \"string\" ? error : errors[error];\n if (typeof e === \"function\") e = e.apply(null, args);\n throw new Error(\"[MobX] \" + e);\n }\n throw new Error(typeof error === \"number\" ? \"[MobX] minified error nr: \" + error + (args.length ? \" \" + args.map(String).join(\",\") : \"\") + \". Find the full error at: https://github.com/mobxjs/mobx/blob/main/packages/mobx/src/errors.ts\" : \"[MobX] \" + error);\n}\n\nvar mockGlobal = {};\nfunction getGlobal() {\n if (typeof globalThis !== \"undefined\") {\n return globalThis;\n }\n if (typeof window !== \"undefined\") {\n return window;\n }\n if (typeof __webpack_require__.g !== \"undefined\") {\n return __webpack_require__.g;\n }\n if (typeof self !== \"undefined\") {\n return self;\n }\n return mockGlobal;\n}\n\n// We shorten anything used > 5 times\nvar assign = Object.assign;\nvar getDescriptor = Object.getOwnPropertyDescriptor;\nvar defineProperty = Object.defineProperty;\nvar objectPrototype = Object.prototype;\nvar EMPTY_ARRAY = [];\nObject.freeze(EMPTY_ARRAY);\nvar EMPTY_OBJECT = {};\nObject.freeze(EMPTY_OBJECT);\nvar hasProxy = typeof Proxy !== \"undefined\";\nvar plainObjectString = /*#__PURE__*/Object.toString();\nfunction assertProxies() {\n if (!hasProxy) {\n die( true ? \"`Proxy` objects are not available in the current environment. Please configure MobX to enable a fallback implementation.`\" : 0);\n }\n}\nfunction warnAboutProxyRequirement(msg) {\n if ( true && globalState.verifyProxies) {\n die(\"MobX is currently configured to be able to run in ES5 mode, but in ES5 MobX won't be able to \" + msg);\n }\n}\nfunction getNextId() {\n return ++globalState.mobxGuid;\n}\n/**\n * Makes sure that the provided function is invoked at most once.\n */\nfunction once(func) {\n var invoked = false;\n return function () {\n if (invoked) {\n return;\n }\n invoked = true;\n return func.apply(this, arguments);\n };\n}\nvar noop = function noop() {};\nfunction isFunction(fn) {\n return typeof fn === \"function\";\n}\nfunction isStringish(value) {\n var t = typeof value;\n switch (t) {\n case \"string\":\n case \"symbol\":\n case \"number\":\n return true;\n }\n return false;\n}\nfunction isObject(value) {\n return value !== null && typeof value === \"object\";\n}\nfunction isPlainObject(value) {\n if (!isObject(value)) {\n return false;\n }\n var proto = Object.getPrototypeOf(value);\n if (proto == null) {\n return true;\n }\n var protoConstructor = Object.hasOwnProperty.call(proto, \"constructor\") && proto.constructor;\n return typeof protoConstructor === \"function\" && protoConstructor.toString() === plainObjectString;\n}\n// https://stackoverflow.com/a/37865170\nfunction isGenerator(obj) {\n var constructor = obj == null ? void 0 : obj.constructor;\n if (!constructor) {\n return false;\n }\n if (\"GeneratorFunction\" === constructor.name || \"GeneratorFunction\" === constructor.displayName) {\n return true;\n }\n return false;\n}\nfunction addHiddenProp(object, propName, value) {\n defineProperty(object, propName, {\n enumerable: false,\n writable: true,\n configurable: true,\n value: value\n });\n}\nfunction addHiddenFinalProp(object, propName, value) {\n defineProperty(object, propName, {\n enumerable: false,\n writable: false,\n configurable: true,\n value: value\n });\n}\nfunction createInstanceofPredicate(name, theClass) {\n var propName = \"isMobX\" + name;\n theClass.prototype[propName] = true;\n return function (x) {\n return isObject(x) && x[propName] === true;\n };\n}\n/**\n * Yields true for both native and observable Map, even across different windows.\n */\nfunction isES6Map(thing) {\n return thing != null && Object.prototype.toString.call(thing) === \"[object Map]\";\n}\n/**\n * Makes sure a Map is an instance of non-inherited native or observable Map.\n */\nfunction isPlainES6Map(thing) {\n var mapProto = Object.getPrototypeOf(thing);\n var objectProto = Object.getPrototypeOf(mapProto);\n var nullProto = Object.getPrototypeOf(objectProto);\n return nullProto === null;\n}\n/**\n * Yields true for both native and observable Set, even across different windows.\n */\nfunction isES6Set(thing) {\n return thing != null && Object.prototype.toString.call(thing) === \"[object Set]\";\n}\nvar hasGetOwnPropertySymbols = typeof Object.getOwnPropertySymbols !== \"undefined\";\n/**\n * Returns the following: own enumerable keys and symbols.\n */\nfunction getPlainObjectKeys(object) {\n var keys = Object.keys(object);\n // Not supported in IE, so there are not going to be symbol props anyway...\n if (!hasGetOwnPropertySymbols) {\n return keys;\n }\n var symbols = Object.getOwnPropertySymbols(object);\n if (!symbols.length) {\n return keys;\n }\n return [].concat(keys, symbols.filter(function (s) {\n return objectPrototype.propertyIsEnumerable.call(object, s);\n }));\n}\n// From Immer utils\n// Returns all own keys, including non-enumerable and symbolic\nvar ownKeys = typeof Reflect !== \"undefined\" && Reflect.ownKeys ? Reflect.ownKeys : hasGetOwnPropertySymbols ? function (obj) {\n return Object.getOwnPropertyNames(obj).concat(Object.getOwnPropertySymbols(obj));\n} : /* istanbul ignore next */Object.getOwnPropertyNames;\nfunction stringifyKey(key) {\n if (typeof key === \"string\") {\n return key;\n }\n if (typeof key === \"symbol\") {\n return key.toString();\n }\n return new String(key).toString();\n}\nfunction toPrimitive(value) {\n return value === null ? null : typeof value === \"object\" ? \"\" + value : value;\n}\nfunction hasProp(target, prop) {\n return objectPrototype.hasOwnProperty.call(target, prop);\n}\n// From Immer utils\nvar getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors || function getOwnPropertyDescriptors(target) {\n // Polyfill needed for Hermes and IE, see https://github.com/facebook/hermes/issues/274\n var res = {};\n // Note: without polyfill for ownKeys, symbols won't be picked up\n ownKeys(target).forEach(function (key) {\n res[key] = getDescriptor(target, key);\n });\n return res;\n};\nfunction getFlag(flags, mask) {\n return !!(flags & mask);\n}\nfunction setFlag(flags, mask, newValue) {\n if (newValue) {\n flags |= mask;\n } else {\n flags &= ~mask;\n }\n return flags;\n}\n\nfunction _arrayLikeToArray(r, a) {\n (null == a || a > r.length) && (a = r.length);\n for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];\n return n;\n}\nfunction _defineProperties(e, r) {\n for (var t = 0; t < r.length; t++) {\n var o = r[t];\n o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);\n }\n}\nfunction _createClass(e, r, t) {\n return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", {\n writable: !1\n }), e;\n}\nfunction _createForOfIteratorHelperLoose(r, e) {\n var t = \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"];\n if (t) return (t = t.call(r)).next.bind(t);\n if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && \"number\" == typeof r.length) {\n t && (r = t);\n var o = 0;\n return function () {\n return o >= r.length ? {\n done: !0\n } : {\n done: !1,\n value: r[o++]\n };\n };\n }\n throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\nfunction _extends() {\n return _extends = Object.assign ? Object.assign.bind() : function (n) {\n for (var e = 1; e < arguments.length; e++) {\n var t = arguments[e];\n for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);\n }\n return n;\n }, _extends.apply(null, arguments);\n}\nfunction _inheritsLoose(t, o) {\n t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);\n}\nfunction _setPrototypeOf(t, e) {\n return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {\n return t.__proto__ = e, t;\n }, _setPrototypeOf(t, e);\n}\nfunction _toPrimitive(t, r) {\n if (\"object\" != typeof t || !t) return t;\n var e = t[Symbol.toPrimitive];\n if (void 0 !== e) {\n var i = e.call(t, r || \"default\");\n if (\"object\" != typeof i) return i;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (\"string\" === r ? String : Number)(t);\n}\nfunction _toPropertyKey(t) {\n var i = _toPrimitive(t, \"string\");\n return \"symbol\" == typeof i ? i : i + \"\";\n}\nfunction _unsupportedIterableToArray(r, a) {\n if (r) {\n if (\"string\" == typeof r) return _arrayLikeToArray(r, a);\n var t = {}.toString.call(r).slice(8, -1);\n return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;\n }\n}\n\nvar storedAnnotationsSymbol = /*#__PURE__*/Symbol(\"mobx-stored-annotations\");\n/**\n * Creates a function that acts as\n * - decorator\n * - annotation object\n */\nfunction createDecoratorAnnotation(annotation) {\n function decorator(target, property) {\n if (is20223Decorator(property)) {\n return annotation.decorate_20223_(target, property);\n } else {\n storeAnnotation(target, property, annotation);\n }\n }\n return Object.assign(decorator, annotation);\n}\n/**\n * Stores annotation to prototype,\n * so it can be inspected later by `makeObservable` called from constructor\n */\nfunction storeAnnotation(prototype, key, annotation) {\n if (!hasProp(prototype, storedAnnotationsSymbol)) {\n addHiddenProp(prototype, storedAnnotationsSymbol, _extends({}, prototype[storedAnnotationsSymbol]));\n }\n // @override must override something\n if ( true && isOverride(annotation) && !hasProp(prototype[storedAnnotationsSymbol], key)) {\n var fieldName = prototype.constructor.name + \".prototype.\" + key.toString();\n die(\"'\" + fieldName + \"' is decorated with 'override', \" + \"but no such decorated member was found on prototype.\");\n }\n // Cannot re-decorate\n assertNotDecorated(prototype, annotation, key);\n // Ignore override\n if (!isOverride(annotation)) {\n prototype[storedAnnotationsSymbol][key] = annotation;\n }\n}\nfunction assertNotDecorated(prototype, annotation, key) {\n if ( true && !isOverride(annotation) && hasProp(prototype[storedAnnotationsSymbol], key)) {\n var fieldName = prototype.constructor.name + \".prototype.\" + key.toString();\n var currentAnnotationType = prototype[storedAnnotationsSymbol][key].annotationType_;\n var requestedAnnotationType = annotation.annotationType_;\n die(\"Cannot apply '@\" + requestedAnnotationType + \"' to '\" + fieldName + \"':\" + (\"\\nThe field is already decorated with '@\" + currentAnnotationType + \"'.\") + \"\\nRe-decorating fields is not allowed.\" + \"\\nUse '@override' decorator for methods overridden by subclass.\");\n }\n}\n/**\n * Collects annotations from prototypes and stores them on target (instance)\n */\nfunction collectStoredAnnotations(target) {\n if (!hasProp(target, storedAnnotationsSymbol)) {\n // if (__DEV__ && !target[storedAnnotationsSymbol]) {\n // die(\n // `No annotations were passed to makeObservable, but no decorated members have been found either`\n // )\n // }\n // We need a copy as we will remove annotation from the list once it's applied.\n addHiddenProp(target, storedAnnotationsSymbol, _extends({}, target[storedAnnotationsSymbol]));\n }\n return target[storedAnnotationsSymbol];\n}\nfunction is20223Decorator(context) {\n return typeof context == \"object\" && typeof context[\"kind\"] == \"string\";\n}\nfunction assert20223DecoratorType(context, types) {\n if ( true && !types.includes(context.kind)) {\n die(\"The decorator applied to '\" + String(context.name) + \"' cannot be used on a \" + context.kind + \" element\");\n }\n}\n\nvar $mobx = /*#__PURE__*/Symbol(\"mobx administration\");\nvar Atom = /*#__PURE__*/function () {\n /**\n * Create a new atom. For debugging purposes it is recommended to give it a name.\n * The onBecomeObserved and onBecomeUnobserved callbacks can be used for resource management.\n */\n function Atom(name_) {\n if (name_ === void 0) {\n name_ = true ? \"Atom@\" + getNextId() : 0;\n }\n this.name_ = void 0;\n this.flags_ = 0;\n this.observers_ = new Set();\n this.lastAccessedBy_ = 0;\n this.lowestObserverState_ = IDerivationState_.NOT_TRACKING_;\n // onBecomeObservedListeners\n this.onBOL = void 0;\n // onBecomeUnobservedListeners\n this.onBUOL = void 0;\n this.name_ = name_;\n }\n // for effective unobserving. BaseAtom has true, for extra optimization, so its onBecomeUnobserved never gets called, because it's not needed\n var _proto = Atom.prototype;\n _proto.onBO = function onBO() {\n if (this.onBOL) {\n this.onBOL.forEach(function (listener) {\n return listener();\n });\n }\n };\n _proto.onBUO = function onBUO() {\n if (this.onBUOL) {\n this.onBUOL.forEach(function (listener) {\n return listener();\n });\n }\n }\n /**\n * Invoke this method to notify mobx that your atom has been used somehow.\n * Returns true if there is currently a reactive context.\n */;\n _proto.reportObserved = function reportObserved$1() {\n return reportObserved(this);\n }\n /**\n * Invoke this method _after_ this method has changed to signal mobx that all its observers should invalidate.\n */;\n _proto.reportChanged = function reportChanged() {\n startBatch();\n propagateChanged(this);\n endBatch();\n };\n _proto.toString = function toString() {\n return this.name_;\n };\n return _createClass(Atom, [{\n key: \"isBeingObserved\",\n get: function get() {\n return getFlag(this.flags_, Atom.isBeingObservedMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Atom.isBeingObservedMask_, newValue);\n }\n }, {\n key: \"isPendingUnobservation\",\n get: function get() {\n return getFlag(this.flags_, Atom.isPendingUnobservationMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Atom.isPendingUnobservationMask_, newValue);\n }\n }, {\n key: \"diffValue\",\n get: function get() {\n return getFlag(this.flags_, Atom.diffValueMask_) ? 1 : 0;\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Atom.diffValueMask_, newValue === 1 ? true : false);\n }\n }]);\n}();\nAtom.isBeingObservedMask_ = 1;\nAtom.isPendingUnobservationMask_ = 2;\nAtom.diffValueMask_ = 4;\nvar isAtom = /*#__PURE__*/createInstanceofPredicate(\"Atom\", Atom);\nfunction createAtom(name, onBecomeObservedHandler, onBecomeUnobservedHandler) {\n if (onBecomeObservedHandler === void 0) {\n onBecomeObservedHandler = noop;\n }\n if (onBecomeUnobservedHandler === void 0) {\n onBecomeUnobservedHandler = noop;\n }\n var atom = new Atom(name);\n // default `noop` listener will not initialize the hook Set\n if (onBecomeObservedHandler !== noop) {\n onBecomeObserved(atom, onBecomeObservedHandler);\n }\n if (onBecomeUnobservedHandler !== noop) {\n onBecomeUnobserved(atom, onBecomeUnobservedHandler);\n }\n return atom;\n}\n\nfunction identityComparer(a, b) {\n return a === b;\n}\nfunction structuralComparer(a, b) {\n return deepEqual(a, b);\n}\nfunction shallowComparer(a, b) {\n return deepEqual(a, b, 1);\n}\nfunction defaultComparer(a, b) {\n if (Object.is) {\n return Object.is(a, b);\n }\n return a === b ? a !== 0 || 1 / a === 1 / b : a !== a && b !== b;\n}\nvar comparer = {\n identity: identityComparer,\n structural: structuralComparer,\n \"default\": defaultComparer,\n shallow: shallowComparer\n};\n\nfunction deepEnhancer(v, _, name) {\n // it is an observable already, done\n if (isObservable(v)) {\n return v;\n }\n // something that can be converted and mutated?\n if (Array.isArray(v)) {\n return observable.array(v, {\n name: name\n });\n }\n if (isPlainObject(v)) {\n return observable.object(v, undefined, {\n name: name\n });\n }\n if (isES6Map(v)) {\n return observable.map(v, {\n name: name\n });\n }\n if (isES6Set(v)) {\n return observable.set(v, {\n name: name\n });\n }\n if (typeof v === \"function\" && !isAction(v) && !isFlow(v)) {\n if (isGenerator(v)) {\n return flow(v);\n } else {\n return autoAction(name, v);\n }\n }\n return v;\n}\nfunction shallowEnhancer(v, _, name) {\n if (v === undefined || v === null) {\n return v;\n }\n if (isObservableObject(v) || isObservableArray(v) || isObservableMap(v) || isObservableSet(v)) {\n return v;\n }\n if (Array.isArray(v)) {\n return observable.array(v, {\n name: name,\n deep: false\n });\n }\n if (isPlainObject(v)) {\n return observable.object(v, undefined, {\n name: name,\n deep: false\n });\n }\n if (isES6Map(v)) {\n return observable.map(v, {\n name: name,\n deep: false\n });\n }\n if (isES6Set(v)) {\n return observable.set(v, {\n name: name,\n deep: false\n });\n }\n if (true) {\n die(\"The shallow modifier / decorator can only used in combination with arrays, objects, maps and sets\");\n }\n}\nfunction referenceEnhancer(newValue) {\n // never turn into an observable\n return newValue;\n}\nfunction refStructEnhancer(v, oldValue) {\n if ( true && isObservable(v)) {\n die(\"observable.struct should not be used with observable values\");\n }\n if (deepEqual(v, oldValue)) {\n return oldValue;\n }\n return v;\n}\n\nvar OVERRIDE = \"override\";\nvar override = /*#__PURE__*/createDecoratorAnnotation({\n annotationType_: OVERRIDE,\n make_: make_,\n extend_: extend_,\n decorate_20223_: decorate_20223_\n});\nfunction isOverride(annotation) {\n return annotation.annotationType_ === OVERRIDE;\n}\nfunction make_(adm, key) {\n // Must not be plain object\n if ( true && adm.isPlainObject_) {\n die(\"Cannot apply '\" + this.annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + this.annotationType_ + \"' cannot be used on plain objects.\"));\n }\n // Must override something\n if ( true && !hasProp(adm.appliedAnnotations_, key)) {\n die(\"'\" + adm.name_ + \".\" + key.toString() + \"' is annotated with '\" + this.annotationType_ + \"', \" + \"but no such annotated member was found on prototype.\");\n }\n return 0 /* MakeResult.Cancel */;\n}\nfunction extend_(adm, key, descriptor, proxyTrap) {\n die(\"'\" + this.annotationType_ + \"' can only be used with 'makeObservable'\");\n}\nfunction decorate_20223_(desc, context) {\n console.warn(\"'\" + this.annotationType_ + \"' cannot be used with decorators - this is a no-op\");\n}\n\nfunction createActionAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$1,\n extend_: extend_$1,\n decorate_20223_: decorate_20223_$1\n };\n}\nfunction make_$1(adm, key, descriptor, source) {\n var _this$options_;\n // bound\n if ((_this$options_ = this.options_) != null && _this$options_.bound) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;\n }\n // own\n if (source === adm.target_) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 2 /* MakeResult.Continue */;\n }\n // prototype\n if (isAction(descriptor.value)) {\n // A prototype could have been annotated already by other constructor,\n // rest of the proto chain must be annotated already\n return 1 /* MakeResult.Break */;\n }\n var actionDescriptor = createActionDescriptor(adm, this, key, descriptor, false);\n defineProperty(source, key, actionDescriptor);\n return 2 /* MakeResult.Continue */;\n}\nfunction extend_$1(adm, key, descriptor, proxyTrap) {\n var actionDescriptor = createActionDescriptor(adm, this, key, descriptor);\n return adm.defineProperty_(key, actionDescriptor, proxyTrap);\n}\nfunction decorate_20223_$1(mthd, context) {\n if (true) {\n assert20223DecoratorType(context, [\"method\", \"field\"]);\n }\n var kind = context.kind,\n name = context.name,\n addInitializer = context.addInitializer;\n var ann = this;\n var _createAction = function _createAction(m) {\n var _ann$options_$name, _ann$options_, _ann$options_$autoAct, _ann$options_2;\n return createAction((_ann$options_$name = (_ann$options_ = ann.options_) == null ? void 0 : _ann$options_.name) != null ? _ann$options_$name : name.toString(), m, (_ann$options_$autoAct = (_ann$options_2 = ann.options_) == null ? void 0 : _ann$options_2.autoAction) != null ? _ann$options_$autoAct : false);\n };\n if (kind == \"field\") {\n return function (initMthd) {\n var _ann$options_3;\n var mthd = initMthd;\n if (!isAction(mthd)) {\n mthd = _createAction(mthd);\n }\n if ((_ann$options_3 = ann.options_) != null && _ann$options_3.bound) {\n mthd = mthd.bind(this);\n mthd.isMobxAction = true;\n }\n return mthd;\n };\n }\n if (kind == \"method\") {\n var _this$options_2;\n if (!isAction(mthd)) {\n mthd = _createAction(mthd);\n }\n if ((_this$options_2 = this.options_) != null && _this$options_2.bound) {\n addInitializer(function () {\n var self = this;\n var bound = self[name].bind(self);\n bound.isMobxAction = true;\n self[name] = bound;\n });\n }\n return mthd;\n }\n die(\"Cannot apply '\" + ann.annotationType_ + \"' to '\" + String(name) + \"' (kind: \" + kind + \"):\" + (\"\\n'\" + ann.annotationType_ + \"' can only be used on properties with a function value.\"));\n}\nfunction assertActionDescriptor(adm, _ref, key, _ref2) {\n var annotationType_ = _ref.annotationType_;\n var value = _ref2.value;\n if ( true && !isFunction(value)) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' can only be used on properties with a function value.\"));\n }\n}\nfunction createActionDescriptor(adm, annotation, key, descriptor,\n// provides ability to disable safeDescriptors for prototypes\nsafeDescriptors) {\n var _annotation$options_, _annotation$options_$, _annotation$options_2, _annotation$options_$2, _annotation$options_3, _annotation$options_4, _adm$proxy_2;\n if (safeDescriptors === void 0) {\n safeDescriptors = globalState.safeDescriptors;\n }\n assertActionDescriptor(adm, annotation, key, descriptor);\n var value = descriptor.value;\n if ((_annotation$options_ = annotation.options_) != null && _annotation$options_.bound) {\n var _adm$proxy_;\n value = value.bind((_adm$proxy_ = adm.proxy_) != null ? _adm$proxy_ : adm.target_);\n }\n return {\n value: createAction((_annotation$options_$ = (_annotation$options_2 = annotation.options_) == null ? void 0 : _annotation$options_2.name) != null ? _annotation$options_$ : key.toString(), value, (_annotation$options_$2 = (_annotation$options_3 = annotation.options_) == null ? void 0 : _annotation$options_3.autoAction) != null ? _annotation$options_$2 : false,\n // https://github.com/mobxjs/mobx/discussions/3140\n (_annotation$options_4 = annotation.options_) != null && _annotation$options_4.bound ? (_adm$proxy_2 = adm.proxy_) != null ? _adm$proxy_2 : adm.target_ : undefined),\n // Non-configurable for classes\n // prevents accidental field redefinition in subclass\n configurable: safeDescriptors ? adm.isPlainObject_ : true,\n // https://github.com/mobxjs/mobx/pull/2641#issuecomment-737292058\n enumerable: false,\n // Non-obsevable, therefore non-writable\n // Also prevents rewriting in subclass constructor\n writable: safeDescriptors ? false : true\n };\n}\n\nfunction createFlowAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$2,\n extend_: extend_$2,\n decorate_20223_: decorate_20223_$2\n };\n}\nfunction make_$2(adm, key, descriptor, source) {\n var _this$options_;\n // own\n if (source === adm.target_) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 2 /* MakeResult.Continue */;\n }\n // prototype\n // bound - must annotate protos to support super.flow()\n if ((_this$options_ = this.options_) != null && _this$options_.bound && (!hasProp(adm.target_, key) || !isFlow(adm.target_[key]))) {\n if (this.extend_(adm, key, descriptor, false) === null) {\n return 0 /* MakeResult.Cancel */;\n }\n }\n if (isFlow(descriptor.value)) {\n // A prototype could have been annotated already by other constructor,\n // rest of the proto chain must be annotated already\n return 1 /* MakeResult.Break */;\n }\n var flowDescriptor = createFlowDescriptor(adm, this, key, descriptor, false, false);\n defineProperty(source, key, flowDescriptor);\n return 2 /* MakeResult.Continue */;\n}\nfunction extend_$2(adm, key, descriptor, proxyTrap) {\n var _this$options_2;\n var flowDescriptor = createFlowDescriptor(adm, this, key, descriptor, (_this$options_2 = this.options_) == null ? void 0 : _this$options_2.bound);\n return adm.defineProperty_(key, flowDescriptor, proxyTrap);\n}\nfunction decorate_20223_$2(mthd, context) {\n var _this$options_3;\n if (true) {\n assert20223DecoratorType(context, [\"method\"]);\n }\n var name = context.name,\n addInitializer = context.addInitializer;\n if (!isFlow(mthd)) {\n mthd = flow(mthd);\n }\n if ((_this$options_3 = this.options_) != null && _this$options_3.bound) {\n addInitializer(function () {\n var self = this;\n var bound = self[name].bind(self);\n bound.isMobXFlow = true;\n self[name] = bound;\n });\n }\n return mthd;\n}\nfunction assertFlowDescriptor(adm, _ref, key, _ref2) {\n var annotationType_ = _ref.annotationType_;\n var value = _ref2.value;\n if ( true && !isFunction(value)) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' can only be used on properties with a generator function value.\"));\n }\n}\nfunction createFlowDescriptor(adm, annotation, key, descriptor, bound,\n// provides ability to disable safeDescriptors for prototypes\nsafeDescriptors) {\n if (safeDescriptors === void 0) {\n safeDescriptors = globalState.safeDescriptors;\n }\n assertFlowDescriptor(adm, annotation, key, descriptor);\n var value = descriptor.value;\n // In case of flow.bound, the descriptor can be from already annotated prototype\n if (!isFlow(value)) {\n value = flow(value);\n }\n if (bound) {\n var _adm$proxy_;\n // We do not keep original function around, so we bind the existing flow\n value = value.bind((_adm$proxy_ = adm.proxy_) != null ? _adm$proxy_ : adm.target_);\n // This is normally set by `flow`, but `bind` returns new function...\n value.isMobXFlow = true;\n }\n return {\n value: value,\n // Non-configurable for classes\n // prevents accidental field redefinition in subclass\n configurable: safeDescriptors ? adm.isPlainObject_ : true,\n // https://github.com/mobxjs/mobx/pull/2641#issuecomment-737292058\n enumerable: false,\n // Non-obsevable, therefore non-writable\n // Also prevents rewriting in subclass constructor\n writable: safeDescriptors ? false : true\n };\n}\n\nfunction createComputedAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$3,\n extend_: extend_$3,\n decorate_20223_: decorate_20223_$3\n };\n}\nfunction make_$3(adm, key, descriptor) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;\n}\nfunction extend_$3(adm, key, descriptor, proxyTrap) {\n assertComputedDescriptor(adm, this, key, descriptor);\n return adm.defineComputedProperty_(key, _extends({}, this.options_, {\n get: descriptor.get,\n set: descriptor.set\n }), proxyTrap);\n}\nfunction decorate_20223_$3(get, context) {\n if (true) {\n assert20223DecoratorType(context, [\"getter\"]);\n }\n var ann = this;\n var key = context.name,\n addInitializer = context.addInitializer;\n addInitializer(function () {\n var adm = asObservableObject(this)[$mobx];\n var options = _extends({}, ann.options_, {\n get: get,\n context: this\n });\n options.name || (options.name = true ? adm.name_ + \".\" + key.toString() : 0);\n adm.values_.set(key, new ComputedValue(options));\n });\n return function () {\n return this[$mobx].getObservablePropValue_(key);\n };\n}\nfunction assertComputedDescriptor(adm, _ref, key, _ref2) {\n var annotationType_ = _ref.annotationType_;\n var get = _ref2.get;\n if ( true && !get) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' can only be used on getter(+setter) properties.\"));\n }\n}\n\nfunction createObservableAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$4,\n extend_: extend_$4,\n decorate_20223_: decorate_20223_$4\n };\n}\nfunction make_$4(adm, key, descriptor) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;\n}\nfunction extend_$4(adm, key, descriptor, proxyTrap) {\n var _this$options_$enhanc, _this$options_;\n assertObservableDescriptor(adm, this, key, descriptor);\n return adm.defineObservableProperty_(key, descriptor.value, (_this$options_$enhanc = (_this$options_ = this.options_) == null ? void 0 : _this$options_.enhancer) != null ? _this$options_$enhanc : deepEnhancer, proxyTrap);\n}\nfunction decorate_20223_$4(desc, context) {\n if (true) {\n if (context.kind === \"field\") {\n throw die(\"Please use `@observable accessor \" + String(context.name) + \"` instead of `@observable \" + String(context.name) + \"`\");\n }\n assert20223DecoratorType(context, [\"accessor\"]);\n }\n var ann = this;\n var kind = context.kind,\n name = context.name;\n // The laziness here is not ideal... It's a workaround to how 2022.3 Decorators are implemented:\n // `addInitializer` callbacks are executed _before_ any accessors are defined (instead of the ideal-for-us right after each).\n // This means that, if we were to do our stuff in an `addInitializer`, we'd attempt to read a private slot\n // before it has been initialized. The runtime doesn't like that and throws a `Cannot read private member\n // from an object whose class did not declare it` error.\n // TODO: it seems that this will not be required anymore in the final version of the spec\n // See TODO: link\n var initializedObjects = new WeakSet();\n function initializeObservable(target, value) {\n var _ann$options_$enhance, _ann$options_;\n var adm = asObservableObject(target)[$mobx];\n var observable = new ObservableValue(value, (_ann$options_$enhance = (_ann$options_ = ann.options_) == null ? void 0 : _ann$options_.enhancer) != null ? _ann$options_$enhance : deepEnhancer, true ? adm.name_ + \".\" + name.toString() : 0, false);\n adm.values_.set(name, observable);\n initializedObjects.add(target);\n }\n if (kind == \"accessor\") {\n return {\n get: function get() {\n if (!initializedObjects.has(this)) {\n initializeObservable(this, desc.get.call(this));\n }\n return this[$mobx].getObservablePropValue_(name);\n },\n set: function set(value) {\n if (!initializedObjects.has(this)) {\n initializeObservable(this, value);\n }\n return this[$mobx].setObservablePropValue_(name, value);\n },\n init: function init(value) {\n if (!initializedObjects.has(this)) {\n initializeObservable(this, value);\n }\n return value;\n }\n };\n }\n return;\n}\nfunction assertObservableDescriptor(adm, _ref, key, descriptor) {\n var annotationType_ = _ref.annotationType_;\n if ( true && !(\"value\" in descriptor)) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' cannot be used on getter/setter properties\"));\n }\n}\n\nvar AUTO = \"true\";\nvar autoAnnotation = /*#__PURE__*/createAutoAnnotation();\nfunction createAutoAnnotation(options) {\n return {\n annotationType_: AUTO,\n options_: options,\n make_: make_$5,\n extend_: extend_$5,\n decorate_20223_: decorate_20223_$5\n };\n}\nfunction make_$5(adm, key, descriptor, source) {\n var _this$options_3, _this$options_4;\n // getter -> computed\n if (descriptor.get) {\n return computed.make_(adm, key, descriptor, source);\n }\n // lone setter -> action setter\n if (descriptor.set) {\n // TODO make action applicable to setter and delegate to action.make_\n var set = createAction(key.toString(), descriptor.set);\n // own\n if (source === adm.target_) {\n return adm.defineProperty_(key, {\n configurable: globalState.safeDescriptors ? adm.isPlainObject_ : true,\n set: set\n }) === null ? 0 /* MakeResult.Cancel */ : 2 /* MakeResult.Continue */;\n }\n // proto\n defineProperty(source, key, {\n configurable: true,\n set: set\n });\n return 2 /* MakeResult.Continue */;\n }\n // function on proto -> autoAction/flow\n if (source !== adm.target_ && typeof descriptor.value === \"function\") {\n var _this$options_2;\n if (isGenerator(descriptor.value)) {\n var _this$options_;\n var flowAnnotation = (_this$options_ = this.options_) != null && _this$options_.autoBind ? flow.bound : flow;\n return flowAnnotation.make_(adm, key, descriptor, source);\n }\n var actionAnnotation = (_this$options_2 = this.options_) != null && _this$options_2.autoBind ? autoAction.bound : autoAction;\n return actionAnnotation.make_(adm, key, descriptor, source);\n }\n // other -> observable\n // Copy props from proto as well, see test:\n // \"decorate should work with Object.create\"\n var observableAnnotation = ((_this$options_3 = this.options_) == null ? void 0 : _this$options_3.deep) === false ? observable.ref : observable;\n // if function respect autoBind option\n if (typeof descriptor.value === \"function\" && (_this$options_4 = this.options_) != null && _this$options_4.autoBind) {\n var _adm$proxy_;\n descriptor.value = descriptor.value.bind((_adm$proxy_ = adm.proxy_) != null ? _adm$proxy_ : adm.target_);\n }\n return observableAnnotation.make_(adm, key, descriptor, source);\n}\nfunction extend_$5(adm, key, descriptor, proxyTrap) {\n var _this$options_5, _this$options_6;\n // getter -> computed\n if (descriptor.get) {\n return computed.extend_(adm, key, descriptor, proxyTrap);\n }\n // lone setter -> action setter\n if (descriptor.set) {\n // TODO make action applicable to setter and delegate to action.extend_\n return adm.defineProperty_(key, {\n configurable: globalState.safeDescriptors ? adm.isPlainObject_ : true,\n set: createAction(key.toString(), descriptor.set)\n }, proxyTrap);\n }\n // other -> observable\n // if function respect autoBind option\n if (typeof descriptor.value === \"function\" && (_this$options_5 = this.options_) != null && _this$options_5.autoBind) {\n var _adm$proxy_2;\n descriptor.value = descriptor.value.bind((_adm$proxy_2 = adm.proxy_) != null ? _adm$proxy_2 : adm.target_);\n }\n var observableAnnotation = ((_this$options_6 = this.options_) == null ? void 0 : _this$options_6.deep) === false ? observable.ref : observable;\n return observableAnnotation.extend_(adm, key, descriptor, proxyTrap);\n}\nfunction decorate_20223_$5(desc, context) {\n die(\"'\" + this.annotationType_ + \"' cannot be used as a decorator\");\n}\n\nvar OBSERVABLE = \"observable\";\nvar OBSERVABLE_REF = \"observable.ref\";\nvar OBSERVABLE_SHALLOW = \"observable.shallow\";\nvar OBSERVABLE_STRUCT = \"observable.struct\";\n// Predefined bags of create observable options, to avoid allocating temporarily option objects\n// in the majority of cases\nvar defaultCreateObservableOptions = {\n deep: true,\n name: undefined,\n defaultDecorator: undefined,\n proxy: true\n};\nObject.freeze(defaultCreateObservableOptions);\nfunction asCreateObservableOptions(thing) {\n return thing || defaultCreateObservableOptions;\n}\nvar observableAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE);\nvar observableRefAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE_REF, {\n enhancer: referenceEnhancer\n});\nvar observableShallowAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE_SHALLOW, {\n enhancer: shallowEnhancer\n});\nvar observableStructAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE_STRUCT, {\n enhancer: refStructEnhancer\n});\nvar observableDecoratorAnnotation = /*#__PURE__*/createDecoratorAnnotation(observableAnnotation);\nfunction getEnhancerFromOptions(options) {\n return options.deep === true ? deepEnhancer : options.deep === false ? referenceEnhancer : getEnhancerFromAnnotation(options.defaultDecorator);\n}\nfunction getAnnotationFromOptions(options) {\n var _options$defaultDecor;\n return options ? (_options$defaultDecor = options.defaultDecorator) != null ? _options$defaultDecor : createAutoAnnotation(options) : undefined;\n}\nfunction getEnhancerFromAnnotation(annotation) {\n var _annotation$options_$, _annotation$options_;\n return !annotation ? deepEnhancer : (_annotation$options_$ = (_annotation$options_ = annotation.options_) == null ? void 0 : _annotation$options_.enhancer) != null ? _annotation$options_$ : deepEnhancer;\n}\n/**\n * Turns an object, array or function into a reactive structure.\n * @param v the value which should become observable.\n */\nfunction createObservable(v, arg2, arg3) {\n // @observable someProp; (2022.3 Decorators)\n if (is20223Decorator(arg2)) {\n return observableAnnotation.decorate_20223_(v, arg2);\n }\n // @observable someProp;\n if (isStringish(arg2)) {\n storeAnnotation(v, arg2, observableAnnotation);\n return;\n }\n // already observable - ignore\n if (isObservable(v)) {\n return v;\n }\n // plain object\n if (isPlainObject(v)) {\n return observable.object(v, arg2, arg3);\n }\n // Array\n if (Array.isArray(v)) {\n return observable.array(v, arg2);\n }\n // Map\n if (isES6Map(v)) {\n return observable.map(v, arg2);\n }\n // Set\n if (isES6Set(v)) {\n return observable.set(v, arg2);\n }\n // other object - ignore\n if (typeof v === \"object\" && v !== null) {\n return v;\n }\n // anything else\n return observable.box(v, arg2);\n}\nassign(createObservable, observableDecoratorAnnotation);\nvar observableFactories = {\n box: function box(value, options) {\n var o = asCreateObservableOptions(options);\n return new ObservableValue(value, getEnhancerFromOptions(o), o.name, true, o.equals);\n },\n array: function array(initialValues, options) {\n var o = asCreateObservableOptions(options);\n return (globalState.useProxies === false || o.proxy === false ? createLegacyArray : createObservableArray)(initialValues, getEnhancerFromOptions(o), o.name);\n },\n map: function map(initialValues, options) {\n var o = asCreateObservableOptions(options);\n return new ObservableMap(initialValues, getEnhancerFromOptions(o), o.name);\n },\n set: function set(initialValues, options) {\n var o = asCreateObservableOptions(options);\n return new ObservableSet(initialValues, getEnhancerFromOptions(o), o.name);\n },\n object: function object(props, decorators, options) {\n return initObservable(function () {\n return extendObservable(globalState.useProxies === false || (options == null ? void 0 : options.proxy) === false ? asObservableObject({}, options) : asDynamicObservableObject({}, options), props, decorators);\n });\n },\n ref: /*#__PURE__*/createDecoratorAnnotation(observableRefAnnotation),\n shallow: /*#__PURE__*/createDecoratorAnnotation(observableShallowAnnotation),\n deep: observableDecoratorAnnotation,\n struct: /*#__PURE__*/createDecoratorAnnotation(observableStructAnnotation)\n};\n// eslint-disable-next-line\nvar observable = /*#__PURE__*/assign(createObservable, observableFactories);\n\nvar COMPUTED = \"computed\";\nvar COMPUTED_STRUCT = \"computed.struct\";\nvar computedAnnotation = /*#__PURE__*/createComputedAnnotation(COMPUTED);\nvar computedStructAnnotation = /*#__PURE__*/createComputedAnnotation(COMPUTED_STRUCT, {\n equals: comparer.structural\n});\n/**\n * Decorator for class properties: @computed get value() { return expr; }.\n * For legacy purposes also invokable as ES5 observable created: `computed(() => expr)`;\n */\nvar computed = function computed(arg1, arg2) {\n if (is20223Decorator(arg2)) {\n // @computed (2022.3 Decorators)\n return computedAnnotation.decorate_20223_(arg1, arg2);\n }\n if (isStringish(arg2)) {\n // @computed\n return storeAnnotation(arg1, arg2, computedAnnotation);\n }\n if (isPlainObject(arg1)) {\n // @computed({ options })\n return createDecoratorAnnotation(createComputedAnnotation(COMPUTED, arg1));\n }\n // computed(expr, options?)\n if (true) {\n if (!isFunction(arg1)) {\n die(\"First argument to `computed` should be an expression.\");\n }\n if (isFunction(arg2)) {\n die(\"A setter as second argument is no longer supported, use `{ set: fn }` option instead\");\n }\n }\n var opts = isPlainObject(arg2) ? arg2 : {};\n opts.get = arg1;\n opts.name || (opts.name = arg1.name || \"\"); /* for generated name */\n return new ComputedValue(opts);\n};\nObject.assign(computed, computedAnnotation);\ncomputed.struct = /*#__PURE__*/createDecoratorAnnotation(computedStructAnnotation);\n\nvar _getDescriptor$config, _getDescriptor;\n// we don't use globalState for these in order to avoid possible issues with multiple\n// mobx versions\nvar currentActionId = 0;\nvar nextActionId = 1;\nvar isFunctionNameConfigurable = (_getDescriptor$config = (_getDescriptor = /*#__PURE__*/getDescriptor(function () {}, \"name\")) == null ? void 0 : _getDescriptor.configurable) != null ? _getDescriptor$config : false;\n// we can safely recycle this object\nvar tmpNameDescriptor = {\n value: \"action\",\n configurable: true,\n writable: false,\n enumerable: false\n};\nfunction createAction(actionName, fn, autoAction, ref) {\n if (autoAction === void 0) {\n autoAction = false;\n }\n if (true) {\n if (!isFunction(fn)) {\n die(\"`action` can only be invoked on functions\");\n }\n if (typeof actionName !== \"string\" || !actionName) {\n die(\"actions should have valid names, got: '\" + actionName + \"'\");\n }\n }\n function res() {\n return executeAction(actionName, autoAction, fn, ref || this, arguments);\n }\n res.isMobxAction = true;\n res.toString = function () {\n return fn.toString();\n };\n if (isFunctionNameConfigurable) {\n tmpNameDescriptor.value = actionName;\n defineProperty(res, \"name\", tmpNameDescriptor);\n }\n return res;\n}\nfunction executeAction(actionName, canRunAsDerivation, fn, scope, args) {\n var runInfo = _startAction(actionName, canRunAsDerivation, scope, args);\n try {\n return fn.apply(scope, args);\n } catch (err) {\n runInfo.error_ = err;\n throw err;\n } finally {\n _endAction(runInfo);\n }\n}\nfunction _startAction(actionName, canRunAsDerivation,\n// true for autoAction\nscope, args) {\n var notifySpy_ = true && isSpyEnabled() && !!actionName;\n var startTime_ = 0;\n if ( true && notifySpy_) {\n startTime_ = Date.now();\n var flattenedArgs = args ? Array.from(args) : EMPTY_ARRAY;\n spyReportStart({\n type: ACTION,\n name: actionName,\n object: scope,\n arguments: flattenedArgs\n });\n }\n var prevDerivation_ = globalState.trackingDerivation;\n var runAsAction = !canRunAsDerivation || !prevDerivation_;\n startBatch();\n var prevAllowStateChanges_ = globalState.allowStateChanges; // by default preserve previous allow\n if (runAsAction) {\n untrackedStart();\n prevAllowStateChanges_ = allowStateChangesStart(true);\n }\n var prevAllowStateReads_ = allowStateReadsStart(true);\n var runInfo = {\n runAsAction_: runAsAction,\n prevDerivation_: prevDerivation_,\n prevAllowStateChanges_: prevAllowStateChanges_,\n prevAllowStateReads_: prevAllowStateReads_,\n notifySpy_: notifySpy_,\n startTime_: startTime_,\n actionId_: nextActionId++,\n parentActionId_: currentActionId\n };\n currentActionId = runInfo.actionId_;\n return runInfo;\n}\nfunction _endAction(runInfo) {\n if (currentActionId !== runInfo.actionId_) {\n die(30);\n }\n currentActionId = runInfo.parentActionId_;\n if (runInfo.error_ !== undefined) {\n globalState.suppressReactionErrors = true;\n }\n allowStateChangesEnd(runInfo.prevAllowStateChanges_);\n allowStateReadsEnd(runInfo.prevAllowStateReads_);\n endBatch();\n if (runInfo.runAsAction_) {\n untrackedEnd(runInfo.prevDerivation_);\n }\n if ( true && runInfo.notifySpy_) {\n spyReportEnd({\n time: Date.now() - runInfo.startTime_\n });\n }\n globalState.suppressReactionErrors = false;\n}\nfunction allowStateChanges(allowStateChanges, func) {\n var prev = allowStateChangesStart(allowStateChanges);\n try {\n return func();\n } finally {\n allowStateChangesEnd(prev);\n }\n}\nfunction allowStateChangesStart(allowStateChanges) {\n var prev = globalState.allowStateChanges;\n globalState.allowStateChanges = allowStateChanges;\n return prev;\n}\nfunction allowStateChangesEnd(prev) {\n globalState.allowStateChanges = prev;\n}\n\nvar CREATE = \"create\";\nvar ObservableValue = /*#__PURE__*/function (_Atom) {\n function ObservableValue(value, enhancer, name_, notifySpy, equals) {\n var _this;\n if (name_ === void 0) {\n name_ = true ? \"ObservableValue@\" + getNextId() : 0;\n }\n if (notifySpy === void 0) {\n notifySpy = true;\n }\n if (equals === void 0) {\n equals = comparer[\"default\"];\n }\n _this = _Atom.call(this, name_) || this;\n _this.enhancer = void 0;\n _this.name_ = void 0;\n _this.equals = void 0;\n _this.hasUnreportedChange_ = false;\n _this.interceptors_ = void 0;\n _this.changeListeners_ = void 0;\n _this.value_ = void 0;\n _this.dehancer = void 0;\n _this.enhancer = enhancer;\n _this.name_ = name_;\n _this.equals = equals;\n _this.value_ = enhancer(value, undefined, name_);\n if ( true && notifySpy && isSpyEnabled()) {\n // only notify spy if this is a stand-alone observable\n spyReport({\n type: CREATE,\n object: _this,\n observableKind: \"value\",\n debugObjectName: _this.name_,\n newValue: \"\" + _this.value_\n });\n }\n return _this;\n }\n _inheritsLoose(ObservableValue, _Atom);\n var _proto = ObservableValue.prototype;\n _proto.dehanceValue = function dehanceValue(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.set = function set(newValue) {\n var oldValue = this.value_;\n newValue = this.prepareNewValue_(newValue);\n if (newValue !== globalState.UNCHANGED) {\n var notifySpy = isSpyEnabled();\n if ( true && notifySpy) {\n spyReportStart({\n type: UPDATE,\n object: this,\n observableKind: \"value\",\n debugObjectName: this.name_,\n newValue: newValue,\n oldValue: oldValue\n });\n }\n this.setNewValue_(newValue);\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n };\n _proto.prepareNewValue_ = function prepareNewValue_(newValue) {\n checkIfStateModificationsAreAllowed(this);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this,\n type: UPDATE,\n newValue: newValue\n });\n if (!change) {\n return globalState.UNCHANGED;\n }\n newValue = change.newValue;\n }\n // apply modifier\n newValue = this.enhancer(newValue, this.value_, this.name_);\n return this.equals(this.value_, newValue) ? globalState.UNCHANGED : newValue;\n };\n _proto.setNewValue_ = function setNewValue_(newValue) {\n var oldValue = this.value_;\n this.value_ = newValue;\n this.reportChanged();\n if (hasListeners(this)) {\n notifyListeners(this, {\n type: UPDATE,\n object: this,\n newValue: newValue,\n oldValue: oldValue\n });\n }\n };\n _proto.get = function get() {\n this.reportObserved();\n return this.dehanceValue(this.value_);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n if (fireImmediately) {\n listener({\n observableKind: \"value\",\n debugObjectName: this.name_,\n object: this,\n type: UPDATE,\n newValue: this.value_,\n oldValue: undefined\n });\n }\n return registerListener(this, listener);\n };\n _proto.raw = function raw() {\n // used by MST ot get undehanced value\n return this.value_;\n };\n _proto.toJSON = function toJSON() {\n return this.get();\n };\n _proto.toString = function toString() {\n return this.name_ + \"[\" + this.value_ + \"]\";\n };\n _proto.valueOf = function valueOf() {\n return toPrimitive(this.get());\n };\n _proto[Symbol.toPrimitive] = function () {\n return this.valueOf();\n };\n return ObservableValue;\n}(Atom);\nvar isObservableValue = /*#__PURE__*/createInstanceofPredicate(\"ObservableValue\", ObservableValue);\n\n/**\n * A node in the state dependency root that observes other nodes, and can be observed itself.\n *\n * ComputedValue will remember the result of the computation for the duration of the batch, or\n * while being observed.\n *\n * During this time it will recompute only when one of its direct dependencies changed,\n * but only when it is being accessed with `ComputedValue.get()`.\n *\n * Implementation description:\n * 1. First time it's being accessed it will compute and remember result\n * give back remembered result until 2. happens\n * 2. First time any deep dependency change, propagate POSSIBLY_STALE to all observers, wait for 3.\n * 3. When it's being accessed, recompute if any shallow dependency changed.\n * if result changed: propagate STALE to all observers, that were POSSIBLY_STALE from the last step.\n * go to step 2. either way\n *\n * If at any point it's outside batch and it isn't observed: reset everything and go to 1.\n */\nvar ComputedValue = /*#__PURE__*/function () {\n /**\n * Create a new computed value based on a function expression.\n *\n * The `name` property is for debug purposes only.\n *\n * The `equals` property specifies the comparer function to use to determine if a newly produced\n * value differs from the previous value. Two comparers are provided in the library; `defaultComparer`\n * compares based on identity comparison (===), and `structuralComparer` deeply compares the structure.\n * Structural comparison can be convenient if you always produce a new aggregated object and\n * don't want to notify observers if it is structurally the same.\n * This is useful for working with vectors, mouse coordinates etc.\n */\n function ComputedValue(options) {\n this.dependenciesState_ = IDerivationState_.NOT_TRACKING_;\n this.observing_ = [];\n // nodes we are looking at. Our value depends on these nodes\n this.newObserving_ = null;\n // during tracking it's an array with new observed observers\n this.observers_ = new Set();\n this.runId_ = 0;\n this.lastAccessedBy_ = 0;\n this.lowestObserverState_ = IDerivationState_.UP_TO_DATE_;\n this.unboundDepsCount_ = 0;\n this.value_ = new CaughtException(null);\n this.name_ = void 0;\n this.triggeredBy_ = void 0;\n this.flags_ = 0;\n this.derivation = void 0;\n // N.B: unminified as it is used by MST\n this.setter_ = void 0;\n this.isTracing_ = TraceMode.NONE;\n this.scope_ = void 0;\n this.equals_ = void 0;\n this.requiresReaction_ = void 0;\n this.keepAlive_ = void 0;\n this.onBOL = void 0;\n this.onBUOL = void 0;\n if (!options.get) {\n die(31);\n }\n this.derivation = options.get;\n this.name_ = options.name || ( true ? \"ComputedValue@\" + getNextId() : 0);\n if (options.set) {\n this.setter_ = createAction( true ? this.name_ + \"-setter\" : 0, options.set);\n }\n this.equals_ = options.equals || (options.compareStructural || options.struct ? comparer.structural : comparer[\"default\"]);\n this.scope_ = options.context;\n this.requiresReaction_ = options.requiresReaction;\n this.keepAlive_ = !!options.keepAlive;\n }\n var _proto = ComputedValue.prototype;\n _proto.onBecomeStale_ = function onBecomeStale_() {\n propagateMaybeChanged(this);\n };\n _proto.onBO = function onBO() {\n if (this.onBOL) {\n this.onBOL.forEach(function (listener) {\n return listener();\n });\n }\n };\n _proto.onBUO = function onBUO() {\n if (this.onBUOL) {\n this.onBUOL.forEach(function (listener) {\n return listener();\n });\n }\n }\n // to check for cycles\n ;\n /**\n * Returns the current value of this computed value.\n * Will evaluate its computation first if needed.\n */\n _proto.get = function get() {\n if (this.isComputing) {\n die(32, this.name_, this.derivation);\n }\n if (globalState.inBatch === 0 &&\n // !globalState.trackingDerivatpion &&\n this.observers_.size === 0 && !this.keepAlive_) {\n if (shouldCompute(this)) {\n this.warnAboutUntrackedRead_();\n startBatch(); // See perf test 'computed memoization'\n this.value_ = this.computeValue_(false);\n endBatch();\n }\n } else {\n reportObserved(this);\n if (shouldCompute(this)) {\n var prevTrackingContext = globalState.trackingContext;\n if (this.keepAlive_ && !prevTrackingContext) {\n globalState.trackingContext = this;\n }\n if (this.trackAndCompute()) {\n propagateChangeConfirmed(this);\n }\n globalState.trackingContext = prevTrackingContext;\n }\n }\n var result = this.value_;\n if (isCaughtException(result)) {\n throw result.cause;\n }\n return result;\n };\n _proto.set = function set(value) {\n if (this.setter_) {\n if (this.isRunningSetter) {\n die(33, this.name_);\n }\n this.isRunningSetter = true;\n try {\n this.setter_.call(this.scope_, value);\n } finally {\n this.isRunningSetter = false;\n }\n } else {\n die(34, this.name_);\n }\n };\n _proto.trackAndCompute = function trackAndCompute() {\n // N.B: unminified as it is used by MST\n var oldValue = this.value_;\n var wasSuspended = /* see #1208 */this.dependenciesState_ === IDerivationState_.NOT_TRACKING_;\n var newValue = this.computeValue_(true);\n var changed = wasSuspended || isCaughtException(oldValue) || isCaughtException(newValue) || !this.equals_(oldValue, newValue);\n if (changed) {\n this.value_ = newValue;\n if ( true && isSpyEnabled()) {\n spyReport({\n observableKind: \"computed\",\n debugObjectName: this.name_,\n object: this.scope_,\n type: \"update\",\n oldValue: oldValue,\n newValue: newValue\n });\n }\n }\n return changed;\n };\n _proto.computeValue_ = function computeValue_(track) {\n this.isComputing = true;\n // don't allow state changes during computation\n var prev = allowStateChangesStart(false);\n var res;\n if (track) {\n res = trackDerivedFunction(this, this.derivation, this.scope_);\n } else {\n if (globalState.disableErrorBoundaries === true) {\n res = this.derivation.call(this.scope_);\n } else {\n try {\n res = this.derivation.call(this.scope_);\n } catch (e) {\n res = new CaughtException(e);\n }\n }\n }\n allowStateChangesEnd(prev);\n this.isComputing = false;\n return res;\n };\n _proto.suspend_ = function suspend_() {\n if (!this.keepAlive_) {\n clearObserving(this);\n this.value_ = undefined; // don't hold on to computed value!\n if ( true && this.isTracing_ !== TraceMode.NONE) {\n console.log(\"[mobx.trace] Computed value '\" + this.name_ + \"' was suspended and it will recompute on the next access.\");\n }\n }\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n var _this = this;\n var firstTime = true;\n var prevValue = undefined;\n return autorun(function () {\n // TODO: why is this in a different place than the spyReport() function? in all other observables it's called in the same place\n var newValue = _this.get();\n if (!firstTime || fireImmediately) {\n var prevU = untrackedStart();\n listener({\n observableKind: \"computed\",\n debugObjectName: _this.name_,\n type: UPDATE,\n object: _this,\n newValue: newValue,\n oldValue: prevValue\n });\n untrackedEnd(prevU);\n }\n firstTime = false;\n prevValue = newValue;\n });\n };\n _proto.warnAboutUntrackedRead_ = function warnAboutUntrackedRead_() {\n if (false) {}\n if (this.isTracing_ !== TraceMode.NONE) {\n console.log(\"[mobx.trace] Computed value '\" + this.name_ + \"' is being read outside a reactive context. Doing a full recompute.\");\n }\n if (typeof this.requiresReaction_ === \"boolean\" ? this.requiresReaction_ : globalState.computedRequiresReaction) {\n console.warn(\"[mobx] Computed value '\" + this.name_ + \"' is being read outside a reactive context. Doing a full recompute.\");\n }\n };\n _proto.toString = function toString() {\n return this.name_ + \"[\" + this.derivation.toString() + \"]\";\n };\n _proto.valueOf = function valueOf() {\n return toPrimitive(this.get());\n };\n _proto[Symbol.toPrimitive] = function () {\n return this.valueOf();\n };\n return _createClass(ComputedValue, [{\n key: \"isComputing\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isComputingMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isComputingMask_, newValue);\n }\n }, {\n key: \"isRunningSetter\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isRunningSetterMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isRunningSetterMask_, newValue);\n }\n }, {\n key: \"isBeingObserved\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isBeingObservedMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isBeingObservedMask_, newValue);\n }\n }, {\n key: \"isPendingUnobservation\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isPendingUnobservationMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isPendingUnobservationMask_, newValue);\n }\n }, {\n key: \"diffValue\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.diffValueMask_) ? 1 : 0;\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.diffValueMask_, newValue === 1 ? true : false);\n }\n }]);\n}();\nComputedValue.isComputingMask_ = 1;\nComputedValue.isRunningSetterMask_ = 2;\nComputedValue.isBeingObservedMask_ = 4;\nComputedValue.isPendingUnobservationMask_ = 8;\nComputedValue.diffValueMask_ = 16;\nvar isComputedValue = /*#__PURE__*/createInstanceofPredicate(\"ComputedValue\", ComputedValue);\n\nvar IDerivationState_;\n(function (IDerivationState_) {\n // before being run or (outside batch and not being observed)\n // at this point derivation is not holding any data about dependency tree\n IDerivationState_[IDerivationState_[\"NOT_TRACKING_\"] = -1] = \"NOT_TRACKING_\";\n // no shallow dependency changed since last computation\n // won't recalculate derivation\n // this is what makes mobx fast\n IDerivationState_[IDerivationState_[\"UP_TO_DATE_\"] = 0] = \"UP_TO_DATE_\";\n // some deep dependency changed, but don't know if shallow dependency changed\n // will require to check first if UP_TO_DATE or POSSIBLY_STALE\n // currently only ComputedValue will propagate POSSIBLY_STALE\n //\n // having this state is second big optimization:\n // don't have to recompute on every dependency change, but only when it's needed\n IDerivationState_[IDerivationState_[\"POSSIBLY_STALE_\"] = 1] = \"POSSIBLY_STALE_\";\n // A shallow dependency has changed since last computation and the derivation\n // will need to recompute when it's needed next.\n IDerivationState_[IDerivationState_[\"STALE_\"] = 2] = \"STALE_\";\n})(IDerivationState_ || (IDerivationState_ = {}));\nvar TraceMode;\n(function (TraceMode) {\n TraceMode[TraceMode[\"NONE\"] = 0] = \"NONE\";\n TraceMode[TraceMode[\"LOG\"] = 1] = \"LOG\";\n TraceMode[TraceMode[\"BREAK\"] = 2] = \"BREAK\";\n})(TraceMode || (TraceMode = {}));\nvar CaughtException = function CaughtException(cause) {\n this.cause = void 0;\n this.cause = cause;\n // Empty\n};\nfunction isCaughtException(e) {\n return e instanceof CaughtException;\n}\n/**\n * Finds out whether any dependency of the derivation has actually changed.\n * If dependenciesState is 1 then it will recalculate dependencies,\n * if any dependency changed it will propagate it by changing dependenciesState to 2.\n *\n * By iterating over the dependencies in the same order that they were reported and\n * stopping on the first change, all the recalculations are only called for ComputedValues\n * that will be tracked by derivation. That is because we assume that if the first x\n * dependencies of the derivation doesn't change then the derivation should run the same way\n * up until accessing x-th dependency.\n */\nfunction shouldCompute(derivation) {\n switch (derivation.dependenciesState_) {\n case IDerivationState_.UP_TO_DATE_:\n return false;\n case IDerivationState_.NOT_TRACKING_:\n case IDerivationState_.STALE_:\n return true;\n case IDerivationState_.POSSIBLY_STALE_:\n {\n // state propagation can occur outside of action/reactive context #2195\n var prevAllowStateReads = allowStateReadsStart(true);\n var prevUntracked = untrackedStart(); // no need for those computeds to be reported, they will be picked up in trackDerivedFunction.\n var obs = derivation.observing_,\n l = obs.length;\n for (var i = 0; i < l; i++) {\n var obj = obs[i];\n if (isComputedValue(obj)) {\n if (globalState.disableErrorBoundaries) {\n obj.get();\n } else {\n try {\n obj.get();\n } catch (e) {\n // we are not interested in the value *or* exception at this moment, but if there is one, notify all\n untrackedEnd(prevUntracked);\n allowStateReadsEnd(prevAllowStateReads);\n return true;\n }\n }\n // if ComputedValue `obj` actually changed it will be computed and propagated to its observers.\n // and `derivation` is an observer of `obj`\n // invariantShouldCompute(derivation)\n if (derivation.dependenciesState_ === IDerivationState_.STALE_) {\n untrackedEnd(prevUntracked);\n allowStateReadsEnd(prevAllowStateReads);\n return true;\n }\n }\n }\n changeDependenciesStateTo0(derivation);\n untrackedEnd(prevUntracked);\n allowStateReadsEnd(prevAllowStateReads);\n return false;\n }\n }\n}\nfunction isComputingDerivation() {\n return globalState.trackingDerivation !== null; // filter out actions inside computations\n}\nfunction checkIfStateModificationsAreAllowed(atom) {\n if (false) {}\n var hasObservers = atom.observers_.size > 0;\n // Should not be possible to change observed state outside strict mode, except during initialization, see #563\n if (!globalState.allowStateChanges && (hasObservers || globalState.enforceActions === \"always\")) {\n console.warn(\"[MobX] \" + (globalState.enforceActions ? \"Since strict-mode is enabled, changing (observed) observable values without using an action is not allowed. Tried to modify: \" : \"Side effects like changing state are not allowed at this point. Are you trying to modify state from, for example, a computed value or the render function of a React component? You can wrap side effects in 'runInAction' (or decorate functions with 'action') if needed. Tried to modify: \") + atom.name_);\n }\n}\nfunction checkIfStateReadsAreAllowed(observable) {\n if ( true && !globalState.allowStateReads && globalState.observableRequiresReaction) {\n console.warn(\"[mobx] Observable '\" + observable.name_ + \"' being read outside a reactive context.\");\n }\n}\n/**\n * Executes the provided function `f` and tracks which observables are being accessed.\n * The tracking information is stored on the `derivation` object and the derivation is registered\n * as observer of any of the accessed observables.\n */\nfunction trackDerivedFunction(derivation, f, context) {\n var prevAllowStateReads = allowStateReadsStart(true);\n changeDependenciesStateTo0(derivation);\n // Preallocate array; will be trimmed by bindDependencies.\n derivation.newObserving_ = new Array(\n // Reserve constant space for initial dependencies, dynamic space otherwise.\n // See https://github.com/mobxjs/mobx/pull/3833\n derivation.runId_ === 0 ? 100 : derivation.observing_.length);\n derivation.unboundDepsCount_ = 0;\n derivation.runId_ = ++globalState.runId;\n var prevTracking = globalState.trackingDerivation;\n globalState.trackingDerivation = derivation;\n globalState.inBatch++;\n var result;\n if (globalState.disableErrorBoundaries === true) {\n result = f.call(context);\n } else {\n try {\n result = f.call(context);\n } catch (e) {\n result = new CaughtException(e);\n }\n }\n globalState.inBatch--;\n globalState.trackingDerivation = prevTracking;\n bindDependencies(derivation);\n warnAboutDerivationWithoutDependencies(derivation);\n allowStateReadsEnd(prevAllowStateReads);\n return result;\n}\nfunction warnAboutDerivationWithoutDependencies(derivation) {\n if (false) {}\n if (derivation.observing_.length !== 0) {\n return;\n }\n if (typeof derivation.requiresObservable_ === \"boolean\" ? derivation.requiresObservable_ : globalState.reactionRequiresObservable) {\n console.warn(\"[mobx] Derivation '\" + derivation.name_ + \"' is created/updated without reading any observable value.\");\n }\n}\n/**\n * diffs newObserving with observing.\n * update observing to be newObserving with unique observables\n * notify observers that become observed/unobserved\n */\nfunction bindDependencies(derivation) {\n // invariant(derivation.dependenciesState !== IDerivationState.NOT_TRACKING, \"INTERNAL ERROR bindDependencies expects derivation.dependenciesState !== -1\");\n var prevObserving = derivation.observing_;\n var observing = derivation.observing_ = derivation.newObserving_;\n var lowestNewObservingDerivationState = IDerivationState_.UP_TO_DATE_;\n // Go through all new observables and check diffValue: (this list can contain duplicates):\n // 0: first occurrence, change to 1 and keep it\n // 1: extra occurrence, drop it\n var i0 = 0,\n l = derivation.unboundDepsCount_;\n for (var i = 0; i < l; i++) {\n var dep = observing[i];\n if (dep.diffValue === 0) {\n dep.diffValue = 1;\n if (i0 !== i) {\n observing[i0] = dep;\n }\n i0++;\n }\n // Upcast is 'safe' here, because if dep is IObservable, `dependenciesState` will be undefined,\n // not hitting the condition\n if (dep.dependenciesState_ > lowestNewObservingDerivationState) {\n lowestNewObservingDerivationState = dep.dependenciesState_;\n }\n }\n observing.length = i0;\n derivation.newObserving_ = null; // newObserving shouldn't be needed outside tracking (statement moved down to work around FF bug, see #614)\n // Go through all old observables and check diffValue: (it is unique after last bindDependencies)\n // 0: it's not in new observables, unobserve it\n // 1: it keeps being observed, don't want to notify it. change to 0\n l = prevObserving.length;\n while (l--) {\n var _dep = prevObserving[l];\n if (_dep.diffValue === 0) {\n removeObserver(_dep, derivation);\n }\n _dep.diffValue = 0;\n }\n // Go through all new observables and check diffValue: (now it should be unique)\n // 0: it was set to 0 in last loop. don't need to do anything.\n // 1: it wasn't observed, let's observe it. set back to 0\n while (i0--) {\n var _dep2 = observing[i0];\n if (_dep2.diffValue === 1) {\n _dep2.diffValue = 0;\n addObserver(_dep2, derivation);\n }\n }\n // Some new observed derivations may become stale during this derivation computation\n // so they have had no chance to propagate staleness (#916)\n if (lowestNewObservingDerivationState !== IDerivationState_.UP_TO_DATE_) {\n derivation.dependenciesState_ = lowestNewObservingDerivationState;\n derivation.onBecomeStale_();\n }\n}\nfunction clearObserving(derivation) {\n // invariant(globalState.inBatch > 0, \"INTERNAL ERROR clearObserving should be called only inside batch\");\n var obs = derivation.observing_;\n derivation.observing_ = [];\n var i = obs.length;\n while (i--) {\n removeObserver(obs[i], derivation);\n }\n derivation.dependenciesState_ = IDerivationState_.NOT_TRACKING_;\n}\nfunction untracked(action) {\n var prev = untrackedStart();\n try {\n return action();\n } finally {\n untrackedEnd(prev);\n }\n}\nfunction untrackedStart() {\n var prev = globalState.trackingDerivation;\n globalState.trackingDerivation = null;\n return prev;\n}\nfunction untrackedEnd(prev) {\n globalState.trackingDerivation = prev;\n}\nfunction allowStateReadsStart(allowStateReads) {\n var prev = globalState.allowStateReads;\n globalState.allowStateReads = allowStateReads;\n return prev;\n}\nfunction allowStateReadsEnd(prev) {\n globalState.allowStateReads = prev;\n}\n/**\n * needed to keep `lowestObserverState` correct. when changing from (2 or 1) to 0\n *\n */\nfunction changeDependenciesStateTo0(derivation) {\n if (derivation.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {\n return;\n }\n derivation.dependenciesState_ = IDerivationState_.UP_TO_DATE_;\n var obs = derivation.observing_;\n var i = obs.length;\n while (i--) {\n obs[i].lowestObserverState_ = IDerivationState_.UP_TO_DATE_;\n }\n}\n\n/**\n * These values will persist if global state is reset\n */\nvar persistentKeys = [\"mobxGuid\", \"spyListeners\", \"enforceActions\", \"computedRequiresReaction\", \"reactionRequiresObservable\", \"observableRequiresReaction\", \"allowStateReads\", \"disableErrorBoundaries\", \"runId\", \"UNCHANGED\", \"useProxies\"];\nvar MobXGlobals = function MobXGlobals() {\n /**\n * MobXGlobals version.\n * MobX compatiblity with other versions loaded in memory as long as this version matches.\n * It indicates that the global state still stores similar information\n *\n * N.B: this version is unrelated to the package version of MobX, and is only the version of the\n * internal state storage of MobX, and can be the same across many different package versions\n */\n this.version = 6;\n /**\n * globally unique token to signal unchanged\n */\n this.UNCHANGED = {};\n /**\n * Currently running derivation\n */\n this.trackingDerivation = null;\n /**\n * Currently running reaction. This determines if we currently have a reactive context.\n * (Tracking derivation is also set for temporal tracking of computed values inside actions,\n * but trackingReaction can only be set by a form of Reaction)\n */\n this.trackingContext = null;\n /**\n * Each time a derivation is tracked, it is assigned a unique run-id\n */\n this.runId = 0;\n /**\n * 'guid' for general purpose. Will be persisted amongst resets.\n */\n this.mobxGuid = 0;\n /**\n * Are we in a batch block? (and how many of them)\n */\n this.inBatch = 0;\n /**\n * Observables that don't have observers anymore, and are about to be\n * suspended, unless somebody else accesses it in the same batch\n *\n * @type {IObservable[]}\n */\n this.pendingUnobservations = [];\n /**\n * List of scheduled, not yet executed, reactions.\n */\n this.pendingReactions = [];\n /**\n * Are we currently processing reactions?\n */\n this.isRunningReactions = false;\n /**\n * Is it allowed to change observables at this point?\n * In general, MobX doesn't allow that when running computations and React.render.\n * To ensure that those functions stay pure.\n */\n this.allowStateChanges = false;\n /**\n * Is it allowed to read observables at this point?\n * Used to hold the state needed for `observableRequiresReaction`\n */\n this.allowStateReads = true;\n /**\n * If strict mode is enabled, state changes are by default not allowed\n */\n this.enforceActions = true;\n /**\n * Spy callbacks\n */\n this.spyListeners = [];\n /**\n * Globally attached error handlers that react specifically to errors in reactions\n */\n this.globalReactionErrorHandlers = [];\n /**\n * Warn if computed values are accessed outside a reactive context\n */\n this.computedRequiresReaction = false;\n /**\n * (Experimental)\n * Warn if you try to create to derivation / reactive context without accessing any observable.\n */\n this.reactionRequiresObservable = false;\n /**\n * (Experimental)\n * Warn if observables are accessed outside a reactive context\n */\n this.observableRequiresReaction = false;\n /*\n * Don't catch and rethrow exceptions. This is useful for inspecting the state of\n * the stack when an exception occurs while debugging.\n */\n this.disableErrorBoundaries = false;\n /*\n * If true, we are already handling an exception in an action. Any errors in reactions should be suppressed, as\n * they are not the cause, see: https://github.com/mobxjs/mobx/issues/1836\n */\n this.suppressReactionErrors = false;\n this.useProxies = true;\n /*\n * print warnings about code that would fail if proxies weren't available\n */\n this.verifyProxies = false;\n /**\n * False forces all object's descriptors to\n * writable: true\n * configurable: true\n */\n this.safeDescriptors = true;\n};\nvar canMergeGlobalState = true;\nvar isolateCalled = false;\nvar globalState = /*#__PURE__*/function () {\n var global = /*#__PURE__*/getGlobal();\n if (global.__mobxInstanceCount > 0 && !global.__mobxGlobals) {\n canMergeGlobalState = false;\n }\n if (global.__mobxGlobals && global.__mobxGlobals.version !== new MobXGlobals().version) {\n canMergeGlobalState = false;\n }\n if (!canMergeGlobalState) {\n // Because this is a IIFE we need to let isolateCalled a chance to change\n // so we run it after the event loop completed at least 1 iteration\n setTimeout(function () {\n if (!isolateCalled) {\n die(35);\n }\n }, 1);\n return new MobXGlobals();\n } else if (global.__mobxGlobals) {\n global.__mobxInstanceCount += 1;\n if (!global.__mobxGlobals.UNCHANGED) {\n global.__mobxGlobals.UNCHANGED = {};\n } // make merge backward compatible\n return global.__mobxGlobals;\n } else {\n global.__mobxInstanceCount = 1;\n return global.__mobxGlobals = /*#__PURE__*/new MobXGlobals();\n }\n}();\nfunction isolateGlobalState() {\n if (globalState.pendingReactions.length || globalState.inBatch || globalState.isRunningReactions) {\n die(36);\n }\n isolateCalled = true;\n if (canMergeGlobalState) {\n var global = getGlobal();\n if (--global.__mobxInstanceCount === 0) {\n global.__mobxGlobals = undefined;\n }\n globalState = new MobXGlobals();\n }\n}\nfunction getGlobalState() {\n return globalState;\n}\n/**\n * For testing purposes only; this will break the internal state of existing observables,\n * but can be used to get back at a stable state after throwing errors\n */\nfunction resetGlobalState() {\n var defaultGlobals = new MobXGlobals();\n for (var key in defaultGlobals) {\n if (persistentKeys.indexOf(key) === -1) {\n globalState[key] = defaultGlobals[key];\n }\n }\n globalState.allowStateChanges = !globalState.enforceActions;\n}\n\nfunction hasObservers(observable) {\n return observable.observers_ && observable.observers_.size > 0;\n}\nfunction getObservers(observable) {\n return observable.observers_;\n}\n// function invariantObservers(observable: IObservable) {\n// const list = observable.observers\n// const map = observable.observersIndexes\n// const l = list.length\n// for (let i = 0; i < l; i++) {\n// const id = list[i].__mapid\n// if (i) {\n// invariant(map[id] === i, \"INTERNAL ERROR maps derivation.__mapid to index in list\") // for performance\n// } else {\n// invariant(!(id in map), \"INTERNAL ERROR observer on index 0 shouldn't be held in map.\") // for performance\n// }\n// }\n// invariant(\n// list.length === 0 || Object.keys(map).length === list.length - 1,\n// \"INTERNAL ERROR there is no junk in map\"\n// )\n// }\nfunction addObserver(observable, node) {\n // invariant(node.dependenciesState !== -1, \"INTERNAL ERROR, can add only dependenciesState !== -1\");\n // invariant(observable._observers.indexOf(node) === -1, \"INTERNAL ERROR add already added node\");\n // invariantObservers(observable);\n observable.observers_.add(node);\n if (observable.lowestObserverState_ > node.dependenciesState_) {\n observable.lowestObserverState_ = node.dependenciesState_;\n }\n // invariantObservers(observable);\n // invariant(observable._observers.indexOf(node) !== -1, \"INTERNAL ERROR didn't add node\");\n}\nfunction removeObserver(observable, node) {\n // invariant(globalState.inBatch > 0, \"INTERNAL ERROR, remove should be called only inside batch\");\n // invariant(observable._observers.indexOf(node) !== -1, \"INTERNAL ERROR remove already removed node\");\n // invariantObservers(observable);\n observable.observers_[\"delete\"](node);\n if (observable.observers_.size === 0) {\n // deleting last observer\n queueForUnobservation(observable);\n }\n // invariantObservers(observable);\n // invariant(observable._observers.indexOf(node) === -1, \"INTERNAL ERROR remove already removed node2\");\n}\nfunction queueForUnobservation(observable) {\n if (observable.isPendingUnobservation === false) {\n // invariant(observable._observers.length === 0, \"INTERNAL ERROR, should only queue for unobservation unobserved observables\");\n observable.isPendingUnobservation = true;\n globalState.pendingUnobservations.push(observable);\n }\n}\n/**\n * Batch starts a transaction, at least for purposes of memoizing ComputedValues when nothing else does.\n * During a batch `onBecomeUnobserved` will be called at most once per observable.\n * Avoids unnecessary recalculations.\n */\nfunction startBatch() {\n globalState.inBatch++;\n}\nfunction endBatch() {\n if (--globalState.inBatch === 0) {\n runReactions();\n // the batch is actually about to finish, all unobserving should happen here.\n var list = globalState.pendingUnobservations;\n for (var i = 0; i < list.length; i++) {\n var observable = list[i];\n observable.isPendingUnobservation = false;\n if (observable.observers_.size === 0) {\n if (observable.isBeingObserved) {\n // if this observable had reactive observers, trigger the hooks\n observable.isBeingObserved = false;\n observable.onBUO();\n }\n if (observable instanceof ComputedValue) {\n // computed values are automatically teared down when the last observer leaves\n // this process happens recursively, this computed might be the last observabe of another, etc..\n observable.suspend_();\n }\n }\n }\n globalState.pendingUnobservations = [];\n }\n}\nfunction reportObserved(observable) {\n checkIfStateReadsAreAllowed(observable);\n var derivation = globalState.trackingDerivation;\n if (derivation !== null) {\n /**\n * Simple optimization, give each derivation run an unique id (runId)\n * Check if last time this observable was accessed the same runId is used\n * if this is the case, the relation is already known\n */\n if (derivation.runId_ !== observable.lastAccessedBy_) {\n observable.lastAccessedBy_ = derivation.runId_;\n // Tried storing newObserving, or observing, or both as Set, but performance didn't come close...\n derivation.newObserving_[derivation.unboundDepsCount_++] = observable;\n if (!observable.isBeingObserved && globalState.trackingContext) {\n observable.isBeingObserved = true;\n observable.onBO();\n }\n }\n return observable.isBeingObserved;\n } else if (observable.observers_.size === 0 && globalState.inBatch > 0) {\n queueForUnobservation(observable);\n }\n return false;\n}\n// function invariantLOS(observable: IObservable, msg: string) {\n// // it's expensive so better not run it in produciton. but temporarily helpful for testing\n// const min = getObservers(observable).reduce((a, b) => Math.min(a, b.dependenciesState), 2)\n// if (min >= observable.lowestObserverState) return // <- the only assumption about `lowestObserverState`\n// throw new Error(\n// \"lowestObserverState is wrong for \" +\n// msg +\n// \" because \" +\n// min +\n// \" < \" +\n// observable.lowestObserverState\n// )\n// }\n/**\n * NOTE: current propagation mechanism will in case of self reruning autoruns behave unexpectedly\n * It will propagate changes to observers from previous run\n * It's hard or maybe impossible (with reasonable perf) to get it right with current approach\n * Hopefully self reruning autoruns aren't a feature people should depend on\n * Also most basic use cases should be ok\n */\n// Called by Atom when its value changes\nfunction propagateChanged(observable) {\n // invariantLOS(observable, \"changed start\");\n if (observable.lowestObserverState_ === IDerivationState_.STALE_) {\n return;\n }\n observable.lowestObserverState_ = IDerivationState_.STALE_;\n // Ideally we use for..of here, but the downcompiled version is really slow...\n observable.observers_.forEach(function (d) {\n if (d.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {\n if ( true && d.isTracing_ !== TraceMode.NONE) {\n logTraceInfo(d, observable);\n }\n d.onBecomeStale_();\n }\n d.dependenciesState_ = IDerivationState_.STALE_;\n });\n // invariantLOS(observable, \"changed end\");\n}\n// Called by ComputedValue when it recalculate and its value changed\nfunction propagateChangeConfirmed(observable) {\n // invariantLOS(observable, \"confirmed start\");\n if (observable.lowestObserverState_ === IDerivationState_.STALE_) {\n return;\n }\n observable.lowestObserverState_ = IDerivationState_.STALE_;\n observable.observers_.forEach(function (d) {\n if (d.dependenciesState_ === IDerivationState_.POSSIBLY_STALE_) {\n d.dependenciesState_ = IDerivationState_.STALE_;\n if ( true && d.isTracing_ !== TraceMode.NONE) {\n logTraceInfo(d, observable);\n }\n } else if (d.dependenciesState_ === IDerivationState_.UP_TO_DATE_ // this happens during computing of `d`, just keep lowestObserverState up to date.\n ) {\n observable.lowestObserverState_ = IDerivationState_.UP_TO_DATE_;\n }\n });\n // invariantLOS(observable, \"confirmed end\");\n}\n// Used by computed when its dependency changed, but we don't wan't to immediately recompute.\nfunction propagateMaybeChanged(observable) {\n // invariantLOS(observable, \"maybe start\");\n if (observable.lowestObserverState_ !== IDerivationState_.UP_TO_DATE_) {\n return;\n }\n observable.lowestObserverState_ = IDerivationState_.POSSIBLY_STALE_;\n observable.observers_.forEach(function (d) {\n if (d.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {\n d.dependenciesState_ = IDerivationState_.POSSIBLY_STALE_;\n d.onBecomeStale_();\n }\n });\n // invariantLOS(observable, \"maybe end\");\n}\nfunction logTraceInfo(derivation, observable) {\n console.log(\"[mobx.trace] '\" + derivation.name_ + \"' is invalidated due to a change in: '\" + observable.name_ + \"'\");\n if (derivation.isTracing_ === TraceMode.BREAK) {\n var lines = [];\n printDepTree(getDependencyTree(derivation), lines, 1);\n // prettier-ignore\n new Function(\"debugger;\\n/*\\nTracing '\" + derivation.name_ + \"'\\n\\nYou are entering this break point because derivation '\" + derivation.name_ + \"' is being traced and '\" + observable.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\" + (derivation instanceof ComputedValue ? derivation.derivation.toString().replace(/[*]\\//g, \"/\") : \"\") + \"\\n\\nThe dependencies for this derivation are:\\n\\n\" + lines.join(\"\\n\") + \"\\n*/\\n \")();\n }\n}\nfunction printDepTree(tree, lines, depth) {\n if (lines.length >= 1000) {\n lines.push(\"(and many more)\");\n return;\n }\n lines.push(\"\" + \"\\t\".repeat(depth - 1) + tree.name);\n if (tree.dependencies) {\n tree.dependencies.forEach(function (child) {\n return printDepTree(child, lines, depth + 1);\n });\n }\n}\n\nvar Reaction = /*#__PURE__*/function () {\n function Reaction(name_, onInvalidate_, errorHandler_, requiresObservable_) {\n if (name_ === void 0) {\n name_ = true ? \"Reaction@\" + getNextId() : 0;\n }\n this.name_ = void 0;\n this.onInvalidate_ = void 0;\n this.errorHandler_ = void 0;\n this.requiresObservable_ = void 0;\n this.observing_ = [];\n // nodes we are looking at. Our value depends on these nodes\n this.newObserving_ = [];\n this.dependenciesState_ = IDerivationState_.NOT_TRACKING_;\n this.runId_ = 0;\n this.unboundDepsCount_ = 0;\n this.flags_ = 0;\n this.isTracing_ = TraceMode.NONE;\n this.name_ = name_;\n this.onInvalidate_ = onInvalidate_;\n this.errorHandler_ = errorHandler_;\n this.requiresObservable_ = requiresObservable_;\n }\n var _proto = Reaction.prototype;\n _proto.onBecomeStale_ = function onBecomeStale_() {\n this.schedule_();\n };\n _proto.schedule_ = function schedule_() {\n if (!this.isScheduled) {\n this.isScheduled = true;\n globalState.pendingReactions.push(this);\n runReactions();\n }\n }\n /**\n * internal, use schedule() if you intend to kick off a reaction\n */;\n _proto.runReaction_ = function runReaction_() {\n if (!this.isDisposed) {\n startBatch();\n this.isScheduled = false;\n var prev = globalState.trackingContext;\n globalState.trackingContext = this;\n if (shouldCompute(this)) {\n this.isTrackPending = true;\n try {\n this.onInvalidate_();\n if ( true && this.isTrackPending && isSpyEnabled()) {\n // onInvalidate didn't trigger track right away..\n spyReport({\n name: this.name_,\n type: \"scheduled-reaction\"\n });\n }\n } catch (e) {\n this.reportExceptionInDerivation_(e);\n }\n }\n globalState.trackingContext = prev;\n endBatch();\n }\n };\n _proto.track = function track(fn) {\n if (this.isDisposed) {\n return;\n // console.warn(\"Reaction already disposed\") // Note: Not a warning / error in mobx 4 either\n }\n startBatch();\n var notify = isSpyEnabled();\n var startTime;\n if ( true && notify) {\n startTime = Date.now();\n spyReportStart({\n name: this.name_,\n type: \"reaction\"\n });\n }\n this.isRunning = true;\n var prevReaction = globalState.trackingContext; // reactions could create reactions...\n globalState.trackingContext = this;\n var result = trackDerivedFunction(this, fn, undefined);\n globalState.trackingContext = prevReaction;\n this.isRunning = false;\n this.isTrackPending = false;\n if (this.isDisposed) {\n // disposed during last run. Clean up everything that was bound after the dispose call.\n clearObserving(this);\n }\n if (isCaughtException(result)) {\n this.reportExceptionInDerivation_(result.cause);\n }\n if ( true && notify) {\n spyReportEnd({\n time: Date.now() - startTime\n });\n }\n endBatch();\n };\n _proto.reportExceptionInDerivation_ = function reportExceptionInDerivation_(error) {\n var _this = this;\n if (this.errorHandler_) {\n this.errorHandler_(error, this);\n return;\n }\n if (globalState.disableErrorBoundaries) {\n throw error;\n }\n var message = true ? \"[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '\" + this + \"'\" : 0;\n if (!globalState.suppressReactionErrors) {\n console.error(message, error);\n /** If debugging brought you here, please, read the above message :-). Tnx! */\n } else if (true) {\n console.warn(\"[mobx] (error in reaction '\" + this.name_ + \"' suppressed, fix error of causing action below)\");\n } // prettier-ignore\n if ( true && isSpyEnabled()) {\n spyReport({\n type: \"error\",\n name: this.name_,\n message: message,\n error: \"\" + error\n });\n }\n globalState.globalReactionErrorHandlers.forEach(function (f) {\n return f(error, _this);\n });\n };\n _proto.dispose = function dispose() {\n if (!this.isDisposed) {\n this.isDisposed = true;\n if (!this.isRunning) {\n // if disposed while running, clean up later. Maybe not optimal, but rare case\n startBatch();\n clearObserving(this);\n endBatch();\n }\n }\n };\n _proto.getDisposer_ = function getDisposer_(abortSignal) {\n var _this2 = this;\n var dispose = function dispose() {\n _this2.dispose();\n abortSignal == null || abortSignal.removeEventListener == null || abortSignal.removeEventListener(\"abort\", dispose);\n };\n abortSignal == null || abortSignal.addEventListener == null || abortSignal.addEventListener(\"abort\", dispose);\n dispose[$mobx] = this;\n return dispose;\n };\n _proto.toString = function toString() {\n return \"Reaction[\" + this.name_ + \"]\";\n };\n _proto.trace = function trace$1(enterBreakPoint) {\n if (enterBreakPoint === void 0) {\n enterBreakPoint = false;\n }\n trace(this, enterBreakPoint);\n };\n return _createClass(Reaction, [{\n key: \"isDisposed\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isDisposedMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isDisposedMask_, newValue);\n }\n }, {\n key: \"isScheduled\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isScheduledMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isScheduledMask_, newValue);\n }\n }, {\n key: \"isTrackPending\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isTrackPendingMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isTrackPendingMask_, newValue);\n }\n }, {\n key: \"isRunning\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isRunningMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isRunningMask_, newValue);\n }\n }, {\n key: \"diffValue\",\n get: function get() {\n return getFlag(this.flags_, Reaction.diffValueMask_) ? 1 : 0;\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.diffValueMask_, newValue === 1 ? true : false);\n }\n }]);\n}();\nReaction.isDisposedMask_ = 1;\nReaction.isScheduledMask_ = 2;\nReaction.isTrackPendingMask_ = 4;\nReaction.isRunningMask_ = 8;\nReaction.diffValueMask_ = 16;\nfunction onReactionError(handler) {\n globalState.globalReactionErrorHandlers.push(handler);\n return function () {\n var idx = globalState.globalReactionErrorHandlers.indexOf(handler);\n if (idx >= 0) {\n globalState.globalReactionErrorHandlers.splice(idx, 1);\n }\n };\n}\n/**\n * Magic number alert!\n * Defines within how many times a reaction is allowed to re-trigger itself\n * until it is assumed that this is gonna be a never ending loop...\n */\nvar MAX_REACTION_ITERATIONS = 100;\nvar reactionScheduler = function reactionScheduler(f) {\n return f();\n};\nfunction runReactions() {\n // Trampolining, if runReactions are already running, new reactions will be picked up\n if (globalState.inBatch > 0 || globalState.isRunningReactions) {\n return;\n }\n reactionScheduler(runReactionsHelper);\n}\nfunction runReactionsHelper() {\n globalState.isRunningReactions = true;\n var allReactions = globalState.pendingReactions;\n var iterations = 0;\n // While running reactions, new reactions might be triggered.\n // Hence we work with two variables and check whether\n // we converge to no remaining reactions after a while.\n while (allReactions.length > 0) {\n if (++iterations === MAX_REACTION_ITERATIONS) {\n console.error( true ? \"Reaction doesn't converge to a stable state after \" + MAX_REACTION_ITERATIONS + \" iterations.\" + (\" Probably there is a cycle in the reactive function: \" + allReactions[0]) : 0);\n allReactions.splice(0); // clear reactions\n }\n var remainingReactions = allReactions.splice(0);\n for (var i = 0, l = remainingReactions.length; i < l; i++) {\n remainingReactions[i].runReaction_();\n }\n }\n globalState.isRunningReactions = false;\n}\nvar isReaction = /*#__PURE__*/createInstanceofPredicate(\"Reaction\", Reaction);\nfunction setReactionScheduler(fn) {\n var baseScheduler = reactionScheduler;\n reactionScheduler = function reactionScheduler(f) {\n return fn(function () {\n return baseScheduler(f);\n });\n };\n}\n\nfunction isSpyEnabled() {\n return true && !!globalState.spyListeners.length;\n}\nfunction spyReport(event) {\n if (false) {} // dead code elimination can do the rest\n if (!globalState.spyListeners.length) {\n return;\n }\n var listeners = globalState.spyListeners;\n for (var i = 0, l = listeners.length; i < l; i++) {\n listeners[i](event);\n }\n}\nfunction spyReportStart(event) {\n if (false) {}\n var change = _extends({}, event, {\n spyReportStart: true\n });\n spyReport(change);\n}\nvar END_EVENT = {\n type: \"report-end\",\n spyReportEnd: true\n};\nfunction spyReportEnd(change) {\n if (false) {}\n if (change) {\n spyReport(_extends({}, change, {\n type: \"report-end\",\n spyReportEnd: true\n }));\n } else {\n spyReport(END_EVENT);\n }\n}\nfunction spy(listener) {\n if (false) {} else {\n globalState.spyListeners.push(listener);\n return once(function () {\n globalState.spyListeners = globalState.spyListeners.filter(function (l) {\n return l !== listener;\n });\n });\n }\n}\n\nvar ACTION = \"action\";\nvar ACTION_BOUND = \"action.bound\";\nvar AUTOACTION = \"autoAction\";\nvar AUTOACTION_BOUND = \"autoAction.bound\";\nvar DEFAULT_ACTION_NAME = \"\";\nvar actionAnnotation = /*#__PURE__*/createActionAnnotation(ACTION);\nvar actionBoundAnnotation = /*#__PURE__*/createActionAnnotation(ACTION_BOUND, {\n bound: true\n});\nvar autoActionAnnotation = /*#__PURE__*/createActionAnnotation(AUTOACTION, {\n autoAction: true\n});\nvar autoActionBoundAnnotation = /*#__PURE__*/createActionAnnotation(AUTOACTION_BOUND, {\n autoAction: true,\n bound: true\n});\nfunction createActionFactory(autoAction) {\n var res = function action(arg1, arg2) {\n // action(fn() {})\n if (isFunction(arg1)) {\n return createAction(arg1.name || DEFAULT_ACTION_NAME, arg1, autoAction);\n }\n // action(\"name\", fn() {})\n if (isFunction(arg2)) {\n return createAction(arg1, arg2, autoAction);\n }\n // @action (2022.3 Decorators)\n if (is20223Decorator(arg2)) {\n return (autoAction ? autoActionAnnotation : actionAnnotation).decorate_20223_(arg1, arg2);\n }\n // @action\n if (isStringish(arg2)) {\n return storeAnnotation(arg1, arg2, autoAction ? autoActionAnnotation : actionAnnotation);\n }\n // action(\"name\") & @action(\"name\")\n if (isStringish(arg1)) {\n return createDecoratorAnnotation(createActionAnnotation(autoAction ? AUTOACTION : ACTION, {\n name: arg1,\n autoAction: autoAction\n }));\n }\n if (true) {\n die(\"Invalid arguments for `action`\");\n }\n };\n return res;\n}\nvar action = /*#__PURE__*/createActionFactory(false);\nObject.assign(action, actionAnnotation);\nvar autoAction = /*#__PURE__*/createActionFactory(true);\nObject.assign(autoAction, autoActionAnnotation);\naction.bound = /*#__PURE__*/createDecoratorAnnotation(actionBoundAnnotation);\nautoAction.bound = /*#__PURE__*/createDecoratorAnnotation(autoActionBoundAnnotation);\nfunction runInAction(fn) {\n return executeAction(fn.name || DEFAULT_ACTION_NAME, false, fn, this, undefined);\n}\nfunction isAction(thing) {\n return isFunction(thing) && thing.isMobxAction === true;\n}\n\n/**\n * Creates a named reactive view and keeps it alive, so that the view is always\n * updated if one of the dependencies changes, even when the view is not further used by something else.\n * @param view The reactive view\n * @returns disposer function, which can be used to stop the view from being updated in the future.\n */\nfunction autorun(view, opts) {\n var _opts$name, _opts, _opts2, _opts3;\n if (opts === void 0) {\n opts = EMPTY_OBJECT;\n }\n if (true) {\n if (!isFunction(view)) {\n die(\"Autorun expects a function as first argument\");\n }\n if (isAction(view)) {\n die(\"Autorun does not accept actions since actions are untrackable\");\n }\n }\n var name = (_opts$name = (_opts = opts) == null ? void 0 : _opts.name) != null ? _opts$name : true ? view.name || \"Autorun@\" + getNextId() : 0;\n var runSync = !opts.scheduler && !opts.delay;\n var reaction;\n if (runSync) {\n // normal autorun\n reaction = new Reaction(name, function () {\n this.track(reactionRunner);\n }, opts.onError, opts.requiresObservable);\n } else {\n var scheduler = createSchedulerFromOptions(opts);\n // debounced autorun\n var isScheduled = false;\n reaction = new Reaction(name, function () {\n if (!isScheduled) {\n isScheduled = true;\n scheduler(function () {\n isScheduled = false;\n if (!reaction.isDisposed) {\n reaction.track(reactionRunner);\n }\n });\n }\n }, opts.onError, opts.requiresObservable);\n }\n function reactionRunner() {\n view(reaction);\n }\n if (!((_opts2 = opts) != null && (_opts2 = _opts2.signal) != null && _opts2.aborted)) {\n reaction.schedule_();\n }\n return reaction.getDisposer_((_opts3 = opts) == null ? void 0 : _opts3.signal);\n}\nvar run = function run(f) {\n return f();\n};\nfunction createSchedulerFromOptions(opts) {\n return opts.scheduler ? opts.scheduler : opts.delay ? function (f) {\n return setTimeout(f, opts.delay);\n } : run;\n}\nfunction reaction(expression, effect, opts) {\n var _opts$name2, _opts4, _opts5;\n if (opts === void 0) {\n opts = EMPTY_OBJECT;\n }\n if (true) {\n if (!isFunction(expression) || !isFunction(effect)) {\n die(\"First and second argument to reaction should be functions\");\n }\n if (!isPlainObject(opts)) {\n die(\"Third argument of reactions should be an object\");\n }\n }\n var name = (_opts$name2 = opts.name) != null ? _opts$name2 : true ? \"Reaction@\" + getNextId() : 0;\n var effectAction = action(name, opts.onError ? wrapErrorHandler(opts.onError, effect) : effect);\n var runSync = !opts.scheduler && !opts.delay;\n var scheduler = createSchedulerFromOptions(opts);\n var firstTime = true;\n var isScheduled = false;\n var value;\n var equals = opts.compareStructural ? comparer.structural : opts.equals || comparer[\"default\"];\n var r = new Reaction(name, function () {\n if (firstTime || runSync) {\n reactionRunner();\n } else if (!isScheduled) {\n isScheduled = true;\n scheduler(reactionRunner);\n }\n }, opts.onError, opts.requiresObservable);\n function reactionRunner() {\n isScheduled = false;\n if (r.isDisposed) {\n return;\n }\n var changed = false;\n var oldValue = value;\n r.track(function () {\n var nextValue = allowStateChanges(false, function () {\n return expression(r);\n });\n changed = firstTime || !equals(value, nextValue);\n value = nextValue;\n });\n if (firstTime && opts.fireImmediately) {\n effectAction(value, oldValue, r);\n } else if (!firstTime && changed) {\n effectAction(value, oldValue, r);\n }\n firstTime = false;\n }\n if (!((_opts4 = opts) != null && (_opts4 = _opts4.signal) != null && _opts4.aborted)) {\n r.schedule_();\n }\n return r.getDisposer_((_opts5 = opts) == null ? void 0 : _opts5.signal);\n}\nfunction wrapErrorHandler(errorHandler, baseFn) {\n return function () {\n try {\n return baseFn.apply(this, arguments);\n } catch (e) {\n errorHandler.call(this, e);\n }\n };\n}\n\nvar ON_BECOME_OBSERVED = \"onBO\";\nvar ON_BECOME_UNOBSERVED = \"onBUO\";\nfunction onBecomeObserved(thing, arg2, arg3) {\n return interceptHook(ON_BECOME_OBSERVED, thing, arg2, arg3);\n}\nfunction onBecomeUnobserved(thing, arg2, arg3) {\n return interceptHook(ON_BECOME_UNOBSERVED, thing, arg2, arg3);\n}\nfunction interceptHook(hook, thing, arg2, arg3) {\n var atom = typeof arg3 === \"function\" ? getAtom(thing, arg2) : getAtom(thing);\n var cb = isFunction(arg3) ? arg3 : arg2;\n var listenersKey = hook + \"L\";\n if (atom[listenersKey]) {\n atom[listenersKey].add(cb);\n } else {\n atom[listenersKey] = new Set([cb]);\n }\n return function () {\n var hookListeners = atom[listenersKey];\n if (hookListeners) {\n hookListeners[\"delete\"](cb);\n if (hookListeners.size === 0) {\n delete atom[listenersKey];\n }\n }\n };\n}\n\nvar NEVER = \"never\";\nvar ALWAYS = \"always\";\nvar OBSERVED = \"observed\";\n// const IF_AVAILABLE = \"ifavailable\"\nfunction configure(options) {\n if (options.isolateGlobalState === true) {\n isolateGlobalState();\n }\n var useProxies = options.useProxies,\n enforceActions = options.enforceActions;\n if (useProxies !== undefined) {\n globalState.useProxies = useProxies === ALWAYS ? true : useProxies === NEVER ? false : typeof Proxy !== \"undefined\";\n }\n if (useProxies === \"ifavailable\") {\n globalState.verifyProxies = true;\n }\n if (enforceActions !== undefined) {\n var ea = enforceActions === ALWAYS ? ALWAYS : enforceActions === OBSERVED;\n globalState.enforceActions = ea;\n globalState.allowStateChanges = ea === true || ea === ALWAYS ? false : true;\n }\n [\"computedRequiresReaction\", \"reactionRequiresObservable\", \"observableRequiresReaction\", \"disableErrorBoundaries\", \"safeDescriptors\"].forEach(function (key) {\n if (key in options) {\n globalState[key] = !!options[key];\n }\n });\n globalState.allowStateReads = !globalState.observableRequiresReaction;\n if ( true && globalState.disableErrorBoundaries === true) {\n console.warn(\"WARNING: Debug feature only. MobX will NOT recover from errors when `disableErrorBoundaries` is enabled.\");\n }\n if (options.reactionScheduler) {\n setReactionScheduler(options.reactionScheduler);\n }\n}\n\nfunction extendObservable(target, properties, annotations, options) {\n if (true) {\n if (arguments.length > 4) {\n die(\"'extendObservable' expected 2-4 arguments\");\n }\n if (typeof target !== \"object\") {\n die(\"'extendObservable' expects an object as first argument\");\n }\n if (isObservableMap(target)) {\n die(\"'extendObservable' should not be used on maps, use map.merge instead\");\n }\n if (!isPlainObject(properties)) {\n die(\"'extendObservable' only accepts plain objects as second argument\");\n }\n if (isObservable(properties) || isObservable(annotations)) {\n die(\"Extending an object with another observable (object) is not supported\");\n }\n }\n // Pull descriptors first, so we don't have to deal with props added by administration ($mobx)\n var descriptors = getOwnPropertyDescriptors(properties);\n initObservable(function () {\n var adm = asObservableObject(target, options)[$mobx];\n ownKeys(descriptors).forEach(function (key) {\n adm.extend_(key, descriptors[key],\n // must pass \"undefined\" for { key: undefined }\n !annotations ? true : key in annotations ? annotations[key] : true);\n });\n });\n return target;\n}\n\nfunction getDependencyTree(thing, property) {\n return nodeToDependencyTree(getAtom(thing, property));\n}\nfunction nodeToDependencyTree(node) {\n var result = {\n name: node.name_\n };\n if (node.observing_ && node.observing_.length > 0) {\n result.dependencies = unique(node.observing_).map(nodeToDependencyTree);\n }\n return result;\n}\nfunction getObserverTree(thing, property) {\n return nodeToObserverTree(getAtom(thing, property));\n}\nfunction nodeToObserverTree(node) {\n var result = {\n name: node.name_\n };\n if (hasObservers(node)) {\n result.observers = Array.from(getObservers(node)).map(nodeToObserverTree);\n }\n return result;\n}\nfunction unique(list) {\n return Array.from(new Set(list));\n}\n\nvar generatorId = 0;\nfunction FlowCancellationError() {\n this.message = \"FLOW_CANCELLED\";\n}\nFlowCancellationError.prototype = /*#__PURE__*/Object.create(Error.prototype);\nfunction isFlowCancellationError(error) {\n return error instanceof FlowCancellationError;\n}\nvar flowAnnotation = /*#__PURE__*/createFlowAnnotation(\"flow\");\nvar flowBoundAnnotation = /*#__PURE__*/createFlowAnnotation(\"flow.bound\", {\n bound: true\n});\nvar flow = /*#__PURE__*/Object.assign(function flow(arg1, arg2) {\n // @flow (2022.3 Decorators)\n if (is20223Decorator(arg2)) {\n return flowAnnotation.decorate_20223_(arg1, arg2);\n }\n // @flow\n if (isStringish(arg2)) {\n return storeAnnotation(arg1, arg2, flowAnnotation);\n }\n // flow(fn)\n if ( true && arguments.length !== 1) {\n die(\"Flow expects single argument with generator function\");\n }\n var generator = arg1;\n var name = generator.name || \"\";\n // Implementation based on https://github.com/tj/co/blob/master/index.js\n var res = function res() {\n var ctx = this;\n var args = arguments;\n var runId = ++generatorId;\n var gen = action(name + \" - runid: \" + runId + \" - init\", generator).apply(ctx, args);\n var rejector;\n var pendingPromise = undefined;\n var promise = new Promise(function (resolve, reject) {\n var stepId = 0;\n rejector = reject;\n function onFulfilled(res) {\n pendingPromise = undefined;\n var ret;\n try {\n ret = action(name + \" - runid: \" + runId + \" - yield \" + stepId++, gen.next).call(gen, res);\n } catch (e) {\n return reject(e);\n }\n next(ret);\n }\n function onRejected(err) {\n pendingPromise = undefined;\n var ret;\n try {\n ret = action(name + \" - runid: \" + runId + \" - yield \" + stepId++, gen[\"throw\"]).call(gen, err);\n } catch (e) {\n return reject(e);\n }\n next(ret);\n }\n function next(ret) {\n if (isFunction(ret == null ? void 0 : ret.then)) {\n // an async iterator\n ret.then(next, reject);\n return;\n }\n if (ret.done) {\n return resolve(ret.value);\n }\n pendingPromise = Promise.resolve(ret.value);\n return pendingPromise.then(onFulfilled, onRejected);\n }\n onFulfilled(undefined); // kick off the process\n });\n promise.cancel = action(name + \" - runid: \" + runId + \" - cancel\", function () {\n try {\n if (pendingPromise) {\n cancelPromise(pendingPromise);\n }\n // Finally block can return (or yield) stuff..\n var _res = gen[\"return\"](undefined);\n // eat anything that promise would do, it's cancelled!\n var yieldedPromise = Promise.resolve(_res.value);\n yieldedPromise.then(noop, noop);\n cancelPromise(yieldedPromise); // maybe it can be cancelled :)\n // reject our original promise\n rejector(new FlowCancellationError());\n } catch (e) {\n rejector(e); // there could be a throwing finally block\n }\n });\n return promise;\n };\n res.isMobXFlow = true;\n return res;\n}, flowAnnotation);\nflow.bound = /*#__PURE__*/createDecoratorAnnotation(flowBoundAnnotation);\nfunction cancelPromise(promise) {\n if (isFunction(promise.cancel)) {\n promise.cancel();\n }\n}\nfunction flowResult(result) {\n return result; // just tricking TypeScript :)\n}\nfunction isFlow(fn) {\n return (fn == null ? void 0 : fn.isMobXFlow) === true;\n}\n\nfunction interceptReads(thing, propOrHandler, handler) {\n var target;\n if (isObservableMap(thing) || isObservableArray(thing) || isObservableValue(thing)) {\n target = getAdministration(thing);\n } else if (isObservableObject(thing)) {\n if ( true && !isStringish(propOrHandler)) {\n return die(\"InterceptReads can only be used with a specific property, not with an object in general\");\n }\n target = getAdministration(thing, propOrHandler);\n } else if (true) {\n return die(\"Expected observable map, object or array as first array\");\n }\n if ( true && target.dehancer !== undefined) {\n return die(\"An intercept reader was already established\");\n }\n target.dehancer = typeof propOrHandler === \"function\" ? propOrHandler : handler;\n return function () {\n target.dehancer = undefined;\n };\n}\n\nfunction intercept(thing, propOrHandler, handler) {\n if (isFunction(handler)) {\n return interceptProperty(thing, propOrHandler, handler);\n } else {\n return interceptInterceptable(thing, propOrHandler);\n }\n}\nfunction interceptInterceptable(thing, handler) {\n return getAdministration(thing).intercept_(handler);\n}\nfunction interceptProperty(thing, property, handler) {\n return getAdministration(thing, property).intercept_(handler);\n}\n\nfunction _isComputed(value, property) {\n if (property === undefined) {\n return isComputedValue(value);\n }\n if (isObservableObject(value) === false) {\n return false;\n }\n if (!value[$mobx].values_.has(property)) {\n return false;\n }\n var atom = getAtom(value, property);\n return isComputedValue(atom);\n}\nfunction isComputed(value) {\n if ( true && arguments.length > 1) {\n return die(\"isComputed expects only 1 argument. Use isComputedProp to inspect the observability of a property\");\n }\n return _isComputed(value);\n}\nfunction isComputedProp(value, propName) {\n if ( true && !isStringish(propName)) {\n return die(\"isComputed expected a property name as second argument\");\n }\n return _isComputed(value, propName);\n}\n\nfunction _isObservable(value, property) {\n if (!value) {\n return false;\n }\n if (property !== undefined) {\n if ( true && (isObservableMap(value) || isObservableArray(value))) {\n return die(\"isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead.\");\n }\n if (isObservableObject(value)) {\n return value[$mobx].values_.has(property);\n }\n return false;\n }\n // For first check, see #701\n return isObservableObject(value) || !!value[$mobx] || isAtom(value) || isReaction(value) || isComputedValue(value);\n}\nfunction isObservable(value) {\n if ( true && arguments.length !== 1) {\n die(\"isObservable expects only 1 argument. Use isObservableProp to inspect the observability of a property\");\n }\n return _isObservable(value);\n}\nfunction isObservableProp(value, propName) {\n if ( true && !isStringish(propName)) {\n return die(\"expected a property name as second argument\");\n }\n return _isObservable(value, propName);\n}\n\nfunction keys(obj) {\n if (isObservableObject(obj)) {\n return obj[$mobx].keys_();\n }\n if (isObservableMap(obj) || isObservableSet(obj)) {\n return Array.from(obj.keys());\n }\n if (isObservableArray(obj)) {\n return obj.map(function (_, index) {\n return index;\n });\n }\n die(5);\n}\nfunction values(obj) {\n if (isObservableObject(obj)) {\n return keys(obj).map(function (key) {\n return obj[key];\n });\n }\n if (isObservableMap(obj)) {\n return keys(obj).map(function (key) {\n return obj.get(key);\n });\n }\n if (isObservableSet(obj)) {\n return Array.from(obj.values());\n }\n if (isObservableArray(obj)) {\n return obj.slice();\n }\n die(6);\n}\nfunction entries(obj) {\n if (isObservableObject(obj)) {\n return keys(obj).map(function (key) {\n return [key, obj[key]];\n });\n }\n if (isObservableMap(obj)) {\n return keys(obj).map(function (key) {\n return [key, obj.get(key)];\n });\n }\n if (isObservableSet(obj)) {\n return Array.from(obj.entries());\n }\n if (isObservableArray(obj)) {\n return obj.map(function (key, index) {\n return [index, key];\n });\n }\n die(7);\n}\nfunction set(obj, key, value) {\n if (arguments.length === 2 && !isObservableSet(obj)) {\n startBatch();\n var _values = key;\n try {\n for (var _key in _values) {\n set(obj, _key, _values[_key]);\n }\n } finally {\n endBatch();\n }\n return;\n }\n if (isObservableObject(obj)) {\n obj[$mobx].set_(key, value);\n } else if (isObservableMap(obj)) {\n obj.set(key, value);\n } else if (isObservableSet(obj)) {\n obj.add(key);\n } else if (isObservableArray(obj)) {\n if (typeof key !== \"number\") {\n key = parseInt(key, 10);\n }\n if (key < 0) {\n die(\"Invalid index: '\" + key + \"'\");\n }\n startBatch();\n if (key >= obj.length) {\n obj.length = key + 1;\n }\n obj[key] = value;\n endBatch();\n } else {\n die(8);\n }\n}\nfunction remove(obj, key) {\n if (isObservableObject(obj)) {\n obj[$mobx].delete_(key);\n } else if (isObservableMap(obj)) {\n obj[\"delete\"](key);\n } else if (isObservableSet(obj)) {\n obj[\"delete\"](key);\n } else if (isObservableArray(obj)) {\n if (typeof key !== \"number\") {\n key = parseInt(key, 10);\n }\n obj.splice(key, 1);\n } else {\n die(9);\n }\n}\nfunction has(obj, key) {\n if (isObservableObject(obj)) {\n return obj[$mobx].has_(key);\n } else if (isObservableMap(obj)) {\n return obj.has(key);\n } else if (isObservableSet(obj)) {\n return obj.has(key);\n } else if (isObservableArray(obj)) {\n return key >= 0 && key < obj.length;\n }\n die(10);\n}\nfunction get(obj, key) {\n if (!has(obj, key)) {\n return undefined;\n }\n if (isObservableObject(obj)) {\n return obj[$mobx].get_(key);\n } else if (isObservableMap(obj)) {\n return obj.get(key);\n } else if (isObservableArray(obj)) {\n return obj[key];\n }\n die(11);\n}\nfunction apiDefineProperty(obj, key, descriptor) {\n if (isObservableObject(obj)) {\n return obj[$mobx].defineProperty_(key, descriptor);\n }\n die(39);\n}\nfunction apiOwnKeys(obj) {\n if (isObservableObject(obj)) {\n return obj[$mobx].ownKeys_();\n }\n die(38);\n}\n\nfunction observe(thing, propOrCb, cbOrFire, fireImmediately) {\n if (isFunction(cbOrFire)) {\n return observeObservableProperty(thing, propOrCb, cbOrFire, fireImmediately);\n } else {\n return observeObservable(thing, propOrCb, cbOrFire);\n }\n}\nfunction observeObservable(thing, listener, fireImmediately) {\n return getAdministration(thing).observe_(listener, fireImmediately);\n}\nfunction observeObservableProperty(thing, property, listener, fireImmediately) {\n return getAdministration(thing, property).observe_(listener, fireImmediately);\n}\n\nfunction cache(map, key, value) {\n map.set(key, value);\n return value;\n}\nfunction toJSHelper(source, __alreadySeen) {\n if (source == null || typeof source !== \"object\" || source instanceof Date || !isObservable(source)) {\n return source;\n }\n if (isObservableValue(source) || isComputedValue(source)) {\n return toJSHelper(source.get(), __alreadySeen);\n }\n if (__alreadySeen.has(source)) {\n return __alreadySeen.get(source);\n }\n if (isObservableArray(source)) {\n var res = cache(__alreadySeen, source, new Array(source.length));\n source.forEach(function (value, idx) {\n res[idx] = toJSHelper(value, __alreadySeen);\n });\n return res;\n }\n if (isObservableSet(source)) {\n var _res = cache(__alreadySeen, source, new Set());\n source.forEach(function (value) {\n _res.add(toJSHelper(value, __alreadySeen));\n });\n return _res;\n }\n if (isObservableMap(source)) {\n var _res2 = cache(__alreadySeen, source, new Map());\n source.forEach(function (value, key) {\n _res2.set(key, toJSHelper(value, __alreadySeen));\n });\n return _res2;\n } else {\n // must be observable object\n var _res3 = cache(__alreadySeen, source, {});\n apiOwnKeys(source).forEach(function (key) {\n if (objectPrototype.propertyIsEnumerable.call(source, key)) {\n _res3[key] = toJSHelper(source[key], __alreadySeen);\n }\n });\n return _res3;\n }\n}\n/**\n * Recursively converts an observable to it's non-observable native counterpart.\n * It does NOT recurse into non-observables, these are left as they are, even if they contain observables.\n * Computed and other non-enumerable properties are completely ignored.\n * Complex scenarios require custom solution, eg implementing `toJSON` or using `serializr` lib.\n */\nfunction toJS(source, options) {\n if ( true && options) {\n die(\"toJS no longer supports options\");\n }\n return toJSHelper(source, new Map());\n}\n\nfunction trace() {\n if (false) {}\n var enterBreakPoint = false;\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n if (typeof args[args.length - 1] === \"boolean\") {\n enterBreakPoint = args.pop();\n }\n var derivation = getAtomFromArgs(args);\n if (!derivation) {\n return die(\"'trace(break?)' can only be used inside a tracked computed value or a Reaction. Consider passing in the computed value or reaction explicitly\");\n }\n if (derivation.isTracing_ === TraceMode.NONE) {\n console.log(\"[mobx.trace] '\" + derivation.name_ + \"' tracing enabled\");\n }\n derivation.isTracing_ = enterBreakPoint ? TraceMode.BREAK : TraceMode.LOG;\n}\nfunction getAtomFromArgs(args) {\n switch (args.length) {\n case 0:\n return globalState.trackingDerivation;\n case 1:\n return getAtom(args[0]);\n case 2:\n return getAtom(args[0], args[1]);\n }\n}\n\n/**\n * During a transaction no views are updated until the end of the transaction.\n * The transaction will be run synchronously nonetheless.\n *\n * @param action a function that updates some reactive state\n * @returns any value that was returned by the 'action' parameter.\n */\nfunction transaction(action, thisArg) {\n if (thisArg === void 0) {\n thisArg = undefined;\n }\n startBatch();\n try {\n return action.apply(thisArg);\n } finally {\n endBatch();\n }\n}\n\nfunction when(predicate, arg1, arg2) {\n if (arguments.length === 1 || arg1 && typeof arg1 === \"object\") {\n return whenPromise(predicate, arg1);\n }\n return _when(predicate, arg1, arg2 || {});\n}\nfunction _when(predicate, effect, opts) {\n var timeoutHandle;\n if (typeof opts.timeout === \"number\") {\n var error = new Error(\"WHEN_TIMEOUT\");\n timeoutHandle = setTimeout(function () {\n if (!disposer[$mobx].isDisposed) {\n disposer();\n if (opts.onError) {\n opts.onError(error);\n } else {\n throw error;\n }\n }\n }, opts.timeout);\n }\n opts.name = true ? opts.name || \"When@\" + getNextId() : 0;\n var effectAction = createAction( true ? opts.name + \"-effect\" : 0, effect);\n // eslint-disable-next-line\n var disposer = autorun(function (r) {\n // predicate should not change state\n var cond = allowStateChanges(false, predicate);\n if (cond) {\n r.dispose();\n if (timeoutHandle) {\n clearTimeout(timeoutHandle);\n }\n effectAction();\n }\n }, opts);\n return disposer;\n}\nfunction whenPromise(predicate, opts) {\n var _opts$signal;\n if ( true && opts && opts.onError) {\n return die(\"the options 'onError' and 'promise' cannot be combined\");\n }\n if (opts != null && (_opts$signal = opts.signal) != null && _opts$signal.aborted) {\n return Object.assign(Promise.reject(new Error(\"WHEN_ABORTED\")), {\n cancel: function cancel() {\n return null;\n }\n });\n }\n var cancel;\n var abort;\n var res = new Promise(function (resolve, reject) {\n var _opts$signal2;\n var disposer = _when(predicate, resolve, _extends({}, opts, {\n onError: reject\n }));\n cancel = function cancel() {\n disposer();\n reject(new Error(\"WHEN_CANCELLED\"));\n };\n abort = function abort() {\n disposer();\n reject(new Error(\"WHEN_ABORTED\"));\n };\n opts == null || (_opts$signal2 = opts.signal) == null || _opts$signal2.addEventListener == null || _opts$signal2.addEventListener(\"abort\", abort);\n })[\"finally\"](function () {\n var _opts$signal3;\n return opts == null || (_opts$signal3 = opts.signal) == null || _opts$signal3.removeEventListener == null ? void 0 : _opts$signal3.removeEventListener(\"abort\", abort);\n });\n res.cancel = cancel;\n return res;\n}\n\nfunction getAdm(target) {\n return target[$mobx];\n}\n// Optimization: we don't need the intermediate objects and could have a completely custom administration for DynamicObjects,\n// and skip either the internal values map, or the base object with its property descriptors!\nvar objectProxyTraps = {\n has: function has(target, name) {\n if ( true && globalState.trackingDerivation) {\n warnAboutProxyRequirement(\"detect new properties using the 'in' operator. Use 'has' from 'mobx' instead.\");\n }\n return getAdm(target).has_(name);\n },\n get: function get(target, name) {\n return getAdm(target).get_(name);\n },\n set: function set(target, name, value) {\n var _getAdm$set_;\n if (!isStringish(name)) {\n return false;\n }\n if ( true && !getAdm(target).values_.has(name)) {\n warnAboutProxyRequirement(\"add a new observable property through direct assignment. Use 'set' from 'mobx' instead.\");\n }\n // null (intercepted) -> true (success)\n return (_getAdm$set_ = getAdm(target).set_(name, value, true)) != null ? _getAdm$set_ : true;\n },\n deleteProperty: function deleteProperty(target, name) {\n var _getAdm$delete_;\n if (true) {\n warnAboutProxyRequirement(\"delete properties from an observable object. Use 'remove' from 'mobx' instead.\");\n }\n if (!isStringish(name)) {\n return false;\n }\n // null (intercepted) -> true (success)\n return (_getAdm$delete_ = getAdm(target).delete_(name, true)) != null ? _getAdm$delete_ : true;\n },\n defineProperty: function defineProperty(target, name, descriptor) {\n var _getAdm$definePropert;\n if (true) {\n warnAboutProxyRequirement(\"define property on an observable object. Use 'defineProperty' from 'mobx' instead.\");\n }\n // null (intercepted) -> true (success)\n return (_getAdm$definePropert = getAdm(target).defineProperty_(name, descriptor)) != null ? _getAdm$definePropert : true;\n },\n ownKeys: function ownKeys(target) {\n if ( true && globalState.trackingDerivation) {\n warnAboutProxyRequirement(\"iterate keys to detect added / removed properties. Use 'keys' from 'mobx' instead.\");\n }\n return getAdm(target).ownKeys_();\n },\n preventExtensions: function preventExtensions(target) {\n die(13);\n }\n};\nfunction asDynamicObservableObject(target, options) {\n var _target$$mobx, _target$$mobx$proxy_;\n assertProxies();\n target = asObservableObject(target, options);\n return (_target$$mobx$proxy_ = (_target$$mobx = target[$mobx]).proxy_) != null ? _target$$mobx$proxy_ : _target$$mobx.proxy_ = new Proxy(target, objectProxyTraps);\n}\n\nfunction hasInterceptors(interceptable) {\n return interceptable.interceptors_ !== undefined && interceptable.interceptors_.length > 0;\n}\nfunction registerInterceptor(interceptable, handler) {\n var interceptors = interceptable.interceptors_ || (interceptable.interceptors_ = []);\n interceptors.push(handler);\n return once(function () {\n var idx = interceptors.indexOf(handler);\n if (idx !== -1) {\n interceptors.splice(idx, 1);\n }\n });\n}\nfunction interceptChange(interceptable, change) {\n var prevU = untrackedStart();\n try {\n // Interceptor can modify the array, copy it to avoid concurrent modification, see #1950\n var interceptors = [].concat(interceptable.interceptors_ || []);\n for (var i = 0, l = interceptors.length; i < l; i++) {\n change = interceptors[i](change);\n if (change && !change.type) {\n die(14);\n }\n if (!change) {\n break;\n }\n }\n return change;\n } finally {\n untrackedEnd(prevU);\n }\n}\n\nfunction hasListeners(listenable) {\n return listenable.changeListeners_ !== undefined && listenable.changeListeners_.length > 0;\n}\nfunction registerListener(listenable, handler) {\n var listeners = listenable.changeListeners_ || (listenable.changeListeners_ = []);\n listeners.push(handler);\n return once(function () {\n var idx = listeners.indexOf(handler);\n if (idx !== -1) {\n listeners.splice(idx, 1);\n }\n });\n}\nfunction notifyListeners(listenable, change) {\n var prevU = untrackedStart();\n var listeners = listenable.changeListeners_;\n if (!listeners) {\n return;\n }\n listeners = listeners.slice();\n for (var i = 0, l = listeners.length; i < l; i++) {\n listeners[i](change);\n }\n untrackedEnd(prevU);\n}\n\nfunction makeObservable(target, annotations, options) {\n initObservable(function () {\n var _annotations;\n var adm = asObservableObject(target, options)[$mobx];\n if ( true && annotations && target[storedAnnotationsSymbol]) {\n die(\"makeObservable second arg must be nullish when using decorators. Mixing @decorator syntax with annotations is not supported.\");\n }\n // Default to decorators\n (_annotations = annotations) != null ? _annotations : annotations = collectStoredAnnotations(target);\n // Annotate\n ownKeys(annotations).forEach(function (key) {\n return adm.make_(key, annotations[key]);\n });\n });\n return target;\n}\n// proto[keysSymbol] = new Set()\nvar keysSymbol = /*#__PURE__*/Symbol(\"mobx-keys\");\nfunction makeAutoObservable(target, overrides, options) {\n if (true) {\n if (!isPlainObject(target) && !isPlainObject(Object.getPrototypeOf(target))) {\n die(\"'makeAutoObservable' can only be used for classes that don't have a superclass\");\n }\n if (isObservableObject(target)) {\n die(\"makeAutoObservable can only be used on objects not already made observable\");\n }\n }\n // Optimization: avoid visiting protos\n // Assumes that annotation.make_/.extend_ works the same for plain objects\n if (isPlainObject(target)) {\n return extendObservable(target, target, overrides, options);\n }\n initObservable(function () {\n var adm = asObservableObject(target, options)[$mobx];\n // Optimization: cache keys on proto\n // Assumes makeAutoObservable can be called only once per object and can't be used in subclass\n if (!target[keysSymbol]) {\n var proto = Object.getPrototypeOf(target);\n var keys = new Set([].concat(ownKeys(target), ownKeys(proto)));\n keys[\"delete\"](\"constructor\");\n keys[\"delete\"]($mobx);\n addHiddenProp(proto, keysSymbol, keys);\n }\n target[keysSymbol].forEach(function (key) {\n return adm.make_(key,\n // must pass \"undefined\" for { key: undefined }\n !overrides ? true : key in overrides ? overrides[key] : true);\n });\n });\n return target;\n}\n\nvar SPLICE = \"splice\";\nvar UPDATE = \"update\";\nvar MAX_SPLICE_SIZE = 10000; // See e.g. https://github.com/mobxjs/mobx/issues/859\nvar arrayTraps = {\n get: function get(target, name) {\n var adm = target[$mobx];\n if (name === $mobx) {\n return adm;\n }\n if (name === \"length\") {\n return adm.getArrayLength_();\n }\n if (typeof name === \"string\" && !isNaN(name)) {\n return adm.get_(parseInt(name));\n }\n if (hasProp(arrayExtensions, name)) {\n return arrayExtensions[name];\n }\n return target[name];\n },\n set: function set(target, name, value) {\n var adm = target[$mobx];\n if (name === \"length\") {\n adm.setArrayLength_(value);\n }\n if (typeof name === \"symbol\" || isNaN(name)) {\n target[name] = value;\n } else {\n // numeric string\n adm.set_(parseInt(name), value);\n }\n return true;\n },\n preventExtensions: function preventExtensions() {\n die(15);\n }\n};\nvar ObservableArrayAdministration = /*#__PURE__*/function () {\n function ObservableArrayAdministration(name, enhancer, owned_, legacyMode_) {\n if (name === void 0) {\n name = true ? \"ObservableArray@\" + getNextId() : 0;\n }\n this.owned_ = void 0;\n this.legacyMode_ = void 0;\n this.atom_ = void 0;\n this.values_ = [];\n // this is the prop that gets proxied, so can't replace it!\n this.interceptors_ = void 0;\n this.changeListeners_ = void 0;\n this.enhancer_ = void 0;\n this.dehancer = void 0;\n this.proxy_ = void 0;\n this.lastKnownLength_ = 0;\n this.owned_ = owned_;\n this.legacyMode_ = legacyMode_;\n this.atom_ = new Atom(name);\n this.enhancer_ = function (newV, oldV) {\n return enhancer(newV, oldV, true ? name + \"[..]\" : 0);\n };\n }\n var _proto = ObservableArrayAdministration.prototype;\n _proto.dehanceValue_ = function dehanceValue_(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.dehanceValues_ = function dehanceValues_(values) {\n if (this.dehancer !== undefined && values.length > 0) {\n return values.map(this.dehancer);\n }\n return values;\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n if (fireImmediately === void 0) {\n fireImmediately = false;\n }\n if (fireImmediately) {\n listener({\n observableKind: \"array\",\n object: this.proxy_,\n debugObjectName: this.atom_.name_,\n type: \"splice\",\n index: 0,\n added: this.values_.slice(),\n addedCount: this.values_.length,\n removed: [],\n removedCount: 0\n });\n }\n return registerListener(this, listener);\n };\n _proto.getArrayLength_ = function getArrayLength_() {\n this.atom_.reportObserved();\n return this.values_.length;\n };\n _proto.setArrayLength_ = function setArrayLength_(newLength) {\n if (typeof newLength !== \"number\" || isNaN(newLength) || newLength < 0) {\n die(\"Out of range: \" + newLength);\n }\n var currentLength = this.values_.length;\n if (newLength === currentLength) {\n return;\n } else if (newLength > currentLength) {\n var newItems = new Array(newLength - currentLength);\n for (var i = 0; i < newLength - currentLength; i++) {\n newItems[i] = undefined;\n } // No Array.fill everywhere...\n this.spliceWithArray_(currentLength, 0, newItems);\n } else {\n this.spliceWithArray_(newLength, currentLength - newLength);\n }\n };\n _proto.updateArrayLength_ = function updateArrayLength_(oldLength, delta) {\n if (oldLength !== this.lastKnownLength_) {\n die(16);\n }\n this.lastKnownLength_ += delta;\n if (this.legacyMode_ && delta > 0) {\n reserveArrayBuffer(oldLength + delta + 1);\n }\n };\n _proto.spliceWithArray_ = function spliceWithArray_(index, deleteCount, newItems) {\n var _this = this;\n checkIfStateModificationsAreAllowed(this.atom_);\n var length = this.values_.length;\n if (index === undefined) {\n index = 0;\n } else if (index > length) {\n index = length;\n } else if (index < 0) {\n index = Math.max(0, length + index);\n }\n if (arguments.length === 1) {\n deleteCount = length - index;\n } else if (deleteCount === undefined || deleteCount === null) {\n deleteCount = 0;\n } else {\n deleteCount = Math.max(0, Math.min(deleteCount, length - index));\n }\n if (newItems === undefined) {\n newItems = EMPTY_ARRAY;\n }\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_,\n type: SPLICE,\n index: index,\n removedCount: deleteCount,\n added: newItems\n });\n if (!change) {\n return EMPTY_ARRAY;\n }\n deleteCount = change.removedCount;\n newItems = change.added;\n }\n newItems = newItems.length === 0 ? newItems : newItems.map(function (v) {\n return _this.enhancer_(v, undefined);\n });\n if (this.legacyMode_ || \"development\" !== \"production\") {\n var lengthDelta = newItems.length - deleteCount;\n this.updateArrayLength_(length, lengthDelta); // checks if internal array wasn't modified\n }\n var res = this.spliceItemsIntoValues_(index, deleteCount, newItems);\n if (deleteCount !== 0 || newItems.length !== 0) {\n this.notifyArraySplice_(index, newItems, res);\n }\n return this.dehanceValues_(res);\n };\n _proto.spliceItemsIntoValues_ = function spliceItemsIntoValues_(index, deleteCount, newItems) {\n if (newItems.length < MAX_SPLICE_SIZE) {\n var _this$values_;\n return (_this$values_ = this.values_).splice.apply(_this$values_, [index, deleteCount].concat(newItems));\n } else {\n // The items removed by the splice\n var res = this.values_.slice(index, index + deleteCount);\n // The items that that should remain at the end of the array\n var oldItems = this.values_.slice(index + deleteCount);\n // New length is the previous length + addition count - deletion count\n this.values_.length += newItems.length - deleteCount;\n for (var i = 0; i < newItems.length; i++) {\n this.values_[index + i] = newItems[i];\n }\n for (var _i = 0; _i < oldItems.length; _i++) {\n this.values_[index + newItems.length + _i] = oldItems[_i];\n }\n return res;\n }\n };\n _proto.notifyArrayChildUpdate_ = function notifyArrayChildUpdate_(index, newValue, oldValue) {\n var notifySpy = !this.owned_ && isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"array\",\n object: this.proxy_,\n type: UPDATE,\n debugObjectName: this.atom_.name_,\n index: index,\n newValue: newValue,\n oldValue: oldValue\n } : null;\n // The reason why this is on right hand side here (and not above), is this way the uglifier will drop it, but it won't\n // cause any runtime overhead in development mode without NODE_ENV set, unless spying is enabled\n if ( true && notifySpy) {\n spyReportStart(change);\n }\n this.atom_.reportChanged();\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n };\n _proto.notifyArraySplice_ = function notifyArraySplice_(index, added, removed) {\n var notifySpy = !this.owned_ && isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"array\",\n object: this.proxy_,\n debugObjectName: this.atom_.name_,\n type: SPLICE,\n index: index,\n removed: removed,\n added: added,\n removedCount: removed.length,\n addedCount: added.length\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n }\n this.atom_.reportChanged();\n // conform: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/observe\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n };\n _proto.get_ = function get_(index) {\n if (this.legacyMode_ && index >= this.values_.length) {\n console.warn( true ? \"[mobx.array] Attempt to read an array index (\" + index + \") that is out of bounds (\" + this.values_.length + \"). Please check length first. Out of bound indices will not be tracked by MobX\" : 0);\n return undefined;\n }\n this.atom_.reportObserved();\n return this.dehanceValue_(this.values_[index]);\n };\n _proto.set_ = function set_(index, newValue) {\n var values = this.values_;\n if (this.legacyMode_ && index > values.length) {\n // out of bounds\n die(17, index, values.length);\n }\n if (index < values.length) {\n // update at index in range\n checkIfStateModificationsAreAllowed(this.atom_);\n var oldValue = values[index];\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: UPDATE,\n object: this.proxy_,\n // since \"this\" is the real array we need to pass its proxy\n index: index,\n newValue: newValue\n });\n if (!change) {\n return;\n }\n newValue = change.newValue;\n }\n newValue = this.enhancer_(newValue, oldValue);\n var changed = newValue !== oldValue;\n if (changed) {\n values[index] = newValue;\n this.notifyArrayChildUpdate_(index, newValue, oldValue);\n }\n } else {\n // For out of bound index, we don't create an actual sparse array,\n // but rather fill the holes with undefined (same as setArrayLength_).\n // This could be considered a bug.\n var newItems = new Array(index + 1 - values.length);\n for (var i = 0; i < newItems.length - 1; i++) {\n newItems[i] = undefined;\n } // No Array.fill everywhere...\n newItems[newItems.length - 1] = newValue;\n this.spliceWithArray_(values.length, 0, newItems);\n }\n };\n return ObservableArrayAdministration;\n}();\nfunction createObservableArray(initialValues, enhancer, name, owned) {\n if (name === void 0) {\n name = true ? \"ObservableArray@\" + getNextId() : 0;\n }\n if (owned === void 0) {\n owned = false;\n }\n assertProxies();\n return initObservable(function () {\n var adm = new ObservableArrayAdministration(name, enhancer, owned, false);\n addHiddenFinalProp(adm.values_, $mobx, adm);\n var proxy = new Proxy(adm.values_, arrayTraps);\n adm.proxy_ = proxy;\n if (initialValues && initialValues.length) {\n adm.spliceWithArray_(0, 0, initialValues);\n }\n return proxy;\n });\n}\n// eslint-disable-next-line\nvar arrayExtensions = {\n clear: function clear() {\n return this.splice(0);\n },\n replace: function replace(newItems) {\n var adm = this[$mobx];\n return adm.spliceWithArray_(0, adm.values_.length, newItems);\n },\n // Used by JSON.stringify\n toJSON: function toJSON() {\n return this.slice();\n },\n /*\n * functions that do alter the internal structure of the array, (based on lib.es6.d.ts)\n * since these functions alter the inner structure of the array, the have side effects.\n * Because the have side effects, they should not be used in computed function,\n * and for that reason the do not call dependencyState.notifyObserved\n */\n splice: function splice(index, deleteCount) {\n for (var _len = arguments.length, newItems = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {\n newItems[_key - 2] = arguments[_key];\n }\n var adm = this[$mobx];\n switch (arguments.length) {\n case 0:\n return [];\n case 1:\n return adm.spliceWithArray_(index);\n case 2:\n return adm.spliceWithArray_(index, deleteCount);\n }\n return adm.spliceWithArray_(index, deleteCount, newItems);\n },\n spliceWithArray: function spliceWithArray(index, deleteCount, newItems) {\n return this[$mobx].spliceWithArray_(index, deleteCount, newItems);\n },\n push: function push() {\n var adm = this[$mobx];\n for (var _len2 = arguments.length, items = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n items[_key2] = arguments[_key2];\n }\n adm.spliceWithArray_(adm.values_.length, 0, items);\n return adm.values_.length;\n },\n pop: function pop() {\n return this.splice(Math.max(this[$mobx].values_.length - 1, 0), 1)[0];\n },\n shift: function shift() {\n return this.splice(0, 1)[0];\n },\n unshift: function unshift() {\n var adm = this[$mobx];\n for (var _len3 = arguments.length, items = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n items[_key3] = arguments[_key3];\n }\n adm.spliceWithArray_(0, 0, items);\n return adm.values_.length;\n },\n reverse: function reverse() {\n // reverse by default mutates in place before returning the result\n // which makes it both a 'derivation' and a 'mutation'.\n if (globalState.trackingDerivation) {\n die(37, \"reverse\");\n }\n this.replace(this.slice().reverse());\n return this;\n },\n sort: function sort() {\n // sort by default mutates in place before returning the result\n // which goes against all good practices. Let's not change the array in place!\n if (globalState.trackingDerivation) {\n die(37, \"sort\");\n }\n var copy = this.slice();\n copy.sort.apply(copy, arguments);\n this.replace(copy);\n return this;\n },\n remove: function remove(value) {\n var adm = this[$mobx];\n var idx = adm.dehanceValues_(adm.values_).indexOf(value);\n if (idx > -1) {\n this.splice(idx, 1);\n return true;\n }\n return false;\n }\n};\n/**\n * Wrap function from prototype\n * Without this, everything works as well, but this works\n * faster as everything works on unproxied values\n */\naddArrayExtension(\"at\", simpleFunc);\naddArrayExtension(\"concat\", simpleFunc);\naddArrayExtension(\"flat\", simpleFunc);\naddArrayExtension(\"includes\", simpleFunc);\naddArrayExtension(\"indexOf\", simpleFunc);\naddArrayExtension(\"join\", simpleFunc);\naddArrayExtension(\"lastIndexOf\", simpleFunc);\naddArrayExtension(\"slice\", simpleFunc);\naddArrayExtension(\"toString\", simpleFunc);\naddArrayExtension(\"toLocaleString\", simpleFunc);\naddArrayExtension(\"toSorted\", simpleFunc);\naddArrayExtension(\"toSpliced\", simpleFunc);\naddArrayExtension(\"with\", simpleFunc);\n// map\naddArrayExtension(\"every\", mapLikeFunc);\naddArrayExtension(\"filter\", mapLikeFunc);\naddArrayExtension(\"find\", mapLikeFunc);\naddArrayExtension(\"findIndex\", mapLikeFunc);\naddArrayExtension(\"findLast\", mapLikeFunc);\naddArrayExtension(\"findLastIndex\", mapLikeFunc);\naddArrayExtension(\"flatMap\", mapLikeFunc);\naddArrayExtension(\"forEach\", mapLikeFunc);\naddArrayExtension(\"map\", mapLikeFunc);\naddArrayExtension(\"some\", mapLikeFunc);\naddArrayExtension(\"toReversed\", mapLikeFunc);\n// reduce\naddArrayExtension(\"reduce\", reduceLikeFunc);\naddArrayExtension(\"reduceRight\", reduceLikeFunc);\nfunction addArrayExtension(funcName, funcFactory) {\n if (typeof Array.prototype[funcName] === \"function\") {\n arrayExtensions[funcName] = funcFactory(funcName);\n }\n}\n// Report and delegate to dehanced array\nfunction simpleFunc(funcName) {\n return function () {\n var adm = this[$mobx];\n adm.atom_.reportObserved();\n var dehancedValues = adm.dehanceValues_(adm.values_);\n return dehancedValues[funcName].apply(dehancedValues, arguments);\n };\n}\n// Make sure callbacks receive correct array arg #2326\nfunction mapLikeFunc(funcName) {\n return function (callback, thisArg) {\n var _this2 = this;\n var adm = this[$mobx];\n adm.atom_.reportObserved();\n var dehancedValues = adm.dehanceValues_(adm.values_);\n return dehancedValues[funcName](function (element, index) {\n return callback.call(thisArg, element, index, _this2);\n });\n };\n}\n// Make sure callbacks receive correct array arg #2326\nfunction reduceLikeFunc(funcName) {\n return function () {\n var _this3 = this;\n var adm = this[$mobx];\n adm.atom_.reportObserved();\n var dehancedValues = adm.dehanceValues_(adm.values_);\n // #2432 - reduce behavior depends on arguments.length\n var callback = arguments[0];\n arguments[0] = function (accumulator, currentValue, index) {\n return callback(accumulator, currentValue, index, _this3);\n };\n return dehancedValues[funcName].apply(dehancedValues, arguments);\n };\n}\nvar isObservableArrayAdministration = /*#__PURE__*/createInstanceofPredicate(\"ObservableArrayAdministration\", ObservableArrayAdministration);\nfunction isObservableArray(thing) {\n return isObject(thing) && isObservableArrayAdministration(thing[$mobx]);\n}\n\nvar ObservableMapMarker = {};\nvar ADD = \"add\";\nvar DELETE = \"delete\";\n// just extend Map? See also https://gist.github.com/nestharus/13b4d74f2ef4a2f4357dbd3fc23c1e54\n// But: https://github.com/mobxjs/mobx/issues/1556\nvar ObservableMap = /*#__PURE__*/function () {\n function ObservableMap(initialData, enhancer_, name_) {\n var _this = this;\n if (enhancer_ === void 0) {\n enhancer_ = deepEnhancer;\n }\n if (name_ === void 0) {\n name_ = true ? \"ObservableMap@\" + getNextId() : 0;\n }\n this.enhancer_ = void 0;\n this.name_ = void 0;\n this[$mobx] = ObservableMapMarker;\n this.data_ = void 0;\n this.hasMap_ = void 0;\n // hasMap, not hashMap >-).\n this.keysAtom_ = void 0;\n this.interceptors_ = void 0;\n this.changeListeners_ = void 0;\n this.dehancer = void 0;\n this.enhancer_ = enhancer_;\n this.name_ = name_;\n if (!isFunction(Map)) {\n die(18);\n }\n initObservable(function () {\n _this.keysAtom_ = createAtom( true ? _this.name_ + \".keys()\" : 0);\n _this.data_ = new Map();\n _this.hasMap_ = new Map();\n if (initialData) {\n _this.merge(initialData);\n }\n });\n }\n var _proto = ObservableMap.prototype;\n _proto.has_ = function has_(key) {\n return this.data_.has(key);\n };\n _proto.has = function has(key) {\n var _this2 = this;\n if (!globalState.trackingDerivation) {\n return this.has_(key);\n }\n var entry = this.hasMap_.get(key);\n if (!entry) {\n var newEntry = entry = new ObservableValue(this.has_(key), referenceEnhancer, true ? this.name_ + \".\" + stringifyKey(key) + \"?\" : 0, false);\n this.hasMap_.set(key, newEntry);\n onBecomeUnobserved(newEntry, function () {\n return _this2.hasMap_[\"delete\"](key);\n });\n }\n return entry.get();\n };\n _proto.set = function set(key, value) {\n var hasKey = this.has_(key);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: hasKey ? UPDATE : ADD,\n object: this,\n newValue: value,\n name: key\n });\n if (!change) {\n return this;\n }\n value = change.newValue;\n }\n if (hasKey) {\n this.updateValue_(key, value);\n } else {\n this.addValue_(key, value);\n }\n return this;\n };\n _proto[\"delete\"] = function _delete(key) {\n var _this3 = this;\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: DELETE,\n object: this,\n name: key\n });\n if (!change) {\n return false;\n }\n }\n if (this.has_(key)) {\n var notifySpy = isSpyEnabled();\n var notify = hasListeners(this);\n var _change = notify || notifySpy ? {\n observableKind: \"map\",\n debugObjectName: this.name_,\n type: DELETE,\n object: this,\n oldValue: this.data_.get(key).value_,\n name: key\n } : null;\n if ( true && notifySpy) {\n spyReportStart(_change);\n } // TODO fix type\n transaction(function () {\n var _this3$hasMap_$get;\n _this3.keysAtom_.reportChanged();\n (_this3$hasMap_$get = _this3.hasMap_.get(key)) == null || _this3$hasMap_$get.setNewValue_(false);\n var observable = _this3.data_.get(key);\n observable.setNewValue_(undefined);\n _this3.data_[\"delete\"](key);\n });\n if (notify) {\n notifyListeners(this, _change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n return true;\n }\n return false;\n };\n _proto.updateValue_ = function updateValue_(key, newValue) {\n var observable = this.data_.get(key);\n newValue = observable.prepareNewValue_(newValue);\n if (newValue !== globalState.UNCHANGED) {\n var notifySpy = isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"map\",\n debugObjectName: this.name_,\n type: UPDATE,\n object: this,\n oldValue: observable.value_,\n name: key,\n newValue: newValue\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n } // TODO fix type\n observable.setNewValue_(newValue);\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n };\n _proto.addValue_ = function addValue_(key, newValue) {\n var _this4 = this;\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n transaction(function () {\n var _this4$hasMap_$get;\n var observable = new ObservableValue(newValue, _this4.enhancer_, true ? _this4.name_ + \".\" + stringifyKey(key) : 0, false);\n _this4.data_.set(key, observable);\n newValue = observable.value_; // value might have been changed\n (_this4$hasMap_$get = _this4.hasMap_.get(key)) == null || _this4$hasMap_$get.setNewValue_(true);\n _this4.keysAtom_.reportChanged();\n });\n var notifySpy = isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"map\",\n debugObjectName: this.name_,\n type: ADD,\n object: this,\n name: key,\n newValue: newValue\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n } // TODO fix type\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n };\n _proto.get = function get(key) {\n if (this.has(key)) {\n return this.dehanceValue_(this.data_.get(key).get());\n }\n return this.dehanceValue_(undefined);\n };\n _proto.dehanceValue_ = function dehanceValue_(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.keys = function keys() {\n this.keysAtom_.reportObserved();\n return this.data_.keys();\n };\n _proto.values = function values() {\n var self = this;\n var keys = this.keys();\n return makeIterableForMap({\n next: function next() {\n var _keys$next = keys.next(),\n done = _keys$next.done,\n value = _keys$next.value;\n return {\n done: done,\n value: done ? undefined : self.get(value)\n };\n }\n });\n };\n _proto.entries = function entries() {\n var self = this;\n var keys = this.keys();\n return makeIterableForMap({\n next: function next() {\n var _keys$next2 = keys.next(),\n done = _keys$next2.done,\n value = _keys$next2.value;\n return {\n done: done,\n value: done ? undefined : [value, self.get(value)]\n };\n }\n });\n };\n _proto[Symbol.iterator] = function () {\n return this.entries();\n };\n _proto.forEach = function forEach(callback, thisArg) {\n for (var _iterator = _createForOfIteratorHelperLoose(this), _step; !(_step = _iterator()).done;) {\n var _step$value = _step.value,\n key = _step$value[0],\n value = _step$value[1];\n callback.call(thisArg, value, key, this);\n }\n }\n /** Merge another object into this object, returns this. */;\n _proto.merge = function merge(other) {\n var _this5 = this;\n if (isObservableMap(other)) {\n other = new Map(other);\n }\n transaction(function () {\n if (isPlainObject(other)) {\n getPlainObjectKeys(other).forEach(function (key) {\n return _this5.set(key, other[key]);\n });\n } else if (Array.isArray(other)) {\n other.forEach(function (_ref) {\n var key = _ref[0],\n value = _ref[1];\n return _this5.set(key, value);\n });\n } else if (isES6Map(other)) {\n if (!isPlainES6Map(other)) {\n die(19, other);\n }\n other.forEach(function (value, key) {\n return _this5.set(key, value);\n });\n } else if (other !== null && other !== undefined) {\n die(20, other);\n }\n });\n return this;\n };\n _proto.clear = function clear() {\n var _this6 = this;\n transaction(function () {\n untracked(function () {\n for (var _iterator2 = _createForOfIteratorHelperLoose(_this6.keys()), _step2; !(_step2 = _iterator2()).done;) {\n var key = _step2.value;\n _this6[\"delete\"](key);\n }\n });\n });\n };\n _proto.replace = function replace(values) {\n var _this7 = this;\n // Implementation requirements:\n // - respect ordering of replacement map\n // - allow interceptors to run and potentially prevent individual operations\n // - don't recreate observables that already exist in original map (so we don't destroy existing subscriptions)\n // - don't _keysAtom.reportChanged if the keys of resulting map are indentical (order matters!)\n // - note that result map may differ from replacement map due to the interceptors\n transaction(function () {\n // Convert to map so we can do quick key lookups\n var replacementMap = convertToMap(values);\n var orderedData = new Map();\n // Used for optimization\n var keysReportChangedCalled = false;\n // Delete keys that don't exist in replacement map\n // if the key deletion is prevented by interceptor\n // add entry at the beginning of the result map\n for (var _iterator3 = _createForOfIteratorHelperLoose(_this7.data_.keys()), _step3; !(_step3 = _iterator3()).done;) {\n var key = _step3.value;\n // Concurrently iterating/deleting keys\n // iterator should handle this correctly\n if (!replacementMap.has(key)) {\n var deleted = _this7[\"delete\"](key);\n // Was the key removed?\n if (deleted) {\n // _keysAtom.reportChanged() was already called\n keysReportChangedCalled = true;\n } else {\n // Delete prevented by interceptor\n var value = _this7.data_.get(key);\n orderedData.set(key, value);\n }\n }\n }\n // Merge entries\n for (var _iterator4 = _createForOfIteratorHelperLoose(replacementMap.entries()), _step4; !(_step4 = _iterator4()).done;) {\n var _step4$value = _step4.value,\n _key = _step4$value[0],\n _value = _step4$value[1];\n // We will want to know whether a new key is added\n var keyExisted = _this7.data_.has(_key);\n // Add or update value\n _this7.set(_key, _value);\n // The addition could have been prevent by interceptor\n if (_this7.data_.has(_key)) {\n // The update could have been prevented by interceptor\n // and also we want to preserve existing values\n // so use value from _data map (instead of replacement map)\n var _value2 = _this7.data_.get(_key);\n orderedData.set(_key, _value2);\n // Was a new key added?\n if (!keyExisted) {\n // _keysAtom.reportChanged() was already called\n keysReportChangedCalled = true;\n }\n }\n }\n // Check for possible key order change\n if (!keysReportChangedCalled) {\n if (_this7.data_.size !== orderedData.size) {\n // If size differs, keys are definitely modified\n _this7.keysAtom_.reportChanged();\n } else {\n var iter1 = _this7.data_.keys();\n var iter2 = orderedData.keys();\n var next1 = iter1.next();\n var next2 = iter2.next();\n while (!next1.done) {\n if (next1.value !== next2.value) {\n _this7.keysAtom_.reportChanged();\n break;\n }\n next1 = iter1.next();\n next2 = iter2.next();\n }\n }\n }\n // Use correctly ordered map\n _this7.data_ = orderedData;\n });\n return this;\n };\n _proto.toString = function toString() {\n return \"[object ObservableMap]\";\n };\n _proto.toJSON = function toJSON() {\n return Array.from(this);\n };\n /**\n * Observes this object. Triggers for the events 'add', 'update' and 'delete'.\n * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe\n * for callback details\n */\n _proto.observe_ = function observe_(listener, fireImmediately) {\n if ( true && fireImmediately === true) {\n die(\"`observe` doesn't support fireImmediately=true in combination with maps.\");\n }\n return registerListener(this, listener);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n return _createClass(ObservableMap, [{\n key: \"size\",\n get: function get() {\n this.keysAtom_.reportObserved();\n return this.data_.size;\n }\n }, {\n key: Symbol.toStringTag,\n get: function get() {\n return \"Map\";\n }\n }]);\n}();\n// eslint-disable-next-line\nvar isObservableMap = /*#__PURE__*/createInstanceofPredicate(\"ObservableMap\", ObservableMap);\nfunction makeIterableForMap(iterator) {\n iterator[Symbol.toStringTag] = \"MapIterator\";\n return makeIterable(iterator);\n}\nfunction convertToMap(dataStructure) {\n if (isES6Map(dataStructure) || isObservableMap(dataStructure)) {\n return dataStructure;\n } else if (Array.isArray(dataStructure)) {\n return new Map(dataStructure);\n } else if (isPlainObject(dataStructure)) {\n var map = new Map();\n for (var key in dataStructure) {\n map.set(key, dataStructure[key]);\n }\n return map;\n } else {\n return die(21, dataStructure);\n }\n}\n\nvar ObservableSetMarker = {};\nvar ObservableSet = /*#__PURE__*/function () {\n function ObservableSet(initialData, enhancer, name_) {\n var _this = this;\n if (enhancer === void 0) {\n enhancer = deepEnhancer;\n }\n if (name_ === void 0) {\n name_ = true ? \"ObservableSet@\" + getNextId() : 0;\n }\n this.name_ = void 0;\n this[$mobx] = ObservableSetMarker;\n this.data_ = new Set();\n this.atom_ = void 0;\n this.changeListeners_ = void 0;\n this.interceptors_ = void 0;\n this.dehancer = void 0;\n this.enhancer_ = void 0;\n this.name_ = name_;\n if (!isFunction(Set)) {\n die(22);\n }\n this.enhancer_ = function (newV, oldV) {\n return enhancer(newV, oldV, name_);\n };\n initObservable(function () {\n _this.atom_ = createAtom(_this.name_);\n if (initialData) {\n _this.replace(initialData);\n }\n });\n }\n var _proto = ObservableSet.prototype;\n _proto.dehanceValue_ = function dehanceValue_(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.clear = function clear() {\n var _this2 = this;\n transaction(function () {\n untracked(function () {\n for (var _iterator = _createForOfIteratorHelperLoose(_this2.data_.values()), _step; !(_step = _iterator()).done;) {\n var value = _step.value;\n _this2[\"delete\"](value);\n }\n });\n });\n };\n _proto.forEach = function forEach(callbackFn, thisArg) {\n for (var _iterator2 = _createForOfIteratorHelperLoose(this), _step2; !(_step2 = _iterator2()).done;) {\n var value = _step2.value;\n callbackFn.call(thisArg, value, value, this);\n }\n };\n _proto.add = function add(value) {\n var _this3 = this;\n checkIfStateModificationsAreAllowed(this.atom_);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: ADD,\n object: this,\n newValue: value\n });\n if (!change) {\n return this;\n }\n // ideally, value = change.value would be done here, so that values can be\n // changed by interceptor. Same applies for other Set and Map api's.\n }\n if (!this.has(value)) {\n transaction(function () {\n _this3.data_.add(_this3.enhancer_(value, undefined));\n _this3.atom_.reportChanged();\n });\n var notifySpy = true && isSpyEnabled();\n var notify = hasListeners(this);\n var _change = notify || notifySpy ? {\n observableKind: \"set\",\n debugObjectName: this.name_,\n type: ADD,\n object: this,\n newValue: value\n } : null;\n if (notifySpy && \"development\" !== \"production\") {\n spyReportStart(_change);\n }\n if (notify) {\n notifyListeners(this, _change);\n }\n if (notifySpy && \"development\" !== \"production\") {\n spyReportEnd();\n }\n }\n return this;\n };\n _proto[\"delete\"] = function _delete(value) {\n var _this4 = this;\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: DELETE,\n object: this,\n oldValue: value\n });\n if (!change) {\n return false;\n }\n }\n if (this.has(value)) {\n var notifySpy = true && isSpyEnabled();\n var notify = hasListeners(this);\n var _change2 = notify || notifySpy ? {\n observableKind: \"set\",\n debugObjectName: this.name_,\n type: DELETE,\n object: this,\n oldValue: value\n } : null;\n if (notifySpy && \"development\" !== \"production\") {\n spyReportStart(_change2);\n }\n transaction(function () {\n _this4.atom_.reportChanged();\n _this4.data_[\"delete\"](value);\n });\n if (notify) {\n notifyListeners(this, _change2);\n }\n if (notifySpy && \"development\" !== \"production\") {\n spyReportEnd();\n }\n return true;\n }\n return false;\n };\n _proto.has = function has(value) {\n this.atom_.reportObserved();\n return this.data_.has(this.dehanceValue_(value));\n };\n _proto.entries = function entries() {\n var nextIndex = 0;\n var keys = Array.from(this.keys());\n var values = Array.from(this.values());\n return makeIterableForSet({\n next: function next() {\n var index = nextIndex;\n nextIndex += 1;\n return index < values.length ? {\n value: [keys[index], values[index]],\n done: false\n } : {\n value: undefined,\n done: true\n };\n }\n });\n };\n _proto.keys = function keys() {\n return this.values();\n };\n _proto.values = function values() {\n this.atom_.reportObserved();\n var self = this;\n var nextIndex = 0;\n var observableValues = Array.from(this.data_.values());\n return makeIterableForSet({\n next: function next() {\n return nextIndex < observableValues.length ? {\n value: self.dehanceValue_(observableValues[nextIndex++]),\n done: false\n } : {\n value: undefined,\n done: true\n };\n }\n });\n };\n _proto.intersection = function intersection(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.intersection(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.intersection(otherSet);\n }\n };\n _proto.union = function union(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.union(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.union(otherSet);\n }\n };\n _proto.difference = function difference(otherSet) {\n return new Set(this).difference(otherSet);\n };\n _proto.symmetricDifference = function symmetricDifference(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.symmetricDifference(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.symmetricDifference(otherSet);\n }\n };\n _proto.isSubsetOf = function isSubsetOf(otherSet) {\n return new Set(this).isSubsetOf(otherSet);\n };\n _proto.isSupersetOf = function isSupersetOf(otherSet) {\n return new Set(this).isSupersetOf(otherSet);\n };\n _proto.isDisjointFrom = function isDisjointFrom(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.isDisjointFrom(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.isDisjointFrom(otherSet);\n }\n };\n _proto.replace = function replace(other) {\n var _this5 = this;\n if (isObservableSet(other)) {\n other = new Set(other);\n }\n transaction(function () {\n if (Array.isArray(other)) {\n _this5.clear();\n other.forEach(function (value) {\n return _this5.add(value);\n });\n } else if (isES6Set(other)) {\n _this5.clear();\n other.forEach(function (value) {\n return _this5.add(value);\n });\n } else if (other !== null && other !== undefined) {\n die(\"Cannot initialize set from \" + other);\n }\n });\n return this;\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n // ... 'fireImmediately' could also be true?\n if ( true && fireImmediately === true) {\n die(\"`observe` doesn't support fireImmediately=true in combination with sets.\");\n }\n return registerListener(this, listener);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.toJSON = function toJSON() {\n return Array.from(this);\n };\n _proto.toString = function toString() {\n return \"[object ObservableSet]\";\n };\n _proto[Symbol.iterator] = function () {\n return this.values();\n };\n return _createClass(ObservableSet, [{\n key: \"size\",\n get: function get() {\n this.atom_.reportObserved();\n return this.data_.size;\n }\n }, {\n key: Symbol.toStringTag,\n get: function get() {\n return \"Set\";\n }\n }]);\n}();\n// eslint-disable-next-line\nvar isObservableSet = /*#__PURE__*/createInstanceofPredicate(\"ObservableSet\", ObservableSet);\nfunction makeIterableForSet(iterator) {\n iterator[Symbol.toStringTag] = \"SetIterator\";\n return makeIterable(iterator);\n}\n\nvar descriptorCache = /*#__PURE__*/Object.create(null);\nvar REMOVE = \"remove\";\nvar ObservableObjectAdministration = /*#__PURE__*/function () {\n function ObservableObjectAdministration(target_, values_, name_,\n // Used anytime annotation is not explicitely provided\n defaultAnnotation_) {\n if (values_ === void 0) {\n values_ = new Map();\n }\n if (defaultAnnotation_ === void 0) {\n defaultAnnotation_ = autoAnnotation;\n }\n this.target_ = void 0;\n this.values_ = void 0;\n this.name_ = void 0;\n this.defaultAnnotation_ = void 0;\n this.keysAtom_ = void 0;\n this.changeListeners_ = void 0;\n this.interceptors_ = void 0;\n this.proxy_ = void 0;\n this.isPlainObject_ = void 0;\n this.appliedAnnotations_ = void 0;\n this.pendingKeys_ = void 0;\n this.target_ = target_;\n this.values_ = values_;\n this.name_ = name_;\n this.defaultAnnotation_ = defaultAnnotation_;\n this.keysAtom_ = new Atom( true ? this.name_ + \".keys\" : 0);\n // Optimization: we use this frequently\n this.isPlainObject_ = isPlainObject(this.target_);\n if ( true && !isAnnotation(this.defaultAnnotation_)) {\n die(\"defaultAnnotation must be valid annotation\");\n }\n if (true) {\n // Prepare structure for tracking which fields were already annotated\n this.appliedAnnotations_ = {};\n }\n }\n var _proto = ObservableObjectAdministration.prototype;\n _proto.getObservablePropValue_ = function getObservablePropValue_(key) {\n return this.values_.get(key).get();\n };\n _proto.setObservablePropValue_ = function setObservablePropValue_(key, newValue) {\n var observable = this.values_.get(key);\n if (observable instanceof ComputedValue) {\n observable.set(newValue);\n return true;\n }\n // intercept\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: UPDATE,\n object: this.proxy_ || this.target_,\n name: key,\n newValue: newValue\n });\n if (!change) {\n return null;\n }\n newValue = change.newValue;\n }\n newValue = observable.prepareNewValue_(newValue);\n // notify spy & observers\n if (newValue !== globalState.UNCHANGED) {\n var notify = hasListeners(this);\n var notifySpy = true && isSpyEnabled();\n var _change = notify || notifySpy ? {\n type: UPDATE,\n observableKind: \"object\",\n debugObjectName: this.name_,\n object: this.proxy_ || this.target_,\n oldValue: observable.value_,\n name: key,\n newValue: newValue\n } : null;\n if ( true && notifySpy) {\n spyReportStart(_change);\n }\n observable.setNewValue_(newValue);\n if (notify) {\n notifyListeners(this, _change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n return true;\n };\n _proto.get_ = function get_(key) {\n if (globalState.trackingDerivation && !hasProp(this.target_, key)) {\n // Key doesn't exist yet, subscribe for it in case it's added later\n this.has_(key);\n }\n return this.target_[key];\n }\n /**\n * @param {PropertyKey} key\n * @param {any} value\n * @param {Annotation|boolean} annotation true - use default annotation, false - copy as is\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.set_ = function set_(key, value, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n // Don't use .has(key) - we care about own\n if (hasProp(this.target_, key)) {\n // Existing prop\n if (this.values_.has(key)) {\n // Observable (can be intercepted)\n return this.setObservablePropValue_(key, value);\n } else if (proxyTrap) {\n // Non-observable - proxy\n return Reflect.set(this.target_, key, value);\n } else {\n // Non-observable\n this.target_[key] = value;\n return true;\n }\n } else {\n // New prop\n return this.extend_(key, {\n value: value,\n enumerable: true,\n writable: true,\n configurable: true\n }, this.defaultAnnotation_, proxyTrap);\n }\n }\n // Trap for \"in\"\n ;\n _proto.has_ = function has_(key) {\n if (!globalState.trackingDerivation) {\n // Skip key subscription outside derivation\n return key in this.target_;\n }\n this.pendingKeys_ || (this.pendingKeys_ = new Map());\n var entry = this.pendingKeys_.get(key);\n if (!entry) {\n entry = new ObservableValue(key in this.target_, referenceEnhancer, true ? this.name_ + \".\" + stringifyKey(key) + \"?\" : 0, false);\n this.pendingKeys_.set(key, entry);\n }\n return entry.get();\n }\n /**\n * @param {PropertyKey} key\n * @param {Annotation|boolean} annotation true - use default annotation, false - ignore prop\n */;\n _proto.make_ = function make_(key, annotation) {\n if (annotation === true) {\n annotation = this.defaultAnnotation_;\n }\n if (annotation === false) {\n return;\n }\n assertAnnotable(this, annotation, key);\n if (!(key in this.target_)) {\n var _this$target_$storedA;\n // Throw on missing key, except for decorators:\n // Decorator annotations are collected from whole prototype chain.\n // When called from super() some props may not exist yet.\n // However we don't have to worry about missing prop,\n // because the decorator must have been applied to something.\n if ((_this$target_$storedA = this.target_[storedAnnotationsSymbol]) != null && _this$target_$storedA[key]) {\n return; // will be annotated by subclass constructor\n } else {\n die(1, annotation.annotationType_, this.name_ + \".\" + key.toString());\n }\n }\n var source = this.target_;\n while (source && source !== objectPrototype) {\n var descriptor = getDescriptor(source, key);\n if (descriptor) {\n var outcome = annotation.make_(this, key, descriptor, source);\n if (outcome === 0 /* MakeResult.Cancel */) {\n return;\n }\n if (outcome === 1 /* MakeResult.Break */) {\n break;\n }\n }\n source = Object.getPrototypeOf(source);\n }\n recordAnnotationApplied(this, annotation, key);\n }\n /**\n * @param {PropertyKey} key\n * @param {PropertyDescriptor} descriptor\n * @param {Annotation|boolean} annotation true - use default annotation, false - copy as is\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.extend_ = function extend_(key, descriptor, annotation, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n if (annotation === true) {\n annotation = this.defaultAnnotation_;\n }\n if (annotation === false) {\n return this.defineProperty_(key, descriptor, proxyTrap);\n }\n assertAnnotable(this, annotation, key);\n var outcome = annotation.extend_(this, key, descriptor, proxyTrap);\n if (outcome) {\n recordAnnotationApplied(this, annotation, key);\n }\n return outcome;\n }\n /**\n * @param {PropertyKey} key\n * @param {PropertyDescriptor} descriptor\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.defineProperty_ = function defineProperty_(key, descriptor, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n try {\n startBatch();\n // Delete\n var deleteOutcome = this.delete_(key);\n if (!deleteOutcome) {\n // Failure or intercepted\n return deleteOutcome;\n }\n // ADD interceptor\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: ADD,\n newValue: descriptor.value\n });\n if (!change) {\n return null;\n }\n var newValue = change.newValue;\n if (descriptor.value !== newValue) {\n descriptor = _extends({}, descriptor, {\n value: newValue\n });\n }\n }\n // Define\n if (proxyTrap) {\n if (!Reflect.defineProperty(this.target_, key, descriptor)) {\n return false;\n }\n } else {\n defineProperty(this.target_, key, descriptor);\n }\n // Notify\n this.notifyPropertyAddition_(key, descriptor.value);\n } finally {\n endBatch();\n }\n return true;\n }\n // If original descriptor becomes relevant, move this to annotation directly\n ;\n _proto.defineObservableProperty_ = function defineObservableProperty_(key, value, enhancer, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n try {\n startBatch();\n // Delete\n var deleteOutcome = this.delete_(key);\n if (!deleteOutcome) {\n // Failure or intercepted\n return deleteOutcome;\n }\n // ADD interceptor\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: ADD,\n newValue: value\n });\n if (!change) {\n return null;\n }\n value = change.newValue;\n }\n var cachedDescriptor = getCachedObservablePropDescriptor(key);\n var descriptor = {\n configurable: globalState.safeDescriptors ? this.isPlainObject_ : true,\n enumerable: true,\n get: cachedDescriptor.get,\n set: cachedDescriptor.set\n };\n // Define\n if (proxyTrap) {\n if (!Reflect.defineProperty(this.target_, key, descriptor)) {\n return false;\n }\n } else {\n defineProperty(this.target_, key, descriptor);\n }\n var observable = new ObservableValue(value, enhancer, true ? this.name_ + \".\" + key.toString() : 0, false);\n this.values_.set(key, observable);\n // Notify (value possibly changed by ObservableValue)\n this.notifyPropertyAddition_(key, observable.value_);\n } finally {\n endBatch();\n }\n return true;\n }\n // If original descriptor becomes relevant, move this to annotation directly\n ;\n _proto.defineComputedProperty_ = function defineComputedProperty_(key, options, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n try {\n startBatch();\n // Delete\n var deleteOutcome = this.delete_(key);\n if (!deleteOutcome) {\n // Failure or intercepted\n return deleteOutcome;\n }\n // ADD interceptor\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: ADD,\n newValue: undefined\n });\n if (!change) {\n return null;\n }\n }\n options.name || (options.name = true ? this.name_ + \".\" + key.toString() : 0);\n options.context = this.proxy_ || this.target_;\n var cachedDescriptor = getCachedObservablePropDescriptor(key);\n var descriptor = {\n configurable: globalState.safeDescriptors ? this.isPlainObject_ : true,\n enumerable: false,\n get: cachedDescriptor.get,\n set: cachedDescriptor.set\n };\n // Define\n if (proxyTrap) {\n if (!Reflect.defineProperty(this.target_, key, descriptor)) {\n return false;\n }\n } else {\n defineProperty(this.target_, key, descriptor);\n }\n this.values_.set(key, new ComputedValue(options));\n // Notify\n this.notifyPropertyAddition_(key, undefined);\n } finally {\n endBatch();\n }\n return true;\n }\n /**\n * @param {PropertyKey} key\n * @param {PropertyDescriptor} descriptor\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.delete_ = function delete_(key, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n // No such prop\n if (!hasProp(this.target_, key)) {\n return true;\n }\n // Intercept\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: REMOVE\n });\n // Cancelled\n if (!change) {\n return null;\n }\n }\n // Delete\n try {\n var _this$pendingKeys_;\n startBatch();\n var notify = hasListeners(this);\n var notifySpy = true && isSpyEnabled();\n var observable = this.values_.get(key);\n // Value needed for spies/listeners\n var value = undefined;\n // Optimization: don't pull the value unless we will need it\n if (!observable && (notify || notifySpy)) {\n var _getDescriptor;\n value = (_getDescriptor = getDescriptor(this.target_, key)) == null ? void 0 : _getDescriptor.value;\n }\n // delete prop (do first, may fail)\n if (proxyTrap) {\n if (!Reflect.deleteProperty(this.target_, key)) {\n return false;\n }\n } else {\n delete this.target_[key];\n }\n // Allow re-annotating this field\n if (true) {\n delete this.appliedAnnotations_[key];\n }\n // Clear observable\n if (observable) {\n this.values_[\"delete\"](key);\n // for computed, value is undefined\n if (observable instanceof ObservableValue) {\n value = observable.value_;\n }\n // Notify: autorun(() => obj[key]), see #1796\n propagateChanged(observable);\n }\n // Notify \"keys/entries/values\" observers\n this.keysAtom_.reportChanged();\n // Notify \"has\" observers\n // \"in\" as it may still exist in proto\n (_this$pendingKeys_ = this.pendingKeys_) == null || (_this$pendingKeys_ = _this$pendingKeys_.get(key)) == null || _this$pendingKeys_.set(key in this.target_);\n // Notify spies/listeners\n if (notify || notifySpy) {\n var _change2 = {\n type: REMOVE,\n observableKind: \"object\",\n object: this.proxy_ || this.target_,\n debugObjectName: this.name_,\n oldValue: value,\n name: key\n };\n if ( true && notifySpy) {\n spyReportStart(_change2);\n }\n if (notify) {\n notifyListeners(this, _change2);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n } finally {\n endBatch();\n }\n return true;\n }\n /**\n * Observes this object. Triggers for the events 'add', 'update' and 'delete'.\n * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe\n * for callback details\n */;\n _proto.observe_ = function observe_(callback, fireImmediately) {\n if ( true && fireImmediately === true) {\n die(\"`observe` doesn't support the fire immediately property for observable objects.\");\n }\n return registerListener(this, callback);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.notifyPropertyAddition_ = function notifyPropertyAddition_(key, value) {\n var _this$pendingKeys_2;\n var notify = hasListeners(this);\n var notifySpy = true && isSpyEnabled();\n if (notify || notifySpy) {\n var change = notify || notifySpy ? {\n type: ADD,\n observableKind: \"object\",\n debugObjectName: this.name_,\n object: this.proxy_ || this.target_,\n name: key,\n newValue: value\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n }\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n (_this$pendingKeys_2 = this.pendingKeys_) == null || (_this$pendingKeys_2 = _this$pendingKeys_2.get(key)) == null || _this$pendingKeys_2.set(true);\n // Notify \"keys/entries/values\" observers\n this.keysAtom_.reportChanged();\n };\n _proto.ownKeys_ = function ownKeys_() {\n this.keysAtom_.reportObserved();\n return ownKeys(this.target_);\n };\n _proto.keys_ = function keys_() {\n // Returns enumerable && own, but unfortunately keysAtom will report on ANY key change.\n // There is no way to distinguish between Object.keys(object) and Reflect.ownKeys(object) - both are handled by ownKeys trap.\n // We can either over-report in Object.keys(object) or under-report in Reflect.ownKeys(object)\n // We choose to over-report in Object.keys(object), because:\n // - typically it's used with simple data objects\n // - when symbolic/non-enumerable keys are relevant Reflect.ownKeys works as expected\n this.keysAtom_.reportObserved();\n return Object.keys(this.target_);\n };\n return ObservableObjectAdministration;\n}();\nfunction asObservableObject(target, options) {\n var _options$name;\n if ( true && options && isObservableObject(target)) {\n die(\"Options can't be provided for already observable objects.\");\n }\n if (hasProp(target, $mobx)) {\n if ( true && !(getAdministration(target) instanceof ObservableObjectAdministration)) {\n die(\"Cannot convert '\" + getDebugName(target) + \"' into observable object:\" + \"\\nThe target is already observable of different type.\" + \"\\nExtending builtins is not supported.\");\n }\n return target;\n }\n if ( true && !Object.isExtensible(target)) {\n die(\"Cannot make the designated object observable; it is not extensible\");\n }\n var name = (_options$name = options == null ? void 0 : options.name) != null ? _options$name : true ? (isPlainObject(target) ? \"ObservableObject\" : target.constructor.name) + \"@\" + getNextId() : 0;\n var adm = new ObservableObjectAdministration(target, new Map(), String(name), getAnnotationFromOptions(options));\n addHiddenProp(target, $mobx, adm);\n return target;\n}\nvar isObservableObjectAdministration = /*#__PURE__*/createInstanceofPredicate(\"ObservableObjectAdministration\", ObservableObjectAdministration);\nfunction getCachedObservablePropDescriptor(key) {\n return descriptorCache[key] || (descriptorCache[key] = {\n get: function get() {\n return this[$mobx].getObservablePropValue_(key);\n },\n set: function set(value) {\n return this[$mobx].setObservablePropValue_(key, value);\n }\n });\n}\nfunction isObservableObject(thing) {\n if (isObject(thing)) {\n return isObservableObjectAdministration(thing[$mobx]);\n }\n return false;\n}\nfunction recordAnnotationApplied(adm, annotation, key) {\n var _adm$target_$storedAn;\n if (true) {\n adm.appliedAnnotations_[key] = annotation;\n }\n // Remove applied decorator annotation so we don't try to apply it again in subclass constructor\n (_adm$target_$storedAn = adm.target_[storedAnnotationsSymbol]) == null || delete _adm$target_$storedAn[key];\n}\nfunction assertAnnotable(adm, annotation, key) {\n // Valid annotation\n if ( true && !isAnnotation(annotation)) {\n die(\"Cannot annotate '\" + adm.name_ + \".\" + key.toString() + \"': Invalid annotation.\");\n }\n /*\n // Configurable, not sealed, not frozen\n // Possibly not needed, just a little better error then the one thrown by engine.\n // Cases where this would be useful the most (subclass field initializer) are not interceptable by this.\n if (__DEV__) {\n const configurable = getDescriptor(adm.target_, key)?.configurable\n const frozen = Object.isFrozen(adm.target_)\n const sealed = Object.isSealed(adm.target_)\n if (!configurable || frozen || sealed) {\n const fieldName = `${adm.name_}.${key.toString()}`\n const requestedAnnotationType = annotation.annotationType_\n let error = `Cannot apply '${requestedAnnotationType}' to '${fieldName}':`\n if (frozen) {\n error += `\\nObject is frozen.`\n }\n if (sealed) {\n error += `\\nObject is sealed.`\n }\n if (!configurable) {\n error += `\\nproperty is not configurable.`\n // Mention only if caused by us to avoid confusion\n if (hasProp(adm.appliedAnnotations!, key)) {\n error += `\\nTo prevent accidental re-definition of a field by a subclass, `\n error += `all annotated fields of non-plain objects (classes) are not configurable.`\n }\n }\n die(error)\n }\n }\n */\n // Not annotated\n if ( true && !isOverride(annotation) && hasProp(adm.appliedAnnotations_, key)) {\n var fieldName = adm.name_ + \".\" + key.toString();\n var currentAnnotationType = adm.appliedAnnotations_[key].annotationType_;\n var requestedAnnotationType = annotation.annotationType_;\n die(\"Cannot apply '\" + requestedAnnotationType + \"' to '\" + fieldName + \"':\" + (\"\\nThe field is already annotated with '\" + currentAnnotationType + \"'.\") + \"\\nRe-annotating fields is not allowed.\" + \"\\nUse 'override' annotation for methods overridden by subclass.\");\n }\n}\n\n// Bug in safari 9.* (or iOS 9 safari mobile). See #364\nvar ENTRY_0 = /*#__PURE__*/createArrayEntryDescriptor(0);\nvar safariPrototypeSetterInheritanceBug = /*#__PURE__*/function () {\n var v = false;\n var p = {};\n Object.defineProperty(p, \"0\", {\n set: function set() {\n v = true;\n }\n });\n /*#__PURE__*/Object.create(p)[\"0\"] = 1;\n return v === false;\n}();\n/**\n * This array buffer contains two lists of properties, so that all arrays\n * can recycle their property definitions, which significantly improves performance of creating\n * properties on the fly.\n */\nvar OBSERVABLE_ARRAY_BUFFER_SIZE = 0;\n// Typescript workaround to make sure ObservableArray extends Array\nvar StubArray = function StubArray() {};\nfunction inherit(ctor, proto) {\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(ctor.prototype, proto);\n } else if (ctor.prototype.__proto__ !== undefined) {\n ctor.prototype.__proto__ = proto;\n } else {\n ctor.prototype = proto;\n }\n}\ninherit(StubArray, Array.prototype);\n// Weex proto freeze protection was here,\n// but it is unclear why the hack is need as MobX never changed the prototype\n// anyway, so removed it in V6\nvar LegacyObservableArray = /*#__PURE__*/function (_StubArray) {\n function LegacyObservableArray(initialValues, enhancer, name, owned) {\n var _this;\n if (name === void 0) {\n name = true ? \"ObservableArray@\" + getNextId() : 0;\n }\n if (owned === void 0) {\n owned = false;\n }\n _this = _StubArray.call(this) || this;\n initObservable(function () {\n var adm = new ObservableArrayAdministration(name, enhancer, owned, true);\n adm.proxy_ = _this;\n addHiddenFinalProp(_this, $mobx, adm);\n if (initialValues && initialValues.length) {\n // @ts-ignore\n _this.spliceWithArray(0, 0, initialValues);\n }\n if (safariPrototypeSetterInheritanceBug) {\n // Seems that Safari won't use numeric prototype setter until any * numeric property is\n // defined on the instance. After that it works fine, even if this property is deleted.\n Object.defineProperty(_this, \"0\", ENTRY_0);\n }\n });\n return _this;\n }\n _inheritsLoose(LegacyObservableArray, _StubArray);\n var _proto = LegacyObservableArray.prototype;\n _proto.concat = function concat() {\n this[$mobx].atom_.reportObserved();\n for (var _len = arguments.length, arrays = new Array(_len), _key = 0; _key < _len; _key++) {\n arrays[_key] = arguments[_key];\n }\n return Array.prototype.concat.apply(this.slice(),\n //@ts-ignore\n arrays.map(function (a) {\n return isObservableArray(a) ? a.slice() : a;\n }));\n };\n _proto[Symbol.iterator] = function () {\n var self = this;\n var nextIndex = 0;\n return makeIterable({\n next: function next() {\n return nextIndex < self.length ? {\n value: self[nextIndex++],\n done: false\n } : {\n done: true,\n value: undefined\n };\n }\n });\n };\n return _createClass(LegacyObservableArray, [{\n key: \"length\",\n get: function get() {\n return this[$mobx].getArrayLength_();\n },\n set: function set(newLength) {\n this[$mobx].setArrayLength_(newLength);\n }\n }, {\n key: Symbol.toStringTag,\n get: function get() {\n return \"Array\";\n }\n }]);\n}(StubArray);\nObject.entries(arrayExtensions).forEach(function (_ref) {\n var prop = _ref[0],\n fn = _ref[1];\n if (prop !== \"concat\") {\n addHiddenProp(LegacyObservableArray.prototype, prop, fn);\n }\n});\nfunction createArrayEntryDescriptor(index) {\n return {\n enumerable: false,\n configurable: true,\n get: function get() {\n return this[$mobx].get_(index);\n },\n set: function set(value) {\n this[$mobx].set_(index, value);\n }\n };\n}\nfunction createArrayBufferItem(index) {\n defineProperty(LegacyObservableArray.prototype, \"\" + index, createArrayEntryDescriptor(index));\n}\nfunction reserveArrayBuffer(max) {\n if (max > OBSERVABLE_ARRAY_BUFFER_SIZE) {\n for (var index = OBSERVABLE_ARRAY_BUFFER_SIZE; index < max + 100; index++) {\n createArrayBufferItem(index);\n }\n OBSERVABLE_ARRAY_BUFFER_SIZE = max;\n }\n}\nreserveArrayBuffer(1000);\nfunction createLegacyArray(initialValues, enhancer, name) {\n return new LegacyObservableArray(initialValues, enhancer, name);\n}\n\nfunction getAtom(thing, property) {\n if (typeof thing === \"object\" && thing !== null) {\n if (isObservableArray(thing)) {\n if (property !== undefined) {\n die(23);\n }\n return thing[$mobx].atom_;\n }\n if (isObservableSet(thing)) {\n return thing.atom_;\n }\n if (isObservableMap(thing)) {\n if (property === undefined) {\n return thing.keysAtom_;\n }\n var observable = thing.data_.get(property) || thing.hasMap_.get(property);\n if (!observable) {\n die(25, property, getDebugName(thing));\n }\n return observable;\n }\n if (isObservableObject(thing)) {\n if (!property) {\n return die(26);\n }\n var _observable = thing[$mobx].values_.get(property);\n if (!_observable) {\n die(27, property, getDebugName(thing));\n }\n return _observable;\n }\n if (isAtom(thing) || isComputedValue(thing) || isReaction(thing)) {\n return thing;\n }\n } else if (isFunction(thing)) {\n if (isReaction(thing[$mobx])) {\n // disposer function\n return thing[$mobx];\n }\n }\n die(28);\n}\nfunction getAdministration(thing, property) {\n if (!thing) {\n die(29);\n }\n if (property !== undefined) {\n return getAdministration(getAtom(thing, property));\n }\n if (isAtom(thing) || isComputedValue(thing) || isReaction(thing)) {\n return thing;\n }\n if (isObservableMap(thing) || isObservableSet(thing)) {\n return thing;\n }\n if (thing[$mobx]) {\n return thing[$mobx];\n }\n die(24, thing);\n}\nfunction getDebugName(thing, property) {\n var named;\n if (property !== undefined) {\n named = getAtom(thing, property);\n } else if (isAction(thing)) {\n return thing.name;\n } else if (isObservableObject(thing) || isObservableMap(thing) || isObservableSet(thing)) {\n named = getAdministration(thing);\n } else {\n // valid for arrays as well\n named = getAtom(thing);\n }\n return named.name_;\n}\n/**\n * Helper function for initializing observable structures, it applies:\n * 1. allowStateChanges so we don't violate enforceActions.\n * 2. untracked so we don't accidentaly subscribe to anything observable accessed during init in case the observable is created inside derivation.\n * 3. batch to avoid state version updates\n */\nfunction initObservable(cb) {\n var derivation = untrackedStart();\n var allowStateChanges = allowStateChangesStart(true);\n startBatch();\n try {\n return cb();\n } finally {\n endBatch();\n allowStateChangesEnd(allowStateChanges);\n untrackedEnd(derivation);\n }\n}\n\nvar toString = objectPrototype.toString;\nfunction deepEqual(a, b, depth) {\n if (depth === void 0) {\n depth = -1;\n }\n return eq(a, b, depth);\n}\n// Copied from https://github.com/jashkenas/underscore/blob/5c237a7c682fb68fd5378203f0bf22dce1624854/underscore.js#L1186-L1289\n// Internal recursive comparison function for `isEqual`.\nfunction eq(a, b, depth, aStack, bStack) {\n // Identical objects are equal. `0 === -0`, but they aren't identical.\n // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).\n if (a === b) {\n return a !== 0 || 1 / a === 1 / b;\n }\n // `null` or `undefined` only equal to itself (strict comparison).\n if (a == null || b == null) {\n return false;\n }\n // `NaN`s are equivalent, but non-reflexive.\n if (a !== a) {\n return b !== b;\n }\n // Exhaust primitive checks\n var type = typeof a;\n if (type !== \"function\" && type !== \"object\" && typeof b != \"object\") {\n return false;\n }\n // Compare `[[Class]]` names.\n var className = toString.call(a);\n if (className !== toString.call(b)) {\n return false;\n }\n switch (className) {\n // Strings, numbers, regular expressions, dates, and booleans are compared by value.\n case \"[object RegExp]\":\n // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i')\n case \"[object String]\":\n // Primitives and their corresponding object wrappers are equivalent; thus, `\"5\"` is\n // equivalent to `new String(\"5\")`.\n return \"\" + a === \"\" + b;\n case \"[object Number]\":\n // `NaN`s are equivalent, but non-reflexive.\n // Object(NaN) is equivalent to NaN.\n if (+a !== +a) {\n return +b !== +b;\n }\n // An `egal` comparison is performed for other numeric values.\n return +a === 0 ? 1 / +a === 1 / b : +a === +b;\n case \"[object Date]\":\n case \"[object Boolean]\":\n // Coerce dates and booleans to numeric primitive values. Dates are compared by their\n // millisecond representations. Note that invalid dates with millisecond representations\n // of `NaN` are not equivalent.\n return +a === +b;\n case \"[object Symbol]\":\n return typeof Symbol !== \"undefined\" && Symbol.valueOf.call(a) === Symbol.valueOf.call(b);\n case \"[object Map]\":\n case \"[object Set]\":\n // Maps and Sets are unwrapped to arrays of entry-pairs, adding an incidental level.\n // Hide this extra level by increasing the depth.\n if (depth >= 0) {\n depth++;\n }\n break;\n }\n // Unwrap any wrapped objects.\n a = unwrap(a);\n b = unwrap(b);\n var areArrays = className === \"[object Array]\";\n if (!areArrays) {\n if (typeof a != \"object\" || typeof b != \"object\") {\n return false;\n }\n // Objects with different constructors are not equivalent, but `Object`s or `Array`s\n // from different frames are.\n var aCtor = a.constructor,\n bCtor = b.constructor;\n if (aCtor !== bCtor && !(isFunction(aCtor) && aCtor instanceof aCtor && isFunction(bCtor) && bCtor instanceof bCtor) && \"constructor\" in a && \"constructor\" in b) {\n return false;\n }\n }\n if (depth === 0) {\n return false;\n } else if (depth < 0) {\n depth = -1;\n }\n // Assume equality for cyclic structures. The algorithm for detecting cyclic\n // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.\n // Initializing stack of traversed objects.\n // It's done here since we only need them for objects and arrays comparison.\n aStack = aStack || [];\n bStack = bStack || [];\n var length = aStack.length;\n while (length--) {\n // Linear search. Performance is inversely proportional to the number of\n // unique nested structures.\n if (aStack[length] === a) {\n return bStack[length] === b;\n }\n }\n // Add the first object to the stack of traversed objects.\n aStack.push(a);\n bStack.push(b);\n // Recursively compare objects and arrays.\n if (areArrays) {\n // Compare array lengths to determine if a deep comparison is necessary.\n length = a.length;\n if (length !== b.length) {\n return false;\n }\n // Deep compare the contents, ignoring non-numeric properties.\n while (length--) {\n if (!eq(a[length], b[length], depth - 1, aStack, bStack)) {\n return false;\n }\n }\n } else {\n // Deep compare objects.\n var keys = Object.keys(a);\n var key;\n length = keys.length;\n // Ensure that both objects contain the same number of properties before comparing deep equality.\n if (Object.keys(b).length !== length) {\n return false;\n }\n while (length--) {\n // Deep compare each member\n key = keys[length];\n if (!(hasProp(b, key) && eq(a[key], b[key], depth - 1, aStack, bStack))) {\n return false;\n }\n }\n }\n // Remove the first object from the stack of traversed objects.\n aStack.pop();\n bStack.pop();\n return true;\n}\nfunction unwrap(a) {\n if (isObservableArray(a)) {\n return a.slice();\n }\n if (isES6Map(a) || isObservableMap(a)) {\n return Array.from(a.entries());\n }\n if (isES6Set(a) || isObservableSet(a)) {\n return Array.from(a.entries());\n }\n return a;\n}\n\nvar _getGlobal$Iterator;\n// safely get iterator prototype if available\nvar maybeIteratorPrototype = ((_getGlobal$Iterator = /*#__PURE__*/getGlobal().Iterator) == null ? void 0 : _getGlobal$Iterator.prototype) || {};\nfunction makeIterable(iterator) {\n iterator[Symbol.iterator] = getSelf;\n return Object.assign(Object.create(maybeIteratorPrototype), iterator);\n}\nfunction getSelf() {\n return this;\n}\n\nfunction isAnnotation(thing) {\n return (\n // Can be function\n thing instanceof Object && typeof thing.annotationType_ === \"string\" && isFunction(thing.make_) && isFunction(thing.extend_)\n );\n}\n\n/**\n * (c) Michel Weststrate 2015 - 2020\n * MIT Licensed\n *\n * Welcome to the mobx sources! To get a global overview of how MobX internally works,\n * this is a good place to start:\n * https://medium.com/@mweststrate/becoming-fully-reactive-an-in-depth-explanation-of-mobservable-55995262a254#.xvbh6qd74\n *\n * Source folders:\n * ===============\n *\n * - api/ Most of the public static methods exposed by the module can be found here.\n * - core/ Implementation of the MobX algorithm; atoms, derivations, reactions, dependency trees, optimizations. Cool stuff can be found here.\n * - types/ All the magic that is need to have observable objects, arrays and values is in this folder. Including the modifiers like `asFlat`.\n * - utils/ Utility stuff.\n *\n */\n[\"Symbol\", \"Map\", \"Set\"].forEach(function (m) {\n var g = getGlobal();\n if (typeof g[m] === \"undefined\") {\n die(\"MobX requires global '\" + m + \"' to be available or polyfilled\");\n }\n});\nif (typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__ === \"object\") {\n // See: https://github.com/andykog/mobx-devtools/\n __MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({\n spy: spy,\n extras: {\n getDebugName: getDebugName\n },\n $mobx: $mobx\n });\n}\n\n\n//# sourceMappingURL=mobx.esm.js.map\n\n\n//# sourceURL=webpack://app_adyen_SFRA/./node_modules/mobx/dist/mobx.esm.js?"); /***/ }) diff --git a/cartridges/app_adyen_SFRA/cartridge/static/default/js/constants.js b/cartridges/app_adyen_SFRA/cartridge/static/default/js/constants.js index c0aaae817..9096a62aa 100644 --- a/cartridges/app_adyen_SFRA/cartridge/static/default/js/constants.js +++ b/cartridges/app_adyen_SFRA/cartridge/static/default/js/constants.js @@ -16,7 +16,7 @@ \****************************************************************************/ /***/ ((module) => { -eval("\n\n// Adyen constants\n\nmodule.exports = {\n METHOD_ADYEN: 'Adyen',\n METHOD_ADYEN_POS: 'AdyenPOS',\n METHOD_ADYEN_COMPONENT: 'AdyenComponent',\n RECEIVED: 'Received',\n NOTENOUGHBALANCE: 'NotEnoughBalance',\n SUCCESS: 'Success',\n GIFTCARD: 'giftcard',\n SCHEME: 'scheme',\n GIROPAY: 'giropay',\n APPLE_PAY: 'applepay',\n PAYPAL: 'paypal',\n AMAZON_PAY: 'amazonpay',\n ACTIONTYPE: {\n QRCODE: 'qrCode'\n },\n DISABLED_SUBMIT_BUTTON_METHODS: ['paypal', 'paywithgoogle', 'googlepay', 'amazonpay', 'applepay', 'cashapp'],\n MULTIPLE_TX_VARIANTS_COMPONENTS: ['upi']\n};\n\n//# sourceURL=webpack://app_adyen_SFRA/./cartridges/app_adyen_SFRA/cartridge/client/default/js/constants.js?"); +eval("\n\n// Adyen constants\n\nmodule.exports = {\n METHOD_ADYEN: 'Adyen',\n METHOD_ADYEN_POS: 'AdyenPOS',\n METHOD_ADYEN_COMPONENT: 'AdyenComponent',\n RECEIVED: 'Received',\n NOTENOUGHBALANCE: 'NotEnoughBalance',\n SUCCESS: 'Success',\n GIFTCARD: 'giftcard',\n SCHEME: 'scheme',\n GIROPAY: 'giropay',\n APPLE_PAY: 'applepay',\n PAYPAL: 'paypal',\n AMAZON_PAY: 'amazonpay',\n ACTIONTYPE: {\n QRCODE: 'qrCode'\n },\n DISABLED_SUBMIT_BUTTON_METHODS: ['paypal', 'paywithgoogle', 'googlepay', 'amazonpay', 'applepay', 'cashapp', 'upi']\n};\n\n//# sourceURL=webpack://app_adyen_SFRA/./cartridges/app_adyen_SFRA/cartridge/client/default/js/constants.js?"); /***/ }) diff --git a/cartridges/app_adyen_SFRA/cartridge/static/default/js/expressPaymentMethodsVisibility.js b/cartridges/app_adyen_SFRA/cartridge/static/default/js/expressPaymentMethodsVisibility.js index 3883a52c6..33f9304c3 100644 --- a/cartridges/app_adyen_SFRA/cartridge/static/default/js/expressPaymentMethodsVisibility.js +++ b/cartridges/app_adyen_SFRA/cartridge/static/default/js/expressPaymentMethodsVisibility.js @@ -26,7 +26,7 @@ eval("\n\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \" \****************************************************************************/ /***/ ((module) => { -eval("\n\n// Adyen constants\n\nmodule.exports = {\n METHOD_ADYEN: 'Adyen',\n METHOD_ADYEN_POS: 'AdyenPOS',\n METHOD_ADYEN_COMPONENT: 'AdyenComponent',\n RECEIVED: 'Received',\n NOTENOUGHBALANCE: 'NotEnoughBalance',\n SUCCESS: 'Success',\n GIFTCARD: 'giftcard',\n SCHEME: 'scheme',\n GIROPAY: 'giropay',\n APPLE_PAY: 'applepay',\n PAYPAL: 'paypal',\n AMAZON_PAY: 'amazonpay',\n ACTIONTYPE: {\n QRCODE: 'qrCode'\n },\n DISABLED_SUBMIT_BUTTON_METHODS: ['paypal', 'paywithgoogle', 'googlepay', 'amazonpay', 'applepay', 'cashapp'],\n MULTIPLE_TX_VARIANTS_COMPONENTS: ['upi']\n};\n\n//# sourceURL=webpack://app_adyen_SFRA/./cartridges/app_adyen_SFRA/cartridge/client/default/js/constants.js?"); +eval("\n\n// Adyen constants\n\nmodule.exports = {\n METHOD_ADYEN: 'Adyen',\n METHOD_ADYEN_POS: 'AdyenPOS',\n METHOD_ADYEN_COMPONENT: 'AdyenComponent',\n RECEIVED: 'Received',\n NOTENOUGHBALANCE: 'NotEnoughBalance',\n SUCCESS: 'Success',\n GIFTCARD: 'giftcard',\n SCHEME: 'scheme',\n GIROPAY: 'giropay',\n APPLE_PAY: 'applepay',\n PAYPAL: 'paypal',\n AMAZON_PAY: 'amazonpay',\n ACTIONTYPE: {\n QRCODE: 'qrCode'\n },\n DISABLED_SUBMIT_BUTTON_METHODS: ['paypal', 'paywithgoogle', 'googlepay', 'amazonpay', 'applepay', 'cashapp', 'upi']\n};\n\n//# sourceURL=webpack://app_adyen_SFRA/./cartridges/app_adyen_SFRA/cartridge/client/default/js/constants.js?"); /***/ }), @@ -56,7 +56,7 @@ eval("\n\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \" \********************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ $mobx: () => (/* binding */ $mobx),\n/* harmony export */ FlowCancellationError: () => (/* binding */ FlowCancellationError),\n/* harmony export */ ObservableMap: () => (/* binding */ ObservableMap),\n/* harmony export */ ObservableSet: () => (/* binding */ ObservableSet),\n/* harmony export */ Reaction: () => (/* binding */ Reaction),\n/* harmony export */ _allowStateChanges: () => (/* binding */ allowStateChanges),\n/* harmony export */ _allowStateChangesInsideComputed: () => (/* binding */ runInAction),\n/* harmony export */ _allowStateReadsEnd: () => (/* binding */ allowStateReadsEnd),\n/* harmony export */ _allowStateReadsStart: () => (/* binding */ allowStateReadsStart),\n/* harmony export */ _autoAction: () => (/* binding */ autoAction),\n/* harmony export */ _endAction: () => (/* binding */ _endAction),\n/* harmony export */ _getAdministration: () => (/* binding */ getAdministration),\n/* harmony export */ _getGlobalState: () => (/* binding */ getGlobalState),\n/* harmony export */ _interceptReads: () => (/* binding */ interceptReads),\n/* harmony export */ _isComputingDerivation: () => (/* binding */ isComputingDerivation),\n/* harmony export */ _resetGlobalState: () => (/* binding */ resetGlobalState),\n/* harmony export */ _startAction: () => (/* binding */ _startAction),\n/* harmony export */ action: () => (/* binding */ action),\n/* harmony export */ autorun: () => (/* binding */ autorun),\n/* harmony export */ comparer: () => (/* binding */ comparer),\n/* harmony export */ computed: () => (/* binding */ computed),\n/* harmony export */ configure: () => (/* binding */ configure),\n/* harmony export */ createAtom: () => (/* binding */ createAtom),\n/* harmony export */ defineProperty: () => (/* binding */ apiDefineProperty),\n/* harmony export */ entries: () => (/* binding */ entries),\n/* harmony export */ extendObservable: () => (/* binding */ extendObservable),\n/* harmony export */ flow: () => (/* binding */ flow),\n/* harmony export */ flowResult: () => (/* binding */ flowResult),\n/* harmony export */ get: () => (/* binding */ get),\n/* harmony export */ getAtom: () => (/* binding */ getAtom),\n/* harmony export */ getDebugName: () => (/* binding */ getDebugName),\n/* harmony export */ getDependencyTree: () => (/* binding */ getDependencyTree),\n/* harmony export */ getObserverTree: () => (/* binding */ getObserverTree),\n/* harmony export */ has: () => (/* binding */ has),\n/* harmony export */ intercept: () => (/* binding */ intercept),\n/* harmony export */ isAction: () => (/* binding */ isAction),\n/* harmony export */ isBoxedObservable: () => (/* binding */ isObservableValue),\n/* harmony export */ isComputed: () => (/* binding */ isComputed),\n/* harmony export */ isComputedProp: () => (/* binding */ isComputedProp),\n/* harmony export */ isFlow: () => (/* binding */ isFlow),\n/* harmony export */ isFlowCancellationError: () => (/* binding */ isFlowCancellationError),\n/* harmony export */ isObservable: () => (/* binding */ isObservable),\n/* harmony export */ isObservableArray: () => (/* binding */ isObservableArray),\n/* harmony export */ isObservableMap: () => (/* binding */ isObservableMap),\n/* harmony export */ isObservableObject: () => (/* binding */ isObservableObject),\n/* harmony export */ isObservableProp: () => (/* binding */ isObservableProp),\n/* harmony export */ isObservableSet: () => (/* binding */ isObservableSet),\n/* harmony export */ keys: () => (/* binding */ keys),\n/* harmony export */ makeAutoObservable: () => (/* binding */ makeAutoObservable),\n/* harmony export */ makeObservable: () => (/* binding */ makeObservable),\n/* harmony export */ observable: () => (/* binding */ observable),\n/* harmony export */ observe: () => (/* binding */ observe),\n/* harmony export */ onBecomeObserved: () => (/* binding */ onBecomeObserved),\n/* harmony export */ onBecomeUnobserved: () => (/* binding */ onBecomeUnobserved),\n/* harmony export */ onReactionError: () => (/* binding */ onReactionError),\n/* harmony export */ override: () => (/* binding */ override),\n/* harmony export */ ownKeys: () => (/* binding */ apiOwnKeys),\n/* harmony export */ reaction: () => (/* binding */ reaction),\n/* harmony export */ remove: () => (/* binding */ remove),\n/* harmony export */ runInAction: () => (/* binding */ runInAction),\n/* harmony export */ set: () => (/* binding */ set),\n/* harmony export */ spy: () => (/* binding */ spy),\n/* harmony export */ toJS: () => (/* binding */ toJS),\n/* harmony export */ trace: () => (/* binding */ trace),\n/* harmony export */ transaction: () => (/* binding */ transaction),\n/* harmony export */ untracked: () => (/* binding */ untracked),\n/* harmony export */ values: () => (/* binding */ values),\n/* harmony export */ when: () => (/* binding */ when)\n/* harmony export */ });\nvar niceErrors = {\n 0: \"Invalid value for configuration 'enforceActions', expected 'never', 'always' or 'observed'\",\n 1: function _(annotationType, key) {\n return \"Cannot apply '\" + annotationType + \"' to '\" + key.toString() + \"': Field not found.\";\n },\n /*\n 2(prop) {\n return `invalid decorator for '${prop.toString()}'`\n },\n 3(prop) {\n return `Cannot decorate '${prop.toString()}': action can only be used on properties with a function value.`\n },\n 4(prop) {\n return `Cannot decorate '${prop.toString()}': computed can only be used on getter properties.`\n },\n */\n 5: \"'keys()' can only be used on observable objects, arrays, sets and maps\",\n 6: \"'values()' can only be used on observable objects, arrays, sets and maps\",\n 7: \"'entries()' can only be used on observable objects, arrays and maps\",\n 8: \"'set()' can only be used on observable objects, arrays and maps\",\n 9: \"'remove()' can only be used on observable objects, arrays and maps\",\n 10: \"'has()' can only be used on observable objects, arrays and maps\",\n 11: \"'get()' can only be used on observable objects, arrays and maps\",\n 12: \"Invalid annotation\",\n 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)\",\n 14: \"Intercept handlers should return nothing or a change object\",\n 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)\",\n 16: \"Modification exception: the internal structure of an observable array was changed.\",\n 17: function _(index, length) {\n return \"[mobx.array] Index out of bounds, \" + index + \" is larger than \" + length;\n },\n 18: \"mobx.map requires Map polyfill for the current browser. Check babel-polyfill or core-js/es6/map.js\",\n 19: function _(other) {\n return \"Cannot initialize from classes that inherit from Map: \" + other.constructor.name;\n },\n 20: function _(other) {\n return \"Cannot initialize map from \" + other;\n },\n 21: function _(dataStructure) {\n return \"Cannot convert to map from '\" + dataStructure + \"'\";\n },\n 22: \"mobx.set requires Set polyfill for the current browser. Check babel-polyfill or core-js/es6/set.js\",\n 23: \"It is not possible to get index atoms from arrays\",\n 24: function _(thing) {\n return \"Cannot obtain administration from \" + thing;\n },\n 25: function _(property, name) {\n return \"the entry '\" + property + \"' does not exist in the observable map '\" + name + \"'\";\n },\n 26: \"please specify a property\",\n 27: function _(property, name) {\n return \"no observable property '\" + property.toString() + \"' found on the observable object '\" + name + \"'\";\n },\n 28: function _(thing) {\n return \"Cannot obtain atom from \" + thing;\n },\n 29: \"Expecting some object\",\n 30: \"invalid action stack. did you forget to finish an action?\",\n 31: \"missing option for computed: get\",\n 32: function _(name, derivation) {\n return \"Cycle detected in computation \" + name + \": \" + derivation;\n },\n 33: function _(name) {\n return \"The setter of computed value '\" + name + \"' is trying to update itself. Did you intend to update an _observable_ value, instead of the computed property?\";\n },\n 34: function _(name) {\n return \"[ComputedValue '\" + name + \"'] It is not possible to assign a new value to a computed value.\";\n },\n 35: \"There are multiple, different versions of MobX active. Make sure MobX is loaded only once or use `configure({ isolateGlobalState: true })`\",\n 36: \"isolateGlobalState should be called before MobX is running any reactions\",\n 37: function _(method) {\n return \"[mobx] `observableArray.\" + method + \"()` mutates the array in-place, which is not allowed inside a derivation. Use `array.slice().\" + method + \"()` instead\";\n },\n 38: \"'ownKeys()' can only be used on observable objects\",\n 39: \"'defineProperty()' can only be used on observable objects\"\n};\nvar errors = true ? niceErrors : 0;\nfunction die(error) {\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n if (true) {\n var e = typeof error === \"string\" ? error : errors[error];\n if (typeof e === \"function\") e = e.apply(null, args);\n throw new Error(\"[MobX] \" + e);\n }\n throw new Error(typeof error === \"number\" ? \"[MobX] minified error nr: \" + error + (args.length ? \" \" + args.map(String).join(\",\") : \"\") + \". Find the full error at: https://github.com/mobxjs/mobx/blob/main/packages/mobx/src/errors.ts\" : \"[MobX] \" + error);\n}\n\nvar mockGlobal = {};\nfunction getGlobal() {\n if (typeof globalThis !== \"undefined\") {\n return globalThis;\n }\n if (typeof window !== \"undefined\") {\n return window;\n }\n if (typeof __webpack_require__.g !== \"undefined\") {\n return __webpack_require__.g;\n }\n if (typeof self !== \"undefined\") {\n return self;\n }\n return mockGlobal;\n}\n\n// We shorten anything used > 5 times\nvar assign = Object.assign;\nvar getDescriptor = Object.getOwnPropertyDescriptor;\nvar defineProperty = Object.defineProperty;\nvar objectPrototype = Object.prototype;\nvar EMPTY_ARRAY = [];\nObject.freeze(EMPTY_ARRAY);\nvar EMPTY_OBJECT = {};\nObject.freeze(EMPTY_OBJECT);\nvar hasProxy = typeof Proxy !== \"undefined\";\nvar plainObjectString = /*#__PURE__*/Object.toString();\nfunction assertProxies() {\n if (!hasProxy) {\n die( true ? \"`Proxy` objects are not available in the current environment. Please configure MobX to enable a fallback implementation.`\" : 0);\n }\n}\nfunction warnAboutProxyRequirement(msg) {\n if ( true && globalState.verifyProxies) {\n die(\"MobX is currently configured to be able to run in ES5 mode, but in ES5 MobX won't be able to \" + msg);\n }\n}\nfunction getNextId() {\n return ++globalState.mobxGuid;\n}\n/**\n * Makes sure that the provided function is invoked at most once.\n */\nfunction once(func) {\n var invoked = false;\n return function () {\n if (invoked) {\n return;\n }\n invoked = true;\n return func.apply(this, arguments);\n };\n}\nvar noop = function noop() {};\nfunction isFunction(fn) {\n return typeof fn === \"function\";\n}\nfunction isStringish(value) {\n var t = typeof value;\n switch (t) {\n case \"string\":\n case \"symbol\":\n case \"number\":\n return true;\n }\n return false;\n}\nfunction isObject(value) {\n return value !== null && typeof value === \"object\";\n}\nfunction isPlainObject(value) {\n if (!isObject(value)) {\n return false;\n }\n var proto = Object.getPrototypeOf(value);\n if (proto == null) {\n return true;\n }\n var protoConstructor = Object.hasOwnProperty.call(proto, \"constructor\") && proto.constructor;\n return typeof protoConstructor === \"function\" && protoConstructor.toString() === plainObjectString;\n}\n// https://stackoverflow.com/a/37865170\nfunction isGenerator(obj) {\n var constructor = obj == null ? void 0 : obj.constructor;\n if (!constructor) {\n return false;\n }\n if (\"GeneratorFunction\" === constructor.name || \"GeneratorFunction\" === constructor.displayName) {\n return true;\n }\n return false;\n}\nfunction addHiddenProp(object, propName, value) {\n defineProperty(object, propName, {\n enumerable: false,\n writable: true,\n configurable: true,\n value: value\n });\n}\nfunction addHiddenFinalProp(object, propName, value) {\n defineProperty(object, propName, {\n enumerable: false,\n writable: false,\n configurable: true,\n value: value\n });\n}\nfunction createInstanceofPredicate(name, theClass) {\n var propName = \"isMobX\" + name;\n theClass.prototype[propName] = true;\n return function (x) {\n return isObject(x) && x[propName] === true;\n };\n}\n/**\n * Yields true for both native and observable Map, even across different windows.\n */\nfunction isES6Map(thing) {\n return thing != null && Object.prototype.toString.call(thing) === \"[object Map]\";\n}\n/**\n * Makes sure a Map is an instance of non-inherited native or observable Map.\n */\nfunction isPlainES6Map(thing) {\n var mapProto = Object.getPrototypeOf(thing);\n var objectProto = Object.getPrototypeOf(mapProto);\n var nullProto = Object.getPrototypeOf(objectProto);\n return nullProto === null;\n}\n/**\n * Yields true for both native and observable Set, even across different windows.\n */\nfunction isES6Set(thing) {\n return thing != null && Object.prototype.toString.call(thing) === \"[object Set]\";\n}\nvar hasGetOwnPropertySymbols = typeof Object.getOwnPropertySymbols !== \"undefined\";\n/**\n * Returns the following: own enumerable keys and symbols.\n */\nfunction getPlainObjectKeys(object) {\n var keys = Object.keys(object);\n // Not supported in IE, so there are not going to be symbol props anyway...\n if (!hasGetOwnPropertySymbols) {\n return keys;\n }\n var symbols = Object.getOwnPropertySymbols(object);\n if (!symbols.length) {\n return keys;\n }\n return [].concat(keys, symbols.filter(function (s) {\n return objectPrototype.propertyIsEnumerable.call(object, s);\n }));\n}\n// From Immer utils\n// Returns all own keys, including non-enumerable and symbolic\nvar ownKeys = typeof Reflect !== \"undefined\" && Reflect.ownKeys ? Reflect.ownKeys : hasGetOwnPropertySymbols ? function (obj) {\n return Object.getOwnPropertyNames(obj).concat(Object.getOwnPropertySymbols(obj));\n} : /* istanbul ignore next */Object.getOwnPropertyNames;\nfunction stringifyKey(key) {\n if (typeof key === \"string\") {\n return key;\n }\n if (typeof key === \"symbol\") {\n return key.toString();\n }\n return new String(key).toString();\n}\nfunction toPrimitive(value) {\n return value === null ? null : typeof value === \"object\" ? \"\" + value : value;\n}\nfunction hasProp(target, prop) {\n return objectPrototype.hasOwnProperty.call(target, prop);\n}\n// From Immer utils\nvar getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors || function getOwnPropertyDescriptors(target) {\n // Polyfill needed for Hermes and IE, see https://github.com/facebook/hermes/issues/274\n var res = {};\n // Note: without polyfill for ownKeys, symbols won't be picked up\n ownKeys(target).forEach(function (key) {\n res[key] = getDescriptor(target, key);\n });\n return res;\n};\nfunction getFlag(flags, mask) {\n return !!(flags & mask);\n}\nfunction setFlag(flags, mask, newValue) {\n if (newValue) {\n flags |= mask;\n } else {\n flags &= ~mask;\n }\n return flags;\n}\n\nfunction _arrayLikeToArray(r, a) {\n (null == a || a > r.length) && (a = r.length);\n for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];\n return n;\n}\nfunction _defineProperties(e, r) {\n for (var t = 0; t < r.length; t++) {\n var o = r[t];\n o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);\n }\n}\nfunction _createClass(e, r, t) {\n return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", {\n writable: !1\n }), e;\n}\nfunction _createForOfIteratorHelperLoose(r, e) {\n var t = \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"];\n if (t) return (t = t.call(r)).next.bind(t);\n if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && \"number\" == typeof r.length) {\n t && (r = t);\n var o = 0;\n return function () {\n return o >= r.length ? {\n done: !0\n } : {\n done: !1,\n value: r[o++]\n };\n };\n }\n throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\nfunction _extends() {\n return _extends = Object.assign ? Object.assign.bind() : function (n) {\n for (var e = 1; e < arguments.length; e++) {\n var t = arguments[e];\n for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);\n }\n return n;\n }, _extends.apply(null, arguments);\n}\nfunction _inheritsLoose(t, o) {\n t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);\n}\nfunction _setPrototypeOf(t, e) {\n return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {\n return t.__proto__ = e, t;\n }, _setPrototypeOf(t, e);\n}\nfunction _toPrimitive(t, r) {\n if (\"object\" != typeof t || !t) return t;\n var e = t[Symbol.toPrimitive];\n if (void 0 !== e) {\n var i = e.call(t, r || \"default\");\n if (\"object\" != typeof i) return i;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (\"string\" === r ? String : Number)(t);\n}\nfunction _toPropertyKey(t) {\n var i = _toPrimitive(t, \"string\");\n return \"symbol\" == typeof i ? i : i + \"\";\n}\nfunction _unsupportedIterableToArray(r, a) {\n if (r) {\n if (\"string\" == typeof r) return _arrayLikeToArray(r, a);\n var t = {}.toString.call(r).slice(8, -1);\n return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;\n }\n}\n\nvar storedAnnotationsSymbol = /*#__PURE__*/Symbol(\"mobx-stored-annotations\");\n/**\n * Creates a function that acts as\n * - decorator\n * - annotation object\n */\nfunction createDecoratorAnnotation(annotation) {\n function decorator(target, property) {\n if (is20223Decorator(property)) {\n return annotation.decorate_20223_(target, property);\n } else {\n storeAnnotation(target, property, annotation);\n }\n }\n return Object.assign(decorator, annotation);\n}\n/**\n * Stores annotation to prototype,\n * so it can be inspected later by `makeObservable` called from constructor\n */\nfunction storeAnnotation(prototype, key, annotation) {\n if (!hasProp(prototype, storedAnnotationsSymbol)) {\n addHiddenProp(prototype, storedAnnotationsSymbol, _extends({}, prototype[storedAnnotationsSymbol]));\n }\n // @override must override something\n if ( true && isOverride(annotation) && !hasProp(prototype[storedAnnotationsSymbol], key)) {\n var fieldName = prototype.constructor.name + \".prototype.\" + key.toString();\n die(\"'\" + fieldName + \"' is decorated with 'override', \" + \"but no such decorated member was found on prototype.\");\n }\n // Cannot re-decorate\n assertNotDecorated(prototype, annotation, key);\n // Ignore override\n if (!isOverride(annotation)) {\n prototype[storedAnnotationsSymbol][key] = annotation;\n }\n}\nfunction assertNotDecorated(prototype, annotation, key) {\n if ( true && !isOverride(annotation) && hasProp(prototype[storedAnnotationsSymbol], key)) {\n var fieldName = prototype.constructor.name + \".prototype.\" + key.toString();\n var currentAnnotationType = prototype[storedAnnotationsSymbol][key].annotationType_;\n var requestedAnnotationType = annotation.annotationType_;\n die(\"Cannot apply '@\" + requestedAnnotationType + \"' to '\" + fieldName + \"':\" + (\"\\nThe field is already decorated with '@\" + currentAnnotationType + \"'.\") + \"\\nRe-decorating fields is not allowed.\" + \"\\nUse '@override' decorator for methods overridden by subclass.\");\n }\n}\n/**\n * Collects annotations from prototypes and stores them on target (instance)\n */\nfunction collectStoredAnnotations(target) {\n if (!hasProp(target, storedAnnotationsSymbol)) {\n // if (__DEV__ && !target[storedAnnotationsSymbol]) {\n // die(\n // `No annotations were passed to makeObservable, but no decorated members have been found either`\n // )\n // }\n // We need a copy as we will remove annotation from the list once it's applied.\n addHiddenProp(target, storedAnnotationsSymbol, _extends({}, target[storedAnnotationsSymbol]));\n }\n return target[storedAnnotationsSymbol];\n}\nfunction is20223Decorator(context) {\n return typeof context == \"object\" && typeof context[\"kind\"] == \"string\";\n}\nfunction assert20223DecoratorType(context, types) {\n if ( true && !types.includes(context.kind)) {\n die(\"The decorator applied to '\" + String(context.name) + \"' cannot be used on a \" + context.kind + \" element\");\n }\n}\n\nvar $mobx = /*#__PURE__*/Symbol(\"mobx administration\");\nvar Atom = /*#__PURE__*/function () {\n /**\n * Create a new atom. For debugging purposes it is recommended to give it a name.\n * The onBecomeObserved and onBecomeUnobserved callbacks can be used for resource management.\n */\n function Atom(name_) {\n if (name_ === void 0) {\n name_ = true ? \"Atom@\" + getNextId() : 0;\n }\n this.name_ = void 0;\n this.flags_ = 0;\n this.observers_ = new Set();\n this.lastAccessedBy_ = 0;\n this.lowestObserverState_ = IDerivationState_.NOT_TRACKING_;\n // onBecomeObservedListeners\n this.onBOL = void 0;\n // onBecomeUnobservedListeners\n this.onBUOL = void 0;\n this.name_ = name_;\n }\n // for effective unobserving. BaseAtom has true, for extra optimization, so its onBecomeUnobserved never gets called, because it's not needed\n var _proto = Atom.prototype;\n _proto.onBO = function onBO() {\n if (this.onBOL) {\n this.onBOL.forEach(function (listener) {\n return listener();\n });\n }\n };\n _proto.onBUO = function onBUO() {\n if (this.onBUOL) {\n this.onBUOL.forEach(function (listener) {\n return listener();\n });\n }\n }\n /**\n * Invoke this method to notify mobx that your atom has been used somehow.\n * Returns true if there is currently a reactive context.\n */;\n _proto.reportObserved = function reportObserved$1() {\n return reportObserved(this);\n }\n /**\n * Invoke this method _after_ this method has changed to signal mobx that all its observers should invalidate.\n */;\n _proto.reportChanged = function reportChanged() {\n startBatch();\n propagateChanged(this);\n endBatch();\n };\n _proto.toString = function toString() {\n return this.name_;\n };\n return _createClass(Atom, [{\n key: \"isBeingObserved\",\n get: function get() {\n return getFlag(this.flags_, Atom.isBeingObservedMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Atom.isBeingObservedMask_, newValue);\n }\n }, {\n key: \"isPendingUnobservation\",\n get: function get() {\n return getFlag(this.flags_, Atom.isPendingUnobservationMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Atom.isPendingUnobservationMask_, newValue);\n }\n }, {\n key: \"diffValue\",\n get: function get() {\n return getFlag(this.flags_, Atom.diffValueMask_) ? 1 : 0;\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Atom.diffValueMask_, newValue === 1 ? true : false);\n }\n }]);\n}();\nAtom.isBeingObservedMask_ = 1;\nAtom.isPendingUnobservationMask_ = 2;\nAtom.diffValueMask_ = 4;\nvar isAtom = /*#__PURE__*/createInstanceofPredicate(\"Atom\", Atom);\nfunction createAtom(name, onBecomeObservedHandler, onBecomeUnobservedHandler) {\n if (onBecomeObservedHandler === void 0) {\n onBecomeObservedHandler = noop;\n }\n if (onBecomeUnobservedHandler === void 0) {\n onBecomeUnobservedHandler = noop;\n }\n var atom = new Atom(name);\n // default `noop` listener will not initialize the hook Set\n if (onBecomeObservedHandler !== noop) {\n onBecomeObserved(atom, onBecomeObservedHandler);\n }\n if (onBecomeUnobservedHandler !== noop) {\n onBecomeUnobserved(atom, onBecomeUnobservedHandler);\n }\n return atom;\n}\n\nfunction identityComparer(a, b) {\n return a === b;\n}\nfunction structuralComparer(a, b) {\n return deepEqual(a, b);\n}\nfunction shallowComparer(a, b) {\n return deepEqual(a, b, 1);\n}\nfunction defaultComparer(a, b) {\n if (Object.is) {\n return Object.is(a, b);\n }\n return a === b ? a !== 0 || 1 / a === 1 / b : a !== a && b !== b;\n}\nvar comparer = {\n identity: identityComparer,\n structural: structuralComparer,\n \"default\": defaultComparer,\n shallow: shallowComparer\n};\n\nfunction deepEnhancer(v, _, name) {\n // it is an observable already, done\n if (isObservable(v)) {\n return v;\n }\n // something that can be converted and mutated?\n if (Array.isArray(v)) {\n return observable.array(v, {\n name: name\n });\n }\n if (isPlainObject(v)) {\n return observable.object(v, undefined, {\n name: name\n });\n }\n if (isES6Map(v)) {\n return observable.map(v, {\n name: name\n });\n }\n if (isES6Set(v)) {\n return observable.set(v, {\n name: name\n });\n }\n if (typeof v === \"function\" && !isAction(v) && !isFlow(v)) {\n if (isGenerator(v)) {\n return flow(v);\n } else {\n return autoAction(name, v);\n }\n }\n return v;\n}\nfunction shallowEnhancer(v, _, name) {\n if (v === undefined || v === null) {\n return v;\n }\n if (isObservableObject(v) || isObservableArray(v) || isObservableMap(v) || isObservableSet(v)) {\n return v;\n }\n if (Array.isArray(v)) {\n return observable.array(v, {\n name: name,\n deep: false\n });\n }\n if (isPlainObject(v)) {\n return observable.object(v, undefined, {\n name: name,\n deep: false\n });\n }\n if (isES6Map(v)) {\n return observable.map(v, {\n name: name,\n deep: false\n });\n }\n if (isES6Set(v)) {\n return observable.set(v, {\n name: name,\n deep: false\n });\n }\n if (true) {\n die(\"The shallow modifier / decorator can only used in combination with arrays, objects, maps and sets\");\n }\n}\nfunction referenceEnhancer(newValue) {\n // never turn into an observable\n return newValue;\n}\nfunction refStructEnhancer(v, oldValue) {\n if ( true && isObservable(v)) {\n die(\"observable.struct should not be used with observable values\");\n }\n if (deepEqual(v, oldValue)) {\n return oldValue;\n }\n return v;\n}\n\nvar OVERRIDE = \"override\";\nvar override = /*#__PURE__*/createDecoratorAnnotation({\n annotationType_: OVERRIDE,\n make_: make_,\n extend_: extend_,\n decorate_20223_: decorate_20223_\n});\nfunction isOverride(annotation) {\n return annotation.annotationType_ === OVERRIDE;\n}\nfunction make_(adm, key) {\n // Must not be plain object\n if ( true && adm.isPlainObject_) {\n die(\"Cannot apply '\" + this.annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + this.annotationType_ + \"' cannot be used on plain objects.\"));\n }\n // Must override something\n if ( true && !hasProp(adm.appliedAnnotations_, key)) {\n die(\"'\" + adm.name_ + \".\" + key.toString() + \"' is annotated with '\" + this.annotationType_ + \"', \" + \"but no such annotated member was found on prototype.\");\n }\n return 0 /* MakeResult.Cancel */;\n}\nfunction extend_(adm, key, descriptor, proxyTrap) {\n die(\"'\" + this.annotationType_ + \"' can only be used with 'makeObservable'\");\n}\nfunction decorate_20223_(desc, context) {\n console.warn(\"'\" + this.annotationType_ + \"' cannot be used with decorators - this is a no-op\");\n}\n\nfunction createActionAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$1,\n extend_: extend_$1,\n decorate_20223_: decorate_20223_$1\n };\n}\nfunction make_$1(adm, key, descriptor, source) {\n var _this$options_;\n // bound\n if ((_this$options_ = this.options_) != null && _this$options_.bound) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;\n }\n // own\n if (source === adm.target_) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 2 /* MakeResult.Continue */;\n }\n // prototype\n if (isAction(descriptor.value)) {\n // A prototype could have been annotated already by other constructor,\n // rest of the proto chain must be annotated already\n return 1 /* MakeResult.Break */;\n }\n var actionDescriptor = createActionDescriptor(adm, this, key, descriptor, false);\n defineProperty(source, key, actionDescriptor);\n return 2 /* MakeResult.Continue */;\n}\nfunction extend_$1(adm, key, descriptor, proxyTrap) {\n var actionDescriptor = createActionDescriptor(adm, this, key, descriptor);\n return adm.defineProperty_(key, actionDescriptor, proxyTrap);\n}\nfunction decorate_20223_$1(mthd, context) {\n if (true) {\n assert20223DecoratorType(context, [\"method\", \"field\"]);\n }\n var kind = context.kind,\n name = context.name,\n addInitializer = context.addInitializer;\n var ann = this;\n var _createAction = function _createAction(m) {\n var _ann$options_$name, _ann$options_, _ann$options_$autoAct, _ann$options_2;\n return createAction((_ann$options_$name = (_ann$options_ = ann.options_) == null ? void 0 : _ann$options_.name) != null ? _ann$options_$name : name.toString(), m, (_ann$options_$autoAct = (_ann$options_2 = ann.options_) == null ? void 0 : _ann$options_2.autoAction) != null ? _ann$options_$autoAct : false);\n };\n // Backwards/Legacy behavior, expects makeObservable(this)\n if (kind == \"field\") {\n addInitializer(function () {\n storeAnnotation(this, name, ann);\n });\n return;\n }\n if (kind == \"method\") {\n var _this$options_2;\n if (!isAction(mthd)) {\n mthd = _createAction(mthd);\n }\n if ((_this$options_2 = this.options_) != null && _this$options_2.bound) {\n addInitializer(function () {\n var self = this;\n var bound = self[name].bind(self);\n bound.isMobxAction = true;\n self[name] = bound;\n });\n }\n return mthd;\n }\n die(\"Cannot apply '\" + ann.annotationType_ + \"' to '\" + String(name) + \"' (kind: \" + kind + \"):\" + (\"\\n'\" + ann.annotationType_ + \"' can only be used on properties with a function value.\"));\n}\nfunction assertActionDescriptor(adm, _ref, key, _ref2) {\n var annotationType_ = _ref.annotationType_;\n var value = _ref2.value;\n if ( true && !isFunction(value)) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' can only be used on properties with a function value.\"));\n }\n}\nfunction createActionDescriptor(adm, annotation, key, descriptor,\n// provides ability to disable safeDescriptors for prototypes\nsafeDescriptors) {\n var _annotation$options_, _annotation$options_$, _annotation$options_2, _annotation$options_$2, _annotation$options_3, _annotation$options_4, _adm$proxy_2;\n if (safeDescriptors === void 0) {\n safeDescriptors = globalState.safeDescriptors;\n }\n assertActionDescriptor(adm, annotation, key, descriptor);\n var value = descriptor.value;\n if ((_annotation$options_ = annotation.options_) != null && _annotation$options_.bound) {\n var _adm$proxy_;\n value = value.bind((_adm$proxy_ = adm.proxy_) != null ? _adm$proxy_ : adm.target_);\n }\n return {\n value: createAction((_annotation$options_$ = (_annotation$options_2 = annotation.options_) == null ? void 0 : _annotation$options_2.name) != null ? _annotation$options_$ : key.toString(), value, (_annotation$options_$2 = (_annotation$options_3 = annotation.options_) == null ? void 0 : _annotation$options_3.autoAction) != null ? _annotation$options_$2 : false,\n // https://github.com/mobxjs/mobx/discussions/3140\n (_annotation$options_4 = annotation.options_) != null && _annotation$options_4.bound ? (_adm$proxy_2 = adm.proxy_) != null ? _adm$proxy_2 : adm.target_ : undefined),\n // Non-configurable for classes\n // prevents accidental field redefinition in subclass\n configurable: safeDescriptors ? adm.isPlainObject_ : true,\n // https://github.com/mobxjs/mobx/pull/2641#issuecomment-737292058\n enumerable: false,\n // Non-obsevable, therefore non-writable\n // Also prevents rewriting in subclass constructor\n writable: safeDescriptors ? false : true\n };\n}\n\nfunction createFlowAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$2,\n extend_: extend_$2,\n decorate_20223_: decorate_20223_$2\n };\n}\nfunction make_$2(adm, key, descriptor, source) {\n var _this$options_;\n // own\n if (source === adm.target_) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 2 /* MakeResult.Continue */;\n }\n // prototype\n // bound - must annotate protos to support super.flow()\n if ((_this$options_ = this.options_) != null && _this$options_.bound && (!hasProp(adm.target_, key) || !isFlow(adm.target_[key]))) {\n if (this.extend_(adm, key, descriptor, false) === null) {\n return 0 /* MakeResult.Cancel */;\n }\n }\n if (isFlow(descriptor.value)) {\n // A prototype could have been annotated already by other constructor,\n // rest of the proto chain must be annotated already\n return 1 /* MakeResult.Break */;\n }\n var flowDescriptor = createFlowDescriptor(adm, this, key, descriptor, false, false);\n defineProperty(source, key, flowDescriptor);\n return 2 /* MakeResult.Continue */;\n}\nfunction extend_$2(adm, key, descriptor, proxyTrap) {\n var _this$options_2;\n var flowDescriptor = createFlowDescriptor(adm, this, key, descriptor, (_this$options_2 = this.options_) == null ? void 0 : _this$options_2.bound);\n return adm.defineProperty_(key, flowDescriptor, proxyTrap);\n}\nfunction decorate_20223_$2(mthd, context) {\n var _this$options_3;\n if (true) {\n assert20223DecoratorType(context, [\"method\"]);\n }\n var name = context.name,\n addInitializer = context.addInitializer;\n if (!isFlow(mthd)) {\n mthd = flow(mthd);\n }\n if ((_this$options_3 = this.options_) != null && _this$options_3.bound) {\n addInitializer(function () {\n var self = this;\n var bound = self[name].bind(self);\n bound.isMobXFlow = true;\n self[name] = bound;\n });\n }\n return mthd;\n}\nfunction assertFlowDescriptor(adm, _ref, key, _ref2) {\n var annotationType_ = _ref.annotationType_;\n var value = _ref2.value;\n if ( true && !isFunction(value)) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' can only be used on properties with a generator function value.\"));\n }\n}\nfunction createFlowDescriptor(adm, annotation, key, descriptor, bound,\n// provides ability to disable safeDescriptors for prototypes\nsafeDescriptors) {\n if (safeDescriptors === void 0) {\n safeDescriptors = globalState.safeDescriptors;\n }\n assertFlowDescriptor(adm, annotation, key, descriptor);\n var value = descriptor.value;\n // In case of flow.bound, the descriptor can be from already annotated prototype\n if (!isFlow(value)) {\n value = flow(value);\n }\n if (bound) {\n var _adm$proxy_;\n // We do not keep original function around, so we bind the existing flow\n value = value.bind((_adm$proxy_ = adm.proxy_) != null ? _adm$proxy_ : adm.target_);\n // This is normally set by `flow`, but `bind` returns new function...\n value.isMobXFlow = true;\n }\n return {\n value: value,\n // Non-configurable for classes\n // prevents accidental field redefinition in subclass\n configurable: safeDescriptors ? adm.isPlainObject_ : true,\n // https://github.com/mobxjs/mobx/pull/2641#issuecomment-737292058\n enumerable: false,\n // Non-obsevable, therefore non-writable\n // Also prevents rewriting in subclass constructor\n writable: safeDescriptors ? false : true\n };\n}\n\nfunction createComputedAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$3,\n extend_: extend_$3,\n decorate_20223_: decorate_20223_$3\n };\n}\nfunction make_$3(adm, key, descriptor) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;\n}\nfunction extend_$3(adm, key, descriptor, proxyTrap) {\n assertComputedDescriptor(adm, this, key, descriptor);\n return adm.defineComputedProperty_(key, _extends({}, this.options_, {\n get: descriptor.get,\n set: descriptor.set\n }), proxyTrap);\n}\nfunction decorate_20223_$3(get, context) {\n if (true) {\n assert20223DecoratorType(context, [\"getter\"]);\n }\n var ann = this;\n var key = context.name,\n addInitializer = context.addInitializer;\n addInitializer(function () {\n var adm = asObservableObject(this)[$mobx];\n var options = _extends({}, ann.options_, {\n get: get,\n context: this\n });\n options.name || (options.name = true ? adm.name_ + \".\" + key.toString() : 0);\n adm.values_.set(key, new ComputedValue(options));\n });\n return function () {\n return this[$mobx].getObservablePropValue_(key);\n };\n}\nfunction assertComputedDescriptor(adm, _ref, key, _ref2) {\n var annotationType_ = _ref.annotationType_;\n var get = _ref2.get;\n if ( true && !get) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' can only be used on getter(+setter) properties.\"));\n }\n}\n\nfunction createObservableAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$4,\n extend_: extend_$4,\n decorate_20223_: decorate_20223_$4\n };\n}\nfunction make_$4(adm, key, descriptor) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;\n}\nfunction extend_$4(adm, key, descriptor, proxyTrap) {\n var _this$options_$enhanc, _this$options_;\n assertObservableDescriptor(adm, this, key, descriptor);\n return adm.defineObservableProperty_(key, descriptor.value, (_this$options_$enhanc = (_this$options_ = this.options_) == null ? void 0 : _this$options_.enhancer) != null ? _this$options_$enhanc : deepEnhancer, proxyTrap);\n}\nfunction decorate_20223_$4(desc, context) {\n if (true) {\n if (context.kind === \"field\") {\n throw die(\"Please use `@observable accessor \" + String(context.name) + \"` instead of `@observable \" + String(context.name) + \"`\");\n }\n assert20223DecoratorType(context, [\"accessor\"]);\n }\n var ann = this;\n var kind = context.kind,\n name = context.name;\n // The laziness here is not ideal... It's a workaround to how 2022.3 Decorators are implemented:\n // `addInitializer` callbacks are executed _before_ any accessors are defined (instead of the ideal-for-us right after each).\n // This means that, if we were to do our stuff in an `addInitializer`, we'd attempt to read a private slot\n // before it has been initialized. The runtime doesn't like that and throws a `Cannot read private member\n // from an object whose class did not declare it` error.\n // TODO: it seems that this will not be required anymore in the final version of the spec\n // See TODO: link\n var initializedObjects = new WeakSet();\n function initializeObservable(target, value) {\n var _ann$options_$enhance, _ann$options_;\n var adm = asObservableObject(target)[$mobx];\n var observable = new ObservableValue(value, (_ann$options_$enhance = (_ann$options_ = ann.options_) == null ? void 0 : _ann$options_.enhancer) != null ? _ann$options_$enhance : deepEnhancer, true ? adm.name_ + \".\" + name.toString() : 0, false);\n adm.values_.set(name, observable);\n initializedObjects.add(target);\n }\n if (kind == \"accessor\") {\n return {\n get: function get() {\n if (!initializedObjects.has(this)) {\n initializeObservable(this, desc.get.call(this));\n }\n return this[$mobx].getObservablePropValue_(name);\n },\n set: function set(value) {\n if (!initializedObjects.has(this)) {\n initializeObservable(this, value);\n }\n return this[$mobx].setObservablePropValue_(name, value);\n },\n init: function init(value) {\n if (!initializedObjects.has(this)) {\n initializeObservable(this, value);\n }\n return value;\n }\n };\n }\n return;\n}\nfunction assertObservableDescriptor(adm, _ref, key, descriptor) {\n var annotationType_ = _ref.annotationType_;\n if ( true && !(\"value\" in descriptor)) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' cannot be used on getter/setter properties\"));\n }\n}\n\nvar AUTO = \"true\";\nvar autoAnnotation = /*#__PURE__*/createAutoAnnotation();\nfunction createAutoAnnotation(options) {\n return {\n annotationType_: AUTO,\n options_: options,\n make_: make_$5,\n extend_: extend_$5,\n decorate_20223_: decorate_20223_$5\n };\n}\nfunction make_$5(adm, key, descriptor, source) {\n var _this$options_3, _this$options_4;\n // getter -> computed\n if (descriptor.get) {\n return computed.make_(adm, key, descriptor, source);\n }\n // lone setter -> action setter\n if (descriptor.set) {\n // TODO make action applicable to setter and delegate to action.make_\n var set = createAction(key.toString(), descriptor.set);\n // own\n if (source === adm.target_) {\n return adm.defineProperty_(key, {\n configurable: globalState.safeDescriptors ? adm.isPlainObject_ : true,\n set: set\n }) === null ? 0 /* MakeResult.Cancel */ : 2 /* MakeResult.Continue */;\n }\n // proto\n defineProperty(source, key, {\n configurable: true,\n set: set\n });\n return 2 /* MakeResult.Continue */;\n }\n // function on proto -> autoAction/flow\n if (source !== adm.target_ && typeof descriptor.value === \"function\") {\n var _this$options_2;\n if (isGenerator(descriptor.value)) {\n var _this$options_;\n var flowAnnotation = (_this$options_ = this.options_) != null && _this$options_.autoBind ? flow.bound : flow;\n return flowAnnotation.make_(adm, key, descriptor, source);\n }\n var actionAnnotation = (_this$options_2 = this.options_) != null && _this$options_2.autoBind ? autoAction.bound : autoAction;\n return actionAnnotation.make_(adm, key, descriptor, source);\n }\n // other -> observable\n // Copy props from proto as well, see test:\n // \"decorate should work with Object.create\"\n var observableAnnotation = ((_this$options_3 = this.options_) == null ? void 0 : _this$options_3.deep) === false ? observable.ref : observable;\n // if function respect autoBind option\n if (typeof descriptor.value === \"function\" && (_this$options_4 = this.options_) != null && _this$options_4.autoBind) {\n var _adm$proxy_;\n descriptor.value = descriptor.value.bind((_adm$proxy_ = adm.proxy_) != null ? _adm$proxy_ : adm.target_);\n }\n return observableAnnotation.make_(adm, key, descriptor, source);\n}\nfunction extend_$5(adm, key, descriptor, proxyTrap) {\n var _this$options_5, _this$options_6;\n // getter -> computed\n if (descriptor.get) {\n return computed.extend_(adm, key, descriptor, proxyTrap);\n }\n // lone setter -> action setter\n if (descriptor.set) {\n // TODO make action applicable to setter and delegate to action.extend_\n return adm.defineProperty_(key, {\n configurable: globalState.safeDescriptors ? adm.isPlainObject_ : true,\n set: createAction(key.toString(), descriptor.set)\n }, proxyTrap);\n }\n // other -> observable\n // if function respect autoBind option\n if (typeof descriptor.value === \"function\" && (_this$options_5 = this.options_) != null && _this$options_5.autoBind) {\n var _adm$proxy_2;\n descriptor.value = descriptor.value.bind((_adm$proxy_2 = adm.proxy_) != null ? _adm$proxy_2 : adm.target_);\n }\n var observableAnnotation = ((_this$options_6 = this.options_) == null ? void 0 : _this$options_6.deep) === false ? observable.ref : observable;\n return observableAnnotation.extend_(adm, key, descriptor, proxyTrap);\n}\nfunction decorate_20223_$5(desc, context) {\n die(\"'\" + this.annotationType_ + \"' cannot be used as a decorator\");\n}\n\nvar OBSERVABLE = \"observable\";\nvar OBSERVABLE_REF = \"observable.ref\";\nvar OBSERVABLE_SHALLOW = \"observable.shallow\";\nvar OBSERVABLE_STRUCT = \"observable.struct\";\n// Predefined bags of create observable options, to avoid allocating temporarily option objects\n// in the majority of cases\nvar defaultCreateObservableOptions = {\n deep: true,\n name: undefined,\n defaultDecorator: undefined,\n proxy: true\n};\nObject.freeze(defaultCreateObservableOptions);\nfunction asCreateObservableOptions(thing) {\n return thing || defaultCreateObservableOptions;\n}\nvar observableAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE);\nvar observableRefAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE_REF, {\n enhancer: referenceEnhancer\n});\nvar observableShallowAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE_SHALLOW, {\n enhancer: shallowEnhancer\n});\nvar observableStructAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE_STRUCT, {\n enhancer: refStructEnhancer\n});\nvar observableDecoratorAnnotation = /*#__PURE__*/createDecoratorAnnotation(observableAnnotation);\nfunction getEnhancerFromOptions(options) {\n return options.deep === true ? deepEnhancer : options.deep === false ? referenceEnhancer : getEnhancerFromAnnotation(options.defaultDecorator);\n}\nfunction getAnnotationFromOptions(options) {\n var _options$defaultDecor;\n return options ? (_options$defaultDecor = options.defaultDecorator) != null ? _options$defaultDecor : createAutoAnnotation(options) : undefined;\n}\nfunction getEnhancerFromAnnotation(annotation) {\n var _annotation$options_$, _annotation$options_;\n return !annotation ? deepEnhancer : (_annotation$options_$ = (_annotation$options_ = annotation.options_) == null ? void 0 : _annotation$options_.enhancer) != null ? _annotation$options_$ : deepEnhancer;\n}\n/**\n * Turns an object, array or function into a reactive structure.\n * @param v the value which should become observable.\n */\nfunction createObservable(v, arg2, arg3) {\n // @observable someProp; (2022.3 Decorators)\n if (is20223Decorator(arg2)) {\n return observableAnnotation.decorate_20223_(v, arg2);\n }\n // @observable someProp;\n if (isStringish(arg2)) {\n storeAnnotation(v, arg2, observableAnnotation);\n return;\n }\n // already observable - ignore\n if (isObservable(v)) {\n return v;\n }\n // plain object\n if (isPlainObject(v)) {\n return observable.object(v, arg2, arg3);\n }\n // Array\n if (Array.isArray(v)) {\n return observable.array(v, arg2);\n }\n // Map\n if (isES6Map(v)) {\n return observable.map(v, arg2);\n }\n // Set\n if (isES6Set(v)) {\n return observable.set(v, arg2);\n }\n // other object - ignore\n if (typeof v === \"object\" && v !== null) {\n return v;\n }\n // anything else\n return observable.box(v, arg2);\n}\nassign(createObservable, observableDecoratorAnnotation);\nvar observableFactories = {\n box: function box(value, options) {\n var o = asCreateObservableOptions(options);\n return new ObservableValue(value, getEnhancerFromOptions(o), o.name, true, o.equals);\n },\n array: function array(initialValues, options) {\n var o = asCreateObservableOptions(options);\n return (globalState.useProxies === false || o.proxy === false ? createLegacyArray : createObservableArray)(initialValues, getEnhancerFromOptions(o), o.name);\n },\n map: function map(initialValues, options) {\n var o = asCreateObservableOptions(options);\n return new ObservableMap(initialValues, getEnhancerFromOptions(o), o.name);\n },\n set: function set(initialValues, options) {\n var o = asCreateObservableOptions(options);\n return new ObservableSet(initialValues, getEnhancerFromOptions(o), o.name);\n },\n object: function object(props, decorators, options) {\n return initObservable(function () {\n return extendObservable(globalState.useProxies === false || (options == null ? void 0 : options.proxy) === false ? asObservableObject({}, options) : asDynamicObservableObject({}, options), props, decorators);\n });\n },\n ref: /*#__PURE__*/createDecoratorAnnotation(observableRefAnnotation),\n shallow: /*#__PURE__*/createDecoratorAnnotation(observableShallowAnnotation),\n deep: observableDecoratorAnnotation,\n struct: /*#__PURE__*/createDecoratorAnnotation(observableStructAnnotation)\n};\n// eslint-disable-next-line\nvar observable = /*#__PURE__*/assign(createObservable, observableFactories);\n\nvar COMPUTED = \"computed\";\nvar COMPUTED_STRUCT = \"computed.struct\";\nvar computedAnnotation = /*#__PURE__*/createComputedAnnotation(COMPUTED);\nvar computedStructAnnotation = /*#__PURE__*/createComputedAnnotation(COMPUTED_STRUCT, {\n equals: comparer.structural\n});\n/**\n * Decorator for class properties: @computed get value() { return expr; }.\n * For legacy purposes also invokable as ES5 observable created: `computed(() => expr)`;\n */\nvar computed = function computed(arg1, arg2) {\n if (is20223Decorator(arg2)) {\n // @computed (2022.3 Decorators)\n return computedAnnotation.decorate_20223_(arg1, arg2);\n }\n if (isStringish(arg2)) {\n // @computed\n return storeAnnotation(arg1, arg2, computedAnnotation);\n }\n if (isPlainObject(arg1)) {\n // @computed({ options })\n return createDecoratorAnnotation(createComputedAnnotation(COMPUTED, arg1));\n }\n // computed(expr, options?)\n if (true) {\n if (!isFunction(arg1)) {\n die(\"First argument to `computed` should be an expression.\");\n }\n if (isFunction(arg2)) {\n die(\"A setter as second argument is no longer supported, use `{ set: fn }` option instead\");\n }\n }\n var opts = isPlainObject(arg2) ? arg2 : {};\n opts.get = arg1;\n opts.name || (opts.name = arg1.name || \"\"); /* for generated name */\n return new ComputedValue(opts);\n};\nObject.assign(computed, computedAnnotation);\ncomputed.struct = /*#__PURE__*/createDecoratorAnnotation(computedStructAnnotation);\n\nvar _getDescriptor$config, _getDescriptor;\n// we don't use globalState for these in order to avoid possible issues with multiple\n// mobx versions\nvar currentActionId = 0;\nvar nextActionId = 1;\nvar isFunctionNameConfigurable = (_getDescriptor$config = (_getDescriptor = /*#__PURE__*/getDescriptor(function () {}, \"name\")) == null ? void 0 : _getDescriptor.configurable) != null ? _getDescriptor$config : false;\n// we can safely recycle this object\nvar tmpNameDescriptor = {\n value: \"action\",\n configurable: true,\n writable: false,\n enumerable: false\n};\nfunction createAction(actionName, fn, autoAction, ref) {\n if (autoAction === void 0) {\n autoAction = false;\n }\n if (true) {\n if (!isFunction(fn)) {\n die(\"`action` can only be invoked on functions\");\n }\n if (typeof actionName !== \"string\" || !actionName) {\n die(\"actions should have valid names, got: '\" + actionName + \"'\");\n }\n }\n function res() {\n return executeAction(actionName, autoAction, fn, ref || this, arguments);\n }\n res.isMobxAction = true;\n res.toString = function () {\n return fn.toString();\n };\n if (isFunctionNameConfigurable) {\n tmpNameDescriptor.value = actionName;\n defineProperty(res, \"name\", tmpNameDescriptor);\n }\n return res;\n}\nfunction executeAction(actionName, canRunAsDerivation, fn, scope, args) {\n var runInfo = _startAction(actionName, canRunAsDerivation, scope, args);\n try {\n return fn.apply(scope, args);\n } catch (err) {\n runInfo.error_ = err;\n throw err;\n } finally {\n _endAction(runInfo);\n }\n}\nfunction _startAction(actionName, canRunAsDerivation,\n// true for autoAction\nscope, args) {\n var notifySpy_ = true && isSpyEnabled() && !!actionName;\n var startTime_ = 0;\n if ( true && notifySpy_) {\n startTime_ = Date.now();\n var flattenedArgs = args ? Array.from(args) : EMPTY_ARRAY;\n spyReportStart({\n type: ACTION,\n name: actionName,\n object: scope,\n arguments: flattenedArgs\n });\n }\n var prevDerivation_ = globalState.trackingDerivation;\n var runAsAction = !canRunAsDerivation || !prevDerivation_;\n startBatch();\n var prevAllowStateChanges_ = globalState.allowStateChanges; // by default preserve previous allow\n if (runAsAction) {\n untrackedStart();\n prevAllowStateChanges_ = allowStateChangesStart(true);\n }\n var prevAllowStateReads_ = allowStateReadsStart(true);\n var runInfo = {\n runAsAction_: runAsAction,\n prevDerivation_: prevDerivation_,\n prevAllowStateChanges_: prevAllowStateChanges_,\n prevAllowStateReads_: prevAllowStateReads_,\n notifySpy_: notifySpy_,\n startTime_: startTime_,\n actionId_: nextActionId++,\n parentActionId_: currentActionId\n };\n currentActionId = runInfo.actionId_;\n return runInfo;\n}\nfunction _endAction(runInfo) {\n if (currentActionId !== runInfo.actionId_) {\n die(30);\n }\n currentActionId = runInfo.parentActionId_;\n if (runInfo.error_ !== undefined) {\n globalState.suppressReactionErrors = true;\n }\n allowStateChangesEnd(runInfo.prevAllowStateChanges_);\n allowStateReadsEnd(runInfo.prevAllowStateReads_);\n endBatch();\n if (runInfo.runAsAction_) {\n untrackedEnd(runInfo.prevDerivation_);\n }\n if ( true && runInfo.notifySpy_) {\n spyReportEnd({\n time: Date.now() - runInfo.startTime_\n });\n }\n globalState.suppressReactionErrors = false;\n}\nfunction allowStateChanges(allowStateChanges, func) {\n var prev = allowStateChangesStart(allowStateChanges);\n try {\n return func();\n } finally {\n allowStateChangesEnd(prev);\n }\n}\nfunction allowStateChangesStart(allowStateChanges) {\n var prev = globalState.allowStateChanges;\n globalState.allowStateChanges = allowStateChanges;\n return prev;\n}\nfunction allowStateChangesEnd(prev) {\n globalState.allowStateChanges = prev;\n}\n\nvar CREATE = \"create\";\nvar ObservableValue = /*#__PURE__*/function (_Atom) {\n function ObservableValue(value, enhancer, name_, notifySpy, equals) {\n var _this;\n if (name_ === void 0) {\n name_ = true ? \"ObservableValue@\" + getNextId() : 0;\n }\n if (notifySpy === void 0) {\n notifySpy = true;\n }\n if (equals === void 0) {\n equals = comparer[\"default\"];\n }\n _this = _Atom.call(this, name_) || this;\n _this.enhancer = void 0;\n _this.name_ = void 0;\n _this.equals = void 0;\n _this.hasUnreportedChange_ = false;\n _this.interceptors_ = void 0;\n _this.changeListeners_ = void 0;\n _this.value_ = void 0;\n _this.dehancer = void 0;\n _this.enhancer = enhancer;\n _this.name_ = name_;\n _this.equals = equals;\n _this.value_ = enhancer(value, undefined, name_);\n if ( true && notifySpy && isSpyEnabled()) {\n // only notify spy if this is a stand-alone observable\n spyReport({\n type: CREATE,\n object: _this,\n observableKind: \"value\",\n debugObjectName: _this.name_,\n newValue: \"\" + _this.value_\n });\n }\n return _this;\n }\n _inheritsLoose(ObservableValue, _Atom);\n var _proto = ObservableValue.prototype;\n _proto.dehanceValue = function dehanceValue(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.set = function set(newValue) {\n var oldValue = this.value_;\n newValue = this.prepareNewValue_(newValue);\n if (newValue !== globalState.UNCHANGED) {\n var notifySpy = isSpyEnabled();\n if ( true && notifySpy) {\n spyReportStart({\n type: UPDATE,\n object: this,\n observableKind: \"value\",\n debugObjectName: this.name_,\n newValue: newValue,\n oldValue: oldValue\n });\n }\n this.setNewValue_(newValue);\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n };\n _proto.prepareNewValue_ = function prepareNewValue_(newValue) {\n checkIfStateModificationsAreAllowed(this);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this,\n type: UPDATE,\n newValue: newValue\n });\n if (!change) {\n return globalState.UNCHANGED;\n }\n newValue = change.newValue;\n }\n // apply modifier\n newValue = this.enhancer(newValue, this.value_, this.name_);\n return this.equals(this.value_, newValue) ? globalState.UNCHANGED : newValue;\n };\n _proto.setNewValue_ = function setNewValue_(newValue) {\n var oldValue = this.value_;\n this.value_ = newValue;\n this.reportChanged();\n if (hasListeners(this)) {\n notifyListeners(this, {\n type: UPDATE,\n object: this,\n newValue: newValue,\n oldValue: oldValue\n });\n }\n };\n _proto.get = function get() {\n this.reportObserved();\n return this.dehanceValue(this.value_);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n if (fireImmediately) {\n listener({\n observableKind: \"value\",\n debugObjectName: this.name_,\n object: this,\n type: UPDATE,\n newValue: this.value_,\n oldValue: undefined\n });\n }\n return registerListener(this, listener);\n };\n _proto.raw = function raw() {\n // used by MST ot get undehanced value\n return this.value_;\n };\n _proto.toJSON = function toJSON() {\n return this.get();\n };\n _proto.toString = function toString() {\n return this.name_ + \"[\" + this.value_ + \"]\";\n };\n _proto.valueOf = function valueOf() {\n return toPrimitive(this.get());\n };\n _proto[Symbol.toPrimitive] = function () {\n return this.valueOf();\n };\n return ObservableValue;\n}(Atom);\nvar isObservableValue = /*#__PURE__*/createInstanceofPredicate(\"ObservableValue\", ObservableValue);\n\n/**\n * A node in the state dependency root that observes other nodes, and can be observed itself.\n *\n * ComputedValue will remember the result of the computation for the duration of the batch, or\n * while being observed.\n *\n * During this time it will recompute only when one of its direct dependencies changed,\n * but only when it is being accessed with `ComputedValue.get()`.\n *\n * Implementation description:\n * 1. First time it's being accessed it will compute and remember result\n * give back remembered result until 2. happens\n * 2. First time any deep dependency change, propagate POSSIBLY_STALE to all observers, wait for 3.\n * 3. When it's being accessed, recompute if any shallow dependency changed.\n * if result changed: propagate STALE to all observers, that were POSSIBLY_STALE from the last step.\n * go to step 2. either way\n *\n * If at any point it's outside batch and it isn't observed: reset everything and go to 1.\n */\nvar ComputedValue = /*#__PURE__*/function () {\n /**\n * Create a new computed value based on a function expression.\n *\n * The `name` property is for debug purposes only.\n *\n * The `equals` property specifies the comparer function to use to determine if a newly produced\n * value differs from the previous value. Two comparers are provided in the library; `defaultComparer`\n * compares based on identity comparison (===), and `structuralComparer` deeply compares the structure.\n * Structural comparison can be convenient if you always produce a new aggregated object and\n * don't want to notify observers if it is structurally the same.\n * This is useful for working with vectors, mouse coordinates etc.\n */\n function ComputedValue(options) {\n this.dependenciesState_ = IDerivationState_.NOT_TRACKING_;\n this.observing_ = [];\n // nodes we are looking at. Our value depends on these nodes\n this.newObserving_ = null;\n // during tracking it's an array with new observed observers\n this.observers_ = new Set();\n this.runId_ = 0;\n this.lastAccessedBy_ = 0;\n this.lowestObserverState_ = IDerivationState_.UP_TO_DATE_;\n this.unboundDepsCount_ = 0;\n this.value_ = new CaughtException(null);\n this.name_ = void 0;\n this.triggeredBy_ = void 0;\n this.flags_ = 0;\n this.derivation = void 0;\n // N.B: unminified as it is used by MST\n this.setter_ = void 0;\n this.isTracing_ = TraceMode.NONE;\n this.scope_ = void 0;\n this.equals_ = void 0;\n this.requiresReaction_ = void 0;\n this.keepAlive_ = void 0;\n this.onBOL = void 0;\n this.onBUOL = void 0;\n if (!options.get) {\n die(31);\n }\n this.derivation = options.get;\n this.name_ = options.name || ( true ? \"ComputedValue@\" + getNextId() : 0);\n if (options.set) {\n this.setter_ = createAction( true ? this.name_ + \"-setter\" : 0, options.set);\n }\n this.equals_ = options.equals || (options.compareStructural || options.struct ? comparer.structural : comparer[\"default\"]);\n this.scope_ = options.context;\n this.requiresReaction_ = options.requiresReaction;\n this.keepAlive_ = !!options.keepAlive;\n }\n var _proto = ComputedValue.prototype;\n _proto.onBecomeStale_ = function onBecomeStale_() {\n propagateMaybeChanged(this);\n };\n _proto.onBO = function onBO() {\n if (this.onBOL) {\n this.onBOL.forEach(function (listener) {\n return listener();\n });\n }\n };\n _proto.onBUO = function onBUO() {\n if (this.onBUOL) {\n this.onBUOL.forEach(function (listener) {\n return listener();\n });\n }\n }\n // to check for cycles\n ;\n /**\n * Returns the current value of this computed value.\n * Will evaluate its computation first if needed.\n */\n _proto.get = function get() {\n if (this.isComputing) {\n die(32, this.name_, this.derivation);\n }\n if (globalState.inBatch === 0 &&\n // !globalState.trackingDerivatpion &&\n this.observers_.size === 0 && !this.keepAlive_) {\n if (shouldCompute(this)) {\n this.warnAboutUntrackedRead_();\n startBatch(); // See perf test 'computed memoization'\n this.value_ = this.computeValue_(false);\n endBatch();\n }\n } else {\n reportObserved(this);\n if (shouldCompute(this)) {\n var prevTrackingContext = globalState.trackingContext;\n if (this.keepAlive_ && !prevTrackingContext) {\n globalState.trackingContext = this;\n }\n if (this.trackAndCompute()) {\n propagateChangeConfirmed(this);\n }\n globalState.trackingContext = prevTrackingContext;\n }\n }\n var result = this.value_;\n if (isCaughtException(result)) {\n throw result.cause;\n }\n return result;\n };\n _proto.set = function set(value) {\n if (this.setter_) {\n if (this.isRunningSetter) {\n die(33, this.name_);\n }\n this.isRunningSetter = true;\n try {\n this.setter_.call(this.scope_, value);\n } finally {\n this.isRunningSetter = false;\n }\n } else {\n die(34, this.name_);\n }\n };\n _proto.trackAndCompute = function trackAndCompute() {\n // N.B: unminified as it is used by MST\n var oldValue = this.value_;\n var wasSuspended = /* see #1208 */this.dependenciesState_ === IDerivationState_.NOT_TRACKING_;\n var newValue = this.computeValue_(true);\n var changed = wasSuspended || isCaughtException(oldValue) || isCaughtException(newValue) || !this.equals_(oldValue, newValue);\n if (changed) {\n this.value_ = newValue;\n if ( true && isSpyEnabled()) {\n spyReport({\n observableKind: \"computed\",\n debugObjectName: this.name_,\n object: this.scope_,\n type: \"update\",\n oldValue: oldValue,\n newValue: newValue\n });\n }\n }\n return changed;\n };\n _proto.computeValue_ = function computeValue_(track) {\n this.isComputing = true;\n // don't allow state changes during computation\n var prev = allowStateChangesStart(false);\n var res;\n if (track) {\n res = trackDerivedFunction(this, this.derivation, this.scope_);\n } else {\n if (globalState.disableErrorBoundaries === true) {\n res = this.derivation.call(this.scope_);\n } else {\n try {\n res = this.derivation.call(this.scope_);\n } catch (e) {\n res = new CaughtException(e);\n }\n }\n }\n allowStateChangesEnd(prev);\n this.isComputing = false;\n return res;\n };\n _proto.suspend_ = function suspend_() {\n if (!this.keepAlive_) {\n clearObserving(this);\n this.value_ = undefined; // don't hold on to computed value!\n if ( true && this.isTracing_ !== TraceMode.NONE) {\n console.log(\"[mobx.trace] Computed value '\" + this.name_ + \"' was suspended and it will recompute on the next access.\");\n }\n }\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n var _this = this;\n var firstTime = true;\n var prevValue = undefined;\n return autorun(function () {\n // TODO: why is this in a different place than the spyReport() function? in all other observables it's called in the same place\n var newValue = _this.get();\n if (!firstTime || fireImmediately) {\n var prevU = untrackedStart();\n listener({\n observableKind: \"computed\",\n debugObjectName: _this.name_,\n type: UPDATE,\n object: _this,\n newValue: newValue,\n oldValue: prevValue\n });\n untrackedEnd(prevU);\n }\n firstTime = false;\n prevValue = newValue;\n });\n };\n _proto.warnAboutUntrackedRead_ = function warnAboutUntrackedRead_() {\n if (false) {}\n if (this.isTracing_ !== TraceMode.NONE) {\n console.log(\"[mobx.trace] Computed value '\" + this.name_ + \"' is being read outside a reactive context. Doing a full recompute.\");\n }\n if (typeof this.requiresReaction_ === \"boolean\" ? this.requiresReaction_ : globalState.computedRequiresReaction) {\n console.warn(\"[mobx] Computed value '\" + this.name_ + \"' is being read outside a reactive context. Doing a full recompute.\");\n }\n };\n _proto.toString = function toString() {\n return this.name_ + \"[\" + this.derivation.toString() + \"]\";\n };\n _proto.valueOf = function valueOf() {\n return toPrimitive(this.get());\n };\n _proto[Symbol.toPrimitive] = function () {\n return this.valueOf();\n };\n return _createClass(ComputedValue, [{\n key: \"isComputing\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isComputingMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isComputingMask_, newValue);\n }\n }, {\n key: \"isRunningSetter\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isRunningSetterMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isRunningSetterMask_, newValue);\n }\n }, {\n key: \"isBeingObserved\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isBeingObservedMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isBeingObservedMask_, newValue);\n }\n }, {\n key: \"isPendingUnobservation\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isPendingUnobservationMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isPendingUnobservationMask_, newValue);\n }\n }, {\n key: \"diffValue\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.diffValueMask_) ? 1 : 0;\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.diffValueMask_, newValue === 1 ? true : false);\n }\n }]);\n}();\nComputedValue.isComputingMask_ = 1;\nComputedValue.isRunningSetterMask_ = 2;\nComputedValue.isBeingObservedMask_ = 4;\nComputedValue.isPendingUnobservationMask_ = 8;\nComputedValue.diffValueMask_ = 16;\nvar isComputedValue = /*#__PURE__*/createInstanceofPredicate(\"ComputedValue\", ComputedValue);\n\nvar IDerivationState_;\n(function (IDerivationState_) {\n // before being run or (outside batch and not being observed)\n // at this point derivation is not holding any data about dependency tree\n IDerivationState_[IDerivationState_[\"NOT_TRACKING_\"] = -1] = \"NOT_TRACKING_\";\n // no shallow dependency changed since last computation\n // won't recalculate derivation\n // this is what makes mobx fast\n IDerivationState_[IDerivationState_[\"UP_TO_DATE_\"] = 0] = \"UP_TO_DATE_\";\n // some deep dependency changed, but don't know if shallow dependency changed\n // will require to check first if UP_TO_DATE or POSSIBLY_STALE\n // currently only ComputedValue will propagate POSSIBLY_STALE\n //\n // having this state is second big optimization:\n // don't have to recompute on every dependency change, but only when it's needed\n IDerivationState_[IDerivationState_[\"POSSIBLY_STALE_\"] = 1] = \"POSSIBLY_STALE_\";\n // A shallow dependency has changed since last computation and the derivation\n // will need to recompute when it's needed next.\n IDerivationState_[IDerivationState_[\"STALE_\"] = 2] = \"STALE_\";\n})(IDerivationState_ || (IDerivationState_ = {}));\nvar TraceMode;\n(function (TraceMode) {\n TraceMode[TraceMode[\"NONE\"] = 0] = \"NONE\";\n TraceMode[TraceMode[\"LOG\"] = 1] = \"LOG\";\n TraceMode[TraceMode[\"BREAK\"] = 2] = \"BREAK\";\n})(TraceMode || (TraceMode = {}));\nvar CaughtException = function CaughtException(cause) {\n this.cause = void 0;\n this.cause = cause;\n // Empty\n};\nfunction isCaughtException(e) {\n return e instanceof CaughtException;\n}\n/**\n * Finds out whether any dependency of the derivation has actually changed.\n * If dependenciesState is 1 then it will recalculate dependencies,\n * if any dependency changed it will propagate it by changing dependenciesState to 2.\n *\n * By iterating over the dependencies in the same order that they were reported and\n * stopping on the first change, all the recalculations are only called for ComputedValues\n * that will be tracked by derivation. That is because we assume that if the first x\n * dependencies of the derivation doesn't change then the derivation should run the same way\n * up until accessing x-th dependency.\n */\nfunction shouldCompute(derivation) {\n switch (derivation.dependenciesState_) {\n case IDerivationState_.UP_TO_DATE_:\n return false;\n case IDerivationState_.NOT_TRACKING_:\n case IDerivationState_.STALE_:\n return true;\n case IDerivationState_.POSSIBLY_STALE_:\n {\n // state propagation can occur outside of action/reactive context #2195\n var prevAllowStateReads = allowStateReadsStart(true);\n var prevUntracked = untrackedStart(); // no need for those computeds to be reported, they will be picked up in trackDerivedFunction.\n var obs = derivation.observing_,\n l = obs.length;\n for (var i = 0; i < l; i++) {\n var obj = obs[i];\n if (isComputedValue(obj)) {\n if (globalState.disableErrorBoundaries) {\n obj.get();\n } else {\n try {\n obj.get();\n } catch (e) {\n // we are not interested in the value *or* exception at this moment, but if there is one, notify all\n untrackedEnd(prevUntracked);\n allowStateReadsEnd(prevAllowStateReads);\n return true;\n }\n }\n // if ComputedValue `obj` actually changed it will be computed and propagated to its observers.\n // and `derivation` is an observer of `obj`\n // invariantShouldCompute(derivation)\n if (derivation.dependenciesState_ === IDerivationState_.STALE_) {\n untrackedEnd(prevUntracked);\n allowStateReadsEnd(prevAllowStateReads);\n return true;\n }\n }\n }\n changeDependenciesStateTo0(derivation);\n untrackedEnd(prevUntracked);\n allowStateReadsEnd(prevAllowStateReads);\n return false;\n }\n }\n}\nfunction isComputingDerivation() {\n return globalState.trackingDerivation !== null; // filter out actions inside computations\n}\nfunction checkIfStateModificationsAreAllowed(atom) {\n if (false) {}\n var hasObservers = atom.observers_.size > 0;\n // Should not be possible to change observed state outside strict mode, except during initialization, see #563\n if (!globalState.allowStateChanges && (hasObservers || globalState.enforceActions === \"always\")) {\n console.warn(\"[MobX] \" + (globalState.enforceActions ? \"Since strict-mode is enabled, changing (observed) observable values without using an action is not allowed. Tried to modify: \" : \"Side effects like changing state are not allowed at this point. Are you trying to modify state from, for example, a computed value or the render function of a React component? You can wrap side effects in 'runInAction' (or decorate functions with 'action') if needed. Tried to modify: \") + atom.name_);\n }\n}\nfunction checkIfStateReadsAreAllowed(observable) {\n if ( true && !globalState.allowStateReads && globalState.observableRequiresReaction) {\n console.warn(\"[mobx] Observable '\" + observable.name_ + \"' being read outside a reactive context.\");\n }\n}\n/**\n * Executes the provided function `f` and tracks which observables are being accessed.\n * The tracking information is stored on the `derivation` object and the derivation is registered\n * as observer of any of the accessed observables.\n */\nfunction trackDerivedFunction(derivation, f, context) {\n var prevAllowStateReads = allowStateReadsStart(true);\n changeDependenciesStateTo0(derivation);\n // Preallocate array; will be trimmed by bindDependencies.\n derivation.newObserving_ = new Array(\n // Reserve constant space for initial dependencies, dynamic space otherwise.\n // See https://github.com/mobxjs/mobx/pull/3833\n derivation.runId_ === 0 ? 100 : derivation.observing_.length);\n derivation.unboundDepsCount_ = 0;\n derivation.runId_ = ++globalState.runId;\n var prevTracking = globalState.trackingDerivation;\n globalState.trackingDerivation = derivation;\n globalState.inBatch++;\n var result;\n if (globalState.disableErrorBoundaries === true) {\n result = f.call(context);\n } else {\n try {\n result = f.call(context);\n } catch (e) {\n result = new CaughtException(e);\n }\n }\n globalState.inBatch--;\n globalState.trackingDerivation = prevTracking;\n bindDependencies(derivation);\n warnAboutDerivationWithoutDependencies(derivation);\n allowStateReadsEnd(prevAllowStateReads);\n return result;\n}\nfunction warnAboutDerivationWithoutDependencies(derivation) {\n if (false) {}\n if (derivation.observing_.length !== 0) {\n return;\n }\n if (typeof derivation.requiresObservable_ === \"boolean\" ? derivation.requiresObservable_ : globalState.reactionRequiresObservable) {\n console.warn(\"[mobx] Derivation '\" + derivation.name_ + \"' is created/updated without reading any observable value.\");\n }\n}\n/**\n * diffs newObserving with observing.\n * update observing to be newObserving with unique observables\n * notify observers that become observed/unobserved\n */\nfunction bindDependencies(derivation) {\n // invariant(derivation.dependenciesState !== IDerivationState.NOT_TRACKING, \"INTERNAL ERROR bindDependencies expects derivation.dependenciesState !== -1\");\n var prevObserving = derivation.observing_;\n var observing = derivation.observing_ = derivation.newObserving_;\n var lowestNewObservingDerivationState = IDerivationState_.UP_TO_DATE_;\n // Go through all new observables and check diffValue: (this list can contain duplicates):\n // 0: first occurrence, change to 1 and keep it\n // 1: extra occurrence, drop it\n var i0 = 0,\n l = derivation.unboundDepsCount_;\n for (var i = 0; i < l; i++) {\n var dep = observing[i];\n if (dep.diffValue === 0) {\n dep.diffValue = 1;\n if (i0 !== i) {\n observing[i0] = dep;\n }\n i0++;\n }\n // Upcast is 'safe' here, because if dep is IObservable, `dependenciesState` will be undefined,\n // not hitting the condition\n if (dep.dependenciesState_ > lowestNewObservingDerivationState) {\n lowestNewObservingDerivationState = dep.dependenciesState_;\n }\n }\n observing.length = i0;\n derivation.newObserving_ = null; // newObserving shouldn't be needed outside tracking (statement moved down to work around FF bug, see #614)\n // Go through all old observables and check diffValue: (it is unique after last bindDependencies)\n // 0: it's not in new observables, unobserve it\n // 1: it keeps being observed, don't want to notify it. change to 0\n l = prevObserving.length;\n while (l--) {\n var _dep = prevObserving[l];\n if (_dep.diffValue === 0) {\n removeObserver(_dep, derivation);\n }\n _dep.diffValue = 0;\n }\n // Go through all new observables and check diffValue: (now it should be unique)\n // 0: it was set to 0 in last loop. don't need to do anything.\n // 1: it wasn't observed, let's observe it. set back to 0\n while (i0--) {\n var _dep2 = observing[i0];\n if (_dep2.diffValue === 1) {\n _dep2.diffValue = 0;\n addObserver(_dep2, derivation);\n }\n }\n // Some new observed derivations may become stale during this derivation computation\n // so they have had no chance to propagate staleness (#916)\n if (lowestNewObservingDerivationState !== IDerivationState_.UP_TO_DATE_) {\n derivation.dependenciesState_ = lowestNewObservingDerivationState;\n derivation.onBecomeStale_();\n }\n}\nfunction clearObserving(derivation) {\n // invariant(globalState.inBatch > 0, \"INTERNAL ERROR clearObserving should be called only inside batch\");\n var obs = derivation.observing_;\n derivation.observing_ = [];\n var i = obs.length;\n while (i--) {\n removeObserver(obs[i], derivation);\n }\n derivation.dependenciesState_ = IDerivationState_.NOT_TRACKING_;\n}\nfunction untracked(action) {\n var prev = untrackedStart();\n try {\n return action();\n } finally {\n untrackedEnd(prev);\n }\n}\nfunction untrackedStart() {\n var prev = globalState.trackingDerivation;\n globalState.trackingDerivation = null;\n return prev;\n}\nfunction untrackedEnd(prev) {\n globalState.trackingDerivation = prev;\n}\nfunction allowStateReadsStart(allowStateReads) {\n var prev = globalState.allowStateReads;\n globalState.allowStateReads = allowStateReads;\n return prev;\n}\nfunction allowStateReadsEnd(prev) {\n globalState.allowStateReads = prev;\n}\n/**\n * needed to keep `lowestObserverState` correct. when changing from (2 or 1) to 0\n *\n */\nfunction changeDependenciesStateTo0(derivation) {\n if (derivation.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {\n return;\n }\n derivation.dependenciesState_ = IDerivationState_.UP_TO_DATE_;\n var obs = derivation.observing_;\n var i = obs.length;\n while (i--) {\n obs[i].lowestObserverState_ = IDerivationState_.UP_TO_DATE_;\n }\n}\n\n/**\n * These values will persist if global state is reset\n */\nvar persistentKeys = [\"mobxGuid\", \"spyListeners\", \"enforceActions\", \"computedRequiresReaction\", \"reactionRequiresObservable\", \"observableRequiresReaction\", \"allowStateReads\", \"disableErrorBoundaries\", \"runId\", \"UNCHANGED\", \"useProxies\"];\nvar MobXGlobals = function MobXGlobals() {\n /**\n * MobXGlobals version.\n * MobX compatiblity with other versions loaded in memory as long as this version matches.\n * It indicates that the global state still stores similar information\n *\n * N.B: this version is unrelated to the package version of MobX, and is only the version of the\n * internal state storage of MobX, and can be the same across many different package versions\n */\n this.version = 6;\n /**\n * globally unique token to signal unchanged\n */\n this.UNCHANGED = {};\n /**\n * Currently running derivation\n */\n this.trackingDerivation = null;\n /**\n * Currently running reaction. This determines if we currently have a reactive context.\n * (Tracking derivation is also set for temporal tracking of computed values inside actions,\n * but trackingReaction can only be set by a form of Reaction)\n */\n this.trackingContext = null;\n /**\n * Each time a derivation is tracked, it is assigned a unique run-id\n */\n this.runId = 0;\n /**\n * 'guid' for general purpose. Will be persisted amongst resets.\n */\n this.mobxGuid = 0;\n /**\n * Are we in a batch block? (and how many of them)\n */\n this.inBatch = 0;\n /**\n * Observables that don't have observers anymore, and are about to be\n * suspended, unless somebody else accesses it in the same batch\n *\n * @type {IObservable[]}\n */\n this.pendingUnobservations = [];\n /**\n * List of scheduled, not yet executed, reactions.\n */\n this.pendingReactions = [];\n /**\n * Are we currently processing reactions?\n */\n this.isRunningReactions = false;\n /**\n * Is it allowed to change observables at this point?\n * In general, MobX doesn't allow that when running computations and React.render.\n * To ensure that those functions stay pure.\n */\n this.allowStateChanges = false;\n /**\n * Is it allowed to read observables at this point?\n * Used to hold the state needed for `observableRequiresReaction`\n */\n this.allowStateReads = true;\n /**\n * If strict mode is enabled, state changes are by default not allowed\n */\n this.enforceActions = true;\n /**\n * Spy callbacks\n */\n this.spyListeners = [];\n /**\n * Globally attached error handlers that react specifically to errors in reactions\n */\n this.globalReactionErrorHandlers = [];\n /**\n * Warn if computed values are accessed outside a reactive context\n */\n this.computedRequiresReaction = false;\n /**\n * (Experimental)\n * Warn if you try to create to derivation / reactive context without accessing any observable.\n */\n this.reactionRequiresObservable = false;\n /**\n * (Experimental)\n * Warn if observables are accessed outside a reactive context\n */\n this.observableRequiresReaction = false;\n /*\n * Don't catch and rethrow exceptions. This is useful for inspecting the state of\n * the stack when an exception occurs while debugging.\n */\n this.disableErrorBoundaries = false;\n /*\n * If true, we are already handling an exception in an action. Any errors in reactions should be suppressed, as\n * they are not the cause, see: https://github.com/mobxjs/mobx/issues/1836\n */\n this.suppressReactionErrors = false;\n this.useProxies = true;\n /*\n * print warnings about code that would fail if proxies weren't available\n */\n this.verifyProxies = false;\n /**\n * False forces all object's descriptors to\n * writable: true\n * configurable: true\n */\n this.safeDescriptors = true;\n};\nvar canMergeGlobalState = true;\nvar isolateCalled = false;\nvar globalState = /*#__PURE__*/function () {\n var global = /*#__PURE__*/getGlobal();\n if (global.__mobxInstanceCount > 0 && !global.__mobxGlobals) {\n canMergeGlobalState = false;\n }\n if (global.__mobxGlobals && global.__mobxGlobals.version !== new MobXGlobals().version) {\n canMergeGlobalState = false;\n }\n if (!canMergeGlobalState) {\n // Because this is a IIFE we need to let isolateCalled a chance to change\n // so we run it after the event loop completed at least 1 iteration\n setTimeout(function () {\n if (!isolateCalled) {\n die(35);\n }\n }, 1);\n return new MobXGlobals();\n } else if (global.__mobxGlobals) {\n global.__mobxInstanceCount += 1;\n if (!global.__mobxGlobals.UNCHANGED) {\n global.__mobxGlobals.UNCHANGED = {};\n } // make merge backward compatible\n return global.__mobxGlobals;\n } else {\n global.__mobxInstanceCount = 1;\n return global.__mobxGlobals = /*#__PURE__*/new MobXGlobals();\n }\n}();\nfunction isolateGlobalState() {\n if (globalState.pendingReactions.length || globalState.inBatch || globalState.isRunningReactions) {\n die(36);\n }\n isolateCalled = true;\n if (canMergeGlobalState) {\n var global = getGlobal();\n if (--global.__mobxInstanceCount === 0) {\n global.__mobxGlobals = undefined;\n }\n globalState = new MobXGlobals();\n }\n}\nfunction getGlobalState() {\n return globalState;\n}\n/**\n * For testing purposes only; this will break the internal state of existing observables,\n * but can be used to get back at a stable state after throwing errors\n */\nfunction resetGlobalState() {\n var defaultGlobals = new MobXGlobals();\n for (var key in defaultGlobals) {\n if (persistentKeys.indexOf(key) === -1) {\n globalState[key] = defaultGlobals[key];\n }\n }\n globalState.allowStateChanges = !globalState.enforceActions;\n}\n\nfunction hasObservers(observable) {\n return observable.observers_ && observable.observers_.size > 0;\n}\nfunction getObservers(observable) {\n return observable.observers_;\n}\n// function invariantObservers(observable: IObservable) {\n// const list = observable.observers\n// const map = observable.observersIndexes\n// const l = list.length\n// for (let i = 0; i < l; i++) {\n// const id = list[i].__mapid\n// if (i) {\n// invariant(map[id] === i, \"INTERNAL ERROR maps derivation.__mapid to index in list\") // for performance\n// } else {\n// invariant(!(id in map), \"INTERNAL ERROR observer on index 0 shouldn't be held in map.\") // for performance\n// }\n// }\n// invariant(\n// list.length === 0 || Object.keys(map).length === list.length - 1,\n// \"INTERNAL ERROR there is no junk in map\"\n// )\n// }\nfunction addObserver(observable, node) {\n // invariant(node.dependenciesState !== -1, \"INTERNAL ERROR, can add only dependenciesState !== -1\");\n // invariant(observable._observers.indexOf(node) === -1, \"INTERNAL ERROR add already added node\");\n // invariantObservers(observable);\n observable.observers_.add(node);\n if (observable.lowestObserverState_ > node.dependenciesState_) {\n observable.lowestObserverState_ = node.dependenciesState_;\n }\n // invariantObservers(observable);\n // invariant(observable._observers.indexOf(node) !== -1, \"INTERNAL ERROR didn't add node\");\n}\nfunction removeObserver(observable, node) {\n // invariant(globalState.inBatch > 0, \"INTERNAL ERROR, remove should be called only inside batch\");\n // invariant(observable._observers.indexOf(node) !== -1, \"INTERNAL ERROR remove already removed node\");\n // invariantObservers(observable);\n observable.observers_[\"delete\"](node);\n if (observable.observers_.size === 0) {\n // deleting last observer\n queueForUnobservation(observable);\n }\n // invariantObservers(observable);\n // invariant(observable._observers.indexOf(node) === -1, \"INTERNAL ERROR remove already removed node2\");\n}\nfunction queueForUnobservation(observable) {\n if (observable.isPendingUnobservation === false) {\n // invariant(observable._observers.length === 0, \"INTERNAL ERROR, should only queue for unobservation unobserved observables\");\n observable.isPendingUnobservation = true;\n globalState.pendingUnobservations.push(observable);\n }\n}\n/**\n * Batch starts a transaction, at least for purposes of memoizing ComputedValues when nothing else does.\n * During a batch `onBecomeUnobserved` will be called at most once per observable.\n * Avoids unnecessary recalculations.\n */\nfunction startBatch() {\n globalState.inBatch++;\n}\nfunction endBatch() {\n if (--globalState.inBatch === 0) {\n runReactions();\n // the batch is actually about to finish, all unobserving should happen here.\n var list = globalState.pendingUnobservations;\n for (var i = 0; i < list.length; i++) {\n var observable = list[i];\n observable.isPendingUnobservation = false;\n if (observable.observers_.size === 0) {\n if (observable.isBeingObserved) {\n // if this observable had reactive observers, trigger the hooks\n observable.isBeingObserved = false;\n observable.onBUO();\n }\n if (observable instanceof ComputedValue) {\n // computed values are automatically teared down when the last observer leaves\n // this process happens recursively, this computed might be the last observabe of another, etc..\n observable.suspend_();\n }\n }\n }\n globalState.pendingUnobservations = [];\n }\n}\nfunction reportObserved(observable) {\n checkIfStateReadsAreAllowed(observable);\n var derivation = globalState.trackingDerivation;\n if (derivation !== null) {\n /**\n * Simple optimization, give each derivation run an unique id (runId)\n * Check if last time this observable was accessed the same runId is used\n * if this is the case, the relation is already known\n */\n if (derivation.runId_ !== observable.lastAccessedBy_) {\n observable.lastAccessedBy_ = derivation.runId_;\n // Tried storing newObserving, or observing, or both as Set, but performance didn't come close...\n derivation.newObserving_[derivation.unboundDepsCount_++] = observable;\n if (!observable.isBeingObserved && globalState.trackingContext) {\n observable.isBeingObserved = true;\n observable.onBO();\n }\n }\n return observable.isBeingObserved;\n } else if (observable.observers_.size === 0 && globalState.inBatch > 0) {\n queueForUnobservation(observable);\n }\n return false;\n}\n// function invariantLOS(observable: IObservable, msg: string) {\n// // it's expensive so better not run it in produciton. but temporarily helpful for testing\n// const min = getObservers(observable).reduce((a, b) => Math.min(a, b.dependenciesState), 2)\n// if (min >= observable.lowestObserverState) return // <- the only assumption about `lowestObserverState`\n// throw new Error(\n// \"lowestObserverState is wrong for \" +\n// msg +\n// \" because \" +\n// min +\n// \" < \" +\n// observable.lowestObserverState\n// )\n// }\n/**\n * NOTE: current propagation mechanism will in case of self reruning autoruns behave unexpectedly\n * It will propagate changes to observers from previous run\n * It's hard or maybe impossible (with reasonable perf) to get it right with current approach\n * Hopefully self reruning autoruns aren't a feature people should depend on\n * Also most basic use cases should be ok\n */\n// Called by Atom when its value changes\nfunction propagateChanged(observable) {\n // invariantLOS(observable, \"changed start\");\n if (observable.lowestObserverState_ === IDerivationState_.STALE_) {\n return;\n }\n observable.lowestObserverState_ = IDerivationState_.STALE_;\n // Ideally we use for..of here, but the downcompiled version is really slow...\n observable.observers_.forEach(function (d) {\n if (d.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {\n if ( true && d.isTracing_ !== TraceMode.NONE) {\n logTraceInfo(d, observable);\n }\n d.onBecomeStale_();\n }\n d.dependenciesState_ = IDerivationState_.STALE_;\n });\n // invariantLOS(observable, \"changed end\");\n}\n// Called by ComputedValue when it recalculate and its value changed\nfunction propagateChangeConfirmed(observable) {\n // invariantLOS(observable, \"confirmed start\");\n if (observable.lowestObserverState_ === IDerivationState_.STALE_) {\n return;\n }\n observable.lowestObserverState_ = IDerivationState_.STALE_;\n observable.observers_.forEach(function (d) {\n if (d.dependenciesState_ === IDerivationState_.POSSIBLY_STALE_) {\n d.dependenciesState_ = IDerivationState_.STALE_;\n if ( true && d.isTracing_ !== TraceMode.NONE) {\n logTraceInfo(d, observable);\n }\n } else if (d.dependenciesState_ === IDerivationState_.UP_TO_DATE_ // this happens during computing of `d`, just keep lowestObserverState up to date.\n ) {\n observable.lowestObserverState_ = IDerivationState_.UP_TO_DATE_;\n }\n });\n // invariantLOS(observable, \"confirmed end\");\n}\n// Used by computed when its dependency changed, but we don't wan't to immediately recompute.\nfunction propagateMaybeChanged(observable) {\n // invariantLOS(observable, \"maybe start\");\n if (observable.lowestObserverState_ !== IDerivationState_.UP_TO_DATE_) {\n return;\n }\n observable.lowestObserverState_ = IDerivationState_.POSSIBLY_STALE_;\n observable.observers_.forEach(function (d) {\n if (d.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {\n d.dependenciesState_ = IDerivationState_.POSSIBLY_STALE_;\n d.onBecomeStale_();\n }\n });\n // invariantLOS(observable, \"maybe end\");\n}\nfunction logTraceInfo(derivation, observable) {\n console.log(\"[mobx.trace] '\" + derivation.name_ + \"' is invalidated due to a change in: '\" + observable.name_ + \"'\");\n if (derivation.isTracing_ === TraceMode.BREAK) {\n var lines = [];\n printDepTree(getDependencyTree(derivation), lines, 1);\n // prettier-ignore\n new Function(\"debugger;\\n/*\\nTracing '\" + derivation.name_ + \"'\\n\\nYou are entering this break point because derivation '\" + derivation.name_ + \"' is being traced and '\" + observable.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\" + (derivation instanceof ComputedValue ? derivation.derivation.toString().replace(/[*]\\//g, \"/\") : \"\") + \"\\n\\nThe dependencies for this derivation are:\\n\\n\" + lines.join(\"\\n\") + \"\\n*/\\n \")();\n }\n}\nfunction printDepTree(tree, lines, depth) {\n if (lines.length >= 1000) {\n lines.push(\"(and many more)\");\n return;\n }\n lines.push(\"\" + \"\\t\".repeat(depth - 1) + tree.name);\n if (tree.dependencies) {\n tree.dependencies.forEach(function (child) {\n return printDepTree(child, lines, depth + 1);\n });\n }\n}\n\nvar Reaction = /*#__PURE__*/function () {\n function Reaction(name_, onInvalidate_, errorHandler_, requiresObservable_) {\n if (name_ === void 0) {\n name_ = true ? \"Reaction@\" + getNextId() : 0;\n }\n this.name_ = void 0;\n this.onInvalidate_ = void 0;\n this.errorHandler_ = void 0;\n this.requiresObservable_ = void 0;\n this.observing_ = [];\n // nodes we are looking at. Our value depends on these nodes\n this.newObserving_ = [];\n this.dependenciesState_ = IDerivationState_.NOT_TRACKING_;\n this.runId_ = 0;\n this.unboundDepsCount_ = 0;\n this.flags_ = 0;\n this.isTracing_ = TraceMode.NONE;\n this.name_ = name_;\n this.onInvalidate_ = onInvalidate_;\n this.errorHandler_ = errorHandler_;\n this.requiresObservable_ = requiresObservable_;\n }\n var _proto = Reaction.prototype;\n _proto.onBecomeStale_ = function onBecomeStale_() {\n this.schedule_();\n };\n _proto.schedule_ = function schedule_() {\n if (!this.isScheduled) {\n this.isScheduled = true;\n globalState.pendingReactions.push(this);\n runReactions();\n }\n }\n /**\n * internal, use schedule() if you intend to kick off a reaction\n */;\n _proto.runReaction_ = function runReaction_() {\n if (!this.isDisposed) {\n startBatch();\n this.isScheduled = false;\n var prev = globalState.trackingContext;\n globalState.trackingContext = this;\n if (shouldCompute(this)) {\n this.isTrackPending = true;\n try {\n this.onInvalidate_();\n if ( true && this.isTrackPending && isSpyEnabled()) {\n // onInvalidate didn't trigger track right away..\n spyReport({\n name: this.name_,\n type: \"scheduled-reaction\"\n });\n }\n } catch (e) {\n this.reportExceptionInDerivation_(e);\n }\n }\n globalState.trackingContext = prev;\n endBatch();\n }\n };\n _proto.track = function track(fn) {\n if (this.isDisposed) {\n return;\n // console.warn(\"Reaction already disposed\") // Note: Not a warning / error in mobx 4 either\n }\n startBatch();\n var notify = isSpyEnabled();\n var startTime;\n if ( true && notify) {\n startTime = Date.now();\n spyReportStart({\n name: this.name_,\n type: \"reaction\"\n });\n }\n this.isRunning = true;\n var prevReaction = globalState.trackingContext; // reactions could create reactions...\n globalState.trackingContext = this;\n var result = trackDerivedFunction(this, fn, undefined);\n globalState.trackingContext = prevReaction;\n this.isRunning = false;\n this.isTrackPending = false;\n if (this.isDisposed) {\n // disposed during last run. Clean up everything that was bound after the dispose call.\n clearObserving(this);\n }\n if (isCaughtException(result)) {\n this.reportExceptionInDerivation_(result.cause);\n }\n if ( true && notify) {\n spyReportEnd({\n time: Date.now() - startTime\n });\n }\n endBatch();\n };\n _proto.reportExceptionInDerivation_ = function reportExceptionInDerivation_(error) {\n var _this = this;\n if (this.errorHandler_) {\n this.errorHandler_(error, this);\n return;\n }\n if (globalState.disableErrorBoundaries) {\n throw error;\n }\n var message = true ? \"[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '\" + this + \"'\" : 0;\n if (!globalState.suppressReactionErrors) {\n console.error(message, error);\n /** If debugging brought you here, please, read the above message :-). Tnx! */\n } else if (true) {\n console.warn(\"[mobx] (error in reaction '\" + this.name_ + \"' suppressed, fix error of causing action below)\");\n } // prettier-ignore\n if ( true && isSpyEnabled()) {\n spyReport({\n type: \"error\",\n name: this.name_,\n message: message,\n error: \"\" + error\n });\n }\n globalState.globalReactionErrorHandlers.forEach(function (f) {\n return f(error, _this);\n });\n };\n _proto.dispose = function dispose() {\n if (!this.isDisposed) {\n this.isDisposed = true;\n if (!this.isRunning) {\n // if disposed while running, clean up later. Maybe not optimal, but rare case\n startBatch();\n clearObserving(this);\n endBatch();\n }\n }\n };\n _proto.getDisposer_ = function getDisposer_(abortSignal) {\n var _this2 = this;\n var dispose = function dispose() {\n _this2.dispose();\n abortSignal == null || abortSignal.removeEventListener == null || abortSignal.removeEventListener(\"abort\", dispose);\n };\n abortSignal == null || abortSignal.addEventListener == null || abortSignal.addEventListener(\"abort\", dispose);\n dispose[$mobx] = this;\n return dispose;\n };\n _proto.toString = function toString() {\n return \"Reaction[\" + this.name_ + \"]\";\n };\n _proto.trace = function trace$1(enterBreakPoint) {\n if (enterBreakPoint === void 0) {\n enterBreakPoint = false;\n }\n trace(this, enterBreakPoint);\n };\n return _createClass(Reaction, [{\n key: \"isDisposed\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isDisposedMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isDisposedMask_, newValue);\n }\n }, {\n key: \"isScheduled\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isScheduledMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isScheduledMask_, newValue);\n }\n }, {\n key: \"isTrackPending\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isTrackPendingMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isTrackPendingMask_, newValue);\n }\n }, {\n key: \"isRunning\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isRunningMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isRunningMask_, newValue);\n }\n }, {\n key: \"diffValue\",\n get: function get() {\n return getFlag(this.flags_, Reaction.diffValueMask_) ? 1 : 0;\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.diffValueMask_, newValue === 1 ? true : false);\n }\n }]);\n}();\nReaction.isDisposedMask_ = 1;\nReaction.isScheduledMask_ = 2;\nReaction.isTrackPendingMask_ = 4;\nReaction.isRunningMask_ = 8;\nReaction.diffValueMask_ = 16;\nfunction onReactionError(handler) {\n globalState.globalReactionErrorHandlers.push(handler);\n return function () {\n var idx = globalState.globalReactionErrorHandlers.indexOf(handler);\n if (idx >= 0) {\n globalState.globalReactionErrorHandlers.splice(idx, 1);\n }\n };\n}\n/**\n * Magic number alert!\n * Defines within how many times a reaction is allowed to re-trigger itself\n * until it is assumed that this is gonna be a never ending loop...\n */\nvar MAX_REACTION_ITERATIONS = 100;\nvar reactionScheduler = function reactionScheduler(f) {\n return f();\n};\nfunction runReactions() {\n // Trampolining, if runReactions are already running, new reactions will be picked up\n if (globalState.inBatch > 0 || globalState.isRunningReactions) {\n return;\n }\n reactionScheduler(runReactionsHelper);\n}\nfunction runReactionsHelper() {\n globalState.isRunningReactions = true;\n var allReactions = globalState.pendingReactions;\n var iterations = 0;\n // While running reactions, new reactions might be triggered.\n // Hence we work with two variables and check whether\n // we converge to no remaining reactions after a while.\n while (allReactions.length > 0) {\n if (++iterations === MAX_REACTION_ITERATIONS) {\n console.error( true ? \"Reaction doesn't converge to a stable state after \" + MAX_REACTION_ITERATIONS + \" iterations.\" + (\" Probably there is a cycle in the reactive function: \" + allReactions[0]) : 0);\n allReactions.splice(0); // clear reactions\n }\n var remainingReactions = allReactions.splice(0);\n for (var i = 0, l = remainingReactions.length; i < l; i++) {\n remainingReactions[i].runReaction_();\n }\n }\n globalState.isRunningReactions = false;\n}\nvar isReaction = /*#__PURE__*/createInstanceofPredicate(\"Reaction\", Reaction);\nfunction setReactionScheduler(fn) {\n var baseScheduler = reactionScheduler;\n reactionScheduler = function reactionScheduler(f) {\n return fn(function () {\n return baseScheduler(f);\n });\n };\n}\n\nfunction isSpyEnabled() {\n return true && !!globalState.spyListeners.length;\n}\nfunction spyReport(event) {\n if (false) {} // dead code elimination can do the rest\n if (!globalState.spyListeners.length) {\n return;\n }\n var listeners = globalState.spyListeners;\n for (var i = 0, l = listeners.length; i < l; i++) {\n listeners[i](event);\n }\n}\nfunction spyReportStart(event) {\n if (false) {}\n var change = _extends({}, event, {\n spyReportStart: true\n });\n spyReport(change);\n}\nvar END_EVENT = {\n type: \"report-end\",\n spyReportEnd: true\n};\nfunction spyReportEnd(change) {\n if (false) {}\n if (change) {\n spyReport(_extends({}, change, {\n type: \"report-end\",\n spyReportEnd: true\n }));\n } else {\n spyReport(END_EVENT);\n }\n}\nfunction spy(listener) {\n if (false) {} else {\n globalState.spyListeners.push(listener);\n return once(function () {\n globalState.spyListeners = globalState.spyListeners.filter(function (l) {\n return l !== listener;\n });\n });\n }\n}\n\nvar ACTION = \"action\";\nvar ACTION_BOUND = \"action.bound\";\nvar AUTOACTION = \"autoAction\";\nvar AUTOACTION_BOUND = \"autoAction.bound\";\nvar DEFAULT_ACTION_NAME = \"\";\nvar actionAnnotation = /*#__PURE__*/createActionAnnotation(ACTION);\nvar actionBoundAnnotation = /*#__PURE__*/createActionAnnotation(ACTION_BOUND, {\n bound: true\n});\nvar autoActionAnnotation = /*#__PURE__*/createActionAnnotation(AUTOACTION, {\n autoAction: true\n});\nvar autoActionBoundAnnotation = /*#__PURE__*/createActionAnnotation(AUTOACTION_BOUND, {\n autoAction: true,\n bound: true\n});\nfunction createActionFactory(autoAction) {\n var res = function action(arg1, arg2) {\n // action(fn() {})\n if (isFunction(arg1)) {\n return createAction(arg1.name || DEFAULT_ACTION_NAME, arg1, autoAction);\n }\n // action(\"name\", fn() {})\n if (isFunction(arg2)) {\n return createAction(arg1, arg2, autoAction);\n }\n // @action (2022.3 Decorators)\n if (is20223Decorator(arg2)) {\n return (autoAction ? autoActionAnnotation : actionAnnotation).decorate_20223_(arg1, arg2);\n }\n // @action\n if (isStringish(arg2)) {\n return storeAnnotation(arg1, arg2, autoAction ? autoActionAnnotation : actionAnnotation);\n }\n // action(\"name\") & @action(\"name\")\n if (isStringish(arg1)) {\n return createDecoratorAnnotation(createActionAnnotation(autoAction ? AUTOACTION : ACTION, {\n name: arg1,\n autoAction: autoAction\n }));\n }\n if (true) {\n die(\"Invalid arguments for `action`\");\n }\n };\n return res;\n}\nvar action = /*#__PURE__*/createActionFactory(false);\nObject.assign(action, actionAnnotation);\nvar autoAction = /*#__PURE__*/createActionFactory(true);\nObject.assign(autoAction, autoActionAnnotation);\naction.bound = /*#__PURE__*/createDecoratorAnnotation(actionBoundAnnotation);\nautoAction.bound = /*#__PURE__*/createDecoratorAnnotation(autoActionBoundAnnotation);\nfunction runInAction(fn) {\n return executeAction(fn.name || DEFAULT_ACTION_NAME, false, fn, this, undefined);\n}\nfunction isAction(thing) {\n return isFunction(thing) && thing.isMobxAction === true;\n}\n\n/**\n * Creates a named reactive view and keeps it alive, so that the view is always\n * updated if one of the dependencies changes, even when the view is not further used by something else.\n * @param view The reactive view\n * @returns disposer function, which can be used to stop the view from being updated in the future.\n */\nfunction autorun(view, opts) {\n var _opts$name, _opts, _opts2, _opts3;\n if (opts === void 0) {\n opts = EMPTY_OBJECT;\n }\n if (true) {\n if (!isFunction(view)) {\n die(\"Autorun expects a function as first argument\");\n }\n if (isAction(view)) {\n die(\"Autorun does not accept actions since actions are untrackable\");\n }\n }\n var name = (_opts$name = (_opts = opts) == null ? void 0 : _opts.name) != null ? _opts$name : true ? view.name || \"Autorun@\" + getNextId() : 0;\n var runSync = !opts.scheduler && !opts.delay;\n var reaction;\n if (runSync) {\n // normal autorun\n reaction = new Reaction(name, function () {\n this.track(reactionRunner);\n }, opts.onError, opts.requiresObservable);\n } else {\n var scheduler = createSchedulerFromOptions(opts);\n // debounced autorun\n var isScheduled = false;\n reaction = new Reaction(name, function () {\n if (!isScheduled) {\n isScheduled = true;\n scheduler(function () {\n isScheduled = false;\n if (!reaction.isDisposed) {\n reaction.track(reactionRunner);\n }\n });\n }\n }, opts.onError, opts.requiresObservable);\n }\n function reactionRunner() {\n view(reaction);\n }\n if (!((_opts2 = opts) != null && (_opts2 = _opts2.signal) != null && _opts2.aborted)) {\n reaction.schedule_();\n }\n return reaction.getDisposer_((_opts3 = opts) == null ? void 0 : _opts3.signal);\n}\nvar run = function run(f) {\n return f();\n};\nfunction createSchedulerFromOptions(opts) {\n return opts.scheduler ? opts.scheduler : opts.delay ? function (f) {\n return setTimeout(f, opts.delay);\n } : run;\n}\nfunction reaction(expression, effect, opts) {\n var _opts$name2, _opts4, _opts5;\n if (opts === void 0) {\n opts = EMPTY_OBJECT;\n }\n if (true) {\n if (!isFunction(expression) || !isFunction(effect)) {\n die(\"First and second argument to reaction should be functions\");\n }\n if (!isPlainObject(opts)) {\n die(\"Third argument of reactions should be an object\");\n }\n }\n var name = (_opts$name2 = opts.name) != null ? _opts$name2 : true ? \"Reaction@\" + getNextId() : 0;\n var effectAction = action(name, opts.onError ? wrapErrorHandler(opts.onError, effect) : effect);\n var runSync = !opts.scheduler && !opts.delay;\n var scheduler = createSchedulerFromOptions(opts);\n var firstTime = true;\n var isScheduled = false;\n var value;\n var equals = opts.compareStructural ? comparer.structural : opts.equals || comparer[\"default\"];\n var r = new Reaction(name, function () {\n if (firstTime || runSync) {\n reactionRunner();\n } else if (!isScheduled) {\n isScheduled = true;\n scheduler(reactionRunner);\n }\n }, opts.onError, opts.requiresObservable);\n function reactionRunner() {\n isScheduled = false;\n if (r.isDisposed) {\n return;\n }\n var changed = false;\n var oldValue = value;\n r.track(function () {\n var nextValue = allowStateChanges(false, function () {\n return expression(r);\n });\n changed = firstTime || !equals(value, nextValue);\n value = nextValue;\n });\n if (firstTime && opts.fireImmediately) {\n effectAction(value, oldValue, r);\n } else if (!firstTime && changed) {\n effectAction(value, oldValue, r);\n }\n firstTime = false;\n }\n if (!((_opts4 = opts) != null && (_opts4 = _opts4.signal) != null && _opts4.aborted)) {\n r.schedule_();\n }\n return r.getDisposer_((_opts5 = opts) == null ? void 0 : _opts5.signal);\n}\nfunction wrapErrorHandler(errorHandler, baseFn) {\n return function () {\n try {\n return baseFn.apply(this, arguments);\n } catch (e) {\n errorHandler.call(this, e);\n }\n };\n}\n\nvar ON_BECOME_OBSERVED = \"onBO\";\nvar ON_BECOME_UNOBSERVED = \"onBUO\";\nfunction onBecomeObserved(thing, arg2, arg3) {\n return interceptHook(ON_BECOME_OBSERVED, thing, arg2, arg3);\n}\nfunction onBecomeUnobserved(thing, arg2, arg3) {\n return interceptHook(ON_BECOME_UNOBSERVED, thing, arg2, arg3);\n}\nfunction interceptHook(hook, thing, arg2, arg3) {\n var atom = typeof arg3 === \"function\" ? getAtom(thing, arg2) : getAtom(thing);\n var cb = isFunction(arg3) ? arg3 : arg2;\n var listenersKey = hook + \"L\";\n if (atom[listenersKey]) {\n atom[listenersKey].add(cb);\n } else {\n atom[listenersKey] = new Set([cb]);\n }\n return function () {\n var hookListeners = atom[listenersKey];\n if (hookListeners) {\n hookListeners[\"delete\"](cb);\n if (hookListeners.size === 0) {\n delete atom[listenersKey];\n }\n }\n };\n}\n\nvar NEVER = \"never\";\nvar ALWAYS = \"always\";\nvar OBSERVED = \"observed\";\n// const IF_AVAILABLE = \"ifavailable\"\nfunction configure(options) {\n if (options.isolateGlobalState === true) {\n isolateGlobalState();\n }\n var useProxies = options.useProxies,\n enforceActions = options.enforceActions;\n if (useProxies !== undefined) {\n globalState.useProxies = useProxies === ALWAYS ? true : useProxies === NEVER ? false : typeof Proxy !== \"undefined\";\n }\n if (useProxies === \"ifavailable\") {\n globalState.verifyProxies = true;\n }\n if (enforceActions !== undefined) {\n var ea = enforceActions === ALWAYS ? ALWAYS : enforceActions === OBSERVED;\n globalState.enforceActions = ea;\n globalState.allowStateChanges = ea === true || ea === ALWAYS ? false : true;\n }\n [\"computedRequiresReaction\", \"reactionRequiresObservable\", \"observableRequiresReaction\", \"disableErrorBoundaries\", \"safeDescriptors\"].forEach(function (key) {\n if (key in options) {\n globalState[key] = !!options[key];\n }\n });\n globalState.allowStateReads = !globalState.observableRequiresReaction;\n if ( true && globalState.disableErrorBoundaries === true) {\n console.warn(\"WARNING: Debug feature only. MobX will NOT recover from errors when `disableErrorBoundaries` is enabled.\");\n }\n if (options.reactionScheduler) {\n setReactionScheduler(options.reactionScheduler);\n }\n}\n\nfunction extendObservable(target, properties, annotations, options) {\n if (true) {\n if (arguments.length > 4) {\n die(\"'extendObservable' expected 2-4 arguments\");\n }\n if (typeof target !== \"object\") {\n die(\"'extendObservable' expects an object as first argument\");\n }\n if (isObservableMap(target)) {\n die(\"'extendObservable' should not be used on maps, use map.merge instead\");\n }\n if (!isPlainObject(properties)) {\n die(\"'extendObservable' only accepts plain objects as second argument\");\n }\n if (isObservable(properties) || isObservable(annotations)) {\n die(\"Extending an object with another observable (object) is not supported\");\n }\n }\n // Pull descriptors first, so we don't have to deal with props added by administration ($mobx)\n var descriptors = getOwnPropertyDescriptors(properties);\n initObservable(function () {\n var adm = asObservableObject(target, options)[$mobx];\n ownKeys(descriptors).forEach(function (key) {\n adm.extend_(key, descriptors[key],\n // must pass \"undefined\" for { key: undefined }\n !annotations ? true : key in annotations ? annotations[key] : true);\n });\n });\n return target;\n}\n\nfunction getDependencyTree(thing, property) {\n return nodeToDependencyTree(getAtom(thing, property));\n}\nfunction nodeToDependencyTree(node) {\n var result = {\n name: node.name_\n };\n if (node.observing_ && node.observing_.length > 0) {\n result.dependencies = unique(node.observing_).map(nodeToDependencyTree);\n }\n return result;\n}\nfunction getObserverTree(thing, property) {\n return nodeToObserverTree(getAtom(thing, property));\n}\nfunction nodeToObserverTree(node) {\n var result = {\n name: node.name_\n };\n if (hasObservers(node)) {\n result.observers = Array.from(getObservers(node)).map(nodeToObserverTree);\n }\n return result;\n}\nfunction unique(list) {\n return Array.from(new Set(list));\n}\n\nvar generatorId = 0;\nfunction FlowCancellationError() {\n this.message = \"FLOW_CANCELLED\";\n}\nFlowCancellationError.prototype = /*#__PURE__*/Object.create(Error.prototype);\nfunction isFlowCancellationError(error) {\n return error instanceof FlowCancellationError;\n}\nvar flowAnnotation = /*#__PURE__*/createFlowAnnotation(\"flow\");\nvar flowBoundAnnotation = /*#__PURE__*/createFlowAnnotation(\"flow.bound\", {\n bound: true\n});\nvar flow = /*#__PURE__*/Object.assign(function flow(arg1, arg2) {\n // @flow (2022.3 Decorators)\n if (is20223Decorator(arg2)) {\n return flowAnnotation.decorate_20223_(arg1, arg2);\n }\n // @flow\n if (isStringish(arg2)) {\n return storeAnnotation(arg1, arg2, flowAnnotation);\n }\n // flow(fn)\n if ( true && arguments.length !== 1) {\n die(\"Flow expects single argument with generator function\");\n }\n var generator = arg1;\n var name = generator.name || \"\";\n // Implementation based on https://github.com/tj/co/blob/master/index.js\n var res = function res() {\n var ctx = this;\n var args = arguments;\n var runId = ++generatorId;\n var gen = action(name + \" - runid: \" + runId + \" - init\", generator).apply(ctx, args);\n var rejector;\n var pendingPromise = undefined;\n var promise = new Promise(function (resolve, reject) {\n var stepId = 0;\n rejector = reject;\n function onFulfilled(res) {\n pendingPromise = undefined;\n var ret;\n try {\n ret = action(name + \" - runid: \" + runId + \" - yield \" + stepId++, gen.next).call(gen, res);\n } catch (e) {\n return reject(e);\n }\n next(ret);\n }\n function onRejected(err) {\n pendingPromise = undefined;\n var ret;\n try {\n ret = action(name + \" - runid: \" + runId + \" - yield \" + stepId++, gen[\"throw\"]).call(gen, err);\n } catch (e) {\n return reject(e);\n }\n next(ret);\n }\n function next(ret) {\n if (isFunction(ret == null ? void 0 : ret.then)) {\n // an async iterator\n ret.then(next, reject);\n return;\n }\n if (ret.done) {\n return resolve(ret.value);\n }\n pendingPromise = Promise.resolve(ret.value);\n return pendingPromise.then(onFulfilled, onRejected);\n }\n onFulfilled(undefined); // kick off the process\n });\n promise.cancel = action(name + \" - runid: \" + runId + \" - cancel\", function () {\n try {\n if (pendingPromise) {\n cancelPromise(pendingPromise);\n }\n // Finally block can return (or yield) stuff..\n var _res = gen[\"return\"](undefined);\n // eat anything that promise would do, it's cancelled!\n var yieldedPromise = Promise.resolve(_res.value);\n yieldedPromise.then(noop, noop);\n cancelPromise(yieldedPromise); // maybe it can be cancelled :)\n // reject our original promise\n rejector(new FlowCancellationError());\n } catch (e) {\n rejector(e); // there could be a throwing finally block\n }\n });\n return promise;\n };\n res.isMobXFlow = true;\n return res;\n}, flowAnnotation);\nflow.bound = /*#__PURE__*/createDecoratorAnnotation(flowBoundAnnotation);\nfunction cancelPromise(promise) {\n if (isFunction(promise.cancel)) {\n promise.cancel();\n }\n}\nfunction flowResult(result) {\n return result; // just tricking TypeScript :)\n}\nfunction isFlow(fn) {\n return (fn == null ? void 0 : fn.isMobXFlow) === true;\n}\n\nfunction interceptReads(thing, propOrHandler, handler) {\n var target;\n if (isObservableMap(thing) || isObservableArray(thing) || isObservableValue(thing)) {\n target = getAdministration(thing);\n } else if (isObservableObject(thing)) {\n if ( true && !isStringish(propOrHandler)) {\n return die(\"InterceptReads can only be used with a specific property, not with an object in general\");\n }\n target = getAdministration(thing, propOrHandler);\n } else if (true) {\n return die(\"Expected observable map, object or array as first array\");\n }\n if ( true && target.dehancer !== undefined) {\n return die(\"An intercept reader was already established\");\n }\n target.dehancer = typeof propOrHandler === \"function\" ? propOrHandler : handler;\n return function () {\n target.dehancer = undefined;\n };\n}\n\nfunction intercept(thing, propOrHandler, handler) {\n if (isFunction(handler)) {\n return interceptProperty(thing, propOrHandler, handler);\n } else {\n return interceptInterceptable(thing, propOrHandler);\n }\n}\nfunction interceptInterceptable(thing, handler) {\n return getAdministration(thing).intercept_(handler);\n}\nfunction interceptProperty(thing, property, handler) {\n return getAdministration(thing, property).intercept_(handler);\n}\n\nfunction _isComputed(value, property) {\n if (property === undefined) {\n return isComputedValue(value);\n }\n if (isObservableObject(value) === false) {\n return false;\n }\n if (!value[$mobx].values_.has(property)) {\n return false;\n }\n var atom = getAtom(value, property);\n return isComputedValue(atom);\n}\nfunction isComputed(value) {\n if ( true && arguments.length > 1) {\n return die(\"isComputed expects only 1 argument. Use isComputedProp to inspect the observability of a property\");\n }\n return _isComputed(value);\n}\nfunction isComputedProp(value, propName) {\n if ( true && !isStringish(propName)) {\n return die(\"isComputed expected a property name as second argument\");\n }\n return _isComputed(value, propName);\n}\n\nfunction _isObservable(value, property) {\n if (!value) {\n return false;\n }\n if (property !== undefined) {\n if ( true && (isObservableMap(value) || isObservableArray(value))) {\n return die(\"isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead.\");\n }\n if (isObservableObject(value)) {\n return value[$mobx].values_.has(property);\n }\n return false;\n }\n // For first check, see #701\n return isObservableObject(value) || !!value[$mobx] || isAtom(value) || isReaction(value) || isComputedValue(value);\n}\nfunction isObservable(value) {\n if ( true && arguments.length !== 1) {\n die(\"isObservable expects only 1 argument. Use isObservableProp to inspect the observability of a property\");\n }\n return _isObservable(value);\n}\nfunction isObservableProp(value, propName) {\n if ( true && !isStringish(propName)) {\n return die(\"expected a property name as second argument\");\n }\n return _isObservable(value, propName);\n}\n\nfunction keys(obj) {\n if (isObservableObject(obj)) {\n return obj[$mobx].keys_();\n }\n if (isObservableMap(obj) || isObservableSet(obj)) {\n return Array.from(obj.keys());\n }\n if (isObservableArray(obj)) {\n return obj.map(function (_, index) {\n return index;\n });\n }\n die(5);\n}\nfunction values(obj) {\n if (isObservableObject(obj)) {\n return keys(obj).map(function (key) {\n return obj[key];\n });\n }\n if (isObservableMap(obj)) {\n return keys(obj).map(function (key) {\n return obj.get(key);\n });\n }\n if (isObservableSet(obj)) {\n return Array.from(obj.values());\n }\n if (isObservableArray(obj)) {\n return obj.slice();\n }\n die(6);\n}\nfunction entries(obj) {\n if (isObservableObject(obj)) {\n return keys(obj).map(function (key) {\n return [key, obj[key]];\n });\n }\n if (isObservableMap(obj)) {\n return keys(obj).map(function (key) {\n return [key, obj.get(key)];\n });\n }\n if (isObservableSet(obj)) {\n return Array.from(obj.entries());\n }\n if (isObservableArray(obj)) {\n return obj.map(function (key, index) {\n return [index, key];\n });\n }\n die(7);\n}\nfunction set(obj, key, value) {\n if (arguments.length === 2 && !isObservableSet(obj)) {\n startBatch();\n var _values = key;\n try {\n for (var _key in _values) {\n set(obj, _key, _values[_key]);\n }\n } finally {\n endBatch();\n }\n return;\n }\n if (isObservableObject(obj)) {\n obj[$mobx].set_(key, value);\n } else if (isObservableMap(obj)) {\n obj.set(key, value);\n } else if (isObservableSet(obj)) {\n obj.add(key);\n } else if (isObservableArray(obj)) {\n if (typeof key !== \"number\") {\n key = parseInt(key, 10);\n }\n if (key < 0) {\n die(\"Invalid index: '\" + key + \"'\");\n }\n startBatch();\n if (key >= obj.length) {\n obj.length = key + 1;\n }\n obj[key] = value;\n endBatch();\n } else {\n die(8);\n }\n}\nfunction remove(obj, key) {\n if (isObservableObject(obj)) {\n obj[$mobx].delete_(key);\n } else if (isObservableMap(obj)) {\n obj[\"delete\"](key);\n } else if (isObservableSet(obj)) {\n obj[\"delete\"](key);\n } else if (isObservableArray(obj)) {\n if (typeof key !== \"number\") {\n key = parseInt(key, 10);\n }\n obj.splice(key, 1);\n } else {\n die(9);\n }\n}\nfunction has(obj, key) {\n if (isObservableObject(obj)) {\n return obj[$mobx].has_(key);\n } else if (isObservableMap(obj)) {\n return obj.has(key);\n } else if (isObservableSet(obj)) {\n return obj.has(key);\n } else if (isObservableArray(obj)) {\n return key >= 0 && key < obj.length;\n }\n die(10);\n}\nfunction get(obj, key) {\n if (!has(obj, key)) {\n return undefined;\n }\n if (isObservableObject(obj)) {\n return obj[$mobx].get_(key);\n } else if (isObservableMap(obj)) {\n return obj.get(key);\n } else if (isObservableArray(obj)) {\n return obj[key];\n }\n die(11);\n}\nfunction apiDefineProperty(obj, key, descriptor) {\n if (isObservableObject(obj)) {\n return obj[$mobx].defineProperty_(key, descriptor);\n }\n die(39);\n}\nfunction apiOwnKeys(obj) {\n if (isObservableObject(obj)) {\n return obj[$mobx].ownKeys_();\n }\n die(38);\n}\n\nfunction observe(thing, propOrCb, cbOrFire, fireImmediately) {\n if (isFunction(cbOrFire)) {\n return observeObservableProperty(thing, propOrCb, cbOrFire, fireImmediately);\n } else {\n return observeObservable(thing, propOrCb, cbOrFire);\n }\n}\nfunction observeObservable(thing, listener, fireImmediately) {\n return getAdministration(thing).observe_(listener, fireImmediately);\n}\nfunction observeObservableProperty(thing, property, listener, fireImmediately) {\n return getAdministration(thing, property).observe_(listener, fireImmediately);\n}\n\nfunction cache(map, key, value) {\n map.set(key, value);\n return value;\n}\nfunction toJSHelper(source, __alreadySeen) {\n if (source == null || typeof source !== \"object\" || source instanceof Date || !isObservable(source)) {\n return source;\n }\n if (isObservableValue(source) || isComputedValue(source)) {\n return toJSHelper(source.get(), __alreadySeen);\n }\n if (__alreadySeen.has(source)) {\n return __alreadySeen.get(source);\n }\n if (isObservableArray(source)) {\n var res = cache(__alreadySeen, source, new Array(source.length));\n source.forEach(function (value, idx) {\n res[idx] = toJSHelper(value, __alreadySeen);\n });\n return res;\n }\n if (isObservableSet(source)) {\n var _res = cache(__alreadySeen, source, new Set());\n source.forEach(function (value) {\n _res.add(toJSHelper(value, __alreadySeen));\n });\n return _res;\n }\n if (isObservableMap(source)) {\n var _res2 = cache(__alreadySeen, source, new Map());\n source.forEach(function (value, key) {\n _res2.set(key, toJSHelper(value, __alreadySeen));\n });\n return _res2;\n } else {\n // must be observable object\n var _res3 = cache(__alreadySeen, source, {});\n apiOwnKeys(source).forEach(function (key) {\n if (objectPrototype.propertyIsEnumerable.call(source, key)) {\n _res3[key] = toJSHelper(source[key], __alreadySeen);\n }\n });\n return _res3;\n }\n}\n/**\n * Recursively converts an observable to it's non-observable native counterpart.\n * It does NOT recurse into non-observables, these are left as they are, even if they contain observables.\n * Computed and other non-enumerable properties are completely ignored.\n * Complex scenarios require custom solution, eg implementing `toJSON` or using `serializr` lib.\n */\nfunction toJS(source, options) {\n if ( true && options) {\n die(\"toJS no longer supports options\");\n }\n return toJSHelper(source, new Map());\n}\n\nfunction trace() {\n if (false) {}\n var enterBreakPoint = false;\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n if (typeof args[args.length - 1] === \"boolean\") {\n enterBreakPoint = args.pop();\n }\n var derivation = getAtomFromArgs(args);\n if (!derivation) {\n return die(\"'trace(break?)' can only be used inside a tracked computed value or a Reaction. Consider passing in the computed value or reaction explicitly\");\n }\n if (derivation.isTracing_ === TraceMode.NONE) {\n console.log(\"[mobx.trace] '\" + derivation.name_ + \"' tracing enabled\");\n }\n derivation.isTracing_ = enterBreakPoint ? TraceMode.BREAK : TraceMode.LOG;\n}\nfunction getAtomFromArgs(args) {\n switch (args.length) {\n case 0:\n return globalState.trackingDerivation;\n case 1:\n return getAtom(args[0]);\n case 2:\n return getAtom(args[0], args[1]);\n }\n}\n\n/**\n * During a transaction no views are updated until the end of the transaction.\n * The transaction will be run synchronously nonetheless.\n *\n * @param action a function that updates some reactive state\n * @returns any value that was returned by the 'action' parameter.\n */\nfunction transaction(action, thisArg) {\n if (thisArg === void 0) {\n thisArg = undefined;\n }\n startBatch();\n try {\n return action.apply(thisArg);\n } finally {\n endBatch();\n }\n}\n\nfunction when(predicate, arg1, arg2) {\n if (arguments.length === 1 || arg1 && typeof arg1 === \"object\") {\n return whenPromise(predicate, arg1);\n }\n return _when(predicate, arg1, arg2 || {});\n}\nfunction _when(predicate, effect, opts) {\n var timeoutHandle;\n if (typeof opts.timeout === \"number\") {\n var error = new Error(\"WHEN_TIMEOUT\");\n timeoutHandle = setTimeout(function () {\n if (!disposer[$mobx].isDisposed) {\n disposer();\n if (opts.onError) {\n opts.onError(error);\n } else {\n throw error;\n }\n }\n }, opts.timeout);\n }\n opts.name = true ? opts.name || \"When@\" + getNextId() : 0;\n var effectAction = createAction( true ? opts.name + \"-effect\" : 0, effect);\n // eslint-disable-next-line\n var disposer = autorun(function (r) {\n // predicate should not change state\n var cond = allowStateChanges(false, predicate);\n if (cond) {\n r.dispose();\n if (timeoutHandle) {\n clearTimeout(timeoutHandle);\n }\n effectAction();\n }\n }, opts);\n return disposer;\n}\nfunction whenPromise(predicate, opts) {\n var _opts$signal;\n if ( true && opts && opts.onError) {\n return die(\"the options 'onError' and 'promise' cannot be combined\");\n }\n if (opts != null && (_opts$signal = opts.signal) != null && _opts$signal.aborted) {\n return Object.assign(Promise.reject(new Error(\"WHEN_ABORTED\")), {\n cancel: function cancel() {\n return null;\n }\n });\n }\n var cancel;\n var abort;\n var res = new Promise(function (resolve, reject) {\n var _opts$signal2;\n var disposer = _when(predicate, resolve, _extends({}, opts, {\n onError: reject\n }));\n cancel = function cancel() {\n disposer();\n reject(new Error(\"WHEN_CANCELLED\"));\n };\n abort = function abort() {\n disposer();\n reject(new Error(\"WHEN_ABORTED\"));\n };\n opts == null || (_opts$signal2 = opts.signal) == null || _opts$signal2.addEventListener == null || _opts$signal2.addEventListener(\"abort\", abort);\n })[\"finally\"](function () {\n var _opts$signal3;\n return opts == null || (_opts$signal3 = opts.signal) == null || _opts$signal3.removeEventListener == null ? void 0 : _opts$signal3.removeEventListener(\"abort\", abort);\n });\n res.cancel = cancel;\n return res;\n}\n\nfunction getAdm(target) {\n return target[$mobx];\n}\n// Optimization: we don't need the intermediate objects and could have a completely custom administration for DynamicObjects,\n// and skip either the internal values map, or the base object with its property descriptors!\nvar objectProxyTraps = {\n has: function has(target, name) {\n if ( true && globalState.trackingDerivation) {\n warnAboutProxyRequirement(\"detect new properties using the 'in' operator. Use 'has' from 'mobx' instead.\");\n }\n return getAdm(target).has_(name);\n },\n get: function get(target, name) {\n return getAdm(target).get_(name);\n },\n set: function set(target, name, value) {\n var _getAdm$set_;\n if (!isStringish(name)) {\n return false;\n }\n if ( true && !getAdm(target).values_.has(name)) {\n warnAboutProxyRequirement(\"add a new observable property through direct assignment. Use 'set' from 'mobx' instead.\");\n }\n // null (intercepted) -> true (success)\n return (_getAdm$set_ = getAdm(target).set_(name, value, true)) != null ? _getAdm$set_ : true;\n },\n deleteProperty: function deleteProperty(target, name) {\n var _getAdm$delete_;\n if (true) {\n warnAboutProxyRequirement(\"delete properties from an observable object. Use 'remove' from 'mobx' instead.\");\n }\n if (!isStringish(name)) {\n return false;\n }\n // null (intercepted) -> true (success)\n return (_getAdm$delete_ = getAdm(target).delete_(name, true)) != null ? _getAdm$delete_ : true;\n },\n defineProperty: function defineProperty(target, name, descriptor) {\n var _getAdm$definePropert;\n if (true) {\n warnAboutProxyRequirement(\"define property on an observable object. Use 'defineProperty' from 'mobx' instead.\");\n }\n // null (intercepted) -> true (success)\n return (_getAdm$definePropert = getAdm(target).defineProperty_(name, descriptor)) != null ? _getAdm$definePropert : true;\n },\n ownKeys: function ownKeys(target) {\n if ( true && globalState.trackingDerivation) {\n warnAboutProxyRequirement(\"iterate keys to detect added / removed properties. Use 'keys' from 'mobx' instead.\");\n }\n return getAdm(target).ownKeys_();\n },\n preventExtensions: function preventExtensions(target) {\n die(13);\n }\n};\nfunction asDynamicObservableObject(target, options) {\n var _target$$mobx, _target$$mobx$proxy_;\n assertProxies();\n target = asObservableObject(target, options);\n return (_target$$mobx$proxy_ = (_target$$mobx = target[$mobx]).proxy_) != null ? _target$$mobx$proxy_ : _target$$mobx.proxy_ = new Proxy(target, objectProxyTraps);\n}\n\nfunction hasInterceptors(interceptable) {\n return interceptable.interceptors_ !== undefined && interceptable.interceptors_.length > 0;\n}\nfunction registerInterceptor(interceptable, handler) {\n var interceptors = interceptable.interceptors_ || (interceptable.interceptors_ = []);\n interceptors.push(handler);\n return once(function () {\n var idx = interceptors.indexOf(handler);\n if (idx !== -1) {\n interceptors.splice(idx, 1);\n }\n });\n}\nfunction interceptChange(interceptable, change) {\n var prevU = untrackedStart();\n try {\n // Interceptor can modify the array, copy it to avoid concurrent modification, see #1950\n var interceptors = [].concat(interceptable.interceptors_ || []);\n for (var i = 0, l = interceptors.length; i < l; i++) {\n change = interceptors[i](change);\n if (change && !change.type) {\n die(14);\n }\n if (!change) {\n break;\n }\n }\n return change;\n } finally {\n untrackedEnd(prevU);\n }\n}\n\nfunction hasListeners(listenable) {\n return listenable.changeListeners_ !== undefined && listenable.changeListeners_.length > 0;\n}\nfunction registerListener(listenable, handler) {\n var listeners = listenable.changeListeners_ || (listenable.changeListeners_ = []);\n listeners.push(handler);\n return once(function () {\n var idx = listeners.indexOf(handler);\n if (idx !== -1) {\n listeners.splice(idx, 1);\n }\n });\n}\nfunction notifyListeners(listenable, change) {\n var prevU = untrackedStart();\n var listeners = listenable.changeListeners_;\n if (!listeners) {\n return;\n }\n listeners = listeners.slice();\n for (var i = 0, l = listeners.length; i < l; i++) {\n listeners[i](change);\n }\n untrackedEnd(prevU);\n}\n\nfunction makeObservable(target, annotations, options) {\n initObservable(function () {\n var _annotations;\n var adm = asObservableObject(target, options)[$mobx];\n if ( true && annotations && target[storedAnnotationsSymbol]) {\n die(\"makeObservable second arg must be nullish when using decorators. Mixing @decorator syntax with annotations is not supported.\");\n }\n // Default to decorators\n (_annotations = annotations) != null ? _annotations : annotations = collectStoredAnnotations(target);\n // Annotate\n ownKeys(annotations).forEach(function (key) {\n return adm.make_(key, annotations[key]);\n });\n });\n return target;\n}\n// proto[keysSymbol] = new Set()\nvar keysSymbol = /*#__PURE__*/Symbol(\"mobx-keys\");\nfunction makeAutoObservable(target, overrides, options) {\n if (true) {\n if (!isPlainObject(target) && !isPlainObject(Object.getPrototypeOf(target))) {\n die(\"'makeAutoObservable' can only be used for classes that don't have a superclass\");\n }\n if (isObservableObject(target)) {\n die(\"makeAutoObservable can only be used on objects not already made observable\");\n }\n }\n // Optimization: avoid visiting protos\n // Assumes that annotation.make_/.extend_ works the same for plain objects\n if (isPlainObject(target)) {\n return extendObservable(target, target, overrides, options);\n }\n initObservable(function () {\n var adm = asObservableObject(target, options)[$mobx];\n // Optimization: cache keys on proto\n // Assumes makeAutoObservable can be called only once per object and can't be used in subclass\n if (!target[keysSymbol]) {\n var proto = Object.getPrototypeOf(target);\n var keys = new Set([].concat(ownKeys(target), ownKeys(proto)));\n keys[\"delete\"](\"constructor\");\n keys[\"delete\"]($mobx);\n addHiddenProp(proto, keysSymbol, keys);\n }\n target[keysSymbol].forEach(function (key) {\n return adm.make_(key,\n // must pass \"undefined\" for { key: undefined }\n !overrides ? true : key in overrides ? overrides[key] : true);\n });\n });\n return target;\n}\n\nvar SPLICE = \"splice\";\nvar UPDATE = \"update\";\nvar MAX_SPLICE_SIZE = 10000; // See e.g. https://github.com/mobxjs/mobx/issues/859\nvar arrayTraps = {\n get: function get(target, name) {\n var adm = target[$mobx];\n if (name === $mobx) {\n return adm;\n }\n if (name === \"length\") {\n return adm.getArrayLength_();\n }\n if (typeof name === \"string\" && !isNaN(name)) {\n return adm.get_(parseInt(name));\n }\n if (hasProp(arrayExtensions, name)) {\n return arrayExtensions[name];\n }\n return target[name];\n },\n set: function set(target, name, value) {\n var adm = target[$mobx];\n if (name === \"length\") {\n adm.setArrayLength_(value);\n }\n if (typeof name === \"symbol\" || isNaN(name)) {\n target[name] = value;\n } else {\n // numeric string\n adm.set_(parseInt(name), value);\n }\n return true;\n },\n preventExtensions: function preventExtensions() {\n die(15);\n }\n};\nvar ObservableArrayAdministration = /*#__PURE__*/function () {\n function ObservableArrayAdministration(name, enhancer, owned_, legacyMode_) {\n if (name === void 0) {\n name = true ? \"ObservableArray@\" + getNextId() : 0;\n }\n this.owned_ = void 0;\n this.legacyMode_ = void 0;\n this.atom_ = void 0;\n this.values_ = [];\n // this is the prop that gets proxied, so can't replace it!\n this.interceptors_ = void 0;\n this.changeListeners_ = void 0;\n this.enhancer_ = void 0;\n this.dehancer = void 0;\n this.proxy_ = void 0;\n this.lastKnownLength_ = 0;\n this.owned_ = owned_;\n this.legacyMode_ = legacyMode_;\n this.atom_ = new Atom(name);\n this.enhancer_ = function (newV, oldV) {\n return enhancer(newV, oldV, true ? name + \"[..]\" : 0);\n };\n }\n var _proto = ObservableArrayAdministration.prototype;\n _proto.dehanceValue_ = function dehanceValue_(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.dehanceValues_ = function dehanceValues_(values) {\n if (this.dehancer !== undefined && values.length > 0) {\n return values.map(this.dehancer);\n }\n return values;\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n if (fireImmediately === void 0) {\n fireImmediately = false;\n }\n if (fireImmediately) {\n listener({\n observableKind: \"array\",\n object: this.proxy_,\n debugObjectName: this.atom_.name_,\n type: \"splice\",\n index: 0,\n added: this.values_.slice(),\n addedCount: this.values_.length,\n removed: [],\n removedCount: 0\n });\n }\n return registerListener(this, listener);\n };\n _proto.getArrayLength_ = function getArrayLength_() {\n this.atom_.reportObserved();\n return this.values_.length;\n };\n _proto.setArrayLength_ = function setArrayLength_(newLength) {\n if (typeof newLength !== \"number\" || isNaN(newLength) || newLength < 0) {\n die(\"Out of range: \" + newLength);\n }\n var currentLength = this.values_.length;\n if (newLength === currentLength) {\n return;\n } else if (newLength > currentLength) {\n var newItems = new Array(newLength - currentLength);\n for (var i = 0; i < newLength - currentLength; i++) {\n newItems[i] = undefined;\n } // No Array.fill everywhere...\n this.spliceWithArray_(currentLength, 0, newItems);\n } else {\n this.spliceWithArray_(newLength, currentLength - newLength);\n }\n };\n _proto.updateArrayLength_ = function updateArrayLength_(oldLength, delta) {\n if (oldLength !== this.lastKnownLength_) {\n die(16);\n }\n this.lastKnownLength_ += delta;\n if (this.legacyMode_ && delta > 0) {\n reserveArrayBuffer(oldLength + delta + 1);\n }\n };\n _proto.spliceWithArray_ = function spliceWithArray_(index, deleteCount, newItems) {\n var _this = this;\n checkIfStateModificationsAreAllowed(this.atom_);\n var length = this.values_.length;\n if (index === undefined) {\n index = 0;\n } else if (index > length) {\n index = length;\n } else if (index < 0) {\n index = Math.max(0, length + index);\n }\n if (arguments.length === 1) {\n deleteCount = length - index;\n } else if (deleteCount === undefined || deleteCount === null) {\n deleteCount = 0;\n } else {\n deleteCount = Math.max(0, Math.min(deleteCount, length - index));\n }\n if (newItems === undefined) {\n newItems = EMPTY_ARRAY;\n }\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_,\n type: SPLICE,\n index: index,\n removedCount: deleteCount,\n added: newItems\n });\n if (!change) {\n return EMPTY_ARRAY;\n }\n deleteCount = change.removedCount;\n newItems = change.added;\n }\n newItems = newItems.length === 0 ? newItems : newItems.map(function (v) {\n return _this.enhancer_(v, undefined);\n });\n if (this.legacyMode_ || \"development\" !== \"production\") {\n var lengthDelta = newItems.length - deleteCount;\n this.updateArrayLength_(length, lengthDelta); // checks if internal array wasn't modified\n }\n var res = this.spliceItemsIntoValues_(index, deleteCount, newItems);\n if (deleteCount !== 0 || newItems.length !== 0) {\n this.notifyArraySplice_(index, newItems, res);\n }\n return this.dehanceValues_(res);\n };\n _proto.spliceItemsIntoValues_ = function spliceItemsIntoValues_(index, deleteCount, newItems) {\n if (newItems.length < MAX_SPLICE_SIZE) {\n var _this$values_;\n return (_this$values_ = this.values_).splice.apply(_this$values_, [index, deleteCount].concat(newItems));\n } else {\n // The items removed by the splice\n var res = this.values_.slice(index, index + deleteCount);\n // The items that that should remain at the end of the array\n var oldItems = this.values_.slice(index + deleteCount);\n // New length is the previous length + addition count - deletion count\n this.values_.length += newItems.length - deleteCount;\n for (var i = 0; i < newItems.length; i++) {\n this.values_[index + i] = newItems[i];\n }\n for (var _i = 0; _i < oldItems.length; _i++) {\n this.values_[index + newItems.length + _i] = oldItems[_i];\n }\n return res;\n }\n };\n _proto.notifyArrayChildUpdate_ = function notifyArrayChildUpdate_(index, newValue, oldValue) {\n var notifySpy = !this.owned_ && isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"array\",\n object: this.proxy_,\n type: UPDATE,\n debugObjectName: this.atom_.name_,\n index: index,\n newValue: newValue,\n oldValue: oldValue\n } : null;\n // The reason why this is on right hand side here (and not above), is this way the uglifier will drop it, but it won't\n // cause any runtime overhead in development mode without NODE_ENV set, unless spying is enabled\n if ( true && notifySpy) {\n spyReportStart(change);\n }\n this.atom_.reportChanged();\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n };\n _proto.notifyArraySplice_ = function notifyArraySplice_(index, added, removed) {\n var notifySpy = !this.owned_ && isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"array\",\n object: this.proxy_,\n debugObjectName: this.atom_.name_,\n type: SPLICE,\n index: index,\n removed: removed,\n added: added,\n removedCount: removed.length,\n addedCount: added.length\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n }\n this.atom_.reportChanged();\n // conform: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/observe\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n };\n _proto.get_ = function get_(index) {\n if (this.legacyMode_ && index >= this.values_.length) {\n console.warn( true ? \"[mobx.array] Attempt to read an array index (\" + index + \") that is out of bounds (\" + this.values_.length + \"). Please check length first. Out of bound indices will not be tracked by MobX\" : 0);\n return undefined;\n }\n this.atom_.reportObserved();\n return this.dehanceValue_(this.values_[index]);\n };\n _proto.set_ = function set_(index, newValue) {\n var values = this.values_;\n if (this.legacyMode_ && index > values.length) {\n // out of bounds\n die(17, index, values.length);\n }\n if (index < values.length) {\n // update at index in range\n checkIfStateModificationsAreAllowed(this.atom_);\n var oldValue = values[index];\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: UPDATE,\n object: this.proxy_,\n // since \"this\" is the real array we need to pass its proxy\n index: index,\n newValue: newValue\n });\n if (!change) {\n return;\n }\n newValue = change.newValue;\n }\n newValue = this.enhancer_(newValue, oldValue);\n var changed = newValue !== oldValue;\n if (changed) {\n values[index] = newValue;\n this.notifyArrayChildUpdate_(index, newValue, oldValue);\n }\n } else {\n // For out of bound index, we don't create an actual sparse array,\n // but rather fill the holes with undefined (same as setArrayLength_).\n // This could be considered a bug.\n var newItems = new Array(index + 1 - values.length);\n for (var i = 0; i < newItems.length - 1; i++) {\n newItems[i] = undefined;\n } // No Array.fill everywhere...\n newItems[newItems.length - 1] = newValue;\n this.spliceWithArray_(values.length, 0, newItems);\n }\n };\n return ObservableArrayAdministration;\n}();\nfunction createObservableArray(initialValues, enhancer, name, owned) {\n if (name === void 0) {\n name = true ? \"ObservableArray@\" + getNextId() : 0;\n }\n if (owned === void 0) {\n owned = false;\n }\n assertProxies();\n return initObservable(function () {\n var adm = new ObservableArrayAdministration(name, enhancer, owned, false);\n addHiddenFinalProp(adm.values_, $mobx, adm);\n var proxy = new Proxy(adm.values_, arrayTraps);\n adm.proxy_ = proxy;\n if (initialValues && initialValues.length) {\n adm.spliceWithArray_(0, 0, initialValues);\n }\n return proxy;\n });\n}\n// eslint-disable-next-line\nvar arrayExtensions = {\n clear: function clear() {\n return this.splice(0);\n },\n replace: function replace(newItems) {\n var adm = this[$mobx];\n return adm.spliceWithArray_(0, adm.values_.length, newItems);\n },\n // Used by JSON.stringify\n toJSON: function toJSON() {\n return this.slice();\n },\n /*\n * functions that do alter the internal structure of the array, (based on lib.es6.d.ts)\n * since these functions alter the inner structure of the array, the have side effects.\n * Because the have side effects, they should not be used in computed function,\n * and for that reason the do not call dependencyState.notifyObserved\n */\n splice: function splice(index, deleteCount) {\n for (var _len = arguments.length, newItems = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {\n newItems[_key - 2] = arguments[_key];\n }\n var adm = this[$mobx];\n switch (arguments.length) {\n case 0:\n return [];\n case 1:\n return adm.spliceWithArray_(index);\n case 2:\n return adm.spliceWithArray_(index, deleteCount);\n }\n return adm.spliceWithArray_(index, deleteCount, newItems);\n },\n spliceWithArray: function spliceWithArray(index, deleteCount, newItems) {\n return this[$mobx].spliceWithArray_(index, deleteCount, newItems);\n },\n push: function push() {\n var adm = this[$mobx];\n for (var _len2 = arguments.length, items = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n items[_key2] = arguments[_key2];\n }\n adm.spliceWithArray_(adm.values_.length, 0, items);\n return adm.values_.length;\n },\n pop: function pop() {\n return this.splice(Math.max(this[$mobx].values_.length - 1, 0), 1)[0];\n },\n shift: function shift() {\n return this.splice(0, 1)[0];\n },\n unshift: function unshift() {\n var adm = this[$mobx];\n for (var _len3 = arguments.length, items = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n items[_key3] = arguments[_key3];\n }\n adm.spliceWithArray_(0, 0, items);\n return adm.values_.length;\n },\n reverse: function reverse() {\n // reverse by default mutates in place before returning the result\n // which makes it both a 'derivation' and a 'mutation'.\n if (globalState.trackingDerivation) {\n die(37, \"reverse\");\n }\n this.replace(this.slice().reverse());\n return this;\n },\n sort: function sort() {\n // sort by default mutates in place before returning the result\n // which goes against all good practices. Let's not change the array in place!\n if (globalState.trackingDerivation) {\n die(37, \"sort\");\n }\n var copy = this.slice();\n copy.sort.apply(copy, arguments);\n this.replace(copy);\n return this;\n },\n remove: function remove(value) {\n var adm = this[$mobx];\n var idx = adm.dehanceValues_(adm.values_).indexOf(value);\n if (idx > -1) {\n this.splice(idx, 1);\n return true;\n }\n return false;\n }\n};\n/**\n * Wrap function from prototype\n * Without this, everything works as well, but this works\n * faster as everything works on unproxied values\n */\naddArrayExtension(\"at\", simpleFunc);\naddArrayExtension(\"concat\", simpleFunc);\naddArrayExtension(\"flat\", simpleFunc);\naddArrayExtension(\"includes\", simpleFunc);\naddArrayExtension(\"indexOf\", simpleFunc);\naddArrayExtension(\"join\", simpleFunc);\naddArrayExtension(\"lastIndexOf\", simpleFunc);\naddArrayExtension(\"slice\", simpleFunc);\naddArrayExtension(\"toString\", simpleFunc);\naddArrayExtension(\"toLocaleString\", simpleFunc);\naddArrayExtension(\"toSorted\", simpleFunc);\naddArrayExtension(\"toSpliced\", simpleFunc);\naddArrayExtension(\"with\", simpleFunc);\n// map\naddArrayExtension(\"every\", mapLikeFunc);\naddArrayExtension(\"filter\", mapLikeFunc);\naddArrayExtension(\"find\", mapLikeFunc);\naddArrayExtension(\"findIndex\", mapLikeFunc);\naddArrayExtension(\"findLast\", mapLikeFunc);\naddArrayExtension(\"findLastIndex\", mapLikeFunc);\naddArrayExtension(\"flatMap\", mapLikeFunc);\naddArrayExtension(\"forEach\", mapLikeFunc);\naddArrayExtension(\"map\", mapLikeFunc);\naddArrayExtension(\"some\", mapLikeFunc);\naddArrayExtension(\"toReversed\", mapLikeFunc);\n// reduce\naddArrayExtension(\"reduce\", reduceLikeFunc);\naddArrayExtension(\"reduceRight\", reduceLikeFunc);\nfunction addArrayExtension(funcName, funcFactory) {\n if (typeof Array.prototype[funcName] === \"function\") {\n arrayExtensions[funcName] = funcFactory(funcName);\n }\n}\n// Report and delegate to dehanced array\nfunction simpleFunc(funcName) {\n return function () {\n var adm = this[$mobx];\n adm.atom_.reportObserved();\n var dehancedValues = adm.dehanceValues_(adm.values_);\n return dehancedValues[funcName].apply(dehancedValues, arguments);\n };\n}\n// Make sure callbacks receive correct array arg #2326\nfunction mapLikeFunc(funcName) {\n return function (callback, thisArg) {\n var _this2 = this;\n var adm = this[$mobx];\n adm.atom_.reportObserved();\n var dehancedValues = adm.dehanceValues_(adm.values_);\n return dehancedValues[funcName](function (element, index) {\n return callback.call(thisArg, element, index, _this2);\n });\n };\n}\n// Make sure callbacks receive correct array arg #2326\nfunction reduceLikeFunc(funcName) {\n return function () {\n var _this3 = this;\n var adm = this[$mobx];\n adm.atom_.reportObserved();\n var dehancedValues = adm.dehanceValues_(adm.values_);\n // #2432 - reduce behavior depends on arguments.length\n var callback = arguments[0];\n arguments[0] = function (accumulator, currentValue, index) {\n return callback(accumulator, currentValue, index, _this3);\n };\n return dehancedValues[funcName].apply(dehancedValues, arguments);\n };\n}\nvar isObservableArrayAdministration = /*#__PURE__*/createInstanceofPredicate(\"ObservableArrayAdministration\", ObservableArrayAdministration);\nfunction isObservableArray(thing) {\n return isObject(thing) && isObservableArrayAdministration(thing[$mobx]);\n}\n\nvar ObservableMapMarker = {};\nvar ADD = \"add\";\nvar DELETE = \"delete\";\n// just extend Map? See also https://gist.github.com/nestharus/13b4d74f2ef4a2f4357dbd3fc23c1e54\n// But: https://github.com/mobxjs/mobx/issues/1556\nvar ObservableMap = /*#__PURE__*/function () {\n function ObservableMap(initialData, enhancer_, name_) {\n var _this = this;\n if (enhancer_ === void 0) {\n enhancer_ = deepEnhancer;\n }\n if (name_ === void 0) {\n name_ = true ? \"ObservableMap@\" + getNextId() : 0;\n }\n this.enhancer_ = void 0;\n this.name_ = void 0;\n this[$mobx] = ObservableMapMarker;\n this.data_ = void 0;\n this.hasMap_ = void 0;\n // hasMap, not hashMap >-).\n this.keysAtom_ = void 0;\n this.interceptors_ = void 0;\n this.changeListeners_ = void 0;\n this.dehancer = void 0;\n this.enhancer_ = enhancer_;\n this.name_ = name_;\n if (!isFunction(Map)) {\n die(18);\n }\n initObservable(function () {\n _this.keysAtom_ = createAtom( true ? _this.name_ + \".keys()\" : 0);\n _this.data_ = new Map();\n _this.hasMap_ = new Map();\n if (initialData) {\n _this.merge(initialData);\n }\n });\n }\n var _proto = ObservableMap.prototype;\n _proto.has_ = function has_(key) {\n return this.data_.has(key);\n };\n _proto.has = function has(key) {\n var _this2 = this;\n if (!globalState.trackingDerivation) {\n return this.has_(key);\n }\n var entry = this.hasMap_.get(key);\n if (!entry) {\n var newEntry = entry = new ObservableValue(this.has_(key), referenceEnhancer, true ? this.name_ + \".\" + stringifyKey(key) + \"?\" : 0, false);\n this.hasMap_.set(key, newEntry);\n onBecomeUnobserved(newEntry, function () {\n return _this2.hasMap_[\"delete\"](key);\n });\n }\n return entry.get();\n };\n _proto.set = function set(key, value) {\n var hasKey = this.has_(key);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: hasKey ? UPDATE : ADD,\n object: this,\n newValue: value,\n name: key\n });\n if (!change) {\n return this;\n }\n value = change.newValue;\n }\n if (hasKey) {\n this.updateValue_(key, value);\n } else {\n this.addValue_(key, value);\n }\n return this;\n };\n _proto[\"delete\"] = function _delete(key) {\n var _this3 = this;\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: DELETE,\n object: this,\n name: key\n });\n if (!change) {\n return false;\n }\n }\n if (this.has_(key)) {\n var notifySpy = isSpyEnabled();\n var notify = hasListeners(this);\n var _change = notify || notifySpy ? {\n observableKind: \"map\",\n debugObjectName: this.name_,\n type: DELETE,\n object: this,\n oldValue: this.data_.get(key).value_,\n name: key\n } : null;\n if ( true && notifySpy) {\n spyReportStart(_change);\n } // TODO fix type\n transaction(function () {\n var _this3$hasMap_$get;\n _this3.keysAtom_.reportChanged();\n (_this3$hasMap_$get = _this3.hasMap_.get(key)) == null || _this3$hasMap_$get.setNewValue_(false);\n var observable = _this3.data_.get(key);\n observable.setNewValue_(undefined);\n _this3.data_[\"delete\"](key);\n });\n if (notify) {\n notifyListeners(this, _change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n return true;\n }\n return false;\n };\n _proto.updateValue_ = function updateValue_(key, newValue) {\n var observable = this.data_.get(key);\n newValue = observable.prepareNewValue_(newValue);\n if (newValue !== globalState.UNCHANGED) {\n var notifySpy = isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"map\",\n debugObjectName: this.name_,\n type: UPDATE,\n object: this,\n oldValue: observable.value_,\n name: key,\n newValue: newValue\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n } // TODO fix type\n observable.setNewValue_(newValue);\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n };\n _proto.addValue_ = function addValue_(key, newValue) {\n var _this4 = this;\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n transaction(function () {\n var _this4$hasMap_$get;\n var observable = new ObservableValue(newValue, _this4.enhancer_, true ? _this4.name_ + \".\" + stringifyKey(key) : 0, false);\n _this4.data_.set(key, observable);\n newValue = observable.value_; // value might have been changed\n (_this4$hasMap_$get = _this4.hasMap_.get(key)) == null || _this4$hasMap_$get.setNewValue_(true);\n _this4.keysAtom_.reportChanged();\n });\n var notifySpy = isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"map\",\n debugObjectName: this.name_,\n type: ADD,\n object: this,\n name: key,\n newValue: newValue\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n } // TODO fix type\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n };\n _proto.get = function get(key) {\n if (this.has(key)) {\n return this.dehanceValue_(this.data_.get(key).get());\n }\n return this.dehanceValue_(undefined);\n };\n _proto.dehanceValue_ = function dehanceValue_(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.keys = function keys() {\n this.keysAtom_.reportObserved();\n return this.data_.keys();\n };\n _proto.values = function values() {\n var self = this;\n var keys = this.keys();\n return makeIterable({\n next: function next() {\n var _keys$next = keys.next(),\n done = _keys$next.done,\n value = _keys$next.value;\n return {\n done: done,\n value: done ? undefined : self.get(value)\n };\n }\n });\n };\n _proto.entries = function entries() {\n var self = this;\n var keys = this.keys();\n return makeIterable({\n next: function next() {\n var _keys$next2 = keys.next(),\n done = _keys$next2.done,\n value = _keys$next2.value;\n return {\n done: done,\n value: done ? undefined : [value, self.get(value)]\n };\n }\n });\n };\n _proto[Symbol.iterator] = function () {\n return this.entries();\n };\n _proto.forEach = function forEach(callback, thisArg) {\n for (var _iterator = _createForOfIteratorHelperLoose(this), _step; !(_step = _iterator()).done;) {\n var _step$value = _step.value,\n key = _step$value[0],\n value = _step$value[1];\n callback.call(thisArg, value, key, this);\n }\n }\n /** Merge another object into this object, returns this. */;\n _proto.merge = function merge(other) {\n var _this5 = this;\n if (isObservableMap(other)) {\n other = new Map(other);\n }\n transaction(function () {\n if (isPlainObject(other)) {\n getPlainObjectKeys(other).forEach(function (key) {\n return _this5.set(key, other[key]);\n });\n } else if (Array.isArray(other)) {\n other.forEach(function (_ref) {\n var key = _ref[0],\n value = _ref[1];\n return _this5.set(key, value);\n });\n } else if (isES6Map(other)) {\n if (!isPlainES6Map(other)) {\n die(19, other);\n }\n other.forEach(function (value, key) {\n return _this5.set(key, value);\n });\n } else if (other !== null && other !== undefined) {\n die(20, other);\n }\n });\n return this;\n };\n _proto.clear = function clear() {\n var _this6 = this;\n transaction(function () {\n untracked(function () {\n for (var _iterator2 = _createForOfIteratorHelperLoose(_this6.keys()), _step2; !(_step2 = _iterator2()).done;) {\n var key = _step2.value;\n _this6[\"delete\"](key);\n }\n });\n });\n };\n _proto.replace = function replace(values) {\n var _this7 = this;\n // Implementation requirements:\n // - respect ordering of replacement map\n // - allow interceptors to run and potentially prevent individual operations\n // - don't recreate observables that already exist in original map (so we don't destroy existing subscriptions)\n // - don't _keysAtom.reportChanged if the keys of resulting map are indentical (order matters!)\n // - note that result map may differ from replacement map due to the interceptors\n transaction(function () {\n // Convert to map so we can do quick key lookups\n var replacementMap = convertToMap(values);\n var orderedData = new Map();\n // Used for optimization\n var keysReportChangedCalled = false;\n // Delete keys that don't exist in replacement map\n // if the key deletion is prevented by interceptor\n // add entry at the beginning of the result map\n for (var _iterator3 = _createForOfIteratorHelperLoose(_this7.data_.keys()), _step3; !(_step3 = _iterator3()).done;) {\n var key = _step3.value;\n // Concurrently iterating/deleting keys\n // iterator should handle this correctly\n if (!replacementMap.has(key)) {\n var deleted = _this7[\"delete\"](key);\n // Was the key removed?\n if (deleted) {\n // _keysAtom.reportChanged() was already called\n keysReportChangedCalled = true;\n } else {\n // Delete prevented by interceptor\n var value = _this7.data_.get(key);\n orderedData.set(key, value);\n }\n }\n }\n // Merge entries\n for (var _iterator4 = _createForOfIteratorHelperLoose(replacementMap.entries()), _step4; !(_step4 = _iterator4()).done;) {\n var _step4$value = _step4.value,\n _key = _step4$value[0],\n _value = _step4$value[1];\n // We will want to know whether a new key is added\n var keyExisted = _this7.data_.has(_key);\n // Add or update value\n _this7.set(_key, _value);\n // The addition could have been prevent by interceptor\n if (_this7.data_.has(_key)) {\n // The update could have been prevented by interceptor\n // and also we want to preserve existing values\n // so use value from _data map (instead of replacement map)\n var _value2 = _this7.data_.get(_key);\n orderedData.set(_key, _value2);\n // Was a new key added?\n if (!keyExisted) {\n // _keysAtom.reportChanged() was already called\n keysReportChangedCalled = true;\n }\n }\n }\n // Check for possible key order change\n if (!keysReportChangedCalled) {\n if (_this7.data_.size !== orderedData.size) {\n // If size differs, keys are definitely modified\n _this7.keysAtom_.reportChanged();\n } else {\n var iter1 = _this7.data_.keys();\n var iter2 = orderedData.keys();\n var next1 = iter1.next();\n var next2 = iter2.next();\n while (!next1.done) {\n if (next1.value !== next2.value) {\n _this7.keysAtom_.reportChanged();\n break;\n }\n next1 = iter1.next();\n next2 = iter2.next();\n }\n }\n }\n // Use correctly ordered map\n _this7.data_ = orderedData;\n });\n return this;\n };\n _proto.toString = function toString() {\n return \"[object ObservableMap]\";\n };\n _proto.toJSON = function toJSON() {\n return Array.from(this);\n };\n /**\n * Observes this object. Triggers for the events 'add', 'update' and 'delete'.\n * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe\n * for callback details\n */\n _proto.observe_ = function observe_(listener, fireImmediately) {\n if ( true && fireImmediately === true) {\n die(\"`observe` doesn't support fireImmediately=true in combination with maps.\");\n }\n return registerListener(this, listener);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n return _createClass(ObservableMap, [{\n key: \"size\",\n get: function get() {\n this.keysAtom_.reportObserved();\n return this.data_.size;\n }\n }, {\n key: Symbol.toStringTag,\n get: function get() {\n return \"Map\";\n }\n }]);\n}();\n// eslint-disable-next-line\nvar isObservableMap = /*#__PURE__*/createInstanceofPredicate(\"ObservableMap\", ObservableMap);\nfunction convertToMap(dataStructure) {\n if (isES6Map(dataStructure) || isObservableMap(dataStructure)) {\n return dataStructure;\n } else if (Array.isArray(dataStructure)) {\n return new Map(dataStructure);\n } else if (isPlainObject(dataStructure)) {\n var map = new Map();\n for (var key in dataStructure) {\n map.set(key, dataStructure[key]);\n }\n return map;\n } else {\n return die(21, dataStructure);\n }\n}\n\nvar ObservableSetMarker = {};\nvar ObservableSet = /*#__PURE__*/function () {\n function ObservableSet(initialData, enhancer, name_) {\n var _this = this;\n if (enhancer === void 0) {\n enhancer = deepEnhancer;\n }\n if (name_ === void 0) {\n name_ = true ? \"ObservableSet@\" + getNextId() : 0;\n }\n this.name_ = void 0;\n this[$mobx] = ObservableSetMarker;\n this.data_ = new Set();\n this.atom_ = void 0;\n this.changeListeners_ = void 0;\n this.interceptors_ = void 0;\n this.dehancer = void 0;\n this.enhancer_ = void 0;\n this.name_ = name_;\n if (!isFunction(Set)) {\n die(22);\n }\n this.enhancer_ = function (newV, oldV) {\n return enhancer(newV, oldV, name_);\n };\n initObservable(function () {\n _this.atom_ = createAtom(_this.name_);\n if (initialData) {\n _this.replace(initialData);\n }\n });\n }\n var _proto = ObservableSet.prototype;\n _proto.dehanceValue_ = function dehanceValue_(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.clear = function clear() {\n var _this2 = this;\n transaction(function () {\n untracked(function () {\n for (var _iterator = _createForOfIteratorHelperLoose(_this2.data_.values()), _step; !(_step = _iterator()).done;) {\n var value = _step.value;\n _this2[\"delete\"](value);\n }\n });\n });\n };\n _proto.forEach = function forEach(callbackFn, thisArg) {\n for (var _iterator2 = _createForOfIteratorHelperLoose(this), _step2; !(_step2 = _iterator2()).done;) {\n var value = _step2.value;\n callbackFn.call(thisArg, value, value, this);\n }\n };\n _proto.add = function add(value) {\n var _this3 = this;\n checkIfStateModificationsAreAllowed(this.atom_);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: ADD,\n object: this,\n newValue: value\n });\n if (!change) {\n return this;\n }\n // ideally, value = change.value would be done here, so that values can be\n // changed by interceptor. Same applies for other Set and Map api's.\n }\n if (!this.has(value)) {\n transaction(function () {\n _this3.data_.add(_this3.enhancer_(value, undefined));\n _this3.atom_.reportChanged();\n });\n var notifySpy = true && isSpyEnabled();\n var notify = hasListeners(this);\n var _change = notify || notifySpy ? {\n observableKind: \"set\",\n debugObjectName: this.name_,\n type: ADD,\n object: this,\n newValue: value\n } : null;\n if (notifySpy && \"development\" !== \"production\") {\n spyReportStart(_change);\n }\n if (notify) {\n notifyListeners(this, _change);\n }\n if (notifySpy && \"development\" !== \"production\") {\n spyReportEnd();\n }\n }\n return this;\n };\n _proto[\"delete\"] = function _delete(value) {\n var _this4 = this;\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: DELETE,\n object: this,\n oldValue: value\n });\n if (!change) {\n return false;\n }\n }\n if (this.has(value)) {\n var notifySpy = true && isSpyEnabled();\n var notify = hasListeners(this);\n var _change2 = notify || notifySpy ? {\n observableKind: \"set\",\n debugObjectName: this.name_,\n type: DELETE,\n object: this,\n oldValue: value\n } : null;\n if (notifySpy && \"development\" !== \"production\") {\n spyReportStart(_change2);\n }\n transaction(function () {\n _this4.atom_.reportChanged();\n _this4.data_[\"delete\"](value);\n });\n if (notify) {\n notifyListeners(this, _change2);\n }\n if (notifySpy && \"development\" !== \"production\") {\n spyReportEnd();\n }\n return true;\n }\n return false;\n };\n _proto.has = function has(value) {\n this.atom_.reportObserved();\n return this.data_.has(this.dehanceValue_(value));\n };\n _proto.entries = function entries() {\n var nextIndex = 0;\n var keys = Array.from(this.keys());\n var values = Array.from(this.values());\n return makeIterable({\n next: function next() {\n var index = nextIndex;\n nextIndex += 1;\n return index < values.length ? {\n value: [keys[index], values[index]],\n done: false\n } : {\n done: true\n };\n }\n });\n };\n _proto.keys = function keys() {\n return this.values();\n };\n _proto.values = function values() {\n this.atom_.reportObserved();\n var self = this;\n var nextIndex = 0;\n var observableValues = Array.from(this.data_.values());\n return makeIterable({\n next: function next() {\n return nextIndex < observableValues.length ? {\n value: self.dehanceValue_(observableValues[nextIndex++]),\n done: false\n } : {\n done: true\n };\n }\n });\n };\n _proto.intersection = function intersection(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.intersection(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.intersection(otherSet);\n }\n };\n _proto.union = function union(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.union(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.union(otherSet);\n }\n };\n _proto.difference = function difference(otherSet) {\n return new Set(this).difference(otherSet);\n };\n _proto.symmetricDifference = function symmetricDifference(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.symmetricDifference(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.symmetricDifference(otherSet);\n }\n };\n _proto.isSubsetOf = function isSubsetOf(otherSet) {\n return new Set(this).isSubsetOf(otherSet);\n };\n _proto.isSupersetOf = function isSupersetOf(otherSet) {\n return new Set(this).isSupersetOf(otherSet);\n };\n _proto.isDisjointFrom = function isDisjointFrom(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.isDisjointFrom(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.isDisjointFrom(otherSet);\n }\n };\n _proto.replace = function replace(other) {\n var _this5 = this;\n if (isObservableSet(other)) {\n other = new Set(other);\n }\n transaction(function () {\n if (Array.isArray(other)) {\n _this5.clear();\n other.forEach(function (value) {\n return _this5.add(value);\n });\n } else if (isES6Set(other)) {\n _this5.clear();\n other.forEach(function (value) {\n return _this5.add(value);\n });\n } else if (other !== null && other !== undefined) {\n die(\"Cannot initialize set from \" + other);\n }\n });\n return this;\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n // ... 'fireImmediately' could also be true?\n if ( true && fireImmediately === true) {\n die(\"`observe` doesn't support fireImmediately=true in combination with sets.\");\n }\n return registerListener(this, listener);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.toJSON = function toJSON() {\n return Array.from(this);\n };\n _proto.toString = function toString() {\n return \"[object ObservableSet]\";\n };\n _proto[Symbol.iterator] = function () {\n return this.values();\n };\n return _createClass(ObservableSet, [{\n key: \"size\",\n get: function get() {\n this.atom_.reportObserved();\n return this.data_.size;\n }\n }, {\n key: Symbol.toStringTag,\n get: function get() {\n return \"Set\";\n }\n }]);\n}();\n// eslint-disable-next-line\nvar isObservableSet = /*#__PURE__*/createInstanceofPredicate(\"ObservableSet\", ObservableSet);\n\nvar descriptorCache = /*#__PURE__*/Object.create(null);\nvar REMOVE = \"remove\";\nvar ObservableObjectAdministration = /*#__PURE__*/function () {\n function ObservableObjectAdministration(target_, values_, name_,\n // Used anytime annotation is not explicitely provided\n defaultAnnotation_) {\n if (values_ === void 0) {\n values_ = new Map();\n }\n if (defaultAnnotation_ === void 0) {\n defaultAnnotation_ = autoAnnotation;\n }\n this.target_ = void 0;\n this.values_ = void 0;\n this.name_ = void 0;\n this.defaultAnnotation_ = void 0;\n this.keysAtom_ = void 0;\n this.changeListeners_ = void 0;\n this.interceptors_ = void 0;\n this.proxy_ = void 0;\n this.isPlainObject_ = void 0;\n this.appliedAnnotations_ = void 0;\n this.pendingKeys_ = void 0;\n this.target_ = target_;\n this.values_ = values_;\n this.name_ = name_;\n this.defaultAnnotation_ = defaultAnnotation_;\n this.keysAtom_ = new Atom( true ? this.name_ + \".keys\" : 0);\n // Optimization: we use this frequently\n this.isPlainObject_ = isPlainObject(this.target_);\n if ( true && !isAnnotation(this.defaultAnnotation_)) {\n die(\"defaultAnnotation must be valid annotation\");\n }\n if (true) {\n // Prepare structure for tracking which fields were already annotated\n this.appliedAnnotations_ = {};\n }\n }\n var _proto = ObservableObjectAdministration.prototype;\n _proto.getObservablePropValue_ = function getObservablePropValue_(key) {\n return this.values_.get(key).get();\n };\n _proto.setObservablePropValue_ = function setObservablePropValue_(key, newValue) {\n var observable = this.values_.get(key);\n if (observable instanceof ComputedValue) {\n observable.set(newValue);\n return true;\n }\n // intercept\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: UPDATE,\n object: this.proxy_ || this.target_,\n name: key,\n newValue: newValue\n });\n if (!change) {\n return null;\n }\n newValue = change.newValue;\n }\n newValue = observable.prepareNewValue_(newValue);\n // notify spy & observers\n if (newValue !== globalState.UNCHANGED) {\n var notify = hasListeners(this);\n var notifySpy = true && isSpyEnabled();\n var _change = notify || notifySpy ? {\n type: UPDATE,\n observableKind: \"object\",\n debugObjectName: this.name_,\n object: this.proxy_ || this.target_,\n oldValue: observable.value_,\n name: key,\n newValue: newValue\n } : null;\n if ( true && notifySpy) {\n spyReportStart(_change);\n }\n observable.setNewValue_(newValue);\n if (notify) {\n notifyListeners(this, _change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n return true;\n };\n _proto.get_ = function get_(key) {\n if (globalState.trackingDerivation && !hasProp(this.target_, key)) {\n // Key doesn't exist yet, subscribe for it in case it's added later\n this.has_(key);\n }\n return this.target_[key];\n }\n /**\n * @param {PropertyKey} key\n * @param {any} value\n * @param {Annotation|boolean} annotation true - use default annotation, false - copy as is\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.set_ = function set_(key, value, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n // Don't use .has(key) - we care about own\n if (hasProp(this.target_, key)) {\n // Existing prop\n if (this.values_.has(key)) {\n // Observable (can be intercepted)\n return this.setObservablePropValue_(key, value);\n } else if (proxyTrap) {\n // Non-observable - proxy\n return Reflect.set(this.target_, key, value);\n } else {\n // Non-observable\n this.target_[key] = value;\n return true;\n }\n } else {\n // New prop\n return this.extend_(key, {\n value: value,\n enumerable: true,\n writable: true,\n configurable: true\n }, this.defaultAnnotation_, proxyTrap);\n }\n }\n // Trap for \"in\"\n ;\n _proto.has_ = function has_(key) {\n if (!globalState.trackingDerivation) {\n // Skip key subscription outside derivation\n return key in this.target_;\n }\n this.pendingKeys_ || (this.pendingKeys_ = new Map());\n var entry = this.pendingKeys_.get(key);\n if (!entry) {\n entry = new ObservableValue(key in this.target_, referenceEnhancer, true ? this.name_ + \".\" + stringifyKey(key) + \"?\" : 0, false);\n this.pendingKeys_.set(key, entry);\n }\n return entry.get();\n }\n /**\n * @param {PropertyKey} key\n * @param {Annotation|boolean} annotation true - use default annotation, false - ignore prop\n */;\n _proto.make_ = function make_(key, annotation) {\n if (annotation === true) {\n annotation = this.defaultAnnotation_;\n }\n if (annotation === false) {\n return;\n }\n assertAnnotable(this, annotation, key);\n if (!(key in this.target_)) {\n var _this$target_$storedA;\n // Throw on missing key, except for decorators:\n // Decorator annotations are collected from whole prototype chain.\n // When called from super() some props may not exist yet.\n // However we don't have to worry about missing prop,\n // because the decorator must have been applied to something.\n if ((_this$target_$storedA = this.target_[storedAnnotationsSymbol]) != null && _this$target_$storedA[key]) {\n return; // will be annotated by subclass constructor\n } else {\n die(1, annotation.annotationType_, this.name_ + \".\" + key.toString());\n }\n }\n var source = this.target_;\n while (source && source !== objectPrototype) {\n var descriptor = getDescriptor(source, key);\n if (descriptor) {\n var outcome = annotation.make_(this, key, descriptor, source);\n if (outcome === 0 /* MakeResult.Cancel */) {\n return;\n }\n if (outcome === 1 /* MakeResult.Break */) {\n break;\n }\n }\n source = Object.getPrototypeOf(source);\n }\n recordAnnotationApplied(this, annotation, key);\n }\n /**\n * @param {PropertyKey} key\n * @param {PropertyDescriptor} descriptor\n * @param {Annotation|boolean} annotation true - use default annotation, false - copy as is\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.extend_ = function extend_(key, descriptor, annotation, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n if (annotation === true) {\n annotation = this.defaultAnnotation_;\n }\n if (annotation === false) {\n return this.defineProperty_(key, descriptor, proxyTrap);\n }\n assertAnnotable(this, annotation, key);\n var outcome = annotation.extend_(this, key, descriptor, proxyTrap);\n if (outcome) {\n recordAnnotationApplied(this, annotation, key);\n }\n return outcome;\n }\n /**\n * @param {PropertyKey} key\n * @param {PropertyDescriptor} descriptor\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.defineProperty_ = function defineProperty_(key, descriptor, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n try {\n startBatch();\n // Delete\n var deleteOutcome = this.delete_(key);\n if (!deleteOutcome) {\n // Failure or intercepted\n return deleteOutcome;\n }\n // ADD interceptor\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: ADD,\n newValue: descriptor.value\n });\n if (!change) {\n return null;\n }\n var newValue = change.newValue;\n if (descriptor.value !== newValue) {\n descriptor = _extends({}, descriptor, {\n value: newValue\n });\n }\n }\n // Define\n if (proxyTrap) {\n if (!Reflect.defineProperty(this.target_, key, descriptor)) {\n return false;\n }\n } else {\n defineProperty(this.target_, key, descriptor);\n }\n // Notify\n this.notifyPropertyAddition_(key, descriptor.value);\n } finally {\n endBatch();\n }\n return true;\n }\n // If original descriptor becomes relevant, move this to annotation directly\n ;\n _proto.defineObservableProperty_ = function defineObservableProperty_(key, value, enhancer, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n try {\n startBatch();\n // Delete\n var deleteOutcome = this.delete_(key);\n if (!deleteOutcome) {\n // Failure or intercepted\n return deleteOutcome;\n }\n // ADD interceptor\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: ADD,\n newValue: value\n });\n if (!change) {\n return null;\n }\n value = change.newValue;\n }\n var cachedDescriptor = getCachedObservablePropDescriptor(key);\n var descriptor = {\n configurable: globalState.safeDescriptors ? this.isPlainObject_ : true,\n enumerable: true,\n get: cachedDescriptor.get,\n set: cachedDescriptor.set\n };\n // Define\n if (proxyTrap) {\n if (!Reflect.defineProperty(this.target_, key, descriptor)) {\n return false;\n }\n } else {\n defineProperty(this.target_, key, descriptor);\n }\n var observable = new ObservableValue(value, enhancer, true ? this.name_ + \".\" + key.toString() : 0, false);\n this.values_.set(key, observable);\n // Notify (value possibly changed by ObservableValue)\n this.notifyPropertyAddition_(key, observable.value_);\n } finally {\n endBatch();\n }\n return true;\n }\n // If original descriptor becomes relevant, move this to annotation directly\n ;\n _proto.defineComputedProperty_ = function defineComputedProperty_(key, options, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n try {\n startBatch();\n // Delete\n var deleteOutcome = this.delete_(key);\n if (!deleteOutcome) {\n // Failure or intercepted\n return deleteOutcome;\n }\n // ADD interceptor\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: ADD,\n newValue: undefined\n });\n if (!change) {\n return null;\n }\n }\n options.name || (options.name = true ? this.name_ + \".\" + key.toString() : 0);\n options.context = this.proxy_ || this.target_;\n var cachedDescriptor = getCachedObservablePropDescriptor(key);\n var descriptor = {\n configurable: globalState.safeDescriptors ? this.isPlainObject_ : true,\n enumerable: false,\n get: cachedDescriptor.get,\n set: cachedDescriptor.set\n };\n // Define\n if (proxyTrap) {\n if (!Reflect.defineProperty(this.target_, key, descriptor)) {\n return false;\n }\n } else {\n defineProperty(this.target_, key, descriptor);\n }\n this.values_.set(key, new ComputedValue(options));\n // Notify\n this.notifyPropertyAddition_(key, undefined);\n } finally {\n endBatch();\n }\n return true;\n }\n /**\n * @param {PropertyKey} key\n * @param {PropertyDescriptor} descriptor\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.delete_ = function delete_(key, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n // No such prop\n if (!hasProp(this.target_, key)) {\n return true;\n }\n // Intercept\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: REMOVE\n });\n // Cancelled\n if (!change) {\n return null;\n }\n }\n // Delete\n try {\n var _this$pendingKeys_;\n startBatch();\n var notify = hasListeners(this);\n var notifySpy = true && isSpyEnabled();\n var observable = this.values_.get(key);\n // Value needed for spies/listeners\n var value = undefined;\n // Optimization: don't pull the value unless we will need it\n if (!observable && (notify || notifySpy)) {\n var _getDescriptor;\n value = (_getDescriptor = getDescriptor(this.target_, key)) == null ? void 0 : _getDescriptor.value;\n }\n // delete prop (do first, may fail)\n if (proxyTrap) {\n if (!Reflect.deleteProperty(this.target_, key)) {\n return false;\n }\n } else {\n delete this.target_[key];\n }\n // Allow re-annotating this field\n if (true) {\n delete this.appliedAnnotations_[key];\n }\n // Clear observable\n if (observable) {\n this.values_[\"delete\"](key);\n // for computed, value is undefined\n if (observable instanceof ObservableValue) {\n value = observable.value_;\n }\n // Notify: autorun(() => obj[key]), see #1796\n propagateChanged(observable);\n }\n // Notify \"keys/entries/values\" observers\n this.keysAtom_.reportChanged();\n // Notify \"has\" observers\n // \"in\" as it may still exist in proto\n (_this$pendingKeys_ = this.pendingKeys_) == null || (_this$pendingKeys_ = _this$pendingKeys_.get(key)) == null || _this$pendingKeys_.set(key in this.target_);\n // Notify spies/listeners\n if (notify || notifySpy) {\n var _change2 = {\n type: REMOVE,\n observableKind: \"object\",\n object: this.proxy_ || this.target_,\n debugObjectName: this.name_,\n oldValue: value,\n name: key\n };\n if ( true && notifySpy) {\n spyReportStart(_change2);\n }\n if (notify) {\n notifyListeners(this, _change2);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n } finally {\n endBatch();\n }\n return true;\n }\n /**\n * Observes this object. Triggers for the events 'add', 'update' and 'delete'.\n * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe\n * for callback details\n */;\n _proto.observe_ = function observe_(callback, fireImmediately) {\n if ( true && fireImmediately === true) {\n die(\"`observe` doesn't support the fire immediately property for observable objects.\");\n }\n return registerListener(this, callback);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.notifyPropertyAddition_ = function notifyPropertyAddition_(key, value) {\n var _this$pendingKeys_2;\n var notify = hasListeners(this);\n var notifySpy = true && isSpyEnabled();\n if (notify || notifySpy) {\n var change = notify || notifySpy ? {\n type: ADD,\n observableKind: \"object\",\n debugObjectName: this.name_,\n object: this.proxy_ || this.target_,\n name: key,\n newValue: value\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n }\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n (_this$pendingKeys_2 = this.pendingKeys_) == null || (_this$pendingKeys_2 = _this$pendingKeys_2.get(key)) == null || _this$pendingKeys_2.set(true);\n // Notify \"keys/entries/values\" observers\n this.keysAtom_.reportChanged();\n };\n _proto.ownKeys_ = function ownKeys_() {\n this.keysAtom_.reportObserved();\n return ownKeys(this.target_);\n };\n _proto.keys_ = function keys_() {\n // Returns enumerable && own, but unfortunately keysAtom will report on ANY key change.\n // There is no way to distinguish between Object.keys(object) and Reflect.ownKeys(object) - both are handled by ownKeys trap.\n // We can either over-report in Object.keys(object) or under-report in Reflect.ownKeys(object)\n // We choose to over-report in Object.keys(object), because:\n // - typically it's used with simple data objects\n // - when symbolic/non-enumerable keys are relevant Reflect.ownKeys works as expected\n this.keysAtom_.reportObserved();\n return Object.keys(this.target_);\n };\n return ObservableObjectAdministration;\n}();\nfunction asObservableObject(target, options) {\n var _options$name;\n if ( true && options && isObservableObject(target)) {\n die(\"Options can't be provided for already observable objects.\");\n }\n if (hasProp(target, $mobx)) {\n if ( true && !(getAdministration(target) instanceof ObservableObjectAdministration)) {\n die(\"Cannot convert '\" + getDebugName(target) + \"' into observable object:\" + \"\\nThe target is already observable of different type.\" + \"\\nExtending builtins is not supported.\");\n }\n return target;\n }\n if ( true && !Object.isExtensible(target)) {\n die(\"Cannot make the designated object observable; it is not extensible\");\n }\n var name = (_options$name = options == null ? void 0 : options.name) != null ? _options$name : true ? (isPlainObject(target) ? \"ObservableObject\" : target.constructor.name) + \"@\" + getNextId() : 0;\n var adm = new ObservableObjectAdministration(target, new Map(), String(name), getAnnotationFromOptions(options));\n addHiddenProp(target, $mobx, adm);\n return target;\n}\nvar isObservableObjectAdministration = /*#__PURE__*/createInstanceofPredicate(\"ObservableObjectAdministration\", ObservableObjectAdministration);\nfunction getCachedObservablePropDescriptor(key) {\n return descriptorCache[key] || (descriptorCache[key] = {\n get: function get() {\n return this[$mobx].getObservablePropValue_(key);\n },\n set: function set(value) {\n return this[$mobx].setObservablePropValue_(key, value);\n }\n });\n}\nfunction isObservableObject(thing) {\n if (isObject(thing)) {\n return isObservableObjectAdministration(thing[$mobx]);\n }\n return false;\n}\nfunction recordAnnotationApplied(adm, annotation, key) {\n var _adm$target_$storedAn;\n if (true) {\n adm.appliedAnnotations_[key] = annotation;\n }\n // Remove applied decorator annotation so we don't try to apply it again in subclass constructor\n (_adm$target_$storedAn = adm.target_[storedAnnotationsSymbol]) == null || delete _adm$target_$storedAn[key];\n}\nfunction assertAnnotable(adm, annotation, key) {\n // Valid annotation\n if ( true && !isAnnotation(annotation)) {\n die(\"Cannot annotate '\" + adm.name_ + \".\" + key.toString() + \"': Invalid annotation.\");\n }\n /*\n // Configurable, not sealed, not frozen\n // Possibly not needed, just a little better error then the one thrown by engine.\n // Cases where this would be useful the most (subclass field initializer) are not interceptable by this.\n if (__DEV__) {\n const configurable = getDescriptor(adm.target_, key)?.configurable\n const frozen = Object.isFrozen(adm.target_)\n const sealed = Object.isSealed(adm.target_)\n if (!configurable || frozen || sealed) {\n const fieldName = `${adm.name_}.${key.toString()}`\n const requestedAnnotationType = annotation.annotationType_\n let error = `Cannot apply '${requestedAnnotationType}' to '${fieldName}':`\n if (frozen) {\n error += `\\nObject is frozen.`\n }\n if (sealed) {\n error += `\\nObject is sealed.`\n }\n if (!configurable) {\n error += `\\nproperty is not configurable.`\n // Mention only if caused by us to avoid confusion\n if (hasProp(adm.appliedAnnotations!, key)) {\n error += `\\nTo prevent accidental re-definition of a field by a subclass, `\n error += `all annotated fields of non-plain objects (classes) are not configurable.`\n }\n }\n die(error)\n }\n }\n */\n // Not annotated\n if ( true && !isOverride(annotation) && hasProp(adm.appliedAnnotations_, key)) {\n var fieldName = adm.name_ + \".\" + key.toString();\n var currentAnnotationType = adm.appliedAnnotations_[key].annotationType_;\n var requestedAnnotationType = annotation.annotationType_;\n die(\"Cannot apply '\" + requestedAnnotationType + \"' to '\" + fieldName + \"':\" + (\"\\nThe field is already annotated with '\" + currentAnnotationType + \"'.\") + \"\\nRe-annotating fields is not allowed.\" + \"\\nUse 'override' annotation for methods overridden by subclass.\");\n }\n}\n\n// Bug in safari 9.* (or iOS 9 safari mobile). See #364\nvar ENTRY_0 = /*#__PURE__*/createArrayEntryDescriptor(0);\nvar safariPrototypeSetterInheritanceBug = /*#__PURE__*/function () {\n var v = false;\n var p = {};\n Object.defineProperty(p, \"0\", {\n set: function set() {\n v = true;\n }\n });\n /*#__PURE__*/Object.create(p)[\"0\"] = 1;\n return v === false;\n}();\n/**\n * This array buffer contains two lists of properties, so that all arrays\n * can recycle their property definitions, which significantly improves performance of creating\n * properties on the fly.\n */\nvar OBSERVABLE_ARRAY_BUFFER_SIZE = 0;\n// Typescript workaround to make sure ObservableArray extends Array\nvar StubArray = function StubArray() {};\nfunction inherit(ctor, proto) {\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(ctor.prototype, proto);\n } else if (ctor.prototype.__proto__ !== undefined) {\n ctor.prototype.__proto__ = proto;\n } else {\n ctor.prototype = proto;\n }\n}\ninherit(StubArray, Array.prototype);\n// Weex proto freeze protection was here,\n// but it is unclear why the hack is need as MobX never changed the prototype\n// anyway, so removed it in V6\nvar LegacyObservableArray = /*#__PURE__*/function (_StubArray) {\n function LegacyObservableArray(initialValues, enhancer, name, owned) {\n var _this;\n if (name === void 0) {\n name = true ? \"ObservableArray@\" + getNextId() : 0;\n }\n if (owned === void 0) {\n owned = false;\n }\n _this = _StubArray.call(this) || this;\n initObservable(function () {\n var adm = new ObservableArrayAdministration(name, enhancer, owned, true);\n adm.proxy_ = _this;\n addHiddenFinalProp(_this, $mobx, adm);\n if (initialValues && initialValues.length) {\n // @ts-ignore\n _this.spliceWithArray(0, 0, initialValues);\n }\n if (safariPrototypeSetterInheritanceBug) {\n // Seems that Safari won't use numeric prototype setter until any * numeric property is\n // defined on the instance. After that it works fine, even if this property is deleted.\n Object.defineProperty(_this, \"0\", ENTRY_0);\n }\n });\n return _this;\n }\n _inheritsLoose(LegacyObservableArray, _StubArray);\n var _proto = LegacyObservableArray.prototype;\n _proto.concat = function concat() {\n this[$mobx].atom_.reportObserved();\n for (var _len = arguments.length, arrays = new Array(_len), _key = 0; _key < _len; _key++) {\n arrays[_key] = arguments[_key];\n }\n return Array.prototype.concat.apply(this.slice(),\n //@ts-ignore\n arrays.map(function (a) {\n return isObservableArray(a) ? a.slice() : a;\n }));\n };\n _proto[Symbol.iterator] = function () {\n var self = this;\n var nextIndex = 0;\n return makeIterable({\n next: function next() {\n return nextIndex < self.length ? {\n value: self[nextIndex++],\n done: false\n } : {\n done: true,\n value: undefined\n };\n }\n });\n };\n return _createClass(LegacyObservableArray, [{\n key: \"length\",\n get: function get() {\n return this[$mobx].getArrayLength_();\n },\n set: function set(newLength) {\n this[$mobx].setArrayLength_(newLength);\n }\n }, {\n key: Symbol.toStringTag,\n get: function get() {\n return \"Array\";\n }\n }]);\n}(StubArray);\nObject.entries(arrayExtensions).forEach(function (_ref) {\n var prop = _ref[0],\n fn = _ref[1];\n if (prop !== \"concat\") {\n addHiddenProp(LegacyObservableArray.prototype, prop, fn);\n }\n});\nfunction createArrayEntryDescriptor(index) {\n return {\n enumerable: false,\n configurable: true,\n get: function get() {\n return this[$mobx].get_(index);\n },\n set: function set(value) {\n this[$mobx].set_(index, value);\n }\n };\n}\nfunction createArrayBufferItem(index) {\n defineProperty(LegacyObservableArray.prototype, \"\" + index, createArrayEntryDescriptor(index));\n}\nfunction reserveArrayBuffer(max) {\n if (max > OBSERVABLE_ARRAY_BUFFER_SIZE) {\n for (var index = OBSERVABLE_ARRAY_BUFFER_SIZE; index < max + 100; index++) {\n createArrayBufferItem(index);\n }\n OBSERVABLE_ARRAY_BUFFER_SIZE = max;\n }\n}\nreserveArrayBuffer(1000);\nfunction createLegacyArray(initialValues, enhancer, name) {\n return new LegacyObservableArray(initialValues, enhancer, name);\n}\n\nfunction getAtom(thing, property) {\n if (typeof thing === \"object\" && thing !== null) {\n if (isObservableArray(thing)) {\n if (property !== undefined) {\n die(23);\n }\n return thing[$mobx].atom_;\n }\n if (isObservableSet(thing)) {\n return thing.atom_;\n }\n if (isObservableMap(thing)) {\n if (property === undefined) {\n return thing.keysAtom_;\n }\n var observable = thing.data_.get(property) || thing.hasMap_.get(property);\n if (!observable) {\n die(25, property, getDebugName(thing));\n }\n return observable;\n }\n if (isObservableObject(thing)) {\n if (!property) {\n return die(26);\n }\n var _observable = thing[$mobx].values_.get(property);\n if (!_observable) {\n die(27, property, getDebugName(thing));\n }\n return _observable;\n }\n if (isAtom(thing) || isComputedValue(thing) || isReaction(thing)) {\n return thing;\n }\n } else if (isFunction(thing)) {\n if (isReaction(thing[$mobx])) {\n // disposer function\n return thing[$mobx];\n }\n }\n die(28);\n}\nfunction getAdministration(thing, property) {\n if (!thing) {\n die(29);\n }\n if (property !== undefined) {\n return getAdministration(getAtom(thing, property));\n }\n if (isAtom(thing) || isComputedValue(thing) || isReaction(thing)) {\n return thing;\n }\n if (isObservableMap(thing) || isObservableSet(thing)) {\n return thing;\n }\n if (thing[$mobx]) {\n return thing[$mobx];\n }\n die(24, thing);\n}\nfunction getDebugName(thing, property) {\n var named;\n if (property !== undefined) {\n named = getAtom(thing, property);\n } else if (isAction(thing)) {\n return thing.name;\n } else if (isObservableObject(thing) || isObservableMap(thing) || isObservableSet(thing)) {\n named = getAdministration(thing);\n } else {\n // valid for arrays as well\n named = getAtom(thing);\n }\n return named.name_;\n}\n/**\n * Helper function for initializing observable structures, it applies:\n * 1. allowStateChanges so we don't violate enforceActions.\n * 2. untracked so we don't accidentaly subscribe to anything observable accessed during init in case the observable is created inside derivation.\n * 3. batch to avoid state version updates\n */\nfunction initObservable(cb) {\n var derivation = untrackedStart();\n var allowStateChanges = allowStateChangesStart(true);\n startBatch();\n try {\n return cb();\n } finally {\n endBatch();\n allowStateChangesEnd(allowStateChanges);\n untrackedEnd(derivation);\n }\n}\n\nvar toString = objectPrototype.toString;\nfunction deepEqual(a, b, depth) {\n if (depth === void 0) {\n depth = -1;\n }\n return eq(a, b, depth);\n}\n// Copied from https://github.com/jashkenas/underscore/blob/5c237a7c682fb68fd5378203f0bf22dce1624854/underscore.js#L1186-L1289\n// Internal recursive comparison function for `isEqual`.\nfunction eq(a, b, depth, aStack, bStack) {\n // Identical objects are equal. `0 === -0`, but they aren't identical.\n // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).\n if (a === b) {\n return a !== 0 || 1 / a === 1 / b;\n }\n // `null` or `undefined` only equal to itself (strict comparison).\n if (a == null || b == null) {\n return false;\n }\n // `NaN`s are equivalent, but non-reflexive.\n if (a !== a) {\n return b !== b;\n }\n // Exhaust primitive checks\n var type = typeof a;\n if (type !== \"function\" && type !== \"object\" && typeof b != \"object\") {\n return false;\n }\n // Compare `[[Class]]` names.\n var className = toString.call(a);\n if (className !== toString.call(b)) {\n return false;\n }\n switch (className) {\n // Strings, numbers, regular expressions, dates, and booleans are compared by value.\n case \"[object RegExp]\":\n // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i')\n case \"[object String]\":\n // Primitives and their corresponding object wrappers are equivalent; thus, `\"5\"` is\n // equivalent to `new String(\"5\")`.\n return \"\" + a === \"\" + b;\n case \"[object Number]\":\n // `NaN`s are equivalent, but non-reflexive.\n // Object(NaN) is equivalent to NaN.\n if (+a !== +a) {\n return +b !== +b;\n }\n // An `egal` comparison is performed for other numeric values.\n return +a === 0 ? 1 / +a === 1 / b : +a === +b;\n case \"[object Date]\":\n case \"[object Boolean]\":\n // Coerce dates and booleans to numeric primitive values. Dates are compared by their\n // millisecond representations. Note that invalid dates with millisecond representations\n // of `NaN` are not equivalent.\n return +a === +b;\n case \"[object Symbol]\":\n return typeof Symbol !== \"undefined\" && Symbol.valueOf.call(a) === Symbol.valueOf.call(b);\n case \"[object Map]\":\n case \"[object Set]\":\n // Maps and Sets are unwrapped to arrays of entry-pairs, adding an incidental level.\n // Hide this extra level by increasing the depth.\n if (depth >= 0) {\n depth++;\n }\n break;\n }\n // Unwrap any wrapped objects.\n a = unwrap(a);\n b = unwrap(b);\n var areArrays = className === \"[object Array]\";\n if (!areArrays) {\n if (typeof a != \"object\" || typeof b != \"object\") {\n return false;\n }\n // Objects with different constructors are not equivalent, but `Object`s or `Array`s\n // from different frames are.\n var aCtor = a.constructor,\n bCtor = b.constructor;\n if (aCtor !== bCtor && !(isFunction(aCtor) && aCtor instanceof aCtor && isFunction(bCtor) && bCtor instanceof bCtor) && \"constructor\" in a && \"constructor\" in b) {\n return false;\n }\n }\n if (depth === 0) {\n return false;\n } else if (depth < 0) {\n depth = -1;\n }\n // Assume equality for cyclic structures. The algorithm for detecting cyclic\n // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.\n // Initializing stack of traversed objects.\n // It's done here since we only need them for objects and arrays comparison.\n aStack = aStack || [];\n bStack = bStack || [];\n var length = aStack.length;\n while (length--) {\n // Linear search. Performance is inversely proportional to the number of\n // unique nested structures.\n if (aStack[length] === a) {\n return bStack[length] === b;\n }\n }\n // Add the first object to the stack of traversed objects.\n aStack.push(a);\n bStack.push(b);\n // Recursively compare objects and arrays.\n if (areArrays) {\n // Compare array lengths to determine if a deep comparison is necessary.\n length = a.length;\n if (length !== b.length) {\n return false;\n }\n // Deep compare the contents, ignoring non-numeric properties.\n while (length--) {\n if (!eq(a[length], b[length], depth - 1, aStack, bStack)) {\n return false;\n }\n }\n } else {\n // Deep compare objects.\n var keys = Object.keys(a);\n var key;\n length = keys.length;\n // Ensure that both objects contain the same number of properties before comparing deep equality.\n if (Object.keys(b).length !== length) {\n return false;\n }\n while (length--) {\n // Deep compare each member\n key = keys[length];\n if (!(hasProp(b, key) && eq(a[key], b[key], depth - 1, aStack, bStack))) {\n return false;\n }\n }\n }\n // Remove the first object from the stack of traversed objects.\n aStack.pop();\n bStack.pop();\n return true;\n}\nfunction unwrap(a) {\n if (isObservableArray(a)) {\n return a.slice();\n }\n if (isES6Map(a) || isObservableMap(a)) {\n return Array.from(a.entries());\n }\n if (isES6Set(a) || isObservableSet(a)) {\n return Array.from(a.entries());\n }\n return a;\n}\n\nfunction makeIterable(iterator) {\n iterator[Symbol.iterator] = getSelf;\n return iterator;\n}\nfunction getSelf() {\n return this;\n}\n\nfunction isAnnotation(thing) {\n return (\n // Can be function\n thing instanceof Object && typeof thing.annotationType_ === \"string\" && isFunction(thing.make_) && isFunction(thing.extend_)\n );\n}\n\n/**\n * (c) Michel Weststrate 2015 - 2020\n * MIT Licensed\n *\n * Welcome to the mobx sources! To get a global overview of how MobX internally works,\n * this is a good place to start:\n * https://medium.com/@mweststrate/becoming-fully-reactive-an-in-depth-explanation-of-mobservable-55995262a254#.xvbh6qd74\n *\n * Source folders:\n * ===============\n *\n * - api/ Most of the public static methods exposed by the module can be found here.\n * - core/ Implementation of the MobX algorithm; atoms, derivations, reactions, dependency trees, optimizations. Cool stuff can be found here.\n * - types/ All the magic that is need to have observable objects, arrays and values is in this folder. Including the modifiers like `asFlat`.\n * - utils/ Utility stuff.\n *\n */\n[\"Symbol\", \"Map\", \"Set\"].forEach(function (m) {\n var g = getGlobal();\n if (typeof g[m] === \"undefined\") {\n die(\"MobX requires global '\" + m + \"' to be available or polyfilled\");\n }\n});\nif (typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__ === \"object\") {\n // See: https://github.com/andykog/mobx-devtools/\n __MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({\n spy: spy,\n extras: {\n getDebugName: getDebugName\n },\n $mobx: $mobx\n });\n}\n\n\n//# sourceMappingURL=mobx.esm.js.map\n\n\n//# sourceURL=webpack://app_adyen_SFRA/./node_modules/mobx/dist/mobx.esm.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ $mobx: () => (/* binding */ $mobx),\n/* harmony export */ FlowCancellationError: () => (/* binding */ FlowCancellationError),\n/* harmony export */ ObservableMap: () => (/* binding */ ObservableMap),\n/* harmony export */ ObservableSet: () => (/* binding */ ObservableSet),\n/* harmony export */ Reaction: () => (/* binding */ Reaction),\n/* harmony export */ _allowStateChanges: () => (/* binding */ allowStateChanges),\n/* harmony export */ _allowStateChangesInsideComputed: () => (/* binding */ runInAction),\n/* harmony export */ _allowStateReadsEnd: () => (/* binding */ allowStateReadsEnd),\n/* harmony export */ _allowStateReadsStart: () => (/* binding */ allowStateReadsStart),\n/* harmony export */ _autoAction: () => (/* binding */ autoAction),\n/* harmony export */ _endAction: () => (/* binding */ _endAction),\n/* harmony export */ _getAdministration: () => (/* binding */ getAdministration),\n/* harmony export */ _getGlobalState: () => (/* binding */ getGlobalState),\n/* harmony export */ _interceptReads: () => (/* binding */ interceptReads),\n/* harmony export */ _isComputingDerivation: () => (/* binding */ isComputingDerivation),\n/* harmony export */ _resetGlobalState: () => (/* binding */ resetGlobalState),\n/* harmony export */ _startAction: () => (/* binding */ _startAction),\n/* harmony export */ action: () => (/* binding */ action),\n/* harmony export */ autorun: () => (/* binding */ autorun),\n/* harmony export */ comparer: () => (/* binding */ comparer),\n/* harmony export */ computed: () => (/* binding */ computed),\n/* harmony export */ configure: () => (/* binding */ configure),\n/* harmony export */ createAtom: () => (/* binding */ createAtom),\n/* harmony export */ defineProperty: () => (/* binding */ apiDefineProperty),\n/* harmony export */ entries: () => (/* binding */ entries),\n/* harmony export */ extendObservable: () => (/* binding */ extendObservable),\n/* harmony export */ flow: () => (/* binding */ flow),\n/* harmony export */ flowResult: () => (/* binding */ flowResult),\n/* harmony export */ get: () => (/* binding */ get),\n/* harmony export */ getAtom: () => (/* binding */ getAtom),\n/* harmony export */ getDebugName: () => (/* binding */ getDebugName),\n/* harmony export */ getDependencyTree: () => (/* binding */ getDependencyTree),\n/* harmony export */ getObserverTree: () => (/* binding */ getObserverTree),\n/* harmony export */ has: () => (/* binding */ has),\n/* harmony export */ intercept: () => (/* binding */ intercept),\n/* harmony export */ isAction: () => (/* binding */ isAction),\n/* harmony export */ isBoxedObservable: () => (/* binding */ isObservableValue),\n/* harmony export */ isComputed: () => (/* binding */ isComputed),\n/* harmony export */ isComputedProp: () => (/* binding */ isComputedProp),\n/* harmony export */ isFlow: () => (/* binding */ isFlow),\n/* harmony export */ isFlowCancellationError: () => (/* binding */ isFlowCancellationError),\n/* harmony export */ isObservable: () => (/* binding */ isObservable),\n/* harmony export */ isObservableArray: () => (/* binding */ isObservableArray),\n/* harmony export */ isObservableMap: () => (/* binding */ isObservableMap),\n/* harmony export */ isObservableObject: () => (/* binding */ isObservableObject),\n/* harmony export */ isObservableProp: () => (/* binding */ isObservableProp),\n/* harmony export */ isObservableSet: () => (/* binding */ isObservableSet),\n/* harmony export */ keys: () => (/* binding */ keys),\n/* harmony export */ makeAutoObservable: () => (/* binding */ makeAutoObservable),\n/* harmony export */ makeObservable: () => (/* binding */ makeObservable),\n/* harmony export */ observable: () => (/* binding */ observable),\n/* harmony export */ observe: () => (/* binding */ observe),\n/* harmony export */ onBecomeObserved: () => (/* binding */ onBecomeObserved),\n/* harmony export */ onBecomeUnobserved: () => (/* binding */ onBecomeUnobserved),\n/* harmony export */ onReactionError: () => (/* binding */ onReactionError),\n/* harmony export */ override: () => (/* binding */ override),\n/* harmony export */ ownKeys: () => (/* binding */ apiOwnKeys),\n/* harmony export */ reaction: () => (/* binding */ reaction),\n/* harmony export */ remove: () => (/* binding */ remove),\n/* harmony export */ runInAction: () => (/* binding */ runInAction),\n/* harmony export */ set: () => (/* binding */ set),\n/* harmony export */ spy: () => (/* binding */ spy),\n/* harmony export */ toJS: () => (/* binding */ toJS),\n/* harmony export */ trace: () => (/* binding */ trace),\n/* harmony export */ transaction: () => (/* binding */ transaction),\n/* harmony export */ untracked: () => (/* binding */ untracked),\n/* harmony export */ values: () => (/* binding */ values),\n/* harmony export */ when: () => (/* binding */ when)\n/* harmony export */ });\nvar niceErrors = {\n 0: \"Invalid value for configuration 'enforceActions', expected 'never', 'always' or 'observed'\",\n 1: function _(annotationType, key) {\n return \"Cannot apply '\" + annotationType + \"' to '\" + key.toString() + \"': Field not found.\";\n },\n /*\n 2(prop) {\n return `invalid decorator for '${prop.toString()}'`\n },\n 3(prop) {\n return `Cannot decorate '${prop.toString()}': action can only be used on properties with a function value.`\n },\n 4(prop) {\n return `Cannot decorate '${prop.toString()}': computed can only be used on getter properties.`\n },\n */\n 5: \"'keys()' can only be used on observable objects, arrays, sets and maps\",\n 6: \"'values()' can only be used on observable objects, arrays, sets and maps\",\n 7: \"'entries()' can only be used on observable objects, arrays and maps\",\n 8: \"'set()' can only be used on observable objects, arrays and maps\",\n 9: \"'remove()' can only be used on observable objects, arrays and maps\",\n 10: \"'has()' can only be used on observable objects, arrays and maps\",\n 11: \"'get()' can only be used on observable objects, arrays and maps\",\n 12: \"Invalid annotation\",\n 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)\",\n 14: \"Intercept handlers should return nothing or a change object\",\n 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)\",\n 16: \"Modification exception: the internal structure of an observable array was changed.\",\n 17: function _(index, length) {\n return \"[mobx.array] Index out of bounds, \" + index + \" is larger than \" + length;\n },\n 18: \"mobx.map requires Map polyfill for the current browser. Check babel-polyfill or core-js/es6/map.js\",\n 19: function _(other) {\n return \"Cannot initialize from classes that inherit from Map: \" + other.constructor.name;\n },\n 20: function _(other) {\n return \"Cannot initialize map from \" + other;\n },\n 21: function _(dataStructure) {\n return \"Cannot convert to map from '\" + dataStructure + \"'\";\n },\n 22: \"mobx.set requires Set polyfill for the current browser. Check babel-polyfill or core-js/es6/set.js\",\n 23: \"It is not possible to get index atoms from arrays\",\n 24: function _(thing) {\n return \"Cannot obtain administration from \" + thing;\n },\n 25: function _(property, name) {\n return \"the entry '\" + property + \"' does not exist in the observable map '\" + name + \"'\";\n },\n 26: \"please specify a property\",\n 27: function _(property, name) {\n return \"no observable property '\" + property.toString() + \"' found on the observable object '\" + name + \"'\";\n },\n 28: function _(thing) {\n return \"Cannot obtain atom from \" + thing;\n },\n 29: \"Expecting some object\",\n 30: \"invalid action stack. did you forget to finish an action?\",\n 31: \"missing option for computed: get\",\n 32: function _(name, derivation) {\n return \"Cycle detected in computation \" + name + \": \" + derivation;\n },\n 33: function _(name) {\n return \"The setter of computed value '\" + name + \"' is trying to update itself. Did you intend to update an _observable_ value, instead of the computed property?\";\n },\n 34: function _(name) {\n return \"[ComputedValue '\" + name + \"'] It is not possible to assign a new value to a computed value.\";\n },\n 35: \"There are multiple, different versions of MobX active. Make sure MobX is loaded only once or use `configure({ isolateGlobalState: true })`\",\n 36: \"isolateGlobalState should be called before MobX is running any reactions\",\n 37: function _(method) {\n return \"[mobx] `observableArray.\" + method + \"()` mutates the array in-place, which is not allowed inside a derivation. Use `array.slice().\" + method + \"()` instead\";\n },\n 38: \"'ownKeys()' can only be used on observable objects\",\n 39: \"'defineProperty()' can only be used on observable objects\"\n};\nvar errors = true ? niceErrors : 0;\nfunction die(error) {\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n if (true) {\n var e = typeof error === \"string\" ? error : errors[error];\n if (typeof e === \"function\") e = e.apply(null, args);\n throw new Error(\"[MobX] \" + e);\n }\n throw new Error(typeof error === \"number\" ? \"[MobX] minified error nr: \" + error + (args.length ? \" \" + args.map(String).join(\",\") : \"\") + \". Find the full error at: https://github.com/mobxjs/mobx/blob/main/packages/mobx/src/errors.ts\" : \"[MobX] \" + error);\n}\n\nvar mockGlobal = {};\nfunction getGlobal() {\n if (typeof globalThis !== \"undefined\") {\n return globalThis;\n }\n if (typeof window !== \"undefined\") {\n return window;\n }\n if (typeof __webpack_require__.g !== \"undefined\") {\n return __webpack_require__.g;\n }\n if (typeof self !== \"undefined\") {\n return self;\n }\n return mockGlobal;\n}\n\n// We shorten anything used > 5 times\nvar assign = Object.assign;\nvar getDescriptor = Object.getOwnPropertyDescriptor;\nvar defineProperty = Object.defineProperty;\nvar objectPrototype = Object.prototype;\nvar EMPTY_ARRAY = [];\nObject.freeze(EMPTY_ARRAY);\nvar EMPTY_OBJECT = {};\nObject.freeze(EMPTY_OBJECT);\nvar hasProxy = typeof Proxy !== \"undefined\";\nvar plainObjectString = /*#__PURE__*/Object.toString();\nfunction assertProxies() {\n if (!hasProxy) {\n die( true ? \"`Proxy` objects are not available in the current environment. Please configure MobX to enable a fallback implementation.`\" : 0);\n }\n}\nfunction warnAboutProxyRequirement(msg) {\n if ( true && globalState.verifyProxies) {\n die(\"MobX is currently configured to be able to run in ES5 mode, but in ES5 MobX won't be able to \" + msg);\n }\n}\nfunction getNextId() {\n return ++globalState.mobxGuid;\n}\n/**\n * Makes sure that the provided function is invoked at most once.\n */\nfunction once(func) {\n var invoked = false;\n return function () {\n if (invoked) {\n return;\n }\n invoked = true;\n return func.apply(this, arguments);\n };\n}\nvar noop = function noop() {};\nfunction isFunction(fn) {\n return typeof fn === \"function\";\n}\nfunction isStringish(value) {\n var t = typeof value;\n switch (t) {\n case \"string\":\n case \"symbol\":\n case \"number\":\n return true;\n }\n return false;\n}\nfunction isObject(value) {\n return value !== null && typeof value === \"object\";\n}\nfunction isPlainObject(value) {\n if (!isObject(value)) {\n return false;\n }\n var proto = Object.getPrototypeOf(value);\n if (proto == null) {\n return true;\n }\n var protoConstructor = Object.hasOwnProperty.call(proto, \"constructor\") && proto.constructor;\n return typeof protoConstructor === \"function\" && protoConstructor.toString() === plainObjectString;\n}\n// https://stackoverflow.com/a/37865170\nfunction isGenerator(obj) {\n var constructor = obj == null ? void 0 : obj.constructor;\n if (!constructor) {\n return false;\n }\n if (\"GeneratorFunction\" === constructor.name || \"GeneratorFunction\" === constructor.displayName) {\n return true;\n }\n return false;\n}\nfunction addHiddenProp(object, propName, value) {\n defineProperty(object, propName, {\n enumerable: false,\n writable: true,\n configurable: true,\n value: value\n });\n}\nfunction addHiddenFinalProp(object, propName, value) {\n defineProperty(object, propName, {\n enumerable: false,\n writable: false,\n configurable: true,\n value: value\n });\n}\nfunction createInstanceofPredicate(name, theClass) {\n var propName = \"isMobX\" + name;\n theClass.prototype[propName] = true;\n return function (x) {\n return isObject(x) && x[propName] === true;\n };\n}\n/**\n * Yields true for both native and observable Map, even across different windows.\n */\nfunction isES6Map(thing) {\n return thing != null && Object.prototype.toString.call(thing) === \"[object Map]\";\n}\n/**\n * Makes sure a Map is an instance of non-inherited native or observable Map.\n */\nfunction isPlainES6Map(thing) {\n var mapProto = Object.getPrototypeOf(thing);\n var objectProto = Object.getPrototypeOf(mapProto);\n var nullProto = Object.getPrototypeOf(objectProto);\n return nullProto === null;\n}\n/**\n * Yields true for both native and observable Set, even across different windows.\n */\nfunction isES6Set(thing) {\n return thing != null && Object.prototype.toString.call(thing) === \"[object Set]\";\n}\nvar hasGetOwnPropertySymbols = typeof Object.getOwnPropertySymbols !== \"undefined\";\n/**\n * Returns the following: own enumerable keys and symbols.\n */\nfunction getPlainObjectKeys(object) {\n var keys = Object.keys(object);\n // Not supported in IE, so there are not going to be symbol props anyway...\n if (!hasGetOwnPropertySymbols) {\n return keys;\n }\n var symbols = Object.getOwnPropertySymbols(object);\n if (!symbols.length) {\n return keys;\n }\n return [].concat(keys, symbols.filter(function (s) {\n return objectPrototype.propertyIsEnumerable.call(object, s);\n }));\n}\n// From Immer utils\n// Returns all own keys, including non-enumerable and symbolic\nvar ownKeys = typeof Reflect !== \"undefined\" && Reflect.ownKeys ? Reflect.ownKeys : hasGetOwnPropertySymbols ? function (obj) {\n return Object.getOwnPropertyNames(obj).concat(Object.getOwnPropertySymbols(obj));\n} : /* istanbul ignore next */Object.getOwnPropertyNames;\nfunction stringifyKey(key) {\n if (typeof key === \"string\") {\n return key;\n }\n if (typeof key === \"symbol\") {\n return key.toString();\n }\n return new String(key).toString();\n}\nfunction toPrimitive(value) {\n return value === null ? null : typeof value === \"object\" ? \"\" + value : value;\n}\nfunction hasProp(target, prop) {\n return objectPrototype.hasOwnProperty.call(target, prop);\n}\n// From Immer utils\nvar getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors || function getOwnPropertyDescriptors(target) {\n // Polyfill needed for Hermes and IE, see https://github.com/facebook/hermes/issues/274\n var res = {};\n // Note: without polyfill for ownKeys, symbols won't be picked up\n ownKeys(target).forEach(function (key) {\n res[key] = getDescriptor(target, key);\n });\n return res;\n};\nfunction getFlag(flags, mask) {\n return !!(flags & mask);\n}\nfunction setFlag(flags, mask, newValue) {\n if (newValue) {\n flags |= mask;\n } else {\n flags &= ~mask;\n }\n return flags;\n}\n\nfunction _arrayLikeToArray(r, a) {\n (null == a || a > r.length) && (a = r.length);\n for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];\n return n;\n}\nfunction _defineProperties(e, r) {\n for (var t = 0; t < r.length; t++) {\n var o = r[t];\n o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);\n }\n}\nfunction _createClass(e, r, t) {\n return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", {\n writable: !1\n }), e;\n}\nfunction _createForOfIteratorHelperLoose(r, e) {\n var t = \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"];\n if (t) return (t = t.call(r)).next.bind(t);\n if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && \"number\" == typeof r.length) {\n t && (r = t);\n var o = 0;\n return function () {\n return o >= r.length ? {\n done: !0\n } : {\n done: !1,\n value: r[o++]\n };\n };\n }\n throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\nfunction _extends() {\n return _extends = Object.assign ? Object.assign.bind() : function (n) {\n for (var e = 1; e < arguments.length; e++) {\n var t = arguments[e];\n for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);\n }\n return n;\n }, _extends.apply(null, arguments);\n}\nfunction _inheritsLoose(t, o) {\n t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);\n}\nfunction _setPrototypeOf(t, e) {\n return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {\n return t.__proto__ = e, t;\n }, _setPrototypeOf(t, e);\n}\nfunction _toPrimitive(t, r) {\n if (\"object\" != typeof t || !t) return t;\n var e = t[Symbol.toPrimitive];\n if (void 0 !== e) {\n var i = e.call(t, r || \"default\");\n if (\"object\" != typeof i) return i;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (\"string\" === r ? String : Number)(t);\n}\nfunction _toPropertyKey(t) {\n var i = _toPrimitive(t, \"string\");\n return \"symbol\" == typeof i ? i : i + \"\";\n}\nfunction _unsupportedIterableToArray(r, a) {\n if (r) {\n if (\"string\" == typeof r) return _arrayLikeToArray(r, a);\n var t = {}.toString.call(r).slice(8, -1);\n return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;\n }\n}\n\nvar storedAnnotationsSymbol = /*#__PURE__*/Symbol(\"mobx-stored-annotations\");\n/**\n * Creates a function that acts as\n * - decorator\n * - annotation object\n */\nfunction createDecoratorAnnotation(annotation) {\n function decorator(target, property) {\n if (is20223Decorator(property)) {\n return annotation.decorate_20223_(target, property);\n } else {\n storeAnnotation(target, property, annotation);\n }\n }\n return Object.assign(decorator, annotation);\n}\n/**\n * Stores annotation to prototype,\n * so it can be inspected later by `makeObservable` called from constructor\n */\nfunction storeAnnotation(prototype, key, annotation) {\n if (!hasProp(prototype, storedAnnotationsSymbol)) {\n addHiddenProp(prototype, storedAnnotationsSymbol, _extends({}, prototype[storedAnnotationsSymbol]));\n }\n // @override must override something\n if ( true && isOverride(annotation) && !hasProp(prototype[storedAnnotationsSymbol], key)) {\n var fieldName = prototype.constructor.name + \".prototype.\" + key.toString();\n die(\"'\" + fieldName + \"' is decorated with 'override', \" + \"but no such decorated member was found on prototype.\");\n }\n // Cannot re-decorate\n assertNotDecorated(prototype, annotation, key);\n // Ignore override\n if (!isOverride(annotation)) {\n prototype[storedAnnotationsSymbol][key] = annotation;\n }\n}\nfunction assertNotDecorated(prototype, annotation, key) {\n if ( true && !isOverride(annotation) && hasProp(prototype[storedAnnotationsSymbol], key)) {\n var fieldName = prototype.constructor.name + \".prototype.\" + key.toString();\n var currentAnnotationType = prototype[storedAnnotationsSymbol][key].annotationType_;\n var requestedAnnotationType = annotation.annotationType_;\n die(\"Cannot apply '@\" + requestedAnnotationType + \"' to '\" + fieldName + \"':\" + (\"\\nThe field is already decorated with '@\" + currentAnnotationType + \"'.\") + \"\\nRe-decorating fields is not allowed.\" + \"\\nUse '@override' decorator for methods overridden by subclass.\");\n }\n}\n/**\n * Collects annotations from prototypes and stores them on target (instance)\n */\nfunction collectStoredAnnotations(target) {\n if (!hasProp(target, storedAnnotationsSymbol)) {\n // if (__DEV__ && !target[storedAnnotationsSymbol]) {\n // die(\n // `No annotations were passed to makeObservable, but no decorated members have been found either`\n // )\n // }\n // We need a copy as we will remove annotation from the list once it's applied.\n addHiddenProp(target, storedAnnotationsSymbol, _extends({}, target[storedAnnotationsSymbol]));\n }\n return target[storedAnnotationsSymbol];\n}\nfunction is20223Decorator(context) {\n return typeof context == \"object\" && typeof context[\"kind\"] == \"string\";\n}\nfunction assert20223DecoratorType(context, types) {\n if ( true && !types.includes(context.kind)) {\n die(\"The decorator applied to '\" + String(context.name) + \"' cannot be used on a \" + context.kind + \" element\");\n }\n}\n\nvar $mobx = /*#__PURE__*/Symbol(\"mobx administration\");\nvar Atom = /*#__PURE__*/function () {\n /**\n * Create a new atom. For debugging purposes it is recommended to give it a name.\n * The onBecomeObserved and onBecomeUnobserved callbacks can be used for resource management.\n */\n function Atom(name_) {\n if (name_ === void 0) {\n name_ = true ? \"Atom@\" + getNextId() : 0;\n }\n this.name_ = void 0;\n this.flags_ = 0;\n this.observers_ = new Set();\n this.lastAccessedBy_ = 0;\n this.lowestObserverState_ = IDerivationState_.NOT_TRACKING_;\n // onBecomeObservedListeners\n this.onBOL = void 0;\n // onBecomeUnobservedListeners\n this.onBUOL = void 0;\n this.name_ = name_;\n }\n // for effective unobserving. BaseAtom has true, for extra optimization, so its onBecomeUnobserved never gets called, because it's not needed\n var _proto = Atom.prototype;\n _proto.onBO = function onBO() {\n if (this.onBOL) {\n this.onBOL.forEach(function (listener) {\n return listener();\n });\n }\n };\n _proto.onBUO = function onBUO() {\n if (this.onBUOL) {\n this.onBUOL.forEach(function (listener) {\n return listener();\n });\n }\n }\n /**\n * Invoke this method to notify mobx that your atom has been used somehow.\n * Returns true if there is currently a reactive context.\n */;\n _proto.reportObserved = function reportObserved$1() {\n return reportObserved(this);\n }\n /**\n * Invoke this method _after_ this method has changed to signal mobx that all its observers should invalidate.\n */;\n _proto.reportChanged = function reportChanged() {\n startBatch();\n propagateChanged(this);\n endBatch();\n };\n _proto.toString = function toString() {\n return this.name_;\n };\n return _createClass(Atom, [{\n key: \"isBeingObserved\",\n get: function get() {\n return getFlag(this.flags_, Atom.isBeingObservedMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Atom.isBeingObservedMask_, newValue);\n }\n }, {\n key: \"isPendingUnobservation\",\n get: function get() {\n return getFlag(this.flags_, Atom.isPendingUnobservationMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Atom.isPendingUnobservationMask_, newValue);\n }\n }, {\n key: \"diffValue\",\n get: function get() {\n return getFlag(this.flags_, Atom.diffValueMask_) ? 1 : 0;\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Atom.diffValueMask_, newValue === 1 ? true : false);\n }\n }]);\n}();\nAtom.isBeingObservedMask_ = 1;\nAtom.isPendingUnobservationMask_ = 2;\nAtom.diffValueMask_ = 4;\nvar isAtom = /*#__PURE__*/createInstanceofPredicate(\"Atom\", Atom);\nfunction createAtom(name, onBecomeObservedHandler, onBecomeUnobservedHandler) {\n if (onBecomeObservedHandler === void 0) {\n onBecomeObservedHandler = noop;\n }\n if (onBecomeUnobservedHandler === void 0) {\n onBecomeUnobservedHandler = noop;\n }\n var atom = new Atom(name);\n // default `noop` listener will not initialize the hook Set\n if (onBecomeObservedHandler !== noop) {\n onBecomeObserved(atom, onBecomeObservedHandler);\n }\n if (onBecomeUnobservedHandler !== noop) {\n onBecomeUnobserved(atom, onBecomeUnobservedHandler);\n }\n return atom;\n}\n\nfunction identityComparer(a, b) {\n return a === b;\n}\nfunction structuralComparer(a, b) {\n return deepEqual(a, b);\n}\nfunction shallowComparer(a, b) {\n return deepEqual(a, b, 1);\n}\nfunction defaultComparer(a, b) {\n if (Object.is) {\n return Object.is(a, b);\n }\n return a === b ? a !== 0 || 1 / a === 1 / b : a !== a && b !== b;\n}\nvar comparer = {\n identity: identityComparer,\n structural: structuralComparer,\n \"default\": defaultComparer,\n shallow: shallowComparer\n};\n\nfunction deepEnhancer(v, _, name) {\n // it is an observable already, done\n if (isObservable(v)) {\n return v;\n }\n // something that can be converted and mutated?\n if (Array.isArray(v)) {\n return observable.array(v, {\n name: name\n });\n }\n if (isPlainObject(v)) {\n return observable.object(v, undefined, {\n name: name\n });\n }\n if (isES6Map(v)) {\n return observable.map(v, {\n name: name\n });\n }\n if (isES6Set(v)) {\n return observable.set(v, {\n name: name\n });\n }\n if (typeof v === \"function\" && !isAction(v) && !isFlow(v)) {\n if (isGenerator(v)) {\n return flow(v);\n } else {\n return autoAction(name, v);\n }\n }\n return v;\n}\nfunction shallowEnhancer(v, _, name) {\n if (v === undefined || v === null) {\n return v;\n }\n if (isObservableObject(v) || isObservableArray(v) || isObservableMap(v) || isObservableSet(v)) {\n return v;\n }\n if (Array.isArray(v)) {\n return observable.array(v, {\n name: name,\n deep: false\n });\n }\n if (isPlainObject(v)) {\n return observable.object(v, undefined, {\n name: name,\n deep: false\n });\n }\n if (isES6Map(v)) {\n return observable.map(v, {\n name: name,\n deep: false\n });\n }\n if (isES6Set(v)) {\n return observable.set(v, {\n name: name,\n deep: false\n });\n }\n if (true) {\n die(\"The shallow modifier / decorator can only used in combination with arrays, objects, maps and sets\");\n }\n}\nfunction referenceEnhancer(newValue) {\n // never turn into an observable\n return newValue;\n}\nfunction refStructEnhancer(v, oldValue) {\n if ( true && isObservable(v)) {\n die(\"observable.struct should not be used with observable values\");\n }\n if (deepEqual(v, oldValue)) {\n return oldValue;\n }\n return v;\n}\n\nvar OVERRIDE = \"override\";\nvar override = /*#__PURE__*/createDecoratorAnnotation({\n annotationType_: OVERRIDE,\n make_: make_,\n extend_: extend_,\n decorate_20223_: decorate_20223_\n});\nfunction isOverride(annotation) {\n return annotation.annotationType_ === OVERRIDE;\n}\nfunction make_(adm, key) {\n // Must not be plain object\n if ( true && adm.isPlainObject_) {\n die(\"Cannot apply '\" + this.annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + this.annotationType_ + \"' cannot be used on plain objects.\"));\n }\n // Must override something\n if ( true && !hasProp(adm.appliedAnnotations_, key)) {\n die(\"'\" + adm.name_ + \".\" + key.toString() + \"' is annotated with '\" + this.annotationType_ + \"', \" + \"but no such annotated member was found on prototype.\");\n }\n return 0 /* MakeResult.Cancel */;\n}\nfunction extend_(adm, key, descriptor, proxyTrap) {\n die(\"'\" + this.annotationType_ + \"' can only be used with 'makeObservable'\");\n}\nfunction decorate_20223_(desc, context) {\n console.warn(\"'\" + this.annotationType_ + \"' cannot be used with decorators - this is a no-op\");\n}\n\nfunction createActionAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$1,\n extend_: extend_$1,\n decorate_20223_: decorate_20223_$1\n };\n}\nfunction make_$1(adm, key, descriptor, source) {\n var _this$options_;\n // bound\n if ((_this$options_ = this.options_) != null && _this$options_.bound) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;\n }\n // own\n if (source === adm.target_) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 2 /* MakeResult.Continue */;\n }\n // prototype\n if (isAction(descriptor.value)) {\n // A prototype could have been annotated already by other constructor,\n // rest of the proto chain must be annotated already\n return 1 /* MakeResult.Break */;\n }\n var actionDescriptor = createActionDescriptor(adm, this, key, descriptor, false);\n defineProperty(source, key, actionDescriptor);\n return 2 /* MakeResult.Continue */;\n}\nfunction extend_$1(adm, key, descriptor, proxyTrap) {\n var actionDescriptor = createActionDescriptor(adm, this, key, descriptor);\n return adm.defineProperty_(key, actionDescriptor, proxyTrap);\n}\nfunction decorate_20223_$1(mthd, context) {\n if (true) {\n assert20223DecoratorType(context, [\"method\", \"field\"]);\n }\n var kind = context.kind,\n name = context.name,\n addInitializer = context.addInitializer;\n var ann = this;\n var _createAction = function _createAction(m) {\n var _ann$options_$name, _ann$options_, _ann$options_$autoAct, _ann$options_2;\n return createAction((_ann$options_$name = (_ann$options_ = ann.options_) == null ? void 0 : _ann$options_.name) != null ? _ann$options_$name : name.toString(), m, (_ann$options_$autoAct = (_ann$options_2 = ann.options_) == null ? void 0 : _ann$options_2.autoAction) != null ? _ann$options_$autoAct : false);\n };\n if (kind == \"field\") {\n return function (initMthd) {\n var _ann$options_3;\n var mthd = initMthd;\n if (!isAction(mthd)) {\n mthd = _createAction(mthd);\n }\n if ((_ann$options_3 = ann.options_) != null && _ann$options_3.bound) {\n mthd = mthd.bind(this);\n mthd.isMobxAction = true;\n }\n return mthd;\n };\n }\n if (kind == \"method\") {\n var _this$options_2;\n if (!isAction(mthd)) {\n mthd = _createAction(mthd);\n }\n if ((_this$options_2 = this.options_) != null && _this$options_2.bound) {\n addInitializer(function () {\n var self = this;\n var bound = self[name].bind(self);\n bound.isMobxAction = true;\n self[name] = bound;\n });\n }\n return mthd;\n }\n die(\"Cannot apply '\" + ann.annotationType_ + \"' to '\" + String(name) + \"' (kind: \" + kind + \"):\" + (\"\\n'\" + ann.annotationType_ + \"' can only be used on properties with a function value.\"));\n}\nfunction assertActionDescriptor(adm, _ref, key, _ref2) {\n var annotationType_ = _ref.annotationType_;\n var value = _ref2.value;\n if ( true && !isFunction(value)) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' can only be used on properties with a function value.\"));\n }\n}\nfunction createActionDescriptor(adm, annotation, key, descriptor,\n// provides ability to disable safeDescriptors for prototypes\nsafeDescriptors) {\n var _annotation$options_, _annotation$options_$, _annotation$options_2, _annotation$options_$2, _annotation$options_3, _annotation$options_4, _adm$proxy_2;\n if (safeDescriptors === void 0) {\n safeDescriptors = globalState.safeDescriptors;\n }\n assertActionDescriptor(adm, annotation, key, descriptor);\n var value = descriptor.value;\n if ((_annotation$options_ = annotation.options_) != null && _annotation$options_.bound) {\n var _adm$proxy_;\n value = value.bind((_adm$proxy_ = adm.proxy_) != null ? _adm$proxy_ : adm.target_);\n }\n return {\n value: createAction((_annotation$options_$ = (_annotation$options_2 = annotation.options_) == null ? void 0 : _annotation$options_2.name) != null ? _annotation$options_$ : key.toString(), value, (_annotation$options_$2 = (_annotation$options_3 = annotation.options_) == null ? void 0 : _annotation$options_3.autoAction) != null ? _annotation$options_$2 : false,\n // https://github.com/mobxjs/mobx/discussions/3140\n (_annotation$options_4 = annotation.options_) != null && _annotation$options_4.bound ? (_adm$proxy_2 = adm.proxy_) != null ? _adm$proxy_2 : adm.target_ : undefined),\n // Non-configurable for classes\n // prevents accidental field redefinition in subclass\n configurable: safeDescriptors ? adm.isPlainObject_ : true,\n // https://github.com/mobxjs/mobx/pull/2641#issuecomment-737292058\n enumerable: false,\n // Non-obsevable, therefore non-writable\n // Also prevents rewriting in subclass constructor\n writable: safeDescriptors ? false : true\n };\n}\n\nfunction createFlowAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$2,\n extend_: extend_$2,\n decorate_20223_: decorate_20223_$2\n };\n}\nfunction make_$2(adm, key, descriptor, source) {\n var _this$options_;\n // own\n if (source === adm.target_) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 2 /* MakeResult.Continue */;\n }\n // prototype\n // bound - must annotate protos to support super.flow()\n if ((_this$options_ = this.options_) != null && _this$options_.bound && (!hasProp(adm.target_, key) || !isFlow(adm.target_[key]))) {\n if (this.extend_(adm, key, descriptor, false) === null) {\n return 0 /* MakeResult.Cancel */;\n }\n }\n if (isFlow(descriptor.value)) {\n // A prototype could have been annotated already by other constructor,\n // rest of the proto chain must be annotated already\n return 1 /* MakeResult.Break */;\n }\n var flowDescriptor = createFlowDescriptor(adm, this, key, descriptor, false, false);\n defineProperty(source, key, flowDescriptor);\n return 2 /* MakeResult.Continue */;\n}\nfunction extend_$2(adm, key, descriptor, proxyTrap) {\n var _this$options_2;\n var flowDescriptor = createFlowDescriptor(adm, this, key, descriptor, (_this$options_2 = this.options_) == null ? void 0 : _this$options_2.bound);\n return adm.defineProperty_(key, flowDescriptor, proxyTrap);\n}\nfunction decorate_20223_$2(mthd, context) {\n var _this$options_3;\n if (true) {\n assert20223DecoratorType(context, [\"method\"]);\n }\n var name = context.name,\n addInitializer = context.addInitializer;\n if (!isFlow(mthd)) {\n mthd = flow(mthd);\n }\n if ((_this$options_3 = this.options_) != null && _this$options_3.bound) {\n addInitializer(function () {\n var self = this;\n var bound = self[name].bind(self);\n bound.isMobXFlow = true;\n self[name] = bound;\n });\n }\n return mthd;\n}\nfunction assertFlowDescriptor(adm, _ref, key, _ref2) {\n var annotationType_ = _ref.annotationType_;\n var value = _ref2.value;\n if ( true && !isFunction(value)) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' can only be used on properties with a generator function value.\"));\n }\n}\nfunction createFlowDescriptor(adm, annotation, key, descriptor, bound,\n// provides ability to disable safeDescriptors for prototypes\nsafeDescriptors) {\n if (safeDescriptors === void 0) {\n safeDescriptors = globalState.safeDescriptors;\n }\n assertFlowDescriptor(adm, annotation, key, descriptor);\n var value = descriptor.value;\n // In case of flow.bound, the descriptor can be from already annotated prototype\n if (!isFlow(value)) {\n value = flow(value);\n }\n if (bound) {\n var _adm$proxy_;\n // We do not keep original function around, so we bind the existing flow\n value = value.bind((_adm$proxy_ = adm.proxy_) != null ? _adm$proxy_ : adm.target_);\n // This is normally set by `flow`, but `bind` returns new function...\n value.isMobXFlow = true;\n }\n return {\n value: value,\n // Non-configurable for classes\n // prevents accidental field redefinition in subclass\n configurable: safeDescriptors ? adm.isPlainObject_ : true,\n // https://github.com/mobxjs/mobx/pull/2641#issuecomment-737292058\n enumerable: false,\n // Non-obsevable, therefore non-writable\n // Also prevents rewriting in subclass constructor\n writable: safeDescriptors ? false : true\n };\n}\n\nfunction createComputedAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$3,\n extend_: extend_$3,\n decorate_20223_: decorate_20223_$3\n };\n}\nfunction make_$3(adm, key, descriptor) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;\n}\nfunction extend_$3(adm, key, descriptor, proxyTrap) {\n assertComputedDescriptor(adm, this, key, descriptor);\n return adm.defineComputedProperty_(key, _extends({}, this.options_, {\n get: descriptor.get,\n set: descriptor.set\n }), proxyTrap);\n}\nfunction decorate_20223_$3(get, context) {\n if (true) {\n assert20223DecoratorType(context, [\"getter\"]);\n }\n var ann = this;\n var key = context.name,\n addInitializer = context.addInitializer;\n addInitializer(function () {\n var adm = asObservableObject(this)[$mobx];\n var options = _extends({}, ann.options_, {\n get: get,\n context: this\n });\n options.name || (options.name = true ? adm.name_ + \".\" + key.toString() : 0);\n adm.values_.set(key, new ComputedValue(options));\n });\n return function () {\n return this[$mobx].getObservablePropValue_(key);\n };\n}\nfunction assertComputedDescriptor(adm, _ref, key, _ref2) {\n var annotationType_ = _ref.annotationType_;\n var get = _ref2.get;\n if ( true && !get) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' can only be used on getter(+setter) properties.\"));\n }\n}\n\nfunction createObservableAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$4,\n extend_: extend_$4,\n decorate_20223_: decorate_20223_$4\n };\n}\nfunction make_$4(adm, key, descriptor) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;\n}\nfunction extend_$4(adm, key, descriptor, proxyTrap) {\n var _this$options_$enhanc, _this$options_;\n assertObservableDescriptor(adm, this, key, descriptor);\n return adm.defineObservableProperty_(key, descriptor.value, (_this$options_$enhanc = (_this$options_ = this.options_) == null ? void 0 : _this$options_.enhancer) != null ? _this$options_$enhanc : deepEnhancer, proxyTrap);\n}\nfunction decorate_20223_$4(desc, context) {\n if (true) {\n if (context.kind === \"field\") {\n throw die(\"Please use `@observable accessor \" + String(context.name) + \"` instead of `@observable \" + String(context.name) + \"`\");\n }\n assert20223DecoratorType(context, [\"accessor\"]);\n }\n var ann = this;\n var kind = context.kind,\n name = context.name;\n // The laziness here is not ideal... It's a workaround to how 2022.3 Decorators are implemented:\n // `addInitializer` callbacks are executed _before_ any accessors are defined (instead of the ideal-for-us right after each).\n // This means that, if we were to do our stuff in an `addInitializer`, we'd attempt to read a private slot\n // before it has been initialized. The runtime doesn't like that and throws a `Cannot read private member\n // from an object whose class did not declare it` error.\n // TODO: it seems that this will not be required anymore in the final version of the spec\n // See TODO: link\n var initializedObjects = new WeakSet();\n function initializeObservable(target, value) {\n var _ann$options_$enhance, _ann$options_;\n var adm = asObservableObject(target)[$mobx];\n var observable = new ObservableValue(value, (_ann$options_$enhance = (_ann$options_ = ann.options_) == null ? void 0 : _ann$options_.enhancer) != null ? _ann$options_$enhance : deepEnhancer, true ? adm.name_ + \".\" + name.toString() : 0, false);\n adm.values_.set(name, observable);\n initializedObjects.add(target);\n }\n if (kind == \"accessor\") {\n return {\n get: function get() {\n if (!initializedObjects.has(this)) {\n initializeObservable(this, desc.get.call(this));\n }\n return this[$mobx].getObservablePropValue_(name);\n },\n set: function set(value) {\n if (!initializedObjects.has(this)) {\n initializeObservable(this, value);\n }\n return this[$mobx].setObservablePropValue_(name, value);\n },\n init: function init(value) {\n if (!initializedObjects.has(this)) {\n initializeObservable(this, value);\n }\n return value;\n }\n };\n }\n return;\n}\nfunction assertObservableDescriptor(adm, _ref, key, descriptor) {\n var annotationType_ = _ref.annotationType_;\n if ( true && !(\"value\" in descriptor)) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' cannot be used on getter/setter properties\"));\n }\n}\n\nvar AUTO = \"true\";\nvar autoAnnotation = /*#__PURE__*/createAutoAnnotation();\nfunction createAutoAnnotation(options) {\n return {\n annotationType_: AUTO,\n options_: options,\n make_: make_$5,\n extend_: extend_$5,\n decorate_20223_: decorate_20223_$5\n };\n}\nfunction make_$5(adm, key, descriptor, source) {\n var _this$options_3, _this$options_4;\n // getter -> computed\n if (descriptor.get) {\n return computed.make_(adm, key, descriptor, source);\n }\n // lone setter -> action setter\n if (descriptor.set) {\n // TODO make action applicable to setter and delegate to action.make_\n var set = createAction(key.toString(), descriptor.set);\n // own\n if (source === adm.target_) {\n return adm.defineProperty_(key, {\n configurable: globalState.safeDescriptors ? adm.isPlainObject_ : true,\n set: set\n }) === null ? 0 /* MakeResult.Cancel */ : 2 /* MakeResult.Continue */;\n }\n // proto\n defineProperty(source, key, {\n configurable: true,\n set: set\n });\n return 2 /* MakeResult.Continue */;\n }\n // function on proto -> autoAction/flow\n if (source !== adm.target_ && typeof descriptor.value === \"function\") {\n var _this$options_2;\n if (isGenerator(descriptor.value)) {\n var _this$options_;\n var flowAnnotation = (_this$options_ = this.options_) != null && _this$options_.autoBind ? flow.bound : flow;\n return flowAnnotation.make_(adm, key, descriptor, source);\n }\n var actionAnnotation = (_this$options_2 = this.options_) != null && _this$options_2.autoBind ? autoAction.bound : autoAction;\n return actionAnnotation.make_(adm, key, descriptor, source);\n }\n // other -> observable\n // Copy props from proto as well, see test:\n // \"decorate should work with Object.create\"\n var observableAnnotation = ((_this$options_3 = this.options_) == null ? void 0 : _this$options_3.deep) === false ? observable.ref : observable;\n // if function respect autoBind option\n if (typeof descriptor.value === \"function\" && (_this$options_4 = this.options_) != null && _this$options_4.autoBind) {\n var _adm$proxy_;\n descriptor.value = descriptor.value.bind((_adm$proxy_ = adm.proxy_) != null ? _adm$proxy_ : adm.target_);\n }\n return observableAnnotation.make_(adm, key, descriptor, source);\n}\nfunction extend_$5(adm, key, descriptor, proxyTrap) {\n var _this$options_5, _this$options_6;\n // getter -> computed\n if (descriptor.get) {\n return computed.extend_(adm, key, descriptor, proxyTrap);\n }\n // lone setter -> action setter\n if (descriptor.set) {\n // TODO make action applicable to setter and delegate to action.extend_\n return adm.defineProperty_(key, {\n configurable: globalState.safeDescriptors ? adm.isPlainObject_ : true,\n set: createAction(key.toString(), descriptor.set)\n }, proxyTrap);\n }\n // other -> observable\n // if function respect autoBind option\n if (typeof descriptor.value === \"function\" && (_this$options_5 = this.options_) != null && _this$options_5.autoBind) {\n var _adm$proxy_2;\n descriptor.value = descriptor.value.bind((_adm$proxy_2 = adm.proxy_) != null ? _adm$proxy_2 : adm.target_);\n }\n var observableAnnotation = ((_this$options_6 = this.options_) == null ? void 0 : _this$options_6.deep) === false ? observable.ref : observable;\n return observableAnnotation.extend_(adm, key, descriptor, proxyTrap);\n}\nfunction decorate_20223_$5(desc, context) {\n die(\"'\" + this.annotationType_ + \"' cannot be used as a decorator\");\n}\n\nvar OBSERVABLE = \"observable\";\nvar OBSERVABLE_REF = \"observable.ref\";\nvar OBSERVABLE_SHALLOW = \"observable.shallow\";\nvar OBSERVABLE_STRUCT = \"observable.struct\";\n// Predefined bags of create observable options, to avoid allocating temporarily option objects\n// in the majority of cases\nvar defaultCreateObservableOptions = {\n deep: true,\n name: undefined,\n defaultDecorator: undefined,\n proxy: true\n};\nObject.freeze(defaultCreateObservableOptions);\nfunction asCreateObservableOptions(thing) {\n return thing || defaultCreateObservableOptions;\n}\nvar observableAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE);\nvar observableRefAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE_REF, {\n enhancer: referenceEnhancer\n});\nvar observableShallowAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE_SHALLOW, {\n enhancer: shallowEnhancer\n});\nvar observableStructAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE_STRUCT, {\n enhancer: refStructEnhancer\n});\nvar observableDecoratorAnnotation = /*#__PURE__*/createDecoratorAnnotation(observableAnnotation);\nfunction getEnhancerFromOptions(options) {\n return options.deep === true ? deepEnhancer : options.deep === false ? referenceEnhancer : getEnhancerFromAnnotation(options.defaultDecorator);\n}\nfunction getAnnotationFromOptions(options) {\n var _options$defaultDecor;\n return options ? (_options$defaultDecor = options.defaultDecorator) != null ? _options$defaultDecor : createAutoAnnotation(options) : undefined;\n}\nfunction getEnhancerFromAnnotation(annotation) {\n var _annotation$options_$, _annotation$options_;\n return !annotation ? deepEnhancer : (_annotation$options_$ = (_annotation$options_ = annotation.options_) == null ? void 0 : _annotation$options_.enhancer) != null ? _annotation$options_$ : deepEnhancer;\n}\n/**\n * Turns an object, array or function into a reactive structure.\n * @param v the value which should become observable.\n */\nfunction createObservable(v, arg2, arg3) {\n // @observable someProp; (2022.3 Decorators)\n if (is20223Decorator(arg2)) {\n return observableAnnotation.decorate_20223_(v, arg2);\n }\n // @observable someProp;\n if (isStringish(arg2)) {\n storeAnnotation(v, arg2, observableAnnotation);\n return;\n }\n // already observable - ignore\n if (isObservable(v)) {\n return v;\n }\n // plain object\n if (isPlainObject(v)) {\n return observable.object(v, arg2, arg3);\n }\n // Array\n if (Array.isArray(v)) {\n return observable.array(v, arg2);\n }\n // Map\n if (isES6Map(v)) {\n return observable.map(v, arg2);\n }\n // Set\n if (isES6Set(v)) {\n return observable.set(v, arg2);\n }\n // other object - ignore\n if (typeof v === \"object\" && v !== null) {\n return v;\n }\n // anything else\n return observable.box(v, arg2);\n}\nassign(createObservable, observableDecoratorAnnotation);\nvar observableFactories = {\n box: function box(value, options) {\n var o = asCreateObservableOptions(options);\n return new ObservableValue(value, getEnhancerFromOptions(o), o.name, true, o.equals);\n },\n array: function array(initialValues, options) {\n var o = asCreateObservableOptions(options);\n return (globalState.useProxies === false || o.proxy === false ? createLegacyArray : createObservableArray)(initialValues, getEnhancerFromOptions(o), o.name);\n },\n map: function map(initialValues, options) {\n var o = asCreateObservableOptions(options);\n return new ObservableMap(initialValues, getEnhancerFromOptions(o), o.name);\n },\n set: function set(initialValues, options) {\n var o = asCreateObservableOptions(options);\n return new ObservableSet(initialValues, getEnhancerFromOptions(o), o.name);\n },\n object: function object(props, decorators, options) {\n return initObservable(function () {\n return extendObservable(globalState.useProxies === false || (options == null ? void 0 : options.proxy) === false ? asObservableObject({}, options) : asDynamicObservableObject({}, options), props, decorators);\n });\n },\n ref: /*#__PURE__*/createDecoratorAnnotation(observableRefAnnotation),\n shallow: /*#__PURE__*/createDecoratorAnnotation(observableShallowAnnotation),\n deep: observableDecoratorAnnotation,\n struct: /*#__PURE__*/createDecoratorAnnotation(observableStructAnnotation)\n};\n// eslint-disable-next-line\nvar observable = /*#__PURE__*/assign(createObservable, observableFactories);\n\nvar COMPUTED = \"computed\";\nvar COMPUTED_STRUCT = \"computed.struct\";\nvar computedAnnotation = /*#__PURE__*/createComputedAnnotation(COMPUTED);\nvar computedStructAnnotation = /*#__PURE__*/createComputedAnnotation(COMPUTED_STRUCT, {\n equals: comparer.structural\n});\n/**\n * Decorator for class properties: @computed get value() { return expr; }.\n * For legacy purposes also invokable as ES5 observable created: `computed(() => expr)`;\n */\nvar computed = function computed(arg1, arg2) {\n if (is20223Decorator(arg2)) {\n // @computed (2022.3 Decorators)\n return computedAnnotation.decorate_20223_(arg1, arg2);\n }\n if (isStringish(arg2)) {\n // @computed\n return storeAnnotation(arg1, arg2, computedAnnotation);\n }\n if (isPlainObject(arg1)) {\n // @computed({ options })\n return createDecoratorAnnotation(createComputedAnnotation(COMPUTED, arg1));\n }\n // computed(expr, options?)\n if (true) {\n if (!isFunction(arg1)) {\n die(\"First argument to `computed` should be an expression.\");\n }\n if (isFunction(arg2)) {\n die(\"A setter as second argument is no longer supported, use `{ set: fn }` option instead\");\n }\n }\n var opts = isPlainObject(arg2) ? arg2 : {};\n opts.get = arg1;\n opts.name || (opts.name = arg1.name || \"\"); /* for generated name */\n return new ComputedValue(opts);\n};\nObject.assign(computed, computedAnnotation);\ncomputed.struct = /*#__PURE__*/createDecoratorAnnotation(computedStructAnnotation);\n\nvar _getDescriptor$config, _getDescriptor;\n// we don't use globalState for these in order to avoid possible issues with multiple\n// mobx versions\nvar currentActionId = 0;\nvar nextActionId = 1;\nvar isFunctionNameConfigurable = (_getDescriptor$config = (_getDescriptor = /*#__PURE__*/getDescriptor(function () {}, \"name\")) == null ? void 0 : _getDescriptor.configurable) != null ? _getDescriptor$config : false;\n// we can safely recycle this object\nvar tmpNameDescriptor = {\n value: \"action\",\n configurable: true,\n writable: false,\n enumerable: false\n};\nfunction createAction(actionName, fn, autoAction, ref) {\n if (autoAction === void 0) {\n autoAction = false;\n }\n if (true) {\n if (!isFunction(fn)) {\n die(\"`action` can only be invoked on functions\");\n }\n if (typeof actionName !== \"string\" || !actionName) {\n die(\"actions should have valid names, got: '\" + actionName + \"'\");\n }\n }\n function res() {\n return executeAction(actionName, autoAction, fn, ref || this, arguments);\n }\n res.isMobxAction = true;\n res.toString = function () {\n return fn.toString();\n };\n if (isFunctionNameConfigurable) {\n tmpNameDescriptor.value = actionName;\n defineProperty(res, \"name\", tmpNameDescriptor);\n }\n return res;\n}\nfunction executeAction(actionName, canRunAsDerivation, fn, scope, args) {\n var runInfo = _startAction(actionName, canRunAsDerivation, scope, args);\n try {\n return fn.apply(scope, args);\n } catch (err) {\n runInfo.error_ = err;\n throw err;\n } finally {\n _endAction(runInfo);\n }\n}\nfunction _startAction(actionName, canRunAsDerivation,\n// true for autoAction\nscope, args) {\n var notifySpy_ = true && isSpyEnabled() && !!actionName;\n var startTime_ = 0;\n if ( true && notifySpy_) {\n startTime_ = Date.now();\n var flattenedArgs = args ? Array.from(args) : EMPTY_ARRAY;\n spyReportStart({\n type: ACTION,\n name: actionName,\n object: scope,\n arguments: flattenedArgs\n });\n }\n var prevDerivation_ = globalState.trackingDerivation;\n var runAsAction = !canRunAsDerivation || !prevDerivation_;\n startBatch();\n var prevAllowStateChanges_ = globalState.allowStateChanges; // by default preserve previous allow\n if (runAsAction) {\n untrackedStart();\n prevAllowStateChanges_ = allowStateChangesStart(true);\n }\n var prevAllowStateReads_ = allowStateReadsStart(true);\n var runInfo = {\n runAsAction_: runAsAction,\n prevDerivation_: prevDerivation_,\n prevAllowStateChanges_: prevAllowStateChanges_,\n prevAllowStateReads_: prevAllowStateReads_,\n notifySpy_: notifySpy_,\n startTime_: startTime_,\n actionId_: nextActionId++,\n parentActionId_: currentActionId\n };\n currentActionId = runInfo.actionId_;\n return runInfo;\n}\nfunction _endAction(runInfo) {\n if (currentActionId !== runInfo.actionId_) {\n die(30);\n }\n currentActionId = runInfo.parentActionId_;\n if (runInfo.error_ !== undefined) {\n globalState.suppressReactionErrors = true;\n }\n allowStateChangesEnd(runInfo.prevAllowStateChanges_);\n allowStateReadsEnd(runInfo.prevAllowStateReads_);\n endBatch();\n if (runInfo.runAsAction_) {\n untrackedEnd(runInfo.prevDerivation_);\n }\n if ( true && runInfo.notifySpy_) {\n spyReportEnd({\n time: Date.now() - runInfo.startTime_\n });\n }\n globalState.suppressReactionErrors = false;\n}\nfunction allowStateChanges(allowStateChanges, func) {\n var prev = allowStateChangesStart(allowStateChanges);\n try {\n return func();\n } finally {\n allowStateChangesEnd(prev);\n }\n}\nfunction allowStateChangesStart(allowStateChanges) {\n var prev = globalState.allowStateChanges;\n globalState.allowStateChanges = allowStateChanges;\n return prev;\n}\nfunction allowStateChangesEnd(prev) {\n globalState.allowStateChanges = prev;\n}\n\nvar CREATE = \"create\";\nvar ObservableValue = /*#__PURE__*/function (_Atom) {\n function ObservableValue(value, enhancer, name_, notifySpy, equals) {\n var _this;\n if (name_ === void 0) {\n name_ = true ? \"ObservableValue@\" + getNextId() : 0;\n }\n if (notifySpy === void 0) {\n notifySpy = true;\n }\n if (equals === void 0) {\n equals = comparer[\"default\"];\n }\n _this = _Atom.call(this, name_) || this;\n _this.enhancer = void 0;\n _this.name_ = void 0;\n _this.equals = void 0;\n _this.hasUnreportedChange_ = false;\n _this.interceptors_ = void 0;\n _this.changeListeners_ = void 0;\n _this.value_ = void 0;\n _this.dehancer = void 0;\n _this.enhancer = enhancer;\n _this.name_ = name_;\n _this.equals = equals;\n _this.value_ = enhancer(value, undefined, name_);\n if ( true && notifySpy && isSpyEnabled()) {\n // only notify spy if this is a stand-alone observable\n spyReport({\n type: CREATE,\n object: _this,\n observableKind: \"value\",\n debugObjectName: _this.name_,\n newValue: \"\" + _this.value_\n });\n }\n return _this;\n }\n _inheritsLoose(ObservableValue, _Atom);\n var _proto = ObservableValue.prototype;\n _proto.dehanceValue = function dehanceValue(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.set = function set(newValue) {\n var oldValue = this.value_;\n newValue = this.prepareNewValue_(newValue);\n if (newValue !== globalState.UNCHANGED) {\n var notifySpy = isSpyEnabled();\n if ( true && notifySpy) {\n spyReportStart({\n type: UPDATE,\n object: this,\n observableKind: \"value\",\n debugObjectName: this.name_,\n newValue: newValue,\n oldValue: oldValue\n });\n }\n this.setNewValue_(newValue);\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n };\n _proto.prepareNewValue_ = function prepareNewValue_(newValue) {\n checkIfStateModificationsAreAllowed(this);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this,\n type: UPDATE,\n newValue: newValue\n });\n if (!change) {\n return globalState.UNCHANGED;\n }\n newValue = change.newValue;\n }\n // apply modifier\n newValue = this.enhancer(newValue, this.value_, this.name_);\n return this.equals(this.value_, newValue) ? globalState.UNCHANGED : newValue;\n };\n _proto.setNewValue_ = function setNewValue_(newValue) {\n var oldValue = this.value_;\n this.value_ = newValue;\n this.reportChanged();\n if (hasListeners(this)) {\n notifyListeners(this, {\n type: UPDATE,\n object: this,\n newValue: newValue,\n oldValue: oldValue\n });\n }\n };\n _proto.get = function get() {\n this.reportObserved();\n return this.dehanceValue(this.value_);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n if (fireImmediately) {\n listener({\n observableKind: \"value\",\n debugObjectName: this.name_,\n object: this,\n type: UPDATE,\n newValue: this.value_,\n oldValue: undefined\n });\n }\n return registerListener(this, listener);\n };\n _proto.raw = function raw() {\n // used by MST ot get undehanced value\n return this.value_;\n };\n _proto.toJSON = function toJSON() {\n return this.get();\n };\n _proto.toString = function toString() {\n return this.name_ + \"[\" + this.value_ + \"]\";\n };\n _proto.valueOf = function valueOf() {\n return toPrimitive(this.get());\n };\n _proto[Symbol.toPrimitive] = function () {\n return this.valueOf();\n };\n return ObservableValue;\n}(Atom);\nvar isObservableValue = /*#__PURE__*/createInstanceofPredicate(\"ObservableValue\", ObservableValue);\n\n/**\n * A node in the state dependency root that observes other nodes, and can be observed itself.\n *\n * ComputedValue will remember the result of the computation for the duration of the batch, or\n * while being observed.\n *\n * During this time it will recompute only when one of its direct dependencies changed,\n * but only when it is being accessed with `ComputedValue.get()`.\n *\n * Implementation description:\n * 1. First time it's being accessed it will compute and remember result\n * give back remembered result until 2. happens\n * 2. First time any deep dependency change, propagate POSSIBLY_STALE to all observers, wait for 3.\n * 3. When it's being accessed, recompute if any shallow dependency changed.\n * if result changed: propagate STALE to all observers, that were POSSIBLY_STALE from the last step.\n * go to step 2. either way\n *\n * If at any point it's outside batch and it isn't observed: reset everything and go to 1.\n */\nvar ComputedValue = /*#__PURE__*/function () {\n /**\n * Create a new computed value based on a function expression.\n *\n * The `name` property is for debug purposes only.\n *\n * The `equals` property specifies the comparer function to use to determine if a newly produced\n * value differs from the previous value. Two comparers are provided in the library; `defaultComparer`\n * compares based on identity comparison (===), and `structuralComparer` deeply compares the structure.\n * Structural comparison can be convenient if you always produce a new aggregated object and\n * don't want to notify observers if it is structurally the same.\n * This is useful for working with vectors, mouse coordinates etc.\n */\n function ComputedValue(options) {\n this.dependenciesState_ = IDerivationState_.NOT_TRACKING_;\n this.observing_ = [];\n // nodes we are looking at. Our value depends on these nodes\n this.newObserving_ = null;\n // during tracking it's an array with new observed observers\n this.observers_ = new Set();\n this.runId_ = 0;\n this.lastAccessedBy_ = 0;\n this.lowestObserverState_ = IDerivationState_.UP_TO_DATE_;\n this.unboundDepsCount_ = 0;\n this.value_ = new CaughtException(null);\n this.name_ = void 0;\n this.triggeredBy_ = void 0;\n this.flags_ = 0;\n this.derivation = void 0;\n // N.B: unminified as it is used by MST\n this.setter_ = void 0;\n this.isTracing_ = TraceMode.NONE;\n this.scope_ = void 0;\n this.equals_ = void 0;\n this.requiresReaction_ = void 0;\n this.keepAlive_ = void 0;\n this.onBOL = void 0;\n this.onBUOL = void 0;\n if (!options.get) {\n die(31);\n }\n this.derivation = options.get;\n this.name_ = options.name || ( true ? \"ComputedValue@\" + getNextId() : 0);\n if (options.set) {\n this.setter_ = createAction( true ? this.name_ + \"-setter\" : 0, options.set);\n }\n this.equals_ = options.equals || (options.compareStructural || options.struct ? comparer.structural : comparer[\"default\"]);\n this.scope_ = options.context;\n this.requiresReaction_ = options.requiresReaction;\n this.keepAlive_ = !!options.keepAlive;\n }\n var _proto = ComputedValue.prototype;\n _proto.onBecomeStale_ = function onBecomeStale_() {\n propagateMaybeChanged(this);\n };\n _proto.onBO = function onBO() {\n if (this.onBOL) {\n this.onBOL.forEach(function (listener) {\n return listener();\n });\n }\n };\n _proto.onBUO = function onBUO() {\n if (this.onBUOL) {\n this.onBUOL.forEach(function (listener) {\n return listener();\n });\n }\n }\n // to check for cycles\n ;\n /**\n * Returns the current value of this computed value.\n * Will evaluate its computation first if needed.\n */\n _proto.get = function get() {\n if (this.isComputing) {\n die(32, this.name_, this.derivation);\n }\n if (globalState.inBatch === 0 &&\n // !globalState.trackingDerivatpion &&\n this.observers_.size === 0 && !this.keepAlive_) {\n if (shouldCompute(this)) {\n this.warnAboutUntrackedRead_();\n startBatch(); // See perf test 'computed memoization'\n this.value_ = this.computeValue_(false);\n endBatch();\n }\n } else {\n reportObserved(this);\n if (shouldCompute(this)) {\n var prevTrackingContext = globalState.trackingContext;\n if (this.keepAlive_ && !prevTrackingContext) {\n globalState.trackingContext = this;\n }\n if (this.trackAndCompute()) {\n propagateChangeConfirmed(this);\n }\n globalState.trackingContext = prevTrackingContext;\n }\n }\n var result = this.value_;\n if (isCaughtException(result)) {\n throw result.cause;\n }\n return result;\n };\n _proto.set = function set(value) {\n if (this.setter_) {\n if (this.isRunningSetter) {\n die(33, this.name_);\n }\n this.isRunningSetter = true;\n try {\n this.setter_.call(this.scope_, value);\n } finally {\n this.isRunningSetter = false;\n }\n } else {\n die(34, this.name_);\n }\n };\n _proto.trackAndCompute = function trackAndCompute() {\n // N.B: unminified as it is used by MST\n var oldValue = this.value_;\n var wasSuspended = /* see #1208 */this.dependenciesState_ === IDerivationState_.NOT_TRACKING_;\n var newValue = this.computeValue_(true);\n var changed = wasSuspended || isCaughtException(oldValue) || isCaughtException(newValue) || !this.equals_(oldValue, newValue);\n if (changed) {\n this.value_ = newValue;\n if ( true && isSpyEnabled()) {\n spyReport({\n observableKind: \"computed\",\n debugObjectName: this.name_,\n object: this.scope_,\n type: \"update\",\n oldValue: oldValue,\n newValue: newValue\n });\n }\n }\n return changed;\n };\n _proto.computeValue_ = function computeValue_(track) {\n this.isComputing = true;\n // don't allow state changes during computation\n var prev = allowStateChangesStart(false);\n var res;\n if (track) {\n res = trackDerivedFunction(this, this.derivation, this.scope_);\n } else {\n if (globalState.disableErrorBoundaries === true) {\n res = this.derivation.call(this.scope_);\n } else {\n try {\n res = this.derivation.call(this.scope_);\n } catch (e) {\n res = new CaughtException(e);\n }\n }\n }\n allowStateChangesEnd(prev);\n this.isComputing = false;\n return res;\n };\n _proto.suspend_ = function suspend_() {\n if (!this.keepAlive_) {\n clearObserving(this);\n this.value_ = undefined; // don't hold on to computed value!\n if ( true && this.isTracing_ !== TraceMode.NONE) {\n console.log(\"[mobx.trace] Computed value '\" + this.name_ + \"' was suspended and it will recompute on the next access.\");\n }\n }\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n var _this = this;\n var firstTime = true;\n var prevValue = undefined;\n return autorun(function () {\n // TODO: why is this in a different place than the spyReport() function? in all other observables it's called in the same place\n var newValue = _this.get();\n if (!firstTime || fireImmediately) {\n var prevU = untrackedStart();\n listener({\n observableKind: \"computed\",\n debugObjectName: _this.name_,\n type: UPDATE,\n object: _this,\n newValue: newValue,\n oldValue: prevValue\n });\n untrackedEnd(prevU);\n }\n firstTime = false;\n prevValue = newValue;\n });\n };\n _proto.warnAboutUntrackedRead_ = function warnAboutUntrackedRead_() {\n if (false) {}\n if (this.isTracing_ !== TraceMode.NONE) {\n console.log(\"[mobx.trace] Computed value '\" + this.name_ + \"' is being read outside a reactive context. Doing a full recompute.\");\n }\n if (typeof this.requiresReaction_ === \"boolean\" ? this.requiresReaction_ : globalState.computedRequiresReaction) {\n console.warn(\"[mobx] Computed value '\" + this.name_ + \"' is being read outside a reactive context. Doing a full recompute.\");\n }\n };\n _proto.toString = function toString() {\n return this.name_ + \"[\" + this.derivation.toString() + \"]\";\n };\n _proto.valueOf = function valueOf() {\n return toPrimitive(this.get());\n };\n _proto[Symbol.toPrimitive] = function () {\n return this.valueOf();\n };\n return _createClass(ComputedValue, [{\n key: \"isComputing\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isComputingMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isComputingMask_, newValue);\n }\n }, {\n key: \"isRunningSetter\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isRunningSetterMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isRunningSetterMask_, newValue);\n }\n }, {\n key: \"isBeingObserved\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isBeingObservedMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isBeingObservedMask_, newValue);\n }\n }, {\n key: \"isPendingUnobservation\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isPendingUnobservationMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isPendingUnobservationMask_, newValue);\n }\n }, {\n key: \"diffValue\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.diffValueMask_) ? 1 : 0;\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.diffValueMask_, newValue === 1 ? true : false);\n }\n }]);\n}();\nComputedValue.isComputingMask_ = 1;\nComputedValue.isRunningSetterMask_ = 2;\nComputedValue.isBeingObservedMask_ = 4;\nComputedValue.isPendingUnobservationMask_ = 8;\nComputedValue.diffValueMask_ = 16;\nvar isComputedValue = /*#__PURE__*/createInstanceofPredicate(\"ComputedValue\", ComputedValue);\n\nvar IDerivationState_;\n(function (IDerivationState_) {\n // before being run or (outside batch and not being observed)\n // at this point derivation is not holding any data about dependency tree\n IDerivationState_[IDerivationState_[\"NOT_TRACKING_\"] = -1] = \"NOT_TRACKING_\";\n // no shallow dependency changed since last computation\n // won't recalculate derivation\n // this is what makes mobx fast\n IDerivationState_[IDerivationState_[\"UP_TO_DATE_\"] = 0] = \"UP_TO_DATE_\";\n // some deep dependency changed, but don't know if shallow dependency changed\n // will require to check first if UP_TO_DATE or POSSIBLY_STALE\n // currently only ComputedValue will propagate POSSIBLY_STALE\n //\n // having this state is second big optimization:\n // don't have to recompute on every dependency change, but only when it's needed\n IDerivationState_[IDerivationState_[\"POSSIBLY_STALE_\"] = 1] = \"POSSIBLY_STALE_\";\n // A shallow dependency has changed since last computation and the derivation\n // will need to recompute when it's needed next.\n IDerivationState_[IDerivationState_[\"STALE_\"] = 2] = \"STALE_\";\n})(IDerivationState_ || (IDerivationState_ = {}));\nvar TraceMode;\n(function (TraceMode) {\n TraceMode[TraceMode[\"NONE\"] = 0] = \"NONE\";\n TraceMode[TraceMode[\"LOG\"] = 1] = \"LOG\";\n TraceMode[TraceMode[\"BREAK\"] = 2] = \"BREAK\";\n})(TraceMode || (TraceMode = {}));\nvar CaughtException = function CaughtException(cause) {\n this.cause = void 0;\n this.cause = cause;\n // Empty\n};\nfunction isCaughtException(e) {\n return e instanceof CaughtException;\n}\n/**\n * Finds out whether any dependency of the derivation has actually changed.\n * If dependenciesState is 1 then it will recalculate dependencies,\n * if any dependency changed it will propagate it by changing dependenciesState to 2.\n *\n * By iterating over the dependencies in the same order that they were reported and\n * stopping on the first change, all the recalculations are only called for ComputedValues\n * that will be tracked by derivation. That is because we assume that if the first x\n * dependencies of the derivation doesn't change then the derivation should run the same way\n * up until accessing x-th dependency.\n */\nfunction shouldCompute(derivation) {\n switch (derivation.dependenciesState_) {\n case IDerivationState_.UP_TO_DATE_:\n return false;\n case IDerivationState_.NOT_TRACKING_:\n case IDerivationState_.STALE_:\n return true;\n case IDerivationState_.POSSIBLY_STALE_:\n {\n // state propagation can occur outside of action/reactive context #2195\n var prevAllowStateReads = allowStateReadsStart(true);\n var prevUntracked = untrackedStart(); // no need for those computeds to be reported, they will be picked up in trackDerivedFunction.\n var obs = derivation.observing_,\n l = obs.length;\n for (var i = 0; i < l; i++) {\n var obj = obs[i];\n if (isComputedValue(obj)) {\n if (globalState.disableErrorBoundaries) {\n obj.get();\n } else {\n try {\n obj.get();\n } catch (e) {\n // we are not interested in the value *or* exception at this moment, but if there is one, notify all\n untrackedEnd(prevUntracked);\n allowStateReadsEnd(prevAllowStateReads);\n return true;\n }\n }\n // if ComputedValue `obj` actually changed it will be computed and propagated to its observers.\n // and `derivation` is an observer of `obj`\n // invariantShouldCompute(derivation)\n if (derivation.dependenciesState_ === IDerivationState_.STALE_) {\n untrackedEnd(prevUntracked);\n allowStateReadsEnd(prevAllowStateReads);\n return true;\n }\n }\n }\n changeDependenciesStateTo0(derivation);\n untrackedEnd(prevUntracked);\n allowStateReadsEnd(prevAllowStateReads);\n return false;\n }\n }\n}\nfunction isComputingDerivation() {\n return globalState.trackingDerivation !== null; // filter out actions inside computations\n}\nfunction checkIfStateModificationsAreAllowed(atom) {\n if (false) {}\n var hasObservers = atom.observers_.size > 0;\n // Should not be possible to change observed state outside strict mode, except during initialization, see #563\n if (!globalState.allowStateChanges && (hasObservers || globalState.enforceActions === \"always\")) {\n console.warn(\"[MobX] \" + (globalState.enforceActions ? \"Since strict-mode is enabled, changing (observed) observable values without using an action is not allowed. Tried to modify: \" : \"Side effects like changing state are not allowed at this point. Are you trying to modify state from, for example, a computed value or the render function of a React component? You can wrap side effects in 'runInAction' (or decorate functions with 'action') if needed. Tried to modify: \") + atom.name_);\n }\n}\nfunction checkIfStateReadsAreAllowed(observable) {\n if ( true && !globalState.allowStateReads && globalState.observableRequiresReaction) {\n console.warn(\"[mobx] Observable '\" + observable.name_ + \"' being read outside a reactive context.\");\n }\n}\n/**\n * Executes the provided function `f` and tracks which observables are being accessed.\n * The tracking information is stored on the `derivation` object and the derivation is registered\n * as observer of any of the accessed observables.\n */\nfunction trackDerivedFunction(derivation, f, context) {\n var prevAllowStateReads = allowStateReadsStart(true);\n changeDependenciesStateTo0(derivation);\n // Preallocate array; will be trimmed by bindDependencies.\n derivation.newObserving_ = new Array(\n // Reserve constant space for initial dependencies, dynamic space otherwise.\n // See https://github.com/mobxjs/mobx/pull/3833\n derivation.runId_ === 0 ? 100 : derivation.observing_.length);\n derivation.unboundDepsCount_ = 0;\n derivation.runId_ = ++globalState.runId;\n var prevTracking = globalState.trackingDerivation;\n globalState.trackingDerivation = derivation;\n globalState.inBatch++;\n var result;\n if (globalState.disableErrorBoundaries === true) {\n result = f.call(context);\n } else {\n try {\n result = f.call(context);\n } catch (e) {\n result = new CaughtException(e);\n }\n }\n globalState.inBatch--;\n globalState.trackingDerivation = prevTracking;\n bindDependencies(derivation);\n warnAboutDerivationWithoutDependencies(derivation);\n allowStateReadsEnd(prevAllowStateReads);\n return result;\n}\nfunction warnAboutDerivationWithoutDependencies(derivation) {\n if (false) {}\n if (derivation.observing_.length !== 0) {\n return;\n }\n if (typeof derivation.requiresObservable_ === \"boolean\" ? derivation.requiresObservable_ : globalState.reactionRequiresObservable) {\n console.warn(\"[mobx] Derivation '\" + derivation.name_ + \"' is created/updated without reading any observable value.\");\n }\n}\n/**\n * diffs newObserving with observing.\n * update observing to be newObserving with unique observables\n * notify observers that become observed/unobserved\n */\nfunction bindDependencies(derivation) {\n // invariant(derivation.dependenciesState !== IDerivationState.NOT_TRACKING, \"INTERNAL ERROR bindDependencies expects derivation.dependenciesState !== -1\");\n var prevObserving = derivation.observing_;\n var observing = derivation.observing_ = derivation.newObserving_;\n var lowestNewObservingDerivationState = IDerivationState_.UP_TO_DATE_;\n // Go through all new observables and check diffValue: (this list can contain duplicates):\n // 0: first occurrence, change to 1 and keep it\n // 1: extra occurrence, drop it\n var i0 = 0,\n l = derivation.unboundDepsCount_;\n for (var i = 0; i < l; i++) {\n var dep = observing[i];\n if (dep.diffValue === 0) {\n dep.diffValue = 1;\n if (i0 !== i) {\n observing[i0] = dep;\n }\n i0++;\n }\n // Upcast is 'safe' here, because if dep is IObservable, `dependenciesState` will be undefined,\n // not hitting the condition\n if (dep.dependenciesState_ > lowestNewObservingDerivationState) {\n lowestNewObservingDerivationState = dep.dependenciesState_;\n }\n }\n observing.length = i0;\n derivation.newObserving_ = null; // newObserving shouldn't be needed outside tracking (statement moved down to work around FF bug, see #614)\n // Go through all old observables and check diffValue: (it is unique after last bindDependencies)\n // 0: it's not in new observables, unobserve it\n // 1: it keeps being observed, don't want to notify it. change to 0\n l = prevObserving.length;\n while (l--) {\n var _dep = prevObserving[l];\n if (_dep.diffValue === 0) {\n removeObserver(_dep, derivation);\n }\n _dep.diffValue = 0;\n }\n // Go through all new observables and check diffValue: (now it should be unique)\n // 0: it was set to 0 in last loop. don't need to do anything.\n // 1: it wasn't observed, let's observe it. set back to 0\n while (i0--) {\n var _dep2 = observing[i0];\n if (_dep2.diffValue === 1) {\n _dep2.diffValue = 0;\n addObserver(_dep2, derivation);\n }\n }\n // Some new observed derivations may become stale during this derivation computation\n // so they have had no chance to propagate staleness (#916)\n if (lowestNewObservingDerivationState !== IDerivationState_.UP_TO_DATE_) {\n derivation.dependenciesState_ = lowestNewObservingDerivationState;\n derivation.onBecomeStale_();\n }\n}\nfunction clearObserving(derivation) {\n // invariant(globalState.inBatch > 0, \"INTERNAL ERROR clearObserving should be called only inside batch\");\n var obs = derivation.observing_;\n derivation.observing_ = [];\n var i = obs.length;\n while (i--) {\n removeObserver(obs[i], derivation);\n }\n derivation.dependenciesState_ = IDerivationState_.NOT_TRACKING_;\n}\nfunction untracked(action) {\n var prev = untrackedStart();\n try {\n return action();\n } finally {\n untrackedEnd(prev);\n }\n}\nfunction untrackedStart() {\n var prev = globalState.trackingDerivation;\n globalState.trackingDerivation = null;\n return prev;\n}\nfunction untrackedEnd(prev) {\n globalState.trackingDerivation = prev;\n}\nfunction allowStateReadsStart(allowStateReads) {\n var prev = globalState.allowStateReads;\n globalState.allowStateReads = allowStateReads;\n return prev;\n}\nfunction allowStateReadsEnd(prev) {\n globalState.allowStateReads = prev;\n}\n/**\n * needed to keep `lowestObserverState` correct. when changing from (2 or 1) to 0\n *\n */\nfunction changeDependenciesStateTo0(derivation) {\n if (derivation.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {\n return;\n }\n derivation.dependenciesState_ = IDerivationState_.UP_TO_DATE_;\n var obs = derivation.observing_;\n var i = obs.length;\n while (i--) {\n obs[i].lowestObserverState_ = IDerivationState_.UP_TO_DATE_;\n }\n}\n\n/**\n * These values will persist if global state is reset\n */\nvar persistentKeys = [\"mobxGuid\", \"spyListeners\", \"enforceActions\", \"computedRequiresReaction\", \"reactionRequiresObservable\", \"observableRequiresReaction\", \"allowStateReads\", \"disableErrorBoundaries\", \"runId\", \"UNCHANGED\", \"useProxies\"];\nvar MobXGlobals = function MobXGlobals() {\n /**\n * MobXGlobals version.\n * MobX compatiblity with other versions loaded in memory as long as this version matches.\n * It indicates that the global state still stores similar information\n *\n * N.B: this version is unrelated to the package version of MobX, and is only the version of the\n * internal state storage of MobX, and can be the same across many different package versions\n */\n this.version = 6;\n /**\n * globally unique token to signal unchanged\n */\n this.UNCHANGED = {};\n /**\n * Currently running derivation\n */\n this.trackingDerivation = null;\n /**\n * Currently running reaction. This determines if we currently have a reactive context.\n * (Tracking derivation is also set for temporal tracking of computed values inside actions,\n * but trackingReaction can only be set by a form of Reaction)\n */\n this.trackingContext = null;\n /**\n * Each time a derivation is tracked, it is assigned a unique run-id\n */\n this.runId = 0;\n /**\n * 'guid' for general purpose. Will be persisted amongst resets.\n */\n this.mobxGuid = 0;\n /**\n * Are we in a batch block? (and how many of them)\n */\n this.inBatch = 0;\n /**\n * Observables that don't have observers anymore, and are about to be\n * suspended, unless somebody else accesses it in the same batch\n *\n * @type {IObservable[]}\n */\n this.pendingUnobservations = [];\n /**\n * List of scheduled, not yet executed, reactions.\n */\n this.pendingReactions = [];\n /**\n * Are we currently processing reactions?\n */\n this.isRunningReactions = false;\n /**\n * Is it allowed to change observables at this point?\n * In general, MobX doesn't allow that when running computations and React.render.\n * To ensure that those functions stay pure.\n */\n this.allowStateChanges = false;\n /**\n * Is it allowed to read observables at this point?\n * Used to hold the state needed for `observableRequiresReaction`\n */\n this.allowStateReads = true;\n /**\n * If strict mode is enabled, state changes are by default not allowed\n */\n this.enforceActions = true;\n /**\n * Spy callbacks\n */\n this.spyListeners = [];\n /**\n * Globally attached error handlers that react specifically to errors in reactions\n */\n this.globalReactionErrorHandlers = [];\n /**\n * Warn if computed values are accessed outside a reactive context\n */\n this.computedRequiresReaction = false;\n /**\n * (Experimental)\n * Warn if you try to create to derivation / reactive context without accessing any observable.\n */\n this.reactionRequiresObservable = false;\n /**\n * (Experimental)\n * Warn if observables are accessed outside a reactive context\n */\n this.observableRequiresReaction = false;\n /*\n * Don't catch and rethrow exceptions. This is useful for inspecting the state of\n * the stack when an exception occurs while debugging.\n */\n this.disableErrorBoundaries = false;\n /*\n * If true, we are already handling an exception in an action. Any errors in reactions should be suppressed, as\n * they are not the cause, see: https://github.com/mobxjs/mobx/issues/1836\n */\n this.suppressReactionErrors = false;\n this.useProxies = true;\n /*\n * print warnings about code that would fail if proxies weren't available\n */\n this.verifyProxies = false;\n /**\n * False forces all object's descriptors to\n * writable: true\n * configurable: true\n */\n this.safeDescriptors = true;\n};\nvar canMergeGlobalState = true;\nvar isolateCalled = false;\nvar globalState = /*#__PURE__*/function () {\n var global = /*#__PURE__*/getGlobal();\n if (global.__mobxInstanceCount > 0 && !global.__mobxGlobals) {\n canMergeGlobalState = false;\n }\n if (global.__mobxGlobals && global.__mobxGlobals.version !== new MobXGlobals().version) {\n canMergeGlobalState = false;\n }\n if (!canMergeGlobalState) {\n // Because this is a IIFE we need to let isolateCalled a chance to change\n // so we run it after the event loop completed at least 1 iteration\n setTimeout(function () {\n if (!isolateCalled) {\n die(35);\n }\n }, 1);\n return new MobXGlobals();\n } else if (global.__mobxGlobals) {\n global.__mobxInstanceCount += 1;\n if (!global.__mobxGlobals.UNCHANGED) {\n global.__mobxGlobals.UNCHANGED = {};\n } // make merge backward compatible\n return global.__mobxGlobals;\n } else {\n global.__mobxInstanceCount = 1;\n return global.__mobxGlobals = /*#__PURE__*/new MobXGlobals();\n }\n}();\nfunction isolateGlobalState() {\n if (globalState.pendingReactions.length || globalState.inBatch || globalState.isRunningReactions) {\n die(36);\n }\n isolateCalled = true;\n if (canMergeGlobalState) {\n var global = getGlobal();\n if (--global.__mobxInstanceCount === 0) {\n global.__mobxGlobals = undefined;\n }\n globalState = new MobXGlobals();\n }\n}\nfunction getGlobalState() {\n return globalState;\n}\n/**\n * For testing purposes only; this will break the internal state of existing observables,\n * but can be used to get back at a stable state after throwing errors\n */\nfunction resetGlobalState() {\n var defaultGlobals = new MobXGlobals();\n for (var key in defaultGlobals) {\n if (persistentKeys.indexOf(key) === -1) {\n globalState[key] = defaultGlobals[key];\n }\n }\n globalState.allowStateChanges = !globalState.enforceActions;\n}\n\nfunction hasObservers(observable) {\n return observable.observers_ && observable.observers_.size > 0;\n}\nfunction getObservers(observable) {\n return observable.observers_;\n}\n// function invariantObservers(observable: IObservable) {\n// const list = observable.observers\n// const map = observable.observersIndexes\n// const l = list.length\n// for (let i = 0; i < l; i++) {\n// const id = list[i].__mapid\n// if (i) {\n// invariant(map[id] === i, \"INTERNAL ERROR maps derivation.__mapid to index in list\") // for performance\n// } else {\n// invariant(!(id in map), \"INTERNAL ERROR observer on index 0 shouldn't be held in map.\") // for performance\n// }\n// }\n// invariant(\n// list.length === 0 || Object.keys(map).length === list.length - 1,\n// \"INTERNAL ERROR there is no junk in map\"\n// )\n// }\nfunction addObserver(observable, node) {\n // invariant(node.dependenciesState !== -1, \"INTERNAL ERROR, can add only dependenciesState !== -1\");\n // invariant(observable._observers.indexOf(node) === -1, \"INTERNAL ERROR add already added node\");\n // invariantObservers(observable);\n observable.observers_.add(node);\n if (observable.lowestObserverState_ > node.dependenciesState_) {\n observable.lowestObserverState_ = node.dependenciesState_;\n }\n // invariantObservers(observable);\n // invariant(observable._observers.indexOf(node) !== -1, \"INTERNAL ERROR didn't add node\");\n}\nfunction removeObserver(observable, node) {\n // invariant(globalState.inBatch > 0, \"INTERNAL ERROR, remove should be called only inside batch\");\n // invariant(observable._observers.indexOf(node) !== -1, \"INTERNAL ERROR remove already removed node\");\n // invariantObservers(observable);\n observable.observers_[\"delete\"](node);\n if (observable.observers_.size === 0) {\n // deleting last observer\n queueForUnobservation(observable);\n }\n // invariantObservers(observable);\n // invariant(observable._observers.indexOf(node) === -1, \"INTERNAL ERROR remove already removed node2\");\n}\nfunction queueForUnobservation(observable) {\n if (observable.isPendingUnobservation === false) {\n // invariant(observable._observers.length === 0, \"INTERNAL ERROR, should only queue for unobservation unobserved observables\");\n observable.isPendingUnobservation = true;\n globalState.pendingUnobservations.push(observable);\n }\n}\n/**\n * Batch starts a transaction, at least for purposes of memoizing ComputedValues when nothing else does.\n * During a batch `onBecomeUnobserved` will be called at most once per observable.\n * Avoids unnecessary recalculations.\n */\nfunction startBatch() {\n globalState.inBatch++;\n}\nfunction endBatch() {\n if (--globalState.inBatch === 0) {\n runReactions();\n // the batch is actually about to finish, all unobserving should happen here.\n var list = globalState.pendingUnobservations;\n for (var i = 0; i < list.length; i++) {\n var observable = list[i];\n observable.isPendingUnobservation = false;\n if (observable.observers_.size === 0) {\n if (observable.isBeingObserved) {\n // if this observable had reactive observers, trigger the hooks\n observable.isBeingObserved = false;\n observable.onBUO();\n }\n if (observable instanceof ComputedValue) {\n // computed values are automatically teared down when the last observer leaves\n // this process happens recursively, this computed might be the last observabe of another, etc..\n observable.suspend_();\n }\n }\n }\n globalState.pendingUnobservations = [];\n }\n}\nfunction reportObserved(observable) {\n checkIfStateReadsAreAllowed(observable);\n var derivation = globalState.trackingDerivation;\n if (derivation !== null) {\n /**\n * Simple optimization, give each derivation run an unique id (runId)\n * Check if last time this observable was accessed the same runId is used\n * if this is the case, the relation is already known\n */\n if (derivation.runId_ !== observable.lastAccessedBy_) {\n observable.lastAccessedBy_ = derivation.runId_;\n // Tried storing newObserving, or observing, or both as Set, but performance didn't come close...\n derivation.newObserving_[derivation.unboundDepsCount_++] = observable;\n if (!observable.isBeingObserved && globalState.trackingContext) {\n observable.isBeingObserved = true;\n observable.onBO();\n }\n }\n return observable.isBeingObserved;\n } else if (observable.observers_.size === 0 && globalState.inBatch > 0) {\n queueForUnobservation(observable);\n }\n return false;\n}\n// function invariantLOS(observable: IObservable, msg: string) {\n// // it's expensive so better not run it in produciton. but temporarily helpful for testing\n// const min = getObservers(observable).reduce((a, b) => Math.min(a, b.dependenciesState), 2)\n// if (min >= observable.lowestObserverState) return // <- the only assumption about `lowestObserverState`\n// throw new Error(\n// \"lowestObserverState is wrong for \" +\n// msg +\n// \" because \" +\n// min +\n// \" < \" +\n// observable.lowestObserverState\n// )\n// }\n/**\n * NOTE: current propagation mechanism will in case of self reruning autoruns behave unexpectedly\n * It will propagate changes to observers from previous run\n * It's hard or maybe impossible (with reasonable perf) to get it right with current approach\n * Hopefully self reruning autoruns aren't a feature people should depend on\n * Also most basic use cases should be ok\n */\n// Called by Atom when its value changes\nfunction propagateChanged(observable) {\n // invariantLOS(observable, \"changed start\");\n if (observable.lowestObserverState_ === IDerivationState_.STALE_) {\n return;\n }\n observable.lowestObserverState_ = IDerivationState_.STALE_;\n // Ideally we use for..of here, but the downcompiled version is really slow...\n observable.observers_.forEach(function (d) {\n if (d.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {\n if ( true && d.isTracing_ !== TraceMode.NONE) {\n logTraceInfo(d, observable);\n }\n d.onBecomeStale_();\n }\n d.dependenciesState_ = IDerivationState_.STALE_;\n });\n // invariantLOS(observable, \"changed end\");\n}\n// Called by ComputedValue when it recalculate and its value changed\nfunction propagateChangeConfirmed(observable) {\n // invariantLOS(observable, \"confirmed start\");\n if (observable.lowestObserverState_ === IDerivationState_.STALE_) {\n return;\n }\n observable.lowestObserverState_ = IDerivationState_.STALE_;\n observable.observers_.forEach(function (d) {\n if (d.dependenciesState_ === IDerivationState_.POSSIBLY_STALE_) {\n d.dependenciesState_ = IDerivationState_.STALE_;\n if ( true && d.isTracing_ !== TraceMode.NONE) {\n logTraceInfo(d, observable);\n }\n } else if (d.dependenciesState_ === IDerivationState_.UP_TO_DATE_ // this happens during computing of `d`, just keep lowestObserverState up to date.\n ) {\n observable.lowestObserverState_ = IDerivationState_.UP_TO_DATE_;\n }\n });\n // invariantLOS(observable, \"confirmed end\");\n}\n// Used by computed when its dependency changed, but we don't wan't to immediately recompute.\nfunction propagateMaybeChanged(observable) {\n // invariantLOS(observable, \"maybe start\");\n if (observable.lowestObserverState_ !== IDerivationState_.UP_TO_DATE_) {\n return;\n }\n observable.lowestObserverState_ = IDerivationState_.POSSIBLY_STALE_;\n observable.observers_.forEach(function (d) {\n if (d.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {\n d.dependenciesState_ = IDerivationState_.POSSIBLY_STALE_;\n d.onBecomeStale_();\n }\n });\n // invariantLOS(observable, \"maybe end\");\n}\nfunction logTraceInfo(derivation, observable) {\n console.log(\"[mobx.trace] '\" + derivation.name_ + \"' is invalidated due to a change in: '\" + observable.name_ + \"'\");\n if (derivation.isTracing_ === TraceMode.BREAK) {\n var lines = [];\n printDepTree(getDependencyTree(derivation), lines, 1);\n // prettier-ignore\n new Function(\"debugger;\\n/*\\nTracing '\" + derivation.name_ + \"'\\n\\nYou are entering this break point because derivation '\" + derivation.name_ + \"' is being traced and '\" + observable.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\" + (derivation instanceof ComputedValue ? derivation.derivation.toString().replace(/[*]\\//g, \"/\") : \"\") + \"\\n\\nThe dependencies for this derivation are:\\n\\n\" + lines.join(\"\\n\") + \"\\n*/\\n \")();\n }\n}\nfunction printDepTree(tree, lines, depth) {\n if (lines.length >= 1000) {\n lines.push(\"(and many more)\");\n return;\n }\n lines.push(\"\" + \"\\t\".repeat(depth - 1) + tree.name);\n if (tree.dependencies) {\n tree.dependencies.forEach(function (child) {\n return printDepTree(child, lines, depth + 1);\n });\n }\n}\n\nvar Reaction = /*#__PURE__*/function () {\n function Reaction(name_, onInvalidate_, errorHandler_, requiresObservable_) {\n if (name_ === void 0) {\n name_ = true ? \"Reaction@\" + getNextId() : 0;\n }\n this.name_ = void 0;\n this.onInvalidate_ = void 0;\n this.errorHandler_ = void 0;\n this.requiresObservable_ = void 0;\n this.observing_ = [];\n // nodes we are looking at. Our value depends on these nodes\n this.newObserving_ = [];\n this.dependenciesState_ = IDerivationState_.NOT_TRACKING_;\n this.runId_ = 0;\n this.unboundDepsCount_ = 0;\n this.flags_ = 0;\n this.isTracing_ = TraceMode.NONE;\n this.name_ = name_;\n this.onInvalidate_ = onInvalidate_;\n this.errorHandler_ = errorHandler_;\n this.requiresObservable_ = requiresObservable_;\n }\n var _proto = Reaction.prototype;\n _proto.onBecomeStale_ = function onBecomeStale_() {\n this.schedule_();\n };\n _proto.schedule_ = function schedule_() {\n if (!this.isScheduled) {\n this.isScheduled = true;\n globalState.pendingReactions.push(this);\n runReactions();\n }\n }\n /**\n * internal, use schedule() if you intend to kick off a reaction\n */;\n _proto.runReaction_ = function runReaction_() {\n if (!this.isDisposed) {\n startBatch();\n this.isScheduled = false;\n var prev = globalState.trackingContext;\n globalState.trackingContext = this;\n if (shouldCompute(this)) {\n this.isTrackPending = true;\n try {\n this.onInvalidate_();\n if ( true && this.isTrackPending && isSpyEnabled()) {\n // onInvalidate didn't trigger track right away..\n spyReport({\n name: this.name_,\n type: \"scheduled-reaction\"\n });\n }\n } catch (e) {\n this.reportExceptionInDerivation_(e);\n }\n }\n globalState.trackingContext = prev;\n endBatch();\n }\n };\n _proto.track = function track(fn) {\n if (this.isDisposed) {\n return;\n // console.warn(\"Reaction already disposed\") // Note: Not a warning / error in mobx 4 either\n }\n startBatch();\n var notify = isSpyEnabled();\n var startTime;\n if ( true && notify) {\n startTime = Date.now();\n spyReportStart({\n name: this.name_,\n type: \"reaction\"\n });\n }\n this.isRunning = true;\n var prevReaction = globalState.trackingContext; // reactions could create reactions...\n globalState.trackingContext = this;\n var result = trackDerivedFunction(this, fn, undefined);\n globalState.trackingContext = prevReaction;\n this.isRunning = false;\n this.isTrackPending = false;\n if (this.isDisposed) {\n // disposed during last run. Clean up everything that was bound after the dispose call.\n clearObserving(this);\n }\n if (isCaughtException(result)) {\n this.reportExceptionInDerivation_(result.cause);\n }\n if ( true && notify) {\n spyReportEnd({\n time: Date.now() - startTime\n });\n }\n endBatch();\n };\n _proto.reportExceptionInDerivation_ = function reportExceptionInDerivation_(error) {\n var _this = this;\n if (this.errorHandler_) {\n this.errorHandler_(error, this);\n return;\n }\n if (globalState.disableErrorBoundaries) {\n throw error;\n }\n var message = true ? \"[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '\" + this + \"'\" : 0;\n if (!globalState.suppressReactionErrors) {\n console.error(message, error);\n /** If debugging brought you here, please, read the above message :-). Tnx! */\n } else if (true) {\n console.warn(\"[mobx] (error in reaction '\" + this.name_ + \"' suppressed, fix error of causing action below)\");\n } // prettier-ignore\n if ( true && isSpyEnabled()) {\n spyReport({\n type: \"error\",\n name: this.name_,\n message: message,\n error: \"\" + error\n });\n }\n globalState.globalReactionErrorHandlers.forEach(function (f) {\n return f(error, _this);\n });\n };\n _proto.dispose = function dispose() {\n if (!this.isDisposed) {\n this.isDisposed = true;\n if (!this.isRunning) {\n // if disposed while running, clean up later. Maybe not optimal, but rare case\n startBatch();\n clearObserving(this);\n endBatch();\n }\n }\n };\n _proto.getDisposer_ = function getDisposer_(abortSignal) {\n var _this2 = this;\n var dispose = function dispose() {\n _this2.dispose();\n abortSignal == null || abortSignal.removeEventListener == null || abortSignal.removeEventListener(\"abort\", dispose);\n };\n abortSignal == null || abortSignal.addEventListener == null || abortSignal.addEventListener(\"abort\", dispose);\n dispose[$mobx] = this;\n return dispose;\n };\n _proto.toString = function toString() {\n return \"Reaction[\" + this.name_ + \"]\";\n };\n _proto.trace = function trace$1(enterBreakPoint) {\n if (enterBreakPoint === void 0) {\n enterBreakPoint = false;\n }\n trace(this, enterBreakPoint);\n };\n return _createClass(Reaction, [{\n key: \"isDisposed\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isDisposedMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isDisposedMask_, newValue);\n }\n }, {\n key: \"isScheduled\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isScheduledMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isScheduledMask_, newValue);\n }\n }, {\n key: \"isTrackPending\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isTrackPendingMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isTrackPendingMask_, newValue);\n }\n }, {\n key: \"isRunning\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isRunningMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isRunningMask_, newValue);\n }\n }, {\n key: \"diffValue\",\n get: function get() {\n return getFlag(this.flags_, Reaction.diffValueMask_) ? 1 : 0;\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.diffValueMask_, newValue === 1 ? true : false);\n }\n }]);\n}();\nReaction.isDisposedMask_ = 1;\nReaction.isScheduledMask_ = 2;\nReaction.isTrackPendingMask_ = 4;\nReaction.isRunningMask_ = 8;\nReaction.diffValueMask_ = 16;\nfunction onReactionError(handler) {\n globalState.globalReactionErrorHandlers.push(handler);\n return function () {\n var idx = globalState.globalReactionErrorHandlers.indexOf(handler);\n if (idx >= 0) {\n globalState.globalReactionErrorHandlers.splice(idx, 1);\n }\n };\n}\n/**\n * Magic number alert!\n * Defines within how many times a reaction is allowed to re-trigger itself\n * until it is assumed that this is gonna be a never ending loop...\n */\nvar MAX_REACTION_ITERATIONS = 100;\nvar reactionScheduler = function reactionScheduler(f) {\n return f();\n};\nfunction runReactions() {\n // Trampolining, if runReactions are already running, new reactions will be picked up\n if (globalState.inBatch > 0 || globalState.isRunningReactions) {\n return;\n }\n reactionScheduler(runReactionsHelper);\n}\nfunction runReactionsHelper() {\n globalState.isRunningReactions = true;\n var allReactions = globalState.pendingReactions;\n var iterations = 0;\n // While running reactions, new reactions might be triggered.\n // Hence we work with two variables and check whether\n // we converge to no remaining reactions after a while.\n while (allReactions.length > 0) {\n if (++iterations === MAX_REACTION_ITERATIONS) {\n console.error( true ? \"Reaction doesn't converge to a stable state after \" + MAX_REACTION_ITERATIONS + \" iterations.\" + (\" Probably there is a cycle in the reactive function: \" + allReactions[0]) : 0);\n allReactions.splice(0); // clear reactions\n }\n var remainingReactions = allReactions.splice(0);\n for (var i = 0, l = remainingReactions.length; i < l; i++) {\n remainingReactions[i].runReaction_();\n }\n }\n globalState.isRunningReactions = false;\n}\nvar isReaction = /*#__PURE__*/createInstanceofPredicate(\"Reaction\", Reaction);\nfunction setReactionScheduler(fn) {\n var baseScheduler = reactionScheduler;\n reactionScheduler = function reactionScheduler(f) {\n return fn(function () {\n return baseScheduler(f);\n });\n };\n}\n\nfunction isSpyEnabled() {\n return true && !!globalState.spyListeners.length;\n}\nfunction spyReport(event) {\n if (false) {} // dead code elimination can do the rest\n if (!globalState.spyListeners.length) {\n return;\n }\n var listeners = globalState.spyListeners;\n for (var i = 0, l = listeners.length; i < l; i++) {\n listeners[i](event);\n }\n}\nfunction spyReportStart(event) {\n if (false) {}\n var change = _extends({}, event, {\n spyReportStart: true\n });\n spyReport(change);\n}\nvar END_EVENT = {\n type: \"report-end\",\n spyReportEnd: true\n};\nfunction spyReportEnd(change) {\n if (false) {}\n if (change) {\n spyReport(_extends({}, change, {\n type: \"report-end\",\n spyReportEnd: true\n }));\n } else {\n spyReport(END_EVENT);\n }\n}\nfunction spy(listener) {\n if (false) {} else {\n globalState.spyListeners.push(listener);\n return once(function () {\n globalState.spyListeners = globalState.spyListeners.filter(function (l) {\n return l !== listener;\n });\n });\n }\n}\n\nvar ACTION = \"action\";\nvar ACTION_BOUND = \"action.bound\";\nvar AUTOACTION = \"autoAction\";\nvar AUTOACTION_BOUND = \"autoAction.bound\";\nvar DEFAULT_ACTION_NAME = \"\";\nvar actionAnnotation = /*#__PURE__*/createActionAnnotation(ACTION);\nvar actionBoundAnnotation = /*#__PURE__*/createActionAnnotation(ACTION_BOUND, {\n bound: true\n});\nvar autoActionAnnotation = /*#__PURE__*/createActionAnnotation(AUTOACTION, {\n autoAction: true\n});\nvar autoActionBoundAnnotation = /*#__PURE__*/createActionAnnotation(AUTOACTION_BOUND, {\n autoAction: true,\n bound: true\n});\nfunction createActionFactory(autoAction) {\n var res = function action(arg1, arg2) {\n // action(fn() {})\n if (isFunction(arg1)) {\n return createAction(arg1.name || DEFAULT_ACTION_NAME, arg1, autoAction);\n }\n // action(\"name\", fn() {})\n if (isFunction(arg2)) {\n return createAction(arg1, arg2, autoAction);\n }\n // @action (2022.3 Decorators)\n if (is20223Decorator(arg2)) {\n return (autoAction ? autoActionAnnotation : actionAnnotation).decorate_20223_(arg1, arg2);\n }\n // @action\n if (isStringish(arg2)) {\n return storeAnnotation(arg1, arg2, autoAction ? autoActionAnnotation : actionAnnotation);\n }\n // action(\"name\") & @action(\"name\")\n if (isStringish(arg1)) {\n return createDecoratorAnnotation(createActionAnnotation(autoAction ? AUTOACTION : ACTION, {\n name: arg1,\n autoAction: autoAction\n }));\n }\n if (true) {\n die(\"Invalid arguments for `action`\");\n }\n };\n return res;\n}\nvar action = /*#__PURE__*/createActionFactory(false);\nObject.assign(action, actionAnnotation);\nvar autoAction = /*#__PURE__*/createActionFactory(true);\nObject.assign(autoAction, autoActionAnnotation);\naction.bound = /*#__PURE__*/createDecoratorAnnotation(actionBoundAnnotation);\nautoAction.bound = /*#__PURE__*/createDecoratorAnnotation(autoActionBoundAnnotation);\nfunction runInAction(fn) {\n return executeAction(fn.name || DEFAULT_ACTION_NAME, false, fn, this, undefined);\n}\nfunction isAction(thing) {\n return isFunction(thing) && thing.isMobxAction === true;\n}\n\n/**\n * Creates a named reactive view and keeps it alive, so that the view is always\n * updated if one of the dependencies changes, even when the view is not further used by something else.\n * @param view The reactive view\n * @returns disposer function, which can be used to stop the view from being updated in the future.\n */\nfunction autorun(view, opts) {\n var _opts$name, _opts, _opts2, _opts3;\n if (opts === void 0) {\n opts = EMPTY_OBJECT;\n }\n if (true) {\n if (!isFunction(view)) {\n die(\"Autorun expects a function as first argument\");\n }\n if (isAction(view)) {\n die(\"Autorun does not accept actions since actions are untrackable\");\n }\n }\n var name = (_opts$name = (_opts = opts) == null ? void 0 : _opts.name) != null ? _opts$name : true ? view.name || \"Autorun@\" + getNextId() : 0;\n var runSync = !opts.scheduler && !opts.delay;\n var reaction;\n if (runSync) {\n // normal autorun\n reaction = new Reaction(name, function () {\n this.track(reactionRunner);\n }, opts.onError, opts.requiresObservable);\n } else {\n var scheduler = createSchedulerFromOptions(opts);\n // debounced autorun\n var isScheduled = false;\n reaction = new Reaction(name, function () {\n if (!isScheduled) {\n isScheduled = true;\n scheduler(function () {\n isScheduled = false;\n if (!reaction.isDisposed) {\n reaction.track(reactionRunner);\n }\n });\n }\n }, opts.onError, opts.requiresObservable);\n }\n function reactionRunner() {\n view(reaction);\n }\n if (!((_opts2 = opts) != null && (_opts2 = _opts2.signal) != null && _opts2.aborted)) {\n reaction.schedule_();\n }\n return reaction.getDisposer_((_opts3 = opts) == null ? void 0 : _opts3.signal);\n}\nvar run = function run(f) {\n return f();\n};\nfunction createSchedulerFromOptions(opts) {\n return opts.scheduler ? opts.scheduler : opts.delay ? function (f) {\n return setTimeout(f, opts.delay);\n } : run;\n}\nfunction reaction(expression, effect, opts) {\n var _opts$name2, _opts4, _opts5;\n if (opts === void 0) {\n opts = EMPTY_OBJECT;\n }\n if (true) {\n if (!isFunction(expression) || !isFunction(effect)) {\n die(\"First and second argument to reaction should be functions\");\n }\n if (!isPlainObject(opts)) {\n die(\"Third argument of reactions should be an object\");\n }\n }\n var name = (_opts$name2 = opts.name) != null ? _opts$name2 : true ? \"Reaction@\" + getNextId() : 0;\n var effectAction = action(name, opts.onError ? wrapErrorHandler(opts.onError, effect) : effect);\n var runSync = !opts.scheduler && !opts.delay;\n var scheduler = createSchedulerFromOptions(opts);\n var firstTime = true;\n var isScheduled = false;\n var value;\n var equals = opts.compareStructural ? comparer.structural : opts.equals || comparer[\"default\"];\n var r = new Reaction(name, function () {\n if (firstTime || runSync) {\n reactionRunner();\n } else if (!isScheduled) {\n isScheduled = true;\n scheduler(reactionRunner);\n }\n }, opts.onError, opts.requiresObservable);\n function reactionRunner() {\n isScheduled = false;\n if (r.isDisposed) {\n return;\n }\n var changed = false;\n var oldValue = value;\n r.track(function () {\n var nextValue = allowStateChanges(false, function () {\n return expression(r);\n });\n changed = firstTime || !equals(value, nextValue);\n value = nextValue;\n });\n if (firstTime && opts.fireImmediately) {\n effectAction(value, oldValue, r);\n } else if (!firstTime && changed) {\n effectAction(value, oldValue, r);\n }\n firstTime = false;\n }\n if (!((_opts4 = opts) != null && (_opts4 = _opts4.signal) != null && _opts4.aborted)) {\n r.schedule_();\n }\n return r.getDisposer_((_opts5 = opts) == null ? void 0 : _opts5.signal);\n}\nfunction wrapErrorHandler(errorHandler, baseFn) {\n return function () {\n try {\n return baseFn.apply(this, arguments);\n } catch (e) {\n errorHandler.call(this, e);\n }\n };\n}\n\nvar ON_BECOME_OBSERVED = \"onBO\";\nvar ON_BECOME_UNOBSERVED = \"onBUO\";\nfunction onBecomeObserved(thing, arg2, arg3) {\n return interceptHook(ON_BECOME_OBSERVED, thing, arg2, arg3);\n}\nfunction onBecomeUnobserved(thing, arg2, arg3) {\n return interceptHook(ON_BECOME_UNOBSERVED, thing, arg2, arg3);\n}\nfunction interceptHook(hook, thing, arg2, arg3) {\n var atom = typeof arg3 === \"function\" ? getAtom(thing, arg2) : getAtom(thing);\n var cb = isFunction(arg3) ? arg3 : arg2;\n var listenersKey = hook + \"L\";\n if (atom[listenersKey]) {\n atom[listenersKey].add(cb);\n } else {\n atom[listenersKey] = new Set([cb]);\n }\n return function () {\n var hookListeners = atom[listenersKey];\n if (hookListeners) {\n hookListeners[\"delete\"](cb);\n if (hookListeners.size === 0) {\n delete atom[listenersKey];\n }\n }\n };\n}\n\nvar NEVER = \"never\";\nvar ALWAYS = \"always\";\nvar OBSERVED = \"observed\";\n// const IF_AVAILABLE = \"ifavailable\"\nfunction configure(options) {\n if (options.isolateGlobalState === true) {\n isolateGlobalState();\n }\n var useProxies = options.useProxies,\n enforceActions = options.enforceActions;\n if (useProxies !== undefined) {\n globalState.useProxies = useProxies === ALWAYS ? true : useProxies === NEVER ? false : typeof Proxy !== \"undefined\";\n }\n if (useProxies === \"ifavailable\") {\n globalState.verifyProxies = true;\n }\n if (enforceActions !== undefined) {\n var ea = enforceActions === ALWAYS ? ALWAYS : enforceActions === OBSERVED;\n globalState.enforceActions = ea;\n globalState.allowStateChanges = ea === true || ea === ALWAYS ? false : true;\n }\n [\"computedRequiresReaction\", \"reactionRequiresObservable\", \"observableRequiresReaction\", \"disableErrorBoundaries\", \"safeDescriptors\"].forEach(function (key) {\n if (key in options) {\n globalState[key] = !!options[key];\n }\n });\n globalState.allowStateReads = !globalState.observableRequiresReaction;\n if ( true && globalState.disableErrorBoundaries === true) {\n console.warn(\"WARNING: Debug feature only. MobX will NOT recover from errors when `disableErrorBoundaries` is enabled.\");\n }\n if (options.reactionScheduler) {\n setReactionScheduler(options.reactionScheduler);\n }\n}\n\nfunction extendObservable(target, properties, annotations, options) {\n if (true) {\n if (arguments.length > 4) {\n die(\"'extendObservable' expected 2-4 arguments\");\n }\n if (typeof target !== \"object\") {\n die(\"'extendObservable' expects an object as first argument\");\n }\n if (isObservableMap(target)) {\n die(\"'extendObservable' should not be used on maps, use map.merge instead\");\n }\n if (!isPlainObject(properties)) {\n die(\"'extendObservable' only accepts plain objects as second argument\");\n }\n if (isObservable(properties) || isObservable(annotations)) {\n die(\"Extending an object with another observable (object) is not supported\");\n }\n }\n // Pull descriptors first, so we don't have to deal with props added by administration ($mobx)\n var descriptors = getOwnPropertyDescriptors(properties);\n initObservable(function () {\n var adm = asObservableObject(target, options)[$mobx];\n ownKeys(descriptors).forEach(function (key) {\n adm.extend_(key, descriptors[key],\n // must pass \"undefined\" for { key: undefined }\n !annotations ? true : key in annotations ? annotations[key] : true);\n });\n });\n return target;\n}\n\nfunction getDependencyTree(thing, property) {\n return nodeToDependencyTree(getAtom(thing, property));\n}\nfunction nodeToDependencyTree(node) {\n var result = {\n name: node.name_\n };\n if (node.observing_ && node.observing_.length > 0) {\n result.dependencies = unique(node.observing_).map(nodeToDependencyTree);\n }\n return result;\n}\nfunction getObserverTree(thing, property) {\n return nodeToObserverTree(getAtom(thing, property));\n}\nfunction nodeToObserverTree(node) {\n var result = {\n name: node.name_\n };\n if (hasObservers(node)) {\n result.observers = Array.from(getObservers(node)).map(nodeToObserverTree);\n }\n return result;\n}\nfunction unique(list) {\n return Array.from(new Set(list));\n}\n\nvar generatorId = 0;\nfunction FlowCancellationError() {\n this.message = \"FLOW_CANCELLED\";\n}\nFlowCancellationError.prototype = /*#__PURE__*/Object.create(Error.prototype);\nfunction isFlowCancellationError(error) {\n return error instanceof FlowCancellationError;\n}\nvar flowAnnotation = /*#__PURE__*/createFlowAnnotation(\"flow\");\nvar flowBoundAnnotation = /*#__PURE__*/createFlowAnnotation(\"flow.bound\", {\n bound: true\n});\nvar flow = /*#__PURE__*/Object.assign(function flow(arg1, arg2) {\n // @flow (2022.3 Decorators)\n if (is20223Decorator(arg2)) {\n return flowAnnotation.decorate_20223_(arg1, arg2);\n }\n // @flow\n if (isStringish(arg2)) {\n return storeAnnotation(arg1, arg2, flowAnnotation);\n }\n // flow(fn)\n if ( true && arguments.length !== 1) {\n die(\"Flow expects single argument with generator function\");\n }\n var generator = arg1;\n var name = generator.name || \"\";\n // Implementation based on https://github.com/tj/co/blob/master/index.js\n var res = function res() {\n var ctx = this;\n var args = arguments;\n var runId = ++generatorId;\n var gen = action(name + \" - runid: \" + runId + \" - init\", generator).apply(ctx, args);\n var rejector;\n var pendingPromise = undefined;\n var promise = new Promise(function (resolve, reject) {\n var stepId = 0;\n rejector = reject;\n function onFulfilled(res) {\n pendingPromise = undefined;\n var ret;\n try {\n ret = action(name + \" - runid: \" + runId + \" - yield \" + stepId++, gen.next).call(gen, res);\n } catch (e) {\n return reject(e);\n }\n next(ret);\n }\n function onRejected(err) {\n pendingPromise = undefined;\n var ret;\n try {\n ret = action(name + \" - runid: \" + runId + \" - yield \" + stepId++, gen[\"throw\"]).call(gen, err);\n } catch (e) {\n return reject(e);\n }\n next(ret);\n }\n function next(ret) {\n if (isFunction(ret == null ? void 0 : ret.then)) {\n // an async iterator\n ret.then(next, reject);\n return;\n }\n if (ret.done) {\n return resolve(ret.value);\n }\n pendingPromise = Promise.resolve(ret.value);\n return pendingPromise.then(onFulfilled, onRejected);\n }\n onFulfilled(undefined); // kick off the process\n });\n promise.cancel = action(name + \" - runid: \" + runId + \" - cancel\", function () {\n try {\n if (pendingPromise) {\n cancelPromise(pendingPromise);\n }\n // Finally block can return (or yield) stuff..\n var _res = gen[\"return\"](undefined);\n // eat anything that promise would do, it's cancelled!\n var yieldedPromise = Promise.resolve(_res.value);\n yieldedPromise.then(noop, noop);\n cancelPromise(yieldedPromise); // maybe it can be cancelled :)\n // reject our original promise\n rejector(new FlowCancellationError());\n } catch (e) {\n rejector(e); // there could be a throwing finally block\n }\n });\n return promise;\n };\n res.isMobXFlow = true;\n return res;\n}, flowAnnotation);\nflow.bound = /*#__PURE__*/createDecoratorAnnotation(flowBoundAnnotation);\nfunction cancelPromise(promise) {\n if (isFunction(promise.cancel)) {\n promise.cancel();\n }\n}\nfunction flowResult(result) {\n return result; // just tricking TypeScript :)\n}\nfunction isFlow(fn) {\n return (fn == null ? void 0 : fn.isMobXFlow) === true;\n}\n\nfunction interceptReads(thing, propOrHandler, handler) {\n var target;\n if (isObservableMap(thing) || isObservableArray(thing) || isObservableValue(thing)) {\n target = getAdministration(thing);\n } else if (isObservableObject(thing)) {\n if ( true && !isStringish(propOrHandler)) {\n return die(\"InterceptReads can only be used with a specific property, not with an object in general\");\n }\n target = getAdministration(thing, propOrHandler);\n } else if (true) {\n return die(\"Expected observable map, object or array as first array\");\n }\n if ( true && target.dehancer !== undefined) {\n return die(\"An intercept reader was already established\");\n }\n target.dehancer = typeof propOrHandler === \"function\" ? propOrHandler : handler;\n return function () {\n target.dehancer = undefined;\n };\n}\n\nfunction intercept(thing, propOrHandler, handler) {\n if (isFunction(handler)) {\n return interceptProperty(thing, propOrHandler, handler);\n } else {\n return interceptInterceptable(thing, propOrHandler);\n }\n}\nfunction interceptInterceptable(thing, handler) {\n return getAdministration(thing).intercept_(handler);\n}\nfunction interceptProperty(thing, property, handler) {\n return getAdministration(thing, property).intercept_(handler);\n}\n\nfunction _isComputed(value, property) {\n if (property === undefined) {\n return isComputedValue(value);\n }\n if (isObservableObject(value) === false) {\n return false;\n }\n if (!value[$mobx].values_.has(property)) {\n return false;\n }\n var atom = getAtom(value, property);\n return isComputedValue(atom);\n}\nfunction isComputed(value) {\n if ( true && arguments.length > 1) {\n return die(\"isComputed expects only 1 argument. Use isComputedProp to inspect the observability of a property\");\n }\n return _isComputed(value);\n}\nfunction isComputedProp(value, propName) {\n if ( true && !isStringish(propName)) {\n return die(\"isComputed expected a property name as second argument\");\n }\n return _isComputed(value, propName);\n}\n\nfunction _isObservable(value, property) {\n if (!value) {\n return false;\n }\n if (property !== undefined) {\n if ( true && (isObservableMap(value) || isObservableArray(value))) {\n return die(\"isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead.\");\n }\n if (isObservableObject(value)) {\n return value[$mobx].values_.has(property);\n }\n return false;\n }\n // For first check, see #701\n return isObservableObject(value) || !!value[$mobx] || isAtom(value) || isReaction(value) || isComputedValue(value);\n}\nfunction isObservable(value) {\n if ( true && arguments.length !== 1) {\n die(\"isObservable expects only 1 argument. Use isObservableProp to inspect the observability of a property\");\n }\n return _isObservable(value);\n}\nfunction isObservableProp(value, propName) {\n if ( true && !isStringish(propName)) {\n return die(\"expected a property name as second argument\");\n }\n return _isObservable(value, propName);\n}\n\nfunction keys(obj) {\n if (isObservableObject(obj)) {\n return obj[$mobx].keys_();\n }\n if (isObservableMap(obj) || isObservableSet(obj)) {\n return Array.from(obj.keys());\n }\n if (isObservableArray(obj)) {\n return obj.map(function (_, index) {\n return index;\n });\n }\n die(5);\n}\nfunction values(obj) {\n if (isObservableObject(obj)) {\n return keys(obj).map(function (key) {\n return obj[key];\n });\n }\n if (isObservableMap(obj)) {\n return keys(obj).map(function (key) {\n return obj.get(key);\n });\n }\n if (isObservableSet(obj)) {\n return Array.from(obj.values());\n }\n if (isObservableArray(obj)) {\n return obj.slice();\n }\n die(6);\n}\nfunction entries(obj) {\n if (isObservableObject(obj)) {\n return keys(obj).map(function (key) {\n return [key, obj[key]];\n });\n }\n if (isObservableMap(obj)) {\n return keys(obj).map(function (key) {\n return [key, obj.get(key)];\n });\n }\n if (isObservableSet(obj)) {\n return Array.from(obj.entries());\n }\n if (isObservableArray(obj)) {\n return obj.map(function (key, index) {\n return [index, key];\n });\n }\n die(7);\n}\nfunction set(obj, key, value) {\n if (arguments.length === 2 && !isObservableSet(obj)) {\n startBatch();\n var _values = key;\n try {\n for (var _key in _values) {\n set(obj, _key, _values[_key]);\n }\n } finally {\n endBatch();\n }\n return;\n }\n if (isObservableObject(obj)) {\n obj[$mobx].set_(key, value);\n } else if (isObservableMap(obj)) {\n obj.set(key, value);\n } else if (isObservableSet(obj)) {\n obj.add(key);\n } else if (isObservableArray(obj)) {\n if (typeof key !== \"number\") {\n key = parseInt(key, 10);\n }\n if (key < 0) {\n die(\"Invalid index: '\" + key + \"'\");\n }\n startBatch();\n if (key >= obj.length) {\n obj.length = key + 1;\n }\n obj[key] = value;\n endBatch();\n } else {\n die(8);\n }\n}\nfunction remove(obj, key) {\n if (isObservableObject(obj)) {\n obj[$mobx].delete_(key);\n } else if (isObservableMap(obj)) {\n obj[\"delete\"](key);\n } else if (isObservableSet(obj)) {\n obj[\"delete\"](key);\n } else if (isObservableArray(obj)) {\n if (typeof key !== \"number\") {\n key = parseInt(key, 10);\n }\n obj.splice(key, 1);\n } else {\n die(9);\n }\n}\nfunction has(obj, key) {\n if (isObservableObject(obj)) {\n return obj[$mobx].has_(key);\n } else if (isObservableMap(obj)) {\n return obj.has(key);\n } else if (isObservableSet(obj)) {\n return obj.has(key);\n } else if (isObservableArray(obj)) {\n return key >= 0 && key < obj.length;\n }\n die(10);\n}\nfunction get(obj, key) {\n if (!has(obj, key)) {\n return undefined;\n }\n if (isObservableObject(obj)) {\n return obj[$mobx].get_(key);\n } else if (isObservableMap(obj)) {\n return obj.get(key);\n } else if (isObservableArray(obj)) {\n return obj[key];\n }\n die(11);\n}\nfunction apiDefineProperty(obj, key, descriptor) {\n if (isObservableObject(obj)) {\n return obj[$mobx].defineProperty_(key, descriptor);\n }\n die(39);\n}\nfunction apiOwnKeys(obj) {\n if (isObservableObject(obj)) {\n return obj[$mobx].ownKeys_();\n }\n die(38);\n}\n\nfunction observe(thing, propOrCb, cbOrFire, fireImmediately) {\n if (isFunction(cbOrFire)) {\n return observeObservableProperty(thing, propOrCb, cbOrFire, fireImmediately);\n } else {\n return observeObservable(thing, propOrCb, cbOrFire);\n }\n}\nfunction observeObservable(thing, listener, fireImmediately) {\n return getAdministration(thing).observe_(listener, fireImmediately);\n}\nfunction observeObservableProperty(thing, property, listener, fireImmediately) {\n return getAdministration(thing, property).observe_(listener, fireImmediately);\n}\n\nfunction cache(map, key, value) {\n map.set(key, value);\n return value;\n}\nfunction toJSHelper(source, __alreadySeen) {\n if (source == null || typeof source !== \"object\" || source instanceof Date || !isObservable(source)) {\n return source;\n }\n if (isObservableValue(source) || isComputedValue(source)) {\n return toJSHelper(source.get(), __alreadySeen);\n }\n if (__alreadySeen.has(source)) {\n return __alreadySeen.get(source);\n }\n if (isObservableArray(source)) {\n var res = cache(__alreadySeen, source, new Array(source.length));\n source.forEach(function (value, idx) {\n res[idx] = toJSHelper(value, __alreadySeen);\n });\n return res;\n }\n if (isObservableSet(source)) {\n var _res = cache(__alreadySeen, source, new Set());\n source.forEach(function (value) {\n _res.add(toJSHelper(value, __alreadySeen));\n });\n return _res;\n }\n if (isObservableMap(source)) {\n var _res2 = cache(__alreadySeen, source, new Map());\n source.forEach(function (value, key) {\n _res2.set(key, toJSHelper(value, __alreadySeen));\n });\n return _res2;\n } else {\n // must be observable object\n var _res3 = cache(__alreadySeen, source, {});\n apiOwnKeys(source).forEach(function (key) {\n if (objectPrototype.propertyIsEnumerable.call(source, key)) {\n _res3[key] = toJSHelper(source[key], __alreadySeen);\n }\n });\n return _res3;\n }\n}\n/**\n * Recursively converts an observable to it's non-observable native counterpart.\n * It does NOT recurse into non-observables, these are left as they are, even if they contain observables.\n * Computed and other non-enumerable properties are completely ignored.\n * Complex scenarios require custom solution, eg implementing `toJSON` or using `serializr` lib.\n */\nfunction toJS(source, options) {\n if ( true && options) {\n die(\"toJS no longer supports options\");\n }\n return toJSHelper(source, new Map());\n}\n\nfunction trace() {\n if (false) {}\n var enterBreakPoint = false;\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n if (typeof args[args.length - 1] === \"boolean\") {\n enterBreakPoint = args.pop();\n }\n var derivation = getAtomFromArgs(args);\n if (!derivation) {\n return die(\"'trace(break?)' can only be used inside a tracked computed value or a Reaction. Consider passing in the computed value or reaction explicitly\");\n }\n if (derivation.isTracing_ === TraceMode.NONE) {\n console.log(\"[mobx.trace] '\" + derivation.name_ + \"' tracing enabled\");\n }\n derivation.isTracing_ = enterBreakPoint ? TraceMode.BREAK : TraceMode.LOG;\n}\nfunction getAtomFromArgs(args) {\n switch (args.length) {\n case 0:\n return globalState.trackingDerivation;\n case 1:\n return getAtom(args[0]);\n case 2:\n return getAtom(args[0], args[1]);\n }\n}\n\n/**\n * During a transaction no views are updated until the end of the transaction.\n * The transaction will be run synchronously nonetheless.\n *\n * @param action a function that updates some reactive state\n * @returns any value that was returned by the 'action' parameter.\n */\nfunction transaction(action, thisArg) {\n if (thisArg === void 0) {\n thisArg = undefined;\n }\n startBatch();\n try {\n return action.apply(thisArg);\n } finally {\n endBatch();\n }\n}\n\nfunction when(predicate, arg1, arg2) {\n if (arguments.length === 1 || arg1 && typeof arg1 === \"object\") {\n return whenPromise(predicate, arg1);\n }\n return _when(predicate, arg1, arg2 || {});\n}\nfunction _when(predicate, effect, opts) {\n var timeoutHandle;\n if (typeof opts.timeout === \"number\") {\n var error = new Error(\"WHEN_TIMEOUT\");\n timeoutHandle = setTimeout(function () {\n if (!disposer[$mobx].isDisposed) {\n disposer();\n if (opts.onError) {\n opts.onError(error);\n } else {\n throw error;\n }\n }\n }, opts.timeout);\n }\n opts.name = true ? opts.name || \"When@\" + getNextId() : 0;\n var effectAction = createAction( true ? opts.name + \"-effect\" : 0, effect);\n // eslint-disable-next-line\n var disposer = autorun(function (r) {\n // predicate should not change state\n var cond = allowStateChanges(false, predicate);\n if (cond) {\n r.dispose();\n if (timeoutHandle) {\n clearTimeout(timeoutHandle);\n }\n effectAction();\n }\n }, opts);\n return disposer;\n}\nfunction whenPromise(predicate, opts) {\n var _opts$signal;\n if ( true && opts && opts.onError) {\n return die(\"the options 'onError' and 'promise' cannot be combined\");\n }\n if (opts != null && (_opts$signal = opts.signal) != null && _opts$signal.aborted) {\n return Object.assign(Promise.reject(new Error(\"WHEN_ABORTED\")), {\n cancel: function cancel() {\n return null;\n }\n });\n }\n var cancel;\n var abort;\n var res = new Promise(function (resolve, reject) {\n var _opts$signal2;\n var disposer = _when(predicate, resolve, _extends({}, opts, {\n onError: reject\n }));\n cancel = function cancel() {\n disposer();\n reject(new Error(\"WHEN_CANCELLED\"));\n };\n abort = function abort() {\n disposer();\n reject(new Error(\"WHEN_ABORTED\"));\n };\n opts == null || (_opts$signal2 = opts.signal) == null || _opts$signal2.addEventListener == null || _opts$signal2.addEventListener(\"abort\", abort);\n })[\"finally\"](function () {\n var _opts$signal3;\n return opts == null || (_opts$signal3 = opts.signal) == null || _opts$signal3.removeEventListener == null ? void 0 : _opts$signal3.removeEventListener(\"abort\", abort);\n });\n res.cancel = cancel;\n return res;\n}\n\nfunction getAdm(target) {\n return target[$mobx];\n}\n// Optimization: we don't need the intermediate objects and could have a completely custom administration for DynamicObjects,\n// and skip either the internal values map, or the base object with its property descriptors!\nvar objectProxyTraps = {\n has: function has(target, name) {\n if ( true && globalState.trackingDerivation) {\n warnAboutProxyRequirement(\"detect new properties using the 'in' operator. Use 'has' from 'mobx' instead.\");\n }\n return getAdm(target).has_(name);\n },\n get: function get(target, name) {\n return getAdm(target).get_(name);\n },\n set: function set(target, name, value) {\n var _getAdm$set_;\n if (!isStringish(name)) {\n return false;\n }\n if ( true && !getAdm(target).values_.has(name)) {\n warnAboutProxyRequirement(\"add a new observable property through direct assignment. Use 'set' from 'mobx' instead.\");\n }\n // null (intercepted) -> true (success)\n return (_getAdm$set_ = getAdm(target).set_(name, value, true)) != null ? _getAdm$set_ : true;\n },\n deleteProperty: function deleteProperty(target, name) {\n var _getAdm$delete_;\n if (true) {\n warnAboutProxyRequirement(\"delete properties from an observable object. Use 'remove' from 'mobx' instead.\");\n }\n if (!isStringish(name)) {\n return false;\n }\n // null (intercepted) -> true (success)\n return (_getAdm$delete_ = getAdm(target).delete_(name, true)) != null ? _getAdm$delete_ : true;\n },\n defineProperty: function defineProperty(target, name, descriptor) {\n var _getAdm$definePropert;\n if (true) {\n warnAboutProxyRequirement(\"define property on an observable object. Use 'defineProperty' from 'mobx' instead.\");\n }\n // null (intercepted) -> true (success)\n return (_getAdm$definePropert = getAdm(target).defineProperty_(name, descriptor)) != null ? _getAdm$definePropert : true;\n },\n ownKeys: function ownKeys(target) {\n if ( true && globalState.trackingDerivation) {\n warnAboutProxyRequirement(\"iterate keys to detect added / removed properties. Use 'keys' from 'mobx' instead.\");\n }\n return getAdm(target).ownKeys_();\n },\n preventExtensions: function preventExtensions(target) {\n die(13);\n }\n};\nfunction asDynamicObservableObject(target, options) {\n var _target$$mobx, _target$$mobx$proxy_;\n assertProxies();\n target = asObservableObject(target, options);\n return (_target$$mobx$proxy_ = (_target$$mobx = target[$mobx]).proxy_) != null ? _target$$mobx$proxy_ : _target$$mobx.proxy_ = new Proxy(target, objectProxyTraps);\n}\n\nfunction hasInterceptors(interceptable) {\n return interceptable.interceptors_ !== undefined && interceptable.interceptors_.length > 0;\n}\nfunction registerInterceptor(interceptable, handler) {\n var interceptors = interceptable.interceptors_ || (interceptable.interceptors_ = []);\n interceptors.push(handler);\n return once(function () {\n var idx = interceptors.indexOf(handler);\n if (idx !== -1) {\n interceptors.splice(idx, 1);\n }\n });\n}\nfunction interceptChange(interceptable, change) {\n var prevU = untrackedStart();\n try {\n // Interceptor can modify the array, copy it to avoid concurrent modification, see #1950\n var interceptors = [].concat(interceptable.interceptors_ || []);\n for (var i = 0, l = interceptors.length; i < l; i++) {\n change = interceptors[i](change);\n if (change && !change.type) {\n die(14);\n }\n if (!change) {\n break;\n }\n }\n return change;\n } finally {\n untrackedEnd(prevU);\n }\n}\n\nfunction hasListeners(listenable) {\n return listenable.changeListeners_ !== undefined && listenable.changeListeners_.length > 0;\n}\nfunction registerListener(listenable, handler) {\n var listeners = listenable.changeListeners_ || (listenable.changeListeners_ = []);\n listeners.push(handler);\n return once(function () {\n var idx = listeners.indexOf(handler);\n if (idx !== -1) {\n listeners.splice(idx, 1);\n }\n });\n}\nfunction notifyListeners(listenable, change) {\n var prevU = untrackedStart();\n var listeners = listenable.changeListeners_;\n if (!listeners) {\n return;\n }\n listeners = listeners.slice();\n for (var i = 0, l = listeners.length; i < l; i++) {\n listeners[i](change);\n }\n untrackedEnd(prevU);\n}\n\nfunction makeObservable(target, annotations, options) {\n initObservable(function () {\n var _annotations;\n var adm = asObservableObject(target, options)[$mobx];\n if ( true && annotations && target[storedAnnotationsSymbol]) {\n die(\"makeObservable second arg must be nullish when using decorators. Mixing @decorator syntax with annotations is not supported.\");\n }\n // Default to decorators\n (_annotations = annotations) != null ? _annotations : annotations = collectStoredAnnotations(target);\n // Annotate\n ownKeys(annotations).forEach(function (key) {\n return adm.make_(key, annotations[key]);\n });\n });\n return target;\n}\n// proto[keysSymbol] = new Set()\nvar keysSymbol = /*#__PURE__*/Symbol(\"mobx-keys\");\nfunction makeAutoObservable(target, overrides, options) {\n if (true) {\n if (!isPlainObject(target) && !isPlainObject(Object.getPrototypeOf(target))) {\n die(\"'makeAutoObservable' can only be used for classes that don't have a superclass\");\n }\n if (isObservableObject(target)) {\n die(\"makeAutoObservable can only be used on objects not already made observable\");\n }\n }\n // Optimization: avoid visiting protos\n // Assumes that annotation.make_/.extend_ works the same for plain objects\n if (isPlainObject(target)) {\n return extendObservable(target, target, overrides, options);\n }\n initObservable(function () {\n var adm = asObservableObject(target, options)[$mobx];\n // Optimization: cache keys on proto\n // Assumes makeAutoObservable can be called only once per object and can't be used in subclass\n if (!target[keysSymbol]) {\n var proto = Object.getPrototypeOf(target);\n var keys = new Set([].concat(ownKeys(target), ownKeys(proto)));\n keys[\"delete\"](\"constructor\");\n keys[\"delete\"]($mobx);\n addHiddenProp(proto, keysSymbol, keys);\n }\n target[keysSymbol].forEach(function (key) {\n return adm.make_(key,\n // must pass \"undefined\" for { key: undefined }\n !overrides ? true : key in overrides ? overrides[key] : true);\n });\n });\n return target;\n}\n\nvar SPLICE = \"splice\";\nvar UPDATE = \"update\";\nvar MAX_SPLICE_SIZE = 10000; // See e.g. https://github.com/mobxjs/mobx/issues/859\nvar arrayTraps = {\n get: function get(target, name) {\n var adm = target[$mobx];\n if (name === $mobx) {\n return adm;\n }\n if (name === \"length\") {\n return adm.getArrayLength_();\n }\n if (typeof name === \"string\" && !isNaN(name)) {\n return adm.get_(parseInt(name));\n }\n if (hasProp(arrayExtensions, name)) {\n return arrayExtensions[name];\n }\n return target[name];\n },\n set: function set(target, name, value) {\n var adm = target[$mobx];\n if (name === \"length\") {\n adm.setArrayLength_(value);\n }\n if (typeof name === \"symbol\" || isNaN(name)) {\n target[name] = value;\n } else {\n // numeric string\n adm.set_(parseInt(name), value);\n }\n return true;\n },\n preventExtensions: function preventExtensions() {\n die(15);\n }\n};\nvar ObservableArrayAdministration = /*#__PURE__*/function () {\n function ObservableArrayAdministration(name, enhancer, owned_, legacyMode_) {\n if (name === void 0) {\n name = true ? \"ObservableArray@\" + getNextId() : 0;\n }\n this.owned_ = void 0;\n this.legacyMode_ = void 0;\n this.atom_ = void 0;\n this.values_ = [];\n // this is the prop that gets proxied, so can't replace it!\n this.interceptors_ = void 0;\n this.changeListeners_ = void 0;\n this.enhancer_ = void 0;\n this.dehancer = void 0;\n this.proxy_ = void 0;\n this.lastKnownLength_ = 0;\n this.owned_ = owned_;\n this.legacyMode_ = legacyMode_;\n this.atom_ = new Atom(name);\n this.enhancer_ = function (newV, oldV) {\n return enhancer(newV, oldV, true ? name + \"[..]\" : 0);\n };\n }\n var _proto = ObservableArrayAdministration.prototype;\n _proto.dehanceValue_ = function dehanceValue_(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.dehanceValues_ = function dehanceValues_(values) {\n if (this.dehancer !== undefined && values.length > 0) {\n return values.map(this.dehancer);\n }\n return values;\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n if (fireImmediately === void 0) {\n fireImmediately = false;\n }\n if (fireImmediately) {\n listener({\n observableKind: \"array\",\n object: this.proxy_,\n debugObjectName: this.atom_.name_,\n type: \"splice\",\n index: 0,\n added: this.values_.slice(),\n addedCount: this.values_.length,\n removed: [],\n removedCount: 0\n });\n }\n return registerListener(this, listener);\n };\n _proto.getArrayLength_ = function getArrayLength_() {\n this.atom_.reportObserved();\n return this.values_.length;\n };\n _proto.setArrayLength_ = function setArrayLength_(newLength) {\n if (typeof newLength !== \"number\" || isNaN(newLength) || newLength < 0) {\n die(\"Out of range: \" + newLength);\n }\n var currentLength = this.values_.length;\n if (newLength === currentLength) {\n return;\n } else if (newLength > currentLength) {\n var newItems = new Array(newLength - currentLength);\n for (var i = 0; i < newLength - currentLength; i++) {\n newItems[i] = undefined;\n } // No Array.fill everywhere...\n this.spliceWithArray_(currentLength, 0, newItems);\n } else {\n this.spliceWithArray_(newLength, currentLength - newLength);\n }\n };\n _proto.updateArrayLength_ = function updateArrayLength_(oldLength, delta) {\n if (oldLength !== this.lastKnownLength_) {\n die(16);\n }\n this.lastKnownLength_ += delta;\n if (this.legacyMode_ && delta > 0) {\n reserveArrayBuffer(oldLength + delta + 1);\n }\n };\n _proto.spliceWithArray_ = function spliceWithArray_(index, deleteCount, newItems) {\n var _this = this;\n checkIfStateModificationsAreAllowed(this.atom_);\n var length = this.values_.length;\n if (index === undefined) {\n index = 0;\n } else if (index > length) {\n index = length;\n } else if (index < 0) {\n index = Math.max(0, length + index);\n }\n if (arguments.length === 1) {\n deleteCount = length - index;\n } else if (deleteCount === undefined || deleteCount === null) {\n deleteCount = 0;\n } else {\n deleteCount = Math.max(0, Math.min(deleteCount, length - index));\n }\n if (newItems === undefined) {\n newItems = EMPTY_ARRAY;\n }\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_,\n type: SPLICE,\n index: index,\n removedCount: deleteCount,\n added: newItems\n });\n if (!change) {\n return EMPTY_ARRAY;\n }\n deleteCount = change.removedCount;\n newItems = change.added;\n }\n newItems = newItems.length === 0 ? newItems : newItems.map(function (v) {\n return _this.enhancer_(v, undefined);\n });\n if (this.legacyMode_ || \"development\" !== \"production\") {\n var lengthDelta = newItems.length - deleteCount;\n this.updateArrayLength_(length, lengthDelta); // checks if internal array wasn't modified\n }\n var res = this.spliceItemsIntoValues_(index, deleteCount, newItems);\n if (deleteCount !== 0 || newItems.length !== 0) {\n this.notifyArraySplice_(index, newItems, res);\n }\n return this.dehanceValues_(res);\n };\n _proto.spliceItemsIntoValues_ = function spliceItemsIntoValues_(index, deleteCount, newItems) {\n if (newItems.length < MAX_SPLICE_SIZE) {\n var _this$values_;\n return (_this$values_ = this.values_).splice.apply(_this$values_, [index, deleteCount].concat(newItems));\n } else {\n // The items removed by the splice\n var res = this.values_.slice(index, index + deleteCount);\n // The items that that should remain at the end of the array\n var oldItems = this.values_.slice(index + deleteCount);\n // New length is the previous length + addition count - deletion count\n this.values_.length += newItems.length - deleteCount;\n for (var i = 0; i < newItems.length; i++) {\n this.values_[index + i] = newItems[i];\n }\n for (var _i = 0; _i < oldItems.length; _i++) {\n this.values_[index + newItems.length + _i] = oldItems[_i];\n }\n return res;\n }\n };\n _proto.notifyArrayChildUpdate_ = function notifyArrayChildUpdate_(index, newValue, oldValue) {\n var notifySpy = !this.owned_ && isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"array\",\n object: this.proxy_,\n type: UPDATE,\n debugObjectName: this.atom_.name_,\n index: index,\n newValue: newValue,\n oldValue: oldValue\n } : null;\n // The reason why this is on right hand side here (and not above), is this way the uglifier will drop it, but it won't\n // cause any runtime overhead in development mode without NODE_ENV set, unless spying is enabled\n if ( true && notifySpy) {\n spyReportStart(change);\n }\n this.atom_.reportChanged();\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n };\n _proto.notifyArraySplice_ = function notifyArraySplice_(index, added, removed) {\n var notifySpy = !this.owned_ && isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"array\",\n object: this.proxy_,\n debugObjectName: this.atom_.name_,\n type: SPLICE,\n index: index,\n removed: removed,\n added: added,\n removedCount: removed.length,\n addedCount: added.length\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n }\n this.atom_.reportChanged();\n // conform: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/observe\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n };\n _proto.get_ = function get_(index) {\n if (this.legacyMode_ && index >= this.values_.length) {\n console.warn( true ? \"[mobx.array] Attempt to read an array index (\" + index + \") that is out of bounds (\" + this.values_.length + \"). Please check length first. Out of bound indices will not be tracked by MobX\" : 0);\n return undefined;\n }\n this.atom_.reportObserved();\n return this.dehanceValue_(this.values_[index]);\n };\n _proto.set_ = function set_(index, newValue) {\n var values = this.values_;\n if (this.legacyMode_ && index > values.length) {\n // out of bounds\n die(17, index, values.length);\n }\n if (index < values.length) {\n // update at index in range\n checkIfStateModificationsAreAllowed(this.atom_);\n var oldValue = values[index];\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: UPDATE,\n object: this.proxy_,\n // since \"this\" is the real array we need to pass its proxy\n index: index,\n newValue: newValue\n });\n if (!change) {\n return;\n }\n newValue = change.newValue;\n }\n newValue = this.enhancer_(newValue, oldValue);\n var changed = newValue !== oldValue;\n if (changed) {\n values[index] = newValue;\n this.notifyArrayChildUpdate_(index, newValue, oldValue);\n }\n } else {\n // For out of bound index, we don't create an actual sparse array,\n // but rather fill the holes with undefined (same as setArrayLength_).\n // This could be considered a bug.\n var newItems = new Array(index + 1 - values.length);\n for (var i = 0; i < newItems.length - 1; i++) {\n newItems[i] = undefined;\n } // No Array.fill everywhere...\n newItems[newItems.length - 1] = newValue;\n this.spliceWithArray_(values.length, 0, newItems);\n }\n };\n return ObservableArrayAdministration;\n}();\nfunction createObservableArray(initialValues, enhancer, name, owned) {\n if (name === void 0) {\n name = true ? \"ObservableArray@\" + getNextId() : 0;\n }\n if (owned === void 0) {\n owned = false;\n }\n assertProxies();\n return initObservable(function () {\n var adm = new ObservableArrayAdministration(name, enhancer, owned, false);\n addHiddenFinalProp(adm.values_, $mobx, adm);\n var proxy = new Proxy(adm.values_, arrayTraps);\n adm.proxy_ = proxy;\n if (initialValues && initialValues.length) {\n adm.spliceWithArray_(0, 0, initialValues);\n }\n return proxy;\n });\n}\n// eslint-disable-next-line\nvar arrayExtensions = {\n clear: function clear() {\n return this.splice(0);\n },\n replace: function replace(newItems) {\n var adm = this[$mobx];\n return adm.spliceWithArray_(0, adm.values_.length, newItems);\n },\n // Used by JSON.stringify\n toJSON: function toJSON() {\n return this.slice();\n },\n /*\n * functions that do alter the internal structure of the array, (based on lib.es6.d.ts)\n * since these functions alter the inner structure of the array, the have side effects.\n * Because the have side effects, they should not be used in computed function,\n * and for that reason the do not call dependencyState.notifyObserved\n */\n splice: function splice(index, deleteCount) {\n for (var _len = arguments.length, newItems = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {\n newItems[_key - 2] = arguments[_key];\n }\n var adm = this[$mobx];\n switch (arguments.length) {\n case 0:\n return [];\n case 1:\n return adm.spliceWithArray_(index);\n case 2:\n return adm.spliceWithArray_(index, deleteCount);\n }\n return adm.spliceWithArray_(index, deleteCount, newItems);\n },\n spliceWithArray: function spliceWithArray(index, deleteCount, newItems) {\n return this[$mobx].spliceWithArray_(index, deleteCount, newItems);\n },\n push: function push() {\n var adm = this[$mobx];\n for (var _len2 = arguments.length, items = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n items[_key2] = arguments[_key2];\n }\n adm.spliceWithArray_(adm.values_.length, 0, items);\n return adm.values_.length;\n },\n pop: function pop() {\n return this.splice(Math.max(this[$mobx].values_.length - 1, 0), 1)[0];\n },\n shift: function shift() {\n return this.splice(0, 1)[0];\n },\n unshift: function unshift() {\n var adm = this[$mobx];\n for (var _len3 = arguments.length, items = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n items[_key3] = arguments[_key3];\n }\n adm.spliceWithArray_(0, 0, items);\n return adm.values_.length;\n },\n reverse: function reverse() {\n // reverse by default mutates in place before returning the result\n // which makes it both a 'derivation' and a 'mutation'.\n if (globalState.trackingDerivation) {\n die(37, \"reverse\");\n }\n this.replace(this.slice().reverse());\n return this;\n },\n sort: function sort() {\n // sort by default mutates in place before returning the result\n // which goes against all good practices. Let's not change the array in place!\n if (globalState.trackingDerivation) {\n die(37, \"sort\");\n }\n var copy = this.slice();\n copy.sort.apply(copy, arguments);\n this.replace(copy);\n return this;\n },\n remove: function remove(value) {\n var adm = this[$mobx];\n var idx = adm.dehanceValues_(adm.values_).indexOf(value);\n if (idx > -1) {\n this.splice(idx, 1);\n return true;\n }\n return false;\n }\n};\n/**\n * Wrap function from prototype\n * Without this, everything works as well, but this works\n * faster as everything works on unproxied values\n */\naddArrayExtension(\"at\", simpleFunc);\naddArrayExtension(\"concat\", simpleFunc);\naddArrayExtension(\"flat\", simpleFunc);\naddArrayExtension(\"includes\", simpleFunc);\naddArrayExtension(\"indexOf\", simpleFunc);\naddArrayExtension(\"join\", simpleFunc);\naddArrayExtension(\"lastIndexOf\", simpleFunc);\naddArrayExtension(\"slice\", simpleFunc);\naddArrayExtension(\"toString\", simpleFunc);\naddArrayExtension(\"toLocaleString\", simpleFunc);\naddArrayExtension(\"toSorted\", simpleFunc);\naddArrayExtension(\"toSpliced\", simpleFunc);\naddArrayExtension(\"with\", simpleFunc);\n// map\naddArrayExtension(\"every\", mapLikeFunc);\naddArrayExtension(\"filter\", mapLikeFunc);\naddArrayExtension(\"find\", mapLikeFunc);\naddArrayExtension(\"findIndex\", mapLikeFunc);\naddArrayExtension(\"findLast\", mapLikeFunc);\naddArrayExtension(\"findLastIndex\", mapLikeFunc);\naddArrayExtension(\"flatMap\", mapLikeFunc);\naddArrayExtension(\"forEach\", mapLikeFunc);\naddArrayExtension(\"map\", mapLikeFunc);\naddArrayExtension(\"some\", mapLikeFunc);\naddArrayExtension(\"toReversed\", mapLikeFunc);\n// reduce\naddArrayExtension(\"reduce\", reduceLikeFunc);\naddArrayExtension(\"reduceRight\", reduceLikeFunc);\nfunction addArrayExtension(funcName, funcFactory) {\n if (typeof Array.prototype[funcName] === \"function\") {\n arrayExtensions[funcName] = funcFactory(funcName);\n }\n}\n// Report and delegate to dehanced array\nfunction simpleFunc(funcName) {\n return function () {\n var adm = this[$mobx];\n adm.atom_.reportObserved();\n var dehancedValues = adm.dehanceValues_(adm.values_);\n return dehancedValues[funcName].apply(dehancedValues, arguments);\n };\n}\n// Make sure callbacks receive correct array arg #2326\nfunction mapLikeFunc(funcName) {\n return function (callback, thisArg) {\n var _this2 = this;\n var adm = this[$mobx];\n adm.atom_.reportObserved();\n var dehancedValues = adm.dehanceValues_(adm.values_);\n return dehancedValues[funcName](function (element, index) {\n return callback.call(thisArg, element, index, _this2);\n });\n };\n}\n// Make sure callbacks receive correct array arg #2326\nfunction reduceLikeFunc(funcName) {\n return function () {\n var _this3 = this;\n var adm = this[$mobx];\n adm.atom_.reportObserved();\n var dehancedValues = adm.dehanceValues_(adm.values_);\n // #2432 - reduce behavior depends on arguments.length\n var callback = arguments[0];\n arguments[0] = function (accumulator, currentValue, index) {\n return callback(accumulator, currentValue, index, _this3);\n };\n return dehancedValues[funcName].apply(dehancedValues, arguments);\n };\n}\nvar isObservableArrayAdministration = /*#__PURE__*/createInstanceofPredicate(\"ObservableArrayAdministration\", ObservableArrayAdministration);\nfunction isObservableArray(thing) {\n return isObject(thing) && isObservableArrayAdministration(thing[$mobx]);\n}\n\nvar ObservableMapMarker = {};\nvar ADD = \"add\";\nvar DELETE = \"delete\";\n// just extend Map? See also https://gist.github.com/nestharus/13b4d74f2ef4a2f4357dbd3fc23c1e54\n// But: https://github.com/mobxjs/mobx/issues/1556\nvar ObservableMap = /*#__PURE__*/function () {\n function ObservableMap(initialData, enhancer_, name_) {\n var _this = this;\n if (enhancer_ === void 0) {\n enhancer_ = deepEnhancer;\n }\n if (name_ === void 0) {\n name_ = true ? \"ObservableMap@\" + getNextId() : 0;\n }\n this.enhancer_ = void 0;\n this.name_ = void 0;\n this[$mobx] = ObservableMapMarker;\n this.data_ = void 0;\n this.hasMap_ = void 0;\n // hasMap, not hashMap >-).\n this.keysAtom_ = void 0;\n this.interceptors_ = void 0;\n this.changeListeners_ = void 0;\n this.dehancer = void 0;\n this.enhancer_ = enhancer_;\n this.name_ = name_;\n if (!isFunction(Map)) {\n die(18);\n }\n initObservable(function () {\n _this.keysAtom_ = createAtom( true ? _this.name_ + \".keys()\" : 0);\n _this.data_ = new Map();\n _this.hasMap_ = new Map();\n if (initialData) {\n _this.merge(initialData);\n }\n });\n }\n var _proto = ObservableMap.prototype;\n _proto.has_ = function has_(key) {\n return this.data_.has(key);\n };\n _proto.has = function has(key) {\n var _this2 = this;\n if (!globalState.trackingDerivation) {\n return this.has_(key);\n }\n var entry = this.hasMap_.get(key);\n if (!entry) {\n var newEntry = entry = new ObservableValue(this.has_(key), referenceEnhancer, true ? this.name_ + \".\" + stringifyKey(key) + \"?\" : 0, false);\n this.hasMap_.set(key, newEntry);\n onBecomeUnobserved(newEntry, function () {\n return _this2.hasMap_[\"delete\"](key);\n });\n }\n return entry.get();\n };\n _proto.set = function set(key, value) {\n var hasKey = this.has_(key);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: hasKey ? UPDATE : ADD,\n object: this,\n newValue: value,\n name: key\n });\n if (!change) {\n return this;\n }\n value = change.newValue;\n }\n if (hasKey) {\n this.updateValue_(key, value);\n } else {\n this.addValue_(key, value);\n }\n return this;\n };\n _proto[\"delete\"] = function _delete(key) {\n var _this3 = this;\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: DELETE,\n object: this,\n name: key\n });\n if (!change) {\n return false;\n }\n }\n if (this.has_(key)) {\n var notifySpy = isSpyEnabled();\n var notify = hasListeners(this);\n var _change = notify || notifySpy ? {\n observableKind: \"map\",\n debugObjectName: this.name_,\n type: DELETE,\n object: this,\n oldValue: this.data_.get(key).value_,\n name: key\n } : null;\n if ( true && notifySpy) {\n spyReportStart(_change);\n } // TODO fix type\n transaction(function () {\n var _this3$hasMap_$get;\n _this3.keysAtom_.reportChanged();\n (_this3$hasMap_$get = _this3.hasMap_.get(key)) == null || _this3$hasMap_$get.setNewValue_(false);\n var observable = _this3.data_.get(key);\n observable.setNewValue_(undefined);\n _this3.data_[\"delete\"](key);\n });\n if (notify) {\n notifyListeners(this, _change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n return true;\n }\n return false;\n };\n _proto.updateValue_ = function updateValue_(key, newValue) {\n var observable = this.data_.get(key);\n newValue = observable.prepareNewValue_(newValue);\n if (newValue !== globalState.UNCHANGED) {\n var notifySpy = isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"map\",\n debugObjectName: this.name_,\n type: UPDATE,\n object: this,\n oldValue: observable.value_,\n name: key,\n newValue: newValue\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n } // TODO fix type\n observable.setNewValue_(newValue);\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n };\n _proto.addValue_ = function addValue_(key, newValue) {\n var _this4 = this;\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n transaction(function () {\n var _this4$hasMap_$get;\n var observable = new ObservableValue(newValue, _this4.enhancer_, true ? _this4.name_ + \".\" + stringifyKey(key) : 0, false);\n _this4.data_.set(key, observable);\n newValue = observable.value_; // value might have been changed\n (_this4$hasMap_$get = _this4.hasMap_.get(key)) == null || _this4$hasMap_$get.setNewValue_(true);\n _this4.keysAtom_.reportChanged();\n });\n var notifySpy = isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"map\",\n debugObjectName: this.name_,\n type: ADD,\n object: this,\n name: key,\n newValue: newValue\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n } // TODO fix type\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n };\n _proto.get = function get(key) {\n if (this.has(key)) {\n return this.dehanceValue_(this.data_.get(key).get());\n }\n return this.dehanceValue_(undefined);\n };\n _proto.dehanceValue_ = function dehanceValue_(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.keys = function keys() {\n this.keysAtom_.reportObserved();\n return this.data_.keys();\n };\n _proto.values = function values() {\n var self = this;\n var keys = this.keys();\n return makeIterableForMap({\n next: function next() {\n var _keys$next = keys.next(),\n done = _keys$next.done,\n value = _keys$next.value;\n return {\n done: done,\n value: done ? undefined : self.get(value)\n };\n }\n });\n };\n _proto.entries = function entries() {\n var self = this;\n var keys = this.keys();\n return makeIterableForMap({\n next: function next() {\n var _keys$next2 = keys.next(),\n done = _keys$next2.done,\n value = _keys$next2.value;\n return {\n done: done,\n value: done ? undefined : [value, self.get(value)]\n };\n }\n });\n };\n _proto[Symbol.iterator] = function () {\n return this.entries();\n };\n _proto.forEach = function forEach(callback, thisArg) {\n for (var _iterator = _createForOfIteratorHelperLoose(this), _step; !(_step = _iterator()).done;) {\n var _step$value = _step.value,\n key = _step$value[0],\n value = _step$value[1];\n callback.call(thisArg, value, key, this);\n }\n }\n /** Merge another object into this object, returns this. */;\n _proto.merge = function merge(other) {\n var _this5 = this;\n if (isObservableMap(other)) {\n other = new Map(other);\n }\n transaction(function () {\n if (isPlainObject(other)) {\n getPlainObjectKeys(other).forEach(function (key) {\n return _this5.set(key, other[key]);\n });\n } else if (Array.isArray(other)) {\n other.forEach(function (_ref) {\n var key = _ref[0],\n value = _ref[1];\n return _this5.set(key, value);\n });\n } else if (isES6Map(other)) {\n if (!isPlainES6Map(other)) {\n die(19, other);\n }\n other.forEach(function (value, key) {\n return _this5.set(key, value);\n });\n } else if (other !== null && other !== undefined) {\n die(20, other);\n }\n });\n return this;\n };\n _proto.clear = function clear() {\n var _this6 = this;\n transaction(function () {\n untracked(function () {\n for (var _iterator2 = _createForOfIteratorHelperLoose(_this6.keys()), _step2; !(_step2 = _iterator2()).done;) {\n var key = _step2.value;\n _this6[\"delete\"](key);\n }\n });\n });\n };\n _proto.replace = function replace(values) {\n var _this7 = this;\n // Implementation requirements:\n // - respect ordering of replacement map\n // - allow interceptors to run and potentially prevent individual operations\n // - don't recreate observables that already exist in original map (so we don't destroy existing subscriptions)\n // - don't _keysAtom.reportChanged if the keys of resulting map are indentical (order matters!)\n // - note that result map may differ from replacement map due to the interceptors\n transaction(function () {\n // Convert to map so we can do quick key lookups\n var replacementMap = convertToMap(values);\n var orderedData = new Map();\n // Used for optimization\n var keysReportChangedCalled = false;\n // Delete keys that don't exist in replacement map\n // if the key deletion is prevented by interceptor\n // add entry at the beginning of the result map\n for (var _iterator3 = _createForOfIteratorHelperLoose(_this7.data_.keys()), _step3; !(_step3 = _iterator3()).done;) {\n var key = _step3.value;\n // Concurrently iterating/deleting keys\n // iterator should handle this correctly\n if (!replacementMap.has(key)) {\n var deleted = _this7[\"delete\"](key);\n // Was the key removed?\n if (deleted) {\n // _keysAtom.reportChanged() was already called\n keysReportChangedCalled = true;\n } else {\n // Delete prevented by interceptor\n var value = _this7.data_.get(key);\n orderedData.set(key, value);\n }\n }\n }\n // Merge entries\n for (var _iterator4 = _createForOfIteratorHelperLoose(replacementMap.entries()), _step4; !(_step4 = _iterator4()).done;) {\n var _step4$value = _step4.value,\n _key = _step4$value[0],\n _value = _step4$value[1];\n // We will want to know whether a new key is added\n var keyExisted = _this7.data_.has(_key);\n // Add or update value\n _this7.set(_key, _value);\n // The addition could have been prevent by interceptor\n if (_this7.data_.has(_key)) {\n // The update could have been prevented by interceptor\n // and also we want to preserve existing values\n // so use value from _data map (instead of replacement map)\n var _value2 = _this7.data_.get(_key);\n orderedData.set(_key, _value2);\n // Was a new key added?\n if (!keyExisted) {\n // _keysAtom.reportChanged() was already called\n keysReportChangedCalled = true;\n }\n }\n }\n // Check for possible key order change\n if (!keysReportChangedCalled) {\n if (_this7.data_.size !== orderedData.size) {\n // If size differs, keys are definitely modified\n _this7.keysAtom_.reportChanged();\n } else {\n var iter1 = _this7.data_.keys();\n var iter2 = orderedData.keys();\n var next1 = iter1.next();\n var next2 = iter2.next();\n while (!next1.done) {\n if (next1.value !== next2.value) {\n _this7.keysAtom_.reportChanged();\n break;\n }\n next1 = iter1.next();\n next2 = iter2.next();\n }\n }\n }\n // Use correctly ordered map\n _this7.data_ = orderedData;\n });\n return this;\n };\n _proto.toString = function toString() {\n return \"[object ObservableMap]\";\n };\n _proto.toJSON = function toJSON() {\n return Array.from(this);\n };\n /**\n * Observes this object. Triggers for the events 'add', 'update' and 'delete'.\n * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe\n * for callback details\n */\n _proto.observe_ = function observe_(listener, fireImmediately) {\n if ( true && fireImmediately === true) {\n die(\"`observe` doesn't support fireImmediately=true in combination with maps.\");\n }\n return registerListener(this, listener);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n return _createClass(ObservableMap, [{\n key: \"size\",\n get: function get() {\n this.keysAtom_.reportObserved();\n return this.data_.size;\n }\n }, {\n key: Symbol.toStringTag,\n get: function get() {\n return \"Map\";\n }\n }]);\n}();\n// eslint-disable-next-line\nvar isObservableMap = /*#__PURE__*/createInstanceofPredicate(\"ObservableMap\", ObservableMap);\nfunction makeIterableForMap(iterator) {\n iterator[Symbol.toStringTag] = \"MapIterator\";\n return makeIterable(iterator);\n}\nfunction convertToMap(dataStructure) {\n if (isES6Map(dataStructure) || isObservableMap(dataStructure)) {\n return dataStructure;\n } else if (Array.isArray(dataStructure)) {\n return new Map(dataStructure);\n } else if (isPlainObject(dataStructure)) {\n var map = new Map();\n for (var key in dataStructure) {\n map.set(key, dataStructure[key]);\n }\n return map;\n } else {\n return die(21, dataStructure);\n }\n}\n\nvar ObservableSetMarker = {};\nvar ObservableSet = /*#__PURE__*/function () {\n function ObservableSet(initialData, enhancer, name_) {\n var _this = this;\n if (enhancer === void 0) {\n enhancer = deepEnhancer;\n }\n if (name_ === void 0) {\n name_ = true ? \"ObservableSet@\" + getNextId() : 0;\n }\n this.name_ = void 0;\n this[$mobx] = ObservableSetMarker;\n this.data_ = new Set();\n this.atom_ = void 0;\n this.changeListeners_ = void 0;\n this.interceptors_ = void 0;\n this.dehancer = void 0;\n this.enhancer_ = void 0;\n this.name_ = name_;\n if (!isFunction(Set)) {\n die(22);\n }\n this.enhancer_ = function (newV, oldV) {\n return enhancer(newV, oldV, name_);\n };\n initObservable(function () {\n _this.atom_ = createAtom(_this.name_);\n if (initialData) {\n _this.replace(initialData);\n }\n });\n }\n var _proto = ObservableSet.prototype;\n _proto.dehanceValue_ = function dehanceValue_(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.clear = function clear() {\n var _this2 = this;\n transaction(function () {\n untracked(function () {\n for (var _iterator = _createForOfIteratorHelperLoose(_this2.data_.values()), _step; !(_step = _iterator()).done;) {\n var value = _step.value;\n _this2[\"delete\"](value);\n }\n });\n });\n };\n _proto.forEach = function forEach(callbackFn, thisArg) {\n for (var _iterator2 = _createForOfIteratorHelperLoose(this), _step2; !(_step2 = _iterator2()).done;) {\n var value = _step2.value;\n callbackFn.call(thisArg, value, value, this);\n }\n };\n _proto.add = function add(value) {\n var _this3 = this;\n checkIfStateModificationsAreAllowed(this.atom_);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: ADD,\n object: this,\n newValue: value\n });\n if (!change) {\n return this;\n }\n // ideally, value = change.value would be done here, so that values can be\n // changed by interceptor. Same applies for other Set and Map api's.\n }\n if (!this.has(value)) {\n transaction(function () {\n _this3.data_.add(_this3.enhancer_(value, undefined));\n _this3.atom_.reportChanged();\n });\n var notifySpy = true && isSpyEnabled();\n var notify = hasListeners(this);\n var _change = notify || notifySpy ? {\n observableKind: \"set\",\n debugObjectName: this.name_,\n type: ADD,\n object: this,\n newValue: value\n } : null;\n if (notifySpy && \"development\" !== \"production\") {\n spyReportStart(_change);\n }\n if (notify) {\n notifyListeners(this, _change);\n }\n if (notifySpy && \"development\" !== \"production\") {\n spyReportEnd();\n }\n }\n return this;\n };\n _proto[\"delete\"] = function _delete(value) {\n var _this4 = this;\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: DELETE,\n object: this,\n oldValue: value\n });\n if (!change) {\n return false;\n }\n }\n if (this.has(value)) {\n var notifySpy = true && isSpyEnabled();\n var notify = hasListeners(this);\n var _change2 = notify || notifySpy ? {\n observableKind: \"set\",\n debugObjectName: this.name_,\n type: DELETE,\n object: this,\n oldValue: value\n } : null;\n if (notifySpy && \"development\" !== \"production\") {\n spyReportStart(_change2);\n }\n transaction(function () {\n _this4.atom_.reportChanged();\n _this4.data_[\"delete\"](value);\n });\n if (notify) {\n notifyListeners(this, _change2);\n }\n if (notifySpy && \"development\" !== \"production\") {\n spyReportEnd();\n }\n return true;\n }\n return false;\n };\n _proto.has = function has(value) {\n this.atom_.reportObserved();\n return this.data_.has(this.dehanceValue_(value));\n };\n _proto.entries = function entries() {\n var nextIndex = 0;\n var keys = Array.from(this.keys());\n var values = Array.from(this.values());\n return makeIterableForSet({\n next: function next() {\n var index = nextIndex;\n nextIndex += 1;\n return index < values.length ? {\n value: [keys[index], values[index]],\n done: false\n } : {\n value: undefined,\n done: true\n };\n }\n });\n };\n _proto.keys = function keys() {\n return this.values();\n };\n _proto.values = function values() {\n this.atom_.reportObserved();\n var self = this;\n var nextIndex = 0;\n var observableValues = Array.from(this.data_.values());\n return makeIterableForSet({\n next: function next() {\n return nextIndex < observableValues.length ? {\n value: self.dehanceValue_(observableValues[nextIndex++]),\n done: false\n } : {\n value: undefined,\n done: true\n };\n }\n });\n };\n _proto.intersection = function intersection(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.intersection(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.intersection(otherSet);\n }\n };\n _proto.union = function union(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.union(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.union(otherSet);\n }\n };\n _proto.difference = function difference(otherSet) {\n return new Set(this).difference(otherSet);\n };\n _proto.symmetricDifference = function symmetricDifference(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.symmetricDifference(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.symmetricDifference(otherSet);\n }\n };\n _proto.isSubsetOf = function isSubsetOf(otherSet) {\n return new Set(this).isSubsetOf(otherSet);\n };\n _proto.isSupersetOf = function isSupersetOf(otherSet) {\n return new Set(this).isSupersetOf(otherSet);\n };\n _proto.isDisjointFrom = function isDisjointFrom(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.isDisjointFrom(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.isDisjointFrom(otherSet);\n }\n };\n _proto.replace = function replace(other) {\n var _this5 = this;\n if (isObservableSet(other)) {\n other = new Set(other);\n }\n transaction(function () {\n if (Array.isArray(other)) {\n _this5.clear();\n other.forEach(function (value) {\n return _this5.add(value);\n });\n } else if (isES6Set(other)) {\n _this5.clear();\n other.forEach(function (value) {\n return _this5.add(value);\n });\n } else if (other !== null && other !== undefined) {\n die(\"Cannot initialize set from \" + other);\n }\n });\n return this;\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n // ... 'fireImmediately' could also be true?\n if ( true && fireImmediately === true) {\n die(\"`observe` doesn't support fireImmediately=true in combination with sets.\");\n }\n return registerListener(this, listener);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.toJSON = function toJSON() {\n return Array.from(this);\n };\n _proto.toString = function toString() {\n return \"[object ObservableSet]\";\n };\n _proto[Symbol.iterator] = function () {\n return this.values();\n };\n return _createClass(ObservableSet, [{\n key: \"size\",\n get: function get() {\n this.atom_.reportObserved();\n return this.data_.size;\n }\n }, {\n key: Symbol.toStringTag,\n get: function get() {\n return \"Set\";\n }\n }]);\n}();\n// eslint-disable-next-line\nvar isObservableSet = /*#__PURE__*/createInstanceofPredicate(\"ObservableSet\", ObservableSet);\nfunction makeIterableForSet(iterator) {\n iterator[Symbol.toStringTag] = \"SetIterator\";\n return makeIterable(iterator);\n}\n\nvar descriptorCache = /*#__PURE__*/Object.create(null);\nvar REMOVE = \"remove\";\nvar ObservableObjectAdministration = /*#__PURE__*/function () {\n function ObservableObjectAdministration(target_, values_, name_,\n // Used anytime annotation is not explicitely provided\n defaultAnnotation_) {\n if (values_ === void 0) {\n values_ = new Map();\n }\n if (defaultAnnotation_ === void 0) {\n defaultAnnotation_ = autoAnnotation;\n }\n this.target_ = void 0;\n this.values_ = void 0;\n this.name_ = void 0;\n this.defaultAnnotation_ = void 0;\n this.keysAtom_ = void 0;\n this.changeListeners_ = void 0;\n this.interceptors_ = void 0;\n this.proxy_ = void 0;\n this.isPlainObject_ = void 0;\n this.appliedAnnotations_ = void 0;\n this.pendingKeys_ = void 0;\n this.target_ = target_;\n this.values_ = values_;\n this.name_ = name_;\n this.defaultAnnotation_ = defaultAnnotation_;\n this.keysAtom_ = new Atom( true ? this.name_ + \".keys\" : 0);\n // Optimization: we use this frequently\n this.isPlainObject_ = isPlainObject(this.target_);\n if ( true && !isAnnotation(this.defaultAnnotation_)) {\n die(\"defaultAnnotation must be valid annotation\");\n }\n if (true) {\n // Prepare structure for tracking which fields were already annotated\n this.appliedAnnotations_ = {};\n }\n }\n var _proto = ObservableObjectAdministration.prototype;\n _proto.getObservablePropValue_ = function getObservablePropValue_(key) {\n return this.values_.get(key).get();\n };\n _proto.setObservablePropValue_ = function setObservablePropValue_(key, newValue) {\n var observable = this.values_.get(key);\n if (observable instanceof ComputedValue) {\n observable.set(newValue);\n return true;\n }\n // intercept\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: UPDATE,\n object: this.proxy_ || this.target_,\n name: key,\n newValue: newValue\n });\n if (!change) {\n return null;\n }\n newValue = change.newValue;\n }\n newValue = observable.prepareNewValue_(newValue);\n // notify spy & observers\n if (newValue !== globalState.UNCHANGED) {\n var notify = hasListeners(this);\n var notifySpy = true && isSpyEnabled();\n var _change = notify || notifySpy ? {\n type: UPDATE,\n observableKind: \"object\",\n debugObjectName: this.name_,\n object: this.proxy_ || this.target_,\n oldValue: observable.value_,\n name: key,\n newValue: newValue\n } : null;\n if ( true && notifySpy) {\n spyReportStart(_change);\n }\n observable.setNewValue_(newValue);\n if (notify) {\n notifyListeners(this, _change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n return true;\n };\n _proto.get_ = function get_(key) {\n if (globalState.trackingDerivation && !hasProp(this.target_, key)) {\n // Key doesn't exist yet, subscribe for it in case it's added later\n this.has_(key);\n }\n return this.target_[key];\n }\n /**\n * @param {PropertyKey} key\n * @param {any} value\n * @param {Annotation|boolean} annotation true - use default annotation, false - copy as is\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.set_ = function set_(key, value, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n // Don't use .has(key) - we care about own\n if (hasProp(this.target_, key)) {\n // Existing prop\n if (this.values_.has(key)) {\n // Observable (can be intercepted)\n return this.setObservablePropValue_(key, value);\n } else if (proxyTrap) {\n // Non-observable - proxy\n return Reflect.set(this.target_, key, value);\n } else {\n // Non-observable\n this.target_[key] = value;\n return true;\n }\n } else {\n // New prop\n return this.extend_(key, {\n value: value,\n enumerable: true,\n writable: true,\n configurable: true\n }, this.defaultAnnotation_, proxyTrap);\n }\n }\n // Trap for \"in\"\n ;\n _proto.has_ = function has_(key) {\n if (!globalState.trackingDerivation) {\n // Skip key subscription outside derivation\n return key in this.target_;\n }\n this.pendingKeys_ || (this.pendingKeys_ = new Map());\n var entry = this.pendingKeys_.get(key);\n if (!entry) {\n entry = new ObservableValue(key in this.target_, referenceEnhancer, true ? this.name_ + \".\" + stringifyKey(key) + \"?\" : 0, false);\n this.pendingKeys_.set(key, entry);\n }\n return entry.get();\n }\n /**\n * @param {PropertyKey} key\n * @param {Annotation|boolean} annotation true - use default annotation, false - ignore prop\n */;\n _proto.make_ = function make_(key, annotation) {\n if (annotation === true) {\n annotation = this.defaultAnnotation_;\n }\n if (annotation === false) {\n return;\n }\n assertAnnotable(this, annotation, key);\n if (!(key in this.target_)) {\n var _this$target_$storedA;\n // Throw on missing key, except for decorators:\n // Decorator annotations are collected from whole prototype chain.\n // When called from super() some props may not exist yet.\n // However we don't have to worry about missing prop,\n // because the decorator must have been applied to something.\n if ((_this$target_$storedA = this.target_[storedAnnotationsSymbol]) != null && _this$target_$storedA[key]) {\n return; // will be annotated by subclass constructor\n } else {\n die(1, annotation.annotationType_, this.name_ + \".\" + key.toString());\n }\n }\n var source = this.target_;\n while (source && source !== objectPrototype) {\n var descriptor = getDescriptor(source, key);\n if (descriptor) {\n var outcome = annotation.make_(this, key, descriptor, source);\n if (outcome === 0 /* MakeResult.Cancel */) {\n return;\n }\n if (outcome === 1 /* MakeResult.Break */) {\n break;\n }\n }\n source = Object.getPrototypeOf(source);\n }\n recordAnnotationApplied(this, annotation, key);\n }\n /**\n * @param {PropertyKey} key\n * @param {PropertyDescriptor} descriptor\n * @param {Annotation|boolean} annotation true - use default annotation, false - copy as is\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.extend_ = function extend_(key, descriptor, annotation, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n if (annotation === true) {\n annotation = this.defaultAnnotation_;\n }\n if (annotation === false) {\n return this.defineProperty_(key, descriptor, proxyTrap);\n }\n assertAnnotable(this, annotation, key);\n var outcome = annotation.extend_(this, key, descriptor, proxyTrap);\n if (outcome) {\n recordAnnotationApplied(this, annotation, key);\n }\n return outcome;\n }\n /**\n * @param {PropertyKey} key\n * @param {PropertyDescriptor} descriptor\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.defineProperty_ = function defineProperty_(key, descriptor, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n try {\n startBatch();\n // Delete\n var deleteOutcome = this.delete_(key);\n if (!deleteOutcome) {\n // Failure or intercepted\n return deleteOutcome;\n }\n // ADD interceptor\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: ADD,\n newValue: descriptor.value\n });\n if (!change) {\n return null;\n }\n var newValue = change.newValue;\n if (descriptor.value !== newValue) {\n descriptor = _extends({}, descriptor, {\n value: newValue\n });\n }\n }\n // Define\n if (proxyTrap) {\n if (!Reflect.defineProperty(this.target_, key, descriptor)) {\n return false;\n }\n } else {\n defineProperty(this.target_, key, descriptor);\n }\n // Notify\n this.notifyPropertyAddition_(key, descriptor.value);\n } finally {\n endBatch();\n }\n return true;\n }\n // If original descriptor becomes relevant, move this to annotation directly\n ;\n _proto.defineObservableProperty_ = function defineObservableProperty_(key, value, enhancer, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n try {\n startBatch();\n // Delete\n var deleteOutcome = this.delete_(key);\n if (!deleteOutcome) {\n // Failure or intercepted\n return deleteOutcome;\n }\n // ADD interceptor\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: ADD,\n newValue: value\n });\n if (!change) {\n return null;\n }\n value = change.newValue;\n }\n var cachedDescriptor = getCachedObservablePropDescriptor(key);\n var descriptor = {\n configurable: globalState.safeDescriptors ? this.isPlainObject_ : true,\n enumerable: true,\n get: cachedDescriptor.get,\n set: cachedDescriptor.set\n };\n // Define\n if (proxyTrap) {\n if (!Reflect.defineProperty(this.target_, key, descriptor)) {\n return false;\n }\n } else {\n defineProperty(this.target_, key, descriptor);\n }\n var observable = new ObservableValue(value, enhancer, true ? this.name_ + \".\" + key.toString() : 0, false);\n this.values_.set(key, observable);\n // Notify (value possibly changed by ObservableValue)\n this.notifyPropertyAddition_(key, observable.value_);\n } finally {\n endBatch();\n }\n return true;\n }\n // If original descriptor becomes relevant, move this to annotation directly\n ;\n _proto.defineComputedProperty_ = function defineComputedProperty_(key, options, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n try {\n startBatch();\n // Delete\n var deleteOutcome = this.delete_(key);\n if (!deleteOutcome) {\n // Failure or intercepted\n return deleteOutcome;\n }\n // ADD interceptor\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: ADD,\n newValue: undefined\n });\n if (!change) {\n return null;\n }\n }\n options.name || (options.name = true ? this.name_ + \".\" + key.toString() : 0);\n options.context = this.proxy_ || this.target_;\n var cachedDescriptor = getCachedObservablePropDescriptor(key);\n var descriptor = {\n configurable: globalState.safeDescriptors ? this.isPlainObject_ : true,\n enumerable: false,\n get: cachedDescriptor.get,\n set: cachedDescriptor.set\n };\n // Define\n if (proxyTrap) {\n if (!Reflect.defineProperty(this.target_, key, descriptor)) {\n return false;\n }\n } else {\n defineProperty(this.target_, key, descriptor);\n }\n this.values_.set(key, new ComputedValue(options));\n // Notify\n this.notifyPropertyAddition_(key, undefined);\n } finally {\n endBatch();\n }\n return true;\n }\n /**\n * @param {PropertyKey} key\n * @param {PropertyDescriptor} descriptor\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.delete_ = function delete_(key, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n // No such prop\n if (!hasProp(this.target_, key)) {\n return true;\n }\n // Intercept\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: REMOVE\n });\n // Cancelled\n if (!change) {\n return null;\n }\n }\n // Delete\n try {\n var _this$pendingKeys_;\n startBatch();\n var notify = hasListeners(this);\n var notifySpy = true && isSpyEnabled();\n var observable = this.values_.get(key);\n // Value needed for spies/listeners\n var value = undefined;\n // Optimization: don't pull the value unless we will need it\n if (!observable && (notify || notifySpy)) {\n var _getDescriptor;\n value = (_getDescriptor = getDescriptor(this.target_, key)) == null ? void 0 : _getDescriptor.value;\n }\n // delete prop (do first, may fail)\n if (proxyTrap) {\n if (!Reflect.deleteProperty(this.target_, key)) {\n return false;\n }\n } else {\n delete this.target_[key];\n }\n // Allow re-annotating this field\n if (true) {\n delete this.appliedAnnotations_[key];\n }\n // Clear observable\n if (observable) {\n this.values_[\"delete\"](key);\n // for computed, value is undefined\n if (observable instanceof ObservableValue) {\n value = observable.value_;\n }\n // Notify: autorun(() => obj[key]), see #1796\n propagateChanged(observable);\n }\n // Notify \"keys/entries/values\" observers\n this.keysAtom_.reportChanged();\n // Notify \"has\" observers\n // \"in\" as it may still exist in proto\n (_this$pendingKeys_ = this.pendingKeys_) == null || (_this$pendingKeys_ = _this$pendingKeys_.get(key)) == null || _this$pendingKeys_.set(key in this.target_);\n // Notify spies/listeners\n if (notify || notifySpy) {\n var _change2 = {\n type: REMOVE,\n observableKind: \"object\",\n object: this.proxy_ || this.target_,\n debugObjectName: this.name_,\n oldValue: value,\n name: key\n };\n if ( true && notifySpy) {\n spyReportStart(_change2);\n }\n if (notify) {\n notifyListeners(this, _change2);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n } finally {\n endBatch();\n }\n return true;\n }\n /**\n * Observes this object. Triggers for the events 'add', 'update' and 'delete'.\n * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe\n * for callback details\n */;\n _proto.observe_ = function observe_(callback, fireImmediately) {\n if ( true && fireImmediately === true) {\n die(\"`observe` doesn't support the fire immediately property for observable objects.\");\n }\n return registerListener(this, callback);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.notifyPropertyAddition_ = function notifyPropertyAddition_(key, value) {\n var _this$pendingKeys_2;\n var notify = hasListeners(this);\n var notifySpy = true && isSpyEnabled();\n if (notify || notifySpy) {\n var change = notify || notifySpy ? {\n type: ADD,\n observableKind: \"object\",\n debugObjectName: this.name_,\n object: this.proxy_ || this.target_,\n name: key,\n newValue: value\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n }\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n (_this$pendingKeys_2 = this.pendingKeys_) == null || (_this$pendingKeys_2 = _this$pendingKeys_2.get(key)) == null || _this$pendingKeys_2.set(true);\n // Notify \"keys/entries/values\" observers\n this.keysAtom_.reportChanged();\n };\n _proto.ownKeys_ = function ownKeys_() {\n this.keysAtom_.reportObserved();\n return ownKeys(this.target_);\n };\n _proto.keys_ = function keys_() {\n // Returns enumerable && own, but unfortunately keysAtom will report on ANY key change.\n // There is no way to distinguish between Object.keys(object) and Reflect.ownKeys(object) - both are handled by ownKeys trap.\n // We can either over-report in Object.keys(object) or under-report in Reflect.ownKeys(object)\n // We choose to over-report in Object.keys(object), because:\n // - typically it's used with simple data objects\n // - when symbolic/non-enumerable keys are relevant Reflect.ownKeys works as expected\n this.keysAtom_.reportObserved();\n return Object.keys(this.target_);\n };\n return ObservableObjectAdministration;\n}();\nfunction asObservableObject(target, options) {\n var _options$name;\n if ( true && options && isObservableObject(target)) {\n die(\"Options can't be provided for already observable objects.\");\n }\n if (hasProp(target, $mobx)) {\n if ( true && !(getAdministration(target) instanceof ObservableObjectAdministration)) {\n die(\"Cannot convert '\" + getDebugName(target) + \"' into observable object:\" + \"\\nThe target is already observable of different type.\" + \"\\nExtending builtins is not supported.\");\n }\n return target;\n }\n if ( true && !Object.isExtensible(target)) {\n die(\"Cannot make the designated object observable; it is not extensible\");\n }\n var name = (_options$name = options == null ? void 0 : options.name) != null ? _options$name : true ? (isPlainObject(target) ? \"ObservableObject\" : target.constructor.name) + \"@\" + getNextId() : 0;\n var adm = new ObservableObjectAdministration(target, new Map(), String(name), getAnnotationFromOptions(options));\n addHiddenProp(target, $mobx, adm);\n return target;\n}\nvar isObservableObjectAdministration = /*#__PURE__*/createInstanceofPredicate(\"ObservableObjectAdministration\", ObservableObjectAdministration);\nfunction getCachedObservablePropDescriptor(key) {\n return descriptorCache[key] || (descriptorCache[key] = {\n get: function get() {\n return this[$mobx].getObservablePropValue_(key);\n },\n set: function set(value) {\n return this[$mobx].setObservablePropValue_(key, value);\n }\n });\n}\nfunction isObservableObject(thing) {\n if (isObject(thing)) {\n return isObservableObjectAdministration(thing[$mobx]);\n }\n return false;\n}\nfunction recordAnnotationApplied(adm, annotation, key) {\n var _adm$target_$storedAn;\n if (true) {\n adm.appliedAnnotations_[key] = annotation;\n }\n // Remove applied decorator annotation so we don't try to apply it again in subclass constructor\n (_adm$target_$storedAn = adm.target_[storedAnnotationsSymbol]) == null || delete _adm$target_$storedAn[key];\n}\nfunction assertAnnotable(adm, annotation, key) {\n // Valid annotation\n if ( true && !isAnnotation(annotation)) {\n die(\"Cannot annotate '\" + adm.name_ + \".\" + key.toString() + \"': Invalid annotation.\");\n }\n /*\n // Configurable, not sealed, not frozen\n // Possibly not needed, just a little better error then the one thrown by engine.\n // Cases where this would be useful the most (subclass field initializer) are not interceptable by this.\n if (__DEV__) {\n const configurable = getDescriptor(adm.target_, key)?.configurable\n const frozen = Object.isFrozen(adm.target_)\n const sealed = Object.isSealed(adm.target_)\n if (!configurable || frozen || sealed) {\n const fieldName = `${adm.name_}.${key.toString()}`\n const requestedAnnotationType = annotation.annotationType_\n let error = `Cannot apply '${requestedAnnotationType}' to '${fieldName}':`\n if (frozen) {\n error += `\\nObject is frozen.`\n }\n if (sealed) {\n error += `\\nObject is sealed.`\n }\n if (!configurable) {\n error += `\\nproperty is not configurable.`\n // Mention only if caused by us to avoid confusion\n if (hasProp(adm.appliedAnnotations!, key)) {\n error += `\\nTo prevent accidental re-definition of a field by a subclass, `\n error += `all annotated fields of non-plain objects (classes) are not configurable.`\n }\n }\n die(error)\n }\n }\n */\n // Not annotated\n if ( true && !isOverride(annotation) && hasProp(adm.appliedAnnotations_, key)) {\n var fieldName = adm.name_ + \".\" + key.toString();\n var currentAnnotationType = adm.appliedAnnotations_[key].annotationType_;\n var requestedAnnotationType = annotation.annotationType_;\n die(\"Cannot apply '\" + requestedAnnotationType + \"' to '\" + fieldName + \"':\" + (\"\\nThe field is already annotated with '\" + currentAnnotationType + \"'.\") + \"\\nRe-annotating fields is not allowed.\" + \"\\nUse 'override' annotation for methods overridden by subclass.\");\n }\n}\n\n// Bug in safari 9.* (or iOS 9 safari mobile). See #364\nvar ENTRY_0 = /*#__PURE__*/createArrayEntryDescriptor(0);\nvar safariPrototypeSetterInheritanceBug = /*#__PURE__*/function () {\n var v = false;\n var p = {};\n Object.defineProperty(p, \"0\", {\n set: function set() {\n v = true;\n }\n });\n /*#__PURE__*/Object.create(p)[\"0\"] = 1;\n return v === false;\n}();\n/**\n * This array buffer contains two lists of properties, so that all arrays\n * can recycle their property definitions, which significantly improves performance of creating\n * properties on the fly.\n */\nvar OBSERVABLE_ARRAY_BUFFER_SIZE = 0;\n// Typescript workaround to make sure ObservableArray extends Array\nvar StubArray = function StubArray() {};\nfunction inherit(ctor, proto) {\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(ctor.prototype, proto);\n } else if (ctor.prototype.__proto__ !== undefined) {\n ctor.prototype.__proto__ = proto;\n } else {\n ctor.prototype = proto;\n }\n}\ninherit(StubArray, Array.prototype);\n// Weex proto freeze protection was here,\n// but it is unclear why the hack is need as MobX never changed the prototype\n// anyway, so removed it in V6\nvar LegacyObservableArray = /*#__PURE__*/function (_StubArray) {\n function LegacyObservableArray(initialValues, enhancer, name, owned) {\n var _this;\n if (name === void 0) {\n name = true ? \"ObservableArray@\" + getNextId() : 0;\n }\n if (owned === void 0) {\n owned = false;\n }\n _this = _StubArray.call(this) || this;\n initObservable(function () {\n var adm = new ObservableArrayAdministration(name, enhancer, owned, true);\n adm.proxy_ = _this;\n addHiddenFinalProp(_this, $mobx, adm);\n if (initialValues && initialValues.length) {\n // @ts-ignore\n _this.spliceWithArray(0, 0, initialValues);\n }\n if (safariPrototypeSetterInheritanceBug) {\n // Seems that Safari won't use numeric prototype setter until any * numeric property is\n // defined on the instance. After that it works fine, even if this property is deleted.\n Object.defineProperty(_this, \"0\", ENTRY_0);\n }\n });\n return _this;\n }\n _inheritsLoose(LegacyObservableArray, _StubArray);\n var _proto = LegacyObservableArray.prototype;\n _proto.concat = function concat() {\n this[$mobx].atom_.reportObserved();\n for (var _len = arguments.length, arrays = new Array(_len), _key = 0; _key < _len; _key++) {\n arrays[_key] = arguments[_key];\n }\n return Array.prototype.concat.apply(this.slice(),\n //@ts-ignore\n arrays.map(function (a) {\n return isObservableArray(a) ? a.slice() : a;\n }));\n };\n _proto[Symbol.iterator] = function () {\n var self = this;\n var nextIndex = 0;\n return makeIterable({\n next: function next() {\n return nextIndex < self.length ? {\n value: self[nextIndex++],\n done: false\n } : {\n done: true,\n value: undefined\n };\n }\n });\n };\n return _createClass(LegacyObservableArray, [{\n key: \"length\",\n get: function get() {\n return this[$mobx].getArrayLength_();\n },\n set: function set(newLength) {\n this[$mobx].setArrayLength_(newLength);\n }\n }, {\n key: Symbol.toStringTag,\n get: function get() {\n return \"Array\";\n }\n }]);\n}(StubArray);\nObject.entries(arrayExtensions).forEach(function (_ref) {\n var prop = _ref[0],\n fn = _ref[1];\n if (prop !== \"concat\") {\n addHiddenProp(LegacyObservableArray.prototype, prop, fn);\n }\n});\nfunction createArrayEntryDescriptor(index) {\n return {\n enumerable: false,\n configurable: true,\n get: function get() {\n return this[$mobx].get_(index);\n },\n set: function set(value) {\n this[$mobx].set_(index, value);\n }\n };\n}\nfunction createArrayBufferItem(index) {\n defineProperty(LegacyObservableArray.prototype, \"\" + index, createArrayEntryDescriptor(index));\n}\nfunction reserveArrayBuffer(max) {\n if (max > OBSERVABLE_ARRAY_BUFFER_SIZE) {\n for (var index = OBSERVABLE_ARRAY_BUFFER_SIZE; index < max + 100; index++) {\n createArrayBufferItem(index);\n }\n OBSERVABLE_ARRAY_BUFFER_SIZE = max;\n }\n}\nreserveArrayBuffer(1000);\nfunction createLegacyArray(initialValues, enhancer, name) {\n return new LegacyObservableArray(initialValues, enhancer, name);\n}\n\nfunction getAtom(thing, property) {\n if (typeof thing === \"object\" && thing !== null) {\n if (isObservableArray(thing)) {\n if (property !== undefined) {\n die(23);\n }\n return thing[$mobx].atom_;\n }\n if (isObservableSet(thing)) {\n return thing.atom_;\n }\n if (isObservableMap(thing)) {\n if (property === undefined) {\n return thing.keysAtom_;\n }\n var observable = thing.data_.get(property) || thing.hasMap_.get(property);\n if (!observable) {\n die(25, property, getDebugName(thing));\n }\n return observable;\n }\n if (isObservableObject(thing)) {\n if (!property) {\n return die(26);\n }\n var _observable = thing[$mobx].values_.get(property);\n if (!_observable) {\n die(27, property, getDebugName(thing));\n }\n return _observable;\n }\n if (isAtom(thing) || isComputedValue(thing) || isReaction(thing)) {\n return thing;\n }\n } else if (isFunction(thing)) {\n if (isReaction(thing[$mobx])) {\n // disposer function\n return thing[$mobx];\n }\n }\n die(28);\n}\nfunction getAdministration(thing, property) {\n if (!thing) {\n die(29);\n }\n if (property !== undefined) {\n return getAdministration(getAtom(thing, property));\n }\n if (isAtom(thing) || isComputedValue(thing) || isReaction(thing)) {\n return thing;\n }\n if (isObservableMap(thing) || isObservableSet(thing)) {\n return thing;\n }\n if (thing[$mobx]) {\n return thing[$mobx];\n }\n die(24, thing);\n}\nfunction getDebugName(thing, property) {\n var named;\n if (property !== undefined) {\n named = getAtom(thing, property);\n } else if (isAction(thing)) {\n return thing.name;\n } else if (isObservableObject(thing) || isObservableMap(thing) || isObservableSet(thing)) {\n named = getAdministration(thing);\n } else {\n // valid for arrays as well\n named = getAtom(thing);\n }\n return named.name_;\n}\n/**\n * Helper function for initializing observable structures, it applies:\n * 1. allowStateChanges so we don't violate enforceActions.\n * 2. untracked so we don't accidentaly subscribe to anything observable accessed during init in case the observable is created inside derivation.\n * 3. batch to avoid state version updates\n */\nfunction initObservable(cb) {\n var derivation = untrackedStart();\n var allowStateChanges = allowStateChangesStart(true);\n startBatch();\n try {\n return cb();\n } finally {\n endBatch();\n allowStateChangesEnd(allowStateChanges);\n untrackedEnd(derivation);\n }\n}\n\nvar toString = objectPrototype.toString;\nfunction deepEqual(a, b, depth) {\n if (depth === void 0) {\n depth = -1;\n }\n return eq(a, b, depth);\n}\n// Copied from https://github.com/jashkenas/underscore/blob/5c237a7c682fb68fd5378203f0bf22dce1624854/underscore.js#L1186-L1289\n// Internal recursive comparison function for `isEqual`.\nfunction eq(a, b, depth, aStack, bStack) {\n // Identical objects are equal. `0 === -0`, but they aren't identical.\n // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).\n if (a === b) {\n return a !== 0 || 1 / a === 1 / b;\n }\n // `null` or `undefined` only equal to itself (strict comparison).\n if (a == null || b == null) {\n return false;\n }\n // `NaN`s are equivalent, but non-reflexive.\n if (a !== a) {\n return b !== b;\n }\n // Exhaust primitive checks\n var type = typeof a;\n if (type !== \"function\" && type !== \"object\" && typeof b != \"object\") {\n return false;\n }\n // Compare `[[Class]]` names.\n var className = toString.call(a);\n if (className !== toString.call(b)) {\n return false;\n }\n switch (className) {\n // Strings, numbers, regular expressions, dates, and booleans are compared by value.\n case \"[object RegExp]\":\n // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i')\n case \"[object String]\":\n // Primitives and their corresponding object wrappers are equivalent; thus, `\"5\"` is\n // equivalent to `new String(\"5\")`.\n return \"\" + a === \"\" + b;\n case \"[object Number]\":\n // `NaN`s are equivalent, but non-reflexive.\n // Object(NaN) is equivalent to NaN.\n if (+a !== +a) {\n return +b !== +b;\n }\n // An `egal` comparison is performed for other numeric values.\n return +a === 0 ? 1 / +a === 1 / b : +a === +b;\n case \"[object Date]\":\n case \"[object Boolean]\":\n // Coerce dates and booleans to numeric primitive values. Dates are compared by their\n // millisecond representations. Note that invalid dates with millisecond representations\n // of `NaN` are not equivalent.\n return +a === +b;\n case \"[object Symbol]\":\n return typeof Symbol !== \"undefined\" && Symbol.valueOf.call(a) === Symbol.valueOf.call(b);\n case \"[object Map]\":\n case \"[object Set]\":\n // Maps and Sets are unwrapped to arrays of entry-pairs, adding an incidental level.\n // Hide this extra level by increasing the depth.\n if (depth >= 0) {\n depth++;\n }\n break;\n }\n // Unwrap any wrapped objects.\n a = unwrap(a);\n b = unwrap(b);\n var areArrays = className === \"[object Array]\";\n if (!areArrays) {\n if (typeof a != \"object\" || typeof b != \"object\") {\n return false;\n }\n // Objects with different constructors are not equivalent, but `Object`s or `Array`s\n // from different frames are.\n var aCtor = a.constructor,\n bCtor = b.constructor;\n if (aCtor !== bCtor && !(isFunction(aCtor) && aCtor instanceof aCtor && isFunction(bCtor) && bCtor instanceof bCtor) && \"constructor\" in a && \"constructor\" in b) {\n return false;\n }\n }\n if (depth === 0) {\n return false;\n } else if (depth < 0) {\n depth = -1;\n }\n // Assume equality for cyclic structures. The algorithm for detecting cyclic\n // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.\n // Initializing stack of traversed objects.\n // It's done here since we only need them for objects and arrays comparison.\n aStack = aStack || [];\n bStack = bStack || [];\n var length = aStack.length;\n while (length--) {\n // Linear search. Performance is inversely proportional to the number of\n // unique nested structures.\n if (aStack[length] === a) {\n return bStack[length] === b;\n }\n }\n // Add the first object to the stack of traversed objects.\n aStack.push(a);\n bStack.push(b);\n // Recursively compare objects and arrays.\n if (areArrays) {\n // Compare array lengths to determine if a deep comparison is necessary.\n length = a.length;\n if (length !== b.length) {\n return false;\n }\n // Deep compare the contents, ignoring non-numeric properties.\n while (length--) {\n if (!eq(a[length], b[length], depth - 1, aStack, bStack)) {\n return false;\n }\n }\n } else {\n // Deep compare objects.\n var keys = Object.keys(a);\n var key;\n length = keys.length;\n // Ensure that both objects contain the same number of properties before comparing deep equality.\n if (Object.keys(b).length !== length) {\n return false;\n }\n while (length--) {\n // Deep compare each member\n key = keys[length];\n if (!(hasProp(b, key) && eq(a[key], b[key], depth - 1, aStack, bStack))) {\n return false;\n }\n }\n }\n // Remove the first object from the stack of traversed objects.\n aStack.pop();\n bStack.pop();\n return true;\n}\nfunction unwrap(a) {\n if (isObservableArray(a)) {\n return a.slice();\n }\n if (isES6Map(a) || isObservableMap(a)) {\n return Array.from(a.entries());\n }\n if (isES6Set(a) || isObservableSet(a)) {\n return Array.from(a.entries());\n }\n return a;\n}\n\nvar _getGlobal$Iterator;\n// safely get iterator prototype if available\nvar maybeIteratorPrototype = ((_getGlobal$Iterator = /*#__PURE__*/getGlobal().Iterator) == null ? void 0 : _getGlobal$Iterator.prototype) || {};\nfunction makeIterable(iterator) {\n iterator[Symbol.iterator] = getSelf;\n return Object.assign(Object.create(maybeIteratorPrototype), iterator);\n}\nfunction getSelf() {\n return this;\n}\n\nfunction isAnnotation(thing) {\n return (\n // Can be function\n thing instanceof Object && typeof thing.annotationType_ === \"string\" && isFunction(thing.make_) && isFunction(thing.extend_)\n );\n}\n\n/**\n * (c) Michel Weststrate 2015 - 2020\n * MIT Licensed\n *\n * Welcome to the mobx sources! To get a global overview of how MobX internally works,\n * this is a good place to start:\n * https://medium.com/@mweststrate/becoming-fully-reactive-an-in-depth-explanation-of-mobservable-55995262a254#.xvbh6qd74\n *\n * Source folders:\n * ===============\n *\n * - api/ Most of the public static methods exposed by the module can be found here.\n * - core/ Implementation of the MobX algorithm; atoms, derivations, reactions, dependency trees, optimizations. Cool stuff can be found here.\n * - types/ All the magic that is need to have observable objects, arrays and values is in this folder. Including the modifiers like `asFlat`.\n * - utils/ Utility stuff.\n *\n */\n[\"Symbol\", \"Map\", \"Set\"].forEach(function (m) {\n var g = getGlobal();\n if (typeof g[m] === \"undefined\") {\n die(\"MobX requires global '\" + m + \"' to be available or polyfilled\");\n }\n});\nif (typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__ === \"object\") {\n // See: https://github.com/andykog/mobx-devtools/\n __MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({\n spy: spy,\n extras: {\n getDebugName: getDebugName\n },\n $mobx: $mobx\n });\n}\n\n\n//# sourceMappingURL=mobx.esm.js.map\n\n\n//# sourceURL=webpack://app_adyen_SFRA/./node_modules/mobx/dist/mobx.esm.js?"); /***/ }) diff --git a/cartridges/app_adyen_SFRA/cartridge/static/default/js/paypalExpress.js b/cartridges/app_adyen_SFRA/cartridge/static/default/js/paypalExpress.js index 98910fcda..043a28c7b 100644 --- a/cartridges/app_adyen_SFRA/cartridge/static/default/js/paypalExpress.js +++ b/cartridges/app_adyen_SFRA/cartridge/static/default/js/paypalExpress.js @@ -36,7 +36,7 @@ eval("\n\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \" \****************************************************************************/ /***/ ((module) => { -eval("\n\n// Adyen constants\n\nmodule.exports = {\n METHOD_ADYEN: 'Adyen',\n METHOD_ADYEN_POS: 'AdyenPOS',\n METHOD_ADYEN_COMPONENT: 'AdyenComponent',\n RECEIVED: 'Received',\n NOTENOUGHBALANCE: 'NotEnoughBalance',\n SUCCESS: 'Success',\n GIFTCARD: 'giftcard',\n SCHEME: 'scheme',\n GIROPAY: 'giropay',\n APPLE_PAY: 'applepay',\n PAYPAL: 'paypal',\n AMAZON_PAY: 'amazonpay',\n ACTIONTYPE: {\n QRCODE: 'qrCode'\n },\n DISABLED_SUBMIT_BUTTON_METHODS: ['paypal', 'paywithgoogle', 'googlepay', 'amazonpay', 'applepay', 'cashapp'],\n MULTIPLE_TX_VARIANTS_COMPONENTS: ['upi']\n};\n\n//# sourceURL=webpack://app_adyen_SFRA/./cartridges/app_adyen_SFRA/cartridge/client/default/js/constants.js?"); +eval("\n\n// Adyen constants\n\nmodule.exports = {\n METHOD_ADYEN: 'Adyen',\n METHOD_ADYEN_POS: 'AdyenPOS',\n METHOD_ADYEN_COMPONENT: 'AdyenComponent',\n RECEIVED: 'Received',\n NOTENOUGHBALANCE: 'NotEnoughBalance',\n SUCCESS: 'Success',\n GIFTCARD: 'giftcard',\n SCHEME: 'scheme',\n GIROPAY: 'giropay',\n APPLE_PAY: 'applepay',\n PAYPAL: 'paypal',\n AMAZON_PAY: 'amazonpay',\n ACTIONTYPE: {\n QRCODE: 'qrCode'\n },\n DISABLED_SUBMIT_BUTTON_METHODS: ['paypal', 'paywithgoogle', 'googlepay', 'amazonpay', 'applepay', 'cashapp', 'upi']\n};\n\n//# sourceURL=webpack://app_adyen_SFRA/./cartridges/app_adyen_SFRA/cartridge/client/default/js/constants.js?"); /***/ }), @@ -66,7 +66,7 @@ eval("\n\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \" \********************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ $mobx: () => (/* binding */ $mobx),\n/* harmony export */ FlowCancellationError: () => (/* binding */ FlowCancellationError),\n/* harmony export */ ObservableMap: () => (/* binding */ ObservableMap),\n/* harmony export */ ObservableSet: () => (/* binding */ ObservableSet),\n/* harmony export */ Reaction: () => (/* binding */ Reaction),\n/* harmony export */ _allowStateChanges: () => (/* binding */ allowStateChanges),\n/* harmony export */ _allowStateChangesInsideComputed: () => (/* binding */ runInAction),\n/* harmony export */ _allowStateReadsEnd: () => (/* binding */ allowStateReadsEnd),\n/* harmony export */ _allowStateReadsStart: () => (/* binding */ allowStateReadsStart),\n/* harmony export */ _autoAction: () => (/* binding */ autoAction),\n/* harmony export */ _endAction: () => (/* binding */ _endAction),\n/* harmony export */ _getAdministration: () => (/* binding */ getAdministration),\n/* harmony export */ _getGlobalState: () => (/* binding */ getGlobalState),\n/* harmony export */ _interceptReads: () => (/* binding */ interceptReads),\n/* harmony export */ _isComputingDerivation: () => (/* binding */ isComputingDerivation),\n/* harmony export */ _resetGlobalState: () => (/* binding */ resetGlobalState),\n/* harmony export */ _startAction: () => (/* binding */ _startAction),\n/* harmony export */ action: () => (/* binding */ action),\n/* harmony export */ autorun: () => (/* binding */ autorun),\n/* harmony export */ comparer: () => (/* binding */ comparer),\n/* harmony export */ computed: () => (/* binding */ computed),\n/* harmony export */ configure: () => (/* binding */ configure),\n/* harmony export */ createAtom: () => (/* binding */ createAtom),\n/* harmony export */ defineProperty: () => (/* binding */ apiDefineProperty),\n/* harmony export */ entries: () => (/* binding */ entries),\n/* harmony export */ extendObservable: () => (/* binding */ extendObservable),\n/* harmony export */ flow: () => (/* binding */ flow),\n/* harmony export */ flowResult: () => (/* binding */ flowResult),\n/* harmony export */ get: () => (/* binding */ get),\n/* harmony export */ getAtom: () => (/* binding */ getAtom),\n/* harmony export */ getDebugName: () => (/* binding */ getDebugName),\n/* harmony export */ getDependencyTree: () => (/* binding */ getDependencyTree),\n/* harmony export */ getObserverTree: () => (/* binding */ getObserverTree),\n/* harmony export */ has: () => (/* binding */ has),\n/* harmony export */ intercept: () => (/* binding */ intercept),\n/* harmony export */ isAction: () => (/* binding */ isAction),\n/* harmony export */ isBoxedObservable: () => (/* binding */ isObservableValue),\n/* harmony export */ isComputed: () => (/* binding */ isComputed),\n/* harmony export */ isComputedProp: () => (/* binding */ isComputedProp),\n/* harmony export */ isFlow: () => (/* binding */ isFlow),\n/* harmony export */ isFlowCancellationError: () => (/* binding */ isFlowCancellationError),\n/* harmony export */ isObservable: () => (/* binding */ isObservable),\n/* harmony export */ isObservableArray: () => (/* binding */ isObservableArray),\n/* harmony export */ isObservableMap: () => (/* binding */ isObservableMap),\n/* harmony export */ isObservableObject: () => (/* binding */ isObservableObject),\n/* harmony export */ isObservableProp: () => (/* binding */ isObservableProp),\n/* harmony export */ isObservableSet: () => (/* binding */ isObservableSet),\n/* harmony export */ keys: () => (/* binding */ keys),\n/* harmony export */ makeAutoObservable: () => (/* binding */ makeAutoObservable),\n/* harmony export */ makeObservable: () => (/* binding */ makeObservable),\n/* harmony export */ observable: () => (/* binding */ observable),\n/* harmony export */ observe: () => (/* binding */ observe),\n/* harmony export */ onBecomeObserved: () => (/* binding */ onBecomeObserved),\n/* harmony export */ onBecomeUnobserved: () => (/* binding */ onBecomeUnobserved),\n/* harmony export */ onReactionError: () => (/* binding */ onReactionError),\n/* harmony export */ override: () => (/* binding */ override),\n/* harmony export */ ownKeys: () => (/* binding */ apiOwnKeys),\n/* harmony export */ reaction: () => (/* binding */ reaction),\n/* harmony export */ remove: () => (/* binding */ remove),\n/* harmony export */ runInAction: () => (/* binding */ runInAction),\n/* harmony export */ set: () => (/* binding */ set),\n/* harmony export */ spy: () => (/* binding */ spy),\n/* harmony export */ toJS: () => (/* binding */ toJS),\n/* harmony export */ trace: () => (/* binding */ trace),\n/* harmony export */ transaction: () => (/* binding */ transaction),\n/* harmony export */ untracked: () => (/* binding */ untracked),\n/* harmony export */ values: () => (/* binding */ values),\n/* harmony export */ when: () => (/* binding */ when)\n/* harmony export */ });\nvar niceErrors = {\n 0: \"Invalid value for configuration 'enforceActions', expected 'never', 'always' or 'observed'\",\n 1: function _(annotationType, key) {\n return \"Cannot apply '\" + annotationType + \"' to '\" + key.toString() + \"': Field not found.\";\n },\n /*\n 2(prop) {\n return `invalid decorator for '${prop.toString()}'`\n },\n 3(prop) {\n return `Cannot decorate '${prop.toString()}': action can only be used on properties with a function value.`\n },\n 4(prop) {\n return `Cannot decorate '${prop.toString()}': computed can only be used on getter properties.`\n },\n */\n 5: \"'keys()' can only be used on observable objects, arrays, sets and maps\",\n 6: \"'values()' can only be used on observable objects, arrays, sets and maps\",\n 7: \"'entries()' can only be used on observable objects, arrays and maps\",\n 8: \"'set()' can only be used on observable objects, arrays and maps\",\n 9: \"'remove()' can only be used on observable objects, arrays and maps\",\n 10: \"'has()' can only be used on observable objects, arrays and maps\",\n 11: \"'get()' can only be used on observable objects, arrays and maps\",\n 12: \"Invalid annotation\",\n 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)\",\n 14: \"Intercept handlers should return nothing or a change object\",\n 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)\",\n 16: \"Modification exception: the internal structure of an observable array was changed.\",\n 17: function _(index, length) {\n return \"[mobx.array] Index out of bounds, \" + index + \" is larger than \" + length;\n },\n 18: \"mobx.map requires Map polyfill for the current browser. Check babel-polyfill or core-js/es6/map.js\",\n 19: function _(other) {\n return \"Cannot initialize from classes that inherit from Map: \" + other.constructor.name;\n },\n 20: function _(other) {\n return \"Cannot initialize map from \" + other;\n },\n 21: function _(dataStructure) {\n return \"Cannot convert to map from '\" + dataStructure + \"'\";\n },\n 22: \"mobx.set requires Set polyfill for the current browser. Check babel-polyfill or core-js/es6/set.js\",\n 23: \"It is not possible to get index atoms from arrays\",\n 24: function _(thing) {\n return \"Cannot obtain administration from \" + thing;\n },\n 25: function _(property, name) {\n return \"the entry '\" + property + \"' does not exist in the observable map '\" + name + \"'\";\n },\n 26: \"please specify a property\",\n 27: function _(property, name) {\n return \"no observable property '\" + property.toString() + \"' found on the observable object '\" + name + \"'\";\n },\n 28: function _(thing) {\n return \"Cannot obtain atom from \" + thing;\n },\n 29: \"Expecting some object\",\n 30: \"invalid action stack. did you forget to finish an action?\",\n 31: \"missing option for computed: get\",\n 32: function _(name, derivation) {\n return \"Cycle detected in computation \" + name + \": \" + derivation;\n },\n 33: function _(name) {\n return \"The setter of computed value '\" + name + \"' is trying to update itself. Did you intend to update an _observable_ value, instead of the computed property?\";\n },\n 34: function _(name) {\n return \"[ComputedValue '\" + name + \"'] It is not possible to assign a new value to a computed value.\";\n },\n 35: \"There are multiple, different versions of MobX active. Make sure MobX is loaded only once or use `configure({ isolateGlobalState: true })`\",\n 36: \"isolateGlobalState should be called before MobX is running any reactions\",\n 37: function _(method) {\n return \"[mobx] `observableArray.\" + method + \"()` mutates the array in-place, which is not allowed inside a derivation. Use `array.slice().\" + method + \"()` instead\";\n },\n 38: \"'ownKeys()' can only be used on observable objects\",\n 39: \"'defineProperty()' can only be used on observable objects\"\n};\nvar errors = true ? niceErrors : 0;\nfunction die(error) {\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n if (true) {\n var e = typeof error === \"string\" ? error : errors[error];\n if (typeof e === \"function\") e = e.apply(null, args);\n throw new Error(\"[MobX] \" + e);\n }\n throw new Error(typeof error === \"number\" ? \"[MobX] minified error nr: \" + error + (args.length ? \" \" + args.map(String).join(\",\") : \"\") + \". Find the full error at: https://github.com/mobxjs/mobx/blob/main/packages/mobx/src/errors.ts\" : \"[MobX] \" + error);\n}\n\nvar mockGlobal = {};\nfunction getGlobal() {\n if (typeof globalThis !== \"undefined\") {\n return globalThis;\n }\n if (typeof window !== \"undefined\") {\n return window;\n }\n if (typeof __webpack_require__.g !== \"undefined\") {\n return __webpack_require__.g;\n }\n if (typeof self !== \"undefined\") {\n return self;\n }\n return mockGlobal;\n}\n\n// We shorten anything used > 5 times\nvar assign = Object.assign;\nvar getDescriptor = Object.getOwnPropertyDescriptor;\nvar defineProperty = Object.defineProperty;\nvar objectPrototype = Object.prototype;\nvar EMPTY_ARRAY = [];\nObject.freeze(EMPTY_ARRAY);\nvar EMPTY_OBJECT = {};\nObject.freeze(EMPTY_OBJECT);\nvar hasProxy = typeof Proxy !== \"undefined\";\nvar plainObjectString = /*#__PURE__*/Object.toString();\nfunction assertProxies() {\n if (!hasProxy) {\n die( true ? \"`Proxy` objects are not available in the current environment. Please configure MobX to enable a fallback implementation.`\" : 0);\n }\n}\nfunction warnAboutProxyRequirement(msg) {\n if ( true && globalState.verifyProxies) {\n die(\"MobX is currently configured to be able to run in ES5 mode, but in ES5 MobX won't be able to \" + msg);\n }\n}\nfunction getNextId() {\n return ++globalState.mobxGuid;\n}\n/**\n * Makes sure that the provided function is invoked at most once.\n */\nfunction once(func) {\n var invoked = false;\n return function () {\n if (invoked) {\n return;\n }\n invoked = true;\n return func.apply(this, arguments);\n };\n}\nvar noop = function noop() {};\nfunction isFunction(fn) {\n return typeof fn === \"function\";\n}\nfunction isStringish(value) {\n var t = typeof value;\n switch (t) {\n case \"string\":\n case \"symbol\":\n case \"number\":\n return true;\n }\n return false;\n}\nfunction isObject(value) {\n return value !== null && typeof value === \"object\";\n}\nfunction isPlainObject(value) {\n if (!isObject(value)) {\n return false;\n }\n var proto = Object.getPrototypeOf(value);\n if (proto == null) {\n return true;\n }\n var protoConstructor = Object.hasOwnProperty.call(proto, \"constructor\") && proto.constructor;\n return typeof protoConstructor === \"function\" && protoConstructor.toString() === plainObjectString;\n}\n// https://stackoverflow.com/a/37865170\nfunction isGenerator(obj) {\n var constructor = obj == null ? void 0 : obj.constructor;\n if (!constructor) {\n return false;\n }\n if (\"GeneratorFunction\" === constructor.name || \"GeneratorFunction\" === constructor.displayName) {\n return true;\n }\n return false;\n}\nfunction addHiddenProp(object, propName, value) {\n defineProperty(object, propName, {\n enumerable: false,\n writable: true,\n configurable: true,\n value: value\n });\n}\nfunction addHiddenFinalProp(object, propName, value) {\n defineProperty(object, propName, {\n enumerable: false,\n writable: false,\n configurable: true,\n value: value\n });\n}\nfunction createInstanceofPredicate(name, theClass) {\n var propName = \"isMobX\" + name;\n theClass.prototype[propName] = true;\n return function (x) {\n return isObject(x) && x[propName] === true;\n };\n}\n/**\n * Yields true for both native and observable Map, even across different windows.\n */\nfunction isES6Map(thing) {\n return thing != null && Object.prototype.toString.call(thing) === \"[object Map]\";\n}\n/**\n * Makes sure a Map is an instance of non-inherited native or observable Map.\n */\nfunction isPlainES6Map(thing) {\n var mapProto = Object.getPrototypeOf(thing);\n var objectProto = Object.getPrototypeOf(mapProto);\n var nullProto = Object.getPrototypeOf(objectProto);\n return nullProto === null;\n}\n/**\n * Yields true for both native and observable Set, even across different windows.\n */\nfunction isES6Set(thing) {\n return thing != null && Object.prototype.toString.call(thing) === \"[object Set]\";\n}\nvar hasGetOwnPropertySymbols = typeof Object.getOwnPropertySymbols !== \"undefined\";\n/**\n * Returns the following: own enumerable keys and symbols.\n */\nfunction getPlainObjectKeys(object) {\n var keys = Object.keys(object);\n // Not supported in IE, so there are not going to be symbol props anyway...\n if (!hasGetOwnPropertySymbols) {\n return keys;\n }\n var symbols = Object.getOwnPropertySymbols(object);\n if (!symbols.length) {\n return keys;\n }\n return [].concat(keys, symbols.filter(function (s) {\n return objectPrototype.propertyIsEnumerable.call(object, s);\n }));\n}\n// From Immer utils\n// Returns all own keys, including non-enumerable and symbolic\nvar ownKeys = typeof Reflect !== \"undefined\" && Reflect.ownKeys ? Reflect.ownKeys : hasGetOwnPropertySymbols ? function (obj) {\n return Object.getOwnPropertyNames(obj).concat(Object.getOwnPropertySymbols(obj));\n} : /* istanbul ignore next */Object.getOwnPropertyNames;\nfunction stringifyKey(key) {\n if (typeof key === \"string\") {\n return key;\n }\n if (typeof key === \"symbol\") {\n return key.toString();\n }\n return new String(key).toString();\n}\nfunction toPrimitive(value) {\n return value === null ? null : typeof value === \"object\" ? \"\" + value : value;\n}\nfunction hasProp(target, prop) {\n return objectPrototype.hasOwnProperty.call(target, prop);\n}\n// From Immer utils\nvar getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors || function getOwnPropertyDescriptors(target) {\n // Polyfill needed for Hermes and IE, see https://github.com/facebook/hermes/issues/274\n var res = {};\n // Note: without polyfill for ownKeys, symbols won't be picked up\n ownKeys(target).forEach(function (key) {\n res[key] = getDescriptor(target, key);\n });\n return res;\n};\nfunction getFlag(flags, mask) {\n return !!(flags & mask);\n}\nfunction setFlag(flags, mask, newValue) {\n if (newValue) {\n flags |= mask;\n } else {\n flags &= ~mask;\n }\n return flags;\n}\n\nfunction _arrayLikeToArray(r, a) {\n (null == a || a > r.length) && (a = r.length);\n for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];\n return n;\n}\nfunction _defineProperties(e, r) {\n for (var t = 0; t < r.length; t++) {\n var o = r[t];\n o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);\n }\n}\nfunction _createClass(e, r, t) {\n return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", {\n writable: !1\n }), e;\n}\nfunction _createForOfIteratorHelperLoose(r, e) {\n var t = \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"];\n if (t) return (t = t.call(r)).next.bind(t);\n if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && \"number\" == typeof r.length) {\n t && (r = t);\n var o = 0;\n return function () {\n return o >= r.length ? {\n done: !0\n } : {\n done: !1,\n value: r[o++]\n };\n };\n }\n throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\nfunction _extends() {\n return _extends = Object.assign ? Object.assign.bind() : function (n) {\n for (var e = 1; e < arguments.length; e++) {\n var t = arguments[e];\n for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);\n }\n return n;\n }, _extends.apply(null, arguments);\n}\nfunction _inheritsLoose(t, o) {\n t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);\n}\nfunction _setPrototypeOf(t, e) {\n return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {\n return t.__proto__ = e, t;\n }, _setPrototypeOf(t, e);\n}\nfunction _toPrimitive(t, r) {\n if (\"object\" != typeof t || !t) return t;\n var e = t[Symbol.toPrimitive];\n if (void 0 !== e) {\n var i = e.call(t, r || \"default\");\n if (\"object\" != typeof i) return i;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (\"string\" === r ? String : Number)(t);\n}\nfunction _toPropertyKey(t) {\n var i = _toPrimitive(t, \"string\");\n return \"symbol\" == typeof i ? i : i + \"\";\n}\nfunction _unsupportedIterableToArray(r, a) {\n if (r) {\n if (\"string\" == typeof r) return _arrayLikeToArray(r, a);\n var t = {}.toString.call(r).slice(8, -1);\n return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;\n }\n}\n\nvar storedAnnotationsSymbol = /*#__PURE__*/Symbol(\"mobx-stored-annotations\");\n/**\n * Creates a function that acts as\n * - decorator\n * - annotation object\n */\nfunction createDecoratorAnnotation(annotation) {\n function decorator(target, property) {\n if (is20223Decorator(property)) {\n return annotation.decorate_20223_(target, property);\n } else {\n storeAnnotation(target, property, annotation);\n }\n }\n return Object.assign(decorator, annotation);\n}\n/**\n * Stores annotation to prototype,\n * so it can be inspected later by `makeObservable` called from constructor\n */\nfunction storeAnnotation(prototype, key, annotation) {\n if (!hasProp(prototype, storedAnnotationsSymbol)) {\n addHiddenProp(prototype, storedAnnotationsSymbol, _extends({}, prototype[storedAnnotationsSymbol]));\n }\n // @override must override something\n if ( true && isOverride(annotation) && !hasProp(prototype[storedAnnotationsSymbol], key)) {\n var fieldName = prototype.constructor.name + \".prototype.\" + key.toString();\n die(\"'\" + fieldName + \"' is decorated with 'override', \" + \"but no such decorated member was found on prototype.\");\n }\n // Cannot re-decorate\n assertNotDecorated(prototype, annotation, key);\n // Ignore override\n if (!isOverride(annotation)) {\n prototype[storedAnnotationsSymbol][key] = annotation;\n }\n}\nfunction assertNotDecorated(prototype, annotation, key) {\n if ( true && !isOverride(annotation) && hasProp(prototype[storedAnnotationsSymbol], key)) {\n var fieldName = prototype.constructor.name + \".prototype.\" + key.toString();\n var currentAnnotationType = prototype[storedAnnotationsSymbol][key].annotationType_;\n var requestedAnnotationType = annotation.annotationType_;\n die(\"Cannot apply '@\" + requestedAnnotationType + \"' to '\" + fieldName + \"':\" + (\"\\nThe field is already decorated with '@\" + currentAnnotationType + \"'.\") + \"\\nRe-decorating fields is not allowed.\" + \"\\nUse '@override' decorator for methods overridden by subclass.\");\n }\n}\n/**\n * Collects annotations from prototypes and stores them on target (instance)\n */\nfunction collectStoredAnnotations(target) {\n if (!hasProp(target, storedAnnotationsSymbol)) {\n // if (__DEV__ && !target[storedAnnotationsSymbol]) {\n // die(\n // `No annotations were passed to makeObservable, but no decorated members have been found either`\n // )\n // }\n // We need a copy as we will remove annotation from the list once it's applied.\n addHiddenProp(target, storedAnnotationsSymbol, _extends({}, target[storedAnnotationsSymbol]));\n }\n return target[storedAnnotationsSymbol];\n}\nfunction is20223Decorator(context) {\n return typeof context == \"object\" && typeof context[\"kind\"] == \"string\";\n}\nfunction assert20223DecoratorType(context, types) {\n if ( true && !types.includes(context.kind)) {\n die(\"The decorator applied to '\" + String(context.name) + \"' cannot be used on a \" + context.kind + \" element\");\n }\n}\n\nvar $mobx = /*#__PURE__*/Symbol(\"mobx administration\");\nvar Atom = /*#__PURE__*/function () {\n /**\n * Create a new atom. For debugging purposes it is recommended to give it a name.\n * The onBecomeObserved and onBecomeUnobserved callbacks can be used for resource management.\n */\n function Atom(name_) {\n if (name_ === void 0) {\n name_ = true ? \"Atom@\" + getNextId() : 0;\n }\n this.name_ = void 0;\n this.flags_ = 0;\n this.observers_ = new Set();\n this.lastAccessedBy_ = 0;\n this.lowestObserverState_ = IDerivationState_.NOT_TRACKING_;\n // onBecomeObservedListeners\n this.onBOL = void 0;\n // onBecomeUnobservedListeners\n this.onBUOL = void 0;\n this.name_ = name_;\n }\n // for effective unobserving. BaseAtom has true, for extra optimization, so its onBecomeUnobserved never gets called, because it's not needed\n var _proto = Atom.prototype;\n _proto.onBO = function onBO() {\n if (this.onBOL) {\n this.onBOL.forEach(function (listener) {\n return listener();\n });\n }\n };\n _proto.onBUO = function onBUO() {\n if (this.onBUOL) {\n this.onBUOL.forEach(function (listener) {\n return listener();\n });\n }\n }\n /**\n * Invoke this method to notify mobx that your atom has been used somehow.\n * Returns true if there is currently a reactive context.\n */;\n _proto.reportObserved = function reportObserved$1() {\n return reportObserved(this);\n }\n /**\n * Invoke this method _after_ this method has changed to signal mobx that all its observers should invalidate.\n */;\n _proto.reportChanged = function reportChanged() {\n startBatch();\n propagateChanged(this);\n endBatch();\n };\n _proto.toString = function toString() {\n return this.name_;\n };\n return _createClass(Atom, [{\n key: \"isBeingObserved\",\n get: function get() {\n return getFlag(this.flags_, Atom.isBeingObservedMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Atom.isBeingObservedMask_, newValue);\n }\n }, {\n key: \"isPendingUnobservation\",\n get: function get() {\n return getFlag(this.flags_, Atom.isPendingUnobservationMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Atom.isPendingUnobservationMask_, newValue);\n }\n }, {\n key: \"diffValue\",\n get: function get() {\n return getFlag(this.flags_, Atom.diffValueMask_) ? 1 : 0;\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Atom.diffValueMask_, newValue === 1 ? true : false);\n }\n }]);\n}();\nAtom.isBeingObservedMask_ = 1;\nAtom.isPendingUnobservationMask_ = 2;\nAtom.diffValueMask_ = 4;\nvar isAtom = /*#__PURE__*/createInstanceofPredicate(\"Atom\", Atom);\nfunction createAtom(name, onBecomeObservedHandler, onBecomeUnobservedHandler) {\n if (onBecomeObservedHandler === void 0) {\n onBecomeObservedHandler = noop;\n }\n if (onBecomeUnobservedHandler === void 0) {\n onBecomeUnobservedHandler = noop;\n }\n var atom = new Atom(name);\n // default `noop` listener will not initialize the hook Set\n if (onBecomeObservedHandler !== noop) {\n onBecomeObserved(atom, onBecomeObservedHandler);\n }\n if (onBecomeUnobservedHandler !== noop) {\n onBecomeUnobserved(atom, onBecomeUnobservedHandler);\n }\n return atom;\n}\n\nfunction identityComparer(a, b) {\n return a === b;\n}\nfunction structuralComparer(a, b) {\n return deepEqual(a, b);\n}\nfunction shallowComparer(a, b) {\n return deepEqual(a, b, 1);\n}\nfunction defaultComparer(a, b) {\n if (Object.is) {\n return Object.is(a, b);\n }\n return a === b ? a !== 0 || 1 / a === 1 / b : a !== a && b !== b;\n}\nvar comparer = {\n identity: identityComparer,\n structural: structuralComparer,\n \"default\": defaultComparer,\n shallow: shallowComparer\n};\n\nfunction deepEnhancer(v, _, name) {\n // it is an observable already, done\n if (isObservable(v)) {\n return v;\n }\n // something that can be converted and mutated?\n if (Array.isArray(v)) {\n return observable.array(v, {\n name: name\n });\n }\n if (isPlainObject(v)) {\n return observable.object(v, undefined, {\n name: name\n });\n }\n if (isES6Map(v)) {\n return observable.map(v, {\n name: name\n });\n }\n if (isES6Set(v)) {\n return observable.set(v, {\n name: name\n });\n }\n if (typeof v === \"function\" && !isAction(v) && !isFlow(v)) {\n if (isGenerator(v)) {\n return flow(v);\n } else {\n return autoAction(name, v);\n }\n }\n return v;\n}\nfunction shallowEnhancer(v, _, name) {\n if (v === undefined || v === null) {\n return v;\n }\n if (isObservableObject(v) || isObservableArray(v) || isObservableMap(v) || isObservableSet(v)) {\n return v;\n }\n if (Array.isArray(v)) {\n return observable.array(v, {\n name: name,\n deep: false\n });\n }\n if (isPlainObject(v)) {\n return observable.object(v, undefined, {\n name: name,\n deep: false\n });\n }\n if (isES6Map(v)) {\n return observable.map(v, {\n name: name,\n deep: false\n });\n }\n if (isES6Set(v)) {\n return observable.set(v, {\n name: name,\n deep: false\n });\n }\n if (true) {\n die(\"The shallow modifier / decorator can only used in combination with arrays, objects, maps and sets\");\n }\n}\nfunction referenceEnhancer(newValue) {\n // never turn into an observable\n return newValue;\n}\nfunction refStructEnhancer(v, oldValue) {\n if ( true && isObservable(v)) {\n die(\"observable.struct should not be used with observable values\");\n }\n if (deepEqual(v, oldValue)) {\n return oldValue;\n }\n return v;\n}\n\nvar OVERRIDE = \"override\";\nvar override = /*#__PURE__*/createDecoratorAnnotation({\n annotationType_: OVERRIDE,\n make_: make_,\n extend_: extend_,\n decorate_20223_: decorate_20223_\n});\nfunction isOverride(annotation) {\n return annotation.annotationType_ === OVERRIDE;\n}\nfunction make_(adm, key) {\n // Must not be plain object\n if ( true && adm.isPlainObject_) {\n die(\"Cannot apply '\" + this.annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + this.annotationType_ + \"' cannot be used on plain objects.\"));\n }\n // Must override something\n if ( true && !hasProp(adm.appliedAnnotations_, key)) {\n die(\"'\" + adm.name_ + \".\" + key.toString() + \"' is annotated with '\" + this.annotationType_ + \"', \" + \"but no such annotated member was found on prototype.\");\n }\n return 0 /* MakeResult.Cancel */;\n}\nfunction extend_(adm, key, descriptor, proxyTrap) {\n die(\"'\" + this.annotationType_ + \"' can only be used with 'makeObservable'\");\n}\nfunction decorate_20223_(desc, context) {\n console.warn(\"'\" + this.annotationType_ + \"' cannot be used with decorators - this is a no-op\");\n}\n\nfunction createActionAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$1,\n extend_: extend_$1,\n decorate_20223_: decorate_20223_$1\n };\n}\nfunction make_$1(adm, key, descriptor, source) {\n var _this$options_;\n // bound\n if ((_this$options_ = this.options_) != null && _this$options_.bound) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;\n }\n // own\n if (source === adm.target_) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 2 /* MakeResult.Continue */;\n }\n // prototype\n if (isAction(descriptor.value)) {\n // A prototype could have been annotated already by other constructor,\n // rest of the proto chain must be annotated already\n return 1 /* MakeResult.Break */;\n }\n var actionDescriptor = createActionDescriptor(adm, this, key, descriptor, false);\n defineProperty(source, key, actionDescriptor);\n return 2 /* MakeResult.Continue */;\n}\nfunction extend_$1(adm, key, descriptor, proxyTrap) {\n var actionDescriptor = createActionDescriptor(adm, this, key, descriptor);\n return adm.defineProperty_(key, actionDescriptor, proxyTrap);\n}\nfunction decorate_20223_$1(mthd, context) {\n if (true) {\n assert20223DecoratorType(context, [\"method\", \"field\"]);\n }\n var kind = context.kind,\n name = context.name,\n addInitializer = context.addInitializer;\n var ann = this;\n var _createAction = function _createAction(m) {\n var _ann$options_$name, _ann$options_, _ann$options_$autoAct, _ann$options_2;\n return createAction((_ann$options_$name = (_ann$options_ = ann.options_) == null ? void 0 : _ann$options_.name) != null ? _ann$options_$name : name.toString(), m, (_ann$options_$autoAct = (_ann$options_2 = ann.options_) == null ? void 0 : _ann$options_2.autoAction) != null ? _ann$options_$autoAct : false);\n };\n // Backwards/Legacy behavior, expects makeObservable(this)\n if (kind == \"field\") {\n addInitializer(function () {\n storeAnnotation(this, name, ann);\n });\n return;\n }\n if (kind == \"method\") {\n var _this$options_2;\n if (!isAction(mthd)) {\n mthd = _createAction(mthd);\n }\n if ((_this$options_2 = this.options_) != null && _this$options_2.bound) {\n addInitializer(function () {\n var self = this;\n var bound = self[name].bind(self);\n bound.isMobxAction = true;\n self[name] = bound;\n });\n }\n return mthd;\n }\n die(\"Cannot apply '\" + ann.annotationType_ + \"' to '\" + String(name) + \"' (kind: \" + kind + \"):\" + (\"\\n'\" + ann.annotationType_ + \"' can only be used on properties with a function value.\"));\n}\nfunction assertActionDescriptor(adm, _ref, key, _ref2) {\n var annotationType_ = _ref.annotationType_;\n var value = _ref2.value;\n if ( true && !isFunction(value)) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' can only be used on properties with a function value.\"));\n }\n}\nfunction createActionDescriptor(adm, annotation, key, descriptor,\n// provides ability to disable safeDescriptors for prototypes\nsafeDescriptors) {\n var _annotation$options_, _annotation$options_$, _annotation$options_2, _annotation$options_$2, _annotation$options_3, _annotation$options_4, _adm$proxy_2;\n if (safeDescriptors === void 0) {\n safeDescriptors = globalState.safeDescriptors;\n }\n assertActionDescriptor(adm, annotation, key, descriptor);\n var value = descriptor.value;\n if ((_annotation$options_ = annotation.options_) != null && _annotation$options_.bound) {\n var _adm$proxy_;\n value = value.bind((_adm$proxy_ = adm.proxy_) != null ? _adm$proxy_ : adm.target_);\n }\n return {\n value: createAction((_annotation$options_$ = (_annotation$options_2 = annotation.options_) == null ? void 0 : _annotation$options_2.name) != null ? _annotation$options_$ : key.toString(), value, (_annotation$options_$2 = (_annotation$options_3 = annotation.options_) == null ? void 0 : _annotation$options_3.autoAction) != null ? _annotation$options_$2 : false,\n // https://github.com/mobxjs/mobx/discussions/3140\n (_annotation$options_4 = annotation.options_) != null && _annotation$options_4.bound ? (_adm$proxy_2 = adm.proxy_) != null ? _adm$proxy_2 : adm.target_ : undefined),\n // Non-configurable for classes\n // prevents accidental field redefinition in subclass\n configurable: safeDescriptors ? adm.isPlainObject_ : true,\n // https://github.com/mobxjs/mobx/pull/2641#issuecomment-737292058\n enumerable: false,\n // Non-obsevable, therefore non-writable\n // Also prevents rewriting in subclass constructor\n writable: safeDescriptors ? false : true\n };\n}\n\nfunction createFlowAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$2,\n extend_: extend_$2,\n decorate_20223_: decorate_20223_$2\n };\n}\nfunction make_$2(adm, key, descriptor, source) {\n var _this$options_;\n // own\n if (source === adm.target_) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 2 /* MakeResult.Continue */;\n }\n // prototype\n // bound - must annotate protos to support super.flow()\n if ((_this$options_ = this.options_) != null && _this$options_.bound && (!hasProp(adm.target_, key) || !isFlow(adm.target_[key]))) {\n if (this.extend_(adm, key, descriptor, false) === null) {\n return 0 /* MakeResult.Cancel */;\n }\n }\n if (isFlow(descriptor.value)) {\n // A prototype could have been annotated already by other constructor,\n // rest of the proto chain must be annotated already\n return 1 /* MakeResult.Break */;\n }\n var flowDescriptor = createFlowDescriptor(adm, this, key, descriptor, false, false);\n defineProperty(source, key, flowDescriptor);\n return 2 /* MakeResult.Continue */;\n}\nfunction extend_$2(adm, key, descriptor, proxyTrap) {\n var _this$options_2;\n var flowDescriptor = createFlowDescriptor(adm, this, key, descriptor, (_this$options_2 = this.options_) == null ? void 0 : _this$options_2.bound);\n return adm.defineProperty_(key, flowDescriptor, proxyTrap);\n}\nfunction decorate_20223_$2(mthd, context) {\n var _this$options_3;\n if (true) {\n assert20223DecoratorType(context, [\"method\"]);\n }\n var name = context.name,\n addInitializer = context.addInitializer;\n if (!isFlow(mthd)) {\n mthd = flow(mthd);\n }\n if ((_this$options_3 = this.options_) != null && _this$options_3.bound) {\n addInitializer(function () {\n var self = this;\n var bound = self[name].bind(self);\n bound.isMobXFlow = true;\n self[name] = bound;\n });\n }\n return mthd;\n}\nfunction assertFlowDescriptor(adm, _ref, key, _ref2) {\n var annotationType_ = _ref.annotationType_;\n var value = _ref2.value;\n if ( true && !isFunction(value)) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' can only be used on properties with a generator function value.\"));\n }\n}\nfunction createFlowDescriptor(adm, annotation, key, descriptor, bound,\n// provides ability to disable safeDescriptors for prototypes\nsafeDescriptors) {\n if (safeDescriptors === void 0) {\n safeDescriptors = globalState.safeDescriptors;\n }\n assertFlowDescriptor(adm, annotation, key, descriptor);\n var value = descriptor.value;\n // In case of flow.bound, the descriptor can be from already annotated prototype\n if (!isFlow(value)) {\n value = flow(value);\n }\n if (bound) {\n var _adm$proxy_;\n // We do not keep original function around, so we bind the existing flow\n value = value.bind((_adm$proxy_ = adm.proxy_) != null ? _adm$proxy_ : adm.target_);\n // This is normally set by `flow`, but `bind` returns new function...\n value.isMobXFlow = true;\n }\n return {\n value: value,\n // Non-configurable for classes\n // prevents accidental field redefinition in subclass\n configurable: safeDescriptors ? adm.isPlainObject_ : true,\n // https://github.com/mobxjs/mobx/pull/2641#issuecomment-737292058\n enumerable: false,\n // Non-obsevable, therefore non-writable\n // Also prevents rewriting in subclass constructor\n writable: safeDescriptors ? false : true\n };\n}\n\nfunction createComputedAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$3,\n extend_: extend_$3,\n decorate_20223_: decorate_20223_$3\n };\n}\nfunction make_$3(adm, key, descriptor) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;\n}\nfunction extend_$3(adm, key, descriptor, proxyTrap) {\n assertComputedDescriptor(adm, this, key, descriptor);\n return adm.defineComputedProperty_(key, _extends({}, this.options_, {\n get: descriptor.get,\n set: descriptor.set\n }), proxyTrap);\n}\nfunction decorate_20223_$3(get, context) {\n if (true) {\n assert20223DecoratorType(context, [\"getter\"]);\n }\n var ann = this;\n var key = context.name,\n addInitializer = context.addInitializer;\n addInitializer(function () {\n var adm = asObservableObject(this)[$mobx];\n var options = _extends({}, ann.options_, {\n get: get,\n context: this\n });\n options.name || (options.name = true ? adm.name_ + \".\" + key.toString() : 0);\n adm.values_.set(key, new ComputedValue(options));\n });\n return function () {\n return this[$mobx].getObservablePropValue_(key);\n };\n}\nfunction assertComputedDescriptor(adm, _ref, key, _ref2) {\n var annotationType_ = _ref.annotationType_;\n var get = _ref2.get;\n if ( true && !get) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' can only be used on getter(+setter) properties.\"));\n }\n}\n\nfunction createObservableAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$4,\n extend_: extend_$4,\n decorate_20223_: decorate_20223_$4\n };\n}\nfunction make_$4(adm, key, descriptor) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;\n}\nfunction extend_$4(adm, key, descriptor, proxyTrap) {\n var _this$options_$enhanc, _this$options_;\n assertObservableDescriptor(adm, this, key, descriptor);\n return adm.defineObservableProperty_(key, descriptor.value, (_this$options_$enhanc = (_this$options_ = this.options_) == null ? void 0 : _this$options_.enhancer) != null ? _this$options_$enhanc : deepEnhancer, proxyTrap);\n}\nfunction decorate_20223_$4(desc, context) {\n if (true) {\n if (context.kind === \"field\") {\n throw die(\"Please use `@observable accessor \" + String(context.name) + \"` instead of `@observable \" + String(context.name) + \"`\");\n }\n assert20223DecoratorType(context, [\"accessor\"]);\n }\n var ann = this;\n var kind = context.kind,\n name = context.name;\n // The laziness here is not ideal... It's a workaround to how 2022.3 Decorators are implemented:\n // `addInitializer` callbacks are executed _before_ any accessors are defined (instead of the ideal-for-us right after each).\n // This means that, if we were to do our stuff in an `addInitializer`, we'd attempt to read a private slot\n // before it has been initialized. The runtime doesn't like that and throws a `Cannot read private member\n // from an object whose class did not declare it` error.\n // TODO: it seems that this will not be required anymore in the final version of the spec\n // See TODO: link\n var initializedObjects = new WeakSet();\n function initializeObservable(target, value) {\n var _ann$options_$enhance, _ann$options_;\n var adm = asObservableObject(target)[$mobx];\n var observable = new ObservableValue(value, (_ann$options_$enhance = (_ann$options_ = ann.options_) == null ? void 0 : _ann$options_.enhancer) != null ? _ann$options_$enhance : deepEnhancer, true ? adm.name_ + \".\" + name.toString() : 0, false);\n adm.values_.set(name, observable);\n initializedObjects.add(target);\n }\n if (kind == \"accessor\") {\n return {\n get: function get() {\n if (!initializedObjects.has(this)) {\n initializeObservable(this, desc.get.call(this));\n }\n return this[$mobx].getObservablePropValue_(name);\n },\n set: function set(value) {\n if (!initializedObjects.has(this)) {\n initializeObservable(this, value);\n }\n return this[$mobx].setObservablePropValue_(name, value);\n },\n init: function init(value) {\n if (!initializedObjects.has(this)) {\n initializeObservable(this, value);\n }\n return value;\n }\n };\n }\n return;\n}\nfunction assertObservableDescriptor(adm, _ref, key, descriptor) {\n var annotationType_ = _ref.annotationType_;\n if ( true && !(\"value\" in descriptor)) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' cannot be used on getter/setter properties\"));\n }\n}\n\nvar AUTO = \"true\";\nvar autoAnnotation = /*#__PURE__*/createAutoAnnotation();\nfunction createAutoAnnotation(options) {\n return {\n annotationType_: AUTO,\n options_: options,\n make_: make_$5,\n extend_: extend_$5,\n decorate_20223_: decorate_20223_$5\n };\n}\nfunction make_$5(adm, key, descriptor, source) {\n var _this$options_3, _this$options_4;\n // getter -> computed\n if (descriptor.get) {\n return computed.make_(adm, key, descriptor, source);\n }\n // lone setter -> action setter\n if (descriptor.set) {\n // TODO make action applicable to setter and delegate to action.make_\n var set = createAction(key.toString(), descriptor.set);\n // own\n if (source === adm.target_) {\n return adm.defineProperty_(key, {\n configurable: globalState.safeDescriptors ? adm.isPlainObject_ : true,\n set: set\n }) === null ? 0 /* MakeResult.Cancel */ : 2 /* MakeResult.Continue */;\n }\n // proto\n defineProperty(source, key, {\n configurable: true,\n set: set\n });\n return 2 /* MakeResult.Continue */;\n }\n // function on proto -> autoAction/flow\n if (source !== adm.target_ && typeof descriptor.value === \"function\") {\n var _this$options_2;\n if (isGenerator(descriptor.value)) {\n var _this$options_;\n var flowAnnotation = (_this$options_ = this.options_) != null && _this$options_.autoBind ? flow.bound : flow;\n return flowAnnotation.make_(adm, key, descriptor, source);\n }\n var actionAnnotation = (_this$options_2 = this.options_) != null && _this$options_2.autoBind ? autoAction.bound : autoAction;\n return actionAnnotation.make_(adm, key, descriptor, source);\n }\n // other -> observable\n // Copy props from proto as well, see test:\n // \"decorate should work with Object.create\"\n var observableAnnotation = ((_this$options_3 = this.options_) == null ? void 0 : _this$options_3.deep) === false ? observable.ref : observable;\n // if function respect autoBind option\n if (typeof descriptor.value === \"function\" && (_this$options_4 = this.options_) != null && _this$options_4.autoBind) {\n var _adm$proxy_;\n descriptor.value = descriptor.value.bind((_adm$proxy_ = adm.proxy_) != null ? _adm$proxy_ : adm.target_);\n }\n return observableAnnotation.make_(adm, key, descriptor, source);\n}\nfunction extend_$5(adm, key, descriptor, proxyTrap) {\n var _this$options_5, _this$options_6;\n // getter -> computed\n if (descriptor.get) {\n return computed.extend_(adm, key, descriptor, proxyTrap);\n }\n // lone setter -> action setter\n if (descriptor.set) {\n // TODO make action applicable to setter and delegate to action.extend_\n return adm.defineProperty_(key, {\n configurable: globalState.safeDescriptors ? adm.isPlainObject_ : true,\n set: createAction(key.toString(), descriptor.set)\n }, proxyTrap);\n }\n // other -> observable\n // if function respect autoBind option\n if (typeof descriptor.value === \"function\" && (_this$options_5 = this.options_) != null && _this$options_5.autoBind) {\n var _adm$proxy_2;\n descriptor.value = descriptor.value.bind((_adm$proxy_2 = adm.proxy_) != null ? _adm$proxy_2 : adm.target_);\n }\n var observableAnnotation = ((_this$options_6 = this.options_) == null ? void 0 : _this$options_6.deep) === false ? observable.ref : observable;\n return observableAnnotation.extend_(adm, key, descriptor, proxyTrap);\n}\nfunction decorate_20223_$5(desc, context) {\n die(\"'\" + this.annotationType_ + \"' cannot be used as a decorator\");\n}\n\nvar OBSERVABLE = \"observable\";\nvar OBSERVABLE_REF = \"observable.ref\";\nvar OBSERVABLE_SHALLOW = \"observable.shallow\";\nvar OBSERVABLE_STRUCT = \"observable.struct\";\n// Predefined bags of create observable options, to avoid allocating temporarily option objects\n// in the majority of cases\nvar defaultCreateObservableOptions = {\n deep: true,\n name: undefined,\n defaultDecorator: undefined,\n proxy: true\n};\nObject.freeze(defaultCreateObservableOptions);\nfunction asCreateObservableOptions(thing) {\n return thing || defaultCreateObservableOptions;\n}\nvar observableAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE);\nvar observableRefAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE_REF, {\n enhancer: referenceEnhancer\n});\nvar observableShallowAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE_SHALLOW, {\n enhancer: shallowEnhancer\n});\nvar observableStructAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE_STRUCT, {\n enhancer: refStructEnhancer\n});\nvar observableDecoratorAnnotation = /*#__PURE__*/createDecoratorAnnotation(observableAnnotation);\nfunction getEnhancerFromOptions(options) {\n return options.deep === true ? deepEnhancer : options.deep === false ? referenceEnhancer : getEnhancerFromAnnotation(options.defaultDecorator);\n}\nfunction getAnnotationFromOptions(options) {\n var _options$defaultDecor;\n return options ? (_options$defaultDecor = options.defaultDecorator) != null ? _options$defaultDecor : createAutoAnnotation(options) : undefined;\n}\nfunction getEnhancerFromAnnotation(annotation) {\n var _annotation$options_$, _annotation$options_;\n return !annotation ? deepEnhancer : (_annotation$options_$ = (_annotation$options_ = annotation.options_) == null ? void 0 : _annotation$options_.enhancer) != null ? _annotation$options_$ : deepEnhancer;\n}\n/**\n * Turns an object, array or function into a reactive structure.\n * @param v the value which should become observable.\n */\nfunction createObservable(v, arg2, arg3) {\n // @observable someProp; (2022.3 Decorators)\n if (is20223Decorator(arg2)) {\n return observableAnnotation.decorate_20223_(v, arg2);\n }\n // @observable someProp;\n if (isStringish(arg2)) {\n storeAnnotation(v, arg2, observableAnnotation);\n return;\n }\n // already observable - ignore\n if (isObservable(v)) {\n return v;\n }\n // plain object\n if (isPlainObject(v)) {\n return observable.object(v, arg2, arg3);\n }\n // Array\n if (Array.isArray(v)) {\n return observable.array(v, arg2);\n }\n // Map\n if (isES6Map(v)) {\n return observable.map(v, arg2);\n }\n // Set\n if (isES6Set(v)) {\n return observable.set(v, arg2);\n }\n // other object - ignore\n if (typeof v === \"object\" && v !== null) {\n return v;\n }\n // anything else\n return observable.box(v, arg2);\n}\nassign(createObservable, observableDecoratorAnnotation);\nvar observableFactories = {\n box: function box(value, options) {\n var o = asCreateObservableOptions(options);\n return new ObservableValue(value, getEnhancerFromOptions(o), o.name, true, o.equals);\n },\n array: function array(initialValues, options) {\n var o = asCreateObservableOptions(options);\n return (globalState.useProxies === false || o.proxy === false ? createLegacyArray : createObservableArray)(initialValues, getEnhancerFromOptions(o), o.name);\n },\n map: function map(initialValues, options) {\n var o = asCreateObservableOptions(options);\n return new ObservableMap(initialValues, getEnhancerFromOptions(o), o.name);\n },\n set: function set(initialValues, options) {\n var o = asCreateObservableOptions(options);\n return new ObservableSet(initialValues, getEnhancerFromOptions(o), o.name);\n },\n object: function object(props, decorators, options) {\n return initObservable(function () {\n return extendObservable(globalState.useProxies === false || (options == null ? void 0 : options.proxy) === false ? asObservableObject({}, options) : asDynamicObservableObject({}, options), props, decorators);\n });\n },\n ref: /*#__PURE__*/createDecoratorAnnotation(observableRefAnnotation),\n shallow: /*#__PURE__*/createDecoratorAnnotation(observableShallowAnnotation),\n deep: observableDecoratorAnnotation,\n struct: /*#__PURE__*/createDecoratorAnnotation(observableStructAnnotation)\n};\n// eslint-disable-next-line\nvar observable = /*#__PURE__*/assign(createObservable, observableFactories);\n\nvar COMPUTED = \"computed\";\nvar COMPUTED_STRUCT = \"computed.struct\";\nvar computedAnnotation = /*#__PURE__*/createComputedAnnotation(COMPUTED);\nvar computedStructAnnotation = /*#__PURE__*/createComputedAnnotation(COMPUTED_STRUCT, {\n equals: comparer.structural\n});\n/**\n * Decorator for class properties: @computed get value() { return expr; }.\n * For legacy purposes also invokable as ES5 observable created: `computed(() => expr)`;\n */\nvar computed = function computed(arg1, arg2) {\n if (is20223Decorator(arg2)) {\n // @computed (2022.3 Decorators)\n return computedAnnotation.decorate_20223_(arg1, arg2);\n }\n if (isStringish(arg2)) {\n // @computed\n return storeAnnotation(arg1, arg2, computedAnnotation);\n }\n if (isPlainObject(arg1)) {\n // @computed({ options })\n return createDecoratorAnnotation(createComputedAnnotation(COMPUTED, arg1));\n }\n // computed(expr, options?)\n if (true) {\n if (!isFunction(arg1)) {\n die(\"First argument to `computed` should be an expression.\");\n }\n if (isFunction(arg2)) {\n die(\"A setter as second argument is no longer supported, use `{ set: fn }` option instead\");\n }\n }\n var opts = isPlainObject(arg2) ? arg2 : {};\n opts.get = arg1;\n opts.name || (opts.name = arg1.name || \"\"); /* for generated name */\n return new ComputedValue(opts);\n};\nObject.assign(computed, computedAnnotation);\ncomputed.struct = /*#__PURE__*/createDecoratorAnnotation(computedStructAnnotation);\n\nvar _getDescriptor$config, _getDescriptor;\n// we don't use globalState for these in order to avoid possible issues with multiple\n// mobx versions\nvar currentActionId = 0;\nvar nextActionId = 1;\nvar isFunctionNameConfigurable = (_getDescriptor$config = (_getDescriptor = /*#__PURE__*/getDescriptor(function () {}, \"name\")) == null ? void 0 : _getDescriptor.configurable) != null ? _getDescriptor$config : false;\n// we can safely recycle this object\nvar tmpNameDescriptor = {\n value: \"action\",\n configurable: true,\n writable: false,\n enumerable: false\n};\nfunction createAction(actionName, fn, autoAction, ref) {\n if (autoAction === void 0) {\n autoAction = false;\n }\n if (true) {\n if (!isFunction(fn)) {\n die(\"`action` can only be invoked on functions\");\n }\n if (typeof actionName !== \"string\" || !actionName) {\n die(\"actions should have valid names, got: '\" + actionName + \"'\");\n }\n }\n function res() {\n return executeAction(actionName, autoAction, fn, ref || this, arguments);\n }\n res.isMobxAction = true;\n res.toString = function () {\n return fn.toString();\n };\n if (isFunctionNameConfigurable) {\n tmpNameDescriptor.value = actionName;\n defineProperty(res, \"name\", tmpNameDescriptor);\n }\n return res;\n}\nfunction executeAction(actionName, canRunAsDerivation, fn, scope, args) {\n var runInfo = _startAction(actionName, canRunAsDerivation, scope, args);\n try {\n return fn.apply(scope, args);\n } catch (err) {\n runInfo.error_ = err;\n throw err;\n } finally {\n _endAction(runInfo);\n }\n}\nfunction _startAction(actionName, canRunAsDerivation,\n// true for autoAction\nscope, args) {\n var notifySpy_ = true && isSpyEnabled() && !!actionName;\n var startTime_ = 0;\n if ( true && notifySpy_) {\n startTime_ = Date.now();\n var flattenedArgs = args ? Array.from(args) : EMPTY_ARRAY;\n spyReportStart({\n type: ACTION,\n name: actionName,\n object: scope,\n arguments: flattenedArgs\n });\n }\n var prevDerivation_ = globalState.trackingDerivation;\n var runAsAction = !canRunAsDerivation || !prevDerivation_;\n startBatch();\n var prevAllowStateChanges_ = globalState.allowStateChanges; // by default preserve previous allow\n if (runAsAction) {\n untrackedStart();\n prevAllowStateChanges_ = allowStateChangesStart(true);\n }\n var prevAllowStateReads_ = allowStateReadsStart(true);\n var runInfo = {\n runAsAction_: runAsAction,\n prevDerivation_: prevDerivation_,\n prevAllowStateChanges_: prevAllowStateChanges_,\n prevAllowStateReads_: prevAllowStateReads_,\n notifySpy_: notifySpy_,\n startTime_: startTime_,\n actionId_: nextActionId++,\n parentActionId_: currentActionId\n };\n currentActionId = runInfo.actionId_;\n return runInfo;\n}\nfunction _endAction(runInfo) {\n if (currentActionId !== runInfo.actionId_) {\n die(30);\n }\n currentActionId = runInfo.parentActionId_;\n if (runInfo.error_ !== undefined) {\n globalState.suppressReactionErrors = true;\n }\n allowStateChangesEnd(runInfo.prevAllowStateChanges_);\n allowStateReadsEnd(runInfo.prevAllowStateReads_);\n endBatch();\n if (runInfo.runAsAction_) {\n untrackedEnd(runInfo.prevDerivation_);\n }\n if ( true && runInfo.notifySpy_) {\n spyReportEnd({\n time: Date.now() - runInfo.startTime_\n });\n }\n globalState.suppressReactionErrors = false;\n}\nfunction allowStateChanges(allowStateChanges, func) {\n var prev = allowStateChangesStart(allowStateChanges);\n try {\n return func();\n } finally {\n allowStateChangesEnd(prev);\n }\n}\nfunction allowStateChangesStart(allowStateChanges) {\n var prev = globalState.allowStateChanges;\n globalState.allowStateChanges = allowStateChanges;\n return prev;\n}\nfunction allowStateChangesEnd(prev) {\n globalState.allowStateChanges = prev;\n}\n\nvar CREATE = \"create\";\nvar ObservableValue = /*#__PURE__*/function (_Atom) {\n function ObservableValue(value, enhancer, name_, notifySpy, equals) {\n var _this;\n if (name_ === void 0) {\n name_ = true ? \"ObservableValue@\" + getNextId() : 0;\n }\n if (notifySpy === void 0) {\n notifySpy = true;\n }\n if (equals === void 0) {\n equals = comparer[\"default\"];\n }\n _this = _Atom.call(this, name_) || this;\n _this.enhancer = void 0;\n _this.name_ = void 0;\n _this.equals = void 0;\n _this.hasUnreportedChange_ = false;\n _this.interceptors_ = void 0;\n _this.changeListeners_ = void 0;\n _this.value_ = void 0;\n _this.dehancer = void 0;\n _this.enhancer = enhancer;\n _this.name_ = name_;\n _this.equals = equals;\n _this.value_ = enhancer(value, undefined, name_);\n if ( true && notifySpy && isSpyEnabled()) {\n // only notify spy if this is a stand-alone observable\n spyReport({\n type: CREATE,\n object: _this,\n observableKind: \"value\",\n debugObjectName: _this.name_,\n newValue: \"\" + _this.value_\n });\n }\n return _this;\n }\n _inheritsLoose(ObservableValue, _Atom);\n var _proto = ObservableValue.prototype;\n _proto.dehanceValue = function dehanceValue(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.set = function set(newValue) {\n var oldValue = this.value_;\n newValue = this.prepareNewValue_(newValue);\n if (newValue !== globalState.UNCHANGED) {\n var notifySpy = isSpyEnabled();\n if ( true && notifySpy) {\n spyReportStart({\n type: UPDATE,\n object: this,\n observableKind: \"value\",\n debugObjectName: this.name_,\n newValue: newValue,\n oldValue: oldValue\n });\n }\n this.setNewValue_(newValue);\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n };\n _proto.prepareNewValue_ = function prepareNewValue_(newValue) {\n checkIfStateModificationsAreAllowed(this);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this,\n type: UPDATE,\n newValue: newValue\n });\n if (!change) {\n return globalState.UNCHANGED;\n }\n newValue = change.newValue;\n }\n // apply modifier\n newValue = this.enhancer(newValue, this.value_, this.name_);\n return this.equals(this.value_, newValue) ? globalState.UNCHANGED : newValue;\n };\n _proto.setNewValue_ = function setNewValue_(newValue) {\n var oldValue = this.value_;\n this.value_ = newValue;\n this.reportChanged();\n if (hasListeners(this)) {\n notifyListeners(this, {\n type: UPDATE,\n object: this,\n newValue: newValue,\n oldValue: oldValue\n });\n }\n };\n _proto.get = function get() {\n this.reportObserved();\n return this.dehanceValue(this.value_);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n if (fireImmediately) {\n listener({\n observableKind: \"value\",\n debugObjectName: this.name_,\n object: this,\n type: UPDATE,\n newValue: this.value_,\n oldValue: undefined\n });\n }\n return registerListener(this, listener);\n };\n _proto.raw = function raw() {\n // used by MST ot get undehanced value\n return this.value_;\n };\n _proto.toJSON = function toJSON() {\n return this.get();\n };\n _proto.toString = function toString() {\n return this.name_ + \"[\" + this.value_ + \"]\";\n };\n _proto.valueOf = function valueOf() {\n return toPrimitive(this.get());\n };\n _proto[Symbol.toPrimitive] = function () {\n return this.valueOf();\n };\n return ObservableValue;\n}(Atom);\nvar isObservableValue = /*#__PURE__*/createInstanceofPredicate(\"ObservableValue\", ObservableValue);\n\n/**\n * A node in the state dependency root that observes other nodes, and can be observed itself.\n *\n * ComputedValue will remember the result of the computation for the duration of the batch, or\n * while being observed.\n *\n * During this time it will recompute only when one of its direct dependencies changed,\n * but only when it is being accessed with `ComputedValue.get()`.\n *\n * Implementation description:\n * 1. First time it's being accessed it will compute and remember result\n * give back remembered result until 2. happens\n * 2. First time any deep dependency change, propagate POSSIBLY_STALE to all observers, wait for 3.\n * 3. When it's being accessed, recompute if any shallow dependency changed.\n * if result changed: propagate STALE to all observers, that were POSSIBLY_STALE from the last step.\n * go to step 2. either way\n *\n * If at any point it's outside batch and it isn't observed: reset everything and go to 1.\n */\nvar ComputedValue = /*#__PURE__*/function () {\n /**\n * Create a new computed value based on a function expression.\n *\n * The `name` property is for debug purposes only.\n *\n * The `equals` property specifies the comparer function to use to determine if a newly produced\n * value differs from the previous value. Two comparers are provided in the library; `defaultComparer`\n * compares based on identity comparison (===), and `structuralComparer` deeply compares the structure.\n * Structural comparison can be convenient if you always produce a new aggregated object and\n * don't want to notify observers if it is structurally the same.\n * This is useful for working with vectors, mouse coordinates etc.\n */\n function ComputedValue(options) {\n this.dependenciesState_ = IDerivationState_.NOT_TRACKING_;\n this.observing_ = [];\n // nodes we are looking at. Our value depends on these nodes\n this.newObserving_ = null;\n // during tracking it's an array with new observed observers\n this.observers_ = new Set();\n this.runId_ = 0;\n this.lastAccessedBy_ = 0;\n this.lowestObserverState_ = IDerivationState_.UP_TO_DATE_;\n this.unboundDepsCount_ = 0;\n this.value_ = new CaughtException(null);\n this.name_ = void 0;\n this.triggeredBy_ = void 0;\n this.flags_ = 0;\n this.derivation = void 0;\n // N.B: unminified as it is used by MST\n this.setter_ = void 0;\n this.isTracing_ = TraceMode.NONE;\n this.scope_ = void 0;\n this.equals_ = void 0;\n this.requiresReaction_ = void 0;\n this.keepAlive_ = void 0;\n this.onBOL = void 0;\n this.onBUOL = void 0;\n if (!options.get) {\n die(31);\n }\n this.derivation = options.get;\n this.name_ = options.name || ( true ? \"ComputedValue@\" + getNextId() : 0);\n if (options.set) {\n this.setter_ = createAction( true ? this.name_ + \"-setter\" : 0, options.set);\n }\n this.equals_ = options.equals || (options.compareStructural || options.struct ? comparer.structural : comparer[\"default\"]);\n this.scope_ = options.context;\n this.requiresReaction_ = options.requiresReaction;\n this.keepAlive_ = !!options.keepAlive;\n }\n var _proto = ComputedValue.prototype;\n _proto.onBecomeStale_ = function onBecomeStale_() {\n propagateMaybeChanged(this);\n };\n _proto.onBO = function onBO() {\n if (this.onBOL) {\n this.onBOL.forEach(function (listener) {\n return listener();\n });\n }\n };\n _proto.onBUO = function onBUO() {\n if (this.onBUOL) {\n this.onBUOL.forEach(function (listener) {\n return listener();\n });\n }\n }\n // to check for cycles\n ;\n /**\n * Returns the current value of this computed value.\n * Will evaluate its computation first if needed.\n */\n _proto.get = function get() {\n if (this.isComputing) {\n die(32, this.name_, this.derivation);\n }\n if (globalState.inBatch === 0 &&\n // !globalState.trackingDerivatpion &&\n this.observers_.size === 0 && !this.keepAlive_) {\n if (shouldCompute(this)) {\n this.warnAboutUntrackedRead_();\n startBatch(); // See perf test 'computed memoization'\n this.value_ = this.computeValue_(false);\n endBatch();\n }\n } else {\n reportObserved(this);\n if (shouldCompute(this)) {\n var prevTrackingContext = globalState.trackingContext;\n if (this.keepAlive_ && !prevTrackingContext) {\n globalState.trackingContext = this;\n }\n if (this.trackAndCompute()) {\n propagateChangeConfirmed(this);\n }\n globalState.trackingContext = prevTrackingContext;\n }\n }\n var result = this.value_;\n if (isCaughtException(result)) {\n throw result.cause;\n }\n return result;\n };\n _proto.set = function set(value) {\n if (this.setter_) {\n if (this.isRunningSetter) {\n die(33, this.name_);\n }\n this.isRunningSetter = true;\n try {\n this.setter_.call(this.scope_, value);\n } finally {\n this.isRunningSetter = false;\n }\n } else {\n die(34, this.name_);\n }\n };\n _proto.trackAndCompute = function trackAndCompute() {\n // N.B: unminified as it is used by MST\n var oldValue = this.value_;\n var wasSuspended = /* see #1208 */this.dependenciesState_ === IDerivationState_.NOT_TRACKING_;\n var newValue = this.computeValue_(true);\n var changed = wasSuspended || isCaughtException(oldValue) || isCaughtException(newValue) || !this.equals_(oldValue, newValue);\n if (changed) {\n this.value_ = newValue;\n if ( true && isSpyEnabled()) {\n spyReport({\n observableKind: \"computed\",\n debugObjectName: this.name_,\n object: this.scope_,\n type: \"update\",\n oldValue: oldValue,\n newValue: newValue\n });\n }\n }\n return changed;\n };\n _proto.computeValue_ = function computeValue_(track) {\n this.isComputing = true;\n // don't allow state changes during computation\n var prev = allowStateChangesStart(false);\n var res;\n if (track) {\n res = trackDerivedFunction(this, this.derivation, this.scope_);\n } else {\n if (globalState.disableErrorBoundaries === true) {\n res = this.derivation.call(this.scope_);\n } else {\n try {\n res = this.derivation.call(this.scope_);\n } catch (e) {\n res = new CaughtException(e);\n }\n }\n }\n allowStateChangesEnd(prev);\n this.isComputing = false;\n return res;\n };\n _proto.suspend_ = function suspend_() {\n if (!this.keepAlive_) {\n clearObserving(this);\n this.value_ = undefined; // don't hold on to computed value!\n if ( true && this.isTracing_ !== TraceMode.NONE) {\n console.log(\"[mobx.trace] Computed value '\" + this.name_ + \"' was suspended and it will recompute on the next access.\");\n }\n }\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n var _this = this;\n var firstTime = true;\n var prevValue = undefined;\n return autorun(function () {\n // TODO: why is this in a different place than the spyReport() function? in all other observables it's called in the same place\n var newValue = _this.get();\n if (!firstTime || fireImmediately) {\n var prevU = untrackedStart();\n listener({\n observableKind: \"computed\",\n debugObjectName: _this.name_,\n type: UPDATE,\n object: _this,\n newValue: newValue,\n oldValue: prevValue\n });\n untrackedEnd(prevU);\n }\n firstTime = false;\n prevValue = newValue;\n });\n };\n _proto.warnAboutUntrackedRead_ = function warnAboutUntrackedRead_() {\n if (false) {}\n if (this.isTracing_ !== TraceMode.NONE) {\n console.log(\"[mobx.trace] Computed value '\" + this.name_ + \"' is being read outside a reactive context. Doing a full recompute.\");\n }\n if (typeof this.requiresReaction_ === \"boolean\" ? this.requiresReaction_ : globalState.computedRequiresReaction) {\n console.warn(\"[mobx] Computed value '\" + this.name_ + \"' is being read outside a reactive context. Doing a full recompute.\");\n }\n };\n _proto.toString = function toString() {\n return this.name_ + \"[\" + this.derivation.toString() + \"]\";\n };\n _proto.valueOf = function valueOf() {\n return toPrimitive(this.get());\n };\n _proto[Symbol.toPrimitive] = function () {\n return this.valueOf();\n };\n return _createClass(ComputedValue, [{\n key: \"isComputing\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isComputingMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isComputingMask_, newValue);\n }\n }, {\n key: \"isRunningSetter\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isRunningSetterMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isRunningSetterMask_, newValue);\n }\n }, {\n key: \"isBeingObserved\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isBeingObservedMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isBeingObservedMask_, newValue);\n }\n }, {\n key: \"isPendingUnobservation\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isPendingUnobservationMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isPendingUnobservationMask_, newValue);\n }\n }, {\n key: \"diffValue\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.diffValueMask_) ? 1 : 0;\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.diffValueMask_, newValue === 1 ? true : false);\n }\n }]);\n}();\nComputedValue.isComputingMask_ = 1;\nComputedValue.isRunningSetterMask_ = 2;\nComputedValue.isBeingObservedMask_ = 4;\nComputedValue.isPendingUnobservationMask_ = 8;\nComputedValue.diffValueMask_ = 16;\nvar isComputedValue = /*#__PURE__*/createInstanceofPredicate(\"ComputedValue\", ComputedValue);\n\nvar IDerivationState_;\n(function (IDerivationState_) {\n // before being run or (outside batch and not being observed)\n // at this point derivation is not holding any data about dependency tree\n IDerivationState_[IDerivationState_[\"NOT_TRACKING_\"] = -1] = \"NOT_TRACKING_\";\n // no shallow dependency changed since last computation\n // won't recalculate derivation\n // this is what makes mobx fast\n IDerivationState_[IDerivationState_[\"UP_TO_DATE_\"] = 0] = \"UP_TO_DATE_\";\n // some deep dependency changed, but don't know if shallow dependency changed\n // will require to check first if UP_TO_DATE or POSSIBLY_STALE\n // currently only ComputedValue will propagate POSSIBLY_STALE\n //\n // having this state is second big optimization:\n // don't have to recompute on every dependency change, but only when it's needed\n IDerivationState_[IDerivationState_[\"POSSIBLY_STALE_\"] = 1] = \"POSSIBLY_STALE_\";\n // A shallow dependency has changed since last computation and the derivation\n // will need to recompute when it's needed next.\n IDerivationState_[IDerivationState_[\"STALE_\"] = 2] = \"STALE_\";\n})(IDerivationState_ || (IDerivationState_ = {}));\nvar TraceMode;\n(function (TraceMode) {\n TraceMode[TraceMode[\"NONE\"] = 0] = \"NONE\";\n TraceMode[TraceMode[\"LOG\"] = 1] = \"LOG\";\n TraceMode[TraceMode[\"BREAK\"] = 2] = \"BREAK\";\n})(TraceMode || (TraceMode = {}));\nvar CaughtException = function CaughtException(cause) {\n this.cause = void 0;\n this.cause = cause;\n // Empty\n};\nfunction isCaughtException(e) {\n return e instanceof CaughtException;\n}\n/**\n * Finds out whether any dependency of the derivation has actually changed.\n * If dependenciesState is 1 then it will recalculate dependencies,\n * if any dependency changed it will propagate it by changing dependenciesState to 2.\n *\n * By iterating over the dependencies in the same order that they were reported and\n * stopping on the first change, all the recalculations are only called for ComputedValues\n * that will be tracked by derivation. That is because we assume that if the first x\n * dependencies of the derivation doesn't change then the derivation should run the same way\n * up until accessing x-th dependency.\n */\nfunction shouldCompute(derivation) {\n switch (derivation.dependenciesState_) {\n case IDerivationState_.UP_TO_DATE_:\n return false;\n case IDerivationState_.NOT_TRACKING_:\n case IDerivationState_.STALE_:\n return true;\n case IDerivationState_.POSSIBLY_STALE_:\n {\n // state propagation can occur outside of action/reactive context #2195\n var prevAllowStateReads = allowStateReadsStart(true);\n var prevUntracked = untrackedStart(); // no need for those computeds to be reported, they will be picked up in trackDerivedFunction.\n var obs = derivation.observing_,\n l = obs.length;\n for (var i = 0; i < l; i++) {\n var obj = obs[i];\n if (isComputedValue(obj)) {\n if (globalState.disableErrorBoundaries) {\n obj.get();\n } else {\n try {\n obj.get();\n } catch (e) {\n // we are not interested in the value *or* exception at this moment, but if there is one, notify all\n untrackedEnd(prevUntracked);\n allowStateReadsEnd(prevAllowStateReads);\n return true;\n }\n }\n // if ComputedValue `obj` actually changed it will be computed and propagated to its observers.\n // and `derivation` is an observer of `obj`\n // invariantShouldCompute(derivation)\n if (derivation.dependenciesState_ === IDerivationState_.STALE_) {\n untrackedEnd(prevUntracked);\n allowStateReadsEnd(prevAllowStateReads);\n return true;\n }\n }\n }\n changeDependenciesStateTo0(derivation);\n untrackedEnd(prevUntracked);\n allowStateReadsEnd(prevAllowStateReads);\n return false;\n }\n }\n}\nfunction isComputingDerivation() {\n return globalState.trackingDerivation !== null; // filter out actions inside computations\n}\nfunction checkIfStateModificationsAreAllowed(atom) {\n if (false) {}\n var hasObservers = atom.observers_.size > 0;\n // Should not be possible to change observed state outside strict mode, except during initialization, see #563\n if (!globalState.allowStateChanges && (hasObservers || globalState.enforceActions === \"always\")) {\n console.warn(\"[MobX] \" + (globalState.enforceActions ? \"Since strict-mode is enabled, changing (observed) observable values without using an action is not allowed. Tried to modify: \" : \"Side effects like changing state are not allowed at this point. Are you trying to modify state from, for example, a computed value or the render function of a React component? You can wrap side effects in 'runInAction' (or decorate functions with 'action') if needed. Tried to modify: \") + atom.name_);\n }\n}\nfunction checkIfStateReadsAreAllowed(observable) {\n if ( true && !globalState.allowStateReads && globalState.observableRequiresReaction) {\n console.warn(\"[mobx] Observable '\" + observable.name_ + \"' being read outside a reactive context.\");\n }\n}\n/**\n * Executes the provided function `f` and tracks which observables are being accessed.\n * The tracking information is stored on the `derivation` object and the derivation is registered\n * as observer of any of the accessed observables.\n */\nfunction trackDerivedFunction(derivation, f, context) {\n var prevAllowStateReads = allowStateReadsStart(true);\n changeDependenciesStateTo0(derivation);\n // Preallocate array; will be trimmed by bindDependencies.\n derivation.newObserving_ = new Array(\n // Reserve constant space for initial dependencies, dynamic space otherwise.\n // See https://github.com/mobxjs/mobx/pull/3833\n derivation.runId_ === 0 ? 100 : derivation.observing_.length);\n derivation.unboundDepsCount_ = 0;\n derivation.runId_ = ++globalState.runId;\n var prevTracking = globalState.trackingDerivation;\n globalState.trackingDerivation = derivation;\n globalState.inBatch++;\n var result;\n if (globalState.disableErrorBoundaries === true) {\n result = f.call(context);\n } else {\n try {\n result = f.call(context);\n } catch (e) {\n result = new CaughtException(e);\n }\n }\n globalState.inBatch--;\n globalState.trackingDerivation = prevTracking;\n bindDependencies(derivation);\n warnAboutDerivationWithoutDependencies(derivation);\n allowStateReadsEnd(prevAllowStateReads);\n return result;\n}\nfunction warnAboutDerivationWithoutDependencies(derivation) {\n if (false) {}\n if (derivation.observing_.length !== 0) {\n return;\n }\n if (typeof derivation.requiresObservable_ === \"boolean\" ? derivation.requiresObservable_ : globalState.reactionRequiresObservable) {\n console.warn(\"[mobx] Derivation '\" + derivation.name_ + \"' is created/updated without reading any observable value.\");\n }\n}\n/**\n * diffs newObserving with observing.\n * update observing to be newObserving with unique observables\n * notify observers that become observed/unobserved\n */\nfunction bindDependencies(derivation) {\n // invariant(derivation.dependenciesState !== IDerivationState.NOT_TRACKING, \"INTERNAL ERROR bindDependencies expects derivation.dependenciesState !== -1\");\n var prevObserving = derivation.observing_;\n var observing = derivation.observing_ = derivation.newObserving_;\n var lowestNewObservingDerivationState = IDerivationState_.UP_TO_DATE_;\n // Go through all new observables and check diffValue: (this list can contain duplicates):\n // 0: first occurrence, change to 1 and keep it\n // 1: extra occurrence, drop it\n var i0 = 0,\n l = derivation.unboundDepsCount_;\n for (var i = 0; i < l; i++) {\n var dep = observing[i];\n if (dep.diffValue === 0) {\n dep.diffValue = 1;\n if (i0 !== i) {\n observing[i0] = dep;\n }\n i0++;\n }\n // Upcast is 'safe' here, because if dep is IObservable, `dependenciesState` will be undefined,\n // not hitting the condition\n if (dep.dependenciesState_ > lowestNewObservingDerivationState) {\n lowestNewObservingDerivationState = dep.dependenciesState_;\n }\n }\n observing.length = i0;\n derivation.newObserving_ = null; // newObserving shouldn't be needed outside tracking (statement moved down to work around FF bug, see #614)\n // Go through all old observables and check diffValue: (it is unique after last bindDependencies)\n // 0: it's not in new observables, unobserve it\n // 1: it keeps being observed, don't want to notify it. change to 0\n l = prevObserving.length;\n while (l--) {\n var _dep = prevObserving[l];\n if (_dep.diffValue === 0) {\n removeObserver(_dep, derivation);\n }\n _dep.diffValue = 0;\n }\n // Go through all new observables and check diffValue: (now it should be unique)\n // 0: it was set to 0 in last loop. don't need to do anything.\n // 1: it wasn't observed, let's observe it. set back to 0\n while (i0--) {\n var _dep2 = observing[i0];\n if (_dep2.diffValue === 1) {\n _dep2.diffValue = 0;\n addObserver(_dep2, derivation);\n }\n }\n // Some new observed derivations may become stale during this derivation computation\n // so they have had no chance to propagate staleness (#916)\n if (lowestNewObservingDerivationState !== IDerivationState_.UP_TO_DATE_) {\n derivation.dependenciesState_ = lowestNewObservingDerivationState;\n derivation.onBecomeStale_();\n }\n}\nfunction clearObserving(derivation) {\n // invariant(globalState.inBatch > 0, \"INTERNAL ERROR clearObserving should be called only inside batch\");\n var obs = derivation.observing_;\n derivation.observing_ = [];\n var i = obs.length;\n while (i--) {\n removeObserver(obs[i], derivation);\n }\n derivation.dependenciesState_ = IDerivationState_.NOT_TRACKING_;\n}\nfunction untracked(action) {\n var prev = untrackedStart();\n try {\n return action();\n } finally {\n untrackedEnd(prev);\n }\n}\nfunction untrackedStart() {\n var prev = globalState.trackingDerivation;\n globalState.trackingDerivation = null;\n return prev;\n}\nfunction untrackedEnd(prev) {\n globalState.trackingDerivation = prev;\n}\nfunction allowStateReadsStart(allowStateReads) {\n var prev = globalState.allowStateReads;\n globalState.allowStateReads = allowStateReads;\n return prev;\n}\nfunction allowStateReadsEnd(prev) {\n globalState.allowStateReads = prev;\n}\n/**\n * needed to keep `lowestObserverState` correct. when changing from (2 or 1) to 0\n *\n */\nfunction changeDependenciesStateTo0(derivation) {\n if (derivation.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {\n return;\n }\n derivation.dependenciesState_ = IDerivationState_.UP_TO_DATE_;\n var obs = derivation.observing_;\n var i = obs.length;\n while (i--) {\n obs[i].lowestObserverState_ = IDerivationState_.UP_TO_DATE_;\n }\n}\n\n/**\n * These values will persist if global state is reset\n */\nvar persistentKeys = [\"mobxGuid\", \"spyListeners\", \"enforceActions\", \"computedRequiresReaction\", \"reactionRequiresObservable\", \"observableRequiresReaction\", \"allowStateReads\", \"disableErrorBoundaries\", \"runId\", \"UNCHANGED\", \"useProxies\"];\nvar MobXGlobals = function MobXGlobals() {\n /**\n * MobXGlobals version.\n * MobX compatiblity with other versions loaded in memory as long as this version matches.\n * It indicates that the global state still stores similar information\n *\n * N.B: this version is unrelated to the package version of MobX, and is only the version of the\n * internal state storage of MobX, and can be the same across many different package versions\n */\n this.version = 6;\n /**\n * globally unique token to signal unchanged\n */\n this.UNCHANGED = {};\n /**\n * Currently running derivation\n */\n this.trackingDerivation = null;\n /**\n * Currently running reaction. This determines if we currently have a reactive context.\n * (Tracking derivation is also set for temporal tracking of computed values inside actions,\n * but trackingReaction can only be set by a form of Reaction)\n */\n this.trackingContext = null;\n /**\n * Each time a derivation is tracked, it is assigned a unique run-id\n */\n this.runId = 0;\n /**\n * 'guid' for general purpose. Will be persisted amongst resets.\n */\n this.mobxGuid = 0;\n /**\n * Are we in a batch block? (and how many of them)\n */\n this.inBatch = 0;\n /**\n * Observables that don't have observers anymore, and are about to be\n * suspended, unless somebody else accesses it in the same batch\n *\n * @type {IObservable[]}\n */\n this.pendingUnobservations = [];\n /**\n * List of scheduled, not yet executed, reactions.\n */\n this.pendingReactions = [];\n /**\n * Are we currently processing reactions?\n */\n this.isRunningReactions = false;\n /**\n * Is it allowed to change observables at this point?\n * In general, MobX doesn't allow that when running computations and React.render.\n * To ensure that those functions stay pure.\n */\n this.allowStateChanges = false;\n /**\n * Is it allowed to read observables at this point?\n * Used to hold the state needed for `observableRequiresReaction`\n */\n this.allowStateReads = true;\n /**\n * If strict mode is enabled, state changes are by default not allowed\n */\n this.enforceActions = true;\n /**\n * Spy callbacks\n */\n this.spyListeners = [];\n /**\n * Globally attached error handlers that react specifically to errors in reactions\n */\n this.globalReactionErrorHandlers = [];\n /**\n * Warn if computed values are accessed outside a reactive context\n */\n this.computedRequiresReaction = false;\n /**\n * (Experimental)\n * Warn if you try to create to derivation / reactive context without accessing any observable.\n */\n this.reactionRequiresObservable = false;\n /**\n * (Experimental)\n * Warn if observables are accessed outside a reactive context\n */\n this.observableRequiresReaction = false;\n /*\n * Don't catch and rethrow exceptions. This is useful for inspecting the state of\n * the stack when an exception occurs while debugging.\n */\n this.disableErrorBoundaries = false;\n /*\n * If true, we are already handling an exception in an action. Any errors in reactions should be suppressed, as\n * they are not the cause, see: https://github.com/mobxjs/mobx/issues/1836\n */\n this.suppressReactionErrors = false;\n this.useProxies = true;\n /*\n * print warnings about code that would fail if proxies weren't available\n */\n this.verifyProxies = false;\n /**\n * False forces all object's descriptors to\n * writable: true\n * configurable: true\n */\n this.safeDescriptors = true;\n};\nvar canMergeGlobalState = true;\nvar isolateCalled = false;\nvar globalState = /*#__PURE__*/function () {\n var global = /*#__PURE__*/getGlobal();\n if (global.__mobxInstanceCount > 0 && !global.__mobxGlobals) {\n canMergeGlobalState = false;\n }\n if (global.__mobxGlobals && global.__mobxGlobals.version !== new MobXGlobals().version) {\n canMergeGlobalState = false;\n }\n if (!canMergeGlobalState) {\n // Because this is a IIFE we need to let isolateCalled a chance to change\n // so we run it after the event loop completed at least 1 iteration\n setTimeout(function () {\n if (!isolateCalled) {\n die(35);\n }\n }, 1);\n return new MobXGlobals();\n } else if (global.__mobxGlobals) {\n global.__mobxInstanceCount += 1;\n if (!global.__mobxGlobals.UNCHANGED) {\n global.__mobxGlobals.UNCHANGED = {};\n } // make merge backward compatible\n return global.__mobxGlobals;\n } else {\n global.__mobxInstanceCount = 1;\n return global.__mobxGlobals = /*#__PURE__*/new MobXGlobals();\n }\n}();\nfunction isolateGlobalState() {\n if (globalState.pendingReactions.length || globalState.inBatch || globalState.isRunningReactions) {\n die(36);\n }\n isolateCalled = true;\n if (canMergeGlobalState) {\n var global = getGlobal();\n if (--global.__mobxInstanceCount === 0) {\n global.__mobxGlobals = undefined;\n }\n globalState = new MobXGlobals();\n }\n}\nfunction getGlobalState() {\n return globalState;\n}\n/**\n * For testing purposes only; this will break the internal state of existing observables,\n * but can be used to get back at a stable state after throwing errors\n */\nfunction resetGlobalState() {\n var defaultGlobals = new MobXGlobals();\n for (var key in defaultGlobals) {\n if (persistentKeys.indexOf(key) === -1) {\n globalState[key] = defaultGlobals[key];\n }\n }\n globalState.allowStateChanges = !globalState.enforceActions;\n}\n\nfunction hasObservers(observable) {\n return observable.observers_ && observable.observers_.size > 0;\n}\nfunction getObservers(observable) {\n return observable.observers_;\n}\n// function invariantObservers(observable: IObservable) {\n// const list = observable.observers\n// const map = observable.observersIndexes\n// const l = list.length\n// for (let i = 0; i < l; i++) {\n// const id = list[i].__mapid\n// if (i) {\n// invariant(map[id] === i, \"INTERNAL ERROR maps derivation.__mapid to index in list\") // for performance\n// } else {\n// invariant(!(id in map), \"INTERNAL ERROR observer on index 0 shouldn't be held in map.\") // for performance\n// }\n// }\n// invariant(\n// list.length === 0 || Object.keys(map).length === list.length - 1,\n// \"INTERNAL ERROR there is no junk in map\"\n// )\n// }\nfunction addObserver(observable, node) {\n // invariant(node.dependenciesState !== -1, \"INTERNAL ERROR, can add only dependenciesState !== -1\");\n // invariant(observable._observers.indexOf(node) === -1, \"INTERNAL ERROR add already added node\");\n // invariantObservers(observable);\n observable.observers_.add(node);\n if (observable.lowestObserverState_ > node.dependenciesState_) {\n observable.lowestObserverState_ = node.dependenciesState_;\n }\n // invariantObservers(observable);\n // invariant(observable._observers.indexOf(node) !== -1, \"INTERNAL ERROR didn't add node\");\n}\nfunction removeObserver(observable, node) {\n // invariant(globalState.inBatch > 0, \"INTERNAL ERROR, remove should be called only inside batch\");\n // invariant(observable._observers.indexOf(node) !== -1, \"INTERNAL ERROR remove already removed node\");\n // invariantObservers(observable);\n observable.observers_[\"delete\"](node);\n if (observable.observers_.size === 0) {\n // deleting last observer\n queueForUnobservation(observable);\n }\n // invariantObservers(observable);\n // invariant(observable._observers.indexOf(node) === -1, \"INTERNAL ERROR remove already removed node2\");\n}\nfunction queueForUnobservation(observable) {\n if (observable.isPendingUnobservation === false) {\n // invariant(observable._observers.length === 0, \"INTERNAL ERROR, should only queue for unobservation unobserved observables\");\n observable.isPendingUnobservation = true;\n globalState.pendingUnobservations.push(observable);\n }\n}\n/**\n * Batch starts a transaction, at least for purposes of memoizing ComputedValues when nothing else does.\n * During a batch `onBecomeUnobserved` will be called at most once per observable.\n * Avoids unnecessary recalculations.\n */\nfunction startBatch() {\n globalState.inBatch++;\n}\nfunction endBatch() {\n if (--globalState.inBatch === 0) {\n runReactions();\n // the batch is actually about to finish, all unobserving should happen here.\n var list = globalState.pendingUnobservations;\n for (var i = 0; i < list.length; i++) {\n var observable = list[i];\n observable.isPendingUnobservation = false;\n if (observable.observers_.size === 0) {\n if (observable.isBeingObserved) {\n // if this observable had reactive observers, trigger the hooks\n observable.isBeingObserved = false;\n observable.onBUO();\n }\n if (observable instanceof ComputedValue) {\n // computed values are automatically teared down when the last observer leaves\n // this process happens recursively, this computed might be the last observabe of another, etc..\n observable.suspend_();\n }\n }\n }\n globalState.pendingUnobservations = [];\n }\n}\nfunction reportObserved(observable) {\n checkIfStateReadsAreAllowed(observable);\n var derivation = globalState.trackingDerivation;\n if (derivation !== null) {\n /**\n * Simple optimization, give each derivation run an unique id (runId)\n * Check if last time this observable was accessed the same runId is used\n * if this is the case, the relation is already known\n */\n if (derivation.runId_ !== observable.lastAccessedBy_) {\n observable.lastAccessedBy_ = derivation.runId_;\n // Tried storing newObserving, or observing, or both as Set, but performance didn't come close...\n derivation.newObserving_[derivation.unboundDepsCount_++] = observable;\n if (!observable.isBeingObserved && globalState.trackingContext) {\n observable.isBeingObserved = true;\n observable.onBO();\n }\n }\n return observable.isBeingObserved;\n } else if (observable.observers_.size === 0 && globalState.inBatch > 0) {\n queueForUnobservation(observable);\n }\n return false;\n}\n// function invariantLOS(observable: IObservable, msg: string) {\n// // it's expensive so better not run it in produciton. but temporarily helpful for testing\n// const min = getObservers(observable).reduce((a, b) => Math.min(a, b.dependenciesState), 2)\n// if (min >= observable.lowestObserverState) return // <- the only assumption about `lowestObserverState`\n// throw new Error(\n// \"lowestObserverState is wrong for \" +\n// msg +\n// \" because \" +\n// min +\n// \" < \" +\n// observable.lowestObserverState\n// )\n// }\n/**\n * NOTE: current propagation mechanism will in case of self reruning autoruns behave unexpectedly\n * It will propagate changes to observers from previous run\n * It's hard or maybe impossible (with reasonable perf) to get it right with current approach\n * Hopefully self reruning autoruns aren't a feature people should depend on\n * Also most basic use cases should be ok\n */\n// Called by Atom when its value changes\nfunction propagateChanged(observable) {\n // invariantLOS(observable, \"changed start\");\n if (observable.lowestObserverState_ === IDerivationState_.STALE_) {\n return;\n }\n observable.lowestObserverState_ = IDerivationState_.STALE_;\n // Ideally we use for..of here, but the downcompiled version is really slow...\n observable.observers_.forEach(function (d) {\n if (d.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {\n if ( true && d.isTracing_ !== TraceMode.NONE) {\n logTraceInfo(d, observable);\n }\n d.onBecomeStale_();\n }\n d.dependenciesState_ = IDerivationState_.STALE_;\n });\n // invariantLOS(observable, \"changed end\");\n}\n// Called by ComputedValue when it recalculate and its value changed\nfunction propagateChangeConfirmed(observable) {\n // invariantLOS(observable, \"confirmed start\");\n if (observable.lowestObserverState_ === IDerivationState_.STALE_) {\n return;\n }\n observable.lowestObserverState_ = IDerivationState_.STALE_;\n observable.observers_.forEach(function (d) {\n if (d.dependenciesState_ === IDerivationState_.POSSIBLY_STALE_) {\n d.dependenciesState_ = IDerivationState_.STALE_;\n if ( true && d.isTracing_ !== TraceMode.NONE) {\n logTraceInfo(d, observable);\n }\n } else if (d.dependenciesState_ === IDerivationState_.UP_TO_DATE_ // this happens during computing of `d`, just keep lowestObserverState up to date.\n ) {\n observable.lowestObserverState_ = IDerivationState_.UP_TO_DATE_;\n }\n });\n // invariantLOS(observable, \"confirmed end\");\n}\n// Used by computed when its dependency changed, but we don't wan't to immediately recompute.\nfunction propagateMaybeChanged(observable) {\n // invariantLOS(observable, \"maybe start\");\n if (observable.lowestObserverState_ !== IDerivationState_.UP_TO_DATE_) {\n return;\n }\n observable.lowestObserverState_ = IDerivationState_.POSSIBLY_STALE_;\n observable.observers_.forEach(function (d) {\n if (d.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {\n d.dependenciesState_ = IDerivationState_.POSSIBLY_STALE_;\n d.onBecomeStale_();\n }\n });\n // invariantLOS(observable, \"maybe end\");\n}\nfunction logTraceInfo(derivation, observable) {\n console.log(\"[mobx.trace] '\" + derivation.name_ + \"' is invalidated due to a change in: '\" + observable.name_ + \"'\");\n if (derivation.isTracing_ === TraceMode.BREAK) {\n var lines = [];\n printDepTree(getDependencyTree(derivation), lines, 1);\n // prettier-ignore\n new Function(\"debugger;\\n/*\\nTracing '\" + derivation.name_ + \"'\\n\\nYou are entering this break point because derivation '\" + derivation.name_ + \"' is being traced and '\" + observable.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\" + (derivation instanceof ComputedValue ? derivation.derivation.toString().replace(/[*]\\//g, \"/\") : \"\") + \"\\n\\nThe dependencies for this derivation are:\\n\\n\" + lines.join(\"\\n\") + \"\\n*/\\n \")();\n }\n}\nfunction printDepTree(tree, lines, depth) {\n if (lines.length >= 1000) {\n lines.push(\"(and many more)\");\n return;\n }\n lines.push(\"\" + \"\\t\".repeat(depth - 1) + tree.name);\n if (tree.dependencies) {\n tree.dependencies.forEach(function (child) {\n return printDepTree(child, lines, depth + 1);\n });\n }\n}\n\nvar Reaction = /*#__PURE__*/function () {\n function Reaction(name_, onInvalidate_, errorHandler_, requiresObservable_) {\n if (name_ === void 0) {\n name_ = true ? \"Reaction@\" + getNextId() : 0;\n }\n this.name_ = void 0;\n this.onInvalidate_ = void 0;\n this.errorHandler_ = void 0;\n this.requiresObservable_ = void 0;\n this.observing_ = [];\n // nodes we are looking at. Our value depends on these nodes\n this.newObserving_ = [];\n this.dependenciesState_ = IDerivationState_.NOT_TRACKING_;\n this.runId_ = 0;\n this.unboundDepsCount_ = 0;\n this.flags_ = 0;\n this.isTracing_ = TraceMode.NONE;\n this.name_ = name_;\n this.onInvalidate_ = onInvalidate_;\n this.errorHandler_ = errorHandler_;\n this.requiresObservable_ = requiresObservable_;\n }\n var _proto = Reaction.prototype;\n _proto.onBecomeStale_ = function onBecomeStale_() {\n this.schedule_();\n };\n _proto.schedule_ = function schedule_() {\n if (!this.isScheduled) {\n this.isScheduled = true;\n globalState.pendingReactions.push(this);\n runReactions();\n }\n }\n /**\n * internal, use schedule() if you intend to kick off a reaction\n */;\n _proto.runReaction_ = function runReaction_() {\n if (!this.isDisposed) {\n startBatch();\n this.isScheduled = false;\n var prev = globalState.trackingContext;\n globalState.trackingContext = this;\n if (shouldCompute(this)) {\n this.isTrackPending = true;\n try {\n this.onInvalidate_();\n if ( true && this.isTrackPending && isSpyEnabled()) {\n // onInvalidate didn't trigger track right away..\n spyReport({\n name: this.name_,\n type: \"scheduled-reaction\"\n });\n }\n } catch (e) {\n this.reportExceptionInDerivation_(e);\n }\n }\n globalState.trackingContext = prev;\n endBatch();\n }\n };\n _proto.track = function track(fn) {\n if (this.isDisposed) {\n return;\n // console.warn(\"Reaction already disposed\") // Note: Not a warning / error in mobx 4 either\n }\n startBatch();\n var notify = isSpyEnabled();\n var startTime;\n if ( true && notify) {\n startTime = Date.now();\n spyReportStart({\n name: this.name_,\n type: \"reaction\"\n });\n }\n this.isRunning = true;\n var prevReaction = globalState.trackingContext; // reactions could create reactions...\n globalState.trackingContext = this;\n var result = trackDerivedFunction(this, fn, undefined);\n globalState.trackingContext = prevReaction;\n this.isRunning = false;\n this.isTrackPending = false;\n if (this.isDisposed) {\n // disposed during last run. Clean up everything that was bound after the dispose call.\n clearObserving(this);\n }\n if (isCaughtException(result)) {\n this.reportExceptionInDerivation_(result.cause);\n }\n if ( true && notify) {\n spyReportEnd({\n time: Date.now() - startTime\n });\n }\n endBatch();\n };\n _proto.reportExceptionInDerivation_ = function reportExceptionInDerivation_(error) {\n var _this = this;\n if (this.errorHandler_) {\n this.errorHandler_(error, this);\n return;\n }\n if (globalState.disableErrorBoundaries) {\n throw error;\n }\n var message = true ? \"[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '\" + this + \"'\" : 0;\n if (!globalState.suppressReactionErrors) {\n console.error(message, error);\n /** If debugging brought you here, please, read the above message :-). Tnx! */\n } else if (true) {\n console.warn(\"[mobx] (error in reaction '\" + this.name_ + \"' suppressed, fix error of causing action below)\");\n } // prettier-ignore\n if ( true && isSpyEnabled()) {\n spyReport({\n type: \"error\",\n name: this.name_,\n message: message,\n error: \"\" + error\n });\n }\n globalState.globalReactionErrorHandlers.forEach(function (f) {\n return f(error, _this);\n });\n };\n _proto.dispose = function dispose() {\n if (!this.isDisposed) {\n this.isDisposed = true;\n if (!this.isRunning) {\n // if disposed while running, clean up later. Maybe not optimal, but rare case\n startBatch();\n clearObserving(this);\n endBatch();\n }\n }\n };\n _proto.getDisposer_ = function getDisposer_(abortSignal) {\n var _this2 = this;\n var dispose = function dispose() {\n _this2.dispose();\n abortSignal == null || abortSignal.removeEventListener == null || abortSignal.removeEventListener(\"abort\", dispose);\n };\n abortSignal == null || abortSignal.addEventListener == null || abortSignal.addEventListener(\"abort\", dispose);\n dispose[$mobx] = this;\n return dispose;\n };\n _proto.toString = function toString() {\n return \"Reaction[\" + this.name_ + \"]\";\n };\n _proto.trace = function trace$1(enterBreakPoint) {\n if (enterBreakPoint === void 0) {\n enterBreakPoint = false;\n }\n trace(this, enterBreakPoint);\n };\n return _createClass(Reaction, [{\n key: \"isDisposed\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isDisposedMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isDisposedMask_, newValue);\n }\n }, {\n key: \"isScheduled\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isScheduledMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isScheduledMask_, newValue);\n }\n }, {\n key: \"isTrackPending\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isTrackPendingMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isTrackPendingMask_, newValue);\n }\n }, {\n key: \"isRunning\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isRunningMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isRunningMask_, newValue);\n }\n }, {\n key: \"diffValue\",\n get: function get() {\n return getFlag(this.flags_, Reaction.diffValueMask_) ? 1 : 0;\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.diffValueMask_, newValue === 1 ? true : false);\n }\n }]);\n}();\nReaction.isDisposedMask_ = 1;\nReaction.isScheduledMask_ = 2;\nReaction.isTrackPendingMask_ = 4;\nReaction.isRunningMask_ = 8;\nReaction.diffValueMask_ = 16;\nfunction onReactionError(handler) {\n globalState.globalReactionErrorHandlers.push(handler);\n return function () {\n var idx = globalState.globalReactionErrorHandlers.indexOf(handler);\n if (idx >= 0) {\n globalState.globalReactionErrorHandlers.splice(idx, 1);\n }\n };\n}\n/**\n * Magic number alert!\n * Defines within how many times a reaction is allowed to re-trigger itself\n * until it is assumed that this is gonna be a never ending loop...\n */\nvar MAX_REACTION_ITERATIONS = 100;\nvar reactionScheduler = function reactionScheduler(f) {\n return f();\n};\nfunction runReactions() {\n // Trampolining, if runReactions are already running, new reactions will be picked up\n if (globalState.inBatch > 0 || globalState.isRunningReactions) {\n return;\n }\n reactionScheduler(runReactionsHelper);\n}\nfunction runReactionsHelper() {\n globalState.isRunningReactions = true;\n var allReactions = globalState.pendingReactions;\n var iterations = 0;\n // While running reactions, new reactions might be triggered.\n // Hence we work with two variables and check whether\n // we converge to no remaining reactions after a while.\n while (allReactions.length > 0) {\n if (++iterations === MAX_REACTION_ITERATIONS) {\n console.error( true ? \"Reaction doesn't converge to a stable state after \" + MAX_REACTION_ITERATIONS + \" iterations.\" + (\" Probably there is a cycle in the reactive function: \" + allReactions[0]) : 0);\n allReactions.splice(0); // clear reactions\n }\n var remainingReactions = allReactions.splice(0);\n for (var i = 0, l = remainingReactions.length; i < l; i++) {\n remainingReactions[i].runReaction_();\n }\n }\n globalState.isRunningReactions = false;\n}\nvar isReaction = /*#__PURE__*/createInstanceofPredicate(\"Reaction\", Reaction);\nfunction setReactionScheduler(fn) {\n var baseScheduler = reactionScheduler;\n reactionScheduler = function reactionScheduler(f) {\n return fn(function () {\n return baseScheduler(f);\n });\n };\n}\n\nfunction isSpyEnabled() {\n return true && !!globalState.spyListeners.length;\n}\nfunction spyReport(event) {\n if (false) {} // dead code elimination can do the rest\n if (!globalState.spyListeners.length) {\n return;\n }\n var listeners = globalState.spyListeners;\n for (var i = 0, l = listeners.length; i < l; i++) {\n listeners[i](event);\n }\n}\nfunction spyReportStart(event) {\n if (false) {}\n var change = _extends({}, event, {\n spyReportStart: true\n });\n spyReport(change);\n}\nvar END_EVENT = {\n type: \"report-end\",\n spyReportEnd: true\n};\nfunction spyReportEnd(change) {\n if (false) {}\n if (change) {\n spyReport(_extends({}, change, {\n type: \"report-end\",\n spyReportEnd: true\n }));\n } else {\n spyReport(END_EVENT);\n }\n}\nfunction spy(listener) {\n if (false) {} else {\n globalState.spyListeners.push(listener);\n return once(function () {\n globalState.spyListeners = globalState.spyListeners.filter(function (l) {\n return l !== listener;\n });\n });\n }\n}\n\nvar ACTION = \"action\";\nvar ACTION_BOUND = \"action.bound\";\nvar AUTOACTION = \"autoAction\";\nvar AUTOACTION_BOUND = \"autoAction.bound\";\nvar DEFAULT_ACTION_NAME = \"\";\nvar actionAnnotation = /*#__PURE__*/createActionAnnotation(ACTION);\nvar actionBoundAnnotation = /*#__PURE__*/createActionAnnotation(ACTION_BOUND, {\n bound: true\n});\nvar autoActionAnnotation = /*#__PURE__*/createActionAnnotation(AUTOACTION, {\n autoAction: true\n});\nvar autoActionBoundAnnotation = /*#__PURE__*/createActionAnnotation(AUTOACTION_BOUND, {\n autoAction: true,\n bound: true\n});\nfunction createActionFactory(autoAction) {\n var res = function action(arg1, arg2) {\n // action(fn() {})\n if (isFunction(arg1)) {\n return createAction(arg1.name || DEFAULT_ACTION_NAME, arg1, autoAction);\n }\n // action(\"name\", fn() {})\n if (isFunction(arg2)) {\n return createAction(arg1, arg2, autoAction);\n }\n // @action (2022.3 Decorators)\n if (is20223Decorator(arg2)) {\n return (autoAction ? autoActionAnnotation : actionAnnotation).decorate_20223_(arg1, arg2);\n }\n // @action\n if (isStringish(arg2)) {\n return storeAnnotation(arg1, arg2, autoAction ? autoActionAnnotation : actionAnnotation);\n }\n // action(\"name\") & @action(\"name\")\n if (isStringish(arg1)) {\n return createDecoratorAnnotation(createActionAnnotation(autoAction ? AUTOACTION : ACTION, {\n name: arg1,\n autoAction: autoAction\n }));\n }\n if (true) {\n die(\"Invalid arguments for `action`\");\n }\n };\n return res;\n}\nvar action = /*#__PURE__*/createActionFactory(false);\nObject.assign(action, actionAnnotation);\nvar autoAction = /*#__PURE__*/createActionFactory(true);\nObject.assign(autoAction, autoActionAnnotation);\naction.bound = /*#__PURE__*/createDecoratorAnnotation(actionBoundAnnotation);\nautoAction.bound = /*#__PURE__*/createDecoratorAnnotation(autoActionBoundAnnotation);\nfunction runInAction(fn) {\n return executeAction(fn.name || DEFAULT_ACTION_NAME, false, fn, this, undefined);\n}\nfunction isAction(thing) {\n return isFunction(thing) && thing.isMobxAction === true;\n}\n\n/**\n * Creates a named reactive view and keeps it alive, so that the view is always\n * updated if one of the dependencies changes, even when the view is not further used by something else.\n * @param view The reactive view\n * @returns disposer function, which can be used to stop the view from being updated in the future.\n */\nfunction autorun(view, opts) {\n var _opts$name, _opts, _opts2, _opts3;\n if (opts === void 0) {\n opts = EMPTY_OBJECT;\n }\n if (true) {\n if (!isFunction(view)) {\n die(\"Autorun expects a function as first argument\");\n }\n if (isAction(view)) {\n die(\"Autorun does not accept actions since actions are untrackable\");\n }\n }\n var name = (_opts$name = (_opts = opts) == null ? void 0 : _opts.name) != null ? _opts$name : true ? view.name || \"Autorun@\" + getNextId() : 0;\n var runSync = !opts.scheduler && !opts.delay;\n var reaction;\n if (runSync) {\n // normal autorun\n reaction = new Reaction(name, function () {\n this.track(reactionRunner);\n }, opts.onError, opts.requiresObservable);\n } else {\n var scheduler = createSchedulerFromOptions(opts);\n // debounced autorun\n var isScheduled = false;\n reaction = new Reaction(name, function () {\n if (!isScheduled) {\n isScheduled = true;\n scheduler(function () {\n isScheduled = false;\n if (!reaction.isDisposed) {\n reaction.track(reactionRunner);\n }\n });\n }\n }, opts.onError, opts.requiresObservable);\n }\n function reactionRunner() {\n view(reaction);\n }\n if (!((_opts2 = opts) != null && (_opts2 = _opts2.signal) != null && _opts2.aborted)) {\n reaction.schedule_();\n }\n return reaction.getDisposer_((_opts3 = opts) == null ? void 0 : _opts3.signal);\n}\nvar run = function run(f) {\n return f();\n};\nfunction createSchedulerFromOptions(opts) {\n return opts.scheduler ? opts.scheduler : opts.delay ? function (f) {\n return setTimeout(f, opts.delay);\n } : run;\n}\nfunction reaction(expression, effect, opts) {\n var _opts$name2, _opts4, _opts5;\n if (opts === void 0) {\n opts = EMPTY_OBJECT;\n }\n if (true) {\n if (!isFunction(expression) || !isFunction(effect)) {\n die(\"First and second argument to reaction should be functions\");\n }\n if (!isPlainObject(opts)) {\n die(\"Third argument of reactions should be an object\");\n }\n }\n var name = (_opts$name2 = opts.name) != null ? _opts$name2 : true ? \"Reaction@\" + getNextId() : 0;\n var effectAction = action(name, opts.onError ? wrapErrorHandler(opts.onError, effect) : effect);\n var runSync = !opts.scheduler && !opts.delay;\n var scheduler = createSchedulerFromOptions(opts);\n var firstTime = true;\n var isScheduled = false;\n var value;\n var equals = opts.compareStructural ? comparer.structural : opts.equals || comparer[\"default\"];\n var r = new Reaction(name, function () {\n if (firstTime || runSync) {\n reactionRunner();\n } else if (!isScheduled) {\n isScheduled = true;\n scheduler(reactionRunner);\n }\n }, opts.onError, opts.requiresObservable);\n function reactionRunner() {\n isScheduled = false;\n if (r.isDisposed) {\n return;\n }\n var changed = false;\n var oldValue = value;\n r.track(function () {\n var nextValue = allowStateChanges(false, function () {\n return expression(r);\n });\n changed = firstTime || !equals(value, nextValue);\n value = nextValue;\n });\n if (firstTime && opts.fireImmediately) {\n effectAction(value, oldValue, r);\n } else if (!firstTime && changed) {\n effectAction(value, oldValue, r);\n }\n firstTime = false;\n }\n if (!((_opts4 = opts) != null && (_opts4 = _opts4.signal) != null && _opts4.aborted)) {\n r.schedule_();\n }\n return r.getDisposer_((_opts5 = opts) == null ? void 0 : _opts5.signal);\n}\nfunction wrapErrorHandler(errorHandler, baseFn) {\n return function () {\n try {\n return baseFn.apply(this, arguments);\n } catch (e) {\n errorHandler.call(this, e);\n }\n };\n}\n\nvar ON_BECOME_OBSERVED = \"onBO\";\nvar ON_BECOME_UNOBSERVED = \"onBUO\";\nfunction onBecomeObserved(thing, arg2, arg3) {\n return interceptHook(ON_BECOME_OBSERVED, thing, arg2, arg3);\n}\nfunction onBecomeUnobserved(thing, arg2, arg3) {\n return interceptHook(ON_BECOME_UNOBSERVED, thing, arg2, arg3);\n}\nfunction interceptHook(hook, thing, arg2, arg3) {\n var atom = typeof arg3 === \"function\" ? getAtom(thing, arg2) : getAtom(thing);\n var cb = isFunction(arg3) ? arg3 : arg2;\n var listenersKey = hook + \"L\";\n if (atom[listenersKey]) {\n atom[listenersKey].add(cb);\n } else {\n atom[listenersKey] = new Set([cb]);\n }\n return function () {\n var hookListeners = atom[listenersKey];\n if (hookListeners) {\n hookListeners[\"delete\"](cb);\n if (hookListeners.size === 0) {\n delete atom[listenersKey];\n }\n }\n };\n}\n\nvar NEVER = \"never\";\nvar ALWAYS = \"always\";\nvar OBSERVED = \"observed\";\n// const IF_AVAILABLE = \"ifavailable\"\nfunction configure(options) {\n if (options.isolateGlobalState === true) {\n isolateGlobalState();\n }\n var useProxies = options.useProxies,\n enforceActions = options.enforceActions;\n if (useProxies !== undefined) {\n globalState.useProxies = useProxies === ALWAYS ? true : useProxies === NEVER ? false : typeof Proxy !== \"undefined\";\n }\n if (useProxies === \"ifavailable\") {\n globalState.verifyProxies = true;\n }\n if (enforceActions !== undefined) {\n var ea = enforceActions === ALWAYS ? ALWAYS : enforceActions === OBSERVED;\n globalState.enforceActions = ea;\n globalState.allowStateChanges = ea === true || ea === ALWAYS ? false : true;\n }\n [\"computedRequiresReaction\", \"reactionRequiresObservable\", \"observableRequiresReaction\", \"disableErrorBoundaries\", \"safeDescriptors\"].forEach(function (key) {\n if (key in options) {\n globalState[key] = !!options[key];\n }\n });\n globalState.allowStateReads = !globalState.observableRequiresReaction;\n if ( true && globalState.disableErrorBoundaries === true) {\n console.warn(\"WARNING: Debug feature only. MobX will NOT recover from errors when `disableErrorBoundaries` is enabled.\");\n }\n if (options.reactionScheduler) {\n setReactionScheduler(options.reactionScheduler);\n }\n}\n\nfunction extendObservable(target, properties, annotations, options) {\n if (true) {\n if (arguments.length > 4) {\n die(\"'extendObservable' expected 2-4 arguments\");\n }\n if (typeof target !== \"object\") {\n die(\"'extendObservable' expects an object as first argument\");\n }\n if (isObservableMap(target)) {\n die(\"'extendObservable' should not be used on maps, use map.merge instead\");\n }\n if (!isPlainObject(properties)) {\n die(\"'extendObservable' only accepts plain objects as second argument\");\n }\n if (isObservable(properties) || isObservable(annotations)) {\n die(\"Extending an object with another observable (object) is not supported\");\n }\n }\n // Pull descriptors first, so we don't have to deal with props added by administration ($mobx)\n var descriptors = getOwnPropertyDescriptors(properties);\n initObservable(function () {\n var adm = asObservableObject(target, options)[$mobx];\n ownKeys(descriptors).forEach(function (key) {\n adm.extend_(key, descriptors[key],\n // must pass \"undefined\" for { key: undefined }\n !annotations ? true : key in annotations ? annotations[key] : true);\n });\n });\n return target;\n}\n\nfunction getDependencyTree(thing, property) {\n return nodeToDependencyTree(getAtom(thing, property));\n}\nfunction nodeToDependencyTree(node) {\n var result = {\n name: node.name_\n };\n if (node.observing_ && node.observing_.length > 0) {\n result.dependencies = unique(node.observing_).map(nodeToDependencyTree);\n }\n return result;\n}\nfunction getObserverTree(thing, property) {\n return nodeToObserverTree(getAtom(thing, property));\n}\nfunction nodeToObserverTree(node) {\n var result = {\n name: node.name_\n };\n if (hasObservers(node)) {\n result.observers = Array.from(getObservers(node)).map(nodeToObserverTree);\n }\n return result;\n}\nfunction unique(list) {\n return Array.from(new Set(list));\n}\n\nvar generatorId = 0;\nfunction FlowCancellationError() {\n this.message = \"FLOW_CANCELLED\";\n}\nFlowCancellationError.prototype = /*#__PURE__*/Object.create(Error.prototype);\nfunction isFlowCancellationError(error) {\n return error instanceof FlowCancellationError;\n}\nvar flowAnnotation = /*#__PURE__*/createFlowAnnotation(\"flow\");\nvar flowBoundAnnotation = /*#__PURE__*/createFlowAnnotation(\"flow.bound\", {\n bound: true\n});\nvar flow = /*#__PURE__*/Object.assign(function flow(arg1, arg2) {\n // @flow (2022.3 Decorators)\n if (is20223Decorator(arg2)) {\n return flowAnnotation.decorate_20223_(arg1, arg2);\n }\n // @flow\n if (isStringish(arg2)) {\n return storeAnnotation(arg1, arg2, flowAnnotation);\n }\n // flow(fn)\n if ( true && arguments.length !== 1) {\n die(\"Flow expects single argument with generator function\");\n }\n var generator = arg1;\n var name = generator.name || \"\";\n // Implementation based on https://github.com/tj/co/blob/master/index.js\n var res = function res() {\n var ctx = this;\n var args = arguments;\n var runId = ++generatorId;\n var gen = action(name + \" - runid: \" + runId + \" - init\", generator).apply(ctx, args);\n var rejector;\n var pendingPromise = undefined;\n var promise = new Promise(function (resolve, reject) {\n var stepId = 0;\n rejector = reject;\n function onFulfilled(res) {\n pendingPromise = undefined;\n var ret;\n try {\n ret = action(name + \" - runid: \" + runId + \" - yield \" + stepId++, gen.next).call(gen, res);\n } catch (e) {\n return reject(e);\n }\n next(ret);\n }\n function onRejected(err) {\n pendingPromise = undefined;\n var ret;\n try {\n ret = action(name + \" - runid: \" + runId + \" - yield \" + stepId++, gen[\"throw\"]).call(gen, err);\n } catch (e) {\n return reject(e);\n }\n next(ret);\n }\n function next(ret) {\n if (isFunction(ret == null ? void 0 : ret.then)) {\n // an async iterator\n ret.then(next, reject);\n return;\n }\n if (ret.done) {\n return resolve(ret.value);\n }\n pendingPromise = Promise.resolve(ret.value);\n return pendingPromise.then(onFulfilled, onRejected);\n }\n onFulfilled(undefined); // kick off the process\n });\n promise.cancel = action(name + \" - runid: \" + runId + \" - cancel\", function () {\n try {\n if (pendingPromise) {\n cancelPromise(pendingPromise);\n }\n // Finally block can return (or yield) stuff..\n var _res = gen[\"return\"](undefined);\n // eat anything that promise would do, it's cancelled!\n var yieldedPromise = Promise.resolve(_res.value);\n yieldedPromise.then(noop, noop);\n cancelPromise(yieldedPromise); // maybe it can be cancelled :)\n // reject our original promise\n rejector(new FlowCancellationError());\n } catch (e) {\n rejector(e); // there could be a throwing finally block\n }\n });\n return promise;\n };\n res.isMobXFlow = true;\n return res;\n}, flowAnnotation);\nflow.bound = /*#__PURE__*/createDecoratorAnnotation(flowBoundAnnotation);\nfunction cancelPromise(promise) {\n if (isFunction(promise.cancel)) {\n promise.cancel();\n }\n}\nfunction flowResult(result) {\n return result; // just tricking TypeScript :)\n}\nfunction isFlow(fn) {\n return (fn == null ? void 0 : fn.isMobXFlow) === true;\n}\n\nfunction interceptReads(thing, propOrHandler, handler) {\n var target;\n if (isObservableMap(thing) || isObservableArray(thing) || isObservableValue(thing)) {\n target = getAdministration(thing);\n } else if (isObservableObject(thing)) {\n if ( true && !isStringish(propOrHandler)) {\n return die(\"InterceptReads can only be used with a specific property, not with an object in general\");\n }\n target = getAdministration(thing, propOrHandler);\n } else if (true) {\n return die(\"Expected observable map, object or array as first array\");\n }\n if ( true && target.dehancer !== undefined) {\n return die(\"An intercept reader was already established\");\n }\n target.dehancer = typeof propOrHandler === \"function\" ? propOrHandler : handler;\n return function () {\n target.dehancer = undefined;\n };\n}\n\nfunction intercept(thing, propOrHandler, handler) {\n if (isFunction(handler)) {\n return interceptProperty(thing, propOrHandler, handler);\n } else {\n return interceptInterceptable(thing, propOrHandler);\n }\n}\nfunction interceptInterceptable(thing, handler) {\n return getAdministration(thing).intercept_(handler);\n}\nfunction interceptProperty(thing, property, handler) {\n return getAdministration(thing, property).intercept_(handler);\n}\n\nfunction _isComputed(value, property) {\n if (property === undefined) {\n return isComputedValue(value);\n }\n if (isObservableObject(value) === false) {\n return false;\n }\n if (!value[$mobx].values_.has(property)) {\n return false;\n }\n var atom = getAtom(value, property);\n return isComputedValue(atom);\n}\nfunction isComputed(value) {\n if ( true && arguments.length > 1) {\n return die(\"isComputed expects only 1 argument. Use isComputedProp to inspect the observability of a property\");\n }\n return _isComputed(value);\n}\nfunction isComputedProp(value, propName) {\n if ( true && !isStringish(propName)) {\n return die(\"isComputed expected a property name as second argument\");\n }\n return _isComputed(value, propName);\n}\n\nfunction _isObservable(value, property) {\n if (!value) {\n return false;\n }\n if (property !== undefined) {\n if ( true && (isObservableMap(value) || isObservableArray(value))) {\n return die(\"isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead.\");\n }\n if (isObservableObject(value)) {\n return value[$mobx].values_.has(property);\n }\n return false;\n }\n // For first check, see #701\n return isObservableObject(value) || !!value[$mobx] || isAtom(value) || isReaction(value) || isComputedValue(value);\n}\nfunction isObservable(value) {\n if ( true && arguments.length !== 1) {\n die(\"isObservable expects only 1 argument. Use isObservableProp to inspect the observability of a property\");\n }\n return _isObservable(value);\n}\nfunction isObservableProp(value, propName) {\n if ( true && !isStringish(propName)) {\n return die(\"expected a property name as second argument\");\n }\n return _isObservable(value, propName);\n}\n\nfunction keys(obj) {\n if (isObservableObject(obj)) {\n return obj[$mobx].keys_();\n }\n if (isObservableMap(obj) || isObservableSet(obj)) {\n return Array.from(obj.keys());\n }\n if (isObservableArray(obj)) {\n return obj.map(function (_, index) {\n return index;\n });\n }\n die(5);\n}\nfunction values(obj) {\n if (isObservableObject(obj)) {\n return keys(obj).map(function (key) {\n return obj[key];\n });\n }\n if (isObservableMap(obj)) {\n return keys(obj).map(function (key) {\n return obj.get(key);\n });\n }\n if (isObservableSet(obj)) {\n return Array.from(obj.values());\n }\n if (isObservableArray(obj)) {\n return obj.slice();\n }\n die(6);\n}\nfunction entries(obj) {\n if (isObservableObject(obj)) {\n return keys(obj).map(function (key) {\n return [key, obj[key]];\n });\n }\n if (isObservableMap(obj)) {\n return keys(obj).map(function (key) {\n return [key, obj.get(key)];\n });\n }\n if (isObservableSet(obj)) {\n return Array.from(obj.entries());\n }\n if (isObservableArray(obj)) {\n return obj.map(function (key, index) {\n return [index, key];\n });\n }\n die(7);\n}\nfunction set(obj, key, value) {\n if (arguments.length === 2 && !isObservableSet(obj)) {\n startBatch();\n var _values = key;\n try {\n for (var _key in _values) {\n set(obj, _key, _values[_key]);\n }\n } finally {\n endBatch();\n }\n return;\n }\n if (isObservableObject(obj)) {\n obj[$mobx].set_(key, value);\n } else if (isObservableMap(obj)) {\n obj.set(key, value);\n } else if (isObservableSet(obj)) {\n obj.add(key);\n } else if (isObservableArray(obj)) {\n if (typeof key !== \"number\") {\n key = parseInt(key, 10);\n }\n if (key < 0) {\n die(\"Invalid index: '\" + key + \"'\");\n }\n startBatch();\n if (key >= obj.length) {\n obj.length = key + 1;\n }\n obj[key] = value;\n endBatch();\n } else {\n die(8);\n }\n}\nfunction remove(obj, key) {\n if (isObservableObject(obj)) {\n obj[$mobx].delete_(key);\n } else if (isObservableMap(obj)) {\n obj[\"delete\"](key);\n } else if (isObservableSet(obj)) {\n obj[\"delete\"](key);\n } else if (isObservableArray(obj)) {\n if (typeof key !== \"number\") {\n key = parseInt(key, 10);\n }\n obj.splice(key, 1);\n } else {\n die(9);\n }\n}\nfunction has(obj, key) {\n if (isObservableObject(obj)) {\n return obj[$mobx].has_(key);\n } else if (isObservableMap(obj)) {\n return obj.has(key);\n } else if (isObservableSet(obj)) {\n return obj.has(key);\n } else if (isObservableArray(obj)) {\n return key >= 0 && key < obj.length;\n }\n die(10);\n}\nfunction get(obj, key) {\n if (!has(obj, key)) {\n return undefined;\n }\n if (isObservableObject(obj)) {\n return obj[$mobx].get_(key);\n } else if (isObservableMap(obj)) {\n return obj.get(key);\n } else if (isObservableArray(obj)) {\n return obj[key];\n }\n die(11);\n}\nfunction apiDefineProperty(obj, key, descriptor) {\n if (isObservableObject(obj)) {\n return obj[$mobx].defineProperty_(key, descriptor);\n }\n die(39);\n}\nfunction apiOwnKeys(obj) {\n if (isObservableObject(obj)) {\n return obj[$mobx].ownKeys_();\n }\n die(38);\n}\n\nfunction observe(thing, propOrCb, cbOrFire, fireImmediately) {\n if (isFunction(cbOrFire)) {\n return observeObservableProperty(thing, propOrCb, cbOrFire, fireImmediately);\n } else {\n return observeObservable(thing, propOrCb, cbOrFire);\n }\n}\nfunction observeObservable(thing, listener, fireImmediately) {\n return getAdministration(thing).observe_(listener, fireImmediately);\n}\nfunction observeObservableProperty(thing, property, listener, fireImmediately) {\n return getAdministration(thing, property).observe_(listener, fireImmediately);\n}\n\nfunction cache(map, key, value) {\n map.set(key, value);\n return value;\n}\nfunction toJSHelper(source, __alreadySeen) {\n if (source == null || typeof source !== \"object\" || source instanceof Date || !isObservable(source)) {\n return source;\n }\n if (isObservableValue(source) || isComputedValue(source)) {\n return toJSHelper(source.get(), __alreadySeen);\n }\n if (__alreadySeen.has(source)) {\n return __alreadySeen.get(source);\n }\n if (isObservableArray(source)) {\n var res = cache(__alreadySeen, source, new Array(source.length));\n source.forEach(function (value, idx) {\n res[idx] = toJSHelper(value, __alreadySeen);\n });\n return res;\n }\n if (isObservableSet(source)) {\n var _res = cache(__alreadySeen, source, new Set());\n source.forEach(function (value) {\n _res.add(toJSHelper(value, __alreadySeen));\n });\n return _res;\n }\n if (isObservableMap(source)) {\n var _res2 = cache(__alreadySeen, source, new Map());\n source.forEach(function (value, key) {\n _res2.set(key, toJSHelper(value, __alreadySeen));\n });\n return _res2;\n } else {\n // must be observable object\n var _res3 = cache(__alreadySeen, source, {});\n apiOwnKeys(source).forEach(function (key) {\n if (objectPrototype.propertyIsEnumerable.call(source, key)) {\n _res3[key] = toJSHelper(source[key], __alreadySeen);\n }\n });\n return _res3;\n }\n}\n/**\n * Recursively converts an observable to it's non-observable native counterpart.\n * It does NOT recurse into non-observables, these are left as they are, even if they contain observables.\n * Computed and other non-enumerable properties are completely ignored.\n * Complex scenarios require custom solution, eg implementing `toJSON` or using `serializr` lib.\n */\nfunction toJS(source, options) {\n if ( true && options) {\n die(\"toJS no longer supports options\");\n }\n return toJSHelper(source, new Map());\n}\n\nfunction trace() {\n if (false) {}\n var enterBreakPoint = false;\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n if (typeof args[args.length - 1] === \"boolean\") {\n enterBreakPoint = args.pop();\n }\n var derivation = getAtomFromArgs(args);\n if (!derivation) {\n return die(\"'trace(break?)' can only be used inside a tracked computed value or a Reaction. Consider passing in the computed value or reaction explicitly\");\n }\n if (derivation.isTracing_ === TraceMode.NONE) {\n console.log(\"[mobx.trace] '\" + derivation.name_ + \"' tracing enabled\");\n }\n derivation.isTracing_ = enterBreakPoint ? TraceMode.BREAK : TraceMode.LOG;\n}\nfunction getAtomFromArgs(args) {\n switch (args.length) {\n case 0:\n return globalState.trackingDerivation;\n case 1:\n return getAtom(args[0]);\n case 2:\n return getAtom(args[0], args[1]);\n }\n}\n\n/**\n * During a transaction no views are updated until the end of the transaction.\n * The transaction will be run synchronously nonetheless.\n *\n * @param action a function that updates some reactive state\n * @returns any value that was returned by the 'action' parameter.\n */\nfunction transaction(action, thisArg) {\n if (thisArg === void 0) {\n thisArg = undefined;\n }\n startBatch();\n try {\n return action.apply(thisArg);\n } finally {\n endBatch();\n }\n}\n\nfunction when(predicate, arg1, arg2) {\n if (arguments.length === 1 || arg1 && typeof arg1 === \"object\") {\n return whenPromise(predicate, arg1);\n }\n return _when(predicate, arg1, arg2 || {});\n}\nfunction _when(predicate, effect, opts) {\n var timeoutHandle;\n if (typeof opts.timeout === \"number\") {\n var error = new Error(\"WHEN_TIMEOUT\");\n timeoutHandle = setTimeout(function () {\n if (!disposer[$mobx].isDisposed) {\n disposer();\n if (opts.onError) {\n opts.onError(error);\n } else {\n throw error;\n }\n }\n }, opts.timeout);\n }\n opts.name = true ? opts.name || \"When@\" + getNextId() : 0;\n var effectAction = createAction( true ? opts.name + \"-effect\" : 0, effect);\n // eslint-disable-next-line\n var disposer = autorun(function (r) {\n // predicate should not change state\n var cond = allowStateChanges(false, predicate);\n if (cond) {\n r.dispose();\n if (timeoutHandle) {\n clearTimeout(timeoutHandle);\n }\n effectAction();\n }\n }, opts);\n return disposer;\n}\nfunction whenPromise(predicate, opts) {\n var _opts$signal;\n if ( true && opts && opts.onError) {\n return die(\"the options 'onError' and 'promise' cannot be combined\");\n }\n if (opts != null && (_opts$signal = opts.signal) != null && _opts$signal.aborted) {\n return Object.assign(Promise.reject(new Error(\"WHEN_ABORTED\")), {\n cancel: function cancel() {\n return null;\n }\n });\n }\n var cancel;\n var abort;\n var res = new Promise(function (resolve, reject) {\n var _opts$signal2;\n var disposer = _when(predicate, resolve, _extends({}, opts, {\n onError: reject\n }));\n cancel = function cancel() {\n disposer();\n reject(new Error(\"WHEN_CANCELLED\"));\n };\n abort = function abort() {\n disposer();\n reject(new Error(\"WHEN_ABORTED\"));\n };\n opts == null || (_opts$signal2 = opts.signal) == null || _opts$signal2.addEventListener == null || _opts$signal2.addEventListener(\"abort\", abort);\n })[\"finally\"](function () {\n var _opts$signal3;\n return opts == null || (_opts$signal3 = opts.signal) == null || _opts$signal3.removeEventListener == null ? void 0 : _opts$signal3.removeEventListener(\"abort\", abort);\n });\n res.cancel = cancel;\n return res;\n}\n\nfunction getAdm(target) {\n return target[$mobx];\n}\n// Optimization: we don't need the intermediate objects and could have a completely custom administration for DynamicObjects,\n// and skip either the internal values map, or the base object with its property descriptors!\nvar objectProxyTraps = {\n has: function has(target, name) {\n if ( true && globalState.trackingDerivation) {\n warnAboutProxyRequirement(\"detect new properties using the 'in' operator. Use 'has' from 'mobx' instead.\");\n }\n return getAdm(target).has_(name);\n },\n get: function get(target, name) {\n return getAdm(target).get_(name);\n },\n set: function set(target, name, value) {\n var _getAdm$set_;\n if (!isStringish(name)) {\n return false;\n }\n if ( true && !getAdm(target).values_.has(name)) {\n warnAboutProxyRequirement(\"add a new observable property through direct assignment. Use 'set' from 'mobx' instead.\");\n }\n // null (intercepted) -> true (success)\n return (_getAdm$set_ = getAdm(target).set_(name, value, true)) != null ? _getAdm$set_ : true;\n },\n deleteProperty: function deleteProperty(target, name) {\n var _getAdm$delete_;\n if (true) {\n warnAboutProxyRequirement(\"delete properties from an observable object. Use 'remove' from 'mobx' instead.\");\n }\n if (!isStringish(name)) {\n return false;\n }\n // null (intercepted) -> true (success)\n return (_getAdm$delete_ = getAdm(target).delete_(name, true)) != null ? _getAdm$delete_ : true;\n },\n defineProperty: function defineProperty(target, name, descriptor) {\n var _getAdm$definePropert;\n if (true) {\n warnAboutProxyRequirement(\"define property on an observable object. Use 'defineProperty' from 'mobx' instead.\");\n }\n // null (intercepted) -> true (success)\n return (_getAdm$definePropert = getAdm(target).defineProperty_(name, descriptor)) != null ? _getAdm$definePropert : true;\n },\n ownKeys: function ownKeys(target) {\n if ( true && globalState.trackingDerivation) {\n warnAboutProxyRequirement(\"iterate keys to detect added / removed properties. Use 'keys' from 'mobx' instead.\");\n }\n return getAdm(target).ownKeys_();\n },\n preventExtensions: function preventExtensions(target) {\n die(13);\n }\n};\nfunction asDynamicObservableObject(target, options) {\n var _target$$mobx, _target$$mobx$proxy_;\n assertProxies();\n target = asObservableObject(target, options);\n return (_target$$mobx$proxy_ = (_target$$mobx = target[$mobx]).proxy_) != null ? _target$$mobx$proxy_ : _target$$mobx.proxy_ = new Proxy(target, objectProxyTraps);\n}\n\nfunction hasInterceptors(interceptable) {\n return interceptable.interceptors_ !== undefined && interceptable.interceptors_.length > 0;\n}\nfunction registerInterceptor(interceptable, handler) {\n var interceptors = interceptable.interceptors_ || (interceptable.interceptors_ = []);\n interceptors.push(handler);\n return once(function () {\n var idx = interceptors.indexOf(handler);\n if (idx !== -1) {\n interceptors.splice(idx, 1);\n }\n });\n}\nfunction interceptChange(interceptable, change) {\n var prevU = untrackedStart();\n try {\n // Interceptor can modify the array, copy it to avoid concurrent modification, see #1950\n var interceptors = [].concat(interceptable.interceptors_ || []);\n for (var i = 0, l = interceptors.length; i < l; i++) {\n change = interceptors[i](change);\n if (change && !change.type) {\n die(14);\n }\n if (!change) {\n break;\n }\n }\n return change;\n } finally {\n untrackedEnd(prevU);\n }\n}\n\nfunction hasListeners(listenable) {\n return listenable.changeListeners_ !== undefined && listenable.changeListeners_.length > 0;\n}\nfunction registerListener(listenable, handler) {\n var listeners = listenable.changeListeners_ || (listenable.changeListeners_ = []);\n listeners.push(handler);\n return once(function () {\n var idx = listeners.indexOf(handler);\n if (idx !== -1) {\n listeners.splice(idx, 1);\n }\n });\n}\nfunction notifyListeners(listenable, change) {\n var prevU = untrackedStart();\n var listeners = listenable.changeListeners_;\n if (!listeners) {\n return;\n }\n listeners = listeners.slice();\n for (var i = 0, l = listeners.length; i < l; i++) {\n listeners[i](change);\n }\n untrackedEnd(prevU);\n}\n\nfunction makeObservable(target, annotations, options) {\n initObservable(function () {\n var _annotations;\n var adm = asObservableObject(target, options)[$mobx];\n if ( true && annotations && target[storedAnnotationsSymbol]) {\n die(\"makeObservable second arg must be nullish when using decorators. Mixing @decorator syntax with annotations is not supported.\");\n }\n // Default to decorators\n (_annotations = annotations) != null ? _annotations : annotations = collectStoredAnnotations(target);\n // Annotate\n ownKeys(annotations).forEach(function (key) {\n return adm.make_(key, annotations[key]);\n });\n });\n return target;\n}\n// proto[keysSymbol] = new Set()\nvar keysSymbol = /*#__PURE__*/Symbol(\"mobx-keys\");\nfunction makeAutoObservable(target, overrides, options) {\n if (true) {\n if (!isPlainObject(target) && !isPlainObject(Object.getPrototypeOf(target))) {\n die(\"'makeAutoObservable' can only be used for classes that don't have a superclass\");\n }\n if (isObservableObject(target)) {\n die(\"makeAutoObservable can only be used on objects not already made observable\");\n }\n }\n // Optimization: avoid visiting protos\n // Assumes that annotation.make_/.extend_ works the same for plain objects\n if (isPlainObject(target)) {\n return extendObservable(target, target, overrides, options);\n }\n initObservable(function () {\n var adm = asObservableObject(target, options)[$mobx];\n // Optimization: cache keys on proto\n // Assumes makeAutoObservable can be called only once per object and can't be used in subclass\n if (!target[keysSymbol]) {\n var proto = Object.getPrototypeOf(target);\n var keys = new Set([].concat(ownKeys(target), ownKeys(proto)));\n keys[\"delete\"](\"constructor\");\n keys[\"delete\"]($mobx);\n addHiddenProp(proto, keysSymbol, keys);\n }\n target[keysSymbol].forEach(function (key) {\n return adm.make_(key,\n // must pass \"undefined\" for { key: undefined }\n !overrides ? true : key in overrides ? overrides[key] : true);\n });\n });\n return target;\n}\n\nvar SPLICE = \"splice\";\nvar UPDATE = \"update\";\nvar MAX_SPLICE_SIZE = 10000; // See e.g. https://github.com/mobxjs/mobx/issues/859\nvar arrayTraps = {\n get: function get(target, name) {\n var adm = target[$mobx];\n if (name === $mobx) {\n return adm;\n }\n if (name === \"length\") {\n return adm.getArrayLength_();\n }\n if (typeof name === \"string\" && !isNaN(name)) {\n return adm.get_(parseInt(name));\n }\n if (hasProp(arrayExtensions, name)) {\n return arrayExtensions[name];\n }\n return target[name];\n },\n set: function set(target, name, value) {\n var adm = target[$mobx];\n if (name === \"length\") {\n adm.setArrayLength_(value);\n }\n if (typeof name === \"symbol\" || isNaN(name)) {\n target[name] = value;\n } else {\n // numeric string\n adm.set_(parseInt(name), value);\n }\n return true;\n },\n preventExtensions: function preventExtensions() {\n die(15);\n }\n};\nvar ObservableArrayAdministration = /*#__PURE__*/function () {\n function ObservableArrayAdministration(name, enhancer, owned_, legacyMode_) {\n if (name === void 0) {\n name = true ? \"ObservableArray@\" + getNextId() : 0;\n }\n this.owned_ = void 0;\n this.legacyMode_ = void 0;\n this.atom_ = void 0;\n this.values_ = [];\n // this is the prop that gets proxied, so can't replace it!\n this.interceptors_ = void 0;\n this.changeListeners_ = void 0;\n this.enhancer_ = void 0;\n this.dehancer = void 0;\n this.proxy_ = void 0;\n this.lastKnownLength_ = 0;\n this.owned_ = owned_;\n this.legacyMode_ = legacyMode_;\n this.atom_ = new Atom(name);\n this.enhancer_ = function (newV, oldV) {\n return enhancer(newV, oldV, true ? name + \"[..]\" : 0);\n };\n }\n var _proto = ObservableArrayAdministration.prototype;\n _proto.dehanceValue_ = function dehanceValue_(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.dehanceValues_ = function dehanceValues_(values) {\n if (this.dehancer !== undefined && values.length > 0) {\n return values.map(this.dehancer);\n }\n return values;\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n if (fireImmediately === void 0) {\n fireImmediately = false;\n }\n if (fireImmediately) {\n listener({\n observableKind: \"array\",\n object: this.proxy_,\n debugObjectName: this.atom_.name_,\n type: \"splice\",\n index: 0,\n added: this.values_.slice(),\n addedCount: this.values_.length,\n removed: [],\n removedCount: 0\n });\n }\n return registerListener(this, listener);\n };\n _proto.getArrayLength_ = function getArrayLength_() {\n this.atom_.reportObserved();\n return this.values_.length;\n };\n _proto.setArrayLength_ = function setArrayLength_(newLength) {\n if (typeof newLength !== \"number\" || isNaN(newLength) || newLength < 0) {\n die(\"Out of range: \" + newLength);\n }\n var currentLength = this.values_.length;\n if (newLength === currentLength) {\n return;\n } else if (newLength > currentLength) {\n var newItems = new Array(newLength - currentLength);\n for (var i = 0; i < newLength - currentLength; i++) {\n newItems[i] = undefined;\n } // No Array.fill everywhere...\n this.spliceWithArray_(currentLength, 0, newItems);\n } else {\n this.spliceWithArray_(newLength, currentLength - newLength);\n }\n };\n _proto.updateArrayLength_ = function updateArrayLength_(oldLength, delta) {\n if (oldLength !== this.lastKnownLength_) {\n die(16);\n }\n this.lastKnownLength_ += delta;\n if (this.legacyMode_ && delta > 0) {\n reserveArrayBuffer(oldLength + delta + 1);\n }\n };\n _proto.spliceWithArray_ = function spliceWithArray_(index, deleteCount, newItems) {\n var _this = this;\n checkIfStateModificationsAreAllowed(this.atom_);\n var length = this.values_.length;\n if (index === undefined) {\n index = 0;\n } else if (index > length) {\n index = length;\n } else if (index < 0) {\n index = Math.max(0, length + index);\n }\n if (arguments.length === 1) {\n deleteCount = length - index;\n } else if (deleteCount === undefined || deleteCount === null) {\n deleteCount = 0;\n } else {\n deleteCount = Math.max(0, Math.min(deleteCount, length - index));\n }\n if (newItems === undefined) {\n newItems = EMPTY_ARRAY;\n }\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_,\n type: SPLICE,\n index: index,\n removedCount: deleteCount,\n added: newItems\n });\n if (!change) {\n return EMPTY_ARRAY;\n }\n deleteCount = change.removedCount;\n newItems = change.added;\n }\n newItems = newItems.length === 0 ? newItems : newItems.map(function (v) {\n return _this.enhancer_(v, undefined);\n });\n if (this.legacyMode_ || \"development\" !== \"production\") {\n var lengthDelta = newItems.length - deleteCount;\n this.updateArrayLength_(length, lengthDelta); // checks if internal array wasn't modified\n }\n var res = this.spliceItemsIntoValues_(index, deleteCount, newItems);\n if (deleteCount !== 0 || newItems.length !== 0) {\n this.notifyArraySplice_(index, newItems, res);\n }\n return this.dehanceValues_(res);\n };\n _proto.spliceItemsIntoValues_ = function spliceItemsIntoValues_(index, deleteCount, newItems) {\n if (newItems.length < MAX_SPLICE_SIZE) {\n var _this$values_;\n return (_this$values_ = this.values_).splice.apply(_this$values_, [index, deleteCount].concat(newItems));\n } else {\n // The items removed by the splice\n var res = this.values_.slice(index, index + deleteCount);\n // The items that that should remain at the end of the array\n var oldItems = this.values_.slice(index + deleteCount);\n // New length is the previous length + addition count - deletion count\n this.values_.length += newItems.length - deleteCount;\n for (var i = 0; i < newItems.length; i++) {\n this.values_[index + i] = newItems[i];\n }\n for (var _i = 0; _i < oldItems.length; _i++) {\n this.values_[index + newItems.length + _i] = oldItems[_i];\n }\n return res;\n }\n };\n _proto.notifyArrayChildUpdate_ = function notifyArrayChildUpdate_(index, newValue, oldValue) {\n var notifySpy = !this.owned_ && isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"array\",\n object: this.proxy_,\n type: UPDATE,\n debugObjectName: this.atom_.name_,\n index: index,\n newValue: newValue,\n oldValue: oldValue\n } : null;\n // The reason why this is on right hand side here (and not above), is this way the uglifier will drop it, but it won't\n // cause any runtime overhead in development mode without NODE_ENV set, unless spying is enabled\n if ( true && notifySpy) {\n spyReportStart(change);\n }\n this.atom_.reportChanged();\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n };\n _proto.notifyArraySplice_ = function notifyArraySplice_(index, added, removed) {\n var notifySpy = !this.owned_ && isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"array\",\n object: this.proxy_,\n debugObjectName: this.atom_.name_,\n type: SPLICE,\n index: index,\n removed: removed,\n added: added,\n removedCount: removed.length,\n addedCount: added.length\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n }\n this.atom_.reportChanged();\n // conform: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/observe\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n };\n _proto.get_ = function get_(index) {\n if (this.legacyMode_ && index >= this.values_.length) {\n console.warn( true ? \"[mobx.array] Attempt to read an array index (\" + index + \") that is out of bounds (\" + this.values_.length + \"). Please check length first. Out of bound indices will not be tracked by MobX\" : 0);\n return undefined;\n }\n this.atom_.reportObserved();\n return this.dehanceValue_(this.values_[index]);\n };\n _proto.set_ = function set_(index, newValue) {\n var values = this.values_;\n if (this.legacyMode_ && index > values.length) {\n // out of bounds\n die(17, index, values.length);\n }\n if (index < values.length) {\n // update at index in range\n checkIfStateModificationsAreAllowed(this.atom_);\n var oldValue = values[index];\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: UPDATE,\n object: this.proxy_,\n // since \"this\" is the real array we need to pass its proxy\n index: index,\n newValue: newValue\n });\n if (!change) {\n return;\n }\n newValue = change.newValue;\n }\n newValue = this.enhancer_(newValue, oldValue);\n var changed = newValue !== oldValue;\n if (changed) {\n values[index] = newValue;\n this.notifyArrayChildUpdate_(index, newValue, oldValue);\n }\n } else {\n // For out of bound index, we don't create an actual sparse array,\n // but rather fill the holes with undefined (same as setArrayLength_).\n // This could be considered a bug.\n var newItems = new Array(index + 1 - values.length);\n for (var i = 0; i < newItems.length - 1; i++) {\n newItems[i] = undefined;\n } // No Array.fill everywhere...\n newItems[newItems.length - 1] = newValue;\n this.spliceWithArray_(values.length, 0, newItems);\n }\n };\n return ObservableArrayAdministration;\n}();\nfunction createObservableArray(initialValues, enhancer, name, owned) {\n if (name === void 0) {\n name = true ? \"ObservableArray@\" + getNextId() : 0;\n }\n if (owned === void 0) {\n owned = false;\n }\n assertProxies();\n return initObservable(function () {\n var adm = new ObservableArrayAdministration(name, enhancer, owned, false);\n addHiddenFinalProp(adm.values_, $mobx, adm);\n var proxy = new Proxy(adm.values_, arrayTraps);\n adm.proxy_ = proxy;\n if (initialValues && initialValues.length) {\n adm.spliceWithArray_(0, 0, initialValues);\n }\n return proxy;\n });\n}\n// eslint-disable-next-line\nvar arrayExtensions = {\n clear: function clear() {\n return this.splice(0);\n },\n replace: function replace(newItems) {\n var adm = this[$mobx];\n return adm.spliceWithArray_(0, adm.values_.length, newItems);\n },\n // Used by JSON.stringify\n toJSON: function toJSON() {\n return this.slice();\n },\n /*\n * functions that do alter the internal structure of the array, (based on lib.es6.d.ts)\n * since these functions alter the inner structure of the array, the have side effects.\n * Because the have side effects, they should not be used in computed function,\n * and for that reason the do not call dependencyState.notifyObserved\n */\n splice: function splice(index, deleteCount) {\n for (var _len = arguments.length, newItems = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {\n newItems[_key - 2] = arguments[_key];\n }\n var adm = this[$mobx];\n switch (arguments.length) {\n case 0:\n return [];\n case 1:\n return adm.spliceWithArray_(index);\n case 2:\n return adm.spliceWithArray_(index, deleteCount);\n }\n return adm.spliceWithArray_(index, deleteCount, newItems);\n },\n spliceWithArray: function spliceWithArray(index, deleteCount, newItems) {\n return this[$mobx].spliceWithArray_(index, deleteCount, newItems);\n },\n push: function push() {\n var adm = this[$mobx];\n for (var _len2 = arguments.length, items = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n items[_key2] = arguments[_key2];\n }\n adm.spliceWithArray_(adm.values_.length, 0, items);\n return adm.values_.length;\n },\n pop: function pop() {\n return this.splice(Math.max(this[$mobx].values_.length - 1, 0), 1)[0];\n },\n shift: function shift() {\n return this.splice(0, 1)[0];\n },\n unshift: function unshift() {\n var adm = this[$mobx];\n for (var _len3 = arguments.length, items = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n items[_key3] = arguments[_key3];\n }\n adm.spliceWithArray_(0, 0, items);\n return adm.values_.length;\n },\n reverse: function reverse() {\n // reverse by default mutates in place before returning the result\n // which makes it both a 'derivation' and a 'mutation'.\n if (globalState.trackingDerivation) {\n die(37, \"reverse\");\n }\n this.replace(this.slice().reverse());\n return this;\n },\n sort: function sort() {\n // sort by default mutates in place before returning the result\n // which goes against all good practices. Let's not change the array in place!\n if (globalState.trackingDerivation) {\n die(37, \"sort\");\n }\n var copy = this.slice();\n copy.sort.apply(copy, arguments);\n this.replace(copy);\n return this;\n },\n remove: function remove(value) {\n var adm = this[$mobx];\n var idx = adm.dehanceValues_(adm.values_).indexOf(value);\n if (idx > -1) {\n this.splice(idx, 1);\n return true;\n }\n return false;\n }\n};\n/**\n * Wrap function from prototype\n * Without this, everything works as well, but this works\n * faster as everything works on unproxied values\n */\naddArrayExtension(\"at\", simpleFunc);\naddArrayExtension(\"concat\", simpleFunc);\naddArrayExtension(\"flat\", simpleFunc);\naddArrayExtension(\"includes\", simpleFunc);\naddArrayExtension(\"indexOf\", simpleFunc);\naddArrayExtension(\"join\", simpleFunc);\naddArrayExtension(\"lastIndexOf\", simpleFunc);\naddArrayExtension(\"slice\", simpleFunc);\naddArrayExtension(\"toString\", simpleFunc);\naddArrayExtension(\"toLocaleString\", simpleFunc);\naddArrayExtension(\"toSorted\", simpleFunc);\naddArrayExtension(\"toSpliced\", simpleFunc);\naddArrayExtension(\"with\", simpleFunc);\n// map\naddArrayExtension(\"every\", mapLikeFunc);\naddArrayExtension(\"filter\", mapLikeFunc);\naddArrayExtension(\"find\", mapLikeFunc);\naddArrayExtension(\"findIndex\", mapLikeFunc);\naddArrayExtension(\"findLast\", mapLikeFunc);\naddArrayExtension(\"findLastIndex\", mapLikeFunc);\naddArrayExtension(\"flatMap\", mapLikeFunc);\naddArrayExtension(\"forEach\", mapLikeFunc);\naddArrayExtension(\"map\", mapLikeFunc);\naddArrayExtension(\"some\", mapLikeFunc);\naddArrayExtension(\"toReversed\", mapLikeFunc);\n// reduce\naddArrayExtension(\"reduce\", reduceLikeFunc);\naddArrayExtension(\"reduceRight\", reduceLikeFunc);\nfunction addArrayExtension(funcName, funcFactory) {\n if (typeof Array.prototype[funcName] === \"function\") {\n arrayExtensions[funcName] = funcFactory(funcName);\n }\n}\n// Report and delegate to dehanced array\nfunction simpleFunc(funcName) {\n return function () {\n var adm = this[$mobx];\n adm.atom_.reportObserved();\n var dehancedValues = adm.dehanceValues_(adm.values_);\n return dehancedValues[funcName].apply(dehancedValues, arguments);\n };\n}\n// Make sure callbacks receive correct array arg #2326\nfunction mapLikeFunc(funcName) {\n return function (callback, thisArg) {\n var _this2 = this;\n var adm = this[$mobx];\n adm.atom_.reportObserved();\n var dehancedValues = adm.dehanceValues_(adm.values_);\n return dehancedValues[funcName](function (element, index) {\n return callback.call(thisArg, element, index, _this2);\n });\n };\n}\n// Make sure callbacks receive correct array arg #2326\nfunction reduceLikeFunc(funcName) {\n return function () {\n var _this3 = this;\n var adm = this[$mobx];\n adm.atom_.reportObserved();\n var dehancedValues = adm.dehanceValues_(adm.values_);\n // #2432 - reduce behavior depends on arguments.length\n var callback = arguments[0];\n arguments[0] = function (accumulator, currentValue, index) {\n return callback(accumulator, currentValue, index, _this3);\n };\n return dehancedValues[funcName].apply(dehancedValues, arguments);\n };\n}\nvar isObservableArrayAdministration = /*#__PURE__*/createInstanceofPredicate(\"ObservableArrayAdministration\", ObservableArrayAdministration);\nfunction isObservableArray(thing) {\n return isObject(thing) && isObservableArrayAdministration(thing[$mobx]);\n}\n\nvar ObservableMapMarker = {};\nvar ADD = \"add\";\nvar DELETE = \"delete\";\n// just extend Map? See also https://gist.github.com/nestharus/13b4d74f2ef4a2f4357dbd3fc23c1e54\n// But: https://github.com/mobxjs/mobx/issues/1556\nvar ObservableMap = /*#__PURE__*/function () {\n function ObservableMap(initialData, enhancer_, name_) {\n var _this = this;\n if (enhancer_ === void 0) {\n enhancer_ = deepEnhancer;\n }\n if (name_ === void 0) {\n name_ = true ? \"ObservableMap@\" + getNextId() : 0;\n }\n this.enhancer_ = void 0;\n this.name_ = void 0;\n this[$mobx] = ObservableMapMarker;\n this.data_ = void 0;\n this.hasMap_ = void 0;\n // hasMap, not hashMap >-).\n this.keysAtom_ = void 0;\n this.interceptors_ = void 0;\n this.changeListeners_ = void 0;\n this.dehancer = void 0;\n this.enhancer_ = enhancer_;\n this.name_ = name_;\n if (!isFunction(Map)) {\n die(18);\n }\n initObservable(function () {\n _this.keysAtom_ = createAtom( true ? _this.name_ + \".keys()\" : 0);\n _this.data_ = new Map();\n _this.hasMap_ = new Map();\n if (initialData) {\n _this.merge(initialData);\n }\n });\n }\n var _proto = ObservableMap.prototype;\n _proto.has_ = function has_(key) {\n return this.data_.has(key);\n };\n _proto.has = function has(key) {\n var _this2 = this;\n if (!globalState.trackingDerivation) {\n return this.has_(key);\n }\n var entry = this.hasMap_.get(key);\n if (!entry) {\n var newEntry = entry = new ObservableValue(this.has_(key), referenceEnhancer, true ? this.name_ + \".\" + stringifyKey(key) + \"?\" : 0, false);\n this.hasMap_.set(key, newEntry);\n onBecomeUnobserved(newEntry, function () {\n return _this2.hasMap_[\"delete\"](key);\n });\n }\n return entry.get();\n };\n _proto.set = function set(key, value) {\n var hasKey = this.has_(key);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: hasKey ? UPDATE : ADD,\n object: this,\n newValue: value,\n name: key\n });\n if (!change) {\n return this;\n }\n value = change.newValue;\n }\n if (hasKey) {\n this.updateValue_(key, value);\n } else {\n this.addValue_(key, value);\n }\n return this;\n };\n _proto[\"delete\"] = function _delete(key) {\n var _this3 = this;\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: DELETE,\n object: this,\n name: key\n });\n if (!change) {\n return false;\n }\n }\n if (this.has_(key)) {\n var notifySpy = isSpyEnabled();\n var notify = hasListeners(this);\n var _change = notify || notifySpy ? {\n observableKind: \"map\",\n debugObjectName: this.name_,\n type: DELETE,\n object: this,\n oldValue: this.data_.get(key).value_,\n name: key\n } : null;\n if ( true && notifySpy) {\n spyReportStart(_change);\n } // TODO fix type\n transaction(function () {\n var _this3$hasMap_$get;\n _this3.keysAtom_.reportChanged();\n (_this3$hasMap_$get = _this3.hasMap_.get(key)) == null || _this3$hasMap_$get.setNewValue_(false);\n var observable = _this3.data_.get(key);\n observable.setNewValue_(undefined);\n _this3.data_[\"delete\"](key);\n });\n if (notify) {\n notifyListeners(this, _change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n return true;\n }\n return false;\n };\n _proto.updateValue_ = function updateValue_(key, newValue) {\n var observable = this.data_.get(key);\n newValue = observable.prepareNewValue_(newValue);\n if (newValue !== globalState.UNCHANGED) {\n var notifySpy = isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"map\",\n debugObjectName: this.name_,\n type: UPDATE,\n object: this,\n oldValue: observable.value_,\n name: key,\n newValue: newValue\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n } // TODO fix type\n observable.setNewValue_(newValue);\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n };\n _proto.addValue_ = function addValue_(key, newValue) {\n var _this4 = this;\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n transaction(function () {\n var _this4$hasMap_$get;\n var observable = new ObservableValue(newValue, _this4.enhancer_, true ? _this4.name_ + \".\" + stringifyKey(key) : 0, false);\n _this4.data_.set(key, observable);\n newValue = observable.value_; // value might have been changed\n (_this4$hasMap_$get = _this4.hasMap_.get(key)) == null || _this4$hasMap_$get.setNewValue_(true);\n _this4.keysAtom_.reportChanged();\n });\n var notifySpy = isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"map\",\n debugObjectName: this.name_,\n type: ADD,\n object: this,\n name: key,\n newValue: newValue\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n } // TODO fix type\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n };\n _proto.get = function get(key) {\n if (this.has(key)) {\n return this.dehanceValue_(this.data_.get(key).get());\n }\n return this.dehanceValue_(undefined);\n };\n _proto.dehanceValue_ = function dehanceValue_(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.keys = function keys() {\n this.keysAtom_.reportObserved();\n return this.data_.keys();\n };\n _proto.values = function values() {\n var self = this;\n var keys = this.keys();\n return makeIterable({\n next: function next() {\n var _keys$next = keys.next(),\n done = _keys$next.done,\n value = _keys$next.value;\n return {\n done: done,\n value: done ? undefined : self.get(value)\n };\n }\n });\n };\n _proto.entries = function entries() {\n var self = this;\n var keys = this.keys();\n return makeIterable({\n next: function next() {\n var _keys$next2 = keys.next(),\n done = _keys$next2.done,\n value = _keys$next2.value;\n return {\n done: done,\n value: done ? undefined : [value, self.get(value)]\n };\n }\n });\n };\n _proto[Symbol.iterator] = function () {\n return this.entries();\n };\n _proto.forEach = function forEach(callback, thisArg) {\n for (var _iterator = _createForOfIteratorHelperLoose(this), _step; !(_step = _iterator()).done;) {\n var _step$value = _step.value,\n key = _step$value[0],\n value = _step$value[1];\n callback.call(thisArg, value, key, this);\n }\n }\n /** Merge another object into this object, returns this. */;\n _proto.merge = function merge(other) {\n var _this5 = this;\n if (isObservableMap(other)) {\n other = new Map(other);\n }\n transaction(function () {\n if (isPlainObject(other)) {\n getPlainObjectKeys(other).forEach(function (key) {\n return _this5.set(key, other[key]);\n });\n } else if (Array.isArray(other)) {\n other.forEach(function (_ref) {\n var key = _ref[0],\n value = _ref[1];\n return _this5.set(key, value);\n });\n } else if (isES6Map(other)) {\n if (!isPlainES6Map(other)) {\n die(19, other);\n }\n other.forEach(function (value, key) {\n return _this5.set(key, value);\n });\n } else if (other !== null && other !== undefined) {\n die(20, other);\n }\n });\n return this;\n };\n _proto.clear = function clear() {\n var _this6 = this;\n transaction(function () {\n untracked(function () {\n for (var _iterator2 = _createForOfIteratorHelperLoose(_this6.keys()), _step2; !(_step2 = _iterator2()).done;) {\n var key = _step2.value;\n _this6[\"delete\"](key);\n }\n });\n });\n };\n _proto.replace = function replace(values) {\n var _this7 = this;\n // Implementation requirements:\n // - respect ordering of replacement map\n // - allow interceptors to run and potentially prevent individual operations\n // - don't recreate observables that already exist in original map (so we don't destroy existing subscriptions)\n // - don't _keysAtom.reportChanged if the keys of resulting map are indentical (order matters!)\n // - note that result map may differ from replacement map due to the interceptors\n transaction(function () {\n // Convert to map so we can do quick key lookups\n var replacementMap = convertToMap(values);\n var orderedData = new Map();\n // Used for optimization\n var keysReportChangedCalled = false;\n // Delete keys that don't exist in replacement map\n // if the key deletion is prevented by interceptor\n // add entry at the beginning of the result map\n for (var _iterator3 = _createForOfIteratorHelperLoose(_this7.data_.keys()), _step3; !(_step3 = _iterator3()).done;) {\n var key = _step3.value;\n // Concurrently iterating/deleting keys\n // iterator should handle this correctly\n if (!replacementMap.has(key)) {\n var deleted = _this7[\"delete\"](key);\n // Was the key removed?\n if (deleted) {\n // _keysAtom.reportChanged() was already called\n keysReportChangedCalled = true;\n } else {\n // Delete prevented by interceptor\n var value = _this7.data_.get(key);\n orderedData.set(key, value);\n }\n }\n }\n // Merge entries\n for (var _iterator4 = _createForOfIteratorHelperLoose(replacementMap.entries()), _step4; !(_step4 = _iterator4()).done;) {\n var _step4$value = _step4.value,\n _key = _step4$value[0],\n _value = _step4$value[1];\n // We will want to know whether a new key is added\n var keyExisted = _this7.data_.has(_key);\n // Add or update value\n _this7.set(_key, _value);\n // The addition could have been prevent by interceptor\n if (_this7.data_.has(_key)) {\n // The update could have been prevented by interceptor\n // and also we want to preserve existing values\n // so use value from _data map (instead of replacement map)\n var _value2 = _this7.data_.get(_key);\n orderedData.set(_key, _value2);\n // Was a new key added?\n if (!keyExisted) {\n // _keysAtom.reportChanged() was already called\n keysReportChangedCalled = true;\n }\n }\n }\n // Check for possible key order change\n if (!keysReportChangedCalled) {\n if (_this7.data_.size !== orderedData.size) {\n // If size differs, keys are definitely modified\n _this7.keysAtom_.reportChanged();\n } else {\n var iter1 = _this7.data_.keys();\n var iter2 = orderedData.keys();\n var next1 = iter1.next();\n var next2 = iter2.next();\n while (!next1.done) {\n if (next1.value !== next2.value) {\n _this7.keysAtom_.reportChanged();\n break;\n }\n next1 = iter1.next();\n next2 = iter2.next();\n }\n }\n }\n // Use correctly ordered map\n _this7.data_ = orderedData;\n });\n return this;\n };\n _proto.toString = function toString() {\n return \"[object ObservableMap]\";\n };\n _proto.toJSON = function toJSON() {\n return Array.from(this);\n };\n /**\n * Observes this object. Triggers for the events 'add', 'update' and 'delete'.\n * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe\n * for callback details\n */\n _proto.observe_ = function observe_(listener, fireImmediately) {\n if ( true && fireImmediately === true) {\n die(\"`observe` doesn't support fireImmediately=true in combination with maps.\");\n }\n return registerListener(this, listener);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n return _createClass(ObservableMap, [{\n key: \"size\",\n get: function get() {\n this.keysAtom_.reportObserved();\n return this.data_.size;\n }\n }, {\n key: Symbol.toStringTag,\n get: function get() {\n return \"Map\";\n }\n }]);\n}();\n// eslint-disable-next-line\nvar isObservableMap = /*#__PURE__*/createInstanceofPredicate(\"ObservableMap\", ObservableMap);\nfunction convertToMap(dataStructure) {\n if (isES6Map(dataStructure) || isObservableMap(dataStructure)) {\n return dataStructure;\n } else if (Array.isArray(dataStructure)) {\n return new Map(dataStructure);\n } else if (isPlainObject(dataStructure)) {\n var map = new Map();\n for (var key in dataStructure) {\n map.set(key, dataStructure[key]);\n }\n return map;\n } else {\n return die(21, dataStructure);\n }\n}\n\nvar ObservableSetMarker = {};\nvar ObservableSet = /*#__PURE__*/function () {\n function ObservableSet(initialData, enhancer, name_) {\n var _this = this;\n if (enhancer === void 0) {\n enhancer = deepEnhancer;\n }\n if (name_ === void 0) {\n name_ = true ? \"ObservableSet@\" + getNextId() : 0;\n }\n this.name_ = void 0;\n this[$mobx] = ObservableSetMarker;\n this.data_ = new Set();\n this.atom_ = void 0;\n this.changeListeners_ = void 0;\n this.interceptors_ = void 0;\n this.dehancer = void 0;\n this.enhancer_ = void 0;\n this.name_ = name_;\n if (!isFunction(Set)) {\n die(22);\n }\n this.enhancer_ = function (newV, oldV) {\n return enhancer(newV, oldV, name_);\n };\n initObservable(function () {\n _this.atom_ = createAtom(_this.name_);\n if (initialData) {\n _this.replace(initialData);\n }\n });\n }\n var _proto = ObservableSet.prototype;\n _proto.dehanceValue_ = function dehanceValue_(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.clear = function clear() {\n var _this2 = this;\n transaction(function () {\n untracked(function () {\n for (var _iterator = _createForOfIteratorHelperLoose(_this2.data_.values()), _step; !(_step = _iterator()).done;) {\n var value = _step.value;\n _this2[\"delete\"](value);\n }\n });\n });\n };\n _proto.forEach = function forEach(callbackFn, thisArg) {\n for (var _iterator2 = _createForOfIteratorHelperLoose(this), _step2; !(_step2 = _iterator2()).done;) {\n var value = _step2.value;\n callbackFn.call(thisArg, value, value, this);\n }\n };\n _proto.add = function add(value) {\n var _this3 = this;\n checkIfStateModificationsAreAllowed(this.atom_);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: ADD,\n object: this,\n newValue: value\n });\n if (!change) {\n return this;\n }\n // ideally, value = change.value would be done here, so that values can be\n // changed by interceptor. Same applies for other Set and Map api's.\n }\n if (!this.has(value)) {\n transaction(function () {\n _this3.data_.add(_this3.enhancer_(value, undefined));\n _this3.atom_.reportChanged();\n });\n var notifySpy = true && isSpyEnabled();\n var notify = hasListeners(this);\n var _change = notify || notifySpy ? {\n observableKind: \"set\",\n debugObjectName: this.name_,\n type: ADD,\n object: this,\n newValue: value\n } : null;\n if (notifySpy && \"development\" !== \"production\") {\n spyReportStart(_change);\n }\n if (notify) {\n notifyListeners(this, _change);\n }\n if (notifySpy && \"development\" !== \"production\") {\n spyReportEnd();\n }\n }\n return this;\n };\n _proto[\"delete\"] = function _delete(value) {\n var _this4 = this;\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: DELETE,\n object: this,\n oldValue: value\n });\n if (!change) {\n return false;\n }\n }\n if (this.has(value)) {\n var notifySpy = true && isSpyEnabled();\n var notify = hasListeners(this);\n var _change2 = notify || notifySpy ? {\n observableKind: \"set\",\n debugObjectName: this.name_,\n type: DELETE,\n object: this,\n oldValue: value\n } : null;\n if (notifySpy && \"development\" !== \"production\") {\n spyReportStart(_change2);\n }\n transaction(function () {\n _this4.atom_.reportChanged();\n _this4.data_[\"delete\"](value);\n });\n if (notify) {\n notifyListeners(this, _change2);\n }\n if (notifySpy && \"development\" !== \"production\") {\n spyReportEnd();\n }\n return true;\n }\n return false;\n };\n _proto.has = function has(value) {\n this.atom_.reportObserved();\n return this.data_.has(this.dehanceValue_(value));\n };\n _proto.entries = function entries() {\n var nextIndex = 0;\n var keys = Array.from(this.keys());\n var values = Array.from(this.values());\n return makeIterable({\n next: function next() {\n var index = nextIndex;\n nextIndex += 1;\n return index < values.length ? {\n value: [keys[index], values[index]],\n done: false\n } : {\n done: true\n };\n }\n });\n };\n _proto.keys = function keys() {\n return this.values();\n };\n _proto.values = function values() {\n this.atom_.reportObserved();\n var self = this;\n var nextIndex = 0;\n var observableValues = Array.from(this.data_.values());\n return makeIterable({\n next: function next() {\n return nextIndex < observableValues.length ? {\n value: self.dehanceValue_(observableValues[nextIndex++]),\n done: false\n } : {\n done: true\n };\n }\n });\n };\n _proto.intersection = function intersection(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.intersection(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.intersection(otherSet);\n }\n };\n _proto.union = function union(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.union(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.union(otherSet);\n }\n };\n _proto.difference = function difference(otherSet) {\n return new Set(this).difference(otherSet);\n };\n _proto.symmetricDifference = function symmetricDifference(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.symmetricDifference(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.symmetricDifference(otherSet);\n }\n };\n _proto.isSubsetOf = function isSubsetOf(otherSet) {\n return new Set(this).isSubsetOf(otherSet);\n };\n _proto.isSupersetOf = function isSupersetOf(otherSet) {\n return new Set(this).isSupersetOf(otherSet);\n };\n _proto.isDisjointFrom = function isDisjointFrom(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.isDisjointFrom(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.isDisjointFrom(otherSet);\n }\n };\n _proto.replace = function replace(other) {\n var _this5 = this;\n if (isObservableSet(other)) {\n other = new Set(other);\n }\n transaction(function () {\n if (Array.isArray(other)) {\n _this5.clear();\n other.forEach(function (value) {\n return _this5.add(value);\n });\n } else if (isES6Set(other)) {\n _this5.clear();\n other.forEach(function (value) {\n return _this5.add(value);\n });\n } else if (other !== null && other !== undefined) {\n die(\"Cannot initialize set from \" + other);\n }\n });\n return this;\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n // ... 'fireImmediately' could also be true?\n if ( true && fireImmediately === true) {\n die(\"`observe` doesn't support fireImmediately=true in combination with sets.\");\n }\n return registerListener(this, listener);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.toJSON = function toJSON() {\n return Array.from(this);\n };\n _proto.toString = function toString() {\n return \"[object ObservableSet]\";\n };\n _proto[Symbol.iterator] = function () {\n return this.values();\n };\n return _createClass(ObservableSet, [{\n key: \"size\",\n get: function get() {\n this.atom_.reportObserved();\n return this.data_.size;\n }\n }, {\n key: Symbol.toStringTag,\n get: function get() {\n return \"Set\";\n }\n }]);\n}();\n// eslint-disable-next-line\nvar isObservableSet = /*#__PURE__*/createInstanceofPredicate(\"ObservableSet\", ObservableSet);\n\nvar descriptorCache = /*#__PURE__*/Object.create(null);\nvar REMOVE = \"remove\";\nvar ObservableObjectAdministration = /*#__PURE__*/function () {\n function ObservableObjectAdministration(target_, values_, name_,\n // Used anytime annotation is not explicitely provided\n defaultAnnotation_) {\n if (values_ === void 0) {\n values_ = new Map();\n }\n if (defaultAnnotation_ === void 0) {\n defaultAnnotation_ = autoAnnotation;\n }\n this.target_ = void 0;\n this.values_ = void 0;\n this.name_ = void 0;\n this.defaultAnnotation_ = void 0;\n this.keysAtom_ = void 0;\n this.changeListeners_ = void 0;\n this.interceptors_ = void 0;\n this.proxy_ = void 0;\n this.isPlainObject_ = void 0;\n this.appliedAnnotations_ = void 0;\n this.pendingKeys_ = void 0;\n this.target_ = target_;\n this.values_ = values_;\n this.name_ = name_;\n this.defaultAnnotation_ = defaultAnnotation_;\n this.keysAtom_ = new Atom( true ? this.name_ + \".keys\" : 0);\n // Optimization: we use this frequently\n this.isPlainObject_ = isPlainObject(this.target_);\n if ( true && !isAnnotation(this.defaultAnnotation_)) {\n die(\"defaultAnnotation must be valid annotation\");\n }\n if (true) {\n // Prepare structure for tracking which fields were already annotated\n this.appliedAnnotations_ = {};\n }\n }\n var _proto = ObservableObjectAdministration.prototype;\n _proto.getObservablePropValue_ = function getObservablePropValue_(key) {\n return this.values_.get(key).get();\n };\n _proto.setObservablePropValue_ = function setObservablePropValue_(key, newValue) {\n var observable = this.values_.get(key);\n if (observable instanceof ComputedValue) {\n observable.set(newValue);\n return true;\n }\n // intercept\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: UPDATE,\n object: this.proxy_ || this.target_,\n name: key,\n newValue: newValue\n });\n if (!change) {\n return null;\n }\n newValue = change.newValue;\n }\n newValue = observable.prepareNewValue_(newValue);\n // notify spy & observers\n if (newValue !== globalState.UNCHANGED) {\n var notify = hasListeners(this);\n var notifySpy = true && isSpyEnabled();\n var _change = notify || notifySpy ? {\n type: UPDATE,\n observableKind: \"object\",\n debugObjectName: this.name_,\n object: this.proxy_ || this.target_,\n oldValue: observable.value_,\n name: key,\n newValue: newValue\n } : null;\n if ( true && notifySpy) {\n spyReportStart(_change);\n }\n observable.setNewValue_(newValue);\n if (notify) {\n notifyListeners(this, _change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n return true;\n };\n _proto.get_ = function get_(key) {\n if (globalState.trackingDerivation && !hasProp(this.target_, key)) {\n // Key doesn't exist yet, subscribe for it in case it's added later\n this.has_(key);\n }\n return this.target_[key];\n }\n /**\n * @param {PropertyKey} key\n * @param {any} value\n * @param {Annotation|boolean} annotation true - use default annotation, false - copy as is\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.set_ = function set_(key, value, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n // Don't use .has(key) - we care about own\n if (hasProp(this.target_, key)) {\n // Existing prop\n if (this.values_.has(key)) {\n // Observable (can be intercepted)\n return this.setObservablePropValue_(key, value);\n } else if (proxyTrap) {\n // Non-observable - proxy\n return Reflect.set(this.target_, key, value);\n } else {\n // Non-observable\n this.target_[key] = value;\n return true;\n }\n } else {\n // New prop\n return this.extend_(key, {\n value: value,\n enumerable: true,\n writable: true,\n configurable: true\n }, this.defaultAnnotation_, proxyTrap);\n }\n }\n // Trap for \"in\"\n ;\n _proto.has_ = function has_(key) {\n if (!globalState.trackingDerivation) {\n // Skip key subscription outside derivation\n return key in this.target_;\n }\n this.pendingKeys_ || (this.pendingKeys_ = new Map());\n var entry = this.pendingKeys_.get(key);\n if (!entry) {\n entry = new ObservableValue(key in this.target_, referenceEnhancer, true ? this.name_ + \".\" + stringifyKey(key) + \"?\" : 0, false);\n this.pendingKeys_.set(key, entry);\n }\n return entry.get();\n }\n /**\n * @param {PropertyKey} key\n * @param {Annotation|boolean} annotation true - use default annotation, false - ignore prop\n */;\n _proto.make_ = function make_(key, annotation) {\n if (annotation === true) {\n annotation = this.defaultAnnotation_;\n }\n if (annotation === false) {\n return;\n }\n assertAnnotable(this, annotation, key);\n if (!(key in this.target_)) {\n var _this$target_$storedA;\n // Throw on missing key, except for decorators:\n // Decorator annotations are collected from whole prototype chain.\n // When called from super() some props may not exist yet.\n // However we don't have to worry about missing prop,\n // because the decorator must have been applied to something.\n if ((_this$target_$storedA = this.target_[storedAnnotationsSymbol]) != null && _this$target_$storedA[key]) {\n return; // will be annotated by subclass constructor\n } else {\n die(1, annotation.annotationType_, this.name_ + \".\" + key.toString());\n }\n }\n var source = this.target_;\n while (source && source !== objectPrototype) {\n var descriptor = getDescriptor(source, key);\n if (descriptor) {\n var outcome = annotation.make_(this, key, descriptor, source);\n if (outcome === 0 /* MakeResult.Cancel */) {\n return;\n }\n if (outcome === 1 /* MakeResult.Break */) {\n break;\n }\n }\n source = Object.getPrototypeOf(source);\n }\n recordAnnotationApplied(this, annotation, key);\n }\n /**\n * @param {PropertyKey} key\n * @param {PropertyDescriptor} descriptor\n * @param {Annotation|boolean} annotation true - use default annotation, false - copy as is\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.extend_ = function extend_(key, descriptor, annotation, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n if (annotation === true) {\n annotation = this.defaultAnnotation_;\n }\n if (annotation === false) {\n return this.defineProperty_(key, descriptor, proxyTrap);\n }\n assertAnnotable(this, annotation, key);\n var outcome = annotation.extend_(this, key, descriptor, proxyTrap);\n if (outcome) {\n recordAnnotationApplied(this, annotation, key);\n }\n return outcome;\n }\n /**\n * @param {PropertyKey} key\n * @param {PropertyDescriptor} descriptor\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.defineProperty_ = function defineProperty_(key, descriptor, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n try {\n startBatch();\n // Delete\n var deleteOutcome = this.delete_(key);\n if (!deleteOutcome) {\n // Failure or intercepted\n return deleteOutcome;\n }\n // ADD interceptor\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: ADD,\n newValue: descriptor.value\n });\n if (!change) {\n return null;\n }\n var newValue = change.newValue;\n if (descriptor.value !== newValue) {\n descriptor = _extends({}, descriptor, {\n value: newValue\n });\n }\n }\n // Define\n if (proxyTrap) {\n if (!Reflect.defineProperty(this.target_, key, descriptor)) {\n return false;\n }\n } else {\n defineProperty(this.target_, key, descriptor);\n }\n // Notify\n this.notifyPropertyAddition_(key, descriptor.value);\n } finally {\n endBatch();\n }\n return true;\n }\n // If original descriptor becomes relevant, move this to annotation directly\n ;\n _proto.defineObservableProperty_ = function defineObservableProperty_(key, value, enhancer, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n try {\n startBatch();\n // Delete\n var deleteOutcome = this.delete_(key);\n if (!deleteOutcome) {\n // Failure or intercepted\n return deleteOutcome;\n }\n // ADD interceptor\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: ADD,\n newValue: value\n });\n if (!change) {\n return null;\n }\n value = change.newValue;\n }\n var cachedDescriptor = getCachedObservablePropDescriptor(key);\n var descriptor = {\n configurable: globalState.safeDescriptors ? this.isPlainObject_ : true,\n enumerable: true,\n get: cachedDescriptor.get,\n set: cachedDescriptor.set\n };\n // Define\n if (proxyTrap) {\n if (!Reflect.defineProperty(this.target_, key, descriptor)) {\n return false;\n }\n } else {\n defineProperty(this.target_, key, descriptor);\n }\n var observable = new ObservableValue(value, enhancer, true ? this.name_ + \".\" + key.toString() : 0, false);\n this.values_.set(key, observable);\n // Notify (value possibly changed by ObservableValue)\n this.notifyPropertyAddition_(key, observable.value_);\n } finally {\n endBatch();\n }\n return true;\n }\n // If original descriptor becomes relevant, move this to annotation directly\n ;\n _proto.defineComputedProperty_ = function defineComputedProperty_(key, options, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n try {\n startBatch();\n // Delete\n var deleteOutcome = this.delete_(key);\n if (!deleteOutcome) {\n // Failure or intercepted\n return deleteOutcome;\n }\n // ADD interceptor\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: ADD,\n newValue: undefined\n });\n if (!change) {\n return null;\n }\n }\n options.name || (options.name = true ? this.name_ + \".\" + key.toString() : 0);\n options.context = this.proxy_ || this.target_;\n var cachedDescriptor = getCachedObservablePropDescriptor(key);\n var descriptor = {\n configurable: globalState.safeDescriptors ? this.isPlainObject_ : true,\n enumerable: false,\n get: cachedDescriptor.get,\n set: cachedDescriptor.set\n };\n // Define\n if (proxyTrap) {\n if (!Reflect.defineProperty(this.target_, key, descriptor)) {\n return false;\n }\n } else {\n defineProperty(this.target_, key, descriptor);\n }\n this.values_.set(key, new ComputedValue(options));\n // Notify\n this.notifyPropertyAddition_(key, undefined);\n } finally {\n endBatch();\n }\n return true;\n }\n /**\n * @param {PropertyKey} key\n * @param {PropertyDescriptor} descriptor\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.delete_ = function delete_(key, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n // No such prop\n if (!hasProp(this.target_, key)) {\n return true;\n }\n // Intercept\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: REMOVE\n });\n // Cancelled\n if (!change) {\n return null;\n }\n }\n // Delete\n try {\n var _this$pendingKeys_;\n startBatch();\n var notify = hasListeners(this);\n var notifySpy = true && isSpyEnabled();\n var observable = this.values_.get(key);\n // Value needed for spies/listeners\n var value = undefined;\n // Optimization: don't pull the value unless we will need it\n if (!observable && (notify || notifySpy)) {\n var _getDescriptor;\n value = (_getDescriptor = getDescriptor(this.target_, key)) == null ? void 0 : _getDescriptor.value;\n }\n // delete prop (do first, may fail)\n if (proxyTrap) {\n if (!Reflect.deleteProperty(this.target_, key)) {\n return false;\n }\n } else {\n delete this.target_[key];\n }\n // Allow re-annotating this field\n if (true) {\n delete this.appliedAnnotations_[key];\n }\n // Clear observable\n if (observable) {\n this.values_[\"delete\"](key);\n // for computed, value is undefined\n if (observable instanceof ObservableValue) {\n value = observable.value_;\n }\n // Notify: autorun(() => obj[key]), see #1796\n propagateChanged(observable);\n }\n // Notify \"keys/entries/values\" observers\n this.keysAtom_.reportChanged();\n // Notify \"has\" observers\n // \"in\" as it may still exist in proto\n (_this$pendingKeys_ = this.pendingKeys_) == null || (_this$pendingKeys_ = _this$pendingKeys_.get(key)) == null || _this$pendingKeys_.set(key in this.target_);\n // Notify spies/listeners\n if (notify || notifySpy) {\n var _change2 = {\n type: REMOVE,\n observableKind: \"object\",\n object: this.proxy_ || this.target_,\n debugObjectName: this.name_,\n oldValue: value,\n name: key\n };\n if ( true && notifySpy) {\n spyReportStart(_change2);\n }\n if (notify) {\n notifyListeners(this, _change2);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n } finally {\n endBatch();\n }\n return true;\n }\n /**\n * Observes this object. Triggers for the events 'add', 'update' and 'delete'.\n * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe\n * for callback details\n */;\n _proto.observe_ = function observe_(callback, fireImmediately) {\n if ( true && fireImmediately === true) {\n die(\"`observe` doesn't support the fire immediately property for observable objects.\");\n }\n return registerListener(this, callback);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.notifyPropertyAddition_ = function notifyPropertyAddition_(key, value) {\n var _this$pendingKeys_2;\n var notify = hasListeners(this);\n var notifySpy = true && isSpyEnabled();\n if (notify || notifySpy) {\n var change = notify || notifySpy ? {\n type: ADD,\n observableKind: \"object\",\n debugObjectName: this.name_,\n object: this.proxy_ || this.target_,\n name: key,\n newValue: value\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n }\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n (_this$pendingKeys_2 = this.pendingKeys_) == null || (_this$pendingKeys_2 = _this$pendingKeys_2.get(key)) == null || _this$pendingKeys_2.set(true);\n // Notify \"keys/entries/values\" observers\n this.keysAtom_.reportChanged();\n };\n _proto.ownKeys_ = function ownKeys_() {\n this.keysAtom_.reportObserved();\n return ownKeys(this.target_);\n };\n _proto.keys_ = function keys_() {\n // Returns enumerable && own, but unfortunately keysAtom will report on ANY key change.\n // There is no way to distinguish between Object.keys(object) and Reflect.ownKeys(object) - both are handled by ownKeys trap.\n // We can either over-report in Object.keys(object) or under-report in Reflect.ownKeys(object)\n // We choose to over-report in Object.keys(object), because:\n // - typically it's used with simple data objects\n // - when symbolic/non-enumerable keys are relevant Reflect.ownKeys works as expected\n this.keysAtom_.reportObserved();\n return Object.keys(this.target_);\n };\n return ObservableObjectAdministration;\n}();\nfunction asObservableObject(target, options) {\n var _options$name;\n if ( true && options && isObservableObject(target)) {\n die(\"Options can't be provided for already observable objects.\");\n }\n if (hasProp(target, $mobx)) {\n if ( true && !(getAdministration(target) instanceof ObservableObjectAdministration)) {\n die(\"Cannot convert '\" + getDebugName(target) + \"' into observable object:\" + \"\\nThe target is already observable of different type.\" + \"\\nExtending builtins is not supported.\");\n }\n return target;\n }\n if ( true && !Object.isExtensible(target)) {\n die(\"Cannot make the designated object observable; it is not extensible\");\n }\n var name = (_options$name = options == null ? void 0 : options.name) != null ? _options$name : true ? (isPlainObject(target) ? \"ObservableObject\" : target.constructor.name) + \"@\" + getNextId() : 0;\n var adm = new ObservableObjectAdministration(target, new Map(), String(name), getAnnotationFromOptions(options));\n addHiddenProp(target, $mobx, adm);\n return target;\n}\nvar isObservableObjectAdministration = /*#__PURE__*/createInstanceofPredicate(\"ObservableObjectAdministration\", ObservableObjectAdministration);\nfunction getCachedObservablePropDescriptor(key) {\n return descriptorCache[key] || (descriptorCache[key] = {\n get: function get() {\n return this[$mobx].getObservablePropValue_(key);\n },\n set: function set(value) {\n return this[$mobx].setObservablePropValue_(key, value);\n }\n });\n}\nfunction isObservableObject(thing) {\n if (isObject(thing)) {\n return isObservableObjectAdministration(thing[$mobx]);\n }\n return false;\n}\nfunction recordAnnotationApplied(adm, annotation, key) {\n var _adm$target_$storedAn;\n if (true) {\n adm.appliedAnnotations_[key] = annotation;\n }\n // Remove applied decorator annotation so we don't try to apply it again in subclass constructor\n (_adm$target_$storedAn = adm.target_[storedAnnotationsSymbol]) == null || delete _adm$target_$storedAn[key];\n}\nfunction assertAnnotable(adm, annotation, key) {\n // Valid annotation\n if ( true && !isAnnotation(annotation)) {\n die(\"Cannot annotate '\" + adm.name_ + \".\" + key.toString() + \"': Invalid annotation.\");\n }\n /*\n // Configurable, not sealed, not frozen\n // Possibly not needed, just a little better error then the one thrown by engine.\n // Cases where this would be useful the most (subclass field initializer) are not interceptable by this.\n if (__DEV__) {\n const configurable = getDescriptor(adm.target_, key)?.configurable\n const frozen = Object.isFrozen(adm.target_)\n const sealed = Object.isSealed(adm.target_)\n if (!configurable || frozen || sealed) {\n const fieldName = `${adm.name_}.${key.toString()}`\n const requestedAnnotationType = annotation.annotationType_\n let error = `Cannot apply '${requestedAnnotationType}' to '${fieldName}':`\n if (frozen) {\n error += `\\nObject is frozen.`\n }\n if (sealed) {\n error += `\\nObject is sealed.`\n }\n if (!configurable) {\n error += `\\nproperty is not configurable.`\n // Mention only if caused by us to avoid confusion\n if (hasProp(adm.appliedAnnotations!, key)) {\n error += `\\nTo prevent accidental re-definition of a field by a subclass, `\n error += `all annotated fields of non-plain objects (classes) are not configurable.`\n }\n }\n die(error)\n }\n }\n */\n // Not annotated\n if ( true && !isOverride(annotation) && hasProp(adm.appliedAnnotations_, key)) {\n var fieldName = adm.name_ + \".\" + key.toString();\n var currentAnnotationType = adm.appliedAnnotations_[key].annotationType_;\n var requestedAnnotationType = annotation.annotationType_;\n die(\"Cannot apply '\" + requestedAnnotationType + \"' to '\" + fieldName + \"':\" + (\"\\nThe field is already annotated with '\" + currentAnnotationType + \"'.\") + \"\\nRe-annotating fields is not allowed.\" + \"\\nUse 'override' annotation for methods overridden by subclass.\");\n }\n}\n\n// Bug in safari 9.* (or iOS 9 safari mobile). See #364\nvar ENTRY_0 = /*#__PURE__*/createArrayEntryDescriptor(0);\nvar safariPrototypeSetterInheritanceBug = /*#__PURE__*/function () {\n var v = false;\n var p = {};\n Object.defineProperty(p, \"0\", {\n set: function set() {\n v = true;\n }\n });\n /*#__PURE__*/Object.create(p)[\"0\"] = 1;\n return v === false;\n}();\n/**\n * This array buffer contains two lists of properties, so that all arrays\n * can recycle their property definitions, which significantly improves performance of creating\n * properties on the fly.\n */\nvar OBSERVABLE_ARRAY_BUFFER_SIZE = 0;\n// Typescript workaround to make sure ObservableArray extends Array\nvar StubArray = function StubArray() {};\nfunction inherit(ctor, proto) {\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(ctor.prototype, proto);\n } else if (ctor.prototype.__proto__ !== undefined) {\n ctor.prototype.__proto__ = proto;\n } else {\n ctor.prototype = proto;\n }\n}\ninherit(StubArray, Array.prototype);\n// Weex proto freeze protection was here,\n// but it is unclear why the hack is need as MobX never changed the prototype\n// anyway, so removed it in V6\nvar LegacyObservableArray = /*#__PURE__*/function (_StubArray) {\n function LegacyObservableArray(initialValues, enhancer, name, owned) {\n var _this;\n if (name === void 0) {\n name = true ? \"ObservableArray@\" + getNextId() : 0;\n }\n if (owned === void 0) {\n owned = false;\n }\n _this = _StubArray.call(this) || this;\n initObservable(function () {\n var adm = new ObservableArrayAdministration(name, enhancer, owned, true);\n adm.proxy_ = _this;\n addHiddenFinalProp(_this, $mobx, adm);\n if (initialValues && initialValues.length) {\n // @ts-ignore\n _this.spliceWithArray(0, 0, initialValues);\n }\n if (safariPrototypeSetterInheritanceBug) {\n // Seems that Safari won't use numeric prototype setter until any * numeric property is\n // defined on the instance. After that it works fine, even if this property is deleted.\n Object.defineProperty(_this, \"0\", ENTRY_0);\n }\n });\n return _this;\n }\n _inheritsLoose(LegacyObservableArray, _StubArray);\n var _proto = LegacyObservableArray.prototype;\n _proto.concat = function concat() {\n this[$mobx].atom_.reportObserved();\n for (var _len = arguments.length, arrays = new Array(_len), _key = 0; _key < _len; _key++) {\n arrays[_key] = arguments[_key];\n }\n return Array.prototype.concat.apply(this.slice(),\n //@ts-ignore\n arrays.map(function (a) {\n return isObservableArray(a) ? a.slice() : a;\n }));\n };\n _proto[Symbol.iterator] = function () {\n var self = this;\n var nextIndex = 0;\n return makeIterable({\n next: function next() {\n return nextIndex < self.length ? {\n value: self[nextIndex++],\n done: false\n } : {\n done: true,\n value: undefined\n };\n }\n });\n };\n return _createClass(LegacyObservableArray, [{\n key: \"length\",\n get: function get() {\n return this[$mobx].getArrayLength_();\n },\n set: function set(newLength) {\n this[$mobx].setArrayLength_(newLength);\n }\n }, {\n key: Symbol.toStringTag,\n get: function get() {\n return \"Array\";\n }\n }]);\n}(StubArray);\nObject.entries(arrayExtensions).forEach(function (_ref) {\n var prop = _ref[0],\n fn = _ref[1];\n if (prop !== \"concat\") {\n addHiddenProp(LegacyObservableArray.prototype, prop, fn);\n }\n});\nfunction createArrayEntryDescriptor(index) {\n return {\n enumerable: false,\n configurable: true,\n get: function get() {\n return this[$mobx].get_(index);\n },\n set: function set(value) {\n this[$mobx].set_(index, value);\n }\n };\n}\nfunction createArrayBufferItem(index) {\n defineProperty(LegacyObservableArray.prototype, \"\" + index, createArrayEntryDescriptor(index));\n}\nfunction reserveArrayBuffer(max) {\n if (max > OBSERVABLE_ARRAY_BUFFER_SIZE) {\n for (var index = OBSERVABLE_ARRAY_BUFFER_SIZE; index < max + 100; index++) {\n createArrayBufferItem(index);\n }\n OBSERVABLE_ARRAY_BUFFER_SIZE = max;\n }\n}\nreserveArrayBuffer(1000);\nfunction createLegacyArray(initialValues, enhancer, name) {\n return new LegacyObservableArray(initialValues, enhancer, name);\n}\n\nfunction getAtom(thing, property) {\n if (typeof thing === \"object\" && thing !== null) {\n if (isObservableArray(thing)) {\n if (property !== undefined) {\n die(23);\n }\n return thing[$mobx].atom_;\n }\n if (isObservableSet(thing)) {\n return thing.atom_;\n }\n if (isObservableMap(thing)) {\n if (property === undefined) {\n return thing.keysAtom_;\n }\n var observable = thing.data_.get(property) || thing.hasMap_.get(property);\n if (!observable) {\n die(25, property, getDebugName(thing));\n }\n return observable;\n }\n if (isObservableObject(thing)) {\n if (!property) {\n return die(26);\n }\n var _observable = thing[$mobx].values_.get(property);\n if (!_observable) {\n die(27, property, getDebugName(thing));\n }\n return _observable;\n }\n if (isAtom(thing) || isComputedValue(thing) || isReaction(thing)) {\n return thing;\n }\n } else if (isFunction(thing)) {\n if (isReaction(thing[$mobx])) {\n // disposer function\n return thing[$mobx];\n }\n }\n die(28);\n}\nfunction getAdministration(thing, property) {\n if (!thing) {\n die(29);\n }\n if (property !== undefined) {\n return getAdministration(getAtom(thing, property));\n }\n if (isAtom(thing) || isComputedValue(thing) || isReaction(thing)) {\n return thing;\n }\n if (isObservableMap(thing) || isObservableSet(thing)) {\n return thing;\n }\n if (thing[$mobx]) {\n return thing[$mobx];\n }\n die(24, thing);\n}\nfunction getDebugName(thing, property) {\n var named;\n if (property !== undefined) {\n named = getAtom(thing, property);\n } else if (isAction(thing)) {\n return thing.name;\n } else if (isObservableObject(thing) || isObservableMap(thing) || isObservableSet(thing)) {\n named = getAdministration(thing);\n } else {\n // valid for arrays as well\n named = getAtom(thing);\n }\n return named.name_;\n}\n/**\n * Helper function for initializing observable structures, it applies:\n * 1. allowStateChanges so we don't violate enforceActions.\n * 2. untracked so we don't accidentaly subscribe to anything observable accessed during init in case the observable is created inside derivation.\n * 3. batch to avoid state version updates\n */\nfunction initObservable(cb) {\n var derivation = untrackedStart();\n var allowStateChanges = allowStateChangesStart(true);\n startBatch();\n try {\n return cb();\n } finally {\n endBatch();\n allowStateChangesEnd(allowStateChanges);\n untrackedEnd(derivation);\n }\n}\n\nvar toString = objectPrototype.toString;\nfunction deepEqual(a, b, depth) {\n if (depth === void 0) {\n depth = -1;\n }\n return eq(a, b, depth);\n}\n// Copied from https://github.com/jashkenas/underscore/blob/5c237a7c682fb68fd5378203f0bf22dce1624854/underscore.js#L1186-L1289\n// Internal recursive comparison function for `isEqual`.\nfunction eq(a, b, depth, aStack, bStack) {\n // Identical objects are equal. `0 === -0`, but they aren't identical.\n // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).\n if (a === b) {\n return a !== 0 || 1 / a === 1 / b;\n }\n // `null` or `undefined` only equal to itself (strict comparison).\n if (a == null || b == null) {\n return false;\n }\n // `NaN`s are equivalent, but non-reflexive.\n if (a !== a) {\n return b !== b;\n }\n // Exhaust primitive checks\n var type = typeof a;\n if (type !== \"function\" && type !== \"object\" && typeof b != \"object\") {\n return false;\n }\n // Compare `[[Class]]` names.\n var className = toString.call(a);\n if (className !== toString.call(b)) {\n return false;\n }\n switch (className) {\n // Strings, numbers, regular expressions, dates, and booleans are compared by value.\n case \"[object RegExp]\":\n // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i')\n case \"[object String]\":\n // Primitives and their corresponding object wrappers are equivalent; thus, `\"5\"` is\n // equivalent to `new String(\"5\")`.\n return \"\" + a === \"\" + b;\n case \"[object Number]\":\n // `NaN`s are equivalent, but non-reflexive.\n // Object(NaN) is equivalent to NaN.\n if (+a !== +a) {\n return +b !== +b;\n }\n // An `egal` comparison is performed for other numeric values.\n return +a === 0 ? 1 / +a === 1 / b : +a === +b;\n case \"[object Date]\":\n case \"[object Boolean]\":\n // Coerce dates and booleans to numeric primitive values. Dates are compared by their\n // millisecond representations. Note that invalid dates with millisecond representations\n // of `NaN` are not equivalent.\n return +a === +b;\n case \"[object Symbol]\":\n return typeof Symbol !== \"undefined\" && Symbol.valueOf.call(a) === Symbol.valueOf.call(b);\n case \"[object Map]\":\n case \"[object Set]\":\n // Maps and Sets are unwrapped to arrays of entry-pairs, adding an incidental level.\n // Hide this extra level by increasing the depth.\n if (depth >= 0) {\n depth++;\n }\n break;\n }\n // Unwrap any wrapped objects.\n a = unwrap(a);\n b = unwrap(b);\n var areArrays = className === \"[object Array]\";\n if (!areArrays) {\n if (typeof a != \"object\" || typeof b != \"object\") {\n return false;\n }\n // Objects with different constructors are not equivalent, but `Object`s or `Array`s\n // from different frames are.\n var aCtor = a.constructor,\n bCtor = b.constructor;\n if (aCtor !== bCtor && !(isFunction(aCtor) && aCtor instanceof aCtor && isFunction(bCtor) && bCtor instanceof bCtor) && \"constructor\" in a && \"constructor\" in b) {\n return false;\n }\n }\n if (depth === 0) {\n return false;\n } else if (depth < 0) {\n depth = -1;\n }\n // Assume equality for cyclic structures. The algorithm for detecting cyclic\n // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.\n // Initializing stack of traversed objects.\n // It's done here since we only need them for objects and arrays comparison.\n aStack = aStack || [];\n bStack = bStack || [];\n var length = aStack.length;\n while (length--) {\n // Linear search. Performance is inversely proportional to the number of\n // unique nested structures.\n if (aStack[length] === a) {\n return bStack[length] === b;\n }\n }\n // Add the first object to the stack of traversed objects.\n aStack.push(a);\n bStack.push(b);\n // Recursively compare objects and arrays.\n if (areArrays) {\n // Compare array lengths to determine if a deep comparison is necessary.\n length = a.length;\n if (length !== b.length) {\n return false;\n }\n // Deep compare the contents, ignoring non-numeric properties.\n while (length--) {\n if (!eq(a[length], b[length], depth - 1, aStack, bStack)) {\n return false;\n }\n }\n } else {\n // Deep compare objects.\n var keys = Object.keys(a);\n var key;\n length = keys.length;\n // Ensure that both objects contain the same number of properties before comparing deep equality.\n if (Object.keys(b).length !== length) {\n return false;\n }\n while (length--) {\n // Deep compare each member\n key = keys[length];\n if (!(hasProp(b, key) && eq(a[key], b[key], depth - 1, aStack, bStack))) {\n return false;\n }\n }\n }\n // Remove the first object from the stack of traversed objects.\n aStack.pop();\n bStack.pop();\n return true;\n}\nfunction unwrap(a) {\n if (isObservableArray(a)) {\n return a.slice();\n }\n if (isES6Map(a) || isObservableMap(a)) {\n return Array.from(a.entries());\n }\n if (isES6Set(a) || isObservableSet(a)) {\n return Array.from(a.entries());\n }\n return a;\n}\n\nfunction makeIterable(iterator) {\n iterator[Symbol.iterator] = getSelf;\n return iterator;\n}\nfunction getSelf() {\n return this;\n}\n\nfunction isAnnotation(thing) {\n return (\n // Can be function\n thing instanceof Object && typeof thing.annotationType_ === \"string\" && isFunction(thing.make_) && isFunction(thing.extend_)\n );\n}\n\n/**\n * (c) Michel Weststrate 2015 - 2020\n * MIT Licensed\n *\n * Welcome to the mobx sources! To get a global overview of how MobX internally works,\n * this is a good place to start:\n * https://medium.com/@mweststrate/becoming-fully-reactive-an-in-depth-explanation-of-mobservable-55995262a254#.xvbh6qd74\n *\n * Source folders:\n * ===============\n *\n * - api/ Most of the public static methods exposed by the module can be found here.\n * - core/ Implementation of the MobX algorithm; atoms, derivations, reactions, dependency trees, optimizations. Cool stuff can be found here.\n * - types/ All the magic that is need to have observable objects, arrays and values is in this folder. Including the modifiers like `asFlat`.\n * - utils/ Utility stuff.\n *\n */\n[\"Symbol\", \"Map\", \"Set\"].forEach(function (m) {\n var g = getGlobal();\n if (typeof g[m] === \"undefined\") {\n die(\"MobX requires global '\" + m + \"' to be available or polyfilled\");\n }\n});\nif (typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__ === \"object\") {\n // See: https://github.com/andykog/mobx-devtools/\n __MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({\n spy: spy,\n extras: {\n getDebugName: getDebugName\n },\n $mobx: $mobx\n });\n}\n\n\n//# sourceMappingURL=mobx.esm.js.map\n\n\n//# sourceURL=webpack://app_adyen_SFRA/./node_modules/mobx/dist/mobx.esm.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ $mobx: () => (/* binding */ $mobx),\n/* harmony export */ FlowCancellationError: () => (/* binding */ FlowCancellationError),\n/* harmony export */ ObservableMap: () => (/* binding */ ObservableMap),\n/* harmony export */ ObservableSet: () => (/* binding */ ObservableSet),\n/* harmony export */ Reaction: () => (/* binding */ Reaction),\n/* harmony export */ _allowStateChanges: () => (/* binding */ allowStateChanges),\n/* harmony export */ _allowStateChangesInsideComputed: () => (/* binding */ runInAction),\n/* harmony export */ _allowStateReadsEnd: () => (/* binding */ allowStateReadsEnd),\n/* harmony export */ _allowStateReadsStart: () => (/* binding */ allowStateReadsStart),\n/* harmony export */ _autoAction: () => (/* binding */ autoAction),\n/* harmony export */ _endAction: () => (/* binding */ _endAction),\n/* harmony export */ _getAdministration: () => (/* binding */ getAdministration),\n/* harmony export */ _getGlobalState: () => (/* binding */ getGlobalState),\n/* harmony export */ _interceptReads: () => (/* binding */ interceptReads),\n/* harmony export */ _isComputingDerivation: () => (/* binding */ isComputingDerivation),\n/* harmony export */ _resetGlobalState: () => (/* binding */ resetGlobalState),\n/* harmony export */ _startAction: () => (/* binding */ _startAction),\n/* harmony export */ action: () => (/* binding */ action),\n/* harmony export */ autorun: () => (/* binding */ autorun),\n/* harmony export */ comparer: () => (/* binding */ comparer),\n/* harmony export */ computed: () => (/* binding */ computed),\n/* harmony export */ configure: () => (/* binding */ configure),\n/* harmony export */ createAtom: () => (/* binding */ createAtom),\n/* harmony export */ defineProperty: () => (/* binding */ apiDefineProperty),\n/* harmony export */ entries: () => (/* binding */ entries),\n/* harmony export */ extendObservable: () => (/* binding */ extendObservable),\n/* harmony export */ flow: () => (/* binding */ flow),\n/* harmony export */ flowResult: () => (/* binding */ flowResult),\n/* harmony export */ get: () => (/* binding */ get),\n/* harmony export */ getAtom: () => (/* binding */ getAtom),\n/* harmony export */ getDebugName: () => (/* binding */ getDebugName),\n/* harmony export */ getDependencyTree: () => (/* binding */ getDependencyTree),\n/* harmony export */ getObserverTree: () => (/* binding */ getObserverTree),\n/* harmony export */ has: () => (/* binding */ has),\n/* harmony export */ intercept: () => (/* binding */ intercept),\n/* harmony export */ isAction: () => (/* binding */ isAction),\n/* harmony export */ isBoxedObservable: () => (/* binding */ isObservableValue),\n/* harmony export */ isComputed: () => (/* binding */ isComputed),\n/* harmony export */ isComputedProp: () => (/* binding */ isComputedProp),\n/* harmony export */ isFlow: () => (/* binding */ isFlow),\n/* harmony export */ isFlowCancellationError: () => (/* binding */ isFlowCancellationError),\n/* harmony export */ isObservable: () => (/* binding */ isObservable),\n/* harmony export */ isObservableArray: () => (/* binding */ isObservableArray),\n/* harmony export */ isObservableMap: () => (/* binding */ isObservableMap),\n/* harmony export */ isObservableObject: () => (/* binding */ isObservableObject),\n/* harmony export */ isObservableProp: () => (/* binding */ isObservableProp),\n/* harmony export */ isObservableSet: () => (/* binding */ isObservableSet),\n/* harmony export */ keys: () => (/* binding */ keys),\n/* harmony export */ makeAutoObservable: () => (/* binding */ makeAutoObservable),\n/* harmony export */ makeObservable: () => (/* binding */ makeObservable),\n/* harmony export */ observable: () => (/* binding */ observable),\n/* harmony export */ observe: () => (/* binding */ observe),\n/* harmony export */ onBecomeObserved: () => (/* binding */ onBecomeObserved),\n/* harmony export */ onBecomeUnobserved: () => (/* binding */ onBecomeUnobserved),\n/* harmony export */ onReactionError: () => (/* binding */ onReactionError),\n/* harmony export */ override: () => (/* binding */ override),\n/* harmony export */ ownKeys: () => (/* binding */ apiOwnKeys),\n/* harmony export */ reaction: () => (/* binding */ reaction),\n/* harmony export */ remove: () => (/* binding */ remove),\n/* harmony export */ runInAction: () => (/* binding */ runInAction),\n/* harmony export */ set: () => (/* binding */ set),\n/* harmony export */ spy: () => (/* binding */ spy),\n/* harmony export */ toJS: () => (/* binding */ toJS),\n/* harmony export */ trace: () => (/* binding */ trace),\n/* harmony export */ transaction: () => (/* binding */ transaction),\n/* harmony export */ untracked: () => (/* binding */ untracked),\n/* harmony export */ values: () => (/* binding */ values),\n/* harmony export */ when: () => (/* binding */ when)\n/* harmony export */ });\nvar niceErrors = {\n 0: \"Invalid value for configuration 'enforceActions', expected 'never', 'always' or 'observed'\",\n 1: function _(annotationType, key) {\n return \"Cannot apply '\" + annotationType + \"' to '\" + key.toString() + \"': Field not found.\";\n },\n /*\n 2(prop) {\n return `invalid decorator for '${prop.toString()}'`\n },\n 3(prop) {\n return `Cannot decorate '${prop.toString()}': action can only be used on properties with a function value.`\n },\n 4(prop) {\n return `Cannot decorate '${prop.toString()}': computed can only be used on getter properties.`\n },\n */\n 5: \"'keys()' can only be used on observable objects, arrays, sets and maps\",\n 6: \"'values()' can only be used on observable objects, arrays, sets and maps\",\n 7: \"'entries()' can only be used on observable objects, arrays and maps\",\n 8: \"'set()' can only be used on observable objects, arrays and maps\",\n 9: \"'remove()' can only be used on observable objects, arrays and maps\",\n 10: \"'has()' can only be used on observable objects, arrays and maps\",\n 11: \"'get()' can only be used on observable objects, arrays and maps\",\n 12: \"Invalid annotation\",\n 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)\",\n 14: \"Intercept handlers should return nothing or a change object\",\n 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)\",\n 16: \"Modification exception: the internal structure of an observable array was changed.\",\n 17: function _(index, length) {\n return \"[mobx.array] Index out of bounds, \" + index + \" is larger than \" + length;\n },\n 18: \"mobx.map requires Map polyfill for the current browser. Check babel-polyfill or core-js/es6/map.js\",\n 19: function _(other) {\n return \"Cannot initialize from classes that inherit from Map: \" + other.constructor.name;\n },\n 20: function _(other) {\n return \"Cannot initialize map from \" + other;\n },\n 21: function _(dataStructure) {\n return \"Cannot convert to map from '\" + dataStructure + \"'\";\n },\n 22: \"mobx.set requires Set polyfill for the current browser. Check babel-polyfill or core-js/es6/set.js\",\n 23: \"It is not possible to get index atoms from arrays\",\n 24: function _(thing) {\n return \"Cannot obtain administration from \" + thing;\n },\n 25: function _(property, name) {\n return \"the entry '\" + property + \"' does not exist in the observable map '\" + name + \"'\";\n },\n 26: \"please specify a property\",\n 27: function _(property, name) {\n return \"no observable property '\" + property.toString() + \"' found on the observable object '\" + name + \"'\";\n },\n 28: function _(thing) {\n return \"Cannot obtain atom from \" + thing;\n },\n 29: \"Expecting some object\",\n 30: \"invalid action stack. did you forget to finish an action?\",\n 31: \"missing option for computed: get\",\n 32: function _(name, derivation) {\n return \"Cycle detected in computation \" + name + \": \" + derivation;\n },\n 33: function _(name) {\n return \"The setter of computed value '\" + name + \"' is trying to update itself. Did you intend to update an _observable_ value, instead of the computed property?\";\n },\n 34: function _(name) {\n return \"[ComputedValue '\" + name + \"'] It is not possible to assign a new value to a computed value.\";\n },\n 35: \"There are multiple, different versions of MobX active. Make sure MobX is loaded only once or use `configure({ isolateGlobalState: true })`\",\n 36: \"isolateGlobalState should be called before MobX is running any reactions\",\n 37: function _(method) {\n return \"[mobx] `observableArray.\" + method + \"()` mutates the array in-place, which is not allowed inside a derivation. Use `array.slice().\" + method + \"()` instead\";\n },\n 38: \"'ownKeys()' can only be used on observable objects\",\n 39: \"'defineProperty()' can only be used on observable objects\"\n};\nvar errors = true ? niceErrors : 0;\nfunction die(error) {\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n if (true) {\n var e = typeof error === \"string\" ? error : errors[error];\n if (typeof e === \"function\") e = e.apply(null, args);\n throw new Error(\"[MobX] \" + e);\n }\n throw new Error(typeof error === \"number\" ? \"[MobX] minified error nr: \" + error + (args.length ? \" \" + args.map(String).join(\",\") : \"\") + \". Find the full error at: https://github.com/mobxjs/mobx/blob/main/packages/mobx/src/errors.ts\" : \"[MobX] \" + error);\n}\n\nvar mockGlobal = {};\nfunction getGlobal() {\n if (typeof globalThis !== \"undefined\") {\n return globalThis;\n }\n if (typeof window !== \"undefined\") {\n return window;\n }\n if (typeof __webpack_require__.g !== \"undefined\") {\n return __webpack_require__.g;\n }\n if (typeof self !== \"undefined\") {\n return self;\n }\n return mockGlobal;\n}\n\n// We shorten anything used > 5 times\nvar assign = Object.assign;\nvar getDescriptor = Object.getOwnPropertyDescriptor;\nvar defineProperty = Object.defineProperty;\nvar objectPrototype = Object.prototype;\nvar EMPTY_ARRAY = [];\nObject.freeze(EMPTY_ARRAY);\nvar EMPTY_OBJECT = {};\nObject.freeze(EMPTY_OBJECT);\nvar hasProxy = typeof Proxy !== \"undefined\";\nvar plainObjectString = /*#__PURE__*/Object.toString();\nfunction assertProxies() {\n if (!hasProxy) {\n die( true ? \"`Proxy` objects are not available in the current environment. Please configure MobX to enable a fallback implementation.`\" : 0);\n }\n}\nfunction warnAboutProxyRequirement(msg) {\n if ( true && globalState.verifyProxies) {\n die(\"MobX is currently configured to be able to run in ES5 mode, but in ES5 MobX won't be able to \" + msg);\n }\n}\nfunction getNextId() {\n return ++globalState.mobxGuid;\n}\n/**\n * Makes sure that the provided function is invoked at most once.\n */\nfunction once(func) {\n var invoked = false;\n return function () {\n if (invoked) {\n return;\n }\n invoked = true;\n return func.apply(this, arguments);\n };\n}\nvar noop = function noop() {};\nfunction isFunction(fn) {\n return typeof fn === \"function\";\n}\nfunction isStringish(value) {\n var t = typeof value;\n switch (t) {\n case \"string\":\n case \"symbol\":\n case \"number\":\n return true;\n }\n return false;\n}\nfunction isObject(value) {\n return value !== null && typeof value === \"object\";\n}\nfunction isPlainObject(value) {\n if (!isObject(value)) {\n return false;\n }\n var proto = Object.getPrototypeOf(value);\n if (proto == null) {\n return true;\n }\n var protoConstructor = Object.hasOwnProperty.call(proto, \"constructor\") && proto.constructor;\n return typeof protoConstructor === \"function\" && protoConstructor.toString() === plainObjectString;\n}\n// https://stackoverflow.com/a/37865170\nfunction isGenerator(obj) {\n var constructor = obj == null ? void 0 : obj.constructor;\n if (!constructor) {\n return false;\n }\n if (\"GeneratorFunction\" === constructor.name || \"GeneratorFunction\" === constructor.displayName) {\n return true;\n }\n return false;\n}\nfunction addHiddenProp(object, propName, value) {\n defineProperty(object, propName, {\n enumerable: false,\n writable: true,\n configurable: true,\n value: value\n });\n}\nfunction addHiddenFinalProp(object, propName, value) {\n defineProperty(object, propName, {\n enumerable: false,\n writable: false,\n configurable: true,\n value: value\n });\n}\nfunction createInstanceofPredicate(name, theClass) {\n var propName = \"isMobX\" + name;\n theClass.prototype[propName] = true;\n return function (x) {\n return isObject(x) && x[propName] === true;\n };\n}\n/**\n * Yields true for both native and observable Map, even across different windows.\n */\nfunction isES6Map(thing) {\n return thing != null && Object.prototype.toString.call(thing) === \"[object Map]\";\n}\n/**\n * Makes sure a Map is an instance of non-inherited native or observable Map.\n */\nfunction isPlainES6Map(thing) {\n var mapProto = Object.getPrototypeOf(thing);\n var objectProto = Object.getPrototypeOf(mapProto);\n var nullProto = Object.getPrototypeOf(objectProto);\n return nullProto === null;\n}\n/**\n * Yields true for both native and observable Set, even across different windows.\n */\nfunction isES6Set(thing) {\n return thing != null && Object.prototype.toString.call(thing) === \"[object Set]\";\n}\nvar hasGetOwnPropertySymbols = typeof Object.getOwnPropertySymbols !== \"undefined\";\n/**\n * Returns the following: own enumerable keys and symbols.\n */\nfunction getPlainObjectKeys(object) {\n var keys = Object.keys(object);\n // Not supported in IE, so there are not going to be symbol props anyway...\n if (!hasGetOwnPropertySymbols) {\n return keys;\n }\n var symbols = Object.getOwnPropertySymbols(object);\n if (!symbols.length) {\n return keys;\n }\n return [].concat(keys, symbols.filter(function (s) {\n return objectPrototype.propertyIsEnumerable.call(object, s);\n }));\n}\n// From Immer utils\n// Returns all own keys, including non-enumerable and symbolic\nvar ownKeys = typeof Reflect !== \"undefined\" && Reflect.ownKeys ? Reflect.ownKeys : hasGetOwnPropertySymbols ? function (obj) {\n return Object.getOwnPropertyNames(obj).concat(Object.getOwnPropertySymbols(obj));\n} : /* istanbul ignore next */Object.getOwnPropertyNames;\nfunction stringifyKey(key) {\n if (typeof key === \"string\") {\n return key;\n }\n if (typeof key === \"symbol\") {\n return key.toString();\n }\n return new String(key).toString();\n}\nfunction toPrimitive(value) {\n return value === null ? null : typeof value === \"object\" ? \"\" + value : value;\n}\nfunction hasProp(target, prop) {\n return objectPrototype.hasOwnProperty.call(target, prop);\n}\n// From Immer utils\nvar getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors || function getOwnPropertyDescriptors(target) {\n // Polyfill needed for Hermes and IE, see https://github.com/facebook/hermes/issues/274\n var res = {};\n // Note: without polyfill for ownKeys, symbols won't be picked up\n ownKeys(target).forEach(function (key) {\n res[key] = getDescriptor(target, key);\n });\n return res;\n};\nfunction getFlag(flags, mask) {\n return !!(flags & mask);\n}\nfunction setFlag(flags, mask, newValue) {\n if (newValue) {\n flags |= mask;\n } else {\n flags &= ~mask;\n }\n return flags;\n}\n\nfunction _arrayLikeToArray(r, a) {\n (null == a || a > r.length) && (a = r.length);\n for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];\n return n;\n}\nfunction _defineProperties(e, r) {\n for (var t = 0; t < r.length; t++) {\n var o = r[t];\n o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);\n }\n}\nfunction _createClass(e, r, t) {\n return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", {\n writable: !1\n }), e;\n}\nfunction _createForOfIteratorHelperLoose(r, e) {\n var t = \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"];\n if (t) return (t = t.call(r)).next.bind(t);\n if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && \"number\" == typeof r.length) {\n t && (r = t);\n var o = 0;\n return function () {\n return o >= r.length ? {\n done: !0\n } : {\n done: !1,\n value: r[o++]\n };\n };\n }\n throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\nfunction _extends() {\n return _extends = Object.assign ? Object.assign.bind() : function (n) {\n for (var e = 1; e < arguments.length; e++) {\n var t = arguments[e];\n for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);\n }\n return n;\n }, _extends.apply(null, arguments);\n}\nfunction _inheritsLoose(t, o) {\n t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);\n}\nfunction _setPrototypeOf(t, e) {\n return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {\n return t.__proto__ = e, t;\n }, _setPrototypeOf(t, e);\n}\nfunction _toPrimitive(t, r) {\n if (\"object\" != typeof t || !t) return t;\n var e = t[Symbol.toPrimitive];\n if (void 0 !== e) {\n var i = e.call(t, r || \"default\");\n if (\"object\" != typeof i) return i;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (\"string\" === r ? String : Number)(t);\n}\nfunction _toPropertyKey(t) {\n var i = _toPrimitive(t, \"string\");\n return \"symbol\" == typeof i ? i : i + \"\";\n}\nfunction _unsupportedIterableToArray(r, a) {\n if (r) {\n if (\"string\" == typeof r) return _arrayLikeToArray(r, a);\n var t = {}.toString.call(r).slice(8, -1);\n return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;\n }\n}\n\nvar storedAnnotationsSymbol = /*#__PURE__*/Symbol(\"mobx-stored-annotations\");\n/**\n * Creates a function that acts as\n * - decorator\n * - annotation object\n */\nfunction createDecoratorAnnotation(annotation) {\n function decorator(target, property) {\n if (is20223Decorator(property)) {\n return annotation.decorate_20223_(target, property);\n } else {\n storeAnnotation(target, property, annotation);\n }\n }\n return Object.assign(decorator, annotation);\n}\n/**\n * Stores annotation to prototype,\n * so it can be inspected later by `makeObservable` called from constructor\n */\nfunction storeAnnotation(prototype, key, annotation) {\n if (!hasProp(prototype, storedAnnotationsSymbol)) {\n addHiddenProp(prototype, storedAnnotationsSymbol, _extends({}, prototype[storedAnnotationsSymbol]));\n }\n // @override must override something\n if ( true && isOverride(annotation) && !hasProp(prototype[storedAnnotationsSymbol], key)) {\n var fieldName = prototype.constructor.name + \".prototype.\" + key.toString();\n die(\"'\" + fieldName + \"' is decorated with 'override', \" + \"but no such decorated member was found on prototype.\");\n }\n // Cannot re-decorate\n assertNotDecorated(prototype, annotation, key);\n // Ignore override\n if (!isOverride(annotation)) {\n prototype[storedAnnotationsSymbol][key] = annotation;\n }\n}\nfunction assertNotDecorated(prototype, annotation, key) {\n if ( true && !isOverride(annotation) && hasProp(prototype[storedAnnotationsSymbol], key)) {\n var fieldName = prototype.constructor.name + \".prototype.\" + key.toString();\n var currentAnnotationType = prototype[storedAnnotationsSymbol][key].annotationType_;\n var requestedAnnotationType = annotation.annotationType_;\n die(\"Cannot apply '@\" + requestedAnnotationType + \"' to '\" + fieldName + \"':\" + (\"\\nThe field is already decorated with '@\" + currentAnnotationType + \"'.\") + \"\\nRe-decorating fields is not allowed.\" + \"\\nUse '@override' decorator for methods overridden by subclass.\");\n }\n}\n/**\n * Collects annotations from prototypes and stores them on target (instance)\n */\nfunction collectStoredAnnotations(target) {\n if (!hasProp(target, storedAnnotationsSymbol)) {\n // if (__DEV__ && !target[storedAnnotationsSymbol]) {\n // die(\n // `No annotations were passed to makeObservable, but no decorated members have been found either`\n // )\n // }\n // We need a copy as we will remove annotation from the list once it's applied.\n addHiddenProp(target, storedAnnotationsSymbol, _extends({}, target[storedAnnotationsSymbol]));\n }\n return target[storedAnnotationsSymbol];\n}\nfunction is20223Decorator(context) {\n return typeof context == \"object\" && typeof context[\"kind\"] == \"string\";\n}\nfunction assert20223DecoratorType(context, types) {\n if ( true && !types.includes(context.kind)) {\n die(\"The decorator applied to '\" + String(context.name) + \"' cannot be used on a \" + context.kind + \" element\");\n }\n}\n\nvar $mobx = /*#__PURE__*/Symbol(\"mobx administration\");\nvar Atom = /*#__PURE__*/function () {\n /**\n * Create a new atom. For debugging purposes it is recommended to give it a name.\n * The onBecomeObserved and onBecomeUnobserved callbacks can be used for resource management.\n */\n function Atom(name_) {\n if (name_ === void 0) {\n name_ = true ? \"Atom@\" + getNextId() : 0;\n }\n this.name_ = void 0;\n this.flags_ = 0;\n this.observers_ = new Set();\n this.lastAccessedBy_ = 0;\n this.lowestObserverState_ = IDerivationState_.NOT_TRACKING_;\n // onBecomeObservedListeners\n this.onBOL = void 0;\n // onBecomeUnobservedListeners\n this.onBUOL = void 0;\n this.name_ = name_;\n }\n // for effective unobserving. BaseAtom has true, for extra optimization, so its onBecomeUnobserved never gets called, because it's not needed\n var _proto = Atom.prototype;\n _proto.onBO = function onBO() {\n if (this.onBOL) {\n this.onBOL.forEach(function (listener) {\n return listener();\n });\n }\n };\n _proto.onBUO = function onBUO() {\n if (this.onBUOL) {\n this.onBUOL.forEach(function (listener) {\n return listener();\n });\n }\n }\n /**\n * Invoke this method to notify mobx that your atom has been used somehow.\n * Returns true if there is currently a reactive context.\n */;\n _proto.reportObserved = function reportObserved$1() {\n return reportObserved(this);\n }\n /**\n * Invoke this method _after_ this method has changed to signal mobx that all its observers should invalidate.\n */;\n _proto.reportChanged = function reportChanged() {\n startBatch();\n propagateChanged(this);\n endBatch();\n };\n _proto.toString = function toString() {\n return this.name_;\n };\n return _createClass(Atom, [{\n key: \"isBeingObserved\",\n get: function get() {\n return getFlag(this.flags_, Atom.isBeingObservedMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Atom.isBeingObservedMask_, newValue);\n }\n }, {\n key: \"isPendingUnobservation\",\n get: function get() {\n return getFlag(this.flags_, Atom.isPendingUnobservationMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Atom.isPendingUnobservationMask_, newValue);\n }\n }, {\n key: \"diffValue\",\n get: function get() {\n return getFlag(this.flags_, Atom.diffValueMask_) ? 1 : 0;\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Atom.diffValueMask_, newValue === 1 ? true : false);\n }\n }]);\n}();\nAtom.isBeingObservedMask_ = 1;\nAtom.isPendingUnobservationMask_ = 2;\nAtom.diffValueMask_ = 4;\nvar isAtom = /*#__PURE__*/createInstanceofPredicate(\"Atom\", Atom);\nfunction createAtom(name, onBecomeObservedHandler, onBecomeUnobservedHandler) {\n if (onBecomeObservedHandler === void 0) {\n onBecomeObservedHandler = noop;\n }\n if (onBecomeUnobservedHandler === void 0) {\n onBecomeUnobservedHandler = noop;\n }\n var atom = new Atom(name);\n // default `noop` listener will not initialize the hook Set\n if (onBecomeObservedHandler !== noop) {\n onBecomeObserved(atom, onBecomeObservedHandler);\n }\n if (onBecomeUnobservedHandler !== noop) {\n onBecomeUnobserved(atom, onBecomeUnobservedHandler);\n }\n return atom;\n}\n\nfunction identityComparer(a, b) {\n return a === b;\n}\nfunction structuralComparer(a, b) {\n return deepEqual(a, b);\n}\nfunction shallowComparer(a, b) {\n return deepEqual(a, b, 1);\n}\nfunction defaultComparer(a, b) {\n if (Object.is) {\n return Object.is(a, b);\n }\n return a === b ? a !== 0 || 1 / a === 1 / b : a !== a && b !== b;\n}\nvar comparer = {\n identity: identityComparer,\n structural: structuralComparer,\n \"default\": defaultComparer,\n shallow: shallowComparer\n};\n\nfunction deepEnhancer(v, _, name) {\n // it is an observable already, done\n if (isObservable(v)) {\n return v;\n }\n // something that can be converted and mutated?\n if (Array.isArray(v)) {\n return observable.array(v, {\n name: name\n });\n }\n if (isPlainObject(v)) {\n return observable.object(v, undefined, {\n name: name\n });\n }\n if (isES6Map(v)) {\n return observable.map(v, {\n name: name\n });\n }\n if (isES6Set(v)) {\n return observable.set(v, {\n name: name\n });\n }\n if (typeof v === \"function\" && !isAction(v) && !isFlow(v)) {\n if (isGenerator(v)) {\n return flow(v);\n } else {\n return autoAction(name, v);\n }\n }\n return v;\n}\nfunction shallowEnhancer(v, _, name) {\n if (v === undefined || v === null) {\n return v;\n }\n if (isObservableObject(v) || isObservableArray(v) || isObservableMap(v) || isObservableSet(v)) {\n return v;\n }\n if (Array.isArray(v)) {\n return observable.array(v, {\n name: name,\n deep: false\n });\n }\n if (isPlainObject(v)) {\n return observable.object(v, undefined, {\n name: name,\n deep: false\n });\n }\n if (isES6Map(v)) {\n return observable.map(v, {\n name: name,\n deep: false\n });\n }\n if (isES6Set(v)) {\n return observable.set(v, {\n name: name,\n deep: false\n });\n }\n if (true) {\n die(\"The shallow modifier / decorator can only used in combination with arrays, objects, maps and sets\");\n }\n}\nfunction referenceEnhancer(newValue) {\n // never turn into an observable\n return newValue;\n}\nfunction refStructEnhancer(v, oldValue) {\n if ( true && isObservable(v)) {\n die(\"observable.struct should not be used with observable values\");\n }\n if (deepEqual(v, oldValue)) {\n return oldValue;\n }\n return v;\n}\n\nvar OVERRIDE = \"override\";\nvar override = /*#__PURE__*/createDecoratorAnnotation({\n annotationType_: OVERRIDE,\n make_: make_,\n extend_: extend_,\n decorate_20223_: decorate_20223_\n});\nfunction isOverride(annotation) {\n return annotation.annotationType_ === OVERRIDE;\n}\nfunction make_(adm, key) {\n // Must not be plain object\n if ( true && adm.isPlainObject_) {\n die(\"Cannot apply '\" + this.annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + this.annotationType_ + \"' cannot be used on plain objects.\"));\n }\n // Must override something\n if ( true && !hasProp(adm.appliedAnnotations_, key)) {\n die(\"'\" + adm.name_ + \".\" + key.toString() + \"' is annotated with '\" + this.annotationType_ + \"', \" + \"but no such annotated member was found on prototype.\");\n }\n return 0 /* MakeResult.Cancel */;\n}\nfunction extend_(adm, key, descriptor, proxyTrap) {\n die(\"'\" + this.annotationType_ + \"' can only be used with 'makeObservable'\");\n}\nfunction decorate_20223_(desc, context) {\n console.warn(\"'\" + this.annotationType_ + \"' cannot be used with decorators - this is a no-op\");\n}\n\nfunction createActionAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$1,\n extend_: extend_$1,\n decorate_20223_: decorate_20223_$1\n };\n}\nfunction make_$1(adm, key, descriptor, source) {\n var _this$options_;\n // bound\n if ((_this$options_ = this.options_) != null && _this$options_.bound) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;\n }\n // own\n if (source === adm.target_) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 2 /* MakeResult.Continue */;\n }\n // prototype\n if (isAction(descriptor.value)) {\n // A prototype could have been annotated already by other constructor,\n // rest of the proto chain must be annotated already\n return 1 /* MakeResult.Break */;\n }\n var actionDescriptor = createActionDescriptor(adm, this, key, descriptor, false);\n defineProperty(source, key, actionDescriptor);\n return 2 /* MakeResult.Continue */;\n}\nfunction extend_$1(adm, key, descriptor, proxyTrap) {\n var actionDescriptor = createActionDescriptor(adm, this, key, descriptor);\n return adm.defineProperty_(key, actionDescriptor, proxyTrap);\n}\nfunction decorate_20223_$1(mthd, context) {\n if (true) {\n assert20223DecoratorType(context, [\"method\", \"field\"]);\n }\n var kind = context.kind,\n name = context.name,\n addInitializer = context.addInitializer;\n var ann = this;\n var _createAction = function _createAction(m) {\n var _ann$options_$name, _ann$options_, _ann$options_$autoAct, _ann$options_2;\n return createAction((_ann$options_$name = (_ann$options_ = ann.options_) == null ? void 0 : _ann$options_.name) != null ? _ann$options_$name : name.toString(), m, (_ann$options_$autoAct = (_ann$options_2 = ann.options_) == null ? void 0 : _ann$options_2.autoAction) != null ? _ann$options_$autoAct : false);\n };\n if (kind == \"field\") {\n return function (initMthd) {\n var _ann$options_3;\n var mthd = initMthd;\n if (!isAction(mthd)) {\n mthd = _createAction(mthd);\n }\n if ((_ann$options_3 = ann.options_) != null && _ann$options_3.bound) {\n mthd = mthd.bind(this);\n mthd.isMobxAction = true;\n }\n return mthd;\n };\n }\n if (kind == \"method\") {\n var _this$options_2;\n if (!isAction(mthd)) {\n mthd = _createAction(mthd);\n }\n if ((_this$options_2 = this.options_) != null && _this$options_2.bound) {\n addInitializer(function () {\n var self = this;\n var bound = self[name].bind(self);\n bound.isMobxAction = true;\n self[name] = bound;\n });\n }\n return mthd;\n }\n die(\"Cannot apply '\" + ann.annotationType_ + \"' to '\" + String(name) + \"' (kind: \" + kind + \"):\" + (\"\\n'\" + ann.annotationType_ + \"' can only be used on properties with a function value.\"));\n}\nfunction assertActionDescriptor(adm, _ref, key, _ref2) {\n var annotationType_ = _ref.annotationType_;\n var value = _ref2.value;\n if ( true && !isFunction(value)) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' can only be used on properties with a function value.\"));\n }\n}\nfunction createActionDescriptor(adm, annotation, key, descriptor,\n// provides ability to disable safeDescriptors for prototypes\nsafeDescriptors) {\n var _annotation$options_, _annotation$options_$, _annotation$options_2, _annotation$options_$2, _annotation$options_3, _annotation$options_4, _adm$proxy_2;\n if (safeDescriptors === void 0) {\n safeDescriptors = globalState.safeDescriptors;\n }\n assertActionDescriptor(adm, annotation, key, descriptor);\n var value = descriptor.value;\n if ((_annotation$options_ = annotation.options_) != null && _annotation$options_.bound) {\n var _adm$proxy_;\n value = value.bind((_adm$proxy_ = adm.proxy_) != null ? _adm$proxy_ : adm.target_);\n }\n return {\n value: createAction((_annotation$options_$ = (_annotation$options_2 = annotation.options_) == null ? void 0 : _annotation$options_2.name) != null ? _annotation$options_$ : key.toString(), value, (_annotation$options_$2 = (_annotation$options_3 = annotation.options_) == null ? void 0 : _annotation$options_3.autoAction) != null ? _annotation$options_$2 : false,\n // https://github.com/mobxjs/mobx/discussions/3140\n (_annotation$options_4 = annotation.options_) != null && _annotation$options_4.bound ? (_adm$proxy_2 = adm.proxy_) != null ? _adm$proxy_2 : adm.target_ : undefined),\n // Non-configurable for classes\n // prevents accidental field redefinition in subclass\n configurable: safeDescriptors ? adm.isPlainObject_ : true,\n // https://github.com/mobxjs/mobx/pull/2641#issuecomment-737292058\n enumerable: false,\n // Non-obsevable, therefore non-writable\n // Also prevents rewriting in subclass constructor\n writable: safeDescriptors ? false : true\n };\n}\n\nfunction createFlowAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$2,\n extend_: extend_$2,\n decorate_20223_: decorate_20223_$2\n };\n}\nfunction make_$2(adm, key, descriptor, source) {\n var _this$options_;\n // own\n if (source === adm.target_) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 2 /* MakeResult.Continue */;\n }\n // prototype\n // bound - must annotate protos to support super.flow()\n if ((_this$options_ = this.options_) != null && _this$options_.bound && (!hasProp(adm.target_, key) || !isFlow(adm.target_[key]))) {\n if (this.extend_(adm, key, descriptor, false) === null) {\n return 0 /* MakeResult.Cancel */;\n }\n }\n if (isFlow(descriptor.value)) {\n // A prototype could have been annotated already by other constructor,\n // rest of the proto chain must be annotated already\n return 1 /* MakeResult.Break */;\n }\n var flowDescriptor = createFlowDescriptor(adm, this, key, descriptor, false, false);\n defineProperty(source, key, flowDescriptor);\n return 2 /* MakeResult.Continue */;\n}\nfunction extend_$2(adm, key, descriptor, proxyTrap) {\n var _this$options_2;\n var flowDescriptor = createFlowDescriptor(adm, this, key, descriptor, (_this$options_2 = this.options_) == null ? void 0 : _this$options_2.bound);\n return adm.defineProperty_(key, flowDescriptor, proxyTrap);\n}\nfunction decorate_20223_$2(mthd, context) {\n var _this$options_3;\n if (true) {\n assert20223DecoratorType(context, [\"method\"]);\n }\n var name = context.name,\n addInitializer = context.addInitializer;\n if (!isFlow(mthd)) {\n mthd = flow(mthd);\n }\n if ((_this$options_3 = this.options_) != null && _this$options_3.bound) {\n addInitializer(function () {\n var self = this;\n var bound = self[name].bind(self);\n bound.isMobXFlow = true;\n self[name] = bound;\n });\n }\n return mthd;\n}\nfunction assertFlowDescriptor(adm, _ref, key, _ref2) {\n var annotationType_ = _ref.annotationType_;\n var value = _ref2.value;\n if ( true && !isFunction(value)) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' can only be used on properties with a generator function value.\"));\n }\n}\nfunction createFlowDescriptor(adm, annotation, key, descriptor, bound,\n// provides ability to disable safeDescriptors for prototypes\nsafeDescriptors) {\n if (safeDescriptors === void 0) {\n safeDescriptors = globalState.safeDescriptors;\n }\n assertFlowDescriptor(adm, annotation, key, descriptor);\n var value = descriptor.value;\n // In case of flow.bound, the descriptor can be from already annotated prototype\n if (!isFlow(value)) {\n value = flow(value);\n }\n if (bound) {\n var _adm$proxy_;\n // We do not keep original function around, so we bind the existing flow\n value = value.bind((_adm$proxy_ = adm.proxy_) != null ? _adm$proxy_ : adm.target_);\n // This is normally set by `flow`, but `bind` returns new function...\n value.isMobXFlow = true;\n }\n return {\n value: value,\n // Non-configurable for classes\n // prevents accidental field redefinition in subclass\n configurable: safeDescriptors ? adm.isPlainObject_ : true,\n // https://github.com/mobxjs/mobx/pull/2641#issuecomment-737292058\n enumerable: false,\n // Non-obsevable, therefore non-writable\n // Also prevents rewriting in subclass constructor\n writable: safeDescriptors ? false : true\n };\n}\n\nfunction createComputedAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$3,\n extend_: extend_$3,\n decorate_20223_: decorate_20223_$3\n };\n}\nfunction make_$3(adm, key, descriptor) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;\n}\nfunction extend_$3(adm, key, descriptor, proxyTrap) {\n assertComputedDescriptor(adm, this, key, descriptor);\n return adm.defineComputedProperty_(key, _extends({}, this.options_, {\n get: descriptor.get,\n set: descriptor.set\n }), proxyTrap);\n}\nfunction decorate_20223_$3(get, context) {\n if (true) {\n assert20223DecoratorType(context, [\"getter\"]);\n }\n var ann = this;\n var key = context.name,\n addInitializer = context.addInitializer;\n addInitializer(function () {\n var adm = asObservableObject(this)[$mobx];\n var options = _extends({}, ann.options_, {\n get: get,\n context: this\n });\n options.name || (options.name = true ? adm.name_ + \".\" + key.toString() : 0);\n adm.values_.set(key, new ComputedValue(options));\n });\n return function () {\n return this[$mobx].getObservablePropValue_(key);\n };\n}\nfunction assertComputedDescriptor(adm, _ref, key, _ref2) {\n var annotationType_ = _ref.annotationType_;\n var get = _ref2.get;\n if ( true && !get) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' can only be used on getter(+setter) properties.\"));\n }\n}\n\nfunction createObservableAnnotation(name, options) {\n return {\n annotationType_: name,\n options_: options,\n make_: make_$4,\n extend_: extend_$4,\n decorate_20223_: decorate_20223_$4\n };\n}\nfunction make_$4(adm, key, descriptor) {\n return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;\n}\nfunction extend_$4(adm, key, descriptor, proxyTrap) {\n var _this$options_$enhanc, _this$options_;\n assertObservableDescriptor(adm, this, key, descriptor);\n return adm.defineObservableProperty_(key, descriptor.value, (_this$options_$enhanc = (_this$options_ = this.options_) == null ? void 0 : _this$options_.enhancer) != null ? _this$options_$enhanc : deepEnhancer, proxyTrap);\n}\nfunction decorate_20223_$4(desc, context) {\n if (true) {\n if (context.kind === \"field\") {\n throw die(\"Please use `@observable accessor \" + String(context.name) + \"` instead of `@observable \" + String(context.name) + \"`\");\n }\n assert20223DecoratorType(context, [\"accessor\"]);\n }\n var ann = this;\n var kind = context.kind,\n name = context.name;\n // The laziness here is not ideal... It's a workaround to how 2022.3 Decorators are implemented:\n // `addInitializer` callbacks are executed _before_ any accessors are defined (instead of the ideal-for-us right after each).\n // This means that, if we were to do our stuff in an `addInitializer`, we'd attempt to read a private slot\n // before it has been initialized. The runtime doesn't like that and throws a `Cannot read private member\n // from an object whose class did not declare it` error.\n // TODO: it seems that this will not be required anymore in the final version of the spec\n // See TODO: link\n var initializedObjects = new WeakSet();\n function initializeObservable(target, value) {\n var _ann$options_$enhance, _ann$options_;\n var adm = asObservableObject(target)[$mobx];\n var observable = new ObservableValue(value, (_ann$options_$enhance = (_ann$options_ = ann.options_) == null ? void 0 : _ann$options_.enhancer) != null ? _ann$options_$enhance : deepEnhancer, true ? adm.name_ + \".\" + name.toString() : 0, false);\n adm.values_.set(name, observable);\n initializedObjects.add(target);\n }\n if (kind == \"accessor\") {\n return {\n get: function get() {\n if (!initializedObjects.has(this)) {\n initializeObservable(this, desc.get.call(this));\n }\n return this[$mobx].getObservablePropValue_(name);\n },\n set: function set(value) {\n if (!initializedObjects.has(this)) {\n initializeObservable(this, value);\n }\n return this[$mobx].setObservablePropValue_(name, value);\n },\n init: function init(value) {\n if (!initializedObjects.has(this)) {\n initializeObservable(this, value);\n }\n return value;\n }\n };\n }\n return;\n}\nfunction assertObservableDescriptor(adm, _ref, key, descriptor) {\n var annotationType_ = _ref.annotationType_;\n if ( true && !(\"value\" in descriptor)) {\n die(\"Cannot apply '\" + annotationType_ + \"' to '\" + adm.name_ + \".\" + key.toString() + \"':\" + (\"\\n'\" + annotationType_ + \"' cannot be used on getter/setter properties\"));\n }\n}\n\nvar AUTO = \"true\";\nvar autoAnnotation = /*#__PURE__*/createAutoAnnotation();\nfunction createAutoAnnotation(options) {\n return {\n annotationType_: AUTO,\n options_: options,\n make_: make_$5,\n extend_: extend_$5,\n decorate_20223_: decorate_20223_$5\n };\n}\nfunction make_$5(adm, key, descriptor, source) {\n var _this$options_3, _this$options_4;\n // getter -> computed\n if (descriptor.get) {\n return computed.make_(adm, key, descriptor, source);\n }\n // lone setter -> action setter\n if (descriptor.set) {\n // TODO make action applicable to setter and delegate to action.make_\n var set = createAction(key.toString(), descriptor.set);\n // own\n if (source === adm.target_) {\n return adm.defineProperty_(key, {\n configurable: globalState.safeDescriptors ? adm.isPlainObject_ : true,\n set: set\n }) === null ? 0 /* MakeResult.Cancel */ : 2 /* MakeResult.Continue */;\n }\n // proto\n defineProperty(source, key, {\n configurable: true,\n set: set\n });\n return 2 /* MakeResult.Continue */;\n }\n // function on proto -> autoAction/flow\n if (source !== adm.target_ && typeof descriptor.value === \"function\") {\n var _this$options_2;\n if (isGenerator(descriptor.value)) {\n var _this$options_;\n var flowAnnotation = (_this$options_ = this.options_) != null && _this$options_.autoBind ? flow.bound : flow;\n return flowAnnotation.make_(adm, key, descriptor, source);\n }\n var actionAnnotation = (_this$options_2 = this.options_) != null && _this$options_2.autoBind ? autoAction.bound : autoAction;\n return actionAnnotation.make_(adm, key, descriptor, source);\n }\n // other -> observable\n // Copy props from proto as well, see test:\n // \"decorate should work with Object.create\"\n var observableAnnotation = ((_this$options_3 = this.options_) == null ? void 0 : _this$options_3.deep) === false ? observable.ref : observable;\n // if function respect autoBind option\n if (typeof descriptor.value === \"function\" && (_this$options_4 = this.options_) != null && _this$options_4.autoBind) {\n var _adm$proxy_;\n descriptor.value = descriptor.value.bind((_adm$proxy_ = adm.proxy_) != null ? _adm$proxy_ : adm.target_);\n }\n return observableAnnotation.make_(adm, key, descriptor, source);\n}\nfunction extend_$5(adm, key, descriptor, proxyTrap) {\n var _this$options_5, _this$options_6;\n // getter -> computed\n if (descriptor.get) {\n return computed.extend_(adm, key, descriptor, proxyTrap);\n }\n // lone setter -> action setter\n if (descriptor.set) {\n // TODO make action applicable to setter and delegate to action.extend_\n return adm.defineProperty_(key, {\n configurable: globalState.safeDescriptors ? adm.isPlainObject_ : true,\n set: createAction(key.toString(), descriptor.set)\n }, proxyTrap);\n }\n // other -> observable\n // if function respect autoBind option\n if (typeof descriptor.value === \"function\" && (_this$options_5 = this.options_) != null && _this$options_5.autoBind) {\n var _adm$proxy_2;\n descriptor.value = descriptor.value.bind((_adm$proxy_2 = adm.proxy_) != null ? _adm$proxy_2 : adm.target_);\n }\n var observableAnnotation = ((_this$options_6 = this.options_) == null ? void 0 : _this$options_6.deep) === false ? observable.ref : observable;\n return observableAnnotation.extend_(adm, key, descriptor, proxyTrap);\n}\nfunction decorate_20223_$5(desc, context) {\n die(\"'\" + this.annotationType_ + \"' cannot be used as a decorator\");\n}\n\nvar OBSERVABLE = \"observable\";\nvar OBSERVABLE_REF = \"observable.ref\";\nvar OBSERVABLE_SHALLOW = \"observable.shallow\";\nvar OBSERVABLE_STRUCT = \"observable.struct\";\n// Predefined bags of create observable options, to avoid allocating temporarily option objects\n// in the majority of cases\nvar defaultCreateObservableOptions = {\n deep: true,\n name: undefined,\n defaultDecorator: undefined,\n proxy: true\n};\nObject.freeze(defaultCreateObservableOptions);\nfunction asCreateObservableOptions(thing) {\n return thing || defaultCreateObservableOptions;\n}\nvar observableAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE);\nvar observableRefAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE_REF, {\n enhancer: referenceEnhancer\n});\nvar observableShallowAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE_SHALLOW, {\n enhancer: shallowEnhancer\n});\nvar observableStructAnnotation = /*#__PURE__*/createObservableAnnotation(OBSERVABLE_STRUCT, {\n enhancer: refStructEnhancer\n});\nvar observableDecoratorAnnotation = /*#__PURE__*/createDecoratorAnnotation(observableAnnotation);\nfunction getEnhancerFromOptions(options) {\n return options.deep === true ? deepEnhancer : options.deep === false ? referenceEnhancer : getEnhancerFromAnnotation(options.defaultDecorator);\n}\nfunction getAnnotationFromOptions(options) {\n var _options$defaultDecor;\n return options ? (_options$defaultDecor = options.defaultDecorator) != null ? _options$defaultDecor : createAutoAnnotation(options) : undefined;\n}\nfunction getEnhancerFromAnnotation(annotation) {\n var _annotation$options_$, _annotation$options_;\n return !annotation ? deepEnhancer : (_annotation$options_$ = (_annotation$options_ = annotation.options_) == null ? void 0 : _annotation$options_.enhancer) != null ? _annotation$options_$ : deepEnhancer;\n}\n/**\n * Turns an object, array or function into a reactive structure.\n * @param v the value which should become observable.\n */\nfunction createObservable(v, arg2, arg3) {\n // @observable someProp; (2022.3 Decorators)\n if (is20223Decorator(arg2)) {\n return observableAnnotation.decorate_20223_(v, arg2);\n }\n // @observable someProp;\n if (isStringish(arg2)) {\n storeAnnotation(v, arg2, observableAnnotation);\n return;\n }\n // already observable - ignore\n if (isObservable(v)) {\n return v;\n }\n // plain object\n if (isPlainObject(v)) {\n return observable.object(v, arg2, arg3);\n }\n // Array\n if (Array.isArray(v)) {\n return observable.array(v, arg2);\n }\n // Map\n if (isES6Map(v)) {\n return observable.map(v, arg2);\n }\n // Set\n if (isES6Set(v)) {\n return observable.set(v, arg2);\n }\n // other object - ignore\n if (typeof v === \"object\" && v !== null) {\n return v;\n }\n // anything else\n return observable.box(v, arg2);\n}\nassign(createObservable, observableDecoratorAnnotation);\nvar observableFactories = {\n box: function box(value, options) {\n var o = asCreateObservableOptions(options);\n return new ObservableValue(value, getEnhancerFromOptions(o), o.name, true, o.equals);\n },\n array: function array(initialValues, options) {\n var o = asCreateObservableOptions(options);\n return (globalState.useProxies === false || o.proxy === false ? createLegacyArray : createObservableArray)(initialValues, getEnhancerFromOptions(o), o.name);\n },\n map: function map(initialValues, options) {\n var o = asCreateObservableOptions(options);\n return new ObservableMap(initialValues, getEnhancerFromOptions(o), o.name);\n },\n set: function set(initialValues, options) {\n var o = asCreateObservableOptions(options);\n return new ObservableSet(initialValues, getEnhancerFromOptions(o), o.name);\n },\n object: function object(props, decorators, options) {\n return initObservable(function () {\n return extendObservable(globalState.useProxies === false || (options == null ? void 0 : options.proxy) === false ? asObservableObject({}, options) : asDynamicObservableObject({}, options), props, decorators);\n });\n },\n ref: /*#__PURE__*/createDecoratorAnnotation(observableRefAnnotation),\n shallow: /*#__PURE__*/createDecoratorAnnotation(observableShallowAnnotation),\n deep: observableDecoratorAnnotation,\n struct: /*#__PURE__*/createDecoratorAnnotation(observableStructAnnotation)\n};\n// eslint-disable-next-line\nvar observable = /*#__PURE__*/assign(createObservable, observableFactories);\n\nvar COMPUTED = \"computed\";\nvar COMPUTED_STRUCT = \"computed.struct\";\nvar computedAnnotation = /*#__PURE__*/createComputedAnnotation(COMPUTED);\nvar computedStructAnnotation = /*#__PURE__*/createComputedAnnotation(COMPUTED_STRUCT, {\n equals: comparer.structural\n});\n/**\n * Decorator for class properties: @computed get value() { return expr; }.\n * For legacy purposes also invokable as ES5 observable created: `computed(() => expr)`;\n */\nvar computed = function computed(arg1, arg2) {\n if (is20223Decorator(arg2)) {\n // @computed (2022.3 Decorators)\n return computedAnnotation.decorate_20223_(arg1, arg2);\n }\n if (isStringish(arg2)) {\n // @computed\n return storeAnnotation(arg1, arg2, computedAnnotation);\n }\n if (isPlainObject(arg1)) {\n // @computed({ options })\n return createDecoratorAnnotation(createComputedAnnotation(COMPUTED, arg1));\n }\n // computed(expr, options?)\n if (true) {\n if (!isFunction(arg1)) {\n die(\"First argument to `computed` should be an expression.\");\n }\n if (isFunction(arg2)) {\n die(\"A setter as second argument is no longer supported, use `{ set: fn }` option instead\");\n }\n }\n var opts = isPlainObject(arg2) ? arg2 : {};\n opts.get = arg1;\n opts.name || (opts.name = arg1.name || \"\"); /* for generated name */\n return new ComputedValue(opts);\n};\nObject.assign(computed, computedAnnotation);\ncomputed.struct = /*#__PURE__*/createDecoratorAnnotation(computedStructAnnotation);\n\nvar _getDescriptor$config, _getDescriptor;\n// we don't use globalState for these in order to avoid possible issues with multiple\n// mobx versions\nvar currentActionId = 0;\nvar nextActionId = 1;\nvar isFunctionNameConfigurable = (_getDescriptor$config = (_getDescriptor = /*#__PURE__*/getDescriptor(function () {}, \"name\")) == null ? void 0 : _getDescriptor.configurable) != null ? _getDescriptor$config : false;\n// we can safely recycle this object\nvar tmpNameDescriptor = {\n value: \"action\",\n configurable: true,\n writable: false,\n enumerable: false\n};\nfunction createAction(actionName, fn, autoAction, ref) {\n if (autoAction === void 0) {\n autoAction = false;\n }\n if (true) {\n if (!isFunction(fn)) {\n die(\"`action` can only be invoked on functions\");\n }\n if (typeof actionName !== \"string\" || !actionName) {\n die(\"actions should have valid names, got: '\" + actionName + \"'\");\n }\n }\n function res() {\n return executeAction(actionName, autoAction, fn, ref || this, arguments);\n }\n res.isMobxAction = true;\n res.toString = function () {\n return fn.toString();\n };\n if (isFunctionNameConfigurable) {\n tmpNameDescriptor.value = actionName;\n defineProperty(res, \"name\", tmpNameDescriptor);\n }\n return res;\n}\nfunction executeAction(actionName, canRunAsDerivation, fn, scope, args) {\n var runInfo = _startAction(actionName, canRunAsDerivation, scope, args);\n try {\n return fn.apply(scope, args);\n } catch (err) {\n runInfo.error_ = err;\n throw err;\n } finally {\n _endAction(runInfo);\n }\n}\nfunction _startAction(actionName, canRunAsDerivation,\n// true for autoAction\nscope, args) {\n var notifySpy_ = true && isSpyEnabled() && !!actionName;\n var startTime_ = 0;\n if ( true && notifySpy_) {\n startTime_ = Date.now();\n var flattenedArgs = args ? Array.from(args) : EMPTY_ARRAY;\n spyReportStart({\n type: ACTION,\n name: actionName,\n object: scope,\n arguments: flattenedArgs\n });\n }\n var prevDerivation_ = globalState.trackingDerivation;\n var runAsAction = !canRunAsDerivation || !prevDerivation_;\n startBatch();\n var prevAllowStateChanges_ = globalState.allowStateChanges; // by default preserve previous allow\n if (runAsAction) {\n untrackedStart();\n prevAllowStateChanges_ = allowStateChangesStart(true);\n }\n var prevAllowStateReads_ = allowStateReadsStart(true);\n var runInfo = {\n runAsAction_: runAsAction,\n prevDerivation_: prevDerivation_,\n prevAllowStateChanges_: prevAllowStateChanges_,\n prevAllowStateReads_: prevAllowStateReads_,\n notifySpy_: notifySpy_,\n startTime_: startTime_,\n actionId_: nextActionId++,\n parentActionId_: currentActionId\n };\n currentActionId = runInfo.actionId_;\n return runInfo;\n}\nfunction _endAction(runInfo) {\n if (currentActionId !== runInfo.actionId_) {\n die(30);\n }\n currentActionId = runInfo.parentActionId_;\n if (runInfo.error_ !== undefined) {\n globalState.suppressReactionErrors = true;\n }\n allowStateChangesEnd(runInfo.prevAllowStateChanges_);\n allowStateReadsEnd(runInfo.prevAllowStateReads_);\n endBatch();\n if (runInfo.runAsAction_) {\n untrackedEnd(runInfo.prevDerivation_);\n }\n if ( true && runInfo.notifySpy_) {\n spyReportEnd({\n time: Date.now() - runInfo.startTime_\n });\n }\n globalState.suppressReactionErrors = false;\n}\nfunction allowStateChanges(allowStateChanges, func) {\n var prev = allowStateChangesStart(allowStateChanges);\n try {\n return func();\n } finally {\n allowStateChangesEnd(prev);\n }\n}\nfunction allowStateChangesStart(allowStateChanges) {\n var prev = globalState.allowStateChanges;\n globalState.allowStateChanges = allowStateChanges;\n return prev;\n}\nfunction allowStateChangesEnd(prev) {\n globalState.allowStateChanges = prev;\n}\n\nvar CREATE = \"create\";\nvar ObservableValue = /*#__PURE__*/function (_Atom) {\n function ObservableValue(value, enhancer, name_, notifySpy, equals) {\n var _this;\n if (name_ === void 0) {\n name_ = true ? \"ObservableValue@\" + getNextId() : 0;\n }\n if (notifySpy === void 0) {\n notifySpy = true;\n }\n if (equals === void 0) {\n equals = comparer[\"default\"];\n }\n _this = _Atom.call(this, name_) || this;\n _this.enhancer = void 0;\n _this.name_ = void 0;\n _this.equals = void 0;\n _this.hasUnreportedChange_ = false;\n _this.interceptors_ = void 0;\n _this.changeListeners_ = void 0;\n _this.value_ = void 0;\n _this.dehancer = void 0;\n _this.enhancer = enhancer;\n _this.name_ = name_;\n _this.equals = equals;\n _this.value_ = enhancer(value, undefined, name_);\n if ( true && notifySpy && isSpyEnabled()) {\n // only notify spy if this is a stand-alone observable\n spyReport({\n type: CREATE,\n object: _this,\n observableKind: \"value\",\n debugObjectName: _this.name_,\n newValue: \"\" + _this.value_\n });\n }\n return _this;\n }\n _inheritsLoose(ObservableValue, _Atom);\n var _proto = ObservableValue.prototype;\n _proto.dehanceValue = function dehanceValue(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.set = function set(newValue) {\n var oldValue = this.value_;\n newValue = this.prepareNewValue_(newValue);\n if (newValue !== globalState.UNCHANGED) {\n var notifySpy = isSpyEnabled();\n if ( true && notifySpy) {\n spyReportStart({\n type: UPDATE,\n object: this,\n observableKind: \"value\",\n debugObjectName: this.name_,\n newValue: newValue,\n oldValue: oldValue\n });\n }\n this.setNewValue_(newValue);\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n };\n _proto.prepareNewValue_ = function prepareNewValue_(newValue) {\n checkIfStateModificationsAreAllowed(this);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this,\n type: UPDATE,\n newValue: newValue\n });\n if (!change) {\n return globalState.UNCHANGED;\n }\n newValue = change.newValue;\n }\n // apply modifier\n newValue = this.enhancer(newValue, this.value_, this.name_);\n return this.equals(this.value_, newValue) ? globalState.UNCHANGED : newValue;\n };\n _proto.setNewValue_ = function setNewValue_(newValue) {\n var oldValue = this.value_;\n this.value_ = newValue;\n this.reportChanged();\n if (hasListeners(this)) {\n notifyListeners(this, {\n type: UPDATE,\n object: this,\n newValue: newValue,\n oldValue: oldValue\n });\n }\n };\n _proto.get = function get() {\n this.reportObserved();\n return this.dehanceValue(this.value_);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n if (fireImmediately) {\n listener({\n observableKind: \"value\",\n debugObjectName: this.name_,\n object: this,\n type: UPDATE,\n newValue: this.value_,\n oldValue: undefined\n });\n }\n return registerListener(this, listener);\n };\n _proto.raw = function raw() {\n // used by MST ot get undehanced value\n return this.value_;\n };\n _proto.toJSON = function toJSON() {\n return this.get();\n };\n _proto.toString = function toString() {\n return this.name_ + \"[\" + this.value_ + \"]\";\n };\n _proto.valueOf = function valueOf() {\n return toPrimitive(this.get());\n };\n _proto[Symbol.toPrimitive] = function () {\n return this.valueOf();\n };\n return ObservableValue;\n}(Atom);\nvar isObservableValue = /*#__PURE__*/createInstanceofPredicate(\"ObservableValue\", ObservableValue);\n\n/**\n * A node in the state dependency root that observes other nodes, and can be observed itself.\n *\n * ComputedValue will remember the result of the computation for the duration of the batch, or\n * while being observed.\n *\n * During this time it will recompute only when one of its direct dependencies changed,\n * but only when it is being accessed with `ComputedValue.get()`.\n *\n * Implementation description:\n * 1. First time it's being accessed it will compute and remember result\n * give back remembered result until 2. happens\n * 2. First time any deep dependency change, propagate POSSIBLY_STALE to all observers, wait for 3.\n * 3. When it's being accessed, recompute if any shallow dependency changed.\n * if result changed: propagate STALE to all observers, that were POSSIBLY_STALE from the last step.\n * go to step 2. either way\n *\n * If at any point it's outside batch and it isn't observed: reset everything and go to 1.\n */\nvar ComputedValue = /*#__PURE__*/function () {\n /**\n * Create a new computed value based on a function expression.\n *\n * The `name` property is for debug purposes only.\n *\n * The `equals` property specifies the comparer function to use to determine if a newly produced\n * value differs from the previous value. Two comparers are provided in the library; `defaultComparer`\n * compares based on identity comparison (===), and `structuralComparer` deeply compares the structure.\n * Structural comparison can be convenient if you always produce a new aggregated object and\n * don't want to notify observers if it is structurally the same.\n * This is useful for working with vectors, mouse coordinates etc.\n */\n function ComputedValue(options) {\n this.dependenciesState_ = IDerivationState_.NOT_TRACKING_;\n this.observing_ = [];\n // nodes we are looking at. Our value depends on these nodes\n this.newObserving_ = null;\n // during tracking it's an array with new observed observers\n this.observers_ = new Set();\n this.runId_ = 0;\n this.lastAccessedBy_ = 0;\n this.lowestObserverState_ = IDerivationState_.UP_TO_DATE_;\n this.unboundDepsCount_ = 0;\n this.value_ = new CaughtException(null);\n this.name_ = void 0;\n this.triggeredBy_ = void 0;\n this.flags_ = 0;\n this.derivation = void 0;\n // N.B: unminified as it is used by MST\n this.setter_ = void 0;\n this.isTracing_ = TraceMode.NONE;\n this.scope_ = void 0;\n this.equals_ = void 0;\n this.requiresReaction_ = void 0;\n this.keepAlive_ = void 0;\n this.onBOL = void 0;\n this.onBUOL = void 0;\n if (!options.get) {\n die(31);\n }\n this.derivation = options.get;\n this.name_ = options.name || ( true ? \"ComputedValue@\" + getNextId() : 0);\n if (options.set) {\n this.setter_ = createAction( true ? this.name_ + \"-setter\" : 0, options.set);\n }\n this.equals_ = options.equals || (options.compareStructural || options.struct ? comparer.structural : comparer[\"default\"]);\n this.scope_ = options.context;\n this.requiresReaction_ = options.requiresReaction;\n this.keepAlive_ = !!options.keepAlive;\n }\n var _proto = ComputedValue.prototype;\n _proto.onBecomeStale_ = function onBecomeStale_() {\n propagateMaybeChanged(this);\n };\n _proto.onBO = function onBO() {\n if (this.onBOL) {\n this.onBOL.forEach(function (listener) {\n return listener();\n });\n }\n };\n _proto.onBUO = function onBUO() {\n if (this.onBUOL) {\n this.onBUOL.forEach(function (listener) {\n return listener();\n });\n }\n }\n // to check for cycles\n ;\n /**\n * Returns the current value of this computed value.\n * Will evaluate its computation first if needed.\n */\n _proto.get = function get() {\n if (this.isComputing) {\n die(32, this.name_, this.derivation);\n }\n if (globalState.inBatch === 0 &&\n // !globalState.trackingDerivatpion &&\n this.observers_.size === 0 && !this.keepAlive_) {\n if (shouldCompute(this)) {\n this.warnAboutUntrackedRead_();\n startBatch(); // See perf test 'computed memoization'\n this.value_ = this.computeValue_(false);\n endBatch();\n }\n } else {\n reportObserved(this);\n if (shouldCompute(this)) {\n var prevTrackingContext = globalState.trackingContext;\n if (this.keepAlive_ && !prevTrackingContext) {\n globalState.trackingContext = this;\n }\n if (this.trackAndCompute()) {\n propagateChangeConfirmed(this);\n }\n globalState.trackingContext = prevTrackingContext;\n }\n }\n var result = this.value_;\n if (isCaughtException(result)) {\n throw result.cause;\n }\n return result;\n };\n _proto.set = function set(value) {\n if (this.setter_) {\n if (this.isRunningSetter) {\n die(33, this.name_);\n }\n this.isRunningSetter = true;\n try {\n this.setter_.call(this.scope_, value);\n } finally {\n this.isRunningSetter = false;\n }\n } else {\n die(34, this.name_);\n }\n };\n _proto.trackAndCompute = function trackAndCompute() {\n // N.B: unminified as it is used by MST\n var oldValue = this.value_;\n var wasSuspended = /* see #1208 */this.dependenciesState_ === IDerivationState_.NOT_TRACKING_;\n var newValue = this.computeValue_(true);\n var changed = wasSuspended || isCaughtException(oldValue) || isCaughtException(newValue) || !this.equals_(oldValue, newValue);\n if (changed) {\n this.value_ = newValue;\n if ( true && isSpyEnabled()) {\n spyReport({\n observableKind: \"computed\",\n debugObjectName: this.name_,\n object: this.scope_,\n type: \"update\",\n oldValue: oldValue,\n newValue: newValue\n });\n }\n }\n return changed;\n };\n _proto.computeValue_ = function computeValue_(track) {\n this.isComputing = true;\n // don't allow state changes during computation\n var prev = allowStateChangesStart(false);\n var res;\n if (track) {\n res = trackDerivedFunction(this, this.derivation, this.scope_);\n } else {\n if (globalState.disableErrorBoundaries === true) {\n res = this.derivation.call(this.scope_);\n } else {\n try {\n res = this.derivation.call(this.scope_);\n } catch (e) {\n res = new CaughtException(e);\n }\n }\n }\n allowStateChangesEnd(prev);\n this.isComputing = false;\n return res;\n };\n _proto.suspend_ = function suspend_() {\n if (!this.keepAlive_) {\n clearObserving(this);\n this.value_ = undefined; // don't hold on to computed value!\n if ( true && this.isTracing_ !== TraceMode.NONE) {\n console.log(\"[mobx.trace] Computed value '\" + this.name_ + \"' was suspended and it will recompute on the next access.\");\n }\n }\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n var _this = this;\n var firstTime = true;\n var prevValue = undefined;\n return autorun(function () {\n // TODO: why is this in a different place than the spyReport() function? in all other observables it's called in the same place\n var newValue = _this.get();\n if (!firstTime || fireImmediately) {\n var prevU = untrackedStart();\n listener({\n observableKind: \"computed\",\n debugObjectName: _this.name_,\n type: UPDATE,\n object: _this,\n newValue: newValue,\n oldValue: prevValue\n });\n untrackedEnd(prevU);\n }\n firstTime = false;\n prevValue = newValue;\n });\n };\n _proto.warnAboutUntrackedRead_ = function warnAboutUntrackedRead_() {\n if (false) {}\n if (this.isTracing_ !== TraceMode.NONE) {\n console.log(\"[mobx.trace] Computed value '\" + this.name_ + \"' is being read outside a reactive context. Doing a full recompute.\");\n }\n if (typeof this.requiresReaction_ === \"boolean\" ? this.requiresReaction_ : globalState.computedRequiresReaction) {\n console.warn(\"[mobx] Computed value '\" + this.name_ + \"' is being read outside a reactive context. Doing a full recompute.\");\n }\n };\n _proto.toString = function toString() {\n return this.name_ + \"[\" + this.derivation.toString() + \"]\";\n };\n _proto.valueOf = function valueOf() {\n return toPrimitive(this.get());\n };\n _proto[Symbol.toPrimitive] = function () {\n return this.valueOf();\n };\n return _createClass(ComputedValue, [{\n key: \"isComputing\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isComputingMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isComputingMask_, newValue);\n }\n }, {\n key: \"isRunningSetter\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isRunningSetterMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isRunningSetterMask_, newValue);\n }\n }, {\n key: \"isBeingObserved\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isBeingObservedMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isBeingObservedMask_, newValue);\n }\n }, {\n key: \"isPendingUnobservation\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.isPendingUnobservationMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isPendingUnobservationMask_, newValue);\n }\n }, {\n key: \"diffValue\",\n get: function get() {\n return getFlag(this.flags_, ComputedValue.diffValueMask_) ? 1 : 0;\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, ComputedValue.diffValueMask_, newValue === 1 ? true : false);\n }\n }]);\n}();\nComputedValue.isComputingMask_ = 1;\nComputedValue.isRunningSetterMask_ = 2;\nComputedValue.isBeingObservedMask_ = 4;\nComputedValue.isPendingUnobservationMask_ = 8;\nComputedValue.diffValueMask_ = 16;\nvar isComputedValue = /*#__PURE__*/createInstanceofPredicate(\"ComputedValue\", ComputedValue);\n\nvar IDerivationState_;\n(function (IDerivationState_) {\n // before being run or (outside batch and not being observed)\n // at this point derivation is not holding any data about dependency tree\n IDerivationState_[IDerivationState_[\"NOT_TRACKING_\"] = -1] = \"NOT_TRACKING_\";\n // no shallow dependency changed since last computation\n // won't recalculate derivation\n // this is what makes mobx fast\n IDerivationState_[IDerivationState_[\"UP_TO_DATE_\"] = 0] = \"UP_TO_DATE_\";\n // some deep dependency changed, but don't know if shallow dependency changed\n // will require to check first if UP_TO_DATE or POSSIBLY_STALE\n // currently only ComputedValue will propagate POSSIBLY_STALE\n //\n // having this state is second big optimization:\n // don't have to recompute on every dependency change, but only when it's needed\n IDerivationState_[IDerivationState_[\"POSSIBLY_STALE_\"] = 1] = \"POSSIBLY_STALE_\";\n // A shallow dependency has changed since last computation and the derivation\n // will need to recompute when it's needed next.\n IDerivationState_[IDerivationState_[\"STALE_\"] = 2] = \"STALE_\";\n})(IDerivationState_ || (IDerivationState_ = {}));\nvar TraceMode;\n(function (TraceMode) {\n TraceMode[TraceMode[\"NONE\"] = 0] = \"NONE\";\n TraceMode[TraceMode[\"LOG\"] = 1] = \"LOG\";\n TraceMode[TraceMode[\"BREAK\"] = 2] = \"BREAK\";\n})(TraceMode || (TraceMode = {}));\nvar CaughtException = function CaughtException(cause) {\n this.cause = void 0;\n this.cause = cause;\n // Empty\n};\nfunction isCaughtException(e) {\n return e instanceof CaughtException;\n}\n/**\n * Finds out whether any dependency of the derivation has actually changed.\n * If dependenciesState is 1 then it will recalculate dependencies,\n * if any dependency changed it will propagate it by changing dependenciesState to 2.\n *\n * By iterating over the dependencies in the same order that they were reported and\n * stopping on the first change, all the recalculations are only called for ComputedValues\n * that will be tracked by derivation. That is because we assume that if the first x\n * dependencies of the derivation doesn't change then the derivation should run the same way\n * up until accessing x-th dependency.\n */\nfunction shouldCompute(derivation) {\n switch (derivation.dependenciesState_) {\n case IDerivationState_.UP_TO_DATE_:\n return false;\n case IDerivationState_.NOT_TRACKING_:\n case IDerivationState_.STALE_:\n return true;\n case IDerivationState_.POSSIBLY_STALE_:\n {\n // state propagation can occur outside of action/reactive context #2195\n var prevAllowStateReads = allowStateReadsStart(true);\n var prevUntracked = untrackedStart(); // no need for those computeds to be reported, they will be picked up in trackDerivedFunction.\n var obs = derivation.observing_,\n l = obs.length;\n for (var i = 0; i < l; i++) {\n var obj = obs[i];\n if (isComputedValue(obj)) {\n if (globalState.disableErrorBoundaries) {\n obj.get();\n } else {\n try {\n obj.get();\n } catch (e) {\n // we are not interested in the value *or* exception at this moment, but if there is one, notify all\n untrackedEnd(prevUntracked);\n allowStateReadsEnd(prevAllowStateReads);\n return true;\n }\n }\n // if ComputedValue `obj` actually changed it will be computed and propagated to its observers.\n // and `derivation` is an observer of `obj`\n // invariantShouldCompute(derivation)\n if (derivation.dependenciesState_ === IDerivationState_.STALE_) {\n untrackedEnd(prevUntracked);\n allowStateReadsEnd(prevAllowStateReads);\n return true;\n }\n }\n }\n changeDependenciesStateTo0(derivation);\n untrackedEnd(prevUntracked);\n allowStateReadsEnd(prevAllowStateReads);\n return false;\n }\n }\n}\nfunction isComputingDerivation() {\n return globalState.trackingDerivation !== null; // filter out actions inside computations\n}\nfunction checkIfStateModificationsAreAllowed(atom) {\n if (false) {}\n var hasObservers = atom.observers_.size > 0;\n // Should not be possible to change observed state outside strict mode, except during initialization, see #563\n if (!globalState.allowStateChanges && (hasObservers || globalState.enforceActions === \"always\")) {\n console.warn(\"[MobX] \" + (globalState.enforceActions ? \"Since strict-mode is enabled, changing (observed) observable values without using an action is not allowed. Tried to modify: \" : \"Side effects like changing state are not allowed at this point. Are you trying to modify state from, for example, a computed value or the render function of a React component? You can wrap side effects in 'runInAction' (or decorate functions with 'action') if needed. Tried to modify: \") + atom.name_);\n }\n}\nfunction checkIfStateReadsAreAllowed(observable) {\n if ( true && !globalState.allowStateReads && globalState.observableRequiresReaction) {\n console.warn(\"[mobx] Observable '\" + observable.name_ + \"' being read outside a reactive context.\");\n }\n}\n/**\n * Executes the provided function `f` and tracks which observables are being accessed.\n * The tracking information is stored on the `derivation` object and the derivation is registered\n * as observer of any of the accessed observables.\n */\nfunction trackDerivedFunction(derivation, f, context) {\n var prevAllowStateReads = allowStateReadsStart(true);\n changeDependenciesStateTo0(derivation);\n // Preallocate array; will be trimmed by bindDependencies.\n derivation.newObserving_ = new Array(\n // Reserve constant space for initial dependencies, dynamic space otherwise.\n // See https://github.com/mobxjs/mobx/pull/3833\n derivation.runId_ === 0 ? 100 : derivation.observing_.length);\n derivation.unboundDepsCount_ = 0;\n derivation.runId_ = ++globalState.runId;\n var prevTracking = globalState.trackingDerivation;\n globalState.trackingDerivation = derivation;\n globalState.inBatch++;\n var result;\n if (globalState.disableErrorBoundaries === true) {\n result = f.call(context);\n } else {\n try {\n result = f.call(context);\n } catch (e) {\n result = new CaughtException(e);\n }\n }\n globalState.inBatch--;\n globalState.trackingDerivation = prevTracking;\n bindDependencies(derivation);\n warnAboutDerivationWithoutDependencies(derivation);\n allowStateReadsEnd(prevAllowStateReads);\n return result;\n}\nfunction warnAboutDerivationWithoutDependencies(derivation) {\n if (false) {}\n if (derivation.observing_.length !== 0) {\n return;\n }\n if (typeof derivation.requiresObservable_ === \"boolean\" ? derivation.requiresObservable_ : globalState.reactionRequiresObservable) {\n console.warn(\"[mobx] Derivation '\" + derivation.name_ + \"' is created/updated without reading any observable value.\");\n }\n}\n/**\n * diffs newObserving with observing.\n * update observing to be newObserving with unique observables\n * notify observers that become observed/unobserved\n */\nfunction bindDependencies(derivation) {\n // invariant(derivation.dependenciesState !== IDerivationState.NOT_TRACKING, \"INTERNAL ERROR bindDependencies expects derivation.dependenciesState !== -1\");\n var prevObserving = derivation.observing_;\n var observing = derivation.observing_ = derivation.newObserving_;\n var lowestNewObservingDerivationState = IDerivationState_.UP_TO_DATE_;\n // Go through all new observables and check diffValue: (this list can contain duplicates):\n // 0: first occurrence, change to 1 and keep it\n // 1: extra occurrence, drop it\n var i0 = 0,\n l = derivation.unboundDepsCount_;\n for (var i = 0; i < l; i++) {\n var dep = observing[i];\n if (dep.diffValue === 0) {\n dep.diffValue = 1;\n if (i0 !== i) {\n observing[i0] = dep;\n }\n i0++;\n }\n // Upcast is 'safe' here, because if dep is IObservable, `dependenciesState` will be undefined,\n // not hitting the condition\n if (dep.dependenciesState_ > lowestNewObservingDerivationState) {\n lowestNewObservingDerivationState = dep.dependenciesState_;\n }\n }\n observing.length = i0;\n derivation.newObserving_ = null; // newObserving shouldn't be needed outside tracking (statement moved down to work around FF bug, see #614)\n // Go through all old observables and check diffValue: (it is unique after last bindDependencies)\n // 0: it's not in new observables, unobserve it\n // 1: it keeps being observed, don't want to notify it. change to 0\n l = prevObserving.length;\n while (l--) {\n var _dep = prevObserving[l];\n if (_dep.diffValue === 0) {\n removeObserver(_dep, derivation);\n }\n _dep.diffValue = 0;\n }\n // Go through all new observables and check diffValue: (now it should be unique)\n // 0: it was set to 0 in last loop. don't need to do anything.\n // 1: it wasn't observed, let's observe it. set back to 0\n while (i0--) {\n var _dep2 = observing[i0];\n if (_dep2.diffValue === 1) {\n _dep2.diffValue = 0;\n addObserver(_dep2, derivation);\n }\n }\n // Some new observed derivations may become stale during this derivation computation\n // so they have had no chance to propagate staleness (#916)\n if (lowestNewObservingDerivationState !== IDerivationState_.UP_TO_DATE_) {\n derivation.dependenciesState_ = lowestNewObservingDerivationState;\n derivation.onBecomeStale_();\n }\n}\nfunction clearObserving(derivation) {\n // invariant(globalState.inBatch > 0, \"INTERNAL ERROR clearObserving should be called only inside batch\");\n var obs = derivation.observing_;\n derivation.observing_ = [];\n var i = obs.length;\n while (i--) {\n removeObserver(obs[i], derivation);\n }\n derivation.dependenciesState_ = IDerivationState_.NOT_TRACKING_;\n}\nfunction untracked(action) {\n var prev = untrackedStart();\n try {\n return action();\n } finally {\n untrackedEnd(prev);\n }\n}\nfunction untrackedStart() {\n var prev = globalState.trackingDerivation;\n globalState.trackingDerivation = null;\n return prev;\n}\nfunction untrackedEnd(prev) {\n globalState.trackingDerivation = prev;\n}\nfunction allowStateReadsStart(allowStateReads) {\n var prev = globalState.allowStateReads;\n globalState.allowStateReads = allowStateReads;\n return prev;\n}\nfunction allowStateReadsEnd(prev) {\n globalState.allowStateReads = prev;\n}\n/**\n * needed to keep `lowestObserverState` correct. when changing from (2 or 1) to 0\n *\n */\nfunction changeDependenciesStateTo0(derivation) {\n if (derivation.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {\n return;\n }\n derivation.dependenciesState_ = IDerivationState_.UP_TO_DATE_;\n var obs = derivation.observing_;\n var i = obs.length;\n while (i--) {\n obs[i].lowestObserverState_ = IDerivationState_.UP_TO_DATE_;\n }\n}\n\n/**\n * These values will persist if global state is reset\n */\nvar persistentKeys = [\"mobxGuid\", \"spyListeners\", \"enforceActions\", \"computedRequiresReaction\", \"reactionRequiresObservable\", \"observableRequiresReaction\", \"allowStateReads\", \"disableErrorBoundaries\", \"runId\", \"UNCHANGED\", \"useProxies\"];\nvar MobXGlobals = function MobXGlobals() {\n /**\n * MobXGlobals version.\n * MobX compatiblity with other versions loaded in memory as long as this version matches.\n * It indicates that the global state still stores similar information\n *\n * N.B: this version is unrelated to the package version of MobX, and is only the version of the\n * internal state storage of MobX, and can be the same across many different package versions\n */\n this.version = 6;\n /**\n * globally unique token to signal unchanged\n */\n this.UNCHANGED = {};\n /**\n * Currently running derivation\n */\n this.trackingDerivation = null;\n /**\n * Currently running reaction. This determines if we currently have a reactive context.\n * (Tracking derivation is also set for temporal tracking of computed values inside actions,\n * but trackingReaction can only be set by a form of Reaction)\n */\n this.trackingContext = null;\n /**\n * Each time a derivation is tracked, it is assigned a unique run-id\n */\n this.runId = 0;\n /**\n * 'guid' for general purpose. Will be persisted amongst resets.\n */\n this.mobxGuid = 0;\n /**\n * Are we in a batch block? (and how many of them)\n */\n this.inBatch = 0;\n /**\n * Observables that don't have observers anymore, and are about to be\n * suspended, unless somebody else accesses it in the same batch\n *\n * @type {IObservable[]}\n */\n this.pendingUnobservations = [];\n /**\n * List of scheduled, not yet executed, reactions.\n */\n this.pendingReactions = [];\n /**\n * Are we currently processing reactions?\n */\n this.isRunningReactions = false;\n /**\n * Is it allowed to change observables at this point?\n * In general, MobX doesn't allow that when running computations and React.render.\n * To ensure that those functions stay pure.\n */\n this.allowStateChanges = false;\n /**\n * Is it allowed to read observables at this point?\n * Used to hold the state needed for `observableRequiresReaction`\n */\n this.allowStateReads = true;\n /**\n * If strict mode is enabled, state changes are by default not allowed\n */\n this.enforceActions = true;\n /**\n * Spy callbacks\n */\n this.spyListeners = [];\n /**\n * Globally attached error handlers that react specifically to errors in reactions\n */\n this.globalReactionErrorHandlers = [];\n /**\n * Warn if computed values are accessed outside a reactive context\n */\n this.computedRequiresReaction = false;\n /**\n * (Experimental)\n * Warn if you try to create to derivation / reactive context without accessing any observable.\n */\n this.reactionRequiresObservable = false;\n /**\n * (Experimental)\n * Warn if observables are accessed outside a reactive context\n */\n this.observableRequiresReaction = false;\n /*\n * Don't catch and rethrow exceptions. This is useful for inspecting the state of\n * the stack when an exception occurs while debugging.\n */\n this.disableErrorBoundaries = false;\n /*\n * If true, we are already handling an exception in an action. Any errors in reactions should be suppressed, as\n * they are not the cause, see: https://github.com/mobxjs/mobx/issues/1836\n */\n this.suppressReactionErrors = false;\n this.useProxies = true;\n /*\n * print warnings about code that would fail if proxies weren't available\n */\n this.verifyProxies = false;\n /**\n * False forces all object's descriptors to\n * writable: true\n * configurable: true\n */\n this.safeDescriptors = true;\n};\nvar canMergeGlobalState = true;\nvar isolateCalled = false;\nvar globalState = /*#__PURE__*/function () {\n var global = /*#__PURE__*/getGlobal();\n if (global.__mobxInstanceCount > 0 && !global.__mobxGlobals) {\n canMergeGlobalState = false;\n }\n if (global.__mobxGlobals && global.__mobxGlobals.version !== new MobXGlobals().version) {\n canMergeGlobalState = false;\n }\n if (!canMergeGlobalState) {\n // Because this is a IIFE we need to let isolateCalled a chance to change\n // so we run it after the event loop completed at least 1 iteration\n setTimeout(function () {\n if (!isolateCalled) {\n die(35);\n }\n }, 1);\n return new MobXGlobals();\n } else if (global.__mobxGlobals) {\n global.__mobxInstanceCount += 1;\n if (!global.__mobxGlobals.UNCHANGED) {\n global.__mobxGlobals.UNCHANGED = {};\n } // make merge backward compatible\n return global.__mobxGlobals;\n } else {\n global.__mobxInstanceCount = 1;\n return global.__mobxGlobals = /*#__PURE__*/new MobXGlobals();\n }\n}();\nfunction isolateGlobalState() {\n if (globalState.pendingReactions.length || globalState.inBatch || globalState.isRunningReactions) {\n die(36);\n }\n isolateCalled = true;\n if (canMergeGlobalState) {\n var global = getGlobal();\n if (--global.__mobxInstanceCount === 0) {\n global.__mobxGlobals = undefined;\n }\n globalState = new MobXGlobals();\n }\n}\nfunction getGlobalState() {\n return globalState;\n}\n/**\n * For testing purposes only; this will break the internal state of existing observables,\n * but can be used to get back at a stable state after throwing errors\n */\nfunction resetGlobalState() {\n var defaultGlobals = new MobXGlobals();\n for (var key in defaultGlobals) {\n if (persistentKeys.indexOf(key) === -1) {\n globalState[key] = defaultGlobals[key];\n }\n }\n globalState.allowStateChanges = !globalState.enforceActions;\n}\n\nfunction hasObservers(observable) {\n return observable.observers_ && observable.observers_.size > 0;\n}\nfunction getObservers(observable) {\n return observable.observers_;\n}\n// function invariantObservers(observable: IObservable) {\n// const list = observable.observers\n// const map = observable.observersIndexes\n// const l = list.length\n// for (let i = 0; i < l; i++) {\n// const id = list[i].__mapid\n// if (i) {\n// invariant(map[id] === i, \"INTERNAL ERROR maps derivation.__mapid to index in list\") // for performance\n// } else {\n// invariant(!(id in map), \"INTERNAL ERROR observer on index 0 shouldn't be held in map.\") // for performance\n// }\n// }\n// invariant(\n// list.length === 0 || Object.keys(map).length === list.length - 1,\n// \"INTERNAL ERROR there is no junk in map\"\n// )\n// }\nfunction addObserver(observable, node) {\n // invariant(node.dependenciesState !== -1, \"INTERNAL ERROR, can add only dependenciesState !== -1\");\n // invariant(observable._observers.indexOf(node) === -1, \"INTERNAL ERROR add already added node\");\n // invariantObservers(observable);\n observable.observers_.add(node);\n if (observable.lowestObserverState_ > node.dependenciesState_) {\n observable.lowestObserverState_ = node.dependenciesState_;\n }\n // invariantObservers(observable);\n // invariant(observable._observers.indexOf(node) !== -1, \"INTERNAL ERROR didn't add node\");\n}\nfunction removeObserver(observable, node) {\n // invariant(globalState.inBatch > 0, \"INTERNAL ERROR, remove should be called only inside batch\");\n // invariant(observable._observers.indexOf(node) !== -1, \"INTERNAL ERROR remove already removed node\");\n // invariantObservers(observable);\n observable.observers_[\"delete\"](node);\n if (observable.observers_.size === 0) {\n // deleting last observer\n queueForUnobservation(observable);\n }\n // invariantObservers(observable);\n // invariant(observable._observers.indexOf(node) === -1, \"INTERNAL ERROR remove already removed node2\");\n}\nfunction queueForUnobservation(observable) {\n if (observable.isPendingUnobservation === false) {\n // invariant(observable._observers.length === 0, \"INTERNAL ERROR, should only queue for unobservation unobserved observables\");\n observable.isPendingUnobservation = true;\n globalState.pendingUnobservations.push(observable);\n }\n}\n/**\n * Batch starts a transaction, at least for purposes of memoizing ComputedValues when nothing else does.\n * During a batch `onBecomeUnobserved` will be called at most once per observable.\n * Avoids unnecessary recalculations.\n */\nfunction startBatch() {\n globalState.inBatch++;\n}\nfunction endBatch() {\n if (--globalState.inBatch === 0) {\n runReactions();\n // the batch is actually about to finish, all unobserving should happen here.\n var list = globalState.pendingUnobservations;\n for (var i = 0; i < list.length; i++) {\n var observable = list[i];\n observable.isPendingUnobservation = false;\n if (observable.observers_.size === 0) {\n if (observable.isBeingObserved) {\n // if this observable had reactive observers, trigger the hooks\n observable.isBeingObserved = false;\n observable.onBUO();\n }\n if (observable instanceof ComputedValue) {\n // computed values are automatically teared down when the last observer leaves\n // this process happens recursively, this computed might be the last observabe of another, etc..\n observable.suspend_();\n }\n }\n }\n globalState.pendingUnobservations = [];\n }\n}\nfunction reportObserved(observable) {\n checkIfStateReadsAreAllowed(observable);\n var derivation = globalState.trackingDerivation;\n if (derivation !== null) {\n /**\n * Simple optimization, give each derivation run an unique id (runId)\n * Check if last time this observable was accessed the same runId is used\n * if this is the case, the relation is already known\n */\n if (derivation.runId_ !== observable.lastAccessedBy_) {\n observable.lastAccessedBy_ = derivation.runId_;\n // Tried storing newObserving, or observing, or both as Set, but performance didn't come close...\n derivation.newObserving_[derivation.unboundDepsCount_++] = observable;\n if (!observable.isBeingObserved && globalState.trackingContext) {\n observable.isBeingObserved = true;\n observable.onBO();\n }\n }\n return observable.isBeingObserved;\n } else if (observable.observers_.size === 0 && globalState.inBatch > 0) {\n queueForUnobservation(observable);\n }\n return false;\n}\n// function invariantLOS(observable: IObservable, msg: string) {\n// // it's expensive so better not run it in produciton. but temporarily helpful for testing\n// const min = getObservers(observable).reduce((a, b) => Math.min(a, b.dependenciesState), 2)\n// if (min >= observable.lowestObserverState) return // <- the only assumption about `lowestObserverState`\n// throw new Error(\n// \"lowestObserverState is wrong for \" +\n// msg +\n// \" because \" +\n// min +\n// \" < \" +\n// observable.lowestObserverState\n// )\n// }\n/**\n * NOTE: current propagation mechanism will in case of self reruning autoruns behave unexpectedly\n * It will propagate changes to observers from previous run\n * It's hard or maybe impossible (with reasonable perf) to get it right with current approach\n * Hopefully self reruning autoruns aren't a feature people should depend on\n * Also most basic use cases should be ok\n */\n// Called by Atom when its value changes\nfunction propagateChanged(observable) {\n // invariantLOS(observable, \"changed start\");\n if (observable.lowestObserverState_ === IDerivationState_.STALE_) {\n return;\n }\n observable.lowestObserverState_ = IDerivationState_.STALE_;\n // Ideally we use for..of here, but the downcompiled version is really slow...\n observable.observers_.forEach(function (d) {\n if (d.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {\n if ( true && d.isTracing_ !== TraceMode.NONE) {\n logTraceInfo(d, observable);\n }\n d.onBecomeStale_();\n }\n d.dependenciesState_ = IDerivationState_.STALE_;\n });\n // invariantLOS(observable, \"changed end\");\n}\n// Called by ComputedValue when it recalculate and its value changed\nfunction propagateChangeConfirmed(observable) {\n // invariantLOS(observable, \"confirmed start\");\n if (observable.lowestObserverState_ === IDerivationState_.STALE_) {\n return;\n }\n observable.lowestObserverState_ = IDerivationState_.STALE_;\n observable.observers_.forEach(function (d) {\n if (d.dependenciesState_ === IDerivationState_.POSSIBLY_STALE_) {\n d.dependenciesState_ = IDerivationState_.STALE_;\n if ( true && d.isTracing_ !== TraceMode.NONE) {\n logTraceInfo(d, observable);\n }\n } else if (d.dependenciesState_ === IDerivationState_.UP_TO_DATE_ // this happens during computing of `d`, just keep lowestObserverState up to date.\n ) {\n observable.lowestObserverState_ = IDerivationState_.UP_TO_DATE_;\n }\n });\n // invariantLOS(observable, \"confirmed end\");\n}\n// Used by computed when its dependency changed, but we don't wan't to immediately recompute.\nfunction propagateMaybeChanged(observable) {\n // invariantLOS(observable, \"maybe start\");\n if (observable.lowestObserverState_ !== IDerivationState_.UP_TO_DATE_) {\n return;\n }\n observable.lowestObserverState_ = IDerivationState_.POSSIBLY_STALE_;\n observable.observers_.forEach(function (d) {\n if (d.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {\n d.dependenciesState_ = IDerivationState_.POSSIBLY_STALE_;\n d.onBecomeStale_();\n }\n });\n // invariantLOS(observable, \"maybe end\");\n}\nfunction logTraceInfo(derivation, observable) {\n console.log(\"[mobx.trace] '\" + derivation.name_ + \"' is invalidated due to a change in: '\" + observable.name_ + \"'\");\n if (derivation.isTracing_ === TraceMode.BREAK) {\n var lines = [];\n printDepTree(getDependencyTree(derivation), lines, 1);\n // prettier-ignore\n new Function(\"debugger;\\n/*\\nTracing '\" + derivation.name_ + \"'\\n\\nYou are entering this break point because derivation '\" + derivation.name_ + \"' is being traced and '\" + observable.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\" + (derivation instanceof ComputedValue ? derivation.derivation.toString().replace(/[*]\\//g, \"/\") : \"\") + \"\\n\\nThe dependencies for this derivation are:\\n\\n\" + lines.join(\"\\n\") + \"\\n*/\\n \")();\n }\n}\nfunction printDepTree(tree, lines, depth) {\n if (lines.length >= 1000) {\n lines.push(\"(and many more)\");\n return;\n }\n lines.push(\"\" + \"\\t\".repeat(depth - 1) + tree.name);\n if (tree.dependencies) {\n tree.dependencies.forEach(function (child) {\n return printDepTree(child, lines, depth + 1);\n });\n }\n}\n\nvar Reaction = /*#__PURE__*/function () {\n function Reaction(name_, onInvalidate_, errorHandler_, requiresObservable_) {\n if (name_ === void 0) {\n name_ = true ? \"Reaction@\" + getNextId() : 0;\n }\n this.name_ = void 0;\n this.onInvalidate_ = void 0;\n this.errorHandler_ = void 0;\n this.requiresObservable_ = void 0;\n this.observing_ = [];\n // nodes we are looking at. Our value depends on these nodes\n this.newObserving_ = [];\n this.dependenciesState_ = IDerivationState_.NOT_TRACKING_;\n this.runId_ = 0;\n this.unboundDepsCount_ = 0;\n this.flags_ = 0;\n this.isTracing_ = TraceMode.NONE;\n this.name_ = name_;\n this.onInvalidate_ = onInvalidate_;\n this.errorHandler_ = errorHandler_;\n this.requiresObservable_ = requiresObservable_;\n }\n var _proto = Reaction.prototype;\n _proto.onBecomeStale_ = function onBecomeStale_() {\n this.schedule_();\n };\n _proto.schedule_ = function schedule_() {\n if (!this.isScheduled) {\n this.isScheduled = true;\n globalState.pendingReactions.push(this);\n runReactions();\n }\n }\n /**\n * internal, use schedule() if you intend to kick off a reaction\n */;\n _proto.runReaction_ = function runReaction_() {\n if (!this.isDisposed) {\n startBatch();\n this.isScheduled = false;\n var prev = globalState.trackingContext;\n globalState.trackingContext = this;\n if (shouldCompute(this)) {\n this.isTrackPending = true;\n try {\n this.onInvalidate_();\n if ( true && this.isTrackPending && isSpyEnabled()) {\n // onInvalidate didn't trigger track right away..\n spyReport({\n name: this.name_,\n type: \"scheduled-reaction\"\n });\n }\n } catch (e) {\n this.reportExceptionInDerivation_(e);\n }\n }\n globalState.trackingContext = prev;\n endBatch();\n }\n };\n _proto.track = function track(fn) {\n if (this.isDisposed) {\n return;\n // console.warn(\"Reaction already disposed\") // Note: Not a warning / error in mobx 4 either\n }\n startBatch();\n var notify = isSpyEnabled();\n var startTime;\n if ( true && notify) {\n startTime = Date.now();\n spyReportStart({\n name: this.name_,\n type: \"reaction\"\n });\n }\n this.isRunning = true;\n var prevReaction = globalState.trackingContext; // reactions could create reactions...\n globalState.trackingContext = this;\n var result = trackDerivedFunction(this, fn, undefined);\n globalState.trackingContext = prevReaction;\n this.isRunning = false;\n this.isTrackPending = false;\n if (this.isDisposed) {\n // disposed during last run. Clean up everything that was bound after the dispose call.\n clearObserving(this);\n }\n if (isCaughtException(result)) {\n this.reportExceptionInDerivation_(result.cause);\n }\n if ( true && notify) {\n spyReportEnd({\n time: Date.now() - startTime\n });\n }\n endBatch();\n };\n _proto.reportExceptionInDerivation_ = function reportExceptionInDerivation_(error) {\n var _this = this;\n if (this.errorHandler_) {\n this.errorHandler_(error, this);\n return;\n }\n if (globalState.disableErrorBoundaries) {\n throw error;\n }\n var message = true ? \"[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '\" + this + \"'\" : 0;\n if (!globalState.suppressReactionErrors) {\n console.error(message, error);\n /** If debugging brought you here, please, read the above message :-). Tnx! */\n } else if (true) {\n console.warn(\"[mobx] (error in reaction '\" + this.name_ + \"' suppressed, fix error of causing action below)\");\n } // prettier-ignore\n if ( true && isSpyEnabled()) {\n spyReport({\n type: \"error\",\n name: this.name_,\n message: message,\n error: \"\" + error\n });\n }\n globalState.globalReactionErrorHandlers.forEach(function (f) {\n return f(error, _this);\n });\n };\n _proto.dispose = function dispose() {\n if (!this.isDisposed) {\n this.isDisposed = true;\n if (!this.isRunning) {\n // if disposed while running, clean up later. Maybe not optimal, but rare case\n startBatch();\n clearObserving(this);\n endBatch();\n }\n }\n };\n _proto.getDisposer_ = function getDisposer_(abortSignal) {\n var _this2 = this;\n var dispose = function dispose() {\n _this2.dispose();\n abortSignal == null || abortSignal.removeEventListener == null || abortSignal.removeEventListener(\"abort\", dispose);\n };\n abortSignal == null || abortSignal.addEventListener == null || abortSignal.addEventListener(\"abort\", dispose);\n dispose[$mobx] = this;\n return dispose;\n };\n _proto.toString = function toString() {\n return \"Reaction[\" + this.name_ + \"]\";\n };\n _proto.trace = function trace$1(enterBreakPoint) {\n if (enterBreakPoint === void 0) {\n enterBreakPoint = false;\n }\n trace(this, enterBreakPoint);\n };\n return _createClass(Reaction, [{\n key: \"isDisposed\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isDisposedMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isDisposedMask_, newValue);\n }\n }, {\n key: \"isScheduled\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isScheduledMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isScheduledMask_, newValue);\n }\n }, {\n key: \"isTrackPending\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isTrackPendingMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isTrackPendingMask_, newValue);\n }\n }, {\n key: \"isRunning\",\n get: function get() {\n return getFlag(this.flags_, Reaction.isRunningMask_);\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.isRunningMask_, newValue);\n }\n }, {\n key: \"diffValue\",\n get: function get() {\n return getFlag(this.flags_, Reaction.diffValueMask_) ? 1 : 0;\n },\n set: function set(newValue) {\n this.flags_ = setFlag(this.flags_, Reaction.diffValueMask_, newValue === 1 ? true : false);\n }\n }]);\n}();\nReaction.isDisposedMask_ = 1;\nReaction.isScheduledMask_ = 2;\nReaction.isTrackPendingMask_ = 4;\nReaction.isRunningMask_ = 8;\nReaction.diffValueMask_ = 16;\nfunction onReactionError(handler) {\n globalState.globalReactionErrorHandlers.push(handler);\n return function () {\n var idx = globalState.globalReactionErrorHandlers.indexOf(handler);\n if (idx >= 0) {\n globalState.globalReactionErrorHandlers.splice(idx, 1);\n }\n };\n}\n/**\n * Magic number alert!\n * Defines within how many times a reaction is allowed to re-trigger itself\n * until it is assumed that this is gonna be a never ending loop...\n */\nvar MAX_REACTION_ITERATIONS = 100;\nvar reactionScheduler = function reactionScheduler(f) {\n return f();\n};\nfunction runReactions() {\n // Trampolining, if runReactions are already running, new reactions will be picked up\n if (globalState.inBatch > 0 || globalState.isRunningReactions) {\n return;\n }\n reactionScheduler(runReactionsHelper);\n}\nfunction runReactionsHelper() {\n globalState.isRunningReactions = true;\n var allReactions = globalState.pendingReactions;\n var iterations = 0;\n // While running reactions, new reactions might be triggered.\n // Hence we work with two variables and check whether\n // we converge to no remaining reactions after a while.\n while (allReactions.length > 0) {\n if (++iterations === MAX_REACTION_ITERATIONS) {\n console.error( true ? \"Reaction doesn't converge to a stable state after \" + MAX_REACTION_ITERATIONS + \" iterations.\" + (\" Probably there is a cycle in the reactive function: \" + allReactions[0]) : 0);\n allReactions.splice(0); // clear reactions\n }\n var remainingReactions = allReactions.splice(0);\n for (var i = 0, l = remainingReactions.length; i < l; i++) {\n remainingReactions[i].runReaction_();\n }\n }\n globalState.isRunningReactions = false;\n}\nvar isReaction = /*#__PURE__*/createInstanceofPredicate(\"Reaction\", Reaction);\nfunction setReactionScheduler(fn) {\n var baseScheduler = reactionScheduler;\n reactionScheduler = function reactionScheduler(f) {\n return fn(function () {\n return baseScheduler(f);\n });\n };\n}\n\nfunction isSpyEnabled() {\n return true && !!globalState.spyListeners.length;\n}\nfunction spyReport(event) {\n if (false) {} // dead code elimination can do the rest\n if (!globalState.spyListeners.length) {\n return;\n }\n var listeners = globalState.spyListeners;\n for (var i = 0, l = listeners.length; i < l; i++) {\n listeners[i](event);\n }\n}\nfunction spyReportStart(event) {\n if (false) {}\n var change = _extends({}, event, {\n spyReportStart: true\n });\n spyReport(change);\n}\nvar END_EVENT = {\n type: \"report-end\",\n spyReportEnd: true\n};\nfunction spyReportEnd(change) {\n if (false) {}\n if (change) {\n spyReport(_extends({}, change, {\n type: \"report-end\",\n spyReportEnd: true\n }));\n } else {\n spyReport(END_EVENT);\n }\n}\nfunction spy(listener) {\n if (false) {} else {\n globalState.spyListeners.push(listener);\n return once(function () {\n globalState.spyListeners = globalState.spyListeners.filter(function (l) {\n return l !== listener;\n });\n });\n }\n}\n\nvar ACTION = \"action\";\nvar ACTION_BOUND = \"action.bound\";\nvar AUTOACTION = \"autoAction\";\nvar AUTOACTION_BOUND = \"autoAction.bound\";\nvar DEFAULT_ACTION_NAME = \"\";\nvar actionAnnotation = /*#__PURE__*/createActionAnnotation(ACTION);\nvar actionBoundAnnotation = /*#__PURE__*/createActionAnnotation(ACTION_BOUND, {\n bound: true\n});\nvar autoActionAnnotation = /*#__PURE__*/createActionAnnotation(AUTOACTION, {\n autoAction: true\n});\nvar autoActionBoundAnnotation = /*#__PURE__*/createActionAnnotation(AUTOACTION_BOUND, {\n autoAction: true,\n bound: true\n});\nfunction createActionFactory(autoAction) {\n var res = function action(arg1, arg2) {\n // action(fn() {})\n if (isFunction(arg1)) {\n return createAction(arg1.name || DEFAULT_ACTION_NAME, arg1, autoAction);\n }\n // action(\"name\", fn() {})\n if (isFunction(arg2)) {\n return createAction(arg1, arg2, autoAction);\n }\n // @action (2022.3 Decorators)\n if (is20223Decorator(arg2)) {\n return (autoAction ? autoActionAnnotation : actionAnnotation).decorate_20223_(arg1, arg2);\n }\n // @action\n if (isStringish(arg2)) {\n return storeAnnotation(arg1, arg2, autoAction ? autoActionAnnotation : actionAnnotation);\n }\n // action(\"name\") & @action(\"name\")\n if (isStringish(arg1)) {\n return createDecoratorAnnotation(createActionAnnotation(autoAction ? AUTOACTION : ACTION, {\n name: arg1,\n autoAction: autoAction\n }));\n }\n if (true) {\n die(\"Invalid arguments for `action`\");\n }\n };\n return res;\n}\nvar action = /*#__PURE__*/createActionFactory(false);\nObject.assign(action, actionAnnotation);\nvar autoAction = /*#__PURE__*/createActionFactory(true);\nObject.assign(autoAction, autoActionAnnotation);\naction.bound = /*#__PURE__*/createDecoratorAnnotation(actionBoundAnnotation);\nautoAction.bound = /*#__PURE__*/createDecoratorAnnotation(autoActionBoundAnnotation);\nfunction runInAction(fn) {\n return executeAction(fn.name || DEFAULT_ACTION_NAME, false, fn, this, undefined);\n}\nfunction isAction(thing) {\n return isFunction(thing) && thing.isMobxAction === true;\n}\n\n/**\n * Creates a named reactive view and keeps it alive, so that the view is always\n * updated if one of the dependencies changes, even when the view is not further used by something else.\n * @param view The reactive view\n * @returns disposer function, which can be used to stop the view from being updated in the future.\n */\nfunction autorun(view, opts) {\n var _opts$name, _opts, _opts2, _opts3;\n if (opts === void 0) {\n opts = EMPTY_OBJECT;\n }\n if (true) {\n if (!isFunction(view)) {\n die(\"Autorun expects a function as first argument\");\n }\n if (isAction(view)) {\n die(\"Autorun does not accept actions since actions are untrackable\");\n }\n }\n var name = (_opts$name = (_opts = opts) == null ? void 0 : _opts.name) != null ? _opts$name : true ? view.name || \"Autorun@\" + getNextId() : 0;\n var runSync = !opts.scheduler && !opts.delay;\n var reaction;\n if (runSync) {\n // normal autorun\n reaction = new Reaction(name, function () {\n this.track(reactionRunner);\n }, opts.onError, opts.requiresObservable);\n } else {\n var scheduler = createSchedulerFromOptions(opts);\n // debounced autorun\n var isScheduled = false;\n reaction = new Reaction(name, function () {\n if (!isScheduled) {\n isScheduled = true;\n scheduler(function () {\n isScheduled = false;\n if (!reaction.isDisposed) {\n reaction.track(reactionRunner);\n }\n });\n }\n }, opts.onError, opts.requiresObservable);\n }\n function reactionRunner() {\n view(reaction);\n }\n if (!((_opts2 = opts) != null && (_opts2 = _opts2.signal) != null && _opts2.aborted)) {\n reaction.schedule_();\n }\n return reaction.getDisposer_((_opts3 = opts) == null ? void 0 : _opts3.signal);\n}\nvar run = function run(f) {\n return f();\n};\nfunction createSchedulerFromOptions(opts) {\n return opts.scheduler ? opts.scheduler : opts.delay ? function (f) {\n return setTimeout(f, opts.delay);\n } : run;\n}\nfunction reaction(expression, effect, opts) {\n var _opts$name2, _opts4, _opts5;\n if (opts === void 0) {\n opts = EMPTY_OBJECT;\n }\n if (true) {\n if (!isFunction(expression) || !isFunction(effect)) {\n die(\"First and second argument to reaction should be functions\");\n }\n if (!isPlainObject(opts)) {\n die(\"Third argument of reactions should be an object\");\n }\n }\n var name = (_opts$name2 = opts.name) != null ? _opts$name2 : true ? \"Reaction@\" + getNextId() : 0;\n var effectAction = action(name, opts.onError ? wrapErrorHandler(opts.onError, effect) : effect);\n var runSync = !opts.scheduler && !opts.delay;\n var scheduler = createSchedulerFromOptions(opts);\n var firstTime = true;\n var isScheduled = false;\n var value;\n var equals = opts.compareStructural ? comparer.structural : opts.equals || comparer[\"default\"];\n var r = new Reaction(name, function () {\n if (firstTime || runSync) {\n reactionRunner();\n } else if (!isScheduled) {\n isScheduled = true;\n scheduler(reactionRunner);\n }\n }, opts.onError, opts.requiresObservable);\n function reactionRunner() {\n isScheduled = false;\n if (r.isDisposed) {\n return;\n }\n var changed = false;\n var oldValue = value;\n r.track(function () {\n var nextValue = allowStateChanges(false, function () {\n return expression(r);\n });\n changed = firstTime || !equals(value, nextValue);\n value = nextValue;\n });\n if (firstTime && opts.fireImmediately) {\n effectAction(value, oldValue, r);\n } else if (!firstTime && changed) {\n effectAction(value, oldValue, r);\n }\n firstTime = false;\n }\n if (!((_opts4 = opts) != null && (_opts4 = _opts4.signal) != null && _opts4.aborted)) {\n r.schedule_();\n }\n return r.getDisposer_((_opts5 = opts) == null ? void 0 : _opts5.signal);\n}\nfunction wrapErrorHandler(errorHandler, baseFn) {\n return function () {\n try {\n return baseFn.apply(this, arguments);\n } catch (e) {\n errorHandler.call(this, e);\n }\n };\n}\n\nvar ON_BECOME_OBSERVED = \"onBO\";\nvar ON_BECOME_UNOBSERVED = \"onBUO\";\nfunction onBecomeObserved(thing, arg2, arg3) {\n return interceptHook(ON_BECOME_OBSERVED, thing, arg2, arg3);\n}\nfunction onBecomeUnobserved(thing, arg2, arg3) {\n return interceptHook(ON_BECOME_UNOBSERVED, thing, arg2, arg3);\n}\nfunction interceptHook(hook, thing, arg2, arg3) {\n var atom = typeof arg3 === \"function\" ? getAtom(thing, arg2) : getAtom(thing);\n var cb = isFunction(arg3) ? arg3 : arg2;\n var listenersKey = hook + \"L\";\n if (atom[listenersKey]) {\n atom[listenersKey].add(cb);\n } else {\n atom[listenersKey] = new Set([cb]);\n }\n return function () {\n var hookListeners = atom[listenersKey];\n if (hookListeners) {\n hookListeners[\"delete\"](cb);\n if (hookListeners.size === 0) {\n delete atom[listenersKey];\n }\n }\n };\n}\n\nvar NEVER = \"never\";\nvar ALWAYS = \"always\";\nvar OBSERVED = \"observed\";\n// const IF_AVAILABLE = \"ifavailable\"\nfunction configure(options) {\n if (options.isolateGlobalState === true) {\n isolateGlobalState();\n }\n var useProxies = options.useProxies,\n enforceActions = options.enforceActions;\n if (useProxies !== undefined) {\n globalState.useProxies = useProxies === ALWAYS ? true : useProxies === NEVER ? false : typeof Proxy !== \"undefined\";\n }\n if (useProxies === \"ifavailable\") {\n globalState.verifyProxies = true;\n }\n if (enforceActions !== undefined) {\n var ea = enforceActions === ALWAYS ? ALWAYS : enforceActions === OBSERVED;\n globalState.enforceActions = ea;\n globalState.allowStateChanges = ea === true || ea === ALWAYS ? false : true;\n }\n [\"computedRequiresReaction\", \"reactionRequiresObservable\", \"observableRequiresReaction\", \"disableErrorBoundaries\", \"safeDescriptors\"].forEach(function (key) {\n if (key in options) {\n globalState[key] = !!options[key];\n }\n });\n globalState.allowStateReads = !globalState.observableRequiresReaction;\n if ( true && globalState.disableErrorBoundaries === true) {\n console.warn(\"WARNING: Debug feature only. MobX will NOT recover from errors when `disableErrorBoundaries` is enabled.\");\n }\n if (options.reactionScheduler) {\n setReactionScheduler(options.reactionScheduler);\n }\n}\n\nfunction extendObservable(target, properties, annotations, options) {\n if (true) {\n if (arguments.length > 4) {\n die(\"'extendObservable' expected 2-4 arguments\");\n }\n if (typeof target !== \"object\") {\n die(\"'extendObservable' expects an object as first argument\");\n }\n if (isObservableMap(target)) {\n die(\"'extendObservable' should not be used on maps, use map.merge instead\");\n }\n if (!isPlainObject(properties)) {\n die(\"'extendObservable' only accepts plain objects as second argument\");\n }\n if (isObservable(properties) || isObservable(annotations)) {\n die(\"Extending an object with another observable (object) is not supported\");\n }\n }\n // Pull descriptors first, so we don't have to deal with props added by administration ($mobx)\n var descriptors = getOwnPropertyDescriptors(properties);\n initObservable(function () {\n var adm = asObservableObject(target, options)[$mobx];\n ownKeys(descriptors).forEach(function (key) {\n adm.extend_(key, descriptors[key],\n // must pass \"undefined\" for { key: undefined }\n !annotations ? true : key in annotations ? annotations[key] : true);\n });\n });\n return target;\n}\n\nfunction getDependencyTree(thing, property) {\n return nodeToDependencyTree(getAtom(thing, property));\n}\nfunction nodeToDependencyTree(node) {\n var result = {\n name: node.name_\n };\n if (node.observing_ && node.observing_.length > 0) {\n result.dependencies = unique(node.observing_).map(nodeToDependencyTree);\n }\n return result;\n}\nfunction getObserverTree(thing, property) {\n return nodeToObserverTree(getAtom(thing, property));\n}\nfunction nodeToObserverTree(node) {\n var result = {\n name: node.name_\n };\n if (hasObservers(node)) {\n result.observers = Array.from(getObservers(node)).map(nodeToObserverTree);\n }\n return result;\n}\nfunction unique(list) {\n return Array.from(new Set(list));\n}\n\nvar generatorId = 0;\nfunction FlowCancellationError() {\n this.message = \"FLOW_CANCELLED\";\n}\nFlowCancellationError.prototype = /*#__PURE__*/Object.create(Error.prototype);\nfunction isFlowCancellationError(error) {\n return error instanceof FlowCancellationError;\n}\nvar flowAnnotation = /*#__PURE__*/createFlowAnnotation(\"flow\");\nvar flowBoundAnnotation = /*#__PURE__*/createFlowAnnotation(\"flow.bound\", {\n bound: true\n});\nvar flow = /*#__PURE__*/Object.assign(function flow(arg1, arg2) {\n // @flow (2022.3 Decorators)\n if (is20223Decorator(arg2)) {\n return flowAnnotation.decorate_20223_(arg1, arg2);\n }\n // @flow\n if (isStringish(arg2)) {\n return storeAnnotation(arg1, arg2, flowAnnotation);\n }\n // flow(fn)\n if ( true && arguments.length !== 1) {\n die(\"Flow expects single argument with generator function\");\n }\n var generator = arg1;\n var name = generator.name || \"\";\n // Implementation based on https://github.com/tj/co/blob/master/index.js\n var res = function res() {\n var ctx = this;\n var args = arguments;\n var runId = ++generatorId;\n var gen = action(name + \" - runid: \" + runId + \" - init\", generator).apply(ctx, args);\n var rejector;\n var pendingPromise = undefined;\n var promise = new Promise(function (resolve, reject) {\n var stepId = 0;\n rejector = reject;\n function onFulfilled(res) {\n pendingPromise = undefined;\n var ret;\n try {\n ret = action(name + \" - runid: \" + runId + \" - yield \" + stepId++, gen.next).call(gen, res);\n } catch (e) {\n return reject(e);\n }\n next(ret);\n }\n function onRejected(err) {\n pendingPromise = undefined;\n var ret;\n try {\n ret = action(name + \" - runid: \" + runId + \" - yield \" + stepId++, gen[\"throw\"]).call(gen, err);\n } catch (e) {\n return reject(e);\n }\n next(ret);\n }\n function next(ret) {\n if (isFunction(ret == null ? void 0 : ret.then)) {\n // an async iterator\n ret.then(next, reject);\n return;\n }\n if (ret.done) {\n return resolve(ret.value);\n }\n pendingPromise = Promise.resolve(ret.value);\n return pendingPromise.then(onFulfilled, onRejected);\n }\n onFulfilled(undefined); // kick off the process\n });\n promise.cancel = action(name + \" - runid: \" + runId + \" - cancel\", function () {\n try {\n if (pendingPromise) {\n cancelPromise(pendingPromise);\n }\n // Finally block can return (or yield) stuff..\n var _res = gen[\"return\"](undefined);\n // eat anything that promise would do, it's cancelled!\n var yieldedPromise = Promise.resolve(_res.value);\n yieldedPromise.then(noop, noop);\n cancelPromise(yieldedPromise); // maybe it can be cancelled :)\n // reject our original promise\n rejector(new FlowCancellationError());\n } catch (e) {\n rejector(e); // there could be a throwing finally block\n }\n });\n return promise;\n };\n res.isMobXFlow = true;\n return res;\n}, flowAnnotation);\nflow.bound = /*#__PURE__*/createDecoratorAnnotation(flowBoundAnnotation);\nfunction cancelPromise(promise) {\n if (isFunction(promise.cancel)) {\n promise.cancel();\n }\n}\nfunction flowResult(result) {\n return result; // just tricking TypeScript :)\n}\nfunction isFlow(fn) {\n return (fn == null ? void 0 : fn.isMobXFlow) === true;\n}\n\nfunction interceptReads(thing, propOrHandler, handler) {\n var target;\n if (isObservableMap(thing) || isObservableArray(thing) || isObservableValue(thing)) {\n target = getAdministration(thing);\n } else if (isObservableObject(thing)) {\n if ( true && !isStringish(propOrHandler)) {\n return die(\"InterceptReads can only be used with a specific property, not with an object in general\");\n }\n target = getAdministration(thing, propOrHandler);\n } else if (true) {\n return die(\"Expected observable map, object or array as first array\");\n }\n if ( true && target.dehancer !== undefined) {\n return die(\"An intercept reader was already established\");\n }\n target.dehancer = typeof propOrHandler === \"function\" ? propOrHandler : handler;\n return function () {\n target.dehancer = undefined;\n };\n}\n\nfunction intercept(thing, propOrHandler, handler) {\n if (isFunction(handler)) {\n return interceptProperty(thing, propOrHandler, handler);\n } else {\n return interceptInterceptable(thing, propOrHandler);\n }\n}\nfunction interceptInterceptable(thing, handler) {\n return getAdministration(thing).intercept_(handler);\n}\nfunction interceptProperty(thing, property, handler) {\n return getAdministration(thing, property).intercept_(handler);\n}\n\nfunction _isComputed(value, property) {\n if (property === undefined) {\n return isComputedValue(value);\n }\n if (isObservableObject(value) === false) {\n return false;\n }\n if (!value[$mobx].values_.has(property)) {\n return false;\n }\n var atom = getAtom(value, property);\n return isComputedValue(atom);\n}\nfunction isComputed(value) {\n if ( true && arguments.length > 1) {\n return die(\"isComputed expects only 1 argument. Use isComputedProp to inspect the observability of a property\");\n }\n return _isComputed(value);\n}\nfunction isComputedProp(value, propName) {\n if ( true && !isStringish(propName)) {\n return die(\"isComputed expected a property name as second argument\");\n }\n return _isComputed(value, propName);\n}\n\nfunction _isObservable(value, property) {\n if (!value) {\n return false;\n }\n if (property !== undefined) {\n if ( true && (isObservableMap(value) || isObservableArray(value))) {\n return die(\"isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead.\");\n }\n if (isObservableObject(value)) {\n return value[$mobx].values_.has(property);\n }\n return false;\n }\n // For first check, see #701\n return isObservableObject(value) || !!value[$mobx] || isAtom(value) || isReaction(value) || isComputedValue(value);\n}\nfunction isObservable(value) {\n if ( true && arguments.length !== 1) {\n die(\"isObservable expects only 1 argument. Use isObservableProp to inspect the observability of a property\");\n }\n return _isObservable(value);\n}\nfunction isObservableProp(value, propName) {\n if ( true && !isStringish(propName)) {\n return die(\"expected a property name as second argument\");\n }\n return _isObservable(value, propName);\n}\n\nfunction keys(obj) {\n if (isObservableObject(obj)) {\n return obj[$mobx].keys_();\n }\n if (isObservableMap(obj) || isObservableSet(obj)) {\n return Array.from(obj.keys());\n }\n if (isObservableArray(obj)) {\n return obj.map(function (_, index) {\n return index;\n });\n }\n die(5);\n}\nfunction values(obj) {\n if (isObservableObject(obj)) {\n return keys(obj).map(function (key) {\n return obj[key];\n });\n }\n if (isObservableMap(obj)) {\n return keys(obj).map(function (key) {\n return obj.get(key);\n });\n }\n if (isObservableSet(obj)) {\n return Array.from(obj.values());\n }\n if (isObservableArray(obj)) {\n return obj.slice();\n }\n die(6);\n}\nfunction entries(obj) {\n if (isObservableObject(obj)) {\n return keys(obj).map(function (key) {\n return [key, obj[key]];\n });\n }\n if (isObservableMap(obj)) {\n return keys(obj).map(function (key) {\n return [key, obj.get(key)];\n });\n }\n if (isObservableSet(obj)) {\n return Array.from(obj.entries());\n }\n if (isObservableArray(obj)) {\n return obj.map(function (key, index) {\n return [index, key];\n });\n }\n die(7);\n}\nfunction set(obj, key, value) {\n if (arguments.length === 2 && !isObservableSet(obj)) {\n startBatch();\n var _values = key;\n try {\n for (var _key in _values) {\n set(obj, _key, _values[_key]);\n }\n } finally {\n endBatch();\n }\n return;\n }\n if (isObservableObject(obj)) {\n obj[$mobx].set_(key, value);\n } else if (isObservableMap(obj)) {\n obj.set(key, value);\n } else if (isObservableSet(obj)) {\n obj.add(key);\n } else if (isObservableArray(obj)) {\n if (typeof key !== \"number\") {\n key = parseInt(key, 10);\n }\n if (key < 0) {\n die(\"Invalid index: '\" + key + \"'\");\n }\n startBatch();\n if (key >= obj.length) {\n obj.length = key + 1;\n }\n obj[key] = value;\n endBatch();\n } else {\n die(8);\n }\n}\nfunction remove(obj, key) {\n if (isObservableObject(obj)) {\n obj[$mobx].delete_(key);\n } else if (isObservableMap(obj)) {\n obj[\"delete\"](key);\n } else if (isObservableSet(obj)) {\n obj[\"delete\"](key);\n } else if (isObservableArray(obj)) {\n if (typeof key !== \"number\") {\n key = parseInt(key, 10);\n }\n obj.splice(key, 1);\n } else {\n die(9);\n }\n}\nfunction has(obj, key) {\n if (isObservableObject(obj)) {\n return obj[$mobx].has_(key);\n } else if (isObservableMap(obj)) {\n return obj.has(key);\n } else if (isObservableSet(obj)) {\n return obj.has(key);\n } else if (isObservableArray(obj)) {\n return key >= 0 && key < obj.length;\n }\n die(10);\n}\nfunction get(obj, key) {\n if (!has(obj, key)) {\n return undefined;\n }\n if (isObservableObject(obj)) {\n return obj[$mobx].get_(key);\n } else if (isObservableMap(obj)) {\n return obj.get(key);\n } else if (isObservableArray(obj)) {\n return obj[key];\n }\n die(11);\n}\nfunction apiDefineProperty(obj, key, descriptor) {\n if (isObservableObject(obj)) {\n return obj[$mobx].defineProperty_(key, descriptor);\n }\n die(39);\n}\nfunction apiOwnKeys(obj) {\n if (isObservableObject(obj)) {\n return obj[$mobx].ownKeys_();\n }\n die(38);\n}\n\nfunction observe(thing, propOrCb, cbOrFire, fireImmediately) {\n if (isFunction(cbOrFire)) {\n return observeObservableProperty(thing, propOrCb, cbOrFire, fireImmediately);\n } else {\n return observeObservable(thing, propOrCb, cbOrFire);\n }\n}\nfunction observeObservable(thing, listener, fireImmediately) {\n return getAdministration(thing).observe_(listener, fireImmediately);\n}\nfunction observeObservableProperty(thing, property, listener, fireImmediately) {\n return getAdministration(thing, property).observe_(listener, fireImmediately);\n}\n\nfunction cache(map, key, value) {\n map.set(key, value);\n return value;\n}\nfunction toJSHelper(source, __alreadySeen) {\n if (source == null || typeof source !== \"object\" || source instanceof Date || !isObservable(source)) {\n return source;\n }\n if (isObservableValue(source) || isComputedValue(source)) {\n return toJSHelper(source.get(), __alreadySeen);\n }\n if (__alreadySeen.has(source)) {\n return __alreadySeen.get(source);\n }\n if (isObservableArray(source)) {\n var res = cache(__alreadySeen, source, new Array(source.length));\n source.forEach(function (value, idx) {\n res[idx] = toJSHelper(value, __alreadySeen);\n });\n return res;\n }\n if (isObservableSet(source)) {\n var _res = cache(__alreadySeen, source, new Set());\n source.forEach(function (value) {\n _res.add(toJSHelper(value, __alreadySeen));\n });\n return _res;\n }\n if (isObservableMap(source)) {\n var _res2 = cache(__alreadySeen, source, new Map());\n source.forEach(function (value, key) {\n _res2.set(key, toJSHelper(value, __alreadySeen));\n });\n return _res2;\n } else {\n // must be observable object\n var _res3 = cache(__alreadySeen, source, {});\n apiOwnKeys(source).forEach(function (key) {\n if (objectPrototype.propertyIsEnumerable.call(source, key)) {\n _res3[key] = toJSHelper(source[key], __alreadySeen);\n }\n });\n return _res3;\n }\n}\n/**\n * Recursively converts an observable to it's non-observable native counterpart.\n * It does NOT recurse into non-observables, these are left as they are, even if they contain observables.\n * Computed and other non-enumerable properties are completely ignored.\n * Complex scenarios require custom solution, eg implementing `toJSON` or using `serializr` lib.\n */\nfunction toJS(source, options) {\n if ( true && options) {\n die(\"toJS no longer supports options\");\n }\n return toJSHelper(source, new Map());\n}\n\nfunction trace() {\n if (false) {}\n var enterBreakPoint = false;\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n if (typeof args[args.length - 1] === \"boolean\") {\n enterBreakPoint = args.pop();\n }\n var derivation = getAtomFromArgs(args);\n if (!derivation) {\n return die(\"'trace(break?)' can only be used inside a tracked computed value or a Reaction. Consider passing in the computed value or reaction explicitly\");\n }\n if (derivation.isTracing_ === TraceMode.NONE) {\n console.log(\"[mobx.trace] '\" + derivation.name_ + \"' tracing enabled\");\n }\n derivation.isTracing_ = enterBreakPoint ? TraceMode.BREAK : TraceMode.LOG;\n}\nfunction getAtomFromArgs(args) {\n switch (args.length) {\n case 0:\n return globalState.trackingDerivation;\n case 1:\n return getAtom(args[0]);\n case 2:\n return getAtom(args[0], args[1]);\n }\n}\n\n/**\n * During a transaction no views are updated until the end of the transaction.\n * The transaction will be run synchronously nonetheless.\n *\n * @param action a function that updates some reactive state\n * @returns any value that was returned by the 'action' parameter.\n */\nfunction transaction(action, thisArg) {\n if (thisArg === void 0) {\n thisArg = undefined;\n }\n startBatch();\n try {\n return action.apply(thisArg);\n } finally {\n endBatch();\n }\n}\n\nfunction when(predicate, arg1, arg2) {\n if (arguments.length === 1 || arg1 && typeof arg1 === \"object\") {\n return whenPromise(predicate, arg1);\n }\n return _when(predicate, arg1, arg2 || {});\n}\nfunction _when(predicate, effect, opts) {\n var timeoutHandle;\n if (typeof opts.timeout === \"number\") {\n var error = new Error(\"WHEN_TIMEOUT\");\n timeoutHandle = setTimeout(function () {\n if (!disposer[$mobx].isDisposed) {\n disposer();\n if (opts.onError) {\n opts.onError(error);\n } else {\n throw error;\n }\n }\n }, opts.timeout);\n }\n opts.name = true ? opts.name || \"When@\" + getNextId() : 0;\n var effectAction = createAction( true ? opts.name + \"-effect\" : 0, effect);\n // eslint-disable-next-line\n var disposer = autorun(function (r) {\n // predicate should not change state\n var cond = allowStateChanges(false, predicate);\n if (cond) {\n r.dispose();\n if (timeoutHandle) {\n clearTimeout(timeoutHandle);\n }\n effectAction();\n }\n }, opts);\n return disposer;\n}\nfunction whenPromise(predicate, opts) {\n var _opts$signal;\n if ( true && opts && opts.onError) {\n return die(\"the options 'onError' and 'promise' cannot be combined\");\n }\n if (opts != null && (_opts$signal = opts.signal) != null && _opts$signal.aborted) {\n return Object.assign(Promise.reject(new Error(\"WHEN_ABORTED\")), {\n cancel: function cancel() {\n return null;\n }\n });\n }\n var cancel;\n var abort;\n var res = new Promise(function (resolve, reject) {\n var _opts$signal2;\n var disposer = _when(predicate, resolve, _extends({}, opts, {\n onError: reject\n }));\n cancel = function cancel() {\n disposer();\n reject(new Error(\"WHEN_CANCELLED\"));\n };\n abort = function abort() {\n disposer();\n reject(new Error(\"WHEN_ABORTED\"));\n };\n opts == null || (_opts$signal2 = opts.signal) == null || _opts$signal2.addEventListener == null || _opts$signal2.addEventListener(\"abort\", abort);\n })[\"finally\"](function () {\n var _opts$signal3;\n return opts == null || (_opts$signal3 = opts.signal) == null || _opts$signal3.removeEventListener == null ? void 0 : _opts$signal3.removeEventListener(\"abort\", abort);\n });\n res.cancel = cancel;\n return res;\n}\n\nfunction getAdm(target) {\n return target[$mobx];\n}\n// Optimization: we don't need the intermediate objects and could have a completely custom administration for DynamicObjects,\n// and skip either the internal values map, or the base object with its property descriptors!\nvar objectProxyTraps = {\n has: function has(target, name) {\n if ( true && globalState.trackingDerivation) {\n warnAboutProxyRequirement(\"detect new properties using the 'in' operator. Use 'has' from 'mobx' instead.\");\n }\n return getAdm(target).has_(name);\n },\n get: function get(target, name) {\n return getAdm(target).get_(name);\n },\n set: function set(target, name, value) {\n var _getAdm$set_;\n if (!isStringish(name)) {\n return false;\n }\n if ( true && !getAdm(target).values_.has(name)) {\n warnAboutProxyRequirement(\"add a new observable property through direct assignment. Use 'set' from 'mobx' instead.\");\n }\n // null (intercepted) -> true (success)\n return (_getAdm$set_ = getAdm(target).set_(name, value, true)) != null ? _getAdm$set_ : true;\n },\n deleteProperty: function deleteProperty(target, name) {\n var _getAdm$delete_;\n if (true) {\n warnAboutProxyRequirement(\"delete properties from an observable object. Use 'remove' from 'mobx' instead.\");\n }\n if (!isStringish(name)) {\n return false;\n }\n // null (intercepted) -> true (success)\n return (_getAdm$delete_ = getAdm(target).delete_(name, true)) != null ? _getAdm$delete_ : true;\n },\n defineProperty: function defineProperty(target, name, descriptor) {\n var _getAdm$definePropert;\n if (true) {\n warnAboutProxyRequirement(\"define property on an observable object. Use 'defineProperty' from 'mobx' instead.\");\n }\n // null (intercepted) -> true (success)\n return (_getAdm$definePropert = getAdm(target).defineProperty_(name, descriptor)) != null ? _getAdm$definePropert : true;\n },\n ownKeys: function ownKeys(target) {\n if ( true && globalState.trackingDerivation) {\n warnAboutProxyRequirement(\"iterate keys to detect added / removed properties. Use 'keys' from 'mobx' instead.\");\n }\n return getAdm(target).ownKeys_();\n },\n preventExtensions: function preventExtensions(target) {\n die(13);\n }\n};\nfunction asDynamicObservableObject(target, options) {\n var _target$$mobx, _target$$mobx$proxy_;\n assertProxies();\n target = asObservableObject(target, options);\n return (_target$$mobx$proxy_ = (_target$$mobx = target[$mobx]).proxy_) != null ? _target$$mobx$proxy_ : _target$$mobx.proxy_ = new Proxy(target, objectProxyTraps);\n}\n\nfunction hasInterceptors(interceptable) {\n return interceptable.interceptors_ !== undefined && interceptable.interceptors_.length > 0;\n}\nfunction registerInterceptor(interceptable, handler) {\n var interceptors = interceptable.interceptors_ || (interceptable.interceptors_ = []);\n interceptors.push(handler);\n return once(function () {\n var idx = interceptors.indexOf(handler);\n if (idx !== -1) {\n interceptors.splice(idx, 1);\n }\n });\n}\nfunction interceptChange(interceptable, change) {\n var prevU = untrackedStart();\n try {\n // Interceptor can modify the array, copy it to avoid concurrent modification, see #1950\n var interceptors = [].concat(interceptable.interceptors_ || []);\n for (var i = 0, l = interceptors.length; i < l; i++) {\n change = interceptors[i](change);\n if (change && !change.type) {\n die(14);\n }\n if (!change) {\n break;\n }\n }\n return change;\n } finally {\n untrackedEnd(prevU);\n }\n}\n\nfunction hasListeners(listenable) {\n return listenable.changeListeners_ !== undefined && listenable.changeListeners_.length > 0;\n}\nfunction registerListener(listenable, handler) {\n var listeners = listenable.changeListeners_ || (listenable.changeListeners_ = []);\n listeners.push(handler);\n return once(function () {\n var idx = listeners.indexOf(handler);\n if (idx !== -1) {\n listeners.splice(idx, 1);\n }\n });\n}\nfunction notifyListeners(listenable, change) {\n var prevU = untrackedStart();\n var listeners = listenable.changeListeners_;\n if (!listeners) {\n return;\n }\n listeners = listeners.slice();\n for (var i = 0, l = listeners.length; i < l; i++) {\n listeners[i](change);\n }\n untrackedEnd(prevU);\n}\n\nfunction makeObservable(target, annotations, options) {\n initObservable(function () {\n var _annotations;\n var adm = asObservableObject(target, options)[$mobx];\n if ( true && annotations && target[storedAnnotationsSymbol]) {\n die(\"makeObservable second arg must be nullish when using decorators. Mixing @decorator syntax with annotations is not supported.\");\n }\n // Default to decorators\n (_annotations = annotations) != null ? _annotations : annotations = collectStoredAnnotations(target);\n // Annotate\n ownKeys(annotations).forEach(function (key) {\n return adm.make_(key, annotations[key]);\n });\n });\n return target;\n}\n// proto[keysSymbol] = new Set()\nvar keysSymbol = /*#__PURE__*/Symbol(\"mobx-keys\");\nfunction makeAutoObservable(target, overrides, options) {\n if (true) {\n if (!isPlainObject(target) && !isPlainObject(Object.getPrototypeOf(target))) {\n die(\"'makeAutoObservable' can only be used for classes that don't have a superclass\");\n }\n if (isObservableObject(target)) {\n die(\"makeAutoObservable can only be used on objects not already made observable\");\n }\n }\n // Optimization: avoid visiting protos\n // Assumes that annotation.make_/.extend_ works the same for plain objects\n if (isPlainObject(target)) {\n return extendObservable(target, target, overrides, options);\n }\n initObservable(function () {\n var adm = asObservableObject(target, options)[$mobx];\n // Optimization: cache keys on proto\n // Assumes makeAutoObservable can be called only once per object and can't be used in subclass\n if (!target[keysSymbol]) {\n var proto = Object.getPrototypeOf(target);\n var keys = new Set([].concat(ownKeys(target), ownKeys(proto)));\n keys[\"delete\"](\"constructor\");\n keys[\"delete\"]($mobx);\n addHiddenProp(proto, keysSymbol, keys);\n }\n target[keysSymbol].forEach(function (key) {\n return adm.make_(key,\n // must pass \"undefined\" for { key: undefined }\n !overrides ? true : key in overrides ? overrides[key] : true);\n });\n });\n return target;\n}\n\nvar SPLICE = \"splice\";\nvar UPDATE = \"update\";\nvar MAX_SPLICE_SIZE = 10000; // See e.g. https://github.com/mobxjs/mobx/issues/859\nvar arrayTraps = {\n get: function get(target, name) {\n var adm = target[$mobx];\n if (name === $mobx) {\n return adm;\n }\n if (name === \"length\") {\n return adm.getArrayLength_();\n }\n if (typeof name === \"string\" && !isNaN(name)) {\n return adm.get_(parseInt(name));\n }\n if (hasProp(arrayExtensions, name)) {\n return arrayExtensions[name];\n }\n return target[name];\n },\n set: function set(target, name, value) {\n var adm = target[$mobx];\n if (name === \"length\") {\n adm.setArrayLength_(value);\n }\n if (typeof name === \"symbol\" || isNaN(name)) {\n target[name] = value;\n } else {\n // numeric string\n adm.set_(parseInt(name), value);\n }\n return true;\n },\n preventExtensions: function preventExtensions() {\n die(15);\n }\n};\nvar ObservableArrayAdministration = /*#__PURE__*/function () {\n function ObservableArrayAdministration(name, enhancer, owned_, legacyMode_) {\n if (name === void 0) {\n name = true ? \"ObservableArray@\" + getNextId() : 0;\n }\n this.owned_ = void 0;\n this.legacyMode_ = void 0;\n this.atom_ = void 0;\n this.values_ = [];\n // this is the prop that gets proxied, so can't replace it!\n this.interceptors_ = void 0;\n this.changeListeners_ = void 0;\n this.enhancer_ = void 0;\n this.dehancer = void 0;\n this.proxy_ = void 0;\n this.lastKnownLength_ = 0;\n this.owned_ = owned_;\n this.legacyMode_ = legacyMode_;\n this.atom_ = new Atom(name);\n this.enhancer_ = function (newV, oldV) {\n return enhancer(newV, oldV, true ? name + \"[..]\" : 0);\n };\n }\n var _proto = ObservableArrayAdministration.prototype;\n _proto.dehanceValue_ = function dehanceValue_(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.dehanceValues_ = function dehanceValues_(values) {\n if (this.dehancer !== undefined && values.length > 0) {\n return values.map(this.dehancer);\n }\n return values;\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n if (fireImmediately === void 0) {\n fireImmediately = false;\n }\n if (fireImmediately) {\n listener({\n observableKind: \"array\",\n object: this.proxy_,\n debugObjectName: this.atom_.name_,\n type: \"splice\",\n index: 0,\n added: this.values_.slice(),\n addedCount: this.values_.length,\n removed: [],\n removedCount: 0\n });\n }\n return registerListener(this, listener);\n };\n _proto.getArrayLength_ = function getArrayLength_() {\n this.atom_.reportObserved();\n return this.values_.length;\n };\n _proto.setArrayLength_ = function setArrayLength_(newLength) {\n if (typeof newLength !== \"number\" || isNaN(newLength) || newLength < 0) {\n die(\"Out of range: \" + newLength);\n }\n var currentLength = this.values_.length;\n if (newLength === currentLength) {\n return;\n } else if (newLength > currentLength) {\n var newItems = new Array(newLength - currentLength);\n for (var i = 0; i < newLength - currentLength; i++) {\n newItems[i] = undefined;\n } // No Array.fill everywhere...\n this.spliceWithArray_(currentLength, 0, newItems);\n } else {\n this.spliceWithArray_(newLength, currentLength - newLength);\n }\n };\n _proto.updateArrayLength_ = function updateArrayLength_(oldLength, delta) {\n if (oldLength !== this.lastKnownLength_) {\n die(16);\n }\n this.lastKnownLength_ += delta;\n if (this.legacyMode_ && delta > 0) {\n reserveArrayBuffer(oldLength + delta + 1);\n }\n };\n _proto.spliceWithArray_ = function spliceWithArray_(index, deleteCount, newItems) {\n var _this = this;\n checkIfStateModificationsAreAllowed(this.atom_);\n var length = this.values_.length;\n if (index === undefined) {\n index = 0;\n } else if (index > length) {\n index = length;\n } else if (index < 0) {\n index = Math.max(0, length + index);\n }\n if (arguments.length === 1) {\n deleteCount = length - index;\n } else if (deleteCount === undefined || deleteCount === null) {\n deleteCount = 0;\n } else {\n deleteCount = Math.max(0, Math.min(deleteCount, length - index));\n }\n if (newItems === undefined) {\n newItems = EMPTY_ARRAY;\n }\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_,\n type: SPLICE,\n index: index,\n removedCount: deleteCount,\n added: newItems\n });\n if (!change) {\n return EMPTY_ARRAY;\n }\n deleteCount = change.removedCount;\n newItems = change.added;\n }\n newItems = newItems.length === 0 ? newItems : newItems.map(function (v) {\n return _this.enhancer_(v, undefined);\n });\n if (this.legacyMode_ || \"development\" !== \"production\") {\n var lengthDelta = newItems.length - deleteCount;\n this.updateArrayLength_(length, lengthDelta); // checks if internal array wasn't modified\n }\n var res = this.spliceItemsIntoValues_(index, deleteCount, newItems);\n if (deleteCount !== 0 || newItems.length !== 0) {\n this.notifyArraySplice_(index, newItems, res);\n }\n return this.dehanceValues_(res);\n };\n _proto.spliceItemsIntoValues_ = function spliceItemsIntoValues_(index, deleteCount, newItems) {\n if (newItems.length < MAX_SPLICE_SIZE) {\n var _this$values_;\n return (_this$values_ = this.values_).splice.apply(_this$values_, [index, deleteCount].concat(newItems));\n } else {\n // The items removed by the splice\n var res = this.values_.slice(index, index + deleteCount);\n // The items that that should remain at the end of the array\n var oldItems = this.values_.slice(index + deleteCount);\n // New length is the previous length + addition count - deletion count\n this.values_.length += newItems.length - deleteCount;\n for (var i = 0; i < newItems.length; i++) {\n this.values_[index + i] = newItems[i];\n }\n for (var _i = 0; _i < oldItems.length; _i++) {\n this.values_[index + newItems.length + _i] = oldItems[_i];\n }\n return res;\n }\n };\n _proto.notifyArrayChildUpdate_ = function notifyArrayChildUpdate_(index, newValue, oldValue) {\n var notifySpy = !this.owned_ && isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"array\",\n object: this.proxy_,\n type: UPDATE,\n debugObjectName: this.atom_.name_,\n index: index,\n newValue: newValue,\n oldValue: oldValue\n } : null;\n // The reason why this is on right hand side here (and not above), is this way the uglifier will drop it, but it won't\n // cause any runtime overhead in development mode without NODE_ENV set, unless spying is enabled\n if ( true && notifySpy) {\n spyReportStart(change);\n }\n this.atom_.reportChanged();\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n };\n _proto.notifyArraySplice_ = function notifyArraySplice_(index, added, removed) {\n var notifySpy = !this.owned_ && isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"array\",\n object: this.proxy_,\n debugObjectName: this.atom_.name_,\n type: SPLICE,\n index: index,\n removed: removed,\n added: added,\n removedCount: removed.length,\n addedCount: added.length\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n }\n this.atom_.reportChanged();\n // conform: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/observe\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n };\n _proto.get_ = function get_(index) {\n if (this.legacyMode_ && index >= this.values_.length) {\n console.warn( true ? \"[mobx.array] Attempt to read an array index (\" + index + \") that is out of bounds (\" + this.values_.length + \"). Please check length first. Out of bound indices will not be tracked by MobX\" : 0);\n return undefined;\n }\n this.atom_.reportObserved();\n return this.dehanceValue_(this.values_[index]);\n };\n _proto.set_ = function set_(index, newValue) {\n var values = this.values_;\n if (this.legacyMode_ && index > values.length) {\n // out of bounds\n die(17, index, values.length);\n }\n if (index < values.length) {\n // update at index in range\n checkIfStateModificationsAreAllowed(this.atom_);\n var oldValue = values[index];\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: UPDATE,\n object: this.proxy_,\n // since \"this\" is the real array we need to pass its proxy\n index: index,\n newValue: newValue\n });\n if (!change) {\n return;\n }\n newValue = change.newValue;\n }\n newValue = this.enhancer_(newValue, oldValue);\n var changed = newValue !== oldValue;\n if (changed) {\n values[index] = newValue;\n this.notifyArrayChildUpdate_(index, newValue, oldValue);\n }\n } else {\n // For out of bound index, we don't create an actual sparse array,\n // but rather fill the holes with undefined (same as setArrayLength_).\n // This could be considered a bug.\n var newItems = new Array(index + 1 - values.length);\n for (var i = 0; i < newItems.length - 1; i++) {\n newItems[i] = undefined;\n } // No Array.fill everywhere...\n newItems[newItems.length - 1] = newValue;\n this.spliceWithArray_(values.length, 0, newItems);\n }\n };\n return ObservableArrayAdministration;\n}();\nfunction createObservableArray(initialValues, enhancer, name, owned) {\n if (name === void 0) {\n name = true ? \"ObservableArray@\" + getNextId() : 0;\n }\n if (owned === void 0) {\n owned = false;\n }\n assertProxies();\n return initObservable(function () {\n var adm = new ObservableArrayAdministration(name, enhancer, owned, false);\n addHiddenFinalProp(adm.values_, $mobx, adm);\n var proxy = new Proxy(adm.values_, arrayTraps);\n adm.proxy_ = proxy;\n if (initialValues && initialValues.length) {\n adm.spliceWithArray_(0, 0, initialValues);\n }\n return proxy;\n });\n}\n// eslint-disable-next-line\nvar arrayExtensions = {\n clear: function clear() {\n return this.splice(0);\n },\n replace: function replace(newItems) {\n var adm = this[$mobx];\n return adm.spliceWithArray_(0, adm.values_.length, newItems);\n },\n // Used by JSON.stringify\n toJSON: function toJSON() {\n return this.slice();\n },\n /*\n * functions that do alter the internal structure of the array, (based on lib.es6.d.ts)\n * since these functions alter the inner structure of the array, the have side effects.\n * Because the have side effects, they should not be used in computed function,\n * and for that reason the do not call dependencyState.notifyObserved\n */\n splice: function splice(index, deleteCount) {\n for (var _len = arguments.length, newItems = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {\n newItems[_key - 2] = arguments[_key];\n }\n var adm = this[$mobx];\n switch (arguments.length) {\n case 0:\n return [];\n case 1:\n return adm.spliceWithArray_(index);\n case 2:\n return adm.spliceWithArray_(index, deleteCount);\n }\n return adm.spliceWithArray_(index, deleteCount, newItems);\n },\n spliceWithArray: function spliceWithArray(index, deleteCount, newItems) {\n return this[$mobx].spliceWithArray_(index, deleteCount, newItems);\n },\n push: function push() {\n var adm = this[$mobx];\n for (var _len2 = arguments.length, items = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n items[_key2] = arguments[_key2];\n }\n adm.spliceWithArray_(adm.values_.length, 0, items);\n return adm.values_.length;\n },\n pop: function pop() {\n return this.splice(Math.max(this[$mobx].values_.length - 1, 0), 1)[0];\n },\n shift: function shift() {\n return this.splice(0, 1)[0];\n },\n unshift: function unshift() {\n var adm = this[$mobx];\n for (var _len3 = arguments.length, items = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n items[_key3] = arguments[_key3];\n }\n adm.spliceWithArray_(0, 0, items);\n return adm.values_.length;\n },\n reverse: function reverse() {\n // reverse by default mutates in place before returning the result\n // which makes it both a 'derivation' and a 'mutation'.\n if (globalState.trackingDerivation) {\n die(37, \"reverse\");\n }\n this.replace(this.slice().reverse());\n return this;\n },\n sort: function sort() {\n // sort by default mutates in place before returning the result\n // which goes against all good practices. Let's not change the array in place!\n if (globalState.trackingDerivation) {\n die(37, \"sort\");\n }\n var copy = this.slice();\n copy.sort.apply(copy, arguments);\n this.replace(copy);\n return this;\n },\n remove: function remove(value) {\n var adm = this[$mobx];\n var idx = adm.dehanceValues_(adm.values_).indexOf(value);\n if (idx > -1) {\n this.splice(idx, 1);\n return true;\n }\n return false;\n }\n};\n/**\n * Wrap function from prototype\n * Without this, everything works as well, but this works\n * faster as everything works on unproxied values\n */\naddArrayExtension(\"at\", simpleFunc);\naddArrayExtension(\"concat\", simpleFunc);\naddArrayExtension(\"flat\", simpleFunc);\naddArrayExtension(\"includes\", simpleFunc);\naddArrayExtension(\"indexOf\", simpleFunc);\naddArrayExtension(\"join\", simpleFunc);\naddArrayExtension(\"lastIndexOf\", simpleFunc);\naddArrayExtension(\"slice\", simpleFunc);\naddArrayExtension(\"toString\", simpleFunc);\naddArrayExtension(\"toLocaleString\", simpleFunc);\naddArrayExtension(\"toSorted\", simpleFunc);\naddArrayExtension(\"toSpliced\", simpleFunc);\naddArrayExtension(\"with\", simpleFunc);\n// map\naddArrayExtension(\"every\", mapLikeFunc);\naddArrayExtension(\"filter\", mapLikeFunc);\naddArrayExtension(\"find\", mapLikeFunc);\naddArrayExtension(\"findIndex\", mapLikeFunc);\naddArrayExtension(\"findLast\", mapLikeFunc);\naddArrayExtension(\"findLastIndex\", mapLikeFunc);\naddArrayExtension(\"flatMap\", mapLikeFunc);\naddArrayExtension(\"forEach\", mapLikeFunc);\naddArrayExtension(\"map\", mapLikeFunc);\naddArrayExtension(\"some\", mapLikeFunc);\naddArrayExtension(\"toReversed\", mapLikeFunc);\n// reduce\naddArrayExtension(\"reduce\", reduceLikeFunc);\naddArrayExtension(\"reduceRight\", reduceLikeFunc);\nfunction addArrayExtension(funcName, funcFactory) {\n if (typeof Array.prototype[funcName] === \"function\") {\n arrayExtensions[funcName] = funcFactory(funcName);\n }\n}\n// Report and delegate to dehanced array\nfunction simpleFunc(funcName) {\n return function () {\n var adm = this[$mobx];\n adm.atom_.reportObserved();\n var dehancedValues = adm.dehanceValues_(adm.values_);\n return dehancedValues[funcName].apply(dehancedValues, arguments);\n };\n}\n// Make sure callbacks receive correct array arg #2326\nfunction mapLikeFunc(funcName) {\n return function (callback, thisArg) {\n var _this2 = this;\n var adm = this[$mobx];\n adm.atom_.reportObserved();\n var dehancedValues = adm.dehanceValues_(adm.values_);\n return dehancedValues[funcName](function (element, index) {\n return callback.call(thisArg, element, index, _this2);\n });\n };\n}\n// Make sure callbacks receive correct array arg #2326\nfunction reduceLikeFunc(funcName) {\n return function () {\n var _this3 = this;\n var adm = this[$mobx];\n adm.atom_.reportObserved();\n var dehancedValues = adm.dehanceValues_(adm.values_);\n // #2432 - reduce behavior depends on arguments.length\n var callback = arguments[0];\n arguments[0] = function (accumulator, currentValue, index) {\n return callback(accumulator, currentValue, index, _this3);\n };\n return dehancedValues[funcName].apply(dehancedValues, arguments);\n };\n}\nvar isObservableArrayAdministration = /*#__PURE__*/createInstanceofPredicate(\"ObservableArrayAdministration\", ObservableArrayAdministration);\nfunction isObservableArray(thing) {\n return isObject(thing) && isObservableArrayAdministration(thing[$mobx]);\n}\n\nvar ObservableMapMarker = {};\nvar ADD = \"add\";\nvar DELETE = \"delete\";\n// just extend Map? See also https://gist.github.com/nestharus/13b4d74f2ef4a2f4357dbd3fc23c1e54\n// But: https://github.com/mobxjs/mobx/issues/1556\nvar ObservableMap = /*#__PURE__*/function () {\n function ObservableMap(initialData, enhancer_, name_) {\n var _this = this;\n if (enhancer_ === void 0) {\n enhancer_ = deepEnhancer;\n }\n if (name_ === void 0) {\n name_ = true ? \"ObservableMap@\" + getNextId() : 0;\n }\n this.enhancer_ = void 0;\n this.name_ = void 0;\n this[$mobx] = ObservableMapMarker;\n this.data_ = void 0;\n this.hasMap_ = void 0;\n // hasMap, not hashMap >-).\n this.keysAtom_ = void 0;\n this.interceptors_ = void 0;\n this.changeListeners_ = void 0;\n this.dehancer = void 0;\n this.enhancer_ = enhancer_;\n this.name_ = name_;\n if (!isFunction(Map)) {\n die(18);\n }\n initObservable(function () {\n _this.keysAtom_ = createAtom( true ? _this.name_ + \".keys()\" : 0);\n _this.data_ = new Map();\n _this.hasMap_ = new Map();\n if (initialData) {\n _this.merge(initialData);\n }\n });\n }\n var _proto = ObservableMap.prototype;\n _proto.has_ = function has_(key) {\n return this.data_.has(key);\n };\n _proto.has = function has(key) {\n var _this2 = this;\n if (!globalState.trackingDerivation) {\n return this.has_(key);\n }\n var entry = this.hasMap_.get(key);\n if (!entry) {\n var newEntry = entry = new ObservableValue(this.has_(key), referenceEnhancer, true ? this.name_ + \".\" + stringifyKey(key) + \"?\" : 0, false);\n this.hasMap_.set(key, newEntry);\n onBecomeUnobserved(newEntry, function () {\n return _this2.hasMap_[\"delete\"](key);\n });\n }\n return entry.get();\n };\n _proto.set = function set(key, value) {\n var hasKey = this.has_(key);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: hasKey ? UPDATE : ADD,\n object: this,\n newValue: value,\n name: key\n });\n if (!change) {\n return this;\n }\n value = change.newValue;\n }\n if (hasKey) {\n this.updateValue_(key, value);\n } else {\n this.addValue_(key, value);\n }\n return this;\n };\n _proto[\"delete\"] = function _delete(key) {\n var _this3 = this;\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: DELETE,\n object: this,\n name: key\n });\n if (!change) {\n return false;\n }\n }\n if (this.has_(key)) {\n var notifySpy = isSpyEnabled();\n var notify = hasListeners(this);\n var _change = notify || notifySpy ? {\n observableKind: \"map\",\n debugObjectName: this.name_,\n type: DELETE,\n object: this,\n oldValue: this.data_.get(key).value_,\n name: key\n } : null;\n if ( true && notifySpy) {\n spyReportStart(_change);\n } // TODO fix type\n transaction(function () {\n var _this3$hasMap_$get;\n _this3.keysAtom_.reportChanged();\n (_this3$hasMap_$get = _this3.hasMap_.get(key)) == null || _this3$hasMap_$get.setNewValue_(false);\n var observable = _this3.data_.get(key);\n observable.setNewValue_(undefined);\n _this3.data_[\"delete\"](key);\n });\n if (notify) {\n notifyListeners(this, _change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n return true;\n }\n return false;\n };\n _proto.updateValue_ = function updateValue_(key, newValue) {\n var observable = this.data_.get(key);\n newValue = observable.prepareNewValue_(newValue);\n if (newValue !== globalState.UNCHANGED) {\n var notifySpy = isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"map\",\n debugObjectName: this.name_,\n type: UPDATE,\n object: this,\n oldValue: observable.value_,\n name: key,\n newValue: newValue\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n } // TODO fix type\n observable.setNewValue_(newValue);\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n };\n _proto.addValue_ = function addValue_(key, newValue) {\n var _this4 = this;\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n transaction(function () {\n var _this4$hasMap_$get;\n var observable = new ObservableValue(newValue, _this4.enhancer_, true ? _this4.name_ + \".\" + stringifyKey(key) : 0, false);\n _this4.data_.set(key, observable);\n newValue = observable.value_; // value might have been changed\n (_this4$hasMap_$get = _this4.hasMap_.get(key)) == null || _this4$hasMap_$get.setNewValue_(true);\n _this4.keysAtom_.reportChanged();\n });\n var notifySpy = isSpyEnabled();\n var notify = hasListeners(this);\n var change = notify || notifySpy ? {\n observableKind: \"map\",\n debugObjectName: this.name_,\n type: ADD,\n object: this,\n name: key,\n newValue: newValue\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n } // TODO fix type\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n };\n _proto.get = function get(key) {\n if (this.has(key)) {\n return this.dehanceValue_(this.data_.get(key).get());\n }\n return this.dehanceValue_(undefined);\n };\n _proto.dehanceValue_ = function dehanceValue_(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.keys = function keys() {\n this.keysAtom_.reportObserved();\n return this.data_.keys();\n };\n _proto.values = function values() {\n var self = this;\n var keys = this.keys();\n return makeIterableForMap({\n next: function next() {\n var _keys$next = keys.next(),\n done = _keys$next.done,\n value = _keys$next.value;\n return {\n done: done,\n value: done ? undefined : self.get(value)\n };\n }\n });\n };\n _proto.entries = function entries() {\n var self = this;\n var keys = this.keys();\n return makeIterableForMap({\n next: function next() {\n var _keys$next2 = keys.next(),\n done = _keys$next2.done,\n value = _keys$next2.value;\n return {\n done: done,\n value: done ? undefined : [value, self.get(value)]\n };\n }\n });\n };\n _proto[Symbol.iterator] = function () {\n return this.entries();\n };\n _proto.forEach = function forEach(callback, thisArg) {\n for (var _iterator = _createForOfIteratorHelperLoose(this), _step; !(_step = _iterator()).done;) {\n var _step$value = _step.value,\n key = _step$value[0],\n value = _step$value[1];\n callback.call(thisArg, value, key, this);\n }\n }\n /** Merge another object into this object, returns this. */;\n _proto.merge = function merge(other) {\n var _this5 = this;\n if (isObservableMap(other)) {\n other = new Map(other);\n }\n transaction(function () {\n if (isPlainObject(other)) {\n getPlainObjectKeys(other).forEach(function (key) {\n return _this5.set(key, other[key]);\n });\n } else if (Array.isArray(other)) {\n other.forEach(function (_ref) {\n var key = _ref[0],\n value = _ref[1];\n return _this5.set(key, value);\n });\n } else if (isES6Map(other)) {\n if (!isPlainES6Map(other)) {\n die(19, other);\n }\n other.forEach(function (value, key) {\n return _this5.set(key, value);\n });\n } else if (other !== null && other !== undefined) {\n die(20, other);\n }\n });\n return this;\n };\n _proto.clear = function clear() {\n var _this6 = this;\n transaction(function () {\n untracked(function () {\n for (var _iterator2 = _createForOfIteratorHelperLoose(_this6.keys()), _step2; !(_step2 = _iterator2()).done;) {\n var key = _step2.value;\n _this6[\"delete\"](key);\n }\n });\n });\n };\n _proto.replace = function replace(values) {\n var _this7 = this;\n // Implementation requirements:\n // - respect ordering of replacement map\n // - allow interceptors to run and potentially prevent individual operations\n // - don't recreate observables that already exist in original map (so we don't destroy existing subscriptions)\n // - don't _keysAtom.reportChanged if the keys of resulting map are indentical (order matters!)\n // - note that result map may differ from replacement map due to the interceptors\n transaction(function () {\n // Convert to map so we can do quick key lookups\n var replacementMap = convertToMap(values);\n var orderedData = new Map();\n // Used for optimization\n var keysReportChangedCalled = false;\n // Delete keys that don't exist in replacement map\n // if the key deletion is prevented by interceptor\n // add entry at the beginning of the result map\n for (var _iterator3 = _createForOfIteratorHelperLoose(_this7.data_.keys()), _step3; !(_step3 = _iterator3()).done;) {\n var key = _step3.value;\n // Concurrently iterating/deleting keys\n // iterator should handle this correctly\n if (!replacementMap.has(key)) {\n var deleted = _this7[\"delete\"](key);\n // Was the key removed?\n if (deleted) {\n // _keysAtom.reportChanged() was already called\n keysReportChangedCalled = true;\n } else {\n // Delete prevented by interceptor\n var value = _this7.data_.get(key);\n orderedData.set(key, value);\n }\n }\n }\n // Merge entries\n for (var _iterator4 = _createForOfIteratorHelperLoose(replacementMap.entries()), _step4; !(_step4 = _iterator4()).done;) {\n var _step4$value = _step4.value,\n _key = _step4$value[0],\n _value = _step4$value[1];\n // We will want to know whether a new key is added\n var keyExisted = _this7.data_.has(_key);\n // Add or update value\n _this7.set(_key, _value);\n // The addition could have been prevent by interceptor\n if (_this7.data_.has(_key)) {\n // The update could have been prevented by interceptor\n // and also we want to preserve existing values\n // so use value from _data map (instead of replacement map)\n var _value2 = _this7.data_.get(_key);\n orderedData.set(_key, _value2);\n // Was a new key added?\n if (!keyExisted) {\n // _keysAtom.reportChanged() was already called\n keysReportChangedCalled = true;\n }\n }\n }\n // Check for possible key order change\n if (!keysReportChangedCalled) {\n if (_this7.data_.size !== orderedData.size) {\n // If size differs, keys are definitely modified\n _this7.keysAtom_.reportChanged();\n } else {\n var iter1 = _this7.data_.keys();\n var iter2 = orderedData.keys();\n var next1 = iter1.next();\n var next2 = iter2.next();\n while (!next1.done) {\n if (next1.value !== next2.value) {\n _this7.keysAtom_.reportChanged();\n break;\n }\n next1 = iter1.next();\n next2 = iter2.next();\n }\n }\n }\n // Use correctly ordered map\n _this7.data_ = orderedData;\n });\n return this;\n };\n _proto.toString = function toString() {\n return \"[object ObservableMap]\";\n };\n _proto.toJSON = function toJSON() {\n return Array.from(this);\n };\n /**\n * Observes this object. Triggers for the events 'add', 'update' and 'delete'.\n * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe\n * for callback details\n */\n _proto.observe_ = function observe_(listener, fireImmediately) {\n if ( true && fireImmediately === true) {\n die(\"`observe` doesn't support fireImmediately=true in combination with maps.\");\n }\n return registerListener(this, listener);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n return _createClass(ObservableMap, [{\n key: \"size\",\n get: function get() {\n this.keysAtom_.reportObserved();\n return this.data_.size;\n }\n }, {\n key: Symbol.toStringTag,\n get: function get() {\n return \"Map\";\n }\n }]);\n}();\n// eslint-disable-next-line\nvar isObservableMap = /*#__PURE__*/createInstanceofPredicate(\"ObservableMap\", ObservableMap);\nfunction makeIterableForMap(iterator) {\n iterator[Symbol.toStringTag] = \"MapIterator\";\n return makeIterable(iterator);\n}\nfunction convertToMap(dataStructure) {\n if (isES6Map(dataStructure) || isObservableMap(dataStructure)) {\n return dataStructure;\n } else if (Array.isArray(dataStructure)) {\n return new Map(dataStructure);\n } else if (isPlainObject(dataStructure)) {\n var map = new Map();\n for (var key in dataStructure) {\n map.set(key, dataStructure[key]);\n }\n return map;\n } else {\n return die(21, dataStructure);\n }\n}\n\nvar ObservableSetMarker = {};\nvar ObservableSet = /*#__PURE__*/function () {\n function ObservableSet(initialData, enhancer, name_) {\n var _this = this;\n if (enhancer === void 0) {\n enhancer = deepEnhancer;\n }\n if (name_ === void 0) {\n name_ = true ? \"ObservableSet@\" + getNextId() : 0;\n }\n this.name_ = void 0;\n this[$mobx] = ObservableSetMarker;\n this.data_ = new Set();\n this.atom_ = void 0;\n this.changeListeners_ = void 0;\n this.interceptors_ = void 0;\n this.dehancer = void 0;\n this.enhancer_ = void 0;\n this.name_ = name_;\n if (!isFunction(Set)) {\n die(22);\n }\n this.enhancer_ = function (newV, oldV) {\n return enhancer(newV, oldV, name_);\n };\n initObservable(function () {\n _this.atom_ = createAtom(_this.name_);\n if (initialData) {\n _this.replace(initialData);\n }\n });\n }\n var _proto = ObservableSet.prototype;\n _proto.dehanceValue_ = function dehanceValue_(value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n return value;\n };\n _proto.clear = function clear() {\n var _this2 = this;\n transaction(function () {\n untracked(function () {\n for (var _iterator = _createForOfIteratorHelperLoose(_this2.data_.values()), _step; !(_step = _iterator()).done;) {\n var value = _step.value;\n _this2[\"delete\"](value);\n }\n });\n });\n };\n _proto.forEach = function forEach(callbackFn, thisArg) {\n for (var _iterator2 = _createForOfIteratorHelperLoose(this), _step2; !(_step2 = _iterator2()).done;) {\n var value = _step2.value;\n callbackFn.call(thisArg, value, value, this);\n }\n };\n _proto.add = function add(value) {\n var _this3 = this;\n checkIfStateModificationsAreAllowed(this.atom_);\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: ADD,\n object: this,\n newValue: value\n });\n if (!change) {\n return this;\n }\n // ideally, value = change.value would be done here, so that values can be\n // changed by interceptor. Same applies for other Set and Map api's.\n }\n if (!this.has(value)) {\n transaction(function () {\n _this3.data_.add(_this3.enhancer_(value, undefined));\n _this3.atom_.reportChanged();\n });\n var notifySpy = true && isSpyEnabled();\n var notify = hasListeners(this);\n var _change = notify || notifySpy ? {\n observableKind: \"set\",\n debugObjectName: this.name_,\n type: ADD,\n object: this,\n newValue: value\n } : null;\n if (notifySpy && \"development\" !== \"production\") {\n spyReportStart(_change);\n }\n if (notify) {\n notifyListeners(this, _change);\n }\n if (notifySpy && \"development\" !== \"production\") {\n spyReportEnd();\n }\n }\n return this;\n };\n _proto[\"delete\"] = function _delete(value) {\n var _this4 = this;\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: DELETE,\n object: this,\n oldValue: value\n });\n if (!change) {\n return false;\n }\n }\n if (this.has(value)) {\n var notifySpy = true && isSpyEnabled();\n var notify = hasListeners(this);\n var _change2 = notify || notifySpy ? {\n observableKind: \"set\",\n debugObjectName: this.name_,\n type: DELETE,\n object: this,\n oldValue: value\n } : null;\n if (notifySpy && \"development\" !== \"production\") {\n spyReportStart(_change2);\n }\n transaction(function () {\n _this4.atom_.reportChanged();\n _this4.data_[\"delete\"](value);\n });\n if (notify) {\n notifyListeners(this, _change2);\n }\n if (notifySpy && \"development\" !== \"production\") {\n spyReportEnd();\n }\n return true;\n }\n return false;\n };\n _proto.has = function has(value) {\n this.atom_.reportObserved();\n return this.data_.has(this.dehanceValue_(value));\n };\n _proto.entries = function entries() {\n var nextIndex = 0;\n var keys = Array.from(this.keys());\n var values = Array.from(this.values());\n return makeIterableForSet({\n next: function next() {\n var index = nextIndex;\n nextIndex += 1;\n return index < values.length ? {\n value: [keys[index], values[index]],\n done: false\n } : {\n value: undefined,\n done: true\n };\n }\n });\n };\n _proto.keys = function keys() {\n return this.values();\n };\n _proto.values = function values() {\n this.atom_.reportObserved();\n var self = this;\n var nextIndex = 0;\n var observableValues = Array.from(this.data_.values());\n return makeIterableForSet({\n next: function next() {\n return nextIndex < observableValues.length ? {\n value: self.dehanceValue_(observableValues[nextIndex++]),\n done: false\n } : {\n value: undefined,\n done: true\n };\n }\n });\n };\n _proto.intersection = function intersection(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.intersection(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.intersection(otherSet);\n }\n };\n _proto.union = function union(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.union(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.union(otherSet);\n }\n };\n _proto.difference = function difference(otherSet) {\n return new Set(this).difference(otherSet);\n };\n _proto.symmetricDifference = function symmetricDifference(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.symmetricDifference(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.symmetricDifference(otherSet);\n }\n };\n _proto.isSubsetOf = function isSubsetOf(otherSet) {\n return new Set(this).isSubsetOf(otherSet);\n };\n _proto.isSupersetOf = function isSupersetOf(otherSet) {\n return new Set(this).isSupersetOf(otherSet);\n };\n _proto.isDisjointFrom = function isDisjointFrom(otherSet) {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.isDisjointFrom(this);\n } else {\n var dehancedSet = new Set(this);\n return dehancedSet.isDisjointFrom(otherSet);\n }\n };\n _proto.replace = function replace(other) {\n var _this5 = this;\n if (isObservableSet(other)) {\n other = new Set(other);\n }\n transaction(function () {\n if (Array.isArray(other)) {\n _this5.clear();\n other.forEach(function (value) {\n return _this5.add(value);\n });\n } else if (isES6Set(other)) {\n _this5.clear();\n other.forEach(function (value) {\n return _this5.add(value);\n });\n } else if (other !== null && other !== undefined) {\n die(\"Cannot initialize set from \" + other);\n }\n });\n return this;\n };\n _proto.observe_ = function observe_(listener, fireImmediately) {\n // ... 'fireImmediately' could also be true?\n if ( true && fireImmediately === true) {\n die(\"`observe` doesn't support fireImmediately=true in combination with sets.\");\n }\n return registerListener(this, listener);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.toJSON = function toJSON() {\n return Array.from(this);\n };\n _proto.toString = function toString() {\n return \"[object ObservableSet]\";\n };\n _proto[Symbol.iterator] = function () {\n return this.values();\n };\n return _createClass(ObservableSet, [{\n key: \"size\",\n get: function get() {\n this.atom_.reportObserved();\n return this.data_.size;\n }\n }, {\n key: Symbol.toStringTag,\n get: function get() {\n return \"Set\";\n }\n }]);\n}();\n// eslint-disable-next-line\nvar isObservableSet = /*#__PURE__*/createInstanceofPredicate(\"ObservableSet\", ObservableSet);\nfunction makeIterableForSet(iterator) {\n iterator[Symbol.toStringTag] = \"SetIterator\";\n return makeIterable(iterator);\n}\n\nvar descriptorCache = /*#__PURE__*/Object.create(null);\nvar REMOVE = \"remove\";\nvar ObservableObjectAdministration = /*#__PURE__*/function () {\n function ObservableObjectAdministration(target_, values_, name_,\n // Used anytime annotation is not explicitely provided\n defaultAnnotation_) {\n if (values_ === void 0) {\n values_ = new Map();\n }\n if (defaultAnnotation_ === void 0) {\n defaultAnnotation_ = autoAnnotation;\n }\n this.target_ = void 0;\n this.values_ = void 0;\n this.name_ = void 0;\n this.defaultAnnotation_ = void 0;\n this.keysAtom_ = void 0;\n this.changeListeners_ = void 0;\n this.interceptors_ = void 0;\n this.proxy_ = void 0;\n this.isPlainObject_ = void 0;\n this.appliedAnnotations_ = void 0;\n this.pendingKeys_ = void 0;\n this.target_ = target_;\n this.values_ = values_;\n this.name_ = name_;\n this.defaultAnnotation_ = defaultAnnotation_;\n this.keysAtom_ = new Atom( true ? this.name_ + \".keys\" : 0);\n // Optimization: we use this frequently\n this.isPlainObject_ = isPlainObject(this.target_);\n if ( true && !isAnnotation(this.defaultAnnotation_)) {\n die(\"defaultAnnotation must be valid annotation\");\n }\n if (true) {\n // Prepare structure for tracking which fields were already annotated\n this.appliedAnnotations_ = {};\n }\n }\n var _proto = ObservableObjectAdministration.prototype;\n _proto.getObservablePropValue_ = function getObservablePropValue_(key) {\n return this.values_.get(key).get();\n };\n _proto.setObservablePropValue_ = function setObservablePropValue_(key, newValue) {\n var observable = this.values_.get(key);\n if (observable instanceof ComputedValue) {\n observable.set(newValue);\n return true;\n }\n // intercept\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n type: UPDATE,\n object: this.proxy_ || this.target_,\n name: key,\n newValue: newValue\n });\n if (!change) {\n return null;\n }\n newValue = change.newValue;\n }\n newValue = observable.prepareNewValue_(newValue);\n // notify spy & observers\n if (newValue !== globalState.UNCHANGED) {\n var notify = hasListeners(this);\n var notifySpy = true && isSpyEnabled();\n var _change = notify || notifySpy ? {\n type: UPDATE,\n observableKind: \"object\",\n debugObjectName: this.name_,\n object: this.proxy_ || this.target_,\n oldValue: observable.value_,\n name: key,\n newValue: newValue\n } : null;\n if ( true && notifySpy) {\n spyReportStart(_change);\n }\n observable.setNewValue_(newValue);\n if (notify) {\n notifyListeners(this, _change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n return true;\n };\n _proto.get_ = function get_(key) {\n if (globalState.trackingDerivation && !hasProp(this.target_, key)) {\n // Key doesn't exist yet, subscribe for it in case it's added later\n this.has_(key);\n }\n return this.target_[key];\n }\n /**\n * @param {PropertyKey} key\n * @param {any} value\n * @param {Annotation|boolean} annotation true - use default annotation, false - copy as is\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.set_ = function set_(key, value, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n // Don't use .has(key) - we care about own\n if (hasProp(this.target_, key)) {\n // Existing prop\n if (this.values_.has(key)) {\n // Observable (can be intercepted)\n return this.setObservablePropValue_(key, value);\n } else if (proxyTrap) {\n // Non-observable - proxy\n return Reflect.set(this.target_, key, value);\n } else {\n // Non-observable\n this.target_[key] = value;\n return true;\n }\n } else {\n // New prop\n return this.extend_(key, {\n value: value,\n enumerable: true,\n writable: true,\n configurable: true\n }, this.defaultAnnotation_, proxyTrap);\n }\n }\n // Trap for \"in\"\n ;\n _proto.has_ = function has_(key) {\n if (!globalState.trackingDerivation) {\n // Skip key subscription outside derivation\n return key in this.target_;\n }\n this.pendingKeys_ || (this.pendingKeys_ = new Map());\n var entry = this.pendingKeys_.get(key);\n if (!entry) {\n entry = new ObservableValue(key in this.target_, referenceEnhancer, true ? this.name_ + \".\" + stringifyKey(key) + \"?\" : 0, false);\n this.pendingKeys_.set(key, entry);\n }\n return entry.get();\n }\n /**\n * @param {PropertyKey} key\n * @param {Annotation|boolean} annotation true - use default annotation, false - ignore prop\n */;\n _proto.make_ = function make_(key, annotation) {\n if (annotation === true) {\n annotation = this.defaultAnnotation_;\n }\n if (annotation === false) {\n return;\n }\n assertAnnotable(this, annotation, key);\n if (!(key in this.target_)) {\n var _this$target_$storedA;\n // Throw on missing key, except for decorators:\n // Decorator annotations are collected from whole prototype chain.\n // When called from super() some props may not exist yet.\n // However we don't have to worry about missing prop,\n // because the decorator must have been applied to something.\n if ((_this$target_$storedA = this.target_[storedAnnotationsSymbol]) != null && _this$target_$storedA[key]) {\n return; // will be annotated by subclass constructor\n } else {\n die(1, annotation.annotationType_, this.name_ + \".\" + key.toString());\n }\n }\n var source = this.target_;\n while (source && source !== objectPrototype) {\n var descriptor = getDescriptor(source, key);\n if (descriptor) {\n var outcome = annotation.make_(this, key, descriptor, source);\n if (outcome === 0 /* MakeResult.Cancel */) {\n return;\n }\n if (outcome === 1 /* MakeResult.Break */) {\n break;\n }\n }\n source = Object.getPrototypeOf(source);\n }\n recordAnnotationApplied(this, annotation, key);\n }\n /**\n * @param {PropertyKey} key\n * @param {PropertyDescriptor} descriptor\n * @param {Annotation|boolean} annotation true - use default annotation, false - copy as is\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.extend_ = function extend_(key, descriptor, annotation, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n if (annotation === true) {\n annotation = this.defaultAnnotation_;\n }\n if (annotation === false) {\n return this.defineProperty_(key, descriptor, proxyTrap);\n }\n assertAnnotable(this, annotation, key);\n var outcome = annotation.extend_(this, key, descriptor, proxyTrap);\n if (outcome) {\n recordAnnotationApplied(this, annotation, key);\n }\n return outcome;\n }\n /**\n * @param {PropertyKey} key\n * @param {PropertyDescriptor} descriptor\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.defineProperty_ = function defineProperty_(key, descriptor, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n try {\n startBatch();\n // Delete\n var deleteOutcome = this.delete_(key);\n if (!deleteOutcome) {\n // Failure or intercepted\n return deleteOutcome;\n }\n // ADD interceptor\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: ADD,\n newValue: descriptor.value\n });\n if (!change) {\n return null;\n }\n var newValue = change.newValue;\n if (descriptor.value !== newValue) {\n descriptor = _extends({}, descriptor, {\n value: newValue\n });\n }\n }\n // Define\n if (proxyTrap) {\n if (!Reflect.defineProperty(this.target_, key, descriptor)) {\n return false;\n }\n } else {\n defineProperty(this.target_, key, descriptor);\n }\n // Notify\n this.notifyPropertyAddition_(key, descriptor.value);\n } finally {\n endBatch();\n }\n return true;\n }\n // If original descriptor becomes relevant, move this to annotation directly\n ;\n _proto.defineObservableProperty_ = function defineObservableProperty_(key, value, enhancer, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n try {\n startBatch();\n // Delete\n var deleteOutcome = this.delete_(key);\n if (!deleteOutcome) {\n // Failure or intercepted\n return deleteOutcome;\n }\n // ADD interceptor\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: ADD,\n newValue: value\n });\n if (!change) {\n return null;\n }\n value = change.newValue;\n }\n var cachedDescriptor = getCachedObservablePropDescriptor(key);\n var descriptor = {\n configurable: globalState.safeDescriptors ? this.isPlainObject_ : true,\n enumerable: true,\n get: cachedDescriptor.get,\n set: cachedDescriptor.set\n };\n // Define\n if (proxyTrap) {\n if (!Reflect.defineProperty(this.target_, key, descriptor)) {\n return false;\n }\n } else {\n defineProperty(this.target_, key, descriptor);\n }\n var observable = new ObservableValue(value, enhancer, true ? this.name_ + \".\" + key.toString() : 0, false);\n this.values_.set(key, observable);\n // Notify (value possibly changed by ObservableValue)\n this.notifyPropertyAddition_(key, observable.value_);\n } finally {\n endBatch();\n }\n return true;\n }\n // If original descriptor becomes relevant, move this to annotation directly\n ;\n _proto.defineComputedProperty_ = function defineComputedProperty_(key, options, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n try {\n startBatch();\n // Delete\n var deleteOutcome = this.delete_(key);\n if (!deleteOutcome) {\n // Failure or intercepted\n return deleteOutcome;\n }\n // ADD interceptor\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: ADD,\n newValue: undefined\n });\n if (!change) {\n return null;\n }\n }\n options.name || (options.name = true ? this.name_ + \".\" + key.toString() : 0);\n options.context = this.proxy_ || this.target_;\n var cachedDescriptor = getCachedObservablePropDescriptor(key);\n var descriptor = {\n configurable: globalState.safeDescriptors ? this.isPlainObject_ : true,\n enumerable: false,\n get: cachedDescriptor.get,\n set: cachedDescriptor.set\n };\n // Define\n if (proxyTrap) {\n if (!Reflect.defineProperty(this.target_, key, descriptor)) {\n return false;\n }\n } else {\n defineProperty(this.target_, key, descriptor);\n }\n this.values_.set(key, new ComputedValue(options));\n // Notify\n this.notifyPropertyAddition_(key, undefined);\n } finally {\n endBatch();\n }\n return true;\n }\n /**\n * @param {PropertyKey} key\n * @param {PropertyDescriptor} descriptor\n * @param {boolean} proxyTrap whether it's called from proxy trap\n * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n */;\n _proto.delete_ = function delete_(key, proxyTrap) {\n if (proxyTrap === void 0) {\n proxyTrap = false;\n }\n checkIfStateModificationsAreAllowed(this.keysAtom_);\n // No such prop\n if (!hasProp(this.target_, key)) {\n return true;\n }\n // Intercept\n if (hasInterceptors(this)) {\n var change = interceptChange(this, {\n object: this.proxy_ || this.target_,\n name: key,\n type: REMOVE\n });\n // Cancelled\n if (!change) {\n return null;\n }\n }\n // Delete\n try {\n var _this$pendingKeys_;\n startBatch();\n var notify = hasListeners(this);\n var notifySpy = true && isSpyEnabled();\n var observable = this.values_.get(key);\n // Value needed for spies/listeners\n var value = undefined;\n // Optimization: don't pull the value unless we will need it\n if (!observable && (notify || notifySpy)) {\n var _getDescriptor;\n value = (_getDescriptor = getDescriptor(this.target_, key)) == null ? void 0 : _getDescriptor.value;\n }\n // delete prop (do first, may fail)\n if (proxyTrap) {\n if (!Reflect.deleteProperty(this.target_, key)) {\n return false;\n }\n } else {\n delete this.target_[key];\n }\n // Allow re-annotating this field\n if (true) {\n delete this.appliedAnnotations_[key];\n }\n // Clear observable\n if (observable) {\n this.values_[\"delete\"](key);\n // for computed, value is undefined\n if (observable instanceof ObservableValue) {\n value = observable.value_;\n }\n // Notify: autorun(() => obj[key]), see #1796\n propagateChanged(observable);\n }\n // Notify \"keys/entries/values\" observers\n this.keysAtom_.reportChanged();\n // Notify \"has\" observers\n // \"in\" as it may still exist in proto\n (_this$pendingKeys_ = this.pendingKeys_) == null || (_this$pendingKeys_ = _this$pendingKeys_.get(key)) == null || _this$pendingKeys_.set(key in this.target_);\n // Notify spies/listeners\n if (notify || notifySpy) {\n var _change2 = {\n type: REMOVE,\n observableKind: \"object\",\n object: this.proxy_ || this.target_,\n debugObjectName: this.name_,\n oldValue: value,\n name: key\n };\n if ( true && notifySpy) {\n spyReportStart(_change2);\n }\n if (notify) {\n notifyListeners(this, _change2);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n } finally {\n endBatch();\n }\n return true;\n }\n /**\n * Observes this object. Triggers for the events 'add', 'update' and 'delete'.\n * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe\n * for callback details\n */;\n _proto.observe_ = function observe_(callback, fireImmediately) {\n if ( true && fireImmediately === true) {\n die(\"`observe` doesn't support the fire immediately property for observable objects.\");\n }\n return registerListener(this, callback);\n };\n _proto.intercept_ = function intercept_(handler) {\n return registerInterceptor(this, handler);\n };\n _proto.notifyPropertyAddition_ = function notifyPropertyAddition_(key, value) {\n var _this$pendingKeys_2;\n var notify = hasListeners(this);\n var notifySpy = true && isSpyEnabled();\n if (notify || notifySpy) {\n var change = notify || notifySpy ? {\n type: ADD,\n observableKind: \"object\",\n debugObjectName: this.name_,\n object: this.proxy_ || this.target_,\n name: key,\n newValue: value\n } : null;\n if ( true && notifySpy) {\n spyReportStart(change);\n }\n if (notify) {\n notifyListeners(this, change);\n }\n if ( true && notifySpy) {\n spyReportEnd();\n }\n }\n (_this$pendingKeys_2 = this.pendingKeys_) == null || (_this$pendingKeys_2 = _this$pendingKeys_2.get(key)) == null || _this$pendingKeys_2.set(true);\n // Notify \"keys/entries/values\" observers\n this.keysAtom_.reportChanged();\n };\n _proto.ownKeys_ = function ownKeys_() {\n this.keysAtom_.reportObserved();\n return ownKeys(this.target_);\n };\n _proto.keys_ = function keys_() {\n // Returns enumerable && own, but unfortunately keysAtom will report on ANY key change.\n // There is no way to distinguish between Object.keys(object) and Reflect.ownKeys(object) - both are handled by ownKeys trap.\n // We can either over-report in Object.keys(object) or under-report in Reflect.ownKeys(object)\n // We choose to over-report in Object.keys(object), because:\n // - typically it's used with simple data objects\n // - when symbolic/non-enumerable keys are relevant Reflect.ownKeys works as expected\n this.keysAtom_.reportObserved();\n return Object.keys(this.target_);\n };\n return ObservableObjectAdministration;\n}();\nfunction asObservableObject(target, options) {\n var _options$name;\n if ( true && options && isObservableObject(target)) {\n die(\"Options can't be provided for already observable objects.\");\n }\n if (hasProp(target, $mobx)) {\n if ( true && !(getAdministration(target) instanceof ObservableObjectAdministration)) {\n die(\"Cannot convert '\" + getDebugName(target) + \"' into observable object:\" + \"\\nThe target is already observable of different type.\" + \"\\nExtending builtins is not supported.\");\n }\n return target;\n }\n if ( true && !Object.isExtensible(target)) {\n die(\"Cannot make the designated object observable; it is not extensible\");\n }\n var name = (_options$name = options == null ? void 0 : options.name) != null ? _options$name : true ? (isPlainObject(target) ? \"ObservableObject\" : target.constructor.name) + \"@\" + getNextId() : 0;\n var adm = new ObservableObjectAdministration(target, new Map(), String(name), getAnnotationFromOptions(options));\n addHiddenProp(target, $mobx, adm);\n return target;\n}\nvar isObservableObjectAdministration = /*#__PURE__*/createInstanceofPredicate(\"ObservableObjectAdministration\", ObservableObjectAdministration);\nfunction getCachedObservablePropDescriptor(key) {\n return descriptorCache[key] || (descriptorCache[key] = {\n get: function get() {\n return this[$mobx].getObservablePropValue_(key);\n },\n set: function set(value) {\n return this[$mobx].setObservablePropValue_(key, value);\n }\n });\n}\nfunction isObservableObject(thing) {\n if (isObject(thing)) {\n return isObservableObjectAdministration(thing[$mobx]);\n }\n return false;\n}\nfunction recordAnnotationApplied(adm, annotation, key) {\n var _adm$target_$storedAn;\n if (true) {\n adm.appliedAnnotations_[key] = annotation;\n }\n // Remove applied decorator annotation so we don't try to apply it again in subclass constructor\n (_adm$target_$storedAn = adm.target_[storedAnnotationsSymbol]) == null || delete _adm$target_$storedAn[key];\n}\nfunction assertAnnotable(adm, annotation, key) {\n // Valid annotation\n if ( true && !isAnnotation(annotation)) {\n die(\"Cannot annotate '\" + adm.name_ + \".\" + key.toString() + \"': Invalid annotation.\");\n }\n /*\n // Configurable, not sealed, not frozen\n // Possibly not needed, just a little better error then the one thrown by engine.\n // Cases where this would be useful the most (subclass field initializer) are not interceptable by this.\n if (__DEV__) {\n const configurable = getDescriptor(adm.target_, key)?.configurable\n const frozen = Object.isFrozen(adm.target_)\n const sealed = Object.isSealed(adm.target_)\n if (!configurable || frozen || sealed) {\n const fieldName = `${adm.name_}.${key.toString()}`\n const requestedAnnotationType = annotation.annotationType_\n let error = `Cannot apply '${requestedAnnotationType}' to '${fieldName}':`\n if (frozen) {\n error += `\\nObject is frozen.`\n }\n if (sealed) {\n error += `\\nObject is sealed.`\n }\n if (!configurable) {\n error += `\\nproperty is not configurable.`\n // Mention only if caused by us to avoid confusion\n if (hasProp(adm.appliedAnnotations!, key)) {\n error += `\\nTo prevent accidental re-definition of a field by a subclass, `\n error += `all annotated fields of non-plain objects (classes) are not configurable.`\n }\n }\n die(error)\n }\n }\n */\n // Not annotated\n if ( true && !isOverride(annotation) && hasProp(adm.appliedAnnotations_, key)) {\n var fieldName = adm.name_ + \".\" + key.toString();\n var currentAnnotationType = adm.appliedAnnotations_[key].annotationType_;\n var requestedAnnotationType = annotation.annotationType_;\n die(\"Cannot apply '\" + requestedAnnotationType + \"' to '\" + fieldName + \"':\" + (\"\\nThe field is already annotated with '\" + currentAnnotationType + \"'.\") + \"\\nRe-annotating fields is not allowed.\" + \"\\nUse 'override' annotation for methods overridden by subclass.\");\n }\n}\n\n// Bug in safari 9.* (or iOS 9 safari mobile). See #364\nvar ENTRY_0 = /*#__PURE__*/createArrayEntryDescriptor(0);\nvar safariPrototypeSetterInheritanceBug = /*#__PURE__*/function () {\n var v = false;\n var p = {};\n Object.defineProperty(p, \"0\", {\n set: function set() {\n v = true;\n }\n });\n /*#__PURE__*/Object.create(p)[\"0\"] = 1;\n return v === false;\n}();\n/**\n * This array buffer contains two lists of properties, so that all arrays\n * can recycle their property definitions, which significantly improves performance of creating\n * properties on the fly.\n */\nvar OBSERVABLE_ARRAY_BUFFER_SIZE = 0;\n// Typescript workaround to make sure ObservableArray extends Array\nvar StubArray = function StubArray() {};\nfunction inherit(ctor, proto) {\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(ctor.prototype, proto);\n } else if (ctor.prototype.__proto__ !== undefined) {\n ctor.prototype.__proto__ = proto;\n } else {\n ctor.prototype = proto;\n }\n}\ninherit(StubArray, Array.prototype);\n// Weex proto freeze protection was here,\n// but it is unclear why the hack is need as MobX never changed the prototype\n// anyway, so removed it in V6\nvar LegacyObservableArray = /*#__PURE__*/function (_StubArray) {\n function LegacyObservableArray(initialValues, enhancer, name, owned) {\n var _this;\n if (name === void 0) {\n name = true ? \"ObservableArray@\" + getNextId() : 0;\n }\n if (owned === void 0) {\n owned = false;\n }\n _this = _StubArray.call(this) || this;\n initObservable(function () {\n var adm = new ObservableArrayAdministration(name, enhancer, owned, true);\n adm.proxy_ = _this;\n addHiddenFinalProp(_this, $mobx, adm);\n if (initialValues && initialValues.length) {\n // @ts-ignore\n _this.spliceWithArray(0, 0, initialValues);\n }\n if (safariPrototypeSetterInheritanceBug) {\n // Seems that Safari won't use numeric prototype setter until any * numeric property is\n // defined on the instance. After that it works fine, even if this property is deleted.\n Object.defineProperty(_this, \"0\", ENTRY_0);\n }\n });\n return _this;\n }\n _inheritsLoose(LegacyObservableArray, _StubArray);\n var _proto = LegacyObservableArray.prototype;\n _proto.concat = function concat() {\n this[$mobx].atom_.reportObserved();\n for (var _len = arguments.length, arrays = new Array(_len), _key = 0; _key < _len; _key++) {\n arrays[_key] = arguments[_key];\n }\n return Array.prototype.concat.apply(this.slice(),\n //@ts-ignore\n arrays.map(function (a) {\n return isObservableArray(a) ? a.slice() : a;\n }));\n };\n _proto[Symbol.iterator] = function () {\n var self = this;\n var nextIndex = 0;\n return makeIterable({\n next: function next() {\n return nextIndex < self.length ? {\n value: self[nextIndex++],\n done: false\n } : {\n done: true,\n value: undefined\n };\n }\n });\n };\n return _createClass(LegacyObservableArray, [{\n key: \"length\",\n get: function get() {\n return this[$mobx].getArrayLength_();\n },\n set: function set(newLength) {\n this[$mobx].setArrayLength_(newLength);\n }\n }, {\n key: Symbol.toStringTag,\n get: function get() {\n return \"Array\";\n }\n }]);\n}(StubArray);\nObject.entries(arrayExtensions).forEach(function (_ref) {\n var prop = _ref[0],\n fn = _ref[1];\n if (prop !== \"concat\") {\n addHiddenProp(LegacyObservableArray.prototype, prop, fn);\n }\n});\nfunction createArrayEntryDescriptor(index) {\n return {\n enumerable: false,\n configurable: true,\n get: function get() {\n return this[$mobx].get_(index);\n },\n set: function set(value) {\n this[$mobx].set_(index, value);\n }\n };\n}\nfunction createArrayBufferItem(index) {\n defineProperty(LegacyObservableArray.prototype, \"\" + index, createArrayEntryDescriptor(index));\n}\nfunction reserveArrayBuffer(max) {\n if (max > OBSERVABLE_ARRAY_BUFFER_SIZE) {\n for (var index = OBSERVABLE_ARRAY_BUFFER_SIZE; index < max + 100; index++) {\n createArrayBufferItem(index);\n }\n OBSERVABLE_ARRAY_BUFFER_SIZE = max;\n }\n}\nreserveArrayBuffer(1000);\nfunction createLegacyArray(initialValues, enhancer, name) {\n return new LegacyObservableArray(initialValues, enhancer, name);\n}\n\nfunction getAtom(thing, property) {\n if (typeof thing === \"object\" && thing !== null) {\n if (isObservableArray(thing)) {\n if (property !== undefined) {\n die(23);\n }\n return thing[$mobx].atom_;\n }\n if (isObservableSet(thing)) {\n return thing.atom_;\n }\n if (isObservableMap(thing)) {\n if (property === undefined) {\n return thing.keysAtom_;\n }\n var observable = thing.data_.get(property) || thing.hasMap_.get(property);\n if (!observable) {\n die(25, property, getDebugName(thing));\n }\n return observable;\n }\n if (isObservableObject(thing)) {\n if (!property) {\n return die(26);\n }\n var _observable = thing[$mobx].values_.get(property);\n if (!_observable) {\n die(27, property, getDebugName(thing));\n }\n return _observable;\n }\n if (isAtom(thing) || isComputedValue(thing) || isReaction(thing)) {\n return thing;\n }\n } else if (isFunction(thing)) {\n if (isReaction(thing[$mobx])) {\n // disposer function\n return thing[$mobx];\n }\n }\n die(28);\n}\nfunction getAdministration(thing, property) {\n if (!thing) {\n die(29);\n }\n if (property !== undefined) {\n return getAdministration(getAtom(thing, property));\n }\n if (isAtom(thing) || isComputedValue(thing) || isReaction(thing)) {\n return thing;\n }\n if (isObservableMap(thing) || isObservableSet(thing)) {\n return thing;\n }\n if (thing[$mobx]) {\n return thing[$mobx];\n }\n die(24, thing);\n}\nfunction getDebugName(thing, property) {\n var named;\n if (property !== undefined) {\n named = getAtom(thing, property);\n } else if (isAction(thing)) {\n return thing.name;\n } else if (isObservableObject(thing) || isObservableMap(thing) || isObservableSet(thing)) {\n named = getAdministration(thing);\n } else {\n // valid for arrays as well\n named = getAtom(thing);\n }\n return named.name_;\n}\n/**\n * Helper function for initializing observable structures, it applies:\n * 1. allowStateChanges so we don't violate enforceActions.\n * 2. untracked so we don't accidentaly subscribe to anything observable accessed during init in case the observable is created inside derivation.\n * 3. batch to avoid state version updates\n */\nfunction initObservable(cb) {\n var derivation = untrackedStart();\n var allowStateChanges = allowStateChangesStart(true);\n startBatch();\n try {\n return cb();\n } finally {\n endBatch();\n allowStateChangesEnd(allowStateChanges);\n untrackedEnd(derivation);\n }\n}\n\nvar toString = objectPrototype.toString;\nfunction deepEqual(a, b, depth) {\n if (depth === void 0) {\n depth = -1;\n }\n return eq(a, b, depth);\n}\n// Copied from https://github.com/jashkenas/underscore/blob/5c237a7c682fb68fd5378203f0bf22dce1624854/underscore.js#L1186-L1289\n// Internal recursive comparison function for `isEqual`.\nfunction eq(a, b, depth, aStack, bStack) {\n // Identical objects are equal. `0 === -0`, but they aren't identical.\n // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).\n if (a === b) {\n return a !== 0 || 1 / a === 1 / b;\n }\n // `null` or `undefined` only equal to itself (strict comparison).\n if (a == null || b == null) {\n return false;\n }\n // `NaN`s are equivalent, but non-reflexive.\n if (a !== a) {\n return b !== b;\n }\n // Exhaust primitive checks\n var type = typeof a;\n if (type !== \"function\" && type !== \"object\" && typeof b != \"object\") {\n return false;\n }\n // Compare `[[Class]]` names.\n var className = toString.call(a);\n if (className !== toString.call(b)) {\n return false;\n }\n switch (className) {\n // Strings, numbers, regular expressions, dates, and booleans are compared by value.\n case \"[object RegExp]\":\n // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i')\n case \"[object String]\":\n // Primitives and their corresponding object wrappers are equivalent; thus, `\"5\"` is\n // equivalent to `new String(\"5\")`.\n return \"\" + a === \"\" + b;\n case \"[object Number]\":\n // `NaN`s are equivalent, but non-reflexive.\n // Object(NaN) is equivalent to NaN.\n if (+a !== +a) {\n return +b !== +b;\n }\n // An `egal` comparison is performed for other numeric values.\n return +a === 0 ? 1 / +a === 1 / b : +a === +b;\n case \"[object Date]\":\n case \"[object Boolean]\":\n // Coerce dates and booleans to numeric primitive values. Dates are compared by their\n // millisecond representations. Note that invalid dates with millisecond representations\n // of `NaN` are not equivalent.\n return +a === +b;\n case \"[object Symbol]\":\n return typeof Symbol !== \"undefined\" && Symbol.valueOf.call(a) === Symbol.valueOf.call(b);\n case \"[object Map]\":\n case \"[object Set]\":\n // Maps and Sets are unwrapped to arrays of entry-pairs, adding an incidental level.\n // Hide this extra level by increasing the depth.\n if (depth >= 0) {\n depth++;\n }\n break;\n }\n // Unwrap any wrapped objects.\n a = unwrap(a);\n b = unwrap(b);\n var areArrays = className === \"[object Array]\";\n if (!areArrays) {\n if (typeof a != \"object\" || typeof b != \"object\") {\n return false;\n }\n // Objects with different constructors are not equivalent, but `Object`s or `Array`s\n // from different frames are.\n var aCtor = a.constructor,\n bCtor = b.constructor;\n if (aCtor !== bCtor && !(isFunction(aCtor) && aCtor instanceof aCtor && isFunction(bCtor) && bCtor instanceof bCtor) && \"constructor\" in a && \"constructor\" in b) {\n return false;\n }\n }\n if (depth === 0) {\n return false;\n } else if (depth < 0) {\n depth = -1;\n }\n // Assume equality for cyclic structures. The algorithm for detecting cyclic\n // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.\n // Initializing stack of traversed objects.\n // It's done here since we only need them for objects and arrays comparison.\n aStack = aStack || [];\n bStack = bStack || [];\n var length = aStack.length;\n while (length--) {\n // Linear search. Performance is inversely proportional to the number of\n // unique nested structures.\n if (aStack[length] === a) {\n return bStack[length] === b;\n }\n }\n // Add the first object to the stack of traversed objects.\n aStack.push(a);\n bStack.push(b);\n // Recursively compare objects and arrays.\n if (areArrays) {\n // Compare array lengths to determine if a deep comparison is necessary.\n length = a.length;\n if (length !== b.length) {\n return false;\n }\n // Deep compare the contents, ignoring non-numeric properties.\n while (length--) {\n if (!eq(a[length], b[length], depth - 1, aStack, bStack)) {\n return false;\n }\n }\n } else {\n // Deep compare objects.\n var keys = Object.keys(a);\n var key;\n length = keys.length;\n // Ensure that both objects contain the same number of properties before comparing deep equality.\n if (Object.keys(b).length !== length) {\n return false;\n }\n while (length--) {\n // Deep compare each member\n key = keys[length];\n if (!(hasProp(b, key) && eq(a[key], b[key], depth - 1, aStack, bStack))) {\n return false;\n }\n }\n }\n // Remove the first object from the stack of traversed objects.\n aStack.pop();\n bStack.pop();\n return true;\n}\nfunction unwrap(a) {\n if (isObservableArray(a)) {\n return a.slice();\n }\n if (isES6Map(a) || isObservableMap(a)) {\n return Array.from(a.entries());\n }\n if (isES6Set(a) || isObservableSet(a)) {\n return Array.from(a.entries());\n }\n return a;\n}\n\nvar _getGlobal$Iterator;\n// safely get iterator prototype if available\nvar maybeIteratorPrototype = ((_getGlobal$Iterator = /*#__PURE__*/getGlobal().Iterator) == null ? void 0 : _getGlobal$Iterator.prototype) || {};\nfunction makeIterable(iterator) {\n iterator[Symbol.iterator] = getSelf;\n return Object.assign(Object.create(maybeIteratorPrototype), iterator);\n}\nfunction getSelf() {\n return this;\n}\n\nfunction isAnnotation(thing) {\n return (\n // Can be function\n thing instanceof Object && typeof thing.annotationType_ === \"string\" && isFunction(thing.make_) && isFunction(thing.extend_)\n );\n}\n\n/**\n * (c) Michel Weststrate 2015 - 2020\n * MIT Licensed\n *\n * Welcome to the mobx sources! To get a global overview of how MobX internally works,\n * this is a good place to start:\n * https://medium.com/@mweststrate/becoming-fully-reactive-an-in-depth-explanation-of-mobservable-55995262a254#.xvbh6qd74\n *\n * Source folders:\n * ===============\n *\n * - api/ Most of the public static methods exposed by the module can be found here.\n * - core/ Implementation of the MobX algorithm; atoms, derivations, reactions, dependency trees, optimizations. Cool stuff can be found here.\n * - types/ All the magic that is need to have observable objects, arrays and values is in this folder. Including the modifiers like `asFlat`.\n * - utils/ Utility stuff.\n *\n */\n[\"Symbol\", \"Map\", \"Set\"].forEach(function (m) {\n var g = getGlobal();\n if (typeof g[m] === \"undefined\") {\n die(\"MobX requires global '\" + m + \"' to be available or polyfilled\");\n }\n});\nif (typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__ === \"object\") {\n // See: https://github.com/andykog/mobx-devtools/\n __MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({\n spy: spy,\n extras: {\n getDebugName: getDebugName\n },\n $mobx: $mobx\n });\n}\n\n\n//# sourceMappingURL=mobx.esm.js.map\n\n\n//# sourceURL=webpack://app_adyen_SFRA/./node_modules/mobx/dist/mobx.esm.js?"); /***/ }) diff --git a/cartridges/app_adyen_SFRA/cartridge/templates/default/checkout/billing/adyenComponentForm.isml b/cartridges/app_adyen_SFRA/cartridge/templates/default/checkout/billing/adyenComponentForm.isml index b0e84e55c..caf04bbcf 100644 --- a/cartridges/app_adyen_SFRA/cartridge/templates/default/checkout/billing/adyenComponentForm.isml +++ b/cartridges/app_adyen_SFRA/cartridge/templates/default/checkout/billing/adyenComponentForm.isml @@ -59,7 +59,7 @@ window.installments = '${pdict.adyen.installments}'; window.googleMerchantID = '${pdict.adyen.googleMerchantID}'; window.merchantAccount = '${pdict.adyen.merchantAccount}'; - window.customerEmail = '${customer && customer.profile && customer.profile.email ? customer.profile.email : ''}'; + window.customerEmail = '${pdict.AdyenHelper.getCustomerEmail()}'; var showStoreDetails = ${customer.authenticated && adyenRecurringPaymentsEnabled}; diff --git a/cartridges/bm_adyen/.project b/cartridges/bm_adyen/.project index e29b44b33..8a70a885c 100644 --- a/cartridges/bm_adyen/.project +++ b/cartridges/bm_adyen/.project @@ -1,7 +1,7 @@ bm_adyen - v24.4.0 + v24.4.1 diff --git a/cartridges/bm_adyen/cartridge/templates/default/order/PaymentInstrumentInfo_Adyen.isml b/cartridges/bm_adyen/cartridge/templates/default/order/PaymentInstrumentInfo_Adyen.isml index 25bd36677..6f183e69f 100644 --- a/cartridges/bm_adyen/cartridge/templates/default/order/PaymentInstrumentInfo_Adyen.isml +++ b/cartridges/bm_adyen/cartridge/templates/default/order/PaymentInstrumentInfo_Adyen.isml @@ -26,7 +26,21 @@ - PSP reference + + PSP reference + + + var mode : String = dw.system.Site.getCurrent().getCustomPreferenceValue("Adyen_Mode"); + var urlPrefixType : String = 'test'; + if (mode == 'LIVE') { + urlPrefixType = 'live'; + } + + + + + + Payment Method Eventcode @@ -80,4 +94,4 @@ \ No newline at end of file +--> diff --git a/cartridges/bm_adyen/cartridge/templates/default/order/PaymentInstrumentInfo_Adyen_Component.isml b/cartridges/bm_adyen/cartridge/templates/default/order/PaymentInstrumentInfo_Adyen_Component.isml index bb973a55d..240ea03f0 100644 --- a/cartridges/bm_adyen/cartridge/templates/default/order/PaymentInstrumentInfo_Adyen_Component.isml +++ b/cartridges/bm_adyen/cartridge/templates/default/order/PaymentInstrumentInfo_Adyen_Component.isml @@ -1,5 +1,4 @@ - @@ -27,7 +26,21 @@ - PSP reference + + PSP reference + + + var mode : String = dw.system.Site.getCurrent().getCustomPreferenceValue("Adyen_Mode"); + var urlPrefixType : String = 'test'; + if (mode == 'LIVE') { + urlPrefixType = 'live'; + } + + + + + + Payment Method Eventcode @@ -90,4 +103,4 @@
- \ No newline at end of file + diff --git a/cartridges/int_adyen_SFRA/.project b/cartridges/int_adyen_SFRA/.project index 99bf30e84..c53edc671 100644 --- a/cartridges/int_adyen_SFRA/.project +++ b/cartridges/int_adyen_SFRA/.project @@ -1,7 +1,7 @@ int_adyen_SFRA - v24.4.0 + v24.4.1 diff --git a/cartridges/int_adyen_SFRA/cartridge/adyen/config/constants.js b/cartridges/int_adyen_SFRA/cartridge/adyen/config/constants.js index 986380f90..81c0554e1 100644 --- a/cartridges/int_adyen_SFRA/cartridge/adyen/config/constants.js +++ b/cartridges/int_adyen_SFRA/cartridge/adyen/config/constants.js @@ -33,7 +33,7 @@ module.exports = { AMAZONPAY: 'amazonpay', PAYPAL: 'paypal' }, - CAN_SKIP_SUMMARY_PAGE: ['applepay', 'cashapp'], + CAN_SKIP_SUMMARY_PAGE: ['applepay', 'cashapp', 'upi'], SERVICE: { PAYMENT: 'AdyenPayment', PAYMENTDETAILS: 'AdyenPaymentDetails', @@ -85,6 +85,6 @@ module.exports = { EXTERNAL_PLATFORM_NAME: 'SalesforceCommerceCloud', EXTERNAL_PLATFORM_VERSION: 'SFRA', APPLE_DOMAIN_URL: '/.well-known/apple-developer-merchantid-domain-association', - CHECKOUT_COMPONENT_VERSION: '5.65.0', - VERSION: '24.4.0' + CHECKOUT_COMPONENT_VERSION: '5.68.0', + VERSION: '24.4.1' }; \ No newline at end of file diff --git a/cartridges/int_adyen_SFRA/cartridge/adyen/scripts/payments/adyenCheckout.js b/cartridges/int_adyen_SFRA/cartridge/adyen/scripts/payments/adyenCheckout.js index f70ae457b..67f5acbad 100644 --- a/cartridges/int_adyen_SFRA/cartridge/adyen/scripts/payments/adyenCheckout.js +++ b/cartridges/int_adyen_SFRA/cartridge/adyen/scripts/payments/adyenCheckout.js @@ -178,7 +178,8 @@ function createPaymentRequest(args) { shipping_type: shippingMethod === null || shippingMethod === void 0 ? void 0 : shippingMethod.description, first_name: address.firstName, last_name: address.lastName, - street_address: "".concat(address.address1, " ").concat(address.address2), + street_address: address.address1, + street_number: address.address2, postal_code: address.postalCode, city: address.city, country: address.countryCode.value diff --git a/cartridges/int_adyen_SFRA/cartridge/adyen/utils/adyenHelper.js b/cartridges/int_adyen_SFRA/cartridge/adyen/utils/adyenHelper.js index 3932ff023..d7b45c849 100644 --- a/cartridges/int_adyen_SFRA/cartridge/adyen/utils/adyenHelper.js +++ b/cartridges/int_adyen_SFRA/cartridge/adyen/utils/adyenHelper.js @@ -39,6 +39,7 @@ var StringUtils = require('dw/util/StringUtils'); var Money = require('dw/value/Money'); var TaxMgr = require('dw/order/TaxMgr'); var ShippingLocation = require('dw/order/ShippingLocation'); +var BasketMgr = require('dw/order/BasketMgr'); //script includes var ShippingMethodModel = require('*/cartridge/models/shipping/shippingMethod'); var collections = require('*/cartridge/scripts/util/collections'); @@ -262,7 +263,6 @@ var adyenHelperObj = { return signature; }, getBasketAmount: function getBasketAmount() { - var BasketMgr = require('dw/order/BasketMgr'); var currentBasket = BasketMgr.getCurrentBasket(); if (!currentBasket) { return; @@ -273,6 +273,10 @@ var adyenHelperObj = { }; return JSON.stringify(amount); }, + getCustomerEmail: function getCustomerEmail() { + var currentBasket = BasketMgr.getCurrentBasket(); + return currentBasket ? currentBasket.customerEmail : ''; + }, // returns an array containing the donation amounts configured in the custom preferences for Adyen Giving getDonationAmounts: function getDonationAmounts() { var returnValue = []; diff --git a/cartridges/int_custom_cartridge/.project b/cartridges/int_custom_cartridge/.project index 5793b4094..6dec5f788 100644 --- a/cartridges/int_custom_cartridge/.project +++ b/cartridges/int_custom_cartridge/.project @@ -1,7 +1,7 @@ int_custom_cartridge - v24.4.0 + v24.4.1 diff --git a/package-lock.json b/package-lock.json index 17cb76267..7f1c32bb7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "app_adyen_SFRA", - "version": "24.4.0", + "version": "24.4.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "app_adyen_SFRA", - "version": "24.4.0", + "version": "24.4.1", "hasInstallScript": true, "dependencies": { "mobx": "^6.0.0", diff --git a/package.json b/package.json index 12bf6dbca..f647a5d0c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "app_adyen_SFRA", - "version": "24.4.0", + "version": "24.4.1", "description": "Adyen's official cartridge for SFRA", "main": "index.js", "paths": { diff --git a/src/cartridges/app_adyen_SFRA/cartridge/client/default/js/adyenCheckout.js b/src/cartridges/app_adyen_SFRA/cartridge/client/default/js/adyenCheckout.js index d571b2101..4bc2c228d 100644 --- a/src/cartridges/app_adyen_SFRA/cartridge/client/default/js/adyenCheckout.js +++ b/src/cartridges/app_adyen_SFRA/cartridge/client/default/js/adyenCheckout.js @@ -45,6 +45,14 @@ if ( ] = window.googleMerchantID; } +$('body').on('checkout:updateCheckoutView', (event, data) => { + if (data.order.orderEmail) { + const { clickToPayConfiguration } = + store.checkoutConfiguration.paymentMethodsConfiguration.card; + clickToPayConfiguration.shopperEmail = data.order.orderEmail; + } +}); + // Submit the payment $('button[value="submit-payment"]').on('click', () => { if (store.paypalTerminatedEarly) { diff --git a/src/cartridges/app_adyen_SFRA/cartridge/client/default/js/adyen_checkout/__tests__/checkoutConfiguration.test.js b/src/cartridges/app_adyen_SFRA/cartridge/client/default/js/adyen_checkout/__tests__/checkoutConfiguration.test.js index 0b766b384..31e2265d4 100644 --- a/src/cartridges/app_adyen_SFRA/cartridge/client/default/js/adyen_checkout/__tests__/checkoutConfiguration.test.js +++ b/src/cartridges/app_adyen_SFRA/cartridge/client/default/js/adyen_checkout/__tests__/checkoutConfiguration.test.js @@ -29,6 +29,8 @@ beforeEach(() => { querySelector = document.querySelector; window.Configuration = { environment: 'TEST' }; window.klarnaWidgetEnabled = true; + window.merchantAccount = 'test_merchant'; + window.customerEmail = 'test@email.com'; store.checkoutConfiguration = {}; setCheckoutConfiguration() card = getCardConfig(); @@ -49,6 +51,8 @@ describe('Checkout Configuration', () => { const data = { paymentMethod: { type: 'scheme' } }; card.onChange({ isValid: true, data }, { props: { holderName: 'test' } }); expect(store.selectedPayment.isValid).toBeTruthy(); + expect(card.clickToPayConfiguration.shopperEmail).toBe(window.customerEmail); + expect(card.clickToPayConfiguration.merchantDisplayName).toBe(window.merchantAccount); }); it('handles onFieldValid', () => { diff --git a/src/cartridges/app_adyen_SFRA/cartridge/client/default/js/adyen_checkout/checkoutConfiguration.js b/src/cartridges/app_adyen_SFRA/cartridge/client/default/js/adyen_checkout/checkoutConfiguration.js index 84bbcb0f9..d94cc8b45 100644 --- a/src/cartridges/app_adyen_SFRA/cartridge/client/default/js/adyen_checkout/checkoutConfiguration.js +++ b/src/cartridges/app_adyen_SFRA/cartridge/client/default/js/adyen_checkout/checkoutConfiguration.js @@ -23,23 +23,13 @@ function getCardConfig() { merchantDisplayName: window.merchantAccount, }, exposeExpiryDate: false, - onChange(state, component) { + onChange(state) { store.isValid = state.isValid; const method = state.data.paymentMethod.storedPaymentMethodId ? `storedCard${state.data.paymentMethod.storedPaymentMethodId}` : store.selectedMethod; store.updateSelectedPayment(method, 'isValid', store.isValid); - if (state.data?.paymentMethod?.storedPaymentMethodId) { - const { holderName } = component.props; - const { paymentMethod } = state.data; - paymentMethod.holderName = holderName; - store.updateSelectedPayment(method, 'stateData', { - ...state.data, - paymentMethod, - }); - } else { - store.updateSelectedPayment(method, 'stateData', state.data); - } + store.updateSelectedPayment(method, 'stateData', state.data); }, onSubmit: () => { helpers.assignPaymentMethodValue(); @@ -199,9 +189,8 @@ function getGiftCardConfig() { async: false, success: (data) => { giftcardBalance = data.balance; - document.querySelector( - 'button[value="submit-payment"]', - ).disabled = false; + document.querySelector('button[value="submit-payment"]').disabled = + false; if (data.resultCode === constants.SUCCESS) { const { giftCardsInfoMessageContainer, @@ -227,9 +216,8 @@ function getGiftCardConfig() { initialPartialObject.totalDiscountedAmount; }); - document.querySelector( - 'button[value="submit-payment"]', - ).disabled = true; + document.querySelector('button[value="submit-payment"]').disabled = + true; giftCardsInfoMessageContainer.innerHTML = ''; giftCardsInfoMessageContainer.classList.remove( 'gift-cards-info-message-container', @@ -284,11 +272,7 @@ function getGiftCardConfig() { } function handleOnChange(state) { - let { type } = state.data.paymentMethod; - const multipleTxVariantComponents = constants.MULTIPLE_TX_VARIANTS_COMPONENTS; - if (multipleTxVariantComponents.includes(store.selectedMethod)) { - type = store.selectedMethod; - } + const { type } = state.data.paymentMethod; store.isValid = state.isValid; if (!store.componentsObj[type]) { store.componentsObj[type] = {}; @@ -391,6 +375,29 @@ function getKlarnaConfig() { return null; } +function getUpiConfig() { + return { + showPayButton: true, + onSubmit: (state, component) => { + $('#dwfrm_billing').trigger('submit'); + helpers.assignPaymentMethodValue(); + helpers.paymentFromComponent(state.data, component); + }, + onAdditionalDetails: (state) => { + document.querySelector('#additionalDetailsHidden').value = JSON.stringify( + state.data, + ); + document.querySelector('#showConfirmationForm').submit(); + }, + onError: (component) => { + if (component) { + component.setStatus('ready'); + } + document.querySelector('#showConfirmationForm').submit(); + }, + }; +} + function setCheckoutConfiguration() { store.checkoutConfiguration.onChange = handleOnChange; store.checkoutConfiguration.onAdditionalDetails = handleOnAdditionalDetails; @@ -419,6 +426,7 @@ function setCheckoutConfiguration() { klarna_account: getKlarnaConfig(), klarna_paynow: getKlarnaConfig(), cashapp: getCashAppConfig(), + upi: getUpiConfig(), }; } diff --git a/src/cartridges/app_adyen_SFRA/cartridge/client/default/js/adyen_checkout/renderGiftcardComponent.js b/src/cartridges/app_adyen_SFRA/cartridge/client/default/js/adyen_checkout/renderGiftcardComponent.js index ed41bb58e..2f4401f6c 100644 --- a/src/cartridges/app_adyen_SFRA/cartridge/client/default/js/adyen_checkout/renderGiftcardComponent.js +++ b/src/cartridges/app_adyen_SFRA/cartridge/client/default/js/adyen_checkout/renderGiftcardComponent.js @@ -96,9 +96,8 @@ function removeGiftCards() { giftCardsInfoMessageContainer.classList.remove( 'gift-cards-info-message-container', ); - document.querySelector( - 'button[value="submit-payment"]', - ).disabled = false; + document.querySelector('button[value="submit-payment"]').disabled = + false; if (res.resultCode === constants.RECEIVED) { document diff --git a/src/cartridges/app_adyen_SFRA/cartridge/client/default/js/constants.js b/src/cartridges/app_adyen_SFRA/cartridge/client/default/js/constants.js index 4de7972c9..151779471 100644 --- a/src/cartridges/app_adyen_SFRA/cartridge/client/default/js/constants.js +++ b/src/cartridges/app_adyen_SFRA/cartridge/client/default/js/constants.js @@ -23,6 +23,6 @@ module.exports = { 'amazonpay', 'applepay', 'cashapp', + 'upi', ], - MULTIPLE_TX_VARIANTS_COMPONENTS: ['upi'], }; diff --git a/src/cartridges/app_adyen_SFRA/cartridge/templates/default/checkout/billing/adyenComponentForm.isml b/src/cartridges/app_adyen_SFRA/cartridge/templates/default/checkout/billing/adyenComponentForm.isml index b0e84e55c..caf04bbcf 100644 --- a/src/cartridges/app_adyen_SFRA/cartridge/templates/default/checkout/billing/adyenComponentForm.isml +++ b/src/cartridges/app_adyen_SFRA/cartridge/templates/default/checkout/billing/adyenComponentForm.isml @@ -59,7 +59,7 @@ window.installments = '${pdict.adyen.installments}'; window.googleMerchantID = '${pdict.adyen.googleMerchantID}'; window.merchantAccount = '${pdict.adyen.merchantAccount}'; - window.customerEmail = '${customer && customer.profile && customer.profile.email ? customer.profile.email : ''}'; + window.customerEmail = '${pdict.AdyenHelper.getCustomerEmail()}'; var showStoreDetails = ${customer.authenticated && adyenRecurringPaymentsEnabled}; diff --git a/src/cartridges/bm_adyen/cartridge/templates/default/order/PaymentInstrumentInfo_Adyen.isml b/src/cartridges/bm_adyen/cartridge/templates/default/order/PaymentInstrumentInfo_Adyen.isml index 25bd36677..6f183e69f 100644 --- a/src/cartridges/bm_adyen/cartridge/templates/default/order/PaymentInstrumentInfo_Adyen.isml +++ b/src/cartridges/bm_adyen/cartridge/templates/default/order/PaymentInstrumentInfo_Adyen.isml @@ -26,7 +26,21 @@ - PSP reference + + PSP reference + + + var mode : String = dw.system.Site.getCurrent().getCustomPreferenceValue("Adyen_Mode"); + var urlPrefixType : String = 'test'; + if (mode == 'LIVE') { + urlPrefixType = 'live'; + } + + + + + + Payment Method Eventcode @@ -80,4 +94,4 @@ \ No newline at end of file +--> diff --git a/src/cartridges/bm_adyen/cartridge/templates/default/order/PaymentInstrumentInfo_Adyen_Component.isml b/src/cartridges/bm_adyen/cartridge/templates/default/order/PaymentInstrumentInfo_Adyen_Component.isml index bb973a55d..240ea03f0 100644 --- a/src/cartridges/bm_adyen/cartridge/templates/default/order/PaymentInstrumentInfo_Adyen_Component.isml +++ b/src/cartridges/bm_adyen/cartridge/templates/default/order/PaymentInstrumentInfo_Adyen_Component.isml @@ -1,5 +1,4 @@ - @@ -27,7 +26,21 @@ - PSP reference + + PSP reference + + + var mode : String = dw.system.Site.getCurrent().getCustomPreferenceValue("Adyen_Mode"); + var urlPrefixType : String = 'test'; + if (mode == 'LIVE') { + urlPrefixType = 'live'; + } + + + + + + Payment Method Eventcode @@ -90,4 +103,4 @@
- \ No newline at end of file + diff --git a/src/cartridges/int_adyen_SFRA/cartridge/adyen/config/constants.js b/src/cartridges/int_adyen_SFRA/cartridge/adyen/config/constants.js index 16d51d681..5a3fa7929 100644 --- a/src/cartridges/int_adyen_SFRA/cartridge/adyen/config/constants.js +++ b/src/cartridges/int_adyen_SFRA/cartridge/adyen/config/constants.js @@ -35,7 +35,7 @@ module.exports = { PAYPAL: 'paypal', }, - CAN_SKIP_SUMMARY_PAGE: ['applepay', 'cashapp'], + CAN_SKIP_SUMMARY_PAGE: ['applepay', 'cashapp', 'upi'], SERVICE: { PAYMENT: 'AdyenPayment', @@ -100,6 +100,6 @@ module.exports = { APPLE_DOMAIN_URL: '/.well-known/apple-developer-merchantid-domain-association', - CHECKOUT_COMPONENT_VERSION: '5.65.0', - VERSION: '24.4.0', + CHECKOUT_COMPONENT_VERSION: '5.68.0', + VERSION: '24.4.1', }; diff --git a/src/cartridges/int_adyen_SFRA/cartridge/adyen/scripts/payments/adyenCheckout.js b/src/cartridges/int_adyen_SFRA/cartridge/adyen/scripts/payments/adyenCheckout.js index 114d2d46d..0adc4bf26 100644 --- a/src/cartridges/int_adyen_SFRA/cartridge/adyen/scripts/payments/adyenCheckout.js +++ b/src/cartridges/int_adyen_SFRA/cartridge/adyen/scripts/payments/adyenCheckout.js @@ -235,7 +235,8 @@ function createPaymentRequest(args) { shipping_type: shippingMethod?.description, first_name: address.firstName, last_name: address.lastName, - street_address: `${address.address1} ${address.address2}`, + street_address: address.address1, + street_number: address.address2, postal_code: address.postalCode, city: address.city, country: address.countryCode.value, diff --git a/src/cartridges/int_adyen_SFRA/cartridge/adyen/utils/adyenHelper.js b/src/cartridges/int_adyen_SFRA/cartridge/adyen/utils/adyenHelper.js index 60ef9bd07..45e6b4ca8 100644 --- a/src/cartridges/int_adyen_SFRA/cartridge/adyen/utils/adyenHelper.js +++ b/src/cartridges/int_adyen_SFRA/cartridge/adyen/utils/adyenHelper.js @@ -31,6 +31,7 @@ const StringUtils = require('dw/util/StringUtils'); const Money = require('dw/value/Money'); const TaxMgr = require('dw/order/TaxMgr'); const ShippingLocation = require('dw/order/ShippingLocation'); +const BasketMgr = require('dw/order/BasketMgr'); //script includes const ShippingMethodModel = require('*/cartridge/models/shipping/shippingMethod'); const collections = require('*/cartridge/scripts/util/collections'); @@ -299,7 +300,6 @@ let adyenHelperObj = { }, getBasketAmount() { - const BasketMgr = require('dw/order/BasketMgr'); const currentBasket = BasketMgr.getCurrentBasket(); if(!currentBasket) { return; @@ -313,6 +313,11 @@ let adyenHelperObj = { return JSON.stringify(amount); }, + getCustomerEmail() { + const currentBasket = BasketMgr.getCurrentBasket(); + return currentBasket ? currentBasket.customerEmail : ''; + }, + // returns an array containing the donation amounts configured in the custom preferences for Adyen Giving getDonationAmounts() { let returnValue = []; diff --git a/tests/playwright/fixtures/INR.spec.mjs b/tests/playwright/fixtures/INR.spec.mjs index c93be8e8d..92557675c 100644 --- a/tests/playwright/fixtures/INR.spec.mjs +++ b/tests/playwright/fixtures/INR.spec.mjs @@ -25,21 +25,18 @@ for (const environment of environments) { test('UPI Success', async ({ page }) => { redirectShopper = new RedirectShopper(page); await redirectShopper.doUPIPayment('upi_collect'); - await checkoutPage.completeCheckout(); await checkoutPage.isPaymentModalShown("upi_collect"); }); test('UPI Failure', async ({ page }) => { redirectShopper = new RedirectShopper(page); await redirectShopper.doUPIPayment('upi_collect', false); - await checkoutPage.completeCheckout(); await checkoutPage.expectRefusal(); }); test('UPI QR Success @quick', async ({ page }) => { redirectShopper = new RedirectShopper(page); await redirectShopper.doUPIPayment('upi_qr'); - await checkoutPage.completeCheckout(); await checkoutPage.isPaymentModalShown("Scan QR code"); }); }); diff --git a/tests/playwright/fixtures/USD.spec.mjs b/tests/playwright/fixtures/USD.spec.mjs index 3a51a9de0..78e127f39 100644 --- a/tests/playwright/fixtures/USD.spec.mjs +++ b/tests/playwright/fixtures/USD.spec.mjs @@ -164,7 +164,7 @@ for (const environment of environments) { await checkoutPage.expectRefusal(); }); - test.skip('CashApp Renders', async ({page}) => { + test('CashApp Renders', async ({page}) => { if (environment.name.indexOf('v5') !== -1) { await checkoutPage.setEmail(); } @@ -265,7 +265,7 @@ for (const environment of environments) { await redirectShopper.doPayPalPayment(true, false, true); if (environment.name.indexOf('v5') !== -1) { await page.locator("button[value='place-order']").click(); - await page.locator(".order-thank-you-msg").isVisible({timeout: 20000}); + await page.locator(".order-thank-you-msg").isVisible(); } else { await checkoutPage.expectSuccess(); } @@ -279,7 +279,7 @@ for (const environment of environments) { await redirectShopper.doPayPalPayment(true, true, true); if (environment.name.indexOf('v5') !== -1) { await page.locator("button[value='place-order']").click(); - await page.locator(".order-thank-you-msg").isVisible({timeout: 20000}); + await page.locator(".order-thank-you-msg").isVisible(); } else { await checkoutPage.expectSuccess(); } diff --git a/tests/playwright/fixtures/countriesEUR/NL.spec.mjs b/tests/playwright/fixtures/countriesEUR/NL.spec.mjs index bb22aef1a..a44fb76a5 100644 --- a/tests/playwright/fixtures/countriesEUR/NL.spec.mjs +++ b/tests/playwright/fixtures/countriesEUR/NL.spec.mjs @@ -77,7 +77,7 @@ for (const environment of environments) { await checkoutPage.expectRefusal(); }); - test('SEPA Success @quick', async ({ page }) => { + test.skip('SEPA Success @quick', async ({ page }) => { pendingPayments = new PendingPayments(page); await pendingPayments.doSEPAPayment(); await checkoutPage.completeCheckout(); diff --git a/tests/playwright/package.json b/tests/playwright/package.json index 5218af6db..03eaaeec9 100644 --- a/tests/playwright/package.json +++ b/tests/playwright/package.json @@ -106,7 +106,7 @@ "yazl": "^2.5.1" }, "devDependencies": { - "@playwright/test": "^1.38.0" + "@playwright/test": "^1.42.1" }, "scripts": { "test": "npx playwright test", diff --git a/tests/playwright/pages/AccountPageSFRA.mjs b/tests/playwright/pages/AccountPageSFRA.mjs index 32fd561cb..819ba2118 100644 --- a/tests/playwright/pages/AccountPageSFRA.mjs +++ b/tests/playwright/pages/AccountPageSFRA.mjs @@ -28,7 +28,7 @@ export default class AccountPageSFRA { .locator('.input-field') .type(cardInput.cvc); } - await this.page.waitForLoadState('networkidle', { timeout: 20000 }); + await this.page.waitForLoadState('networkidle'); await this.page.click('button[name="save"]'); }; @@ -41,7 +41,7 @@ export default class AccountPageSFRA { const cardElement = this.savedCardElementGenerator(cardData); const deleteButton = cardElement.locator('../../button'); - await this.page.waitForLoadState('networkidle', { timeout: 20000 }); + await this.page.waitForLoadState('networkidle'); await deleteButton.click(); await this.page.click('.delete-confirmation-btn'); @@ -52,7 +52,6 @@ export default class AccountPageSFRA { await cardElement.waitFor({ state: 'visible', - timeout: 20000, }); }; @@ -65,7 +64,6 @@ export default class AccountPageSFRA { await cardElement.waitFor({ state: 'detached', - timeout: 20000, }); }; diff --git a/tests/playwright/pages/CheckoutPageSFRA5.mjs b/tests/playwright/pages/CheckoutPageSFRA5.mjs index f4a132c1a..984f30348 100644 --- a/tests/playwright/pages/CheckoutPageSFRA5.mjs +++ b/tests/playwright/pages/CheckoutPageSFRA5.mjs @@ -78,7 +78,7 @@ export default class CheckoutPageSFRA5 { this.passwordField = page.locator('#login-form-password'); this.loginButton = page.locator('.login button[type="submit"]'); - this.paymentModal = page.locator("#action-modal #adyenModalDialog"); + this.paymentModal = page.locator(".additionalFields"); this.donationAmountButton = page.locator('.adyen-checkout__button').nth(0); this.donationButton = page.locator('.adyen-checkout__button--donate'); @@ -88,7 +88,7 @@ export default class CheckoutPageSFRA5 { isPaymentModalShown = async (imgAltValue) => { await expect(this.paymentModal.locator(`img[alt='${imgAltValue}']`)) - .toBeVisible({ timeout: 20000 }); + .toBeVisible(); } navigateToCheckout = async (locale) => { @@ -101,7 +101,7 @@ export default class CheckoutPageSFRA5 { goToCheckoutPageWithFullCart = async (locale, itemCount = 1) => { await this.addProductToCart(locale, itemCount); - await this.successMessage.waitFor({ visible: true, timeout: 20000 }); + await this.successMessage.waitFor({ visible: true }); await this.navigateToCheckout(locale); await this.checkoutGuest.click(); @@ -166,20 +166,20 @@ export default class CheckoutPageSFRA5 { }; submitShipping = async () => { - await this.page.waitForLoadState('networkidle', { timeout: 20000 }); + await this.page.waitForLoadState('networkidle'); await this.shippingSubmit.click(); - await this.page.waitForNavigation({ waitUntil: "networkidle", timeout: 20000 }); + await this.page.waitForNavigation({ waitUntil: "networkidle" }); // Ugly wait since the submit button takes time to mount. await new Promise(r => setTimeout(r, 2000)); }; submitPayment = async () => { - await this.page.waitForLoadState('load', { timeout: 30000 }); + await this.page.waitForLoadState('load'); await this.submitPaymentButton.click(); }; placeOrder = async () => { - await this.page.waitForLoadState('load', { timeout: 30000 }); + await this.page.waitForLoadState('load'); await this.placeOrderButton.click(); }; @@ -193,7 +193,7 @@ export default class CheckoutPageSFRA5 { }; goBackAndSubmitShipping = async () => { - await this.page.waitForNavigation('load', { timeout: 20000 }); + await this.page.waitForNavigation('load'); await this.navigateBack(); await this.submitShipping(); }; @@ -203,25 +203,25 @@ export default class CheckoutPageSFRA5 { url: /Order-Confirm/, timeout: 20000, }); - await expect(this.thankYouMessage).toBeVisible({ timeout: 20000 }); + await expect(this.thankYouMessage).toBeVisible(); }; expectNonRedirectSuccess = async () => { - await expect(this.thankYouMessage).toBeVisible({ timeout: 20000 }); + await expect(this.thankYouMessage).toBeVisible(); }; expectRefusal = async () => { - await expect(this.errorMessage).not.toBeEmpty({ timeout: 25000 }); + await expect(this.errorMessage).not.toBeEmpty(); }; expectVoucher = async () => { - await expect(this.voucherCode).toBeVisible({ timeout: 20000 }); + await expect(this.voucherCode).toBeVisible(); }; expectQRcode = async () => { - await this.qrLoader.waitFor({ state: 'attached', timeout: 20000 }); - await expect(this.qrLoaderAmount).toBeVisible({ timeout: 20000 }); - await expect(this.qrImg).toBeVisible({ timeout: 20000 }); + await this.qrLoader.waitFor({ state: 'attached'}); + await expect(this.qrLoaderAmount).toBeVisible(); + await expect(this.qrImg).toBeVisible(); }; expectGiftCardWarning = async () => { @@ -229,14 +229,14 @@ export default class CheckoutPageSFRA5 { }; getLocation = async () => { - await this.page.waitForLoadState('load', { timeout: 20000 }); + await this.page.waitForLoadState('load'); return await this.page.url(); }; navigateBack = async () => { - await this.page.waitForLoadState('networkidle', { timeout: 20000 }); + await this.page.waitForLoadState('networkidle'); await this.page.goBack(); - await this.page.waitForLoadState('networkidle', { timeout: 20000 }); + await this.page.waitForLoadState('networkidle'); }; loginUser = async (credentials) => { diff --git a/tests/playwright/pages/CheckoutPageSFRA6.mjs b/tests/playwright/pages/CheckoutPageSFRA6.mjs index d85b0df5f..35d8a9df1 100644 --- a/tests/playwright/pages/CheckoutPageSFRA6.mjs +++ b/tests/playwright/pages/CheckoutPageSFRA6.mjs @@ -57,7 +57,7 @@ export default class CheckoutPageSFRA { this.shippingSubmit = page.locator("button[value='submit-shipping']"); - this.submitPaymentButton = page.locator("button[value='submit-payment']"); + this.submitPaymentButton = page.locator('.submit-payment'); this.placeOrderButton = page.locator("button[value='place-order']"); this.errorMessage = page.locator('.error-message-text'); @@ -80,7 +80,7 @@ export default class CheckoutPageSFRA { this.passwordField = page.locator('#login-form-password'); this.loginButton = page.locator('.login button[type="submit"]'); - this.paymentModal = page.locator("#action-modal #adyenModalDialog"); + this.paymentModal = page.locator(".additionalFields"); this.donationAmountButton = page.locator('.adyen-checkout__button').nth(0); this.donationButton = page.locator('.adyen-checkout__button--donate'); @@ -89,7 +89,7 @@ export default class CheckoutPageSFRA { isPaymentModalShown = async (imgAltValue) => { await expect(this.paymentModal.locator(`img[alt='${imgAltValue}']`)) - .toBeVisible({ timeout: 20000 }); + .toBeVisible(); } navigateToCheckout = async (locale) => { @@ -102,7 +102,7 @@ export default class CheckoutPageSFRA { goToCheckoutPageWithFullCart = async (locale, itemCount = 1, email) => { await this.addProductToCart(locale, itemCount); - await this.successMessage.waitFor({ visible: true, timeout: 20000 }); + await this.successMessage.waitFor({ visible: true }); await this.navigateToCheckout(locale); await this.setEmail(email); @@ -127,7 +127,7 @@ export default class CheckoutPageSFRA { }; setShopperDetails = async (shopperDetails) => { - await this.customerInfoSection.waitFor({ visible: true, timeout: 20000 }); + await this.customerInfoSection.waitFor({ visible: true }); await this.checkoutPageUserFirstNameInput.type( @@ -175,31 +175,26 @@ export default class CheckoutPageSFRA { }; submitShipping = async () => { - await this.page.waitForLoadState('networkidle', { timeout: 20000 }); + await this.page.waitForLoadState('networkidle'); await this.shippingSubmit.click(); - await this.page.waitForNavigation({ waitUntil: "networkidle", timeout: 20000 }); + await this.page.waitForNavigation({ waitUntil: "networkidle" }); // Ugly wait since the submit button takes time to mount. await new Promise(r => setTimeout(r, 2000)); }; submitPayment = async () => { - await this.page.waitForLoadState('load', { timeout: 30000 }); - await this.submitPaymentButton.click(); + await this.page.waitForFunction(() => { + const button = document.querySelector('.submit-payment'); + return button && !button.disabled; + }); + + await this.submitPaymentButton.click(); }; placeOrder = async () => { - let retries = 3; - while (retries > 0) { - try { - await this.page.waitForLoadState('load', { timeout: 30000 }); - await this.placeOrderButton.click(); - break; // Break out of the loop if successful - } catch (error) { - retries--; - await this.page.reload(); - } - } + await this.page.waitForLoadState('load'); + await this.placeOrderButton.click(); }; completeCheckoutLoggedInUser = async () => { @@ -212,7 +207,7 @@ export default class CheckoutPageSFRA { }; goBackAndSubmitShipping = async () => { - await this.page.waitForNavigation('load', { timeout: 20000 }); + await this.page.waitForNavigation('load'); await this.navigateBack(); await this.submitShipping(); }; @@ -221,27 +216,26 @@ export default class CheckoutPageSFRA { expectSuccess = async () => { await this.page.waitForNavigation({ url: /Order-Confirm/, - timeout: 20000, }); - await expect(this.thankYouMessage).toBeVisible({ timeout: 20000 }); + await expect(this.thankYouMessage).toBeVisible(); }; expectNonRedirectSuccess = async () => { - await expect(this.thankYouMessage).toBeVisible({ timeout: 20000 }); + await expect(this.thankYouMessage).toBeVisible(); }; expectRefusal = async () => { - await expect(this.errorMessage).not.toBeEmpty({ timeout: 25000 }); + await expect(this.errorMessage).not.toBeEmpty(); }; expectVoucher = async () => { - await expect(this.voucherCode).toBeVisible({ timeout: 20000 }); + await expect(this.voucherCode).toBeVisible(); }; expectQRcode = async () => { - await this.qrLoader.waitFor({ state: 'attached', timeout: 20000 }); - await expect(this.qrLoaderAmount).toBeVisible({ timeout: 20000 }); - await expect(this.qrImg).toBeVisible({ timeout: 20000 }); + await this.qrLoader.waitFor({ state: 'attached' }); + await expect(this.qrLoaderAmount).toBeVisible(); + await expect(this.qrImg).toBeVisible(); }; expectGiftCardWarning = async () => { @@ -249,7 +243,7 @@ export default class CheckoutPageSFRA { }; getLocation = async () => { - await this.page.waitForLoadState('load', { timeout: 20000 }); + await this.page.waitForLoadState('load'); return await this.page.url(); }; diff --git a/tests/playwright/pages/PaymentMethodsPage.mjs b/tests/playwright/pages/PaymentMethodsPage.mjs index e6c4a1956..cf5fded54 100644 --- a/tests/playwright/pages/PaymentMethodsPage.mjs +++ b/tests/playwright/pages/PaymentMethodsPage.mjs @@ -11,7 +11,7 @@ export default class PaymentMethodsPage { } getLocation = async () => { - await this.page.waitForNavigation('load', { timeout: 20000 }); + await this.page.waitForNavigation('load'); return await this.page.url(); }; @@ -36,24 +36,22 @@ export default class PaymentMethodsPage { // Paypal button locator on payment methods page const payPalButton = this.page .frameLocator('.adyen-checkout__paypal__button--paypal iframe.visible') - .locator('.paypal-button'); + .locator('.paypal-button-container'); + + const popupPromise = this.page.waitForEvent('popup'); // Click PayPal radio button if (!expressFlow) { await this.page.click('#rb_paypal'); + await this.page.waitForTimeout(5000); } - await expect(this.page.locator('.adyen-checkout__paypal__button--paypal iframe.visible'),).toBeVisible({ timeout: 20000 }); - // Capture popup for interaction - const [popup] = await Promise.all([ - this.page.waitForEvent('popup'), - payPalButton.click(), - ]); + await payPalButton.click(); + const popup = await popupPromise; // Wait for the page load await popup.waitForNavigation({ url: /.*sandbox.paypal.com*/, - timeout: 20000, }); // Paypal HPP selectors @@ -83,7 +81,7 @@ export default class PaymentMethodsPage { else { await this.cancelButton.click(); await this.page.goBack(); - await expect(this.page.locator('.add-to-cart'),).toBeVisible({ timeout: 20000 }); + await expect(this.page.locator('.add-to-cart'),).toBeVisible(); } }; @@ -95,7 +93,7 @@ export default class PaymentMethodsPage { if (normalFlow) { await this.page.click("#rb_amazonpay"); } - await this.page.waitForLoadState('domcontentloaded', { timeout: 20000 }); + await this.page.waitForLoadState('domcontentloaded'); await this.page.click(".adyen-checkout__amazonpay__button"); // Amazon Sandbox selectors @@ -111,7 +109,7 @@ export default class PaymentMethodsPage { await this.passwordInput.click(); await this.passwordInput.type(paymentData.AmazonPay.password); await this.loginButton.click(); - await this.page.waitForLoadState("networkidle", { timeout: 20000 }); + await this.page.waitForLoadState("networkidle"); if (await this.amazonCaptcha.isVisible()){ return false; @@ -133,7 +131,7 @@ export default class PaymentMethodsPage { await this.rejectionCard.click(); await this.confirmPaymentChangeButton.click(); } - await this.page.waitForLoadState("networkidle", { timeout: 20000 }); + await this.page.waitForLoadState("networkidle"); this.submitButton = this.page.locator('#a-autoid-0'); await this.submitButton.waitFor({ state: 'visible' }); await this.submitButton.click(); @@ -169,6 +167,7 @@ export default class PaymentMethodsPage { }; initiateUPIPayment = async (paymentMethod, success = true) => { + const continueButton = this.page.locator(".adyen-checkout__button--pay"); await this.page.locator(`#rb_upi`).click(); if (paymentMethod == "upi_collect") { await this.page.locator("#upi-button-vpa").click(); @@ -179,6 +178,7 @@ export default class PaymentMethodsPage { if (paymentMethod == "upi_qr") { await this.page.locator("#upi-button-qrCode").click(); } + await continueButton.click(); }; @@ -232,12 +232,13 @@ export default class PaymentMethodsPage { initiateGiftCardPayment = async (giftCardInput) => { const giftCardComponentWrapper = this.page.locator(".gift-card-selection"); + // Adding a timeout to ensure visibility + await new Promise(r => setTimeout(r, 2000)); await this.page.locator('#giftCardAddButton').click(); - await this.page.locator('#giftCardSelect').click() + await this.page.locator('.gift-card-select-wrapper').click() const giftCardBrand = this.page.locator(`li[data-brand=${giftCardInput.brand}]`) await this.page.locator("#giftCardUl").waitFor({ state: 'visible', - timeout: 20000, }); await giftCardBrand.click(); @@ -334,7 +335,6 @@ export default class PaymentMethodsPage { //Simulation of the redirect to the Oney page await this.page.waitForNavigation({ url: /.*staging.e-payments.oney/, - timeout: 20000, }); }; @@ -353,7 +353,6 @@ export default class PaymentMethodsPage { waitForKlarnaLoad = async () => { await this.page.waitForNavigation({ url: /.*playground.klarna/, - timeout: 25000, waitUntil: 'load', }); }; @@ -361,14 +360,13 @@ export default class PaymentMethodsPage { // Generic function to be used for simulating the redirect waitForRedirect = async () => { await this.page.waitForNavigation({ - timeout: 20000, waitUntil: 'load', }); }; async continueOnKlarna(skipModal) { await this.waitForKlarnaLoad(); - await this.page.waitForLoadState('networkidle', { timeout: 25000 }); + await this.page.waitForLoadState('networkidle'); this.klarnaIframe = this.page.frameLocator( '#klarna-apf-iframe', ); @@ -381,7 +379,6 @@ export default class PaymentMethodsPage { await this.klarnaContinueButton.click(); await this.klarnaVerificationCodeInput.waitFor({ state: 'visible', - timeout: 25000, }); await this.klarnaVerificationCodeInput.fill('123456'); if (this.klarnaSelectPlanButton.isVisible() && !skipModal) { @@ -390,7 +387,6 @@ export default class PaymentMethodsPage { } await this.klarnaBuyButton.waitFor({ state: 'visible', - timeout: 25000, }); await this.klarnaBuyButton.click(); } @@ -440,10 +436,10 @@ export default class PaymentMethodsPage { '#invoice_kp-invoice-payment-method', ); - await this.page.waitForNavigation('networkidle', { timeout: 20000 }); - await this.klarnaPaymentMethodGroup.waitFor('visible', { timeout: 20000 }); - await this.page.waitForLoadState('networkidle', { timeout: 20000 }); - await this.klarnaBuyButton.waitFor('visible', { timeout: 20000 }); + await this.page.waitForNavigation('networkidle'); + await this.klarnaPaymentMethodGroup.waitFor('visible'); + await this.page.waitForLoadState('networkidle'); + await this.klarnaBuyButton.waitFor('visible'); await this.klarnaBuyButton.click(); await this.klarnaIdNumberField.fill('811228-9874'); @@ -452,7 +448,7 @@ export default class PaymentMethodsPage { cancelKlarnaPayment = async () => { await this.waitForKlarnaLoad(); - await this.page.waitForLoadState('networkidle', { timeout: 25000 }); + await this.page.waitForLoadState('networkidle'); this.cancelButton = this.page.locator("button[title='Close']"); await this.cancelButton.click(); await this.page.click("button[id='payment-cancel-dialog-express__confirm']"); @@ -464,8 +460,8 @@ export default class PaymentMethodsPage { const backButton = this.page.locator("button[name='backLink']"); await rejectCookies.click(); - await giroBankDropdown.waitFor({ state: 'visible', timeout: 20000 }); - await backButton.waitFor({ state: 'visible', timeout: 20000 }); + await giroBankDropdown.waitFor({ state: 'visible' }); + await backButton.waitFor({ state: 'visible' }); await backButton.click(); }; @@ -499,7 +495,6 @@ export default class PaymentMethodsPage { await this.page.click('#component_cashapp'); await this.page.locator("div[data-testid='qr-modal-body']").waitFor({ state: 'visible', - timeout: 20000, }); } @@ -521,12 +516,11 @@ export default class PaymentMethodsPage { confirmVippsPayment = async () => { await this.page.locator("div[class='payment-details']").waitFor({ state: 'visible', - timeout: 25000, }); }; cancelVippsPayment = async () => { - await expect(this.page.locator('.cancel-link')).toBeVisible({ timeout: 20000 }); + await expect(this.page.locator('.cancel-link')).toBeVisible(); await this.page.click('.cancel-link'); }; @@ -535,18 +529,15 @@ export default class PaymentMethodsPage { await this.page.click("button[data-testid='continue-button']"); await this.page.locator("div[data-testid='spinner']").waitFor({ state: 'visible', - timeout: 20000, }); await this.page.click("button[data-testid='continue-button']"); await this.page.locator('input[name="loginid"]').type('idabarese51'); await this.page.click("button[data-testid='continue-button']"); await this.page.locator("div[data-testid='spinner']").waitFor({ state: 'visible', - timeout: 20000, }); await this.page.locator("div[data-testid='spinner']").waitFor({ state: 'detached', - timeout: 20000, }); const oneTimeCodeLocator = await this.page.locator( @@ -618,14 +609,15 @@ export default class PaymentMethodsPage { MultiBancoVoucherExists = async () => { await expect( this.page.locator('.adyen-checkout__voucher-result--multibanco'), - ).toBeVisible({ timeout: 20000 }); + ).toBeVisible(); }; initiateSEPAPayment = async () => { - const nameInput = this.page.locator('//input[contains(@name,"ownerName")]'); - const ibanInput = this.page.locator('//input[contains(@name,"ibanNumber")]'); + const nameInput = this.page.locator('input[name="ownerName"]'); + const ibanInput = this.page.locator('input[name="ibanNumber"]'); await this.page.click('#rb_sepadirectdebit'); + await expect(ibanInput).toBeVisible(); await nameInput.fill(paymentData.SepaDirectDebit.accountName); await ibanInput.fill(paymentData.SepaDirectDebit.iban); }; diff --git a/tests/playwright/paymentFlows/pending.mjs b/tests/playwright/paymentFlows/pending.mjs index c521c6e36..ede89a886 100644 --- a/tests/playwright/paymentFlows/pending.mjs +++ b/tests/playwright/paymentFlows/pending.mjs @@ -39,7 +39,7 @@ export class PendingPayments { waitForThirdPartyPaymentLoader = async () => { const checkoutLoader = this.page.locator('.adyen-checkout__await'); - await checkoutLoader.waitFor({ state: 'attached', timeout: 20000 }); - await checkoutLoader.waitFor({ state: 'detached', timeout: 20000 }); + await checkoutLoader.waitFor({ state: 'attached' }); + await checkoutLoader.waitFor({ state: 'detached' }); }; } diff --git a/tests/playwright/paymentFlows/redirectShopper.mjs b/tests/playwright/paymentFlows/redirectShopper.mjs index 09530b209..17edd86db 100644 --- a/tests/playwright/paymentFlows/redirectShopper.mjs +++ b/tests/playwright/paymentFlows/redirectShopper.mjs @@ -98,7 +98,7 @@ export class RedirectShopper { await this.page.fill('input[name="dateOfBirth"]', '1980-01-11'); await this.page.fill('input[name="shopperEmail"]', email); // There is no static locator to click the checkbox - await this.page.locator('label:has-text("Ich stimme den")').click(); + await this.page.locator('label:has-text("Ich bin mit")').click(); }; completeGiropayRedirect = async (success) => { @@ -114,7 +114,7 @@ export class RedirectShopper { }; completeEPSRedirect = async (success) => { - await this.page.waitForLoadState('networkidle', { timeout: 20000 }); + await this.page.waitForLoadState('networkidle'); if (success) { await this.paymentMethodsPage.confirmSimulator(); } else { diff --git a/tests/playwright/sfcc.config.js b/tests/playwright/sfcc.config.js index b6c79157e..98c683201 100644 --- a/tests/playwright/sfcc.config.js +++ b/tests/playwright/sfcc.config.js @@ -17,7 +17,7 @@ const config = { * Maximum time expect() should wait for the condition to be met. * For example in `await expect(locator).toHaveText();` */ - timeout: 10000, + timeout: 30000, }, /* Fail the build on CI if you accidentally left test.only in the source code. */ @@ -27,7 +27,7 @@ const config = { retries: process.env.CI ? 1 : 0, /* Opt out of parallel tests on CI. */ - workers: process.env.CI ? 3 : 1, + workers: process.env.CI ? 2 : 1, /* Reporter to use. See https://playwright.dev/docs/test-reporters */ reporter: 'html', @@ -35,7 +35,7 @@ const config = { /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ use: { /* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */ - actionTimeout: 20000, + actionTimeout: 30000, /* Base URL to use in actions like `await page.goto('/')`. */ baseURL: `https://${process.env.SFCC_HOSTNAME}`,