{"version":3,"sources":["webpack:///./node_modules/@wry/context/lib/index.js","webpack:///./node_modules/@wry/equality/lib/index.js","webpack:///./node_modules/@wry/caches/lib/weak.js","webpack:///./node_modules/@wry/context/lib/slot.js","webpack:///./node_modules/@wry/trie/lib/index.js","webpack:///./node_modules/@wry/caches/lib/strong.js"],"names":["bind","noContext","toString","hasOwnProperty","Object","prototype","fnToStr","Function","previousComparisons","Map","equal","a","b","check","clear","aTag","call","bTag","length","previouslyCompared","aKeys","definedKeys","bKeys","keyCount","k","key","name","message","size","aIterator","entries","isMap","info","next","done","aKey","aValue","value","has","get","Uint8Array","len","byteLength","aCode","endsWith","nativeCodeSuffix","obj","keys","filter","isDefinedKey","this","full","suffix","fromIndex","indexOf","bSet","set","Set","add","noop","defaultDispose","_WeakRef","WeakRef","deref","_WeakMap","WeakMap","_FinalizationRegistry","FinalizationRegistry","register","unregister","finalizationBatchSize","WeakCache","max","Infinity","dispose","map","newest","oldest","unfinalizedNodes","finalizationScheduled","finalize","iterator","values","i","node","delete","keyRef","registry","queueMicrotask","deleteNode","getNode","older","newer","scheduleFinalization","currentContext","MISSING_VALUE","idCounter","makeSlotClass","id","Date","now","Math","random","slice","join","context","parent","slots","hasValue","callback","args","thisArg","__proto__","apply","saved","arguments","maybe","fn","ignored","globalKey","host","globalThis","global","create","globalHost","Slot","Array","defineProperty","enumerable","writable","configurable","defaultMakeData","forEach","Trie","weakness","makeData","lookupArray","array","getChildTrie","data","peekArray","mapFor","removeArray","head","child","weak","strong","isObjRef","StrongCache"],"mappings":"0HAAA,uDAEO,MAAM,KAAEA,EAAI,UAAEC,GAAc,Q,oCCFnC,wCAAM,SAAEC,EAAQ,eAAEC,GAAmBC,OAAOC,UACtCC,EAAUC,SAASF,UAAUH,SAC7BM,EAAsB,IAAIC,IAIzB,SAASC,EAAMC,EAAGC,GACrB,IACI,OAAOC,EAAMF,EAAGC,GAEpB,QACIJ,EAAoBM,SAK5B,SAASD,EAAMF,EAAGC,GAEd,GAAID,IAA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C,KAAK2B,SACd3B,KAAK2B,OAASe,GAGtB,OAAOR,EAEX,IAAI3D,EAAKY,GACL,IAAI+C,EAAOlC,KAAKwC,QAAQjE,GACxB,OAAI2D,EACOA,EAAK/C,MAAQA,GAExB+C,EAAO,CACH3D,MACAY,QACAuD,MAAO,KACPD,MAAOzC,KAAK0B,QAEZ1B,KAAK0B,SACL1B,KAAK0B,OAAOgB,MAAQR,GAExBlC,KAAK0B,OAASQ,EACdlC,KAAK2B,OAAS3B,KAAK2B,QAAUO,EAC7BlC,KAAKyB,IAAInB,IAAI/B,EAAK2D,GACXA,EAAK/C,OAEhB,QACI,MAAOa,KAAK2B,QAAU3B,KAAKyB,IAAI/C,KAAOsB,KAAKsB,IACvCtB,KAAKmC,OAAOnC,KAAK2B,OAAOpD,KAGhC,OAAOA,GACH,MAAM2D,EAAOlC,KAAKyB,IAAIpC,IAAId,GAC1B,QAAI2D,IACIA,IAASlC,KAAK0B,SACd1B,KAAK0B,OAASQ,EAAKO,OAEnBP,IAASlC,KAAK2B,SACd3B,KAAK2B,OAASO,EAAKQ,OAEnBR,EAAKQ,QACLR,EAAKQ,MAAMD,MAAQP,EAAKO,OAExBP,EAAKO,QACLP,EAAKO,MAAMC,MAAQR,EAAKQ,OAE5B1C,KAAKyB,IAAIU,OAAO5D,GAChByB,KAAKwB,QAAQU,EAAK/C,MAAOZ,IAClB","file":"js/chunk-vendors~5f61dd74.cb3ae812.js","sourcesContent":["import { Slot } from \"./slot.js\";\nexport { Slot };\nexport const { bind, noContext } = Slot;\n// Like global.setTimeout, except the callback runs with captured context.\nexport { setTimeoutWithContext as setTimeout };\nfunction setTimeoutWithContext(callback, delay) {\n return setTimeout(bind(callback), delay);\n}\n// Turn any generator function into an async function (using yield instead\n// of await), with context automatically preserved across yields.\nexport function asyncFromGen(genFn) {\n return function () {\n const gen = genFn.apply(this, arguments);\n const boundNext = bind(gen.next);\n const boundThrow = bind(gen.throw);\n return new Promise((resolve, reject) => {\n function invoke(method, argument) {\n try {\n var result = method.call(gen, argument);\n }\n catch (error) {\n return reject(error);\n }\n const next = result.done ? resolve : invokeNext;\n if (isPromiseLike(result.value)) {\n result.value.then(next, result.done ? reject : invokeThrow);\n }\n else {\n next(result.value);\n }\n }\n const invokeNext = (value) => invoke(boundNext, value);\n const invokeThrow = (error) => invoke(boundThrow, error);\n invokeNext();\n });\n };\n}\nfunction isPromiseLike(value) {\n return value && typeof value.then === \"function\";\n}\n// If you use the fibers npm package to implement coroutines in Node.js,\n// you should call this function at least once to ensure context management\n// remains coherent across any yields.\nconst wrappedFibers = [];\nexport function wrapYieldingFiberMethods(Fiber) {\n // There can be only one implementation of Fiber per process, so this array\n // should never grow longer than one element.\n if (wrappedFibers.indexOf(Fiber) < 0) {\n const wrap = (obj, method) => {\n const fn = obj[method];\n obj[method] = function () {\n return noContext(fn, arguments, this);\n };\n };\n // These methods can yield, according to\n // https://github.com/laverdet/node-fibers/blob/ddebed9b8ae3883e57f822e2108e6943e5c8d2a8/fibers.js#L97-L100\n wrap(Fiber, \"yield\");\n wrap(Fiber.prototype, \"run\");\n wrap(Fiber.prototype, \"throwInto\");\n wrappedFibers.push(Fiber);\n }\n return Fiber;\n}\n//# sourceMappingURL=index.js.map","const { toString, hasOwnProperty } = Object.prototype;\nconst fnToStr = Function.prototype.toString;\nconst previousComparisons = new Map();\n/**\n * Performs a deep equality check on two JavaScript values, tolerating cycles.\n */\nexport function equal(a, b) {\n try {\n return check(a, b);\n }\n finally {\n previousComparisons.clear();\n }\n}\n// Allow default imports as well.\nexport default equal;\nfunction check(a, b) {\n // If the two values are strictly equal, our job is easy.\n if (a === b) {\n return true;\n }\n // Object.prototype.toString returns a representation of the runtime type of\n // the given value that is considerably more precise than typeof.\n const aTag = toString.call(a);\n const bTag = toString.call(b);\n // If the runtime types of a and b are different, they could maybe be equal\n // under some interpretation of equality, but for simplicity and performance\n // we just return false instead.\n if (aTag !== bTag) {\n return false;\n }\n switch (aTag) {\n case '[object Array]':\n // Arrays are a lot like other objects, but we can cheaply compare their\n // lengths as a short-cut before comparing their elements.\n if (a.length !== b.length)\n return false;\n // Fall through to object case...\n case '[object Object]': {\n if (previouslyCompared(a, b))\n return true;\n const aKeys = definedKeys(a);\n const bKeys = definedKeys(b);\n // If `a` and `b` have a different number of enumerable keys, they\n // must be different.\n const keyCount = aKeys.length;\n if (keyCount !== bKeys.length)\n return false;\n // Now make sure they have the same keys.\n for (let k = 0; k < keyCount; ++k) {\n if (!hasOwnProperty.call(b, aKeys[k])) {\n return false;\n }\n }\n // Finally, check deep equality of all child properties.\n for (let k = 0; k < keyCount; ++k) {\n const key = aKeys[k];\n if (!check(a[key], b[key])) {\n return false;\n }\n }\n return true;\n }\n case '[object Error]':\n return a.name === b.name && a.message === b.message;\n case '[object Number]':\n // Handle NaN, which is !== itself.\n if (a !== a)\n return b !== b;\n // Fall through to shared +a === +b case...\n case '[object Boolean]':\n case '[object Date]':\n return +a === +b;\n case '[object RegExp]':\n case '[object String]':\n return a == `${b}`;\n case '[object Map]':\n case '[object Set]': {\n if (a.size !== b.size)\n return false;\n if (previouslyCompared(a, b))\n return true;\n const aIterator = a.entries();\n const isMap = aTag === '[object Map]';\n while (true) {\n const info = aIterator.next();\n if (info.done)\n break;\n // If a instanceof Set, aValue === aKey.\n const [aKey, aValue] = info.value;\n // So this works the same way for both Set and Map.\n if (!b.has(aKey)) {\n return false;\n }\n // However, we care about deep equality of values only when dealing\n // with Map structures.\n if (isMap && !check(aValue, b.get(aKey))) {\n return false;\n }\n }\n return true;\n }\n case '[object Uint16Array]':\n case '[object Uint8Array]': // Buffer, in Node.js.\n case '[object Uint32Array]':\n case '[object Int32Array]':\n case '[object Int8Array]':\n case '[object Int16Array]':\n case '[object ArrayBuffer]':\n // DataView doesn't need these conversions, but the equality check is\n // otherwise the same.\n a = new Uint8Array(a);\n b = new Uint8Array(b);\n // Fall through...\n case '[object DataView]': {\n let len = a.byteLength;\n if (len === b.byteLength) {\n while (len-- && a[len] === b[len]) {\n // Keep looping as long as the bytes are equal.\n }\n }\n return len === -1;\n }\n case '[object AsyncFunction]':\n case '[object GeneratorFunction]':\n case '[object AsyncGeneratorFunction]':\n case '[object Function]': {\n const aCode = fnToStr.call(a);\n if (aCode !== fnToStr.call(b)) {\n return false;\n }\n // We consider non-native functions equal if they have the same code\n // (native functions require === because their code is censored).\n // Note that this behavior is not entirely sound, since !== function\n // objects with the same code can behave differently depending on\n // their closure scope. However, any function can behave differently\n // depending on the values of its input arguments (including this)\n // and its calling context (including its closure scope), even\n // though the function object is === to itself; and it is entirely\n // possible for functions that are not === to behave exactly the\n // same under all conceivable circumstances. Because none of these\n // factors are statically decidable in JavaScript, JS function\n // equality is not well-defined. This ambiguity allows us to\n // consider the best possible heuristic among various imperfect\n // options, and equating non-native functions that have the same\n // code has enormous practical benefits, such as when comparing\n // functions that are repeatedly passed as fresh function\n // expressions within objects that are otherwise deeply equal. Since\n // any function created from the same syntactic expression (in the\n // same code location) will always stringify to the same code\n // according to fnToStr.call, we can reasonably expect these\n // repeatedly passed function expressions to have the same code, and\n // thus behave \"the same\" (with all the caveats mentioned above),\n // even though the runtime function objects are !== to one another.\n return !endsWith(aCode, nativeCodeSuffix);\n }\n }\n // Otherwise the values are not equal.\n return false;\n}\nfunction definedKeys(obj) {\n // Remember that the second argument to Array.prototype.filter will be\n // used as `this` within the callback function.\n return Object.keys(obj).filter(isDefinedKey, obj);\n}\nfunction isDefinedKey(key) {\n return this[key] !== void 0;\n}\nconst nativeCodeSuffix = \"{ [native code] }\";\nfunction endsWith(full, suffix) {\n const fromIndex = full.length - suffix.length;\n return fromIndex >= 0 &&\n full.indexOf(suffix, fromIndex) === fromIndex;\n}\nfunction previouslyCompared(a, b) {\n // Though cyclic references can make an object graph appear infinite from the\n // perspective of a depth-first traversal, the graph still contains a finite\n // number of distinct object references. We use the previousComparisons cache\n // to avoid comparing the same pair of object references more than once, which\n // guarantees termination (even if we end up comparing every object in one\n // graph to every object in the other graph, which is extremely unlikely),\n // while still allowing weird isomorphic structures (like rings with different\n // lengths) a chance to pass the equality test.\n let bSet = previousComparisons.get(a);\n if (bSet) {\n // Return true here because we can be sure false will be returned somewhere\n // else if the objects are not equivalent.\n if (bSet.has(b))\n return true;\n }\n else {\n previousComparisons.set(a, bSet = new Set);\n }\n bSet.add(b);\n return false;\n}\n//# sourceMappingURL=index.js.map","function noop() { }\nconst defaultDispose = noop;\nconst _WeakRef = typeof WeakRef !== \"undefined\"\n ? WeakRef\n : function (value) {\n return { deref: () => value };\n };\nconst _WeakMap = typeof WeakMap !== \"undefined\" ? WeakMap : Map;\nconst _FinalizationRegistry = typeof FinalizationRegistry !== \"undefined\"\n ? FinalizationRegistry\n : function () {\n return {\n register: noop,\n unregister: noop,\n };\n };\nconst finalizationBatchSize = 10024;\nexport class WeakCache {\n constructor(max = Infinity, dispose = defaultDispose) {\n this.max = max;\n this.dispose = dispose;\n this.map = new _WeakMap();\n this.newest = null;\n this.oldest = null;\n this.unfinalizedNodes = new Set();\n this.finalizationScheduled = false;\n this.size = 0;\n this.finalize = () => {\n const iterator = this.unfinalizedNodes.values();\n for (let i = 0; i < finalizationBatchSize; i++) {\n const node = iterator.next().value;\n if (!node)\n break;\n this.unfinalizedNodes.delete(node);\n const key = node.key;\n delete node.key;\n node.keyRef = new _WeakRef(key);\n this.registry.register(key, node, node);\n }\n if (this.unfinalizedNodes.size > 0) {\n queueMicrotask(this.finalize);\n }\n else {\n this.finalizationScheduled = false;\n }\n };\n this.registry = new _FinalizationRegistry(this.deleteNode.bind(this));\n }\n has(key) {\n return this.map.has(key);\n }\n get(key) {\n const node = this.getNode(key);\n return node && node.value;\n }\n getNode(key) {\n const node = this.map.get(key);\n if (node && node !== this.newest) {\n const { older, newer } = node;\n if (newer) {\n newer.older = older;\n }\n if (older) {\n older.newer = newer;\n }\n node.older = this.newest;\n node.older.newer = node;\n node.newer = null;\n this.newest = node;\n if (node === this.oldest) {\n this.oldest = newer;\n }\n }\n return node;\n }\n set(key, value) {\n let node = this.getNode(key);\n if (node) {\n return (node.value = value);\n }\n node = {\n key,\n value,\n newer: null,\n older: this.newest,\n };\n if (this.newest) {\n this.newest.newer = node;\n }\n this.newest = node;\n this.oldest = this.oldest || node;\n this.scheduleFinalization(node);\n this.map.set(key, node);\n this.size++;\n return node.value;\n }\n clean() {\n while (this.oldest && this.size > this.max) {\n this.deleteNode(this.oldest);\n }\n }\n deleteNode(node) {\n if (node === this.newest) {\n this.newest = node.older;\n }\n if (node === this.oldest) {\n this.oldest = node.newer;\n }\n if (node.newer) {\n node.newer.older = node.older;\n }\n if (node.older) {\n node.older.newer = node.newer;\n }\n this.size--;\n const key = node.key || (node.keyRef && node.keyRef.deref());\n this.dispose(node.value, key);\n if (!node.keyRef) {\n this.unfinalizedNodes.delete(node);\n }\n else {\n this.registry.unregister(node);\n }\n if (key)\n this.map.delete(key);\n }\n delete(key) {\n const node = this.map.get(key);\n if (node) {\n this.deleteNode(node);\n return true;\n }\n return false;\n }\n scheduleFinalization(node) {\n this.unfinalizedNodes.add(node);\n if (!this.finalizationScheduled) {\n this.finalizationScheduled = true;\n queueMicrotask(this.finalize);\n }\n }\n}\n//# sourceMappingURL=weak.js.map","// This currentContext variable will only be used if the makeSlotClass\n// function is called, which happens only if this is the first copy of the\n// @wry/context package to be imported.\nlet currentContext = null;\n// This unique internal object is used to denote the absence of a value\n// for a given Slot, and is never exposed to outside code.\nconst MISSING_VALUE = {};\nlet idCounter = 1;\n// Although we can't do anything about the cost of duplicated code from\n// accidentally bundling multiple copies of the @wry/context package, we can\n// avoid creating the Slot class more than once using makeSlotClass.\nconst makeSlotClass = () => class Slot {\n constructor() {\n // If you have a Slot object, you can find out its slot.id, but you cannot\n // guess the slot.id of a Slot you don't have access to, thanks to the\n // randomized suffix.\n this.id = [\n \"slot\",\n idCounter++,\n Date.now(),\n Math.random().toString(36).slice(2),\n ].join(\":\");\n }\n hasValue() {\n for (let context = currentContext; context; context = context.parent) {\n // We use the Slot object iself as a key to its value, which means the\n // value cannot be obtained without a reference to the Slot object.\n if (this.id in context.slots) {\n const value = context.slots[this.id];\n if (value === MISSING_VALUE)\n break;\n if (context !== currentContext) {\n // Cache the value in currentContext.slots so the next lookup will\n // be faster. This caching is safe because the tree of contexts and\n // the values of the slots are logically immutable.\n currentContext.slots[this.id] = value;\n }\n return true;\n }\n }\n if (currentContext) {\n // If a value was not found for this Slot, it's never going to be found\n // no matter how many times we look it up, so we might as well cache\n // the absence of the value, too.\n currentContext.slots[this.id] = MISSING_VALUE;\n }\n return false;\n }\n getValue() {\n if (this.hasValue()) {\n return currentContext.slots[this.id];\n }\n }\n withValue(value, callback, \n // Given the prevalence of arrow functions, specifying arguments is likely\n // to be much more common than specifying `this`, hence this ordering:\n args, thisArg) {\n const slots = {\n __proto__: null,\n [this.id]: value,\n };\n const parent = currentContext;\n currentContext = { parent, slots };\n try {\n // Function.prototype.apply allows the arguments array argument to be\n // omitted or undefined, so args! is fine here.\n return callback.apply(thisArg, args);\n }\n finally {\n currentContext = parent;\n }\n }\n // Capture the current context and wrap a callback function so that it\n // reestablishes the captured context when called.\n static bind(callback) {\n const context = currentContext;\n return function () {\n const saved = currentContext;\n try {\n currentContext = context;\n return callback.apply(this, arguments);\n }\n finally {\n currentContext = saved;\n }\n };\n }\n // Immediately run a callback function without any captured context.\n static noContext(callback, \n // Given the prevalence of arrow functions, specifying arguments is likely\n // to be much more common than specifying `this`, hence this ordering:\n args, thisArg) {\n if (currentContext) {\n const saved = currentContext;\n try {\n currentContext = null;\n // Function.prototype.apply allows the arguments array argument to be\n // omitted or undefined, so args! is fine here.\n return callback.apply(thisArg, args);\n }\n finally {\n currentContext = saved;\n }\n }\n else {\n return callback.apply(thisArg, args);\n }\n }\n};\nfunction maybe(fn) {\n try {\n return fn();\n }\n catch (ignored) { }\n}\n// We store a single global implementation of the Slot class as a permanent\n// non-enumerable property of the globalThis object. This obfuscation does\n// nothing to prevent access to the Slot class, but at least it ensures the\n// implementation (i.e. currentContext) cannot be tampered with, and all copies\n// of the @wry/context package (hopefully just one) will share the same Slot\n// implementation. Since the first copy of the @wry/context package to be\n// imported wins, this technique imposes a steep cost for any future breaking\n// changes to the Slot class.\nconst globalKey = \"@wry/context:Slot\";\nconst host = \n// Prefer globalThis when available.\n// https://github.com/benjamn/wryware/issues/347\nmaybe(() => globalThis) ||\n // Fall back to global, which works in Node.js and may be converted by some\n // bundlers to the appropriate identifier (window, self, ...) depending on the\n // bundling target. https://github.com/endojs/endo/issues/576#issuecomment-1178515224\n maybe(() => global) ||\n // Otherwise, use a dummy host that's local to this module. We used to fall\n // back to using the Array constructor as a namespace, but that was flagged in\n // https://github.com/benjamn/wryware/issues/347, and can be avoided.\n Object.create(null);\n// Whichever globalHost we're using, make TypeScript happy about the additional\n// globalKey property.\nconst globalHost = host;\nexport const Slot = globalHost[globalKey] ||\n // Earlier versions of this package stored the globalKey property on the Array\n // constructor, so we check there as well, to prevent Slot class duplication.\n Array[globalKey] ||\n (function (Slot) {\n try {\n Object.defineProperty(globalHost, globalKey, {\n value: Slot,\n enumerable: false,\n writable: false,\n // When it was possible for globalHost to be the Array constructor (a\n // legacy Slot dedup strategy), it was important for the property to be\n // configurable:true so it could be deleted. That does not seem to be as\n // important when globalHost is the global object, but I don't want to\n // cause similar problems again, and configurable:true seems safest.\n // https://github.com/endojs/endo/issues/576#issuecomment-1178274008\n configurable: true\n });\n }\n finally {\n return Slot;\n }\n })(makeSlotClass());\n//# sourceMappingURL=slot.js.map","// A [trie](https://en.wikipedia.org/wiki/Trie) data structure that holds\n// object keys weakly, yet can also hold non-object keys, unlike the\n// native `WeakMap`.\n// If no makeData function is supplied, the looked-up data will be an empty,\n// null-prototype Object.\nconst defaultMakeData = () => Object.create(null);\n// Useful for processing arguments objects as well as arrays.\nconst { forEach, slice } = Array.prototype;\nconst { hasOwnProperty } = Object.prototype;\nexport class Trie {\n constructor(weakness = true, makeData = defaultMakeData) {\n this.weakness = weakness;\n this.makeData = makeData;\n }\n lookup() {\n return this.lookupArray(arguments);\n }\n lookupArray(array) {\n let node = this;\n forEach.call(array, key => node = node.getChildTrie(key));\n return hasOwnProperty.call(node, \"data\")\n ? node.data\n : node.data = this.makeData(slice.call(array));\n }\n peek() {\n return this.peekArray(arguments);\n }\n peekArray(array) {\n let node = this;\n for (let i = 0, len = array.length; node && i < len; ++i) {\n const map = node.mapFor(array[i], false);\n node = map && map.get(array[i]);\n }\n return node && node.data;\n }\n remove() {\n return this.removeArray(arguments);\n }\n removeArray(array) {\n let data;\n if (array.length) {\n const head = array[0];\n const map = this.mapFor(head, false);\n const child = map && map.get(head);\n if (child) {\n data = child.removeArray(slice.call(array, 1));\n if (!child.data && !child.weak && !(child.strong && child.strong.size)) {\n map.delete(head);\n }\n }\n }\n else {\n data = this.data;\n delete this.data;\n }\n return data;\n }\n getChildTrie(key) {\n const map = this.mapFor(key, true);\n let child = map.get(key);\n if (!child)\n map.set(key, child = new Trie(this.weakness, this.makeData));\n return child;\n }\n mapFor(key, create) {\n return this.weakness && isObjRef(key)\n ? this.weak || (create ? this.weak = new WeakMap : void 0)\n : this.strong || (create ? this.strong = new Map : void 0);\n }\n}\nfunction isObjRef(value) {\n switch (typeof value) {\n case \"object\":\n if (value === null)\n break;\n // Fall through to return true...\n case \"function\":\n return true;\n }\n return false;\n}\n//# sourceMappingURL=index.js.map","function defaultDispose() { }\nexport class StrongCache {\n constructor(max = Infinity, dispose = defaultDispose) {\n this.max = max;\n this.dispose = dispose;\n this.map = new Map();\n this.newest = null;\n this.oldest = null;\n }\n has(key) {\n return this.map.has(key);\n }\n get(key) {\n const node = this.getNode(key);\n return node && node.value;\n }\n get size() {\n return this.map.size;\n }\n getNode(key) {\n const node = this.map.get(key);\n if (node && node !== this.newest) {\n const { older, newer } = node;\n if (newer) {\n newer.older = older;\n }\n if (older) {\n older.newer = newer;\n }\n node.older = this.newest;\n node.older.newer = node;\n node.newer = null;\n this.newest = node;\n if (node === this.oldest) {\n this.oldest = newer;\n }\n }\n return node;\n }\n set(key, value) {\n let node = this.getNode(key);\n if (node) {\n return node.value = value;\n }\n node = {\n key,\n value,\n newer: null,\n older: this.newest\n };\n if (this.newest) {\n this.newest.newer = node;\n }\n this.newest = node;\n this.oldest = this.oldest || node;\n this.map.set(key, node);\n return node.value;\n }\n clean() {\n while (this.oldest && this.map.size > this.max) {\n this.delete(this.oldest.key);\n }\n }\n delete(key) {\n const node = this.map.get(key);\n if (node) {\n if (node === this.newest) {\n this.newest = node.older;\n }\n if (node === this.oldest) {\n this.oldest = node.newer;\n }\n if (node.newer) {\n node.newer.older = node.older;\n }\n if (node.older) {\n node.older.newer = node.newer;\n }\n this.map.delete(key);\n this.dispose(node.value, key);\n return true;\n }\n return false;\n }\n}\n//# sourceMappingURL=strong.js.map"],"sourceRoot":""}