@boredland/node-ts-cache 2.0.2 → 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +42 -42
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["debug","_debug","storage: Storage","meta: CachedItem<typeof content>[\"meta\"]","DEFAULT_COMPARATOR","reverseComparator","forEach","k","comparators","forEach","DEFAULT_COMPARATOR","reverseComparator","FibonacciHeap","MaxFibonacciHeap","forEach","typed","forEach","iterables","compare","Heap","MaxHeap","k","SuffixArray","GeneralizedSuffixArray","Iterator","Iterator","forEach","iterables","typed","Vector","k","forEach","typed","iterables","LRUCache","forEach","typed","iterables","LRUMap","LRUMapWithDelete","FibonacciHeap","Heap","SuffixArray","Vector","LRUMapWithDelete","EventEmitter","#queue","EventEmitter","#carryoverIntervalCount","#isIntervalIgnored","#intervalCap","#interval","#queue","#queueClass","#isPaused","#setupRateLimitTracking","#doesIntervalAllowAnother","#intervalCount","#doesConcurrentAllowAnother","#pending","#concurrency","#tryToStartAnother","#onInterval","#initializeIntervalIfNeeded","#timeoutId","#isIntervalPaused","#intervalId","#intervalEnd","#lastExecutionTime","#createIntervalTimeout","#onResumeInterval","#clearIntervalTimer","#clearTimeoutTimer","#scheduleRateLimitUpdate","#processQueue","#throwOnAbort","#idAssigner","#runningTasks","#next","#updateRateLimitState","#onEvent","#rateLimitFlushScheduled","#rateLimitedInInterval","typeGuess_1","k","sort","hasher","hash","revalidationQueues: Record<string, PQueue>","hash","prefix"],"sources":["../src/debug.ts","../src/cacheContainer.ts","../src/fallbackStorage.ts","../node_modules/mnemonist/utils/comparators.js","../node_modules/obliterator/support.js","../node_modules/obliterator/foreach.js","../node_modules/mnemonist/fibonacci-heap.js","../node_modules/mnemonist/utils/typed-arrays.js","../node_modules/mnemonist/utils/iterables.js","../node_modules/mnemonist/heap.js","../node_modules/mnemonist/suffix-array.js","../node_modules/obliterator/iterator.js","../node_modules/mnemonist/vector.js","../node_modules/mnemonist/lru-cache.js","../node_modules/mnemonist/lru-map.js","../node_modules/mnemonist/lru-map-with-delete.js","../node_modules/mnemonist/index.mjs","../src/lruStorage.ts","../node_modules/eventemitter3/index.js","../node_modules/eventemitter3/index.mjs","../node_modules/p-timeout/index.js","../node_modules/p-queue/dist/lower-bound.js","../node_modules/p-queue/dist/priority-queue.js","../node_modules/p-queue/dist/index.js","../node_modules/node-object-hash/dist/typeGuess.js","../node_modules/node-object-hash/dist/stringifiers.js","../node_modules/node-object-hash/dist/objectSorter.js","../node_modules/node-object-hash/dist/hasher.js","../src/hash.ts","../src/withCache.ts"],"sourcesContent":["import { debug as _debug } from \"node:util\";\n\nexport const debug = _debug(\"node-ts-cache\");\n","import { debug } from \"./debug.ts\";\nimport type { Storage } from \"./storage.ts\";\n\nexport type CachedItem<T = unknown> = {\n\tcontent: T;\n\tmeta: {\n\t\tcreatedAt: number;\n\t\tttl: number | null;\n\t\tstaleTtl?: number | null;\n\t};\n};\n\nexport type CachingOptions = {\n\t/** Number of milliseconds to expire the cached item - defaults to forever */\n\tttl: number | null;\n\t/** Number of milliseconds to mark the cached item stale - defaults to the ttl */\n\tstaleTtl: number | null;\n\t/** (Default: JSON.stringify combination of className, methodName and call args) */\n\tcalculateKey: (data: {\n\t\t/** The class name for the method being decorated */\n\t\tclassName: string;\n\t\t/** The method name being decorated */\n\t\tmethodName: string;\n\t\t/** The arguments passed to the method when called */\n\t\targs: unknown[];\n\t}) => string;\n};\n\nexport class CacheContainer {\n\tconstructor(private storage: Storage) {}\n\n\tpublic async getItem<T>(key: string): Promise<\n\t\t| {\n\t\t\t\tcontent: T;\n\t\t\t\tmeta: { expired: boolean; stale: boolean; createdAt: number };\n\t\t }\n\t\t| undefined\n\t> {\n\t\tconst item = await this.storage.getItem(key);\n\n\t\tif (!item) return;\n\n\t\tconst result = {\n\t\t\tcontent: item.content as T,\n\t\t\tmeta: {\n\t\t\t\tcreatedAt: item.meta.createdAt,\n\t\t\t\texpired: this.isItemExpired(item),\n\t\t\t\tstale: this.isStaleItem(item),\n\t\t\t},\n\t\t};\n\n\t\tif (result.meta.expired && !result.meta.stale) {\n\t\t\tawait this.unsetKey(key);\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn result;\n\t}\n\n\tpublic async setItem(\n\t\tkey: string,\n\t\tcontent: unknown,\n\t\toptions?: Partial<CachingOptions>,\n\t): Promise<void> {\n\t\tconst finalOptions = {\n\t\t\tttl: null,\n\t\t\tstaleTtl: null,\n\t\t\t...options,\n\t\t};\n\n\t\tconst meta: CachedItem<typeof content>[\"meta\"] = {\n\t\t\tcreatedAt: Date.now(),\n\t\t\tttl: finalOptions.ttl,\n\t\t\tstaleTtl: finalOptions.staleTtl,\n\t\t};\n\n\t\tawait this.storage.setItem(key, { meta, content });\n\t}\n\n\tpublic async clear(): Promise<void> {\n\t\tawait this.storage.clear();\n\n\t\tdebug(\"Cleared cache\");\n\t}\n\n\tprivate isItemExpired(item: CachedItem): boolean {\n\t\tif (item.meta.ttl === null) return false;\n\t\treturn Date.now() > item.meta.createdAt + item.meta.ttl;\n\t}\n\n\tprivate isStaleItem(item: CachedItem): boolean {\n\t\tconst staleTtl = item.meta.staleTtl ?? item.meta.ttl;\n\t\tif (staleTtl === null) return false;\n\t\treturn Date.now() > item.meta.createdAt + staleTtl;\n\t}\n\n\tpublic async unsetKey(key: string): Promise<void> {\n\t\tawait this.storage.removeItem(key);\n\t}\n}\n","import type { CachedItem } from \"./cacheContainer.ts\";\nimport type { Storage } from \"./storage.ts\";\n\n/**\n * Fallback Cache Provider that tries multiple storages in order.\n *\n * On getItem, it tries each storage in order until it finds a hit.\n * If a hit is found in a lower-priority storage, it writes it back to all higher-priority storages.\n * **It only guarantees writing to the highest priority storage on setItem.**\n */\nexport class FallbackStorage implements Storage {\n\tprivate storages: [Storage, ...Storage[]];\n\n\tconstructor(storages: [Storage, ...Storage[]]) {\n\t\tthis.storages = storages;\n\t}\n\n\tasync clear(): Promise<void> {\n\t\tawait Promise.all([...this.storages.map((storage) => storage.clear())]);\n\t}\n\n\tasync getItem(key: string): Promise<CachedItem | undefined> {\n\t\tfor (let i = 0; i < this.storages.length; i++) {\n\t\t\tconst storage = this.storages[i];\n\t\t\tconst item = await storage?.getItem(key);\n\t\t\tif (item !== undefined) {\n\t\t\t\tif (i !== 0) {\n\t\t\t\t\t// Only set in higher priority storages (indices 0 to i-1)\n\t\t\t\t\tawait Promise.all(\n\t\t\t\t\t\tthis.storages\n\t\t\t\t\t\t\t.slice(0, i)\n\t\t\t\t\t\t\t.map((storage) => storage.setItem(key, item)),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn item;\n\t\t\t}\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tasync setItem(key: string, content: CachedItem): Promise<void> {\n\t\tconst [primaryStorage, ...moreStorages] = this.storages;\n\t\tawait primaryStorage.setItem(key, content);\n\t\tvoid Promise.all(\n\t\t\tmoreStorages.map((storage) => storage.setItem(key, content)),\n\t\t);\n\t}\n\n\tasync removeItem(key: string): Promise<void> {\n\t\tawait Promise.all(this.storages.map((storage) => storage.removeItem(key)));\n\t}\n}\n","/**\n * Mnemonist Heap Comparators\n * ===========================\n *\n * Default comparators & functions dealing with comparators reversing etc.\n */\nvar DEFAULT_COMPARATOR = function(a, b) {\n if (a < b)\n return -1;\n if (a > b)\n return 1;\n\n return 0;\n};\n\nvar DEFAULT_REVERSE_COMPARATOR = function(a, b) {\n if (a < b)\n return 1;\n if (a > b)\n return -1;\n\n return 0;\n};\n\n/**\n * Function used to reverse a comparator.\n */\nfunction reverseComparator(comparator) {\n return function(a, b) {\n return comparator(b, a);\n };\n}\n\n/**\n * Function returning a tuple comparator.\n */\nfunction createTupleComparator(size) {\n if (size === 2) {\n return function(a, b) {\n if (a[0] < b[0])\n return -1;\n\n if (a[0] > b[0])\n return 1;\n\n if (a[1] < b[1])\n return -1;\n\n if (a[1] > b[1])\n return 1;\n\n return 0;\n };\n }\n\n return function(a, b) {\n var i = 0;\n\n while (i < size) {\n if (a[i] < b[i])\n return -1;\n\n if (a[i] > b[i])\n return 1;\n\n i++;\n }\n\n return 0;\n };\n}\n\n/**\n * Exporting.\n */\nexports.DEFAULT_COMPARATOR = DEFAULT_COMPARATOR;\nexports.DEFAULT_REVERSE_COMPARATOR = DEFAULT_REVERSE_COMPARATOR;\nexports.reverseComparator = reverseComparator;\nexports.createTupleComparator = createTupleComparator;\n","exports.ARRAY_BUFFER_SUPPORT = typeof ArrayBuffer !== 'undefined';\nexports.SYMBOL_SUPPORT = typeof Symbol !== 'undefined';\n","/**\n * Obliterator ForEach Function\n * =============================\n *\n * Helper function used to easily iterate over mixed values.\n */\nvar support = require('./support.js');\n\nvar ARRAY_BUFFER_SUPPORT = support.ARRAY_BUFFER_SUPPORT;\nvar SYMBOL_SUPPORT = support.SYMBOL_SUPPORT;\n\n/**\n * Function able to iterate over almost any iterable JS value.\n *\n * @param {any} iterable - Iterable value.\n * @param {function} callback - Callback function.\n */\nmodule.exports = function forEach(iterable, callback) {\n var iterator, k, i, l, s;\n\n if (!iterable) throw new Error('obliterator/forEach: invalid iterable.');\n\n if (typeof callback !== 'function')\n throw new Error('obliterator/forEach: expecting a callback.');\n\n // The target is an array or a string or function arguments\n if (\n Array.isArray(iterable) ||\n (ARRAY_BUFFER_SUPPORT && ArrayBuffer.isView(iterable)) ||\n typeof iterable === 'string' ||\n iterable.toString() === '[object Arguments]'\n ) {\n for (i = 0, l = iterable.length; i < l; i++) callback(iterable[i], i);\n return;\n }\n\n // The target has a #.forEach method\n if (typeof iterable.forEach === 'function') {\n iterable.forEach(callback);\n return;\n }\n\n // The target is iterable\n if (\n SYMBOL_SUPPORT &&\n Symbol.iterator in iterable &&\n typeof iterable.next !== 'function'\n ) {\n iterable = iterable[Symbol.iterator]();\n }\n\n // The target is an iterator\n if (typeof iterable.next === 'function') {\n iterator = iterable;\n i = 0;\n\n while (((s = iterator.next()), s.done !== true)) {\n callback(s.value, i);\n i++;\n }\n\n return;\n }\n\n // The target is a plain object\n for (k in iterable) {\n if (iterable.hasOwnProperty(k)) {\n callback(iterable[k], k);\n }\n }\n\n return;\n};\n","/* eslint no-constant-condition: 0 */\n/**\n * Mnemonist Fibonacci Heap\n * =========================\n *\n * Fibonacci heap implementation.\n */\nvar comparators = require('./utils/comparators.js'),\n forEach = require('obliterator/foreach');\n\nvar DEFAULT_COMPARATOR = comparators.DEFAULT_COMPARATOR,\n reverseComparator = comparators.reverseComparator;\n\n/**\n * Fibonacci Heap.\n *\n * @constructor\n */\nfunction FibonacciHeap(comparator) {\n this.clear();\n this.comparator = comparator || DEFAULT_COMPARATOR;\n\n if (typeof this.comparator !== 'function')\n throw new Error('mnemonist/FibonacciHeap.constructor: given comparator should be a function.');\n}\n\n/**\n * Method used to clear the heap.\n *\n * @return {undefined}\n */\nFibonacciHeap.prototype.clear = function() {\n\n // Properties\n this.root = null;\n this.min = null;\n this.size = 0;\n};\n\n/**\n * Function used to create a node.\n *\n * @param {any} item - Target item.\n * @return {object}\n */\nfunction createNode(item) {\n return {\n item: item,\n degree: 0\n };\n}\n\n/**\n * Function used to merge the given node with the root list.\n *\n * @param {FibonacciHeap} heap - Target heap.\n * @param {Node} node - Target node.\n */\nfunction mergeWithRoot(heap, node) {\n if (!heap.root) {\n heap.root = node;\n }\n else {\n node.right = heap.root.right;\n node.left = heap.root;\n heap.root.right.left = node;\n heap.root.right = node;\n }\n}\n\n/**\n * Method used to push an item into the heap.\n *\n * @param {any} item - Item to push.\n * @return {number}\n */\nFibonacciHeap.prototype.push = function(item) {\n var node = createNode(item);\n node.left = node;\n node.right = node;\n mergeWithRoot(this, node);\n\n if (!this.min || this.comparator(node.item, this.min.item) <= 0)\n this.min = node;\n\n return ++this.size;\n};\n\n/**\n * Method used to get the \"first\" item of the heap.\n *\n * @return {any}\n */\nFibonacciHeap.prototype.peek = function() {\n return this.min ? this.min.item : undefined;\n};\n\n/**\n * Function used to consume the given linked list.\n *\n * @param {Node} head - Head node.\n * @param {array}\n */\nfunction consumeLinkedList(head) {\n var nodes = [],\n node = head,\n flag = false;\n\n while (true) {\n if (node === head && flag)\n break;\n else if (node === head)\n flag = true;\n\n nodes.push(node);\n node = node.right;\n }\n\n return nodes;\n}\n\n/**\n * Function used to remove the target node from the root list.\n *\n * @param {FibonacciHeap} heap - Target heap.\n * @param {Node} node - Target node.\n */\nfunction removeFromRoot(heap, node) {\n if (heap.root === node)\n heap.root = node.right;\n node.left.right = node.right;\n node.right.left = node.left;\n}\n\n/**\n * Function used to merge the given node with the child list of a root node.\n *\n * @param {Node} parent - Parent node.\n * @param {Node} node - Target node.\n */\nfunction mergeWithChild(parent, node) {\n if (!parent.child) {\n parent.child = node;\n }\n else {\n node.right = parent.child.right;\n node.left = parent.child;\n parent.child.right.left = node;\n parent.child.right = node;\n }\n}\n\n/**\n * Function used to link one node to another in the root list.\n *\n * @param {FibonacciHeap} heap - Target heap.\n * @param {Node} y - Y node.\n * @param {Node} x - X node.\n */\nfunction link(heap, y, x) {\n removeFromRoot(heap, y);\n y.left = y;\n y.right = y;\n mergeWithChild(x, y);\n x.degree++;\n y.parent = x;\n}\n\n/**\n * Function used to consolidate the heap.\n *\n * @param {FibonacciHeap} heap - Target heap.\n */\nfunction consolidate(heap) {\n var A = new Array(heap.size),\n nodes = consumeLinkedList(heap.root),\n i, l, x, y, d, t;\n\n for (i = 0, l = nodes.length; i < l; i++) {\n x = nodes[i];\n d = x.degree;\n\n while (A[d]) {\n y = A[d];\n\n if (heap.comparator(x.item, y.item) > 0) {\n t = x;\n x = y;\n y = t;\n }\n\n link(heap, y, x);\n A[d] = null;\n d++;\n }\n\n A[d] = x;\n }\n\n for (i = 0; i < heap.size; i++) {\n if (A[i] && heap.comparator(A[i].item, heap.min.item) <= 0)\n heap.min = A[i];\n }\n}\n\n/**\n * Method used to retrieve & remove the \"first\" item of the heap.\n *\n * @return {any}\n */\nFibonacciHeap.prototype.pop = function() {\n if (!this.size)\n return undefined;\n\n var z = this.min;\n\n if (z.child) {\n var nodes = consumeLinkedList(z.child),\n node,\n i,\n l;\n\n for (i = 0, l = nodes.length; i < l; i++) {\n node = nodes[i];\n\n mergeWithRoot(this, node);\n delete node.parent;\n }\n }\n\n removeFromRoot(this, z);\n\n if (z === z.right) {\n this.min = null;\n this.root = null;\n }\n else {\n this.min = z.right;\n consolidate(this);\n }\n\n this.size--;\n\n return z.item;\n};\n\n/**\n * Convenience known methods.\n */\nFibonacciHeap.prototype.inspect = function() {\n var proxy = {\n size: this.size\n };\n\n if (this.min && 'item' in this.min)\n proxy.top = this.min.item;\n\n // Trick so that node displays the name of the constructor\n Object.defineProperty(proxy, 'constructor', {\n value: FibonacciHeap,\n enumerable: false\n });\n\n return proxy;\n};\n\nif (typeof Symbol !== 'undefined')\n FibonacciHeap.prototype[Symbol.for('nodejs.util.inspect.custom')] = FibonacciHeap.prototype.inspect;\n\n/**\n * Fibonacci Maximum Heap.\n *\n * @constructor\n */\nfunction MaxFibonacciHeap(comparator) {\n this.clear();\n this.comparator = comparator || DEFAULT_COMPARATOR;\n\n if (typeof this.comparator !== 'function')\n throw new Error('mnemonist/FibonacciHeap.constructor: given comparator should be a function.');\n\n this.comparator = reverseComparator(this.comparator);\n}\n\nMaxFibonacciHeap.prototype = FibonacciHeap.prototype;\n\n/**\n * Static @.from function taking an arbitrary iterable & converting it into\n * a heap.\n *\n * @param {Iterable} iterable - Target iterable.\n * @param {function} comparator - Custom comparator function.\n * @return {FibonacciHeap}\n */\nFibonacciHeap.from = function(iterable, comparator) {\n var heap = new FibonacciHeap(comparator);\n\n forEach(iterable, function(value) {\n heap.push(value);\n });\n\n return heap;\n};\n\nMaxFibonacciHeap.from = function(iterable, comparator) {\n var heap = new MaxFibonacciHeap(comparator);\n\n forEach(iterable, function(value) {\n heap.push(value);\n });\n\n return heap;\n};\n\n/**\n * Exporting.\n */\nFibonacciHeap.MinFibonacciHeap = FibonacciHeap;\nFibonacciHeap.MaxFibonacciHeap = MaxFibonacciHeap;\n\nmodule.exports = FibonacciHeap;\n","/**\n * Mnemonist Typed Array Helpers\n * ==============================\n *\n * Miscellaneous helpers related to typed arrays.\n */\n\n/**\n * When using an unsigned integer array to store pointers, one might want to\n * choose the optimal word size in regards to the actual numbers of pointers\n * to store.\n *\n * This helpers does just that.\n *\n * @param {number} size - Expected size of the array to map.\n * @return {TypedArray}\n */\nvar MAX_8BIT_INTEGER = Math.pow(2, 8) - 1,\n MAX_16BIT_INTEGER = Math.pow(2, 16) - 1,\n MAX_32BIT_INTEGER = Math.pow(2, 32) - 1;\n\nvar MAX_SIGNED_8BIT_INTEGER = Math.pow(2, 7) - 1,\n MAX_SIGNED_16BIT_INTEGER = Math.pow(2, 15) - 1,\n MAX_SIGNED_32BIT_INTEGER = Math.pow(2, 31) - 1;\n\nexports.getPointerArray = function(size) {\n var maxIndex = size - 1;\n\n if (maxIndex <= MAX_8BIT_INTEGER)\n return Uint8Array;\n\n if (maxIndex <= MAX_16BIT_INTEGER)\n return Uint16Array;\n\n if (maxIndex <= MAX_32BIT_INTEGER)\n return Uint32Array;\n\n throw new Error('mnemonist: Pointer Array of size > 4294967295 is not supported.');\n};\n\nexports.getSignedPointerArray = function(size) {\n var maxIndex = size - 1;\n\n if (maxIndex <= MAX_SIGNED_8BIT_INTEGER)\n return Int8Array;\n\n if (maxIndex <= MAX_SIGNED_16BIT_INTEGER)\n return Int16Array;\n\n if (maxIndex <= MAX_SIGNED_32BIT_INTEGER)\n return Int32Array;\n\n return Float64Array;\n};\n\n/**\n * Function returning the minimal type able to represent the given number.\n *\n * @param {number} value - Value to test.\n * @return {TypedArrayClass}\n */\nexports.getNumberType = function(value) {\n\n // <= 32 bits itnteger?\n if (value === (value | 0)) {\n\n // Negative\n if (Math.sign(value) === -1) {\n if (value <= 127 && value >= -128)\n return Int8Array;\n\n if (value <= 32767 && value >= -32768)\n return Int16Array;\n\n return Int32Array;\n }\n else {\n\n if (value <= 255)\n return Uint8Array;\n\n if (value <= 65535)\n return Uint16Array;\n\n return Uint32Array;\n }\n }\n\n // 53 bits integer & floats\n // NOTE: it's kinda hard to tell whether we could use 32bits or not...\n return Float64Array;\n};\n\n/**\n * Function returning the minimal type able to represent the given array\n * of JavaScript numbers.\n *\n * @param {array} array - Array to represent.\n * @param {function} getter - Optional getter.\n * @return {TypedArrayClass}\n */\nvar TYPE_PRIORITY = {\n Uint8Array: 1,\n Int8Array: 2,\n Uint16Array: 3,\n Int16Array: 4,\n Uint32Array: 5,\n Int32Array: 6,\n Float32Array: 7,\n Float64Array: 8\n};\n\n// TODO: make this a one-shot for one value\nexports.getMinimalRepresentation = function(array, getter) {\n var maxType = null,\n maxPriority = 0,\n p,\n t,\n v,\n i,\n l;\n\n for (i = 0, l = array.length; i < l; i++) {\n v = getter ? getter(array[i]) : array[i];\n t = exports.getNumberType(v);\n p = TYPE_PRIORITY[t.name];\n\n if (p > maxPriority) {\n maxPriority = p;\n maxType = t;\n }\n }\n\n return maxType;\n};\n\n/**\n * Function returning whether the given value is a typed array.\n *\n * @param {any} value - Value to test.\n * @return {boolean}\n */\nexports.isTypedArray = function(value) {\n return typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView(value);\n};\n\n/**\n * Function used to concat byte arrays.\n *\n * @param {...ByteArray}\n * @return {ByteArray}\n */\nexports.concat = function() {\n var length = 0,\n i,\n o,\n l;\n\n for (i = 0, l = arguments.length; i < l; i++)\n length += arguments[i].length;\n\n var array = new (arguments[0].constructor)(length);\n\n for (i = 0, o = 0; i < l; i++) {\n array.set(arguments[i], o);\n o += arguments[i].length;\n }\n\n return array;\n};\n\n/**\n * Function used to initialize a byte array of indices.\n *\n * @param {number} length - Length of target.\n * @return {ByteArray}\n */\nexports.indices = function(length) {\n var PointerArray = exports.getPointerArray(length);\n\n var array = new PointerArray(length);\n\n for (var i = 0; i < length; i++)\n array[i] = i;\n\n return array;\n};\n","/**\n * Mnemonist Iterable Function\n * ============================\n *\n * Harmonized iteration helpers over mixed iterable targets.\n */\nvar forEach = require('obliterator/foreach');\n\nvar typed = require('./typed-arrays.js');\n\n/**\n * Function used to determine whether the given object supports array-like\n * random access.\n *\n * @param {any} target - Target object.\n * @return {boolean}\n */\nfunction isArrayLike(target) {\n return Array.isArray(target) || typed.isTypedArray(target);\n}\n\n/**\n * Function used to guess the length of the structure over which we are going\n * to iterate.\n *\n * @param {any} target - Target object.\n * @return {number|undefined}\n */\nfunction guessLength(target) {\n if (typeof target.length === 'number')\n return target.length;\n\n if (typeof target.size === 'number')\n return target.size;\n\n return;\n}\n\n/**\n * Function used to convert an iterable to an array.\n *\n * @param {any} target - Iteration target.\n * @return {array}\n */\nfunction toArray(target) {\n var l = guessLength(target);\n\n var array = typeof l === 'number' ? new Array(l) : [];\n\n var i = 0;\n\n // TODO: we could optimize when given target is array like\n forEach(target, function(value) {\n array[i++] = value;\n });\n\n return array;\n}\n\n/**\n * Same as above but returns a supplementary indices array.\n *\n * @param {any} target - Iteration target.\n * @return {array}\n */\nfunction toArrayWithIndices(target) {\n var l = guessLength(target);\n\n var IndexArray = typeof l === 'number' ?\n typed.getPointerArray(l) :\n Array;\n\n var array = typeof l === 'number' ? new Array(l) : [];\n var indices = typeof l === 'number' ? new IndexArray(l) : [];\n\n var i = 0;\n\n // TODO: we could optimize when given target is array like\n forEach(target, function(value) {\n array[i] = value;\n indices[i] = i++;\n });\n\n return [array, indices];\n}\n\n/**\n * Exporting.\n */\nexports.isArrayLike = isArrayLike;\nexports.guessLength = guessLength;\nexports.toArray = toArray;\nexports.toArrayWithIndices = toArrayWithIndices;\n","/**\n * Mnemonist Binary Heap\n * ======================\n *\n * Binary heap implementation.\n */\nvar forEach = require('obliterator/foreach'),\n comparators = require('./utils/comparators.js'),\n iterables = require('./utils/iterables.js');\n\nvar DEFAULT_COMPARATOR = comparators.DEFAULT_COMPARATOR,\n reverseComparator = comparators.reverseComparator;\n\n/**\n * Heap helper functions.\n */\n\n/**\n * Function used to sift down.\n *\n * @param {function} compare - Comparison function.\n * @param {array} heap - Array storing the heap's data.\n * @param {number} startIndex - Starting index.\n * @param {number} i - Index.\n */\nfunction siftDown(compare, heap, startIndex, i) {\n var item = heap[i],\n parentIndex,\n parent;\n\n while (i > startIndex) {\n parentIndex = (i - 1) >> 1;\n parent = heap[parentIndex];\n\n if (compare(item, parent) < 0) {\n heap[i] = parent;\n i = parentIndex;\n continue;\n }\n\n break;\n }\n\n heap[i] = item;\n}\n\n/**\n * Function used to sift up.\n *\n * @param {function} compare - Comparison function.\n * @param {array} heap - Array storing the heap's data.\n * @param {number} i - Index.\n */\nfunction siftUp(compare, heap, i) {\n var endIndex = heap.length,\n startIndex = i,\n item = heap[i],\n childIndex = 2 * i + 1,\n rightIndex;\n\n while (childIndex < endIndex) {\n rightIndex = childIndex + 1;\n\n if (\n rightIndex < endIndex &&\n compare(heap[childIndex], heap[rightIndex]) >= 0\n ) {\n childIndex = rightIndex;\n }\n\n heap[i] = heap[childIndex];\n i = childIndex;\n childIndex = 2 * i + 1;\n }\n\n heap[i] = item;\n siftDown(compare, heap, startIndex, i);\n}\n\n/**\n * Function used to push an item into a heap represented by a raw array.\n *\n * @param {function} compare - Comparison function.\n * @param {array} heap - Array storing the heap's data.\n * @param {any} item - Item to push.\n */\nfunction push(compare, heap, item) {\n heap.push(item);\n siftDown(compare, heap, 0, heap.length - 1);\n}\n\n/**\n * Function used to pop an item from a heap represented by a raw array.\n *\n * @param {function} compare - Comparison function.\n * @param {array} heap - Array storing the heap's data.\n * @return {any}\n */\nfunction pop(compare, heap) {\n var lastItem = heap.pop();\n\n if (heap.length !== 0) {\n var item = heap[0];\n heap[0] = lastItem;\n siftUp(compare, heap, 0);\n\n return item;\n }\n\n return lastItem;\n}\n\n/**\n * Function used to pop the heap then push a new value into it, thus \"replacing\"\n * it.\n *\n * @param {function} compare - Comparison function.\n * @param {array} heap - Array storing the heap's data.\n * @param {any} item - The item to push.\n * @return {any}\n */\nfunction replace(compare, heap, item) {\n if (heap.length === 0)\n throw new Error('mnemonist/heap.replace: cannot pop an empty heap.');\n\n var popped = heap[0];\n heap[0] = item;\n siftUp(compare, heap, 0);\n\n return popped;\n}\n\n/**\n * Function used to push an item in the heap then pop the heap and return the\n * popped value.\n *\n * @param {function} compare - Comparison function.\n * @param {array} heap - Array storing the heap's data.\n * @param {any} item - The item to push.\n * @return {any}\n */\nfunction pushpop(compare, heap, item) {\n var tmp;\n\n if (heap.length !== 0 && compare(heap[0], item) < 0) {\n tmp = heap[0];\n heap[0] = item;\n item = tmp;\n siftUp(compare, heap, 0);\n }\n\n return item;\n}\n\n/**\n * Converts and array into an abstract heap in linear time.\n *\n * @param {function} compare - Comparison function.\n * @param {array} array - Target array.\n */\nfunction heapify(compare, array) {\n var n = array.length,\n l = n >> 1,\n i = l;\n\n while (--i >= 0)\n siftUp(compare, array, i);\n}\n\n/**\n * Fully consumes the given heap.\n *\n * @param {function} compare - Comparison function.\n * @param {array} heap - Array storing the heap's data.\n * @return {array}\n */\nfunction consume(compare, heap) {\n var l = heap.length,\n i = 0;\n\n var array = new Array(l);\n\n while (i < l)\n array[i++] = pop(compare, heap);\n\n return array;\n}\n\n/**\n * Function used to retrieve the n smallest items from the given iterable.\n *\n * @param {function} compare - Comparison function.\n * @param {number} n - Number of top items to retrieve.\n * @param {any} iterable - Arbitrary iterable.\n * @param {array}\n */\nfunction nsmallest(compare, n, iterable) {\n if (arguments.length === 2) {\n iterable = n;\n n = compare;\n compare = DEFAULT_COMPARATOR;\n }\n\n var reverseCompare = reverseComparator(compare);\n\n var i, l, v;\n\n var min = Infinity;\n\n var result;\n\n // If n is equal to 1, it's just a matter of finding the minimum\n if (n === 1) {\n if (iterables.isArrayLike(iterable)) {\n for (i = 0, l = iterable.length; i < l; i++) {\n v = iterable[i];\n\n if (min === Infinity || compare(v, min) < 0)\n min = v;\n }\n\n result = new iterable.constructor(1);\n result[0] = min;\n\n return result;\n }\n\n forEach(iterable, function(value) {\n if (min === Infinity || compare(value, min) < 0)\n min = value;\n });\n\n return [min];\n }\n\n if (iterables.isArrayLike(iterable)) {\n\n // If n > iterable length, we just clone and sort\n if (n >= iterable.length)\n return iterable.slice().sort(compare);\n\n result = iterable.slice(0, n);\n heapify(reverseCompare, result);\n\n for (i = n, l = iterable.length; i < l; i++)\n if (reverseCompare(iterable[i], result[0]) > 0)\n replace(reverseCompare, result, iterable[i]);\n\n // NOTE: if n is over some number, it becomes faster to consume the heap\n return result.sort(compare);\n }\n\n // Correct for size\n var size = iterables.guessLength(iterable);\n\n if (size !== null && size < n)\n n = size;\n\n result = new Array(n);\n i = 0;\n\n forEach(iterable, function(value) {\n if (i < n) {\n result[i] = value;\n }\n else {\n if (i === n)\n heapify(reverseCompare, result);\n\n if (reverseCompare(value, result[0]) > 0)\n replace(reverseCompare, result, value);\n }\n\n i++;\n });\n\n if (result.length > i)\n result.length = i;\n\n // NOTE: if n is over some number, it becomes faster to consume the heap\n return result.sort(compare);\n}\n\n/**\n * Function used to retrieve the n largest items from the given iterable.\n *\n * @param {function} compare - Comparison function.\n * @param {number} n - Number of top items to retrieve.\n * @param {any} iterable - Arbitrary iterable.\n * @param {array}\n */\nfunction nlargest(compare, n, iterable) {\n if (arguments.length === 2) {\n iterable = n;\n n = compare;\n compare = DEFAULT_COMPARATOR;\n }\n\n var reverseCompare = reverseComparator(compare);\n\n var i, l, v;\n\n var max = -Infinity;\n\n var result;\n\n // If n is equal to 1, it's just a matter of finding the maximum\n if (n === 1) {\n if (iterables.isArrayLike(iterable)) {\n for (i = 0, l = iterable.length; i < l; i++) {\n v = iterable[i];\n\n if (max === -Infinity || compare(v, max) > 0)\n max = v;\n }\n\n result = new iterable.constructor(1);\n result[0] = max;\n\n return result;\n }\n\n forEach(iterable, function(value) {\n if (max === -Infinity || compare(value, max) > 0)\n max = value;\n });\n\n return [max];\n }\n\n if (iterables.isArrayLike(iterable)) {\n\n // If n > iterable length, we just clone and sort\n if (n >= iterable.length)\n return iterable.slice().sort(reverseCompare);\n\n result = iterable.slice(0, n);\n heapify(compare, result);\n\n for (i = n, l = iterable.length; i < l; i++)\n if (compare(iterable[i], result[0]) > 0)\n replace(compare, result, iterable[i]);\n\n // NOTE: if n is over some number, it becomes faster to consume the heap\n return result.sort(reverseCompare);\n }\n\n // Correct for size\n var size = iterables.guessLength(iterable);\n\n if (size !== null && size < n)\n n = size;\n\n result = new Array(n);\n i = 0;\n\n forEach(iterable, function(value) {\n if (i < n) {\n result[i] = value;\n }\n else {\n if (i === n)\n heapify(compare, result);\n\n if (compare(value, result[0]) > 0)\n replace(compare, result, value);\n }\n\n i++;\n });\n\n if (result.length > i)\n result.length = i;\n\n // NOTE: if n is over some number, it becomes faster to consume the heap\n return result.sort(reverseCompare);\n}\n\n/**\n * Binary Minimum Heap.\n *\n * @constructor\n * @param {function} comparator - Comparator function to use.\n */\nfunction Heap(comparator) {\n this.clear();\n this.comparator = comparator || DEFAULT_COMPARATOR;\n\n if (typeof this.comparator !== 'function')\n throw new Error('mnemonist/Heap.constructor: given comparator should be a function.');\n}\n\n/**\n * Method used to clear the heap.\n *\n * @return {undefined}\n */\nHeap.prototype.clear = function() {\n\n // Properties\n this.items = [];\n this.size = 0;\n};\n\n/**\n * Method used to push an item into the heap.\n *\n * @param {any} item - Item to push.\n * @return {number}\n */\nHeap.prototype.push = function(item) {\n push(this.comparator, this.items, item);\n return ++this.size;\n};\n\n/**\n * Method used to retrieve the \"first\" item of the heap.\n *\n * @return {any}\n */\nHeap.prototype.peek = function() {\n return this.items[0];\n};\n\n/**\n * Method used to retrieve & remove the \"first\" item of the heap.\n *\n * @return {any}\n */\nHeap.prototype.pop = function() {\n if (this.size !== 0)\n this.size--;\n\n return pop(this.comparator, this.items);\n};\n\n/**\n * Method used to pop the heap, then push an item and return the popped\n * item.\n *\n * @param {any} item - Item to push into the heap.\n * @return {any}\n */\nHeap.prototype.replace = function(item) {\n return replace(this.comparator, this.items, item);\n};\n\n/**\n * Method used to push the heap, the pop it and return the pooped item.\n *\n * @param {any} item - Item to push into the heap.\n * @return {any}\n */\nHeap.prototype.pushpop = function(item) {\n return pushpop(this.comparator, this.items, item);\n};\n\n/**\n * Method used to consume the heap fully and return its items as a sorted array.\n *\n * @return {array}\n */\nHeap.prototype.consume = function() {\n this.size = 0;\n return consume(this.comparator, this.items);\n};\n\n/**\n * Method used to convert the heap to an array. Note that it basically clone\n * the heap and consumes it completely. This is hardly performant.\n *\n * @return {array}\n */\nHeap.prototype.toArray = function() {\n return consume(this.comparator, this.items.slice());\n};\n\n/**\n * Convenience known methods.\n */\nHeap.prototype.inspect = function() {\n var proxy = this.toArray();\n\n // Trick so that node displays the name of the constructor\n Object.defineProperty(proxy, 'constructor', {\n value: Heap,\n enumerable: false\n });\n\n return proxy;\n};\n\nif (typeof Symbol !== 'undefined')\n Heap.prototype[Symbol.for('nodejs.util.inspect.custom')] = Heap.prototype.inspect;\n\n/**\n * Binary Maximum Heap.\n *\n * @constructor\n * @param {function} comparator - Comparator function to use.\n */\nfunction MaxHeap(comparator) {\n this.clear();\n this.comparator = comparator || DEFAULT_COMPARATOR;\n\n if (typeof this.comparator !== 'function')\n throw new Error('mnemonist/MaxHeap.constructor: given comparator should be a function.');\n\n this.comparator = reverseComparator(this.comparator);\n}\n\nMaxHeap.prototype = Heap.prototype;\n\n/**\n * Static @.from function taking an arbitrary iterable & converting it into\n * a heap.\n *\n * @param {Iterable} iterable - Target iterable.\n * @param {function} comparator - Custom comparator function.\n * @return {Heap}\n */\nHeap.from = function(iterable, comparator) {\n var heap = new Heap(comparator);\n\n var items;\n\n // If iterable is an array, we can be clever about it\n if (iterables.isArrayLike(iterable))\n items = iterable.slice();\n else\n items = iterables.toArray(iterable);\n\n heapify(heap.comparator, items);\n heap.items = items;\n heap.size = items.length;\n\n return heap;\n};\n\nMaxHeap.from = function(iterable, comparator) {\n var heap = new MaxHeap(comparator);\n\n var items;\n\n // If iterable is an array, we can be clever about it\n if (iterables.isArrayLike(iterable))\n items = iterable.slice();\n else\n items = iterables.toArray(iterable);\n\n heapify(heap.comparator, items);\n heap.items = items;\n heap.size = items.length;\n\n return heap;\n};\n\n/**\n * Exporting.\n */\nHeap.siftUp = siftUp;\nHeap.siftDown = siftDown;\nHeap.push = push;\nHeap.pop = pop;\nHeap.replace = replace;\nHeap.pushpop = pushpop;\nHeap.heapify = heapify;\nHeap.consume = consume;\n\nHeap.nsmallest = nsmallest;\nHeap.nlargest = nlargest;\n\nHeap.MinHeap = Heap;\nHeap.MaxHeap = MaxHeap;\n\nmodule.exports = Heap;\n","/**\n * Mnemonist Suffix Array\n * =======================\n *\n * Linear time implementation of a suffix array using the recursive\n * method by Karkkainen and Sanders.\n *\n * [References]:\n * https://www.cs.helsinki.fi/u/tpkarkka/publications/jacm05-revised.pdf\n * http://people.mpi-inf.mpg.de/~sanders/programs/suffix/\n * http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.184.442&rep=rep1&type=pdf\n *\n * [Article]:\n * \"Simple Linear Work Suffix Array Construction\", Karkkainen and Sanders.\n *\n * [Note]:\n * A paper by Simon J. Puglisi, William F. Smyth & Andrew Turpin named\n * \"The Performance of Linear Time Suffix Sorting Algorithms\" seems to\n * prove that supralinear algorithm are in fact better faring for\n * \"real\" world use cases. It would be nice to check this out in JavaScript\n * because the high level of the language could change a lot to the fact.\n *\n * The current code is largely inspired by the following:\n * https://github.com/tixxit/suffixarray/blob/master/suffixarray.js\n */\n\n/**\n * Constants.\n */\nvar SEPARATOR = '\\u0001';\n\n/**\n * Function used to sort the triples.\n *\n * @param {string|array} string - Padded sequence.\n * @param {array} array - Array to sort (will be mutated).\n * @param {number} offset - Index offset.\n */\nfunction sort(string, array, offset) {\n var l = array.length,\n buckets = [],\n i = l,\n j = -1,\n b,\n d = 0,\n bits;\n\n while (i--)\n j = Math.max(string[array[i] + offset], j);\n\n bits = j >> 24 && 32 || j >> 16 && 24 || j >> 8 && 16 || 8;\n\n for (; d < bits; d += 4) {\n for (i = 16; i--;)\n buckets[i] = [];\n for (i = l; i--;)\n buckets[((string[array[i] + offset]) >> d) & 15].push(array[i]);\n for (b = 0; b < 16; b++) {\n for (j = buckets[b].length; j--;)\n array[++i] = buckets[b][j];\n }\n }\n}\n\n/**\n * Comparison helper.\n */\nfunction compare(string, lookup, m, n) {\n return (\n (string[m] - string[n]) ||\n (m % 3 === 2 ?\n (string[m + 1] - string[n + 1]) || (lookup[m + 2] - lookup[n + 2]) :\n (lookup[m + 1] - lookup[n + 1]))\n );\n}\n\n/**\n * Recursive function used to build the suffix tree in linear time.\n *\n * @param {string|array} string - Padded sequence.\n * @param {number} l - True length of sequence (unpadded).\n * @return {array}\n */\nfunction build(string, l) {\n var a = [],\n b = [],\n al = (2 * l / 3) | 0,\n bl = l - al,\n r = (al + 1) >> 1,\n i = al,\n j = 0,\n k,\n lookup = [],\n result = [];\n\n if (l === 1)\n return [0];\n\n while (i--)\n a[i] = ((i * 3) >> 1) + 1;\n\n for (i = 3; i--;)\n sort(string, a, i);\n\n j = b[((a[0] / 3) | 0) + (a[0] % 3 === 1 ? 0 : r)] = 1;\n\n for (i = 1; i < al; i++) {\n if (string[a[i]] !== string[a[i - 1]] ||\n string[a[i] + 1] !== string[a[i - 1] + 1] ||\n string[a[i] + 2] !== string[a[i - 1] + 2])\n j++;\n\n b[((a[i] / 3) | 0) + (a[i] % 3 === 1 ? 0 : r)] = j;\n }\n\n if (j < al) {\n b = build(b, al);\n\n for (i = al; i--;)\n a[i] = b[i] < r ? b[i] * 3 + 1 : ((b[i] - r) * 3 + 2);\n }\n\n for (i = al; i--;)\n lookup[a[i]] = i;\n lookup[l] = -1;\n lookup[l + 1] = -2;\n\n b = l % 3 === 1 ? [l - 1] : [];\n\n for (i = 0; i < al; i++) {\n if (a[i] % 3 === 1)\n b.push(a[i] - 1);\n }\n\n sort(string, b, 0);\n\n for (i = 0, j = 0, k = 0; i < al && j < bl;)\n result[k++] = (\n compare(string, lookup, a[i], b[j]) < 0 ?\n a[i++] :\n b[j++]\n );\n\n while (i < al)\n result[k++] = a[i++];\n\n while (j < bl)\n result[k++] = b[j++];\n\n return result;\n}\n\n/**\n * Function used to create the array we are going to work on.\n *\n * @param {string|array} target - Target sequence.\n * @return {array}\n */\nfunction convert(target) {\n\n // Creating the alphabet array\n var length = target.length,\n paddingOffset = length % 3,\n array = new Array(length + paddingOffset),\n l,\n i;\n\n // If we have an arbitrary sequence, we need to transform it\n if (typeof target !== 'string') {\n var uniqueTokens = Object.create(null);\n\n for (i = 0; i < length; i++) {\n if (!uniqueTokens[target[i]])\n uniqueTokens[target[i]] = true;\n }\n\n var alphabet = Object.create(null),\n sortedUniqueTokens = Object.keys(uniqueTokens).sort();\n\n for (i = 0, l = sortedUniqueTokens.length; i < l; i++)\n alphabet[sortedUniqueTokens[i]] = i + 1;\n\n for (i = 0; i < length; i++) {\n array[i] = alphabet[target[i]];\n }\n }\n else {\n for (i = 0; i < length; i++)\n array[i] = target.charCodeAt(i);\n }\n\n // Padding the array\n for (i = length; i < length + paddingOffset; i++)\n array[i] = 0;\n\n return array;\n}\n\n/**\n * Suffix Array.\n *\n * @constructor\n * @param {string|array} string - Sequence for which to build the suffix array.\n */\nfunction SuffixArray(string) {\n\n // Properties\n this.hasArbitrarySequence = typeof string !== 'string';\n this.string = string;\n this.length = string.length;\n\n // Building the array\n this.array = build(convert(string), this.length);\n}\n\n/**\n * Convenience known methods.\n */\nSuffixArray.prototype.toString = function() {\n return this.array.join(',');\n};\n\nSuffixArray.prototype.toJSON = function() {\n return this.array;\n};\n\nSuffixArray.prototype.inspect = function() {\n var array = new Array(this.length);\n\n for (var i = 0; i < this.length; i++)\n array[i] = this.string.slice(this.array[i]);\n\n // Trick so that node displays the name of the constructor\n Object.defineProperty(array, 'constructor', {\n value: SuffixArray,\n enumerable: false\n });\n\n return array;\n};\n\nif (typeof Symbol !== 'undefined')\n SuffixArray.prototype[Symbol.for('nodejs.util.inspect.custom')] = SuffixArray.prototype.inspect;\n\n/**\n * Generalized Suffix Array.\n *\n * @constructor\n */\nfunction GeneralizedSuffixArray(strings) {\n\n // Properties\n this.hasArbitrarySequence = typeof strings[0] !== 'string';\n this.size = strings.length;\n\n if (this.hasArbitrarySequence) {\n this.text = [];\n\n for (var i = 0, l = this.size; i < l; i++) {\n this.text.push.apply(this.text, strings[i]);\n\n if (i < l - 1)\n this.text.push(SEPARATOR);\n }\n }\n else {\n this.text = strings.join(SEPARATOR);\n }\n\n this.firstLength = strings[0].length;\n this.length = this.text.length;\n\n // Building the array\n this.array = build(convert(this.text), this.length);\n}\n\n/**\n * Method used to retrieve the longest common subsequence of the generalized\n * suffix array.\n *\n * @return {string|array}\n */\nGeneralizedSuffixArray.prototype.longestCommonSubsequence = function() {\n var lcs = this.hasArbitrarySequence ? [] : '',\n lcp,\n i,\n j,\n s,\n t;\n\n for (i = 1; i < this.length; i++) {\n s = this.array[i];\n t = this.array[i - 1];\n\n if (s < this.firstLength &&\n t < this.firstLength)\n continue;\n\n if (s > this.firstLength &&\n t > this.firstLength)\n continue;\n\n lcp = Math.min(this.length - s, this.length - t);\n\n for (j = 0; j < lcp; j++) {\n if (this.text[s + j] !== this.text[t + j]) {\n lcp = j;\n break;\n }\n }\n\n if (lcp > lcs.length)\n lcs = this.text.slice(s, s + lcp);\n }\n\n return lcs;\n};\n\n/**\n * Convenience known methods.\n */\nGeneralizedSuffixArray.prototype.toString = function() {\n return this.array.join(',');\n};\n\nGeneralizedSuffixArray.prototype.toJSON = function() {\n return this.array;\n};\n\nGeneralizedSuffixArray.prototype.inspect = function() {\n var array = new Array(this.length);\n\n for (var i = 0; i < this.length; i++)\n array[i] = this.text.slice(this.array[i]);\n\n // Trick so that node displays the name of the constructor\n Object.defineProperty(array, 'constructor', {\n value: GeneralizedSuffixArray,\n enumerable: false\n });\n\n return array;\n};\n\nif (typeof Symbol !== 'undefined')\n GeneralizedSuffixArray.prototype[Symbol.for('nodejs.util.inspect.custom')] = GeneralizedSuffixArray.prototype.inspect;\n\n/**\n * Exporting.\n */\nSuffixArray.GeneralizedSuffixArray = GeneralizedSuffixArray;\n\nmodule.exports = SuffixArray;\n","/**\n * Obliterator Iterator Class\n * ===========================\n *\n * Simple class representing the library's iterators.\n */\n\n/**\n * Iterator class.\n *\n * @constructor\n * @param {function} next - Next function.\n */\nfunction Iterator(next) {\n if (typeof next !== 'function')\n throw new Error('obliterator/iterator: expecting a function!');\n\n this.next = next;\n}\n\n/**\n * If symbols are supported, we add `next` to `Symbol.iterator`.\n */\nif (typeof Symbol !== 'undefined')\n Iterator.prototype[Symbol.iterator] = function () {\n return this;\n };\n\n/**\n * Returning an iterator of the given values.\n *\n * @param {any...} values - Values.\n * @return {Iterator}\n */\nIterator.of = function () {\n var args = arguments,\n l = args.length,\n i = 0;\n\n return new Iterator(function () {\n if (i >= l) return {done: true};\n\n return {done: false, value: args[i++]};\n });\n};\n\n/**\n * Returning an empty iterator.\n *\n * @return {Iterator}\n */\nIterator.empty = function () {\n var iterator = new Iterator(function () {\n return {done: true};\n });\n\n return iterator;\n};\n\n/**\n * Returning an iterator over the given indexed sequence.\n *\n * @param {string|Array} sequence - Target sequence.\n * @return {Iterator}\n */\nIterator.fromSequence = function (sequence) {\n var i = 0,\n l = sequence.length;\n\n return new Iterator(function () {\n if (i >= l) return {done: true};\n\n return {done: false, value: sequence[i++]};\n });\n};\n\n/**\n * Returning whether the given value is an iterator.\n *\n * @param {any} value - Value.\n * @return {boolean}\n */\nIterator.is = function (value) {\n if (value instanceof Iterator) return true;\n\n return (\n typeof value === 'object' &&\n value !== null &&\n typeof value.next === 'function'\n );\n};\n\n/**\n * Exporting.\n */\nmodule.exports = Iterator;\n","/**\n * Mnemonist Vector\n * =================\n *\n * Abstract implementation of a growing array that can be used with JavaScript\n * typed arrays and other array-like structures.\n *\n * Note: should try and use ArrayBuffer.transfer when it will be available.\n */\nvar Iterator = require('obliterator/iterator'),\n forEach = require('obliterator/foreach'),\n iterables = require('./utils/iterables.js'),\n typed = require('./utils/typed-arrays.js');\n\n/**\n * Defaults.\n */\nvar DEFAULT_GROWING_POLICY = function(currentCapacity) {\n return Math.max(1, Math.ceil(currentCapacity * 1.5));\n};\n\nvar pointerArrayFactory = function(capacity) {\n var PointerArray = typed.getPointerArray(capacity);\n\n return new PointerArray(capacity);\n};\n\n/**\n * Vector.\n *\n * @constructor\n * @param {function} ArrayClass - An array constructor.\n * @param {number|object} initialCapacityOrOptions - Self-explanatory:\n * @param {number} initialCapacity - Initial capacity.\n * @param {number} initialLength - Initial length.\n * @param {function} policy - Allocation policy.\n */\nfunction Vector(ArrayClass, initialCapacityOrOptions) {\n if (arguments.length < 1)\n throw new Error('mnemonist/vector: expecting at least a byte array constructor.');\n\n var initialCapacity = initialCapacityOrOptions || 0,\n policy = DEFAULT_GROWING_POLICY,\n initialLength = 0,\n factory = false;\n\n if (typeof initialCapacityOrOptions === 'object') {\n initialCapacity = initialCapacityOrOptions.initialCapacity || 0;\n initialLength = initialCapacityOrOptions.initialLength || 0;\n policy = initialCapacityOrOptions.policy || policy;\n factory = initialCapacityOrOptions.factory === true;\n }\n\n this.factory = factory ? ArrayClass : null;\n this.ArrayClass = ArrayClass;\n this.length = initialLength;\n this.capacity = Math.max(initialLength, initialCapacity);\n this.policy = policy;\n this.array = new ArrayClass(this.capacity);\n}\n\n/**\n * Method used to set a value.\n *\n * @param {number} index - Index to edit.\n * @param {any} value - Value.\n * @return {Vector}\n */\nVector.prototype.set = function(index, value) {\n\n // Out of bounds?\n if (this.length < index)\n throw new Error('Vector(' + this.ArrayClass.name + ').set: index out of bounds.');\n\n // Updating value\n this.array[index] = value;\n\n return this;\n};\n\n/**\n * Method used to get a value.\n *\n * @param {number} index - Index to retrieve.\n * @return {any}\n */\nVector.prototype.get = function(index) {\n if (this.length < index)\n return undefined;\n\n return this.array[index];\n};\n\n/**\n * Method used to apply the growing policy.\n *\n * @param {number} [override] - Override capacity.\n * @return {number}\n */\nVector.prototype.applyPolicy = function(override) {\n var newCapacity = this.policy(override || this.capacity);\n\n if (typeof newCapacity !== 'number' || newCapacity < 0)\n throw new Error('mnemonist/vector.applyPolicy: policy returned an invalid value (expecting a positive integer).');\n\n if (newCapacity <= this.capacity)\n throw new Error('mnemonist/vector.applyPolicy: policy returned a less or equal capacity to allocate.');\n\n // TODO: we should probably check that the returned number is an integer\n return newCapacity;\n};\n\n/**\n * Method used to reallocate the underlying array.\n *\n * @param {number} capacity - Target capacity.\n * @return {Vector}\n */\nVector.prototype.reallocate = function(capacity) {\n if (capacity === this.capacity)\n return this;\n\n var oldArray = this.array;\n\n if (capacity < this.length)\n this.length = capacity;\n\n if (capacity > this.capacity) {\n if (this.factory === null)\n this.array = new this.ArrayClass(capacity);\n else\n this.array = this.factory(capacity);\n\n if (typed.isTypedArray(this.array)) {\n this.array.set(oldArray, 0);\n }\n else {\n for (var i = 0, l = this.length; i < l; i++)\n this.array[i] = oldArray[i];\n }\n }\n else {\n this.array = oldArray.slice(0, capacity);\n }\n\n this.capacity = capacity;\n\n return this;\n};\n\n/**\n * Method used to grow the array.\n *\n * @param {number} [capacity] - Optional capacity to match.\n * @return {Vector}\n */\nVector.prototype.grow = function(capacity) {\n var newCapacity;\n\n if (typeof capacity === 'number') {\n\n if (this.capacity >= capacity)\n return this;\n\n // We need to match the given capacity\n newCapacity = this.capacity;\n\n while (newCapacity < capacity)\n newCapacity = this.applyPolicy(newCapacity);\n\n this.reallocate(newCapacity);\n\n return this;\n }\n\n // We need to run the policy once\n newCapacity = this.applyPolicy();\n this.reallocate(newCapacity);\n\n return this;\n};\n\n/**\n * Method used to resize the array. Won't deallocate.\n *\n * @param {number} length - Target length.\n * @return {Vector}\n */\nVector.prototype.resize = function(length) {\n if (length === this.length)\n return this;\n\n if (length < this.length) {\n this.length = length;\n return this;\n }\n\n this.length = length;\n this.reallocate(length);\n\n return this;\n};\n\n/**\n * Method used to push a value into the array.\n *\n * @param {any} value - Value to push.\n * @return {number} - Length of the array.\n */\nVector.prototype.push = function(value) {\n if (this.capacity === this.length)\n this.grow();\n\n this.array[this.length++] = value;\n\n return this.length;\n};\n\n/**\n * Method used to pop the last value of the array.\n *\n * @return {number} - The popped value.\n */\nVector.prototype.pop = function() {\n if (this.length === 0)\n return;\n\n return this.array[--this.length];\n};\n\n/**\n * Method used to create an iterator over a vector's values.\n *\n * @return {Iterator}\n */\nVector.prototype.values = function() {\n var items = this.array,\n l = this.length,\n i = 0;\n\n return new Iterator(function() {\n if (i >= l)\n return {\n done: true\n };\n\n var value = items[i];\n i++;\n\n return {\n value: value,\n done: false\n };\n });\n};\n\n/**\n * Method used to create an iterator over a vector's entries.\n *\n * @return {Iterator}\n */\nVector.prototype.entries = function() {\n var items = this.array,\n l = this.length,\n i = 0;\n\n return new Iterator(function() {\n if (i >= l)\n return {\n done: true\n };\n\n var value = items[i];\n\n return {\n value: [i++, value],\n done: false\n };\n });\n};\n\n/**\n * Attaching the #.values method to Symbol.iterator if possible.\n */\nif (typeof Symbol !== 'undefined')\n Vector.prototype[Symbol.iterator] = Vector.prototype.values;\n\n/**\n * Convenience known methods.\n */\nVector.prototype.inspect = function() {\n var proxy = this.array.slice(0, this.length);\n\n proxy.type = this.array.constructor.name;\n proxy.items = this.length;\n proxy.capacity = this.capacity;\n\n // Trick so that node displays the name of the constructor\n Object.defineProperty(proxy, 'constructor', {\n value: Vector,\n enumerable: false\n });\n\n return proxy;\n};\n\nif (typeof Symbol !== 'undefined')\n Vector.prototype[Symbol.for('nodejs.util.inspect.custom')] = Vector.prototype.inspect;\n\n/**\n * Static @.from function taking an arbitrary iterable & converting it into\n * a vector.\n *\n * @param {Iterable} iterable - Target iterable.\n * @param {function} ArrayClass - Byte array class.\n * @param {number} capacity - Desired capacity.\n * @return {Vector}\n */\nVector.from = function(iterable, ArrayClass, capacity) {\n\n if (arguments.length < 3) {\n\n // Attempting to guess the needed capacity\n capacity = iterables.guessLength(iterable);\n\n if (typeof capacity !== 'number')\n throw new Error('mnemonist/vector.from: could not guess iterable length. Please provide desired capacity as last argument.');\n }\n\n var vector = new Vector(ArrayClass, capacity);\n\n forEach(iterable, function(value) {\n vector.push(value);\n });\n\n return vector;\n};\n\n/**\n * Exporting.\n */\nfunction subClass(ArrayClass) {\n var SubClass = function(initialCapacityOrOptions) {\n Vector.call(this, ArrayClass, initialCapacityOrOptions);\n };\n\n for (var k in Vector.prototype) {\n if (Vector.prototype.hasOwnProperty(k))\n SubClass.prototype[k] = Vector.prototype[k];\n }\n\n SubClass.from = function(iterable, capacity) {\n return Vector.from(iterable, ArrayClass, capacity);\n };\n\n if (typeof Symbol !== 'undefined')\n SubClass.prototype[Symbol.iterator] = SubClass.prototype.values;\n\n return SubClass;\n}\n\nVector.Int8Vector = subClass(Int8Array);\nVector.Uint8Vector = subClass(Uint8Array);\nVector.Uint8ClampedVector = subClass(Uint8ClampedArray);\nVector.Int16Vector = subClass(Int16Array);\nVector.Uint16Vector = subClass(Uint16Array);\nVector.Int32Vector = subClass(Int32Array);\nVector.Uint32Vector = subClass(Uint32Array);\nVector.Float32Vector = subClass(Float32Array);\nVector.Float64Vector = subClass(Float64Array);\nVector.PointerVector = subClass(pointerArrayFactory);\n\nmodule.exports = Vector;\n","/**\n * Mnemonist LRUCache\n * ===================\n *\n * JavaScript implementation of the LRU Cache data structure. To save up\n * memory and allocations this implementation represents its underlying\n * doubly-linked list as static arrays and pointers. Thus, memory is allocated\n * only once at instantiation and JS objects are never created to serve as\n * pointers. This also means this implementation does not trigger too many\n * garbage collections.\n *\n * Note that to save up memory, a LRU Cache can be implemented using a singly\n * linked list by storing predecessors' pointers as hashmap values.\n * However, this means more hashmap lookups and would probably slow the whole\n * thing down. What's more, pointers are not the things taking most space in\n * memory.\n */\nvar Iterator = require('obliterator/iterator'),\n forEach = require('obliterator/foreach'),\n typed = require('./utils/typed-arrays.js'),\n iterables = require('./utils/iterables.js');\n\n/**\n * LRUCache.\n *\n * @constructor\n * @param {function} Keys - Array class for storing keys.\n * @param {function} Values - Array class for storing values.\n * @param {number} capacity - Desired capacity.\n */\nfunction LRUCache(Keys, Values, capacity) {\n if (arguments.length < 2) {\n capacity = Keys;\n Keys = null;\n Values = null;\n }\n\n this.capacity = capacity;\n\n if (typeof this.capacity !== 'number' || this.capacity <= 0)\n throw new Error('mnemonist/lru-cache: capacity should be positive number.');\n else if (!isFinite(this.capacity) || Math.floor(this.capacity) !== this.capacity)\n throw new Error('mnemonist/lru-cache: capacity should be a finite positive integer.');\n\n var PointerArray = typed.getPointerArray(capacity);\n\n this.forward = new PointerArray(capacity);\n this.backward = new PointerArray(capacity);\n this.K = typeof Keys === 'function' ? new Keys(capacity) : new Array(capacity);\n this.V = typeof Values === 'function' ? new Values(capacity) : new Array(capacity);\n\n // Properties\n this.size = 0;\n this.head = 0;\n this.tail = 0;\n this.items = {};\n}\n\n/**\n * Method used to clear the structure.\n *\n * @return {undefined}\n */\nLRUCache.prototype.clear = function() {\n this.size = 0;\n this.head = 0;\n this.tail = 0;\n this.items = {};\n};\n\n/**\n * Method used to splay a value on top.\n *\n * @param {number} pointer - Pointer of the value to splay on top.\n * @return {LRUCache}\n */\nLRUCache.prototype.splayOnTop = function(pointer) {\n var oldHead = this.head;\n\n if (this.head === pointer)\n return this;\n\n var previous = this.backward[pointer],\n next = this.forward[pointer];\n\n if (this.tail === pointer) {\n this.tail = previous;\n }\n else {\n this.backward[next] = previous;\n }\n\n this.forward[previous] = next;\n\n this.backward[oldHead] = pointer;\n this.head = pointer;\n this.forward[pointer] = oldHead;\n\n return this;\n};\n\n/**\n * Method used to set the value for the given key in the cache.\n *\n * @param {any} key - Key.\n * @param {any} value - Value.\n * @return {undefined}\n */\nLRUCache.prototype.set = function(key, value) {\n\n var pointer = this.items[key];\n\n // The key already exists, we just need to update the value and splay on top\n if (typeof pointer !== 'undefined') {\n this.splayOnTop(pointer);\n this.V[pointer] = value;\n\n return;\n }\n\n // The cache is not yet full\n if (this.size < this.capacity) {\n pointer = this.size++;\n }\n\n // Cache is full, we need to drop the last value\n else {\n pointer = this.tail;\n this.tail = this.backward[pointer];\n delete this.items[this.K[pointer]];\n }\n\n // Storing key & value\n this.items[key] = pointer;\n this.K[pointer] = key;\n this.V[pointer] = value;\n\n // Moving the item at the front of the list\n this.forward[pointer] = this.head;\n this.backward[this.head] = pointer;\n this.head = pointer;\n};\n\n/**\n * Method used to set the value for the given key in the cache\n *\n * @param {any} key - Key.\n * @param {any} value - Value.\n * @return {{evicted: boolean, key: any, value: any}} An object containing the\n * key and value of an item that was overwritten or evicted in the set\n * operation, as well as a boolean indicating whether it was evicted due to\n * limited capacity. Return value is null if nothing was evicted or overwritten\n * during the set operation.\n */\nLRUCache.prototype.setpop = function(key, value) {\n var oldValue = null;\n var oldKey = null;\n\n var pointer = this.items[key];\n\n // The key already exists, we just need to update the value and splay on top\n if (typeof pointer !== 'undefined') {\n this.splayOnTop(pointer);\n oldValue = this.V[pointer];\n this.V[pointer] = value;\n return {evicted: false, key: key, value: oldValue};\n }\n\n // The cache is not yet full\n if (this.size < this.capacity) {\n pointer = this.size++;\n }\n\n // Cache is full, we need to drop the last value\n else {\n pointer = this.tail;\n this.tail = this.backward[pointer];\n oldValue = this.V[pointer];\n oldKey = this.K[pointer];\n delete this.items[oldKey];\n }\n\n // Storing key & value\n this.items[key] = pointer;\n this.K[pointer] = key;\n this.V[pointer] = value;\n\n // Moving the item at the front of the list\n this.forward[pointer] = this.head;\n this.backward[this.head] = pointer;\n this.head = pointer;\n\n // Return object if eviction took place, otherwise return null\n if (oldKey) {\n return {evicted: true, key: oldKey, value: oldValue};\n }\n else {\n return null;\n }\n};\n\n/**\n * Method used to check whether the key exists in the cache.\n *\n * @param {any} key - Key.\n * @return {boolean}\n */\nLRUCache.prototype.has = function(key) {\n return key in this.items;\n};\n\n/**\n * Method used to get the value attached to the given key. Will move the\n * related key to the front of the underlying linked list.\n *\n * @param {any} key - Key.\n * @return {any}\n */\nLRUCache.prototype.get = function(key) {\n var pointer = this.items[key];\n\n if (typeof pointer === 'undefined')\n return;\n\n this.splayOnTop(pointer);\n\n return this.V[pointer];\n};\n\n/**\n * Method used to get the value attached to the given key. Does not modify\n * the ordering of the underlying linked list.\n *\n * @param {any} key - Key.\n * @return {any}\n */\nLRUCache.prototype.peek = function(key) {\n var pointer = this.items[key];\n\n if (typeof pointer === 'undefined')\n return;\n\n return this.V[pointer];\n};\n\n/**\n * Method used to iterate over the cache's entries using a callback.\n *\n * @param {function} callback - Function to call for each item.\n * @param {object} scope - Optional scope.\n * @return {undefined}\n */\nLRUCache.prototype.forEach = function(callback, scope) {\n scope = arguments.length > 1 ? scope : this;\n\n var i = 0,\n l = this.size;\n\n var pointer = this.head,\n keys = this.K,\n values = this.V,\n forward = this.forward;\n\n while (i < l) {\n\n callback.call(scope, values[pointer], keys[pointer], this);\n pointer = forward[pointer];\n\n i++;\n }\n};\n\n/**\n * Method used to create an iterator over the cache's keys from most\n * recently used to least recently used.\n *\n * @return {Iterator}\n */\nLRUCache.prototype.keys = function() {\n var i = 0,\n l = this.size;\n\n var pointer = this.head,\n keys = this.K,\n forward = this.forward;\n\n return new Iterator(function() {\n if (i >= l)\n return {done: true};\n\n var key = keys[pointer];\n\n i++;\n\n if (i < l)\n pointer = forward[pointer];\n\n return {\n done: false,\n value: key\n };\n });\n};\n\n/**\n * Method used to create an iterator over the cache's values from most\n * recently used to least recently used.\n *\n * @return {Iterator}\n */\nLRUCache.prototype.values = function() {\n var i = 0,\n l = this.size;\n\n var pointer = this.head,\n values = this.V,\n forward = this.forward;\n\n return new Iterator(function() {\n if (i >= l)\n return {done: true};\n\n var value = values[pointer];\n\n i++;\n\n if (i < l)\n pointer = forward[pointer];\n\n return {\n done: false,\n value: value\n };\n });\n};\n\n/**\n * Method used to create an iterator over the cache's entries from most\n * recently used to least recently used.\n *\n * @return {Iterator}\n */\nLRUCache.prototype.entries = function() {\n var i = 0,\n l = this.size;\n\n var pointer = this.head,\n keys = this.K,\n values = this.V,\n forward = this.forward;\n\n return new Iterator(function() {\n if (i >= l)\n return {done: true};\n\n var key = keys[pointer],\n value = values[pointer];\n\n i++;\n\n if (i < l)\n pointer = forward[pointer];\n\n return {\n done: false,\n value: [key, value]\n };\n });\n};\n\n/**\n * Attaching the #.entries method to Symbol.iterator if possible.\n */\nif (typeof Symbol !== 'undefined')\n LRUCache.prototype[Symbol.iterator] = LRUCache.prototype.entries;\n\n/**\n * Convenience known methods.\n */\nLRUCache.prototype.inspect = function() {\n var proxy = new Map();\n\n var iterator = this.entries(),\n step;\n\n while ((step = iterator.next(), !step.done))\n proxy.set(step.value[0], step.value[1]);\n\n // Trick so that node displays the name of the constructor\n Object.defineProperty(proxy, 'constructor', {\n value: LRUCache,\n enumerable: false\n });\n\n return proxy;\n};\n\nif (typeof Symbol !== 'undefined')\n LRUCache.prototype[Symbol.for('nodejs.util.inspect.custom')] = LRUCache.prototype.inspect;\n\n/**\n * Static @.from function taking an arbitrary iterable & converting it into\n * a structure.\n *\n * @param {Iterable} iterable - Target iterable.\n * @param {function} Keys - Array class for storing keys.\n * @param {function} Values - Array class for storing values.\n * @param {number} capacity - Cache's capacity.\n * @return {LRUCache}\n */\nLRUCache.from = function(iterable, Keys, Values, capacity) {\n if (arguments.length < 2) {\n capacity = iterables.guessLength(iterable);\n\n if (typeof capacity !== 'number')\n throw new Error('mnemonist/lru-cache.from: could not guess iterable length. Please provide desired capacity as last argument.');\n }\n else if (arguments.length === 2) {\n capacity = Keys;\n Keys = null;\n Values = null;\n }\n\n var cache = new LRUCache(Keys, Values, capacity);\n\n forEach(iterable, function(value, key) {\n cache.set(key, value);\n });\n\n return cache;\n};\n\n/**\n * Exporting.\n */\nmodule.exports = LRUCache;\n","/**\n * Mnemonist LRUMap\n * =================\n *\n * Variant of the LRUCache class that leverages an ES6 Map instead of an object.\n * It might be faster for some use case but it is still hard to understand\n * when a Map can outperform an object in v8.\n */\nvar LRUCache = require('./lru-cache.js'),\n forEach = require('obliterator/foreach'),\n typed = require('./utils/typed-arrays.js'),\n iterables = require('./utils/iterables.js');\n\n/**\n * LRUMap.\n *\n * @constructor\n * @param {function} Keys - Array class for storing keys.\n * @param {function} Values - Array class for storing values.\n * @param {number} capacity - Desired capacity.\n */\nfunction LRUMap(Keys, Values, capacity) {\n if (arguments.length < 2) {\n capacity = Keys;\n Keys = null;\n Values = null;\n }\n\n this.capacity = capacity;\n\n if (typeof this.capacity !== 'number' || this.capacity <= 0)\n throw new Error('mnemonist/lru-map: capacity should be positive number.');\n else if (!isFinite(this.capacity) || Math.floor(this.capacity) !== this.capacity)\n throw new Error('mnemonist/lru-map: capacity should be a finite positive integer.');\n\n var PointerArray = typed.getPointerArray(capacity);\n\n this.forward = new PointerArray(capacity);\n this.backward = new PointerArray(capacity);\n this.K = typeof Keys === 'function' ? new Keys(capacity) : new Array(capacity);\n this.V = typeof Values === 'function' ? new Values(capacity) : new Array(capacity);\n\n // Properties\n this.size = 0;\n this.head = 0;\n this.tail = 0;\n this.items = new Map();\n}\n\n/**\n * Method used to clear the structure.\n *\n * @return {undefined}\n */\nLRUMap.prototype.clear = function() {\n this.size = 0;\n this.head = 0;\n this.tail = 0;\n this.items.clear();\n};\n\n/**\n * Method used to set the value for the given key in the cache.\n *\n * @param {any} key - Key.\n * @param {any} value - Value.\n * @return {undefined}\n */\nLRUMap.prototype.set = function(key, value) {\n\n var pointer = this.items.get(key);\n\n // The key already exists, we just need to update the value and splay on top\n if (typeof pointer !== 'undefined') {\n this.splayOnTop(pointer);\n this.V[pointer] = value;\n\n return;\n }\n\n // The cache is not yet full\n if (this.size < this.capacity) {\n pointer = this.size++;\n }\n\n // Cache is full, we need to drop the last value\n else {\n pointer = this.tail;\n this.tail = this.backward[pointer];\n this.items.delete(this.K[pointer]);\n }\n\n // Storing key & value\n this.items.set(key, pointer);\n this.K[pointer] = key;\n this.V[pointer] = value;\n\n // Moving the item at the front of the list\n this.forward[pointer] = this.head;\n this.backward[this.head] = pointer;\n this.head = pointer;\n};\n\n/**\n * Method used to set the value for the given key in the cache.\n *\n * @param {any} key - Key.\n * @param {any} value - Value.\n * @return {{evicted: boolean, key: any, value: any}} An object containing the\n * key and value of an item that was overwritten or evicted in the set\n * operation, as well as a boolean indicating whether it was evicted due to\n * limited capacity. Return value is null if nothing was evicted or overwritten\n * during the set operation.\n */\nLRUMap.prototype.setpop = function(key, value) {\n var oldValue = null;\n var oldKey = null;\n\n var pointer = this.items.get(key);\n\n // The key already exists, we just need to update the value and splay on top\n if (typeof pointer !== 'undefined') {\n this.splayOnTop(pointer);\n oldValue = this.V[pointer];\n this.V[pointer] = value;\n return {evicted: false, key: key, value: oldValue};\n }\n\n // The cache is not yet full\n if (this.size < this.capacity) {\n pointer = this.size++;\n }\n\n // Cache is full, we need to drop the last value\n else {\n pointer = this.tail;\n this.tail = this.backward[pointer];\n oldValue = this.V[pointer];\n oldKey = this.K[pointer];\n this.items.delete(oldKey);\n }\n\n // Storing key & value\n this.items.set(key, pointer);\n this.K[pointer] = key;\n this.V[pointer] = value;\n\n // Moving the item at the front of the list\n this.forward[pointer] = this.head;\n this.backward[this.head] = pointer;\n this.head = pointer;\n\n // Return object if eviction took place, otherwise return null\n if (oldKey) {\n return {evicted: true, key: oldKey, value: oldValue};\n }\n else {\n return null;\n }\n};\n\n/**\n * Method used to check whether the key exists in the cache.\n *\n * @param {any} key - Key.\n * @return {boolean}\n */\nLRUMap.prototype.has = function(key) {\n return this.items.has(key);\n};\n\n/**\n * Method used to get the value attached to the given key. Will move the\n * related key to the front of the underlying linked list.\n *\n * @param {any} key - Key.\n * @return {any}\n */\nLRUMap.prototype.get = function(key) {\n var pointer = this.items.get(key);\n\n if (typeof pointer === 'undefined')\n return;\n\n this.splayOnTop(pointer);\n\n return this.V[pointer];\n};\n\n/**\n * Method used to get the value attached to the given key. Does not modify\n * the ordering of the underlying linked list.\n *\n * @param {any} key - Key.\n * @return {any}\n */\nLRUMap.prototype.peek = function(key) {\n var pointer = this.items.get(key);\n\n if (typeof pointer === 'undefined')\n return;\n\n return this.V[pointer];\n};\n\n/**\n * Methods that can be reused as-is from LRUCache.\n */\nLRUMap.prototype.splayOnTop = LRUCache.prototype.splayOnTop;\nLRUMap.prototype.forEach = LRUCache.prototype.forEach;\nLRUMap.prototype.keys = LRUCache.prototype.keys;\nLRUMap.prototype.values = LRUCache.prototype.values;\nLRUMap.prototype.entries = LRUCache.prototype.entries;\n\n/**\n * Attaching the #.entries method to Symbol.iterator if possible.\n */\nif (typeof Symbol !== 'undefined')\n LRUMap.prototype[Symbol.iterator] = LRUMap.prototype.entries;\n\n/**\n * Convenience known methods.\n */\nLRUMap.prototype.inspect = LRUCache.prototype.inspect;\n\n/**\n * Static @.from function taking an arbitrary iterable & converting it into\n * a structure.\n *\n * @param {Iterable} iterable - Target iterable.\n * @param {function} Keys - Array class for storing keys.\n * @param {function} Values - Array class for storing values.\n * @param {number} capacity - Cache's capacity.\n * @return {LRUMap}\n */\nLRUMap.from = function(iterable, Keys, Values, capacity) {\n if (arguments.length < 2) {\n capacity = iterables.guessLength(iterable);\n\n if (typeof capacity !== 'number')\n throw new Error('mnemonist/lru-cache.from: could not guess iterable length. Please provide desired capacity as last argument.');\n }\n else if (arguments.length === 2) {\n capacity = Keys;\n Keys = null;\n Values = null;\n }\n\n var cache = new LRUMap(Keys, Values, capacity);\n\n forEach(iterable, function(value, key) {\n cache.set(key, value);\n });\n\n return cache;\n};\n\n/**\n * Exporting.\n */\nmodule.exports = LRUMap;\n","/**\n * Mnemonist LRUMapWithDelete\n * ===========================\n *\n * An extension of LRUMap with delete functionality.\n */\n\nvar LRUMap = require('./lru-map.js'),\n forEach = require('obliterator/foreach'),\n typed = require('./utils/typed-arrays.js'),\n iterables = require('./utils/iterables.js');\n\n// The only complication with deleting items is that the LRU's\n// performance depends on having a fixed-size list of pointers; the\n// doubly-linked-list is happy to expand and contract.\n//\n// On delete, we record the position of the former item's pointer in a\n// list of \"holes\" in the pointer array. On insert, if there is a hole\n// the new pointer slots in to fill the hole; otherwise, it is\n// appended as usual. (Note: we are only talking here about the\n// internal pointer list. setting or getting an item promotes it\n// to the top of the LRU ranking no matter what came before)\n\nfunction LRUMapWithDelete(Keys, Values, capacity) {\n if (arguments.length < 2) {\n LRUMap.call(this, Keys);\n }\n else {\n LRUMap.call(this, Keys, Values, capacity);\n }\n var PointerArray = typed.getPointerArray(this.capacity);\n this.deleted = new PointerArray(this.capacity);\n this.deletedSize = 0;\n}\n\nfor (var k in LRUMap.prototype)\n LRUMapWithDelete.prototype[k] = LRUMap.prototype[k];\nif (typeof Symbol !== 'undefined')\n LRUMapWithDelete.prototype[Symbol.iterator] = LRUMap.prototype[Symbol.iterator];\n\n/**\n * Method used to clear the structure.\n *\n * @return {undefined}\n */\nLRUMapWithDelete.prototype.clear = function() {\n LRUMap.prototype.clear.call(this);\n this.deletedSize = 0;\n};\n\n/**\n * Method used to set the value for the given key in the cache.\n *\n * @param {any} key - Key.\n * @param {any} value - Value.\n * @return {undefined}\n */\nLRUMapWithDelete.prototype.set = function(key, value) {\n\n var pointer = this.items.get(key);\n\n // The key already exists, we just need to update the value and splay on top\n if (typeof pointer !== 'undefined') {\n this.splayOnTop(pointer);\n this.V[pointer] = value;\n\n return;\n }\n\n // The cache is not yet full\n if (this.size < this.capacity) {\n if (this.deletedSize > 0) {\n // If there is a \"hole\" in the pointer list, reuse it\n pointer = this.deleted[--this.deletedSize];\n }\n else {\n // otherwise append to the pointer list\n pointer = this.size;\n }\n this.size++;\n }\n\n // Cache is full, we need to drop the last value\n else {\n pointer = this.tail;\n this.tail = this.backward[pointer];\n this.items.delete(this.K[pointer]);\n }\n\n // Storing key & value\n this.items.set(key, pointer);\n this.K[pointer] = key;\n this.V[pointer] = value;\n\n // Moving the item at the front of the list\n this.forward[pointer] = this.head;\n this.backward[this.head] = pointer;\n this.head = pointer;\n};\n\n/**\n * Method used to set the value for the given key in the cache\n *\n * @param {any} key - Key.\n * @param {any} value - Value.\n * @return {{evicted: boolean, key: any, value: any}} An object containing the\n * key and value of an item that was overwritten or evicted in the set\n * operation, as well as a boolean indicating whether it was evicted due to\n * limited capacity. Return value is null if nothing was evicted or overwritten\n * during the set operation.\n */\nLRUMapWithDelete.prototype.setpop = function(key, value) {\n var oldValue = null;\n var oldKey = null;\n\n var pointer = this.items.get(key);\n\n // The key already exists, we just need to update the value and splay on top\n if (typeof pointer !== 'undefined') {\n this.splayOnTop(pointer);\n oldValue = this.V[pointer];\n this.V[pointer] = value;\n return {evicted: false, key: key, value: oldValue};\n }\n\n // The cache is not yet full\n if (this.size < this.capacity) {\n if (this.deletedSize > 0) {\n // If there is a \"hole\" in the pointer list, reuse it\n pointer = this.deleted[--this.deletedSize];\n }\n else {\n // otherwise append to the pointer list\n pointer = this.size;\n }\n this.size++;\n }\n\n // Cache is full, we need to drop the last value\n else {\n pointer = this.tail;\n this.tail = this.backward[pointer];\n oldValue = this.V[pointer];\n oldKey = this.K[pointer];\n this.items.delete(oldKey);\n }\n\n // Storing key & value\n this.items.set(key, pointer);\n this.K[pointer] = key;\n this.V[pointer] = value;\n\n // Moving the item at the front of the list\n this.forward[pointer] = this.head;\n this.backward[this.head] = pointer;\n this.head = pointer;\n\n // Return object if eviction took place, otherwise return null\n if (oldKey) {\n return {evicted: true, key: oldKey, value: oldValue};\n }\n else {\n return null;\n }\n};\n\n/**\n * Method used to delete the entry for the given key in the cache.\n *\n * @param {any} key - Key.\n * @return {boolean} - true if the item was present\n */\nLRUMapWithDelete.prototype.delete = function(key) {\n\n var pointer = this.items.get(key);\n\n if (typeof pointer === 'undefined') {\n return false;\n }\n\n this.items.delete(key);\n\n if (this.size === 1) {\n this.size = 0;\n this.head = 0;\n this.tail = 0;\n this.deletedSize = 0;\n return true;\n }\n\n var previous = this.backward[pointer],\n next = this.forward[pointer];\n\n if (this.head === pointer) {\n this.head = next;\n }\n if (this.tail === pointer) {\n this.tail = previous;\n }\n\n this.forward[previous] = next;\n this.backward[next] = previous;\n\n this.size--;\n this.deleted[this.deletedSize++] = pointer;\n\n return true;\n};\n\n/**\n * Method used to remove and return the value for the given key in the cache.\n *\n * @param {any} key - Key.\n * @param {any} [missing=undefined] - Value to return if item is absent\n * @return {any} The value, if present; the missing indicator if absent\n */\nLRUMapWithDelete.prototype.remove = function(key, missing = undefined) {\n\n var pointer = this.items.get(key);\n\n if (typeof pointer === 'undefined') {\n return missing;\n }\n\n var dead = this.V[pointer];\n this.items.delete(key);\n\n if (this.size === 1) {\n this.size = 0;\n this.head = 0;\n this.tail = 0;\n this.deletedSize = 0;\n return dead;\n }\n\n var previous = this.backward[pointer],\n next = this.forward[pointer];\n\n if (this.head === pointer) {\n this.head = next;\n }\n if (this.tail === pointer) {\n this.tail = previous;\n }\n\n this.forward[previous] = next;\n this.backward[next] = previous;\n\n this.size--;\n this.deleted[this.deletedSize++] = pointer;\n\n return dead;\n};\n\n/**\n * Static @.from function taking an arbitrary iterable & converting it into\n * a structure.\n *\n * @param {Iterable} iterable - Target iterable.\n * @param {function} Keys - Array class for storing keys.\n * @param {function} Values - Array class for storing values.\n * @param {number} capacity - Cache's capacity.\n * @return {LRUMapWithDelete}\n */\nLRUMapWithDelete.from = function(iterable, Keys, Values, capacity) {\n if (arguments.length < 2) {\n capacity = iterables.guessLength(iterable);\n\n if (typeof capacity !== 'number')\n throw new Error('mnemonist/lru-map.from: could not guess iterable length. Please provide desired capacity as last argument.');\n }\n else if (arguments.length === 2) {\n capacity = Keys;\n Keys = null;\n Values = null;\n }\n\n var cache = new LRUMapWithDelete(Keys, Values, capacity);\n\n forEach(iterable, function(value, key) {\n cache.set(key, value);\n });\n\n return cache;\n};\n\nmodule.exports = LRUMapWithDelete;\n","/**\n * Mnemonist Library Endpoint (ESM)\n * =================================\n *\n * Exporting every data structure through a unified endpoint.\n */\nimport * as set from './set.js';\nimport {default as FibonacciHeap} from './fibonacci-heap.js';\nconst MinFibonacciHeap = FibonacciHeap.MinFibonacciHeap;\nconst MaxFibonacciHeap = FibonacciHeap.MaxFibonacciHeap;\nimport {default as Heap} from './heap.js';\nconst MinHeap = Heap.MinHeap;\nconst MaxHeap = Heap.MaxHeap;\nimport {default as SuffixArray} from './suffix-array.js';\nconst GeneralizedSuffixArray = SuffixArray.GeneralizedSuffixArray;\nimport {default as Vector} from './vector.js';\nconst Uint8Vector = Vector.Uint8Vector;\nconst Uint8ClampedVector = Vector.Uint8ClampedVector;\nconst Int8Vector = Vector.Int8Vector;\nconst Uint16Vector = Vector.Uint16Vector;\nconst Int16Vector = Vector.Int16Vector;\nconst Uint32Vector = Vector.Uint32Vector;\nconst Int32Vector = Vector.Int32Vector;\nconst Float32Vector = Vector.Float32Vector;\nconst Float64Vector = Vector.Float64Vector;\nconst PointerVector = Vector.PointerVector;\n\nexport {default as BiMap} from './bi-map.js';\nexport {default as BitSet} from './bit-set.js';\nexport {default as BitVector} from './bit-vector.js';\nexport {default as BloomFilter} from './bloom-filter.js';\nexport {default as BKTree} from './bk-tree.js';\nexport {default as CircularBuffer} from './circular-buffer.js';\nexport {default as DefaultMap} from './default-map.js';\nexport {default as DefaultWeakMap} from './default-weak-map.js';\nexport {default as FixedDeque} from './fixed-deque.js';\nexport {default as StaticDisjointSet} from './static-disjoint-set.js';\nexport {FibonacciHeap, MinFibonacciHeap, MaxFibonacciHeap};\nexport {default as FixedReverseHeap} from './fixed-reverse-heap.js';\nexport {default as FuzzyMap} from './fuzzy-map.js';\nexport {default as FuzzyMultiMap} from './fuzzy-multi-map.js';\nexport {default as HashedArrayTree} from './hashed-array-tree.js';\nexport {Heap, MinHeap, MaxHeap};\nexport {default as StaticIntervalTree} from './static-interval-tree.js';\nexport {default as InvertedIndex} from './inverted-index.js';\nexport {default as KDTree} from './kd-tree.js';\nexport {default as LinkedList} from './linked-list.js';\nexport {default as LRUCache} from './lru-cache.js';\nexport {default as LRUCacheWithDelete} from './lru-cache-with-delete.js';\nexport {default as LRUMap} from './lru-map.js';\nexport {default as LRUMapWithDelete} from './lru-map-with-delete.js';\nexport {default as MultiMap} from './multi-map.js';\nexport {default as MultiSet} from './multi-set.js';\nexport {default as PassjoinIndex} from './passjoin-index.js';\nexport {default as Queue} from './queue.js';\nexport {default as FixedStack} from './fixed-stack.js';\nexport {default as Stack} from './stack.js';\nexport {SuffixArray, GeneralizedSuffixArray};\nexport {set};\nexport {default as SparseQueueSet} from './sparse-queue-set.js';\nexport {default as SparseMap} from './sparse-map.js';\nexport {default as SparseSet} from './sparse-set.js';\nexport {default as SymSpell} from './symspell.js';\nexport {default as Trie} from './trie.js';\nexport {default as TrieMap} from './trie-map.js';\nexport {Vector, Uint8Vector, Uint8ClampedVector, Int8Vector, Uint16Vector, Int16Vector, Uint32Vector, Int32Vector, Float32Vector, Float64Vector, PointerVector};\nexport {default as VPTree} from './vp-tree.js';\n","import { LRUMapWithDelete } from \"mnemonist\";\nimport type { CachedItem } from \"./cacheContainer.ts\";\nimport type { Storage } from \"./storage.ts\";\n\nexport class LRUStorage implements Storage {\n\tprivate cache: LRUMapWithDelete<string, CachedItem>;\n\n\tconstructor({ max = 10_000 }: { max?: number } = {}) {\n\t\tthis.cache = new LRUMapWithDelete<string, CachedItem>(max);\n\t}\n\n\tasync clear(): Promise<void> {\n\t\tthis.cache.clear();\n\t}\n\n\tasync getItem(key: string) {\n\t\tconst item = this.cache.get(key);\n\t\treturn item;\n\t}\n\n\tasync setItem(key: string, content: CachedItem) {\n\t\tthis.cache.set(key, content);\n\t}\n\n\tasync removeItem(key: string) {\n\t\tthis.cache.delete(key);\n\t}\n}\n","'use strict';\n\nvar has = Object.prototype.hasOwnProperty\n , prefix = '~';\n\n/**\n * Constructor to create a storage for our `EE` objects.\n * An `Events` instance is a plain object whose properties are event names.\n *\n * @constructor\n * @private\n */\nfunction Events() {}\n\n//\n// We try to not inherit from `Object.prototype`. In some engines creating an\n// instance in this way is faster than calling `Object.create(null)` directly.\n// If `Object.create(null)` is not supported we prefix the event names with a\n// character to make sure that the built-in object properties are not\n// overridden or used as an attack vector.\n//\nif (Object.create) {\n Events.prototype = Object.create(null);\n\n //\n // This hack is needed because the `__proto__` property is still inherited in\n // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.\n //\n if (!new Events().__proto__) prefix = false;\n}\n\n/**\n * Representation of a single event listener.\n *\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} [once=false] Specify if the listener is a one-time listener.\n * @constructor\n * @private\n */\nfunction EE(fn, context, once) {\n this.fn = fn;\n this.context = context;\n this.once = once || false;\n}\n\n/**\n * Add a listener for a given event.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} once Specify if the listener is a one-time listener.\n * @returns {EventEmitter}\n * @private\n */\nfunction addListener(emitter, event, fn, context, once) {\n if (typeof fn !== 'function') {\n throw new TypeError('The listener must be a function');\n }\n\n var listener = new EE(fn, context || emitter, once)\n , evt = prefix ? prefix + event : event;\n\n if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;\n else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);\n else emitter._events[evt] = [emitter._events[evt], listener];\n\n return emitter;\n}\n\n/**\n * Clear event by name.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} evt The Event name.\n * @private\n */\nfunction clearEvent(emitter, evt) {\n if (--emitter._eventsCount === 0) emitter._events = new Events();\n else delete emitter._events[evt];\n}\n\n/**\n * Minimal `EventEmitter` interface that is molded against the Node.js\n * `EventEmitter` interface.\n *\n * @constructor\n * @public\n */\nfunction EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}\n\n/**\n * Return an array listing the events for which the emitter has registered\n * listeners.\n *\n * @returns {Array}\n * @public\n */\nEventEmitter.prototype.eventNames = function eventNames() {\n var names = []\n , events\n , name;\n\n if (this._eventsCount === 0) return names;\n\n for (name in (events = this._events)) {\n if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);\n }\n\n if (Object.getOwnPropertySymbols) {\n return names.concat(Object.getOwnPropertySymbols(events));\n }\n\n return names;\n};\n\n/**\n * Return the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Array} The registered listeners.\n * @public\n */\nEventEmitter.prototype.listeners = function listeners(event) {\n var evt = prefix ? prefix + event : event\n , handlers = this._events[evt];\n\n if (!handlers) return [];\n if (handlers.fn) return [handlers.fn];\n\n for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {\n ee[i] = handlers[i].fn;\n }\n\n return ee;\n};\n\n/**\n * Return the number of listeners listening to a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Number} The number of listeners.\n * @public\n */\nEventEmitter.prototype.listenerCount = function listenerCount(event) {\n var evt = prefix ? prefix + event : event\n , listeners = this._events[evt];\n\n if (!listeners) return 0;\n if (listeners.fn) return 1;\n return listeners.length;\n};\n\n/**\n * Calls each of the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Boolean} `true` if the event had listeners, else `false`.\n * @public\n */\nEventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return false;\n\n var listeners = this._events[evt]\n , len = arguments.length\n , args\n , i;\n\n if (listeners.fn) {\n if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);\n\n switch (len) {\n case 1: return listeners.fn.call(listeners.context), true;\n case 2: return listeners.fn.call(listeners.context, a1), true;\n case 3: return listeners.fn.call(listeners.context, a1, a2), true;\n case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;\n case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;\n case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;\n }\n\n for (i = 1, args = new Array(len -1); i < len; i++) {\n args[i - 1] = arguments[i];\n }\n\n listeners.fn.apply(listeners.context, args);\n } else {\n var length = listeners.length\n , j;\n\n for (i = 0; i < length; i++) {\n if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);\n\n switch (len) {\n case 1: listeners[i].fn.call(listeners[i].context); break;\n case 2: listeners[i].fn.call(listeners[i].context, a1); break;\n case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;\n case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;\n default:\n if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {\n args[j - 1] = arguments[j];\n }\n\n listeners[i].fn.apply(listeners[i].context, args);\n }\n }\n }\n\n return true;\n};\n\n/**\n * Add a listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.on = function on(event, fn, context) {\n return addListener(this, event, fn, context, false);\n};\n\n/**\n * Add a one-time listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.once = function once(event, fn, context) {\n return addListener(this, event, fn, context, true);\n};\n\n/**\n * Remove the listeners of a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn Only remove the listeners that match this function.\n * @param {*} context Only remove the listeners that have this context.\n * @param {Boolean} once Only remove one-time listeners.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return this;\n if (!fn) {\n clearEvent(this, evt);\n return this;\n }\n\n var listeners = this._events[evt];\n\n if (listeners.fn) {\n if (\n listeners.fn === fn &&\n (!once || listeners.once) &&\n (!context || listeners.context === context)\n ) {\n clearEvent(this, evt);\n }\n } else {\n for (var i = 0, events = [], length = listeners.length; i < length; i++) {\n if (\n listeners[i].fn !== fn ||\n (once && !listeners[i].once) ||\n (context && listeners[i].context !== context)\n ) {\n events.push(listeners[i]);\n }\n }\n\n //\n // Reset the array, or remove it completely if we have no more listeners.\n //\n if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;\n else clearEvent(this, evt);\n }\n\n return this;\n};\n\n/**\n * Remove all listeners, or those of the specified event.\n *\n * @param {(String|Symbol)} [event] The event name.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {\n var evt;\n\n if (event) {\n evt = prefix ? prefix + event : event;\n if (this._events[evt]) clearEvent(this, evt);\n } else {\n this._events = new Events();\n this._eventsCount = 0;\n }\n\n return this;\n};\n\n//\n// Alias methods names because people roll like that.\n//\nEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\nEventEmitter.prototype.addListener = EventEmitter.prototype.on;\n\n//\n// Expose the prefix.\n//\nEventEmitter.prefixed = prefix;\n\n//\n// Allow `EventEmitter` to be imported as module namespace.\n//\nEventEmitter.EventEmitter = EventEmitter;\n\n//\n// Expose the module.\n//\nif ('undefined' !== typeof module) {\n module.exports = EventEmitter;\n}\n","import EventEmitter from './index.js'\n\nexport { EventEmitter }\nexport default EventEmitter\n","export class TimeoutError extends Error {\n\tname = 'TimeoutError';\n\n\tconstructor(message, options) {\n\t\tsuper(message, options);\n\t\tError.captureStackTrace?.(this, TimeoutError);\n\t}\n}\n\nconst getAbortedReason = signal => signal.reason ?? new DOMException('This operation was aborted.', 'AbortError');\n\nexport default function pTimeout(promise, options) {\n\tconst {\n\t\tmilliseconds,\n\t\tfallback,\n\t\tmessage,\n\t\tcustomTimers = {setTimeout, clearTimeout},\n\t\tsignal,\n\t} = options;\n\n\tlet timer;\n\tlet abortHandler;\n\n\tconst wrappedPromise = new Promise((resolve, reject) => {\n\t\tif (typeof milliseconds !== 'number' || Math.sign(milliseconds) !== 1) {\n\t\t\tthrow new TypeError(`Expected \\`milliseconds\\` to be a positive number, got \\`${milliseconds}\\``);\n\t\t}\n\n\t\tif (signal?.aborted) {\n\t\t\treject(getAbortedReason(signal));\n\t\t\treturn;\n\t\t}\n\n\t\tif (signal) {\n\t\t\tabortHandler = () => {\n\t\t\t\treject(getAbortedReason(signal));\n\t\t\t};\n\n\t\t\tsignal.addEventListener('abort', abortHandler, {once: true});\n\t\t}\n\n\t\t// Use .then() instead of async IIFE to preserve stack traces\n\t\t// eslint-disable-next-line promise/prefer-await-to-then, promise/prefer-catch\n\t\tpromise.then(resolve, reject);\n\n\t\tif (milliseconds === Number.POSITIVE_INFINITY) {\n\t\t\treturn;\n\t\t}\n\n\t\t// We create the error outside of `setTimeout` to preserve the stack trace.\n\t\tconst timeoutError = new TimeoutError();\n\n\t\t// `.call(undefined, ...)` is needed for custom timers to avoid context issues\n\t\ttimer = customTimers.setTimeout.call(undefined, () => {\n\t\t\tif (fallback) {\n\t\t\t\ttry {\n\t\t\t\t\tresolve(fallback());\n\t\t\t\t} catch (error) {\n\t\t\t\t\treject(error);\n\t\t\t\t}\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (typeof promise.cancel === 'function') {\n\t\t\t\tpromise.cancel();\n\t\t\t}\n\n\t\t\tif (message === false) {\n\t\t\t\tresolve();\n\t\t\t} else if (message instanceof Error) {\n\t\t\t\treject(message);\n\t\t\t} else {\n\t\t\t\ttimeoutError.message = message ?? `Promise timed out after ${milliseconds} milliseconds`;\n\t\t\t\treject(timeoutError);\n\t\t\t}\n\t\t}, milliseconds);\n\t});\n\n\t// eslint-disable-next-line promise/prefer-await-to-then\n\tconst cancelablePromise = wrappedPromise.finally(() => {\n\t\tcancelablePromise.clear();\n\t\tif (abortHandler && signal) {\n\t\t\tsignal.removeEventListener('abort', abortHandler);\n\t\t}\n\t});\n\n\tcancelablePromise.clear = () => {\n\t\t// `.call(undefined, ...)` is needed for custom timers to avoid context issues\n\t\tcustomTimers.clearTimeout.call(undefined, timer);\n\t\ttimer = undefined;\n\t};\n\n\treturn cancelablePromise;\n}\n","// Port of lower_bound from https://en.cppreference.com/w/cpp/algorithm/lower_bound\n// Used to compute insertion index to keep queue sorted after insertion\nexport default function lowerBound(array, value, comparator) {\n let first = 0;\n let count = array.length;\n while (count > 0) {\n const step = Math.trunc(count / 2);\n let it = first + step;\n if (comparator(array[it], value) <= 0) {\n first = ++it;\n count -= step + 1;\n }\n else {\n count = step;\n }\n }\n return first;\n}\n","import lowerBound from './lower-bound.js';\nexport default class PriorityQueue {\n #queue = [];\n enqueue(run, options) {\n const { priority = 0, id, } = options ?? {};\n const element = {\n priority,\n id,\n run,\n };\n if (this.size === 0 || this.#queue[this.size - 1].priority >= priority) {\n this.#queue.push(element);\n return;\n }\n const index = lowerBound(this.#queue, element, (a, b) => b.priority - a.priority);\n this.#queue.splice(index, 0, element);\n }\n setPriority(id, priority) {\n const index = this.#queue.findIndex((element) => element.id === id);\n if (index === -1) {\n throw new ReferenceError(`No promise function with the id \"${id}\" exists in the queue.`);\n }\n const [item] = this.#queue.splice(index, 1);\n this.enqueue(item.run, { priority, id });\n }\n dequeue() {\n const item = this.#queue.shift();\n return item?.run;\n }\n filter(options) {\n return this.#queue.filter((element) => element.priority === options.priority).map((element) => element.run);\n }\n get size() {\n return this.#queue.length;\n }\n}\n","import { EventEmitter } from 'eventemitter3';\nimport pTimeout from 'p-timeout';\nimport PriorityQueue from './priority-queue.js';\n/**\nPromise queue with concurrency control.\n*/\nexport default class PQueue extends EventEmitter {\n #carryoverIntervalCount;\n #isIntervalIgnored;\n #intervalCount = 0;\n #intervalCap;\n #rateLimitedInInterval = false;\n #rateLimitFlushScheduled = false;\n #interval;\n #intervalEnd = 0;\n #lastExecutionTime = 0;\n #intervalId;\n #timeoutId;\n #queue;\n #queueClass;\n #pending = 0;\n // The `!` is needed because of https://github.com/microsoft/TypeScript/issues/32194\n #concurrency;\n #isPaused;\n // Use to assign a unique identifier to a promise function, if not explicitly specified\n #idAssigner = 1n;\n // Track currently running tasks for debugging\n #runningTasks = new Map();\n /**\n Get or set the default timeout for all tasks. Can be changed at runtime.\n\n Operations will throw a `TimeoutError` if they don't complete within the specified time.\n\n The timeout begins when the operation is dequeued and starts execution, not while it's waiting in the queue.\n\n @example\n ```\n const queue = new PQueue({timeout: 5000});\n\n // Change timeout for all future tasks\n queue.timeout = 10000;\n ```\n */\n timeout;\n constructor(options) {\n super();\n // eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n options = {\n carryoverIntervalCount: false,\n intervalCap: Number.POSITIVE_INFINITY,\n interval: 0,\n concurrency: Number.POSITIVE_INFINITY,\n autoStart: true,\n queueClass: PriorityQueue,\n ...options,\n };\n if (!(typeof options.intervalCap === 'number' && options.intervalCap >= 1)) {\n throw new TypeError(`Expected \\`intervalCap\\` to be a number from 1 and up, got \\`${options.intervalCap?.toString() ?? ''}\\` (${typeof options.intervalCap})`);\n }\n if (options.interval === undefined || !(Number.isFinite(options.interval) && options.interval >= 0)) {\n throw new TypeError(`Expected \\`interval\\` to be a finite number >= 0, got \\`${options.interval?.toString() ?? ''}\\` (${typeof options.interval})`);\n }\n // TODO: Remove this fallback in the next major version\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n this.#carryoverIntervalCount = options.carryoverIntervalCount ?? options.carryoverConcurrencyCount ?? false;\n this.#isIntervalIgnored = options.intervalCap === Number.POSITIVE_INFINITY || options.interval === 0;\n this.#intervalCap = options.intervalCap;\n this.#interval = options.interval;\n this.#queue = new options.queueClass();\n this.#queueClass = options.queueClass;\n this.concurrency = options.concurrency;\n if (options.timeout !== undefined && !(Number.isFinite(options.timeout) && options.timeout > 0)) {\n throw new TypeError(`Expected \\`timeout\\` to be a positive finite number, got \\`${options.timeout}\\` (${typeof options.timeout})`);\n }\n this.timeout = options.timeout;\n this.#isPaused = options.autoStart === false;\n this.#setupRateLimitTracking();\n }\n get #doesIntervalAllowAnother() {\n return this.#isIntervalIgnored || this.#intervalCount < this.#intervalCap;\n }\n get #doesConcurrentAllowAnother() {\n return this.#pending < this.#concurrency;\n }\n #next() {\n this.#pending--;\n if (this.#pending === 0) {\n this.emit('pendingZero');\n }\n this.#tryToStartAnother();\n this.emit('next');\n }\n #onResumeInterval() {\n this.#onInterval(); // Already schedules update\n this.#initializeIntervalIfNeeded();\n this.#timeoutId = undefined;\n }\n get #isIntervalPaused() {\n const now = Date.now();\n if (this.#intervalId === undefined) {\n const delay = this.#intervalEnd - now;\n if (delay < 0) {\n // If the interval has expired while idle, check if we should enforce the interval\n // from the last task execution. This ensures proper spacing between tasks even\n // when the queue becomes empty and then new tasks are added.\n if (this.#lastExecutionTime > 0) {\n const timeSinceLastExecution = now - this.#lastExecutionTime;\n if (timeSinceLastExecution < this.#interval) {\n // Not enough time has passed since the last task execution\n this.#createIntervalTimeout(this.#interval - timeSinceLastExecution);\n return true;\n }\n }\n // Enough time has passed or no previous execution, allow execution\n this.#intervalCount = (this.#carryoverIntervalCount) ? this.#pending : 0;\n }\n else {\n // Act as the interval is pending\n this.#createIntervalTimeout(delay);\n return true;\n }\n }\n return false;\n }\n #createIntervalTimeout(delay) {\n if (this.#timeoutId !== undefined) {\n return;\n }\n this.#timeoutId = setTimeout(() => {\n this.#onResumeInterval();\n }, delay);\n }\n #clearIntervalTimer() {\n if (this.#intervalId) {\n clearInterval(this.#intervalId);\n this.#intervalId = undefined;\n }\n }\n #clearTimeoutTimer() {\n if (this.#timeoutId) {\n clearTimeout(this.#timeoutId);\n this.#timeoutId = undefined;\n }\n }\n #tryToStartAnother() {\n if (this.#queue.size === 0) {\n // We can clear the interval (\"pause\")\n // Because we can redo it later (\"resume\")\n this.#clearIntervalTimer();\n this.emit('empty');\n if (this.#pending === 0) {\n // Clear timeout as well when completely idle\n this.#clearTimeoutTimer();\n this.emit('idle');\n }\n return false;\n }\n let taskStarted = false;\n if (!this.#isPaused) {\n const canInitializeInterval = !this.#isIntervalPaused;\n if (this.#doesIntervalAllowAnother && this.#doesConcurrentAllowAnother) {\n const job = this.#queue.dequeue();\n // Increment interval count immediately to prevent race conditions\n if (!this.#isIntervalIgnored) {\n this.#intervalCount++;\n this.#scheduleRateLimitUpdate();\n }\n this.emit('active');\n this.#lastExecutionTime = Date.now();\n job();\n if (canInitializeInterval) {\n this.#initializeIntervalIfNeeded();\n }\n taskStarted = true;\n }\n }\n return taskStarted;\n }\n #initializeIntervalIfNeeded() {\n if (this.#isIntervalIgnored || this.#intervalId !== undefined) {\n return;\n }\n this.#intervalId = setInterval(() => {\n this.#onInterval();\n }, this.#interval);\n this.#intervalEnd = Date.now() + this.#interval;\n }\n #onInterval() {\n if (this.#intervalCount === 0 && this.#pending === 0 && this.#intervalId) {\n this.#clearIntervalTimer();\n }\n this.#intervalCount = this.#carryoverIntervalCount ? this.#pending : 0;\n this.#processQueue();\n this.#scheduleRateLimitUpdate();\n }\n /**\n Executes all queued functions until it reaches the limit.\n */\n #processQueue() {\n // eslint-disable-next-line no-empty\n while (this.#tryToStartAnother()) { }\n }\n get concurrency() {\n return this.#concurrency;\n }\n set concurrency(newConcurrency) {\n if (!(typeof newConcurrency === 'number' && newConcurrency >= 1)) {\n throw new TypeError(`Expected \\`concurrency\\` to be a number from 1 and up, got \\`${newConcurrency}\\` (${typeof newConcurrency})`);\n }\n this.#concurrency = newConcurrency;\n this.#processQueue();\n }\n async #throwOnAbort(signal) {\n return new Promise((_resolve, reject) => {\n signal.addEventListener('abort', () => {\n reject(signal.reason);\n }, { once: true });\n });\n }\n /**\n Updates the priority of a promise function by its id, affecting its execution order. Requires a defined concurrency limit to take effect.\n\n For example, this can be used to prioritize a promise function to run earlier.\n\n ```js\n import PQueue from 'p-queue';\n\n const queue = new PQueue({concurrency: 1});\n\n queue.add(async () => '🦄', {priority: 1});\n queue.add(async () => '🦀', {priority: 0, id: '🦀'});\n queue.add(async () => '🦄', {priority: 1});\n queue.add(async () => '🦄', {priority: 1});\n\n queue.setPriority('🦀', 2);\n ```\n\n In this case, the promise function with `id: '🦀'` runs second.\n\n You can also deprioritize a promise function to delay its execution:\n\n ```js\n import PQueue from 'p-queue';\n\n const queue = new PQueue({concurrency: 1});\n\n queue.add(async () => '🦄', {priority: 1});\n queue.add(async () => '🦀', {priority: 1, id: '🦀'});\n queue.add(async () => '🦄');\n queue.add(async () => '🦄', {priority: 0});\n\n queue.setPriority('🦀', -1);\n ```\n Here, the promise function with `id: '🦀'` executes last.\n */\n setPriority(id, priority) {\n if (typeof priority !== 'number' || !Number.isFinite(priority)) {\n throw new TypeError(`Expected \\`priority\\` to be a finite number, got \\`${priority}\\` (${typeof priority})`);\n }\n this.#queue.setPriority(id, priority);\n }\n async add(function_, options = {}) {\n // In case `id` is not defined.\n options.id ??= (this.#idAssigner++).toString();\n options = {\n timeout: this.timeout,\n ...options,\n };\n return new Promise((resolve, reject) => {\n // Create a unique symbol for tracking this task\n const taskSymbol = Symbol(`task-${options.id}`);\n this.#queue.enqueue(async () => {\n this.#pending++;\n // Track this running task\n this.#runningTasks.set(taskSymbol, {\n id: options.id,\n priority: options.priority ?? 0, // Match priority-queue default\n startTime: Date.now(),\n timeout: options.timeout,\n });\n try {\n // Check abort signal - if aborted, need to decrement the counter\n // that was incremented in tryToStartAnother\n try {\n options.signal?.throwIfAborted();\n }\n catch (error) {\n // Decrement the counter that was already incremented\n if (!this.#isIntervalIgnored) {\n this.#intervalCount--;\n }\n // Clean up tracking before throwing\n this.#runningTasks.delete(taskSymbol);\n throw error;\n }\n let operation = function_({ signal: options.signal });\n if (options.timeout) {\n operation = pTimeout(Promise.resolve(operation), {\n milliseconds: options.timeout,\n message: `Task timed out after ${options.timeout}ms (queue has ${this.#pending} running, ${this.#queue.size} waiting)`,\n });\n }\n if (options.signal) {\n operation = Promise.race([operation, this.#throwOnAbort(options.signal)]);\n }\n const result = await operation;\n resolve(result);\n this.emit('completed', result);\n }\n catch (error) {\n reject(error);\n this.emit('error', error);\n }\n finally {\n // Remove from running tasks\n this.#runningTasks.delete(taskSymbol);\n // Use queueMicrotask to prevent deep recursion while maintaining timing\n queueMicrotask(() => {\n this.#next();\n });\n }\n }, options);\n this.emit('add');\n this.#tryToStartAnother();\n });\n }\n async addAll(functions, options) {\n return Promise.all(functions.map(async (function_) => this.add(function_, options)));\n }\n /**\n Start (or resume) executing enqueued tasks within concurrency limit. No need to call this if queue is not paused (via `options.autoStart = false` or by `.pause()` method.)\n */\n start() {\n if (!this.#isPaused) {\n return this;\n }\n this.#isPaused = false;\n this.#processQueue();\n return this;\n }\n /**\n Put queue execution on hold.\n */\n pause() {\n this.#isPaused = true;\n }\n /**\n Clear the queue.\n */\n clear() {\n this.#queue = new this.#queueClass();\n // Note: We don't clear #runningTasks as those tasks are still running\n // They will be removed when they complete in the finally block\n // Force synchronous update since clear() should have immediate effect\n this.#updateRateLimitState();\n }\n /**\n Can be called multiple times. Useful if you for example add additional items at a later time.\n\n @returns A promise that settles when the queue becomes empty.\n */\n async onEmpty() {\n // Instantly resolve if the queue is empty\n if (this.#queue.size === 0) {\n return;\n }\n await this.#onEvent('empty');\n }\n /**\n @returns A promise that settles when the queue size is less than the given limit: `queue.size < limit`.\n\n If you want to avoid having the queue grow beyond a certain size you can `await queue.onSizeLessThan()` before adding a new item.\n\n Note that this only limits the number of items waiting to start. There could still be up to `concurrency` jobs already running that this call does not include in its calculation.\n */\n async onSizeLessThan(limit) {\n // Instantly resolve if the queue is empty.\n if (this.#queue.size < limit) {\n return;\n }\n await this.#onEvent('next', () => this.#queue.size < limit);\n }\n /**\n The difference with `.onEmpty` is that `.onIdle` guarantees that all work from the queue has finished. `.onEmpty` merely signals that the queue is empty, but it could mean that some promises haven't completed yet.\n\n @returns A promise that settles when the queue becomes empty, and all promises have completed; `queue.size === 0 && queue.pending === 0`.\n */\n async onIdle() {\n // Instantly resolve if none pending and if nothing else is queued\n if (this.#pending === 0 && this.#queue.size === 0) {\n return;\n }\n await this.#onEvent('idle');\n }\n /**\n The difference with `.onIdle` is that `.onPendingZero` only waits for currently running tasks to finish, ignoring queued tasks.\n\n @returns A promise that settles when all currently running tasks have completed; `queue.pending === 0`.\n */\n async onPendingZero() {\n if (this.#pending === 0) {\n return;\n }\n await this.#onEvent('pendingZero');\n }\n /**\n @returns A promise that settles when the queue becomes rate-limited due to intervalCap.\n */\n async onRateLimit() {\n if (this.isRateLimited) {\n return;\n }\n await this.#onEvent('rateLimit');\n }\n /**\n @returns A promise that settles when the queue is no longer rate-limited.\n */\n async onRateLimitCleared() {\n if (!this.isRateLimited) {\n return;\n }\n await this.#onEvent('rateLimitCleared');\n }\n /**\n @returns A promise that rejects when any task in the queue errors.\n\n Use with `Promise.race([queue.onError(), queue.onIdle()])` to fail fast on the first error while still resolving normally when the queue goes idle.\n\n Important: The promise returned by `add()` still rejects. You must handle each `add()` promise (for example, `.catch(() => {})`) to avoid unhandled rejections.\n\n @example\n ```\n import PQueue from 'p-queue';\n\n const queue = new PQueue({concurrency: 2});\n\n queue.add(() => fetchData(1)).catch(() => {});\n queue.add(() => fetchData(2)).catch(() => {});\n queue.add(() => fetchData(3)).catch(() => {});\n\n // Stop processing on first error\n try {\n await Promise.race([\n queue.onError(),\n queue.onIdle()\n ]);\n } catch (error) {\n queue.pause(); // Stop processing remaining tasks\n console.error('Queue failed:', error);\n }\n ```\n */\n // eslint-disable-next-line @typescript-eslint/promise-function-async\n async onError() {\n return new Promise((_resolve, reject) => {\n const handleError = (error) => {\n this.off('error', handleError);\n reject(error);\n };\n this.on('error', handleError);\n });\n }\n async #onEvent(event, filter) {\n return new Promise(resolve => {\n const listener = () => {\n if (filter && !filter()) {\n return;\n }\n this.off(event, listener);\n resolve();\n };\n this.on(event, listener);\n });\n }\n /**\n Size of the queue, the number of queued items waiting to run.\n */\n get size() {\n return this.#queue.size;\n }\n /**\n Size of the queue, filtered by the given options.\n\n For example, this can be used to find the number of items remaining in the queue with a specific priority level.\n */\n sizeBy(options) {\n // eslint-disable-next-line unicorn/no-array-callback-reference\n return this.#queue.filter(options).length;\n }\n /**\n Number of running items (no longer in the queue).\n */\n get pending() {\n return this.#pending;\n }\n /**\n Whether the queue is currently paused.\n */\n get isPaused() {\n return this.#isPaused;\n }\n #setupRateLimitTracking() {\n // Only schedule updates when rate limiting is enabled\n if (this.#isIntervalIgnored) {\n return;\n }\n // Wire up to lifecycle events that affect rate limit state\n // Only 'add' and 'next' can actually change rate limit state\n this.on('add', () => {\n if (this.#queue.size > 0) {\n this.#scheduleRateLimitUpdate();\n }\n });\n this.on('next', () => {\n this.#scheduleRateLimitUpdate();\n });\n }\n #scheduleRateLimitUpdate() {\n // Skip if rate limiting is not enabled or already scheduled\n if (this.#isIntervalIgnored || this.#rateLimitFlushScheduled) {\n return;\n }\n this.#rateLimitFlushScheduled = true;\n queueMicrotask(() => {\n this.#rateLimitFlushScheduled = false;\n this.#updateRateLimitState();\n });\n }\n #updateRateLimitState() {\n const previous = this.#rateLimitedInInterval;\n const shouldBeRateLimited = !this.#isIntervalIgnored\n && this.#intervalCount >= this.#intervalCap\n && this.#queue.size > 0;\n if (shouldBeRateLimited !== previous) {\n this.#rateLimitedInInterval = shouldBeRateLimited;\n this.emit(shouldBeRateLimited ? 'rateLimit' : 'rateLimitCleared');\n }\n }\n /**\n Whether the queue is currently rate-limited due to intervalCap.\n */\n get isRateLimited() {\n return this.#rateLimitedInInterval;\n }\n /**\n Whether the queue is saturated. Returns `true` when:\n - All concurrency slots are occupied and tasks are waiting, OR\n - The queue is rate-limited and tasks are waiting\n\n Useful for detecting backpressure and potential hanging tasks.\n\n ```js\n import PQueue from 'p-queue';\n\n const queue = new PQueue({concurrency: 2});\n\n // Backpressure handling\n if (queue.isSaturated) {\n console.log('Queue is saturated, waiting for capacity...');\n await queue.onSizeLessThan(queue.concurrency);\n }\n\n // Monitoring for stuck tasks\n setInterval(() => {\n if (queue.isSaturated) {\n console.warn(`Queue saturated: ${queue.pending} running, ${queue.size} waiting`);\n }\n }, 60000);\n ```\n */\n get isSaturated() {\n return (this.#pending === this.#concurrency && this.#queue.size > 0)\n || (this.isRateLimited && this.#queue.size > 0);\n }\n /**\n The tasks currently being executed. Each task includes its `id`, `priority`, `startTime`, and `timeout` (if set).\n\n Returns an array of task info objects.\n\n ```js\n import PQueue from 'p-queue';\n\n const queue = new PQueue({concurrency: 2});\n\n // Add tasks with IDs for better debugging\n queue.add(() => fetchUser(123), {id: 'user-123'});\n queue.add(() => fetchPosts(456), {id: 'posts-456', priority: 1});\n\n // Check what's running\n console.log(queue.runningTasks);\n // => [{\n // id: 'user-123',\n // priority: 0,\n // startTime: 1759253001716,\n // timeout: undefined\n // }, {\n // id: 'posts-456',\n // priority: 1,\n // startTime: 1759253001916,\n // timeout: undefined\n // }]\n ```\n */\n get runningTasks() {\n // Return fresh array with fresh objects to prevent mutations\n return [...this.#runningTasks.values()].map(task => ({ ...task }));\n }\n}\n/**\nError thrown when a task times out.\n\n@example\n```\nimport PQueue, {TimeoutError} from 'p-queue';\n\nconst queue = new PQueue({timeout: 1000});\n\ntry {\n await queue.add(() => someTask());\n} catch (error) {\n if (error instanceof TimeoutError) {\n console.log('Task timed out');\n }\n}\n```\n*/\nexport { TimeoutError } from 'p-timeout';\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.instanceOfHashable = exports.guessType = exports.guessObjectType = exports.TYPE_MAP = void 0;\n/**\n * Type mapping rules.\n */\nexports.TYPE_MAP = {\n Array: 'array',\n Int8Array: 'typedarray',\n Uint8Array: 'typedarray',\n Uint8ClampedArray: 'typedarray',\n Int16Array: 'typedarray',\n Uint16Array: 'typedarray',\n Int32Array: 'typedarray',\n Uint32Array: 'typedarray',\n Float32Array: 'typedarray',\n Float64Array: 'typedarray',\n BigUint64Array: 'typedarray',\n BigInt64Array: 'typedarray',\n Buffer: 'typedarray',\n Map: 'map',\n Set: 'set',\n Date: 'date',\n String: 'string',\n Number: 'number',\n BigInt: 'bigint',\n Boolean: 'boolean',\n Object: 'object',\n};\n/**\n * Guess object type\n * @param obj analyzed object\n * @return object type\n */\nconst guessObjectType = (obj) => {\n if (obj === null) {\n return 'null';\n }\n if ((0, exports.instanceOfHashable)(obj)) {\n return 'hashable';\n }\n const type = obj?.constructor?.name ?? 'unknown';\n return exports.TYPE_MAP[type] || 'unknown';\n};\nexports.guessObjectType = guessObjectType;\n/**\n * Guess variable type\n * @param obj analyzed variable\n * @return variable type\n */\nconst guessType = (obj) => {\n const type = typeof obj;\n return type !== 'object' ? type : (0, exports.guessObjectType)(obj);\n};\nexports.guessType = guessType;\n/**\n * Identify if object is instance of Hashable interface\n * @param object analyzed variable\n * @return true if object has toHashableString property and this property is function\n * otherwise return false\n */\nconst instanceOfHashable = (object) => {\n return typeof object.toHashableString === 'function';\n};\nexports.instanceOfHashable = instanceOfHashable;\n//# sourceMappingURL=typeGuess.js.map","\"use strict\";\n/* eslint-disable @typescript-eslint/no-explicit-any */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports._mapSort = exports._map = exports._objectSort = exports._object = exports._setCoerce = exports._set = exports._setSort = exports._setSortCoerce = exports._typedArray = exports._typedArraySort = exports._array = exports._arraySort = exports._date = exports._dateCoerce = exports._functionTrim = exports._functionTrimCoerce = exports._function = exports._functionCoerce = exports._null = exports._nullCoerce = exports._undefined = exports._undefinedCoerce = exports._symbol = exports._symbolCoerce = exports._boolean = exports._booleanCoerce = exports._bigInt = exports._bigIntCoerce = exports._number = exports._numberCoerce = exports._stringTrim = exports._stringTrimCoerce = exports._string = exports._stringCoerce = exports._hashable = exports.PREFIX = void 0;\nconst typeGuess_1 = require(\"./typeGuess\");\n/**\n * Prefixes that used when type coercion is disabled\n */\nexports.PREFIX = {\n string: '<:s>',\n number: '<:n>',\n bigint: '<:bi>',\n boolean: '<:b>',\n symbol: '<:smbl>',\n undefined: '<:undf>',\n null: '<:null>',\n function: '<:func>',\n array: '',\n date: '<:date>',\n set: '<:set>',\n map: '<:map>',\n};\n/**\n * Converts Hashable to string\n * @private\n * @param obj object to convert\n * @returns object string representation\n */\nfunction _hashable(obj) {\n return obj.toHashableString();\n}\nexports._hashable = _hashable;\n/**\n * Converts string to string\n * @private\n * @param obj object to convert\n * @return object string representation\n */\nfunction _stringCoerce(obj) {\n return obj;\n}\nexports._stringCoerce = _stringCoerce;\n/**\n * Converts string to string\n * @private\n * @param obj object to convert\n * @return object string representation\n */\nfunction _string(obj) {\n return exports.PREFIX.string + ':' + obj;\n}\nexports._string = _string;\n/**\n * Converts string to string\n * @private\n * @param obj object to convert\n * @return object string representation\n */\nfunction _stringTrimCoerce(obj) {\n return obj.replace(/(\\s+|\\t|\\r\\n|\\n|\\r)/gm, ' ').trim();\n}\nexports._stringTrimCoerce = _stringTrimCoerce;\n/**\n * Converts string to string\n * @private\n * @param obj object to convert\n * @return object string representation\n */\nfunction _stringTrim(obj) {\n return exports.PREFIX.string + ':' + obj.replace(/(\\s+|\\t|\\r\\n|\\n|\\r)/gm, ' ').trim();\n}\nexports._stringTrim = _stringTrim;\n/**\n * Converts number to string\n * @private\n * @param obj object to convert\n * @return object string representation\n */\nfunction _numberCoerce(obj) {\n return obj.toString();\n}\nexports._numberCoerce = _numberCoerce;\n/**\n * Converts number to string\n * @private\n * @param obj object to convert\n * @return object string representation\n */\nfunction _number(obj) {\n return `${exports.PREFIX.number}:${obj}`;\n}\nexports._number = _number;\n/**\n * Converts BigInt to string\n * @private\n * @param obj object to convert\n * @return object string representation\n */\nfunction _bigIntCoerce(obj) {\n return obj.toString();\n}\nexports._bigIntCoerce = _bigIntCoerce;\n/**\n * Converts BigInt to string\n * @private\n * @param obj object to convert\n * @return object string representation\n */\nfunction _bigInt(obj) {\n return `${exports.PREFIX.bigint}:${obj.toString()}`;\n}\nexports._bigInt = _bigInt;\n/**\n * Converts boolean to string\n * @private\n * @param obj object to convert\n * @return object string representation\n */\nfunction _booleanCoerce(obj) {\n return obj ? '1' : '0';\n}\nexports._booleanCoerce = _booleanCoerce;\n/**\n * Converts boolean to string\n * @private\n * @param obj object to convert\n * @return object string representation\n */\nfunction _boolean(obj) {\n return exports.PREFIX.boolean + ':' + obj.toString();\n}\nexports._boolean = _boolean;\n/**\n * Converts symbol to string\n * @private\n * @param obj object to convert\n * @return object string representation\n */\nfunction _symbolCoerce() {\n return exports.PREFIX.symbol;\n}\nexports._symbolCoerce = _symbolCoerce;\n/**\n * Converts symbol to string\n * @private\n * @param obj object to convert\n * @return object string representation\n */\nfunction _symbol(obj) {\n return exports.PREFIX.symbol + ':' + obj.toString();\n}\nexports._symbol = _symbol;\n/**\n * Converts undefined to string\n * @private\n * @param obj object to convert\n * @return object string representation\n */\nfunction _undefinedCoerce() {\n return '';\n}\nexports._undefinedCoerce = _undefinedCoerce;\n/**\n * Converts undefined to string\n * @private\n * @param obj object to convert\n * @return object string representation\n */\nfunction _undefined() {\n return exports.PREFIX.undefined;\n}\nexports._undefined = _undefined;\n/**\n * Converts null to string\n * @private\n * @param obj object to convert\n * @return object string representation\n */\nfunction _nullCoerce() {\n return '';\n}\nexports._nullCoerce = _nullCoerce;\n/**\n * Converts null to string\n * @private\n * @param obj object to convert\n * @return object string representation\n */\nfunction _null() {\n return exports.PREFIX.null;\n}\nexports._null = _null;\n/**\n * Converts function to string\n * @private\n * @param obj object to convert\n * @return object string representation\n */\n// eslint-disable-next-line @typescript-eslint/ban-types\nfunction _functionCoerce(obj) {\n return obj.name + '=>' + obj.toString();\n}\nexports._functionCoerce = _functionCoerce;\n/**\n * Converts function to string\n * @private\n * @param obj object to convert\n * @return object string representation\n */\n// eslint-disable-next-line @typescript-eslint/ban-types\nfunction _function(obj) {\n return exports.PREFIX.function + ':' + obj.name + '=>' + obj.toString();\n}\nexports._function = _function;\n/**\n * Converts function to string\n * @private\n * @param obj object to convert\n * @return object string representation\n */\n// eslint-disable-next-line @typescript-eslint/ban-types\nfunction _functionTrimCoerce(obj) {\n return (obj.name +\n '=>' +\n obj\n .toString()\n .replace(/(\\s+|\\t|\\r\\n|\\n|\\r)/gm, ' ')\n .trim());\n}\nexports._functionTrimCoerce = _functionTrimCoerce;\n/**\n * Converts function to string\n * @private\n * @param obj object to convert\n * @return object string representation\n */\n// eslint-disable-next-line @typescript-eslint/ban-types\nfunction _functionTrim(obj) {\n return (exports.PREFIX.function +\n ':' +\n obj.name +\n '=>' +\n obj\n .toString()\n .replace(/(\\s+|\\t|\\r\\n|\\n|\\r)/gm, ' ')\n .trim());\n}\nexports._functionTrim = _functionTrim;\n/**\n * Converts date to string\n * @private\n * @param obj object to convert\n * @return object string representation\n */\nfunction _dateCoerce(obj) {\n return obj.toISOString();\n}\nexports._dateCoerce = _dateCoerce;\n/**\n * Converts date to string\n * @private\n * @param obj object to convert\n * @return object string representation\n */\nfunction _date(obj) {\n return exports.PREFIX.date + ':' + obj.toISOString();\n}\nexports._date = _date;\n/**\n * Converts array to string\n * @private\n * @param obj object to convert\n * @return object string representation\n */\nfunction _arraySort(obj) {\n const stringifiers = this;\n return ('[' +\n obj\n .map((item) => {\n return stringifiers[(0, typeGuess_1.guessType)(item)](item);\n })\n .sort()\n .toString() +\n ']');\n}\nexports._arraySort = _arraySort;\n/**\n * Converts array to string\n * @private\n * @param obj object to convert\n * @return object string representation\n */\nfunction _array(obj) {\n const stringifiers = this;\n return ('[' +\n obj\n .map((item) => {\n return stringifiers[(0, typeGuess_1.guessType)(item)](item);\n })\n .toString() +\n ']');\n}\nexports._array = _array;\n/**\n * Converts TypedArray to string\n * @private\n * @param obj object to convert\n * @return object string representation\n */\nfunction _typedArraySort(obj) {\n const stringifiers = this;\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-explicit-any\n const values = Array.prototype.slice.call(obj);\n return ('[' +\n values\n .map((num) => {\n return stringifiers[(0, typeGuess_1.guessType)(num)](num);\n })\n .sort()\n .toString() +\n ']');\n}\nexports._typedArraySort = _typedArraySort;\n/**\n * Converts TypedArray to string\n * @private\n * @param obj object to convert\n * @return object string representation\n */\nfunction _typedArray(obj) {\n const stringifiers = this;\n const values = Array.prototype.slice.call(obj);\n return ('[' +\n values\n .map((num) => {\n return stringifiers[(0, typeGuess_1.guessType)(num)](num);\n })\n .toString() +\n ']');\n}\nexports._typedArray = _typedArray;\n/**\n * Converts set to string\n * @private\n * @param obj object to convert\n * @return object string representation\n */\nfunction _setSortCoerce(obj) {\n return _arraySort.call(this, Array.from(obj));\n}\nexports._setSortCoerce = _setSortCoerce;\n/**\n * Converts set to string\n * @private\n * @param obj object to convert\n * @return object string representation\n */\nfunction _setSort(obj) {\n return `${exports.PREFIX.set}:${_arraySort.call(this, Array.from(obj))}`;\n}\nexports._setSort = _setSort;\n/**\n * Converts set to string\n * @private\n * @param obj object to convert\n * @return object string representation\n */\nfunction _set(obj) {\n return `${exports.PREFIX.set}:${_array.call(this, Array.from(obj))}`;\n}\nexports._set = _set;\n/**\n * Converts set to string\n * @private\n * @param obj object to convert\n * @return object string representation\n */\nfunction _setCoerce(obj) {\n return _array.call(this, Array.from(obj));\n}\nexports._setCoerce = _setCoerce;\n/**\n * Converts object to string\n * @private\n * @param obj object to convert\n * @return object string representation\n */\nfunction _object(obj) {\n const stringifiers = this;\n const keys = Object.keys(obj);\n const objArray = [];\n for (const key of keys) {\n const val = obj[key];\n const valT = (0, typeGuess_1.guessType)(val);\n objArray.push(key + ':' + stringifiers[valT](val));\n }\n return '{' + objArray.toString() + '}';\n}\nexports._object = _object;\n/**\n * Converts object to string\n * @private\n * @param obj object to convert\n * @return object string representation\n */\nfunction _objectSort(obj) {\n const stringifiers = this;\n const keys = Object.keys(obj).sort();\n const objArray = [];\n for (const key of keys) {\n const val = obj[key];\n const valT = (0, typeGuess_1.guessType)(val);\n objArray.push(key + ':' + stringifiers[valT](val));\n }\n return '{' + objArray.toString() + '}';\n}\nexports._objectSort = _objectSort;\n/**\n * Converts map to string\n * @private\n * @param obj object to convert\n * @return object string representation\n */\nfunction _map(obj) {\n const stringifiers = this;\n const arr = Array.from(obj);\n const mapped = [];\n for (const item of arr) {\n const [key, value] = item;\n mapped.push([stringifiers[(0, typeGuess_1.guessType)(key)](key), stringifiers[(0, typeGuess_1.guessType)(value)](value)]);\n }\n return '[' + mapped.join(';') + ']';\n}\nexports._map = _map;\n/**\n * Converts map to string\n * @private\n * @param obj object to convert\n * @return object string representation\n */\nfunction _mapSort(obj) {\n const stringifiers = this;\n const arr = Array.from(obj);\n const mapped = [];\n for (const item of arr) {\n const [key, value] = item;\n mapped.push([stringifiers[(0, typeGuess_1.guessType)(key)](key), stringifiers[(0, typeGuess_1.guessType)(value)](value)]);\n }\n return '[' + mapped.sort().join(';') + ']';\n}\nexports._mapSort = _mapSort;\n//# sourceMappingURL=stringifiers.js.map","\"use strict\";\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.objectSorter = void 0;\nconst str = __importStar(require(\"./stringifiers\"));\nconst typeGuess_1 = require(\"./typeGuess\");\n/**\n * Object sorter consturctor\n * @param options object transformation options\n * @return function that transforms object to strings\n */\nconst objectSorter = (options) => {\n const { sort, coerce, trim } = {\n sort: true,\n coerce: true,\n trim: false,\n ...options,\n };\n const sortOptions = {\n array: typeof sort === 'boolean' ? sort : sort?.array ?? false,\n typedArray: typeof sort === 'boolean' ? false : sort?.typedArray ?? false,\n object: typeof sort === 'boolean' ? sort : sort?.object ?? false,\n set: typeof sort === 'boolean' ? sort : sort?.set ?? false,\n map: typeof sort === 'boolean' ? sort : sort?.map ?? false,\n };\n const coerceOptions = {\n boolean: typeof coerce === 'boolean' ? coerce : coerce?.boolean ?? false,\n number: typeof coerce === 'boolean' ? coerce : coerce?.number ?? false,\n bigint: typeof coerce === 'boolean' ? coerce : coerce?.bigint ?? false,\n string: typeof coerce === 'boolean' ? coerce : coerce?.string ?? false,\n undefined: typeof coerce === 'boolean' ? coerce : coerce?.undefined ?? false,\n null: typeof coerce === 'boolean' ? coerce : coerce?.null ?? false,\n symbol: typeof coerce === 'boolean' ? coerce : coerce?.symbol ?? false,\n function: typeof coerce === 'boolean' ? coerce : coerce?.function ?? false,\n date: typeof coerce === 'boolean' ? coerce : coerce?.date ?? false,\n set: typeof coerce === 'boolean' ? coerce : coerce?.set ?? false,\n };\n const trimOptions = {\n string: typeof trim === 'boolean' ? trim : trim?.string ?? false,\n function: typeof trim === 'boolean' ? trim : trim?.function ?? false,\n };\n const stringifiers = {\n // eslint-disable-next-line @typescript-eslint/ban-types\n unknown: function _unknown(obj) {\n // `unknonw` - is a typo, saved for backward compatibility\n const constructorName = obj.constructor?.name ?? 'unknonw';\n let objectName = 'unknown';\n if (typeof obj.toString === 'function') {\n objectName = obj.toString();\n }\n else if (Object.keys(obj).length > 0) {\n objectName = JSON.stringify(obj);\n }\n return `<:${constructorName}>:${objectName}`;\n },\n };\n stringifiers['hashable'] = str._hashable.bind(stringifiers);\n if (trimOptions.string) {\n stringifiers['string'] = coerceOptions.string\n ? str._stringTrimCoerce.bind(stringifiers)\n : str._stringTrim.bind(stringifiers);\n }\n else {\n stringifiers['string'] = coerceOptions.string\n ? str._stringCoerce.bind(stringifiers)\n : str._string.bind(stringifiers);\n }\n stringifiers['number'] = coerceOptions.number\n ? str._numberCoerce.bind(stringifiers)\n : str._number.bind(stringifiers);\n stringifiers['bigint'] = coerceOptions.bigint\n ? str._bigIntCoerce.bind(stringifiers)\n : str._bigInt.bind(stringifiers);\n stringifiers['boolean'] = coerceOptions.boolean\n ? str._booleanCoerce.bind(stringifiers)\n : str._boolean.bind(stringifiers);\n stringifiers['symbol'] = coerceOptions.symbol\n ? str._symbolCoerce.bind(stringifiers)\n : str._symbol.bind(stringifiers);\n stringifiers['undefined'] = coerceOptions.undefined\n ? str._undefinedCoerce.bind(stringifiers)\n : str._undefined.bind(stringifiers);\n stringifiers['null'] = coerceOptions.null\n ? str._nullCoerce.bind(stringifiers)\n : str._null.bind(stringifiers);\n if (trimOptions.function) {\n stringifiers['function'] = coerceOptions.function\n ? str._functionTrimCoerce.bind(stringifiers)\n : str._functionTrim.bind(stringifiers);\n }\n else {\n stringifiers['function'] = coerceOptions.function\n ? str._functionCoerce.bind(stringifiers)\n : str._function.bind(stringifiers);\n }\n stringifiers['date'] = coerceOptions.date\n ? str._dateCoerce.bind(stringifiers)\n : str._date.bind(stringifiers);\n stringifiers['array'] = sortOptions.array\n ? str._arraySort.bind(stringifiers)\n : str._array.bind(stringifiers);\n stringifiers['typedarray'] = sortOptions.typedArray\n ? str._typedArraySort.bind(stringifiers)\n : str._typedArray.bind(stringifiers);\n if (sortOptions.set) {\n stringifiers['set'] = coerceOptions.set\n ? str._setSortCoerce.bind(stringifiers)\n : str._setSort.bind(stringifiers);\n }\n else {\n stringifiers['set'] = coerceOptions.set\n ? str._setCoerce.bind(stringifiers)\n : str._set.bind(stringifiers);\n }\n stringifiers['object'] = sortOptions.object\n ? str._objectSort.bind(stringifiers)\n : str._object.bind(stringifiers);\n stringifiers['map'] = sortOptions.map\n ? str._mapSort.bind(stringifiers)\n : str._map.bind(stringifiers);\n /**\n * Serializes object to string\n * @param obj object\n */\n function objectToString(obj) {\n return stringifiers[(0, typeGuess_1.guessType)(obj)](obj);\n }\n return objectToString;\n};\nexports.objectSorter = objectSorter;\n//# sourceMappingURL=objectSorter.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.hasher = void 0;\nconst crypto_1 = require(\"crypto\");\nconst objectSorter_1 = require(\"./objectSorter\");\n/**\n * Default hash algorithm\n */\nconst DEFAULT_ALG = 'sha256';\n/**\n * Default hash string enoding\n */\nconst DEFAULT_ENC = 'hex';\n/**\n * Hasher constructor\n * @param options hasher options\n * @return hasher instance\n */\nconst hasher = (options) => {\n const sortObject = (0, objectSorter_1.objectSorter)(options);\n /**\n * Object hash function\n * @param obj object to hash\n * @param opts hasher options\n * @returns hash string\n */\n const hash = (obj, opts) => {\n const alg = opts?.alg || options?.alg || DEFAULT_ALG;\n const enc = opts?.enc || options?.enc || DEFAULT_ENC;\n const sorted = sortObject(obj);\n return (0, crypto_1.createHash)(alg).update(sorted).digest(enc);\n };\n return {\n hash,\n sort: sortObject,\n sortObject,\n };\n};\nexports.hasher = hasher;\n//# sourceMappingURL=hasher.js.map","import { hasher } from \"node-object-hash\";\n\n/**\n * Hash function for creating consistent, deterministic hashes from JavaScript objects.\n * Used primarily for generating cache keys and ensuring object equality checks.\n *\n * @param obj - Any JavaScript object to hash\n * @returns String hash of the object\n */\nconst { hash } = hasher({\n\tsort: true, // Ensures consistent order for object properties\n\tcoerce: true, // Converts values to a consistent type (e.g., numbers to strings)\n});\n\nexport default hash;\n","import PQueue from \"p-queue\";\nimport type { CacheContainer } from \"./cacheContainer.ts\";\nimport hash from \"./hash.ts\";\n\nconst revalidationQueues: Record<string, PQueue> = {};\n\ntype WithCacheOptions<Parameters, Result> = {\n\t/** An optional prefix to prepend to the cache key for namespacing purposes */\n\tprefix?: string;\n\t/** An optional function to calculate a cache key based on the function parameters. Defaults to hashing the parameters */\n\tcalculateKey?: (input: Parameters) => string;\n\t/** An optional predicate function to determine whether a result should be cached. Useful for filtering out error responses or invalid data */\n\tshouldStore?: (result: Awaited<Result>) => boolean;\n\t/**\n\t * Concurrency limit for background revalidation tasks in the queue\n\t * @default 1\n\t */\n\trevalidationConcurrency?: number;\n\t/**\n\t * Time in milliseconds after which cached content is considered \"expired\" and no longer fresh.\n\t * During this period, cached content is returned immediately without revalidation.\n\t * When set to 0 along with staleTimeMs=0, caching is disabled entirely.\n\t * @default 0 (no caching)\n\t */\n\tcacheTimeMs?: number;\n\t/**\n\t * Time in milliseconds after which cached content is considered \"stale\".\n\t * Used for Stale-While-Revalidate: stale content is returned immediately while revalidation happens in the background.\n\t * Must be greater than cacheTimeMs to be effective. When both cacheTimeMs and staleTimeMs are 0, caching is disabled.\n\t * @default 0 (no stale caching)\n\t */\n\tstaleTimeMs?: number;\n};\n\n/**\n * Creates a withCache wrapper function for a specific cache container.\n * Implements Stale-While-Revalidate (SWR) caching strategy:\n * - Fresh content (within cacheTimeMs): returned immediately without revalidation\n * - Stale content (within staleTimeMs after expiration): returned immediately while revalidating in background\n * - Expired content (beyond staleTimeMs): waits for fresh revalidation\n * - No caching (when cacheTimeMs=0 and staleTimeMs=0): function executes every time\n *\n * @param container - The cache container instance to store and retrieve cached values\n * @returns A withCache function bound to the provided container\n */\nexport const withCacheFactory = (container: CacheContainer) => {\n\t/**\n\t * Wraps an async function with caching and Stale-While-Revalidate (SWR) logic.\n\t * Multiple concurrent calls with the same parameters share the same cache entry and revalidation queue.\n\t *\n\t * @param operation - The async function to wrap with caching\n\t * @param options - Caching and revalidation options\n\t * @returns An async wrapper function that returns cached or freshly computed results\n\t */\n\tconst withCache = <\n\t\tParameters extends Array<unknown>,\n\t\tResult extends Promise<unknown>,\n\t>(\n\t\toperation: (...parameters: Parameters) => Result,\n\t\t{\n\t\t\tcacheTimeMs = 0,\n\t\t\tstaleTimeMs = 0,\n\t\t\tcalculateKey = hash,\n\t\t\trevalidationConcurrency: concurrency = 1,\n\t\t\tprefix = \"default\",\n\t\t\tshouldStore = () => true,\n\t\t}: WithCacheOptions<Parameters, Result> = {},\n\t) => {\n\t\treturn async (...parameters: Parameters): Promise<Result> => {\n\t\t\tconst key = `${operation.name}:${prefix}:${\n\t\t\t\tcalculateKey ? calculateKey(parameters) : hash(parameters)\n\t\t\t}` as const;\n\n\t\t\tconst queueName = `${operation.name}:${prefix}` as const;\n\n\t\t\trevalidationQueues[queueName] =\n\t\t\t\trevalidationQueues[queueName] ??\n\t\t\t\tnew PQueue({\n\t\t\t\t\tconcurrency,\n\t\t\t\t});\n\t\t\trevalidationQueues[queueName].concurrency = concurrency;\n\n\t\t\tconst cachedResponse = await container.getItem<Awaited<Result>>(key);\n\n\t\t\tconst refreshedItem = async () => {\n\t\t\t\tconst result = await operation(...parameters);\n\t\t\t\tif (shouldStore(result)) {\n\t\t\t\t\tawait container.setItem(key, result, {\n\t\t\t\t\t\tttl: cacheTimeMs,\n\t\t\t\t\t\tstaleTtl: staleTimeMs,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\treturn result;\n\t\t\t};\n\n\t\t\t/**\n\t\t\t * The easiest case: no caching at all\n\t\t\t */\n\t\t\tif (cacheTimeMs === 0 && staleTimeMs === 0) {\n\t\t\t\treturn operation(...parameters);\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * The easy case: we have a valid cached response\n\t\t\t */\n\t\t\tif (cachedResponse && !cachedResponse.meta.expired) {\n\t\t\t\treturn cachedResponse.content;\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Stale-While-Revalidate strategy:\n\t\t\t * If the cached response is expired but stale\n\t\t\t * we return the stale value immediately and revalidate in the background\n\t\t\t */\n\t\t\tif (cachedResponse?.meta.expired && cachedResponse?.meta.stale) {\n\t\t\t\tif (\n\t\t\t\t\t!revalidationQueues[queueName].runningTasks.some(\n\t\t\t\t\t\t(t) => t.id === key && t.startTime,\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\trevalidationQueues[queueName].add(refreshedItem, {\n\t\t\t\t\t\tid: key,\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\treturn cachedResponse.content;\n\t\t\t}\n\n\t\t\tconst result = await refreshedItem();\n\t\t\treturn result;\n\t\t};\n\t};\n\treturn withCache;\n};\n"],"x_google_ignoreList":[3,4,5,6,7,8,9,10,11,12,13,14,15,16,18,19,20,21,22,23,24,25,26,27],"mappings":"2nBAEA,MAAaA,EAAQC,EAAO,gBAAgB,CC0B5C,IAAa,EAAb,KAA4B,CAC3B,YAAY,EAA0B,CAAlB,KAAA,QAAA,EAEpB,MAAa,QAAW,EAMtB,CACD,IAAM,EAAO,MAAM,KAAK,QAAQ,QAAQ,EAAI,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CACjC,IAAM,EAAS,MAAM,EAAU,GAAG,EAAW,CAO7C,OANI,EAAY,EAAO,EACtB,MAAM,EAAU,QAAQ,EAAK,EAAQ,CACpC,IAAK,EACL,SAAU,EACV,CAAC,CAEI,GAqCR,OA/BI,IAAgB,GAAK,IAAgB,EACjC,EAAU,GAAG,EAAW,CAM5B,GAAkB,CAAC,EAAe,KAAK,QACnC,EAAe,QAQnB,GAAgB,KAAK,SAAW,GAAgB,KAAK,OAEtD,EAAmB,GAAW,aAAa,KAC1C,GAAM,EAAE,KAAO,GAAO,EAAE,UACzB,EAED,EAAmB,GAAW,IAAI,EAAe,CAChD,GAAI,EACJ,CAAC,CAGI,EAAe,SAGR,MAAM,GAAe"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["debug","_debug","storage: Storage","meta: CachedItem<typeof content>[\"meta\"]","DEFAULT_COMPARATOR","reverseComparator","forEach","k","comparators","forEach","DEFAULT_COMPARATOR","reverseComparator","FibonacciHeap","MaxFibonacciHeap","forEach","typed","forEach","iterables","compare","Heap","MaxHeap","k","SuffixArray","GeneralizedSuffixArray","Iterator","Iterator","forEach","iterables","typed","Vector","k","forEach","typed","iterables","LRUCache","forEach","typed","iterables","LRUMap","LRUMapWithDelete","FibonacciHeap","Heap","SuffixArray","Vector","LRUMapWithDelete","EventEmitter","#queue","EventEmitter","#carryoverIntervalCount","#isIntervalIgnored","#intervalCap","#interval","#queue","#queueClass","#isPaused","#setupRateLimitTracking","#doesIntervalAllowAnother","#intervalCount","#doesConcurrentAllowAnother","#pending","#concurrency","#tryToStartAnother","#onInterval","#initializeIntervalIfNeeded","#timeoutId","#isIntervalPaused","#intervalId","#intervalEnd","#lastExecutionTime","#createIntervalTimeout","#onResumeInterval","#clearIntervalTimer","#clearTimeoutTimer","#scheduleRateLimitUpdate","#processQueue","#throwOnAbort","#idAssigner","#runningTasks","#next","#updateRateLimitState","#onEvent","#rateLimitFlushScheduled","#rateLimitedInInterval","typeGuess_1","k","sort","hasher","hash","revalidationQueues: Record<string, PQueue>","hash","prefix"],"sources":["../src/debug.ts","../src/cacheContainer.ts","../src/fallbackStorage.ts","../node_modules/mnemonist/utils/comparators.js","../node_modules/obliterator/support.js","../node_modules/obliterator/foreach.js","../node_modules/mnemonist/fibonacci-heap.js","../node_modules/mnemonist/utils/typed-arrays.js","../node_modules/mnemonist/utils/iterables.js","../node_modules/mnemonist/heap.js","../node_modules/mnemonist/suffix-array.js","../node_modules/obliterator/iterator.js","../node_modules/mnemonist/vector.js","../node_modules/mnemonist/lru-cache.js","../node_modules/mnemonist/lru-map.js","../node_modules/mnemonist/lru-map-with-delete.js","../node_modules/mnemonist/index.mjs","../src/lruStorage.ts","../node_modules/eventemitter3/index.js","../node_modules/eventemitter3/index.mjs","../node_modules/p-timeout/index.js","../node_modules/p-queue/dist/lower-bound.js","../node_modules/p-queue/dist/priority-queue.js","../node_modules/p-queue/dist/index.js","../node_modules/node-object-hash/dist/typeGuess.js","../node_modules/node-object-hash/dist/stringifiers.js","../node_modules/node-object-hash/dist/objectSorter.js","../node_modules/node-object-hash/dist/hasher.js","../src/hash.ts","../src/withCache.ts"],"sourcesContent":["import { debug as _debug } from \"node:util\";\n\nexport const debug = _debug(\"node-ts-cache\");\n","import { debug } from \"./debug.ts\";\nimport type { Storage } from \"./storage.ts\";\n\nexport type CachedItem<T = unknown> = {\n\tcontent: T;\n\tmeta: {\n\t\tcreatedAt: number;\n\t\tttl: number | null;\n\t\tstaleTtl?: number | null;\n\t};\n};\n\nexport type CachingOptions = {\n\t/** Number of milliseconds to expire the cached item - defaults to forever */\n\tttl: number | null;\n\t/** Number of milliseconds to mark the cached item stale - defaults to the ttl */\n\tstaleTtl: number | null;\n\t/** (Default: JSON.stringify combination of className, methodName and call args) */\n\tcalculateKey: (data: {\n\t\t/** The class name for the method being decorated */\n\t\tclassName: string;\n\t\t/** The method name being decorated */\n\t\tmethodName: string;\n\t\t/** The arguments passed to the method when called */\n\t\targs: unknown[];\n\t}) => string;\n};\n\nexport class CacheContainer {\n\tconstructor(private storage: Storage) {}\n\n\tpublic async getItem<T>(key: string): Promise<\n\t\t| {\n\t\t\t\tcontent: T;\n\t\t\t\tmeta: { expired: boolean; stale: boolean; createdAt: number };\n\t\t }\n\t\t| undefined\n\t> {\n\t\tconst item = await this.storage.getItem(key);\n\n\t\tif (!item) return;\n\n\t\tconst result = {\n\t\t\tcontent: item.content as T,\n\t\t\tmeta: {\n\t\t\t\tcreatedAt: item.meta.createdAt,\n\t\t\t\texpired: this.isItemExpired(item),\n\t\t\t\tstale: this.isStaleItem(item),\n\t\t\t},\n\t\t};\n\n\t\tif (result.meta.expired && !result.meta.stale) {\n\t\t\tawait this.unsetKey(key);\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn result;\n\t}\n\n\tpublic async setItem(\n\t\tkey: string,\n\t\tcontent: unknown,\n\t\toptions?: Partial<CachingOptions>,\n\t): Promise<void> {\n\t\tconst finalOptions = {\n\t\t\tttl: null,\n\t\t\tstaleTtl: null,\n\t\t\t...options,\n\t\t};\n\n\t\tconst meta: CachedItem<typeof content>[\"meta\"] = {\n\t\t\tcreatedAt: Date.now(),\n\t\t\tttl: finalOptions.ttl,\n\t\t\tstaleTtl: finalOptions.staleTtl,\n\t\t};\n\n\t\tawait this.storage.setItem(key, { meta, content });\n\t}\n\n\tpublic async clear(): Promise<void> {\n\t\tawait this.storage.clear();\n\n\t\tdebug(\"Cleared cache\");\n\t}\n\n\tprivate isItemExpired(item: CachedItem): boolean {\n\t\tif (item.meta.ttl === null) return false;\n\t\treturn Date.now() > item.meta.createdAt + item.meta.ttl;\n\t}\n\n\tprivate isStaleItem(item: CachedItem): boolean {\n\t\tconst staleTtl = item.meta.staleTtl ?? item.meta.ttl;\n\t\tif (staleTtl === null) return false;\n\t\treturn Date.now() > item.meta.createdAt + staleTtl;\n\t}\n\n\tpublic async unsetKey(key: string): Promise<void> {\n\t\tawait this.storage.removeItem(key);\n\t}\n}\n","import type { CachedItem } from \"./cacheContainer.ts\";\nimport type { Storage } from \"./storage.ts\";\n\n/**\n * Fallback Cache Provider that tries multiple storages in order.\n *\n * On getItem, it tries each storage in order until it finds a hit.\n * If a hit is found in a lower-priority storage, it writes it back to all higher-priority storages.\n * **It only guarantees writing to the highest priority storage on setItem.**\n */\nexport class FallbackStorage implements Storage {\n\tprivate storages: [Storage, ...Storage[]];\n\n\tconstructor(storages: [Storage, ...Storage[]]) {\n\t\tthis.storages = storages;\n\t}\n\n\tasync clear(): Promise<void> {\n\t\tawait Promise.all([...this.storages.map((storage) => storage.clear())]);\n\t}\n\n\tasync getItem(key: string): Promise<CachedItem | undefined> {\n\t\tfor (let i = 0; i < this.storages.length; i++) {\n\t\t\tconst storage = this.storages[i];\n\t\t\tconst item = await storage?.getItem(key);\n\t\t\tif (item !== undefined) {\n\t\t\t\tif (i !== 0) {\n\t\t\t\t\t// Only set in higher priority storages (indices 0 to i-1)\n\t\t\t\t\tawait Promise.all(\n\t\t\t\t\t\tthis.storages\n\t\t\t\t\t\t\t.slice(0, i)\n\t\t\t\t\t\t\t.map((storage) => storage.setItem(key, item)),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn item;\n\t\t\t}\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tasync setItem(key: string, content: CachedItem): Promise<void> {\n\t\tconst [primaryStorage, ...moreStorages] = this.storages;\n\t\tawait primaryStorage.setItem(key, content);\n\t\tvoid Promise.all(\n\t\t\tmoreStorages.map((storage) => storage.setItem(key, content)),\n\t\t);\n\t}\n\n\tasync removeItem(key: string): Promise<void> {\n\t\tawait Promise.all(this.storages.map((storage) => storage.removeItem(key)));\n\t}\n}\n","/**\n * Mnemonist Heap Comparators\n * ===========================\n *\n * Default comparators & functions dealing with comparators reversing etc.\n */\nvar DEFAULT_COMPARATOR = function(a, b) {\n if (a < b)\n return -1;\n if (a > b)\n return 1;\n\n return 0;\n};\n\nvar DEFAULT_REVERSE_COMPARATOR = function(a, b) {\n if (a < b)\n return 1;\n if (a > b)\n return -1;\n\n return 0;\n};\n\n/**\n * Function used to reverse a comparator.\n */\nfunction reverseComparator(comparator) {\n return function(a, b) {\n return comparator(b, a);\n };\n}\n\n/**\n * Function returning a tuple comparator.\n */\nfunction createTupleComparator(size) {\n if (size === 2) {\n return function(a, b) {\n if (a[0] < b[0])\n return -1;\n\n if (a[0] > b[0])\n return 1;\n\n if (a[1] < b[1])\n return -1;\n\n if (a[1] > b[1])\n return 1;\n\n return 0;\n };\n }\n\n return function(a, b) {\n var i = 0;\n\n while (i < size) {\n if (a[i] < b[i])\n return -1;\n\n if (a[i] > b[i])\n return 1;\n\n i++;\n }\n\n return 0;\n };\n}\n\n/**\n * Exporting.\n */\nexports.DEFAULT_COMPARATOR = DEFAULT_COMPARATOR;\nexports.DEFAULT_REVERSE_COMPARATOR = DEFAULT_REVERSE_COMPARATOR;\nexports.reverseComparator = reverseComparator;\nexports.createTupleComparator = createTupleComparator;\n","exports.ARRAY_BUFFER_SUPPORT = typeof ArrayBuffer !== 'undefined';\nexports.SYMBOL_SUPPORT = typeof Symbol !== 'undefined';\n","/**\n * Obliterator ForEach Function\n * =============================\n *\n * Helper function used to easily iterate over mixed values.\n */\nvar support = require('./support.js');\n\nvar ARRAY_BUFFER_SUPPORT = support.ARRAY_BUFFER_SUPPORT;\nvar SYMBOL_SUPPORT = support.SYMBOL_SUPPORT;\n\n/**\n * Function able to iterate over almost any iterable JS value.\n *\n * @param {any} iterable - Iterable value.\n * @param {function} callback - Callback function.\n */\nmodule.exports = function forEach(iterable, callback) {\n var iterator, k, i, l, s;\n\n if (!iterable) throw new Error('obliterator/forEach: invalid iterable.');\n\n if (typeof callback !== 'function')\n throw new Error('obliterator/forEach: expecting a callback.');\n\n // The target is an array or a string or function arguments\n if (\n Array.isArray(iterable) ||\n (ARRAY_BUFFER_SUPPORT && ArrayBuffer.isView(iterable)) ||\n typeof iterable === 'string' ||\n iterable.toString() === '[object Arguments]'\n ) {\n for (i = 0, l = iterable.length; i < l; i++) callback(iterable[i], i);\n return;\n }\n\n // The target has a #.forEach method\n if (typeof iterable.forEach === 'function') {\n iterable.forEach(callback);\n return;\n }\n\n // The target is iterable\n if (\n SYMBOL_SUPPORT &&\n Symbol.iterator in iterable &&\n typeof iterable.next !== 'function'\n ) {\n iterable = iterable[Symbol.iterator]();\n }\n\n // The target is an iterator\n if (typeof iterable.next === 'function') {\n iterator = iterable;\n i = 0;\n\n while (((s = iterator.next()), s.done !== true)) {\n callback(s.value, i);\n i++;\n }\n\n return;\n }\n\n // The target is a plain object\n for (k in iterable) {\n if (iterable.hasOwnProperty(k)) {\n callback(iterable[k], k);\n }\n }\n\n return;\n};\n","/* eslint no-constant-condition: 0 */\n/**\n * Mnemonist Fibonacci Heap\n * =========================\n *\n * Fibonacci heap implementation.\n */\nvar comparators = require('./utils/comparators.js'),\n forEach = require('obliterator/foreach');\n\nvar DEFAULT_COMPARATOR = comparators.DEFAULT_COMPARATOR,\n reverseComparator = comparators.reverseComparator;\n\n/**\n * Fibonacci Heap.\n *\n * @constructor\n */\nfunction FibonacciHeap(comparator) {\n this.clear();\n this.comparator = comparator || DEFAULT_COMPARATOR;\n\n if (typeof this.comparator !== 'function')\n throw new Error('mnemonist/FibonacciHeap.constructor: given comparator should be a function.');\n}\n\n/**\n * Method used to clear the heap.\n *\n * @return {undefined}\n */\nFibonacciHeap.prototype.clear = function() {\n\n // Properties\n this.root = null;\n this.min = null;\n this.size = 0;\n};\n\n/**\n * Function used to create a node.\n *\n * @param {any} item - Target item.\n * @return {object}\n */\nfunction createNode(item) {\n return {\n item: item,\n degree: 0\n };\n}\n\n/**\n * Function used to merge the given node with the root list.\n *\n * @param {FibonacciHeap} heap - Target heap.\n * @param {Node} node - Target node.\n */\nfunction mergeWithRoot(heap, node) {\n if (!heap.root) {\n heap.root = node;\n }\n else {\n node.right = heap.root.right;\n node.left = heap.root;\n heap.root.right.left = node;\n heap.root.right = node;\n }\n}\n\n/**\n * Method used to push an item into the heap.\n *\n * @param {any} item - Item to push.\n * @return {number}\n */\nFibonacciHeap.prototype.push = function(item) {\n var node = createNode(item);\n node.left = node;\n node.right = node;\n mergeWithRoot(this, node);\n\n if (!this.min || this.comparator(node.item, this.min.item) <= 0)\n this.min = node;\n\n return ++this.size;\n};\n\n/**\n * Method used to get the \"first\" item of the heap.\n *\n * @return {any}\n */\nFibonacciHeap.prototype.peek = function() {\n return this.min ? this.min.item : undefined;\n};\n\n/**\n * Function used to consume the given linked list.\n *\n * @param {Node} head - Head node.\n * @param {array}\n */\nfunction consumeLinkedList(head) {\n var nodes = [],\n node = head,\n flag = false;\n\n while (true) {\n if (node === head && flag)\n break;\n else if (node === head)\n flag = true;\n\n nodes.push(node);\n node = node.right;\n }\n\n return nodes;\n}\n\n/**\n * Function used to remove the target node from the root list.\n *\n * @param {FibonacciHeap} heap - Target heap.\n * @param {Node} node - Target node.\n */\nfunction removeFromRoot(heap, node) {\n if (heap.root === node)\n heap.root = node.right;\n node.left.right = node.right;\n node.right.left = node.left;\n}\n\n/**\n * Function used to merge the given node with the child list of a root node.\n *\n * @param {Node} parent - Parent node.\n * @param {Node} node - Target node.\n */\nfunction mergeWithChild(parent, node) {\n if (!parent.child) {\n parent.child = node;\n }\n else {\n node.right = parent.child.right;\n node.left = parent.child;\n parent.child.right.left = node;\n parent.child.right = node;\n }\n}\n\n/**\n * Function used to link one node to another in the root list.\n *\n * @param {FibonacciHeap} heap - Target heap.\n * @param {Node} y - Y node.\n * @param {Node} x - X node.\n */\nfunction link(heap, y, x) {\n removeFromRoot(heap, y);\n y.left = y;\n y.right = y;\n mergeWithChild(x, y);\n x.degree++;\n y.parent = x;\n}\n\n/**\n * Function used to consolidate the heap.\n *\n * @param {FibonacciHeap} heap - Target heap.\n */\nfunction consolidate(heap) {\n var A = new Array(heap.size),\n nodes = consumeLinkedList(heap.root),\n i, l, x, y, d, t;\n\n for (i = 0, l = nodes.length; i < l; i++) {\n x = nodes[i];\n d = x.degree;\n\n while (A[d]) {\n y = A[d];\n\n if (heap.comparator(x.item, y.item) > 0) {\n t = x;\n x = y;\n y = t;\n }\n\n link(heap, y, x);\n A[d] = null;\n d++;\n }\n\n A[d] = x;\n }\n\n for (i = 0; i < heap.size; i++) {\n if (A[i] && heap.comparator(A[i].item, heap.min.item) <= 0)\n heap.min = A[i];\n }\n}\n\n/**\n * Method used to retrieve & remove the \"first\" item of the heap.\n *\n * @return {any}\n */\nFibonacciHeap.prototype.pop = function() {\n if (!this.size)\n return undefined;\n\n var z = this.min;\n\n if (z.child) {\n var nodes = consumeLinkedList(z.child),\n node,\n i,\n l;\n\n for (i = 0, l = nodes.length; i < l; i++) {\n node = nodes[i];\n\n mergeWithRoot(this, node);\n delete node.parent;\n }\n }\n\n removeFromRoot(this, z);\n\n if (z === z.right) {\n this.min = null;\n this.root = null;\n }\n else {\n this.min = z.right;\n consolidate(this);\n }\n\n this.size--;\n\n return z.item;\n};\n\n/**\n * Convenience known methods.\n */\nFibonacciHeap.prototype.inspect = function() {\n var proxy = {\n size: this.size\n };\n\n if (this.min && 'item' in this.min)\n proxy.top = this.min.item;\n\n // Trick so that node displays the name of the constructor\n Object.defineProperty(proxy, 'constructor', {\n value: FibonacciHeap,\n enumerable: false\n });\n\n return proxy;\n};\n\nif (typeof Symbol !== 'undefined')\n FibonacciHeap.prototype[Symbol.for('nodejs.util.inspect.custom')] = FibonacciHeap.prototype.inspect;\n\n/**\n * Fibonacci Maximum Heap.\n *\n * @constructor\n */\nfunction MaxFibonacciHeap(comparator) {\n this.clear();\n this.comparator = comparator || DEFAULT_COMPARATOR;\n\n if (typeof this.comparator !== 'function')\n throw new Error('mnemonist/FibonacciHeap.constructor: given comparator should be a function.');\n\n this.comparator = reverseComparator(this.comparator);\n}\n\nMaxFibonacciHeap.prototype = FibonacciHeap.prototype;\n\n/**\n * Static @.from function taking an arbitrary iterable & converting it into\n * a heap.\n *\n * @param {Iterable} iterable - Target iterable.\n * @param {function} comparator - Custom comparator function.\n * @return {FibonacciHeap}\n */\nFibonacciHeap.from = function(iterable, comparator) {\n var heap = new FibonacciHeap(comparator);\n\n forEach(iterable, function(value) {\n heap.push(value);\n });\n\n return heap;\n};\n\nMaxFibonacciHeap.from = function(iterable, comparator) {\n var heap = new MaxFibonacciHeap(comparator);\n\n forEach(iterable, function(value) {\n heap.push(value);\n });\n\n return heap;\n};\n\n/**\n * Exporting.\n */\nFibonacciHeap.MinFibonacciHeap = FibonacciHeap;\nFibonacciHeap.MaxFibonacciHeap = MaxFibonacciHeap;\n\nmodule.exports = FibonacciHeap;\n","/**\n * Mnemonist Typed Array Helpers\n * ==============================\n *\n * Miscellaneous helpers related to typed arrays.\n */\n\n/**\n * When using an unsigned integer array to store pointers, one might want to\n * choose the optimal word size in regards to the actual numbers of pointers\n * to store.\n *\n * This helpers does just that.\n *\n * @param {number} size - Expected size of the array to map.\n * @return {TypedArray}\n */\nvar MAX_8BIT_INTEGER = Math.pow(2, 8) - 1,\n MAX_16BIT_INTEGER = Math.pow(2, 16) - 1,\n MAX_32BIT_INTEGER = Math.pow(2, 32) - 1;\n\nvar MAX_SIGNED_8BIT_INTEGER = Math.pow(2, 7) - 1,\n MAX_SIGNED_16BIT_INTEGER = Math.pow(2, 15) - 1,\n MAX_SIGNED_32BIT_INTEGER = Math.pow(2, 31) - 1;\n\nexports.getPointerArray = function(size) {\n var maxIndex = size - 1;\n\n if (maxIndex <= MAX_8BIT_INTEGER)\n return Uint8Array;\n\n if (maxIndex <= MAX_16BIT_INTEGER)\n return Uint16Array;\n\n if (maxIndex <= MAX_32BIT_INTEGER)\n return Uint32Array;\n\n throw new Error('mnemonist: Pointer Array of size > 4294967295 is not supported.');\n};\n\nexports.getSignedPointerArray = function(size) {\n var maxIndex = size - 1;\n\n if (maxIndex <= MAX_SIGNED_8BIT_INTEGER)\n return Int8Array;\n\n if (maxIndex <= MAX_SIGNED_16BIT_INTEGER)\n return Int16Array;\n\n if (maxIndex <= MAX_SIGNED_32BIT_INTEGER)\n return Int32Array;\n\n return Float64Array;\n};\n\n/**\n * Function returning the minimal type able to represent the given number.\n *\n * @param {number} value - Value to test.\n * @return {TypedArrayClass}\n */\nexports.getNumberType = function(value) {\n\n // <= 32 bits itnteger?\n if (value === (value | 0)) {\n\n // Negative\n if (Math.sign(value) === -1) {\n if (value <= 127 && value >= -128)\n return Int8Array;\n\n if (value <= 32767 && value >= -32768)\n return Int16Array;\n\n return Int32Array;\n }\n else {\n\n if (value <= 255)\n return Uint8Array;\n\n if (value <= 65535)\n return Uint16Array;\n\n return Uint32Array;\n }\n }\n\n // 53 bits integer & floats\n // NOTE: it's kinda hard to tell whether we could use 32bits or not...\n return Float64Array;\n};\n\n/**\n * Function returning the minimal type able to represent the given array\n * of JavaScript numbers.\n *\n * @param {array} array - Array to represent.\n * @param {function} getter - Optional getter.\n * @return {TypedArrayClass}\n */\nvar TYPE_PRIORITY = {\n Uint8Array: 1,\n Int8Array: 2,\n Uint16Array: 3,\n Int16Array: 4,\n Uint32Array: 5,\n Int32Array: 6,\n Float32Array: 7,\n Float64Array: 8\n};\n\n// TODO: make this a one-shot for one value\nexports.getMinimalRepresentation = function(array, getter) {\n var maxType = null,\n maxPriority = 0,\n p,\n t,\n v,\n i,\n l;\n\n for (i = 0, l = array.length; i < l; i++) {\n v = getter ? getter(array[i]) : array[i];\n t = exports.getNumberType(v);\n p = TYPE_PRIORITY[t.name];\n\n if (p > maxPriority) {\n maxPriority = p;\n maxType = t;\n }\n }\n\n return maxType;\n};\n\n/**\n * Function returning whether the given value is a typed array.\n *\n * @param {any} value - Value to test.\n * @return {boolean}\n */\nexports.isTypedArray = function(value) {\n return typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView(value);\n};\n\n/**\n * Function used to concat byte arrays.\n *\n * @param {...ByteArray}\n * @return {ByteArray}\n */\nexports.concat = function() {\n var length = 0,\n i,\n o,\n l;\n\n for (i = 0, l = arguments.length; i < l; i++)\n length += arguments[i].length;\n\n var array = new (arguments[0].constructor)(length);\n\n for (i = 0, o = 0; i < l; i++) {\n array.set(arguments[i], o);\n o += arguments[i].length;\n }\n\n return array;\n};\n\n/**\n * Function used to initialize a byte array of indices.\n *\n * @param {number} length - Length of target.\n * @return {ByteArray}\n */\nexports.indices = function(length) {\n var PointerArray = exports.getPointerArray(length);\n\n var array = new PointerArray(length);\n\n for (var i = 0; i < length; i++)\n array[i] = i;\n\n return array;\n};\n","/**\n * Mnemonist Iterable Function\n * ============================\n *\n * Harmonized iteration helpers over mixed iterable targets.\n */\nvar forEach = require('obliterator/foreach');\n\nvar typed = require('./typed-arrays.js');\n\n/**\n * Function used to determine whether the given object supports array-like\n * random access.\n *\n * @param {any} target - Target object.\n * @return {boolean}\n */\nfunction isArrayLike(target) {\n return Array.isArray(target) || typed.isTypedArray(target);\n}\n\n/**\n * Function used to guess the length of the structure over which we are going\n * to iterate.\n *\n * @param {any} target - Target object.\n * @return {number|undefined}\n */\nfunction guessLength(target) {\n if (typeof target.length === 'number')\n return target.length;\n\n if (typeof target.size === 'number')\n return target.size;\n\n return;\n}\n\n/**\n * Function used to convert an iterable to an array.\n *\n * @param {any} target - Iteration target.\n * @return {array}\n */\nfunction toArray(target) {\n var l = guessLength(target);\n\n var array = typeof l === 'number' ? new Array(l) : [];\n\n var i = 0;\n\n // TODO: we could optimize when given target is array like\n forEach(target, function(value) {\n array[i++] = value;\n });\n\n return array;\n}\n\n/**\n * Same as above but returns a supplementary indices array.\n *\n * @param {any} target - Iteration target.\n * @return {array}\n */\nfunction toArrayWithIndices(target) {\n var l = guessLength(target);\n\n var IndexArray = typeof l === 'number' ?\n typed.getPointerArray(l) :\n Array;\n\n var array = typeof l === 'number' ? new Array(l) : [];\n var indices = typeof l === 'number' ? new IndexArray(l) : [];\n\n var i = 0;\n\n // TODO: we could optimize when given target is array like\n forEach(target, function(value) {\n array[i] = value;\n indices[i] = i++;\n });\n\n return [array, indices];\n}\n\n/**\n * Exporting.\n */\nexports.isArrayLike = isArrayLike;\nexports.guessLength = guessLength;\nexports.toArray = toArray;\nexports.toArrayWithIndices = toArrayWithIndices;\n","/**\n * Mnemonist Binary Heap\n * ======================\n *\n * Binary heap implementation.\n */\nvar forEach = require('obliterator/foreach'),\n comparators = require('./utils/comparators.js'),\n iterables = require('./utils/iterables.js');\n\nvar DEFAULT_COMPARATOR = comparators.DEFAULT_COMPARATOR,\n reverseComparator = comparators.reverseComparator;\n\n/**\n * Heap helper functions.\n */\n\n/**\n * Function used to sift down.\n *\n * @param {function} compare - Comparison function.\n * @param {array} heap - Array storing the heap's data.\n * @param {number} startIndex - Starting index.\n * @param {number} i - Index.\n */\nfunction siftDown(compare, heap, startIndex, i) {\n var item = heap[i],\n parentIndex,\n parent;\n\n while (i > startIndex) {\n parentIndex = (i - 1) >> 1;\n parent = heap[parentIndex];\n\n if (compare(item, parent) < 0) {\n heap[i] = parent;\n i = parentIndex;\n continue;\n }\n\n break;\n }\n\n heap[i] = item;\n}\n\n/**\n * Function used to sift up.\n *\n * @param {function} compare - Comparison function.\n * @param {array} heap - Array storing the heap's data.\n * @param {number} i - Index.\n */\nfunction siftUp(compare, heap, i) {\n var endIndex = heap.length,\n startIndex = i,\n item = heap[i],\n childIndex = 2 * i + 1,\n rightIndex;\n\n while (childIndex < endIndex) {\n rightIndex = childIndex + 1;\n\n if (\n rightIndex < endIndex &&\n compare(heap[childIndex], heap[rightIndex]) >= 0\n ) {\n childIndex = rightIndex;\n }\n\n heap[i] = heap[childIndex];\n i = childIndex;\n childIndex = 2 * i + 1;\n }\n\n heap[i] = item;\n siftDown(compare, heap, startIndex, i);\n}\n\n/**\n * Function used to push an item into a heap represented by a raw array.\n *\n * @param {function} compare - Comparison function.\n * @param {array} heap - Array storing the heap's data.\n * @param {any} item - Item to push.\n */\nfunction push(compare, heap, item) {\n heap.push(item);\n siftDown(compare, heap, 0, heap.length - 1);\n}\n\n/**\n * Function used to pop an item from a heap represented by a raw array.\n *\n * @param {function} compare - Comparison function.\n * @param {array} heap - Array storing the heap's data.\n * @return {any}\n */\nfunction pop(compare, heap) {\n var lastItem = heap.pop();\n\n if (heap.length !== 0) {\n var item = heap[0];\n heap[0] = lastItem;\n siftUp(compare, heap, 0);\n\n return item;\n }\n\n return lastItem;\n}\n\n/**\n * Function used to pop the heap then push a new value into it, thus \"replacing\"\n * it.\n *\n * @param {function} compare - Comparison function.\n * @param {array} heap - Array storing the heap's data.\n * @param {any} item - The item to push.\n * @return {any}\n */\nfunction replace(compare, heap, item) {\n if (heap.length === 0)\n throw new Error('mnemonist/heap.replace: cannot pop an empty heap.');\n\n var popped = heap[0];\n heap[0] = item;\n siftUp(compare, heap, 0);\n\n return popped;\n}\n\n/**\n * Function used to push an item in the heap then pop the heap and return the\n * popped value.\n *\n * @param {function} compare - Comparison function.\n * @param {array} heap - Array storing the heap's data.\n * @param {any} item - The item to push.\n * @return {any}\n */\nfunction pushpop(compare, heap, item) {\n var tmp;\n\n if (heap.length !== 0 && compare(heap[0], item) < 0) {\n tmp = heap[0];\n heap[0] = item;\n item = tmp;\n siftUp(compare, heap, 0);\n }\n\n return item;\n}\n\n/**\n * Converts and array into an abstract heap in linear time.\n *\n * @param {function} compare - Comparison function.\n * @param {array} array - Target array.\n */\nfunction heapify(compare, array) {\n var n = array.length,\n l = n >> 1,\n i = l;\n\n while (--i >= 0)\n siftUp(compare, array, i);\n}\n\n/**\n * Fully consumes the given heap.\n *\n * @param {function} compare - Comparison function.\n * @param {array} heap - Array storing the heap's data.\n * @return {array}\n */\nfunction consume(compare, heap) {\n var l = heap.length,\n i = 0;\n\n var array = new Array(l);\n\n while (i < l)\n array[i++] = pop(compare, heap);\n\n return array;\n}\n\n/**\n * Function used to retrieve the n smallest items from the given iterable.\n *\n * @param {function} compare - Comparison function.\n * @param {number} n - Number of top items to retrieve.\n * @param {any} iterable - Arbitrary iterable.\n * @param {array}\n */\nfunction nsmallest(compare, n, iterable) {\n if (arguments.length === 2) {\n iterable = n;\n n = compare;\n compare = DEFAULT_COMPARATOR;\n }\n\n var reverseCompare = reverseComparator(compare);\n\n var i, l, v;\n\n var min = Infinity;\n\n var result;\n\n // If n is equal to 1, it's just a matter of finding the minimum\n if (n === 1) {\n if (iterables.isArrayLike(iterable)) {\n for (i = 0, l = iterable.length; i < l; i++) {\n v = iterable[i];\n\n if (min === Infinity || compare(v, min) < 0)\n min = v;\n }\n\n result = new iterable.constructor(1);\n result[0] = min;\n\n return result;\n }\n\n forEach(iterable, function(value) {\n if (min === Infinity || compare(value, min) < 0)\n min = value;\n });\n\n return [min];\n }\n\n if (iterables.isArrayLike(iterable)) {\n\n // If n > iterable length, we just clone and sort\n if (n >= iterable.length)\n return iterable.slice().sort(compare);\n\n result = iterable.slice(0, n);\n heapify(reverseCompare, result);\n\n for (i = n, l = iterable.length; i < l; i++)\n if (reverseCompare(iterable[i], result[0]) > 0)\n replace(reverseCompare, result, iterable[i]);\n\n // NOTE: if n is over some number, it becomes faster to consume the heap\n return result.sort(compare);\n }\n\n // Correct for size\n var size = iterables.guessLength(iterable);\n\n if (size !== null && size < n)\n n = size;\n\n result = new Array(n);\n i = 0;\n\n forEach(iterable, function(value) {\n if (i < n) {\n result[i] = value;\n }\n else {\n if (i === n)\n heapify(reverseCompare, result);\n\n if (reverseCompare(value, result[0]) > 0)\n replace(reverseCompare, result, value);\n }\n\n i++;\n });\n\n if (result.length > i)\n result.length = i;\n\n // NOTE: if n is over some number, it becomes faster to consume the heap\n return result.sort(compare);\n}\n\n/**\n * Function used to retrieve the n largest items from the given iterable.\n *\n * @param {function} compare - Comparison function.\n * @param {number} n - Number of top items to retrieve.\n * @param {any} iterable - Arbitrary iterable.\n * @param {array}\n */\nfunction nlargest(compare, n, iterable) {\n if (arguments.length === 2) {\n iterable = n;\n n = compare;\n compare = DEFAULT_COMPARATOR;\n }\n\n var reverseCompare = reverseComparator(compare);\n\n var i, l, v;\n\n var max = -Infinity;\n\n var result;\n\n // If n is equal to 1, it's just a matter of finding the maximum\n if (n === 1) {\n if (iterables.isArrayLike(iterable)) {\n for (i = 0, l = iterable.length; i < l; i++) {\n v = iterable[i];\n\n if (max === -Infinity || compare(v, max) > 0)\n max = v;\n }\n\n result = new iterable.constructor(1);\n result[0] = max;\n\n return result;\n }\n\n forEach(iterable, function(value) {\n if (max === -Infinity || compare(value, max) > 0)\n max = value;\n });\n\n return [max];\n }\n\n if (iterables.isArrayLike(iterable)) {\n\n // If n > iterable length, we just clone and sort\n if (n >= iterable.length)\n return iterable.slice().sort(reverseCompare);\n\n result = iterable.slice(0, n);\n heapify(compare, result);\n\n for (i = n, l = iterable.length; i < l; i++)\n if (compare(iterable[i], result[0]) > 0)\n replace(compare, result, iterable[i]);\n\n // NOTE: if n is over some number, it becomes faster to consume the heap\n return result.sort(reverseCompare);\n }\n\n // Correct for size\n var size = iterables.guessLength(iterable);\n\n if (size !== null && size < n)\n n = size;\n\n result = new Array(n);\n i = 0;\n\n forEach(iterable, function(value) {\n if (i < n) {\n result[i] = value;\n }\n else {\n if (i === n)\n heapify(compare, result);\n\n if (compare(value, result[0]) > 0)\n replace(compare, result, value);\n }\n\n i++;\n });\n\n if (result.length > i)\n result.length = i;\n\n // NOTE: if n is over some number, it becomes faster to consume the heap\n return result.sort(reverseCompare);\n}\n\n/**\n * Binary Minimum Heap.\n *\n * @constructor\n * @param {function} comparator - Comparator function to use.\n */\nfunction Heap(comparator) {\n this.clear();\n this.comparator = comparator || DEFAULT_COMPARATOR;\n\n if (typeof this.comparator !== 'function')\n throw new Error('mnemonist/Heap.constructor: given comparator should be a function.');\n}\n\n/**\n * Method used to clear the heap.\n *\n * @return {undefined}\n */\nHeap.prototype.clear = function() {\n\n // Properties\n this.items = [];\n this.size = 0;\n};\n\n/**\n * Method used to push an item into the heap.\n *\n * @param {any} item - Item to push.\n * @return {number}\n */\nHeap.prototype.push = function(item) {\n push(this.comparator, this.items, item);\n return ++this.size;\n};\n\n/**\n * Method used to retrieve the \"first\" item of the heap.\n *\n * @return {any}\n */\nHeap.prototype.peek = function() {\n return this.items[0];\n};\n\n/**\n * Method used to retrieve & remove the \"first\" item of the heap.\n *\n * @return {any}\n */\nHeap.prototype.pop = function() {\n if (this.size !== 0)\n this.size--;\n\n return pop(this.comparator, this.items);\n};\n\n/**\n * Method used to pop the heap, then push an item and return the popped\n * item.\n *\n * @param {any} item - Item to push into the heap.\n * @return {any}\n */\nHeap.prototype.replace = function(item) {\n return replace(this.comparator, this.items, item);\n};\n\n/**\n * Method used to push the heap, the pop it and return the pooped item.\n *\n * @param {any} item - Item to push into the heap.\n * @return {any}\n */\nHeap.prototype.pushpop = function(item) {\n return pushpop(this.comparator, this.items, item);\n};\n\n/**\n * Method used to consume the heap fully and return its items as a sorted array.\n *\n * @return {array}\n */\nHeap.prototype.consume = function() {\n this.size = 0;\n return consume(this.comparator, this.items);\n};\n\n/**\n * Method used to convert the heap to an array. Note that it basically clone\n * the heap and consumes it completely. This is hardly performant.\n *\n * @return {array}\n */\nHeap.prototype.toArray = function() {\n return consume(this.comparator, this.items.slice());\n};\n\n/**\n * Convenience known methods.\n */\nHeap.prototype.inspect = function() {\n var proxy = this.toArray();\n\n // Trick so that node displays the name of the constructor\n Object.defineProperty(proxy, 'constructor', {\n value: Heap,\n enumerable: false\n });\n\n return proxy;\n};\n\nif (typeof Symbol !== 'undefined')\n Heap.prototype[Symbol.for('nodejs.util.inspect.custom')] = Heap.prototype.inspect;\n\n/**\n * Binary Maximum Heap.\n *\n * @constructor\n * @param {function} comparator - Comparator function to use.\n */\nfunction MaxHeap(comparator) {\n this.clear();\n this.comparator = comparator || DEFAULT_COMPARATOR;\n\n if (typeof this.comparator !== 'function')\n throw new Error('mnemonist/MaxHeap.constructor: given comparator should be a function.');\n\n this.comparator = reverseComparator(this.comparator);\n}\n\nMaxHeap.prototype = Heap.prototype;\n\n/**\n * Static @.from function taking an arbitrary iterable & converting it into\n * a heap.\n *\n * @param {Iterable} iterable - Target iterable.\n * @param {function} comparator - Custom comparator function.\n * @return {Heap}\n */\nHeap.from = function(iterable, comparator) {\n var heap = new Heap(comparator);\n\n var items;\n\n // If iterable is an array, we can be clever about it\n if (iterables.isArrayLike(iterable))\n items = iterable.slice();\n else\n items = iterables.toArray(iterable);\n\n heapify(heap.comparator, items);\n heap.items = items;\n heap.size = items.length;\n\n return heap;\n};\n\nMaxHeap.from = function(iterable, comparator) {\n var heap = new MaxHeap(comparator);\n\n var items;\n\n // If iterable is an array, we can be clever about it\n if (iterables.isArrayLike(iterable))\n items = iterable.slice();\n else\n items = iterables.toArray(iterable);\n\n heapify(heap.comparator, items);\n heap.items = items;\n heap.size = items.length;\n\n return heap;\n};\n\n/**\n * Exporting.\n */\nHeap.siftUp = siftUp;\nHeap.siftDown = siftDown;\nHeap.push = push;\nHeap.pop = pop;\nHeap.replace = replace;\nHeap.pushpop = pushpop;\nHeap.heapify = heapify;\nHeap.consume = consume;\n\nHeap.nsmallest = nsmallest;\nHeap.nlargest = nlargest;\n\nHeap.MinHeap = Heap;\nHeap.MaxHeap = MaxHeap;\n\nmodule.exports = Heap;\n","/**\n * Mnemonist Suffix Array\n * =======================\n *\n * Linear time implementation of a suffix array using the recursive\n * method by Karkkainen and Sanders.\n *\n * [References]:\n * https://www.cs.helsinki.fi/u/tpkarkka/publications/jacm05-revised.pdf\n * http://people.mpi-inf.mpg.de/~sanders/programs/suffix/\n * http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.184.442&rep=rep1&type=pdf\n *\n * [Article]:\n * \"Simple Linear Work Suffix Array Construction\", Karkkainen and Sanders.\n *\n * [Note]:\n * A paper by Simon J. Puglisi, William F. Smyth & Andrew Turpin named\n * \"The Performance of Linear Time Suffix Sorting Algorithms\" seems to\n * prove that supralinear algorithm are in fact better faring for\n * \"real\" world use cases. It would be nice to check this out in JavaScript\n * because the high level of the language could change a lot to the fact.\n *\n * The current code is largely inspired by the following:\n * https://github.com/tixxit/suffixarray/blob/master/suffixarray.js\n */\n\n/**\n * Constants.\n */\nvar SEPARATOR = '\\u0001';\n\n/**\n * Function used to sort the triples.\n *\n * @param {string|array} string - Padded sequence.\n * @param {array} array - Array to sort (will be mutated).\n * @param {number} offset - Index offset.\n */\nfunction sort(string, array, offset) {\n var l = array.length,\n buckets = [],\n i = l,\n j = -1,\n b,\n d = 0,\n bits;\n\n while (i--)\n j = Math.max(string[array[i] + offset], j);\n\n bits = j >> 24 && 32 || j >> 16 && 24 || j >> 8 && 16 || 8;\n\n for (; d < bits; d += 4) {\n for (i = 16; i--;)\n buckets[i] = [];\n for (i = l; i--;)\n buckets[((string[array[i] + offset]) >> d) & 15].push(array[i]);\n for (b = 0; b < 16; b++) {\n for (j = buckets[b].length; j--;)\n array[++i] = buckets[b][j];\n }\n }\n}\n\n/**\n * Comparison helper.\n */\nfunction compare(string, lookup, m, n) {\n return (\n (string[m] - string[n]) ||\n (m % 3 === 2 ?\n (string[m + 1] - string[n + 1]) || (lookup[m + 2] - lookup[n + 2]) :\n (lookup[m + 1] - lookup[n + 1]))\n );\n}\n\n/**\n * Recursive function used to build the suffix tree in linear time.\n *\n * @param {string|array} string - Padded sequence.\n * @param {number} l - True length of sequence (unpadded).\n * @return {array}\n */\nfunction build(string, l) {\n var a = [],\n b = [],\n al = (2 * l / 3) | 0,\n bl = l - al,\n r = (al + 1) >> 1,\n i = al,\n j = 0,\n k,\n lookup = [],\n result = [];\n\n if (l === 1)\n return [0];\n\n while (i--)\n a[i] = ((i * 3) >> 1) + 1;\n\n for (i = 3; i--;)\n sort(string, a, i);\n\n j = b[((a[0] / 3) | 0) + (a[0] % 3 === 1 ? 0 : r)] = 1;\n\n for (i = 1; i < al; i++) {\n if (string[a[i]] !== string[a[i - 1]] ||\n string[a[i] + 1] !== string[a[i - 1] + 1] ||\n string[a[i] + 2] !== string[a[i - 1] + 2])\n j++;\n\n b[((a[i] / 3) | 0) + (a[i] % 3 === 1 ? 0 : r)] = j;\n }\n\n if (j < al) {\n b = build(b, al);\n\n for (i = al; i--;)\n a[i] = b[i] < r ? b[i] * 3 + 1 : ((b[i] - r) * 3 + 2);\n }\n\n for (i = al; i--;)\n lookup[a[i]] = i;\n lookup[l] = -1;\n lookup[l + 1] = -2;\n\n b = l % 3 === 1 ? [l - 1] : [];\n\n for (i = 0; i < al; i++) {\n if (a[i] % 3 === 1)\n b.push(a[i] - 1);\n }\n\n sort(string, b, 0);\n\n for (i = 0, j = 0, k = 0; i < al && j < bl;)\n result[k++] = (\n compare(string, lookup, a[i], b[j]) < 0 ?\n a[i++] :\n b[j++]\n );\n\n while (i < al)\n result[k++] = a[i++];\n\n while (j < bl)\n result[k++] = b[j++];\n\n return result;\n}\n\n/**\n * Function used to create the array we are going to work on.\n *\n * @param {string|array} target - Target sequence.\n * @return {array}\n */\nfunction convert(target) {\n\n // Creating the alphabet array\n var length = target.length,\n paddingOffset = length % 3,\n array = new Array(length + paddingOffset),\n l,\n i;\n\n // If we have an arbitrary sequence, we need to transform it\n if (typeof target !== 'string') {\n var uniqueTokens = Object.create(null);\n\n for (i = 0; i < length; i++) {\n if (!uniqueTokens[target[i]])\n uniqueTokens[target[i]] = true;\n }\n\n var alphabet = Object.create(null),\n sortedUniqueTokens = Object.keys(uniqueTokens).sort();\n\n for (i = 0, l = sortedUniqueTokens.length; i < l; i++)\n alphabet[sortedUniqueTokens[i]] = i + 1;\n\n for (i = 0; i < length; i++) {\n array[i] = alphabet[target[i]];\n }\n }\n else {\n for (i = 0; i < length; i++)\n array[i] = target.charCodeAt(i);\n }\n\n // Padding the array\n for (i = length; i < length + paddingOffset; i++)\n array[i] = 0;\n\n return array;\n}\n\n/**\n * Suffix Array.\n *\n * @constructor\n * @param {string|array} string - Sequence for which to build the suffix array.\n */\nfunction SuffixArray(string) {\n\n // Properties\n this.hasArbitrarySequence = typeof string !== 'string';\n this.string = string;\n this.length = string.length;\n\n // Building the array\n this.array = build(convert(string), this.length);\n}\n\n/**\n * Convenience known methods.\n */\nSuffixArray.prototype.toString = function() {\n return this.array.join(',');\n};\n\nSuffixArray.prototype.toJSON = function() {\n return this.array;\n};\n\nSuffixArray.prototype.inspect = function() {\n var array = new Array(this.length);\n\n for (var i = 0; i < this.length; i++)\n array[i] = this.string.slice(this.array[i]);\n\n // Trick so that node displays the name of the constructor\n Object.defineProperty(array, 'constructor', {\n value: SuffixArray,\n enumerable: false\n });\n\n return array;\n};\n\nif (typeof Symbol !== 'undefined')\n SuffixArray.prototype[Symbol.for('nodejs.util.inspect.custom')] = SuffixArray.prototype.inspect;\n\n/**\n * Generalized Suffix Array.\n *\n * @constructor\n */\nfunction GeneralizedSuffixArray(strings) {\n\n // Properties\n this.hasArbitrarySequence = typeof strings[0] !== 'string';\n this.size = strings.length;\n\n if (this.hasArbitrarySequence) {\n this.text = [];\n\n for (var i = 0, l = this.size; i < l; i++) {\n this.text.push.apply(this.text, strings[i]);\n\n if (i < l - 1)\n this.text.push(SEPARATOR);\n }\n }\n else {\n this.text = strings.join(SEPARATOR);\n }\n\n this.firstLength = strings[0].length;\n this.length = this.text.length;\n\n // Building the array\n this.array = build(convert(this.text), this.length);\n}\n\n/**\n * Method used to retrieve the longest common subsequence of the generalized\n * suffix array.\n *\n * @return {string|array}\n */\nGeneralizedSuffixArray.prototype.longestCommonSubsequence = function() {\n var lcs = this.hasArbitrarySequence ? [] : '',\n lcp,\n i,\n j,\n s,\n t;\n\n for (i = 1; i < this.length; i++) {\n s = this.array[i];\n t = this.array[i - 1];\n\n if (s < this.firstLength &&\n t < this.firstLength)\n continue;\n\n if (s > this.firstLength &&\n t > this.firstLength)\n continue;\n\n lcp = Math.min(this.length - s, this.length - t);\n\n for (j = 0; j < lcp; j++) {\n if (this.text[s + j] !== this.text[t + j]) {\n lcp = j;\n break;\n }\n }\n\n if (lcp > lcs.length)\n lcs = this.text.slice(s, s + lcp);\n }\n\n return lcs;\n};\n\n/**\n * Convenience known methods.\n */\nGeneralizedSuffixArray.prototype.toString = function() {\n return this.array.join(',');\n};\n\nGeneralizedSuffixArray.prototype.toJSON = function() {\n return this.array;\n};\n\nGeneralizedSuffixArray.prototype.inspect = function() {\n var array = new Array(this.length);\n\n for (var i = 0; i < this.length; i++)\n array[i] = this.text.slice(this.array[i]);\n\n // Trick so that node displays the name of the constructor\n Object.defineProperty(array, 'constructor', {\n value: GeneralizedSuffixArray,\n enumerable: false\n });\n\n return array;\n};\n\nif (typeof Symbol !== 'undefined')\n GeneralizedSuffixArray.prototype[Symbol.for('nodejs.util.inspect.custom')] = GeneralizedSuffixArray.prototype.inspect;\n\n/**\n * Exporting.\n */\nSuffixArray.GeneralizedSuffixArray = GeneralizedSuffixArray;\n\nmodule.exports = SuffixArray;\n","/**\n * Obliterator Iterator Class\n * ===========================\n *\n * Simple class representing the library's iterators.\n */\n\n/**\n * Iterator class.\n *\n * @constructor\n * @param {function} next - Next function.\n */\nfunction Iterator(next) {\n if (typeof next !== 'function')\n throw new Error('obliterator/iterator: expecting a function!');\n\n this.next = next;\n}\n\n/**\n * If symbols are supported, we add `next` to `Symbol.iterator`.\n */\nif (typeof Symbol !== 'undefined')\n Iterator.prototype[Symbol.iterator] = function () {\n return this;\n };\n\n/**\n * Returning an iterator of the given values.\n *\n * @param {any...} values - Values.\n * @return {Iterator}\n */\nIterator.of = function () {\n var args = arguments,\n l = args.length,\n i = 0;\n\n return new Iterator(function () {\n if (i >= l) return {done: true};\n\n return {done: false, value: args[i++]};\n });\n};\n\n/**\n * Returning an empty iterator.\n *\n * @return {Iterator}\n */\nIterator.empty = function () {\n var iterator = new Iterator(function () {\n return {done: true};\n });\n\n return iterator;\n};\n\n/**\n * Returning an iterator over the given indexed sequence.\n *\n * @param {string|Array} sequence - Target sequence.\n * @return {Iterator}\n */\nIterator.fromSequence = function (sequence) {\n var i = 0,\n l = sequence.length;\n\n return new Iterator(function () {\n if (i >= l) return {done: true};\n\n return {done: false, value: sequence[i++]};\n });\n};\n\n/**\n * Returning whether the given value is an iterator.\n *\n * @param {any} value - Value.\n * @return {boolean}\n */\nIterator.is = function (value) {\n if (value instanceof Iterator) return true;\n\n return (\n typeof value === 'object' &&\n value !== null &&\n typeof value.next === 'function'\n );\n};\n\n/**\n * Exporting.\n */\nmodule.exports = Iterator;\n","/**\n * Mnemonist Vector\n * =================\n *\n * Abstract implementation of a growing array that can be used with JavaScript\n * typed arrays and other array-like structures.\n *\n * Note: should try and use ArrayBuffer.transfer when it will be available.\n */\nvar Iterator = require('obliterator/iterator'),\n forEach = require('obliterator/foreach'),\n iterables = require('./utils/iterables.js'),\n typed = require('./utils/typed-arrays.js');\n\n/**\n * Defaults.\n */\nvar DEFAULT_GROWING_POLICY = function(currentCapacity) {\n return Math.max(1, Math.ceil(currentCapacity * 1.5));\n};\n\nvar pointerArrayFactory = function(capacity) {\n var PointerArray = typed.getPointerArray(capacity);\n\n return new PointerArray(capacity);\n};\n\n/**\n * Vector.\n *\n * @constructor\n * @param {function} ArrayClass - An array constructor.\n * @param {number|object} initialCapacityOrOptions - Self-explanatory:\n * @param {number} initialCapacity - Initial capacity.\n * @param {number} initialLength - Initial length.\n * @param {function} policy - Allocation policy.\n */\nfunction Vector(ArrayClass, initialCapacityOrOptions) {\n if (arguments.length < 1)\n throw new Error('mnemonist/vector: expecting at least a byte array constructor.');\n\n var initialCapacity = initialCapacityOrOptions || 0,\n policy = DEFAULT_GROWING_POLICY,\n initialLength = 0,\n factory = false;\n\n if (typeof initialCapacityOrOptions === 'object') {\n initialCapacity = initialCapacityOrOptions.initialCapacity || 0;\n initialLength = initialCapacityOrOptions.initialLength || 0;\n policy = initialCapacityOrOptions.policy || policy;\n factory = initialCapacityOrOptions.factory === true;\n }\n\n this.factory = factory ? ArrayClass : null;\n this.ArrayClass = ArrayClass;\n this.length = initialLength;\n this.capacity = Math.max(initialLength, initialCapacity);\n this.policy = policy;\n this.array = new ArrayClass(this.capacity);\n}\n\n/**\n * Method used to set a value.\n *\n * @param {number} index - Index to edit.\n * @param {any} value - Value.\n * @return {Vector}\n */\nVector.prototype.set = function(index, value) {\n\n // Out of bounds?\n if (this.length < index)\n throw new Error('Vector(' + this.ArrayClass.name + ').set: index out of bounds.');\n\n // Updating value\n this.array[index] = value;\n\n return this;\n};\n\n/**\n * Method used to get a value.\n *\n * @param {number} index - Index to retrieve.\n * @return {any}\n */\nVector.prototype.get = function(index) {\n if (this.length < index)\n return undefined;\n\n return this.array[index];\n};\n\n/**\n * Method used to apply the growing policy.\n *\n * @param {number} [override] - Override capacity.\n * @return {number}\n */\nVector.prototype.applyPolicy = function(override) {\n var newCapacity = this.policy(override || this.capacity);\n\n if (typeof newCapacity !== 'number' || newCapacity < 0)\n throw new Error('mnemonist/vector.applyPolicy: policy returned an invalid value (expecting a positive integer).');\n\n if (newCapacity <= this.capacity)\n throw new Error('mnemonist/vector.applyPolicy: policy returned a less or equal capacity to allocate.');\n\n // TODO: we should probably check that the returned number is an integer\n return newCapacity;\n};\n\n/**\n * Method used to reallocate the underlying array.\n *\n * @param {number} capacity - Target capacity.\n * @return {Vector}\n */\nVector.prototype.reallocate = function(capacity) {\n if (capacity === this.capacity)\n return this;\n\n var oldArray = this.array;\n\n if (capacity < this.length)\n this.length = capacity;\n\n if (capacity > this.capacity) {\n if (this.factory === null)\n this.array = new this.ArrayClass(capacity);\n else\n this.array = this.factory(capacity);\n\n if (typed.isTypedArray(this.array)) {\n this.array.set(oldArray, 0);\n }\n else {\n for (var i = 0, l = this.length; i < l; i++)\n this.array[i] = oldArray[i];\n }\n }\n else {\n this.array = oldArray.slice(0, capacity);\n }\n\n this.capacity = capacity;\n\n return this;\n};\n\n/**\n * Method used to grow the array.\n *\n * @param {number} [capacity] - Optional capacity to match.\n * @return {Vector}\n */\nVector.prototype.grow = function(capacity) {\n var newCapacity;\n\n if (typeof capacity === 'number') {\n\n if (this.capacity >= capacity)\n return this;\n\n // We need to match the given capacity\n newCapacity = this.capacity;\n\n while (newCapacity < capacity)\n newCapacity = this.applyPolicy(newCapacity);\n\n this.reallocate(newCapacity);\n\n return this;\n }\n\n // We need to run the policy once\n newCapacity = this.applyPolicy();\n this.reallocate(newCapacity);\n\n return this;\n};\n\n/**\n * Method used to resize the array. Won't deallocate.\n *\n * @param {number} length - Target length.\n * @return {Vector}\n */\nVector.prototype.resize = function(length) {\n if (length === this.length)\n return this;\n\n if (length < this.length) {\n this.length = length;\n return this;\n }\n\n this.length = length;\n this.reallocate(length);\n\n return this;\n};\n\n/**\n * Method used to push a value into the array.\n *\n * @param {any} value - Value to push.\n * @return {number} - Length of the array.\n */\nVector.prototype.push = function(value) {\n if (this.capacity === this.length)\n this.grow();\n\n this.array[this.length++] = value;\n\n return this.length;\n};\n\n/**\n * Method used to pop the last value of the array.\n *\n * @return {number} - The popped value.\n */\nVector.prototype.pop = function() {\n if (this.length === 0)\n return;\n\n return this.array[--this.length];\n};\n\n/**\n * Method used to create an iterator over a vector's values.\n *\n * @return {Iterator}\n */\nVector.prototype.values = function() {\n var items = this.array,\n l = this.length,\n i = 0;\n\n return new Iterator(function() {\n if (i >= l)\n return {\n done: true\n };\n\n var value = items[i];\n i++;\n\n return {\n value: value,\n done: false\n };\n });\n};\n\n/**\n * Method used to create an iterator over a vector's entries.\n *\n * @return {Iterator}\n */\nVector.prototype.entries = function() {\n var items = this.array,\n l = this.length,\n i = 0;\n\n return new Iterator(function() {\n if (i >= l)\n return {\n done: true\n };\n\n var value = items[i];\n\n return {\n value: [i++, value],\n done: false\n };\n });\n};\n\n/**\n * Attaching the #.values method to Symbol.iterator if possible.\n */\nif (typeof Symbol !== 'undefined')\n Vector.prototype[Symbol.iterator] = Vector.prototype.values;\n\n/**\n * Convenience known methods.\n */\nVector.prototype.inspect = function() {\n var proxy = this.array.slice(0, this.length);\n\n proxy.type = this.array.constructor.name;\n proxy.items = this.length;\n proxy.capacity = this.capacity;\n\n // Trick so that node displays the name of the constructor\n Object.defineProperty(proxy, 'constructor', {\n value: Vector,\n enumerable: false\n });\n\n return proxy;\n};\n\nif (typeof Symbol !== 'undefined')\n Vector.prototype[Symbol.for('nodejs.util.inspect.custom')] = Vector.prototype.inspect;\n\n/**\n * Static @.from function taking an arbitrary iterable & converting it into\n * a vector.\n *\n * @param {Iterable} iterable - Target iterable.\n * @param {function} ArrayClass - Byte array class.\n * @param {number} capacity - Desired capacity.\n * @return {Vector}\n */\nVector.from = function(iterable, ArrayClass, capacity) {\n\n if (arguments.length < 3) {\n\n // Attempting to guess the needed capacity\n capacity = iterables.guessLength(iterable);\n\n if (typeof capacity !== 'number')\n throw new Error('mnemonist/vector.from: could not guess iterable length. Please provide desired capacity as last argument.');\n }\n\n var vector = new Vector(ArrayClass, capacity);\n\n forEach(iterable, function(value) {\n vector.push(value);\n });\n\n return vector;\n};\n\n/**\n * Exporting.\n */\nfunction subClass(ArrayClass) {\n var SubClass = function(initialCapacityOrOptions) {\n Vector.call(this, ArrayClass, initialCapacityOrOptions);\n };\n\n for (var k in Vector.prototype) {\n if (Vector.prototype.hasOwnProperty(k))\n SubClass.prototype[k] = Vector.prototype[k];\n }\n\n SubClass.from = function(iterable, capacity) {\n return Vector.from(iterable, ArrayClass, capacity);\n };\n\n if (typeof Symbol !== 'undefined')\n SubClass.prototype[Symbol.iterator] = SubClass.prototype.values;\n\n return SubClass;\n}\n\nVector.Int8Vector = subClass(Int8Array);\nVector.Uint8Vector = subClass(Uint8Array);\nVector.Uint8ClampedVector = subClass(Uint8ClampedArray);\nVector.Int16Vector = subClass(Int16Array);\nVector.Uint16Vector = subClass(Uint16Array);\nVector.Int32Vector = subClass(Int32Array);\nVector.Uint32Vector = subClass(Uint32Array);\nVector.Float32Vector = subClass(Float32Array);\nVector.Float64Vector = subClass(Float64Array);\nVector.PointerVector = subClass(pointerArrayFactory);\n\nmodule.exports = Vector;\n","/**\n * Mnemonist LRUCache\n * ===================\n *\n * JavaScript implementation of the LRU Cache data structure. To save up\n * memory and allocations this implementation represents its underlying\n * doubly-linked list as static arrays and pointers. Thus, memory is allocated\n * only once at instantiation and JS objects are never created to serve as\n * pointers. This also means this implementation does not trigger too many\n * garbage collections.\n *\n * Note that to save up memory, a LRU Cache can be implemented using a singly\n * linked list by storing predecessors' pointers as hashmap values.\n * However, this means more hashmap lookups and would probably slow the whole\n * thing down. What's more, pointers are not the things taking most space in\n * memory.\n */\nvar Iterator = require('obliterator/iterator'),\n forEach = require('obliterator/foreach'),\n typed = require('./utils/typed-arrays.js'),\n iterables = require('./utils/iterables.js');\n\n/**\n * LRUCache.\n *\n * @constructor\n * @param {function} Keys - Array class for storing keys.\n * @param {function} Values - Array class for storing values.\n * @param {number} capacity - Desired capacity.\n */\nfunction LRUCache(Keys, Values, capacity) {\n if (arguments.length < 2) {\n capacity = Keys;\n Keys = null;\n Values = null;\n }\n\n this.capacity = capacity;\n\n if (typeof this.capacity !== 'number' || this.capacity <= 0)\n throw new Error('mnemonist/lru-cache: capacity should be positive number.');\n else if (!isFinite(this.capacity) || Math.floor(this.capacity) !== this.capacity)\n throw new Error('mnemonist/lru-cache: capacity should be a finite positive integer.');\n\n var PointerArray = typed.getPointerArray(capacity);\n\n this.forward = new PointerArray(capacity);\n this.backward = new PointerArray(capacity);\n this.K = typeof Keys === 'function' ? new Keys(capacity) : new Array(capacity);\n this.V = typeof Values === 'function' ? new Values(capacity) : new Array(capacity);\n\n // Properties\n this.size = 0;\n this.head = 0;\n this.tail = 0;\n this.items = {};\n}\n\n/**\n * Method used to clear the structure.\n *\n * @return {undefined}\n */\nLRUCache.prototype.clear = function() {\n this.size = 0;\n this.head = 0;\n this.tail = 0;\n this.items = {};\n};\n\n/**\n * Method used to splay a value on top.\n *\n * @param {number} pointer - Pointer of the value to splay on top.\n * @return {LRUCache}\n */\nLRUCache.prototype.splayOnTop = function(pointer) {\n var oldHead = this.head;\n\n if (this.head === pointer)\n return this;\n\n var previous = this.backward[pointer],\n next = this.forward[pointer];\n\n if (this.tail === pointer) {\n this.tail = previous;\n }\n else {\n this.backward[next] = previous;\n }\n\n this.forward[previous] = next;\n\n this.backward[oldHead] = pointer;\n this.head = pointer;\n this.forward[pointer] = oldHead;\n\n return this;\n};\n\n/**\n * Method used to set the value for the given key in the cache.\n *\n * @param {any} key - Key.\n * @param {any} value - Value.\n * @return {undefined}\n */\nLRUCache.prototype.set = function(key, value) {\n\n var pointer = this.items[key];\n\n // The key already exists, we just need to update the value and splay on top\n if (typeof pointer !== 'undefined') {\n this.splayOnTop(pointer);\n this.V[pointer] = value;\n\n return;\n }\n\n // The cache is not yet full\n if (this.size < this.capacity) {\n pointer = this.size++;\n }\n\n // Cache is full, we need to drop the last value\n else {\n pointer = this.tail;\n this.tail = this.backward[pointer];\n delete this.items[this.K[pointer]];\n }\n\n // Storing key & value\n this.items[key] = pointer;\n this.K[pointer] = key;\n this.V[pointer] = value;\n\n // Moving the item at the front of the list\n this.forward[pointer] = this.head;\n this.backward[this.head] = pointer;\n this.head = pointer;\n};\n\n/**\n * Method used to set the value for the given key in the cache\n *\n * @param {any} key - Key.\n * @param {any} value - Value.\n * @return {{evicted: boolean, key: any, value: any}} An object containing the\n * key and value of an item that was overwritten or evicted in the set\n * operation, as well as a boolean indicating whether it was evicted due to\n * limited capacity. Return value is null if nothing was evicted or overwritten\n * during the set operation.\n */\nLRUCache.prototype.setpop = function(key, value) {\n var oldValue = null;\n var oldKey = null;\n\n var pointer = this.items[key];\n\n // The key already exists, we just need to update the value and splay on top\n if (typeof pointer !== 'undefined') {\n this.splayOnTop(pointer);\n oldValue = this.V[pointer];\n this.V[pointer] = value;\n return {evicted: false, key: key, value: oldValue};\n }\n\n // The cache is not yet full\n if (this.size < this.capacity) {\n pointer = this.size++;\n }\n\n // Cache is full, we need to drop the last value\n else {\n pointer = this.tail;\n this.tail = this.backward[pointer];\n oldValue = this.V[pointer];\n oldKey = this.K[pointer];\n delete this.items[oldKey];\n }\n\n // Storing key & value\n this.items[key] = pointer;\n this.K[pointer] = key;\n this.V[pointer] = value;\n\n // Moving the item at the front of the list\n this.forward[pointer] = this.head;\n this.backward[this.head] = pointer;\n this.head = pointer;\n\n // Return object if eviction took place, otherwise return null\n if (oldKey) {\n return {evicted: true, key: oldKey, value: oldValue};\n }\n else {\n return null;\n }\n};\n\n/**\n * Method used to check whether the key exists in the cache.\n *\n * @param {any} key - Key.\n * @return {boolean}\n */\nLRUCache.prototype.has = function(key) {\n return key in this.items;\n};\n\n/**\n * Method used to get the value attached to the given key. Will move the\n * related key to the front of the underlying linked list.\n *\n * @param {any} key - Key.\n * @return {any}\n */\nLRUCache.prototype.get = function(key) {\n var pointer = this.items[key];\n\n if (typeof pointer === 'undefined')\n return;\n\n this.splayOnTop(pointer);\n\n return this.V[pointer];\n};\n\n/**\n * Method used to get the value attached to the given key. Does not modify\n * the ordering of the underlying linked list.\n *\n * @param {any} key - Key.\n * @return {any}\n */\nLRUCache.prototype.peek = function(key) {\n var pointer = this.items[key];\n\n if (typeof pointer === 'undefined')\n return;\n\n return this.V[pointer];\n};\n\n/**\n * Method used to iterate over the cache's entries using a callback.\n *\n * @param {function} callback - Function to call for each item.\n * @param {object} scope - Optional scope.\n * @return {undefined}\n */\nLRUCache.prototype.forEach = function(callback, scope) {\n scope = arguments.length > 1 ? scope : this;\n\n var i = 0,\n l = this.size;\n\n var pointer = this.head,\n keys = this.K,\n values = this.V,\n forward = this.forward;\n\n while (i < l) {\n\n callback.call(scope, values[pointer], keys[pointer], this);\n pointer = forward[pointer];\n\n i++;\n }\n};\n\n/**\n * Method used to create an iterator over the cache's keys from most\n * recently used to least recently used.\n *\n * @return {Iterator}\n */\nLRUCache.prototype.keys = function() {\n var i = 0,\n l = this.size;\n\n var pointer = this.head,\n keys = this.K,\n forward = this.forward;\n\n return new Iterator(function() {\n if (i >= l)\n return {done: true};\n\n var key = keys[pointer];\n\n i++;\n\n if (i < l)\n pointer = forward[pointer];\n\n return {\n done: false,\n value: key\n };\n });\n};\n\n/**\n * Method used to create an iterator over the cache's values from most\n * recently used to least recently used.\n *\n * @return {Iterator}\n */\nLRUCache.prototype.values = function() {\n var i = 0,\n l = this.size;\n\n var pointer = this.head,\n values = this.V,\n forward = this.forward;\n\n return new Iterator(function() {\n if (i >= l)\n return {done: true};\n\n var value = values[pointer];\n\n i++;\n\n if (i < l)\n pointer = forward[pointer];\n\n return {\n done: false,\n value: value\n };\n });\n};\n\n/**\n * Method used to create an iterator over the cache's entries from most\n * recently used to least recently used.\n *\n * @return {Iterator}\n */\nLRUCache.prototype.entries = function() {\n var i = 0,\n l = this.size;\n\n var pointer = this.head,\n keys = this.K,\n values = this.V,\n forward = this.forward;\n\n return new Iterator(function() {\n if (i >= l)\n return {done: true};\n\n var key = keys[pointer],\n value = values[pointer];\n\n i++;\n\n if (i < l)\n pointer = forward[pointer];\n\n return {\n done: false,\n value: [key, value]\n };\n });\n};\n\n/**\n * Attaching the #.entries method to Symbol.iterator if possible.\n */\nif (typeof Symbol !== 'undefined')\n LRUCache.prototype[Symbol.iterator] = LRUCache.prototype.entries;\n\n/**\n * Convenience known methods.\n */\nLRUCache.prototype.inspect = function() {\n var proxy = new Map();\n\n var iterator = this.entries(),\n step;\n\n while ((step = iterator.next(), !step.done))\n proxy.set(step.value[0], step.value[1]);\n\n // Trick so that node displays the name of the constructor\n Object.defineProperty(proxy, 'constructor', {\n value: LRUCache,\n enumerable: false\n });\n\n return proxy;\n};\n\nif (typeof Symbol !== 'undefined')\n LRUCache.prototype[Symbol.for('nodejs.util.inspect.custom')] = LRUCache.prototype.inspect;\n\n/**\n * Static @.from function taking an arbitrary iterable & converting it into\n * a structure.\n *\n * @param {Iterable} iterable - Target iterable.\n * @param {function} Keys - Array class for storing keys.\n * @param {function} Values - Array class for storing values.\n * @param {number} capacity - Cache's capacity.\n * @return {LRUCache}\n */\nLRUCache.from = function(iterable, Keys, Values, capacity) {\n if (arguments.length < 2) {\n capacity = iterables.guessLength(iterable);\n\n if (typeof capacity !== 'number')\n throw new Error('mnemonist/lru-cache.from: could not guess iterable length. Please provide desired capacity as last argument.');\n }\n else if (arguments.length === 2) {\n capacity = Keys;\n Keys = null;\n Values = null;\n }\n\n var cache = new LRUCache(Keys, Values, capacity);\n\n forEach(iterable, function(value, key) {\n cache.set(key, value);\n });\n\n return cache;\n};\n\n/**\n * Exporting.\n */\nmodule.exports = LRUCache;\n","/**\n * Mnemonist LRUMap\n * =================\n *\n * Variant of the LRUCache class that leverages an ES6 Map instead of an object.\n * It might be faster for some use case but it is still hard to understand\n * when a Map can outperform an object in v8.\n */\nvar LRUCache = require('./lru-cache.js'),\n forEach = require('obliterator/foreach'),\n typed = require('./utils/typed-arrays.js'),\n iterables = require('./utils/iterables.js');\n\n/**\n * LRUMap.\n *\n * @constructor\n * @param {function} Keys - Array class for storing keys.\n * @param {function} Values - Array class for storing values.\n * @param {number} capacity - Desired capacity.\n */\nfunction LRUMap(Keys, Values, capacity) {\n if (arguments.length < 2) {\n capacity = Keys;\n Keys = null;\n Values = null;\n }\n\n this.capacity = capacity;\n\n if (typeof this.capacity !== 'number' || this.capacity <= 0)\n throw new Error('mnemonist/lru-map: capacity should be positive number.');\n else if (!isFinite(this.capacity) || Math.floor(this.capacity) !== this.capacity)\n throw new Error('mnemonist/lru-map: capacity should be a finite positive integer.');\n\n var PointerArray = typed.getPointerArray(capacity);\n\n this.forward = new PointerArray(capacity);\n this.backward = new PointerArray(capacity);\n this.K = typeof Keys === 'function' ? new Keys(capacity) : new Array(capacity);\n this.V = typeof Values === 'function' ? new Values(capacity) : new Array(capacity);\n\n // Properties\n this.size = 0;\n this.head = 0;\n this.tail = 0;\n this.items = new Map();\n}\n\n/**\n * Method used to clear the structure.\n *\n * @return {undefined}\n */\nLRUMap.prototype.clear = function() {\n this.size = 0;\n this.head = 0;\n this.tail = 0;\n this.items.clear();\n};\n\n/**\n * Method used to set the value for the given key in the cache.\n *\n * @param {any} key - Key.\n * @param {any} value - Value.\n * @return {undefined}\n */\nLRUMap.prototype.set = function(key, value) {\n\n var pointer = this.items.get(key);\n\n // The key already exists, we just need to update the value and splay on top\n if (typeof pointer !== 'undefined') {\n this.splayOnTop(pointer);\n this.V[pointer] = value;\n\n return;\n }\n\n // The cache is not yet full\n if (this.size < this.capacity) {\n pointer = this.size++;\n }\n\n // Cache is full, we need to drop the last value\n else {\n pointer = this.tail;\n this.tail = this.backward[pointer];\n this.items.delete(this.K[pointer]);\n }\n\n // Storing key & value\n this.items.set(key, pointer);\n this.K[pointer] = key;\n this.V[pointer] = value;\n\n // Moving the item at the front of the list\n this.forward[pointer] = this.head;\n this.backward[this.head] = pointer;\n this.head = pointer;\n};\n\n/**\n * Method used to set the value for the given key in the cache.\n *\n * @param {any} key - Key.\n * @param {any} value - Value.\n * @return {{evicted: boolean, key: any, value: any}} An object containing the\n * key and value of an item that was overwritten or evicted in the set\n * operation, as well as a boolean indicating whether it was evicted due to\n * limited capacity. Return value is null if nothing was evicted or overwritten\n * during the set operation.\n */\nLRUMap.prototype.setpop = function(key, value) {\n var oldValue = null;\n var oldKey = null;\n\n var pointer = this.items.get(key);\n\n // The key already exists, we just need to update the value and splay on top\n if (typeof pointer !== 'undefined') {\n this.splayOnTop(pointer);\n oldValue = this.V[pointer];\n this.V[pointer] = value;\n return {evicted: false, key: key, value: oldValue};\n }\n\n // The cache is not yet full\n if (this.size < this.capacity) {\n pointer = this.size++;\n }\n\n // Cache is full, we need to drop the last value\n else {\n pointer = this.tail;\n this.tail = this.backward[pointer];\n oldValue = this.V[pointer];\n oldKey = this.K[pointer];\n this.items.delete(oldKey);\n }\n\n // Storing key & value\n this.items.set(key, pointer);\n this.K[pointer] = key;\n this.V[pointer] = value;\n\n // Moving the item at the front of the list\n this.forward[pointer] = this.head;\n this.backward[this.head] = pointer;\n this.head = pointer;\n\n // Return object if eviction took place, otherwise return null\n if (oldKey) {\n return {evicted: true, key: oldKey, value: oldValue};\n }\n else {\n return null;\n }\n};\n\n/**\n * Method used to check whether the key exists in the cache.\n *\n * @param {any} key - Key.\n * @return {boolean}\n */\nLRUMap.prototype.has = function(key) {\n return this.items.has(key);\n};\n\n/**\n * Method used to get the value attached to the given key. Will move the\n * related key to the front of the underlying linked list.\n *\n * @param {any} key - Key.\n * @return {any}\n */\nLRUMap.prototype.get = function(key) {\n var pointer = this.items.get(key);\n\n if (typeof pointer === 'undefined')\n return;\n\n this.splayOnTop(pointer);\n\n return this.V[pointer];\n};\n\n/**\n * Method used to get the value attached to the given key. Does not modify\n * the ordering of the underlying linked list.\n *\n * @param {any} key - Key.\n * @return {any}\n */\nLRUMap.prototype.peek = function(key) {\n var pointer = this.items.get(key);\n\n if (typeof pointer === 'undefined')\n return;\n\n return this.V[pointer];\n};\n\n/**\n * Methods that can be reused as-is from LRUCache.\n */\nLRUMap.prototype.splayOnTop = LRUCache.prototype.splayOnTop;\nLRUMap.prototype.forEach = LRUCache.prototype.forEach;\nLRUMap.prototype.keys = LRUCache.prototype.keys;\nLRUMap.prototype.values = LRUCache.prototype.values;\nLRUMap.prototype.entries = LRUCache.prototype.entries;\n\n/**\n * Attaching the #.entries method to Symbol.iterator if possible.\n */\nif (typeof Symbol !== 'undefined')\n LRUMap.prototype[Symbol.iterator] = LRUMap.prototype.entries;\n\n/**\n * Convenience known methods.\n */\nLRUMap.prototype.inspect = LRUCache.prototype.inspect;\n\n/**\n * Static @.from function taking an arbitrary iterable & converting it into\n * a structure.\n *\n * @param {Iterable} iterable - Target iterable.\n * @param {function} Keys - Array class for storing keys.\n * @param {function} Values - Array class for storing values.\n * @param {number} capacity - Cache's capacity.\n * @return {LRUMap}\n */\nLRUMap.from = function(iterable, Keys, Values, capacity) {\n if (arguments.length < 2) {\n capacity = iterables.guessLength(iterable);\n\n if (typeof capacity !== 'number')\n throw new Error('mnemonist/lru-cache.from: could not guess iterable length. Please provide desired capacity as last argument.');\n }\n else if (arguments.length === 2) {\n capacity = Keys;\n Keys = null;\n Values = null;\n }\n\n var cache = new LRUMap(Keys, Values, capacity);\n\n forEach(iterable, function(value, key) {\n cache.set(key, value);\n });\n\n return cache;\n};\n\n/**\n * Exporting.\n */\nmodule.exports = LRUMap;\n","/**\n * Mnemonist LRUMapWithDelete\n * ===========================\n *\n * An extension of LRUMap with delete functionality.\n */\n\nvar LRUMap = require('./lru-map.js'),\n forEach = require('obliterator/foreach'),\n typed = require('./utils/typed-arrays.js'),\n iterables = require('./utils/iterables.js');\n\n// The only complication with deleting items is that the LRU's\n// performance depends on having a fixed-size list of pointers; the\n// doubly-linked-list is happy to expand and contract.\n//\n// On delete, we record the position of the former item's pointer in a\n// list of \"holes\" in the pointer array. On insert, if there is a hole\n// the new pointer slots in to fill the hole; otherwise, it is\n// appended as usual. (Note: we are only talking here about the\n// internal pointer list. setting or getting an item promotes it\n// to the top of the LRU ranking no matter what came before)\n\nfunction LRUMapWithDelete(Keys, Values, capacity) {\n if (arguments.length < 2) {\n LRUMap.call(this, Keys);\n }\n else {\n LRUMap.call(this, Keys, Values, capacity);\n }\n var PointerArray = typed.getPointerArray(this.capacity);\n this.deleted = new PointerArray(this.capacity);\n this.deletedSize = 0;\n}\n\nfor (var k in LRUMap.prototype)\n LRUMapWithDelete.prototype[k] = LRUMap.prototype[k];\nif (typeof Symbol !== 'undefined')\n LRUMapWithDelete.prototype[Symbol.iterator] = LRUMap.prototype[Symbol.iterator];\n\n/**\n * Method used to clear the structure.\n *\n * @return {undefined}\n */\nLRUMapWithDelete.prototype.clear = function() {\n LRUMap.prototype.clear.call(this);\n this.deletedSize = 0;\n};\n\n/**\n * Method used to set the value for the given key in the cache.\n *\n * @param {any} key - Key.\n * @param {any} value - Value.\n * @return {undefined}\n */\nLRUMapWithDelete.prototype.set = function(key, value) {\n\n var pointer = this.items.get(key);\n\n // The key already exists, we just need to update the value and splay on top\n if (typeof pointer !== 'undefined') {\n this.splayOnTop(pointer);\n this.V[pointer] = value;\n\n return;\n }\n\n // The cache is not yet full\n if (this.size < this.capacity) {\n if (this.deletedSize > 0) {\n // If there is a \"hole\" in the pointer list, reuse it\n pointer = this.deleted[--this.deletedSize];\n }\n else {\n // otherwise append to the pointer list\n pointer = this.size;\n }\n this.size++;\n }\n\n // Cache is full, we need to drop the last value\n else {\n pointer = this.tail;\n this.tail = this.backward[pointer];\n this.items.delete(this.K[pointer]);\n }\n\n // Storing key & value\n this.items.set(key, pointer);\n this.K[pointer] = key;\n this.V[pointer] = value;\n\n // Moving the item at the front of the list\n this.forward[pointer] = this.head;\n this.backward[this.head] = pointer;\n this.head = pointer;\n};\n\n/**\n * Method used to set the value for the given key in the cache\n *\n * @param {any} key - Key.\n * @param {any} value - Value.\n * @return {{evicted: boolean, key: any, value: any}} An object containing the\n * key and value of an item that was overwritten or evicted in the set\n * operation, as well as a boolean indicating whether it was evicted due to\n * limited capacity. Return value is null if nothing was evicted or overwritten\n * during the set operation.\n */\nLRUMapWithDelete.prototype.setpop = function(key, value) {\n var oldValue = null;\n var oldKey = null;\n\n var pointer = this.items.get(key);\n\n // The key already exists, we just need to update the value and splay on top\n if (typeof pointer !== 'undefined') {\n this.splayOnTop(pointer);\n oldValue = this.V[pointer];\n this.V[pointer] = value;\n return {evicted: false, key: key, value: oldValue};\n }\n\n // The cache is not yet full\n if (this.size < this.capacity) {\n if (this.deletedSize > 0) {\n // If there is a \"hole\" in the pointer list, reuse it\n pointer = this.deleted[--this.deletedSize];\n }\n else {\n // otherwise append to the pointer list\n pointer = this.size;\n }\n this.size++;\n }\n\n // Cache is full, we need to drop the last value\n else {\n pointer = this.tail;\n this.tail = this.backward[pointer];\n oldValue = this.V[pointer];\n oldKey = this.K[pointer];\n this.items.delete(oldKey);\n }\n\n // Storing key & value\n this.items.set(key, pointer);\n this.K[pointer] = key;\n this.V[pointer] = value;\n\n // Moving the item at the front of the list\n this.forward[pointer] = this.head;\n this.backward[this.head] = pointer;\n this.head = pointer;\n\n // Return object if eviction took place, otherwise return null\n if (oldKey) {\n return {evicted: true, key: oldKey, value: oldValue};\n }\n else {\n return null;\n }\n};\n\n/**\n * Method used to delete the entry for the given key in the cache.\n *\n * @param {any} key - Key.\n * @return {boolean} - true if the item was present\n */\nLRUMapWithDelete.prototype.delete = function(key) {\n\n var pointer = this.items.get(key);\n\n if (typeof pointer === 'undefined') {\n return false;\n }\n\n this.items.delete(key);\n\n if (this.size === 1) {\n this.size = 0;\n this.head = 0;\n this.tail = 0;\n this.deletedSize = 0;\n return true;\n }\n\n var previous = this.backward[pointer],\n next = this.forward[pointer];\n\n if (this.head === pointer) {\n this.head = next;\n }\n if (this.tail === pointer) {\n this.tail = previous;\n }\n\n this.forward[previous] = next;\n this.backward[next] = previous;\n\n this.size--;\n this.deleted[this.deletedSize++] = pointer;\n\n return true;\n};\n\n/**\n * Method used to remove and return the value for the given key in the cache.\n *\n * @param {any} key - Key.\n * @param {any} [missing=undefined] - Value to return if item is absent\n * @return {any} The value, if present; the missing indicator if absent\n */\nLRUMapWithDelete.prototype.remove = function(key, missing = undefined) {\n\n var pointer = this.items.get(key);\n\n if (typeof pointer === 'undefined') {\n return missing;\n }\n\n var dead = this.V[pointer];\n this.items.delete(key);\n\n if (this.size === 1) {\n this.size = 0;\n this.head = 0;\n this.tail = 0;\n this.deletedSize = 0;\n return dead;\n }\n\n var previous = this.backward[pointer],\n next = this.forward[pointer];\n\n if (this.head === pointer) {\n this.head = next;\n }\n if (this.tail === pointer) {\n this.tail = previous;\n }\n\n this.forward[previous] = next;\n this.backward[next] = previous;\n\n this.size--;\n this.deleted[this.deletedSize++] = pointer;\n\n return dead;\n};\n\n/**\n * Static @.from function taking an arbitrary iterable & converting it into\n * a structure.\n *\n * @param {Iterable} iterable - Target iterable.\n * @param {function} Keys - Array class for storing keys.\n * @param {function} Values - Array class for storing values.\n * @param {number} capacity - Cache's capacity.\n * @return {LRUMapWithDelete}\n */\nLRUMapWithDelete.from = function(iterable, Keys, Values, capacity) {\n if (arguments.length < 2) {\n capacity = iterables.guessLength(iterable);\n\n if (typeof capacity !== 'number')\n throw new Error('mnemonist/lru-map.from: could not guess iterable length. Please provide desired capacity as last argument.');\n }\n else if (arguments.length === 2) {\n capacity = Keys;\n Keys = null;\n Values = null;\n }\n\n var cache = new LRUMapWithDelete(Keys, Values, capacity);\n\n forEach(iterable, function(value, key) {\n cache.set(key, value);\n });\n\n return cache;\n};\n\nmodule.exports = LRUMapWithDelete;\n","/**\n * Mnemonist Library Endpoint (ESM)\n * =================================\n *\n * Exporting every data structure through a unified endpoint.\n */\nimport * as set from './set.js';\nimport {default as FibonacciHeap} from './fibonacci-heap.js';\nconst MinFibonacciHeap = FibonacciHeap.MinFibonacciHeap;\nconst MaxFibonacciHeap = FibonacciHeap.MaxFibonacciHeap;\nimport {default as Heap} from './heap.js';\nconst MinHeap = Heap.MinHeap;\nconst MaxHeap = Heap.MaxHeap;\nimport {default as SuffixArray} from './suffix-array.js';\nconst GeneralizedSuffixArray = SuffixArray.GeneralizedSuffixArray;\nimport {default as Vector} from './vector.js';\nconst Uint8Vector = Vector.Uint8Vector;\nconst Uint8ClampedVector = Vector.Uint8ClampedVector;\nconst Int8Vector = Vector.Int8Vector;\nconst Uint16Vector = Vector.Uint16Vector;\nconst Int16Vector = Vector.Int16Vector;\nconst Uint32Vector = Vector.Uint32Vector;\nconst Int32Vector = Vector.Int32Vector;\nconst Float32Vector = Vector.Float32Vector;\nconst Float64Vector = Vector.Float64Vector;\nconst PointerVector = Vector.PointerVector;\n\nexport {default as BiMap} from './bi-map.js';\nexport {default as BitSet} from './bit-set.js';\nexport {default as BitVector} from './bit-vector.js';\nexport {default as BloomFilter} from './bloom-filter.js';\nexport {default as BKTree} from './bk-tree.js';\nexport {default as CircularBuffer} from './circular-buffer.js';\nexport {default as DefaultMap} from './default-map.js';\nexport {default as DefaultWeakMap} from './default-weak-map.js';\nexport {default as FixedDeque} from './fixed-deque.js';\nexport {default as StaticDisjointSet} from './static-disjoint-set.js';\nexport {FibonacciHeap, MinFibonacciHeap, MaxFibonacciHeap};\nexport {default as FixedReverseHeap} from './fixed-reverse-heap.js';\nexport {default as FuzzyMap} from './fuzzy-map.js';\nexport {default as FuzzyMultiMap} from './fuzzy-multi-map.js';\nexport {default as HashedArrayTree} from './hashed-array-tree.js';\nexport {Heap, MinHeap, MaxHeap};\nexport {default as StaticIntervalTree} from './static-interval-tree.js';\nexport {default as InvertedIndex} from './inverted-index.js';\nexport {default as KDTree} from './kd-tree.js';\nexport {default as LinkedList} from './linked-list.js';\nexport {default as LRUCache} from './lru-cache.js';\nexport {default as LRUCacheWithDelete} from './lru-cache-with-delete.js';\nexport {default as LRUMap} from './lru-map.js';\nexport {default as LRUMapWithDelete} from './lru-map-with-delete.js';\nexport {default as MultiMap} from './multi-map.js';\nexport {default as MultiSet} from './multi-set.js';\nexport {default as PassjoinIndex} from './passjoin-index.js';\nexport {default as Queue} from './queue.js';\nexport {default as FixedStack} from './fixed-stack.js';\nexport {default as Stack} from './stack.js';\nexport {SuffixArray, GeneralizedSuffixArray};\nexport {set};\nexport {default as SparseQueueSet} from './sparse-queue-set.js';\nexport {default as SparseMap} from './sparse-map.js';\nexport {default as SparseSet} from './sparse-set.js';\nexport {default as SymSpell} from './symspell.js';\nexport {default as Trie} from './trie.js';\nexport {default as TrieMap} from './trie-map.js';\nexport {Vector, Uint8Vector, Uint8ClampedVector, Int8Vector, Uint16Vector, Int16Vector, Uint32Vector, Int32Vector, Float32Vector, Float64Vector, PointerVector};\nexport {default as VPTree} from './vp-tree.js';\n","import { LRUMapWithDelete } from \"mnemonist\";\nimport type { CachedItem } from \"./cacheContainer.ts\";\nimport type { Storage } from \"./storage.ts\";\n\nexport class LRUStorage implements Storage {\n\tprivate cache: LRUMapWithDelete<string, CachedItem>;\n\n\tconstructor({ max = 10_000 }: { max?: number } = {}) {\n\t\tthis.cache = new LRUMapWithDelete<string, CachedItem>(max);\n\t}\n\n\tasync clear(): Promise<void> {\n\t\tthis.cache.clear();\n\t}\n\n\tasync getItem(key: string) {\n\t\tconst item = this.cache.get(key);\n\t\treturn item;\n\t}\n\n\tasync setItem(key: string, content: CachedItem) {\n\t\tthis.cache.set(key, content);\n\t}\n\n\tasync removeItem(key: string) {\n\t\tthis.cache.delete(key);\n\t}\n}\n","'use strict';\n\nvar has = Object.prototype.hasOwnProperty\n , prefix = '~';\n\n/**\n * Constructor to create a storage for our `EE` objects.\n * An `Events` instance is a plain object whose properties are event names.\n *\n * @constructor\n * @private\n */\nfunction Events() {}\n\n//\n// We try to not inherit from `Object.prototype`. In some engines creating an\n// instance in this way is faster than calling `Object.create(null)` directly.\n// If `Object.create(null)` is not supported we prefix the event names with a\n// character to make sure that the built-in object properties are not\n// overridden or used as an attack vector.\n//\nif (Object.create) {\n Events.prototype = Object.create(null);\n\n //\n // This hack is needed because the `__proto__` property is still inherited in\n // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.\n //\n if (!new Events().__proto__) prefix = false;\n}\n\n/**\n * Representation of a single event listener.\n *\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} [once=false] Specify if the listener is a one-time listener.\n * @constructor\n * @private\n */\nfunction EE(fn, context, once) {\n this.fn = fn;\n this.context = context;\n this.once = once || false;\n}\n\n/**\n * Add a listener for a given event.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} once Specify if the listener is a one-time listener.\n * @returns {EventEmitter}\n * @private\n */\nfunction addListener(emitter, event, fn, context, once) {\n if (typeof fn !== 'function') {\n throw new TypeError('The listener must be a function');\n }\n\n var listener = new EE(fn, context || emitter, once)\n , evt = prefix ? prefix + event : event;\n\n if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;\n else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);\n else emitter._events[evt] = [emitter._events[evt], listener];\n\n return emitter;\n}\n\n/**\n * Clear event by name.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} evt The Event name.\n * @private\n */\nfunction clearEvent(emitter, evt) {\n if (--emitter._eventsCount === 0) emitter._events = new Events();\n else delete emitter._events[evt];\n}\n\n/**\n * Minimal `EventEmitter` interface that is molded against the Node.js\n * `EventEmitter` interface.\n *\n * @constructor\n * @public\n */\nfunction EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}\n\n/**\n * Return an array listing the events for which the emitter has registered\n * listeners.\n *\n * @returns {Array}\n * @public\n */\nEventEmitter.prototype.eventNames = function eventNames() {\n var names = []\n , events\n , name;\n\n if (this._eventsCount === 0) return names;\n\n for (name in (events = this._events)) {\n if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);\n }\n\n if (Object.getOwnPropertySymbols) {\n return names.concat(Object.getOwnPropertySymbols(events));\n }\n\n return names;\n};\n\n/**\n * Return the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Array} The registered listeners.\n * @public\n */\nEventEmitter.prototype.listeners = function listeners(event) {\n var evt = prefix ? prefix + event : event\n , handlers = this._events[evt];\n\n if (!handlers) return [];\n if (handlers.fn) return [handlers.fn];\n\n for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {\n ee[i] = handlers[i].fn;\n }\n\n return ee;\n};\n\n/**\n * Return the number of listeners listening to a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Number} The number of listeners.\n * @public\n */\nEventEmitter.prototype.listenerCount = function listenerCount(event) {\n var evt = prefix ? prefix + event : event\n , listeners = this._events[evt];\n\n if (!listeners) return 0;\n if (listeners.fn) return 1;\n return listeners.length;\n};\n\n/**\n * Calls each of the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Boolean} `true` if the event had listeners, else `false`.\n * @public\n */\nEventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return false;\n\n var listeners = this._events[evt]\n , len = arguments.length\n , args\n , i;\n\n if (listeners.fn) {\n if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);\n\n switch (len) {\n case 1: return listeners.fn.call(listeners.context), true;\n case 2: return listeners.fn.call(listeners.context, a1), true;\n case 3: return listeners.fn.call(listeners.context, a1, a2), true;\n case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;\n case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;\n case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;\n }\n\n for (i = 1, args = new Array(len -1); i < len; i++) {\n args[i - 1] = arguments[i];\n }\n\n listeners.fn.apply(listeners.context, args);\n } else {\n var length = listeners.length\n , j;\n\n for (i = 0; i < length; i++) {\n if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);\n\n switch (len) {\n case 1: listeners[i].fn.call(listeners[i].context); break;\n case 2: listeners[i].fn.call(listeners[i].context, a1); break;\n case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;\n case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;\n default:\n if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {\n args[j - 1] = arguments[j];\n }\n\n listeners[i].fn.apply(listeners[i].context, args);\n }\n }\n }\n\n return true;\n};\n\n/**\n * Add a listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.on = function on(event, fn, context) {\n return addListener(this, event, fn, context, false);\n};\n\n/**\n * Add a one-time listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.once = function once(event, fn, context) {\n return addListener(this, event, fn, context, true);\n};\n\n/**\n * Remove the listeners of a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn Only remove the listeners that match this function.\n * @param {*} context Only remove the listeners that have this context.\n * @param {Boolean} once Only remove one-time listeners.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return this;\n if (!fn) {\n clearEvent(this, evt);\n return this;\n }\n\n var listeners = this._events[evt];\n\n if (listeners.fn) {\n if (\n listeners.fn === fn &&\n (!once || listeners.once) &&\n (!context || listeners.context === context)\n ) {\n clearEvent(this, evt);\n }\n } else {\n for (var i = 0, events = [], length = listeners.length; i < length; i++) {\n if (\n listeners[i].fn !== fn ||\n (once && !listeners[i].once) ||\n (context && listeners[i].context !== context)\n ) {\n events.push(listeners[i]);\n }\n }\n\n //\n // Reset the array, or remove it completely if we have no more listeners.\n //\n if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;\n else clearEvent(this, evt);\n }\n\n return this;\n};\n\n/**\n * Remove all listeners, or those of the specified event.\n *\n * @param {(String|Symbol)} [event] The event name.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {\n var evt;\n\n if (event) {\n evt = prefix ? prefix + event : event;\n if (this._events[evt]) clearEvent(this, evt);\n } else {\n this._events = new Events();\n this._eventsCount = 0;\n }\n\n return this;\n};\n\n//\n// Alias methods names because people roll like that.\n//\nEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\nEventEmitter.prototype.addListener = EventEmitter.prototype.on;\n\n//\n// Expose the prefix.\n//\nEventEmitter.prefixed = prefix;\n\n//\n// Allow `EventEmitter` to be imported as module namespace.\n//\nEventEmitter.EventEmitter = EventEmitter;\n\n//\n// Expose the module.\n//\nif ('undefined' !== typeof module) {\n module.exports = EventEmitter;\n}\n","import EventEmitter from './index.js'\n\nexport { EventEmitter }\nexport default EventEmitter\n","export class TimeoutError extends Error {\n\tname = 'TimeoutError';\n\n\tconstructor(message, options) {\n\t\tsuper(message, options);\n\t\tError.captureStackTrace?.(this, TimeoutError);\n\t}\n}\n\nconst getAbortedReason = signal => signal.reason ?? new DOMException('This operation was aborted.', 'AbortError');\n\nexport default function pTimeout(promise, options) {\n\tconst {\n\t\tmilliseconds,\n\t\tfallback,\n\t\tmessage,\n\t\tcustomTimers = {setTimeout, clearTimeout},\n\t\tsignal,\n\t} = options;\n\n\tlet timer;\n\tlet abortHandler;\n\n\tconst wrappedPromise = new Promise((resolve, reject) => {\n\t\tif (typeof milliseconds !== 'number' || Math.sign(milliseconds) !== 1) {\n\t\t\tthrow new TypeError(`Expected \\`milliseconds\\` to be a positive number, got \\`${milliseconds}\\``);\n\t\t}\n\n\t\tif (signal?.aborted) {\n\t\t\treject(getAbortedReason(signal));\n\t\t\treturn;\n\t\t}\n\n\t\tif (signal) {\n\t\t\tabortHandler = () => {\n\t\t\t\treject(getAbortedReason(signal));\n\t\t\t};\n\n\t\t\tsignal.addEventListener('abort', abortHandler, {once: true});\n\t\t}\n\n\t\t// Use .then() instead of async IIFE to preserve stack traces\n\t\t// eslint-disable-next-line promise/prefer-await-to-then, promise/prefer-catch\n\t\tpromise.then(resolve, reject);\n\n\t\tif (milliseconds === Number.POSITIVE_INFINITY) {\n\t\t\treturn;\n\t\t}\n\n\t\t// We create the error outside of `setTimeout` to preserve the stack trace.\n\t\tconst timeoutError = new TimeoutError();\n\n\t\t// `.call(undefined, ...)` is needed for custom timers to avoid context issues\n\t\ttimer = customTimers.setTimeout.call(undefined, () => {\n\t\t\tif (fallback) {\n\t\t\t\ttry {\n\t\t\t\t\tresolve(fallback());\n\t\t\t\t} catch (error) {\n\t\t\t\t\treject(error);\n\t\t\t\t}\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (typeof promise.cancel === 'function') {\n\t\t\t\tpromise.cancel();\n\t\t\t}\n\n\t\t\tif (message === false) {\n\t\t\t\tresolve();\n\t\t\t} else if (message instanceof Error) {\n\t\t\t\treject(message);\n\t\t\t} else {\n\t\t\t\ttimeoutError.message = message ?? `Promise timed out after ${milliseconds} milliseconds`;\n\t\t\t\treject(timeoutError);\n\t\t\t}\n\t\t}, milliseconds);\n\t});\n\n\t// eslint-disable-next-line promise/prefer-await-to-then\n\tconst cancelablePromise = wrappedPromise.finally(() => {\n\t\tcancelablePromise.clear();\n\t\tif (abortHandler && signal) {\n\t\t\tsignal.removeEventListener('abort', abortHandler);\n\t\t}\n\t});\n\n\tcancelablePromise.clear = () => {\n\t\t// `.call(undefined, ...)` is needed for custom timers to avoid context issues\n\t\tcustomTimers.clearTimeout.call(undefined, timer);\n\t\ttimer = undefined;\n\t};\n\n\treturn cancelablePromise;\n}\n","// Port of lower_bound from https://en.cppreference.com/w/cpp/algorithm/lower_bound\n// Used to compute insertion index to keep queue sorted after insertion\nexport default function lowerBound(array, value, comparator) {\n let first = 0;\n let count = array.length;\n while (count > 0) {\n const step = Math.trunc(count / 2);\n let it = first + step;\n if (comparator(array[it], value) <= 0) {\n first = ++it;\n count -= step + 1;\n }\n else {\n count = step;\n }\n }\n return first;\n}\n","import lowerBound from './lower-bound.js';\nexport default class PriorityQueue {\n #queue = [];\n enqueue(run, options) {\n const { priority = 0, id, } = options ?? {};\n const element = {\n priority,\n id,\n run,\n };\n if (this.size === 0 || this.#queue[this.size - 1].priority >= priority) {\n this.#queue.push(element);\n return;\n }\n const index = lowerBound(this.#queue, element, (a, b) => b.priority - a.priority);\n this.#queue.splice(index, 0, element);\n }\n setPriority(id, priority) {\n const index = this.#queue.findIndex((element) => element.id === id);\n if (index === -1) {\n throw new ReferenceError(`No promise function with the id \"${id}\" exists in the queue.`);\n }\n const [item] = this.#queue.splice(index, 1);\n this.enqueue(item.run, { priority, id });\n }\n dequeue() {\n const item = this.#queue.shift();\n return item?.run;\n }\n filter(options) {\n return this.#queue.filter((element) => element.priority === options.priority).map((element) => element.run);\n }\n get size() {\n return this.#queue.length;\n }\n}\n","import { EventEmitter } from 'eventemitter3';\nimport pTimeout from 'p-timeout';\nimport PriorityQueue from './priority-queue.js';\n/**\nPromise queue with concurrency control.\n*/\nexport default class PQueue extends EventEmitter {\n #carryoverIntervalCount;\n #isIntervalIgnored;\n #intervalCount = 0;\n #intervalCap;\n #rateLimitedInInterval = false;\n #rateLimitFlushScheduled = false;\n #interval;\n #intervalEnd = 0;\n #lastExecutionTime = 0;\n #intervalId;\n #timeoutId;\n #queue;\n #queueClass;\n #pending = 0;\n // The `!` is needed because of https://github.com/microsoft/TypeScript/issues/32194\n #concurrency;\n #isPaused;\n // Use to assign a unique identifier to a promise function, if not explicitly specified\n #idAssigner = 1n;\n // Track currently running tasks for debugging\n #runningTasks = new Map();\n /**\n Get or set the default timeout for all tasks. Can be changed at runtime.\n\n Operations will throw a `TimeoutError` if they don't complete within the specified time.\n\n The timeout begins when the operation is dequeued and starts execution, not while it's waiting in the queue.\n\n @example\n ```\n const queue = new PQueue({timeout: 5000});\n\n // Change timeout for all future tasks\n queue.timeout = 10000;\n ```\n */\n timeout;\n constructor(options) {\n super();\n // eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n options = {\n carryoverIntervalCount: false,\n intervalCap: Number.POSITIVE_INFINITY,\n interval: 0,\n concurrency: Number.POSITIVE_INFINITY,\n autoStart: true,\n queueClass: PriorityQueue,\n ...options,\n };\n if (!(typeof options.intervalCap === 'number' && options.intervalCap >= 1)) {\n throw new TypeError(`Expected \\`intervalCap\\` to be a number from 1 and up, got \\`${options.intervalCap?.toString() ?? ''}\\` (${typeof options.intervalCap})`);\n }\n if (options.interval === undefined || !(Number.isFinite(options.interval) && options.interval >= 0)) {\n throw new TypeError(`Expected \\`interval\\` to be a finite number >= 0, got \\`${options.interval?.toString() ?? ''}\\` (${typeof options.interval})`);\n }\n // TODO: Remove this fallback in the next major version\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n this.#carryoverIntervalCount = options.carryoverIntervalCount ?? options.carryoverConcurrencyCount ?? false;\n this.#isIntervalIgnored = options.intervalCap === Number.POSITIVE_INFINITY || options.interval === 0;\n this.#intervalCap = options.intervalCap;\n this.#interval = options.interval;\n this.#queue = new options.queueClass();\n this.#queueClass = options.queueClass;\n this.concurrency = options.concurrency;\n if (options.timeout !== undefined && !(Number.isFinite(options.timeout) && options.timeout > 0)) {\n throw new TypeError(`Expected \\`timeout\\` to be a positive finite number, got \\`${options.timeout}\\` (${typeof options.timeout})`);\n }\n this.timeout = options.timeout;\n this.#isPaused = options.autoStart === false;\n this.#setupRateLimitTracking();\n }\n get #doesIntervalAllowAnother() {\n return this.#isIntervalIgnored || this.#intervalCount < this.#intervalCap;\n }\n get #doesConcurrentAllowAnother() {\n return this.#pending < this.#concurrency;\n }\n #next() {\n this.#pending--;\n if (this.#pending === 0) {\n this.emit('pendingZero');\n }\n this.#tryToStartAnother();\n this.emit('next');\n }\n #onResumeInterval() {\n this.#onInterval(); // Already schedules update\n this.#initializeIntervalIfNeeded();\n this.#timeoutId = undefined;\n }\n get #isIntervalPaused() {\n const now = Date.now();\n if (this.#intervalId === undefined) {\n const delay = this.#intervalEnd - now;\n if (delay < 0) {\n // If the interval has expired while idle, check if we should enforce the interval\n // from the last task execution. This ensures proper spacing between tasks even\n // when the queue becomes empty and then new tasks are added.\n if (this.#lastExecutionTime > 0) {\n const timeSinceLastExecution = now - this.#lastExecutionTime;\n if (timeSinceLastExecution < this.#interval) {\n // Not enough time has passed since the last task execution\n this.#createIntervalTimeout(this.#interval - timeSinceLastExecution);\n return true;\n }\n }\n // Enough time has passed or no previous execution, allow execution\n this.#intervalCount = (this.#carryoverIntervalCount) ? this.#pending : 0;\n }\n else {\n // Act as the interval is pending\n this.#createIntervalTimeout(delay);\n return true;\n }\n }\n return false;\n }\n #createIntervalTimeout(delay) {\n if (this.#timeoutId !== undefined) {\n return;\n }\n this.#timeoutId = setTimeout(() => {\n this.#onResumeInterval();\n }, delay);\n }\n #clearIntervalTimer() {\n if (this.#intervalId) {\n clearInterval(this.#intervalId);\n this.#intervalId = undefined;\n }\n }\n #clearTimeoutTimer() {\n if (this.#timeoutId) {\n clearTimeout(this.#timeoutId);\n this.#timeoutId = undefined;\n }\n }\n #tryToStartAnother() {\n if (this.#queue.size === 0) {\n // We can clear the interval (\"pause\")\n // Because we can redo it later (\"resume\")\n this.#clearIntervalTimer();\n this.emit('empty');\n if (this.#pending === 0) {\n // Clear timeout as well when completely idle\n this.#clearTimeoutTimer();\n this.emit('idle');\n }\n return false;\n }\n let taskStarted = false;\n if (!this.#isPaused) {\n const canInitializeInterval = !this.#isIntervalPaused;\n if (this.#doesIntervalAllowAnother && this.#doesConcurrentAllowAnother) {\n const job = this.#queue.dequeue();\n // Increment interval count immediately to prevent race conditions\n if (!this.#isIntervalIgnored) {\n this.#intervalCount++;\n this.#scheduleRateLimitUpdate();\n }\n this.emit('active');\n this.#lastExecutionTime = Date.now();\n job();\n if (canInitializeInterval) {\n this.#initializeIntervalIfNeeded();\n }\n taskStarted = true;\n }\n }\n return taskStarted;\n }\n #initializeIntervalIfNeeded() {\n if (this.#isIntervalIgnored || this.#intervalId !== undefined) {\n return;\n }\n this.#intervalId = setInterval(() => {\n this.#onInterval();\n }, this.#interval);\n this.#intervalEnd = Date.now() + this.#interval;\n }\n #onInterval() {\n if (this.#intervalCount === 0 && this.#pending === 0 && this.#intervalId) {\n this.#clearIntervalTimer();\n }\n this.#intervalCount = this.#carryoverIntervalCount ? this.#pending : 0;\n this.#processQueue();\n this.#scheduleRateLimitUpdate();\n }\n /**\n Executes all queued functions until it reaches the limit.\n */\n #processQueue() {\n // eslint-disable-next-line no-empty\n while (this.#tryToStartAnother()) { }\n }\n get concurrency() {\n return this.#concurrency;\n }\n set concurrency(newConcurrency) {\n if (!(typeof newConcurrency === 'number' && newConcurrency >= 1)) {\n throw new TypeError(`Expected \\`concurrency\\` to be a number from 1 and up, got \\`${newConcurrency}\\` (${typeof newConcurrency})`);\n }\n this.#concurrency = newConcurrency;\n this.#processQueue();\n }\n async #throwOnAbort(signal) {\n return new Promise((_resolve, reject) => {\n signal.addEventListener('abort', () => {\n reject(signal.reason);\n }, { once: true });\n });\n }\n /**\n Updates the priority of a promise function by its id, affecting its execution order. Requires a defined concurrency limit to take effect.\n\n For example, this can be used to prioritize a promise function to run earlier.\n\n ```js\n import PQueue from 'p-queue';\n\n const queue = new PQueue({concurrency: 1});\n\n queue.add(async () => '🦄', {priority: 1});\n queue.add(async () => '🦀', {priority: 0, id: '🦀'});\n queue.add(async () => '🦄', {priority: 1});\n queue.add(async () => '🦄', {priority: 1});\n\n queue.setPriority('🦀', 2);\n ```\n\n In this case, the promise function with `id: '🦀'` runs second.\n\n You can also deprioritize a promise function to delay its execution:\n\n ```js\n import PQueue from 'p-queue';\n\n const queue = new PQueue({concurrency: 1});\n\n queue.add(async () => '🦄', {priority: 1});\n queue.add(async () => '🦀', {priority: 1, id: '🦀'});\n queue.add(async () => '🦄');\n queue.add(async () => '🦄', {priority: 0});\n\n queue.setPriority('🦀', -1);\n ```\n Here, the promise function with `id: '🦀'` executes last.\n */\n setPriority(id, priority) {\n if (typeof priority !== 'number' || !Number.isFinite(priority)) {\n throw new TypeError(`Expected \\`priority\\` to be a finite number, got \\`${priority}\\` (${typeof priority})`);\n }\n this.#queue.setPriority(id, priority);\n }\n async add(function_, options = {}) {\n // In case `id` is not defined.\n options.id ??= (this.#idAssigner++).toString();\n options = {\n timeout: this.timeout,\n ...options,\n };\n return new Promise((resolve, reject) => {\n // Create a unique symbol for tracking this task\n const taskSymbol = Symbol(`task-${options.id}`);\n this.#queue.enqueue(async () => {\n this.#pending++;\n // Track this running task\n this.#runningTasks.set(taskSymbol, {\n id: options.id,\n priority: options.priority ?? 0, // Match priority-queue default\n startTime: Date.now(),\n timeout: options.timeout,\n });\n try {\n // Check abort signal - if aborted, need to decrement the counter\n // that was incremented in tryToStartAnother\n try {\n options.signal?.throwIfAborted();\n }\n catch (error) {\n // Decrement the counter that was already incremented\n if (!this.#isIntervalIgnored) {\n this.#intervalCount--;\n }\n // Clean up tracking before throwing\n this.#runningTasks.delete(taskSymbol);\n throw error;\n }\n let operation = function_({ signal: options.signal });\n if (options.timeout) {\n operation = pTimeout(Promise.resolve(operation), {\n milliseconds: options.timeout,\n message: `Task timed out after ${options.timeout}ms (queue has ${this.#pending} running, ${this.#queue.size} waiting)`,\n });\n }\n if (options.signal) {\n operation = Promise.race([operation, this.#throwOnAbort(options.signal)]);\n }\n const result = await operation;\n resolve(result);\n this.emit('completed', result);\n }\n catch (error) {\n reject(error);\n this.emit('error', error);\n }\n finally {\n // Remove from running tasks\n this.#runningTasks.delete(taskSymbol);\n // Use queueMicrotask to prevent deep recursion while maintaining timing\n queueMicrotask(() => {\n this.#next();\n });\n }\n }, options);\n this.emit('add');\n this.#tryToStartAnother();\n });\n }\n async addAll(functions, options) {\n return Promise.all(functions.map(async (function_) => this.add(function_, options)));\n }\n /**\n Start (or resume) executing enqueued tasks within concurrency limit. No need to call this if queue is not paused (via `options.autoStart = false` or by `.pause()` method.)\n */\n start() {\n if (!this.#isPaused) {\n return this;\n }\n this.#isPaused = false;\n this.#processQueue();\n return this;\n }\n /**\n Put queue execution on hold.\n */\n pause() {\n this.#isPaused = true;\n }\n /**\n Clear the queue.\n */\n clear() {\n this.#queue = new this.#queueClass();\n // Note: We don't clear #runningTasks as those tasks are still running\n // They will be removed when they complete in the finally block\n // Force synchronous update since clear() should have immediate effect\n this.#updateRateLimitState();\n }\n /**\n Can be called multiple times. Useful if you for example add additional items at a later time.\n\n @returns A promise that settles when the queue becomes empty.\n */\n async onEmpty() {\n // Instantly resolve if the queue is empty\n if (this.#queue.size === 0) {\n return;\n }\n await this.#onEvent('empty');\n }\n /**\n @returns A promise that settles when the queue size is less than the given limit: `queue.size < limit`.\n\n If you want to avoid having the queue grow beyond a certain size you can `await queue.onSizeLessThan()` before adding a new item.\n\n Note that this only limits the number of items waiting to start. There could still be up to `concurrency` jobs already running that this call does not include in its calculation.\n */\n async onSizeLessThan(limit) {\n // Instantly resolve if the queue is empty.\n if (this.#queue.size < limit) {\n return;\n }\n await this.#onEvent('next', () => this.#queue.size < limit);\n }\n /**\n The difference with `.onEmpty` is that `.onIdle` guarantees that all work from the queue has finished. `.onEmpty` merely signals that the queue is empty, but it could mean that some promises haven't completed yet.\n\n @returns A promise that settles when the queue becomes empty, and all promises have completed; `queue.size === 0 && queue.pending === 0`.\n */\n async onIdle() {\n // Instantly resolve if none pending and if nothing else is queued\n if (this.#pending === 0 && this.#queue.size === 0) {\n return;\n }\n await this.#onEvent('idle');\n }\n /**\n The difference with `.onIdle` is that `.onPendingZero` only waits for currently running tasks to finish, ignoring queued tasks.\n\n @returns A promise that settles when all currently running tasks have completed; `queue.pending === 0`.\n */\n async onPendingZero() {\n if (this.#pending === 0) {\n return;\n }\n await this.#onEvent('pendingZero');\n }\n /**\n @returns A promise that settles when the queue becomes rate-limited due to intervalCap.\n */\n async onRateLimit() {\n if (this.isRateLimited) {\n return;\n }\n await this.#onEvent('rateLimit');\n }\n /**\n @returns A promise that settles when the queue is no longer rate-limited.\n */\n async onRateLimitCleared() {\n if (!this.isRateLimited) {\n return;\n }\n await this.#onEvent('rateLimitCleared');\n }\n /**\n @returns A promise that rejects when any task in the queue errors.\n\n Use with `Promise.race([queue.onError(), queue.onIdle()])` to fail fast on the first error while still resolving normally when the queue goes idle.\n\n Important: The promise returned by `add()` still rejects. You must handle each `add()` promise (for example, `.catch(() => {})`) to avoid unhandled rejections.\n\n @example\n ```\n import PQueue from 'p-queue';\n\n const queue = new PQueue({concurrency: 2});\n\n queue.add(() => fetchData(1)).catch(() => {});\n queue.add(() => fetchData(2)).catch(() => {});\n queue.add(() => fetchData(3)).catch(() => {});\n\n // Stop processing on first error\n try {\n await Promise.race([\n queue.onError(),\n queue.onIdle()\n ]);\n } catch (error) {\n queue.pause(); // Stop processing remaining tasks\n console.error('Queue failed:', error);\n }\n ```\n */\n // eslint-disable-next-line @typescript-eslint/promise-function-async\n async onError() {\n return new Promise((_resolve, reject) => {\n const handleError = (error) => {\n this.off('error', handleError);\n reject(error);\n };\n this.on('error', handleError);\n });\n }\n async #onEvent(event, filter) {\n return new Promise(resolve => {\n const listener = () => {\n if (filter && !filter()) {\n return;\n }\n this.off(event, listener);\n resolve();\n };\n this.on(event, listener);\n });\n }\n /**\n Size of the queue, the number of queued items waiting to run.\n */\n get size() {\n return this.#queue.size;\n }\n /**\n Size of the queue, filtered by the given options.\n\n For example, this can be used to find the number of items remaining in the queue with a specific priority level.\n */\n sizeBy(options) {\n // eslint-disable-next-line unicorn/no-array-callback-reference\n return this.#queue.filter(options).length;\n }\n /**\n Number of running items (no longer in the queue).\n */\n get pending() {\n return this.#pending;\n }\n /**\n Whether the queue is currently paused.\n */\n get isPaused() {\n return this.#isPaused;\n }\n #setupRateLimitTracking() {\n // Only schedule updates when rate limiting is enabled\n if (this.#isIntervalIgnored) {\n return;\n }\n // Wire up to lifecycle events that affect rate limit state\n // Only 'add' and 'next' can actually change rate limit state\n this.on('add', () => {\n if (this.#queue.size > 0) {\n this.#scheduleRateLimitUpdate();\n }\n });\n this.on('next', () => {\n this.#scheduleRateLimitUpdate();\n });\n }\n #scheduleRateLimitUpdate() {\n // Skip if rate limiting is not enabled or already scheduled\n if (this.#isIntervalIgnored || this.#rateLimitFlushScheduled) {\n return;\n }\n this.#rateLimitFlushScheduled = true;\n queueMicrotask(() => {\n this.#rateLimitFlushScheduled = false;\n this.#updateRateLimitState();\n });\n }\n #updateRateLimitState() {\n const previous = this.#rateLimitedInInterval;\n const shouldBeRateLimited = !this.#isIntervalIgnored\n && this.#intervalCount >= this.#intervalCap\n && this.#queue.size > 0;\n if (shouldBeRateLimited !== previous) {\n this.#rateLimitedInInterval = shouldBeRateLimited;\n this.emit(shouldBeRateLimited ? 'rateLimit' : 'rateLimitCleared');\n }\n }\n /**\n Whether the queue is currently rate-limited due to intervalCap.\n */\n get isRateLimited() {\n return this.#rateLimitedInInterval;\n }\n /**\n Whether the queue is saturated. Returns `true` when:\n - All concurrency slots are occupied and tasks are waiting, OR\n - The queue is rate-limited and tasks are waiting\n\n Useful for detecting backpressure and potential hanging tasks.\n\n ```js\n import PQueue from 'p-queue';\n\n const queue = new PQueue({concurrency: 2});\n\n // Backpressure handling\n if (queue.isSaturated) {\n console.log('Queue is saturated, waiting for capacity...');\n await queue.onSizeLessThan(queue.concurrency);\n }\n\n // Monitoring for stuck tasks\n setInterval(() => {\n if (queue.isSaturated) {\n console.warn(`Queue saturated: ${queue.pending} running, ${queue.size} waiting`);\n }\n }, 60000);\n ```\n */\n get isSaturated() {\n return (this.#pending === this.#concurrency && this.#queue.size > 0)\n || (this.isRateLimited && this.#queue.size > 0);\n }\n /**\n The tasks currently being executed. Each task includes its `id`, `priority`, `startTime`, and `timeout` (if set).\n\n Returns an array of task info objects.\n\n ```js\n import PQueue from 'p-queue';\n\n const queue = new PQueue({concurrency: 2});\n\n // Add tasks with IDs for better debugging\n queue.add(() => fetchUser(123), {id: 'user-123'});\n queue.add(() => fetchPosts(456), {id: 'posts-456', priority: 1});\n\n // Check what's running\n console.log(queue.runningTasks);\n // => [{\n // id: 'user-123',\n // priority: 0,\n // startTime: 1759253001716,\n // timeout: undefined\n // }, {\n // id: 'posts-456',\n // priority: 1,\n // startTime: 1759253001916,\n // timeout: undefined\n // }]\n ```\n */\n get runningTasks() {\n // Return fresh array with fresh objects to prevent mutations\n return [...this.#runningTasks.values()].map(task => ({ ...task }));\n }\n}\n/**\nError thrown when a task times out.\n\n@example\n```\nimport PQueue, {TimeoutError} from 'p-queue';\n\nconst queue = new PQueue({timeout: 1000});\n\ntry {\n await queue.add(() => someTask());\n} catch (error) {\n if (error instanceof TimeoutError) {\n console.log('Task timed out');\n }\n}\n```\n*/\nexport { TimeoutError } from 'p-timeout';\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.instanceOfHashable = exports.guessType = exports.guessObjectType = exports.TYPE_MAP = void 0;\n/**\n * Type mapping rules.\n */\nexports.TYPE_MAP = {\n Array: 'array',\n Int8Array: 'typedarray',\n Uint8Array: 'typedarray',\n Uint8ClampedArray: 'typedarray',\n Int16Array: 'typedarray',\n Uint16Array: 'typedarray',\n Int32Array: 'typedarray',\n Uint32Array: 'typedarray',\n Float32Array: 'typedarray',\n Float64Array: 'typedarray',\n BigUint64Array: 'typedarray',\n BigInt64Array: 'typedarray',\n Buffer: 'typedarray',\n Map: 'map',\n Set: 'set',\n Date: 'date',\n String: 'string',\n Number: 'number',\n BigInt: 'bigint',\n Boolean: 'boolean',\n Object: 'object',\n};\n/**\n * Guess object type\n * @param obj analyzed object\n * @return object type\n */\nconst guessObjectType = (obj) => {\n if (obj === null) {\n return 'null';\n }\n if ((0, exports.instanceOfHashable)(obj)) {\n return 'hashable';\n }\n const type = obj?.constructor?.name ?? 'unknown';\n return exports.TYPE_MAP[type] || 'unknown';\n};\nexports.guessObjectType = guessObjectType;\n/**\n * Guess variable type\n * @param obj analyzed variable\n * @return variable type\n */\nconst guessType = (obj) => {\n const type = typeof obj;\n return type !== 'object' ? type : (0, exports.guessObjectType)(obj);\n};\nexports.guessType = guessType;\n/**\n * Identify if object is instance of Hashable interface\n * @param object analyzed variable\n * @return true if object has toHashableString property and this property is function\n * otherwise return false\n */\nconst instanceOfHashable = (object) => {\n return typeof object.toHashableString === 'function';\n};\nexports.instanceOfHashable = instanceOfHashable;\n//# sourceMappingURL=typeGuess.js.map","\"use strict\";\n/* eslint-disable @typescript-eslint/no-explicit-any */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports._mapSort = exports._map = exports._objectSort = exports._object = exports._setCoerce = exports._set = exports._setSort = exports._setSortCoerce = exports._typedArray = exports._typedArraySort = exports._array = exports._arraySort = exports._date = exports._dateCoerce = exports._functionTrim = exports._functionTrimCoerce = exports._function = exports._functionCoerce = exports._null = exports._nullCoerce = exports._undefined = exports._undefinedCoerce = exports._symbol = exports._symbolCoerce = exports._boolean = exports._booleanCoerce = exports._bigInt = exports._bigIntCoerce = exports._number = exports._numberCoerce = exports._stringTrim = exports._stringTrimCoerce = exports._string = exports._stringCoerce = exports._hashable = exports.PREFIX = void 0;\nconst typeGuess_1 = require(\"./typeGuess\");\n/**\n * Prefixes that used when type coercion is disabled\n */\nexports.PREFIX = {\n string: '<:s>',\n number: '<:n>',\n bigint: '<:bi>',\n boolean: '<:b>',\n symbol: '<:smbl>',\n undefined: '<:undf>',\n null: '<:null>',\n function: '<:func>',\n array: '',\n date: '<:date>',\n set: '<:set>',\n map: '<:map>',\n};\n/**\n * Converts Hashable to string\n * @private\n * @param obj object to convert\n * @returns object string representation\n */\nfunction _hashable(obj) {\n return obj.toHashableString();\n}\nexports._hashable = _hashable;\n/**\n * Converts string to string\n * @private\n * @param obj object to convert\n * @return object string representation\n */\nfunction _stringCoerce(obj) {\n return obj;\n}\nexports._stringCoerce = _stringCoerce;\n/**\n * Converts string to string\n * @private\n * @param obj object to convert\n * @return object string representation\n */\nfunction _string(obj) {\n return exports.PREFIX.string + ':' + obj;\n}\nexports._string = _string;\n/**\n * Converts string to string\n * @private\n * @param obj object to convert\n * @return object string representation\n */\nfunction _stringTrimCoerce(obj) {\n return obj.replace(/(\\s+|\\t|\\r\\n|\\n|\\r)/gm, ' ').trim();\n}\nexports._stringTrimCoerce = _stringTrimCoerce;\n/**\n * Converts string to string\n * @private\n * @param obj object to convert\n * @return object string representation\n */\nfunction _stringTrim(obj) {\n return exports.PREFIX.string + ':' + obj.replace(/(\\s+|\\t|\\r\\n|\\n|\\r)/gm, ' ').trim();\n}\nexports._stringTrim = _stringTrim;\n/**\n * Converts number to string\n * @private\n * @param obj object to convert\n * @return object string representation\n */\nfunction _numberCoerce(obj) {\n return obj.toString();\n}\nexports._numberCoerce = _numberCoerce;\n/**\n * Converts number to string\n * @private\n * @param obj object to convert\n * @return object string representation\n */\nfunction _number(obj) {\n return `${exports.PREFIX.number}:${obj}`;\n}\nexports._number = _number;\n/**\n * Converts BigInt to string\n * @private\n * @param obj object to convert\n * @return object string representation\n */\nfunction _bigIntCoerce(obj) {\n return obj.toString();\n}\nexports._bigIntCoerce = _bigIntCoerce;\n/**\n * Converts BigInt to string\n * @private\n * @param obj object to convert\n * @return object string representation\n */\nfunction _bigInt(obj) {\n return `${exports.PREFIX.bigint}:${obj.toString()}`;\n}\nexports._bigInt = _bigInt;\n/**\n * Converts boolean to string\n * @private\n * @param obj object to convert\n * @return object string representation\n */\nfunction _booleanCoerce(obj) {\n return obj ? '1' : '0';\n}\nexports._booleanCoerce = _booleanCoerce;\n/**\n * Converts boolean to string\n * @private\n * @param obj object to convert\n * @return object string representation\n */\nfunction _boolean(obj) {\n return exports.PREFIX.boolean + ':' + obj.toString();\n}\nexports._boolean = _boolean;\n/**\n * Converts symbol to string\n * @private\n * @param obj object to convert\n * @return object string representation\n */\nfunction _symbolCoerce() {\n return exports.PREFIX.symbol;\n}\nexports._symbolCoerce = _symbolCoerce;\n/**\n * Converts symbol to string\n * @private\n * @param obj object to convert\n * @return object string representation\n */\nfunction _symbol(obj) {\n return exports.PREFIX.symbol + ':' + obj.toString();\n}\nexports._symbol = _symbol;\n/**\n * Converts undefined to string\n * @private\n * @param obj object to convert\n * @return object string representation\n */\nfunction _undefinedCoerce() {\n return '';\n}\nexports._undefinedCoerce = _undefinedCoerce;\n/**\n * Converts undefined to string\n * @private\n * @param obj object to convert\n * @return object string representation\n */\nfunction _undefined() {\n return exports.PREFIX.undefined;\n}\nexports._undefined = _undefined;\n/**\n * Converts null to string\n * @private\n * @param obj object to convert\n * @return object string representation\n */\nfunction _nullCoerce() {\n return '';\n}\nexports._nullCoerce = _nullCoerce;\n/**\n * Converts null to string\n * @private\n * @param obj object to convert\n * @return object string representation\n */\nfunction _null() {\n return exports.PREFIX.null;\n}\nexports._null = _null;\n/**\n * Converts function to string\n * @private\n * @param obj object to convert\n * @return object string representation\n */\n// eslint-disable-next-line @typescript-eslint/ban-types\nfunction _functionCoerce(obj) {\n return obj.name + '=>' + obj.toString();\n}\nexports._functionCoerce = _functionCoerce;\n/**\n * Converts function to string\n * @private\n * @param obj object to convert\n * @return object string representation\n */\n// eslint-disable-next-line @typescript-eslint/ban-types\nfunction _function(obj) {\n return exports.PREFIX.function + ':' + obj.name + '=>' + obj.toString();\n}\nexports._function = _function;\n/**\n * Converts function to string\n * @private\n * @param obj object to convert\n * @return object string representation\n */\n// eslint-disable-next-line @typescript-eslint/ban-types\nfunction _functionTrimCoerce(obj) {\n return (obj.name +\n '=>' +\n obj\n .toString()\n .replace(/(\\s+|\\t|\\r\\n|\\n|\\r)/gm, ' ')\n .trim());\n}\nexports._functionTrimCoerce = _functionTrimCoerce;\n/**\n * Converts function to string\n * @private\n * @param obj object to convert\n * @return object string representation\n */\n// eslint-disable-next-line @typescript-eslint/ban-types\nfunction _functionTrim(obj) {\n return (exports.PREFIX.function +\n ':' +\n obj.name +\n '=>' +\n obj\n .toString()\n .replace(/(\\s+|\\t|\\r\\n|\\n|\\r)/gm, ' ')\n .trim());\n}\nexports._functionTrim = _functionTrim;\n/**\n * Converts date to string\n * @private\n * @param obj object to convert\n * @return object string representation\n */\nfunction _dateCoerce(obj) {\n return obj.toISOString();\n}\nexports._dateCoerce = _dateCoerce;\n/**\n * Converts date to string\n * @private\n * @param obj object to convert\n * @return object string representation\n */\nfunction _date(obj) {\n return exports.PREFIX.date + ':' + obj.toISOString();\n}\nexports._date = _date;\n/**\n * Converts array to string\n * @private\n * @param obj object to convert\n * @return object string representation\n */\nfunction _arraySort(obj) {\n const stringifiers = this;\n return ('[' +\n obj\n .map((item) => {\n return stringifiers[(0, typeGuess_1.guessType)(item)](item);\n })\n .sort()\n .toString() +\n ']');\n}\nexports._arraySort = _arraySort;\n/**\n * Converts array to string\n * @private\n * @param obj object to convert\n * @return object string representation\n */\nfunction _array(obj) {\n const stringifiers = this;\n return ('[' +\n obj\n .map((item) => {\n return stringifiers[(0, typeGuess_1.guessType)(item)](item);\n })\n .toString() +\n ']');\n}\nexports._array = _array;\n/**\n * Converts TypedArray to string\n * @private\n * @param obj object to convert\n * @return object string representation\n */\nfunction _typedArraySort(obj) {\n const stringifiers = this;\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-explicit-any\n const values = Array.prototype.slice.call(obj);\n return ('[' +\n values\n .map((num) => {\n return stringifiers[(0, typeGuess_1.guessType)(num)](num);\n })\n .sort()\n .toString() +\n ']');\n}\nexports._typedArraySort = _typedArraySort;\n/**\n * Converts TypedArray to string\n * @private\n * @param obj object to convert\n * @return object string representation\n */\nfunction _typedArray(obj) {\n const stringifiers = this;\n const values = Array.prototype.slice.call(obj);\n return ('[' +\n values\n .map((num) => {\n return stringifiers[(0, typeGuess_1.guessType)(num)](num);\n })\n .toString() +\n ']');\n}\nexports._typedArray = _typedArray;\n/**\n * Converts set to string\n * @private\n * @param obj object to convert\n * @return object string representation\n */\nfunction _setSortCoerce(obj) {\n return _arraySort.call(this, Array.from(obj));\n}\nexports._setSortCoerce = _setSortCoerce;\n/**\n * Converts set to string\n * @private\n * @param obj object to convert\n * @return object string representation\n */\nfunction _setSort(obj) {\n return `${exports.PREFIX.set}:${_arraySort.call(this, Array.from(obj))}`;\n}\nexports._setSort = _setSort;\n/**\n * Converts set to string\n * @private\n * @param obj object to convert\n * @return object string representation\n */\nfunction _set(obj) {\n return `${exports.PREFIX.set}:${_array.call(this, Array.from(obj))}`;\n}\nexports._set = _set;\n/**\n * Converts set to string\n * @private\n * @param obj object to convert\n * @return object string representation\n */\nfunction _setCoerce(obj) {\n return _array.call(this, Array.from(obj));\n}\nexports._setCoerce = _setCoerce;\n/**\n * Converts object to string\n * @private\n * @param obj object to convert\n * @return object string representation\n */\nfunction _object(obj) {\n const stringifiers = this;\n const keys = Object.keys(obj);\n const objArray = [];\n for (const key of keys) {\n const val = obj[key];\n const valT = (0, typeGuess_1.guessType)(val);\n objArray.push(key + ':' + stringifiers[valT](val));\n }\n return '{' + objArray.toString() + '}';\n}\nexports._object = _object;\n/**\n * Converts object to string\n * @private\n * @param obj object to convert\n * @return object string representation\n */\nfunction _objectSort(obj) {\n const stringifiers = this;\n const keys = Object.keys(obj).sort();\n const objArray = [];\n for (const key of keys) {\n const val = obj[key];\n const valT = (0, typeGuess_1.guessType)(val);\n objArray.push(key + ':' + stringifiers[valT](val));\n }\n return '{' + objArray.toString() + '}';\n}\nexports._objectSort = _objectSort;\n/**\n * Converts map to string\n * @private\n * @param obj object to convert\n * @return object string representation\n */\nfunction _map(obj) {\n const stringifiers = this;\n const arr = Array.from(obj);\n const mapped = [];\n for (const item of arr) {\n const [key, value] = item;\n mapped.push([stringifiers[(0, typeGuess_1.guessType)(key)](key), stringifiers[(0, typeGuess_1.guessType)(value)](value)]);\n }\n return '[' + mapped.join(';') + ']';\n}\nexports._map = _map;\n/**\n * Converts map to string\n * @private\n * @param obj object to convert\n * @return object string representation\n */\nfunction _mapSort(obj) {\n const stringifiers = this;\n const arr = Array.from(obj);\n const mapped = [];\n for (const item of arr) {\n const [key, value] = item;\n mapped.push([stringifiers[(0, typeGuess_1.guessType)(key)](key), stringifiers[(0, typeGuess_1.guessType)(value)](value)]);\n }\n return '[' + mapped.sort().join(';') + ']';\n}\nexports._mapSort = _mapSort;\n//# sourceMappingURL=stringifiers.js.map","\"use strict\";\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.objectSorter = void 0;\nconst str = __importStar(require(\"./stringifiers\"));\nconst typeGuess_1 = require(\"./typeGuess\");\n/**\n * Object sorter consturctor\n * @param options object transformation options\n * @return function that transforms object to strings\n */\nconst objectSorter = (options) => {\n const { sort, coerce, trim } = {\n sort: true,\n coerce: true,\n trim: false,\n ...options,\n };\n const sortOptions = {\n array: typeof sort === 'boolean' ? sort : sort?.array ?? false,\n typedArray: typeof sort === 'boolean' ? false : sort?.typedArray ?? false,\n object: typeof sort === 'boolean' ? sort : sort?.object ?? false,\n set: typeof sort === 'boolean' ? sort : sort?.set ?? false,\n map: typeof sort === 'boolean' ? sort : sort?.map ?? false,\n };\n const coerceOptions = {\n boolean: typeof coerce === 'boolean' ? coerce : coerce?.boolean ?? false,\n number: typeof coerce === 'boolean' ? coerce : coerce?.number ?? false,\n bigint: typeof coerce === 'boolean' ? coerce : coerce?.bigint ?? false,\n string: typeof coerce === 'boolean' ? coerce : coerce?.string ?? false,\n undefined: typeof coerce === 'boolean' ? coerce : coerce?.undefined ?? false,\n null: typeof coerce === 'boolean' ? coerce : coerce?.null ?? false,\n symbol: typeof coerce === 'boolean' ? coerce : coerce?.symbol ?? false,\n function: typeof coerce === 'boolean' ? coerce : coerce?.function ?? false,\n date: typeof coerce === 'boolean' ? coerce : coerce?.date ?? false,\n set: typeof coerce === 'boolean' ? coerce : coerce?.set ?? false,\n };\n const trimOptions = {\n string: typeof trim === 'boolean' ? trim : trim?.string ?? false,\n function: typeof trim === 'boolean' ? trim : trim?.function ?? false,\n };\n const stringifiers = {\n // eslint-disable-next-line @typescript-eslint/ban-types\n unknown: function _unknown(obj) {\n // `unknonw` - is a typo, saved for backward compatibility\n const constructorName = obj.constructor?.name ?? 'unknonw';\n let objectName = 'unknown';\n if (typeof obj.toString === 'function') {\n objectName = obj.toString();\n }\n else if (Object.keys(obj).length > 0) {\n objectName = JSON.stringify(obj);\n }\n return `<:${constructorName}>:${objectName}`;\n },\n };\n stringifiers['hashable'] = str._hashable.bind(stringifiers);\n if (trimOptions.string) {\n stringifiers['string'] = coerceOptions.string\n ? str._stringTrimCoerce.bind(stringifiers)\n : str._stringTrim.bind(stringifiers);\n }\n else {\n stringifiers['string'] = coerceOptions.string\n ? str._stringCoerce.bind(stringifiers)\n : str._string.bind(stringifiers);\n }\n stringifiers['number'] = coerceOptions.number\n ? str._numberCoerce.bind(stringifiers)\n : str._number.bind(stringifiers);\n stringifiers['bigint'] = coerceOptions.bigint\n ? str._bigIntCoerce.bind(stringifiers)\n : str._bigInt.bind(stringifiers);\n stringifiers['boolean'] = coerceOptions.boolean\n ? str._booleanCoerce.bind(stringifiers)\n : str._boolean.bind(stringifiers);\n stringifiers['symbol'] = coerceOptions.symbol\n ? str._symbolCoerce.bind(stringifiers)\n : str._symbol.bind(stringifiers);\n stringifiers['undefined'] = coerceOptions.undefined\n ? str._undefinedCoerce.bind(stringifiers)\n : str._undefined.bind(stringifiers);\n stringifiers['null'] = coerceOptions.null\n ? str._nullCoerce.bind(stringifiers)\n : str._null.bind(stringifiers);\n if (trimOptions.function) {\n stringifiers['function'] = coerceOptions.function\n ? str._functionTrimCoerce.bind(stringifiers)\n : str._functionTrim.bind(stringifiers);\n }\n else {\n stringifiers['function'] = coerceOptions.function\n ? str._functionCoerce.bind(stringifiers)\n : str._function.bind(stringifiers);\n }\n stringifiers['date'] = coerceOptions.date\n ? str._dateCoerce.bind(stringifiers)\n : str._date.bind(stringifiers);\n stringifiers['array'] = sortOptions.array\n ? str._arraySort.bind(stringifiers)\n : str._array.bind(stringifiers);\n stringifiers['typedarray'] = sortOptions.typedArray\n ? str._typedArraySort.bind(stringifiers)\n : str._typedArray.bind(stringifiers);\n if (sortOptions.set) {\n stringifiers['set'] = coerceOptions.set\n ? str._setSortCoerce.bind(stringifiers)\n : str._setSort.bind(stringifiers);\n }\n else {\n stringifiers['set'] = coerceOptions.set\n ? str._setCoerce.bind(stringifiers)\n : str._set.bind(stringifiers);\n }\n stringifiers['object'] = sortOptions.object\n ? str._objectSort.bind(stringifiers)\n : str._object.bind(stringifiers);\n stringifiers['map'] = sortOptions.map\n ? str._mapSort.bind(stringifiers)\n : str._map.bind(stringifiers);\n /**\n * Serializes object to string\n * @param obj object\n */\n function objectToString(obj) {\n return stringifiers[(0, typeGuess_1.guessType)(obj)](obj);\n }\n return objectToString;\n};\nexports.objectSorter = objectSorter;\n//# sourceMappingURL=objectSorter.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.hasher = void 0;\nconst crypto_1 = require(\"crypto\");\nconst objectSorter_1 = require(\"./objectSorter\");\n/**\n * Default hash algorithm\n */\nconst DEFAULT_ALG = 'sha256';\n/**\n * Default hash string enoding\n */\nconst DEFAULT_ENC = 'hex';\n/**\n * Hasher constructor\n * @param options hasher options\n * @return hasher instance\n */\nconst hasher = (options) => {\n const sortObject = (0, objectSorter_1.objectSorter)(options);\n /**\n * Object hash function\n * @param obj object to hash\n * @param opts hasher options\n * @returns hash string\n */\n const hash = (obj, opts) => {\n const alg = opts?.alg || options?.alg || DEFAULT_ALG;\n const enc = opts?.enc || options?.enc || DEFAULT_ENC;\n const sorted = sortObject(obj);\n return (0, crypto_1.createHash)(alg).update(sorted).digest(enc);\n };\n return {\n hash,\n sort: sortObject,\n sortObject,\n };\n};\nexports.hasher = hasher;\n//# sourceMappingURL=hasher.js.map","import { hasher } from \"node-object-hash\";\n\n/**\n * Hash function for creating consistent, deterministic hashes from JavaScript objects.\n * Used primarily for generating cache keys and ensuring object equality checks.\n *\n * @param obj - Any JavaScript object to hash\n * @returns String hash of the object\n */\nconst { hash } = hasher({\n\tsort: true, // Ensures consistent order for object properties\n\tcoerce: true, // Converts values to a consistent type (e.g., numbers to strings)\n});\n\nexport default hash;\n","import PQueue from \"p-queue\";\nimport type { CacheContainer } from \"./cacheContainer.ts\";\nimport hash from \"./hash.ts\";\n\nconst revalidationQueues: Record<string, PQueue> = {};\n\ntype WithCacheOptions<Parameters, Result> = {\n /** An optional prefix to prepend to the cache key for namespacing purposes */\n prefix?: string;\n /** An optional function to calculate a cache key based on the function parameters. Defaults to hashing the parameters */\n calculateKey?: (input: Parameters) => string;\n /** An optional predicate function to determine whether a result should be cached. Useful for filtering out error responses or invalid data */\n shouldStore?: (result: Awaited<Result>) => boolean;\n /**\n * Concurrency limit for background revalidation tasks in the queue\n * @default 1\n */\n revalidationConcurrency?: number;\n /**\n * Time in milliseconds after which cached content is considered \"expired\" and no longer fresh.\n * During this period, cached content is returned immediately without revalidation.\n * When set to 0 along with staleTimeMs=0, caching is disabled entirely.\n * @default undefined - cache indefinitely\n */\n cacheTimeMs?: number;\n /**\n * Time in milliseconds after which cached content is considered \"stale\".\n * Used for Stale-While-Revalidate: stale content is returned immediately while revalidation happens in the background.\n * Must be greater than cacheTimeMs to be effective. When both cacheTimeMs and staleTimeMs are 0, caching is disabled.\n * @default 0 (no stale caching)\n */\n staleTimeMs?: number;\n};\n\n/**\n * Creates a withCache wrapper function for a specific cache container.\n * Implements Stale-While-Revalidate (SWR) caching strategy:\n * - Fresh content (within cacheTimeMs): returned immediately without revalidation\n * - Stale content (within staleTimeMs after expiration): returned immediately while revalidating in background\n * - Expired content (beyond staleTimeMs): waits for fresh revalidation\n * - No caching (when cacheTimeMs=0 and staleTimeMs=0): function executes every time\n *\n * @param container - The cache container instance to store and retrieve cached values\n * @returns A withCache function bound to the provided container\n */\nexport const withCacheFactory = (container: CacheContainer) => {\n /**\n * Wraps an async function with caching and Stale-While-Revalidate (SWR) logic.\n * Multiple concurrent calls with the same parameters share the same cache entry and revalidation queue.\n *\n * @param operation - The async function to wrap with caching\n * @param options - Caching and revalidation options\n * @returns An async wrapper function that returns cached or freshly computed results\n */\n const withCache = <\n Parameters extends Array<unknown>,\n Result extends Promise<unknown>,\n >(\n operation: (...parameters: Parameters) => Result,\n {\n cacheTimeMs,\n staleTimeMs = 0,\n calculateKey = hash,\n revalidationConcurrency: concurrency = 1,\n prefix = \"default\",\n shouldStore = () => true,\n }: WithCacheOptions<Parameters, Result> = {},\n ) => {\n return async (...parameters: Parameters): Promise<Result> => {\n const key = `${operation.name}:${prefix}:${\n calculateKey ? calculateKey(parameters) : hash(parameters)\n }` as const;\n\n const queueName = `${operation.name}:${prefix}` as const;\n\n revalidationQueues[queueName] =\n revalidationQueues[queueName] ??\n new PQueue({\n concurrency,\n });\n revalidationQueues[queueName].concurrency = concurrency;\n\n const cachedResponse = await container.getItem<Awaited<Result>>(key);\n\n const refreshedItem = async () => {\n const result = await operation(...parameters);\n if (shouldStore(result)) {\n await container.setItem(key, result, {\n ttl: cacheTimeMs ?? null,\n staleTtl: staleTimeMs,\n });\n }\n return result;\n };\n\n /**\n * The easiest case: no caching at all\n */\n if (cacheTimeMs === 0 && staleTimeMs === 0) {\n return operation(...parameters);\n }\n\n /**\n * The easy case: we have a valid cached response\n */\n if (cachedResponse && !cachedResponse.meta.expired) {\n return cachedResponse.content;\n }\n\n /**\n * Stale-While-Revalidate strategy:\n * If the cached response is expired but stale\n * we return the stale value immediately and revalidate in the background\n */\n if (cachedResponse?.meta.expired && cachedResponse?.meta.stale) {\n if (\n !revalidationQueues[queueName].runningTasks.some(\n (t) => t.id === key && t.startTime,\n )\n ) {\n revalidationQueues[queueName].add(refreshedItem, {\n id: key,\n });\n }\n\n return cachedResponse.content;\n }\n\n const result = await refreshedItem();\n return result;\n };\n };\n return withCache;\n};\n"],"x_google_ignoreList":[3,4,5,6,7,8,9,10,11,12,13,14,15,16,18,19,20,21,22,23,24,25,26,27],"mappings":"2nBAEA,MAAaA,EAAQC,EAAO,gBAAgB,CC0B5C,IAAa,EAAb,KAA4B,CAC3B,YAAY,EAA0B,CAAlB,KAAA,QAAA,EAEpB,MAAa,QAAW,EAMtB,CACD,IAAM,EAAO,MAAM,KAAK,QAAQ,QAAQ,EAAI,CAE5C,GAAI,CAAC,EAAM,OAEX,IAAM,EAAS,CACd,QAAS,EAAK,QACd,KAAM,CACL,UAAW,EAAK,KAAK,UACrB,QAAS,KAAK,cAAc,EAAK,CACjC,MAAO,KAAK,YAAY,EAAK,CAC7B,CACD,CAED,GAAI,EAAO,KAAK,SAAW,CAAC,EAAO,KAAK,MAAO,CAC9C,MAAM,KAAK,SAAS,EAAI,CACxB,OAGD,OAAO,EAGR,MAAa,QACZ,EACA,EACA,EACgB,CAChB,IAAM,EAAe,CACpB,IAAK,KACL,SAAU,KACV,GAAG,EACH,CAEKE,EAA2C,CAChD,UAAW,KAAK,KAAK,CACrB,IAAK,EAAa,IAClB,SAAU,EAAa,SACvB,CAED,MAAM,KAAK,QAAQ,QAAQ,EAAK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