Mercurial > repos > fubar > jbrowse2
comparison x/static/js/8007.3025c802.chunk.js.map @ 125:49f3d3878413 draft
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 5ea1f9c1eef1de76232e69aa6d34cda77d90d566
author | fubar |
---|---|
date | Sat, 05 Oct 2024 23:58:05 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
124:137e08517410 | 125:49f3d3878413 |
---|---|
1 {"version":3,"file":"static/js/8007.3025c802.chunk.js","mappings":";uJAAA,MAAMA,GAMS,MAAMC,EAArB,cACE,KAAAC,QAAU,IAAIC,IACd,KAAAC,gBAAkB,IAAIC,eAyCxB,CAjCE,SAAAC,CAAUC,EAAsB,IAAIP,GAClC,GAAIQ,KAAKD,OAAOE,QACd,MAAM,IAAIC,MAAM,yCAKlBF,KAAKN,QAAQS,IAAIJ,GACbA,EAAOE,QAGTD,KAAKI,cAAcL,GACyB,mBAA5BA,EAAOM,kBACvBN,EAAOM,iBAAiB,SAAS,KAC/BL,KAAKI,cAAcL,EAAO,GAGhC,CAEA,aAAAK,CAAcL,GACZC,KAAKN,QAAQY,OAAOP,GACM,IAAtBC,KAAKN,QAAQa,MACfP,KAAKJ,gBAAgBY,OAEzB,CAEA,UAAIT,GACF,OAAOC,KAAKJ,gBAAgBG,MAC9B,CAEA,KAAAS,GACER,KAAKJ,gBAAgBY,OACvB,EChDa,MAAMC,EAArB,cACE,KAAAC,UAAY,IAAIf,GAclB,CAXE,WAAAgB,CAAYC,EAAqB,QAC/BZ,KAAKU,UAAUP,IAAIS,GACnBA,EAASZ,KAAKa,eAChB,CAEA,QAAAD,CAASE,GACPd,KAAKa,eAAiBC,EACtB,IAAK,MAAMC,KAAOf,KAAKU,UACrBK,EAAID,EAER,ECSa,MAAME,EAWnB,WAAAC,EAAY,KACVC,EAAI,MACJC,IAKA,GAAoB,mBAATD,EACT,MAAM,IAAIE,UAAU,6BAEtB,GAAqB,iBAAVD,EACT,MAAM,IAAIC,UAAU,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EAAI6hD,EAAQ7lD,SAAUgE,EAKpCy9C,EAAe6B,EAHP,IAANt/C,EACI6hD,EAAQ7hD,GACR,IAAK6hD,EAAQ7hD,GAAIw/C,oBAAqB/B,IAM5C1pC,EAAKvb,QAAQumD,wBACbtB,IAAiBqE,GApElB,UAA4B,aACjCrE,EAAY,QACZnD,EAAO,SACPyH,EAAQ,WACRrD,IAOA,MAGMsD,EAA+B,IAHb1H,EAAQN,SAK9BG,OAAQsD,GAGNsE,IAGwB,iBAAfrD,GAA2BA,EAAW3qD,WAAW,WAC1DumD,EAAQvrD,QAAQizD,GAEhB1H,EAAQp5C,KAAK8gD,GAGnB,CA6CMC,CAAmB,CACjBxE,aAAc,MAAAA,EAAAA,EAAgB,GAC9BnD,QAASuH,EAAQA,EAAQ7lD,OAAS,GAAGs+C,QACrCyH,UAAU,EACVrD,WAAYmD,EAAQA,EAAQ7lD,OAAS,GAAG0iD,YACxC,GAGR,CItCMwD,CACE,CACE3C,UACAb,aACAc,oBAAqBlF,EAAQN,SAASG,OACtC6B,eAAAA,EACAxjD,QAAAA,EACA8hD,QAAAA,GAEF,CAAEqH,WAAYnpD,EAAQsmD,gBACvB,IAML,MAAO,CAACnC,EAAe+D,EACzB,CDvI4B,CAAe1E,EAAgBxjD,GAezD,MAAO,CAdconD,EAAMrzD,IACV,IAAA41D,cACf,CAACptC,EAAsC2pC,IAE5BgC,EADe,mBAAb3rC,EACQqtC,IACf,MAAMC,EAAsBttC,EAAsBqtC,EAAa71D,IAC/D,MAAO,CAAE,CAACA,GAAO81D,EAAoB,EAGzB,CAAE,CAAC91D,GAAOwoB,GAFrB2pC,IAIP,CAACnyD,EAAMm0D,IAGsB","sources":["../../../node_modules/@gmod/abortable-promise-cache/src/AggregateAbortController.ts","../../../node_modules/@gmod/abortable-promise-cache/src/AggregateStatusReporter.ts","../../../node_modules/@gmod/abortable-promise-cache/src/AbortablePromiseCache.ts","../../../node_modules/@mui/icons-material/esm/Apps.js","../../../node_modules/@mui/icons-material/esm/Delete.js","../../../node_modules/@mui/icons-material/esm/Extension.js","../../../node_modules/@mui/icons-material/esm/FileCopy.js","../../../node_modules/@mui/icons-material/esm/GetApp.js","../../../node_modules/@mui/icons-material/esm/KeyboardArrowRight.js","../../../node_modules/@mui/icons-material/esm/Launch.js","../../../node_modules/@mui/icons-material/esm/Menu.js","../../../node_modules/@mui/icons-material/esm/Publish.js","../../../node_modules/@mui/icons-material/esm/Redo.js","../../../node_modules/@mui/icons-material/esm/Save.js","../../../node_modules/@mui/icons-material/esm/Settings.js","../../../node_modules/@mui/icons-material/esm/Share.js","../../../node_modules/@mui/icons-material/esm/Storage.js","../../../node_modules/@mui/icons-material/esm/Undo.js","../../../node_modules/@mui/material/AppBar/appBarClasses.js","../../../node_modules/@mui/material/AppBar/AppBar.js","../../../node_modules/@mui/material/CssBaseline/CssBaseline.js","../../../node_modules/@mui/material/Fab/Fab.js","../../../node_modules/@mui/material/Fab/fabClasses.js","../../../node_modules/@mui/material/Toolbar/Toolbar.js","../../../node_modules/@mui/material/Toolbar/toolbarClasses.js","../../../node_modules/deepmerge/dist/cjs.js","../../../node_modules/generic-filehandle/src/remoteFile.ts","../../../node_modules/mobx-react-lite/src/observer.ts","../../../node_modules/mobx-state-tree/dist/mobx-state-tree.module.js","../../../node_modules/mobx/src/errors.ts","../../../node_modules/mobx/src/utils/global.ts","../../../node_modules/mobx/src/utils/utils.ts","../../../node_modules/mobx/src/api/decorators.ts","../../../node_modules/mobx/src/types/overrideannotation.ts","../../../node_modules/mobx/src/core/atom.ts","../../../node_modules/mobx/src/utils/comparer.ts","../../../node_modules/mobx/src/types/modifiers.ts","../../../node_modules/mobx/src/types/actionannotation.ts","../../../node_modules/mobx/src/types/flowannotation.ts","../../../node_modules/mobx/src/types/computedannotation.ts","../../../node_modules/mobx/src/types/observableannotation.ts","../../../node_modules/mobx/src/types/autoannotation.ts","../../../node_modules/mobx/src/api/observable.ts","../../../node_modules/mobx/src/types/dynamicobject.ts","../../../node_modules/mobx/src/api/computed.ts","../../../node_modules/mobx/src/core/action.ts","../../../node_modules/mobx/src/types/observablevalue.ts","../../../node_modules/mobx/src/core/computedvalue.ts","../../../node_modules/mobx/src/core/observable.ts","../../../node_modules/mobx/src/core/derivation.ts","../../../node_modules/mobx/src/core/globalstate.ts","../../../node_modules/mobx/src/core/reaction.ts","../../../node_modules/mobx/src/core/spy.ts","../../../node_modules/mobx/src/api/action.ts","../../../node_modules/mobx/src/api/autorun.ts","../../../node_modules/mobx/src/api/become-observed.ts","../../../node_modules/mobx/src/api/configure.ts","../../../node_modules/mobx/src/api/extendobservable.ts","../../../node_modules/mobx/src/api/extras.ts","../../../node_modules/mobx/src/api/flow.ts","../../../node_modules/mobx/src/api/intercept-read.ts","../../../node_modules/mobx/src/api/intercept.ts","../../../node_modules/mobx/src/api/iscomputed.ts","../../../node_modules/mobx/src/api/isobservable.ts","../../../node_modules/mobx/src/api/object-api.ts","../../../node_modules/mobx/src/api/observe.ts","../../../node_modules/mobx/src/api/tojs.ts","../../../node_modules/mobx/src/api/trace.ts","../../../node_modules/mobx/src/api/transaction.ts","../../../node_modules/mobx/src/api/when.ts","../../../node_modules/mobx/src/types/intercept-utils.ts","../../../node_modules/mobx/src/types/listen-utils.ts","../../../node_modules/mobx/src/api/makeObservable.ts","../../../node_modules/mobx/src/types/observablearray.ts","../../../node_modules/mobx/src/types/observablemap.ts","../../../node_modules/mobx/src/types/observableset.ts","../../../node_modules/mobx/src/types/observableobject.ts","../../../node_modules/mobx/src/types/legacyobservablearray.ts","../../../node_modules/mobx/src/types/type-utils.ts","../../../node_modules/mobx/src/utils/eq.ts","../../../node_modules/mobx/src/utils/iterable.ts","../../../node_modules/mobx/src/mobx.ts","../../../node_modules/use-query-params/adapters/window/index.js","../../../node_modules/serialize-query-params/src/params.ts","../../../node_modules/serialize-query-params/src/serialize.ts","../../../node_modules/serialize-query-params/src/updateLocation.ts","../../../node_modules/use-query-params/src/decodedParamCache.ts","../../../node_modules/use-query-params/src/inheritedParams.ts","../../../node_modules/use-query-params/src/shallowEqual.ts","../../../node_modules/use-query-params/src/latestValues.ts","../../../node_modules/use-query-params/src/memoSearchStringToObject.ts","../../../node_modules/use-query-params/src/urlName.ts","../../../node_modules/use-query-params/src/options.ts","../../../node_modules/use-query-params/src/QueryParamProvider.tsx","../../../node_modules/serialize-query-params/src/searchStringToObject.ts","../../../node_modules/serialize-query-params/src/objectToSearchString.ts","../../../node_modules/use-query-params/src/updateSearchString.ts","../../../node_modules/serialize-query-params/src/encodeQueryParams.ts","../../../node_modules/use-query-params/src/removeDefaults.ts","../../../node_modules/use-query-params/src/useQueryParam.ts","../../../node_modules/use-query-params/src/useQueryParams.ts"],"sourcesContent":["class NullSignal {}\n\n/**\n * aggregates a number of abort signals, will only fire the aggregated\n * abort if all of the input signals have been aborted\n */\nexport default class AggregateAbortController {\n signals = new Set()\n abortController = new AbortController()\n\n /**\n * @param {AbortSignal} [signal] optional AbortSignal to add. if falsy,\n * will be treated as a null-signal, and this abortcontroller will no\n * longer be abortable.\n */\n //@ts-ignore\n addSignal(signal: AbortSignal = new NullSignal()): void {\n if (this.signal.aborted) {\n throw new Error('cannot add a signal, already aborted!')\n }\n\n // note that a NullSignal will never fire, so if we\n // have one this thing will never actually abort\n this.signals.add(signal)\n if (signal.aborted) {\n // handle the abort immediately if it is already aborted\n // for some reason\n this.handleAborted(signal)\n } else if (typeof signal.addEventListener === 'function') {\n signal.addEventListener('abort', () => {\n this.handleAborted(signal)\n })\n }\n }\n\n handleAborted(signal: AbortSignal): void {\n this.signals.delete(signal)\n if (this.signals.size === 0) {\n this.abortController.abort()\n }\n }\n\n get signal(): AbortSignal {\n return this.abortController.signal\n }\n\n abort(): void {\n this.abortController.abort()\n }\n}\n","export default class AggregateStatusReporter {\n callbacks = new Set<Function>()\n currentMessage: unknown\n\n addCallback(callback: Function = () => {}): void {\n this.callbacks.add(callback)\n callback(this.currentMessage)\n }\n\n callback(message: unknown) {\n this.currentMessage = message\n for (const elt of this.callbacks) {\n elt(message)\n }\n }\n}\n","import AggregateAbortController from './AggregateAbortController'\nimport AggregateStatusReporter from './AggregateStatusReporter'\n\ninterface Cache<U> {\n delete: (key: string) => void\n keys: () => Iterator<string>\n get: (key: string) => U | undefined\n set: (key: string, value: U) => void\n has: (key: string) => boolean\n}\ntype FillCallback<T, U> = (\n data: T,\n signal?: AbortSignal,\n statusCallback?: Function,\n) => Promise<U>\n\ninterface Entry<U> {\n aborter: AggregateAbortController\n settled: boolean\n readonly aborted: boolean\n statusReporter: AggregateStatusReporter\n promise: Promise<U>\n}\nexport default class AbortablePromiseCache<T, U> {\n /**\n * @param {object} args constructor args\n * @param {Function} args.fill fill callback, will be called with sig `fill(data, signal)`\n * @param {object} args.cache backing store to use, must implement `get(key)`, `set(key, val)`,\n * `delete(key)`, and `keys() -> iterator`\n */\n\n private cache: Cache<Entry<U>>\n private fillCallback: FillCallback<T, U>\n\n constructor({\n fill,\n cache,\n }: {\n fill: FillCallback<T, U>\n cache: Cache<Entry<U>>\n }) {\n if (typeof fill !== 'function') {\n throw new TypeError('must pass a fill function')\n }\n if (typeof cache !== 'object') {\n throw new TypeError('must pass a cache object')\n }\n if (\n typeof cache.get !== 'function' ||\n typeof cache.set !== 'function' ||\n typeof cache.delete !== 'function'\n ) {\n throw new TypeError(\n 'cache must implement get(key), set(key, val), and and delete(key)',\n )\n }\n\n this.cache = cache\n this.fillCallback = fill\n }\n\n static isAbortException(exception: Error) {\n return (\n // DOMException\n exception.name === 'AbortError' ||\n // standard-ish non-DOM abort exception\n //@ts-ignore\n exception.code === 'ERR_ABORTED' ||\n // stringified DOMException\n exception.message === 'AbortError: aborted' ||\n // stringified standard-ish exception\n exception.message === 'Error: aborted'\n )\n }\n\n evict(key: string, entry: Entry<U>) {\n if (this.cache.get(key) === entry) {\n this.cache.delete(key)\n }\n }\n\n fill(key: string, data: T, signal?: AbortSignal, statusCallback?: Function) {\n const aborter = new AggregateAbortController()\n const statusReporter = new AggregateStatusReporter()\n statusReporter.addCallback(statusCallback)\n const newEntry: Entry<U> = {\n aborter: aborter,\n promise: this.fillCallback(data, aborter.signal, (message: unknown) => {\n statusReporter.callback(message)\n }),\n settled: false,\n statusReporter,\n get aborted() {\n return this.aborter.signal.aborted\n },\n }\n newEntry.aborter.addSignal(signal)\n\n // remove the fill from the cache when its abortcontroller fires, if still in there\n newEntry.aborter.signal.addEventListener('abort', () => {\n if (!newEntry.settled) {\n this.evict(key, newEntry)\n }\n })\n\n // chain off the cached promise to record when it settles\n newEntry.promise\n .then(\n () => {\n newEntry.settled = true\n },\n () => {\n newEntry.settled = true\n\n // if the fill throws an error (including abort) and is still in the cache, remove it\n this.evict(key, newEntry)\n },\n )\n .catch(error => {\n // this will only be reached if there is some kind of\n // bad bug in this library\n console.error(error)\n throw error\n })\n\n this.cache.set(key, newEntry)\n }\n\n static checkSinglePromise<U>(promise: Promise<U>, signal?: AbortSignal) {\n // check just this signal for having been aborted, and abort the\n // promise if it was, regardless of what happened with the cached\n // response\n function checkForSingleAbort() {\n if (signal?.aborted) {\n throw Object.assign(new Error('aborted'), { code: 'ERR_ABORTED' })\n }\n }\n\n return promise.then(\n result => {\n checkForSingleAbort()\n return result\n },\n error => {\n checkForSingleAbort()\n throw error\n },\n )\n }\n\n has(key: string): boolean {\n return this.cache.has(key)\n }\n\n /**\n * Callback for getting status of the pending async\n *\n * @callback statusCallback\n * @param {any} status, current status string or message object\n */\n\n /**\n * @param {any} key cache key to use for this request\n * @param {any} data data passed as the first argument to the fill callback\n * @param {AbortSignal} [signal] optional AbortSignal object that aborts the request\n * @param {statusCallback} a callback to get the current status of a pending async operation\n */\n get(\n key: string,\n data: T,\n signal?: AbortSignal,\n statusCallback?: Function,\n ): Promise<U> {\n if (!signal && data instanceof AbortSignal) {\n throw new TypeError(\n 'second get argument appears to be an AbortSignal, perhaps you meant to pass `null` for the fill data?',\n )\n }\n const cacheEntry = this.cache.get(key)\n\n if (cacheEntry) {\n if (cacheEntry.aborted && !cacheEntry.settled) {\n // if it's aborted but has not realized it yet, evict it and redispatch\n this.evict(key, cacheEntry)\n return this.get(key, data, signal, statusCallback)\n }\n\n if (cacheEntry.settled) {\n // too late to abort, just return it\n return cacheEntry.promise\n }\n\n // request is in-flight, add this signal to its list of signals,\n // or if there is no signal, the aborter will become non-abortable\n cacheEntry.aborter.addSignal(signal)\n cacheEntry.statusReporter.addCallback(statusCallback)\n\n return AbortablePromiseCache.checkSinglePromise(\n cacheEntry.promise,\n signal,\n )\n }\n\n // if we got here, it is not in the cache. fill.\n this.fill(key, data, signal, statusCallback)\n return AbortablePromiseCache.checkSinglePromise(\n //see https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#non-null-assertion-operator-postfix-\n\n this.cache.get(key)!.promise,\n signal,\n )\n }\n\n /**\n * delete the given entry from the cache. if it exists and its fill request has\n * not yet settled, the fill will be signaled to abort.\n *\n * @param {any} key\n */\n delete(key: string) {\n const cachedEntry = this.cache.get(key)\n if (cachedEntry) {\n if (!cachedEntry.settled) {\n cachedEntry.aborter.abort()\n }\n this.cache.delete(key)\n }\n }\n\n /**\n * Clear all requests from the cache. Aborts any that have not settled.\n * @returns {number} count of entries deleted\n */\n clear() {\n // iterate without needing regenerator-runtime\n const keyIter = this.cache.keys()\n let deleteCount = 0\n for (let result = keyIter.next(); !result.done; result = keyIter.next()) {\n this.delete(result.value)\n deleteCount += 1\n }\n return deleteCount\n }\n}\n","\"use client\";\n\nimport createSvgIcon from './utils/createSvgIcon';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon( /*#__PURE__*/_jsx(\"path\", {\n d: \"M4 8h4V4H4zm6 12h4v-4h-4zm-6 0h4v-4H4zm0-6h4v-4H4zm6 0h4v-4h-4zm6-10v4h4V4zm-6 4h4V4h-4zm6 6h4v-4h-4zm0 6h4v-4h-4z\"\n}), 'Apps');","\"use client\";\n\nimport createSvgIcon from './utils/createSvgIcon';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon( /*#__PURE__*/_jsx(\"path\", {\n d: \"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zM19 4h-3.5l-1-1h-5l-1 1H5v2h14z\"\n}), 'Delete');","\"use client\";\n\nimport createSvgIcon from './utils/createSvgIcon';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon( /*#__PURE__*/_jsx(\"path\", {\n d: \"M20.5 11H19V7c0-1.1-.9-2-2-2h-4V3.5C13 2.12 11.88 1 10.5 1S8 2.12 8 3.5V5H4c-1.1 0-1.99.9-1.99 2v3.8H3.5c1.49 0 2.7 1.21 2.7 2.7s-1.21 2.7-2.7 2.7H2V20c0 1.1.9 2 2 2h3.8v-1.5c0-1.49 1.21-2.7 2.7-2.7s2.7 1.21 2.7 2.7V22H17c1.1 0 2-.9 2-2v-4h1.5c1.38 0 2.5-1.12 2.5-2.5S21.88 11 20.5 11\"\n}), 'Extension');","\"use client\";\n\nimport createSvgIcon from './utils/createSvgIcon';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon( /*#__PURE__*/_jsx(\"path\", {\n d: \"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12zm-1 4 6 6v10c0 1.1-.9 2-2 2H7.99C6.89 23 6 22.1 6 21l.01-14c0-1.1.89-2 1.99-2zm-1 7h5.5L14 6.5z\"\n}), 'FileCopy');","\"use client\";\n\nimport createSvgIcon from './utils/createSvgIcon';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon( /*#__PURE__*/_jsx(\"path\", {\n d: \"M19 9h-4V3H9v6H5l7 7zM5 18v2h14v-2z\"\n}), 'GetApp');","\"use client\";\n\nimport createSvgIcon from './utils/createSvgIcon';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon( /*#__PURE__*/_jsx(\"path\", {\n d: \"M8.59 16.59 13.17 12 8.59 7.41 10 6l6 6-6 6z\"\n}), 'KeyboardArrowRight');","\"use client\";\n\nimport createSvgIcon from './utils/createSvgIcon';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon( /*#__PURE__*/_jsx(\"path\", {\n d: \"M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3z\"\n}), 'Launch');","\"use client\";\n\nimport createSvgIcon from './utils/createSvgIcon';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon( /*#__PURE__*/_jsx(\"path\", {\n d: \"M3 18h18v-2H3zm0-5h18v-2H3zm0-7v2h18V6z\"\n}), 'Menu');","\"use client\";\n\nimport createSvgIcon from './utils/createSvgIcon';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon( /*#__PURE__*/_jsx(\"path\", {\n d: \"M5 4v2h14V4zm0 10h4v6h6v-6h4l-7-7z\"\n}), 'Publish');","\"use client\";\n\nimport createSvgIcon from './utils/createSvgIcon';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon( /*#__PURE__*/_jsx(\"path\", {\n d: \"M18.4 10.6C16.55 8.99 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16c1.05-3.19 4.05-5.5 7.6-5.5 1.95 0 3.73.72 5.12 1.88L13 16h9V7z\"\n}), 'Redo');","\"use client\";\n\nimport createSvgIcon from './utils/createSvgIcon';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon( /*#__PURE__*/_jsx(\"path\", {\n d: \"M17 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V7zm-5 16c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3m3-10H5V5h10z\"\n}), 'Save');","\"use client\";\n\nimport createSvgIcon from './utils/createSvgIcon';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon( /*#__PURE__*/_jsx(\"path\", {\n d: \"M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6\"\n}), 'Settings');","\"use client\";\n\nimport createSvgIcon from './utils/createSvgIcon';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon( /*#__PURE__*/_jsx(\"path\", {\n d: \"M18 16.08c-.76 0-1.44.3-1.96.77L8.91 12.7c.05-.23.09-.46.09-.7s-.04-.47-.09-.7l7.05-4.11c.54.5 1.25.81 2.04.81 1.66 0 3-1.34 3-3s-1.34-3-3-3-3 1.34-3 3c0 .24.04.47.09.7L8.04 9.81C7.5 9.31 6.79 9 6 9c-1.66 0-3 1.34-3 3s1.34 3 3 3c.79 0 1.5-.31 2.04-.81l7.12 4.16c-.05.21-.08.43-.08.65 0 1.61 1.31 2.92 2.92 2.92s2.92-1.31 2.92-2.92-1.31-2.92-2.92-2.92\"\n}), 'Share');","\"use client\";\n\nimport createSvgIcon from './utils/createSvgIcon';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon( /*#__PURE__*/_jsx(\"path\", {\n d: \"M2 20h20v-4H2zm2-3h2v2H4zM2 4v4h20V4zm4 3H4V5h2zm-4 7h20v-4H2zm2-3h2v2H4z\"\n}), 'Storage');","\"use client\";\n\nimport createSvgIcon from './utils/createSvgIcon';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon( /*#__PURE__*/_jsx(\"path\", {\n d: \"M12.5 8c-2.65 0-5.05.99-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8\"\n}), 'Undo');","import generateUtilityClasses from '@mui/utils/generateUtilityClasses';\nimport generateUtilityClass from '@mui/utils/generateUtilityClass';\nexport function getAppBarUtilityClass(slot) {\n return generateUtilityClass('MuiAppBar', slot);\n}\nconst appBarClasses = generateUtilityClasses('MuiAppBar', ['root', 'positionFixed', 'positionAbsolute', 'positionSticky', 'positionStatic', 'positionRelative', 'colorDefault', 'colorPrimary', 'colorSecondary', 'colorInherit', 'colorTransparent', 'colorError', 'colorInfo', 'colorSuccess', 'colorWarning']);\nexport default appBarClasses;","'use client';\n\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\nimport clsx from 'clsx';\nimport composeClasses from '@mui/utils/composeClasses';\nimport { styled } from \"../zero-styled/index.js\";\nimport memoTheme from \"../utils/memoTheme.js\";\nimport { useDefaultProps } from \"../DefaultPropsProvider/index.js\";\nimport capitalize from \"../utils/capitalize.js\";\nimport createSimplePaletteValueFilter from \"../utils/createSimplePaletteValueFilter.js\";\nimport Paper from \"../Paper/index.js\";\nimport { getAppBarUtilityClass } from \"./appBarClasses.js\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst useUtilityClasses = ownerState => {\n const {\n color,\n position,\n classes\n } = ownerState;\n const slots = {\n root: ['root', `color${capitalize(color)}`, `position${capitalize(position)}`]\n };\n return composeClasses(slots, getAppBarUtilityClass, classes);\n};\n\n// var2 is the fallback.\n// Ex. var1: 'var(--a)', var2: 'var(--b)'; return: 'var(--a, var(--b))'\nconst joinVars = (var1, var2) => var1 ? `${var1?.replace(')', '')}, ${var2})` : var2;\nconst AppBarRoot = styled(Paper, {\n name: 'MuiAppBar',\n slot: 'Root',\n overridesResolver: (props, styles) => {\n const {\n ownerState\n } = props;\n return [styles.root, styles[`position${capitalize(ownerState.position)}`], styles[`color${capitalize(ownerState.color)}`]];\n }\n})(memoTheme(({\n theme\n}) => ({\n display: 'flex',\n flexDirection: 'column',\n width: '100%',\n boxSizing: 'border-box',\n // Prevent padding issue with the Modal and fixed positioned AppBar.\n flexShrink: 0,\n variants: [{\n props: {\n position: 'fixed'\n },\n style: {\n position: 'fixed',\n zIndex: (theme.vars || theme).zIndex.appBar,\n top: 0,\n left: 'auto',\n right: 0,\n '@media print': {\n // Prevent the app bar to be visible on each printed page.\n position: 'absolute'\n }\n }\n }, {\n props: {\n position: 'absolute'\n },\n style: {\n position: 'absolute',\n zIndex: (theme.vars || theme).zIndex.appBar,\n top: 0,\n left: 'auto',\n right: 0\n }\n }, {\n props: {\n position: 'sticky'\n },\n style: {\n position: 'sticky',\n zIndex: (theme.vars || theme).zIndex.appBar,\n top: 0,\n left: 'auto',\n right: 0\n }\n }, {\n props: {\n position: 'static'\n },\n style: {\n position: 'static'\n }\n }, {\n props: {\n position: 'relative'\n },\n style: {\n position: 'relative'\n }\n }, {\n props: {\n color: 'inherit'\n },\n style: {\n '--AppBar-color': 'inherit'\n }\n }, {\n props: {\n color: 'default'\n },\n style: {\n '--AppBar-background': theme.vars ? theme.vars.palette.AppBar.defaultBg : theme.palette.grey[100],\n '--AppBar-color': theme.vars ? theme.vars.palette.text.primary : theme.palette.getContrastText(theme.palette.grey[100]),\n ...theme.applyStyles('dark', {\n '--AppBar-background': theme.vars ? theme.vars.palette.AppBar.defaultBg : theme.palette.grey[900],\n '--AppBar-color': theme.vars ? theme.vars.palette.text.primary : theme.palette.getContrastText(theme.palette.grey[900])\n })\n }\n }, ...Object.entries(theme.palette).filter(createSimplePaletteValueFilter(['contrastText'])).map(([color]) => ({\n props: {\n color\n },\n style: {\n '--AppBar-background': (theme.vars ?? theme).palette[color].main,\n '--AppBar-color': (theme.vars ?? theme).palette[color].contrastText\n }\n })), {\n props: props => props.enableColorOnDark === true && !['inherit', 'transparent'].includes(props.color),\n style: {\n backgroundColor: 'var(--AppBar-background)',\n color: 'var(--AppBar-color)'\n }\n }, {\n props: props => props.enableColorOnDark === false && !['inherit', 'transparent'].includes(props.color),\n style: {\n backgroundColor: 'var(--AppBar-background)',\n color: 'var(--AppBar-color)',\n ...theme.applyStyles('dark', {\n backgroundColor: theme.vars ? joinVars(theme.vars.palette.AppBar.darkBg, 'var(--AppBar-background)') : null,\n color: theme.vars ? joinVars(theme.vars.palette.AppBar.darkColor, 'var(--AppBar-color)') : null\n })\n }\n }, {\n props: {\n color: 'transparent'\n },\n style: {\n '--AppBar-background': 'transparent',\n '--AppBar-color': 'inherit',\n backgroundColor: 'var(--AppBar-background)',\n color: 'var(--AppBar-color)',\n ...theme.applyStyles('dark', {\n backgroundImage: 'none'\n })\n }\n }]\n})));\nconst AppBar = /*#__PURE__*/React.forwardRef(function AppBar(inProps, ref) {\n const props = useDefaultProps({\n props: inProps,\n name: 'MuiAppBar'\n });\n const {\n className,\n color = 'primary',\n enableColorOnDark = false,\n position = 'fixed',\n ...other\n } = props;\n const ownerState = {\n ...props,\n color,\n position,\n enableColorOnDark\n };\n const classes = useUtilityClasses(ownerState);\n return /*#__PURE__*/_jsx(AppBarRoot, {\n square: true,\n component: \"header\",\n ownerState: ownerState,\n elevation: 4,\n className: clsx(classes.root, className, position === 'fixed' && 'mui-fixed'),\n ref: ref,\n ...other\n });\n});\nprocess.env.NODE_ENV !== \"production\" ? AppBar.propTypes /* remove-proptypes */ = {\n // ┌────────────────────────────── Warning ──────────────────────────────┐\n // │ These PropTypes are generated from the TypeScript type definitions. │\n // │ To update them, edit the d.ts file and run `pnpm proptypes`. │\n // └─────────────────────────────────────────────────────────────────────┘\n /**\n * The content of the component.\n */\n children: PropTypes.node,\n /**\n * Override or extend the styles applied to the component.\n */\n classes: PropTypes.object,\n /**\n * @ignore\n */\n className: PropTypes.string,\n /**\n * The color of the component.\n * It supports both default and custom theme colors, which can be added as shown in the\n * [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors).\n * @default 'primary'\n */\n color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['default', 'inherit', 'primary', 'secondary', 'transparent', 'error', 'info', 'success', 'warning']), PropTypes.string]),\n /**\n * If true, the `color` prop is applied in dark mode.\n * @default false\n */\n enableColorOnDark: PropTypes.bool,\n /**\n * The positioning type. The behavior of the different options is described\n * [in the MDN web docs](https://developer.mozilla.org/en-US/docs/Learn/CSS/CSS_layout/Positioning).\n * Note: `sticky` is not universally supported and will fall back to `static` when unavailable.\n * @default 'fixed'\n */\n position: PropTypes.oneOf(['absolute', 'fixed', 'relative', 'static', 'sticky']),\n /**\n * The system prop that allows defining system overrides as well as additional CSS styles.\n */\n sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])\n} : void 0;\nexport default AppBar;","'use client';\n\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\nimport { globalCss } from \"../zero-styled/index.js\";\nimport { useDefaultProps } from \"../DefaultPropsProvider/index.js\";\n\n// to determine if the global styles are static or dynamic\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nconst isDynamicSupport = typeof globalCss({}) === 'function';\nexport const html = (theme, enableColorScheme) => ({\n WebkitFontSmoothing: 'antialiased',\n // Antialiasing.\n MozOsxFontSmoothing: 'grayscale',\n // Antialiasing.\n // Change from `box-sizing: content-box` so that `width`\n // is not affected by `padding` or `border`.\n boxSizing: 'border-box',\n // Fix font resize problem in iOS\n WebkitTextSizeAdjust: '100%',\n // When used under CssVarsProvider, colorScheme should not be applied dynamically because it will generate the stylesheet twice for server-rendered applications.\n ...(enableColorScheme && !theme.vars && {\n colorScheme: theme.palette.mode\n })\n});\nexport const body = theme => ({\n color: (theme.vars || theme).palette.text.primary,\n ...theme.typography.body1,\n backgroundColor: (theme.vars || theme).palette.background.default,\n '@media print': {\n // Save printer ink.\n backgroundColor: (theme.vars || theme).palette.common.white\n }\n});\nexport const styles = (theme, enableColorScheme = false) => {\n const colorSchemeStyles = {};\n if (enableColorScheme && theme.colorSchemes && typeof theme.getColorSchemeSelector === 'function') {\n Object.entries(theme.colorSchemes).forEach(([key, scheme]) => {\n const selector = theme.getColorSchemeSelector(key);\n if (selector.startsWith('@')) {\n // for @media (prefers-color-scheme), we need to target :root\n colorSchemeStyles[selector] = {\n ':root': {\n colorScheme: scheme.palette?.mode\n }\n };\n } else {\n // else, it's likely that the selector already target an element with a class or data attribute\n colorSchemeStyles[selector.replace(/\\s*&/, '')] = {\n colorScheme: scheme.palette?.mode\n };\n }\n });\n }\n let defaultStyles = {\n html: html(theme, enableColorScheme),\n '*, *::before, *::after': {\n boxSizing: 'inherit'\n },\n 'strong, b': {\n fontWeight: theme.typography.fontWeightBold\n },\n body: {\n margin: 0,\n // Remove the margin in all browsers.\n ...body(theme),\n // Add support for document.body.requestFullScreen().\n // Other elements, if background transparent, are not supported.\n '&::backdrop': {\n backgroundColor: (theme.vars || theme).palette.background.default\n }\n },\n ...colorSchemeStyles\n };\n const themeOverrides = theme.components?.MuiCssBaseline?.styleOverrides;\n if (themeOverrides) {\n defaultStyles = [defaultStyles, themeOverrides];\n }\n return defaultStyles;\n};\n\n// `ecs` stands for enableColorScheme. This is internal logic to make it work with Pigment CSS, so shorter is better.\nconst SELECTOR = 'mui-ecs';\nconst staticStyles = theme => {\n const result = styles(theme, false);\n const baseStyles = Array.isArray(result) ? result[0] : result;\n if (!theme.vars && baseStyles) {\n baseStyles.html[`:root:has(${SELECTOR})`] = {\n colorScheme: theme.palette.mode\n };\n }\n if (theme.colorSchemes) {\n Object.entries(theme.colorSchemes).forEach(([key, scheme]) => {\n const selector = theme.getColorSchemeSelector(key);\n if (selector.startsWith('@')) {\n // for @media (prefers-color-scheme), we need to target :root\n baseStyles[selector] = {\n [`:root:not(:has(.${SELECTOR}))`]: {\n colorScheme: scheme.palette?.mode\n }\n };\n } else {\n // else, it's likely that the selector already target an element with a class or data attribute\n baseStyles[selector.replace(/\\s*&/, '')] = {\n [`&:not(:has(.${SELECTOR}))`]: {\n colorScheme: scheme.palette?.mode\n }\n };\n }\n });\n }\n return result;\n};\nconst GlobalStyles = globalCss(isDynamicSupport ? ({\n theme,\n enableColorScheme\n}) => styles(theme, enableColorScheme) : ({\n theme\n}) => staticStyles(theme));\n\n/**\n * Kickstart an elegant, consistent, and simple baseline to build upon.\n */\nfunction CssBaseline(inProps) {\n const props = useDefaultProps({\n props: inProps,\n name: 'MuiCssBaseline'\n });\n const {\n children,\n enableColorScheme = false\n } = props;\n return /*#__PURE__*/_jsxs(React.Fragment, {\n children: [isDynamicSupport && /*#__PURE__*/_jsx(GlobalStyles, {\n enableColorScheme: enableColorScheme\n }), !isDynamicSupport && !enableColorScheme && /*#__PURE__*/_jsx(\"span\", {\n className: SELECTOR,\n style: {\n display: 'none'\n }\n }), children]\n });\n}\nprocess.env.NODE_ENV !== \"production\" ? CssBaseline.propTypes /* remove-proptypes */ = {\n // ┌────────────────────────────── Warning ──────────────────────────────┐\n // │ These PropTypes are generated from the TypeScript type definitions. │\n // │ To update them, edit the d.ts file and run `pnpm proptypes`. │\n // └─────────────────────────────────────────────────────────────────────┘\n /**\n * You can wrap a node.\n */\n children: PropTypes.node,\n /**\n * Enable `color-scheme` CSS property to use `theme.palette.mode`.\n * For more details, check out https://developer.mozilla.org/en-US/docs/Web/CSS/color-scheme\n * For browser support, check out https://caniuse.com/?search=color-scheme\n * @default false\n */\n enableColorScheme: PropTypes.bool\n} : void 0;\nexport default CssBaseline;","'use client';\n\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\nimport clsx from 'clsx';\nimport composeClasses from '@mui/utils/composeClasses';\nimport ButtonBase from \"../ButtonBase/index.js\";\nimport capitalize from \"../utils/capitalize.js\";\nimport fabClasses, { getFabUtilityClass } from \"./fabClasses.js\";\nimport rootShouldForwardProp from \"../styles/rootShouldForwardProp.js\";\nimport { styled } from \"../zero-styled/index.js\";\nimport memoTheme from \"../utils/memoTheme.js\";\nimport createSimplePaletteValueFilter from \"../utils/createSimplePaletteValueFilter.js\";\nimport { useDefaultProps } from \"../DefaultPropsProvider/index.js\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst useUtilityClasses = ownerState => {\n const {\n color,\n variant,\n classes,\n size\n } = ownerState;\n const slots = {\n root: ['root', variant, `size${capitalize(size)}`, color === 'inherit' ? 'colorInherit' : color]\n };\n const composedClasses = composeClasses(slots, getFabUtilityClass, classes);\n return {\n ...classes,\n // forward the focused, disabled, etc. classes to the ButtonBase\n ...composedClasses\n };\n};\nconst FabRoot = styled(ButtonBase, {\n name: 'MuiFab',\n slot: 'Root',\n shouldForwardProp: prop => rootShouldForwardProp(prop) || prop === 'classes',\n overridesResolver: (props, styles) => {\n const {\n ownerState\n } = props;\n return [styles.root, styles[ownerState.variant], styles[`size${capitalize(ownerState.size)}`], ownerState.color === 'inherit' && styles.colorInherit, styles[capitalize(ownerState.size)], styles[ownerState.color]];\n }\n})(memoTheme(({\n theme\n}) => ({\n ...theme.typography.button,\n minHeight: 36,\n transition: theme.transitions.create(['background-color', 'box-shadow', 'border-color'], {\n duration: theme.transitions.duration.short\n }),\n borderRadius: '50%',\n padding: 0,\n minWidth: 0,\n width: 56,\n height: 56,\n zIndex: (theme.vars || theme).zIndex.fab,\n boxShadow: (theme.vars || theme).shadows[6],\n '&:active': {\n boxShadow: (theme.vars || theme).shadows[12]\n },\n color: theme.vars ? theme.vars.palette.text.primary : theme.palette.getContrastText?.(theme.palette.grey[300]),\n backgroundColor: (theme.vars || theme).palette.grey[300],\n '&:hover': {\n backgroundColor: (theme.vars || theme).palette.grey.A100,\n // Reset on touch devices, it doesn't add specificity\n '@media (hover: none)': {\n backgroundColor: (theme.vars || theme).palette.grey[300]\n },\n textDecoration: 'none'\n },\n [`&.${fabClasses.focusVisible}`]: {\n boxShadow: (theme.vars || theme).shadows[6]\n },\n variants: [{\n props: {\n size: 'small'\n },\n style: {\n width: 40,\n height: 40\n }\n }, {\n props: {\n size: 'medium'\n },\n style: {\n width: 48,\n height: 48\n }\n }, {\n props: {\n variant: 'extended'\n },\n style: {\n borderRadius: 48 / 2,\n padding: '0 16px',\n width: 'auto',\n minHeight: 'auto',\n minWidth: 48,\n height: 48\n }\n }, {\n props: {\n variant: 'extended',\n size: 'small'\n },\n style: {\n width: 'auto',\n padding: '0 8px',\n borderRadius: 34 / 2,\n minWidth: 34,\n height: 34\n }\n }, {\n props: {\n variant: 'extended',\n size: 'medium'\n },\n style: {\n width: 'auto',\n padding: '0 16px',\n borderRadius: 40 / 2,\n minWidth: 40,\n height: 40\n }\n }, {\n props: {\n color: 'inherit'\n },\n style: {\n color: 'inherit'\n }\n }]\n})), memoTheme(({\n theme\n}) => ({\n variants: [...Object.entries(theme.palette).filter(createSimplePaletteValueFilter(['dark', 'contrastText'])) // check all the used fields in the style below\n .map(([color]) => ({\n props: {\n color\n },\n style: {\n color: (theme.vars || theme).palette[color].contrastText,\n backgroundColor: (theme.vars || theme).palette[color].main,\n '&:hover': {\n backgroundColor: (theme.vars || theme).palette[color].dark,\n // Reset on touch devices, it doesn't add specificity\n '@media (hover: none)': {\n backgroundColor: (theme.vars || theme).palette[color].main\n }\n }\n }\n }))]\n})), memoTheme(({\n theme\n}) => ({\n [`&.${fabClasses.disabled}`]: {\n color: (theme.vars || theme).palette.action.disabled,\n boxShadow: (theme.vars || theme).shadows[0],\n backgroundColor: (theme.vars || theme).palette.action.disabledBackground\n }\n})));\nconst Fab = /*#__PURE__*/React.forwardRef(function Fab(inProps, ref) {\n const props = useDefaultProps({\n props: inProps,\n name: 'MuiFab'\n });\n const {\n children,\n className,\n color = 'default',\n component = 'button',\n disabled = false,\n disableFocusRipple = false,\n focusVisibleClassName,\n size = 'large',\n variant = 'circular',\n ...other\n } = props;\n const ownerState = {\n ...props,\n color,\n component,\n disabled,\n disableFocusRipple,\n size,\n variant\n };\n const classes = useUtilityClasses(ownerState);\n return /*#__PURE__*/_jsx(FabRoot, {\n className: clsx(classes.root, className),\n component: component,\n disabled: disabled,\n focusRipple: !disableFocusRipple,\n focusVisibleClassName: clsx(classes.focusVisible, focusVisibleClassName),\n ownerState: ownerState,\n ref: ref,\n ...other,\n classes: classes,\n children: children\n });\n});\nprocess.env.NODE_ENV !== \"production\" ? Fab.propTypes /* remove-proptypes */ = {\n // ┌────────────────────────────── Warning ──────────────────────────────┐\n // │ These PropTypes are generated from the TypeScript type definitions. │\n // │ To update them, edit the d.ts file and run `pnpm proptypes`. │\n // └─────────────────────────────────────────────────────────────────────┘\n /**\n * The content of the component.\n */\n children: PropTypes.node,\n /**\n * Override or extend the styles applied to the component.\n */\n classes: PropTypes.object,\n /**\n * @ignore\n */\n className: PropTypes.string,\n /**\n * The color of the component.\n * It supports both default and custom theme colors, which can be added as shown in the\n * [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors).\n * @default 'default'\n */\n color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['default', 'error', 'info', 'inherit', 'primary', 'secondary', 'success', 'warning']), PropTypes.string]),\n /**\n * The component used for the root node.\n * Either a string to use a HTML element or a component.\n */\n component: PropTypes.elementType,\n /**\n * If `true`, the component is disabled.\n * @default false\n */\n disabled: PropTypes.bool,\n /**\n * If `true`, the keyboard focus ripple is disabled.\n * @default false\n */\n disableFocusRipple: PropTypes.bool,\n /**\n * If `true`, the ripple effect is disabled.\n */\n disableRipple: PropTypes.bool,\n /**\n * @ignore\n */\n focusVisibleClassName: PropTypes.string,\n /**\n * The URL to link to when the button is clicked.\n * If defined, an `a` element will be used as the root node.\n */\n href: PropTypes.string,\n /**\n * The size of the component.\n * `small` is equivalent to the dense button styling.\n * @default 'large'\n */\n size: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['small', 'medium', 'large']), PropTypes.string]),\n /**\n * The system prop that allows defining system overrides as well as additional CSS styles.\n */\n sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),\n /**\n * The variant to use.\n * @default 'circular'\n */\n variant: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['circular', 'extended']), PropTypes.string])\n} : void 0;\nexport default Fab;","import generateUtilityClasses from '@mui/utils/generateUtilityClasses';\nimport generateUtilityClass from '@mui/utils/generateUtilityClass';\nexport function getFabUtilityClass(slot) {\n return generateUtilityClass('MuiFab', slot);\n}\nconst fabClasses = generateUtilityClasses('MuiFab', ['root', 'primary', 'secondary', 'extended', 'circular', 'focusVisible', 'disabled', 'colorInherit', 'sizeSmall', 'sizeMedium', 'sizeLarge', 'info', 'error', 'warning', 'success']);\nexport default fabClasses;","'use client';\n\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\nimport clsx from 'clsx';\nimport composeClasses from '@mui/utils/composeClasses';\nimport { styled } from \"../zero-styled/index.js\";\nimport memoTheme from \"../utils/memoTheme.js\";\nimport { useDefaultProps } from \"../DefaultPropsProvider/index.js\";\nimport { getToolbarUtilityClass } from \"./toolbarClasses.js\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst useUtilityClasses = ownerState => {\n const {\n classes,\n disableGutters,\n variant\n } = ownerState;\n const slots = {\n root: ['root', !disableGutters && 'gutters', variant]\n };\n return composeClasses(slots, getToolbarUtilityClass, classes);\n};\nconst ToolbarRoot = styled('div', {\n name: 'MuiToolbar',\n slot: 'Root',\n overridesResolver: (props, styles) => {\n const {\n ownerState\n } = props;\n return [styles.root, !ownerState.disableGutters && styles.gutters, styles[ownerState.variant]];\n }\n})(memoTheme(({\n theme\n}) => ({\n position: 'relative',\n display: 'flex',\n alignItems: 'center',\n variants: [{\n props: ({\n ownerState\n }) => !ownerState.disableGutters,\n style: {\n paddingLeft: theme.spacing(2),\n paddingRight: theme.spacing(2),\n [theme.breakpoints.up('sm')]: {\n paddingLeft: theme.spacing(3),\n paddingRight: theme.spacing(3)\n }\n }\n }, {\n props: {\n variant: 'dense'\n },\n style: {\n minHeight: 48\n }\n }, {\n props: {\n variant: 'regular'\n },\n style: theme.mixins.toolbar\n }]\n})));\nconst Toolbar = /*#__PURE__*/React.forwardRef(function Toolbar(inProps, ref) {\n const props = useDefaultProps({\n props: inProps,\n name: 'MuiToolbar'\n });\n const {\n className,\n component = 'div',\n disableGutters = false,\n variant = 'regular',\n ...other\n } = props;\n const ownerState = {\n ...props,\n component,\n disableGutters,\n variant\n };\n const classes = useUtilityClasses(ownerState);\n return /*#__PURE__*/_jsx(ToolbarRoot, {\n as: component,\n className: clsx(classes.root, className),\n ref: ref,\n ownerState: ownerState,\n ...other\n });\n});\nprocess.env.NODE_ENV !== \"production\" ? Toolbar.propTypes /* remove-proptypes */ = {\n // ┌────────────────────────────── Warning ──────────────────────────────┐\n // │ These PropTypes are generated from the TypeScript type definitions. │\n // │ To update them, edit the d.ts file and run `pnpm proptypes`. │\n // └─────────────────────────────────────────────────────────────────────┘\n /**\n * The Toolbar children, usually a mixture of `IconButton`, `Button` and `Typography`.\n * The Toolbar is a flex container, allowing flex item properties to be used to lay out the children.\n */\n children: PropTypes.node,\n /**\n * Override or extend the styles applied to the component.\n */\n classes: PropTypes.object,\n /**\n * @ignore\n */\n className: PropTypes.string,\n /**\n * The component used for the root node.\n * Either a string to use a HTML element or a component.\n */\n component: PropTypes.elementType,\n /**\n * If `true`, disables gutter padding.\n * @default false\n */\n disableGutters: PropTypes.bool,\n /**\n * The system prop that allows defining system overrides as well as additional CSS styles.\n */\n sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),\n /**\n * The variant to use.\n * @default 'regular'\n */\n variant: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['dense', 'regular']), PropTypes.string])\n} : void 0;\nexport default Toolbar;","import generateUtilityClasses from '@mui/utils/generateUtilityClasses';\nimport generateUtilityClass from '@mui/utils/generateUtilityClass';\nexport function getToolbarUtilityClass(slot) {\n return generateUtilityClass('MuiToolbar', slot);\n}\nconst toolbarClasses = generateUtilityClasses('MuiToolbar', ['root', 'gutters', 'regular', 'dense']);\nexport default toolbarClasses;","'use strict';\n\nvar isMergeableObject = function isMergeableObject(value) {\n\treturn isNonNullObject(value)\n\t\t&& !isSpecial(value)\n};\n\nfunction isNonNullObject(value) {\n\treturn !!value && typeof value === 'object'\n}\n\nfunction isSpecial(value) {\n\tvar stringValue = Object.prototype.toString.call(value);\n\n\treturn stringValue === '[object RegExp]'\n\t\t|| stringValue === '[object Date]'\n\t\t|| isReactElement(value)\n}\n\n// see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25\nvar canUseSymbol = typeof Symbol === 'function' && Symbol.for;\nvar REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7;\n\nfunction isReactElement(value) {\n\treturn value.$$typeof === REACT_ELEMENT_TYPE\n}\n\nfunction emptyTarget(val) {\n\treturn Array.isArray(val) ? [] : {}\n}\n\nfunction cloneUnlessOtherwiseSpecified(value, options) {\n\treturn (options.clone !== false && options.isMergeableObject(value))\n\t\t? deepmerge(emptyTarget(value), value, options)\n\t\t: value\n}\n\nfunction defaultArrayMerge(target, source, options) {\n\treturn target.concat(source).map(function(element) {\n\t\treturn cloneUnlessOtherwiseSpecified(element, options)\n\t})\n}\n\nfunction getMergeFunction(key, options) {\n\tif (!options.customMerge) {\n\t\treturn deepmerge\n\t}\n\tvar customMerge = options.customMerge(key);\n\treturn typeof customMerge === 'function' ? customMerge : deepmerge\n}\n\nfunction getEnumerableOwnPropertySymbols(target) {\n\treturn Object.getOwnPropertySymbols\n\t\t? Object.getOwnPropertySymbols(target).filter(function(symbol) {\n\t\t\treturn Object.propertyIsEnumerable.call(target, symbol)\n\t\t})\n\t\t: []\n}\n\nfunction getKeys(target) {\n\treturn Object.keys(target).concat(getEnumerableOwnPropertySymbols(target))\n}\n\nfunction propertyIsOnObject(object, property) {\n\ttry {\n\t\treturn property in object\n\t} catch(_) {\n\t\treturn false\n\t}\n}\n\n// Protects from prototype poisoning and unexpected merging up the prototype chain.\nfunction propertyIsUnsafe(target, key) {\n\treturn propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet,\n\t\t&& !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain,\n\t\t\t&& Object.propertyIsEnumerable.call(target, key)) // and also unsafe if they're nonenumerable.\n}\n\nfunction mergeObject(target, source, options) {\n\tvar destination = {};\n\tif (options.isMergeableObject(target)) {\n\t\tgetKeys(target).forEach(function(key) {\n\t\t\tdestination[key] = cloneUnlessOtherwiseSpecified(target[key], options);\n\t\t});\n\t}\n\tgetKeys(source).forEach(function(key) {\n\t\tif (propertyIsUnsafe(target, key)) {\n\t\t\treturn\n\t\t}\n\n\t\tif (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {\n\t\t\tdestination[key] = getMergeFunction(key, options)(target[key], source[key], options);\n\t\t} else {\n\t\t\tdestination[key] = cloneUnlessOtherwiseSpecified(source[key], options);\n\t\t}\n\t});\n\treturn destination\n}\n\nfunction deepmerge(target, source, options) {\n\toptions = options || {};\n\toptions.arrayMerge = options.arrayMerge || defaultArrayMerge;\n\toptions.isMergeableObject = options.isMergeableObject || isMergeableObject;\n\t// cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge()\n\t// implementations can use it. The caller may not replace it.\n\toptions.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;\n\n\tvar sourceIsArray = Array.isArray(source);\n\tvar targetIsArray = Array.isArray(target);\n\tvar sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;\n\n\tif (!sourceAndTargetTypesMatch) {\n\t\treturn cloneUnlessOtherwiseSpecified(source, options)\n\t} else if (sourceIsArray) {\n\t\treturn options.arrayMerge(target, source, options)\n\t} else {\n\t\treturn mergeObject(target, source, options)\n\t}\n}\n\ndeepmerge.all = function deepmergeAll(array, options) {\n\tif (!Array.isArray(array)) {\n\t\tthrow new Error('first argument should be an array')\n\t}\n\n\treturn array.reduce(function(prev, next) {\n\t\treturn deepmerge(prev, next, options)\n\t}, {})\n};\n\nvar deepmerge_1 = deepmerge;\n\nmodule.exports = deepmerge_1;\n","import { Buffer } from 'buffer'\nimport {\n GenericFilehandle,\n FilehandleOptions,\n Stats,\n Fetcher,\n PolyfilledResponse,\n} from './filehandle'\n\nfunction getMessage(e: unknown) {\n const r =\n typeof e === 'object' && e !== null && 'message' in e\n ? (e.message as string)\n : `${e}`\n return r.replace(/\\.$/, '')\n}\n\nexport default class RemoteFile implements GenericFilehandle {\n protected url: string\n private _stat?: Stats\n private fetchImplementation: Fetcher\n private baseOverrides: any = {}\n\n private async getBufferFromResponse(\n response: PolyfilledResponse,\n ): Promise<Buffer> {\n const resp = await response.arrayBuffer()\n return Buffer.from(resp)\n }\n\n public constructor(source: string, opts: FilehandleOptions = {}) {\n this.url = source\n const fetch = opts.fetch || globalThis.fetch.bind(globalThis)\n if (!fetch) {\n throw new TypeError(\n `no fetch function supplied, and none found in global environment`,\n )\n }\n if (opts.overrides) {\n this.baseOverrides = opts.overrides\n }\n this.fetchImplementation = fetch\n }\n\n public async fetch(\n input: RequestInfo,\n init: RequestInit | undefined,\n ): Promise<PolyfilledResponse> {\n let response\n try {\n response = await this.fetchImplementation(input, init)\n } catch (e) {\n if (`${e}`.includes('Failed to fetch')) {\n // refetch to to help work around a chrome bug (discussed in\n // generic-filehandle issue #72) in which the chrome cache returns a\n // CORS error for content in its cache. see also\n // https://github.com/GMOD/jbrowse-components/pull/1511\n console.warn(\n `generic-filehandle: refetching ${input} to attempt to work around chrome CORS header caching bug`,\n )\n try {\n response = await this.fetchImplementation(input, {\n ...init,\n cache: 'reload',\n })\n } catch (e) {\n throw new Error(`${getMessage(e)} fetching ${input}`, { cause: e })\n }\n } else {\n throw new Error(`${getMessage(e)} fetching ${input}`, { cause: e })\n }\n }\n return response\n }\n\n public async read(\n buffer: Buffer,\n offset = 0,\n length: number,\n position = 0,\n opts: FilehandleOptions = {},\n ): Promise<{ bytesRead: number; buffer: Buffer }> {\n const { headers = {}, signal, overrides = {} } = opts\n if (length < Infinity) {\n headers.range = `bytes=${position}-${position + length}`\n } else if (length === Infinity && position !== 0) {\n headers.range = `bytes=${position}-`\n }\n const res = await this.fetch(this.url, {\n ...this.baseOverrides,\n ...overrides,\n headers: {\n ...headers,\n ...overrides.headers,\n ...this.baseOverrides.headers,\n },\n method: 'GET',\n redirect: 'follow',\n mode: 'cors',\n signal,\n })\n\n if (!res.ok) {\n throw new Error(`HTTP ${res.status} fetching ${this.url}`)\n }\n\n if ((res.status === 200 && position === 0) || res.status === 206) {\n const resData = await this.getBufferFromResponse(res)\n const bytesCopied = resData.copy(\n buffer,\n offset,\n 0,\n Math.min(length, resData.length),\n )\n\n // try to parse out the size of the remote file\n const contentRange = res.headers.get('content-range')\n const sizeMatch = /\\/(\\d+)$/.exec(contentRange || '')\n if (sizeMatch?.[1]) {\n this._stat = { size: parseInt(sizeMatch[1], 10) }\n }\n\n return { bytesRead: bytesCopied, buffer }\n }\n\n if (res.status === 200) {\n throw new Error(`${this.url} fetch returned status 200, expected 206`)\n }\n\n // TODO: try harder here to gather more information about what the problem is\n throw new Error(`HTTP ${res.status} fetching ${this.url}`)\n }\n\n public async readFile(): Promise<Buffer>\n public async readFile(options: BufferEncoding): Promise<string>\n public async readFile<T extends undefined>(\n options:\n | Omit<FilehandleOptions, 'encoding'>\n | (Omit<FilehandleOptions, 'encoding'> & { encoding: T }),\n ): Promise<Buffer>\n public async readFile<T extends BufferEncoding>(\n options: Omit<FilehandleOptions, 'encoding'> & { encoding: T },\n ): Promise<string>\n readFile<T extends BufferEncoding>(\n options: Omit<FilehandleOptions, 'encoding'> & { encoding: T },\n ): T extends BufferEncoding ? Promise<Buffer> : Promise<Buffer | string>\n public async readFile(\n options: FilehandleOptions | BufferEncoding = {},\n ): Promise<Buffer | string> {\n let encoding\n let opts\n if (typeof options === 'string') {\n encoding = options\n opts = {}\n } else {\n encoding = options.encoding\n opts = options\n delete opts.encoding\n }\n const { headers = {}, signal, overrides = {} } = opts\n const res = await this.fetch(this.url, {\n headers,\n method: 'GET',\n redirect: 'follow',\n mode: 'cors',\n signal,\n ...this.baseOverrides,\n ...overrides,\n })\n if (res.status !== 200) {\n throw new Error(`HTTP ${res.status} fetching ${this.url}`)\n }\n if (encoding === 'utf8') {\n return res.text()\n } else if (encoding) {\n throw new Error(`unsupported encoding: ${encoding}`)\n } else {\n return this.getBufferFromResponse(res)\n }\n }\n\n public async stat(): Promise<Stats> {\n if (!this._stat) {\n const buf = Buffer.allocUnsafe(10)\n await this.read(buf, 0, 10, 0)\n if (!this._stat) {\n throw new Error(`unable to determine size of file at ${this.url}`)\n }\n }\n return this._stat\n }\n\n public async close(): Promise<void> {\n return\n }\n}\n","import { forwardRef, memo } from \"react\"\n\nimport { isUsingStaticRendering } from \"./staticRendering\"\nimport { useObserver } from \"./useObserver\"\n\nlet warnObserverOptionsDeprecated = true\n\nconst hasSymbol = typeof Symbol === \"function\" && Symbol.for\nconst isFunctionNameConfigurable =\n Object.getOwnPropertyDescriptor(() => {}, \"name\")?.configurable ?? false\n\n// Using react-is had some issues (and operates on elements, not on types), see #608 / #609\nconst ReactForwardRefSymbol = hasSymbol\n ? Symbol.for(\"react.forward_ref\")\n : typeof forwardRef === \"function\" && forwardRef((props: any) => null)[\"$$typeof\"]\n\nconst ReactMemoSymbol = hasSymbol\n ? Symbol.for(\"react.memo\")\n : typeof memo === \"function\" && memo((props: any) => null)[\"$$typeof\"]\n\nexport interface IObserverOptions {\n readonly forwardRef?: boolean\n}\n\nexport function observer<P extends object, TRef = {}>(\n baseComponent: React.ForwardRefRenderFunction<TRef, P>,\n options: IObserverOptions & { forwardRef: true }\n): React.MemoExoticComponent<\n React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<TRef>>\n>\n\nexport function observer<P extends object, TRef = {}>(\n baseComponent: React.ForwardRefExoticComponent<\n React.PropsWithoutRef<P> & React.RefAttributes<TRef>\n >\n): React.MemoExoticComponent<\n React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<TRef>>\n>\n\nexport function observer<P extends object>(\n baseComponent: React.FunctionComponent<P>,\n options?: IObserverOptions\n): React.FunctionComponent<P>\n\nexport function observer<\n C extends React.FunctionComponent<any> | React.ForwardRefRenderFunction<any>,\n Options extends IObserverOptions\n>(\n baseComponent: C,\n options?: Options\n): Options extends { forwardRef: true }\n ? C extends React.ForwardRefRenderFunction<infer TRef, infer P>\n ? C &\n React.MemoExoticComponent<\n React.ForwardRefExoticComponent<\n React.PropsWithoutRef<P> & React.RefAttributes<TRef>\n >\n >\n : never /* forwardRef set for a non forwarding component */\n : C & { displayName: string }\n\n// n.b. base case is not used for actual typings or exported in the typing files\nexport function observer<P extends object, TRef = {}>(\n baseComponent:\n | React.ForwardRefRenderFunction<TRef, P>\n | React.FunctionComponent<P>\n | React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<TRef>>,\n // TODO remove in next major\n options?: IObserverOptions\n) {\n if (process.env.NODE_ENV !== \"production\" && warnObserverOptionsDeprecated && options) {\n warnObserverOptionsDeprecated = false\n console.warn(\n `[mobx-react-lite] \\`observer(fn, { forwardRef: true })\\` is deprecated, use \\`observer(React.forwardRef(fn))\\``\n )\n }\n\n if (ReactMemoSymbol && baseComponent[\"$$typeof\"] === ReactMemoSymbol) {\n throw new Error(\n `[mobx-react-lite] You are trying to use \\`observer\\` on a function component wrapped in either another \\`observer\\` or \\`React.memo\\`. The observer already applies 'React.memo' for you.`\n )\n }\n\n // The working of observer is explained step by step in this talk: https://www.youtube.com/watch?v=cPF4iBedoF0&feature=youtu.be&t=1307\n if (isUsingStaticRendering()) {\n return baseComponent\n }\n\n let useForwardRef = options?.forwardRef ?? false\n let render = baseComponent\n\n const baseComponentName = baseComponent.displayName || baseComponent.name\n\n // If already wrapped with forwardRef, unwrap,\n // so we can patch render and apply memo\n if (ReactForwardRefSymbol && baseComponent[\"$$typeof\"] === ReactForwardRefSymbol) {\n useForwardRef = true\n render = baseComponent[\"render\"]\n if (typeof render !== \"function\") {\n throw new Error(\n `[mobx-react-lite] \\`render\\` property of ForwardRef was not a function`\n )\n }\n }\n\n let observerComponent = (props: any, ref: React.Ref<TRef>) => {\n return useObserver(() => render(props, ref), baseComponentName)\n }\n\n // Inherit original name and displayName, see #3438\n ;(observerComponent as React.FunctionComponent).displayName = baseComponent.displayName\n\n if (isFunctionNameConfigurable) {\n Object.defineProperty(observerComponent, \"name\", {\n value: baseComponent.name,\n writable: true,\n configurable: true\n })\n }\n\n // Support legacy context: `contextTypes` must be applied before `memo`\n if ((baseComponent as any).contextTypes) {\n ;(observerComponent as React.FunctionComponent).contextTypes = (\n baseComponent as any\n ).contextTypes\n }\n\n if (useForwardRef) {\n // `forwardRef` must be applied prior `memo`\n // `forwardRef(observer(cmp))` throws:\n // \"forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))\"\n observerComponent = forwardRef(observerComponent)\n }\n\n // memo; we are not interested in deep updates\n // in props; we assume that if deep objects are changed,\n // this is in observables, which would have been tracked anyway\n observerComponent = memo(observerComponent)\n\n copyStaticProperties(baseComponent, observerComponent)\n\n if (\"production\" !== process.env.NODE_ENV) {\n Object.defineProperty(observerComponent, \"contextTypes\", {\n set() {\n throw new Error(\n `[mobx-react-lite] \\`${\n this.displayName || this.type?.displayName || this.type?.name || \"Component\"\n }.contextTypes\\` must be set before applying \\`observer\\`.`\n )\n }\n })\n }\n\n return observerComponent\n}\n\n// based on https://github.com/mridgway/hoist-non-react-statics/blob/master/src/index.js\nconst hoistBlackList: any = {\n $$typeof: true,\n render: true,\n compare: true,\n type: true,\n // Don't redefine `displayName`,\n // it's defined as getter-setter pair on `memo` (see #3192).\n displayName: true\n}\n\nfunction copyStaticProperties(base: any, target: any) {\n Object.keys(base).forEach(key => {\n if (!hoistBlackList[key]) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(base, key)!)\n }\n })\n}\n","import { isComputedProp, isObservableProp, createAtom, action, computed, _allowStateChangesInsideComputed, reaction, runInAction, observable, values, entries, _getGlobalState, isObservableArray, isObservableObject, defineProperty as defineProperty$1, ObservableMap, _interceptReads, intercept, observe, _getAdministration, set, makeObservable, getAtom, when } from 'mobx';\n\nvar livelinessChecking = \"warn\";\n/**\n * Defines what MST should do when running into reads / writes to objects that have died.\n * By default it will print a warning.\n * Use the `\"error\"` option to easy debugging to see where the error was thrown and when the offending read / write took place\n *\n * @param mode `\"warn\"`, `\"error\"` or `\"ignore\"`\n */\nfunction setLivelinessChecking(mode) {\n livelinessChecking = mode;\n}\n/**\n * Returns the current liveliness checking mode.\n *\n * @returns `\"warn\"`, `\"error\"` or `\"ignore\"`\n */\nfunction getLivelinessChecking() {\n return livelinessChecking;\n}\n/**\n * @deprecated use setLivelinessChecking instead\n * @hidden\n *\n * Defines what MST should do when running into reads / writes to objects that have died.\n * By default it will print a warning.\n * Use the `\"error\"` option to easy debugging to see where the error was thrown and when the offending read / write took place\n *\n * @param mode `\"warn\"`, `\"error\"` or `\"ignore\"`\n */\nfunction setLivelynessChecking(mode) {\n setLivelinessChecking(mode);\n}\n\n/**\n * @hidden\n */\nvar Hook;\n(function (Hook) {\n Hook[\"afterCreate\"] = \"afterCreate\";\n Hook[\"afterAttach\"] = \"afterAttach\";\n Hook[\"afterCreationFinalization\"] = \"afterCreationFinalization\";\n Hook[\"beforeDetach\"] = \"beforeDetach\";\n Hook[\"beforeDestroy\"] = \"beforeDestroy\";\n})(Hook || (Hook = {}));\n\n/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nfunction __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nvar __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n };\r\n return __assign.apply(this, arguments);\r\n};\r\n\r\nfunction __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nfunction __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nfunction __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nfunction __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nfunction __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\n\n/**\n * Returns the _actual_ type of the given tree node. (Or throws)\n *\n * @param object\n * @returns\n */\nfunction getType(object) {\n assertIsStateTreeNode(object, 1);\n return getStateTreeNode(object).type;\n}\n/**\n * Returns the _declared_ type of the given sub property of an object, array or map.\n * In the case of arrays and maps the property name is optional and will be ignored.\n *\n * Example:\n * ```ts\n * const Box = types.model({ x: 0, y: 0 })\n * const box = Box.create()\n *\n * console.log(getChildType(box, \"x\").name) // 'number'\n * ```\n *\n * @param object\n * @param propertyName\n * @returns\n */\nfunction getChildType(object, propertyName) {\n assertIsStateTreeNode(object, 1);\n return getStateTreeNode(object).getChildType(propertyName);\n}\n/**\n * Registers a function that will be invoked for each mutation that is applied to the provided model instance, or to any of its children.\n * See [patches](https://github.com/mobxjs/mobx-state-tree#patches) for more details. onPatch events are emitted immediately and will not await the end of a transaction.\n * Patches can be used to deeply observe a model tree.\n *\n * @param target the model instance from which to receive patches\n * @param callback the callback that is invoked for each patch. The reversePatch is a patch that would actually undo the emitted patch\n * @returns function to remove the listener\n */\nfunction onPatch(target, callback) {\n // check all arguments\n assertIsStateTreeNode(target, 1);\n assertIsFunction(callback, 2);\n return getStateTreeNode(target).onPatch(callback);\n}\n/**\n * Registers a function that is invoked whenever a new snapshot for the given model instance is available.\n * The listener will only be fire at the end of the current MobX (trans)action.\n * See [snapshots](https://github.com/mobxjs/mobx-state-tree#snapshots) for more details.\n *\n * @param target\n * @param callback\n * @returns\n */\nfunction onSnapshot(target, callback) {\n // check all arguments\n assertIsStateTreeNode(target, 1);\n assertIsFunction(callback, 2);\n return getStateTreeNode(target).onSnapshot(callback);\n}\n/**\n * Applies a JSON-patch to the given model instance or bails out if the patch couldn't be applied\n * See [patches](https://github.com/mobxjs/mobx-state-tree#patches) for more details.\n *\n * Can apply a single past, or an array of patches.\n *\n * @param target\n * @param patch\n * @returns\n */\nfunction applyPatch(target, patch) {\n // check all arguments\n assertIsStateTreeNode(target, 1);\n assertArg(patch, function (p) { return typeof p === \"object\"; }, \"object or array\", 2);\n getStateTreeNode(target).applyPatches(asArray(patch));\n}\n/**\n * Small abstraction around `onPatch` and `applyPatch`, attaches a patch listener to a tree and records all the patches.\n * Returns a recorder object with the following signature:\n *\n * Example:\n * ```ts\n * export interface IPatchRecorder {\n * // the recorded patches\n * patches: IJsonPatch[]\n * // the inverse of the recorded patches\n * inversePatches: IJsonPatch[]\n * // true if currently recording\n * recording: boolean\n * // stop recording patches\n * stop(): void\n * // resume recording patches\n * resume(): void\n * // apply all the recorded patches on the given target (the original subject if omitted)\n * replay(target?: IAnyStateTreeNode): void\n * // reverse apply the recorded patches on the given target (the original subject if omitted)\n * // stops the recorder if not already stopped\n * undo(): void\n * }\n * ```\n *\n * The optional filter function allows to skip recording certain patches.\n *\n * @param subject\n * @param filter\n * @returns\n */\nfunction recordPatches(subject, filter) {\n // check all arguments\n assertIsStateTreeNode(subject, 1);\n var data = {\n patches: [],\n inversePatches: []\n };\n // we will generate the immutable copy of patches on demand for public consumption\n var publicData = {};\n var disposer;\n var recorder = {\n get recording() {\n return !!disposer;\n },\n get patches() {\n if (!publicData.patches) {\n publicData.patches = data.patches.slice();\n }\n return publicData.patches;\n },\n get reversedInversePatches() {\n if (!publicData.reversedInversePatches) {\n publicData.reversedInversePatches = data.inversePatches.slice().reverse();\n }\n return publicData.reversedInversePatches;\n },\n get inversePatches() {\n if (!publicData.inversePatches) {\n publicData.inversePatches = data.inversePatches.slice();\n }\n return publicData.inversePatches;\n },\n stop: function () {\n if (disposer) {\n disposer();\n disposer = undefined;\n }\n },\n resume: function () {\n if (disposer)\n return;\n disposer = onPatch(subject, function (patch, inversePatch) {\n // skip patches that are asked to be filtered if there's a filter in place\n if (filter && !filter(patch, inversePatch, getRunningActionContext())) {\n return;\n }\n data.patches.push(patch);\n data.inversePatches.push(inversePatch);\n // mark immutable public patches as dirty\n publicData.patches = undefined;\n publicData.inversePatches = undefined;\n publicData.reversedInversePatches = undefined;\n });\n },\n replay: function (target) {\n applyPatch(target || subject, data.patches);\n },\n undo: function (target) {\n applyPatch(target || subject, data.inversePatches.slice().reverse());\n }\n };\n recorder.resume();\n return recorder;\n}\n/**\n * The inverse of `unprotect`.\n *\n * @param target\n */\nfunction protect(target) {\n // check all arguments\n assertIsStateTreeNode(target, 1);\n var node = getStateTreeNode(target);\n if (!node.isRoot)\n throw fail(\"`protect` can only be invoked on root nodes\");\n node.isProtectionEnabled = true;\n}\n/**\n * By default it is not allowed to directly modify a model. Models can only be modified through actions.\n * However, in some cases you don't care about the advantages (like replayability, traceability, etc) this yields.\n * For example because you are building a PoC or don't have any middleware attached to your tree.\n *\n * In that case you can disable this protection by calling `unprotect` on the root of your tree.\n *\n * Example:\n * ```ts\n * const Todo = types.model({\n * done: false\n * }).actions(self => ({\n * toggle() {\n * self.done = !self.done\n * }\n * }))\n *\n * const todo = Todo.create()\n * todo.done = true // throws!\n * todo.toggle() // OK\n * unprotect(todo)\n * todo.done = false // OK\n * ```\n */\nfunction unprotect(target) {\n // check all arguments\n assertIsStateTreeNode(target, 1);\n var node = getStateTreeNode(target);\n if (!node.isRoot)\n throw fail(\"`unprotect` can only be invoked on root nodes\");\n node.isProtectionEnabled = false;\n}\n/**\n * Returns true if the object is in protected mode, @see protect\n */\nfunction isProtected(target) {\n return getStateTreeNode(target).isProtected;\n}\n/**\n * Applies a snapshot to a given model instances. Patch and snapshot listeners will be invoked as usual.\n *\n * @param target\n * @param snapshot\n * @returns\n */\nfunction applySnapshot(target, snapshot) {\n // check all arguments\n assertIsStateTreeNode(target, 1);\n return getStateTreeNode(target).applySnapshot(snapshot);\n}\n/**\n * Calculates a snapshot from the given model instance. The snapshot will always reflect the latest state but use\n * structural sharing where possible. Doesn't require MobX transactions to be completed.\n *\n * @param target\n * @param applyPostProcess If true (the default) then postProcessSnapshot gets applied.\n * @returns\n */\nfunction getSnapshot(target, applyPostProcess) {\n if (applyPostProcess === void 0) { applyPostProcess = true; }\n // check all arguments\n assertIsStateTreeNode(target, 1);\n var node = getStateTreeNode(target);\n if (applyPostProcess)\n return node.snapshot;\n return freeze(node.type.getSnapshot(node, false));\n}\n/**\n * Given a model instance, returns `true` if the object has a parent, that is, is part of another object, map or array.\n *\n * @param target\n * @param depth How far should we look upward? 1 by default.\n * @returns\n */\nfunction hasParent(target, depth) {\n if (depth === void 0) { depth = 1; }\n // check all arguments\n assertIsStateTreeNode(target, 1);\n assertIsNumber(depth, 2, 0);\n var parent = getStateTreeNode(target).parent;\n while (parent) {\n if (--depth === 0)\n return true;\n parent = parent.parent;\n }\n return false;\n}\n/**\n * Returns the immediate parent of this object, or throws.\n *\n * Note that the immediate parent can be either an object, map or array, and\n * doesn't necessarily refer to the parent model.\n *\n * Please note that in child nodes access to the root is only possible\n * once the `afterAttach` hook has fired.\n *\n * @param target\n * @param depth How far should we look upward? 1 by default.\n * @returns\n */\nfunction getParent(target, depth) {\n if (depth === void 0) { depth = 1; }\n // check all arguments\n assertIsStateTreeNode(target, 1);\n assertIsNumber(depth, 2, 0);\n var d = depth;\n var parent = getStateTreeNode(target).parent;\n while (parent) {\n if (--d === 0)\n return parent.storedValue;\n parent = parent.parent;\n }\n throw fail(\"Failed to find the parent of \" + getStateTreeNode(target) + \" at depth \" + depth);\n}\n/**\n * Given a model instance, returns `true` if the object has a parent of given type, that is, is part of another object, map or array\n *\n * @param target\n * @param type\n * @returns\n */\nfunction hasParentOfType(target, type) {\n // check all arguments\n assertIsStateTreeNode(target, 1);\n assertIsType(type, 2);\n var parent = getStateTreeNode(target).parent;\n while (parent) {\n if (type.is(parent.storedValue))\n return true;\n parent = parent.parent;\n }\n return false;\n}\n/**\n * Returns the target's parent of a given type, or throws.\n *\n * @param target\n * @param type\n * @returns\n */\nfunction getParentOfType(target, type) {\n // check all arguments\n assertIsStateTreeNode(target, 1);\n assertIsType(type, 2);\n var parent = getStateTreeNode(target).parent;\n while (parent) {\n if (type.is(parent.storedValue))\n return parent.storedValue;\n parent = parent.parent;\n }\n throw fail(\"Failed to find the parent of \" + getStateTreeNode(target) + \" of a given type\");\n}\n/**\n * Given an object in a model tree, returns the root object of that tree.\n *\n * Please note that in child nodes access to the root is only possible\n * once the `afterAttach` hook has fired.\n *\n * @param target\n * @returns\n */\nfunction getRoot(target) {\n // check all arguments\n assertIsStateTreeNode(target, 1);\n return getStateTreeNode(target).root.storedValue;\n}\n/**\n * Returns the path of the given object in the model tree\n *\n * @param target\n * @returns\n */\nfunction getPath(target) {\n // check all arguments\n assertIsStateTreeNode(target, 1);\n return getStateTreeNode(target).path;\n}\n/**\n * Returns the path of the given object as unescaped string array.\n *\n * @param target\n * @returns\n */\nfunction getPathParts(target) {\n // check all arguments\n assertIsStateTreeNode(target, 1);\n return splitJsonPath(getStateTreeNode(target).path);\n}\n/**\n * Returns true if the given object is the root of a model tree.\n *\n * @param target\n * @returns\n */\nfunction isRoot(target) {\n // check all arguments\n assertIsStateTreeNode(target, 1);\n return getStateTreeNode(target).isRoot;\n}\n/**\n * Resolves a path relatively to a given object.\n * Returns undefined if no value can be found.\n *\n * @param target\n * @param path escaped json path\n * @returns\n */\nfunction resolvePath(target, path) {\n // check all arguments\n assertIsStateTreeNode(target, 1);\n assertIsString(path, 2);\n var node = resolveNodeByPath(getStateTreeNode(target), path);\n return node ? node.value : undefined;\n}\n/**\n * Resolves a model instance given a root target, the type and the identifier you are searching for.\n * Returns undefined if no value can be found.\n *\n * @param type\n * @param target\n * @param identifier\n * @returns\n */\nfunction resolveIdentifier(type, target, identifier) {\n // check all arguments\n assertIsType(type, 1);\n assertIsStateTreeNode(target, 2);\n assertIsValidIdentifier(identifier, 3);\n var node = getStateTreeNode(target).root.identifierCache.resolve(type, normalizeIdentifier(identifier));\n return node === null || node === void 0 ? void 0 : node.value;\n}\n/**\n * Returns the identifier of the target node.\n * This is the *string normalized* identifier, which might not match the type of the identifier attribute\n *\n * @param target\n * @returns\n */\nfunction getIdentifier(target) {\n // check all arguments\n assertIsStateTreeNode(target, 1);\n return getStateTreeNode(target).identifier;\n}\n/**\n * Tests if a reference is valid (pointing to an existing node and optionally if alive) and returns such reference if the check passes,\n * else it returns undefined.\n *\n * @param getter Function to access the reference.\n * @param checkIfAlive true to also make sure the referenced node is alive (default), false to skip this check.\n * @returns\n */\nfunction tryReference(getter, checkIfAlive) {\n if (checkIfAlive === void 0) { checkIfAlive = true; }\n try {\n var node = getter();\n if (node === undefined || node === null) {\n return undefined;\n }\n else if (isStateTreeNode(node)) {\n if (!checkIfAlive) {\n return node;\n }\n else {\n return isAlive(node) ? node : undefined;\n }\n }\n else {\n throw fail(\"The reference to be checked is not one of node, null or undefined\");\n }\n }\n catch (e) {\n if (e instanceof InvalidReferenceError) {\n return undefined;\n }\n throw e;\n }\n}\n/**\n * Tests if a reference is valid (pointing to an existing node and optionally if alive) and returns if the check passes or not.\n *\n * @param getter Function to access the reference.\n * @param checkIfAlive true to also make sure the referenced node is alive (default), false to skip this check.\n * @returns\n */\nfunction isValidReference(getter, checkIfAlive) {\n if (checkIfAlive === void 0) { checkIfAlive = true; }\n try {\n var node = getter();\n if (node === undefined || node === null) {\n return false;\n }\n else if (isStateTreeNode(node)) {\n return checkIfAlive ? isAlive(node) : true;\n }\n else {\n throw fail(\"The reference to be checked is not one of node, null or undefined\");\n }\n }\n catch (e) {\n if (e instanceof InvalidReferenceError) {\n return false;\n }\n throw e;\n }\n}\n/**\n * Try to resolve a given path relative to a given node.\n *\n * @param target\n * @param path\n * @returns\n */\nfunction tryResolve(target, path) {\n // check all arguments\n assertIsStateTreeNode(target, 1);\n assertIsString(path, 2);\n var node = resolveNodeByPath(getStateTreeNode(target), path, false);\n if (node === undefined)\n return undefined;\n try {\n return node.value;\n }\n catch (e) {\n // For what ever reason not resolvable (e.g. totally not existing path, or value that cannot be fetched)\n // see test / issue: 'try resolve doesn't work #686'\n return undefined;\n }\n}\n/**\n * Given two state tree nodes that are part of the same tree,\n * returns the shortest jsonpath needed to navigate from the one to the other\n *\n * @param base\n * @param target\n * @returns\n */\nfunction getRelativePath(base, target) {\n // check all arguments\n assertIsStateTreeNode(base, 1);\n assertIsStateTreeNode(target, 2);\n return getRelativePathBetweenNodes(getStateTreeNode(base), getStateTreeNode(target));\n}\n/**\n * Returns a deep copy of the given state tree node as new tree.\n * Shorthand for `snapshot(x) = getType(x).create(getSnapshot(x))`\n *\n * _Tip: clone will create a literal copy, including the same identifiers. To modify identifiers etc. during cloning, don't use clone but take a snapshot of the tree, modify it, and create new instance_\n *\n * @param source\n * @param keepEnvironment indicates whether the clone should inherit the same environment (`true`, the default), or not have an environment (`false`). If an object is passed in as second argument, that will act as the environment for the cloned tree.\n * @returns\n */\nfunction clone(source, keepEnvironment) {\n if (keepEnvironment === void 0) { keepEnvironment = true; }\n // check all arguments\n assertIsStateTreeNode(source, 1);\n var node = getStateTreeNode(source);\n return node.type.create(node.snapshot, keepEnvironment === true\n ? node.root.environment\n : keepEnvironment === false\n ? undefined\n : keepEnvironment); // it's an object or something else\n}\n/**\n * Removes a model element from the state tree, and let it live on as a new state tree\n */\nfunction detach(target) {\n // check all arguments\n assertIsStateTreeNode(target, 1);\n getStateTreeNode(target).detach();\n return target;\n}\n/**\n * Removes a model element from the state tree, and mark it as end-of-life; the element should not be used anymore\n */\nfunction destroy(target) {\n // check all arguments\n assertIsStateTreeNode(target, 1);\n var node = getStateTreeNode(target);\n if (node.isRoot)\n node.die();\n else\n node.parent.removeChild(node.subpath);\n}\n/**\n * Returns true if the given state tree node is not killed yet.\n * This means that the node is still a part of a tree, and that `destroy`\n * has not been called. If a node is not alive anymore, the only thing one can do with it\n * is requesting it's last path and snapshot\n *\n * @param target\n * @returns\n */\nfunction isAlive(target) {\n // check all arguments\n assertIsStateTreeNode(target, 1);\n return getStateTreeNode(target).observableIsAlive;\n}\n/**\n * Use this utility to register a function that should be called whenever the\n * targeted state tree node is destroyed. This is a useful alternative to managing\n * cleanup methods yourself using the `beforeDestroy` hook.\n *\n * This methods returns the same disposer that was passed as argument.\n *\n * Example:\n * ```ts\n * const Todo = types.model({\n * title: types.string\n * }).actions(self => ({\n * afterCreate() {\n * const autoSaveDisposer = reaction(\n * () => getSnapshot(self),\n * snapshot => sendSnapshotToServerSomehow(snapshot)\n * )\n * // stop sending updates to server if this\n * // instance is destroyed\n * addDisposer(self, autoSaveDisposer)\n * }\n * }))\n * ```\n *\n * @param target\n * @param disposer\n * @returns The same disposer that was passed as argument\n */\nfunction addDisposer(target, disposer) {\n // check all arguments\n assertIsStateTreeNode(target, 1);\n assertIsFunction(disposer, 2);\n var node = getStateTreeNode(target);\n node.addDisposer(disposer);\n return disposer;\n}\n/**\n * Returns the environment of the current state tree. For more info on environments,\n * see [Dependency injection](https://github.com/mobxjs/mobx-state-tree#dependency-injection)\n *\n * Please note that in child nodes access to the root is only possible\n * once the `afterAttach` hook has fired\n *\n * Returns an empty environment if the tree wasn't initialized with an environment\n *\n * @param target\n * @returns\n */\nfunction getEnv(target) {\n // check all arguments\n assertIsStateTreeNode(target, 1);\n var node = getStateTreeNode(target);\n var env = node.root.environment;\n if (!env)\n return EMPTY_OBJECT;\n return env;\n}\n/**\n * Performs a depth first walk through a tree.\n */\nfunction walk(target, processor) {\n // check all arguments\n assertIsStateTreeNode(target, 1);\n assertIsFunction(processor, 2);\n var node = getStateTreeNode(target);\n // tslint:disable-next-line:no_unused-variable\n node.getChildren().forEach(function (child) {\n if (isStateTreeNode(child.storedValue))\n walk(child.storedValue, processor);\n });\n processor(node.storedValue);\n}\n/**\n * Returns a reflection of the model type properties and name for either a model type or model node.\n *\n * @param typeOrNode\n * @returns\n */\nfunction getPropertyMembers(typeOrNode) {\n var type;\n if (isStateTreeNode(typeOrNode)) {\n type = getType(typeOrNode);\n }\n else {\n type = typeOrNode;\n }\n assertArg(type, function (t) { return isModelType(t); }, \"model type or model instance\", 1);\n return {\n name: type.name,\n properties: __assign({}, type.properties)\n };\n}\n/**\n * Returns a reflection of the model node, including name, properties, views, volatile state,\n * and actions. `flowActions` is also provided as a separate array of names for any action that\n * came from a flow generator as well.\n *\n * In the case where a model has two actions: `doSomething` and `doSomethingWithFlow`, where\n * `doSomethingWithFlow` is a flow generator, the `actions` array will contain both actions,\n * i.e. [\"doSomething\", \"doSomethingWithFlow\"], and the `flowActions` array will contain only\n * the flow action, i.e. [\"doSomethingWithFlow\"].\n *\n * @param target\n * @returns\n */\nfunction getMembers(target) {\n var type = getStateTreeNode(target).type;\n var reflected = __assign(__assign({}, getPropertyMembers(type)), { actions: [], volatile: [], views: [], flowActions: [] });\n var props = Object.getOwnPropertyNames(target);\n props.forEach(function (key) {\n if (key in reflected.properties)\n return;\n var descriptor = Object.getOwnPropertyDescriptor(target, key);\n if (descriptor.get) {\n if (isComputedProp(target, key))\n reflected.views.push(key);\n else\n reflected.volatile.push(key);\n return;\n }\n if (descriptor.value._isFlowAction === true) {\n reflected.flowActions.push(key);\n }\n if (descriptor.value._isMSTAction === true) {\n reflected.actions.push(key);\n }\n else if (isObservableProp(target, key)) {\n reflected.volatile.push(key);\n }\n else {\n reflected.views.push(key);\n }\n });\n return reflected;\n}\n/**\n * Casts a node snapshot or instance type to an instance type so it can be assigned to a type instance.\n * Note that this is just a cast for the type system, this is, it won't actually convert a snapshot to an instance,\n * but just fool typescript into thinking so.\n * Either way, casting when outside an assignation operation won't compile.\n *\n * Example:\n * ```ts\n * const ModelA = types.model({\n * n: types.number\n * }).actions(self => ({\n * setN(aNumber: number) {\n * self.n = aNumber\n * }\n * }))\n *\n * const ModelB = types.model({\n * innerModel: ModelA\n * }).actions(self => ({\n * someAction() {\n * // this will allow the compiler to assign a snapshot to the property\n * self.innerModel = cast({ a: 5 })\n * }\n * }))\n * ```\n *\n * @param snapshotOrInstance Snapshot or instance\n * @returns The same object cast as an instance\n */\nfunction cast(snapshotOrInstance) {\n return snapshotOrInstance;\n}\n/**\n * Casts a node instance type to a snapshot type so it can be assigned to a type snapshot (e.g. to be used inside a create call).\n * Note that this is just a cast for the type system, this is, it won't actually convert an instance to a snapshot,\n * but just fool typescript into thinking so.\n *\n * Example:\n * ```ts\n * const ModelA = types.model({\n * n: types.number\n * }).actions(self => ({\n * setN(aNumber: number) {\n * self.n = aNumber\n * }\n * }))\n *\n * const ModelB = types.model({\n * innerModel: ModelA\n * })\n *\n * const a = ModelA.create({ n: 5 });\n * // this will allow the compiler to use a model as if it were a snapshot\n * const b = ModelB.create({ innerModel: castToSnapshot(a)})\n * ```\n *\n * @param snapshotOrInstance Snapshot or instance\n * @returns The same object cast as an input (creation) snapshot\n */\nfunction castToSnapshot(snapshotOrInstance) {\n return snapshotOrInstance;\n}\n/**\n * Casts a node instance type to a reference snapshot type so it can be assigned to a reference snapshot (e.g. to be used inside a create call).\n * Note that this is just a cast for the type system, this is, it won't actually convert an instance to a reference snapshot,\n * but just fool typescript into thinking so.\n *\n * Example:\n * ```ts\n * const ModelA = types.model({\n * id: types.identifier,\n * n: types.number\n * }).actions(self => ({\n * setN(aNumber: number) {\n * self.n = aNumber\n * }\n * }))\n *\n * const ModelB = types.model({\n * refA: types.reference(ModelA)\n * })\n *\n * const a = ModelA.create({ id: 'someId', n: 5 });\n * // this will allow the compiler to use a model as if it were a reference snapshot\n * const b = ModelB.create({ refA: castToReferenceSnapshot(a)})\n * ```\n *\n * @param instance Instance\n * @returns The same object cast as a reference snapshot (string or number)\n */\nfunction castToReferenceSnapshot(instance) {\n return instance;\n}\n/**\n * Returns the unique node id (not to be confused with the instance identifier) for a\n * given instance.\n * This id is a number that is unique for each instance.\n *\n * @export\n * @param target\n * @returns\n */\nfunction getNodeId(target) {\n assertIsStateTreeNode(target, 1);\n return getStateTreeNode(target).nodeId;\n}\n\n/**\n * @internal\n * @hidden\n */\nvar BaseNode = /** @class */ (function () {\n function BaseNode(type, parent, subpath, environment) {\n Object.defineProperty(this, \"type\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: type\n });\n Object.defineProperty(this, \"environment\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: environment\n });\n Object.defineProperty(this, \"_escapedSubpath\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_subpath\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_subpathUponDeath\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_pathUponDeath\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"storedValue\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n }); // usually the same type as the value, but not always (such as with references)\n Object.defineProperty(this, \"aliveAtom\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_state\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: NodeLifeCycle.INITIALIZING\n });\n Object.defineProperty(this, \"_hookSubscribers\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_parent\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"pathAtom\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this.environment = environment;\n this.baseSetParent(parent, subpath);\n }\n Object.defineProperty(BaseNode.prototype, \"subpath\", {\n get: function () {\n return this._subpath;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BaseNode.prototype, \"subpathUponDeath\", {\n get: function () {\n return this._subpathUponDeath;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BaseNode.prototype, \"pathUponDeath\", {\n get: function () {\n return this._pathUponDeath;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BaseNode.prototype, \"value\", {\n get: function () {\n return this.type.getValue(this);\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BaseNode.prototype, \"state\", {\n get: function () {\n return this._state;\n },\n set: function (val) {\n var wasAlive = this.isAlive;\n this._state = val;\n var isAlive = this.isAlive;\n if (this.aliveAtom && wasAlive !== isAlive) {\n this.aliveAtom.reportChanged();\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BaseNode.prototype, \"fireInternalHook\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (name) {\n if (this._hookSubscribers) {\n this._hookSubscribers.emit(name, this, name);\n }\n }\n });\n Object.defineProperty(BaseNode.prototype, \"registerHook\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (hook, hookHandler) {\n if (!this._hookSubscribers) {\n this._hookSubscribers = new EventHandlers();\n }\n return this._hookSubscribers.register(hook, hookHandler);\n }\n });\n Object.defineProperty(BaseNode.prototype, \"parent\", {\n get: function () {\n return this._parent;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BaseNode.prototype, \"getReconciliationType\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function () {\n return this.type;\n }\n });\n Object.defineProperty(BaseNode.prototype, \"baseSetParent\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (parent, subpath) {\n this._parent = parent;\n this._subpath = subpath;\n this._escapedSubpath = undefined; // regenerate when needed\n if (this.pathAtom) {\n this.pathAtom.reportChanged();\n }\n }\n });\n Object.defineProperty(BaseNode.prototype, \"path\", {\n /*\n * Returns (escaped) path representation as string\n */\n get: function () {\n return this.getEscapedPath(true);\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BaseNode.prototype, \"getEscapedPath\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (reportObserved) {\n if (reportObserved) {\n if (!this.pathAtom) {\n this.pathAtom = createAtom(\"path\");\n }\n this.pathAtom.reportObserved();\n }\n if (!this.parent)\n return \"\";\n // regenerate escaped subpath if needed\n if (this._escapedSubpath === undefined) {\n this._escapedSubpath = !this._subpath ? \"\" : escapeJsonPath(this._subpath);\n }\n return this.parent.getEscapedPath(reportObserved) + \"/\" + this._escapedSubpath;\n }\n });\n Object.defineProperty(BaseNode.prototype, \"isRoot\", {\n get: function () {\n return this.parent === null;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BaseNode.prototype, \"isAlive\", {\n get: function () {\n return this.state !== NodeLifeCycle.DEAD;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BaseNode.prototype, \"isDetaching\", {\n get: function () {\n return this.state === NodeLifeCycle.DETACHING;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BaseNode.prototype, \"observableIsAlive\", {\n get: function () {\n if (!this.aliveAtom) {\n this.aliveAtom = createAtom(\"alive\");\n }\n this.aliveAtom.reportObserved();\n return this.isAlive;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BaseNode.prototype, \"baseFinalizeCreation\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (whenFinalized) {\n if (devMode()) {\n if (!this.isAlive) {\n // istanbul ignore next\n throw fail(\"assertion failed: cannot finalize the creation of a node that is already dead\");\n }\n }\n // goal: afterCreate hooks runs depth-first. After attach runs parent first, so on afterAttach the parent has completed already\n if (this.state === NodeLifeCycle.CREATED) {\n if (this.parent) {\n if (this.parent.state !== NodeLifeCycle.FINALIZED) {\n // parent not ready yet, postpone\n return;\n }\n this.fireHook(Hook.afterAttach);\n }\n this.state = NodeLifeCycle.FINALIZED;\n if (whenFinalized) {\n whenFinalized();\n }\n }\n }\n });\n Object.defineProperty(BaseNode.prototype, \"baseFinalizeDeath\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function () {\n if (this._hookSubscribers) {\n this._hookSubscribers.clearAll();\n }\n this._subpathUponDeath = this._subpath;\n this._pathUponDeath = this.getEscapedPath(false);\n this.baseSetParent(null, \"\");\n this.state = NodeLifeCycle.DEAD;\n }\n });\n Object.defineProperty(BaseNode.prototype, \"baseAboutToDie\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function () {\n this.fireHook(Hook.beforeDestroy);\n }\n });\n return BaseNode;\n}());\n\n/**\n * @internal\n * @hidden\n */\nvar ScalarNode = /** @class */ (function (_super) {\n __extends(ScalarNode, _super);\n function ScalarNode(simpleType, parent, subpath, environment, initialSnapshot) {\n var _this = _super.call(this, simpleType, parent, subpath, environment) || this;\n try {\n _this.storedValue = simpleType.createNewInstance(initialSnapshot);\n }\n catch (e) {\n // short-cut to die the instance, to avoid the snapshot computed starting to throw...\n _this.state = NodeLifeCycle.DEAD;\n throw e;\n }\n _this.state = NodeLifeCycle.CREATED;\n // for scalar nodes there's no point in firing this event since it would fire on the constructor, before\n // anybody can actually register for/listen to it\n // this.fireHook(Hook.AfterCreate)\n _this.finalizeCreation();\n return _this;\n }\n Object.defineProperty(ScalarNode.prototype, \"root\", {\n get: function () {\n // future optimization: store root ref in the node and maintain it\n if (!this.parent)\n throw fail(\"This scalar node is not part of a tree\");\n return this.parent.root;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(ScalarNode.prototype, \"setParent\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (newParent, subpath) {\n var parentChanged = this.parent !== newParent;\n var subpathChanged = this.subpath !== subpath;\n if (!parentChanged && !subpathChanged) {\n return;\n }\n if (devMode()) {\n if (!subpath) {\n // istanbul ignore next\n throw fail(\"assertion failed: subpath expected\");\n }\n if (!newParent) {\n // istanbul ignore next\n throw fail(\"assertion failed: parent expected\");\n }\n if (parentChanged) {\n // istanbul ignore next\n throw fail(\"assertion failed: scalar nodes cannot change their parent\");\n }\n }\n this.environment = undefined; // use parent's\n this.baseSetParent(this.parent, subpath);\n }\n });\n Object.defineProperty(ScalarNode.prototype, \"snapshot\", {\n get: function () {\n return freeze(this.getSnapshot());\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(ScalarNode.prototype, \"getSnapshot\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function () {\n return this.type.getSnapshot(this);\n }\n });\n Object.defineProperty(ScalarNode.prototype, \"toString\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function () {\n var path = (this.isAlive ? this.path : this.pathUponDeath) || \"<root>\";\n return this.type.name + \"@\" + path + (this.isAlive ? \"\" : \" [dead]\");\n }\n });\n Object.defineProperty(ScalarNode.prototype, \"die\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function () {\n if (!this.isAlive || this.state === NodeLifeCycle.DETACHING)\n return;\n this.aboutToDie();\n this.finalizeDeath();\n }\n });\n Object.defineProperty(ScalarNode.prototype, \"finalizeCreation\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function () {\n this.baseFinalizeCreation();\n }\n });\n Object.defineProperty(ScalarNode.prototype, \"aboutToDie\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function () {\n this.baseAboutToDie();\n }\n });\n Object.defineProperty(ScalarNode.prototype, \"finalizeDeath\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function () {\n this.baseFinalizeDeath();\n }\n });\n Object.defineProperty(ScalarNode.prototype, \"fireHook\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (name) {\n this.fireInternalHook(name);\n }\n });\n return ScalarNode;\n}(BaseNode));\nScalarNode.prototype.die = action(ScalarNode.prototype.die);\n\nvar nextNodeId = 1;\nvar snapshotReactionOptions = {\n onError: function (e) {\n throw e;\n }\n};\n/**\n * @internal\n * @hidden\n */\nvar ObjectNode = /** @class */ (function (_super) {\n __extends(ObjectNode, _super);\n function ObjectNode(complexType, parent, subpath, environment, initialValue) {\n var _this = _super.call(this, complexType, parent, subpath, environment) || this;\n Object.defineProperty(_this, \"nodeId\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: ++nextNodeId\n });\n Object.defineProperty(_this, \"identifierAttribute\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(_this, \"identifier\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n }); // Identifier is always normalized to string, even if the identifier property isn't\n Object.defineProperty(_this, \"unnormalizedIdentifier\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(_this, \"identifierCache\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(_this, \"isProtectionEnabled\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: true\n });\n Object.defineProperty(_this, \"middlewares\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(_this, \"hasSnapshotPostProcessor\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: false\n });\n Object.defineProperty(_this, \"_applyPatches\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(_this, \"_applySnapshot\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(_this, \"_autoUnbox\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: true\n }); // unboxing is disabled when reading child nodes\n Object.defineProperty(_this, \"_isRunningAction\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: false\n }); // only relevant for root\n Object.defineProperty(_this, \"_hasSnapshotReaction\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: false\n });\n Object.defineProperty(_this, \"_observableInstanceState\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 0 /* UNINITIALIZED */\n });\n Object.defineProperty(_this, \"_childNodes\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(_this, \"_initialSnapshot\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(_this, \"_cachedInitialSnapshot\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(_this, \"_cachedInitialSnapshotCreated\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: false\n });\n Object.defineProperty(_this, \"_snapshotComputed\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(_this, \"_snapshotUponDeath\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n // #region internal event handling\n Object.defineProperty(_this, \"_internalEvents\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n _this._snapshotComputed = computed(function () { return freeze(_this.getSnapshot()); });\n _this.unbox = _this.unbox.bind(_this);\n _this._initialSnapshot = freeze(initialValue);\n _this.identifierAttribute = complexType.identifierAttribute;\n if (!parent) {\n _this.identifierCache = new IdentifierCache();\n }\n _this._childNodes = complexType.initializeChildNodes(_this, _this._initialSnapshot);\n // identifier can not be changed during lifecycle of a node\n // so we safely can read it from initial snapshot\n _this.identifier = null;\n _this.unnormalizedIdentifier = null;\n if (_this.identifierAttribute && _this._initialSnapshot) {\n var id = _this._initialSnapshot[_this.identifierAttribute];\n if (id === undefined) {\n // try with the actual node if not (for optional identifiers)\n var childNode = _this._childNodes[_this.identifierAttribute];\n if (childNode) {\n id = childNode.value;\n }\n }\n if (typeof id !== \"string\" && typeof id !== \"number\") {\n throw fail(\"Instance identifier '\" + _this.identifierAttribute + \"' for type '\" + _this.type.name + \"' must be a string or a number\");\n }\n // normalize internal identifier to string\n _this.identifier = normalizeIdentifier(id);\n _this.unnormalizedIdentifier = id;\n }\n if (!parent) {\n _this.identifierCache.addNodeToCache(_this);\n }\n else {\n parent.root.identifierCache.addNodeToCache(_this);\n }\n return _this;\n }\n Object.defineProperty(ObjectNode.prototype, \"applyPatches\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (patches) {\n this.createObservableInstanceIfNeeded();\n this._applyPatches(patches);\n }\n });\n Object.defineProperty(ObjectNode.prototype, \"applySnapshot\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (snapshot) {\n this.createObservableInstanceIfNeeded();\n this._applySnapshot(snapshot);\n }\n });\n Object.defineProperty(ObjectNode.prototype, \"createObservableInstanceIfNeeded\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (fireHooks) {\n if (fireHooks === void 0) { fireHooks = true; }\n if (this._observableInstanceState === 0 /* UNINITIALIZED */) {\n this.createObservableInstance(fireHooks);\n }\n }\n });\n Object.defineProperty(ObjectNode.prototype, \"createObservableInstance\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (fireHooks) {\n var e_1, _a, e_2, _b;\n if (fireHooks === void 0) { fireHooks = true; }\n if (devMode()) {\n if (this.state !== NodeLifeCycle.INITIALIZING) {\n // istanbul ignore next\n throw fail(\"assertion failed: the creation of the observable instance must be done on the initializing phase\");\n }\n }\n this._observableInstanceState = 1 /* CREATING */;\n // make sure the parent chain is created as well\n // array with parent chain from parent to child\n var parentChain = [];\n var parent = this.parent;\n // for performance reasons we never go back further than the most direct\n // uninitialized parent\n // this is done to avoid traversing the whole tree to the root when using\n // the same reference again\n while (parent &&\n parent._observableInstanceState === 0 /* UNINITIALIZED */) {\n parentChain.unshift(parent);\n parent = parent.parent;\n }\n try {\n // initialize the uninitialized parent chain from parent to child\n for (var parentChain_1 = __values(parentChain), parentChain_1_1 = parentChain_1.next(); !parentChain_1_1.done; parentChain_1_1 = parentChain_1.next()) {\n var p = parentChain_1_1.value;\n // delay firing hooks until after all parents have been created\n p.createObservableInstanceIfNeeded(false);\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (parentChain_1_1 && !parentChain_1_1.done && (_a = parentChain_1.return)) _a.call(parentChain_1);\n }\n finally { if (e_1) throw e_1.error; }\n }\n var type = this.type;\n try {\n this.storedValue = type.createNewInstance(this._childNodes);\n this.preboot();\n this._isRunningAction = true;\n type.finalizeNewInstance(this, this.storedValue);\n }\n catch (e) {\n // short-cut to die the instance, to avoid the snapshot computed starting to throw...\n this.state = NodeLifeCycle.DEAD;\n throw e;\n }\n finally {\n this._isRunningAction = false;\n }\n this._observableInstanceState = 2 /* CREATED */;\n this._snapshotComputed.trackAndCompute();\n if (this.isRoot)\n this._addSnapshotReaction();\n this._childNodes = EMPTY_OBJECT;\n this.state = NodeLifeCycle.CREATED;\n if (fireHooks) {\n this.fireHook(Hook.afterCreate);\n // Note that the parent might not be finalized at this point\n // so afterAttach won't be called until later in that case\n this.finalizeCreation();\n try {\n // fire the hooks of the parents that we created\n for (var _c = __values(parentChain.reverse()), _d = _c.next(); !_d.done; _d = _c.next()) {\n var p = _d.value;\n p.fireHook(Hook.afterCreate);\n // This will call afterAttach on the child if necessary\n p.finalizeCreation();\n }\n }\n catch (e_2_1) { e_2 = { error: e_2_1 }; }\n finally {\n try {\n if (_d && !_d.done && (_b = _c.return)) _b.call(_c);\n }\n finally { if (e_2) throw e_2.error; }\n }\n }\n }\n });\n Object.defineProperty(ObjectNode.prototype, \"root\", {\n get: function () {\n var parent = this.parent;\n return parent ? parent.root : this;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(ObjectNode.prototype, \"clearParent\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function () {\n if (!this.parent)\n return;\n // detach if attached\n this.fireHook(Hook.beforeDetach);\n var previousState = this.state;\n this.state = NodeLifeCycle.DETACHING;\n var root = this.root;\n var newEnv = root.environment;\n var newIdCache = root.identifierCache.splitCache(this);\n try {\n this.parent.removeChild(this.subpath);\n this.baseSetParent(null, \"\");\n this.environment = newEnv;\n this.identifierCache = newIdCache;\n }\n finally {\n this.state = previousState;\n }\n }\n });\n Object.defineProperty(ObjectNode.prototype, \"setParent\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (newParent, subpath) {\n var parentChanged = newParent !== this.parent;\n var subpathChanged = subpath !== this.subpath;\n if (!parentChanged && !subpathChanged) {\n return;\n }\n if (devMode()) {\n if (!subpath) {\n // istanbul ignore next\n throw fail(\"assertion failed: subpath expected\");\n }\n if (!newParent) {\n // istanbul ignore next\n throw fail(\"assertion failed: new parent expected\");\n }\n if (this.parent && parentChanged) {\n throw fail(\"A node cannot exists twice in the state tree. Failed to add \" + this + \" to path '\" + newParent.path + \"/\" + subpath + \"'.\");\n }\n if (!this.parent && newParent.root === this) {\n throw fail(\"A state tree is not allowed to contain itself. Cannot assign \" + this + \" to path '\" + newParent.path + \"/\" + subpath + \"'\");\n }\n if (!this.parent && !!this.environment && this.environment !== newParent.root.environment) {\n throw fail(\"A state tree cannot be made part of another state tree as long as their environments are different.\");\n }\n }\n if (parentChanged) {\n // attach to new parent\n this.environment = undefined; // will use root's\n newParent.root.identifierCache.mergeCache(this);\n this.baseSetParent(newParent, subpath);\n this.fireHook(Hook.afterAttach);\n }\n else if (subpathChanged) {\n // moving to a new subpath on the same parent\n this.baseSetParent(this.parent, subpath);\n }\n }\n });\n Object.defineProperty(ObjectNode.prototype, \"fireHook\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (name) {\n var _this = this;\n this.fireInternalHook(name);\n var fn = this.storedValue && typeof this.storedValue === \"object\" && this.storedValue[name];\n if (typeof fn === \"function\") {\n // we check for it to allow old mobx peer dependencies that don't have the method to work (even when still bugged)\n if (_allowStateChangesInsideComputed) {\n _allowStateChangesInsideComputed(function () {\n fn.apply(_this.storedValue);\n });\n }\n else {\n fn.apply(this.storedValue);\n }\n }\n }\n });\n Object.defineProperty(ObjectNode.prototype, \"snapshot\", {\n // advantage of using computed for a snapshot is that nicely respects transactions etc.\n get: function () {\n if (this.hasSnapshotPostProcessor) {\n this.createObservableInstanceIfNeeded();\n }\n return this._snapshotComputed.get();\n },\n enumerable: false,\n configurable: true\n });\n // NOTE: we use this method to get snapshot without creating @computed overhead\n Object.defineProperty(ObjectNode.prototype, \"getSnapshot\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function () {\n if (!this.isAlive)\n return this._snapshotUponDeath;\n return this._observableInstanceState === 2 /* CREATED */\n ? this._getActualSnapshot()\n : this._getCachedInitialSnapshot();\n }\n });\n Object.defineProperty(ObjectNode.prototype, \"_getActualSnapshot\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function () {\n return this.type.getSnapshot(this);\n }\n });\n Object.defineProperty(ObjectNode.prototype, \"_getCachedInitialSnapshot\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function () {\n if (!this._cachedInitialSnapshotCreated) {\n var type = this.type;\n var childNodes = this._childNodes;\n var snapshot = this._initialSnapshot;\n this._cachedInitialSnapshot = type.processInitialSnapshot(childNodes, snapshot);\n this._cachedInitialSnapshotCreated = true;\n }\n return this._cachedInitialSnapshot;\n }\n });\n Object.defineProperty(ObjectNode.prototype, \"isRunningAction\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function () {\n if (this._isRunningAction)\n return true;\n if (this.isRoot)\n return false;\n return this.parent.isRunningAction();\n }\n });\n Object.defineProperty(ObjectNode.prototype, \"assertAlive\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (context) {\n var livelinessChecking = getLivelinessChecking();\n if (!this.isAlive && livelinessChecking !== \"ignore\") {\n var error = this._getAssertAliveError(context);\n switch (livelinessChecking) {\n case \"error\":\n throw fail(error);\n case \"warn\":\n warnError(error);\n }\n }\n }\n });\n Object.defineProperty(ObjectNode.prototype, \"_getAssertAliveError\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (context) {\n var escapedPath = this.getEscapedPath(false) || this.pathUponDeath || \"\";\n var subpath = (context.subpath && escapeJsonPath(context.subpath)) || \"\";\n var actionContext = context.actionContext || getCurrentActionContext();\n // try to use a real action context if possible since it includes the action name\n if (actionContext && actionContext.type !== \"action\" && actionContext.parentActionEvent) {\n actionContext = actionContext.parentActionEvent;\n }\n var actionFullPath = \"\";\n if (actionContext && actionContext.name != null) {\n // try to use the context, and if it not available use the node one\n var actionPath = (actionContext && actionContext.context && getPath(actionContext.context)) || escapedPath;\n actionFullPath = actionPath + \".\" + actionContext.name + \"()\";\n }\n return \"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '\" + this.type.name + \"', Path upon death: '\" + escapedPath + \"', Subpath: '\" + subpath + \"', Action: '\" + actionFullPath + \"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree.\";\n }\n });\n Object.defineProperty(ObjectNode.prototype, \"getChildNode\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (subpath) {\n this.assertAlive({\n subpath: subpath\n });\n this._autoUnbox = false;\n try {\n return this._observableInstanceState === 2 /* CREATED */\n ? this.type.getChildNode(this, subpath)\n : this._childNodes[subpath];\n }\n finally {\n this._autoUnbox = true;\n }\n }\n });\n Object.defineProperty(ObjectNode.prototype, \"getChildren\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function () {\n this.assertAlive(EMPTY_OBJECT);\n this._autoUnbox = false;\n try {\n return this._observableInstanceState === 2 /* CREATED */\n ? this.type.getChildren(this)\n : convertChildNodesToArray(this._childNodes);\n }\n finally {\n this._autoUnbox = true;\n }\n }\n });\n Object.defineProperty(ObjectNode.prototype, \"getChildType\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (propertyName) {\n return this.type.getChildType(propertyName);\n }\n });\n Object.defineProperty(ObjectNode.prototype, \"isProtected\", {\n get: function () {\n return this.root.isProtectionEnabled;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(ObjectNode.prototype, \"assertWritable\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (context) {\n this.assertAlive(context);\n if (!this.isRunningAction() && this.isProtected) {\n throw fail(\"Cannot modify '\" + this + \"', the object is protected and can only be modified by using an action.\");\n }\n }\n });\n Object.defineProperty(ObjectNode.prototype, \"removeChild\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (subpath) {\n this.type.removeChild(this, subpath);\n }\n });\n // bound on the constructor\n Object.defineProperty(ObjectNode.prototype, \"unbox\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (childNode) {\n if (!childNode)\n return childNode;\n this.assertAlive({\n subpath: childNode.subpath || childNode.subpathUponDeath\n });\n return this._autoUnbox ? childNode.value : childNode;\n }\n });\n Object.defineProperty(ObjectNode.prototype, \"toString\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function () {\n var path = (this.isAlive ? this.path : this.pathUponDeath) || \"<root>\";\n var identifier = this.identifier ? \"(id: \" + this.identifier + \")\" : \"\";\n return this.type.name + \"@\" + path + identifier + (this.isAlive ? \"\" : \" [dead]\");\n }\n });\n Object.defineProperty(ObjectNode.prototype, \"finalizeCreation\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function () {\n var _this = this;\n this.baseFinalizeCreation(function () {\n var e_3, _a;\n try {\n for (var _b = __values(_this.getChildren()), _c = _b.next(); !_c.done; _c = _b.next()) {\n var child = _c.value;\n child.finalizeCreation();\n }\n }\n catch (e_3_1) { e_3 = { error: e_3_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_3) throw e_3.error; }\n }\n _this.fireInternalHook(Hook.afterCreationFinalization);\n });\n }\n });\n Object.defineProperty(ObjectNode.prototype, \"detach\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function () {\n if (!this.isAlive)\n throw fail(\"Error while detaching, node is not alive.\");\n this.clearParent();\n }\n });\n Object.defineProperty(ObjectNode.prototype, \"preboot\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function () {\n var self = this;\n this._applyPatches = createActionInvoker(this.storedValue, \"@APPLY_PATCHES\", function (patches) {\n patches.forEach(function (patch) {\n if (!patch.path) {\n self.type.applySnapshot(self, patch.value);\n return;\n }\n var parts = splitJsonPath(patch.path);\n var node = resolveNodeByPathParts(self, parts.slice(0, -1));\n node.applyPatchLocally(parts[parts.length - 1], patch);\n });\n });\n this._applySnapshot = createActionInvoker(this.storedValue, \"@APPLY_SNAPSHOT\", function (snapshot) {\n // if the snapshot is the same as the current one, avoid performing a reconcile\n if (snapshot === self.snapshot)\n return;\n // else, apply it by calling the type logic\n return self.type.applySnapshot(self, snapshot);\n });\n addHiddenFinalProp(this.storedValue, \"$treenode\", this);\n addHiddenFinalProp(this.storedValue, \"toJSON\", toJSON);\n }\n });\n Object.defineProperty(ObjectNode.prototype, \"die\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function () {\n if (!this.isAlive || this.state === NodeLifeCycle.DETACHING)\n return;\n this.aboutToDie();\n this.finalizeDeath();\n }\n });\n Object.defineProperty(ObjectNode.prototype, \"aboutToDie\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function () {\n if (this._observableInstanceState === 0 /* UNINITIALIZED */) {\n return;\n }\n this.getChildren().forEach(function (node) {\n node.aboutToDie();\n });\n // beforeDestroy should run before the disposers since else we could end up in a situation where\n // a disposer added with addDisposer at this stage (beforeDestroy) is actually never released\n this.baseAboutToDie();\n this._internalEventsEmit(\"dispose\" /* Dispose */);\n this._internalEventsClear(\"dispose\" /* Dispose */);\n }\n });\n Object.defineProperty(ObjectNode.prototype, \"finalizeDeath\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function () {\n // invariant: not called directly but from \"die\"\n this.getChildren().forEach(function (node) {\n node.finalizeDeath();\n });\n this.root.identifierCache.notifyDied(this);\n // \"kill\" the computed prop and just store the last snapshot\n var snapshot = this.snapshot;\n this._snapshotUponDeath = snapshot;\n this._internalEventsClearAll();\n this.baseFinalizeDeath();\n }\n });\n Object.defineProperty(ObjectNode.prototype, \"onSnapshot\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (onChange) {\n this._addSnapshotReaction();\n return this._internalEventsRegister(\"snapshot\" /* Snapshot */, onChange);\n }\n });\n Object.defineProperty(ObjectNode.prototype, \"emitSnapshot\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (snapshot) {\n this._internalEventsEmit(\"snapshot\" /* Snapshot */, snapshot);\n }\n });\n Object.defineProperty(ObjectNode.prototype, \"onPatch\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (handler) {\n return this._internalEventsRegister(\"patch\" /* Patch */, handler);\n }\n });\n Object.defineProperty(ObjectNode.prototype, \"emitPatch\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (basePatch, source) {\n if (this._internalEventsHasSubscribers(\"patch\" /* Patch */)) {\n var localizedPatch = extend({}, basePatch, {\n path: source.path.substr(this.path.length) + \"/\" + basePatch.path // calculate the relative path of the patch\n });\n var _a = __read(splitPatch(localizedPatch), 2), patch = _a[0], reversePatch = _a[1];\n this._internalEventsEmit(\"patch\" /* Patch */, patch, reversePatch);\n }\n if (this.parent)\n this.parent.emitPatch(basePatch, source);\n }\n });\n Object.defineProperty(ObjectNode.prototype, \"hasDisposer\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (disposer) {\n return this._internalEventsHas(\"dispose\" /* Dispose */, disposer);\n }\n });\n Object.defineProperty(ObjectNode.prototype, \"addDisposer\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (disposer) {\n if (!this.hasDisposer(disposer)) {\n this._internalEventsRegister(\"dispose\" /* Dispose */, disposer, true);\n return;\n }\n throw fail(\"cannot add a disposer when it is already registered for execution\");\n }\n });\n Object.defineProperty(ObjectNode.prototype, \"removeDisposer\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (disposer) {\n if (!this._internalEventsHas(\"dispose\" /* Dispose */, disposer)) {\n throw fail(\"cannot remove a disposer which was never registered for execution\");\n }\n this._internalEventsUnregister(\"dispose\" /* Dispose */, disposer);\n }\n });\n Object.defineProperty(ObjectNode.prototype, \"removeMiddleware\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (middleware) {\n if (this.middlewares) {\n var index = this.middlewares.indexOf(middleware);\n if (index >= 0) {\n this.middlewares.splice(index, 1);\n }\n }\n }\n });\n Object.defineProperty(ObjectNode.prototype, \"addMiddleWare\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (handler, includeHooks) {\n var _this = this;\n if (includeHooks === void 0) { includeHooks = true; }\n var middleware = { handler: handler, includeHooks: includeHooks };\n if (!this.middlewares)\n this.middlewares = [middleware];\n else\n this.middlewares.push(middleware);\n return function () {\n _this.removeMiddleware(middleware);\n };\n }\n });\n Object.defineProperty(ObjectNode.prototype, \"applyPatchLocally\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (subpath, patch) {\n this.assertWritable({\n subpath: subpath\n });\n this.createObservableInstanceIfNeeded();\n this.type.applyPatchLocally(this, subpath, patch);\n }\n });\n Object.defineProperty(ObjectNode.prototype, \"_addSnapshotReaction\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function () {\n var _this = this;\n if (!this._hasSnapshotReaction) {\n var snapshotDisposer = reaction(function () { return _this.snapshot; }, function (snapshot) { return _this.emitSnapshot(snapshot); }, snapshotReactionOptions);\n this.addDisposer(snapshotDisposer);\n this._hasSnapshotReaction = true;\n }\n }\n });\n // we proxy the methods to avoid creating an EventHandlers instance when it is not needed\n Object.defineProperty(ObjectNode.prototype, \"_internalEventsHasSubscribers\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (event) {\n return !!this._internalEvents && this._internalEvents.hasSubscribers(event);\n }\n });\n Object.defineProperty(ObjectNode.prototype, \"_internalEventsRegister\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (event, eventHandler, atTheBeginning) {\n if (atTheBeginning === void 0) { atTheBeginning = false; }\n if (!this._internalEvents) {\n this._internalEvents = new EventHandlers();\n }\n return this._internalEvents.register(event, eventHandler, atTheBeginning);\n }\n });\n Object.defineProperty(ObjectNode.prototype, \"_internalEventsHas\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (event, eventHandler) {\n return !!this._internalEvents && this._internalEvents.has(event, eventHandler);\n }\n });\n Object.defineProperty(ObjectNode.prototype, \"_internalEventsUnregister\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (event, eventHandler) {\n if (this._internalEvents) {\n this._internalEvents.unregister(event, eventHandler);\n }\n }\n });\n Object.defineProperty(ObjectNode.prototype, \"_internalEventsEmit\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (event) {\n var _a;\n var args = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n args[_i - 1] = arguments[_i];\n }\n if (this._internalEvents) {\n (_a = this._internalEvents).emit.apply(_a, __spread([event], args));\n }\n }\n });\n Object.defineProperty(ObjectNode.prototype, \"_internalEventsClear\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (event) {\n if (this._internalEvents) {\n this._internalEvents.clear(event);\n }\n }\n });\n Object.defineProperty(ObjectNode.prototype, \"_internalEventsClearAll\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function () {\n if (this._internalEvents) {\n this._internalEvents.clearAll();\n }\n }\n });\n return ObjectNode;\n}(BaseNode));\nObjectNode.prototype.createObservableInstance = action(ObjectNode.prototype.createObservableInstance);\nObjectNode.prototype.detach = action(ObjectNode.prototype.detach);\nObjectNode.prototype.die = action(ObjectNode.prototype.die);\n\nvar _a;\n/**\n * @internal\n * @hidden\n */\nvar TypeFlags;\n(function (TypeFlags) {\n TypeFlags[TypeFlags[\"String\"] = 1] = \"String\";\n TypeFlags[TypeFlags[\"Number\"] = 2] = \"Number\";\n TypeFlags[TypeFlags[\"Boolean\"] = 4] = \"Boolean\";\n TypeFlags[TypeFlags[\"Date\"] = 8] = \"Date\";\n TypeFlags[TypeFlags[\"Literal\"] = 16] = \"Literal\";\n TypeFlags[TypeFlags[\"Array\"] = 32] = \"Array\";\n TypeFlags[TypeFlags[\"Map\"] = 64] = \"Map\";\n TypeFlags[TypeFlags[\"Object\"] = 128] = \"Object\";\n TypeFlags[TypeFlags[\"Frozen\"] = 256] = \"Frozen\";\n TypeFlags[TypeFlags[\"Optional\"] = 512] = \"Optional\";\n TypeFlags[TypeFlags[\"Reference\"] = 1024] = \"Reference\";\n TypeFlags[TypeFlags[\"Identifier\"] = 2048] = \"Identifier\";\n TypeFlags[TypeFlags[\"Late\"] = 4096] = \"Late\";\n TypeFlags[TypeFlags[\"Refinement\"] = 8192] = \"Refinement\";\n TypeFlags[TypeFlags[\"Union\"] = 16384] = \"Union\";\n TypeFlags[TypeFlags[\"Null\"] = 32768] = \"Null\";\n TypeFlags[TypeFlags[\"Undefined\"] = 65536] = \"Undefined\";\n TypeFlags[TypeFlags[\"Integer\"] = 131072] = \"Integer\";\n TypeFlags[TypeFlags[\"Custom\"] = 262144] = \"Custom\";\n TypeFlags[TypeFlags[\"SnapshotProcessor\"] = 524288] = \"SnapshotProcessor\";\n TypeFlags[TypeFlags[\"Lazy\"] = 1048576] = \"Lazy\";\n TypeFlags[TypeFlags[\"Finite\"] = 2097152] = \"Finite\";\n TypeFlags[TypeFlags[\"Float\"] = 4194304] = \"Float\";\n})(TypeFlags || (TypeFlags = {}));\n/**\n * @internal\n * @hidden\n */\nvar cannotDetermineSubtype = \"cannotDetermine\";\n/** @hidden */\nvar $type = Symbol(\"$type\");\n/**\n * A base type produces a MST node (Node in the state tree)\n *\n * @internal\n * @hidden\n */\nvar BaseType = /** @class */ (function () {\n function BaseType(name) {\n Object.defineProperty(this, _a, {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n // these are just to make inner types avaialable to inherited classes\n Object.defineProperty(this, \"C\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"S\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"T\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"N\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"isType\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: true\n });\n Object.defineProperty(this, \"name\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this.name = name;\n }\n Object.defineProperty(BaseType.prototype, \"create\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (snapshot, environment) {\n typecheckInternal(this, snapshot);\n return this.instantiate(null, \"\", environment, snapshot).value;\n }\n });\n Object.defineProperty(BaseType.prototype, \"getSnapshot\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (node, applyPostProcess) {\n // istanbul ignore next\n throw fail(\"unimplemented method\");\n }\n });\n Object.defineProperty(BaseType.prototype, \"isAssignableFrom\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (type) {\n return type === this;\n }\n });\n Object.defineProperty(BaseType.prototype, \"validate\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (value, context) {\n var node = getStateTreeNodeSafe(value);\n if (node) {\n var valueType = getType(value);\n return this.isAssignableFrom(valueType)\n ? typeCheckSuccess()\n : typeCheckFailure(context, value);\n // it is tempting to compare snapshots, but in that case we should always clone on assignments...\n }\n return this.isValidSnapshot(value, context);\n }\n });\n Object.defineProperty(BaseType.prototype, \"is\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (thing) {\n return this.validate(thing, [{ path: \"\", type: this }]).length === 0;\n }\n });\n Object.defineProperty(BaseType.prototype, \"Type\", {\n get: function () {\n // istanbul ignore next\n throw fail(\"Factory.Type should not be actually called. It is just a Type signature that can be used at compile time with Typescript, by using `typeof type.Type`\");\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BaseType.prototype, \"TypeWithoutSTN\", {\n get: function () {\n // istanbul ignore next\n throw fail(\"Factory.TypeWithoutSTN should not be actually called. It is just a Type signature that can be used at compile time with Typescript, by using `typeof type.TypeWithoutSTN`\");\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BaseType.prototype, \"SnapshotType\", {\n get: function () {\n // istanbul ignore next\n throw fail(\"Factory.SnapshotType should not be actually called. It is just a Type signature that can be used at compile time with Typescript, by using `typeof type.SnapshotType`\");\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BaseType.prototype, \"CreationType\", {\n get: function () {\n // istanbul ignore next\n throw fail(\"Factory.CreationType should not be actually called. It is just a Type signature that can be used at compile time with Typescript, by using `typeof type.CreationType`\");\n },\n enumerable: false,\n configurable: true\n });\n return BaseType;\n}());\n_a = $type;\nBaseType.prototype.create = action(BaseType.prototype.create);\n/**\n * A complex type produces a MST node (Node in the state tree)\n *\n * @internal\n * @hidden\n */\nvar ComplexType = /** @class */ (function (_super) {\n __extends(ComplexType, _super);\n function ComplexType(name) {\n var _this = _super.call(this, name) || this;\n Object.defineProperty(_this, \"identifierAttribute\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n return _this;\n }\n Object.defineProperty(ComplexType.prototype, \"create\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (snapshot, environment) {\n if (snapshot === void 0) { snapshot = this.getDefaultSnapshot(); }\n return _super.prototype.create.call(this, snapshot, environment);\n }\n });\n Object.defineProperty(ComplexType.prototype, \"getValue\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (node) {\n node.createObservableInstanceIfNeeded();\n return node.storedValue;\n }\n });\n Object.defineProperty(ComplexType.prototype, \"isMatchingSnapshotId\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (current, snapshot) {\n return (!current.identifierAttribute ||\n current.identifier === normalizeIdentifier(snapshot[current.identifierAttribute]));\n }\n });\n Object.defineProperty(ComplexType.prototype, \"tryToReconcileNode\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (current, newValue) {\n if (current.isDetaching)\n return false;\n if (current.snapshot === newValue) {\n // newValue is the current snapshot of the node, noop\n return true;\n }\n if (isStateTreeNode(newValue) && getStateTreeNode(newValue) === current) {\n // the current node is the same as the new one\n return true;\n }\n if (current.type === this &&\n isMutable(newValue) &&\n !isStateTreeNode(newValue) &&\n this.isMatchingSnapshotId(current, newValue)) {\n // the newValue has no node, so can be treated like a snapshot\n // we can reconcile\n current.applySnapshot(newValue);\n return true;\n }\n return false;\n }\n });\n Object.defineProperty(ComplexType.prototype, \"reconcile\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (current, newValue, parent, subpath) {\n var nodeReconciled = this.tryToReconcileNode(current, newValue);\n if (nodeReconciled) {\n current.setParent(parent, subpath);\n return current;\n }\n // current node cannot be recycled in any way\n current.die(); // noop if detaching\n // attempt to reuse the new one\n if (isStateTreeNode(newValue) && this.isAssignableFrom(getType(newValue))) {\n // newValue is a Node as well, move it here..\n var newNode = getStateTreeNode(newValue);\n newNode.setParent(parent, subpath);\n return newNode;\n }\n // nothing to do, we have to create a new node\n return this.instantiate(parent, subpath, undefined, newValue);\n }\n });\n Object.defineProperty(ComplexType.prototype, \"getSubTypes\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function () {\n return null;\n }\n });\n return ComplexType;\n}(BaseType));\nComplexType.prototype.create = action(ComplexType.prototype.create);\n/**\n * @internal\n * @hidden\n */\nvar SimpleType = /** @class */ (function (_super) {\n __extends(SimpleType, _super);\n function SimpleType() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n Object.defineProperty(SimpleType.prototype, \"createNewInstance\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (snapshot) {\n return snapshot;\n }\n });\n Object.defineProperty(SimpleType.prototype, \"getValue\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (node) {\n // if we ever find a case where scalar nodes can be accessed without iterating through its parent\n // uncomment this to make sure the parent chain is created when this is accessed\n // if (node.parent) {\n // node.parent.createObservableInstanceIfNeeded()\n // }\n return node.storedValue;\n }\n });\n Object.defineProperty(SimpleType.prototype, \"getSnapshot\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (node) {\n return node.storedValue;\n }\n });\n Object.defineProperty(SimpleType.prototype, \"reconcile\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (current, newValue, parent, subpath) {\n // reconcile only if type and value are still the same, and only if the node is not detaching\n if (!current.isDetaching && current.type === this && current.storedValue === newValue) {\n return current;\n }\n var res = this.instantiate(parent, subpath, undefined, newValue);\n current.die(); // noop if detaching\n return res;\n }\n });\n Object.defineProperty(SimpleType.prototype, \"getSubTypes\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function () {\n return null;\n }\n });\n return SimpleType;\n}(BaseType));\n/**\n * Returns if a given value represents a type.\n *\n * @param value Value to check.\n * @returns `true` if the value is a type.\n */\nfunction isType(value) {\n return typeof value === \"object\" && value && value.isType === true;\n}\n/**\n * @internal\n * @hidden\n */\nfunction assertIsType(type, argNumber) {\n assertArg(type, isType, \"mobx-state-tree type\", argNumber);\n}\n\nvar runningActions = new Map();\n/**\n * Note: Consider migrating to `createActionTrackingMiddleware2`, it is easier to use.\n *\n * Convenience utility to create action based middleware that supports async processes more easily.\n * All hooks are called for both synchronous and asynchronous actions. Except that either `onSuccess` or `onFail` is called\n *\n * The create middleware tracks the process of an action (assuming it passes the `filter`).\n * `onResume` can return any value, which will be passed as second argument to any other hook. This makes it possible to keep state during a process.\n *\n * See the `atomic` middleware for an example\n *\n * @param hooks\n * @returns\n */\nfunction createActionTrackingMiddleware(hooks) {\n return function actionTrackingMiddleware(call, next, abort) {\n switch (call.type) {\n case \"action\": {\n if (!hooks.filter || hooks.filter(call) === true) {\n var context = hooks.onStart(call);\n hooks.onResume(call, context);\n runningActions.set(call.id, {\n call: call,\n context: context,\n async: false\n });\n try {\n var res = next(call);\n hooks.onSuspend(call, context);\n if (runningActions.get(call.id).async === false) {\n runningActions.delete(call.id);\n hooks.onSuccess(call, context, res);\n }\n return res;\n }\n catch (e) {\n runningActions.delete(call.id);\n hooks.onFail(call, context, e);\n throw e;\n }\n }\n else {\n return next(call);\n }\n }\n case \"flow_spawn\": {\n var root = runningActions.get(call.rootId);\n root.async = true;\n return next(call);\n }\n case \"flow_resume\":\n case \"flow_resume_error\": {\n var root = runningActions.get(call.rootId);\n hooks.onResume(call, root.context);\n try {\n return next(call);\n }\n finally {\n hooks.onSuspend(call, root.context);\n }\n }\n case \"flow_throw\": {\n var root = runningActions.get(call.rootId);\n runningActions.delete(call.rootId);\n hooks.onFail(call, root.context, call.args[0]);\n return next(call);\n }\n case \"flow_return\": {\n var root = runningActions.get(call.rootId);\n runningActions.delete(call.rootId);\n hooks.onSuccess(call, root.context, call.args[0]);\n return next(call);\n }\n }\n };\n}\n\nvar RunningAction = /** @class */ (function () {\n function RunningAction(hooks, call) {\n Object.defineProperty(this, \"hooks\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: hooks\n });\n Object.defineProperty(this, \"call\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: call\n });\n Object.defineProperty(this, \"flowsPending\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 0\n });\n Object.defineProperty(this, \"running\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: true\n });\n if (hooks) {\n hooks.onStart(call);\n }\n }\n Object.defineProperty(RunningAction.prototype, \"finish\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (error) {\n if (this.running) {\n this.running = false;\n if (this.hooks) {\n this.hooks.onFinish(this.call, error);\n }\n }\n }\n });\n Object.defineProperty(RunningAction.prototype, \"incFlowsPending\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function () {\n this.flowsPending++;\n }\n });\n Object.defineProperty(RunningAction.prototype, \"decFlowsPending\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function () {\n this.flowsPending--;\n }\n });\n Object.defineProperty(RunningAction.prototype, \"hasFlowsPending\", {\n get: function () {\n return this.flowsPending > 0;\n },\n enumerable: false,\n configurable: true\n });\n return RunningAction;\n}());\n/**\n * Convenience utility to create action based middleware that supports async processes more easily.\n * The flow is like this:\n * - for each action: if filter passes -> `onStart` -> (inner actions recursively) -> `onFinish`\n *\n * Example: if we had an action `a` that called inside an action `b1`, then `b2` the flow would be:\n * - `filter(a)`\n * - `onStart(a)`\n * - `filter(b1)`\n * - `onStart(b1)`\n * - `onFinish(b1)`\n * - `filter(b2)`\n * - `onStart(b2)`\n * - `onFinish(b2)`\n * - `onFinish(a)`\n *\n * The flow is the same no matter if the actions are sync or async.\n *\n * See the `atomic` middleware for an example\n *\n * @param hooks\n * @returns\n */\nfunction createActionTrackingMiddleware2(middlewareHooks) {\n var runningActions = new Map();\n return function actionTrackingMiddleware(call, next) {\n // find parentRunningAction\n var parentRunningAction = call.parentActionEvent\n ? runningActions.get(call.parentActionEvent.id)\n : undefined;\n if (call.type === \"action\") {\n var newCall = __assign(__assign({}, call), { \n // make a shallow copy of the parent action env\n env: parentRunningAction && parentRunningAction.call.env, parentCall: parentRunningAction && parentRunningAction.call });\n var passesFilter = !middlewareHooks.filter || middlewareHooks.filter(newCall);\n var hooks = passesFilter ? middlewareHooks : undefined;\n var runningAction = new RunningAction(hooks, newCall);\n runningActions.set(call.id, runningAction);\n var res = void 0;\n try {\n res = next(call);\n }\n catch (e) {\n runningActions.delete(call.id);\n runningAction.finish(e);\n throw e;\n }\n // sync action finished\n if (!runningAction.hasFlowsPending) {\n runningActions.delete(call.id);\n runningAction.finish();\n }\n return res;\n }\n else {\n if (!parentRunningAction) {\n return next(call);\n }\n switch (call.type) {\n case \"flow_spawn\": {\n parentRunningAction.incFlowsPending();\n return next(call);\n }\n case \"flow_resume\":\n case \"flow_resume_error\": {\n return next(call);\n }\n case \"flow_throw\": {\n var error = call.args[0];\n try {\n return next(call);\n }\n finally {\n parentRunningAction.decFlowsPending();\n if (!parentRunningAction.hasFlowsPending) {\n runningActions.delete(call.parentActionEvent.id);\n parentRunningAction.finish(error);\n }\n }\n }\n case \"flow_return\": {\n try {\n return next(call);\n }\n finally {\n parentRunningAction.decFlowsPending();\n if (!parentRunningAction.hasFlowsPending) {\n runningActions.delete(call.parentActionEvent.id);\n parentRunningAction.finish();\n }\n }\n }\n }\n }\n };\n}\n\nfunction serializeArgument(node, actionName, index, arg) {\n if (arg instanceof Date)\n return { $MST_DATE: arg.getTime() };\n if (isPrimitive(arg))\n return arg;\n // We should not serialize MST nodes, even if we can, because we don't know if the receiving party can handle a raw snapshot instead of an\n // MST type instance. So if one wants to serialize a MST node that was pass in, either explitly pass: 1: an id, 2: a (relative) path, 3: a snapshot\n if (isStateTreeNode(arg))\n return serializeTheUnserializable(\"[MSTNode: \" + getType(arg).name + \"]\");\n if (typeof arg === \"function\")\n return serializeTheUnserializable(\"[function]\");\n if (typeof arg === \"object\" && !isPlainObject(arg) && !isArray(arg))\n return serializeTheUnserializable(\"[object \" + ((arg && arg.constructor && arg.constructor.name) || \"Complex Object\") + \"]\");\n try {\n // Check if serializable, cycle free etc...\n // MWE: there must be a better way....\n JSON.stringify(arg); // or throws\n return arg;\n }\n catch (e) {\n return serializeTheUnserializable(\"\" + e);\n }\n}\nfunction deserializeArgument(adm, value) {\n if (value && typeof value === \"object\" && \"$MST_DATE\" in value)\n return new Date(value[\"$MST_DATE\"]);\n return value;\n}\nfunction serializeTheUnserializable(baseType) {\n return {\n $MST_UNSERIALIZABLE: true,\n type: baseType\n };\n}\n/**\n * Applies an action or a series of actions in a single MobX transaction.\n * Does not return any value\n * Takes an action description as produced by the `onAction` middleware.\n *\n * @param target\n * @param actions\n */\nfunction applyAction(target, actions) {\n // check all arguments\n assertIsStateTreeNode(target, 1);\n assertArg(actions, function (a) { return typeof a === \"object\"; }, \"object or array\", 2);\n runInAction(function () {\n asArray(actions).forEach(function (action) { return baseApplyAction(target, action); });\n });\n}\nfunction baseApplyAction(target, action) {\n var resolvedTarget = tryResolve(target, action.path || \"\");\n if (!resolvedTarget)\n throw fail(\"Invalid action path: \" + (action.path || \"\"));\n var node = getStateTreeNode(resolvedTarget);\n // Reserved functions\n if (action.name === \"@APPLY_PATCHES\") {\n return applyPatch.call(null, resolvedTarget, action.args[0]);\n }\n if (action.name === \"@APPLY_SNAPSHOT\") {\n return applySnapshot.call(null, resolvedTarget, action.args[0]);\n }\n if (!(typeof resolvedTarget[action.name] === \"function\"))\n throw fail(\"Action '\" + action.name + \"' does not exist in '\" + node.path + \"'\");\n return resolvedTarget[action.name].apply(resolvedTarget, action.args ? action.args.map(function (v) { return deserializeArgument(node, v); }) : []);\n}\n/**\n * Small abstraction around `onAction` and `applyAction`, attaches an action listener to a tree and records all the actions emitted.\n * Returns an recorder object with the following signature:\n *\n * Example:\n * ```ts\n * export interface IActionRecorder {\n * // the recorded actions\n * actions: ISerializedActionCall[]\n * // true if currently recording\n * recording: boolean\n * // stop recording actions\n * stop(): void\n * // resume recording actions\n * resume(): void\n * // apply all the recorded actions on the given object\n * replay(target: IAnyStateTreeNode): void\n * }\n * ```\n *\n * The optional filter function allows to skip recording certain actions.\n *\n * @param subject\n * @returns\n */\nfunction recordActions(subject, filter) {\n // check all arguments\n assertIsStateTreeNode(subject, 1);\n var actions = [];\n var listener = function (call) {\n var recordThis = filter ? filter(call, getRunningActionContext()) : true;\n if (recordThis) {\n actions.push(call);\n }\n };\n var disposer;\n var recorder = {\n actions: actions,\n get recording() {\n return !!disposer;\n },\n stop: function () {\n if (disposer) {\n disposer();\n disposer = undefined;\n }\n },\n resume: function () {\n if (disposer)\n return;\n disposer = onAction(subject, listener);\n },\n replay: function (target) {\n applyAction(target, actions);\n }\n };\n recorder.resume();\n return recorder;\n}\n/**\n * Registers a function that will be invoked for each action that is called on the provided model instance, or to any of its children.\n * See [actions](https://github.com/mobxjs/mobx-state-tree#actions) for more details. onAction events are emitted only for the outermost called action in the stack.\n * Action can also be intercepted by middleware using addMiddleware to change the function call before it will be run.\n *\n * Not all action arguments might be serializable. For unserializable arguments, a struct like `{ $MST_UNSERIALIZABLE: true, type: \"someType\" }` will be generated.\n * MST Nodes are considered non-serializable as well (they could be serialized as there snapshot, but it is uncertain whether an replaying party will be able to handle such a non-instantiated snapshot).\n * Rather, when using `onAction` middleware, one should consider in passing arguments which are 1: an id, 2: a (relative) path, or 3: a snapshot. Instead of a real MST node.\n *\n * Example:\n * ```ts\n * const Todo = types.model({\n * task: types.string\n * })\n *\n * const TodoStore = types.model({\n * todos: types.array(Todo)\n * }).actions(self => ({\n * add(todo) {\n * self.todos.push(todo);\n * }\n * }))\n *\n * const s = TodoStore.create({ todos: [] })\n *\n * let disposer = onAction(s, (call) => {\n * console.log(call);\n * })\n *\n * s.add({ task: \"Grab a coffee\" })\n * // Logs: { name: \"add\", path: \"\", args: [{ task: \"Grab a coffee\" }] }\n * ```\n *\n * @param target\n * @param listener\n * @param attachAfter (default false) fires the listener *after* the action has executed instead of before.\n * @returns\n */\nfunction onAction(target, listener, attachAfter) {\n if (attachAfter === void 0) { attachAfter = false; }\n // check all arguments\n assertIsStateTreeNode(target, 1);\n if (devMode()) {\n if (!isRoot(target))\n warnError(\"Warning: Attaching onAction listeners to non root nodes is dangerous: No events will be emitted for actions initiated higher up in the tree.\");\n if (!isProtected(target))\n warnError(\"Warning: Attaching onAction listeners to non protected nodes is dangerous: No events will be emitted for direct modifications without action.\");\n }\n return addMiddleware(target, function handler(rawCall, next) {\n if (rawCall.type === \"action\" && rawCall.id === rawCall.rootId) {\n var sourceNode_1 = getStateTreeNode(rawCall.context);\n var info = {\n name: rawCall.name,\n path: getRelativePathBetweenNodes(getStateTreeNode(target), sourceNode_1),\n args: rawCall.args.map(function (arg, index) {\n return serializeArgument(sourceNode_1, rawCall.name, index, arg);\n })\n };\n if (attachAfter) {\n var res = next(rawCall);\n listener(info);\n return res;\n }\n else {\n listener(info);\n return next(rawCall);\n }\n }\n else {\n return next(rawCall);\n }\n });\n}\n\nvar nextActionId = 1;\nvar currentActionContext;\n/**\n * @internal\n * @hidden\n */\nfunction getCurrentActionContext() {\n return currentActionContext;\n}\n/**\n * @internal\n * @hidden\n */\nfunction getNextActionId() {\n return nextActionId++;\n}\n// TODO: optimize away entire action context if there is no middleware in tree?\n/**\n * @internal\n * @hidden\n */\nfunction runWithActionContext(context, fn) {\n var node = getStateTreeNode(context.context);\n if (context.type === \"action\") {\n node.assertAlive({\n actionContext: context\n });\n }\n var baseIsRunningAction = node._isRunningAction;\n node._isRunningAction = true;\n var previousContext = currentActionContext;\n currentActionContext = context;\n try {\n return runMiddleWares(node, context, fn);\n }\n finally {\n currentActionContext = previousContext;\n node._isRunningAction = baseIsRunningAction;\n }\n}\n/**\n * @internal\n * @hidden\n */\nfunction getParentActionContext(parentContext) {\n if (!parentContext)\n return undefined;\n if (parentContext.type === \"action\")\n return parentContext;\n return parentContext.parentActionEvent;\n}\n/**\n * @internal\n * @hidden\n */\nfunction createActionInvoker(target, name, fn) {\n var res = function () {\n var id = getNextActionId();\n var parentContext = currentActionContext;\n var parentActionContext = getParentActionContext(parentContext);\n return runWithActionContext({\n type: \"action\",\n name: name,\n id: id,\n args: argsToArray(arguments),\n context: target,\n tree: getRoot(target),\n rootId: parentContext ? parentContext.rootId : id,\n parentId: parentContext ? parentContext.id : 0,\n allParentIds: parentContext ? __spread(parentContext.allParentIds, [parentContext.id]) : [],\n parentEvent: parentContext,\n parentActionEvent: parentActionContext\n }, fn);\n };\n res._isMSTAction = true;\n res._isFlowAction = fn._isFlowAction;\n return res;\n}\n/**\n * Middleware can be used to intercept any action is invoked on the subtree where it is attached.\n * If a tree is protected (by default), this means that any mutation of the tree will pass through your middleware.\n *\n * For more details, see the [middleware docs](concepts/middleware.md)\n *\n * @param target Node to apply the middleware to.\n * @param middleware Middleware to apply.\n * @returns A callable function to dispose the middleware.\n */\nfunction addMiddleware(target, handler, includeHooks) {\n if (includeHooks === void 0) { includeHooks = true; }\n var node = getStateTreeNode(target);\n if (devMode()) {\n if (!node.isProtectionEnabled) {\n warnError(\"It is recommended to protect the state tree before attaching action middleware, as otherwise it cannot be guaranteed that all changes are passed through middleware. See `protect`\");\n }\n }\n return node.addMiddleWare(handler, includeHooks);\n}\n/**\n * Binds middleware to a specific action.\n *\n * Example:\n * ```ts\n * type.actions(self => {\n * function takeA____() {\n * self.toilet.donate()\n * self.wipe()\n * self.wipe()\n * self.toilet.flush()\n * }\n * return {\n * takeA____: decorate(atomic, takeA____)\n * }\n * })\n * ```\n *\n * @param handler\n * @param fn\n * @param includeHooks\n * @returns The original function\n */\nfunction decorate(handler, fn, includeHooks) {\n if (includeHooks === void 0) { includeHooks = true; }\n var middleware = { handler: handler, includeHooks: includeHooks };\n fn.$mst_middleware = fn.$mst_middleware || [];\n fn.$mst_middleware.push(middleware);\n return fn;\n}\nvar CollectedMiddlewares = /** @class */ (function () {\n function CollectedMiddlewares(node, fn) {\n Object.defineProperty(this, \"arrayIndex\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 0\n });\n Object.defineProperty(this, \"inArrayIndex\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 0\n });\n Object.defineProperty(this, \"middlewares\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: []\n });\n // we just push middleware arrays into an array of arrays to avoid making copies\n if (fn.$mst_middleware) {\n this.middlewares.push(fn.$mst_middleware);\n }\n var n = node;\n // Find all middlewares. Optimization: cache this?\n while (n) {\n if (n.middlewares)\n this.middlewares.push(n.middlewares);\n n = n.parent;\n }\n }\n Object.defineProperty(CollectedMiddlewares.prototype, \"isEmpty\", {\n get: function () {\n return this.middlewares.length <= 0;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(CollectedMiddlewares.prototype, \"getNextMiddleware\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function () {\n var array = this.middlewares[this.arrayIndex];\n if (!array)\n return undefined;\n var item = array[this.inArrayIndex++];\n if (!item) {\n this.arrayIndex++;\n this.inArrayIndex = 0;\n return this.getNextMiddleware();\n }\n return item;\n }\n });\n return CollectedMiddlewares;\n}());\nfunction runMiddleWares(node, baseCall, originalFn) {\n var middlewares = new CollectedMiddlewares(node, originalFn);\n // Short circuit\n if (middlewares.isEmpty)\n return action(originalFn).apply(null, baseCall.args);\n var result = null;\n function runNextMiddleware(call) {\n var middleware = middlewares.getNextMiddleware();\n var handler = middleware && middleware.handler;\n if (!handler) {\n return action(originalFn).apply(null, call.args);\n }\n // skip hooks if asked to\n if (!middleware.includeHooks && Hook[call.name]) {\n return runNextMiddleware(call);\n }\n var nextInvoked = false;\n function next(call2, callback) {\n nextInvoked = true;\n // the result can contain\n // - the non manipulated return value from an action\n // - the non manipulated abort value\n // - one of the above but manipulated through the callback function\n result = runNextMiddleware(call2);\n if (callback) {\n result = callback(result);\n }\n }\n var abortInvoked = false;\n function abort(value) {\n abortInvoked = true;\n // overwrite the result\n // can be manipulated through middlewares earlier in the queue using the callback fn\n result = value;\n }\n handler(call, next, abort);\n if (devMode()) {\n if (!nextInvoked && !abortInvoked) {\n var node2 = getStateTreeNode(call.tree);\n throw fail(\"Neither the next() nor the abort() callback within the middleware \" + handler.name + \" for the action: \\\"\" + call.name + \"\\\" on the node: \" + node2.type.name + \" was invoked.\");\n }\n else if (nextInvoked && abortInvoked) {\n var node2 = getStateTreeNode(call.tree);\n throw fail(\"The next() and abort() callback within the middleware \" + handler.name + \" for the action: \\\"\" + call.name + \"\\\" on the node: \" + node2.type.name + \" were invoked.\");\n }\n }\n return result;\n }\n return runNextMiddleware(baseCall);\n}\n\n/**\n * Returns the currently executing MST action context, or undefined if none.\n */\nfunction getRunningActionContext() {\n var current = getCurrentActionContext();\n while (current && current.type !== \"action\") {\n current = current.parentActionEvent;\n }\n return current;\n}\nfunction _isActionContextThisOrChildOf(actionContext, sameOrParent, includeSame) {\n var parentId = typeof sameOrParent === \"number\" ? sameOrParent : sameOrParent.id;\n var current = includeSame\n ? actionContext\n : actionContext.parentActionEvent;\n while (current) {\n if (current.id === parentId) {\n return true;\n }\n current = current.parentActionEvent;\n }\n return false;\n}\n/**\n * Returns if the given action context is a parent of this action context.\n */\nfunction isActionContextChildOf(actionContext, parent) {\n return _isActionContextThisOrChildOf(actionContext, parent, false);\n}\n/**\n * Returns if the given action context is this or a parent of this action context.\n */\nfunction isActionContextThisOrChildOf(actionContext, parentOrThis) {\n return _isActionContextThisOrChildOf(actionContext, parentOrThis, true);\n}\n\nfunction safeStringify(value) {\n try {\n return JSON.stringify(value);\n }\n catch (e) {\n // istanbul ignore next\n return \"<Unserializable: \" + e + \">\";\n }\n}\n/**\n * @internal\n * @hidden\n */\nfunction prettyPrintValue(value) {\n return typeof value === \"function\"\n ? \"<function\" + (value.name ? \" \" + value.name : \"\") + \">\"\n : isStateTreeNode(value)\n ? \"<\" + value + \">\"\n : \"`\" + safeStringify(value) + \"`\";\n}\nfunction shortenPrintValue(valueInString) {\n return valueInString.length < 280\n ? valueInString\n : valueInString.substring(0, 272) + \"......\" + valueInString.substring(valueInString.length - 8);\n}\nfunction toErrorString(error) {\n var value = error.value;\n var type = error.context[error.context.length - 1].type;\n var fullPath = error.context\n .map(function (_a) {\n var path = _a.path;\n return path;\n })\n .filter(function (path) { return path.length > 0; })\n .join(\"/\");\n var pathPrefix = fullPath.length > 0 ? \"at path \\\"/\" + fullPath + \"\\\" \" : \"\";\n var currentTypename = isStateTreeNode(value)\n ? \"value of type \" + getStateTreeNode(value).type.name + \":\"\n : isPrimitive(value)\n ? \"value\"\n : \"snapshot\";\n var isSnapshotCompatible = type && isStateTreeNode(value) && type.is(getStateTreeNode(value).snapshot);\n return (\"\" + pathPrefix + currentTypename + \" \" + prettyPrintValue(value) + \" is not assignable \" + (type ? \"to type: `\" + type.name + \"`\" : \"\") +\n (error.message ? \" (\" + error.message + \")\" : \"\") +\n (type\n ? isPrimitiveType(type) || isPrimitive(value)\n ? \".\"\n : \", expected an instance of `\" + type.name + \"` or a snapshot like `\" + type.describe() + \"` instead.\" +\n (isSnapshotCompatible\n ? \" (Note that a snapshot of the provided value is compatible with the targeted type)\"\n : \"\")\n : \".\"));\n}\n/**\n * @internal\n * @hidden\n */\nfunction getContextForPath(context, path, type) {\n return context.concat([{ path: path, type: type }]);\n}\n/**\n * @internal\n * @hidden\n */\nfunction typeCheckSuccess() {\n return EMPTY_ARRAY;\n}\n/**\n * @internal\n * @hidden\n */\nfunction typeCheckFailure(context, value, message) {\n return [{ context: context, value: value, message: message }];\n}\n/**\n * @internal\n * @hidden\n */\nfunction flattenTypeErrors(errors) {\n return errors.reduce(function (a, i) { return a.concat(i); }, []);\n}\n// TODO; doublecheck: typecheck should only needed to be invoked from: type.create and array / map / value.property will change\n/**\n * @internal\n * @hidden\n */\nfunction typecheckInternal(type, value) {\n // runs typeChecking if it is in dev-mode or through a process.env.ENABLE_TYPE_CHECK flag\n if (isTypeCheckingEnabled()) {\n typecheck(type, value);\n }\n}\n/**\n * Run's the typechecker for the given type on the given value, which can be a snapshot or an instance.\n * Throws if the given value is not according the provided type specification.\n * Use this if you need typechecks even in a production build (by default all automatic runtime type checks will be skipped in production builds)\n *\n * @param type Type to check against.\n * @param value Value to be checked, either a snapshot or an instance.\n */\nfunction typecheck(type, value) {\n var errors = type.validate(value, [{ path: \"\", type: type }]);\n if (errors.length > 0) {\n throw fail(validationErrorsToString(type, value, errors));\n }\n}\nfunction validationErrorsToString(type, value, errors) {\n if (errors.length === 0) {\n return undefined;\n }\n return (\"Error while converting \" + shortenPrintValue(prettyPrintValue(value)) + \" to `\" + type.name + \"`:\\n\\n \" + errors.map(toErrorString).join(\"\\n \"));\n}\n\nvar identifierCacheId = 0;\n/**\n * @internal\n * @hidden\n */\nvar IdentifierCache = /** @class */ (function () {\n function IdentifierCache() {\n Object.defineProperty(this, \"cacheId\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: identifierCacheId++\n });\n // n.b. in cache all identifiers are normalized to strings\n Object.defineProperty(this, \"cache\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: observable.map()\n });\n // last time the cache (array) for a given time changed\n // n.b. it is not really the time, but just an integer that gets increased after each modification to the array\n Object.defineProperty(this, \"lastCacheModificationPerId\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: observable.map()\n });\n }\n Object.defineProperty(IdentifierCache.prototype, \"updateLastCacheModificationPerId\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (identifier) {\n var lcm = this.lastCacheModificationPerId.get(identifier);\n // we start at 1 since 0 means no update since cache creation\n this.lastCacheModificationPerId.set(identifier, lcm === undefined ? 1 : lcm + 1);\n }\n });\n Object.defineProperty(IdentifierCache.prototype, \"getLastCacheModificationPerId\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (identifier) {\n var modificationId = this.lastCacheModificationPerId.get(identifier) || 0;\n return this.cacheId + \"-\" + modificationId;\n }\n });\n Object.defineProperty(IdentifierCache.prototype, \"addNodeToCache\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (node, lastCacheUpdate) {\n if (lastCacheUpdate === void 0) { lastCacheUpdate = true; }\n if (node.identifierAttribute) {\n var identifier = node.identifier;\n if (!this.cache.has(identifier)) {\n this.cache.set(identifier, observable.array([], mobxShallow));\n }\n var set = this.cache.get(identifier);\n if (set.indexOf(node) !== -1)\n throw fail(\"Already registered\");\n set.push(node);\n if (lastCacheUpdate) {\n this.updateLastCacheModificationPerId(identifier);\n }\n }\n }\n });\n Object.defineProperty(IdentifierCache.prototype, \"mergeCache\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (node) {\n var _this = this;\n values(node.identifierCache.cache).forEach(function (nodes) {\n return nodes.forEach(function (child) {\n _this.addNodeToCache(child);\n });\n });\n }\n });\n Object.defineProperty(IdentifierCache.prototype, \"notifyDied\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (node) {\n if (node.identifierAttribute) {\n var id = node.identifier;\n var set = this.cache.get(id);\n if (set) {\n set.remove(node);\n // remove empty sets from cache\n if (!set.length) {\n this.cache.delete(id);\n }\n this.updateLastCacheModificationPerId(node.identifier);\n }\n }\n }\n });\n Object.defineProperty(IdentifierCache.prototype, \"splitCache\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (splitNode) {\n var _this = this;\n var newCache = new IdentifierCache();\n // The slash is added here so we only match children of the splitNode. In version 5.1.8 and\n // earlier there was no trailing slash, so non children that started with the same path string\n // were being matched incorrectly.\n var basePath = splitNode.path + \"/\";\n entries(this.cache).forEach(function (_a) {\n var _b = __read(_a, 2), id = _b[0], nodes = _b[1];\n var modified = false;\n for (var i = nodes.length - 1; i >= 0; i--) {\n var node = nodes[i];\n if (node === splitNode || node.path.indexOf(basePath) === 0) {\n newCache.addNodeToCache(node, false); // no need to update lastUpdated since it is a whole new cache\n nodes.splice(i, 1);\n // remove empty sets from cache\n if (!nodes.length) {\n _this.cache.delete(id);\n }\n modified = true;\n }\n }\n if (modified) {\n _this.updateLastCacheModificationPerId(id);\n }\n });\n return newCache;\n }\n });\n Object.defineProperty(IdentifierCache.prototype, \"has\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (type, identifier) {\n var set = this.cache.get(identifier);\n if (!set)\n return false;\n return set.some(function (candidate) { return type.isAssignableFrom(candidate.type); });\n }\n });\n Object.defineProperty(IdentifierCache.prototype, \"resolve\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (type, identifier) {\n var set = this.cache.get(identifier);\n if (!set)\n return null;\n var matches = set.filter(function (candidate) { return type.isAssignableFrom(candidate.type); });\n switch (matches.length) {\n case 0:\n return null;\n case 1:\n return matches[0];\n default:\n throw fail(\"Cannot resolve a reference to type '\" + type.name + \"' with id: '\" + identifier + \"' unambigously, there are multiple candidates: \" + matches\n .map(function (n) { return n.path; })\n .join(\", \"));\n }\n }\n });\n return IdentifierCache;\n}());\n\n/**\n * @internal\n * @hidden\n */\nfunction createObjectNode(type, parent, subpath, environment, initialValue) {\n var existingNode = getStateTreeNodeSafe(initialValue);\n if (existingNode) {\n if (existingNode.parent) {\n // istanbul ignore next\n throw fail(\"Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '\" + (parent ? parent.path : \"\") + \"/\" + subpath + \"', but it lives already at '\" + existingNode.path + \"'\");\n }\n if (parent) {\n existingNode.setParent(parent, subpath);\n }\n // else it already has no parent since it is a pre-requisite\n return existingNode;\n }\n // not a node, a snapshot\n return new ObjectNode(type, parent, subpath, environment, initialValue);\n}\n/**\n * @internal\n * @hidden\n */\nfunction createScalarNode(type, parent, subpath, environment, initialValue) {\n return new ScalarNode(type, parent, subpath, environment, initialValue);\n}\n/**\n * @internal\n * @hidden\n */\nfunction isNode(value) {\n return value instanceof ScalarNode || value instanceof ObjectNode;\n}\n\n/**\n * @internal\n * @hidden\n */\nvar NodeLifeCycle;\n(function (NodeLifeCycle) {\n NodeLifeCycle[NodeLifeCycle[\"INITIALIZING\"] = 0] = \"INITIALIZING\";\n NodeLifeCycle[NodeLifeCycle[\"CREATED\"] = 1] = \"CREATED\";\n NodeLifeCycle[NodeLifeCycle[\"FINALIZED\"] = 2] = \"FINALIZED\";\n NodeLifeCycle[NodeLifeCycle[\"DETACHING\"] = 3] = \"DETACHING\";\n NodeLifeCycle[NodeLifeCycle[\"DEAD\"] = 4] = \"DEAD\"; // no coming back from this one\n})(NodeLifeCycle || (NodeLifeCycle = {}));\n/**\n * Returns true if the given value is a node in a state tree.\n * More precisely, that is, if the value is an instance of a\n * `types.model`, `types.array` or `types.map`.\n *\n * @param value\n * @returns true if the value is a state tree node.\n */\nfunction isStateTreeNode(value) {\n return !!(value && value.$treenode);\n}\n/**\n * @internal\n * @hidden\n */\nfunction assertIsStateTreeNode(value, argNumber) {\n assertArg(value, isStateTreeNode, \"mobx-state-tree node\", argNumber);\n}\n/**\n * @internal\n * @hidden\n */\nfunction getStateTreeNode(value) {\n if (!isStateTreeNode(value)) {\n // istanbul ignore next\n throw fail(\"Value \" + value + \" is no MST Node\");\n }\n return value.$treenode;\n}\n/**\n * @internal\n * @hidden\n */\nfunction getStateTreeNodeSafe(value) {\n return (value && value.$treenode) || null;\n}\n/**\n * @internal\n * @hidden\n */\nfunction toJSON() {\n return getStateTreeNode(this).snapshot;\n}\nvar doubleDot = function (_) { return \"..\"; };\n/**\n * @internal\n * @hidden\n */\nfunction getRelativePathBetweenNodes(base, target) {\n // PRE condition target is (a child of) base!\n if (base.root !== target.root) {\n throw fail(\"Cannot calculate relative path: objects '\" + base + \"' and '\" + target + \"' are not part of the same object tree\");\n }\n var baseParts = splitJsonPath(base.path);\n var targetParts = splitJsonPath(target.path);\n var common = 0;\n for (; common < baseParts.length; common++) {\n if (baseParts[common] !== targetParts[common])\n break;\n }\n // TODO: assert that no targetParts paths are \"..\", \".\" or \"\"!\n return baseParts.slice(common).map(doubleDot).join(\"/\") + joinJsonPath(targetParts.slice(common));\n}\n/**\n * @internal\n * @hidden\n */\nfunction resolveNodeByPath(base, path, failIfResolveFails) {\n if (failIfResolveFails === void 0) { failIfResolveFails = true; }\n return resolveNodeByPathParts(base, splitJsonPath(path), failIfResolveFails);\n}\n/**\n * @internal\n * @hidden\n */\nfunction resolveNodeByPathParts(base, pathParts, failIfResolveFails) {\n if (failIfResolveFails === void 0) { failIfResolveFails = true; }\n var current = base;\n try {\n for (var i = 0; i < pathParts.length; i++) {\n var part = pathParts[i];\n if (part === \"..\") {\n current = current.parent;\n if (current)\n continue; // not everything has a parent\n }\n else if (part === \".\") {\n continue;\n }\n else if (current) {\n if (current instanceof ScalarNode) {\n // check if the value of a scalar resolves to a state tree node (e.g. references)\n // then we can continue resolving...\n var value = current.value;\n if (isStateTreeNode(value)) {\n current = getStateTreeNode(value);\n // fall through\n }\n }\n if (current instanceof ObjectNode) {\n var subType = current.getChildType(part);\n if (subType) {\n current = current.getChildNode(part);\n if (current)\n continue;\n }\n }\n }\n throw fail(\"Could not resolve '\" + part + \"' in path '\" + (joinJsonPath(pathParts.slice(0, i)) || \"/\") + \"' while resolving '\" + joinJsonPath(pathParts) + \"'\");\n }\n }\n catch (e) {\n if (!failIfResolveFails) {\n return undefined;\n }\n throw e;\n }\n return current;\n}\n/**\n * @internal\n * @hidden\n */\nfunction convertChildNodesToArray(childNodes) {\n if (!childNodes)\n return EMPTY_ARRAY;\n var keys = Object.keys(childNodes);\n if (!keys.length)\n return EMPTY_ARRAY;\n var result = new Array(keys.length);\n keys.forEach(function (key, index) {\n result[index] = childNodes[key];\n });\n return result;\n}\n\n// based on: https://github.com/mobxjs/mobx-utils/blob/master/src/async-action.ts\n/*\n All contents of this file are deprecated.\n\n The term `process` has been replaced with `flow` to avoid conflicts with the\n global `process` object.\n\n Refer to `flow.ts` for any further changes to this implementation.\n*/\nvar DEPRECATION_MESSAGE = \"See https://github.com/mobxjs/mobx-state-tree/issues/399 for more information. \" +\n \"Note that the middleware event types starting with `process` now start with `flow`.\";\n/**\n * @hidden\n *\n * @deprecated has been renamed to `flow()`.\n * See https://github.com/mobxjs/mobx-state-tree/issues/399 for more information.\n * Note that the middleware event types starting with `process` now start with `flow`.\n *\n * @returns {Promise}\n */\nfunction process$1(asyncAction) {\n deprecated(\"process\", \"`process()` has been renamed to `flow()`. \" + DEPRECATION_MESSAGE);\n return flow(asyncAction);\n}\n\nvar plainObjectString = Object.toString();\n/**\n * @internal\n * @hidden\n */\nvar EMPTY_ARRAY = Object.freeze([]);\n/**\n * @internal\n * @hidden\n */\nvar EMPTY_OBJECT = Object.freeze({});\n/**\n * @internal\n * @hidden\n */\nvar mobxShallow = _getGlobalState().useProxies\n ? { deep: false }\n : { deep: false, proxy: false };\nObject.freeze(mobxShallow);\n/**\n * @internal\n * @hidden\n */\nfunction fail(message) {\n if (message === void 0) { message = \"Illegal state\"; }\n return new Error(\"[mobx-state-tree] \" + message);\n}\n/**\n * @internal\n * @hidden\n */\nfunction identity(_) {\n return _;\n}\n/**\n * @internal\n * @hidden\n */\nvar isInteger = Number.isInteger;\n/**\n * @internal\n * @hidden\n */\nfunction isFloat(val) {\n return Number(val) === val && val % 1 !== 0;\n}\n/**\n * @internal\n * @hidden\n */\nfunction isFinite(val) {\n return Number.isFinite(val);\n}\n/**\n * @internal\n * @hidden\n */\nfunction isArray(val) {\n return Array.isArray(val) || isObservableArray(val);\n}\n/**\n * @internal\n * @hidden\n */\nfunction asArray(val) {\n if (!val)\n return EMPTY_ARRAY;\n if (isArray(val))\n return val;\n return [val];\n}\n/**\n * @internal\n * @hidden\n */\nfunction extend(a) {\n var b = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n b[_i - 1] = arguments[_i];\n }\n for (var i = 0; i < b.length; i++) {\n var current = b[i];\n for (var key in current)\n a[key] = current[key];\n }\n return a;\n}\n/**\n * @internal\n * @hidden\n */\nfunction isPlainObject(value) {\n var _a;\n if (value === null || typeof value !== \"object\")\n return false;\n var proto = Object.getPrototypeOf(value);\n if (proto == null)\n return true;\n return ((_a = proto.constructor) === null || _a === void 0 ? void 0 : _a.toString()) === plainObjectString;\n}\n/**\n * @internal\n * @hidden\n */\nfunction isMutable(value) {\n return (value !== null &&\n typeof value === \"object\" &&\n !(value instanceof Date) &&\n !(value instanceof RegExp));\n}\n/**\n * @internal\n * @hidden\n */\nfunction isPrimitive(value, includeDate) {\n if (includeDate === void 0) { includeDate = true; }\n return (value === null ||\n value === undefined ||\n typeof value === \"string\" ||\n typeof value === \"number\" ||\n typeof value === \"boolean\" ||\n (includeDate && value instanceof Date));\n}\n/**\n * @internal\n * @hidden\n * Freeze a value and return it (if not in production)\n */\nfunction freeze(value) {\n if (!devMode())\n return value;\n return isPrimitive(value) || isObservableArray(value) ? value : Object.freeze(value);\n}\n/**\n * @internal\n * @hidden\n * Recursively freeze a value (if not in production)\n */\nfunction deepFreeze(value) {\n if (!devMode())\n return value;\n freeze(value);\n if (isPlainObject(value)) {\n Object.keys(value).forEach(function (propKey) {\n if (!isPrimitive(value[propKey]) && !Object.isFrozen(value[propKey])) {\n deepFreeze(value[propKey]);\n }\n });\n }\n return value;\n}\n/**\n * @internal\n * @hidden\n */\nfunction isSerializable(value) {\n return typeof value !== \"function\";\n}\n/**\n * @internal\n * @hidden\n */\nfunction defineProperty(object, key, descriptor) {\n isObservableObject(object)\n ? defineProperty$1(object, key, descriptor)\n : Object.defineProperty(object, key, descriptor);\n}\n/**\n * @internal\n * @hidden\n */\nfunction addHiddenFinalProp(object, propName, value) {\n defineProperty(object, propName, {\n enumerable: false,\n writable: false,\n configurable: true,\n value: value\n });\n}\n/**\n * @internal\n * @hidden\n */\nfunction addHiddenWritableProp(object, propName, value) {\n defineProperty(object, propName, {\n enumerable: false,\n writable: true,\n configurable: true,\n value: value\n });\n}\n/**\n * @internal\n * @hidden\n */\nvar EventHandler = /** @class */ (function () {\n function EventHandler() {\n Object.defineProperty(this, \"handlers\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: []\n });\n }\n Object.defineProperty(EventHandler.prototype, \"hasSubscribers\", {\n get: function () {\n return this.handlers.length > 0;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(EventHandler.prototype, \"register\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (fn, atTheBeginning) {\n var _this = this;\n if (atTheBeginning === void 0) { atTheBeginning = false; }\n if (atTheBeginning) {\n this.handlers.unshift(fn);\n }\n else {\n this.handlers.push(fn);\n }\n return function () {\n _this.unregister(fn);\n };\n }\n });\n Object.defineProperty(EventHandler.prototype, \"has\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (fn) {\n return this.handlers.indexOf(fn) >= 0;\n }\n });\n Object.defineProperty(EventHandler.prototype, \"unregister\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (fn) {\n var index = this.handlers.indexOf(fn);\n if (index >= 0) {\n this.handlers.splice(index, 1);\n }\n }\n });\n Object.defineProperty(EventHandler.prototype, \"clear\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function () {\n this.handlers.length = 0;\n }\n });\n Object.defineProperty(EventHandler.prototype, \"emit\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n // make a copy just in case it changes\n var handlers = this.handlers.slice();\n handlers.forEach(function (f) { return f.apply(void 0, __spread(args)); });\n }\n });\n return EventHandler;\n}());\n/**\n * @internal\n * @hidden\n */\nvar EventHandlers = /** @class */ (function () {\n function EventHandlers() {\n Object.defineProperty(this, \"eventHandlers\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n }\n Object.defineProperty(EventHandlers.prototype, \"hasSubscribers\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (event) {\n var handler = this.eventHandlers && this.eventHandlers[event];\n return !!handler && handler.hasSubscribers;\n }\n });\n Object.defineProperty(EventHandlers.prototype, \"register\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (event, fn, atTheBeginning) {\n if (atTheBeginning === void 0) { atTheBeginning = false; }\n if (!this.eventHandlers) {\n this.eventHandlers = {};\n }\n var handler = this.eventHandlers[event];\n if (!handler) {\n handler = this.eventHandlers[event] = new EventHandler();\n }\n return handler.register(fn, atTheBeginning);\n }\n });\n Object.defineProperty(EventHandlers.prototype, \"has\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (event, fn) {\n var handler = this.eventHandlers && this.eventHandlers[event];\n return !!handler && handler.has(fn);\n }\n });\n Object.defineProperty(EventHandlers.prototype, \"unregister\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (event, fn) {\n var handler = this.eventHandlers && this.eventHandlers[event];\n if (handler) {\n handler.unregister(fn);\n }\n }\n });\n Object.defineProperty(EventHandlers.prototype, \"clear\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (event) {\n if (this.eventHandlers) {\n delete this.eventHandlers[event];\n }\n }\n });\n Object.defineProperty(EventHandlers.prototype, \"clearAll\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function () {\n this.eventHandlers = undefined;\n }\n });\n Object.defineProperty(EventHandlers.prototype, \"emit\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (event) {\n var _a;\n var args = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n args[_i - 1] = arguments[_i];\n }\n var handler = this.eventHandlers && this.eventHandlers[event];\n if (handler) {\n (_a = handler).emit.apply(_a, __spread(args));\n }\n }\n });\n return EventHandlers;\n}());\n/**\n * @internal\n * @hidden\n */\nfunction argsToArray(args) {\n var res = new Array(args.length);\n for (var i = 0; i < args.length; i++)\n res[i] = args[i];\n return res;\n}\n/**\n * @internal\n * @hidden\n */\nfunction stringStartsWith(str, beginning) {\n return str.indexOf(beginning) === 0;\n}\n/**\n * @internal\n * @hidden\n */\nvar deprecated = function (id, message) {\n // skip if running production\n if (!devMode())\n return;\n // warn if hasn't been warned before\n if (deprecated.ids && !deprecated.ids.hasOwnProperty(id)) {\n warnError(\"Deprecation warning: \" + message);\n }\n // mark as warned to avoid duplicate warn message\n if (deprecated.ids)\n deprecated.ids[id] = true;\n};\ndeprecated.ids = {};\n/**\n * @internal\n * @hidden\n */\nfunction warnError(msg) {\n console.warn(new Error(\"[mobx-state-tree] \" + msg));\n}\n/**\n * @internal\n * @hidden\n */\nfunction isTypeCheckingEnabled() {\n return (devMode() ||\n (typeof process !== \"undefined\" && process.env && process.env.ENABLE_TYPE_CHECK === \"true\"));\n}\n/**\n * @internal\n * @hidden\n */\nfunction devMode() {\n return process.env.NODE_ENV !== \"production\";\n}\n/**\n * @internal\n * @hidden\n */\nfunction assertArg(value, fn, typeName, argNumber) {\n if (devMode()) {\n if (!fn(value)) {\n // istanbul ignore next\n throw fail(\"expected \" + typeName + \" as argument \" + asArray(argNumber).join(\" or \") + \", got \" + value + \" instead\");\n }\n }\n}\n/**\n * @internal\n * @hidden\n */\nfunction assertIsFunction(value, argNumber) {\n assertArg(value, function (fn) { return typeof fn === \"function\"; }, \"function\", argNumber);\n}\n/**\n * @internal\n * @hidden\n */\nfunction assertIsNumber(value, argNumber, min, max) {\n assertArg(value, function (n) { return typeof n === \"number\"; }, \"number\", argNumber);\n if (min !== undefined) {\n assertArg(value, function (n) { return n >= min; }, \"number greater than \" + min, argNumber);\n }\n if (max !== undefined) {\n assertArg(value, function (n) { return n <= max; }, \"number lesser than \" + max, argNumber);\n }\n}\n/**\n * @internal\n * @hidden\n */\nfunction assertIsString(value, argNumber, canBeEmpty) {\n if (canBeEmpty === void 0) { canBeEmpty = true; }\n assertArg(value, function (s) { return typeof s === \"string\"; }, \"string\", argNumber);\n if (!canBeEmpty) {\n assertArg(value, function (s) { return s !== \"\"; }, \"not empty string\", argNumber);\n }\n}\n/**\n * @internal\n * @hidden\n */\nfunction setImmediateWithFallback(fn) {\n if (typeof queueMicrotask === \"function\") {\n queueMicrotask(fn);\n }\n else if (typeof setImmediate === \"function\") {\n setImmediate(fn);\n }\n else {\n setTimeout(fn, 1);\n }\n}\n\n/**\n * See [asynchronous actions](concepts/async-actions.md).\n *\n * @returns The flow as a promise.\n */\nfunction flow(generator) {\n return createFlowSpawner(generator.name, generator);\n}\n/**\n * @deprecated Not needed since TS3.6.\n * Used for TypeScript to make flows that return a promise return the actual promise result.\n *\n * @param val\n * @returns\n */\nfunction castFlowReturn(val) {\n return val;\n}\n/**\n * @experimental\n * experimental api - might change on minor/patch releases\n *\n * Convert a promise-returning function to a generator-returning one.\n * This is intended to allow for usage of `yield*` in async actions to\n * retain the promise return type.\n *\n * Example:\n * ```ts\n * function getDataAsync(input: string): Promise<number> { ... }\n * const getDataGen = toGeneratorFunction(getDataAsync);\n *\n * const someModel.actions(self => ({\n * someAction: flow(function*() {\n * // value is typed as number\n * const value = yield* getDataGen(\"input value\");\n * ...\n * })\n * }))\n * ```\n */\nfunction toGeneratorFunction(p) {\n return function () {\n var _i;\n var args = [];\n for (_i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, p.apply(void 0, __spread(args))];\n case 1: return [2 /*return*/, (_a.sent())];\n }\n });\n };\n}\n/**\n * @experimental\n * experimental api - might change on minor/patch releases\n *\n * Convert a promise to a generator yielding that promise\n * This is intended to allow for usage of `yield*` in async actions to\n * retain the promise return type.\n *\n * Example:\n * ```ts\n * function getDataAsync(input: string): Promise<number> { ... }\n *\n * const someModel.actions(self => ({\n * someAction: flow(function*() {\n * // value is typed as number\n * const value = yield* toGenerator(getDataAsync(\"input value\"));\n * ...\n * })\n * }))\n * ```\n */\nfunction toGenerator(p) {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, p];\n case 1: return [2 /*return*/, (_a.sent())];\n }\n });\n}\n/**\n * @internal\n * @hidden\n */\nfunction createFlowSpawner(name, generator) {\n var spawner = function flowSpawner() {\n // Implementation based on https://github.com/tj/co/blob/master/index.js\n var runId = getNextActionId();\n var parentContext = getCurrentActionContext();\n if (!parentContext) {\n throw fail(\"a mst flow must always have a parent context\");\n }\n var parentActionContext = getParentActionContext(parentContext);\n if (!parentActionContext) {\n throw fail(\"a mst flow must always have a parent action context\");\n }\n var contextBase = {\n name: name,\n id: runId,\n tree: parentContext.tree,\n context: parentContext.context,\n parentId: parentContext.id,\n allParentIds: __spread(parentContext.allParentIds, [parentContext.id]),\n rootId: parentContext.rootId,\n parentEvent: parentContext,\n parentActionEvent: parentActionContext\n };\n var args = arguments;\n function wrap(fn, type, arg) {\n fn.$mst_middleware = spawner.$mst_middleware; // pick up any middleware attached to the flow\n return runWithActionContext(__assign(__assign({}, contextBase), { type: type, args: [arg] }), fn);\n }\n return new Promise(function (resolve, reject) {\n var gen;\n var init = function asyncActionInit() {\n gen = generator.apply(null, arguments);\n onFulfilled(undefined); // kick off the flow\n };\n init.$mst_middleware = spawner.$mst_middleware;\n runWithActionContext(__assign(__assign({}, contextBase), { type: \"flow_spawn\", args: argsToArray(args) }), init);\n function onFulfilled(res) {\n var ret;\n try {\n // prettier-ignore\n var cancelError = wrap(function (r) { ret = gen.next(r); }, \"flow_resume\", res);\n if (cancelError instanceof Error) {\n ret = gen.throw(cancelError);\n }\n }\n catch (e) {\n // prettier-ignore\n setImmediateWithFallback(function () {\n wrap(function (r) { reject(e); }, \"flow_throw\", e);\n });\n return;\n }\n next(ret);\n return;\n }\n function onRejected(err) {\n var ret;\n try {\n // prettier-ignore\n wrap(function (r) { ret = gen.throw(r); }, \"flow_resume_error\", err); // or yieldError?\n }\n catch (e) {\n // prettier-ignore\n setImmediateWithFallback(function () {\n wrap(function (r) { reject(e); }, \"flow_throw\", e);\n });\n return;\n }\n next(ret);\n }\n function next(ret) {\n if (ret.done) {\n // prettier-ignore\n setImmediateWithFallback(function () {\n wrap(function (r) { resolve(r); }, \"flow_return\", ret.value);\n });\n return;\n }\n // TODO: support more type of values? See https://github.com/tj/co/blob/249bbdc72da24ae44076afd716349d2089b31c4c/index.js#L100\n if (!ret.value || typeof ret.value.then !== \"function\") {\n // istanbul ignore next\n throw fail(\"Only promises can be yielded to `async`, got: \" + ret);\n }\n return ret.value.then(onFulfilled, onRejected);\n }\n });\n };\n spawner._isFlowAction = true;\n return spawner;\n}\n\n/**\n * @internal\n * @hidden\n */\nfunction splitPatch(patch) {\n if (!(\"oldValue\" in patch))\n throw fail(\"Patches without `oldValue` field cannot be inversed\");\n return [stripPatch(patch), invertPatch(patch)];\n}\n/**\n * @internal\n * @hidden\n */\nfunction stripPatch(patch) {\n // strips `oldvalue` information from the patch, so that it becomes a patch conform the json-patch spec\n // this removes the ability to undo the patch\n switch (patch.op) {\n case \"add\":\n return { op: \"add\", path: patch.path, value: patch.value };\n case \"remove\":\n return { op: \"remove\", path: patch.path };\n case \"replace\":\n return { op: \"replace\", path: patch.path, value: patch.value };\n }\n}\nfunction invertPatch(patch) {\n switch (patch.op) {\n case \"add\":\n return {\n op: \"remove\",\n path: patch.path\n };\n case \"remove\":\n return {\n op: \"add\",\n path: patch.path,\n value: patch.oldValue\n };\n case \"replace\":\n return {\n op: \"replace\",\n path: patch.path,\n value: patch.oldValue\n };\n }\n}\n/**\n * Simple simple check to check it is a number.\n */\nfunction isNumber(x) {\n return typeof x === \"number\";\n}\n/**\n * Escape slashes and backslashes.\n *\n * http://tools.ietf.org/html/rfc6901\n */\nfunction escapeJsonPath(path) {\n if (isNumber(path) === true) {\n return \"\" + path;\n }\n if (path.indexOf(\"/\") === -1 && path.indexOf(\"~\") === -1)\n return path;\n return path.replace(/~/g, \"~0\").replace(/\\//g, \"~1\");\n}\n/**\n * Unescape slashes and backslashes.\n */\nfunction unescapeJsonPath(path) {\n return path.replace(/~1/g, \"/\").replace(/~0/g, \"~\");\n}\n/**\n * Generates a json-path compliant json path from path parts.\n *\n * @param path\n * @returns\n */\nfunction joinJsonPath(path) {\n // `/` refers to property with an empty name, while `` refers to root itself!\n if (path.length === 0)\n return \"\";\n var getPathStr = function (p) { return p.map(escapeJsonPath).join(\"/\"); };\n if (path[0] === \".\" || path[0] === \"..\") {\n // relative\n return getPathStr(path);\n }\n else {\n // absolute\n return \"/\" + getPathStr(path);\n }\n}\n/**\n * Splits and decodes a json path into several parts.\n *\n * @param path\n * @returns\n */\nfunction splitJsonPath(path) {\n // `/` refers to property with an empty name, while `` refers to root itself!\n var parts = path.split(\"/\").map(unescapeJsonPath);\n var valid = path === \"\" ||\n path === \".\" ||\n path === \"..\" ||\n stringStartsWith(path, \"/\") ||\n stringStartsWith(path, \"./\") ||\n stringStartsWith(path, \"../\");\n if (!valid) {\n throw fail(\"a json path must be either rooted, empty or relative, but got '\" + path + \"'\");\n }\n // '/a/b/c' -> [\"a\", \"b\", \"c\"]\n // '../../b/c' -> [\"..\", \"..\", \"b\", \"c\"]\n // '' -> []\n // '/' -> ['']\n // './a' -> [\".\", \"a\"]\n // /./a' -> [\".\", \"a\"] equivalent to './a'\n if (parts[0] === \"\") {\n parts.shift();\n }\n return parts;\n}\n\n/** @hidden */\nvar $preProcessorFailed = Symbol(\"$preProcessorFailed\");\nvar SnapshotProcessor = /** @class */ (function (_super) {\n __extends(SnapshotProcessor, _super);\n function SnapshotProcessor(_subtype, _processors, name) {\n var _this = _super.call(this, name || _subtype.name) || this;\n Object.defineProperty(_this, \"_subtype\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: _subtype\n });\n Object.defineProperty(_this, \"_processors\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: _processors\n });\n return _this;\n }\n Object.defineProperty(SnapshotProcessor.prototype, \"flags\", {\n get: function () {\n return this._subtype.flags | TypeFlags.SnapshotProcessor;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(SnapshotProcessor.prototype, \"describe\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function () {\n return \"snapshotProcessor(\" + this._subtype.describe() + \")\";\n }\n });\n Object.defineProperty(SnapshotProcessor.prototype, \"preProcessSnapshot\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (sn) {\n if (this._processors.preProcessor) {\n return this._processors.preProcessor.call(null, sn);\n }\n return sn;\n }\n });\n Object.defineProperty(SnapshotProcessor.prototype, \"preProcessSnapshotSafe\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (sn) {\n try {\n return this.preProcessSnapshot(sn);\n }\n catch (e) {\n return $preProcessorFailed;\n }\n }\n });\n Object.defineProperty(SnapshotProcessor.prototype, \"postProcessSnapshot\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (sn, node) {\n if (this._processors.postProcessor) {\n return this._processors.postProcessor.call(null, sn, node.storedValue);\n }\n return sn;\n }\n });\n Object.defineProperty(SnapshotProcessor.prototype, \"_fixNode\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (node) {\n var _this = this;\n // the node has to use these methods rather than the original type ones\n proxyNodeTypeMethods(node.type, this, \"create\");\n if (node instanceof ObjectNode) {\n node.hasSnapshotPostProcessor = !!this._processors.postProcessor;\n }\n var oldGetSnapshot = node.getSnapshot;\n node.getSnapshot = function () { return _this.postProcessSnapshot(oldGetSnapshot.call(node), node); };\n if (!isUnionType(this._subtype)) {\n node.getReconciliationType = function () {\n return _this;\n };\n }\n }\n });\n Object.defineProperty(SnapshotProcessor.prototype, \"instantiate\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (parent, subpath, environment, initialValue) {\n var processedInitialValue = isStateTreeNode(initialValue)\n ? initialValue\n : this.preProcessSnapshot(initialValue);\n var node = this._subtype.instantiate(parent, subpath, environment, processedInitialValue);\n this._fixNode(node);\n return node;\n }\n });\n Object.defineProperty(SnapshotProcessor.prototype, \"reconcile\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (current, newValue, parent, subpath) {\n var node = this._subtype.reconcile(current, isStateTreeNode(newValue) ? newValue : this.preProcessSnapshot(newValue), parent, subpath);\n if (node !== current) {\n this._fixNode(node);\n }\n return node;\n }\n });\n Object.defineProperty(SnapshotProcessor.prototype, \"getSnapshot\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (node, applyPostProcess) {\n if (applyPostProcess === void 0) { applyPostProcess = true; }\n var sn = this._subtype.getSnapshot(node);\n return applyPostProcess ? this.postProcessSnapshot(sn, node) : sn;\n }\n });\n Object.defineProperty(SnapshotProcessor.prototype, \"isValidSnapshot\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (value, context) {\n var processedSn = this.preProcessSnapshotSafe(value);\n if (processedSn === $preProcessorFailed) {\n return typeCheckFailure(context, value, \"Failed to preprocess value\");\n }\n return this._subtype.validate(processedSn, context);\n }\n });\n Object.defineProperty(SnapshotProcessor.prototype, \"getSubTypes\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function () {\n return this._subtype;\n }\n });\n Object.defineProperty(SnapshotProcessor.prototype, \"is\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (thing) {\n var value = isType(thing)\n ? this._subtype\n : isStateTreeNode(thing)\n ? getSnapshot(thing, false)\n : this.preProcessSnapshotSafe(thing);\n if (value === $preProcessorFailed) {\n return false;\n }\n return this._subtype.validate(value, [{ path: \"\", type: this._subtype }]).length === 0;\n }\n });\n Object.defineProperty(SnapshotProcessor.prototype, \"isAssignableFrom\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (type) {\n return this._subtype.isAssignableFrom(type);\n }\n });\n Object.defineProperty(SnapshotProcessor.prototype, \"isMatchingSnapshotId\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (current, snapshot) {\n if (!(this._subtype instanceof ComplexType)) {\n return false;\n }\n var processedSn = this.preProcessSnapshot(snapshot);\n return this._subtype.isMatchingSnapshotId(current, processedSn);\n }\n });\n return SnapshotProcessor;\n}(BaseType));\nfunction proxyNodeTypeMethods(nodeType, snapshotProcessorType) {\n var e_1, _a;\n var methods = [];\n for (var _i = 2; _i < arguments.length; _i++) {\n methods[_i - 2] = arguments[_i];\n }\n try {\n for (var methods_1 = __values(methods), methods_1_1 = methods_1.next(); !methods_1_1.done; methods_1_1 = methods_1.next()) {\n var method = methods_1_1.value;\n nodeType[method] = snapshotProcessorType[method].bind(snapshotProcessorType);\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (methods_1_1 && !methods_1_1.done && (_a = methods_1.return)) _a.call(methods_1);\n }\n finally { if (e_1) throw e_1.error; }\n }\n}\n/**\n * `types.snapshotProcessor` - Runs a pre/post snapshot processor before/after serializing a given type.\n *\n * Example:\n * ```ts\n * const Todo1 = types.model({ text: types.string })\n * // in the backend the text type must be null when empty\n * interface BackendTodo {\n * text: string | null\n * }\n *\n * const Todo2 = types.snapshotProcessor(Todo1, {\n * // from snapshot to instance\n * preProcessor(snapshot: BackendTodo) {\n * return {\n * text: sn.text || \"\";\n * }\n * },\n *\n * // from instance to snapshot\n * postProcessor(snapshot, node): BackendTodo {\n * return {\n * text: !sn.text ? null : sn.text\n * }\n * }\n * })\n * ```\n *\n * @param type Type to run the processors over.\n * @param processors Processors to run.\n * @param name Type name, or undefined to inherit the inner type one.\n * @returns\n */\nfunction snapshotProcessor(type, processors, name) {\n assertIsType(type, 1);\n if (devMode()) {\n if (processors.postProcessor && typeof processors.postProcessor !== \"function\") {\n // istanbul ignore next\n throw fail(\"postSnapshotProcessor must be a function\");\n }\n if (processors.preProcessor && typeof processors.preProcessor !== \"function\") {\n // istanbul ignore next\n throw fail(\"preSnapshotProcessor must be a function\");\n }\n }\n return new SnapshotProcessor(type, processors, name);\n}\n\nvar needsIdentifierError = \"Map.put can only be used to store complex values that have an identifier type attribute\";\nfunction tryCollectModelTypes(type, modelTypes) {\n var e_1, _a;\n var subtypes = type.getSubTypes();\n if (subtypes === cannotDetermineSubtype) {\n return false;\n }\n if (subtypes) {\n var subtypesArray = asArray(subtypes);\n try {\n for (var subtypesArray_1 = __values(subtypesArray), subtypesArray_1_1 = subtypesArray_1.next(); !subtypesArray_1_1.done; subtypesArray_1_1 = subtypesArray_1.next()) {\n var subtype = subtypesArray_1_1.value;\n if (!tryCollectModelTypes(subtype, modelTypes))\n return false;\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (subtypesArray_1_1 && !subtypesArray_1_1.done && (_a = subtypesArray_1.return)) _a.call(subtypesArray_1);\n }\n finally { if (e_1) throw e_1.error; }\n }\n }\n if (type instanceof ModelType) {\n modelTypes.push(type);\n }\n return true;\n}\n/**\n * @internal\n * @hidden\n */\nvar MapIdentifierMode;\n(function (MapIdentifierMode) {\n MapIdentifierMode[MapIdentifierMode[\"UNKNOWN\"] = 0] = \"UNKNOWN\";\n MapIdentifierMode[MapIdentifierMode[\"YES\"] = 1] = \"YES\";\n MapIdentifierMode[MapIdentifierMode[\"NO\"] = 2] = \"NO\";\n})(MapIdentifierMode || (MapIdentifierMode = {}));\nvar MSTMap = /** @class */ (function (_super) {\n __extends(MSTMap, _super);\n function MSTMap(initialData, name) {\n return _super.call(this, initialData, observable.ref.enhancer, name) || this;\n }\n Object.defineProperty(MSTMap.prototype, \"get\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (key) {\n // maybe this is over-enthousiastic? normalize numeric keys to strings\n return _super.prototype.get.call(this, \"\" + key);\n }\n });\n Object.defineProperty(MSTMap.prototype, \"has\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (key) {\n return _super.prototype.has.call(this, \"\" + key);\n }\n });\n Object.defineProperty(MSTMap.prototype, \"delete\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (key) {\n return _super.prototype.delete.call(this, \"\" + key);\n }\n });\n Object.defineProperty(MSTMap.prototype, \"set\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (key, value) {\n return _super.prototype.set.call(this, \"\" + key, value);\n }\n });\n Object.defineProperty(MSTMap.prototype, \"put\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (value) {\n if (!value)\n throw fail(\"Map.put cannot be used to set empty values\");\n if (isStateTreeNode(value)) {\n var node = getStateTreeNode(value);\n if (devMode()) {\n if (!node.identifierAttribute) {\n throw fail(needsIdentifierError);\n }\n }\n if (node.identifier === null) {\n throw fail(needsIdentifierError);\n }\n this.set(node.identifier, value);\n return value;\n }\n else if (!isMutable(value)) {\n throw fail(\"Map.put can only be used to store complex values\");\n }\n else {\n var mapNode = getStateTreeNode(this);\n var mapType = mapNode.type;\n if (mapType.identifierMode !== MapIdentifierMode.YES) {\n throw fail(needsIdentifierError);\n }\n var idAttr = mapType.mapIdentifierAttribute;\n var id = value[idAttr];\n if (!isValidIdentifier(id)) {\n // try again but this time after creating a node for the value\n // since it might be an optional identifier\n var newNode = this.put(mapType.getChildType().create(value, mapNode.environment));\n return this.put(getSnapshot(newNode));\n }\n var key = normalizeIdentifier(id);\n this.set(key, value);\n return this.get(key);\n }\n }\n });\n return MSTMap;\n}(ObservableMap));\n/**\n * @internal\n * @hidden\n */\nvar MapType = /** @class */ (function (_super) {\n __extends(MapType, _super);\n function MapType(name, _subType, hookInitializers) {\n if (hookInitializers === void 0) { hookInitializers = []; }\n var _this = _super.call(this, name) || this;\n Object.defineProperty(_this, \"_subType\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: _subType\n });\n Object.defineProperty(_this, \"identifierMode\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: MapIdentifierMode.UNKNOWN\n });\n Object.defineProperty(_this, \"mapIdentifierAttribute\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: undefined\n });\n Object.defineProperty(_this, \"flags\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: TypeFlags.Map\n });\n Object.defineProperty(_this, \"hookInitializers\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: []\n });\n _this._determineIdentifierMode();\n _this.hookInitializers = hookInitializers;\n return _this;\n }\n Object.defineProperty(MapType.prototype, \"hooks\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (hooks) {\n var hookInitializers = this.hookInitializers.length > 0 ? this.hookInitializers.concat(hooks) : [hooks];\n return new MapType(this.name, this._subType, hookInitializers);\n }\n });\n Object.defineProperty(MapType.prototype, \"instantiate\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (parent, subpath, environment, initialValue) {\n this._determineIdentifierMode();\n return createObjectNode(this, parent, subpath, environment, initialValue);\n }\n });\n Object.defineProperty(MapType.prototype, \"_determineIdentifierMode\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function () {\n if (this.identifierMode !== MapIdentifierMode.UNKNOWN) {\n return;\n }\n var modelTypes = [];\n if (tryCollectModelTypes(this._subType, modelTypes)) {\n var identifierAttribute = modelTypes.reduce(function (current, type) {\n if (!type.identifierAttribute)\n return current;\n if (current && current !== type.identifierAttribute) {\n throw fail(\"The objects in a map should all have the same identifier attribute, expected '\" + current + \"', but child of type '\" + type.name + \"' declared attribute '\" + type.identifierAttribute + \"' as identifier\");\n }\n return type.identifierAttribute;\n }, undefined);\n if (identifierAttribute) {\n this.identifierMode = MapIdentifierMode.YES;\n this.mapIdentifierAttribute = identifierAttribute;\n }\n else {\n this.identifierMode = MapIdentifierMode.NO;\n }\n }\n }\n });\n Object.defineProperty(MapType.prototype, \"initializeChildNodes\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (objNode, initialSnapshot) {\n if (initialSnapshot === void 0) { initialSnapshot = {}; }\n var subType = objNode.type._subType;\n var result = {};\n Object.keys(initialSnapshot).forEach(function (name) {\n result[name] = subType.instantiate(objNode, name, undefined, initialSnapshot[name]);\n });\n return result;\n }\n });\n Object.defineProperty(MapType.prototype, \"createNewInstance\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (childNodes) {\n return new MSTMap(childNodes, this.name);\n }\n });\n Object.defineProperty(MapType.prototype, \"finalizeNewInstance\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (node, instance) {\n _interceptReads(instance, node.unbox);\n var type = node.type;\n type.hookInitializers.forEach(function (initializer) {\n var hooks = initializer(instance);\n Object.keys(hooks).forEach(function (name) {\n var hook = hooks[name];\n var actionInvoker = createActionInvoker(instance, name, hook);\n (!devMode() ? addHiddenFinalProp : addHiddenWritableProp)(instance, name, actionInvoker);\n });\n });\n intercept(instance, this.willChange);\n observe(instance, this.didChange);\n }\n });\n Object.defineProperty(MapType.prototype, \"describe\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function () {\n return this.name;\n }\n });\n Object.defineProperty(MapType.prototype, \"getChildren\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (node) {\n // return (node.storedValue as ObservableMap<any>).values()\n return values(node.storedValue);\n }\n });\n Object.defineProperty(MapType.prototype, \"getChildNode\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (node, key) {\n var childNode = node.storedValue.get(\"\" + key);\n if (!childNode)\n throw fail(\"Not a child \" + key);\n return childNode;\n }\n });\n Object.defineProperty(MapType.prototype, \"willChange\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (change) {\n var node = getStateTreeNode(change.object);\n var key = change.name;\n node.assertWritable({ subpath: key });\n var mapType = node.type;\n var subType = mapType._subType;\n switch (change.type) {\n case \"update\":\n {\n var newValue = change.newValue;\n var oldValue = change.object.get(key);\n if (newValue === oldValue)\n return null;\n typecheckInternal(subType, newValue);\n change.newValue = subType.reconcile(node.getChildNode(key), change.newValue, node, key);\n mapType.processIdentifier(key, change.newValue);\n }\n break;\n case \"add\":\n {\n typecheckInternal(subType, change.newValue);\n change.newValue = subType.instantiate(node, key, undefined, change.newValue);\n mapType.processIdentifier(key, change.newValue);\n }\n break;\n }\n return change;\n }\n });\n Object.defineProperty(MapType.prototype, \"processIdentifier\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (expected, node) {\n if (this.identifierMode === MapIdentifierMode.YES && node instanceof ObjectNode) {\n var identifier = node.identifier;\n if (identifier !== expected)\n throw fail(\"A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '\" + identifier + \"', but expected: '\" + expected + \"'\");\n }\n }\n });\n Object.defineProperty(MapType.prototype, \"getSnapshot\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (node) {\n var res = {};\n node.getChildren().forEach(function (childNode) {\n res[childNode.subpath] = childNode.snapshot;\n });\n return res;\n }\n });\n Object.defineProperty(MapType.prototype, \"processInitialSnapshot\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (childNodes) {\n var processed = {};\n Object.keys(childNodes).forEach(function (key) {\n processed[key] = childNodes[key].getSnapshot();\n });\n return processed;\n }\n });\n Object.defineProperty(MapType.prototype, \"didChange\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (change) {\n var node = getStateTreeNode(change.object);\n switch (change.type) {\n case \"update\":\n return void node.emitPatch({\n op: \"replace\",\n path: escapeJsonPath(change.name),\n value: change.newValue.snapshot,\n oldValue: change.oldValue ? change.oldValue.snapshot : undefined\n }, node);\n case \"add\":\n return void node.emitPatch({\n op: \"add\",\n path: escapeJsonPath(change.name),\n value: change.newValue.snapshot,\n oldValue: undefined\n }, node);\n case \"delete\":\n // a node got deleted, get the old snapshot and make the node die\n var oldSnapshot = change.oldValue.snapshot;\n change.oldValue.die();\n // emit the patch\n return void node.emitPatch({\n op: \"remove\",\n path: escapeJsonPath(change.name),\n oldValue: oldSnapshot\n }, node);\n }\n }\n });\n Object.defineProperty(MapType.prototype, \"applyPatchLocally\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (node, subpath, patch) {\n var target = node.storedValue;\n switch (patch.op) {\n case \"add\":\n case \"replace\":\n target.set(subpath, patch.value);\n break;\n case \"remove\":\n target.delete(subpath);\n break;\n }\n }\n });\n Object.defineProperty(MapType.prototype, \"applySnapshot\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (node, snapshot) {\n typecheckInternal(this, snapshot);\n var target = node.storedValue;\n var currentKeys = {};\n Array.from(target.keys()).forEach(function (key) {\n currentKeys[key] = false;\n });\n if (snapshot) {\n // Don't use target.replace, as it will throw away all existing items first\n for (var key in snapshot) {\n target.set(key, snapshot[key]);\n currentKeys[\"\" + key] = true;\n }\n }\n Object.keys(currentKeys).forEach(function (key) {\n if (currentKeys[key] === false)\n target.delete(key);\n });\n }\n });\n Object.defineProperty(MapType.prototype, \"getChildType\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function () {\n return this._subType;\n }\n });\n Object.defineProperty(MapType.prototype, \"isValidSnapshot\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (value, context) {\n var _this = this;\n if (!isPlainObject(value)) {\n return typeCheckFailure(context, value, \"Value is not a plain object\");\n }\n return flattenTypeErrors(Object.keys(value).map(function (path) {\n return _this._subType.validate(value[path], getContextForPath(context, path, _this._subType));\n }));\n }\n });\n Object.defineProperty(MapType.prototype, \"getDefaultSnapshot\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function () {\n return EMPTY_OBJECT;\n }\n });\n Object.defineProperty(MapType.prototype, \"removeChild\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (node, subpath) {\n node.storedValue.delete(subpath);\n }\n });\n return MapType;\n}(ComplexType));\nMapType.prototype.applySnapshot = action(MapType.prototype.applySnapshot);\n/**\n * `types.map` - Creates a key based collection type who's children are all of a uniform declared type.\n * If the type stored in a map has an identifier, it is mandatory to store the child under that identifier in the map.\n *\n * This type will always produce [observable maps](https://mobx.js.org/api.html#observablemap)\n *\n * Example:\n * ```ts\n * const Todo = types.model({\n * id: types.identifier,\n * task: types.string\n * })\n *\n * const TodoStore = types.model({\n * todos: types.map(Todo)\n * })\n *\n * const s = TodoStore.create({ todos: {} })\n * unprotect(s)\n * s.todos.set(17, { task: \"Grab coffee\", id: 17 })\n * s.todos.put({ task: \"Grab cookie\", id: 18 }) // put will infer key from the identifier\n * console.log(s.todos.get(17).task) // prints: \"Grab coffee\"\n * ```\n *\n * @param subtype\n * @returns\n */\nfunction map(subtype) {\n return new MapType(\"Map<string, \" + subtype.name + \">\", subtype);\n}\n/**\n * Returns if a given value represents a map type.\n *\n * @param type\n * @returns `true` if it is a map type.\n */\nfunction isMapType(type) {\n return isType(type) && (type.flags & TypeFlags.Map) > 0;\n}\n\n/**\n * @internal\n * @hidden\n */\nvar ArrayType = /** @class */ (function (_super) {\n __extends(ArrayType, _super);\n function ArrayType(name, _subType, hookInitializers) {\n if (hookInitializers === void 0) { hookInitializers = []; }\n var _this = _super.call(this, name) || this;\n Object.defineProperty(_this, \"_subType\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: _subType\n });\n Object.defineProperty(_this, \"flags\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: TypeFlags.Array\n });\n Object.defineProperty(_this, \"hookInitializers\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: []\n });\n _this.hookInitializers = hookInitializers;\n return _this;\n }\n Object.defineProperty(ArrayType.prototype, \"hooks\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (hooks) {\n var hookInitializers = this.hookInitializers.length > 0 ? this.hookInitializers.concat(hooks) : [hooks];\n return new ArrayType(this.name, this._subType, hookInitializers);\n }\n });\n Object.defineProperty(ArrayType.prototype, \"instantiate\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (parent, subpath, environment, initialValue) {\n return createObjectNode(this, parent, subpath, environment, initialValue);\n }\n });\n Object.defineProperty(ArrayType.prototype, \"initializeChildNodes\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (objNode, snapshot) {\n if (snapshot === void 0) { snapshot = []; }\n var subType = objNode.type._subType;\n var result = {};\n snapshot.forEach(function (item, index) {\n var subpath = \"\" + index;\n result[subpath] = subType.instantiate(objNode, subpath, undefined, item);\n });\n return result;\n }\n });\n Object.defineProperty(ArrayType.prototype, \"createNewInstance\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (childNodes) {\n var options = __assign(__assign({}, mobxShallow), { name: this.name });\n return observable.array(convertChildNodesToArray(childNodes), options);\n }\n });\n Object.defineProperty(ArrayType.prototype, \"finalizeNewInstance\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (node, instance) {\n _getAdministration(instance).dehancer = node.unbox;\n var type = node.type;\n type.hookInitializers.forEach(function (initializer) {\n var hooks = initializer(instance);\n Object.keys(hooks).forEach(function (name) {\n var hook = hooks[name];\n var actionInvoker = createActionInvoker(instance, name, hook);\n (!devMode() ? addHiddenFinalProp : addHiddenWritableProp)(instance, name, actionInvoker);\n });\n });\n intercept(instance, this.willChange);\n observe(instance, this.didChange);\n }\n });\n Object.defineProperty(ArrayType.prototype, \"describe\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function () {\n return this.name;\n }\n });\n Object.defineProperty(ArrayType.prototype, \"getChildren\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (node) {\n return node.storedValue.slice();\n }\n });\n Object.defineProperty(ArrayType.prototype, \"getChildNode\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (node, key) {\n var index = Number(key);\n if (index < node.storedValue.length)\n return node.storedValue[index];\n throw fail(\"Not a child: \" + key);\n }\n });\n Object.defineProperty(ArrayType.prototype, \"willChange\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (change) {\n var node = getStateTreeNode(change.object);\n node.assertWritable({ subpath: \"\" + change.index });\n var subType = node.type._subType;\n var childNodes = node.getChildren();\n switch (change.type) {\n case \"update\":\n {\n if (change.newValue === change.object[change.index])\n return null;\n var updatedNodes = reconcileArrayChildren(node, subType, [childNodes[change.index]], [change.newValue], [change.index]);\n if (!updatedNodes) {\n return null;\n }\n change.newValue = updatedNodes[0];\n }\n break;\n case \"splice\":\n {\n var index_1 = change.index, removedCount = change.removedCount, added = change.added;\n var addedNodes = reconcileArrayChildren(node, subType, childNodes.slice(index_1, index_1 + removedCount), added, added.map(function (_, i) { return index_1 + i; }));\n if (!addedNodes) {\n return null;\n }\n change.added = addedNodes;\n // update paths of remaining items\n for (var i = index_1 + removedCount; i < childNodes.length; i++) {\n childNodes[i].setParent(node, \"\" + (i + added.length - removedCount));\n }\n }\n break;\n }\n return change;\n }\n });\n Object.defineProperty(ArrayType.prototype, \"getSnapshot\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (node) {\n return node.getChildren().map(function (childNode) { return childNode.snapshot; });\n }\n });\n Object.defineProperty(ArrayType.prototype, \"processInitialSnapshot\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (childNodes) {\n var processed = [];\n Object.keys(childNodes).forEach(function (key) {\n processed.push(childNodes[key].getSnapshot());\n });\n return processed;\n }\n });\n Object.defineProperty(ArrayType.prototype, \"didChange\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (change) {\n var node = getStateTreeNode(change.object);\n switch (change.type) {\n case \"update\":\n return void node.emitPatch({\n op: \"replace\",\n path: \"\" + change.index,\n value: change.newValue.snapshot,\n oldValue: change.oldValue ? change.oldValue.snapshot : undefined\n }, node);\n case \"splice\":\n for (var i = change.removedCount - 1; i >= 0; i--)\n node.emitPatch({\n op: \"remove\",\n path: \"\" + (change.index + i),\n oldValue: change.removed[i].snapshot\n }, node);\n for (var i = 0; i < change.addedCount; i++)\n node.emitPatch({\n op: \"add\",\n path: \"\" + (change.index + i),\n value: node.getChildNode(\"\" + (change.index + i)).snapshot,\n oldValue: undefined\n }, node);\n return;\n }\n }\n });\n Object.defineProperty(ArrayType.prototype, \"applyPatchLocally\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (node, subpath, patch) {\n var target = node.storedValue;\n var index = subpath === \"-\" ? target.length : Number(subpath);\n switch (patch.op) {\n case \"replace\":\n target[index] = patch.value;\n break;\n case \"add\":\n target.splice(index, 0, patch.value);\n break;\n case \"remove\":\n target.splice(index, 1);\n break;\n }\n }\n });\n Object.defineProperty(ArrayType.prototype, \"applySnapshot\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (node, snapshot) {\n typecheckInternal(this, snapshot);\n var target = node.storedValue;\n target.replace(snapshot);\n }\n });\n Object.defineProperty(ArrayType.prototype, \"getChildType\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function () {\n return this._subType;\n }\n });\n Object.defineProperty(ArrayType.prototype, \"isValidSnapshot\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (value, context) {\n var _this = this;\n if (!isArray(value)) {\n return typeCheckFailure(context, value, \"Value is not an array\");\n }\n return flattenTypeErrors(value.map(function (item, index) {\n return _this._subType.validate(item, getContextForPath(context, \"\" + index, _this._subType));\n }));\n }\n });\n Object.defineProperty(ArrayType.prototype, \"getDefaultSnapshot\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function () {\n return EMPTY_ARRAY;\n }\n });\n Object.defineProperty(ArrayType.prototype, \"removeChild\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (node, subpath) {\n node.storedValue.splice(Number(subpath), 1);\n }\n });\n return ArrayType;\n}(ComplexType));\nArrayType.prototype.applySnapshot = action(ArrayType.prototype.applySnapshot);\n/**\n * `types.array` - Creates an index based collection type who's children are all of a uniform declared type.\n *\n * This type will always produce [observable arrays](https://mobx.js.org/api.html#observablearray)\n *\n * Example:\n * ```ts\n * const Todo = types.model({\n * task: types.string\n * })\n *\n * const TodoStore = types.model({\n * todos: types.array(Todo)\n * })\n *\n * const s = TodoStore.create({ todos: [] })\n * unprotect(s) // needed to allow modifying outside of an action\n * s.todos.push({ task: \"Grab coffee\" })\n * console.log(s.todos[0]) // prints: \"Grab coffee\"\n * ```\n *\n * @param subtype\n * @returns\n */\nfunction array(subtype) {\n assertIsType(subtype, 1);\n return new ArrayType(subtype.name + \"[]\", subtype);\n}\nfunction reconcileArrayChildren(parent, childType, oldNodes, newValues, newPaths) {\n var nothingChanged = true;\n for (var i = 0;; i++) {\n var hasNewNode = i <= newValues.length - 1;\n var oldNode = oldNodes[i];\n var newValue = hasNewNode ? newValues[i] : undefined;\n var newPath = \"\" + newPaths[i];\n // for some reason, instead of newValue we got a node, fallback to the storedValue\n // TODO: https://github.com/mobxjs/mobx-state-tree/issues/340#issuecomment-325581681\n if (isNode(newValue))\n newValue = newValue.storedValue;\n if (!oldNode && !hasNewNode) {\n // both are empty, end\n break;\n }\n else if (!hasNewNode) {\n // new one does not exists\n nothingChanged = false;\n oldNodes.splice(i, 1);\n if (oldNode instanceof ObjectNode) {\n // since it is going to be returned by pop/splice/shift better create it before killing it\n // so it doesn't end up in an undead state\n oldNode.createObservableInstanceIfNeeded();\n }\n oldNode.die();\n i--;\n }\n else if (!oldNode) {\n // there is no old node, create it\n // check if already belongs to the same parent. if so, avoid pushing item in. only swapping can occur.\n if (isStateTreeNode(newValue) && getStateTreeNode(newValue).parent === parent) {\n // this node is owned by this parent, but not in the reconcilable set, so it must be double\n throw fail(\"Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '\" + parent.path + \"/\" + newPath + \"', but it lives already at '\" + getStateTreeNode(newValue).path + \"'\");\n }\n nothingChanged = false;\n var newNode = valueAsNode(childType, parent, newPath, newValue);\n oldNodes.splice(i, 0, newNode);\n }\n else if (areSame(oldNode, newValue)) {\n // both are the same, reconcile\n oldNodes[i] = valueAsNode(childType, parent, newPath, newValue, oldNode);\n }\n else {\n // nothing to do, try to reorder\n var oldMatch = undefined;\n // find a possible candidate to reuse\n for (var j = i; j < oldNodes.length; j++) {\n if (areSame(oldNodes[j], newValue)) {\n oldMatch = oldNodes.splice(j, 1)[0];\n break;\n }\n }\n nothingChanged = false;\n var newNode = valueAsNode(childType, parent, newPath, newValue, oldMatch);\n oldNodes.splice(i, 0, newNode);\n }\n }\n return nothingChanged ? null : oldNodes;\n}\n/**\n * Convert a value to a node at given parent and subpath. Attempts to reuse old node if possible and given.\n */\nfunction valueAsNode(childType, parent, subpath, newValue, oldNode) {\n // ensure the value is valid-ish\n typecheckInternal(childType, newValue);\n function getNewNode() {\n // the new value has a MST node\n if (isStateTreeNode(newValue)) {\n var childNode = getStateTreeNode(newValue);\n childNode.assertAlive(EMPTY_OBJECT);\n // the node lives here\n if (childNode.parent !== null && childNode.parent === parent) {\n childNode.setParent(parent, subpath);\n return childNode;\n }\n }\n // there is old node and new one is a value/snapshot\n if (oldNode) {\n return childType.reconcile(oldNode, newValue, parent, subpath);\n }\n // nothing to do, create from scratch\n return childType.instantiate(parent, subpath, undefined, newValue);\n }\n var newNode = getNewNode();\n if (oldNode && oldNode !== newNode) {\n if (oldNode instanceof ObjectNode) {\n // since it is going to be returned by pop/splice/shift better create it before killing it\n // so it doesn't end up in an undead state\n oldNode.createObservableInstanceIfNeeded();\n }\n oldNode.die();\n }\n return newNode;\n}\n/**\n * Check if a node holds a value.\n */\nfunction areSame(oldNode, newValue) {\n // never consider dead old nodes for reconciliation\n if (!oldNode.isAlive) {\n return false;\n }\n // the new value has the same node\n if (isStateTreeNode(newValue)) {\n var newNode = getStateTreeNode(newValue);\n return newNode.isAlive && newNode === oldNode;\n }\n // the provided value is the snapshot of the old node\n if (oldNode.snapshot === newValue) {\n return true;\n }\n // Non object nodes don't get reconciled\n if (!(oldNode instanceof ObjectNode)) {\n return false;\n }\n var oldNodeType = oldNode.getReconciliationType();\n // new value is a snapshot with the correct identifier\n return (oldNode.identifier !== null &&\n oldNode.identifierAttribute &&\n isPlainObject(newValue) &&\n oldNodeType.is(newValue) &&\n oldNodeType.isMatchingSnapshotId(oldNode, newValue));\n}\n/**\n * Returns if a given value represents an array type.\n *\n * @param type\n * @returns `true` if the type is an array type.\n */\nfunction isArrayType(type) {\n return isType(type) && (type.flags & TypeFlags.Array) > 0;\n}\n\nvar PRE_PROCESS_SNAPSHOT = \"preProcessSnapshot\";\nvar POST_PROCESS_SNAPSHOT = \"postProcessSnapshot\";\nfunction objectTypeToString() {\n return getStateTreeNode(this).toString();\n}\nvar defaultObjectOptions = {\n name: \"AnonymousModel\",\n properties: {},\n initializers: EMPTY_ARRAY\n};\nfunction toPropertiesObject(declaredProps) {\n var keysList = Object.keys(declaredProps);\n var alreadySeenKeys = new Set();\n keysList.forEach(function (key) {\n if (alreadySeenKeys.has(key)) {\n throw fail(key + \" is declared twice in the model. Model should not contain the same keys\");\n }\n alreadySeenKeys.add(key);\n });\n // loop through properties and ensures that all items are types\n return keysList.reduce(function (props, key) {\n // warn if user intended a HOOK\n if (key in Hook) {\n throw fail(\"Hook '\" + key + \"' was defined as property. Hooks should be defined as part of the actions\");\n }\n // the user intended to use a view\n var descriptor = Object.getOwnPropertyDescriptor(declaredProps, key);\n if (\"get\" in descriptor) {\n throw fail(\"Getters are not supported as properties. Please use views instead\");\n }\n // undefined and null are not valid\n var value = descriptor.value;\n if (value === null || value === undefined) {\n throw fail(\"The default value of an attribute cannot be null or undefined as the type cannot be inferred. Did you mean `types.maybe(someType)`?\");\n }\n // its a primitive, convert to its type\n else if (isPrimitive(value)) {\n props[key] = optional(getPrimitiveFactoryFromValue(value), value);\n }\n // map defaults to empty object automatically for models\n else if (value instanceof MapType) {\n props[key] = optional(value, {});\n }\n else if (value instanceof ArrayType) {\n props[key] = optional(value, []);\n }\n // its already a type\n else if (isType(value)) ;\n // its a function, maybe the user wanted a view?\n else if (devMode() && typeof value === \"function\") {\n throw fail(\"Invalid type definition for property '\" + key + \"', it looks like you passed a function. Did you forget to invoke it, or did you intend to declare a view / action?\");\n }\n // no other complex values\n else if (devMode() && typeof value === \"object\") {\n throw fail(\"Invalid type definition for property '\" + key + \"', it looks like you passed an object. Try passing another model type or a types.frozen.\");\n }\n else {\n throw fail(\"Invalid type definition for property '\" + key + \"', cannot infer a type from a value like '\" + value + \"' (\" + typeof value + \")\");\n }\n return props;\n }, __assign({}, declaredProps));\n}\n/**\n * @internal\n * @hidden\n */\nvar ModelType = /** @class */ (function (_super) {\n __extends(ModelType, _super);\n function ModelType(opts) {\n var _this = _super.call(this, opts.name || defaultObjectOptions.name) || this;\n Object.defineProperty(_this, \"flags\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: TypeFlags.Object\n });\n /*\n * The original object definition\n */\n Object.defineProperty(_this, \"initializers\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(_this, \"properties\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(_this, \"preProcessor\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(_this, \"postProcessor\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(_this, \"propertyNames\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(_this, \"named\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: function (name) {\n return _this.cloneAndEnhance({ name: name });\n }\n });\n Object.defineProperty(_this, \"props\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: function (properties) {\n return _this.cloneAndEnhance({ properties: properties });\n }\n });\n Object.defineProperty(_this, \"preProcessSnapshot\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: function (preProcessor) {\n var currentPreprocessor = _this.preProcessor;\n if (!currentPreprocessor)\n return _this.cloneAndEnhance({ preProcessor: preProcessor });\n else\n return _this.cloneAndEnhance({\n preProcessor: function (snapshot) { return currentPreprocessor(preProcessor(snapshot)); }\n });\n }\n });\n Object.defineProperty(_this, \"postProcessSnapshot\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: function (postProcessor) {\n var currentPostprocessor = _this.postProcessor;\n if (!currentPostprocessor)\n return _this.cloneAndEnhance({ postProcessor: postProcessor });\n else\n return _this.cloneAndEnhance({\n postProcessor: function (snapshot) { return postProcessor(currentPostprocessor(snapshot)); }\n });\n }\n });\n Object.assign(_this, defaultObjectOptions, opts);\n // ensures that any default value gets converted to its related type\n _this.properties = toPropertiesObject(_this.properties);\n freeze(_this.properties); // make sure nobody messes with it\n _this.propertyNames = Object.keys(_this.properties);\n _this.identifierAttribute = _this._getIdentifierAttribute();\n return _this;\n }\n Object.defineProperty(ModelType.prototype, \"_getIdentifierAttribute\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function () {\n var identifierAttribute = undefined;\n this.forAllProps(function (propName, propType) {\n if (propType.flags & TypeFlags.Identifier) {\n if (identifierAttribute)\n throw fail(\"Cannot define property '\" + propName + \"' as object identifier, property '\" + identifierAttribute + \"' is already defined as identifier property\");\n identifierAttribute = propName;\n }\n });\n return identifierAttribute;\n }\n });\n Object.defineProperty(ModelType.prototype, \"cloneAndEnhance\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (opts) {\n return new ModelType({\n name: opts.name || this.name,\n properties: Object.assign({}, this.properties, opts.properties),\n initializers: this.initializers.concat(opts.initializers || []),\n preProcessor: opts.preProcessor || this.preProcessor,\n postProcessor: opts.postProcessor || this.postProcessor\n });\n }\n });\n Object.defineProperty(ModelType.prototype, \"actions\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (fn) {\n var _this = this;\n var actionInitializer = function (self) {\n _this.instantiateActions(self, fn(self));\n return self;\n };\n return this.cloneAndEnhance({ initializers: [actionInitializer] });\n }\n });\n Object.defineProperty(ModelType.prototype, \"instantiateActions\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (self, actions) {\n // check if return is correct\n if (!isPlainObject(actions))\n throw fail(\"actions initializer should return a plain object containing actions\");\n // bind actions to the object created\n Object.keys(actions).forEach(function (name) {\n // warn if preprocessor was given\n if (name === PRE_PROCESS_SNAPSHOT)\n throw fail(\"Cannot define action '\" + PRE_PROCESS_SNAPSHOT + \"', it should be defined using 'type.preProcessSnapshot(fn)' instead\");\n // warn if postprocessor was given\n if (name === POST_PROCESS_SNAPSHOT)\n throw fail(\"Cannot define action '\" + POST_PROCESS_SNAPSHOT + \"', it should be defined using 'type.postProcessSnapshot(fn)' instead\");\n var action2 = actions[name];\n // apply hook composition\n var baseAction = self[name];\n if (name in Hook && baseAction) {\n var specializedAction_1 = action2;\n action2 = function () {\n baseAction.apply(null, arguments);\n specializedAction_1.apply(null, arguments);\n };\n }\n // the goal of this is to make sure actions using \"this\" can call themselves,\n // while still allowing the middlewares to register them\n var middlewares = action2.$mst_middleware; // make sure middlewares are not lost\n var boundAction = action2.bind(actions);\n boundAction._isFlowAction = action2._isFlowAction || false;\n boundAction.$mst_middleware = middlewares;\n var actionInvoker = createActionInvoker(self, name, boundAction);\n actions[name] = actionInvoker;\n (!devMode() ? addHiddenFinalProp : addHiddenWritableProp)(self, name, actionInvoker);\n });\n }\n });\n Object.defineProperty(ModelType.prototype, \"volatile\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (fn) {\n var _this = this;\n if (typeof fn !== \"function\") {\n throw fail(\"You passed an \" + typeof fn + \" to volatile state as an argument, when function is expected\");\n }\n var stateInitializer = function (self) {\n _this.instantiateVolatileState(self, fn(self));\n return self;\n };\n return this.cloneAndEnhance({ initializers: [stateInitializer] });\n }\n });\n Object.defineProperty(ModelType.prototype, \"instantiateVolatileState\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (self, state) {\n // check views return\n if (!isPlainObject(state))\n throw fail(\"volatile state initializer should return a plain object containing state\");\n set(self, state);\n }\n });\n Object.defineProperty(ModelType.prototype, \"extend\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (fn) {\n var _this = this;\n var initializer = function (self) {\n var _a = fn(self), actions = _a.actions, views = _a.views, state = _a.state, rest = __rest(_a, [\"actions\", \"views\", \"state\"]);\n for (var key in rest)\n throw fail(\"The `extend` function should return an object with a subset of the fields 'actions', 'views' and 'state'. Found invalid key '\" + key + \"'\");\n if (state)\n _this.instantiateVolatileState(self, state);\n if (views)\n _this.instantiateViews(self, views);\n if (actions)\n _this.instantiateActions(self, actions);\n return self;\n };\n return this.cloneAndEnhance({ initializers: [initializer] });\n }\n });\n Object.defineProperty(ModelType.prototype, \"views\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (fn) {\n var _this = this;\n var viewInitializer = function (self) {\n _this.instantiateViews(self, fn(self));\n return self;\n };\n return this.cloneAndEnhance({ initializers: [viewInitializer] });\n }\n });\n Object.defineProperty(ModelType.prototype, \"instantiateViews\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (self, views) {\n // check views return\n if (!isPlainObject(views))\n throw fail(\"views initializer should return a plain object containing views\");\n Object.getOwnPropertyNames(views).forEach(function (key) {\n var _a;\n // is this a computed property?\n var descriptor = Object.getOwnPropertyDescriptor(views, key);\n if (\"get\" in descriptor) {\n defineProperty$1(self, key, descriptor);\n makeObservable(self, (_a = {}, _a[key] = computed, _a));\n }\n else if (typeof descriptor.value === \"function\") {\n (!devMode() ? addHiddenFinalProp : addHiddenWritableProp)(self, key, descriptor.value);\n }\n else {\n throw fail(\"A view member should either be a function or getter based property\");\n }\n });\n }\n });\n Object.defineProperty(ModelType.prototype, \"instantiate\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (parent, subpath, environment, initialValue) {\n var value = isStateTreeNode(initialValue)\n ? initialValue\n : this.applySnapshotPreProcessor(initialValue);\n return createObjectNode(this, parent, subpath, environment, value);\n // Optimization: record all prop- view- and action names after first construction, and generate an optimal base class\n // that pre-reserves all these fields for fast object-member lookups\n }\n });\n Object.defineProperty(ModelType.prototype, \"initializeChildNodes\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (objNode, initialSnapshot) {\n if (initialSnapshot === void 0) { initialSnapshot = {}; }\n var type = objNode.type;\n var result = {};\n type.forAllProps(function (name, childType) {\n result[name] = childType.instantiate(objNode, name, undefined, initialSnapshot[name]);\n });\n return result;\n }\n });\n Object.defineProperty(ModelType.prototype, \"createNewInstance\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (childNodes) {\n var options = __assign(__assign({}, mobxShallow), { name: this.name });\n return observable.object(childNodes, EMPTY_OBJECT, options);\n }\n });\n Object.defineProperty(ModelType.prototype, \"finalizeNewInstance\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (node, instance) {\n addHiddenFinalProp(instance, \"toString\", objectTypeToString);\n this.forAllProps(function (name) {\n _interceptReads(instance, name, node.unbox);\n });\n this.initializers.reduce(function (self, fn) { return fn(self); }, instance);\n intercept(instance, this.willChange);\n observe(instance, this.didChange);\n }\n });\n Object.defineProperty(ModelType.prototype, \"willChange\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (chg) {\n // TODO: mobx typings don't seem to take into account that newValue can be set even when removing a prop\n var change = chg;\n var node = getStateTreeNode(change.object);\n var subpath = change.name;\n node.assertWritable({ subpath: subpath });\n var childType = node.type.properties[subpath];\n // only properties are typed, state are stored as-is references\n if (childType) {\n typecheckInternal(childType, change.newValue);\n change.newValue = childType.reconcile(node.getChildNode(subpath), change.newValue, node, subpath);\n }\n return change;\n }\n });\n Object.defineProperty(ModelType.prototype, \"didChange\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (chg) {\n // TODO: mobx typings don't seem to take into account that newValue can be set even when removing a prop\n var change = chg;\n var childNode = getStateTreeNode(change.object);\n var childType = childNode.type.properties[change.name];\n if (!childType) {\n // don't emit patches for volatile state\n return;\n }\n var oldChildValue = change.oldValue ? change.oldValue.snapshot : undefined;\n childNode.emitPatch({\n op: \"replace\",\n path: escapeJsonPath(change.name),\n value: change.newValue.snapshot,\n oldValue: oldChildValue\n }, childNode);\n }\n });\n Object.defineProperty(ModelType.prototype, \"getChildren\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (node) {\n var _this = this;\n var res = [];\n this.forAllProps(function (name) {\n res.push(_this.getChildNode(node, name));\n });\n return res;\n }\n });\n Object.defineProperty(ModelType.prototype, \"getChildNode\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (node, key) {\n var _a;\n if (!(key in this.properties))\n throw fail(\"Not a value property: \" + key);\n var adm = _getAdministration(node.storedValue, key);\n var childNode = (_a = adm.raw) === null || _a === void 0 ? void 0 : _a.call(adm);\n if (!childNode)\n throw fail(\"Node not available for property \" + key);\n return childNode;\n }\n });\n Object.defineProperty(ModelType.prototype, \"getSnapshot\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (node, applyPostProcess) {\n var _this = this;\n if (applyPostProcess === void 0) { applyPostProcess = true; }\n var res = {};\n this.forAllProps(function (name, type) {\n try {\n // TODO: FIXME, make sure the observable ref is used!\n var atom = getAtom(node.storedValue, name);\n atom.reportObserved();\n }\n catch (e) {\n throw fail(name + \" property is declared twice\");\n }\n res[name] = _this.getChildNode(node, name).snapshot;\n });\n if (applyPostProcess) {\n return this.applySnapshotPostProcessor(res);\n }\n return res;\n }\n });\n Object.defineProperty(ModelType.prototype, \"processInitialSnapshot\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (childNodes) {\n var processed = {};\n Object.keys(childNodes).forEach(function (key) {\n processed[key] = childNodes[key].getSnapshot();\n });\n return this.applySnapshotPostProcessor(processed);\n }\n });\n Object.defineProperty(ModelType.prototype, \"applyPatchLocally\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (node, subpath, patch) {\n if (!(patch.op === \"replace\" || patch.op === \"add\")) {\n throw fail(\"object does not support operation \" + patch.op);\n }\n node.storedValue[subpath] = patch.value;\n }\n });\n Object.defineProperty(ModelType.prototype, \"applySnapshot\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (node, snapshot) {\n typecheckInternal(this, snapshot);\n var preProcessedSnapshot = this.applySnapshotPreProcessor(snapshot);\n this.forAllProps(function (name) {\n node.storedValue[name] = preProcessedSnapshot[name];\n });\n }\n });\n Object.defineProperty(ModelType.prototype, \"applySnapshotPreProcessor\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (snapshot) {\n var processor = this.preProcessor;\n return processor ? processor.call(null, snapshot) : snapshot;\n }\n });\n Object.defineProperty(ModelType.prototype, \"applySnapshotPostProcessor\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (snapshot) {\n var postProcessor = this.postProcessor;\n if (postProcessor)\n return postProcessor.call(null, snapshot);\n return snapshot;\n }\n });\n Object.defineProperty(ModelType.prototype, \"getChildType\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (propertyName) {\n assertIsString(propertyName, 1);\n return this.properties[propertyName];\n }\n });\n Object.defineProperty(ModelType.prototype, \"isValidSnapshot\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (value, context) {\n var _this = this;\n var snapshot = this.applySnapshotPreProcessor(value);\n if (!isPlainObject(snapshot)) {\n return typeCheckFailure(context, snapshot, \"Value is not a plain object\");\n }\n return flattenTypeErrors(this.propertyNames.map(function (key) {\n return _this.properties[key].validate(snapshot[key], getContextForPath(context, key, _this.properties[key]));\n }));\n }\n });\n Object.defineProperty(ModelType.prototype, \"forAllProps\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (fn) {\n var _this = this;\n this.propertyNames.forEach(function (key) { return fn(key, _this.properties[key]); });\n }\n });\n Object.defineProperty(ModelType.prototype, \"describe\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function () {\n var _this = this;\n // optimization: cache\n return (\"{ \" +\n this.propertyNames.map(function (key) { return key + \": \" + _this.properties[key].describe(); }).join(\"; \") +\n \" }\");\n }\n });\n Object.defineProperty(ModelType.prototype, \"getDefaultSnapshot\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function () {\n return EMPTY_OBJECT;\n }\n });\n Object.defineProperty(ModelType.prototype, \"removeChild\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (node, subpath) {\n node.storedValue[subpath] = undefined;\n }\n });\n return ModelType;\n}(ComplexType));\nModelType.prototype.applySnapshot = action(ModelType.prototype.applySnapshot);\n/**\n * `types.model` - Creates a new model type by providing a name, properties, volatile state and actions.\n *\n * See the [model type](/concepts/trees#creating-models) description or the [getting started](intro/getting-started.md#getting-started-1) tutorial.\n */\nfunction model() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n if (devMode() && typeof args[0] !== \"string\" && args[1]) {\n throw fail(\"Model creation failed. First argument must be a string when two arguments are provided\");\n }\n var name = typeof args[0] === \"string\" ? args.shift() : \"AnonymousModel\";\n var properties = args.shift() || {};\n return new ModelType({ name: name, properties: properties });\n}\n/**\n * `types.compose` - Composes a new model from one or more existing model types.\n * This method can be invoked in two forms:\n * Given 2 or more model types, the types are composed into a new Type.\n * Given first parameter as a string and 2 or more model types,\n * the types are composed into a new Type with the given name\n */\nfunction compose() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n // TODO: just join the base type names if no name is provided\n var hasTypename = typeof args[0] === \"string\";\n var typeName = hasTypename ? args[0] : \"AnonymousModel\";\n if (hasTypename) {\n args.shift();\n }\n // check all parameters\n if (devMode()) {\n args.forEach(function (type, i) {\n assertArg(type, isModelType, \"mobx-state-tree model type\", hasTypename ? i + 2 : i + 1);\n });\n }\n return args\n .reduce(function (prev, cur) {\n return prev.cloneAndEnhance({\n name: prev.name + \"_\" + cur.name,\n properties: cur.properties,\n initializers: cur.initializers,\n preProcessor: function (snapshot) {\n return cur.applySnapshotPreProcessor(prev.applySnapshotPreProcessor(snapshot));\n },\n postProcessor: function (snapshot) {\n return cur.applySnapshotPostProcessor(prev.applySnapshotPostProcessor(snapshot));\n }\n });\n })\n .named(typeName);\n}\n/**\n * Returns if a given value represents a model type.\n *\n * @param type\n * @returns\n */\nfunction isModelType(type) {\n return isType(type) && (type.flags & TypeFlags.Object) > 0;\n}\n\n// TODO: implement CoreType using types.custom ?\n/**\n * @internal\n * @hidden\n */\nvar CoreType = /** @class */ (function (_super) {\n __extends(CoreType, _super);\n function CoreType(name, flags, checker, initializer) {\n if (initializer === void 0) { initializer = identity; }\n var _this = _super.call(this, name) || this;\n Object.defineProperty(_this, \"flags\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: flags\n });\n Object.defineProperty(_this, \"checker\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: checker\n });\n Object.defineProperty(_this, \"initializer\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: initializer\n });\n _this.flags = flags;\n return _this;\n }\n Object.defineProperty(CoreType.prototype, \"describe\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function () {\n return this.name;\n }\n });\n Object.defineProperty(CoreType.prototype, \"instantiate\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (parent, subpath, environment, initialValue) {\n return createScalarNode(this, parent, subpath, environment, initialValue);\n }\n });\n Object.defineProperty(CoreType.prototype, \"createNewInstance\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (snapshot) {\n return this.initializer(snapshot);\n }\n });\n Object.defineProperty(CoreType.prototype, \"isValidSnapshot\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (value, context) {\n if (isPrimitive(value) && this.checker(value)) {\n return typeCheckSuccess();\n }\n var typeName = this.name === \"Date\" ? \"Date or a unix milliseconds timestamp\" : this.name;\n return typeCheckFailure(context, value, \"Value is not a \" + typeName);\n }\n });\n return CoreType;\n}(SimpleType));\n/**\n * `types.string` - Creates a type that can only contain a string value.\n * This type is used for string values by default\n *\n * Example:\n * ```ts\n * const Person = types.model({\n * firstName: types.string,\n * lastName: \"Doe\"\n * })\n * ```\n */\n// tslint:disable-next-line:variable-name\nvar string = new CoreType(\"string\", TypeFlags.String, function (v) { return typeof v === \"string\"; });\n/**\n * `types.number` - Creates a type that can only contain a numeric value.\n * This type is used for numeric values by default\n *\n * Example:\n * ```ts\n * const Vector = types.model({\n * x: types.number,\n * y: 1.5\n * })\n * ```\n */\n// tslint:disable-next-line:variable-name\nvar number = new CoreType(\"number\", TypeFlags.Number, function (v) { return typeof v === \"number\"; });\n/**\n * `types.integer` - Creates a type that can only contain an integer value.\n *\n * Example:\n * ```ts\n * const Size = types.model({\n * width: types.integer,\n * height: 10\n * })\n * ```\n */\n// tslint:disable-next-line:variable-name\nvar integer = new CoreType(\"integer\", TypeFlags.Integer, function (v) { return isInteger(v); });\n/**\n * `types.float` - Creates a type that can only contain an float value.\n *\n * Example:\n * ```ts\n * const Size = types.model({\n * width: types.float,\n * height: 10\n * })\n * ```\n */\n// tslint:disable-next-line:variable-name\nvar float = new CoreType(\"float\", TypeFlags.Float, function (v) { return isFloat(v); });\n/**\n * `types.finite` - Creates a type that can only contain an finite value.\n *\n * Example:\n * ```ts\n * const Size = types.model({\n * width: types.finite,\n * height: 10\n * })\n * ```\n */\n// tslint:disable-next-line:variable-name\nvar finite = new CoreType(\"finite\", TypeFlags.Finite, function (v) { return isFinite(v); });\n/**\n * `types.boolean` - Creates a type that can only contain a boolean value.\n * This type is used for boolean values by default\n *\n * Example:\n * ```ts\n * const Thing = types.model({\n * isCool: types.boolean,\n * isAwesome: false\n * })\n * ```\n */\n// tslint:disable-next-line:variable-name\nvar boolean = new CoreType(\"boolean\", TypeFlags.Boolean, function (v) { return typeof v === \"boolean\"; });\n/**\n * `types.null` - The type of the value `null`\n */\nvar nullType = new CoreType(\"null\", TypeFlags.Null, function (v) { return v === null; });\n/**\n * `types.undefined` - The type of the value `undefined`\n */\nvar undefinedType = new CoreType(\"undefined\", TypeFlags.Undefined, function (v) { return v === undefined; });\nvar _DatePrimitive = new CoreType(\"Date\", TypeFlags.Date, function (v) { return typeof v === \"number\" || v instanceof Date; }, function (v) { return (v instanceof Date ? v : new Date(v)); });\n_DatePrimitive.getSnapshot = function (node) {\n return node.storedValue.getTime();\n};\n/**\n * `types.Date` - Creates a type that can only contain a javascript Date value.\n *\n * Example:\n * ```ts\n * const LogLine = types.model({\n * timestamp: types.Date,\n * })\n *\n * LogLine.create({ timestamp: new Date() })\n * ```\n */\nvar DatePrimitive = _DatePrimitive;\n/**\n * @internal\n * @hidden\n */\nfunction getPrimitiveFactoryFromValue(value) {\n switch (typeof value) {\n case \"string\":\n return string;\n case \"number\":\n return number; // In the future, isInteger(value) ? integer : number would be interesting, but would be too breaking for now\n case \"boolean\":\n return boolean;\n case \"object\":\n if (value instanceof Date)\n return DatePrimitive;\n }\n throw fail(\"Cannot determine primitive type from value \" + value);\n}\n/**\n * Returns if a given value represents a primitive type.\n *\n * @param type\n * @returns\n */\nfunction isPrimitiveType(type) {\n return (isType(type) &&\n (type.flags &\n (TypeFlags.String |\n TypeFlags.Number |\n TypeFlags.Integer |\n TypeFlags.Boolean |\n TypeFlags.Date)) >\n 0);\n}\n\n/**\n * @internal\n * @hidden\n */\nvar Literal = /** @class */ (function (_super) {\n __extends(Literal, _super);\n function Literal(value) {\n var _this = _super.call(this, JSON.stringify(value)) || this;\n Object.defineProperty(_this, \"value\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(_this, \"flags\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: TypeFlags.Literal\n });\n _this.value = value;\n return _this;\n }\n Object.defineProperty(Literal.prototype, \"instantiate\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (parent, subpath, environment, initialValue) {\n return createScalarNode(this, parent, subpath, environment, initialValue);\n }\n });\n Object.defineProperty(Literal.prototype, \"describe\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function () {\n return JSON.stringify(this.value);\n }\n });\n Object.defineProperty(Literal.prototype, \"isValidSnapshot\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (value, context) {\n if (isPrimitive(value) && value === this.value) {\n return typeCheckSuccess();\n }\n return typeCheckFailure(context, value, \"Value is not a literal \" + JSON.stringify(this.value));\n }\n });\n return Literal;\n}(SimpleType));\n/**\n * `types.literal` - The literal type will return a type that will match only the exact given type.\n * The given value must be a primitive, in order to be serialized to a snapshot correctly.\n * You can use literal to match exact strings for example the exact male or female string.\n *\n * Example:\n * ```ts\n * const Person = types.model({\n * name: types.string,\n * gender: types.union(types.literal('male'), types.literal('female'))\n * })\n * ```\n *\n * @param value The value to use in the strict equal check\n * @returns\n */\nfunction literal(value) {\n // check that the given value is a primitive\n assertArg(value, isPrimitive, \"primitive\", 1);\n return new Literal(value);\n}\n/**\n * Returns if a given value represents a literal type.\n *\n * @param type\n * @returns\n */\nfunction isLiteralType(type) {\n return isType(type) && (type.flags & TypeFlags.Literal) > 0;\n}\n\nvar Refinement = /** @class */ (function (_super) {\n __extends(Refinement, _super);\n function Refinement(name, _subtype, _predicate, _message) {\n var _this = _super.call(this, name) || this;\n Object.defineProperty(_this, \"_subtype\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: _subtype\n });\n Object.defineProperty(_this, \"_predicate\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: _predicate\n });\n Object.defineProperty(_this, \"_message\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: _message\n });\n return _this;\n }\n Object.defineProperty(Refinement.prototype, \"flags\", {\n get: function () {\n return this._subtype.flags | TypeFlags.Refinement;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Refinement.prototype, \"describe\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function () {\n return this.name;\n }\n });\n Object.defineProperty(Refinement.prototype, \"instantiate\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (parent, subpath, environment, initialValue) {\n // create the child type\n return this._subtype.instantiate(parent, subpath, environment, initialValue);\n }\n });\n Object.defineProperty(Refinement.prototype, \"isAssignableFrom\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (type) {\n return this._subtype.isAssignableFrom(type);\n }\n });\n Object.defineProperty(Refinement.prototype, \"isValidSnapshot\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (value, context) {\n var subtypeErrors = this._subtype.validate(value, context);\n if (subtypeErrors.length > 0)\n return subtypeErrors;\n var snapshot = isStateTreeNode(value) ? getStateTreeNode(value).snapshot : value;\n if (!this._predicate(snapshot)) {\n return typeCheckFailure(context, value, this._message(value));\n }\n return typeCheckSuccess();\n }\n });\n Object.defineProperty(Refinement.prototype, \"reconcile\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (current, newValue, parent, subpath) {\n return this._subtype.reconcile(current, newValue, parent, subpath);\n }\n });\n Object.defineProperty(Refinement.prototype, \"getSubTypes\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function () {\n return this._subtype;\n }\n });\n return Refinement;\n}(BaseType));\n/**\n * `types.refinement` - Creates a type that is more specific than the base type, e.g. `types.refinement(types.string, value => value.length > 5)` to create a type of strings that can only be longer then 5.\n *\n * @param name\n * @param type\n * @param predicate\n * @returns\n */\nfunction refinement() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var name = typeof args[0] === \"string\" ? args.shift() : isType(args[0]) ? args[0].name : null;\n var type = args[0];\n var predicate = args[1];\n var message = args[2] ? args[2] : function (v) { return \"Value does not respect the refinement predicate\"; };\n // ensures all parameters are correct\n assertIsType(type, [1, 2]);\n assertIsString(name, 1);\n assertIsFunction(predicate, [2, 3]);\n assertIsFunction(message, [3, 4]);\n return new Refinement(name, type, predicate, message);\n}\n/**\n * Returns if a given value is a refinement type.\n *\n * @param type\n * @returns\n */\nfunction isRefinementType(type) {\n return (type.flags & TypeFlags.Refinement) > 0;\n}\n\n/**\n * `types.enumeration` - Can be used to create an string based enumeration.\n * (note: this methods is just sugar for a union of string literals)\n *\n * Example:\n * ```ts\n * const TrafficLight = types.model({\n * color: types.enumeration(\"Color\", [\"Red\", \"Orange\", \"Green\"])\n * })\n * ```\n *\n * @param name descriptive name of the enumeration (optional)\n * @param options possible values this enumeration can have\n * @returns\n */\nfunction enumeration(name, options) {\n var realOptions = typeof name === \"string\" ? options : name;\n // check all options\n if (devMode()) {\n realOptions.forEach(function (option, i) {\n assertIsString(option, i + 1);\n });\n }\n var type = union.apply(void 0, __spread(realOptions.map(function (option) { return literal(\"\" + option); })));\n if (typeof name === \"string\")\n type.name = name;\n return type;\n}\n\n/**\n * @internal\n * @hidden\n */\nvar Union = /** @class */ (function (_super) {\n __extends(Union, _super);\n function Union(name, _types, options) {\n var _this = _super.call(this, name) || this;\n Object.defineProperty(_this, \"_types\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: _types\n });\n Object.defineProperty(_this, \"_dispatcher\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(_this, \"_eager\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: true\n });\n options = __assign({ eager: true, dispatcher: undefined }, options);\n _this._dispatcher = options.dispatcher;\n if (!options.eager)\n _this._eager = false;\n return _this;\n }\n Object.defineProperty(Union.prototype, \"flags\", {\n get: function () {\n var result = TypeFlags.Union;\n this._types.forEach(function (type) {\n result |= type.flags;\n });\n return result;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Union.prototype, \"isAssignableFrom\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (type) {\n return this._types.some(function (subType) { return subType.isAssignableFrom(type); });\n }\n });\n Object.defineProperty(Union.prototype, \"describe\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function () {\n return \"(\" + this._types.map(function (factory) { return factory.describe(); }).join(\" | \") + \")\";\n }\n });\n Object.defineProperty(Union.prototype, \"instantiate\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (parent, subpath, environment, initialValue) {\n var type = this.determineType(initialValue, undefined);\n if (!type)\n throw fail(\"No matching type for union \" + this.describe()); // can happen in prod builds\n return type.instantiate(parent, subpath, environment, initialValue);\n }\n });\n Object.defineProperty(Union.prototype, \"reconcile\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (current, newValue, parent, subpath) {\n var type = this.determineType(newValue, current.getReconciliationType());\n if (!type)\n throw fail(\"No matching type for union \" + this.describe()); // can happen in prod builds\n return type.reconcile(current, newValue, parent, subpath);\n }\n });\n Object.defineProperty(Union.prototype, \"determineType\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (value, reconcileCurrentType) {\n // try the dispatcher, if defined\n if (this._dispatcher) {\n return this._dispatcher(value);\n }\n // find the most accomodating type\n // if we are using reconciliation try the current node type first (fix for #1045)\n if (reconcileCurrentType) {\n if (reconcileCurrentType.is(value)) {\n return reconcileCurrentType;\n }\n return this._types.filter(function (t) { return t !== reconcileCurrentType; }).find(function (type) { return type.is(value); });\n }\n else {\n return this._types.find(function (type) { return type.is(value); });\n }\n }\n });\n Object.defineProperty(Union.prototype, \"isValidSnapshot\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (value, context) {\n if (this._dispatcher) {\n return this._dispatcher(value).validate(value, context);\n }\n var allErrors = [];\n var applicableTypes = 0;\n for (var i = 0; i < this._types.length; i++) {\n var type = this._types[i];\n var errors = type.validate(value, context);\n if (errors.length === 0) {\n if (this._eager)\n return typeCheckSuccess();\n else\n applicableTypes++;\n }\n else {\n allErrors.push(errors);\n }\n }\n if (applicableTypes === 1)\n return typeCheckSuccess();\n return typeCheckFailure(context, value, \"No type is applicable for the union\").concat(flattenTypeErrors(allErrors));\n }\n });\n Object.defineProperty(Union.prototype, \"getSubTypes\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function () {\n return this._types;\n }\n });\n return Union;\n}(BaseType));\n/**\n * `types.union` - Create a union of multiple types. If the correct type cannot be inferred unambiguously from a snapshot, provide a dispatcher function of the form `(snapshot) => Type`.\n *\n * @param optionsOrType\n * @param otherTypes\n * @returns\n */\nfunction union(optionsOrType) {\n var otherTypes = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n otherTypes[_i - 1] = arguments[_i];\n }\n var options = isType(optionsOrType) ? undefined : optionsOrType;\n var types = isType(optionsOrType) ? __spread([optionsOrType], otherTypes) : otherTypes;\n var name = \"(\" + types.map(function (type) { return type.name; }).join(\" | \") + \")\";\n // check all options\n if (devMode()) {\n if (options) {\n assertArg(options, function (o) { return isPlainObject(o); }, \"object { eager?: boolean, dispatcher?: Function }\", 1);\n }\n types.forEach(function (type, i) {\n assertIsType(type, options ? i + 2 : i + 1);\n });\n }\n return new Union(name, types, options);\n}\n/**\n * Returns if a given value represents a union type.\n *\n * @param type\n * @returns\n */\nfunction isUnionType(type) {\n return (type.flags & TypeFlags.Union) > 0;\n}\n\n/**\n * @hidden\n * @internal\n */\nvar OptionalValue = /** @class */ (function (_super) {\n __extends(OptionalValue, _super);\n function OptionalValue(_subtype, _defaultValue, optionalValues) {\n var _this = _super.call(this, _subtype.name) || this;\n Object.defineProperty(_this, \"_subtype\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: _subtype\n });\n Object.defineProperty(_this, \"_defaultValue\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: _defaultValue\n });\n Object.defineProperty(_this, \"optionalValues\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: optionalValues\n });\n return _this;\n }\n Object.defineProperty(OptionalValue.prototype, \"flags\", {\n get: function () {\n return this._subtype.flags | TypeFlags.Optional;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(OptionalValue.prototype, \"describe\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function () {\n return this._subtype.describe() + \"?\";\n }\n });\n Object.defineProperty(OptionalValue.prototype, \"instantiate\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (parent, subpath, environment, initialValue) {\n if (this.optionalValues.indexOf(initialValue) >= 0) {\n var defaultInstanceOrSnapshot = this.getDefaultInstanceOrSnapshot();\n return this._subtype.instantiate(parent, subpath, environment, defaultInstanceOrSnapshot);\n }\n return this._subtype.instantiate(parent, subpath, environment, initialValue);\n }\n });\n Object.defineProperty(OptionalValue.prototype, \"reconcile\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (current, newValue, parent, subpath) {\n return this._subtype.reconcile(current, this.optionalValues.indexOf(newValue) < 0 && this._subtype.is(newValue)\n ? newValue\n : this.getDefaultInstanceOrSnapshot(), parent, subpath);\n }\n });\n Object.defineProperty(OptionalValue.prototype, \"getDefaultInstanceOrSnapshot\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function () {\n var defaultInstanceOrSnapshot = typeof this._defaultValue === \"function\"\n ? this._defaultValue()\n : this._defaultValue;\n // while static values are already snapshots and checked on types.optional\n // generator functions must always be rechecked just in case\n if (typeof this._defaultValue === \"function\") {\n typecheckInternal(this, defaultInstanceOrSnapshot);\n }\n return defaultInstanceOrSnapshot;\n }\n });\n Object.defineProperty(OptionalValue.prototype, \"isValidSnapshot\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (value, context) {\n // defaulted values can be skipped\n if (this.optionalValues.indexOf(value) >= 0) {\n return typeCheckSuccess();\n }\n // bounce validation to the sub-type\n return this._subtype.validate(value, context);\n }\n });\n Object.defineProperty(OptionalValue.prototype, \"isAssignableFrom\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (type) {\n return this._subtype.isAssignableFrom(type);\n }\n });\n Object.defineProperty(OptionalValue.prototype, \"getSubTypes\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function () {\n return this._subtype;\n }\n });\n return OptionalValue;\n}(BaseType));\nfunction checkOptionalPreconditions(type, defaultValueOrFunction) {\n // make sure we never pass direct instances\n if (typeof defaultValueOrFunction !== \"function\" && isStateTreeNode(defaultValueOrFunction)) {\n throw fail(\"default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead\");\n }\n assertIsType(type, 1);\n if (devMode()) {\n // we only check default values if they are passed directly\n // if they are generator functions they will be checked once they are generated\n // we don't check generator function results here to avoid generating a node just for type-checking purposes\n // which might generate side-effects\n if (typeof defaultValueOrFunction !== \"function\") {\n typecheckInternal(type, defaultValueOrFunction);\n }\n }\n}\n/**\n * `types.optional` - Can be used to create a property with a default value.\n *\n * Depending on the third argument (`optionalValues`) there are two ways of operation:\n * - If the argument is not provided, then if a value is not provided in the snapshot (`undefined` or missing),\n * it will default to the provided `defaultValue`\n * - If the argument is provided, then if the value in the snapshot matches one of the optional values inside the array then it will\n * default to the provided `defaultValue`. Additionally, if one of the optional values inside the array is `undefined` then a missing\n * property is also valid.\n *\n * Note that it is also possible to include values of the same type as the intended subtype as optional values,\n * in this case the optional value will be transformed into the `defaultValue` (e.g. `types.optional(types.string, \"unnamed\", [undefined, \"\"])`\n * will transform the snapshot values `undefined` (and therefore missing) and empty strings into the string `\"unnamed\"` when it gets\n * instantiated).\n *\n * If `defaultValue` is a function, the function will be invoked for every new instance.\n * Applying a snapshot in which the optional value is one of the optional values (or `undefined`/_not_ present if none are provided) causes the\n * value to be reset.\n *\n * Example:\n * ```ts\n * const Todo = types.model({\n * title: types.string,\n * subtitle1: types.optional(types.string, \"\", [null]),\n * subtitle2: types.optional(types.string, \"\", [null, undefined]),\n * done: types.optional(types.boolean, false),\n * created: types.optional(types.Date, () => new Date()),\n * })\n *\n * // if done is missing / undefined it will become false\n * // if created is missing / undefined it will get a freshly generated timestamp\n * // if subtitle1 is null it will default to \"\", but it cannot be missing or undefined\n * // if subtitle2 is null or undefined it will default to \"\"; since it can be undefined it can also be missing\n * const todo = Todo.create({ title: \"Get coffee\", subtitle1: null })\n * ```\n *\n * @param type\n * @param defaultValueOrFunction\n * @param optionalValues an optional array with zero or more primitive values (string, number, boolean, null or undefined)\n * that will be converted into the default. `[ undefined ]` is assumed when none is provided\n * @returns\n */\nfunction optional(type, defaultValueOrFunction, optionalValues) {\n checkOptionalPreconditions(type, defaultValueOrFunction);\n return new OptionalValue(type, defaultValueOrFunction, optionalValues ? optionalValues : undefinedAsOptionalValues);\n}\nvar undefinedAsOptionalValues = [undefined];\n/**\n * Returns if a value represents an optional type.\n *\n * @template IT\n * @param type\n * @returns\n */\nfunction isOptionalType(type) {\n return isType(type) && (type.flags & TypeFlags.Optional) > 0;\n}\n\nvar optionalUndefinedType = optional(undefinedType, undefined);\nvar optionalNullType = optional(nullType, null);\n/**\n * `types.maybe` - Maybe will make a type nullable, and also optional.\n * The value `undefined` will be used to represent nullability.\n *\n * @param type\n * @returns\n */\nfunction maybe(type) {\n assertIsType(type, 1);\n return union(type, optionalUndefinedType);\n}\n/**\n * `types.maybeNull` - Maybe will make a type nullable, and also optional.\n * The value `null` will be used to represent no value.\n *\n * @param type\n * @returns\n */\nfunction maybeNull(type) {\n assertIsType(type, 1);\n return union(type, optionalNullType);\n}\n\nvar Late = /** @class */ (function (_super) {\n __extends(Late, _super);\n function Late(name, _definition) {\n var _this = _super.call(this, name) || this;\n Object.defineProperty(_this, \"_definition\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: _definition\n });\n Object.defineProperty(_this, \"_subType\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n return _this;\n }\n Object.defineProperty(Late.prototype, \"flags\", {\n get: function () {\n return (this._subType ? this._subType.flags : 0) | TypeFlags.Late;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Late.prototype, \"getSubType\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (mustSucceed) {\n if (!this._subType) {\n var t = undefined;\n try {\n t = this._definition();\n }\n catch (e) {\n if (e instanceof ReferenceError)\n // can happen in strict ES5 code when a definition is self refering\n t = undefined;\n else\n throw e;\n }\n if (mustSucceed && t === undefined)\n throw fail(\"Late type seems to be used too early, the definition (still) returns undefined\");\n if (t) {\n if (devMode() && !isType(t))\n throw fail(\"Failed to determine subtype, make sure types.late returns a type definition.\");\n this._subType = t;\n }\n }\n return this._subType;\n }\n });\n Object.defineProperty(Late.prototype, \"instantiate\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (parent, subpath, environment, initialValue) {\n return this.getSubType(true).instantiate(parent, subpath, environment, initialValue);\n }\n });\n Object.defineProperty(Late.prototype, \"reconcile\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (current, newValue, parent, subpath) {\n return this.getSubType(true).reconcile(current, newValue, parent, subpath);\n }\n });\n Object.defineProperty(Late.prototype, \"describe\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function () {\n var t = this.getSubType(false);\n return t ? t.name : \"<uknown late type>\";\n }\n });\n Object.defineProperty(Late.prototype, \"isValidSnapshot\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (value, context) {\n var t = this.getSubType(false);\n if (!t) {\n // See #916; the variable the definition closure is pointing to wasn't defined yet, so can't be evaluted yet here\n return typeCheckSuccess();\n }\n return t.validate(value, context);\n }\n });\n Object.defineProperty(Late.prototype, \"isAssignableFrom\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (type) {\n var t = this.getSubType(false);\n return t ? t.isAssignableFrom(type) : false;\n }\n });\n Object.defineProperty(Late.prototype, \"getSubTypes\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function () {\n var subtype = this.getSubType(false);\n return subtype ? subtype : cannotDetermineSubtype;\n }\n });\n return Late;\n}(BaseType));\n/**\n * `types.late` - Defines a type that gets implemented later. This is useful when you have to deal with circular dependencies.\n * Please notice that when defining circular dependencies TypeScript isn't smart enough to inference them.\n *\n * Example:\n * ```ts\n * // TypeScript isn't smart enough to infer self referencing types.\n * const Node = types.model({\n * children: types.array(types.late((): IAnyModelType => Node)) // then typecast each array element to Instance<typeof Node>\n * })\n * ```\n *\n * @param name The name to use for the type that will be returned.\n * @param type A function that returns the type that will be defined.\n * @returns\n */\nfunction late(nameOrType, maybeType) {\n var name = typeof nameOrType === \"string\" ? nameOrType : \"late(\" + nameOrType.toString() + \")\";\n var type = typeof nameOrType === \"string\" ? maybeType : nameOrType;\n // checks that the type is actually a late type\n if (devMode()) {\n if (!(typeof type === \"function\" && type.length === 0))\n throw fail(\"Invalid late type, expected a function with zero arguments that returns a type, got: \" +\n type);\n }\n return new Late(name, type);\n}\n/**\n * Returns if a given value represents a late type.\n *\n * @param type\n * @returns\n */\nfunction isLateType(type) {\n return isType(type) && (type.flags & TypeFlags.Late) > 0;\n}\n\nfunction lazy(name, options) {\n // TODO: fix this unknown casting to be stricter\n return new Lazy(name, options);\n}\n/**\n * @internal\n * @hidden\n */\nvar Lazy = /** @class */ (function (_super) {\n __extends(Lazy, _super);\n function Lazy(name, options) {\n var _this = _super.call(this, name) || this;\n Object.defineProperty(_this, \"options\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: options\n });\n Object.defineProperty(_this, \"flags\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: TypeFlags.Lazy\n });\n Object.defineProperty(_this, \"loadedType\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: null\n });\n Object.defineProperty(_this, \"pendingNodeList\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: observable.array()\n });\n when(function () {\n return _this.pendingNodeList.length > 0 &&\n _this.pendingNodeList.some(function (node) {\n return node.isAlive && _this.options.shouldLoadPredicate(node.parent ? node.parent.value : null);\n });\n }, function () {\n _this.options.loadType().then(action(function (type) {\n _this.loadedType = type;\n _this.pendingNodeList.forEach(function (node) {\n if (!node.parent)\n return;\n if (!_this.loadedType)\n return;\n node.parent.applyPatches([\n {\n op: \"replace\",\n path: \"/\" + node.subpath,\n value: node.snapshot\n }\n ]);\n });\n }));\n });\n return _this;\n }\n Object.defineProperty(Lazy.prototype, \"describe\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function () {\n return \"<lazy \" + this.name + \">\";\n }\n });\n Object.defineProperty(Lazy.prototype, \"instantiate\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (parent, subpath, environment, value) {\n var _this = this;\n if (this.loadedType) {\n return this.loadedType.instantiate(parent, subpath, environment, value);\n }\n var node = createScalarNode(this, parent, subpath, environment, deepFreeze(value));\n this.pendingNodeList.push(node);\n when(function () { return !node.isAlive; }, function () { return _this.pendingNodeList.splice(_this.pendingNodeList.indexOf(node), 1); });\n return node;\n }\n });\n Object.defineProperty(Lazy.prototype, \"isValidSnapshot\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (value, context) {\n if (this.loadedType) {\n return this.loadedType.validate(value, context);\n }\n if (!isSerializable(value)) {\n return typeCheckFailure(context, value, \"Value is not serializable and cannot be lazy\");\n }\n return typeCheckSuccess();\n }\n });\n Object.defineProperty(Lazy.prototype, \"reconcile\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (current, value, parent, subpath) {\n if (this.loadedType) {\n current.die();\n return this.loadedType.instantiate(parent, subpath, parent.environment, value);\n }\n return _super.prototype.reconcile.call(this, current, value, parent, subpath);\n }\n });\n return Lazy;\n}(SimpleType));\n\n/**\n * @internal\n * @hidden\n */\nvar Frozen = /** @class */ (function (_super) {\n __extends(Frozen, _super);\n function Frozen(subType) {\n var _this = _super.call(this, subType ? \"frozen(\" + subType.name + \")\" : \"frozen\") || this;\n Object.defineProperty(_this, \"subType\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: subType\n });\n Object.defineProperty(_this, \"flags\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: TypeFlags.Frozen\n });\n return _this;\n }\n Object.defineProperty(Frozen.prototype, \"describe\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function () {\n return \"<any immutable value>\";\n }\n });\n Object.defineProperty(Frozen.prototype, \"instantiate\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (parent, subpath, environment, value) {\n // create the node\n return createScalarNode(this, parent, subpath, environment, deepFreeze(value));\n }\n });\n Object.defineProperty(Frozen.prototype, \"isValidSnapshot\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (value, context) {\n if (!isSerializable(value)) {\n return typeCheckFailure(context, value, \"Value is not serializable and cannot be frozen\");\n }\n if (this.subType)\n return this.subType.validate(value, context);\n return typeCheckSuccess();\n }\n });\n return Frozen;\n}(SimpleType));\nvar untypedFrozenInstance = new Frozen();\n/**\n * `types.frozen` - Frozen can be used to store any value that is serializable in itself (that is valid JSON).\n * Frozen values need to be immutable or treated as if immutable. They need be serializable as well.\n * Values stored in frozen will snapshotted as-is by MST, and internal changes will not be tracked.\n *\n * This is useful to store complex, but immutable values like vectors etc. It can form a powerful bridge to parts of your application that should be immutable, or that assume data to be immutable.\n *\n * Note: if you want to store free-form state that is mutable, or not serializeable, consider using volatile state instead.\n *\n * Frozen properties can be defined in three different ways\n * 1. `types.frozen(SubType)` - provide a valid MST type and frozen will check if the provided data conforms the snapshot for that type\n * 2. `types.frozen({ someDefaultValue: true})` - provide a primitive value, object or array, and MST will infer the type from that object, and also make it the default value for the field\n * 3. `types.frozen<TypeScriptType>()` - provide a typescript type, to help in strongly typing the field (design time only)\n *\n * Example:\n * ```ts\n * const GameCharacter = types.model({\n * name: string,\n * location: types.frozen({ x: 0, y: 0})\n * })\n *\n * const hero = GameCharacter.create({\n * name: \"Mario\",\n * location: { x: 7, y: 4 }\n * })\n *\n * hero.location = { x: 10, y: 2 } // OK\n * hero.location.x = 7 // Not ok!\n * ```\n *\n * ```ts\n * type Point = { x: number, y: number }\n * const Mouse = types.model({\n * loc: types.frozen<Point>()\n * })\n * ```\n *\n * @param defaultValueOrType\n * @returns\n */\nfunction frozen(arg) {\n if (arguments.length === 0)\n return untypedFrozenInstance;\n else if (isType(arg))\n return new Frozen(arg);\n else\n return optional(untypedFrozenInstance, arg);\n}\n/**\n * Returns if a given value represents a frozen type.\n *\n * @param type\n * @returns\n */\nfunction isFrozenType(type) {\n return isType(type) && (type.flags & TypeFlags.Frozen) > 0;\n}\n\nfunction getInvalidationCause(hook) {\n switch (hook) {\n case Hook.beforeDestroy:\n return \"destroy\";\n case Hook.beforeDetach:\n return \"detach\";\n default:\n return undefined;\n }\n}\nvar StoredReference = /** @class */ (function () {\n function StoredReference(value, targetType) {\n Object.defineProperty(this, \"targetType\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: targetType\n });\n Object.defineProperty(this, \"identifier\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"node\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"resolvedReference\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n if (isValidIdentifier(value)) {\n this.identifier = value;\n }\n else if (isStateTreeNode(value)) {\n var targetNode = getStateTreeNode(value);\n if (!targetNode.identifierAttribute)\n throw fail(\"Can only store references with a defined identifier attribute.\");\n var id = targetNode.unnormalizedIdentifier;\n if (id === null || id === undefined) {\n throw fail(\"Can only store references to tree nodes with a defined identifier.\");\n }\n this.identifier = id;\n }\n else {\n throw fail(\"Can only store references to tree nodes or identifiers, got: '\" + value + \"'\");\n }\n }\n Object.defineProperty(StoredReference.prototype, \"updateResolvedReference\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (node) {\n var normalizedId = normalizeIdentifier(this.identifier);\n var root = node.root;\n var lastCacheModification = root.identifierCache.getLastCacheModificationPerId(normalizedId);\n if (!this.resolvedReference ||\n this.resolvedReference.lastCacheModification !== lastCacheModification) {\n var targetType = this.targetType;\n // reference was initialized with the identifier of the target\n var target = root.identifierCache.resolve(targetType, normalizedId);\n if (!target) {\n throw new InvalidReferenceError(\"[mobx-state-tree] Failed to resolve reference '\" + this.identifier + \"' to type '\" + this.targetType.name + \"' (from node: \" + node.path + \")\");\n }\n this.resolvedReference = {\n node: target,\n lastCacheModification: lastCacheModification\n };\n }\n }\n });\n Object.defineProperty(StoredReference.prototype, \"resolvedValue\", {\n get: function () {\n this.updateResolvedReference(this.node);\n return this.resolvedReference.node.value;\n },\n enumerable: false,\n configurable: true\n });\n return StoredReference;\n}());\n/**\n * @internal\n * @hidden\n */\nvar InvalidReferenceError = /** @class */ (function (_super) {\n __extends(InvalidReferenceError, _super);\n function InvalidReferenceError(m) {\n var _this = _super.call(this, m) || this;\n Object.setPrototypeOf(_this, InvalidReferenceError.prototype);\n return _this;\n }\n return InvalidReferenceError;\n}(Error));\n/**\n * @internal\n * @hidden\n */\nvar BaseReferenceType = /** @class */ (function (_super) {\n __extends(BaseReferenceType, _super);\n function BaseReferenceType(targetType, onInvalidated) {\n var _this = _super.call(this, \"reference(\" + targetType.name + \")\") || this;\n Object.defineProperty(_this, \"targetType\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: targetType\n });\n Object.defineProperty(_this, \"onInvalidated\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: onInvalidated\n });\n Object.defineProperty(_this, \"flags\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: TypeFlags.Reference\n });\n return _this;\n }\n Object.defineProperty(BaseReferenceType.prototype, \"describe\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function () {\n return this.name;\n }\n });\n Object.defineProperty(BaseReferenceType.prototype, \"isAssignableFrom\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (type) {\n return this.targetType.isAssignableFrom(type);\n }\n });\n Object.defineProperty(BaseReferenceType.prototype, \"isValidSnapshot\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (value, context) {\n return isValidIdentifier(value)\n ? typeCheckSuccess()\n : typeCheckFailure(context, value, \"Value is not a valid identifier, which is a string or a number\");\n }\n });\n Object.defineProperty(BaseReferenceType.prototype, \"fireInvalidated\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (cause, storedRefNode, referenceId, refTargetNode) {\n // to actually invalidate a reference we need an alive parent,\n // since it is a scalar value (immutable-ish) and we need to change it\n // from the parent\n var storedRefParentNode = storedRefNode.parent;\n if (!storedRefParentNode || !storedRefParentNode.isAlive) {\n return;\n }\n var storedRefParentValue = storedRefParentNode.storedValue;\n if (!storedRefParentValue) {\n return;\n }\n this.onInvalidated({\n cause: cause,\n parent: storedRefParentValue,\n invalidTarget: refTargetNode ? refTargetNode.storedValue : undefined,\n invalidId: referenceId,\n replaceRef: function (newRef) {\n applyPatch(storedRefNode.root.storedValue, {\n op: \"replace\",\n value: newRef,\n path: storedRefNode.path\n });\n },\n removeRef: function () {\n if (isModelType(storedRefParentNode.type)) {\n this.replaceRef(undefined);\n }\n else {\n applyPatch(storedRefNode.root.storedValue, {\n op: \"remove\",\n path: storedRefNode.path\n });\n }\n }\n });\n }\n });\n Object.defineProperty(BaseReferenceType.prototype, \"addTargetNodeWatcher\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (storedRefNode, referenceId) {\n var _this = this;\n // this will make sure the target node becomes created\n var refTargetValue = this.getValue(storedRefNode);\n if (!refTargetValue) {\n return undefined;\n }\n var refTargetNode = getStateTreeNode(refTargetValue);\n var hookHandler = function (_, refTargetNodeHook) {\n var cause = getInvalidationCause(refTargetNodeHook);\n if (!cause) {\n return;\n }\n _this.fireInvalidated(cause, storedRefNode, referenceId, refTargetNode);\n };\n var refTargetDetachHookDisposer = refTargetNode.registerHook(Hook.beforeDetach, hookHandler);\n var refTargetDestroyHookDisposer = refTargetNode.registerHook(Hook.beforeDestroy, hookHandler);\n return function () {\n refTargetDetachHookDisposer();\n refTargetDestroyHookDisposer();\n };\n }\n });\n Object.defineProperty(BaseReferenceType.prototype, \"watchTargetNodeForInvalidations\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (storedRefNode, identifier, customGetSet) {\n var _this = this;\n if (!this.onInvalidated) {\n return;\n }\n var onRefTargetDestroyedHookDisposer;\n // get rid of the watcher hook when the stored ref node is destroyed\n // detached is ignored since scalar nodes (where the reference resides) cannot be detached\n storedRefNode.registerHook(Hook.beforeDestroy, function () {\n if (onRefTargetDestroyedHookDisposer) {\n onRefTargetDestroyedHookDisposer();\n }\n });\n var startWatching = function (sync) {\n // re-create hook in case the stored ref gets reattached\n if (onRefTargetDestroyedHookDisposer) {\n onRefTargetDestroyedHookDisposer();\n }\n // make sure the target node is actually there and initialized\n var storedRefParentNode = storedRefNode.parent;\n var storedRefParentValue = storedRefParentNode && storedRefParentNode.storedValue;\n if (storedRefParentNode && storedRefParentNode.isAlive && storedRefParentValue) {\n var refTargetNodeExists = void 0;\n if (customGetSet) {\n refTargetNodeExists = !!customGetSet.get(identifier, storedRefParentValue);\n }\n else {\n refTargetNodeExists = storedRefNode.root.identifierCache.has(_this.targetType, normalizeIdentifier(identifier));\n }\n if (!refTargetNodeExists) {\n // we cannot change the reference in sync mode\n // since we are in the middle of a reconciliation/instantiation and the change would be overwritten\n // for those cases just let the wrong reference be assigned and fail upon usage\n // (like current references do)\n // this means that effectively this code will only run when it is created from a snapshot\n if (!sync) {\n _this.fireInvalidated(\"invalidSnapshotReference\", storedRefNode, identifier, null);\n }\n }\n else {\n onRefTargetDestroyedHookDisposer = _this.addTargetNodeWatcher(storedRefNode, identifier);\n }\n }\n };\n if (storedRefNode.state === NodeLifeCycle.FINALIZED) {\n // already attached, so the whole tree is ready\n startWatching(true);\n }\n else {\n if (!storedRefNode.isRoot) {\n // start watching once the whole tree is ready\n storedRefNode.root.registerHook(Hook.afterCreationFinalization, function () {\n // make sure to attach it so it can start listening\n if (storedRefNode.parent) {\n storedRefNode.parent.createObservableInstanceIfNeeded();\n }\n });\n }\n // start watching once the node is attached somewhere / parent changes\n storedRefNode.registerHook(Hook.afterAttach, function () {\n startWatching(false);\n });\n }\n }\n });\n return BaseReferenceType;\n}(SimpleType));\n/**\n * @internal\n * @hidden\n */\nvar IdentifierReferenceType = /** @class */ (function (_super) {\n __extends(IdentifierReferenceType, _super);\n function IdentifierReferenceType(targetType, onInvalidated) {\n return _super.call(this, targetType, onInvalidated) || this;\n }\n Object.defineProperty(IdentifierReferenceType.prototype, \"getValue\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (storedRefNode) {\n if (!storedRefNode.isAlive)\n return undefined;\n var storedRef = storedRefNode.storedValue;\n return storedRef.resolvedValue;\n }\n });\n Object.defineProperty(IdentifierReferenceType.prototype, \"getSnapshot\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (storedRefNode) {\n var ref = storedRefNode.storedValue;\n return ref.identifier;\n }\n });\n Object.defineProperty(IdentifierReferenceType.prototype, \"instantiate\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (parent, subpath, environment, initialValue) {\n var identifier = isStateTreeNode(initialValue) ? getIdentifier(initialValue) : initialValue;\n var storedRef = new StoredReference(initialValue, this.targetType);\n var storedRefNode = createScalarNode(this, parent, subpath, environment, storedRef);\n storedRef.node = storedRefNode;\n this.watchTargetNodeForInvalidations(storedRefNode, identifier, undefined);\n return storedRefNode;\n }\n });\n Object.defineProperty(IdentifierReferenceType.prototype, \"reconcile\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (current, newValue, parent, subpath) {\n if (!current.isDetaching && current.type === this) {\n var compareByValue = isStateTreeNode(newValue);\n var ref = current.storedValue;\n if ((!compareByValue && ref.identifier === newValue) ||\n (compareByValue && ref.resolvedValue === newValue)) {\n current.setParent(parent, subpath);\n return current;\n }\n }\n var newNode = this.instantiate(parent, subpath, undefined, newValue);\n current.die(); // noop if detaching\n return newNode;\n }\n });\n return IdentifierReferenceType;\n}(BaseReferenceType));\n/**\n * @internal\n * @hidden\n */\nvar CustomReferenceType = /** @class */ (function (_super) {\n __extends(CustomReferenceType, _super);\n function CustomReferenceType(targetType, options, onInvalidated) {\n var _this = _super.call(this, targetType, onInvalidated) || this;\n Object.defineProperty(_this, \"options\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: options\n });\n return _this;\n }\n Object.defineProperty(CustomReferenceType.prototype, \"getValue\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (storedRefNode) {\n if (!storedRefNode.isAlive)\n return undefined;\n var referencedNode = this.options.get(storedRefNode.storedValue, storedRefNode.parent ? storedRefNode.parent.storedValue : null);\n return referencedNode;\n }\n });\n Object.defineProperty(CustomReferenceType.prototype, \"getSnapshot\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (storedRefNode) {\n return storedRefNode.storedValue;\n }\n });\n Object.defineProperty(CustomReferenceType.prototype, \"instantiate\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (parent, subpath, environment, newValue) {\n var identifier = isStateTreeNode(newValue)\n ? this.options.set(newValue, parent ? parent.storedValue : null)\n : newValue;\n var storedRefNode = createScalarNode(this, parent, subpath, environment, identifier);\n this.watchTargetNodeForInvalidations(storedRefNode, identifier, this.options);\n return storedRefNode;\n }\n });\n Object.defineProperty(CustomReferenceType.prototype, \"reconcile\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (current, newValue, parent, subpath) {\n var newIdentifier = isStateTreeNode(newValue)\n ? this.options.set(newValue, current ? current.storedValue : null)\n : newValue;\n if (!current.isDetaching && current.type === this && current.storedValue === newIdentifier) {\n current.setParent(parent, subpath);\n return current;\n }\n var newNode = this.instantiate(parent, subpath, undefined, newIdentifier);\n current.die(); // noop if detaching\n return newNode;\n }\n });\n return CustomReferenceType;\n}(BaseReferenceType));\n/**\n * `types.reference` - Creates a reference to another type, which should have defined an identifier.\n * See also the [reference and identifiers](https://github.com/mobxjs/mobx-state-tree#references-and-identifiers) section.\n */\nfunction reference(subType, options) {\n assertIsType(subType, 1);\n if (devMode()) {\n if (arguments.length === 2 && typeof arguments[1] === \"string\") {\n // istanbul ignore next\n throw fail(\"References with base path are no longer supported. Please remove the base path.\");\n }\n }\n var getSetOptions = options ? options : undefined;\n var onInvalidated = options\n ? options.onInvalidated\n : undefined;\n if (getSetOptions && (getSetOptions.get || getSetOptions.set)) {\n if (devMode()) {\n if (!getSetOptions.get || !getSetOptions.set) {\n throw fail(\"reference options must either contain both a 'get' and a 'set' method or none of them\");\n }\n }\n return new CustomReferenceType(subType, {\n get: getSetOptions.get,\n set: getSetOptions.set\n }, onInvalidated);\n }\n else {\n return new IdentifierReferenceType(subType, onInvalidated);\n }\n}\n/**\n * Returns if a given value represents a reference type.\n *\n * @param type\n * @returns\n */\nfunction isReferenceType(type) {\n return (type.flags & TypeFlags.Reference) > 0;\n}\n/**\n * `types.safeReference` - A safe reference is like a standard reference, except that it accepts the undefined value by default\n * and automatically sets itself to undefined (when the parent is a model) / removes itself from arrays and maps\n * when the reference it is pointing to gets detached/destroyed.\n *\n * The optional options parameter object accepts a parameter named `acceptsUndefined`, which is set to true by default, so it is suitable\n * for model properties.\n * When used inside collections (arrays/maps), it is recommended to set this option to false so it can't take undefined as value,\n * which is usually the desired in those cases.\n * Additionally, the optional options parameter object accepts a parameter named `onInvalidated`, which will be called when the reference target node that the reference is pointing to is about to be detached/destroyed\n *\n * Strictly speaking it is a `types.maybe(types.reference(X))` (when `acceptsUndefined` is set to true, the default) and\n * `types.reference(X)` (when `acceptsUndefined` is set to false), both of them with a customized `onInvalidated` option.\n *\n * @param subType\n * @param options\n * @returns\n */\nfunction safeReference(subType, options) {\n var refType = reference(subType, __assign(__assign({}, options), { onInvalidated: function (ev) {\n if (options && options.onInvalidated) {\n options.onInvalidated(ev);\n }\n ev.removeRef();\n } }));\n if (options && options.acceptsUndefined === false) {\n return refType;\n }\n else {\n return maybe(refType);\n }\n}\n\nvar BaseIdentifierType = /** @class */ (function (_super) {\n __extends(BaseIdentifierType, _super);\n function BaseIdentifierType(name, validType) {\n var _this = _super.call(this, name) || this;\n Object.defineProperty(_this, \"validType\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: validType\n });\n Object.defineProperty(_this, \"flags\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: TypeFlags.Identifier\n });\n return _this;\n }\n Object.defineProperty(BaseIdentifierType.prototype, \"instantiate\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (parent, subpath, environment, initialValue) {\n if (!parent || !(parent.type instanceof ModelType))\n throw fail(\"Identifier types can only be instantiated as direct child of a model type\");\n return createScalarNode(this, parent, subpath, environment, initialValue);\n }\n });\n Object.defineProperty(BaseIdentifierType.prototype, \"reconcile\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (current, newValue, parent, subpath) {\n // we don't consider detaching here since identifier are scalar nodes, and scalar nodes cannot be detached\n if (current.storedValue !== newValue)\n throw fail(\"Tried to change identifier from '\" + current.storedValue + \"' to '\" + newValue + \"'. Changing identifiers is not allowed.\");\n current.setParent(parent, subpath);\n return current;\n }\n });\n Object.defineProperty(BaseIdentifierType.prototype, \"isValidSnapshot\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (value, context) {\n if (typeof value !== this.validType) {\n return typeCheckFailure(context, value, \"Value is not a valid \" + this.describe() + \", expected a \" + this.validType);\n }\n return typeCheckSuccess();\n }\n });\n return BaseIdentifierType;\n}(SimpleType));\n/**\n * @internal\n * @hidden\n */\nvar IdentifierType = /** @class */ (function (_super) {\n __extends(IdentifierType, _super);\n function IdentifierType() {\n var _this = _super.call(this, \"identifier\", \"string\") || this;\n Object.defineProperty(_this, \"flags\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: TypeFlags.Identifier\n });\n return _this;\n }\n Object.defineProperty(IdentifierType.prototype, \"describe\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function () {\n return \"identifier\";\n }\n });\n return IdentifierType;\n}(BaseIdentifierType));\n/**\n * @internal\n * @hidden\n */\nvar IdentifierNumberType = /** @class */ (function (_super) {\n __extends(IdentifierNumberType, _super);\n function IdentifierNumberType() {\n return _super.call(this, \"identifierNumber\", \"number\") || this;\n }\n Object.defineProperty(IdentifierNumberType.prototype, \"getSnapshot\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (node) {\n return node.storedValue;\n }\n });\n Object.defineProperty(IdentifierNumberType.prototype, \"describe\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function () {\n return \"identifierNumber\";\n }\n });\n return IdentifierNumberType;\n}(BaseIdentifierType));\n/**\n * `types.identifier` - Identifiers are used to make references, lifecycle events and reconciling works.\n * Inside a state tree, for each type can exist only one instance for each given identifier.\n * For example there couldn't be 2 instances of user with id 1. If you need more, consider using references.\n * Identifier can be used only as type property of a model.\n * This type accepts as parameter the value type of the identifier field that can be either string or number.\n *\n * Example:\n * ```ts\n * const Todo = types.model(\"Todo\", {\n * id: types.identifier,\n * title: types.string\n * })\n * ```\n *\n * @returns\n */\nvar identifier = new IdentifierType();\n/**\n * `types.identifierNumber` - Similar to `types.identifier`. This one will serialize from / to a number when applying snapshots\n *\n * Example:\n * ```ts\n * const Todo = types.model(\"Todo\", {\n * id: types.identifierNumber,\n * title: types.string\n * })\n * ```\n *\n * @returns\n */\nvar identifierNumber = new IdentifierNumberType();\n/**\n * Returns if a given value represents an identifier type.\n *\n * @param type\n * @returns\n */\nfunction isIdentifierType(type) {\n return isType(type) && (type.flags & TypeFlags.Identifier) > 0;\n}\n/**\n * @internal\n * @hidden\n */\nfunction normalizeIdentifier(id) {\n return \"\" + id;\n}\n/**\n * @internal\n * @hidden\n */\nfunction isValidIdentifier(id) {\n return typeof id === \"string\" || typeof id === \"number\";\n}\n/**\n * @internal\n * @hidden\n */\nfunction assertIsValidIdentifier(id, argNumber) {\n assertArg(id, isValidIdentifier, \"string or number (identifier)\", argNumber);\n}\n\n/**\n * `types.custom` - Creates a custom type. Custom types can be used for arbitrary immutable values, that have a serializable representation. For example, to create your own Date representation, Decimal type etc.\n *\n * The signature of the options is:\n * ```ts\n * export interface CustomTypeOptions<S, T> {\n * // Friendly name\n * name: string\n * // given a serialized value and environment, how to turn it into the target type\n * fromSnapshot(snapshot: S, env: any): T\n * // return the serialization of the current value\n * toSnapshot(value: T): S\n * // if true, this is a converted value, if false, it's a snapshot\n * isTargetType(value: T | S): value is T\n * // a non empty string is assumed to be a validation error\n * getValidationMessage?(snapshot: S): string\n * }\n * ```\n *\n * Example:\n * ```ts\n * const DecimalPrimitive = types.custom<string, Decimal>({\n * name: \"Decimal\",\n * fromSnapshot(value: string) {\n * return new Decimal(value)\n * },\n * toSnapshot(value: Decimal) {\n * return value.toString()\n * },\n * isTargetType(value: string | Decimal): boolean {\n * return value instanceof Decimal\n * },\n * getValidationMessage(value: string): string {\n * if (/^-?\\d+\\.\\d+$/.test(value)) return \"\" // OK\n * return `'${value}' doesn't look like a valid decimal number`\n * }\n * })\n *\n * const Wallet = types.model({\n * balance: DecimalPrimitive\n * })\n * ```\n *\n * @param options\n * @returns\n */\nfunction custom(options) {\n return new CustomType(options);\n}\n/**\n * @internal\n * @hidden\n */\nvar CustomType = /** @class */ (function (_super) {\n __extends(CustomType, _super);\n function CustomType(options) {\n var _this = _super.call(this, options.name) || this;\n Object.defineProperty(_this, \"options\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: options\n });\n Object.defineProperty(_this, \"flags\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: TypeFlags.Custom\n });\n return _this;\n }\n Object.defineProperty(CustomType.prototype, \"describe\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function () {\n return this.name;\n }\n });\n Object.defineProperty(CustomType.prototype, \"isValidSnapshot\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (value, context) {\n if (this.options.isTargetType(value))\n return typeCheckSuccess();\n var typeError = this.options.getValidationMessage(value);\n if (typeError) {\n return typeCheckFailure(context, value, \"Invalid value for type '\" + this.name + \"': \" + typeError);\n }\n return typeCheckSuccess();\n }\n });\n Object.defineProperty(CustomType.prototype, \"getSnapshot\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (node) {\n return this.options.toSnapshot(node.storedValue);\n }\n });\n Object.defineProperty(CustomType.prototype, \"instantiate\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (parent, subpath, environment, initialValue) {\n var valueToStore = this.options.isTargetType(initialValue)\n ? initialValue\n : this.options.fromSnapshot(initialValue, parent && parent.root.environment);\n return createScalarNode(this, parent, subpath, environment, valueToStore);\n }\n });\n Object.defineProperty(CustomType.prototype, \"reconcile\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (current, value, parent, subpath) {\n var isSnapshot = !this.options.isTargetType(value);\n // in theory customs use scalar nodes which cannot be detached, but still...\n if (!current.isDetaching) {\n var unchanged = current.type === this &&\n (isSnapshot ? value === current.snapshot : value === current.storedValue);\n if (unchanged) {\n current.setParent(parent, subpath);\n return current;\n }\n }\n var valueToStore = isSnapshot\n ? this.options.fromSnapshot(value, parent.root.environment)\n : value;\n var newNode = this.instantiate(parent, subpath, undefined, valueToStore);\n current.die(); // noop if detaching\n return newNode;\n }\n });\n return CustomType;\n}(SimpleType));\n\n// we import the types to re-export them inside types.\nvar types = {\n enumeration: enumeration,\n model: model,\n compose: compose,\n custom: custom,\n reference: reference,\n safeReference: safeReference,\n union: union,\n optional: optional,\n literal: literal,\n maybe: maybe,\n maybeNull: maybeNull,\n refinement: refinement,\n string: string,\n boolean: boolean,\n number: number,\n integer: integer,\n float: float,\n finite: finite,\n Date: DatePrimitive,\n map: map,\n array: array,\n frozen: frozen,\n identifier: identifier,\n identifierNumber: identifierNumber,\n late: late,\n lazy: lazy,\n undefined: undefinedType,\n null: nullType,\n snapshotProcessor: snapshotProcessor\n};\n\nexport { addDisposer, addMiddleware, applyAction, applyPatch, applySnapshot, cast, castFlowReturn, castToReferenceSnapshot, castToSnapshot, clone, createActionTrackingMiddleware, createActionTrackingMiddleware2, decorate, destroy, detach, escapeJsonPath, flow, getChildType, getEnv, getIdentifier, getLivelinessChecking, getMembers, getNodeId, getParent, getParentOfType, getPath, getPathParts, getPropertyMembers, getRelativePath, getRoot, getRunningActionContext, getSnapshot, getType, hasParent, hasParentOfType, isActionContextChildOf, isActionContextThisOrChildOf, isAlive, isArrayType, isFrozenType, isIdentifierType, isLateType, isLiteralType, isMapType, isModelType, isOptionalType, isPrimitiveType, isProtected, isReferenceType, isRefinementType, isRoot, isStateTreeNode, isType, isUnionType, isValidReference, joinJsonPath, onAction, onPatch, onSnapshot, process$1 as process, protect, recordActions, recordPatches, resolveIdentifier, resolvePath, setLivelinessChecking, setLivelynessChecking, splitJsonPath, types as t, toGenerator, toGeneratorFunction, tryReference, tryResolve, typecheck, types, unescapeJsonPath, unprotect, walk };\n","const niceErrors = {\n 0: `Invalid value for configuration 'enforceActions', expected 'never', 'always' or 'observed'`,\n 1(annotationType, key: PropertyKey) {\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(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(other) {\n return \"Cannot initialize from classes that inherit from Map: \" + other.constructor.name\n },\n 20(other) {\n return \"Cannot initialize map from \" + other\n },\n 21(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(thing) {\n return \"Cannot obtain administration from \" + thing\n },\n 25(property, name) {\n return `the entry '${property}' does not exist in the observable map '${name}'`\n },\n 26: \"please specify a property\",\n 27(property, name) {\n return `no observable property '${property.toString()}' found on the observable object '${name}'`\n },\n 28(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(name, derivation) {\n return `Cycle detected in computation ${name}: ${derivation}`\n },\n 33(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(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(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} as const\n\nconst errors: typeof niceErrors = __DEV__ ? niceErrors : ({} as any)\n\nexport function die(error: string | keyof typeof errors, ...args: any[]): never {\n if (__DEV__) {\n let e: any = typeof error === \"string\" ? error : errors[error]\n if (typeof e === \"function\") e = e.apply(null, args as any)\n throw new Error(`[MobX] ${e}`)\n }\n throw new Error(\n typeof error === \"number\"\n ? `[MobX] minified error nr: ${error}${\n args.length ? \" \" + args.map(String).join(\",\") : \"\"\n }. Find the full error at: https://github.com/mobxjs/mobx/blob/main/packages/mobx/src/errors.ts`\n : `[MobX] ${error}`\n )\n}\n","declare const window: any\ndeclare const self: any\n\nconst mockGlobal = {}\n\nexport function getGlobal() {\n if (typeof globalThis !== \"undefined\") {\n return globalThis\n }\n if (typeof window !== \"undefined\") {\n return window\n }\n if (typeof global !== \"undefined\") {\n return global\n }\n if (typeof self !== \"undefined\") {\n return self\n }\n return mockGlobal\n}\n","import { globalState, die } from \"../internal\"\n\n// We shorten anything used > 5 times\nexport const assign = Object.assign\nexport const getDescriptor = Object.getOwnPropertyDescriptor\nexport const defineProperty = Object.defineProperty\nexport const objectPrototype = Object.prototype\n\nexport const EMPTY_ARRAY = []\nObject.freeze(EMPTY_ARRAY)\n\nexport const EMPTY_OBJECT = {}\nObject.freeze(EMPTY_OBJECT)\n\nexport interface Lambda {\n (): void\n name?: string\n}\n\nconst hasProxy = typeof Proxy !== \"undefined\"\nconst plainObjectString = Object.toString()\n\nexport function assertProxies() {\n if (!hasProxy) {\n die(\n __DEV__\n ? \"`Proxy` objects are not available in the current environment. Please configure MobX to enable a fallback implementation.`\"\n : \"Proxy not available\"\n )\n }\n}\n\nexport function warnAboutProxyRequirement(msg: string) {\n if (__DEV__ && globalState.verifyProxies) {\n die(\n \"MobX is currently configured to be able to run in ES5 mode, but in ES5 MobX won't be able to \" +\n msg\n )\n }\n}\n\nexport function getNextId() {\n return ++globalState.mobxGuid\n}\n\n/**\n * Makes sure that the provided function is invoked at most once.\n */\nexport function once(func: Lambda): Lambda {\n let invoked = false\n return function () {\n if (invoked) {\n return\n }\n invoked = true\n return (func as any).apply(this, arguments)\n }\n}\n\nexport const noop = () => {}\n\nexport function isFunction(fn: any): fn is Function {\n return typeof fn === \"function\"\n}\n\nexport function isString(value: any): value is string {\n return typeof value === \"string\"\n}\n\nexport function isStringish(value: any): value is string | number | symbol {\n const t = typeof value\n switch (t) {\n case \"string\":\n case \"symbol\":\n case \"number\":\n return true\n }\n return false\n}\n\nexport function isObject(value: any): value is Object {\n return value !== null && typeof value === \"object\"\n}\n\nexport function isPlainObject(value: any) {\n if (!isObject(value)) {\n return false\n }\n const proto = Object.getPrototypeOf(value)\n if (proto == null) {\n return true\n }\n const protoConstructor = Object.hasOwnProperty.call(proto, \"constructor\") && proto.constructor\n return (\n typeof protoConstructor === \"function\" && protoConstructor.toString() === plainObjectString\n )\n}\n\n// https://stackoverflow.com/a/37865170\nexport function isGenerator(obj: any): boolean {\n const constructor = obj?.constructor\n if (!constructor) {\n return false\n }\n if (\n \"GeneratorFunction\" === constructor.name ||\n \"GeneratorFunction\" === constructor.displayName\n ) {\n return true\n }\n return false\n}\n\nexport function addHiddenProp(object: any, propName: PropertyKey, value: any) {\n defineProperty(object, propName, {\n enumerable: false,\n writable: true,\n configurable: true,\n value\n })\n}\n\nexport function addHiddenFinalProp(object: any, propName: PropertyKey, value: any) {\n defineProperty(object, propName, {\n enumerable: false,\n writable: false,\n configurable: true,\n value\n })\n}\n\nexport function createInstanceofPredicate<T>(\n name: string,\n theClass: new (...args: any[]) => T\n): (x: any) => x is T {\n const propName = \"isMobX\" + name\n theClass.prototype[propName] = true\n return function (x) {\n return isObject(x) && x[propName] === true\n } as any\n}\n\n/**\n * Yields true for both native and observable Map, even across different windows.\n */\nexport function isES6Map(thing: unknown): thing is Map<any, any> {\n return thing != null && Object.prototype.toString.call(thing) === \"[object Map]\"\n}\n\n/**\n * Makes sure a Map is an instance of non-inherited native or observable Map.\n */\nexport function isPlainES6Map(thing: Map<unknown, unknown>): boolean {\n const mapProto = Object.getPrototypeOf(thing)\n const objectProto = Object.getPrototypeOf(mapProto)\n const nullProto = Object.getPrototypeOf(objectProto)\n return nullProto === null\n}\n\n/**\n * Yields true for both native and observable Set, even across different windows.\n */\nexport function isES6Set(thing: unknown): thing is Set<any> {\n return thing != null && Object.prototype.toString.call(thing) === \"[object Set]\"\n}\n\nconst hasGetOwnPropertySymbols = typeof Object.getOwnPropertySymbols !== \"undefined\"\n\n/**\n * Returns the following: own enumerable keys and symbols.\n */\nexport function getPlainObjectKeys(object: any) {\n const 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 const symbols = Object.getOwnPropertySymbols(object)\n if (!symbols.length) {\n return keys\n }\n return [...keys, ...symbols.filter(s => objectPrototype.propertyIsEnumerable.call(object, s))]\n}\n\n// From Immer utils\n// Returns all own keys, including non-enumerable and symbolic\nexport const ownKeys: (target: any) => Array<string | symbol> =\n typeof Reflect !== \"undefined\" && Reflect.ownKeys\n ? Reflect.ownKeys\n : hasGetOwnPropertySymbols\n ? obj => Object.getOwnPropertyNames(obj).concat(Object.getOwnPropertySymbols(obj) as any)\n : /* istanbul ignore next */ Object.getOwnPropertyNames\n\nexport function stringifyKey(key: any): string {\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}\n\nexport function toPrimitive(value: any) {\n return value === null ? null : typeof value === \"object\" ? \"\" + value : value\n}\n\nexport function hasProp(target: Object, prop: PropertyKey): boolean {\n return objectPrototype.hasOwnProperty.call(target, prop)\n}\n\n// From Immer utils\nexport const getOwnPropertyDescriptors =\n Object.getOwnPropertyDescriptors ||\n function getOwnPropertyDescriptors(target: any) {\n // Polyfill needed for Hermes and IE, see https://github.com/facebook/hermes/issues/274\n const res: any = {}\n // Note: without polyfill for ownKeys, symbols won't be picked up\n ownKeys(target).forEach(key => {\n res[key] = getDescriptor(target, key)\n })\n return res\n }\n\nexport function getFlag(flags: number, mask: number) {\n return !!(flags & mask)\n}\n\nexport function setFlag(flags: number, mask: number, newValue: boolean): number {\n if (newValue) {\n flags |= mask\n } else {\n flags &= ~mask\n }\n return flags\n}\n","import { Annotation, addHiddenProp, AnnotationsMap, hasProp, die, isOverride } from \"../internal\"\n\nimport type { Decorator } from \"../types/decorator_fills\"\n\nexport const storedAnnotationsSymbol = Symbol(\"mobx-stored-annotations\")\n\n/**\n * Creates a function that acts as\n * - decorator\n * - annotation object\n */\nexport function createDecoratorAnnotation<D extends Decorator = Decorator>(\n annotation: Annotation\n): PropertyDecorator & Annotation & D {\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) as any\n}\n\n/**\n * Stores annotation to prototype,\n * so it can be inspected later by `makeObservable` called from constructor\n */\nexport function storeAnnotation(prototype: any, key: PropertyKey, annotation: Annotation) {\n if (!hasProp(prototype, storedAnnotationsSymbol)) {\n addHiddenProp(prototype, storedAnnotationsSymbol, {\n // Inherit annotations\n ...prototype[storedAnnotationsSymbol]\n })\n }\n // @override must override something\n if (__DEV__ && isOverride(annotation) && !hasProp(prototype[storedAnnotationsSymbol], key)) {\n const fieldName = `${prototype.constructor.name}.prototype.${key.toString()}`\n die(\n `'${fieldName}' is decorated with 'override', ` +\n `but no such decorated member was found on prototype.`\n )\n }\n // Cannot re-decorate\n assertNotDecorated(prototype, annotation, key)\n\n // Ignore override\n if (!isOverride(annotation)) {\n prototype[storedAnnotationsSymbol][key] = annotation\n }\n}\n\nfunction assertNotDecorated(prototype: object, annotation: Annotation, key: PropertyKey) {\n if (__DEV__ && !isOverride(annotation) && hasProp(prototype[storedAnnotationsSymbol], key)) {\n const fieldName = `${prototype.constructor.name}.prototype.${key.toString()}`\n const currentAnnotationType = prototype[storedAnnotationsSymbol][key].annotationType_\n const requestedAnnotationType = annotation.annotationType_\n die(\n `Cannot apply '@${requestedAnnotationType}' to '${fieldName}':` +\n `\\nThe field is already decorated with '@${currentAnnotationType}'.` +\n `\\nRe-decorating fields is not allowed.` +\n `\\nUse '@override' decorator for methods overridden by subclass.`\n )\n }\n}\n\n/**\n * Collects annotations from prototypes and stores them on target (instance)\n */\nexport function collectStoredAnnotations(target): AnnotationsMap<any, any> {\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, { ...target[storedAnnotationsSymbol] })\n }\n return target[storedAnnotationsSymbol]\n}\n\nexport function is20223Decorator(context): context is DecoratorContext {\n return typeof context == \"object\" && typeof context[\"kind\"] == \"string\"\n}\n\nexport function assert20223DecoratorType(\n context: DecoratorContext,\n types: DecoratorContext[\"kind\"][]\n) {\n if (__DEV__ && !types.includes(context.kind)) {\n die(\n `The decorator applied to '${String(context.name)}' cannot be used on a ${\n context.kind\n } element`\n )\n }\n}\n","import {\n die,\n Annotation,\n hasProp,\n createDecoratorAnnotation,\n ObservableObjectAdministration,\n MakeResult\n} from \"../internal\"\n\nimport type { ClassMethodDecorator } from \"./decorator_fills\"\n\nconst OVERRIDE = \"override\"\n\nexport const override: Annotation & PropertyDecorator & ClassMethodDecorator =\n createDecoratorAnnotation({\n annotationType_: OVERRIDE,\n make_,\n extend_,\n decorate_20223_\n })\n\nexport function isOverride(annotation: Annotation): boolean {\n return annotation.annotationType_ === OVERRIDE\n}\n\nfunction make_(this: Annotation, adm: ObservableObjectAdministration, key): MakeResult {\n // Must not be plain object\n if (__DEV__ && adm.isPlainObject_) {\n die(\n `Cannot apply '${this.annotationType_}' to '${adm.name_}.${key.toString()}':` +\n `\\n'${this.annotationType_}' cannot be used on plain objects.`\n )\n }\n // Must override something\n if (__DEV__ && !hasProp(adm.appliedAnnotations_!, key)) {\n die(\n `'${adm.name_}.${key.toString()}' is annotated with '${this.annotationType_}', ` +\n `but no such annotated member was found on prototype.`\n )\n }\n return MakeResult.Cancel\n}\n\nfunction extend_(this: Annotation, adm, key, descriptor, proxyTrap): boolean {\n die(`'${this.annotationType_}' can only be used with 'makeObservable'`)\n}\n\nfunction decorate_20223_(this: Annotation, desc, context: DecoratorContext) {\n console.warn(`'${this.annotationType_}' cannot be used with decorators - this is a no-op`)\n}\n","import {\n IDerivationState_,\n IObservable,\n IDerivation,\n createInstanceofPredicate,\n endBatch,\n getNextId,\n noop,\n onBecomeObserved,\n onBecomeUnobserved,\n propagateChanged,\n reportObserved,\n startBatch,\n Lambda\n} from \"../internal\"\n\nimport { getFlag, setFlag } from \"../utils/utils\"\n\nexport const $mobx = Symbol(\"mobx administration\")\n\nexport interface IAtom extends IObservable {\n reportObserved(): boolean\n reportChanged(): void\n}\n\nexport class Atom implements IAtom {\n private static readonly isBeingObservedMask_ = 0b001\n private static readonly isPendingUnobservationMask_ = 0b010\n private static readonly diffValueMask_ = 0b100\n private flags_ = 0b000\n\n observers_ = new Set<IDerivation>()\n\n lastAccessedBy_ = 0\n lowestObserverState_ = IDerivationState_.NOT_TRACKING_\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 constructor(public name_ = __DEV__ ? \"Atom@\" + getNextId() : \"Atom\") {}\n\n // for effective unobserving. BaseAtom has true, for extra optimization, so its onBecomeUnobserved never gets called, because it's not needed\n get isBeingObserved(): boolean {\n return getFlag(this.flags_, Atom.isBeingObservedMask_)\n }\n set isBeingObserved(newValue: boolean) {\n this.flags_ = setFlag(this.flags_, Atom.isBeingObservedMask_, newValue)\n }\n\n get isPendingUnobservation(): boolean {\n return getFlag(this.flags_, Atom.isPendingUnobservationMask_)\n }\n set isPendingUnobservation(newValue: boolean) {\n this.flags_ = setFlag(this.flags_, Atom.isPendingUnobservationMask_, newValue)\n }\n\n get diffValue(): 0 | 1 {\n return getFlag(this.flags_, Atom.diffValueMask_) ? 1 : 0\n }\n set diffValue(newValue: 0 | 1) {\n this.flags_ = setFlag(this.flags_, Atom.diffValueMask_, newValue === 1 ? true : false)\n }\n\n // onBecomeObservedListeners\n public onBOL: Set<Lambda> | undefined\n // onBecomeUnobservedListeners\n public onBUOL: Set<Lambda> | undefined\n\n public onBO() {\n if (this.onBOL) {\n this.onBOL.forEach(listener => listener())\n }\n }\n\n public onBUO() {\n if (this.onBUOL) {\n this.onBUOL.forEach(listener => 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 public reportObserved(): boolean {\n return reportObserved(this)\n }\n\n /**\n * Invoke this method _after_ this method has changed to signal mobx that all its observers should invalidate.\n */\n public reportChanged() {\n startBatch()\n propagateChanged(this)\n endBatch()\n }\n\n toString() {\n return this.name_\n }\n}\n\nexport const isAtom = createInstanceofPredicate(\"Atom\", Atom)\n\nexport function createAtom(\n name: string,\n onBecomeObservedHandler: () => void = noop,\n onBecomeUnobservedHandler: () => void = noop\n): IAtom {\n const atom = new Atom(name)\n // default `noop` listener will not initialize the hook Set\n if (onBecomeObservedHandler !== noop) {\n onBecomeObserved(atom, onBecomeObservedHandler)\n }\n\n if (onBecomeUnobservedHandler !== noop) {\n onBecomeUnobserved(atom, onBecomeUnobservedHandler)\n }\n return atom\n}\n","import { deepEqual } from \"../internal\"\n\nexport interface IEqualsComparer<T> {\n (a: T, b: T): boolean\n}\n\nfunction identityComparer(a: any, b: any): boolean {\n return a === b\n}\n\nfunction structuralComparer(a: any, b: any): boolean {\n return deepEqual(a, b)\n}\n\nfunction shallowComparer(a: any, b: any): boolean {\n return deepEqual(a, b, 1)\n}\n\nfunction defaultComparer(a: any, b: any): boolean {\n if (Object.is) {\n return Object.is(a, b)\n }\n\n return a === b ? a !== 0 || 1 / a === 1 / b : a !== a && b !== b\n}\n\nexport const comparer = {\n identity: identityComparer,\n structural: structuralComparer,\n default: defaultComparer,\n shallow: shallowComparer\n}\n","import {\n deepEqual,\n isES6Map,\n isES6Set,\n isObservable,\n isObservableArray,\n isObservableMap,\n isObservableSet,\n isObservableObject,\n isPlainObject,\n observable,\n die,\n isAction,\n autoAction,\n flow,\n isFlow,\n isGenerator\n} from \"../internal\"\n\nexport interface IEnhancer<T> {\n (newValue: T, oldValue: T | undefined, name: string): T\n}\n\nexport function deepEnhancer(v, _, name) {\n // it is an observable already, done\n if (isObservable(v)) {\n return v\n }\n\n // something that can be converted and mutated?\n if (Array.isArray(v)) {\n return observable.array(v, { name })\n }\n if (isPlainObject(v)) {\n return observable.object(v, undefined, { name })\n }\n if (isES6Map(v)) {\n return observable.map(v, { name })\n }\n if (isES6Set(v)) {\n return observable.set(v, { name })\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}\n\nexport function shallowEnhancer(v, _, name): any {\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, { name, deep: false })\n }\n if (isPlainObject(v)) {\n return observable.object(v, undefined, { name, deep: false })\n }\n if (isES6Map(v)) {\n return observable.map(v, { name, deep: false })\n }\n if (isES6Set(v)) {\n return observable.set(v, { name, deep: false })\n }\n\n if (__DEV__) {\n die(\n \"The shallow modifier / decorator can only used in combination with arrays, objects, maps and sets\"\n )\n }\n}\n\nexport function referenceEnhancer(newValue?) {\n // never turn into an observable\n return newValue\n}\n\nexport function refStructEnhancer(v, oldValue): any {\n if (__DEV__ && 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","import {\n ObservableObjectAdministration,\n createAction,\n isAction,\n defineProperty,\n die,\n isFunction,\n Annotation,\n globalState,\n MakeResult,\n assert20223DecoratorType,\n storeAnnotation\n} from \"../internal\"\n\nexport function createActionAnnotation(name: string, options?: object): Annotation {\n return {\n annotationType_: name,\n options_: options,\n make_,\n extend_,\n decorate_20223_\n }\n}\n\nfunction make_(\n this: Annotation,\n adm: ObservableObjectAdministration,\n key: PropertyKey,\n descriptor: PropertyDescriptor,\n source: object\n): MakeResult {\n // bound\n if (this.options_?.bound) {\n return this.extend_(adm, key, descriptor, false) === null\n ? MakeResult.Cancel\n : MakeResult.Break\n }\n // own\n if (source === adm.target_) {\n return this.extend_(adm, key, descriptor, false) === null\n ? MakeResult.Cancel\n : 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 MakeResult.Break\n }\n const actionDescriptor = createActionDescriptor(adm, this, key, descriptor, false)\n defineProperty(source, key, actionDescriptor)\n return MakeResult.Continue\n}\n\nfunction extend_(\n this: Annotation,\n adm: ObservableObjectAdministration,\n key: PropertyKey,\n descriptor: PropertyDescriptor,\n proxyTrap: boolean\n): boolean | null {\n const actionDescriptor = createActionDescriptor(adm, this, key, descriptor)\n return adm.defineProperty_(key, actionDescriptor, proxyTrap)\n}\n\nfunction decorate_20223_(this: Annotation, mthd, context: DecoratorContext) {\n if (__DEV__) {\n assert20223DecoratorType(context, [\"method\", \"field\"])\n }\n const { kind, name, addInitializer } = context\n const ann = this\n\n const _createAction = m =>\n createAction(ann.options_?.name ?? name!.toString(), m, ann.options_?.autoAction ?? 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\n if (kind == \"method\") {\n if (!isAction(mthd)) {\n mthd = _createAction(mthd)\n }\n\n if (this.options_?.bound) {\n addInitializer(function () {\n const self = this as any\n const bound = self[name].bind(self)\n bound.isMobxAction = true\n self[name] = bound\n })\n }\n\n return mthd\n }\n\n die(\n `Cannot apply '${ann.annotationType_}' to '${String(name)}' (kind: ${kind}):` +\n `\\n'${ann.annotationType_}' can only be used on properties with a function value.`\n )\n}\n\nfunction assertActionDescriptor(\n adm: ObservableObjectAdministration,\n { annotationType_ }: Annotation,\n key: PropertyKey,\n { value }: PropertyDescriptor\n) {\n if (__DEV__ && !isFunction(value)) {\n die(\n `Cannot apply '${annotationType_}' to '${adm.name_}.${key.toString()}':` +\n `\\n'${annotationType_}' can only be used on properties with a function value.`\n )\n }\n}\n\nexport function createActionDescriptor(\n adm: ObservableObjectAdministration,\n annotation: Annotation,\n key: PropertyKey,\n descriptor: PropertyDescriptor,\n // provides ability to disable safeDescriptors for prototypes\n safeDescriptors: boolean = globalState.safeDescriptors\n) {\n assertActionDescriptor(adm, annotation, key, descriptor)\n let { value } = descriptor\n if (annotation.options_?.bound) {\n value = value.bind(adm.proxy_ ?? adm.target_)\n }\n return {\n value: createAction(\n annotation.options_?.name ?? key.toString(),\n value,\n annotation.options_?.autoAction ?? false,\n // https://github.com/mobxjs/mobx/discussions/3140\n annotation.options_?.bound ? adm.proxy_ ?? adm.target_ : undefined\n ),\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","import {\n ObservableObjectAdministration,\n Annotation,\n defineProperty,\n die,\n flow,\n isFlow,\n isFunction,\n globalState,\n MakeResult,\n hasProp,\n assert20223DecoratorType\n} from \"../internal\"\n\nexport function createFlowAnnotation(name: string, options?: object): Annotation {\n return {\n annotationType_: name,\n options_: options,\n make_,\n extend_,\n decorate_20223_\n }\n}\n\nfunction make_(\n this: Annotation,\n adm: ObservableObjectAdministration,\n key: PropertyKey,\n descriptor: PropertyDescriptor,\n source: object\n): MakeResult {\n // own\n if (source === adm.target_) {\n return this.extend_(adm, key, descriptor, false) === null\n ? MakeResult.Cancel\n : MakeResult.Continue\n }\n // prototype\n // bound - must annotate protos to support super.flow()\n if (this.options_?.bound && (!hasProp(adm.target_, key) || !isFlow(adm.target_[key]))) {\n if (this.extend_(adm, key, descriptor, false) === null) {\n return 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 MakeResult.Break\n }\n const flowDescriptor = createFlowDescriptor(adm, this, key, descriptor, false, false)\n defineProperty(source, key, flowDescriptor)\n return MakeResult.Continue\n}\n\nfunction extend_(\n this: Annotation,\n adm: ObservableObjectAdministration,\n key: PropertyKey,\n descriptor: PropertyDescriptor,\n proxyTrap: boolean\n): boolean | null {\n const flowDescriptor = createFlowDescriptor(adm, this, key, descriptor, this.options_?.bound)\n return adm.defineProperty_(key, flowDescriptor, proxyTrap)\n}\n\nfunction decorate_20223_(this: Annotation, mthd, context: ClassMethodDecoratorContext) {\n if (__DEV__) {\n assert20223DecoratorType(context, [\"method\"])\n }\n const { name, addInitializer } = context\n\n if (!isFlow(mthd)) {\n mthd = flow(mthd)\n }\n\n if (this.options_?.bound) {\n addInitializer(function () {\n const self = this as any\n const bound = self[name].bind(self)\n bound.isMobXFlow = true\n self[name] = bound\n })\n }\n\n return mthd\n}\n\nfunction assertFlowDescriptor(\n adm: ObservableObjectAdministration,\n { annotationType_ }: Annotation,\n key: PropertyKey,\n { value }: PropertyDescriptor\n) {\n if (__DEV__ && !isFunction(value)) {\n die(\n `Cannot apply '${annotationType_}' to '${adm.name_}.${key.toString()}':` +\n `\\n'${annotationType_}' can only be used on properties with a generator function value.`\n )\n }\n}\n\nfunction createFlowDescriptor(\n adm: ObservableObjectAdministration,\n annotation: Annotation,\n key: PropertyKey,\n descriptor: PropertyDescriptor,\n bound: boolean,\n // provides ability to disable safeDescriptors for prototypes\n safeDescriptors: boolean = globalState.safeDescriptors\n): PropertyDescriptor {\n assertFlowDescriptor(adm, annotation, key, descriptor)\n let { value } = descriptor\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 // We do not keep original function around, so we bind the existing flow\n value = value.bind(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,\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","import {\n ObservableObjectAdministration,\n die,\n Annotation,\n MakeResult,\n assert20223DecoratorType,\n $mobx,\n asObservableObject,\n ComputedValue\n} from \"../internal\"\n\nexport function createComputedAnnotation(name: string, options?: object): Annotation {\n return {\n annotationType_: name,\n options_: options,\n make_,\n extend_,\n decorate_20223_\n }\n}\n\nfunction make_(\n this: Annotation,\n adm: ObservableObjectAdministration,\n key: PropertyKey,\n descriptor: PropertyDescriptor\n): MakeResult {\n return this.extend_(adm, key, descriptor, false) === null ? MakeResult.Cancel : MakeResult.Break\n}\n\nfunction extend_(\n this: Annotation,\n adm: ObservableObjectAdministration,\n key: PropertyKey,\n descriptor: PropertyDescriptor,\n proxyTrap: boolean\n): boolean | null {\n assertComputedDescriptor(adm, this, key, descriptor)\n return adm.defineComputedProperty_(\n key,\n {\n ...this.options_,\n get: descriptor.get,\n set: descriptor.set\n },\n proxyTrap\n )\n}\n\nfunction decorate_20223_(this: Annotation, get, context: ClassGetterDecoratorContext) {\n if (__DEV__) {\n assert20223DecoratorType(context, [\"getter\"])\n }\n const ann = this\n const { name: key, addInitializer } = context\n\n addInitializer(function () {\n const adm: ObservableObjectAdministration = asObservableObject(this)[$mobx]\n const options = {\n ...ann.options_,\n get,\n context: this\n }\n options.name ||= __DEV__\n ? `${adm.name_}.${key.toString()}`\n : `ObservableObject.${key.toString()}`\n adm.values_.set(key, new ComputedValue(options))\n })\n\n return function () {\n return this[$mobx].getObservablePropValue_(key)\n }\n}\n\nfunction assertComputedDescriptor(\n adm: ObservableObjectAdministration,\n { annotationType_ }: Annotation,\n key: PropertyKey,\n { get }: PropertyDescriptor\n) {\n if (__DEV__ && !get) {\n die(\n `Cannot apply '${annotationType_}' to '${adm.name_}.${key.toString()}':` +\n `\\n'${annotationType_}' can only be used on getter(+setter) properties.`\n )\n }\n}\n","import {\n ObservableObjectAdministration,\n deepEnhancer,\n die,\n Annotation,\n MakeResult,\n assert20223DecoratorType,\n ObservableValue,\n asObservableObject,\n $mobx\n} from \"../internal\"\n\nexport function createObservableAnnotation(name: string, options?: object): Annotation {\n return {\n annotationType_: name,\n options_: options,\n make_,\n extend_,\n decorate_20223_\n }\n}\n\nfunction make_(\n this: Annotation,\n adm: ObservableObjectAdministration,\n key: PropertyKey,\n descriptor: PropertyDescriptor\n): MakeResult {\n return this.extend_(adm, key, descriptor, false) === null ? MakeResult.Cancel : MakeResult.Break\n}\n\nfunction extend_(\n this: Annotation,\n adm: ObservableObjectAdministration,\n key: PropertyKey,\n descriptor: PropertyDescriptor,\n proxyTrap: boolean\n): boolean | null {\n assertObservableDescriptor(adm, this, key, descriptor)\n return adm.defineObservableProperty_(\n key,\n descriptor.value,\n this.options_?.enhancer ?? deepEnhancer,\n proxyTrap\n )\n}\n\nfunction decorate_20223_(\n this: Annotation,\n desc,\n context: ClassAccessorDecoratorContext | ClassFieldDecoratorContext\n) {\n if (__DEV__) {\n if (context.kind === \"field\") {\n throw die(\n `Please use \\`@observable accessor ${String(\n context.name\n )}\\` instead of \\`@observable ${String(context.name)}\\``\n )\n }\n assert20223DecoratorType(context, [\"accessor\"])\n }\n\n const ann = this\n const { kind, name } = context\n\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 const initializedObjects = new WeakSet()\n\n function initializeObservable(target, value) {\n const adm: ObservableObjectAdministration = asObservableObject(target)[$mobx]\n const observable = new ObservableValue(\n value,\n ann.options_?.enhancer ?? deepEnhancer,\n __DEV__ ? `${adm.name_}.${name.toString()}` : `ObservableObject.${name.toString()}`,\n false\n )\n adm.values_.set(name, observable)\n initializedObjects.add(target)\n }\n\n if (kind == \"accessor\") {\n return {\n get() {\n if (!initializedObjects.has(this)) {\n initializeObservable(this, desc.get.call(this))\n }\n return this[$mobx].getObservablePropValue_(name)\n },\n set(value) {\n if (!initializedObjects.has(this)) {\n initializeObservable(this, value)\n }\n return this[$mobx].setObservablePropValue_(name, value)\n },\n init(value) {\n if (!initializedObjects.has(this)) {\n initializeObservable(this, value)\n }\n return value\n }\n }\n }\n\n return\n}\n\nfunction assertObservableDescriptor(\n adm: ObservableObjectAdministration,\n { annotationType_ }: Annotation,\n key: PropertyKey,\n descriptor: PropertyDescriptor\n) {\n if (__DEV__ && !(\"value\" in descriptor)) {\n die(\n `Cannot apply '${annotationType_}' to '${adm.name_}.${key.toString()}':` +\n `\\n'${annotationType_}' cannot be used on getter/setter properties`\n )\n }\n}\n","import {\n ObservableObjectAdministration,\n observable,\n Annotation,\n defineProperty,\n createAction,\n globalState,\n flow,\n computed,\n autoAction,\n isGenerator,\n MakeResult,\n die\n} from \"../internal\"\n\nconst AUTO = \"true\"\n\nexport const autoAnnotation: Annotation = createAutoAnnotation()\n\nexport function createAutoAnnotation(options?: object): Annotation {\n return {\n annotationType_: AUTO,\n options_: options,\n make_,\n extend_,\n decorate_20223_\n }\n}\n\nfunction make_(\n adm: ObservableObjectAdministration,\n key: PropertyKey,\n descriptor: PropertyDescriptor,\n source: object\n): MakeResult {\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 const set = createAction(key.toString(), descriptor.set) as (v: any) => void\n // own\n if (source === adm.target_) {\n return adm.defineProperty_(key, {\n configurable: globalState.safeDescriptors ? adm.isPlainObject_ : true,\n set\n }) === null\n ? MakeResult.Cancel\n : MakeResult.Continue\n }\n // proto\n defineProperty(source, key, {\n configurable: true,\n set\n })\n return MakeResult.Continue\n }\n // function on proto -> autoAction/flow\n if (source !== adm.target_ && typeof descriptor.value === \"function\") {\n if (isGenerator(descriptor.value)) {\n const flowAnnotation = this.options_?.autoBind ? flow.bound : flow\n return flowAnnotation.make_(adm, key, descriptor, source)\n }\n const actionAnnotation = this.options_?.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 let observableAnnotation = this.options_?.deep === false ? observable.ref : observable\n // if function respect autoBind option\n if (typeof descriptor.value === \"function\" && this.options_?.autoBind) {\n descriptor.value = descriptor.value.bind(adm.proxy_ ?? adm.target_)\n }\n return observableAnnotation.make_(adm, key, descriptor, source)\n}\n\nfunction extend_(\n adm: ObservableObjectAdministration,\n key: PropertyKey,\n descriptor: PropertyDescriptor,\n proxyTrap: boolean\n): boolean | null {\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_(\n key,\n {\n configurable: globalState.safeDescriptors ? adm.isPlainObject_ : true,\n set: createAction(key.toString(), descriptor.set) as (v: any) => void\n },\n proxyTrap\n )\n }\n // other -> observable\n // if function respect autoBind option\n if (typeof descriptor.value === \"function\" && this.options_?.autoBind) {\n descriptor.value = descriptor.value.bind(adm.proxy_ ?? adm.target_)\n }\n let observableAnnotation = this.options_?.deep === false ? observable.ref : observable\n return observableAnnotation.extend_(adm, key, descriptor, proxyTrap)\n}\n\nfunction decorate_20223_(this: Annotation, desc, context: ClassGetterDecoratorContext) {\n die(`'${this.annotationType_}' cannot be used as a decorator`)\n}\n","import {\n IEnhancer,\n IEqualsComparer,\n IObservableArray,\n IObservableMapInitialValues,\n IObservableSetInitialValues,\n IObservableValue,\n ObservableMap,\n ObservableSet,\n ObservableValue,\n asDynamicObservableObject,\n createObservableArray,\n deepEnhancer,\n extendObservable,\n isES6Map,\n isES6Set,\n isObservable,\n isPlainObject,\n referenceEnhancer,\n Annotation,\n shallowEnhancer,\n refStructEnhancer,\n AnnotationsMap,\n asObservableObject,\n storeAnnotation,\n createDecoratorAnnotation,\n createLegacyArray,\n globalState,\n assign,\n isStringish,\n createObservableAnnotation,\n createAutoAnnotation,\n is20223Decorator,\n initObservable\n} from \"../internal\"\n\nimport type { ClassAccessorDecorator, ClassFieldDecorator } from \"../types/decorator_fills\"\n\nexport const OBSERVABLE = \"observable\"\nexport const OBSERVABLE_REF = \"observable.ref\"\nexport const OBSERVABLE_SHALLOW = \"observable.shallow\"\nexport const OBSERVABLE_STRUCT = \"observable.struct\"\n\nexport type CreateObservableOptions = {\n name?: string\n equals?: IEqualsComparer<any>\n deep?: boolean\n defaultDecorator?: Annotation\n proxy?: boolean\n autoBind?: boolean\n}\n\n// Predefined bags of create observable options, to avoid allocating temporarily option objects\n// in the majority of cases\nexport const defaultCreateObservableOptions: CreateObservableOptions = {\n deep: true,\n name: undefined,\n defaultDecorator: undefined,\n proxy: true\n}\nObject.freeze(defaultCreateObservableOptions)\n\nexport function asCreateObservableOptions(thing: any): CreateObservableOptions {\n return thing || defaultCreateObservableOptions\n}\n\nconst observableAnnotation = createObservableAnnotation(OBSERVABLE)\nconst observableRefAnnotation = createObservableAnnotation(OBSERVABLE_REF, {\n enhancer: referenceEnhancer\n})\nconst observableShallowAnnotation = createObservableAnnotation(OBSERVABLE_SHALLOW, {\n enhancer: shallowEnhancer\n})\nconst observableStructAnnotation = createObservableAnnotation(OBSERVABLE_STRUCT, {\n enhancer: refStructEnhancer\n})\nconst observableDecoratorAnnotation =\n createDecoratorAnnotation<ClassAccessorDecorator>(observableAnnotation)\n\nexport function getEnhancerFromOptions(options: CreateObservableOptions): IEnhancer<any> {\n return options.deep === true\n ? deepEnhancer\n : options.deep === false\n ? referenceEnhancer\n : getEnhancerFromAnnotation(options.defaultDecorator)\n}\n\nexport function getAnnotationFromOptions(\n options?: CreateObservableOptions\n): Annotation | undefined {\n return options ? options.defaultDecorator ?? createAutoAnnotation(options) : undefined\n}\n\nexport function getEnhancerFromAnnotation(annotation?: Annotation): IEnhancer<any> {\n return !annotation ? deepEnhancer : annotation.options_?.enhancer ?? deepEnhancer\n}\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: any, arg2?: any, arg3?: any) {\n // @observable someProp; (2022.3 Decorators)\n if (is20223Decorator(arg2)) {\n return observableAnnotation.decorate_20223_(v, arg2)\n }\n\n // @observable someProp;\n if (isStringish(arg2)) {\n storeAnnotation(v, arg2, observableAnnotation)\n return\n }\n\n // already observable - ignore\n if (isObservable(v)) {\n return v\n }\n\n // plain object\n if (isPlainObject(v)) {\n return observable.object(v, arg2, arg3)\n }\n\n // Array\n if (Array.isArray(v)) {\n return observable.array(v, arg2)\n }\n\n // Map\n if (isES6Map(v)) {\n return observable.map(v, arg2)\n }\n\n // Set\n if (isES6Set(v)) {\n return observable.set(v, arg2)\n }\n\n // other object - ignore\n if (typeof v === \"object\" && v !== null) {\n return v\n }\n\n // anything else\n return observable.box(v, arg2)\n}\nassign(createObservable, observableDecoratorAnnotation)\n\nexport interface IObservableValueFactory {\n <T>(value: T, options?: CreateObservableOptions): IObservableValue<T>\n <T>(value?: T, options?: CreateObservableOptions): IObservableValue<T | undefined>\n}\n\nexport interface IObservableFactory\n extends Annotation,\n PropertyDecorator,\n ClassAccessorDecorator,\n ClassFieldDecorator {\n // TODO: remove ClassFieldDecorator, this is only temporarily support for legacy decorators\n <T = any>(value: T[], options?: CreateObservableOptions): IObservableArray<T>\n <T = any>(value: Set<T>, options?: CreateObservableOptions): ObservableSet<T>\n <K = any, V = any>(value: Map<K, V>, options?: CreateObservableOptions): ObservableMap<K, V>\n <T extends object>(\n value: T,\n decorators?: AnnotationsMap<T, never>,\n options?: CreateObservableOptions\n ): T\n\n box: IObservableValueFactory\n array: <T = any>(initialValues?: T[], options?: CreateObservableOptions) => IObservableArray<T>\n set: <T = any>(\n initialValues?: IObservableSetInitialValues<T>,\n options?: CreateObservableOptions\n ) => ObservableSet<T>\n map: <K = any, V = any>(\n initialValues?: IObservableMapInitialValues<K, V>,\n options?: CreateObservableOptions\n ) => ObservableMap<K, V>\n object: <T = any>(\n props: T,\n decorators?: AnnotationsMap<T, never>,\n options?: CreateObservableOptions\n ) => T\n\n /**\n * Decorator that creates an observable that only observes the references, but doesn't try to turn the assigned value into an observable.ts.\n */\n ref: Annotation & PropertyDecorator & ClassAccessorDecorator & ClassFieldDecorator\n /**\n * Decorator that creates an observable converts its value (objects, maps or arrays) into a shallow observable structure\n */\n shallow: Annotation & PropertyDecorator & ClassAccessorDecorator & ClassFieldDecorator\n deep: Annotation & PropertyDecorator & ClassAccessorDecorator & ClassFieldDecorator\n struct: Annotation & PropertyDecorator & ClassAccessorDecorator & ClassFieldDecorator\n}\n\nconst observableFactories: IObservableFactory = {\n box<T = any>(value: T, options?: CreateObservableOptions): IObservableValue<T> {\n const o = asCreateObservableOptions(options)\n return new ObservableValue(value, getEnhancerFromOptions(o), o.name, true, o.equals)\n },\n array<T = any>(initialValues?: T[], options?: CreateObservableOptions): IObservableArray<T> {\n const o = asCreateObservableOptions(options)\n return (\n globalState.useProxies === false || o.proxy === false\n ? createLegacyArray\n : createObservableArray\n )(initialValues, getEnhancerFromOptions(o), o.name)\n },\n map<K = any, V = any>(\n initialValues?: IObservableMapInitialValues<K, V>,\n options?: CreateObservableOptions\n ): ObservableMap<K, V> {\n const o = asCreateObservableOptions(options)\n return new ObservableMap<K, V>(initialValues, getEnhancerFromOptions(o), o.name)\n },\n set<T = any>(\n initialValues?: IObservableSetInitialValues<T>,\n options?: CreateObservableOptions\n ): ObservableSet<T> {\n const o = asCreateObservableOptions(options)\n return new ObservableSet<T>(initialValues, getEnhancerFromOptions(o), o.name)\n },\n object<T extends object = any>(\n props: T,\n decorators?: AnnotationsMap<T, never>,\n options?: CreateObservableOptions\n ): T {\n return initObservable(() =>\n extendObservable(\n globalState.useProxies === false || options?.proxy === false\n ? asObservableObject({}, options)\n : asDynamicObservableObject({}, options),\n props,\n decorators\n )\n )\n },\n ref: createDecoratorAnnotation(observableRefAnnotation),\n shallow: createDecoratorAnnotation(observableShallowAnnotation),\n deep: observableDecoratorAnnotation,\n struct: createDecoratorAnnotation(observableStructAnnotation)\n} as any\n\n// eslint-disable-next-line\nexport var observable: IObservableFactory = assign(createObservable, observableFactories)\n","import {\n $mobx,\n IIsObservableObject,\n ObservableObjectAdministration,\n warnAboutProxyRequirement,\n assertProxies,\n die,\n isStringish,\n globalState,\n CreateObservableOptions,\n asObservableObject\n} from \"../internal\"\n\nfunction getAdm(target): ObservableObjectAdministration {\n return target[$mobx]\n}\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!\nconst objectProxyTraps: ProxyHandler<any> = {\n has(target: IIsObservableObject, name: PropertyKey): boolean {\n if (__DEV__ && globalState.trackingDerivation) {\n warnAboutProxyRequirement(\n \"detect new properties using the 'in' operator. Use 'has' from 'mobx' instead.\"\n )\n }\n return getAdm(target).has_(name)\n },\n get(target: IIsObservableObject, name: PropertyKey): any {\n return getAdm(target).get_(name)\n },\n set(target: IIsObservableObject, name: PropertyKey, value: any): boolean {\n if (!isStringish(name)) {\n return false\n }\n if (__DEV__ && !getAdm(target).values_.has(name)) {\n warnAboutProxyRequirement(\n \"add a new observable property through direct assignment. Use 'set' from 'mobx' instead.\"\n )\n }\n // null (intercepted) -> true (success)\n return getAdm(target).set_(name, value, true) ?? true\n },\n deleteProperty(target: IIsObservableObject, name: PropertyKey): boolean {\n if (__DEV__) {\n warnAboutProxyRequirement(\n \"delete properties from an observable object. Use 'remove' from 'mobx' instead.\"\n )\n }\n if (!isStringish(name)) {\n return false\n }\n // null (intercepted) -> true (success)\n return getAdm(target).delete_(name, true) ?? true\n },\n defineProperty(\n target: IIsObservableObject,\n name: PropertyKey,\n descriptor: PropertyDescriptor\n ): boolean {\n if (__DEV__) {\n warnAboutProxyRequirement(\n \"define property on an observable object. Use 'defineProperty' from 'mobx' instead.\"\n )\n }\n // null (intercepted) -> true (success)\n return getAdm(target).defineProperty_(name, descriptor) ?? true\n },\n ownKeys(target: IIsObservableObject): ArrayLike<string | symbol> {\n if (__DEV__ && globalState.trackingDerivation) {\n warnAboutProxyRequirement(\n \"iterate keys to detect added / removed properties. Use 'keys' from 'mobx' instead.\"\n )\n }\n return getAdm(target).ownKeys_()\n },\n preventExtensions(target) {\n die(13)\n }\n}\n\nexport function asDynamicObservableObject(\n target: any,\n options?: CreateObservableOptions\n): IIsObservableObject {\n assertProxies()\n target = asObservableObject(target, options)\n return (target[$mobx].proxy_ ??= new Proxy(target, objectProxyTraps))\n}\n","import {\n ComputedValue,\n IComputedValueOptions,\n Annotation,\n storeAnnotation,\n createDecoratorAnnotation,\n isStringish,\n isPlainObject,\n isFunction,\n die,\n IComputedValue,\n createComputedAnnotation,\n comparer,\n is20223Decorator\n} from \"../internal\"\n\nimport type { ClassGetterDecorator } from \"../types/decorator_fills\"\n\nexport const COMPUTED = \"computed\"\nexport const COMPUTED_STRUCT = \"computed.struct\"\n\nexport interface IComputedFactory extends Annotation, PropertyDecorator, ClassGetterDecorator {\n // @computed(opts)\n <T>(options: IComputedValueOptions<T>): Annotation & PropertyDecorator & ClassGetterDecorator\n // computed(fn, opts)\n <T>(func: () => T, options?: IComputedValueOptions<T>): IComputedValue<T>\n\n struct: Annotation & PropertyDecorator & ClassGetterDecorator\n}\n\nconst computedAnnotation = createComputedAnnotation(COMPUTED)\nconst computedStructAnnotation = createComputedAnnotation(COMPUTED_STRUCT, {\n equals: comparer.structural\n})\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 */\nexport const computed: IComputedFactory = 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\n // computed(expr, options?)\n if (__DEV__) {\n if (!isFunction(arg1)) {\n die(\"First argument to `computed` should be an expression.\")\n }\n if (isFunction(arg2)) {\n die(\n \"A setter as second argument is no longer supported, use `{ set: fn }` option instead\"\n )\n }\n }\n const opts: IComputedValueOptions<any> = isPlainObject(arg2) ? arg2 : {}\n opts.get = arg1\n opts.name ||= arg1.name || \"\" /* for generated name */\n\n return new ComputedValue(opts)\n} as any\n\nObject.assign(computed, computedAnnotation)\n\ncomputed.struct = createDecoratorAnnotation(computedStructAnnotation)\n","import {\n IDerivation,\n endBatch,\n globalState,\n isSpyEnabled,\n spyReportEnd,\n spyReportStart,\n startBatch,\n untrackedEnd,\n untrackedStart,\n isFunction,\n allowStateReadsStart,\n allowStateReadsEnd,\n ACTION,\n EMPTY_ARRAY,\n die,\n getDescriptor,\n defineProperty\n} from \"../internal\"\n\n// we don't use globalState for these in order to avoid possible issues with multiple\n// mobx versions\nlet currentActionId = 0\nlet nextActionId = 1\nconst isFunctionNameConfigurable = getDescriptor(() => {}, \"name\")?.configurable ?? false\n\n// we can safely recycle this object\nconst tmpNameDescriptor: PropertyDescriptor = {\n value: \"action\",\n configurable: true,\n writable: false,\n enumerable: false\n}\n\nexport function createAction(\n actionName: string,\n fn: Function,\n autoAction: boolean = false,\n ref?: Object\n): Function {\n if (__DEV__) {\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 = () => fn.toString()\n if (isFunctionNameConfigurable) {\n tmpNameDescriptor.value = actionName\n defineProperty(res, \"name\", tmpNameDescriptor)\n }\n return res\n}\n\nexport function executeAction(\n actionName: string,\n canRunAsDerivation: boolean,\n fn: Function,\n scope?: any,\n args?: IArguments\n) {\n const 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}\n\nexport interface IActionRunInfo {\n prevDerivation_: IDerivation | null\n prevAllowStateChanges_: boolean\n prevAllowStateReads_: boolean\n notifySpy_: boolean\n startTime_: number\n error_?: any\n parentActionId_: number\n actionId_: number\n runAsAction_?: boolean\n}\n\nexport function _startAction(\n actionName: string,\n canRunAsDerivation: boolean, // true for autoAction\n scope: any,\n args?: IArguments\n): IActionRunInfo {\n const notifySpy_ = __DEV__ && isSpyEnabled() && !!actionName\n let startTime_: number = 0\n if (__DEV__ && notifySpy_) {\n startTime_ = Date.now()\n const flattenedArgs = args ? Array.from(args) : EMPTY_ARRAY\n spyReportStart({\n type: ACTION,\n name: actionName,\n object: scope,\n arguments: flattenedArgs\n })\n }\n const prevDerivation_ = globalState.trackingDerivation\n const runAsAction = !canRunAsDerivation || !prevDerivation_\n startBatch()\n let prevAllowStateChanges_ = globalState.allowStateChanges // by default preserve previous allow\n if (runAsAction) {\n untrackedStart()\n prevAllowStateChanges_ = allowStateChangesStart(true)\n }\n const prevAllowStateReads_ = allowStateReadsStart(true)\n const runInfo = {\n runAsAction_: runAsAction,\n prevDerivation_,\n prevAllowStateChanges_,\n prevAllowStateReads_,\n notifySpy_,\n startTime_,\n actionId_: nextActionId++,\n parentActionId_: currentActionId\n }\n currentActionId = runInfo.actionId_\n return runInfo\n}\n\nexport function _endAction(runInfo: IActionRunInfo) {\n if (currentActionId !== runInfo.actionId_) {\n die(30)\n }\n currentActionId = runInfo.parentActionId_\n\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 (__DEV__ && runInfo.notifySpy_) {\n spyReportEnd({ time: Date.now() - runInfo.startTime_ })\n }\n globalState.suppressReactionErrors = false\n}\n\nexport function allowStateChanges<T>(allowStateChanges: boolean, func: () => T): T {\n const prev = allowStateChangesStart(allowStateChanges)\n try {\n return func()\n } finally {\n allowStateChangesEnd(prev)\n }\n}\n\nexport function allowStateChangesStart(allowStateChanges: boolean) {\n const prev = globalState.allowStateChanges\n globalState.allowStateChanges = allowStateChanges\n return prev\n}\n\nexport function allowStateChangesEnd(prev: boolean) {\n globalState.allowStateChanges = prev\n}\n","import {\n Atom,\n IEnhancer,\n IInterceptable,\n IEqualsComparer,\n IInterceptor,\n IListenable,\n Lambda,\n checkIfStateModificationsAreAllowed,\n comparer,\n createInstanceofPredicate,\n getNextId,\n hasInterceptors,\n hasListeners,\n interceptChange,\n isSpyEnabled,\n notifyListeners,\n registerInterceptor,\n registerListener,\n spyReport,\n spyReportEnd,\n spyReportStart,\n toPrimitive,\n globalState,\n IUNCHANGED,\n UPDATE\n} from \"../internal\"\n\nexport interface IValueWillChange<T> {\n object: IObservableValue<T>\n type: \"update\"\n newValue: T\n}\n\nexport type IValueDidChange<T = any> = {\n type: \"update\"\n observableKind: \"value\"\n object: IObservableValue<T>\n debugObjectName: string\n newValue: T\n oldValue: T | undefined\n}\nexport type IBoxDidChange<T = any> =\n | {\n type: \"create\"\n observableKind: \"value\"\n object: IObservableValue<T>\n debugObjectName: string\n newValue: T\n }\n | IValueDidChange<T>\n\nexport interface IObservableValue<T> {\n get(): T\n set(value: T): void\n}\n\nconst CREATE = \"create\"\n\nexport class ObservableValue<T>\n extends Atom\n implements IObservableValue<T>, IInterceptable<IValueWillChange<T>>, IListenable\n{\n hasUnreportedChange_ = false\n interceptors_\n changeListeners_\n value_\n dehancer: any\n\n constructor(\n value: T,\n public enhancer: IEnhancer<T>,\n public name_ = __DEV__ ? \"ObservableValue@\" + getNextId() : \"ObservableValue\",\n notifySpy = true,\n private equals: IEqualsComparer<any> = comparer.default\n ) {\n super(name_)\n this.value_ = enhancer(value, undefined, name_)\n if (__DEV__ && 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 }\n\n private dehanceValue(value: T): T {\n if (this.dehancer !== undefined) {\n return this.dehancer(value)\n }\n return value\n }\n\n public set(newValue: T) {\n const oldValue = this.value_\n newValue = this.prepareNewValue_(newValue) as any\n if (newValue !== globalState.UNCHANGED) {\n const notifySpy = isSpyEnabled()\n if (__DEV__ && notifySpy) {\n spyReportStart({\n type: UPDATE,\n object: this,\n observableKind: \"value\",\n debugObjectName: this.name_,\n newValue,\n oldValue\n })\n }\n this.setNewValue_(newValue)\n if (__DEV__ && notifySpy) {\n spyReportEnd()\n }\n }\n }\n\n private prepareNewValue_(newValue): T | IUNCHANGED {\n checkIfStateModificationsAreAllowed(this)\n if (hasInterceptors(this)) {\n const change = interceptChange<IValueWillChange<T>>(this, {\n object: this,\n type: UPDATE,\n 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\n setNewValue_(newValue: T) {\n const 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,\n oldValue\n })\n }\n }\n\n public get(): T {\n this.reportObserved()\n return this.dehanceValue(this.value_)\n }\n\n intercept_(handler: IInterceptor<IValueWillChange<T>>): Lambda {\n return registerInterceptor(this, handler)\n }\n\n observe_(listener: (change: IValueDidChange<T>) => void, fireImmediately?: boolean): Lambda {\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\n raw() {\n // used by MST ot get undehanced value\n return this.value_\n }\n\n toJSON() {\n return this.get()\n }\n\n toString() {\n return `${this.name_}[${this.value_}]`\n }\n\n valueOf(): T {\n return toPrimitive(this.get())\n }\n\n [Symbol.toPrimitive]() {\n return this.valueOf()\n }\n}\n\nexport const isObservableValue = createInstanceofPredicate(\"ObservableValue\", ObservableValue) as (\n x: any\n) => x is IObservableValue<any>\n","import {\n CaughtException,\n IDerivation,\n IDerivationState_,\n IEqualsComparer,\n IObservable,\n Lambda,\n TraceMode,\n autorun,\n clearObserving,\n comparer,\n createAction,\n createInstanceofPredicate,\n endBatch,\n getNextId,\n globalState,\n isCaughtException,\n isSpyEnabled,\n propagateChangeConfirmed,\n propagateMaybeChanged,\n reportObserved,\n shouldCompute,\n spyReport,\n startBatch,\n toPrimitive,\n trackDerivedFunction,\n untrackedEnd,\n untrackedStart,\n UPDATE,\n die,\n allowStateChangesStart,\n allowStateChangesEnd\n} from \"../internal\"\n\nimport { getFlag, setFlag } from \"../utils/utils\"\n\nexport interface IComputedValue<T> {\n get(): T\n set(value: T): void\n}\n\nexport interface IComputedValueOptions<T> {\n get?: () => T\n set?: (value: T) => void\n name?: string\n equals?: IEqualsComparer<T>\n context?: any\n requiresReaction?: boolean\n keepAlive?: boolean\n}\n\nexport type IComputedDidChange<T = any> = {\n type: \"update\"\n observableKind: \"computed\"\n object: unknown\n debugObjectName: string\n newValue: T\n oldValue: T | undefined\n}\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 */\nexport class ComputedValue<T> implements IObservable, IComputedValue<T>, IDerivation {\n dependenciesState_ = IDerivationState_.NOT_TRACKING_\n observing_: IObservable[] = [] // nodes we are looking at. Our value depends on these nodes\n newObserving_ = null // during tracking it's an array with new observed observers\n observers_ = new Set<IDerivation>()\n runId_ = 0\n lastAccessedBy_ = 0\n lowestObserverState_ = IDerivationState_.UP_TO_DATE_\n unboundDepsCount_ = 0\n protected value_: T | undefined | CaughtException = new CaughtException(null)\n name_: string\n triggeredBy_?: string\n\n private static readonly isComputingMask_ = 0b00001\n private static readonly isRunningSetterMask_ = 0b00010\n private static readonly isBeingObservedMask_ = 0b00100\n private static readonly isPendingUnobservationMask_ = 0b01000\n private static readonly diffValueMask_ = 0b10000\n private flags_ = 0b00000\n\n derivation: () => T // N.B: unminified as it is used by MST\n setter_?: (value: T) => void\n isTracing_: TraceMode = TraceMode.NONE\n scope_: Object | undefined\n private equals_: IEqualsComparer<any>\n private requiresReaction_: boolean | undefined\n keepAlive_: boolean\n\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 constructor(options: IComputedValueOptions<T>) {\n if (!options.get) {\n die(31)\n }\n this.derivation = options.get!\n this.name_ = options.name || (__DEV__ ? \"ComputedValue@\" + getNextId() : \"ComputedValue\")\n if (options.set) {\n this.setter_ = createAction(\n __DEV__ ? this.name_ + \"-setter\" : \"ComputedValue-setter\",\n options.set\n ) as any\n }\n this.equals_ =\n options.equals ||\n ((options as any).compareStructural || (options as any).struct\n ? comparer.structural\n : comparer.default)\n this.scope_ = options.context\n this.requiresReaction_ = options.requiresReaction\n this.keepAlive_ = !!options.keepAlive\n }\n\n onBecomeStale_() {\n propagateMaybeChanged(this)\n }\n\n public onBOL: Set<Lambda> | undefined\n public onBUOL: Set<Lambda> | undefined\n\n public onBO() {\n if (this.onBOL) {\n this.onBOL.forEach(listener => listener())\n }\n }\n\n public onBUO() {\n if (this.onBUOL) {\n this.onBUOL.forEach(listener => listener())\n }\n }\n\n // to check for cycles\n private get isComputing(): boolean {\n return getFlag(this.flags_, ComputedValue.isComputingMask_)\n }\n private set isComputing(newValue: boolean) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isComputingMask_, newValue)\n }\n\n private get isRunningSetter(): boolean {\n return getFlag(this.flags_, ComputedValue.isRunningSetterMask_)\n }\n private set isRunningSetter(newValue: boolean) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isRunningSetterMask_, newValue)\n }\n\n get isBeingObserved(): boolean {\n return getFlag(this.flags_, ComputedValue.isBeingObservedMask_)\n }\n set isBeingObserved(newValue: boolean) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isBeingObservedMask_, newValue)\n }\n\n get isPendingUnobservation(): boolean {\n return getFlag(this.flags_, ComputedValue.isPendingUnobservationMask_)\n }\n set isPendingUnobservation(newValue: boolean) {\n this.flags_ = setFlag(this.flags_, ComputedValue.isPendingUnobservationMask_, newValue)\n }\n\n get diffValue(): 0 | 1 {\n return getFlag(this.flags_, ComputedValue.diffValueMask_) ? 1 : 0\n }\n set diffValue(newValue: 0 | 1) {\n this.flags_ = setFlag(\n this.flags_,\n ComputedValue.diffValueMask_,\n newValue === 1 ? true : false\n )\n }\n\n /**\n * Returns the current value of this computed value.\n * Will evaluate its computation first if needed.\n */\n public get(): T {\n if (this.isComputing) {\n die(32, this.name_, this.derivation)\n }\n if (\n globalState.inBatch === 0 &&\n // !globalState.trackingDerivatpion &&\n this.observers_.size === 0 &&\n !this.keepAlive_\n ) {\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 let 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 const result = this.value_!\n\n if (isCaughtException(result)) {\n throw result.cause\n }\n return result\n }\n\n public set(value: T) {\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\n trackAndCompute(): boolean {\n // N.B: unminified as it is used by MST\n const oldValue = this.value_\n const wasSuspended =\n /* see #1208 */ this.dependenciesState_ === IDerivationState_.NOT_TRACKING_\n const newValue = this.computeValue_(true)\n\n const changed =\n wasSuspended ||\n isCaughtException(oldValue) ||\n isCaughtException(newValue) ||\n !this.equals_(oldValue, newValue)\n\n if (changed) {\n this.value_ = newValue\n\n if (__DEV__ && isSpyEnabled()) {\n spyReport({\n observableKind: \"computed\",\n debugObjectName: this.name_,\n object: this.scope_,\n type: \"update\",\n oldValue,\n newValue\n } as IComputedDidChange)\n }\n }\n\n return changed\n }\n\n computeValue_(track: boolean) {\n this.isComputing = true\n // don't allow state changes during computation\n const prev = allowStateChangesStart(false)\n let res: T | CaughtException\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\n suspend_() {\n if (!this.keepAlive_) {\n clearObserving(this)\n this.value_ = undefined // don't hold on to computed value!\n if (__DEV__ && this.isTracing_ !== TraceMode.NONE) {\n console.log(\n `[mobx.trace] Computed value '${this.name_}' was suspended and it will recompute on the next access.`\n )\n }\n }\n }\n\n observe_(listener: (change: IComputedDidChange<T>) => void, fireImmediately?: boolean): Lambda {\n let firstTime = true\n let prevValue: T | undefined = undefined\n return autorun(() => {\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 let newValue = this.get()\n if (!firstTime || fireImmediately) {\n const prevU = untrackedStart()\n listener({\n observableKind: \"computed\",\n debugObjectName: this.name_,\n type: UPDATE,\n object: this,\n newValue,\n oldValue: prevValue\n })\n untrackedEnd(prevU)\n }\n firstTime = false\n prevValue = newValue\n })\n }\n\n warnAboutUntrackedRead_() {\n if (!__DEV__) {\n return\n }\n if (this.isTracing_ !== TraceMode.NONE) {\n console.log(\n `[mobx.trace] Computed value '${this.name_}' is being read outside a reactive context. Doing a full recompute.`\n )\n }\n if (\n typeof this.requiresReaction_ === \"boolean\"\n ? this.requiresReaction_\n : globalState.computedRequiresReaction\n ) {\n console.warn(\n `[mobx] Computed value '${this.name_}' is being read outside a reactive context. Doing a full recompute.`\n )\n }\n }\n\n toString() {\n return `${this.name_}[${this.derivation.toString()}]`\n }\n\n valueOf(): T {\n return toPrimitive(this.get())\n }\n\n [Symbol.toPrimitive]() {\n return this.valueOf()\n }\n}\n\nexport const isComputedValue = createInstanceofPredicate(\"ComputedValue\", ComputedValue)\n","import {\n Lambda,\n ComputedValue,\n IDependencyTree,\n IDerivation,\n IDerivationState_,\n TraceMode,\n getDependencyTree,\n globalState,\n runReactions,\n checkIfStateReadsAreAllowed\n} from \"../internal\"\n\nexport interface IDepTreeNode {\n name_: string\n observing_?: IObservable[]\n}\n\nexport interface IObservable extends IDepTreeNode {\n diffValue: number\n /**\n * Id of the derivation *run* that last accessed this observable.\n * If this id equals the *run* id of the current derivation,\n * the dependency is already established\n */\n lastAccessedBy_: number\n isBeingObserved: boolean\n\n lowestObserverState_: IDerivationState_ // Used to avoid redundant propagations\n isPendingUnobservation: boolean // Used to push itself to global.pendingUnobservations at most once per batch.\n\n observers_: Set<IDerivation>\n\n onBUO(): void\n onBO(): void\n\n onBUOL: Set<Lambda> | undefined\n onBOL: Set<Lambda> | undefined\n}\n\nexport function hasObservers(observable: IObservable): boolean {\n return observable.observers_ && observable.observers_.size > 0\n}\n\nexport function getObservers(observable: IObservable): Set<IDerivation> {\n return observable.observers_\n}\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// }\nexport function addObserver(observable: IObservable, node: IDerivation) {\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\n observable.observers_.add(node)\n if (observable.lowestObserverState_ > node.dependenciesState_) {\n observable.lowestObserverState_ = node.dependenciesState_\n }\n\n // invariantObservers(observable);\n // invariant(observable._observers.indexOf(node) !== -1, \"INTERNAL ERROR didn't add node\");\n}\n\nexport function removeObserver(observable: IObservable, node: IDerivation) {\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}\n\nexport function queueForUnobservation(observable: IObservable) {\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/**\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 */\nexport function startBatch() {\n globalState.inBatch++\n}\n\nexport function endBatch() {\n if (--globalState.inBatch === 0) {\n runReactions()\n // the batch is actually about to finish, all unobserving should happen here.\n const list = globalState.pendingUnobservations\n for (let i = 0; i < list.length; i++) {\n const 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}\n\nexport function reportObserved(observable: IObservable): boolean {\n checkIfStateReadsAreAllowed(observable)\n\n const 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\n return false\n}\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/**\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\n// Called by Atom when its value changes\nexport function propagateChanged(observable: IObservable) {\n // invariantLOS(observable, \"changed start\");\n if (observable.lowestObserverState_ === IDerivationState_.STALE_) {\n return\n }\n observable.lowestObserverState_ = IDerivationState_.STALE_\n\n // Ideally we use for..of here, but the downcompiled version is really slow...\n observable.observers_.forEach(d => {\n if (d.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {\n if (__DEV__ && 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\n// Called by ComputedValue when it recalculate and its value changed\nexport function propagateChangeConfirmed(observable: IObservable) {\n // invariantLOS(observable, \"confirmed start\");\n if (observable.lowestObserverState_ === IDerivationState_.STALE_) {\n return\n }\n observable.lowestObserverState_ = IDerivationState_.STALE_\n\n observable.observers_.forEach(d => {\n if (d.dependenciesState_ === IDerivationState_.POSSIBLY_STALE_) {\n d.dependenciesState_ = IDerivationState_.STALE_\n if (__DEV__ && d.isTracing_ !== TraceMode.NONE) {\n logTraceInfo(d, observable)\n }\n } else if (\n 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\n// Used by computed when its dependency changed, but we don't wan't to immediately recompute.\nexport function propagateMaybeChanged(observable: IObservable) {\n // invariantLOS(observable, \"maybe start\");\n if (observable.lowestObserverState_ !== IDerivationState_.UP_TO_DATE_) {\n return\n }\n observable.lowestObserverState_ = IDerivationState_.POSSIBLY_STALE_\n\n observable.observers_.forEach(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}\n\nfunction logTraceInfo(derivation: IDerivation, observable: IObservable) {\n console.log(\n `[mobx.trace] '${derivation.name_}' is invalidated due to a change in: '${observable.name_}'`\n )\n if (derivation.isTracing_ === TraceMode.BREAK) {\n const lines = []\n printDepTree(getDependencyTree(derivation), lines, 1)\n\n // prettier-ignore\n new Function(\n`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}\n\nfunction printDepTree(tree: IDependencyTree, lines: string[], depth: number) {\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(child => printDepTree(child, lines, depth + 1))\n }\n}\n","import {\n IAtom,\n IDepTreeNode,\n IObservable,\n addObserver,\n globalState,\n isComputedValue,\n removeObserver\n} from \"../internal\"\n\nexport enum 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 NOT_TRACKING_ = -1,\n // no shallow dependency changed since last computation\n // won't recalculate derivation\n // this is what makes mobx fast\n UP_TO_DATE_ = 0,\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 POSSIBLY_STALE_ = 1,\n // A shallow dependency has changed since last computation and the derivation\n // will need to recompute when it's needed next.\n STALE_ = 2\n}\n\nexport enum TraceMode {\n NONE,\n LOG,\n BREAK\n}\n\n/**\n * A derivation is everything that can be derived from the state (all the atoms) in a pure manner.\n * See https://medium.com/@mweststrate/becoming-fully-reactive-an-in-depth-explanation-of-mobservable-55995262a254#.xvbh6qd74\n */\nexport interface IDerivation extends IDepTreeNode {\n observing_: IObservable[]\n newObserving_: null | IObservable[]\n dependenciesState_: IDerivationState_\n /**\n * Id of the current run of a derivation. Each time the derivation is tracked\n * this number is increased by one. This number is globally unique\n */\n runId_: number\n /**\n * amount of dependencies used by the derivation in this run, which has not been bound yet.\n */\n unboundDepsCount_: number\n onBecomeStale_(): void\n isTracing_: TraceMode\n\n /**\n * warn if the derivation has no dependencies after creation/update\n */\n requiresObservable_?: boolean\n}\n\nexport class CaughtException {\n constructor(public cause: any) {\n // Empty\n }\n}\n\nexport function isCaughtException(e: any): e is CaughtException {\n return e instanceof CaughtException\n}\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 */\nexport function shouldCompute(derivation: IDerivation): boolean {\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 // state propagation can occur outside of action/reactive context #2195\n const prevAllowStateReads = allowStateReadsStart(true)\n const prevUntracked = untrackedStart() // no need for those computeds to be reported, they will be picked up in trackDerivedFunction.\n const obs = derivation.observing_,\n l = obs.length\n for (let i = 0; i < l; i++) {\n const 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_ as any) === 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}\n\nexport function isComputingDerivation() {\n return globalState.trackingDerivation !== null // filter out actions inside computations\n}\n\nexport function checkIfStateModificationsAreAllowed(atom: IAtom) {\n if (!__DEV__) {\n return\n }\n const hasObservers = atom.observers_.size > 0\n // Should not be possible to change observed state outside strict mode, except during initialization, see #563\n if (\n !globalState.allowStateChanges &&\n (hasObservers || globalState.enforceActions === \"always\")\n ) {\n console.warn(\n \"[MobX] \" +\n (globalState.enforceActions\n ? \"Since strict-mode is enabled, changing (observed) observable values without using an action is not allowed. Tried to modify: \"\n : \"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: \") +\n atom.name_\n )\n }\n}\n\nexport function checkIfStateReadsAreAllowed(observable: IObservable) {\n if (__DEV__ && !globalState.allowStateReads && globalState.observableRequiresReaction) {\n console.warn(\n `[mobx] Observable '${observable.name_}' being read outside a reactive context.`\n )\n }\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 */\nexport function trackDerivedFunction<T>(derivation: IDerivation, f: () => T, context: any) {\n const 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 )\n derivation.unboundDepsCount_ = 0\n derivation.runId_ = ++globalState.runId\n const prevTracking = globalState.trackingDerivation\n globalState.trackingDerivation = derivation\n globalState.inBatch++\n let 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\n warnAboutDerivationWithoutDependencies(derivation)\n allowStateReadsEnd(prevAllowStateReads)\n return result\n}\n\nfunction warnAboutDerivationWithoutDependencies(derivation: IDerivation) {\n if (!__DEV__) {\n return\n }\n\n if (derivation.observing_.length !== 0) {\n return\n }\n\n if (\n typeof derivation.requiresObservable_ === \"boolean\"\n ? derivation.requiresObservable_\n : globalState.reactionRequiresObservable\n ) {\n console.warn(\n `[mobx] Derivation '${derivation.name_}' is created/updated without reading any observable value.`\n )\n }\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: IDerivation) {\n // invariant(derivation.dependenciesState !== IDerivationState.NOT_TRACKING, \"INTERNAL ERROR bindDependencies expects derivation.dependenciesState !== -1\");\n const prevObserving = derivation.observing_\n const observing = (derivation.observing_ = derivation.newObserving_!)\n let lowestNewObservingDerivationState = IDerivationState_.UP_TO_DATE_\n\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 let i0 = 0,\n l = derivation.unboundDepsCount_\n for (let i = 0; i < l; i++) {\n const 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\n // Upcast is 'safe' here, because if dep is IObservable, `dependenciesState` will be undefined,\n // not hitting the condition\n if ((dep as any as IDerivation).dependenciesState_ > lowestNewObservingDerivationState) {\n lowestNewObservingDerivationState = (dep as any as IDerivation).dependenciesState_\n }\n }\n observing.length = i0\n\n derivation.newObserving_ = null // newObserving shouldn't be needed outside tracking (statement moved down to work around FF bug, see #614)\n\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 const dep = prevObserving[l]\n if (dep.diffValue === 0) {\n removeObserver(dep, derivation)\n }\n dep.diffValue = 0\n }\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 const dep = observing[i0]\n if (dep.diffValue === 1) {\n dep.diffValue = 0\n addObserver(dep, derivation)\n }\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}\n\nexport function clearObserving(derivation: IDerivation) {\n // invariant(globalState.inBatch > 0, \"INTERNAL ERROR clearObserving should be called only inside batch\");\n const obs = derivation.observing_\n derivation.observing_ = []\n let i = obs.length\n while (i--) {\n removeObserver(obs[i], derivation)\n }\n\n derivation.dependenciesState_ = IDerivationState_.NOT_TRACKING_\n}\n\nexport function untracked<T>(action: () => T): T {\n const prev = untrackedStart()\n try {\n return action()\n } finally {\n untrackedEnd(prev)\n }\n}\n\nexport function untrackedStart(): IDerivation | null {\n const prev = globalState.trackingDerivation\n globalState.trackingDerivation = null\n return prev\n}\n\nexport function untrackedEnd(prev: IDerivation | null) {\n globalState.trackingDerivation = prev\n}\n\nexport function allowStateReadsStart(allowStateReads: boolean) {\n const prev = globalState.allowStateReads\n globalState.allowStateReads = allowStateReads\n return prev\n}\n\nexport function allowStateReadsEnd(prev: boolean) {\n globalState.allowStateReads = prev\n}\n\n/**\n * needed to keep `lowestObserverState` correct. when changing from (2 or 1) to 0\n *\n */\nexport function changeDependenciesStateTo0(derivation: IDerivation) {\n if (derivation.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {\n return\n }\n derivation.dependenciesState_ = IDerivationState_.UP_TO_DATE_\n\n const obs = derivation.observing_\n let i = obs.length\n while (i--) {\n obs[i].lowestObserverState_ = IDerivationState_.UP_TO_DATE_\n }\n}\n","import { IDerivation, IObservable, Reaction, die, getGlobal } from \"../internal\"\nimport { ComputedValue } from \"./computedvalue\"\n\n/**\n * These values will persist if global state is reset\n */\nconst persistentKeys: (keyof MobXGlobals)[] = [\n \"mobxGuid\",\n \"spyListeners\",\n \"enforceActions\",\n \"computedRequiresReaction\",\n \"reactionRequiresObservable\",\n \"observableRequiresReaction\",\n \"allowStateReads\",\n \"disableErrorBoundaries\",\n \"runId\",\n \"UNCHANGED\",\n \"useProxies\"\n]\n\nexport type IUNCHANGED = {}\n\nexport class 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 version = 6\n\n /**\n * globally unique token to signal unchanged\n */\n UNCHANGED: IUNCHANGED = {}\n\n /**\n * Currently running derivation\n */\n trackingDerivation: IDerivation | null = null\n\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 trackingContext: Reaction | ComputedValue<any> | null = null\n\n /**\n * Each time a derivation is tracked, it is assigned a unique run-id\n */\n runId = 0\n\n /**\n * 'guid' for general purpose. Will be persisted amongst resets.\n */\n mobxGuid = 0\n\n /**\n * Are we in a batch block? (and how many of them)\n */\n inBatch: number = 0\n\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 pendingUnobservations: IObservable[] = []\n\n /**\n * List of scheduled, not yet executed, reactions.\n */\n pendingReactions: Reaction[] = []\n\n /**\n * Are we currently processing reactions?\n */\n isRunningReactions = false\n\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 allowStateChanges = false\n\n /**\n * Is it allowed to read observables at this point?\n * Used to hold the state needed for `observableRequiresReaction`\n */\n allowStateReads = true\n\n /**\n * If strict mode is enabled, state changes are by default not allowed\n */\n enforceActions: boolean | \"always\" = true\n\n /**\n * Spy callbacks\n */\n spyListeners: { (change: any): void }[] = []\n\n /**\n * Globally attached error handlers that react specifically to errors in reactions\n */\n globalReactionErrorHandlers: ((error: any, derivation: IDerivation) => void)[] = []\n\n /**\n * Warn if computed values are accessed outside a reactive context\n */\n computedRequiresReaction = false\n\n /**\n * (Experimental)\n * Warn if you try to create to derivation / reactive context without accessing any observable.\n */\n reactionRequiresObservable = false\n\n /**\n * (Experimental)\n * Warn if observables are accessed outside a reactive context\n */\n observableRequiresReaction = false\n\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 disableErrorBoundaries = false\n\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 suppressReactionErrors = false\n\n useProxies = true\n /*\n * print warnings about code that would fail if proxies weren't available\n */\n verifyProxies = false\n\n /**\n * False forces all object's descriptors to\n * writable: true\n * configurable: true\n */\n safeDescriptors = true\n}\n\nlet canMergeGlobalState = true\nlet isolateCalled = false\n\nexport let globalState: MobXGlobals = (function () {\n let global = 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\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(() => {\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 = new MobXGlobals())\n }\n})()\n\nexport function isolateGlobalState() {\n if (\n globalState.pendingReactions.length ||\n globalState.inBatch ||\n globalState.isRunningReactions\n ) {\n die(36)\n }\n isolateCalled = true\n if (canMergeGlobalState) {\n let global = getGlobal()\n if (--global.__mobxInstanceCount === 0) {\n global.__mobxGlobals = undefined\n }\n globalState = new MobXGlobals()\n }\n}\n\nexport function getGlobalState(): any {\n return globalState\n}\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 */\nexport function resetGlobalState() {\n const defaultGlobals = new MobXGlobals()\n for (let key in defaultGlobals) {\n if (persistentKeys.indexOf(key as any) === -1) {\n globalState[key] = defaultGlobals[key]\n }\n }\n globalState.allowStateChanges = !globalState.enforceActions\n}\n","import {\n $mobx,\n IDerivation,\n IDerivationState_,\n IObservable,\n Lambda,\n TraceMode,\n clearObserving,\n createInstanceofPredicate,\n endBatch,\n getNextId,\n globalState,\n isCaughtException,\n isSpyEnabled,\n shouldCompute,\n spyReport,\n spyReportEnd,\n spyReportStart,\n startBatch,\n trace,\n trackDerivedFunction,\n GenericAbortSignal\n} from \"../internal\"\n\nimport { getFlag, setFlag } from \"../utils/utils\"\n\n/**\n * Reactions are a special kind of derivations. Several things distinguishes them from normal reactive computations\n *\n * 1) They will always run, whether they are used by other computations or not.\n * This means that they are very suitable for triggering side effects like logging, updating the DOM and making network requests.\n * 2) They are not observable themselves\n * 3) They will always run after any 'normal' derivations\n * 4) They are allowed to change the state and thereby triggering themselves again, as long as they make sure the state propagates to a stable state in a reasonable amount of iterations.\n *\n * The state machine of a Reaction is as follows:\n *\n * 1) after creating, the reaction should be started by calling `runReaction` or by scheduling it (see also `autorun`)\n * 2) the `onInvalidate` handler should somehow result in a call to `this.track(someFunction)`\n * 3) all observables accessed in `someFunction` will be observed by this reaction.\n * 4) as soon as some of the dependencies has changed the Reaction will be rescheduled for another run (after the current mutation or transaction). `isScheduled` will yield true once a dependency is stale and during this period\n * 5) `onInvalidate` will be called, and we are back at step 1.\n *\n */\n\nexport interface IReactionPublic {\n dispose(): void\n trace(enterBreakPoint?: boolean): void\n}\n\nexport interface IReactionDisposer {\n (): void\n [$mobx]: Reaction\n}\n\nexport class Reaction implements IDerivation, IReactionPublic {\n observing_: IObservable[] = [] // nodes we are looking at. Our value depends on these nodes\n newObserving_: IObservable[] = []\n dependenciesState_ = IDerivationState_.NOT_TRACKING_\n runId_ = 0\n unboundDepsCount_ = 0\n\n private static readonly isDisposedMask_ = 0b00001\n private static readonly isScheduledMask_ = 0b00010\n private static readonly isTrackPendingMask_ = 0b00100\n private static readonly isRunningMask_ = 0b01000\n private static readonly diffValueMask_ = 0b10000\n private flags_ = 0b00000\n\n isTracing_: TraceMode = TraceMode.NONE\n\n constructor(\n public name_: string = __DEV__ ? \"Reaction@\" + getNextId() : \"Reaction\",\n private onInvalidate_: () => void,\n private errorHandler_?: (error: any, derivation: IDerivation) => void,\n public requiresObservable_?\n ) {}\n\n get isDisposed() {\n return getFlag(this.flags_, Reaction.isDisposedMask_)\n }\n set isDisposed(newValue: boolean) {\n this.flags_ = setFlag(this.flags_, Reaction.isDisposedMask_, newValue)\n }\n\n get isScheduled() {\n return getFlag(this.flags_, Reaction.isScheduledMask_)\n }\n set isScheduled(newValue: boolean) {\n this.flags_ = setFlag(this.flags_, Reaction.isScheduledMask_, newValue)\n }\n\n get isTrackPending() {\n return getFlag(this.flags_, Reaction.isTrackPendingMask_)\n }\n set isTrackPending(newValue: boolean) {\n this.flags_ = setFlag(this.flags_, Reaction.isTrackPendingMask_, newValue)\n }\n\n get isRunning() {\n return getFlag(this.flags_, Reaction.isRunningMask_)\n }\n set isRunning(newValue: boolean) {\n this.flags_ = setFlag(this.flags_, Reaction.isRunningMask_, newValue)\n }\n\n get diffValue(): 0 | 1 {\n return getFlag(this.flags_, Reaction.diffValueMask_) ? 1 : 0\n }\n set diffValue(newValue: 0 | 1) {\n this.flags_ = setFlag(this.flags_, Reaction.diffValueMask_, newValue === 1 ? true : false)\n }\n\n onBecomeStale_() {\n this.schedule_()\n }\n\n schedule_() {\n if (!this.isScheduled) {\n this.isScheduled = true\n globalState.pendingReactions.push(this)\n runReactions()\n }\n }\n\n /**\n * internal, use schedule() if you intend to kick off a reaction\n */\n runReaction_() {\n if (!this.isDisposed) {\n startBatch()\n this.isScheduled = false\n const prev = globalState.trackingContext\n globalState.trackingContext = this\n if (shouldCompute(this)) {\n this.isTrackPending = true\n\n try {\n this.onInvalidate_()\n if (__DEV__ && 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\n track(fn: () => void) {\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 const notify = isSpyEnabled()\n let startTime\n if (__DEV__ && notify) {\n startTime = Date.now()\n spyReportStart({\n name: this.name_,\n type: \"reaction\"\n })\n }\n this.isRunning = true\n const prevReaction = globalState.trackingContext // reactions could create reactions...\n globalState.trackingContext = this\n const 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 (__DEV__ && notify) {\n spyReportEnd({\n time: Date.now() - startTime\n })\n }\n endBatch()\n }\n\n reportExceptionInDerivation_(error: any) {\n if (this.errorHandler_) {\n this.errorHandler_(error, this)\n return\n }\n\n if (globalState.disableErrorBoundaries) {\n throw error\n }\n\n const message = __DEV__\n ? `[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '${this}'`\n : `[mobx] uncaught error in '${this}'`\n if (!globalState.suppressReactionErrors) {\n console.error(message, error)\n /** If debugging brought you here, please, read the above message :-). Tnx! */\n } else if (__DEV__) { console.warn(`[mobx] (error in reaction '${this.name_}' suppressed, fix error of causing action below)`) } // prettier-ignore\n\n if (__DEV__ && isSpyEnabled()) {\n spyReport({\n type: \"error\",\n name: this.name_,\n message,\n error: \"\" + error\n })\n }\n\n globalState.globalReactionErrorHandlers.forEach(f => f(error, this))\n }\n\n 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\n getDisposer_(abortSignal?: GenericAbortSignal): IReactionDisposer {\n const dispose = (() => {\n this.dispose()\n abortSignal?.removeEventListener?.(\"abort\", dispose)\n }) as IReactionDisposer\n abortSignal?.addEventListener?.(\"abort\", dispose)\n dispose[$mobx] = this\n\n return dispose\n }\n\n toString() {\n return `Reaction[${this.name_}]`\n }\n\n trace(enterBreakPoint: boolean = false) {\n trace(this, enterBreakPoint)\n }\n}\n\nexport function onReactionError(handler: (error: any, derivation: IDerivation) => void): Lambda {\n globalState.globalReactionErrorHandlers.push(handler)\n return () => {\n const idx = globalState.globalReactionErrorHandlers.indexOf(handler)\n if (idx >= 0) {\n globalState.globalReactionErrorHandlers.splice(idx, 1)\n }\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 */\nconst MAX_REACTION_ITERATIONS = 100\n\nlet reactionScheduler: (fn: () => void) => void = f => f()\n\nexport function 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}\n\nfunction runReactionsHelper() {\n globalState.isRunningReactions = true\n const allReactions = globalState.pendingReactions\n let iterations = 0\n\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(\n __DEV__\n ? `Reaction doesn't converge to a stable state after ${MAX_REACTION_ITERATIONS} iterations.` +\n ` Probably there is a cycle in the reactive function: ${allReactions[0]}`\n : `[mobx] cycle in reaction: ${allReactions[0]}`\n )\n allReactions.splice(0) // clear reactions\n }\n let remainingReactions = allReactions.splice(0)\n for (let i = 0, l = remainingReactions.length; i < l; i++) {\n remainingReactions[i].runReaction_()\n }\n }\n globalState.isRunningReactions = false\n}\n\nexport const isReaction = createInstanceofPredicate(\"Reaction\", Reaction)\n\nexport function setReactionScheduler(fn: (f: () => void) => void) {\n const baseScheduler = reactionScheduler\n reactionScheduler = f => fn(() => baseScheduler(f))\n}\n","import { IComputedDidChange } from \"./computedvalue\"\nimport { IValueDidChange, IBoxDidChange } from \"./../types/observablevalue\"\nimport { IObjectDidChange } from \"./../types/observableobject\"\nimport { IArrayDidChange } from \"./../types/observablearray\"\nimport { Lambda, globalState, once, ISetDidChange, IMapDidChange } from \"../internal\"\n\nexport function isSpyEnabled() {\n return __DEV__ && !!globalState.spyListeners.length\n}\n\nexport type PureSpyEvent =\n | { type: \"action\"; name: string; object: unknown; arguments: unknown[] }\n | { type: \"scheduled-reaction\"; name: string }\n | { type: \"reaction\"; name: string }\n | { type: \"error\"; name: string; message: string; error: string }\n | IComputedDidChange<unknown>\n | IObjectDidChange<unknown>\n | IArrayDidChange<unknown>\n | IMapDidChange<unknown, unknown>\n | ISetDidChange<unknown>\n | IValueDidChange<unknown>\n | IBoxDidChange<unknown>\n | { type: \"report-end\"; spyReportEnd: true; time?: number }\n\ntype SpyEvent = PureSpyEvent & { spyReportStart?: true }\n\nexport function spyReport(event: SpyEvent) {\n if (!__DEV__) {\n return\n } // dead code elimination can do the rest\n if (!globalState.spyListeners.length) {\n return\n }\n const listeners = globalState.spyListeners\n for (let i = 0, l = listeners.length; i < l; i++) {\n listeners[i](event)\n }\n}\n\nexport function spyReportStart(event: PureSpyEvent) {\n if (!__DEV__) {\n return\n }\n const change = { ...event, spyReportStart: true as const }\n spyReport(change)\n}\n\nconst END_EVENT: SpyEvent = { type: \"report-end\", spyReportEnd: true }\n\nexport function spyReportEnd(change?: { time?: number }) {\n if (!__DEV__) {\n return\n }\n if (change) {\n spyReport({ ...change, type: \"report-end\", spyReportEnd: true })\n } else {\n spyReport(END_EVENT)\n }\n}\n\nexport function spy(listener: (change: SpyEvent) => void): Lambda {\n if (!__DEV__) {\n console.warn(`[mobx.spy] Is a no-op in production builds`)\n return function () {}\n } else {\n globalState.spyListeners.push(listener)\n return once(() => {\n globalState.spyListeners = globalState.spyListeners.filter(l => l !== listener)\n })\n }\n}\n","import {\n createAction,\n executeAction,\n Annotation,\n storeAnnotation,\n die,\n isFunction,\n isStringish,\n createDecoratorAnnotation,\n createActionAnnotation,\n is20223Decorator\n} from \"../internal\"\n\nimport type { ClassFieldDecorator, ClassMethodDecorator } from \"../types/decorator_fills\"\n\nexport const ACTION = \"action\"\nexport const ACTION_BOUND = \"action.bound\"\nexport const AUTOACTION = \"autoAction\"\nexport const AUTOACTION_BOUND = \"autoAction.bound\"\n\nconst DEFAULT_ACTION_NAME = \"<unnamed action>\"\n\nconst actionAnnotation = createActionAnnotation(ACTION)\nconst actionBoundAnnotation = createActionAnnotation(ACTION_BOUND, {\n bound: true\n})\nconst autoActionAnnotation = createActionAnnotation(AUTOACTION, {\n autoAction: true\n})\nconst autoActionBoundAnnotation = createActionAnnotation(AUTOACTION_BOUND, {\n autoAction: true,\n bound: true\n})\n\nexport interface IActionFactory\n extends Annotation,\n PropertyDecorator,\n ClassMethodDecorator,\n ClassFieldDecorator {\n // nameless actions\n <T extends Function | undefined | null>(fn: T): T\n // named actions\n <T extends Function | undefined | null>(name: string, fn: T): T\n\n // named decorator\n (customName: string): PropertyDecorator &\n Annotation &\n ClassMethodDecorator &\n ClassFieldDecorator\n\n // decorator (name no longer supported)\n bound: Annotation & PropertyDecorator & ClassMethodDecorator & ClassFieldDecorator\n}\n\nfunction createActionFactory(autoAction: boolean): IActionFactory {\n const res: IActionFactory = function action(arg1, arg2?): any {\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_(\n arg1,\n arg2\n )\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(\n createActionAnnotation(autoAction ? AUTOACTION : ACTION, {\n name: arg1,\n autoAction\n })\n )\n }\n\n if (__DEV__) {\n die(\"Invalid arguments for `action`\")\n }\n } as IActionFactory\n return res\n}\n\nexport const action: IActionFactory = createActionFactory(false)\nObject.assign(action, actionAnnotation)\nexport const autoAction: IActionFactory = createActionFactory(true)\nObject.assign(autoAction, autoActionAnnotation)\n\naction.bound = createDecoratorAnnotation(actionBoundAnnotation)\nautoAction.bound = createDecoratorAnnotation(autoActionBoundAnnotation)\n\nexport function runInAction<T>(fn: () => T): T {\n return executeAction(fn.name || DEFAULT_ACTION_NAME, false, fn, this, undefined)\n}\n\nexport function isAction(thing: any) {\n return isFunction(thing) && thing.isMobxAction === true\n}\n","import {\n EMPTY_OBJECT,\n IEqualsComparer,\n IReactionDisposer,\n IReactionPublic,\n Lambda,\n Reaction,\n action,\n comparer,\n getNextId,\n isAction,\n isFunction,\n isPlainObject,\n die,\n allowStateChanges,\n GenericAbortSignal\n} from \"../internal\"\n\nexport interface IAutorunOptions {\n delay?: number\n name?: string\n /**\n * Experimental.\n * Warns if the view doesn't track observables\n */\n requiresObservable?: boolean\n scheduler?: (callback: () => void) => any\n onError?: (error: any) => void\n signal?: GenericAbortSignal\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 */\nexport function autorun(\n view: (r: IReactionPublic) => any,\n opts: IAutorunOptions = EMPTY_OBJECT\n): IReactionDisposer {\n if (__DEV__) {\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\n const name: string =\n opts?.name ?? (__DEV__ ? (view as any).name || \"Autorun@\" + getNextId() : \"Autorun\")\n const runSync = !opts.scheduler && !opts.delay\n let reaction: Reaction\n\n if (runSync) {\n // normal autorun\n reaction = new Reaction(\n name,\n function (this: Reaction) {\n this.track(reactionRunner)\n },\n opts.onError,\n opts.requiresObservable\n )\n } else {\n const scheduler = createSchedulerFromOptions(opts)\n // debounced autorun\n let isScheduled = false\n\n reaction = new Reaction(\n name,\n () => {\n if (!isScheduled) {\n isScheduled = true\n scheduler(() => {\n isScheduled = false\n if (!reaction.isDisposed) {\n reaction.track(reactionRunner)\n }\n })\n }\n },\n opts.onError,\n opts.requiresObservable\n )\n }\n\n function reactionRunner() {\n view(reaction)\n }\n\n if (!opts?.signal?.aborted) {\n reaction.schedule_()\n }\n return reaction.getDisposer_(opts?.signal)\n}\n\nexport type IReactionOptions<T, FireImmediately extends boolean> = IAutorunOptions & {\n fireImmediately?: FireImmediately\n equals?: IEqualsComparer<T>\n}\n\nconst run = (f: Lambda) => f()\n\nfunction createSchedulerFromOptions(opts: IAutorunOptions) {\n return opts.scheduler\n ? opts.scheduler\n : opts.delay\n ? (f: Lambda) => setTimeout(f, opts.delay!)\n : run\n}\n\nexport function reaction<T, FireImmediately extends boolean = false>(\n expression: (r: IReactionPublic) => T,\n effect: (\n arg: T,\n prev: FireImmediately extends true ? T | undefined : T,\n r: IReactionPublic\n ) => void,\n opts: IReactionOptions<T, FireImmediately> = EMPTY_OBJECT\n): IReactionDisposer {\n if (__DEV__) {\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 const name = opts.name ?? (__DEV__ ? \"Reaction@\" + getNextId() : \"Reaction\")\n const effectAction = action(\n name,\n opts.onError ? wrapErrorHandler(opts.onError, effect) : effect\n )\n const runSync = !opts.scheduler && !opts.delay\n const scheduler = createSchedulerFromOptions(opts)\n\n let firstTime = true\n let isScheduled = false\n let value: T\n\n const equals: IEqualsComparer<T> = (opts as any).compareStructural\n ? comparer.structural\n : opts.equals || comparer.default\n\n const r = new Reaction(\n name,\n () => {\n if (firstTime || runSync) {\n reactionRunner()\n } else if (!isScheduled) {\n isScheduled = true\n scheduler!(reactionRunner)\n }\n },\n opts.onError,\n opts.requiresObservable\n )\n\n function reactionRunner() {\n isScheduled = false\n if (r.isDisposed) {\n return\n }\n let changed: boolean = false\n const oldValue = value\n r.track(() => {\n const nextValue = allowStateChanges(false, () => expression(r))\n changed = firstTime || !equals(value, nextValue)\n value = nextValue\n })\n\n // This casting is nesessary as TS cannot infer proper type in current function implementation\n type OldValue = FireImmediately extends true ? T | undefined : T\n if (firstTime && opts.fireImmediately!) {\n effectAction(value, oldValue as OldValue, r)\n } else if (!firstTime && changed) {\n effectAction(value, oldValue as OldValue, r)\n }\n firstTime = false\n }\n\n if (!opts?.signal?.aborted) {\n r.schedule_()\n }\n return r.getDisposer_(opts?.signal)\n}\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","import {\n IComputedValue,\n IObservable,\n IObservableArray,\n Lambda,\n ObservableMap,\n getAtom,\n ObservableSet,\n isFunction,\n IObservableValue\n} from \"../internal\"\n\nconst ON_BECOME_OBSERVED = \"onBO\"\nconst ON_BECOME_UNOBSERVED = \"onBUO\"\n\nexport function onBecomeObserved(\n value:\n | IObservable\n | IComputedValue<any>\n | IObservableArray<any>\n | ObservableMap<any, any>\n | ObservableSet<any>\n | IObservableValue<any>,\n listener: Lambda\n): Lambda\nexport function onBecomeObserved<K, V = any>(\n value: ObservableMap<K, V> | Object,\n property: K,\n listener: Lambda\n): Lambda\nexport function onBecomeObserved(thing, arg2, arg3?): Lambda {\n return interceptHook(ON_BECOME_OBSERVED, thing, arg2, arg3)\n}\n\nexport function onBecomeUnobserved(\n value:\n | IObservable\n | IComputedValue<any>\n | IObservableArray<any>\n | ObservableMap<any, any>\n | ObservableSet<any>\n | IObservableValue<any>,\n listener: Lambda\n): Lambda\nexport function onBecomeUnobserved<K, V = any>(\n value: ObservableMap<K, V> | Object,\n property: K,\n listener: Lambda\n): Lambda\nexport function onBecomeUnobserved(thing, arg2, arg3?): Lambda {\n return interceptHook(ON_BECOME_UNOBSERVED, thing, arg2, arg3)\n}\n\nfunction interceptHook(hook: \"onBO\" | \"onBUO\", thing, arg2, arg3) {\n const atom: IObservable =\n typeof arg3 === \"function\" ? getAtom(thing, arg2) : (getAtom(thing) as any)\n const cb = isFunction(arg3) ? arg3 : arg2\n const listenersKey = `${hook}L` as \"onBOL\" | \"onBUOL\"\n\n if (atom[listenersKey]) {\n atom[listenersKey]!.add(cb)\n } else {\n atom[listenersKey] = new Set<Lambda>([cb])\n }\n\n return function () {\n const hookListeners = atom[listenersKey]\n if (hookListeners) {\n hookListeners.delete(cb)\n if (hookListeners.size === 0) {\n delete atom[listenersKey]\n }\n }\n }\n}\n","import { globalState, isolateGlobalState, setReactionScheduler } from \"../internal\"\n\nconst NEVER = \"never\"\nconst ALWAYS = \"always\"\nconst OBSERVED = \"observed\"\n// const IF_AVAILABLE = \"ifavailable\"\n\nexport function configure(options: {\n enforceActions?: \"never\" | \"always\" | \"observed\"\n computedRequiresReaction?: boolean\n /**\n * Warn if you try to create to derivation / reactive context without accessing any observable.\n */\n reactionRequiresObservable?: boolean\n /**\n * Warn if observables are accessed outside a reactive context\n */\n observableRequiresReaction?: boolean\n isolateGlobalState?: boolean\n disableErrorBoundaries?: boolean\n safeDescriptors?: boolean\n reactionScheduler?: (f: () => void) => void\n useProxies?: \"always\" | \"never\" | \"ifavailable\"\n}): void {\n if (options.isolateGlobalState === true) {\n isolateGlobalState()\n }\n const { useProxies, enforceActions } = options\n if (useProxies !== undefined) {\n globalState.useProxies =\n useProxies === ALWAYS\n ? true\n : useProxies === NEVER\n ? false\n : typeof Proxy !== \"undefined\"\n }\n if (useProxies === \"ifavailable\") {\n globalState.verifyProxies = true\n }\n if (enforceActions !== undefined) {\n const ea = enforceActions === ALWAYS ? ALWAYS : enforceActions === OBSERVED\n globalState.enforceActions = ea\n globalState.allowStateChanges = ea === true || ea === ALWAYS ? false : true\n }\n ;[\n \"computedRequiresReaction\",\n \"reactionRequiresObservable\",\n \"observableRequiresReaction\",\n \"disableErrorBoundaries\",\n \"safeDescriptors\"\n ].forEach(key => {\n if (key in options) {\n globalState[key] = !!options[key]\n }\n })\n globalState.allowStateReads = !globalState.observableRequiresReaction\n if (__DEV__ && globalState.disableErrorBoundaries === true) {\n console.warn(\n \"WARNING: Debug feature only. MobX will NOT recover from errors when `disableErrorBoundaries` is enabled.\"\n )\n }\n if (options.reactionScheduler) {\n setReactionScheduler(options.reactionScheduler)\n }\n}\n","import {\n CreateObservableOptions,\n isObservableMap,\n AnnotationsMap,\n asObservableObject,\n isPlainObject,\n ObservableObjectAdministration,\n isObservable,\n die,\n getOwnPropertyDescriptors,\n $mobx,\n ownKeys,\n initObservable\n} from \"../internal\"\n\nexport function extendObservable<A extends Object, B extends Object>(\n target: A,\n properties: B,\n annotations?: AnnotationsMap<B, never>,\n options?: CreateObservableOptions\n): A & B {\n if (__DEV__) {\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 const descriptors = getOwnPropertyDescriptors(properties)\n\n initObservable(() => {\n const adm: ObservableObjectAdministration = asObservableObject(target, options)[$mobx]\n ownKeys(descriptors).forEach(key => {\n adm.extend_(\n key,\n descriptors[key as any],\n // must pass \"undefined\" for { key: undefined }\n !annotations ? true : key in annotations ? annotations[key] : true\n )\n })\n })\n\n return target as any\n}\n","import { IDepTreeNode, getAtom, getObservers, hasObservers } from \"../internal\"\n\nexport interface IDependencyTree {\n name: string\n dependencies?: IDependencyTree[]\n}\n\nexport interface IObserverTree {\n name: string\n observers?: IObserverTree[]\n}\n\nexport function getDependencyTree(thing: any, property?: string): IDependencyTree {\n return nodeToDependencyTree(getAtom(thing, property))\n}\n\nfunction nodeToDependencyTree(node: IDepTreeNode): IDependencyTree {\n const result: IDependencyTree = {\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}\n\nexport function getObserverTree(thing: any, property?: string): IObserverTree {\n return nodeToObserverTree(getAtom(thing, property))\n}\n\nfunction nodeToObserverTree(node: IDepTreeNode): IObserverTree {\n const result: IObserverTree = {\n name: node.name_\n }\n if (hasObservers(node as any)) {\n result.observers = Array.from(<any>getObservers(node as any)).map(<any>nodeToObserverTree)\n }\n return result\n}\n\nfunction unique<T>(list: T[]): T[] {\n return Array.from(new Set(list))\n}\n","import {\n action,\n noop,\n die,\n isFunction,\n Annotation,\n isStringish,\n storeAnnotation,\n createFlowAnnotation,\n createDecoratorAnnotation,\n is20223Decorator\n} from \"../internal\"\n\nimport type { ClassMethodDecorator } from \"../types/decorator_fills\"\n\nexport const FLOW = \"flow\"\n\nlet generatorId = 0\n\nexport function FlowCancellationError() {\n this.message = \"FLOW_CANCELLED\"\n}\nFlowCancellationError.prototype = Object.create(Error.prototype)\n\nexport function isFlowCancellationError(error: Error) {\n return error instanceof FlowCancellationError\n}\n\nexport type CancellablePromise<T> = Promise<T> & { cancel(): void }\n\ninterface Flow extends Annotation, PropertyDecorator, ClassMethodDecorator {\n <R, Args extends any[]>(\n generator: (...args: Args) => Generator<any, R, any> | AsyncGenerator<any, R, any>\n ): (...args: Args) => CancellablePromise<R>\n bound: Annotation & PropertyDecorator & ClassMethodDecorator\n}\n\nconst flowAnnotation = createFlowAnnotation(\"flow\")\nconst flowBoundAnnotation = createFlowAnnotation(\"flow.bound\", { bound: true })\n\nexport const flow: Flow = Object.assign(\n 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 (__DEV__ && arguments.length !== 1) {\n die(`Flow expects single argument with generator function`)\n }\n const generator = arg1\n const name = generator.name || \"<unnamed flow>\"\n\n // Implementation based on https://github.com/tj/co/blob/master/index.js\n const res = function () {\n const ctx = this\n const args = arguments\n const runId = ++generatorId\n const gen = action(`${name} - runid: ${runId} - init`, generator).apply(ctx, args)\n let rejector: (error: any) => void\n let pendingPromise: CancellablePromise<any> | undefined = undefined\n\n const promise = new Promise(function (resolve, reject) {\n let stepId = 0\n rejector = reject\n\n function onFulfilled(res: any) {\n pendingPromise = undefined\n let ret\n try {\n ret = action(\n `${name} - runid: ${runId} - yield ${stepId++}`,\n gen.next\n ).call(gen, res)\n } catch (e) {\n return reject(e)\n }\n\n next(ret)\n }\n\n function onRejected(err: any) {\n pendingPromise = undefined\n let ret\n try {\n ret = action(\n `${name} - runid: ${runId} - yield ${stepId++}`,\n gen.throw!\n ).call(gen, err)\n } catch (e) {\n return reject(e)\n }\n next(ret)\n }\n\n function next(ret: any) {\n if (isFunction(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) as any\n return pendingPromise!.then(onFulfilled, onRejected)\n }\n\n onFulfilled(undefined) // kick off the process\n }) as any\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 const res = gen.return!(undefined as any)\n // eat anything that promise would do, it's cancelled!\n const 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 } as any,\n flowAnnotation\n)\n\nflow.bound = createDecoratorAnnotation(flowBoundAnnotation)\n\nfunction cancelPromise(promise) {\n if (isFunction(promise.cancel)) {\n promise.cancel()\n }\n}\n\nexport function flowResult<T>(\n result: T\n): T extends Generator<any, infer R, any>\n ? CancellablePromise<R>\n : T extends CancellablePromise<any>\n ? T\n : never {\n return result as any // just tricking TypeScript :)\n}\n\nexport function isFlow(fn: any): boolean {\n return fn?.isMobXFlow === true\n}\n","import {\n IObservableArray,\n IObservableValue,\n Lambda,\n ObservableMap,\n getAdministration,\n isObservableArray,\n isObservableMap,\n isObservableObject,\n isObservableValue,\n ObservableSet,\n die,\n isStringish\n} from \"../internal\"\n\nexport type ReadInterceptor<T> = (value: any) => T\n\n/** Experimental feature right now, tested indirectly via Mobx-State-Tree */\nexport function interceptReads<T>(value: IObservableValue<T>, handler: ReadInterceptor<T>): Lambda\nexport function interceptReads<T>(\n observableArray: IObservableArray<T>,\n handler: ReadInterceptor<T>\n): Lambda\nexport function interceptReads<K, V>(\n observableMap: ObservableMap<K, V>,\n handler: ReadInterceptor<V>\n): Lambda\nexport function interceptReads<V>(\n observableSet: ObservableSet<V>,\n handler: ReadInterceptor<V>\n): Lambda\nexport function interceptReads(\n object: Object,\n property: string,\n handler: ReadInterceptor<any>\n): Lambda\nexport function interceptReads(thing, propOrHandler?, handler?): Lambda {\n let target\n if (isObservableMap(thing) || isObservableArray(thing) || isObservableValue(thing)) {\n target = getAdministration(thing)\n } else if (isObservableObject(thing)) {\n if (__DEV__ && !isStringish(propOrHandler)) {\n return die(\n `InterceptReads can only be used with a specific property, not with an object in general`\n )\n }\n target = getAdministration(thing, propOrHandler)\n } else if (__DEV__) {\n return die(`Expected observable map, object or array as first array`)\n }\n if (__DEV__ && target.dehancer !== undefined) {\n return die(`An intercept reader was already established`)\n }\n target.dehancer = typeof propOrHandler === \"function\" ? propOrHandler : handler\n return () => {\n target.dehancer = undefined\n }\n}\n","import {\n IArrayWillChange,\n IArrayWillSplice,\n IInterceptor,\n IMapWillChange,\n IObjectWillChange,\n IObservableArray,\n IObservableValue,\n IValueWillChange,\n Lambda,\n ObservableMap,\n getAdministration,\n ObservableSet,\n ISetWillChange,\n isFunction\n} from \"../internal\"\n\nexport function intercept<T>(\n value: IObservableValue<T>,\n handler: IInterceptor<IValueWillChange<T>>\n): Lambda\nexport function intercept<T>(\n observableArray: IObservableArray<T> | Array<T>,\n handler: IInterceptor<IArrayWillChange<T> | IArrayWillSplice<T>>\n): Lambda\nexport function intercept<K, V>(\n observableMap: ObservableMap<K, V> | Map<K, V>,\n handler: IInterceptor<IMapWillChange<K, V>>\n): Lambda\nexport function intercept<V>(\n observableSet: ObservableSet<V> | Set<V>,\n handler: IInterceptor<ISetWillChange<V>>\n): Lambda\nexport function intercept<K, V>(\n observableMap: ObservableMap<K, V> | Map<K, V>,\n property: K,\n handler: IInterceptor<IValueWillChange<V>>\n): Lambda\nexport function intercept(object: object, handler: IInterceptor<IObjectWillChange>): Lambda\nexport function intercept<T extends object, K extends keyof T>(\n object: T,\n property: K,\n handler: IInterceptor<IValueWillChange<T[K]>>\n): Lambda\nexport function intercept(thing, propOrHandler?, handler?): Lambda {\n if (isFunction(handler)) {\n return interceptProperty(thing, propOrHandler, handler)\n } else {\n return interceptInterceptable(thing, propOrHandler)\n }\n}\n\nfunction interceptInterceptable(thing, handler) {\n return getAdministration(thing).intercept_(handler)\n}\n\nfunction interceptProperty(thing, property, handler) {\n return getAdministration(thing, property).intercept_(handler)\n}\n","import { $mobx, getAtom, isComputedValue, isObservableObject, die, isStringish } from \"../internal\"\n\nexport function _isComputed(value, property?: PropertyKey): boolean {\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 const atom = getAtom(value, property)\n return isComputedValue(atom)\n}\n\nexport function isComputed(value: any): boolean {\n if (__DEV__ && arguments.length > 1) {\n return die(\n `isComputed expects only 1 argument. Use isComputedProp to inspect the observability of a property`\n )\n }\n return _isComputed(value)\n}\n\nexport function isComputedProp(value: any, propName: PropertyKey): boolean {\n if (__DEV__ && !isStringish(propName)) {\n return die(`isComputed expected a property name as second argument`)\n }\n return _isComputed(value, propName)\n}\n","import {\n $mobx,\n isAtom,\n isComputedValue,\n isObservableArray,\n isObservableMap,\n isObservableObject,\n isReaction,\n die,\n isStringish\n} from \"../internal\"\n\nfunction _isObservable(value, property?: PropertyKey): boolean {\n if (!value) {\n return false\n }\n if (property !== undefined) {\n if (__DEV__ && (isObservableMap(value) || isObservableArray(value))) {\n return die(\n \"isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead.\"\n )\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 (\n isObservableObject(value) ||\n !!value[$mobx] ||\n isAtom(value) ||\n isReaction(value) ||\n isComputedValue(value)\n )\n}\n\nexport function isObservable(value: any): boolean {\n if (__DEV__ && arguments.length !== 1) {\n die(\n `isObservable expects only 1 argument. Use isObservableProp to inspect the observability of a property`\n )\n }\n return _isObservable(value)\n}\n\nexport function isObservableProp(value: any, propName: PropertyKey): boolean {\n if (__DEV__ && !isStringish(propName)) {\n return die(`expected a property name as second argument`)\n }\n return _isObservable(value, propName)\n}\n","import {\n $mobx,\n IIsObservableObject,\n IObservableArray,\n ObservableMap,\n ObservableSet,\n ObservableObjectAdministration,\n endBatch,\n isObservableArray,\n isObservableMap,\n isObservableSet,\n isObservableObject,\n startBatch,\n die\n} from \"../internal\"\n\nexport function keys<K>(map: ObservableMap<K, any>): ReadonlyArray<K>\nexport function keys<T>(ar: IObservableArray<T>): ReadonlyArray<number>\nexport function keys<T>(set: ObservableSet<T>): ReadonlyArray<T>\nexport function keys<T extends Object>(obj: T): ReadonlyArray<PropertyKey>\nexport function keys(obj: any): any {\n if (isObservableObject(obj)) {\n return (\n (obj as any as IIsObservableObject)[$mobx] as ObservableObjectAdministration\n ).keys_()\n }\n if (isObservableMap(obj) || isObservableSet(obj)) {\n return Array.from(obj.keys())\n }\n if (isObservableArray(obj)) {\n return obj.map((_, index) => index)\n }\n die(5)\n}\n\nexport function values<K, T>(map: ObservableMap<K, T>): ReadonlyArray<T>\nexport function values<T>(set: ObservableSet<T>): ReadonlyArray<T>\nexport function values<T>(ar: IObservableArray<T>): ReadonlyArray<T>\nexport function values<T = any>(obj: T): ReadonlyArray<T extends object ? T[keyof T] : any>\nexport function values(obj: any): string[] {\n if (isObservableObject(obj)) {\n return keys(obj).map(key => obj[key])\n }\n if (isObservableMap(obj)) {\n return keys(obj).map(key => obj.get(key))\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}\n\nexport function entries<K, T>(map: ObservableMap<K, T>): ReadonlyArray<[K, T]>\nexport function entries<T>(set: ObservableSet<T>): ReadonlyArray<[T, T]>\nexport function entries<T>(ar: IObservableArray<T>): ReadonlyArray<[number, T]>\nexport function entries<T = any>(\n obj: T\n): ReadonlyArray<[string, T extends object ? T[keyof T] : any]>\nexport function entries(obj: any): any {\n if (isObservableObject(obj)) {\n return keys(obj).map(key => [key, obj[key]])\n }\n if (isObservableMap(obj)) {\n return keys(obj).map(key => [key, obj.get(key)])\n }\n if (isObservableSet(obj)) {\n return Array.from(obj.entries())\n }\n if (isObservableArray(obj)) {\n return obj.map((key, index) => [index, key])\n }\n die(7)\n}\n\nexport function set<V>(obj: ObservableMap<PropertyKey, V>, values: { [key: string]: V })\nexport function set<K, V>(obj: ObservableMap<K, V>, key: K, value: V)\nexport function set<T>(obj: ObservableSet<T>, value: T)\nexport function set<T>(obj: IObservableArray<T>, index: number, value: T)\nexport function set<T extends Object>(obj: T, values: { [key: string]: any })\nexport function set<T extends Object>(obj: T, key: PropertyKey, value: any)\nexport function set(obj: any, key: any, value?: any): void {\n if (arguments.length === 2 && !isObservableSet(obj)) {\n startBatch()\n const values = key\n try {\n for (let key in values) {\n set(obj, key, values[key])\n }\n } finally {\n endBatch()\n }\n return\n }\n if (isObservableObject(obj)) {\n ;(obj as any as IIsObservableObject)[$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}\n\nexport function remove<K, V>(obj: ObservableMap<K, V>, key: K)\nexport function remove<T>(obj: ObservableSet<T>, key: T)\nexport function remove<T>(obj: IObservableArray<T>, index: number)\nexport function remove<T extends Object>(obj: T, key: string)\nexport function remove(obj: any, key: any): void {\n if (isObservableObject(obj)) {\n ;(obj as any as IIsObservableObject)[$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}\n\nexport function has<K>(obj: ObservableMap<K, any>, key: K): boolean\nexport function has<T>(obj: ObservableSet<T>, key: T): boolean\nexport function has<T>(obj: IObservableArray<T>, index: number): boolean\nexport function has<T extends Object>(obj: T, key: string): boolean\nexport function has(obj: any, key: any): boolean {\n if (isObservableObject(obj)) {\n return (obj as any as IIsObservableObject)[$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}\n\nexport function get<K, V>(obj: ObservableMap<K, V>, key: K): V | undefined\nexport function get<T>(obj: IObservableArray<T>, index: number): T | undefined\nexport function get<T extends Object>(obj: T, key: string): any\nexport function get(obj: any, key: any): any {\n if (!has(obj, key)) {\n return undefined\n }\n if (isObservableObject(obj)) {\n return (obj as any as IIsObservableObject)[$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}\n\nexport function apiDefineProperty(obj: Object, key: PropertyKey, descriptor: PropertyDescriptor) {\n if (isObservableObject(obj)) {\n return (obj as any as IIsObservableObject)[$mobx].defineProperty_(key, descriptor)\n }\n die(39)\n}\n\nexport function apiOwnKeys(obj: Object) {\n if (isObservableObject(obj)) {\n return (obj as any as IIsObservableObject)[$mobx].ownKeys_()\n }\n die(38)\n}\n","import {\n IArrayDidChange,\n IComputedValue,\n IMapDidChange,\n IObjectDidChange,\n IObservableArray,\n IObservableValue,\n IValueDidChange,\n Lambda,\n ObservableMap,\n getAdministration,\n ObservableSet,\n ISetDidChange,\n isFunction\n} from \"../internal\"\n\nexport function observe<T>(\n value: IObservableValue<T> | IComputedValue<T>,\n listener: (change: IValueDidChange<T>) => void,\n fireImmediately?: boolean\n): Lambda\nexport function observe<T>(\n observableArray: IObservableArray<T> | Array<T>,\n listener: (change: IArrayDidChange<T>) => void,\n fireImmediately?: boolean\n): Lambda\nexport function observe<V>(\n // ObservableSet/ObservableMap are required despite they implement Set/Map: https://github.com/mobxjs/mobx/pull/3180#discussion_r746542929\n observableSet: ObservableSet<V> | Set<V>,\n listener: (change: ISetDidChange<V>) => void,\n fireImmediately?: boolean\n): Lambda\nexport function observe<K, V>(\n observableMap: ObservableMap<K, V> | Map<K, V>,\n listener: (change: IMapDidChange<K, V>) => void,\n fireImmediately?: boolean\n): Lambda\nexport function observe<K, V>(\n observableMap: ObservableMap<K, V> | Map<K, V>,\n property: K,\n listener: (change: IValueDidChange<V>) => void,\n fireImmediately?: boolean\n): Lambda\nexport function observe(\n object: Object,\n listener: (change: IObjectDidChange) => void,\n fireImmediately?: boolean\n): Lambda\nexport function observe<T, K extends keyof T>(\n object: T,\n property: K,\n listener: (change: IValueDidChange<T[K]>) => void,\n fireImmediately?: boolean\n): Lambda\nexport function observe(thing, propOrCb?, cbOrFire?, fireImmediately?): Lambda {\n if (isFunction(cbOrFire)) {\n return observeObservableProperty(thing, propOrCb, cbOrFire, fireImmediately)\n } else {\n return observeObservable(thing, propOrCb, cbOrFire)\n }\n}\n\nfunction observeObservable(thing, listener, fireImmediately: boolean) {\n return getAdministration(thing).observe_(listener, fireImmediately)\n}\n\nfunction observeObservableProperty(thing, property, listener, fireImmediately: boolean) {\n return getAdministration(thing, property).observe_(listener, fireImmediately)\n}\n","import {\n isObservable,\n isObservableArray,\n isObservableValue,\n isObservableMap,\n isObservableSet,\n isComputedValue,\n die,\n apiOwnKeys,\n objectPrototype\n} from \"../internal\"\n\nfunction cache<K, V>(map: Map<any, any>, key: K, value: V): V {\n map.set(key, value)\n return value\n}\n\nfunction toJSHelper(source, __alreadySeen: Map<any, any>) {\n if (\n source == null ||\n typeof source !== \"object\" ||\n source instanceof Date ||\n !isObservable(source)\n ) {\n return source\n }\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 const res = cache(__alreadySeen, source, new Array(source.length))\n source.forEach((value, idx) => {\n res[idx] = toJSHelper(value, __alreadySeen)\n })\n return res\n }\n if (isObservableSet(source)) {\n const res = cache(__alreadySeen, source, new Set())\n source.forEach(value => {\n res.add(toJSHelper(value, __alreadySeen))\n })\n return res\n }\n if (isObservableMap(source)) {\n const res = cache(__alreadySeen, source, new Map())\n source.forEach((value, key) => {\n res.set(key, toJSHelper(value, __alreadySeen))\n })\n return res\n } else {\n // must be observable object\n const res = cache(__alreadySeen, source, {})\n apiOwnKeys(source).forEach((key: any) => {\n if (objectPrototype.propertyIsEnumerable.call(source, key)) {\n res[key] = toJSHelper(source[key], __alreadySeen)\n }\n })\n return res\n }\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 */\nexport function toJS<T>(source: T, options?: any): T {\n if (__DEV__ && options) {\n die(\"toJS no longer supports options\")\n }\n return toJSHelper(source, new Map())\n}\n","import { TraceMode, die, getAtom, globalState } from \"../internal\"\n\nexport function trace(thing?: any, prop?: string, enterBreakPoint?: boolean): void\nexport function trace(thing?: any, enterBreakPoint?: boolean): void\nexport function trace(enterBreakPoint?: boolean): void\nexport function trace(...args: any[]): void {\n if (!__DEV__) {\n return\n }\n let enterBreakPoint = false\n if (typeof args[args.length - 1] === \"boolean\") {\n enterBreakPoint = args.pop()\n }\n const derivation = getAtomFromArgs(args)\n if (!derivation) {\n return die(\n `'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 }\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}\n\nfunction getAtomFromArgs(args): any {\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","import { endBatch, startBatch } from \"../internal\"\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 */\nexport function transaction<T>(action: () => T, thisArg = undefined): T {\n startBatch()\n try {\n return action.apply(thisArg)\n } finally {\n endBatch()\n }\n}\n","import {\n $mobx,\n IReactionDisposer,\n Lambda,\n autorun,\n createAction,\n getNextId,\n die,\n allowStateChanges,\n GenericAbortSignal\n} from \"../internal\"\n\nexport interface IWhenOptions {\n name?: string\n timeout?: number\n onError?: (error: any) => void\n signal?: GenericAbortSignal\n}\n\nexport function when(\n predicate: () => boolean,\n opts?: IWhenOptions\n): Promise<void> & { cancel(): void }\nexport function when(\n predicate: () => boolean,\n effect: Lambda,\n opts?: IWhenOptions\n): IReactionDisposer\nexport function when(predicate: any, arg1?: any, arg2?: any): any {\n if (arguments.length === 1 || (arg1 && typeof arg1 === \"object\")) {\n return whenPromise(predicate, arg1)\n }\n return _when(predicate, arg1, arg2 || {})\n}\n\nfunction _when(predicate: () => boolean, effect: Lambda, opts: IWhenOptions): IReactionDisposer {\n let timeoutHandle: any\n if (typeof opts.timeout === \"number\") {\n const error = new Error(\"WHEN_TIMEOUT\")\n timeoutHandle = setTimeout(() => {\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\n opts.name = __DEV__ ? opts.name || \"When@\" + getNextId() : \"When\"\n const effectAction = createAction(\n __DEV__ ? opts.name + \"-effect\" : \"When-effect\",\n effect as Function\n )\n // eslint-disable-next-line\n var disposer = autorun(r => {\n // predicate should not change state\n let 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}\n\nfunction whenPromise(\n predicate: () => boolean,\n opts?: IWhenOptions\n): Promise<void> & { cancel(): void } {\n if (__DEV__ && opts && opts.onError) {\n return die(`the options 'onError' and 'promise' cannot be combined`)\n }\n if (opts?.signal?.aborted) {\n return Object.assign(Promise.reject(new Error(\"WHEN_ABORTED\")), { cancel: () => null })\n }\n let cancel\n let abort\n const res = new Promise((resolve, reject) => {\n let disposer = _when(predicate, resolve as Lambda, { ...opts, onError: reject })\n cancel = () => {\n disposer()\n reject(new Error(\"WHEN_CANCELLED\"))\n }\n abort = () => {\n disposer()\n reject(new Error(\"WHEN_ABORTED\"))\n }\n opts?.signal?.addEventListener?.(\"abort\", abort)\n }).finally(() => opts?.signal?.removeEventListener?.(\"abort\", abort))\n ;(res as any).cancel = cancel\n return res as any\n}\n","import { Lambda, once, untrackedEnd, untrackedStart, die } from \"../internal\"\n\nexport type IInterceptor<T> = (change: T) => T | null\n\nexport interface IInterceptable<T> {\n interceptors_: IInterceptor<T>[] | undefined\n}\n\nexport function hasInterceptors(interceptable: IInterceptable<any>) {\n return interceptable.interceptors_ !== undefined && interceptable.interceptors_.length > 0\n}\n\nexport function registerInterceptor<T>(\n interceptable: IInterceptable<T>,\n handler: IInterceptor<T>\n): Lambda {\n const interceptors = interceptable.interceptors_ || (interceptable.interceptors_ = [])\n interceptors.push(handler)\n return once(() => {\n const idx = interceptors.indexOf(handler)\n if (idx !== -1) {\n interceptors.splice(idx, 1)\n }\n })\n}\n\nexport function interceptChange<T>(\n interceptable: IInterceptable<T | null>,\n change: T | null\n): T | null {\n const prevU = untrackedStart()\n try {\n // Interceptor can modify the array, copy it to avoid concurrent modification, see #1950\n const interceptors = [...(interceptable.interceptors_ || [])]\n for (let i = 0, l = interceptors.length; i < l; i++) {\n change = interceptors[i](change)\n if (change && !(change as any).type) {\n die(14)\n }\n if (!change) {\n break\n }\n }\n return change\n } finally {\n untrackedEnd(prevU)\n }\n}\n","import { Lambda, once, untrackedEnd, untrackedStart } from \"../internal\"\n\nexport interface IListenable {\n changeListeners_: Function[] | undefined\n}\n\nexport function hasListeners(listenable: IListenable) {\n return listenable.changeListeners_ !== undefined && listenable.changeListeners_.length > 0\n}\n\nexport function registerListener(listenable: IListenable, handler: Function): Lambda {\n const listeners = listenable.changeListeners_ || (listenable.changeListeners_ = [])\n listeners.push(handler)\n return once(() => {\n const idx = listeners.indexOf(handler)\n if (idx !== -1) {\n listeners.splice(idx, 1)\n }\n })\n}\n\nexport function notifyListeners<T>(listenable: IListenable, change: T) {\n const prevU = untrackedStart()\n let listeners = listenable.changeListeners_\n if (!listeners) {\n return\n }\n listeners = listeners.slice()\n for (let i = 0, l = listeners.length; i < l; i++) {\n listeners[i](change)\n }\n untrackedEnd(prevU)\n}\n","import {\n $mobx,\n asObservableObject,\n AnnotationsMap,\n CreateObservableOptions,\n ObservableObjectAdministration,\n collectStoredAnnotations,\n isPlainObject,\n isObservableObject,\n die,\n ownKeys,\n extendObservable,\n addHiddenProp,\n storedAnnotationsSymbol,\n initObservable\n} from \"../internal\"\n\n// Hack based on https://github.com/Microsoft/TypeScript/issues/14829#issuecomment-322267089\n// We need this, because otherwise, AdditionalKeys is going to be inferred to be any\n// set of superfluous keys. But, we rather want to get a compile error unless AdditionalKeys is\n// _explicity_ passed as generic argument\n// Fixes: https://github.com/mobxjs/mobx/issues/2325#issuecomment-691070022\ntype NoInfer<T> = [T][T extends any ? 0 : never]\n\ntype MakeObservableOptions = Omit<CreateObservableOptions, \"proxy\">\n\nexport function makeObservable<T extends object, AdditionalKeys extends PropertyKey = never>(\n target: T,\n annotations?: AnnotationsMap<T, NoInfer<AdditionalKeys>>,\n options?: MakeObservableOptions\n): T {\n initObservable(() => {\n const adm: ObservableObjectAdministration = asObservableObject(target, options)[$mobx]\n if (__DEV__ && annotations && target[storedAnnotationsSymbol]) {\n die(\n `makeObservable second arg must be nullish when using decorators. Mixing @decorator syntax with annotations is not supported.`\n )\n }\n // Default to decorators\n annotations ??= collectStoredAnnotations(target)\n\n // Annotate\n ownKeys(annotations).forEach(key => adm.make_(key, annotations![key]))\n })\n return target\n}\n\n// proto[keysSymbol] = new Set<PropertyKey>()\nconst keysSymbol = Symbol(\"mobx-keys\")\n\nexport function makeAutoObservable<T extends object, AdditionalKeys extends PropertyKey = never>(\n target: T,\n overrides?: AnnotationsMap<T, NoInfer<AdditionalKeys>>,\n options?: MakeObservableOptions\n): T {\n if (__DEV__) {\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\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\n initObservable(() => {\n const adm: ObservableObjectAdministration = asObservableObject(target, options)[$mobx]\n\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 const proto = Object.getPrototypeOf(target)\n const keys = new Set([...ownKeys(target), ...ownKeys(proto)])\n keys.delete(\"constructor\")\n keys.delete($mobx)\n addHiddenProp(proto, keysSymbol, keys)\n }\n\n target[keysSymbol].forEach(key =>\n adm.make_(\n key,\n // must pass \"undefined\" for { key: undefined }\n !overrides ? true : key in overrides ? overrides[key] : true\n )\n )\n })\n\n return target\n}\n","import {\n $mobx,\n Atom,\n EMPTY_ARRAY,\n IAtom,\n IEnhancer,\n IInterceptable,\n IInterceptor,\n IListenable,\n Lambda,\n addHiddenFinalProp,\n checkIfStateModificationsAreAllowed,\n createInstanceofPredicate,\n getNextId,\n hasInterceptors,\n hasListeners,\n interceptChange,\n isObject,\n isSpyEnabled,\n notifyListeners,\n registerInterceptor,\n registerListener,\n spyReportEnd,\n spyReportStart,\n assertProxies,\n reserveArrayBuffer,\n hasProp,\n die,\n globalState,\n initObservable\n} from \"../internal\"\n\nconst SPLICE = \"splice\"\nexport const UPDATE = \"update\"\nexport const MAX_SPLICE_SIZE = 10000 // See e.g. https://github.com/mobxjs/mobx/issues/859\n\nexport interface IObservableArray<T = any> extends Array<T> {\n spliceWithArray(index: number, deleteCount?: number, newItems?: T[]): T[]\n clear(): T[]\n replace(newItems: T[]): T[]\n remove(value: T): boolean\n toJSON(): T[]\n}\n\ninterface IArrayBaseChange<T> {\n object: IObservableArray<T>\n observableKind: \"array\"\n debugObjectName: string\n index: number\n}\n\nexport type IArrayDidChange<T = any> = IArrayUpdate<T> | IArraySplice<T>\n\nexport interface IArrayUpdate<T = any> extends IArrayBaseChange<T> {\n type: \"update\"\n newValue: T\n oldValue: T\n}\n\nexport interface IArraySplice<T = any> extends IArrayBaseChange<T> {\n type: \"splice\"\n added: T[]\n addedCount: number\n removed: T[]\n removedCount: number\n}\n\nexport interface IArrayWillChange<T = any> {\n object: IObservableArray<T>\n index: number\n type: \"update\"\n newValue: T\n}\n\nexport interface IArrayWillSplice<T = any> {\n object: IObservableArray<T>\n index: number\n type: \"splice\"\n added: T[]\n removedCount: number\n}\n\nconst arrayTraps = {\n get(target, name) {\n const adm: ObservableArrayAdministration = 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 as any)) {\n return adm.get_(parseInt(name))\n }\n if (hasProp(arrayExtensions, name)) {\n return arrayExtensions[name]\n }\n return target[name]\n },\n set(target, name, value): boolean {\n const adm: ObservableArrayAdministration = 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() {\n die(15)\n }\n}\n\nexport class ObservableArrayAdministration\n implements IInterceptable<IArrayWillChange<any> | IArrayWillSplice<any>>, IListenable\n{\n atom_: IAtom\n readonly values_: any[] = [] // this is the prop that gets proxied, so can't replace it!\n interceptors_\n changeListeners_\n enhancer_: (newV: any, oldV: any | undefined) => any\n dehancer: any\n proxy_!: IObservableArray<any>\n lastKnownLength_ = 0\n\n constructor(\n name = __DEV__ ? \"ObservableArray@\" + getNextId() : \"ObservableArray\",\n enhancer: IEnhancer<any>,\n public owned_: boolean,\n public legacyMode_: boolean\n ) {\n this.atom_ = new Atom(name)\n this.enhancer_ = (newV, oldV) =>\n enhancer(newV, oldV, __DEV__ ? name + \"[..]\" : \"ObservableArray[..]\")\n }\n\n dehanceValue_(value: any): any {\n if (this.dehancer !== undefined) {\n return this.dehancer(value)\n }\n return value\n }\n\n dehanceValues_(values: any[]): any[] {\n if (this.dehancer !== undefined && values.length > 0) {\n return values.map(this.dehancer) as any\n }\n return values\n }\n\n intercept_(handler: IInterceptor<IArrayWillChange<any> | IArrayWillSplice<any>>): Lambda {\n return registerInterceptor<IArrayWillChange<any> | IArrayWillSplice<any>>(this, handler)\n }\n\n observe_(\n listener: (changeData: IArrayDidChange<any>) => void,\n fireImmediately = false\n ): Lambda {\n if (fireImmediately) {\n listener(<IArraySplice<any>>{\n observableKind: \"array\",\n object: this.proxy_ as any,\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\n getArrayLength_(): number {\n this.atom_.reportObserved()\n return this.values_.length\n }\n\n setArrayLength_(newLength: number) {\n if (typeof newLength !== \"number\" || isNaN(newLength) || newLength < 0) {\n die(\"Out of range: \" + newLength)\n }\n let currentLength = this.values_.length\n if (newLength === currentLength) {\n return\n } else if (newLength > currentLength) {\n const newItems = new Array(newLength - currentLength)\n for (let 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\n updateArrayLength_(oldLength: number, delta: number) {\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\n spliceWithArray_(index: number, deleteCount?: number, newItems?: any[]): any[] {\n checkIfStateModificationsAreAllowed(this.atom_)\n const length = this.values_.length\n\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\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\n if (newItems === undefined) {\n newItems = EMPTY_ARRAY\n }\n\n if (hasInterceptors(this)) {\n const change = interceptChange<IArrayWillSplice<any>>(this as any, {\n object: this.proxy_ as any,\n type: SPLICE,\n 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\n newItems =\n newItems.length === 0 ? newItems : newItems.map(v => this.enhancer_(v, undefined))\n if (this.legacyMode_ || __DEV__) {\n const lengthDelta = newItems.length - deleteCount\n this.updateArrayLength_(length, lengthDelta) // checks if internal array wasn't modified\n }\n const res = this.spliceItemsIntoValues_(index, deleteCount, newItems)\n\n if (deleteCount !== 0 || newItems.length !== 0) {\n this.notifyArraySplice_(index, newItems, res)\n }\n return this.dehanceValues_(res)\n }\n\n spliceItemsIntoValues_(index: number, deleteCount: number, newItems: any[]): any[] {\n if (newItems.length < MAX_SPLICE_SIZE) {\n return this.values_.splice(index, deleteCount, ...newItems)\n } else {\n // The items removed by the splice\n const res = this.values_.slice(index, index + deleteCount)\n // The items that that should remain at the end of the array\n let 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 (let i = 0; i < newItems.length; i++) {\n this.values_[index + i] = newItems[i]\n }\n for (let i = 0; i < oldItems.length; i++) {\n this.values_[index + newItems.length + i] = oldItems[i]\n }\n return res\n }\n }\n\n notifyArrayChildUpdate_(index: number, newValue: any, oldValue: any) {\n const notifySpy = !this.owned_ && isSpyEnabled()\n const notify = hasListeners(this)\n const change: IArrayDidChange | null =\n notify || notifySpy\n ? ({\n observableKind: \"array\",\n object: this.proxy_,\n type: UPDATE,\n debugObjectName: this.atom_.name_,\n index,\n newValue,\n oldValue\n } as const)\n : null\n\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 (__DEV__ && notifySpy) {\n spyReportStart(change!)\n }\n this.atom_.reportChanged()\n if (notify) {\n notifyListeners(this, change)\n }\n if (__DEV__ && notifySpy) {\n spyReportEnd()\n }\n }\n\n notifyArraySplice_(index: number, added: any[], removed: any[]) {\n const notifySpy = !this.owned_ && isSpyEnabled()\n const notify = hasListeners(this)\n const change: IArraySplice | null =\n notify || notifySpy\n ? ({\n observableKind: \"array\",\n object: this.proxy_,\n debugObjectName: this.atom_.name_,\n type: SPLICE,\n index,\n removed,\n added,\n removedCount: removed.length,\n addedCount: added.length\n } as const)\n : null\n\n if (__DEV__ && 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 (__DEV__ && notifySpy) {\n spyReportEnd()\n }\n }\n\n get_(index: number): any | undefined {\n if (this.legacyMode_ && index >= this.values_.length) {\n console.warn(\n __DEV__\n ? `[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`\n : `[mobx] Out of bounds read: ${index}`\n )\n return undefined\n }\n this.atom_.reportObserved()\n return this.dehanceValue_(this.values_[index])\n }\n\n set_(index: number, newValue: any) {\n const 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 const oldValue = values[index]\n if (hasInterceptors(this)) {\n const change = interceptChange<IArrayWillChange<any>>(this as any, {\n type: UPDATE,\n object: this.proxy_ as any, // since \"this\" is the real array we need to pass its proxy\n index,\n newValue\n })\n if (!change) {\n return\n }\n newValue = change.newValue\n }\n newValue = this.enhancer_(newValue, oldValue)\n const 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 const newItems = new Array(index + 1 - values.length)\n for (let 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}\n\nexport function createObservableArray<T>(\n initialValues: T[] | undefined,\n enhancer: IEnhancer<T>,\n name = __DEV__ ? \"ObservableArray@\" + getNextId() : \"ObservableArray\",\n owned = false\n): IObservableArray<T> {\n assertProxies()\n return initObservable(() => {\n const adm = new ObservableArrayAdministration(name, enhancer, owned, false)\n addHiddenFinalProp(adm.values_, $mobx, adm)\n const proxy = new Proxy(adm.values_, arrayTraps) as any\n adm.proxy_ = proxy\n if (initialValues && initialValues.length) {\n adm.spliceWithArray_(0, 0, initialValues)\n }\n return proxy\n })\n}\n\n// eslint-disable-next-line\nexport var arrayExtensions = {\n clear(): any[] {\n return this.splice(0)\n },\n\n replace(newItems: any[]) {\n const adm: ObservableArrayAdministration = this[$mobx]\n return adm.spliceWithArray_(0, adm.values_.length, newItems)\n },\n\n // Used by JSON.stringify\n toJSON(): any[] {\n return this.slice()\n },\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(index: number, deleteCount?: number, ...newItems: any[]): any[] {\n const adm: ObservableArrayAdministration = 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\n spliceWithArray(index: number, deleteCount?: number, newItems?: any[]): any[] {\n return (this[$mobx] as ObservableArrayAdministration).spliceWithArray_(\n index,\n deleteCount,\n newItems\n )\n },\n\n push(...items: any[]): number {\n const adm: ObservableArrayAdministration = this[$mobx]\n adm.spliceWithArray_(adm.values_.length, 0, items)\n return adm.values_.length\n },\n\n pop() {\n return this.splice(Math.max(this[$mobx].values_.length - 1, 0), 1)[0]\n },\n\n shift() {\n return this.splice(0, 1)[0]\n },\n\n unshift(...items: any[]): number {\n const adm: ObservableArrayAdministration = this[$mobx]\n adm.spliceWithArray_(0, 0, items)\n return adm.values_.length\n },\n\n reverse(): any[] {\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\n sort(): any[] {\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 const copy = this.slice()\n copy.sort.apply(copy, arguments)\n this.replace(copy)\n return this\n },\n\n remove(value: any): boolean {\n const adm: ObservableArrayAdministration = this[$mobx]\n const 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/**\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)\n\nfunction addArrayExtension(funcName, funcFactory) {\n if (typeof Array.prototype[funcName] === \"function\") {\n arrayExtensions[funcName] = funcFactory(funcName)\n }\n}\n\n// Report and delegate to dehanced array\nfunction simpleFunc(funcName) {\n return function () {\n const adm: ObservableArrayAdministration = this[$mobx]\n adm.atom_.reportObserved()\n const dehancedValues = adm.dehanceValues_(adm.values_)\n return dehancedValues[funcName].apply(dehancedValues, arguments)\n }\n}\n\n// Make sure callbacks receive correct array arg #2326\nfunction mapLikeFunc(funcName) {\n return function (callback, thisArg) {\n const adm: ObservableArrayAdministration = this[$mobx]\n adm.atom_.reportObserved()\n const dehancedValues = adm.dehanceValues_(adm.values_)\n return dehancedValues[funcName]((element, index) => {\n return callback.call(thisArg, element, index, this)\n })\n }\n}\n\n// Make sure callbacks receive correct array arg #2326\nfunction reduceLikeFunc(funcName) {\n return function () {\n const adm: ObservableArrayAdministration = this[$mobx]\n adm.atom_.reportObserved()\n const dehancedValues = adm.dehanceValues_(adm.values_)\n // #2432 - reduce behavior depends on arguments.length\n const callback = arguments[0]\n arguments[0] = (accumulator, currentValue, index) => {\n return callback(accumulator, currentValue, index, this)\n }\n return dehancedValues[funcName].apply(dehancedValues, arguments)\n }\n}\n\nconst isObservableArrayAdministration = createInstanceofPredicate(\n \"ObservableArrayAdministration\",\n ObservableArrayAdministration\n)\n\nexport function isObservableArray(thing): thing is IObservableArray<any> {\n return isObject(thing) && isObservableArrayAdministration(thing[$mobx])\n}\n","import {\n $mobx,\n IEnhancer,\n IInterceptable,\n IInterceptor,\n IListenable,\n Lambda,\n ObservableValue,\n checkIfStateModificationsAreAllowed,\n createAtom,\n createInstanceofPredicate,\n deepEnhancer,\n getNextId,\n getPlainObjectKeys,\n hasInterceptors,\n hasListeners,\n interceptChange,\n isES6Map,\n isPlainES6Map,\n isPlainObject,\n isSpyEnabled,\n makeIterable,\n notifyListeners,\n referenceEnhancer,\n registerInterceptor,\n registerListener,\n spyReportEnd,\n spyReportStart,\n stringifyKey,\n transaction,\n untracked,\n onBecomeUnobserved,\n globalState,\n die,\n isFunction,\n UPDATE,\n IAtom,\n PureSpyEvent,\n initObservable\n} from \"../internal\"\n\nexport interface IKeyValueMap<V = any> {\n [key: string]: V\n}\n\nexport type IMapEntry<K = any, V = any> = [K, V]\nexport type IReadonlyMapEntry<K = any, V = any> = readonly [K, V]\nexport type IMapEntries<K = any, V = any> = IMapEntry<K, V>[]\nexport type IReadonlyMapEntries<K = any, V = any> = IReadonlyMapEntry<K, V>[]\n\nexport type IMapDidChange<K = any, V = any> = { observableKind: \"map\"; debugObjectName: string } & (\n | {\n object: ObservableMap<K, V>\n name: K // actual the key or index, but this is based on the ancient .observe proposal for consistency\n type: \"update\"\n newValue: V\n oldValue: V\n }\n | {\n object: ObservableMap<K, V>\n name: K\n type: \"add\"\n newValue: V\n }\n | {\n object: ObservableMap<K, V>\n name: K\n type: \"delete\"\n oldValue: V\n }\n)\n\nexport interface IMapWillChange<K = any, V = any> {\n object: ObservableMap<K, V>\n type: \"update\" | \"add\" | \"delete\"\n name: K\n newValue?: V\n}\n\nconst ObservableMapMarker = {}\n\nexport const ADD = \"add\"\nexport const DELETE = \"delete\"\n\nexport type IObservableMapInitialValues<K = any, V = any> =\n | IMapEntries<K, V>\n | IReadonlyMapEntries<K, V>\n | IKeyValueMap<V>\n | Map<K, V>\n\n// just extend Map? See also https://gist.github.com/nestharus/13b4d74f2ef4a2f4357dbd3fc23c1e54\n// But: https://github.com/mobxjs/mobx/issues/1556\nexport class ObservableMap<K = any, V = any>\n implements Map<K, V>, IInterceptable<IMapWillChange<K, V>>, IListenable\n{\n [$mobx] = ObservableMapMarker\n data_!: Map<K, ObservableValue<V>>\n hasMap_!: Map<K, ObservableValue<boolean>> // hasMap, not hashMap >-).\n keysAtom_!: IAtom\n interceptors_\n changeListeners_\n dehancer: any\n\n constructor(\n initialData?: IObservableMapInitialValues<K, V>,\n public enhancer_: IEnhancer<V> = deepEnhancer,\n public name_ = __DEV__ ? \"ObservableMap@\" + getNextId() : \"ObservableMap\"\n ) {\n if (!isFunction(Map)) {\n die(18)\n }\n initObservable(() => {\n this.keysAtom_ = createAtom(__DEV__ ? `${this.name_}.keys()` : \"ObservableMap.keys()\")\n this.data_ = new Map()\n this.hasMap_ = new Map()\n if (initialData) {\n this.merge(initialData)\n }\n })\n }\n\n private has_(key: K): boolean {\n return this.data_.has(key)\n }\n\n has(key: K): boolean {\n if (!globalState.trackingDerivation) {\n return this.has_(key)\n }\n\n let entry = this.hasMap_.get(key)\n if (!entry) {\n const newEntry = (entry = new ObservableValue(\n this.has_(key),\n referenceEnhancer,\n __DEV__ ? `${this.name_}.${stringifyKey(key)}?` : \"ObservableMap.key?\",\n false\n ))\n this.hasMap_.set(key, newEntry)\n onBecomeUnobserved(newEntry, () => this.hasMap_.delete(key))\n }\n\n return entry.get()\n }\n\n set(key: K, value: V) {\n const hasKey = this.has_(key)\n if (hasInterceptors(this)) {\n const change = interceptChange<IMapWillChange<K, V>>(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\n delete(key: K): boolean {\n checkIfStateModificationsAreAllowed(this.keysAtom_)\n if (hasInterceptors(this)) {\n const change = interceptChange<IMapWillChange<K, V>>(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 const notifySpy = isSpyEnabled()\n const notify = hasListeners(this)\n const change: IMapDidChange<K, V> | null =\n notify || notifySpy\n ? {\n observableKind: \"map\",\n debugObjectName: this.name_,\n type: DELETE,\n object: this,\n oldValue: (<any>this.data_.get(key)).value_,\n name: key\n }\n : null\n\n if (__DEV__ && notifySpy) {\n spyReportStart(change! as PureSpyEvent)\n } // TODO fix type\n transaction(() => {\n this.keysAtom_.reportChanged()\n this.hasMap_.get(key)?.setNewValue_(false)\n const observable = this.data_.get(key)!\n observable.setNewValue_(undefined as any)\n this.data_.delete(key)\n })\n if (notify) {\n notifyListeners(this, change)\n }\n if (__DEV__ && notifySpy) {\n spyReportEnd()\n }\n return true\n }\n return false\n }\n\n private updateValue_(key: K, newValue: V | undefined) {\n const observable = this.data_.get(key)!\n newValue = (observable as any).prepareNewValue_(newValue) as V\n if (newValue !== globalState.UNCHANGED) {\n const notifySpy = isSpyEnabled()\n const notify = hasListeners(this)\n const change: IMapDidChange<K, V> | null =\n notify || notifySpy\n ? {\n observableKind: \"map\",\n debugObjectName: this.name_,\n type: UPDATE,\n object: this,\n oldValue: (observable as any).value_,\n name: key,\n newValue\n }\n : null\n if (__DEV__ && notifySpy) {\n spyReportStart(change! as PureSpyEvent)\n } // TODO fix type\n observable.setNewValue_(newValue as V)\n if (notify) {\n notifyListeners(this, change)\n }\n if (__DEV__ && notifySpy) {\n spyReportEnd()\n }\n }\n }\n\n private addValue_(key: K, newValue: V) {\n checkIfStateModificationsAreAllowed(this.keysAtom_)\n transaction(() => {\n const observable = new ObservableValue(\n newValue,\n this.enhancer_,\n __DEV__ ? `${this.name_}.${stringifyKey(key)}` : \"ObservableMap.key\",\n false\n )\n this.data_.set(key, observable)\n newValue = (observable as any).value_ // value might have been changed\n this.hasMap_.get(key)?.setNewValue_(true)\n this.keysAtom_.reportChanged()\n })\n const notifySpy = isSpyEnabled()\n const notify = hasListeners(this)\n const change: IMapDidChange<K, V> | null =\n notify || notifySpy\n ? {\n observableKind: \"map\",\n debugObjectName: this.name_,\n type: ADD,\n object: this,\n name: key,\n newValue\n }\n : null\n if (__DEV__ && notifySpy) {\n spyReportStart(change! as PureSpyEvent)\n } // TODO fix type\n if (notify) {\n notifyListeners(this, change)\n }\n if (__DEV__ && notifySpy) {\n spyReportEnd()\n }\n }\n\n get(key: K): V | undefined {\n if (this.has(key)) {\n return this.dehanceValue_(this.data_.get(key)!.get())\n }\n return this.dehanceValue_(undefined)\n }\n\n private dehanceValue_<X extends V | undefined>(value: X): X {\n if (this.dehancer !== undefined) {\n return this.dehancer(value)\n }\n return value\n }\n\n keys(): IterableIterator<K> {\n this.keysAtom_.reportObserved()\n return this.data_.keys()\n }\n\n values(): IterableIterator<V> {\n const self = this\n const keys = this.keys()\n return makeIterable({\n next() {\n const { done, value } = keys.next()\n return {\n done,\n value: done ? (undefined as any) : self.get(value)\n }\n }\n })\n }\n\n entries(): IterableIterator<IMapEntry<K, V>> {\n const self = this\n const keys = this.keys()\n return makeIterable({\n next() {\n const { done, value } = keys.next()\n return {\n done,\n value: done ? (undefined as any) : ([value, self.get(value)!] as [K, V])\n }\n }\n })\n }\n\n [Symbol.iterator]() {\n return this.entries()\n }\n\n forEach(callback: (value: V, key: K, object: Map<K, V>) => void, thisArg?) {\n for (const [key, value] of this) {\n callback.call(thisArg, value, key, this)\n }\n }\n\n /** Merge another object into this object, returns this. */\n merge(other?: IObservableMapInitialValues<K, V>): ObservableMap<K, V> {\n if (isObservableMap(other)) {\n other = new Map(other)\n }\n transaction(() => {\n if (isPlainObject(other)) {\n getPlainObjectKeys(other).forEach((key: any) =>\n this.set(key as K, (other as IKeyValueMap)[key])\n )\n } else if (Array.isArray(other)) {\n other.forEach(([key, value]) => this.set(key, value))\n } else if (isES6Map(other)) {\n if (!isPlainES6Map(other)) {\n die(19, other)\n }\n other.forEach((value, key) => this.set(key, value))\n } else if (other !== null && other !== undefined) {\n die(20, other)\n }\n })\n return this\n }\n\n clear() {\n transaction(() => {\n untracked(() => {\n for (const key of this.keys()) {\n this.delete(key)\n }\n })\n })\n }\n\n replace(values: IObservableMapInitialValues<K, V>): ObservableMap<K, V> {\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(() => {\n // Convert to map so we can do quick key lookups\n const replacementMap = convertToMap(values)\n const orderedData = new Map()\n // Used for optimization\n let 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 (const key of this.data_.keys()) {\n // Concurrently iterating/deleting keys\n // iterator should handle this correctly\n if (!replacementMap.has(key)) {\n const deleted = this.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 const value = this.data_.get(key)\n orderedData.set(key, value)\n }\n }\n }\n // Merge entries\n for (const [key, value] of replacementMap.entries()) {\n // We will want to know whether a new key is added\n const keyExisted = this.data_.has(key)\n // Add or update value\n this.set(key, value)\n // The addition could have been prevent by interceptor\n if (this.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 const value = this.data_.get(key)\n orderedData.set(key, value)\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 (this.data_.size !== orderedData.size) {\n // If size differs, keys are definitely modified\n this.keysAtom_.reportChanged()\n } else {\n const iter1 = this.data_.keys()\n const iter2 = orderedData.keys()\n let next1 = iter1.next()\n let next2 = iter2.next()\n while (!next1.done) {\n if (next1.value !== next2.value) {\n this.keysAtom_.reportChanged()\n break\n }\n next1 = iter1.next()\n next2 = iter2.next()\n }\n }\n }\n // Use correctly ordered map\n this.data_ = orderedData\n })\n return this\n }\n\n get size(): number {\n this.keysAtom_.reportObserved()\n return this.data_.size\n }\n\n toString(): string {\n return \"[object ObservableMap]\"\n }\n\n toJSON(): [K, V][] {\n return Array.from(this)\n }\n\n get [Symbol.toStringTag]() {\n return \"Map\"\n }\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 observe_(listener: (changes: IMapDidChange<K, V>) => void, fireImmediately?: boolean): Lambda {\n if (__DEV__ && fireImmediately === true) {\n die(\"`observe` doesn't support fireImmediately=true in combination with maps.\")\n }\n return registerListener(this, listener)\n }\n\n intercept_(handler: IInterceptor<IMapWillChange<K, V>>): Lambda {\n return registerInterceptor(this, handler)\n }\n}\n\n// eslint-disable-next-line\nexport var isObservableMap = createInstanceofPredicate(\"ObservableMap\", ObservableMap) as (\n thing: any\n) => thing is ObservableMap<any, any>\n\nfunction convertToMap(dataStructure: any): Map<any, any> {\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 const map = new Map()\n for (const key in dataStructure) {\n map.set(key, dataStructure[key])\n }\n return map\n } else {\n return die(21, dataStructure)\n }\n}\n","import {\n $mobx,\n createAtom,\n deepEnhancer,\n getNextId,\n IEnhancer,\n isSpyEnabled,\n hasListeners,\n IListenable,\n registerListener,\n Lambda,\n spyReportStart,\n notifyListeners,\n spyReportEnd,\n createInstanceofPredicate,\n hasInterceptors,\n interceptChange,\n IInterceptable,\n IInterceptor,\n registerInterceptor,\n checkIfStateModificationsAreAllowed,\n untracked,\n makeIterable,\n transaction,\n isES6Set,\n IAtom,\n DELETE,\n ADD,\n die,\n isFunction,\n initObservable\n} from \"../internal\"\n\nconst ObservableSetMarker = {}\n\nexport type IObservableSetInitialValues<T> = Set<T> | readonly T[]\n\nexport type ISetDidChange<T = any> =\n | {\n object: ObservableSet<T>\n observableKind: \"set\"\n debugObjectName: string\n type: \"add\"\n newValue: T\n }\n | {\n object: ObservableSet<T>\n observableKind: \"set\"\n debugObjectName: string\n type: \"delete\"\n oldValue: T\n }\n\nexport type ISetWillChange<T = any> =\n | {\n type: \"delete\"\n object: ObservableSet<T>\n oldValue: T\n }\n | {\n type: \"add\"\n object: ObservableSet<T>\n newValue: T\n }\n\nexport class ObservableSet<T = any> implements Set<T>, IInterceptable<ISetWillChange>, IListenable {\n [$mobx] = ObservableSetMarker\n private data_: Set<any> = new Set()\n atom_!: IAtom\n changeListeners_\n interceptors_\n dehancer: any\n enhancer_: (newV: any, oldV: any | undefined) => any\n\n constructor(\n initialData?: IObservableSetInitialValues<T>,\n enhancer: IEnhancer<T> = deepEnhancer,\n public name_ = __DEV__ ? \"ObservableSet@\" + getNextId() : \"ObservableSet\"\n ) {\n if (!isFunction(Set)) {\n die(22)\n }\n this.enhancer_ = (newV, oldV) => enhancer(newV, oldV, name_)\n initObservable(() => {\n this.atom_ = createAtom(this.name_)\n if (initialData) {\n this.replace(initialData)\n }\n })\n }\n\n private dehanceValue_<X extends T | undefined>(value: X): X {\n if (this.dehancer !== undefined) {\n return this.dehancer(value)\n }\n return value\n }\n\n clear() {\n transaction(() => {\n untracked(() => {\n for (const value of this.data_.values()) {\n this.delete(value)\n }\n })\n })\n }\n\n forEach(callbackFn: (value: T, value2: T, set: Set<T>) => void, thisArg?: any) {\n for (const value of this) {\n callbackFn.call(thisArg, value, value, this)\n }\n }\n\n get size() {\n this.atom_.reportObserved()\n return this.data_.size\n }\n\n add(value: T) {\n checkIfStateModificationsAreAllowed(this.atom_)\n if (hasInterceptors(this)) {\n const change = interceptChange<ISetWillChange<T>>(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(() => {\n this.data_.add(this.enhancer_(value, undefined))\n this.atom_.reportChanged()\n })\n const notifySpy = __DEV__ && isSpyEnabled()\n const notify = hasListeners(this)\n const change =\n notify || notifySpy\n ? <ISetDidChange<T>>{\n observableKind: \"set\",\n debugObjectName: this.name_,\n type: ADD,\n object: this,\n newValue: value\n }\n : null\n if (notifySpy && __DEV__) {\n spyReportStart(change!)\n }\n if (notify) {\n notifyListeners(this, change)\n }\n if (notifySpy && __DEV__) {\n spyReportEnd()\n }\n }\n\n return this\n }\n\n delete(value: T) {\n if (hasInterceptors(this)) {\n const change = interceptChange<ISetWillChange<T>>(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 const notifySpy = __DEV__ && isSpyEnabled()\n const notify = hasListeners(this)\n const change =\n notify || notifySpy\n ? <ISetDidChange<T>>{\n observableKind: \"set\",\n debugObjectName: this.name_,\n type: DELETE,\n object: this,\n oldValue: value\n }\n : null\n\n if (notifySpy && __DEV__) {\n spyReportStart(change!)\n }\n transaction(() => {\n this.atom_.reportChanged()\n this.data_.delete(value)\n })\n if (notify) {\n notifyListeners(this, change)\n }\n if (notifySpy && __DEV__) {\n spyReportEnd()\n }\n return true\n }\n return false\n }\n\n has(value: T) {\n this.atom_.reportObserved()\n return this.data_.has(this.dehanceValue_(value))\n }\n\n entries() {\n let nextIndex = 0\n const keys = Array.from(this.keys())\n const values = Array.from(this.values())\n return makeIterable<[T, T]>({\n next() {\n const index = nextIndex\n nextIndex += 1\n return index < values.length\n ? { value: [keys[index], values[index]], done: false }\n : { done: true }\n }\n } as any)\n }\n\n keys(): IterableIterator<T> {\n return this.values()\n }\n\n values(): IterableIterator<T> {\n this.atom_.reportObserved()\n const self = this\n let nextIndex = 0\n const observableValues = Array.from(this.data_.values())\n return makeIterable<T>({\n next() {\n return nextIndex < observableValues.length\n ? { value: self.dehanceValue_(observableValues[nextIndex++]), done: false }\n : { done: true }\n }\n } as any)\n }\n\n intersection<U>(otherSet: ReadonlySetLike<U> | Set<U>): Set<T & U> {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.intersection(this)\n } else {\n const dehancedSet = new Set(this)\n return dehancedSet.intersection(otherSet)\n }\n }\n\n union<U>(otherSet: ReadonlySetLike<U> | Set<U>): Set<T | U> {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.union(this)\n } else {\n const dehancedSet = new Set(this)\n return dehancedSet.union(otherSet)\n }\n }\n\n difference<U>(otherSet: ReadonlySetLike<U>): Set<T> {\n return new Set(this).difference(otherSet)\n }\n\n symmetricDifference<U>(otherSet: ReadonlySetLike<U> | Set<U>): Set<T | U> {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.symmetricDifference(this)\n } else {\n const dehancedSet = new Set(this)\n return dehancedSet.symmetricDifference(otherSet)\n }\n }\n\n isSubsetOf(otherSet: ReadonlySetLike<unknown>): boolean {\n return new Set(this).isSubsetOf(otherSet)\n }\n\n isSupersetOf(otherSet: ReadonlySetLike<unknown>): boolean {\n return new Set(this).isSupersetOf(otherSet)\n }\n\n isDisjointFrom(otherSet: ReadonlySetLike<unknown> | Set<unknown>): boolean {\n if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n return otherSet.isDisjointFrom(this)\n } else {\n const dehancedSet = new Set(this)\n return dehancedSet.isDisjointFrom(otherSet)\n }\n }\n\n replace(other: ObservableSet<T> | IObservableSetInitialValues<T>): ObservableSet<T> {\n if (isObservableSet(other)) {\n other = new Set(other)\n }\n\n transaction(() => {\n if (Array.isArray(other)) {\n this.clear()\n other.forEach(value => this.add(value))\n } else if (isES6Set(other)) {\n this.clear()\n other.forEach(value => this.add(value))\n } else if (other !== null && other !== undefined) {\n die(\"Cannot initialize set from \" + other)\n }\n })\n\n return this\n }\n observe_(listener: (changes: ISetDidChange<T>) => void, fireImmediately?: boolean): Lambda {\n // ... 'fireImmediately' could also be true?\n if (__DEV__ && fireImmediately === true) {\n die(\"`observe` doesn't support fireImmediately=true in combination with sets.\")\n }\n return registerListener(this, listener)\n }\n\n intercept_(handler: IInterceptor<ISetWillChange<T>>): Lambda {\n return registerInterceptor(this, handler)\n }\n\n toJSON(): T[] {\n return Array.from(this)\n }\n\n toString(): string {\n return \"[object ObservableSet]\"\n }\n\n [Symbol.iterator]() {\n return this.values()\n }\n\n get [Symbol.toStringTag]() {\n return \"Set\"\n }\n}\n\n// eslint-disable-next-line\nexport var isObservableSet = createInstanceofPredicate(\"ObservableSet\", ObservableSet) as (\n thing: any\n) => thing is ObservableSet<any>\n","import {\n CreateObservableOptions,\n getAnnotationFromOptions,\n propagateChanged,\n isAnnotation,\n $mobx,\n Atom,\n Annotation,\n ComputedValue,\n IAtom,\n IComputedValueOptions,\n IEnhancer,\n IInterceptable,\n IListenable,\n Lambda,\n ObservableValue,\n addHiddenProp,\n createInstanceofPredicate,\n endBatch,\n getNextId,\n hasInterceptors,\n hasListeners,\n interceptChange,\n isObject,\n isPlainObject,\n isSpyEnabled,\n notifyListeners,\n referenceEnhancer,\n registerInterceptor,\n registerListener,\n spyReportEnd,\n spyReportStart,\n startBatch,\n stringifyKey,\n globalState,\n ADD,\n UPDATE,\n die,\n hasProp,\n getDescriptor,\n storedAnnotationsSymbol,\n ownKeys,\n isOverride,\n defineProperty,\n autoAnnotation,\n getAdministration,\n getDebugName,\n objectPrototype,\n MakeResult,\n checkIfStateModificationsAreAllowed\n} from \"../internal\"\n\nconst descriptorCache = Object.create(null)\n\nexport type IObjectDidChange<T = any> = {\n observableKind: \"object\"\n name: PropertyKey\n object: T\n debugObjectName: string\n} & (\n | {\n type: \"add\"\n newValue: any\n }\n | {\n type: \"update\"\n oldValue: any\n newValue: any\n }\n | {\n type: \"remove\"\n oldValue: any\n }\n)\n\nexport type IObjectWillChange<T = any> =\n | {\n object: T\n type: \"update\" | \"add\"\n name: PropertyKey\n newValue: any\n }\n | {\n object: T\n type: \"remove\"\n name: PropertyKey\n }\n\nconst REMOVE = \"remove\"\n\nexport class ObservableObjectAdministration\n implements IInterceptable<IObjectWillChange>, IListenable\n{\n keysAtom_: IAtom\n changeListeners_\n interceptors_\n proxy_: any\n isPlainObject_: boolean\n appliedAnnotations_?: object\n private pendingKeys_: undefined | Map<PropertyKey, ObservableValue<boolean>>\n\n constructor(\n public target_: any,\n public values_ = new Map<PropertyKey, ObservableValue<any> | ComputedValue<any>>(),\n public name_: string,\n // Used anytime annotation is not explicitely provided\n public defaultAnnotation_: Annotation = autoAnnotation\n ) {\n this.keysAtom_ = new Atom(__DEV__ ? `${this.name_}.keys` : \"ObservableObject.keys\")\n // Optimization: we use this frequently\n this.isPlainObject_ = isPlainObject(this.target_)\n if (__DEV__ && !isAnnotation(this.defaultAnnotation_)) {\n die(`defaultAnnotation must be valid annotation`)\n }\n if (__DEV__) {\n // Prepare structure for tracking which fields were already annotated\n this.appliedAnnotations_ = {}\n }\n }\n\n getObservablePropValue_(key: PropertyKey): any {\n return this.values_.get(key)!.get()\n }\n\n setObservablePropValue_(key: PropertyKey, newValue): boolean | null {\n const observable = this.values_.get(key)\n if (observable instanceof ComputedValue) {\n observable.set(newValue)\n return true\n }\n\n // intercept\n if (hasInterceptors(this)) {\n const change = interceptChange<IObjectWillChange>(this, {\n type: UPDATE,\n object: this.proxy_ || this.target_,\n name: key,\n newValue\n })\n if (!change) {\n return null\n }\n newValue = (change as any).newValue\n }\n newValue = (observable as any).prepareNewValue_(newValue)\n\n // notify spy & observers\n if (newValue !== globalState.UNCHANGED) {\n const notify = hasListeners(this)\n const notifySpy = __DEV__ && isSpyEnabled()\n const change: IObjectDidChange | null =\n notify || notifySpy\n ? {\n type: UPDATE,\n observableKind: \"object\",\n debugObjectName: this.name_,\n object: this.proxy_ || this.target_,\n oldValue: (observable as any).value_,\n name: key,\n newValue\n }\n : null\n\n if (__DEV__ && notifySpy) {\n spyReportStart(change!)\n }\n ;(observable as ObservableValue<any>).setNewValue_(newValue)\n if (notify) {\n notifyListeners(this, change)\n }\n if (__DEV__ && notifySpy) {\n spyReportEnd()\n }\n }\n return true\n }\n\n get_(key: PropertyKey): any {\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 /**\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 set_(key: PropertyKey, value: any, proxyTrap: boolean = false): boolean | null {\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_(\n key,\n { value, enumerable: true, writable: true, configurable: true },\n this.defaultAnnotation_,\n proxyTrap\n )\n }\n }\n\n // Trap for \"in\"\n has_(key: PropertyKey): boolean {\n if (!globalState.trackingDerivation) {\n // Skip key subscription outside derivation\n return key in this.target_\n }\n this.pendingKeys_ ||= new Map()\n let entry = this.pendingKeys_.get(key)\n if (!entry) {\n entry = new ObservableValue(\n key in this.target_,\n referenceEnhancer,\n __DEV__ ? `${this.name_}.${stringifyKey(key)}?` : \"ObservableObject.key?\",\n false\n )\n this.pendingKeys_.set(key, entry)\n }\n return entry.get()\n }\n\n /**\n * @param {PropertyKey} key\n * @param {Annotation|boolean} annotation true - use default annotation, false - ignore prop\n */\n make_(key: PropertyKey, annotation: Annotation | boolean): void {\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 // 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_[storedAnnotationsSymbol]?.[key]) {\n return // will be annotated by subclass constructor\n } else {\n die(1, annotation.annotationType_, `${this.name_}.${key.toString()}`)\n }\n }\n let source = this.target_\n while (source && source !== objectPrototype) {\n const descriptor = getDescriptor(source, key)\n if (descriptor) {\n const outcome = annotation.make_(this, key, descriptor, source)\n if (outcome === MakeResult.Cancel) {\n return\n }\n if (outcome === MakeResult.Break) {\n break\n }\n }\n source = Object.getPrototypeOf(source)\n }\n recordAnnotationApplied(this, annotation, key)\n }\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 extend_(\n key: PropertyKey,\n descriptor: PropertyDescriptor,\n annotation: Annotation | boolean,\n proxyTrap: boolean = false\n ): boolean | null {\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 const outcome = annotation.extend_(this, key, descriptor, proxyTrap)\n if (outcome) {\n recordAnnotationApplied(this, annotation, key)\n }\n return outcome\n }\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 defineProperty_(\n key: PropertyKey,\n descriptor: PropertyDescriptor,\n proxyTrap: boolean = false\n ): boolean | null {\n checkIfStateModificationsAreAllowed(this.keysAtom_)\n try {\n startBatch()\n\n // Delete\n const deleteOutcome = this.delete_(key)\n if (!deleteOutcome) {\n // Failure or intercepted\n return deleteOutcome\n }\n\n // ADD interceptor\n if (hasInterceptors(this)) {\n const change = interceptChange<IObjectWillChange>(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 const { newValue } = change as any\n if (descriptor.value !== newValue) {\n descriptor = {\n ...descriptor,\n value: newValue\n }\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\n // Notify\n this.notifyPropertyAddition_(key, descriptor.value)\n } finally {\n endBatch()\n }\n return true\n }\n\n // If original descriptor becomes relevant, move this to annotation directly\n defineObservableProperty_(\n key: PropertyKey,\n value: any,\n enhancer: IEnhancer<any>,\n proxyTrap: boolean = false\n ): boolean | null {\n checkIfStateModificationsAreAllowed(this.keysAtom_)\n try {\n startBatch()\n\n // Delete\n const deleteOutcome = this.delete_(key)\n if (!deleteOutcome) {\n // Failure or intercepted\n return deleteOutcome\n }\n\n // ADD interceptor\n if (hasInterceptors(this)) {\n const change = interceptChange<IObjectWillChange>(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 as any).newValue\n }\n\n const cachedDescriptor = getCachedObservablePropDescriptor(key)\n const descriptor = {\n configurable: globalState.safeDescriptors ? this.isPlainObject_ : true,\n enumerable: true,\n get: cachedDescriptor.get,\n set: cachedDescriptor.set\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\n const observable = new ObservableValue(\n value,\n enhancer,\n __DEV__ ? `${this.name_}.${key.toString()}` : \"ObservableObject.key\",\n false\n )\n\n this.values_.set(key, observable)\n\n // Notify (value possibly changed by ObservableValue)\n this.notifyPropertyAddition_(key, observable.value_)\n } finally {\n endBatch()\n }\n return true\n }\n\n // If original descriptor becomes relevant, move this to annotation directly\n defineComputedProperty_(\n key: PropertyKey,\n options: IComputedValueOptions<any>,\n proxyTrap: boolean = false\n ): boolean | null {\n checkIfStateModificationsAreAllowed(this.keysAtom_)\n try {\n startBatch()\n\n // Delete\n const deleteOutcome = this.delete_(key)\n if (!deleteOutcome) {\n // Failure or intercepted\n return deleteOutcome\n }\n\n // ADD interceptor\n if (hasInterceptors(this)) {\n const change = interceptChange<IObjectWillChange>(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 ||= __DEV__ ? `${this.name_}.${key.toString()}` : \"ObservableObject.key\"\n options.context = this.proxy_ || this.target_\n const cachedDescriptor = getCachedObservablePropDescriptor(key)\n const descriptor = {\n configurable: globalState.safeDescriptors ? this.isPlainObject_ : true,\n enumerable: false,\n get: cachedDescriptor.get,\n set: cachedDescriptor.set\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\n this.values_.set(key, new ComputedValue(options))\n\n // Notify\n this.notifyPropertyAddition_(key, undefined)\n } finally {\n endBatch()\n }\n return true\n }\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 delete_(key: PropertyKey, proxyTrap: boolean = false): boolean | null {\n checkIfStateModificationsAreAllowed(this.keysAtom_)\n // No such prop\n if (!hasProp(this.target_, key)) {\n return true\n }\n\n // Intercept\n if (hasInterceptors(this)) {\n const change = interceptChange<IObjectWillChange>(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\n // Delete\n try {\n startBatch()\n const notify = hasListeners(this)\n const notifySpy = __DEV__ && isSpyEnabled()\n const observable = this.values_.get(key)\n // Value needed for spies/listeners\n let value = undefined\n // Optimization: don't pull the value unless we will need it\n if (!observable && (notify || notifySpy)) {\n value = getDescriptor(this.target_, key)?.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 (__DEV__) {\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\n // Notify \"has\" observers\n // \"in\" as it may still exist in proto\n this.pendingKeys_?.get(key)?.set(key in this.target_)\n\n // Notify spies/listeners\n if (notify || notifySpy) {\n const change: IObjectDidChange = {\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 (__DEV__ && notifySpy) {\n spyReportStart(change!)\n }\n if (notify) {\n notifyListeners(this, change)\n }\n if (__DEV__ && notifySpy) {\n spyReportEnd()\n }\n }\n } finally {\n endBatch()\n }\n return true\n }\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 observe_(callback: (changes: IObjectDidChange) => void, fireImmediately?: boolean): Lambda {\n if (__DEV__ && fireImmediately === true) {\n die(\"`observe` doesn't support the fire immediately property for observable objects.\")\n }\n return registerListener(this, callback)\n }\n\n intercept_(handler): Lambda {\n return registerInterceptor(this, handler)\n }\n\n notifyPropertyAddition_(key: PropertyKey, value: any) {\n const notify = hasListeners(this)\n const notifySpy = __DEV__ && isSpyEnabled()\n if (notify || notifySpy) {\n const change: IObjectDidChange | null =\n notify || notifySpy\n ? ({\n type: ADD,\n observableKind: \"object\",\n debugObjectName: this.name_,\n object: this.proxy_ || this.target_,\n name: key,\n newValue: value\n } as const)\n : null\n\n if (__DEV__ && notifySpy) {\n spyReportStart(change!)\n }\n if (notify) {\n notifyListeners(this, change)\n }\n if (__DEV__ && notifySpy) {\n spyReportEnd()\n }\n }\n\n this.pendingKeys_?.get(key)?.set(true)\n\n // Notify \"keys/entries/values\" observers\n this.keysAtom_.reportChanged()\n }\n\n ownKeys_(): Array<string | symbol> {\n this.keysAtom_.reportObserved()\n return ownKeys(this.target_)\n }\n\n keys_(): PropertyKey[] {\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}\n\nexport interface IIsObservableObject {\n [$mobx]: ObservableObjectAdministration\n}\n\nexport function asObservableObject(\n target: any,\n options?: CreateObservableOptions\n): IIsObservableObject {\n if (__DEV__ && options && isObservableObject(target)) {\n die(`Options can't be provided for already observable objects.`)\n }\n\n if (hasProp(target, $mobx)) {\n if (__DEV__ && !(getAdministration(target) instanceof ObservableObjectAdministration)) {\n die(\n `Cannot convert '${getDebugName(target)}' into observable object:` +\n `\\nThe target is already observable of different type.` +\n `\\nExtending builtins is not supported.`\n )\n }\n return target\n }\n\n if (__DEV__ && !Object.isExtensible(target)) {\n die(\"Cannot make the designated object observable; it is not extensible\")\n }\n\n const name =\n options?.name ??\n (__DEV__\n ? `${\n isPlainObject(target) ? \"ObservableObject\" : target.constructor.name\n }@${getNextId()}`\n : \"ObservableObject\")\n\n const adm = new ObservableObjectAdministration(\n target,\n new Map(),\n String(name),\n getAnnotationFromOptions(options)\n )\n\n addHiddenProp(target, $mobx, adm)\n\n return target\n}\n\nconst isObservableObjectAdministration = createInstanceofPredicate(\n \"ObservableObjectAdministration\",\n ObservableObjectAdministration\n)\n\nfunction getCachedObservablePropDescriptor(key) {\n return (\n descriptorCache[key] ||\n (descriptorCache[key] = {\n get() {\n return this[$mobx].getObservablePropValue_(key)\n },\n set(value) {\n return this[$mobx].setObservablePropValue_(key, value)\n }\n })\n )\n}\n\nexport function isObservableObject(thing: any): boolean {\n if (isObject(thing)) {\n return isObservableObjectAdministration((thing as any)[$mobx])\n }\n return false\n}\n\nexport function recordAnnotationApplied(\n adm: ObservableObjectAdministration,\n annotation: Annotation,\n key: PropertyKey\n) {\n if (__DEV__) {\n adm.appliedAnnotations_![key] = annotation\n }\n // Remove applied decorator annotation so we don't try to apply it again in subclass constructor\n delete adm.target_[storedAnnotationsSymbol]?.[key]\n}\n\nfunction assertAnnotable(\n adm: ObservableObjectAdministration,\n annotation: Annotation,\n key: PropertyKey\n) {\n // Valid annotation\n if (__DEV__ && !isAnnotation(annotation)) {\n die(`Cannot annotate '${adm.name_}.${key.toString()}': Invalid annotation.`)\n }\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\n // Not annotated\n if (__DEV__ && !isOverride(annotation) && hasProp(adm.appliedAnnotations_!, key)) {\n const fieldName = `${adm.name_}.${key.toString()}`\n const currentAnnotationType = adm.appliedAnnotations_![key].annotationType_\n const requestedAnnotationType = annotation.annotationType_\n die(\n `Cannot apply '${requestedAnnotationType}' to '${fieldName}':` +\n `\\nThe field is already annotated with '${currentAnnotationType}'.` +\n `\\nRe-annotating fields is not allowed.` +\n `\\nUse 'override' annotation for methods overridden by subclass.`\n )\n }\n}\n","import {\n getNextId,\n addHiddenFinalProp,\n makeIterable,\n addHiddenProp,\n ObservableArrayAdministration,\n $mobx,\n arrayExtensions,\n IEnhancer,\n isObservableArray,\n IObservableArray,\n defineProperty,\n initObservable\n} from \"../internal\"\n\n// Bug in safari 9.* (or iOS 9 safari mobile). See #364\nconst ENTRY_0 = createArrayEntryDescriptor(0)\n\nconst safariPrototypeSetterInheritanceBug = (() => {\n let v = false\n const p = {}\n Object.defineProperty(p, \"0\", {\n set: () => {\n v = true\n }\n })\n Object.create(p)[\"0\"] = 1\n return v === false\n})()\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 */\nlet OBSERVABLE_ARRAY_BUFFER_SIZE = 0\n\n// Typescript workaround to make sure ObservableArray extends Array\nclass 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\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\n\nexport class LegacyObservableArray<T> extends StubArray {\n constructor(\n initialValues: T[] | undefined,\n enhancer: IEnhancer<T>,\n name = __DEV__ ? \"ObservableArray@\" + getNextId() : \"ObservableArray\",\n owned = false\n ) {\n super()\n initObservable(() => {\n const adm = new ObservableArrayAdministration(name, enhancer, owned, true)\n adm.proxy_ = this as any\n addHiddenFinalProp(this, $mobx, adm)\n\n if (initialValues && initialValues.length) {\n // @ts-ignore\n this.spliceWithArray(0, 0, initialValues)\n }\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 }\n\n concat(...arrays: T[][]): T[] {\n ;(this[$mobx] as ObservableArrayAdministration).atom_.reportObserved()\n return Array.prototype.concat.apply(\n (this as any).slice(),\n //@ts-ignore\n arrays.map(a => (isObservableArray(a) ? a.slice() : a))\n )\n }\n\n get length(): number {\n return (this[$mobx] as ObservableArrayAdministration).getArrayLength_()\n }\n\n set length(newLength: number) {\n ;(this[$mobx] as ObservableArrayAdministration).setArrayLength_(newLength)\n }\n\n get [Symbol.toStringTag]() {\n return \"Array\"\n }\n\n [Symbol.iterator]() {\n const self = this\n let nextIndex = 0\n return makeIterable({\n next() {\n return nextIndex < self.length\n ? { value: self[nextIndex++], done: false }\n : { done: true, value: undefined }\n }\n })\n }\n}\n\nObject.entries(arrayExtensions).forEach(([prop, fn]) => {\n if (prop !== \"concat\") {\n addHiddenProp(LegacyObservableArray.prototype, prop, fn)\n }\n})\n\nfunction createArrayEntryDescriptor(index: number) {\n return {\n enumerable: false,\n configurable: true,\n get: function () {\n return this[$mobx].get_(index)\n },\n set: function (value) {\n this[$mobx].set_(index, value)\n }\n }\n}\n\nfunction createArrayBufferItem(index: number) {\n defineProperty(LegacyObservableArray.prototype, \"\" + index, createArrayEntryDescriptor(index))\n}\n\nexport function reserveArrayBuffer(max: number) {\n if (max > OBSERVABLE_ARRAY_BUFFER_SIZE) {\n for (let index = OBSERVABLE_ARRAY_BUFFER_SIZE; index < max + 100; index++) {\n createArrayBufferItem(index)\n }\n OBSERVABLE_ARRAY_BUFFER_SIZE = max\n }\n}\n\nreserveArrayBuffer(1000)\n\nexport function createLegacyArray<T>(\n initialValues: T[] | undefined,\n enhancer: IEnhancer<T>,\n name?: string\n): IObservableArray<T> {\n return new LegacyObservableArray(initialValues, enhancer, name) as any\n}\n","import { isAction } from \"../api/action\"\nimport {\n $mobx,\n IDepTreeNode,\n isAtom,\n isComputedValue,\n isObservableArray,\n isObservableMap,\n isObservableObject,\n isReaction,\n isObservableSet,\n die,\n isFunction,\n allowStateChangesStart,\n untrackedStart,\n allowStateChangesEnd,\n untrackedEnd,\n startBatch,\n endBatch\n} from \"../internal\"\n\nexport function getAtom(thing: any, property?: PropertyKey): IDepTreeNode {\n if (typeof thing === \"object\" && thing !== null) {\n if (isObservableArray(thing)) {\n if (property !== undefined) {\n die(23)\n }\n return (thing as any)[$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 const 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 (property && !thing[$mobx]) {\n thing[property]\n } // See #1072\n if (isObservableObject(thing)) {\n if (!property) {\n return die(26)\n }\n const observable = (thing as any)[$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}\n\nexport function getAdministration(thing: any, property?: string) {\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}\n\nexport function getDebugName(thing: any, property?: string): string {\n let 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/**\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 */\nexport function initObservable<T>(cb: () => T): T {\n const derivation = untrackedStart()\n const allowStateChanges = allowStateChangesStart(true)\n startBatch()\n try {\n return cb()\n } finally {\n endBatch()\n allowStateChangesEnd(allowStateChanges)\n untrackedEnd(derivation)\n }\n}\n","import {\n isES6Map,\n isObservableArray,\n isObservableMap,\n isES6Set,\n isObservableSet,\n hasProp,\n isFunction,\n objectPrototype\n} from \"../internal\"\n\ndeclare const Symbol\nconst toString = objectPrototype.toString\n\nexport function deepEqual(a: any, b: any, depth: number = -1): boolean {\n return eq(a, b, depth)\n}\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: any, b: any, depth: number, aStack?: any[], bStack?: any[]) {\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 const type = typeof a\n if (type !== \"function\" && type !== \"object\" && typeof b != \"object\") {\n return false\n }\n\n // Compare `[[Class]]` names.\n const 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 (\n typeof Symbol !== \"undefined\" && Symbol.valueOf.call(a) === Symbol.valueOf.call(b)\n )\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\n const areArrays = className === \"[object Array]\"\n if (!areArrays) {\n if (typeof a != \"object\" || typeof b != \"object\") {\n return false\n }\n\n // Objects with different constructors are not equivalent, but `Object`s or `Array`s\n // from different frames are.\n const aCtor = a.constructor,\n bCtor = b.constructor\n if (\n aCtor !== bCtor &&\n !(\n isFunction(aCtor) &&\n aCtor instanceof aCtor &&\n isFunction(bCtor) &&\n bCtor instanceof bCtor\n ) &&\n \"constructor\" in a &&\n \"constructor\" in b\n ) {\n return false\n }\n }\n\n if (depth === 0) {\n return false\n } else if (depth < 0) {\n depth = -1\n }\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\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 let 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\n // Add the first object to the stack of traversed objects.\n aStack.push(a)\n bStack.push(b)\n\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 const keys = Object.keys(a)\n let 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}\n\nfunction unwrap(a: any) {\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","export function makeIterable<T>(iterator: Iterator<T>): IterableIterator<T> {\n iterator[Symbol.iterator] = getSelf\n return iterator as any\n}\n\nfunction getSelf() {\n return this\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 */\nimport { die } from \"./errors\"\nimport { getGlobal } from \"./utils/global\"\n;[\"Symbol\", \"Map\", \"Set\"].forEach(m => {\n let g = getGlobal()\n if (typeof g[m] === \"undefined\") {\n die(`MobX requires global '${m}' to be available or polyfilled`)\n }\n})\n\nimport { spy, getDebugName, $mobx } from \"./internal\"\n\nexport {\n IObservable,\n IDepTreeNode,\n Reaction,\n IReactionPublic,\n IReactionDisposer,\n untracked,\n IAtom,\n createAtom,\n spy,\n IComputedValue,\n IEqualsComparer,\n comparer,\n IEnhancer,\n IInterceptable,\n IInterceptor,\n IListenable,\n IObjectWillChange,\n IObjectDidChange,\n isObservableObject,\n IValueDidChange,\n IValueWillChange,\n IObservableValue,\n isObservableValue as isBoxedObservable,\n IObservableArray,\n IArrayWillChange,\n IArrayWillSplice,\n IArraySplice,\n IArrayUpdate,\n IArrayDidChange,\n isObservableArray,\n IKeyValueMap,\n ObservableMap,\n IMapEntries,\n IMapEntry,\n IMapWillChange,\n IMapDidChange,\n isObservableMap,\n IObservableMapInitialValues,\n ObservableSet,\n isObservableSet,\n ISetDidChange,\n ISetWillChange,\n IObservableSetInitialValues,\n transaction,\n observable,\n IObservableFactory,\n CreateObservableOptions,\n computed,\n IComputedFactory,\n isObservable,\n isObservableProp,\n isComputed,\n isComputedProp,\n extendObservable,\n observe,\n intercept,\n autorun,\n IAutorunOptions,\n reaction,\n IReactionOptions,\n when,\n IWhenOptions,\n action,\n isAction,\n runInAction,\n IActionFactory,\n keys,\n values,\n entries,\n set,\n remove,\n has,\n get,\n apiOwnKeys as ownKeys,\n apiDefineProperty as defineProperty,\n configure,\n onBecomeObserved,\n onBecomeUnobserved,\n flow,\n isFlow,\n flowResult,\n FlowCancellationError,\n isFlowCancellationError,\n toJS,\n trace,\n IObserverTree,\n IDependencyTree,\n getDependencyTree,\n getObserverTree,\n resetGlobalState as _resetGlobalState,\n getGlobalState as _getGlobalState,\n getDebugName,\n getAtom,\n getAdministration as _getAdministration,\n allowStateChanges as _allowStateChanges,\n runInAction as _allowStateChangesInsideComputed, // This has become the default behavior in Mobx 6\n Lambda,\n $mobx,\n isComputingDerivation as _isComputingDerivation,\n onReactionError,\n interceptReads as _interceptReads,\n IComputedValueOptions,\n IActionRunInfo,\n _startAction,\n _endAction,\n allowStateReadsStart as _allowStateReadsStart,\n allowStateReadsEnd as _allowStateReadsEnd,\n makeObservable,\n makeAutoObservable,\n autoAction as _autoAction,\n AnnotationsMap,\n AnnotationMapEntry,\n override\n} from \"./internal\"\n\n// Devtools support\ndeclare const __MOBX_DEVTOOLS_GLOBAL_HOOK__: { injectMobx: (any) => void }\nif (typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__ === \"object\") {\n // See: https://github.com/andykog/mobx-devtools/\n __MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({\n spy,\n extras: {\n getDebugName\n },\n $mobx\n })\n}\n","import { useState } from \"react\";\nfunction makeAdapter() {\n const adapter = {\n replace(location) {\n window.history.replaceState(location.state, \"\", location.search || \"?\");\n },\n push(location) {\n window.history.pushState(location.state, \"\", location.search || \"?\");\n },\n get location() {\n return window.location;\n }\n };\n return adapter;\n}\nconst WindowHistoryAdapter = ({\n children\n}) => {\n const [adapter] = useState(makeAdapter);\n return children(adapter);\n};\nexport {\n WindowHistoryAdapter\n};\n","import * as Serialize from './serialize';\nimport { QueryParamConfig } from './types';\n\n/**\n * String values\n */\nexport const StringParam: QueryParamConfig<\n string | null | undefined,\n string | null | undefined\n> = {\n encode: Serialize.encodeString,\n decode: Serialize.decodeString,\n};\n\n/**\n * String enum\n */\nexport const createEnumParam = <T extends string>(\n enumValues: T[]\n): QueryParamConfig<T | null | undefined, T | null | undefined> => ({\n encode: Serialize.encodeString,\n decode: (input) => Serialize.decodeEnum(input, enumValues),\n});\n\n/**\n * Array enum\n */\nexport const createEnumArrayParam = <T extends string>(\n enumValues: T[]\n): QueryParamConfig<T[] | null | undefined, T[] | null | undefined> => ({\n encode: (text) =>\n Serialize.encodeArray(text == null || Array.isArray(text) ? text : [text]),\n decode: (input) => Serialize.decodeArrayEnum(input, enumValues),\n});\n\n/**\n * Array delimited enum\n */\nexport const createEnumDelimitedArrayParam = <T extends string>(\n enumValues: T[],\n entrySeparator = '_'\n): QueryParamConfig<T[] | null | undefined, T[] | null | undefined> => ({\n encode: (text) =>\n Serialize.encodeDelimitedArray(\n text == null || Array.isArray(text) ? text : [text],\n entrySeparator\n ),\n decode: (input) =>\n Serialize.decodeDelimitedArrayEnum(input, enumValues, entrySeparator),\n});\n\n/**\n * Numbers (integers or floats)\n */\nexport const NumberParam: QueryParamConfig<\n number | null | undefined,\n number | null | undefined\n> = {\n encode: Serialize.encodeNumber,\n decode: Serialize.decodeNumber,\n};\n\n/**\n * For flat objects where values are strings\n */\nexport const ObjectParam: QueryParamConfig<\n { [key: string]: string | undefined } | null | undefined,\n { [key: string]: string | undefined } | null | undefined\n> = {\n encode: Serialize.encodeObject,\n decode: Serialize.decodeObject,\n};\n\n/**\n * For flat arrays of strings, filters out undefined values during decode\n */\nexport const ArrayParam: QueryParamConfig<\n (string | null)[] | null | undefined,\n (string | null)[] | null | undefined\n> = {\n encode: Serialize.encodeArray,\n decode: Serialize.decodeArray,\n};\n\n/**\n * For flat arrays of strings, filters out undefined values during decode\n */\nexport const NumericArrayParam: QueryParamConfig<\n (number | null)[] | null | undefined,\n (number | null)[] | null | undefined\n> = {\n encode: Serialize.encodeNumericArray,\n decode: Serialize.decodeNumericArray,\n};\n\n/**\n * For any type of data, encoded via JSON.stringify\n */\nexport const JsonParam: QueryParamConfig<any, any> = {\n encode: Serialize.encodeJson,\n decode: Serialize.decodeJson,\n};\n\n/**\n * For simple dates (YYYY-MM-DD)\n */\nexport const DateParam: QueryParamConfig<\n Date | null | undefined,\n Date | null | undefined\n> = {\n encode: Serialize.encodeDate,\n decode: Serialize.decodeDate,\n equals: (\n valueA: Date | null | undefined,\n valueB: Date | null | undefined\n ) => {\n if (valueA === valueB) return true;\n if (valueA == null || valueB == null) return valueA === valueB;\n\n // ignore time of day\n return (\n valueA.getFullYear() === valueB.getFullYear() &&\n valueA.getMonth() === valueB.getMonth() &&\n valueA.getDate() === valueB.getDate()\n );\n },\n};\n\n/**\n * For dates in simplified extended ISO format (YYYY-MM-DDTHH:mm:ss.sssZ or ±YYYYYY-MM-DDTHH:mm:ss.sssZ)\n */\nexport const DateTimeParam: QueryParamConfig<\n Date | null | undefined,\n Date | null | undefined\n> = {\n encode: Serialize.encodeDateTime,\n decode: Serialize.decodeDateTime,\n equals: (\n valueA: Date | null | undefined,\n valueB: Date | null | undefined\n ) => {\n if (valueA === valueB) return true;\n if (valueA == null || valueB == null) return valueA === valueB;\n\n return valueA.valueOf() === valueB.valueOf();\n },\n};\n\n/**\n * For boolean values: 1 = true, 0 = false\n */\nexport const BooleanParam: QueryParamConfig<\n boolean | null | undefined,\n boolean | null | undefined\n> = {\n encode: Serialize.encodeBoolean,\n decode: Serialize.decodeBoolean,\n};\n\n/**\n * For flat objects where the values are numbers\n */\nexport const NumericObjectParam: QueryParamConfig<\n { [key: string]: number | null | undefined } | null | undefined,\n { [key: string]: number | null | undefined } | null | undefined\n> = {\n encode: Serialize.encodeNumericObject,\n decode: Serialize.decodeNumericObject,\n};\n\n/**\n * For flat arrays of strings, filters out undefined values during decode\n */\nexport const DelimitedArrayParam: QueryParamConfig<\n (string | null)[] | null | undefined,\n (string | null)[] | null | undefined\n> = {\n encode: Serialize.encodeDelimitedArray,\n decode: Serialize.decodeDelimitedArray,\n};\n\n/**\n * For flat arrays where the values are numbers, filters out undefined values during decode\n */\nexport const DelimitedNumericArrayParam: QueryParamConfig<\n (number | null)[] | null | undefined,\n (number | null)[] | null | undefined\n> = {\n encode: Serialize.encodeDelimitedNumericArray,\n decode: Serialize.decodeDelimitedNumericArray,\n};\n","/**\n * Interprets an encoded string and returns either the string or null/undefined if not available.\n * Ignores array inputs (takes just first element in array)\n * @param input encoded string\n */\nfunction getEncodedValue(\n input: string | (string | null)[] | null | undefined,\n allowEmptyString?: boolean\n): string | null | undefined {\n if (input == null) {\n return input;\n }\n // '' or []\n if (\n input.length === 0 &&\n (!allowEmptyString || (allowEmptyString && input !== ''))\n ) {\n return null;\n }\n\n const str = input instanceof Array ? input[0] : input;\n if (str == null) {\n return str;\n }\n if (!allowEmptyString && str === '') {\n return null;\n }\n\n return str;\n}\n\n/**\n * Interprets an encoded string and return null/undefined or an array with\n * the encoded string contents\n * @param input encoded string\n */\nfunction getEncodedValueArray(\n input: string | (string | null)[] | null | undefined\n): (string | null)[] | null | undefined {\n if (input == null) {\n return input;\n }\n\n return input instanceof Array ? input : input === '' ? [] : [input];\n}\n\n/**\n * Encodes a date as a string in YYYY-MM-DD format.\n *\n * @param {Date} date\n * @return {String} the encoded date\n */\nexport function encodeDate(\n date: Date | null | undefined\n): string | null | undefined {\n if (date == null) {\n return date;\n }\n\n const year = date.getFullYear();\n const month = date.getMonth() + 1;\n const day = date.getDate();\n\n return `${year}-${month < 10 ? `0${month}` : month}-${\n day < 10 ? `0${day}` : day\n }`;\n}\n\n/**\n * Converts a date in the format 'YYYY-mm-dd...' into a proper date, because\n * new Date() does not do that correctly. The date can be as complete or incomplete\n * as necessary (aka, '2015', '2015-10', '2015-10-01').\n * It will not work for dates that have times included in them.\n *\n * If an array is provided, only the first entry is used.\n *\n * @param {String} input String date form like '2015-10-01'\n * @return {Date} parsed date\n */\nexport function decodeDate(\n input: string | (string | null)[] | null | undefined\n): Date | null | undefined {\n const dateString = getEncodedValue(input);\n if (dateString == null) return dateString;\n\n const parts = dateString.split('-') as any;\n // may only be a year so won't even have a month\n if (parts[1] != null) {\n parts[1] -= 1; // Note: months are 0-based\n } else {\n // just a year, set the month and day to the first\n parts[1] = 0;\n parts[2] = 1;\n }\n\n const decoded = new Date(...(parts as [number, number, number]));\n\n if (isNaN(decoded.getTime())) {\n return null;\n }\n\n return decoded;\n}\n\n/**\n * Encodes a date as a string in ISO 8601 (\"2019-05-28T10:58:40Z\") format.\n *\n * @param {Date} date\n * @return {String} the encoded date\n */\nexport function encodeDateTime(\n date: Date | null | undefined\n): string | null | undefined {\n if (date == null) {\n return date;\n }\n\n return date.toISOString();\n}\n\n/**\n * Converts a date in the https://en.wikipedia.org/wiki/ISO_8601 format.\n * For allowed inputs see specs:\n * - https://tools.ietf.org/html/rfc2822#page-14\n * - http://www.ecma-international.org/ecma-262/5.1/#sec-15.9.1.15\n *\n * If an array is provided, only the first entry is used.\n *\n * @param {String} input String date form like '1995-12-17T03:24:00'\n * @return {Date} parsed date\n */\nexport function decodeDateTime(\n input: string | (string | null)[] | null | undefined\n): Date | null | undefined {\n const dateString = getEncodedValue(input);\n if (dateString == null) return dateString;\n\n const decoded = new Date(dateString);\n\n if (isNaN(decoded.getTime())) {\n return null;\n }\n\n return decoded;\n}\n\n/**\n * Encodes a boolean as a string. true -> \"1\", false -> \"0\".\n *\n * @param {Boolean} bool\n * @return {String} the encoded boolean\n */\nexport function encodeBoolean(\n bool: boolean | null | undefined\n): string | null | undefined {\n if (bool == null) {\n return bool;\n }\n\n return bool ? '1' : '0';\n}\n\n/**\n * Decodes a boolean from a string. \"1\" -> true, \"0\" -> false.\n * Everything else maps to undefined.\n *\n * If an array is provided, only the first entry is used.\n *\n * @param {String} input the encoded boolean string\n * @return {Boolean} the boolean value\n */\nexport function decodeBoolean(\n input: string | (string | null)[] | null | undefined\n): boolean | null | undefined {\n const boolStr = getEncodedValue(input);\n if (boolStr == null) return boolStr;\n\n if (boolStr === '1') {\n return true;\n } else if (boolStr === '0') {\n return false;\n }\n\n return null;\n}\n\n/**\n * Encodes a number as a string.\n *\n * @param {Number} num\n * @return {String} the encoded number\n */\nexport function encodeNumber(\n num: number | null | undefined\n): string | null | undefined {\n if (num == null) {\n return num;\n }\n\n return String(num);\n}\n\n/**\n * Decodes a number from a string. If the number is invalid,\n * it returns undefined.\n *\n * If an array is provided, only the first entry is used.\n *\n * @param {String} input the encoded number string\n * @return {Number} the number value\n */\nexport function decodeNumber(\n input: string | (string | null)[] | null | undefined\n): number | null | undefined {\n const numStr = getEncodedValue(input);\n if (numStr == null) return numStr;\n if (numStr === '') return null;\n\n const result = +numStr;\n return result;\n}\n\n/**\n * Encodes a string while safely handling null and undefined values.\n *\n * @param {String} str a string to encode\n * @return {String} the encoded string\n */\nexport function encodeString(\n str: string | (string | null)[] | null | undefined\n): string | null | undefined {\n if (str == null) {\n return str;\n }\n\n return String(str);\n}\n\n/**\n * Decodes a string while safely handling null and undefined values.\n *\n * If an array is provided, only the first entry is used.\n *\n * @param {String} input the encoded string\n * @return {String} the string value\n */\nexport function decodeString(\n input: string | (string | null)[] | null | undefined\n): string | null | undefined {\n const str = getEncodedValue(input, true);\n if (str == null) return str;\n\n return String(str);\n}\n\n/**\n * Decodes an enum value while safely handling null and undefined values.\n *\n * If an array is provided, only the first entry is used.\n *\n * @param {String} input the encoded string\n * @param {String[]} enumValues allowed enum values\n * @return {String} the string value from enumValues\n */\nexport function decodeEnum<T extends string>(\n input: string | (string | null)[] | null | undefined,\n enumValues: T[]\n): T | null | undefined {\n const str = decodeString(input);\n if (str == null) return str;\n return enumValues.includes(str as any) ? (str as T) : undefined;\n}\n\n/**\n * Decodes an enum value from arrays while safely handling null and undefined values.\n *\n * @template T\n * @param {String} input the encoded string\n * @param {T[]} enumValues allowed enum values\n * @return {T[]} the string value from enumValues\n */\nexport function decodeArrayEnum<T extends string>(\n input: string | (string | null)[] | null | undefined,\n enumValues: T[]\n): T[] | null | undefined {\n const arr = decodeArray(input);\n if (arr == null) return arr;\n if (!arr.length) return undefined;\n return arr.every((str) => str != null && enumValues.includes(str as T))\n ? (arr as T[])\n : undefined;\n}\n\n/**\n * Decodes an enum value from arrays while safely handling null and undefined values.\n *\n * @template T\n * @param {String} input the encoded string\n * @param {T[]} enumValues allowed enum values\n * @param entrySeparator The array as a string with elements joined by the\n * entry separator\n * @return {T[]} the string value from enumValues\n */\nexport function decodeDelimitedArrayEnum<T extends string>(\n input: string | (string | null)[] | null | undefined,\n enumValues: T[],\n entrySeparator = '_'\n): T[] | null | undefined {\n if (input != null && Array.isArray(input) && !input.length) return undefined;\n const arr = decodeDelimitedArray(input, entrySeparator);\n return decodeArrayEnum(arr, enumValues);\n}\n\n/**\n * Encodes anything as a JSON string.\n *\n * @param {Any} any The thing to be encoded\n * @return {String} The JSON string representation of any\n */\nexport function encodeJson(\n any: any | null | undefined\n): string | null | undefined {\n if (any == null) {\n return any;\n }\n\n return JSON.stringify(any);\n}\n\n/**\n * Decodes a JSON string into javascript\n *\n * If an array is provided, only the first entry is used.\n *\n * @param {String} input The JSON string representation\n * @return {Any} The javascript representation\n */\nexport function decodeJson(\n input: string | (string | null)[] | null | undefined\n): any | null | undefined {\n const jsonStr = getEncodedValue(input);\n if (jsonStr == null) return jsonStr;\n\n let result = null;\n try {\n result = JSON.parse(jsonStr);\n } catch (e) {\n /* ignore errors, returning undefined */\n }\n\n return result;\n}\n\n/**\n * Encodes an array as a JSON string.\n *\n * @param {Array} array The array to be encoded\n * @return {String[]} The array of strings to be put in the URL\n * as repeated query parameters\n */\nexport function encodeArray(\n array: (string | null)[] | null | undefined\n): (string | null)[] | null | undefined {\n if (array == null) {\n return array;\n }\n\n return array;\n}\n\n/**\n * Decodes an array or singular value and returns it as an array\n * or undefined if falsy. Filters out undefined values.\n *\n * @param {String | Array} input The input value\n * @return {Array} The javascript representation\n */\nexport function decodeArray(\n input: string | (string | null)[] | null | undefined\n): (string | null)[] | null | undefined {\n const arr = getEncodedValueArray(input);\n if (arr == null) return arr;\n\n return arr;\n}\n\n/**\n * Encodes a numeric array as a JSON string.\n *\n * @param {Array} array The array to be encoded\n * @return {String[]} The array of strings to be put in the URL\n * as repeated query parameters\n */\nexport function encodeNumericArray(\n array: (number | null)[] | null | undefined\n): (string | null)[] | null | undefined {\n if (array == null) {\n return array;\n }\n\n return array.map(String);\n}\n\n/**\n * Decodes an array or singular value and returns it as an array\n * or undefined if falsy. Filters out undefined and NaN values.\n *\n * @param {String | Array} input The input value\n * @return {Array} The javascript representation\n */\nexport function decodeNumericArray(\n input: string | (string | null)[] | null | undefined\n): (number | null)[] | null | undefined {\n const arr = decodeArray(input);\n if (arr == null) return arr;\n\n return arr.map((d) => (d === '' || d == null ? null : +d));\n}\n\n/**\n * Encodes an array as a delimited string. For example,\n * ['a', 'b'] -> 'a_b' with entrySeparator='_'\n *\n * @param array The array to be encoded\n * @param entrySeparator The string used to delimit entries\n * @return The array as a string with elements joined by the\n * entry separator\n */\nexport function encodeDelimitedArray(\n array: (string | null)[] | null | undefined,\n entrySeparator = '_'\n): string | null | undefined {\n if (array == null) {\n return array;\n }\n\n return array.join(entrySeparator);\n}\n\n/**\n * Decodes a delimited string into javascript array. For example,\n * 'a_b' -> ['a', 'b'] with entrySeparator='_'\n *\n * If an array is provided as input, only the first entry is used.\n *\n * @param {String} input The JSON string representation\n * @param entrySeparator The array as a string with elements joined by the\n * entry separator\n * @return {Array} The javascript representation\n */\nexport function decodeDelimitedArray(\n input: string | (string | null)[] | null | undefined,\n entrySeparator = '_'\n): (string | null)[] | null | undefined {\n const arrayStr = getEncodedValue(input, true);\n if (arrayStr == null) return arrayStr;\n if (arrayStr === '') return [];\n\n return arrayStr.split(entrySeparator);\n}\n\n/**\n * Encodes a numeric array as a delimited string. (alias of encodeDelimitedArray)\n * For example, [1, 2] -> '1_2' with entrySeparator='_'\n *\n * @param {Array} array The array to be encoded\n * @return {String} The JSON string representation of array\n */\nexport const encodeDelimitedNumericArray = encodeDelimitedArray as (\n array: (number | null)[] | null | undefined,\n entrySeparator?: string\n) => string | null | undefined;\n\n/**\n * Decodes a delimited string into javascript array where all entries are numbers\n * For example, '1_2' -> [1, 2] with entrySeparator='_'\n *\n * If an array is provided as input, only the first entry is used.\n *\n * @param {String} jsonStr The JSON string representation\n * @return {Array} The javascript representation\n */\nexport function decodeDelimitedNumericArray(\n arrayStr: string | (string | null)[] | null | undefined,\n entrySeparator = '_'\n): (number | null)[] | null | undefined {\n const decoded = decodeDelimitedArray(arrayStr, entrySeparator);\n if (decoded == null) return decoded;\n\n return decoded.map((d) => (d === '' || d == null ? null : +d));\n}\n\n/**\n * Encode simple objects as readable strings. Works only for simple,\n * flat objects where values are numbers, strings.\n *\n * For example { foo: bar, boo: baz } -> \"foo-bar_boo-baz\"\n *\n * @param {Object} object The object to encode\n * @param {String} keyValSeparator=\"-\" The separator between keys and values\n * @param {String} entrySeparator=\"_\" The separator between entries\n * @return {String} The encoded object\n */\nexport function encodeObject(\n obj: { [key: string]: string | null | number | undefined } | null | undefined,\n keyValSeparator = '-',\n entrySeparator = '_'\n): string | null | undefined {\n if (obj == null) return obj; // null or undefined\n if (!Object.keys(obj).length) return ''; // {} case\n\n return Object.keys(obj)\n .map((key) => `${key}${keyValSeparator}${obj[key]}`)\n .join(entrySeparator);\n}\n\n/**\n * Decodes a simple object to javascript. Currently works only for simple,\n * flat objects where values are strings.\n *\n * For example \"foo-bar_boo-baz\" -> { foo: bar, boo: baz }\n *\n * If an array is provided as input, only the first entry is used.\n *\n * @param {String} input The object string to decode\n * @param {String} keyValSeparator=\"-\" The separator between keys and values\n * @param {String} entrySeparator=\"_\" The separator between entries\n * @return {Object} The javascript object\n */\nexport function decodeObject(\n input: string | (string | null)[] | null | undefined,\n keyValSeparator = '-',\n entrySeparator = '_'\n): { [key: string]: string } | null | undefined {\n const objStr = getEncodedValue(input, true);\n if (objStr == null) return objStr;\n if (objStr === '') return {};\n\n const obj: { [key: string]: string } = {};\n\n const keyValSeparatorRegExp = new RegExp(`${keyValSeparator}(.*)`);\n objStr.split(entrySeparator).forEach((entryStr) => {\n const [key, value] = entryStr.split(keyValSeparatorRegExp);\n obj[key] = value;\n });\n\n return obj;\n}\n\n/**\n * Encode simple objects as readable strings. Alias of encodeObject.\n *\n * For example { foo: 123, boo: 521 } -> \"foo-123_boo-521\"\n *\n * @param {Object} object The object to encode\n * @param {String} keyValSeparator=\"-\" The separator between keys and values\n * @param {String} entrySeparator=\"_\" The separator between entries\n * @return {String} The encoded object\n */\nexport const encodeNumericObject = encodeObject as (\n obj: { [key: string]: number | null | undefined } | null | undefined,\n keyValSeparator?: string,\n entrySeparator?: string\n) => string | null | undefined;\n\n/**\n * Decodes a simple object to javascript where all values are numbers.\n * Currently works only for simple, flat objects.\n *\n * For example \"foo-123_boo-521\" -> { foo: 123, boo: 521 }\n *\n * If an array is provided as input, only the first entry is used.\n *\n * @param {String} input The object string to decode\n * @param {String} keyValSeparator=\"-\" The separator between keys and values\n * @param {String} entrySeparator=\"_\" The separator between entries\n * @return {Object} The javascript object\n */\nexport function decodeNumericObject(\n input: string | (string | null)[] | null | undefined,\n keyValSeparator = '-',\n entrySeparator = '_'\n): { [key: string]: number | null | undefined } | null | undefined {\n const decoded: { [key: string]: string } | null | undefined = decodeObject(\n input,\n keyValSeparator,\n entrySeparator\n );\n\n if (decoded == null) return decoded;\n\n // convert to numbers\n const decodedNumberObj: { [key: string]: number | null | undefined } = {};\n for (const key of Object.keys(decoded)) {\n decodedNumberObj[key] = decodeNumber(decoded[key]);\n }\n\n return decodedNumberObj;\n}\n","import { EncodedQuery } from './types';\nimport { objectToSearchString } from './objectToSearchString';\nimport { searchStringToObject } from '.';\n\n/**\n * An example of a transformSearchString function that undoes encoding of\n * common JSON characters that are technically allowed in URLs.\n */\nconst JSON_SAFE_CHARS = `{}[],\":`\n .split('')\n .map((d) => [d, encodeURIComponent(d)]);\n\nfunction getHrefFromLocation(location: Location, search: string): string {\n // https://developer.mozilla.org/en-US/docs/Web/API/URL/URL\n let href: string = search;\n\n if (location.href) {\n // TODO - implement base option if location.href is relative\n // see https://developer.mozilla.org/en-US/docs/Web/API/URL/URL#syntax\n try {\n const url = new URL(location.href);\n href = `${url.origin}${url.pathname}${search}`;\n } catch (e) {\n href = '';\n }\n }\n\n return href;\n}\n\nexport function transformSearchStringJsonSafe(searchString: string): string {\n let str = searchString;\n for (let [char, code] of JSON_SAFE_CHARS) {\n str = str.replace(new RegExp('\\\\' + code, 'g'), char);\n }\n return str;\n}\n\n/**\n * Update a location, wiping out parameters not included in encodedQuery\n * If a param is set to undefined it will be removed from the URL.\n */\nexport function updateLocation(\n encodedQuery: EncodedQuery,\n location: Location,\n objectToSearchStringFn = objectToSearchString\n): Location {\n let encodedSearchString = objectToSearchStringFn(encodedQuery);\n\n const search = encodedSearchString.length ? `?${encodedSearchString}` : '';\n\n const newLocation: Location & {\n key: string;\n query: EncodedQuery;\n } = {\n ...location,\n key: `${Date.now()}`, // needed for some routers (e.g. react-router)\n href: getHrefFromLocation(location, search),\n search,\n query: encodedQuery, // needed for some routers (e.g. found)\n };\n\n return newLocation;\n}\n\n/**\n * Update a location while retaining existing parameters.\n * If a param is set to undefined it will be removed from the URL.\n */\nexport function updateInLocation(\n encodedQueryReplacements: EncodedQuery,\n location: Location,\n objectToSearchStringFn = objectToSearchString,\n searchStringToObjectFn = searchStringToObject\n): Location {\n // explicitly avoid parsing numbers to ensure the\n // return type has the same shape as EncodeQuery\n const currQuery = searchStringToObjectFn(location.search);\n\n const newQuery = {\n ...currQuery,\n ...encodedQueryReplacements,\n };\n\n return updateLocation(newQuery, location, objectToSearchStringFn);\n}\n","type EncodedValue = string | (string | null)[] | null | undefined;\n\ntype CachedParam = {\n stringified: EncodedValue;\n decoded: any;\n decode: Function;\n};\n\n/**\n * simple cache that keeps values around so long as something\n * has registered interest in it (typically via calling useQueryParams).\n * Caches based on the stringified value as the key and the\n * last passed in decode function.\n */\nexport class DecodedParamCache {\n private paramsMap: Map<string, CachedParam>;\n private registeredParams: Map<string, number>;\n\n constructor() {\n this.paramsMap = new Map();\n this.registeredParams = new Map();\n }\n\n set(\n param: string,\n stringifiedValue: EncodedValue,\n decodedValue: any,\n decode: Function\n ) {\n this.paramsMap.set(param, {\n stringified: stringifiedValue,\n decoded: decodedValue,\n decode,\n });\n }\n\n /**\n * A param has been cached if the stringified value and decode function matches\n */\n has(param: string, stringifiedValue: EncodedValue, decode?: Function) {\n if (!this.paramsMap.has(param)) return false;\n const cachedParam = this.paramsMap.get(param);\n if (!cachedParam) return false;\n\n return (\n cachedParam.stringified === stringifiedValue &&\n (decode == null || cachedParam.decode === decode)\n );\n }\n\n get(param: string) {\n if (this.paramsMap.has(param)) return this.paramsMap.get(param)?.decoded;\n return undefined;\n }\n\n /**\n * Register interest in a set of param names. When these go to 0 they are cleaned out.\n */\n registerParams(paramNames: string[]) {\n for (const param of paramNames) {\n const currValue = this.registeredParams.get(param) || 0;\n this.registeredParams.set(param, currValue + 1);\n }\n }\n\n /**\n * Unregister interest in a set of param names. If there is no remaining interest,\n * remove the decoded value from the cache to prevent memory leaks.\n */\n unregisterParams(paramNames: string[]) {\n for (const param of paramNames) {\n const value = (this.registeredParams.get(param) || 0) - 1;\n if (value <= 0) {\n this.registeredParams.delete(param);\n if (this.paramsMap.has(param)) {\n this.paramsMap.delete(param);\n }\n } else {\n this.registeredParams.set(param, value);\n }\n }\n }\n\n clear() {\n this.paramsMap.clear();\n this.registeredParams.clear();\n }\n}\n\nexport const decodedParamCache = new DecodedParamCache();\n","import {\n QueryParamConfig,\n QueryParamConfigMap,\n StringParam,\n} from 'serialize-query-params';\nimport { QueryParamOptions } from './options';\nimport { QueryParamConfigMapWithInherit } from './types';\n\n/**\n * Convert inherit strings from a query param config to actual\n * parameters based on predefined ('inherited') mappings.\n * Defaults to StringParam.\n */\nexport function convertInheritedParamStringsToParams(\n paramConfigMapWithInherit: QueryParamConfigMapWithInherit,\n options: QueryParamOptions\n): QueryParamConfigMap {\n const paramConfigMap: QueryParamConfigMap = {};\n let hasInherit = false;\n\n const hookKeys = Object.keys(paramConfigMapWithInherit);\n let paramKeys = hookKeys;\n\n // include known params if asked for explicitly, or no params were configured and we didn't\n // explicitly say not to\n const includeKnownParams =\n options.includeKnownParams ||\n (options.includeKnownParams !== false && hookKeys.length === 0);\n\n if (includeKnownParams) {\n const knownKeys = Object.keys(options.params ?? {});\n paramKeys.push(...knownKeys);\n }\n\n for (const key of paramKeys) {\n const param = paramConfigMapWithInherit[key];\n // does it have an existing parameter definition? use it\n if (param != null && typeof param === 'object') {\n paramConfigMap[key] = param;\n continue;\n }\n\n // otherwise, we have to inherit or use the default\n hasInherit = true;\n\n // default is StringParam\n paramConfigMap[key] = options.params?.[key] ?? StringParam;\n }\n\n // if we didn't inherit anything, just return the input\n if (!hasInherit) return paramConfigMapWithInherit as QueryParamConfigMap;\n\n return paramConfigMap;\n}\n\n/**\n * Extends a config to include params for all specified keys,\n * defaulting to StringParam if not found in the inheritedParams\n * map.\n */\nexport function extendParamConfigForKeys(\n baseParamConfigMap: QueryParamConfigMap,\n paramKeys: string[],\n inheritedParams?: QueryParamOptions['params'] | undefined,\n defaultParam?: QueryParamConfig<any> | undefined\n) {\n // if we aren't inheriting anything or there are no params, return the input\n if (!inheritedParams || !paramKeys.length) return baseParamConfigMap;\n\n let paramConfigMap = { ...baseParamConfigMap };\n let hasInherit = false;\n for (const paramKey of paramKeys) {\n // if it is missing a parameter, fill it in\n if (!Object.prototype.hasOwnProperty.call(paramConfigMap, paramKey)) {\n paramConfigMap[paramKey] = inheritedParams[paramKey] ?? defaultParam;\n hasInherit = true;\n }\n }\n\n if (!hasInherit) return baseParamConfigMap;\n return paramConfigMap;\n}\n","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license at\n * https://github.com/facebook/fbjs/blob/master/LICENSE\n */\n\n/*eslint-disable no-self-compare */\n\nconst hasOwnProperty = Object.prototype.hasOwnProperty;\n\n/**\n * inlined Object.is polyfill to avoid requiring consumers ship their own\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is\n */\nfunction is(x: any, y: any): boolean {\n // SameValue algorithm\n if (x === y) {\n // Steps 1-5, 7-10\n // Steps 6.b-6.e: +0 != -0\n // Added the nonzero y check to make Flow happy, but it is redundant\n return x !== 0 || y !== 0 || 1 / x === 1 / y;\n } else {\n // Step 6.a: NaN == NaN\n return x !== x && y !== y;\n }\n}\n\n/**\n * Performs equality by iterating through keys on an object and returning false\n * when any key has values which are not strictly equal between the arguments.\n * Returns true when the values of all keys are strictly equal.\n\n * @pbeshai modification of shallowEqual to take into consideration a map providing\n * equals functions\n */\nexport default function shallowEqual(\n objA: any,\n objB: any,\n equalMap?: any\n): boolean {\n if (is(objA, objB)) {\n return true;\n }\n\n if (\n typeof objA !== 'object' ||\n objA === null ||\n typeof objB !== 'object' ||\n objB === null\n ) {\n return false;\n }\n\n const keysA = Object.keys(objA);\n const keysB = Object.keys(objB);\n\n if (keysA.length !== keysB.length) {\n return false;\n }\n\n // Test for A's keys different from B.\n for (let i = 0; i < keysA.length; i++) {\n const isEqual = equalMap?.[keysA[i]]?.equals ?? is;\n if (\n !hasOwnProperty.call(objB, keysA[i]) ||\n !isEqual(objA[keysA[i]], objB[keysA[i]])\n ) {\n return false;\n }\n }\n\n return true;\n}\n","import {\n DecodedValueMap,\n EncodedQuery,\n QueryParamConfigMap,\n} from 'serialize-query-params';\nimport { DecodedParamCache } from './decodedParamCache';\nimport shallowEqual from './shallowEqual';\n\n/**\n * Helper to get the latest decoded values with smart caching.\n * Abstracted into its own function to allow re-use in a functional setter (#26)\n */\nexport function getLatestDecodedValues<QPCMap extends QueryParamConfigMap>(\n parsedParams: EncodedQuery,\n paramConfigMap: QPCMap,\n decodedParamCache: DecodedParamCache\n) {\n const decodedValues: Partial<DecodedValueMap<QPCMap>> = {};\n\n // we have new encoded values, so let's get new decoded values.\n // recompute new values but only for those that changed\n const paramNames = Object.keys(paramConfigMap);\n for (const paramName of paramNames) {\n // do we have a new encoded value?\n const paramConfig = paramConfigMap[paramName];\n const encodedValue = parsedParams[paramName];\n\n // if we have a new encoded value, re-decode. otherwise reuse cache\n let decodedValue;\n if (decodedParamCache.has(paramName, encodedValue, paramConfig.decode)) {\n decodedValue = decodedParamCache.get(paramName);\n } else {\n decodedValue = paramConfig.decode(encodedValue);\n\n // check if we had a cached value for this encoded value but a different encoder\n // (sometimes people inline decode functions, e.g. withDefault...)\n // AND we had a different equals check than ===\n if (\n paramConfig.equals &&\n decodedParamCache.has(paramName, encodedValue)\n ) {\n const oldDecodedValue = decodedParamCache.get(paramName);\n if (paramConfig.equals(decodedValue, oldDecodedValue)) {\n decodedValue = oldDecodedValue;\n }\n }\n\n // do not cache undefined values\n if (decodedValue !== undefined) {\n decodedParamCache.set(\n paramName,\n encodedValue,\n decodedValue,\n paramConfig.decode\n );\n }\n }\n\n // in case the decode function didn't interpret `default` for some reason,\n // we can interpret it here as a backup\n if (decodedValue === undefined && paramConfig.default !== undefined) {\n decodedValue = paramConfig.default;\n }\n\n decodedValues[paramName as keyof QPCMap] = decodedValue;\n }\n\n return decodedValues as DecodedValueMap<QPCMap>;\n}\n\n/**\n * Wrap get latest so we use the same exact object if the current\n * values are shallow equal to the previous.\n */\nexport function makeStableGetLatestDecodedValues() {\n let prevDecodedValues: DecodedValueMap<any> | undefined;\n\n function stableGetLatest<QPCMap extends QueryParamConfigMap>(\n parsedParams: EncodedQuery,\n paramConfigMap: QPCMap,\n decodedParamCache: DecodedParamCache\n ) {\n const decodedValues = getLatestDecodedValues(\n parsedParams,\n paramConfigMap,\n decodedParamCache\n );\n if (\n prevDecodedValues != null &&\n shallowEqual(prevDecodedValues, decodedValues)\n ) {\n return prevDecodedValues;\n }\n prevDecodedValues = decodedValues;\n return decodedValues;\n }\n\n return stableGetLatest;\n}\n","import { EncodedQuery } from 'serialize-query-params';\nimport shallowEqual from './shallowEqual';\nimport { deserializeUrlNameMap } from './urlName';\n\nlet cachedSearchString: string | undefined;\nlet cachedUrlNameMapString: string | undefined;\nlet cachedSearchStringToObjectFn:\n | ((searchString: string) => EncodedQuery)\n | undefined;\nlet cachedParsedQuery: EncodedQuery = {};\n\n/**\n * cached conversion of ?foo=1&bar=2 to { foo: '1', bar: '2' }\n */\nexport const memoSearchStringToObject = (\n searchStringToObject: (searchString: string) => EncodedQuery,\n searchString?: string | undefined,\n /** optionally provide a mapping string to handle renames via `urlName`\n * mapping are separated by \\n and mappings are urlName\\0paramName\n */\n urlNameMapStr?: string | undefined\n) => {\n // if we have a cached version, just return it\n if (\n cachedSearchString === searchString &&\n cachedSearchStringToObjectFn === searchStringToObject &&\n cachedUrlNameMapString === urlNameMapStr\n ) {\n return cachedParsedQuery;\n }\n\n cachedSearchString = searchString;\n cachedSearchStringToObjectFn = searchStringToObject;\n const newParsedQuery = searchStringToObject(searchString ?? '');\n cachedUrlNameMapString = urlNameMapStr;\n\n const urlNameMap = deserializeUrlNameMap(urlNameMapStr);\n\n // keep old values for keys if they are the same\n for (let [key, value] of Object.entries(newParsedQuery)) {\n // handle url name mapping\n if (urlNameMap?.[key]) {\n delete newParsedQuery[key];\n key = urlNameMap[key];\n newParsedQuery[key] = value;\n }\n\n const oldValue = cachedParsedQuery[key];\n if (shallowEqual(value, oldValue)) {\n newParsedQuery[key] = oldValue;\n }\n }\n\n cachedParsedQuery = newParsedQuery;\n return newParsedQuery;\n};\n","import { EncodedValueMap, QueryParamConfigMap } from 'serialize-query-params';\n\n/**\n * Create an alias mapping using the optional `urlName` property on params\n */\nexport function serializeUrlNameMap(\n paramConfigMap: QueryParamConfigMap\n): string | undefined {\n let urlNameMapParts: string[] | undefined;\n for (const paramName in paramConfigMap) {\n if (paramConfigMap[paramName].urlName) {\n const urlName = paramConfigMap[paramName].urlName;\n const part = `${urlName}\\0${paramName}`;\n if (!urlNameMapParts) urlNameMapParts = [part];\n else urlNameMapParts.push(part);\n }\n }\n\n return urlNameMapParts ? urlNameMapParts.join('\\n') : undefined;\n}\n\n/**\n * Converts the stringified alias/urlName map back into an object\n */\nexport function deserializeUrlNameMap(\n urlNameMapStr: string | undefined\n): Record<string, string> | undefined {\n if (!urlNameMapStr) return undefined;\n\n return Object.fromEntries(\n urlNameMapStr.split('\\n').map((part) => part.split('\\0'))\n );\n}\n\n/**\n * converts { searchString: 'foo'} to { q: 'foo'} if the searchString\n * is configured to have \"q\" as its urlName.\n */\nexport function applyUrlNames(\n encodedValues: Partial<EncodedValueMap<any>>,\n paramConfigMap: QueryParamConfigMap\n) {\n let newEncodedValues: Partial<EncodedValueMap<any>> = {};\n for (const paramName in encodedValues) {\n if (paramConfigMap[paramName]?.urlName != null) {\n newEncodedValues[paramConfigMap[paramName].urlName!] =\n encodedValues[paramName];\n } else {\n newEncodedValues[paramName] = encodedValues[paramName];\n }\n }\n\n return newEncodedValues;\n}\n","import {\n EncodedQuery,\n QueryParamConfigMap,\n searchStringToObject,\n objectToSearchString,\n} from 'serialize-query-params';\nimport { UrlUpdateType } from './types';\n\nexport const defaultOptions: QueryParamOptionsWithRequired = {\n searchStringToObject: searchStringToObject,\n objectToSearchString: objectToSearchString,\n updateType: 'pushIn',\n includeKnownParams: undefined,\n includeAllParams: false,\n removeDefaultsFromUrl: false,\n enableBatching: false,\n skipUpdateWhenNoChange: true,\n};\n\nexport interface QueryParamOptions {\n searchStringToObject?: (searchString: string) => EncodedQuery;\n objectToSearchString?: (encodedParams: EncodedQuery) => string;\n updateType?: UrlUpdateType;\n includeKnownParams?: boolean;\n includeAllParams?: boolean;\n /** whether sets that result in no change to the location search string should be ignored (default: true) */\n skipUpdateWhenNoChange?: boolean;\n params?: QueryParamConfigMap;\n\n /** when a value equals its default, do not encode it in the URL when updating */\n removeDefaultsFromUrl?: boolean;\n\n /**\n * @experimental this is an experimental option to combine multiple `set` calls\n * into a single URL update.\n */\n enableBatching?: boolean;\n}\n\ntype RequiredOptions = 'searchStringToObject' | 'objectToSearchString';\nexport type QueryParamOptionsWithRequired = Required<\n Pick<QueryParamOptions, RequiredOptions>\n> &\n Omit<QueryParamOptions, RequiredOptions>;\n\nexport function mergeOptions(\n parentOptions: QueryParamOptionsWithRequired,\n currOptions: QueryParamOptions | null | undefined\n): QueryParamOptionsWithRequired {\n if (currOptions == null) {\n currOptions = {};\n }\n\n const merged = { ...parentOptions, ...currOptions };\n\n // deep merge param objects\n if (currOptions.params && parentOptions.params) {\n merged.params = { ...parentOptions.params, ...currOptions.params };\n }\n\n return merged;\n}\n","import * as React from 'react';\nimport {\n mergeOptions,\n defaultOptions,\n QueryParamOptions,\n QueryParamOptionsWithRequired,\n} from './options';\nimport { QueryParamAdapter, QueryParamAdapterComponent } from './types';\n\n/**\n * Shape of the QueryParamContext, which the hooks consume to read and\n * update the URL state.\n */\ntype QueryParamContextValue = {\n adapter: QueryParamAdapter;\n options: QueryParamOptionsWithRequired;\n};\n\nconst providerlessContextValue: QueryParamContextValue = {\n adapter: {} as QueryParamAdapter,\n options: defaultOptions,\n};\n\nexport const QueryParamContext = React.createContext<QueryParamContextValue>(\n providerlessContextValue\n);\n\nexport function useQueryParamContext() {\n const value = React.useContext(QueryParamContext);\n if (\n process.env.NODE_ENV !== 'production' &&\n (value === undefined || value === providerlessContextValue)\n ) {\n throw new Error('useQueryParams must be used within a QueryParamProvider');\n }\n\n return value;\n}\n\n/**\n * Props for the Provider component, used to hook the active routing\n * system into our controls. Note only the root provider requires\n * `adapter`. We try to encourage that via intellisense by writing\n * the types this way (you must provide at least one of adapter or options,\n * default intellisense suggests adapter required.)\n */\ntype QueryParamProviderProps = {\n /** Main app goes here */\n children: React.ReactNode;\n} & (\n | {\n adapter?: never;\n options: QueryParamOptions;\n }\n | {\n /** required for the root provider but not for nested ones */\n adapter: QueryParamAdapterComponent;\n options?: QueryParamOptions;\n }\n);\n\nfunction QueryParamProviderInner({\n children,\n adapter,\n options,\n}: {\n children: React.ReactNode;\n adapter?: QueryParamAdapter | undefined;\n options?: QueryParamOptions;\n}) {\n // allow merging in parent options\n const { adapter: parentAdapter, options: parentOptions } =\n React.useContext(QueryParamContext);\n\n const value = React.useMemo(() => {\n return {\n adapter: adapter ?? parentAdapter,\n options: mergeOptions(\n parentOptions,\n options\n ) as QueryParamOptionsWithRequired,\n };\n }, [adapter, options, parentAdapter, parentOptions]);\n\n return (\n <QueryParamContext.Provider value={value}>\n {children}\n </QueryParamContext.Provider>\n );\n}\n\n/**\n * Context provider for query params to have access to the\n * active routing system, enabling updates to the URL.\n */\nexport function QueryParamProvider({\n children,\n adapter,\n options,\n}: QueryParamProviderProps) {\n const Adapter = adapter;\n return Adapter ? (\n <Adapter>\n {(adapter) => (\n <QueryParamProviderInner adapter={adapter} options={options}>\n {children}\n </QueryParamProviderInner>\n )}\n </Adapter>\n ) : (\n <QueryParamProviderInner options={options}>\n {children}\n </QueryParamProviderInner>\n );\n}\n\nexport default QueryParamProvider;\n","import { EncodedQuery } from './types';\n\n/**\n * Default implementation of searchStringToObject powered by URLSearchParams\n * This converts a search string like `?foo=123&bar=x` to { foo: '123', bar: 'x' }\n * This is only a very basic version, you may prefer the advanced versions offered\n * by third party libraries like query-string (\"parse\") or qs.\n */\nexport function searchStringToObject(searchString: string): EncodedQuery {\n const params = new URLSearchParams(searchString);\n const parsed: EncodedQuery = {};\n for (let [key, value] of params) {\n if (Object.prototype.hasOwnProperty.call(parsed, key)) {\n if (Array.isArray(parsed[key])) {\n (parsed[key] as string[]).push(value);\n } else {\n parsed[key] = [parsed[key] as string, value];\n }\n } else {\n parsed[key] = value;\n }\n }\n\n return parsed;\n}\n","import { EncodedQuery } from './types';\n\n/**\n * Default implementation of objectToSearchString powered by URLSearchParams.\n * Does not support null values. Does not prefix with \"?\"\n * This converts an object { foo: '123', bar: 'x' } to a search string `?foo=123&bar=x`\n * This is only a very basic version, you may prefer the advanced versions offered\n * by third party libraries like query-string (\"stringify\") or qs.\n */\nexport function objectToSearchString(encodedParams: EncodedQuery): string {\n const params = new URLSearchParams();\n const entries = Object.entries(encodedParams);\n\n for (const [key, value] of entries) {\n if (value === undefined) continue;\n if (value === null) continue;\n\n if (Array.isArray(value)) {\n for (const item of value) {\n params.append(key, item ?? '');\n }\n } else {\n params.append(key, value);\n }\n }\n\n return params.toString();\n}\n","import {\n DecodedValueMap,\n encodeQueryParams,\n QueryParamConfigMap,\n} from 'serialize-query-params';\nimport { decodedParamCache } from './decodedParamCache';\nimport { extendParamConfigForKeys } from './inheritedParams';\nimport { getLatestDecodedValues } from './latestValues';\nimport { memoSearchStringToObject } from './memoSearchStringToObject';\nimport { QueryParamOptionsWithRequired } from './options';\nimport { removeDefaults } from './removeDefaults';\nimport { PartialLocation, QueryParamAdapter, UrlUpdateType } from './types';\nimport { applyUrlNames } from './urlName';\n\n// for multiple param config\ntype ChangesType<DecodedValueMapType> =\n | Partial<DecodedValueMapType>\n | ((latestValues: DecodedValueMapType) => Partial<DecodedValueMapType>);\n\n/**\n * Given a ?foo=1&bar=2 and { bar: 3, baz: true } produce ?foo=1&bar=3&baz=1\n * or similar, depending on updateType. The result will be prefixed with \"?\"\n * or just be the empty string.\n */\nexport function getUpdatedSearchString({\n changes,\n updateType,\n currentSearchString,\n paramConfigMap: baseParamConfigMap,\n options,\n}: {\n changes: ChangesType<DecodedValueMap<any>>;\n updateType?: UrlUpdateType;\n currentSearchString: string;\n paramConfigMap: QueryParamConfigMap;\n options: QueryParamOptionsWithRequired;\n}): string {\n const { searchStringToObject, objectToSearchString } = options;\n if (updateType == null) updateType = options.updateType;\n\n let encodedChanges;\n const parsedParams = memoSearchStringToObject(\n searchStringToObject,\n currentSearchString\n );\n\n // see if we have unconfigured params in the changes that we can\n // inherit to expand our config map instead of just using strings\n const paramConfigMap = extendParamConfigForKeys(\n baseParamConfigMap,\n Object.keys(changes),\n options.params\n );\n\n // update changes prior to encoding to handle removing defaults\n // getting latest values when functional update\n let changesToUse: Partial<DecodedValueMap<any>>;\n\n // functional updates here get the latest values\n if (typeof changes === 'function') {\n const latestValues = getLatestDecodedValues(\n parsedParams,\n paramConfigMap,\n decodedParamCache\n );\n\n changesToUse = (changes as Function)(latestValues);\n } else {\n // simple update here\n changesToUse = changes;\n }\n\n encodedChanges = encodeQueryParams(paramConfigMap, changesToUse);\n\n // remove defaults\n if (options.removeDefaultsFromUrl) {\n removeDefaults(encodedChanges, paramConfigMap);\n }\n\n // interpret urlNames\n encodedChanges = applyUrlNames(encodedChanges, paramConfigMap);\n\n let newSearchString: string;\n if (updateType === 'push' || updateType === 'replace') {\n newSearchString = objectToSearchString(encodedChanges);\n } else {\n newSearchString = objectToSearchString({\n ...parsedParams,\n ...encodedChanges,\n });\n }\n\n if (newSearchString?.length && newSearchString[0] !== '?') {\n (newSearchString as any) = `?${newSearchString}`;\n }\n\n return newSearchString ?? '';\n}\n\n/**\n * uses an adapter to update a location object and optionally\n * navigate based on the updateType\n */\nexport function updateSearchString({\n searchString,\n adapter,\n navigate,\n updateType,\n}: {\n searchString: string;\n adapter: QueryParamAdapter;\n navigate: boolean;\n updateType?: UrlUpdateType;\n}) {\n const currentLocation = adapter.location;\n\n // update the location and URL\n const newLocation: PartialLocation = {\n ...currentLocation,\n search: searchString,\n };\n\n if (navigate) {\n // be defensive about checking updateType since it is somewhat easy to\n // accidentally pass a second argument to the setter.\n if (typeof updateType === 'string' && updateType.startsWith('replace')) {\n adapter.replace(newLocation);\n } else {\n adapter.push(newLocation);\n }\n }\n}\n\ntype UpdateArgs = Parameters<typeof getUpdatedSearchString>[0] & {\n adapter: QueryParamAdapter;\n};\n\nconst immediateTask = (task: Function) => task();\nconst timeoutTask = (task: Function) => setTimeout(() => task(), 0);\n// alternative could be native `queueMicrotask`\n\nconst updateQueue: UpdateArgs[] = [];\n\n/**\n * support batching by enqueuing updates (if immediate is not true)\n */\nexport function enqueueUpdate(\n args: UpdateArgs,\n { immediate }: { immediate?: boolean } = {}\n) {\n updateQueue.push(args);\n let scheduleTask = immediate ? immediateTask : timeoutTask;\n\n if (updateQueue.length === 1) {\n scheduleTask(() => {\n const updates = updateQueue.slice();\n updateQueue.length = 0;\n const initialSearchString = updates[0].currentSearchString;\n\n let searchString: string | undefined;\n for (let i = 0; i < updates.length; ++i) {\n const modifiedUpdate: UpdateArgs =\n i === 0\n ? updates[i]\n : { ...updates[i], currentSearchString: searchString! };\n searchString = getUpdatedSearchString(modifiedUpdate);\n }\n\n // do not update unnecessarily #234\n if (\n args.options.skipUpdateWhenNoChange &&\n searchString === initialSearchString\n ) {\n return;\n }\n\n updateSearchString({\n searchString: searchString ?? '',\n adapter: updates[updates.length - 1].adapter,\n navigate: true,\n updateType: updates[updates.length - 1].updateType,\n });\n });\n }\n}\n","import { DecodedValueMap, QueryParamConfigMap, EncodedValueMap } from './types';\n\n/**\n * Convert the values in query to strings via the encode functions configured\n * in paramConfigMap\n *\n * @param paramConfigMap Map from query name to { encode, decode } config\n * @param query Query updates mapping param name to decoded value\n */\nexport function encodeQueryParams<QPCMap extends QueryParamConfigMap>(\n paramConfigMap: QPCMap,\n query: Partial<DecodedValueMap<QPCMap>>\n): Partial<EncodedValueMap<QPCMap>> {\n const encodedQuery: Partial<EncodedValueMap<QPCMap>> = {};\n\n const paramNames = Object.keys(query);\n for (const paramName of paramNames) {\n const decodedValue = query[paramName];\n\n if (!paramConfigMap[paramName]) {\n // NOTE: we could just not encode it, but it is probably convenient to have\n // it be included by default as a string type.\n (encodedQuery as any)[paramName] =\n decodedValue == null ? decodedValue : String(decodedValue);\n } else {\n encodedQuery[paramName as keyof QPCMap] = paramConfigMap[\n paramName\n ].encode(query[paramName]);\n }\n }\n\n return encodedQuery;\n}\nexport default encodeQueryParams;\n","import { EncodedValueMap, QueryParamConfigMap } from 'serialize-query-params';\n\n/**\n * Note: This function is destructive - it mutates encodedValues.\n * Remove values that match the encoded defaults from the encodedValues object\n */\nexport function removeDefaults(\n encodedValues: Partial<EncodedValueMap<any>>,\n paramConfigMap: QueryParamConfigMap\n) {\n for (const paramName in encodedValues) {\n // does it have a configured default and does it have a non-undefined value?\n if (\n paramConfigMap[paramName]?.default !== undefined &&\n encodedValues[paramName] !== undefined\n ) {\n // does its current value match the encoded default\n const encodedDefault = paramConfigMap[paramName].encode(\n paramConfigMap[paramName].default\n );\n if (encodedDefault === encodedValues[paramName]) {\n encodedValues[paramName] = undefined;\n }\n }\n }\n}\n","import { useCallback, useMemo } from 'react';\nimport { QueryParamConfig } from 'serialize-query-params';\nimport { QueryParamOptions } from './options';\nimport { UrlUpdateType } from './types';\nimport useQueryParams from './useQueryParams';\n\ntype NewValueType<D> = D | ((latestValue: D) => D);\n\n/**\n * Given a query param name and query parameter configuration ({ encode, decode })\n * return the decoded value and a setter for updating it.\n *\n * The setter takes two arguments (newValue, updateType) where updateType\n * is one of 'replace' | 'replaceIn' | 'push' | 'pushIn', defaulting to\n * 'pushIn'.\n */\nexport const useQueryParam = <TypeToEncode, TypeFromDecode = TypeToEncode>(\n name: string,\n paramConfig?: QueryParamConfig<TypeToEncode, TypeFromDecode>,\n options?: QueryParamOptions\n): [\n TypeFromDecode,\n (newValue: NewValueType<TypeToEncode>, updateType?: UrlUpdateType) => void\n] => {\n const paramConfigMap = useMemo(\n () => ({ [name]: paramConfig ?? 'inherit' }),\n [name, paramConfig]\n );\n const [query, setQuery] = useQueryParams(paramConfigMap, options);\n const decodedValue = query[name];\n const setValue = useCallback(\n (newValue: NewValueType<TypeToEncode>, updateType?: UrlUpdateType) => {\n if (typeof newValue === 'function') {\n return setQuery((latestValues) => {\n const newValueFromLatest = (newValue as Function)(latestValues[name]);\n return { [name]: newValueFromLatest };\n }, updateType);\n }\n return setQuery({ [name]: newValue } as any, updateType);\n },\n [name, setQuery]\n );\n\n return [decodedValue, setValue];\n};\n","import { useEffect, useMemo, useRef, useState } from 'react';\nimport {\n DecodedValueMap,\n QueryParamConfig,\n QueryParamConfigMap,\n StringParam,\n} from 'serialize-query-params';\nimport { decodedParamCache } from './decodedParamCache';\nimport {\n extendParamConfigForKeys,\n convertInheritedParamStringsToParams,\n} from './inheritedParams';\nimport { makeStableGetLatestDecodedValues } from './latestValues';\nimport { memoSearchStringToObject } from './memoSearchStringToObject';\nimport { mergeOptions, QueryParamOptions } from './options';\nimport { useQueryParamContext } from './QueryParamProvider';\nimport {\n QueryParamConfigMapWithInherit,\n SetQuery,\n UrlUpdateType,\n} from './types';\nimport { enqueueUpdate } from './updateSearchString';\nimport { serializeUrlNameMap } from './urlName';\n\n// for multiple param config\ntype ChangesType<DecodedValueMapType> =\n | Partial<DecodedValueMapType>\n | ((latestValues: DecodedValueMapType) => Partial<DecodedValueMapType>);\n\ntype UseQueryParamsResult<QPCMap extends QueryParamConfigMap> = [\n DecodedValueMap<QPCMap>,\n SetQuery<QPCMap>\n];\ntype ExpandInherits<QPCMap extends QueryParamConfigMapWithInherit> = {\n [ParamName in keyof QPCMap]: QPCMap[ParamName] extends string\n ? typeof StringParam\n : QPCMap[ParamName] extends QueryParamConfig<any>\n ? QPCMap[ParamName]\n : never;\n};\n\n/**\n * Given a query parameter configuration (mapping query param name to { encode, decode }),\n * return an object with the decoded values and a setter for updating them.\n */\nexport function useQueryParams<\n QPCMap extends QueryParamConfigMap = QueryParamConfigMap\n>(): UseQueryParamsResult<QPCMap>;\nexport function useQueryParams<QPCMap extends QueryParamConfigMapWithInherit>(\n names: string[],\n options?: QueryParamOptions\n): UseQueryParamsResult<ExpandInherits<QPCMap>>;\nexport function useQueryParams<\n QPCMap extends QueryParamConfigMapWithInherit,\n OutputQPCMap extends QueryParamConfigMap = ExpandInherits<QPCMap>\n>(\n paramConfigMap: QPCMap,\n options?: QueryParamOptions\n): UseQueryParamsResult<OutputQPCMap>;\nexport function useQueryParams(\n arg1?: string[] | QueryParamConfigMapWithInherit,\n arg2?: QueryParamConfig<any> | QueryParamOptions\n): UseQueryParamsResult<any> {\n const { adapter, options: contextOptions } = useQueryParamContext();\n const [stableGetLatest] = useState(makeStableGetLatestDecodedValues);\n\n // intepret the overloaded arguments\n const { paramConfigMap: paramConfigMapWithInherit, options } = parseArguments(\n arg1,\n arg2\n );\n\n const mergedOptions = useMemo(() => {\n return mergeOptions(contextOptions, options);\n }, [contextOptions, options]);\n\n // interpret params that were configured up the chain\n let paramConfigMap = convertInheritedParamStringsToParams(\n paramConfigMapWithInherit,\n mergedOptions\n );\n\n // what is the current stringified value?\n const parsedParams = memoSearchStringToObject(\n mergedOptions.searchStringToObject,\n adapter.location.search,\n serializeUrlNameMap(paramConfigMap) // note we serialize for memo purposes\n );\n\n // do we want to include all params from the URL even if not configured?\n if (mergedOptions.includeAllParams) {\n paramConfigMap = extendParamConfigForKeys(\n paramConfigMap,\n Object.keys(parsedParams),\n mergedOptions.params,\n StringParam\n );\n }\n\n // run decode on each key\n const decodedValues = stableGetLatest(\n parsedParams,\n paramConfigMap,\n decodedParamCache\n );\n\n // clear out unused values in cache\n // use string for relatively stable effect dependency\n const paramKeyString = Object.keys(paramConfigMap).join('\\0');\n useEffect(() => {\n const paramNames = paramKeyString.split('\\0');\n decodedParamCache.registerParams(paramNames);\n return () => {\n decodedParamCache.unregisterParams(paramNames);\n };\n }, [paramKeyString]);\n\n // create a setter for updating multiple query params at once\n // use a ref for callback dependencies so we don't generate a new one unnecessarily\n const callbackDependencies = {\n adapter,\n paramConfigMap,\n options: mergedOptions,\n };\n const callbackDependenciesRef =\n useRef<typeof callbackDependencies>(callbackDependencies);\n if (callbackDependenciesRef.current == null) {\n callbackDependenciesRef.current = callbackDependencies;\n }\n useEffect(() => {\n callbackDependenciesRef.current.adapter = adapter;\n callbackDependenciesRef.current.paramConfigMap = paramConfigMap;\n callbackDependenciesRef.current.options = mergedOptions;\n }, [adapter, paramConfigMap, mergedOptions]);\n\n // create callback with stable identity\n const [setQuery] = useState(() => {\n const setQuery = (\n changes: ChangesType<DecodedValueMap<any>>,\n updateType?: UrlUpdateType\n ) => {\n // read from a ref so we don't generate new setters each time any change\n const { adapter, paramConfigMap, options } =\n callbackDependenciesRef.current!;\n if (updateType == null) updateType = options.updateType;\n\n enqueueUpdate(\n {\n changes,\n updateType,\n currentSearchString: adapter.location.search,\n paramConfigMap,\n options,\n adapter,\n },\n { immediate: !options.enableBatching }\n );\n };\n\n return setQuery;\n });\n\n return [decodedValues, setQuery];\n}\n\nexport default useQueryParams;\n\nfunction parseArguments(\n arg1: string[] | QueryParamConfigMapWithInherit | undefined,\n arg2: QueryParamConfig<any> | QueryParamOptions | undefined\n): {\n paramConfigMap: QueryParamConfigMapWithInherit;\n options: QueryParamOptions | undefined;\n} {\n let paramConfigMap: QueryParamConfigMapWithInherit;\n let options: QueryParamOptions | undefined;\n\n if (arg1 === undefined) {\n // useQueryParams()\n paramConfigMap = {};\n options = arg2 as QueryParamOptions | undefined;\n } else if (Array.isArray(arg1)) {\n // useQueryParams(['geo', 'other'])\n // useQueryParams(['geo', 'other'], options)\n paramConfigMap = Object.fromEntries(\n arg1.map((key) => [key, 'inherit' as const])\n );\n options = arg2 as QueryParamOptions | undefined;\n } else {\n // useQueryParams({ geo: NumberParam })\n // useQueryParams({ geo: NumberParam }, options)\n paramConfigMap = arg1;\n options = arg2 as QueryParamOptions | undefined;\n }\n\n return { paramConfigMap, options };\n}\n"],"names":["NullSignal","AggregateAbortController","signals","Set","abortController","AbortController","addSignal","signal","this","aborted","Error","add","handleAborted","addEventListener","delete","size","abort","AggregateStatusReporter","callbacks","addCallback","callback","currentMessage","message","elt","AbortablePromiseCache","constructor","fill","cache","TypeError","get","set","fillCallback","isAbortException","exception","name","code","evict","key","entry","data","statusCallback","aborter","statusReporter","newEntry","promise","settled","then","catch","error","console","checkSinglePromise","checkForSingleAbort","Object","assign","result","has","AbortSignal","cacheEntry","cachedEntry","clear","keyIter","keys","deleteCount","next","done","value","d","getAppBarUtilityClass","slot","generateUtilityClass","generateUtilityClasses","joinVars","var1","var2","replace","AppBarRoot","styled","Paper","overridesResolver","props","styles","ownerState","root","capitalize","position","color","memoTheme","theme","display","flexDirection","width","boxSizing","flexShrink","variants","style","zIndex","vars","appBar","top","left","right","palette","AppBar","defaultBg","grey","text","primary","getContrastText","applyStyles","entries","filter","createSimplePaletteValueFilter","map","main","contrastText","enableColorOnDark","includes","backgroundColor","darkBg","darkColor","backgroundImage","inProps","ref","className","other","classes","slots","composeClasses","useUtilityClasses","square","component","elevation","clsx","isDynamicSupport","html","enableColorScheme","WebkitFontSmoothing","MozOsxFontSmoothing","WebkitTextSizeAdjust","colorScheme","mode","body","typography","body1","background","default","common","white","colorSchemeStyles","colorSchemes","getColorSchemeSelector","forEach","scheme","selector","startsWith","defaultStyles","fontWeight","fontWeightBold","margin","themeOverrides","components","MuiCssBaseline","styleOverrides","SELECTOR","GlobalStyles","baseStyles","Array","isArray","staticStyles","children","FabRoot","shouldForwardProp","prop","variant","colorInherit","button","minHeight","transition","transitions","create","duration","short","borderRadius","padding","minWidth","height","fab","boxShadow","shadows","A100","textDecoration","focusVisible","dark","disabled","action","disabledBackground","disableFocusRipple","focusVisibleClassName","composedClasses","focusRipple","getFabUtilityClass","ToolbarRoot","disableGutters","gutters","alignItems","paddingLeft","spacing","paddingRight","breakpoints","up","mixins","toolbar","as","getToolbarUtilityClass","isMergeableObject","isNonNullObject","stringValue","prototype","toString","call","$$typeof","REACT_ELEMENT_TYPE","isReactElement","isSpecial","Symbol","for","cloneUnlessOtherwiseSpecified","options","clone","deepmerge","val","defaultArrayMerge","target","source","concat","element","getKeys","getOwnPropertySymbols","symbol","propertyIsEnumerable","getEnumerableOwnPropertySymbols","propertyIsOnObject","object","property","_","arrayMerge","sourceIsArray","destination","hasOwnProperty","propertyIsUnsafe","customMerge","getMergeFunction","mergeObject","all","array","reduce","prev","deepmerge_1","module","exports","getMessage","e","RemoteFile","getBufferFromResponse","response","resp","arrayBuffer","from","opts","baseOverrides","url","fetch","globalThis","bind","overrides","fetchImplementation","input","init","cause","warn","read","buffer","offset","length","headers","Infinity","range","res","method","redirect","ok","status","resData","bytesCopied","copy","Math","min","contentRange","sizeMatch","exec","_stat","parseInt","bytesRead","readFile","encoding","stat","buf","allocUnsafe","close","hasSymbol","isFunctionNameConfigurable","getOwnPropertyDescriptor","configurable","ReactForwardRefSymbol","forwardRef","ReactMemoSymbol","memo","observer","baseComponent","useForwardRef","render","baseComponentName","displayName","base","observerComponent","defineProperty","writable","contextTypes","hoistBlackList","compare","type","Hook","livelinessChecking","setLivelinessChecking","getLivelinessChecking","setLivelynessChecking","extendStatics","b","setPrototypeOf","__proto__","p","__extends","String","__","__assign","t","s","i","n","arguments","apply","__generator","thisArg","f","y","g","label","sent","trys","ops","verb","iterator","v","op","pop","push","step","__values","o","m","__read","r","ar","__spread","getType","assertIsStateTreeNode","getStateTreeNode","getChildType","propertyName","onPatch","assertIsFunction","onSnapshot","applyPatch","patch","assertArg","applyPatches","asArray","recordPatches","subject","disposer","patches","inversePatches","publicData","recorder","recording","slice","reversedInversePatches","reverse","stop","undefined","resume","inversePatch","getRunningActionContext","replay","undo","protect","node","isRoot","fail","isProtectionEnabled","unprotect","isProtected","applySnapshot","snapshot","getSnapshot","applyPostProcess","hasParent","depth","assertIsNumber","parent","getParent","storedValue","hasParentOfType","assertIsType","is","getParentOfType","getRoot","getPath","path","getPathParts","splitJsonPath","resolvePath","assertIsString","resolveNodeByPath","resolveIdentifier","identifier","identifierCache","resolve","normalizeIdentifier","getIdentifier","tryReference","getter","checkIfAlive","isStateTreeNode","isAlive","InvalidReferenceError","isValidReference","tryResolve","getRelativePath","getRelativePathBetweenNodes","keepEnvironment","environment","detach","destroy","die","removeChild","subpath","observableIsAlive","addDisposer","getEnv","EMPTY_OBJECT","walk","processor","getChildren","child","getPropertyMembers","typeOrNode","properties","getMembers","reflected","actions","volatile","views","flowActions","getOwnPropertyNames","descriptor","isComputedProp","_isFlowAction","_isMSTAction","isObservableProp","cast","snapshotOrInstance","castToSnapshot","castToReferenceSnapshot","instance","getNodeId","nodeId","BaseNode","enumerable","NodeLifeCycle","INITIALIZING","baseSetParent","_subpath","_subpathUponDeath","_pathUponDeath","getValue","_state","wasAlive","aliveAtom","reportChanged","_hookSubscribers","emit","hook","hookHandler","EventHandlers","register","_parent","_escapedSubpath","pathAtom","getEscapedPath","reportObserved","createAtom","escapeJsonPath","state","DEAD","DETACHING","whenFinalized","CREATED","FINALIZED","fireHook","afterAttach","clearAll","beforeDestroy","ScalarNode","_super","simpleType","initialSnapshot","_this","createNewInstance","finalizeCreation","newParent","parentChanged","subpathChanged","pathUponDeath","aboutToDie","finalizeDeath","baseFinalizeCreation","baseAboutToDie","baseFinalizeDeath","fireInternalHook","_a","TypeFlags","nextNodeId","snapshotReactionOptions","onError","ObjectNode","complexType","initialValue","_snapshotComputed","computed","unbox","_initialSnapshot","identifierAttribute","IdentifierCache","_childNodes","initializeChildNodes","unnormalizedIdentifier","id","childNode","addNodeToCache","createObservableInstanceIfNeeded","_applyPatches","_applySnapshot","fireHooks","_observableInstanceState","createObservableInstance","e_1","e_2","_b","parentChain","unshift","parentChain_1","parentChain_1_1","e_1_1","return","preboot","_isRunningAction","finalizeNewInstance","trackAndCompute","_addSnapshotReaction","afterCreate","_c","_d","e_2_1","beforeDetach","previousState","newEnv","newIdCache","splitCache","mergeCache","fn","_allowStateChangesInsideComputed","hasSnapshotPostProcessor","_getActualSnapshot","_getCachedInitialSnapshot","_snapshotUponDeath","_cachedInitialSnapshotCreated","childNodes","_cachedInitialSnapshot","processInitialSnapshot","isRunningAction","context","msg","_getAssertAliveError","escapedPath","actionContext","getCurrentActionContext","parentActionEvent","actionFullPath","assertAlive","_autoUnbox","getChildNode","convertChildNodesToArray","subpathUponDeath","e_3","e_3_1","afterCreationFinalization","clearParent","self","createActionInvoker","parts","resolveNodeByPathParts","applyPatchLocally","addHiddenFinalProp","toJSON","_internalEventsEmit","_internalEventsClear","notifyDied","_internalEventsClearAll","onChange","_internalEventsRegister","handler","basePatch","_internalEventsHasSubscribers","localizedPatch","a","_i","current","extend","substr","stripPatch","invertPatch","splitPatch","reversePatch","emitPatch","_internalEventsHas","hasDisposer","_internalEventsUnregister","middleware","middlewares","index","indexOf","splice","includeHooks","removeMiddleware","assertWritable","_hasSnapshotReaction","snapshotDisposer","reaction","emitSnapshot","event","_internalEvents","hasSubscribers","eventHandler","atTheBeginning","unregister","args","cannotDetermineSubtype","$type","BaseType","typecheckInternal","instantiate","getStateTreeNodeSafe","valueType","isAssignableFrom","typeCheckSuccess","typeCheckFailure","isValidSnapshot","thing","validate","ComplexType","getDefaultSnapshot","newValue","isDetaching","isMutable","isMatchingSnapshotId","tryToReconcileNode","setParent","newNode","SimpleType","isType","argNumber","runningActions","Map","createActionTrackingMiddleware","hooks","onStart","onResume","async","onSuspend","onSuccess","onFail","rootId","RunningAction","running","onFinish","flowsPending","createActionTrackingMiddleware2","middlewareHooks","parentRunningAction","newCall","env","parentCall","passesFilter","runningAction","finish","hasFlowsPending","incFlowsPending","decFlowsPending","serializeTheUnserializable","baseType","$MST_UNSERIALIZABLE","applyAction","runInAction","resolvedTarget","Date","baseApplyAction","recordActions","listener","onAction","attachAfter","addMiddleware","rawCall","sourceNode_1","info","arg","actionName","$MST_DATE","getTime","isPrimitive","isPlainObject","JSON","stringify","serializeArgument","currentActionContext","nextActionId","getNextActionId","runWithActionContext","baseIsRunningAction","previousContext","baseCall","originalFn","CollectedMiddlewares","isEmpty","runNextMiddleware","getNextMiddleware","call2","runMiddleWares","getParentActionContext","parentContext","parentActionContext","argsToArray","tree","parentId","allParentIds","parentEvent","addMiddleWare","decorate","$mst_middleware","arrayIndex","inArrayIndex","_isActionContextThisOrChildOf","sameOrParent","includeSame","isActionContextChildOf","isActionContextThisOrChildOf","parentOrThis","prettyPrintValue","safeStringify","toErrorString","fullPath","join","pathPrefix","currentTypename","isSnapshotCompatible","isPrimitiveType","describe","getContextForPath","EMPTY_ARRAY","flattenTypeErrors","errors","process","typecheck","valueInString","substring","validationErrorsToString","identifierCacheId","observable","lcm","lastCacheModificationPerId","modificationId","cacheId","lastCacheUpdate","mobxShallow","updateLastCacheModificationPerId","values","nodes","remove","splitNode","newCache","basePath","modified","some","candidate","matches","createObjectNode","existingNode","createScalarNode","$treenode","doubleDot","baseParts","targetParts","joinJsonPath","failIfResolveFails","pathParts","part","DEPRECATION_MESSAGE","process$1","asyncAction","deprecated","flow","plainObjectString","freeze","_getGlobalState","useProxies","deep","proxy","identity","isInteger","Number","isObservableArray","proto","getPrototypeOf","RegExp","includeDate","isSerializable","propName","isObservableObject","EventHandler","handlers","eventHandlers","stringStartsWith","str","beginning","typeName","max","canBeEmpty","setImmediateWithFallback","queueMicrotask","setImmediate","setTimeout","generator","spawner","runId","contextBase","wrap","Promise","reject","gen","onFulfilled","ret","cancelError","throw","onRejected","err","createFlowSpawner","castFlowReturn","toGeneratorFunction","toGenerator","oldValue","unescapeJsonPath","getPathStr","split","shift","ids","MapIdentifierMode","$preProcessorFailed","SnapshotProcessor","_subtype","_processors","flags","sn","preProcessor","preProcessSnapshot","postProcessor","nodeType","snapshotProcessorType","methods","methods_1","methods_1_1","proxyNodeTypeMethods","oldGetSnapshot","postProcessSnapshot","isUnionType","getReconciliationType","processedInitialValue","_fixNode","reconcile","processedSn","preProcessSnapshotSafe","needsIdentifierError","tryCollectModelTypes","modelTypes","subtypes","getSubTypes","subtypesArray","subtypesArray_1","subtypesArray_1_1","ModelType","MSTMap","initialData","enhancer","mapNode","mapType","identifierMode","YES","mapIdentifierAttribute","isValidIdentifier","put","ObservableMap","MapType","_subType","hookInitializers","UNKNOWN","_determineIdentifierMode","NO","objNode","subType","_interceptReads","initializer","actionInvoker","intercept","willChange","observe","didChange","change","processIdentifier","expected","processed","oldSnapshot","currentKeys","isMapType","ArrayType","item","_getAdministration","dehancer","updatedNodes","reconcileArrayChildren","index_1","removedCount","added","addedNodes","removed","addedCount","childType","oldNodes","newValues","newPaths","nothingChanged","hasNewNode","oldNode","newPath","areSame","valueAsNode","oldMatch","j","getNewNode","oldNodeType","isArrayType","PRE_PROCESS_SNAPSHOT","POST_PROCESS_SNAPSHOT","objectTypeToString","defaultObjectOptions","initializers","declaredProps","keysList","alreadySeenKeys","cloneAndEnhance","currentPreprocessor","currentPostprocessor","optional","string","number","boolean","DatePrimitive","getPrimitiveFactoryFromValue","propertyNames","_getIdentifierAttribute","forAllProps","propType","Identifier","instantiateActions","action2","baseAction","specializedAction_1","boundAction","instantiateVolatileState","rest","__rest","instantiateViews","makeObservable","applySnapshotPreProcessor","chg","oldChildValue","adm","raw","getAtom","applySnapshotPostProcessor","preProcessedSnapshot","isModelType","CoreType","checker","integer","Integer","float","Float","finite","Finite","isFinite","Boolean","nullType","Null","undefinedType","Undefined","_DatePrimitive","Literal","literal","isLiteralType","Refinement","_predicate","_message","subtypeErrors","isRefinementType","Union","_types","eager","dispatcher","_dispatcher","_eager","factory","determineType","reconcileCurrentType","find","allErrors","applicableTypes","union","optionsOrType","otherTypes","types","OptionalValue","_defaultValue","optionalValues","Optional","defaultInstanceOrSnapshot","getDefaultInstanceOrSnapshot","defaultValueOrFunction","checkOptionalPreconditions","undefinedAsOptionalValues","isOptionalType","optionalUndefinedType","optionalNullType","maybe","Late","_definition","mustSucceed","ReferenceError","getSubType","isLateType","Lazy","when","pendingNodeList","shouldLoadPredicate","loadType","loadedType","Frozen","untypedFrozenInstance","isFrozenType","StoredReference","targetType","targetNode","normalizedId","lastCacheModification","getLastCacheModificationPerId","resolvedReference","updateResolvedReference","BaseReferenceType","onInvalidated","Reference","storedRefNode","referenceId","refTargetNode","storedRefParentNode","storedRefParentValue","invalidTarget","invalidId","replaceRef","newRef","removeRef","refTargetValue","refTargetNodeHook","getInvalidationCause","fireInvalidated","refTargetDetachHookDisposer","registerHook","refTargetDestroyHookDisposer","customGetSet","onRefTargetDestroyedHookDisposer","startWatching","sync","addTargetNodeWatcher","IdentifierReferenceType","resolvedValue","storedRef","watchTargetNodeForInvalidations","compareByValue","CustomReferenceType","newIdentifier","reference","getSetOptions","isReferenceType","BaseIdentifierType","validType","IdentifierType","IdentifierNumberType","identifierNumber","isIdentifierType","CustomType","Custom","isTargetType","typeError","getValidationMessage","toSnapshot","fromSnapshot","isSnapshot","valueToStore","enumeration","realOptions","option","model","compose","hasTypename","cur","named","custom","safeReference","refType","ev","acceptsUndefined","maybeNull","refinement","predicate","subtype","frozen","late","nameOrType","maybeType","lazy","null","snapshotProcessor","processors","_len","_key","mockGlobal","getGlobal","window","global","getDescriptor","objectPrototype","hasProxy","Proxy","assertProxies","once","func","invoked","noop","isFunction","isStringish","isObject","protoConstructor","isGenerator","obj","addHiddenProp","createInstanceofPredicate","theClass","x","isES6Map","isES6Set","hasGetOwnPropertySymbols","ownKeys","Reflect","toPrimitive","hasProp","getOwnPropertyDescriptors","getFlag","mask","setFlag","storedAnnotationsSymbol","createDecoratorAnnotation","annotation","is20223Decorator","decorate_20223_","storeAnnotation","_extends","annotationType_","OVERRIDE","isOverride","$mobx","Atom","name_","flags_","observers_","lastAccessedBy_","lowestObserverState_","IDerivationState_","NOT_TRACKING_","onBOL","onBUOL","_proto","onBO","onBUO","startBatch","propagateChanged","endBatch","_createClass","isBeingObservedMask_","isPendingUnobservationMask_","diffValueMask_","isAtom","onBecomeObservedHandler","onBecomeUnobservedHandler","atom","onBecomeObserved","onBecomeUnobserved","comparer","structural","deepEqual","shallow","deepEnhancer","isObservable","isAction","isFlow","autoAction","referenceEnhancer","override","make_","extend_","proxyTrap","desc","createActionAnnotation","options_","_this$options_","bound","target_","actionDescriptor","createActionDescriptor","defineProperty_","mthd","kind","addInitializer","ann","_this$options_2","_ann$options_$name","_ann$options_","_ann$options_$autoAct","_ann$options_2","createAction","isMobxAction","safeDescriptors","_ref2","globalState","_adm$proxy_","_annotation$options_","proxy_","_annotation$options_$","_annotation$options_2","_annotation$options_$2","_annotation$options_3","_annotation$options_4","_adm$proxy_2","isPlainObject_","createFlowAnnotation","flowDescriptor","createFlowDescriptor","_this$options_3","isMobXFlow","createComputedAnnotation","defineComputedProperty_","asObservableObject","values_","ComputedValue","getObservablePropValue_","createObservableAnnotation","defineObservableProperty_","_this$options_$enhanc","initializedObjects","WeakSet","initializeObservable","ObservableValue","_ann$options_$enhance","setObservablePropValue_","AUTO","autoAnnotation","createAutoAnnotation","autoBind","observableAnnotation","_this$options_4","_this$options_5","_this$options_6","defaultCreateObservableOptions","defaultDecorator","asCreateObservableOptions","observableRefAnnotation","observableShallowAnnotation","isObservableMap","isObservableSet","observableStructAnnotation","observableDecoratorAnnotation","getEnhancerFromOptions","createObservable","arg2","arg3","box","equals","initialValues","createLegacyArray","createObservableArray","ObservableSet","decorators","initObservable","extendObservable","_target$$mobx$proxy_","_target$$mobx","objectProxyTraps","asDynamicObservableObject","struct","COMPUTED","computedAnnotation","computedStructAnnotation","arg1","currentActionId","_getDescriptor$config","_getDescriptor","tmpNameDescriptor","executeAction","canRunAsDerivation","scope","runInfo","_startAction","error_","_endAction","prevDerivation_","trackingDerivation","runAsAction","prevAllowStateChanges_","allowStateChanges","untrackedStart","allowStateChangesStart","runAsAction_","prevAllowStateReads_","allowStateReadsStart","notifySpy_","startTime_","actionId_","parentActionId_","suppressReactionErrors","allowStateChangesEnd","allowStateReadsEnd","untrackedEnd","_Atom","notifySpy","hasUnreportedChange_","interceptors_","changeListeners_","value_","_inheritsLoose","dehanceValue","prepareNewValue_","UNCHANGED","setNewValue_","hasInterceptors","interceptChange","UPDATE","hasListeners","notifyListeners","intercept_","registerInterceptor","observe_","fireImmediately","observableKind","debugObjectName","registerListener","valueOf","isObservableValue","dependenciesState_","observing_","newObserving_","runId_","UP_TO_DATE_","unboundDepsCount_","CaughtException","triggeredBy_","derivation","setter_","isTracing_","TraceMode","NONE","scope_","equals_","requiresReaction_","keepAlive_","compareStructural","requiresReaction","keepAlive","onBecomeStale_","POSSIBLY_STALE_","propagateMaybeChanged","isComputing","inBatch","shouldCompute","prevTrackingContext","trackingContext","STALE_","propagateChangeConfirmed","warnAboutUntrackedRead_","computeValue_","isCaughtException","isRunningSetter","wasSuspended","changed","track","trackDerivedFunction","disableErrorBoundaries","suspend_","clearObserving","firstTime","prevValue","autorun","prevU","isComputingMask_","isRunningSetterMask_","isComputedValue","prevAllowStateReads","prevUntracked","obs","l","changeDependenciesStateTo0","isComputingDerivation","prevTracking","prevObserving","observing","lowestNewObservingDerivationState","i0","dep","diffValue","removeObserver","addObserver","bindDependencies","untracked","allowStateReads","persistentKeys","MobXGlobals","version","mobxGuid","pendingUnobservations","pendingReactions","isRunningReactions","enforceActions","spyListeners","globalReactionErrorHandlers","computedRequiresReaction","reactionRequiresObservable","observableRequiresReaction","verifyProxies","canMergeGlobalState","isolateCalled","__mobxInstanceCount","__mobxGlobals","getGlobalState","resetGlobalState","defaultGlobals","queueForUnobservation","isPendingUnobservation","runReactions","list","isBeingObserved","Reaction","onInvalidate_","errorHandler_","requiresObservable_","schedule_","isScheduled","runReaction_","isDisposed","isTrackPending","reportExceptionInDerivation_","isRunning","prevReaction","dispose","getDisposer_","abortSignal","_this2","removeEventListener","trace","enterBreakPoint","isDisposedMask_","isScheduledMask_","isTrackPendingMask_","isRunningMask_","onReactionError","idx","MAX_REACTION_ITERATIONS","reactionScheduler","runReactionsHelper","allReactions","iterations","remainingReactions","isReaction","spy","ACTION","AUTOACTION","DEFAULT_ACTION_NAME","actionAnnotation","actionBoundAnnotation","autoActionAnnotation","autoActionBoundAnnotation","createActionFactory","view","_opts$name","_opts","scheduler","delay","createSchedulerFromOptions","reactionRunner","requiresObservable","_opts2","_opts3","run","expression","effect","errorHandler","baseFn","_opts$name2","effectAction","runSync","nextValue","_opts4","_opts5","ON_BECOME_OBSERVED","ON_BECOME_UNOBSERVED","interceptHook","cb","listenersKey","hookListeners","NEVER","ALWAYS","OBSERVED","configure","isolateGlobalState","baseScheduler","ea","annotations","descriptors","getDependencyTree","nodeToDependencyTree","dependencies","getObserverTree","nodeToObserverTree","hasObservers","observers","getObservers","generatorId","FlowCancellationError","isFlowCancellationError","flowAnnotation","flowBoundAnnotation","rejector","pendingPromise","stepId","cancel","cancelPromise","yieldedPromise","flowResult","interceptReads","propOrHandler","getAdministration","interceptProperty","interceptInterceptable","_isComputed","isComputed","_isObservable","keys_","set_","delete_","has_","get_","apiDefineProperty","apiOwnKeys","ownKeys_","propOrCb","cbOrFire","observeObservableProperty","observeObservable","toJSHelper","__alreadySeen","toJS","transaction","_opts$signal","_when","_opts$signal2","_opts$signal3","whenPromise","timeoutHandle","timeout","clearTimeout","getAdm","_getAdm$set_","deleteProperty","_getAdm$delete_","_getAdm$definePropert","preventExtensions","interceptable","interceptors","listenable","listeners","collectStoredAnnotations","keysSymbol","makeAutoObservable","SPLICE","arrayTraps","getArrayLength_","isNaN","arrayExtensions","setArrayLength_","ObservableArrayAdministration","owned_","legacyMode_","atom_","enhancer_","lastKnownLength_","newV","oldV","dehanceValue_","dehanceValues_","newLength","currentLength","newItems","spliceWithArray_","updateArrayLength_","oldLength","delta","reserveArrayBuffer","lengthDelta","spliceItemsIntoValues_","notifyArraySplice_","_this$values_","oldItems","notifyArrayChildUpdate_","notify","owned","spliceWithArray","_len2","items","_key2","_len3","_key3","sort","addArrayExtension","funcName","funcFactory","simpleFunc","dehancedValues","mapLikeFunc","reduceLikeFunc","accumulator","currentValue","_this3","isObservableArrayAdministration","ObservableMapMarker","ADD","DELETE","data_","hasMap_","keysAtom_","merge","hasKey","updateValue_","addValue_","_this3$hasMap_$get","_this4","_this4$hasMap_$get","makeIterable","_keys$next","_keys$next2","_step","_iterator","_createForOfIteratorHelperLoose","_step$value","mapProto","objectProto","symbols","getPlainObjectKeys","_this5","_ref","_step2","_iterator2","_this6","_step3","replacementMap","dataStructure","convertToMap","orderedData","keysReportChangedCalled","_iterator3","_this7","_step4","_iterator4","_step4$value","keyExisted","iter1","iter2","next1","next2","toStringTag","ObservableSetMarker","callbackFn","nextIndex","observableValues","intersection","otherSet","difference","symmetricDifference","isSubsetOf","isSupersetOf","isDisjointFrom","descriptorCache","REMOVE","ObservableObjectAdministration","defaultAnnotation_","appliedAnnotations_","pendingKeys_","_this$target_$storedA","outcome","recordAnnotationApplied","deleteOutcome","notifyPropertyAddition_","cachedDescriptor","getCachedObservablePropDescriptor","_this$pendingKeys_","_this$pendingKeys_2","_options$name","_options$defaultDecor","getAnnotationFromOptions","isObservableObjectAdministration","_adm$target_$storedAn","ctor","ENTRY_0","createArrayEntryDescriptor","safariPrototypeSetterInheritanceBug","OBSERVABLE_ARRAY_BUFFER_SIZE","StubArray","LegacyObservableArray","_StubArray","arrays","createArrayBufferItem","getDebugName","eq","aStack","bStack","unwrap","areArrays","aCtor","bCtor","getSelf","__MOBX_DEVTOOLS_GLOBAL_HOOK__","injectMobx","extras","makeAdapter","location","history","replaceState","search","pushState","WindowHistoryAdapter","adapter","useState","StringParam","encode","decode","allowEmptyString","getEncodedValue","encodeURIComponent","decodedParamCache","paramsMap","registeredParams","param","stringifiedValue","decodedValue","stringified","decoded","cachedParam","registerParams","paramNames","currValue","unregisterParams","extendParamConfigForKeys","baseParamConfigMap","paramKeys","inheritedParams","defaultParam","paramConfigMap","hasInherit","paramKey","objA","objB","equalMap","keysA","keysB","isEqual","getLatestDecodedValues","parsedParams","decodedValues","paramName","paramConfig","encodedValue","oldDecodedValue","makeStableGetLatestDecodedValues","prevDecodedValues","shallowEqual","cachedSearchString","cachedUrlNameMapString","cachedSearchStringToObjectFn","cachedParsedQuery","memoSearchStringToObject","searchStringToObject","searchString","urlNameMapStr","newParsedQuery","urlNameMap","fromEntries","deserializeUrlNameMap","mergeOptions","parentOptions","currOptions","merged","params","providerlessContextValue","URLSearchParams","parsed","objectToSearchString","encodedParams","append","updateType","includeKnownParams","includeAllParams","removeDefaultsFromUrl","enableBatching","skipUpdateWhenNoChange","QueryParamContext","QueryParamProviderInner","parentAdapter","Provider","QueryParamProvider","Adapter","getUpdatedSearchString","changes","currentSearchString","encodedChanges","changesToUse","newSearchString","query","encodedQuery","encodeQueryParams","encodedValues","removeDefaults","newEncodedValues","urlName","applyUrlNames","immediateTask","task","timeoutTask","updateQueue","useQueryParam","useMemo","setQuery","contextOptions","useQueryParamContext","stableGetLatest","paramConfigMapWithInherit","parseArguments","mergedOptions","hookKeys","knownKeys","convertInheritedParamStringsToParams","urlNameMapParts","serializeUrlNameMap","paramKeyString","useEffect","callbackDependencies","callbackDependenciesRef","useRef","immediate","scheduleTask","updates","initialSearchString","navigate","newLocation","updateSearchString","enqueueUpdate","useCallback","latestValues","newValueFromLatest"],"sourceRoot":""} |